PageRenderTime 24ms CodeModel.GetById 19ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/beta/AR/rep_dailySale.asp

http://github.com/khaneh/Orders
ASP | 254 lines | 236 code | 15 blank | 3 comment | 26 complexity | 2573de91d63202477208af8267a05de7 MD5 | raw file
  1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2'Order (2)
  3PageTitle="����� ����"
  4SubmenuItem=11
  5if not Auth("C" , 1) then NotAllowdToViewThisPage()
  6%>
  7<!--#include file="top.asp" -->
  8<STYLE>
  9	.GetCustTbl {font-family:tahoma; background-color: #DDDDDD; width:630; direction: RTL; }
 10	.GetCustTbl td {padding:2; font-size: 9pt; height:25;}
 11	.GetCustInp { font-family:tahoma; font-size: 9pt;}
 12	.CusTableHeader {background-color: #33AACC; text-align: center; font-weight:bold;}
 13	.CustContactTable {font-family:tahoma; width:100%; border:1 solid black; direction: RTL; background-color:#CCCCCC;}
 14	.CustContactTable td {padding:5;}
 15	.CustTable {font-family:tahoma; width:80%; border:1 solid black; direction: RTL; background-color:black;}
 16	.CustTable td {padding:5;}
 17	.CustTable a {text-decoration:none;color:#000088}
 18	.CustTable a:hover {text-decoration:underline;}
 19	.CusTD1 {background-color: #CCCC66; text-align: left; font-weight:bold;}
 20	.CusTD2 {background-color: #DDDDDD; direction: LTR; text-align: right; font-size:9pt;}
 21	.CusTD3 {background-color: #DDDDDD; direction: LTR; text-align: center; font-size:9pt;}
 22	.CusTD4 {background-color: #CCCC66; direction: LTR; text-align: center; font-size:9pt;}
 23	.CustTable4 {font-family:tahoma; direction: RTL; width:100%; height:100%; background-color:#C3DBEB;}
 24	.Inp1 {font-size: 9pt;background-color: #CCE;border: none;direction: LTR;}
 25</STYLE>
 26<% 
 27if Auth("C" , 2) then 
 28	input_date_start=	sqlSafe(request("input_date_start"))
 29	input_date_end=		sqlSafe(request("input_date_end"))
 30else
 31	input_date_start=	sqlSafe(request("input_date"))
 32	input_date_end=		sqlSafe(request("input_date"))
 33end if
 34
 35	if request("fullyApplied")="on" then 
 36		fullyApplied=1
 37	else 
 38		fullyApplied=0
 39	end if
 40'ON ERROR RESUME Next
 41Ord =	request("Ord")	
 42page=	request("page")	
 43select case Ord
 44	case "1":
 45		order="EffectiveDate"
 46	case "-1":
 47		order="EffectiveDate DESC"
 48	case "2":
 49		order="AccountTitle"
 50	case "-2":
 51		order="AccountTitle DESC"
 52	case "3":
 53		order="AmountOriginal"
 54	case "-3":
 55		order="AmountOriginal DESC"
 56	case "4":
 57		order="RemainedAmount"
 58	case "-4":
 59		order="RemainedAmount DESC"
 60	Case "5":
 61		order = "arBalance"
 62	Case "-5":
 63		order = "arBalance DESC"
 64	case "6":
 65		order="FullyApplied"
 66	case "-6":
 67		order="FullyApplied DESC"
 68	case else:
 69		order="EffectiveDate"
 70		Ord=1
 71end select	
 72mySQL="select SUM(AmountOriginal) as AmountOriginal,SUM(RemainedAmount) as RemainedAmount, MAX(arBalance) as arBalance, count(ARItems.ID) AS totalItems from ARItems inner join Accounts on ARItems.Account=Accounts.ID where (ARItems.EffectiveDate between '" & input_date_start & "' and '" & input_date_end & "') and ARItems.Type=1 and ARItems.voided=0"
 73if fullyApplied=1 then mySQL=mySQL&" AND FullyApplied=0"
 74
 75%>
 76<TABLE dir=rtl align=center width=640 cellspacing=2 cellpadding=2 style="border:2 solid #330066;">	
 77<%
 78set rs=Conn.Execute (mySQL)
 79if rs.eof then
 80%>	<tr>
 81		<td bgcolor="#BBBBBB" height="30" colspan="7" align=center><b>��� .</b></td>
 82	</tr>
 83<%	Else %>
 84	<TR bgcolor="#CCCCEE" >
 85		<TD colspan=2 rowspan=2 title=" <%=rs("totalItems")%> ���� ">
 86			<form method=post>
 87				&nbsp;�� ����� <input class=Inp1 type=text name='input_date_start' size=10 value='<%=input_date_start%>' style="width:55px;">
 88				&nbsp;�� ����� <input class=Inp1 type=text name='input_date_end' size=10 value='<%=input_date_end%>' style="width:55px;">
 89				&nbsp;��� ����� �������<input type=CHECKBOX name='fullyApplied' <% if fullyApplied=1 then response.write("checked") %>>
 90				<input type=submit value='Ȑ��'>
 91				<input type=hidden name="Ord" value='<%=Ord%>'>
 92				<input type=hidden name="Page" value='<%=page%>'>
 93			</form>
 94		</TD>
 95
 96		<TD width=70 >��� ����</TD>
 97		<TD width=70 >��� �����</TD>
 98		<TD width=70 >��� ����� ���ȝ��</TD>
 99		<TD width=70 ></TD>
100	</TR>
101	<TR bgcolor="#CCCCEE" >
102		<TD width=70 dir=ltr align=right><b><%=Separate(rs("AmountOriginal"))%></b></TD>
103		<TD width=70 dir=ltr align=right><b><%=Separate(rs("RemainedAmount"))%></b></TD>
104		<TD width=70 dir=ltr align=right><b><%=Separate(rs("arBalance"))%></b></TD>
105		<TD></TD>
106	</TR>
107	<TR bgcolor="black" height="2">
108		<TD colspan="6" style="padding:0;"></TD>
109	</TR>
110<%
111	rs.close
112
113	if ord<0 then
114		style="background-color: #33CC99;"
115		arrow="<br><span style='font-family:webdings'>6 6 6</span>"
116	else
117		style="background-color: #33CC99;"
118		arrow="<br><span style='font-family:webdings'>5 5 5</span>"
119	end if
120%>
121	<TR bgcolor="eeeeee" style="cursor:hand;" title="����� �����">
122		<TD width=50 onclick='go2Page(1,-1);' style="<%if abs(ord)=1 then response.write style%>">�����<%if abs(ord)=1 then response.write arrow%></TD>
123		<TD width='*'  onclick='go2Page(1,-2);' style="<%if abs(ord)=2 then response.write style%>">��� ����<%if abs(ord)=2 then response.write arrow%></TD>
124		<TD width=70 onclick='go2Page(1,-3);' style="<%if abs(ord)=3 then response.write style%>">����<%if abs(ord)=3 then response.write arrow%></TD>
125		<TD width=70 onclick='go2Page(1,-4);' style="<%if abs(ord)=4 then response.write style%>">�����<%if abs(ord)=4 then response.write arrow%></TD>
126		
127		<TD width=70 onclick='go2Page(1,-5);' style="<%if abs(ord)=5 then response.write style%>">����� ����<%if abs(ord)=5 then response.write arrow%></TD>
128		<TD width=70 onclick='go2Page(1,-6);' style="<%if abs(ord)=6 then response.write style%>">�����<%if abs(ord)=6 then response.write arrow%></TD>
129	</TR>
130	<TR bgcolor="eeeeee" >
131		<TD colspan=6 height=2 bgcolor=0></TD>
132	</TR>
133<%		
134	SumAmount=0
135	SumRemain=0
136	tmpCounter=0
137
138	mySQL="select Accounts.arBalance,Accounts.AccountTitle, ARItems.* from ARItems inner join Accounts on ARItems.Account=Accounts.ID where (ARItems.EffectiveDate between '" & input_date_start & "' and '" & input_date_end & "')  and ARItems.Type=1 and ARItems.voided=0" 
139	if fullyApplied=1 then mySQL=mySQL&" AND ARItems.FullyApplied=0"
140	mySQL= mySQL & " ORDER BY " & order
141	Set rs=Server.CreateObject("ADODB.Recordset")'Conn.Execute(mySQL)
142
143	PageSize = 50
144	rs.PageSize = PageSize
145'response.write mySql
146	rs.CursorLocation=3 'in ADOVBS_INC adUseClient=3
147	rs.Open mySQL ,Conn,3
148	TotalPages = rs.PageCount
149
150	CurrentPage=1
151
152	if isnumeric(Page) then
153		pp=clng(Page)
154		if pp <= TotalPages AND pp > 0 then
155			CurrentPage = pp
156		end if
157	end if
158
159	if not rs.eof then
160		rs.AbsolutePage=CurrentPage
161	end if
162
163	if rs.eof then
164%>		<tr>
165			<td bgcolor="#BBBBBB" height="30" colspan="7" align=center><b>��� .</b></td>
166		</tr>
167<%	else
168		Do While NOT rs.eof AND (rs.AbsolutePage = CurrentPage)
169			tmpCounter = tmpCounter + 1
170			if tmpCounter mod 2 = 1 then
171				tmpColor="#FFFFFF"
172				tmpColor2="#FFFFBB"
173			Else
174				tmpColor="#DDDDDD"
175				tmpColor2="#EEEEBB"
176			End if 
177	%>
178			<TR <%
179			if rs("voided")="False" then 
180				response.write "bgcolor='" & tmpColor & "'" 
181			else 
182				response.write "bgcolor='#FFEEEE' title='���� ���'"
183			end if
184			%>" >
185				<TD><%=Separate(rs("EffectiveDate"))%></TD>
186				<TD title="������ ����"><A href='../CRM/AccountInfo.asp?act=show&selectedCustomer=<%=rs("Account")%>'><%=rs("AccountTitle")%></A></TD>
187				<TD dir=ltr align=right title="������ ������ ������"><a href='AccountReport.asp?act=showInvoice&invoice=<%=rs("Link")%>'><%=Separate(rs("AmountOriginal"))%></a></TD>
188				<TD dir=ltr align=right><%=Separate(rs("RemainedAmount"))%></TD>
189				<TD dir=ltr align=right title="����� ����" <% if cdbl(rs("arBalance"))<0 then response.write("style='background-color:#F55;'") %>><a href='AccountReport.asp?sys=AR&act=show&selectedCustomer=<%=rs("Account")%>'><%=Separate(rs("arBalance"))%></a></TD>
190				<TD ><% 
191					if rs("FullyApplied")="True" then 
192						response.write("����� ���")
193					else
194						response.write("<b style='color:red;'>����� ����</b>")
195					end if
196					%>
197				</TD>
198			</TR>
199			  
200	<% 
201		rs.moveNext
202		Loop
203
204		if TotalPages > 1 then
205			pageCols=20
206%>			
207			<TR bgcolor="eeeeee" >
208				<TD colspan=6 height=2 bgcolor=0></TD>
209			</TR>
210			<TR class="RepTableTitle">
211				<TD bgcolor="#CCCCEE" height="30" colspan="6">
212				<table width=100% cellspacing=0 style="cursor:hand;color:gray;">
213				<tr>
214					<td style="height:25;border-bottom:1 solid black;" colspan=<%=pagecols%>>
215						<b>���� <%=CurrentPage%> �� <%=TotalPages%></b>
216						&nbsp;&nbsp;<a href="javascript:go2Page(<%=CurrentPage+1%>,0);">���� ��� &gt;</a>
217					</td>
218				</tr>
219				<tr>
220<%				for i=1 to TotalPages 
221					if i = CurrentPage then 
222%>						<td style="color:black;"><b>[<%=i%>]</b></td>
223<%					else
224%>						<td onclick="go2Page(<%=i%>,0);"><%=i%></td>
225<%					end if 
226					if i mod pageCols = 0 then response.write "</tr><tr>" 
227				next 
228
229%>				</tr>
230				</table>
231				</TD>
232			</TR>
233<%		end if
234	end if
235end if
236%>
237		</TABLE>
238		<SCRIPT LANGUAGE="JavaScript">
239		function go2Page(p,ord) {
240			if(ord==0){
241				ord=<%=Ord%>;
242			}
243			else if(ord==<%=Ord%>){
244				ord= 0-ord;
245			}
246			document.getElementsByName('Page')[0].value=p;
247			document.getElementsByName('Ord')[0].value=ord;
248			document.forms[0].submit();
249			//str = '?act=show&FromDate=' + escape('<%=FromDate%>') + '&ToDate=' + escape('<%=ToDate%>') + '&Ord=' + escape(ord) + '&p=' + escape(p);  
250			//window.location = str;
251		}
252		</SCRIPT>
253
254<!--#include file="tah.asp" -->