/beta/cashReg/CashRegAdminReport.asp
ASP | 559 lines | 514 code | 37 blank | 8 comment | 58 complexity | e2efd9a76d7e2099be5db75530773661 MD5 | raw file
1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><% 2'CashRegister (9) 3PageTitle="����� �� �����" 4SubmenuItem=6 5if not Auth(9 , 6) then NotAllowdToViewThisPage() 6%> 7<!--#include file="top.asp" --> 8<!--#include File="../include_farsiDateHandling.asp"--> 9<!--#include File="../include_JS_InputMasks.asp"--> 10<STYLE> 11 .CClosTable {font-family:tahoma; font-size:9pt; direction: RTL; border:2 solid #330099;} 12 .CClosTable td {padding:5;border:1pt solid gray;} 13 .CClosTable a {text-decoration:none; color:#222288;} 14 .CClosTable a:hover {text-decoration:underline;} 15 .CClosTableTitle {background-color: #CCCCFF; text-align: center; font-weight:bold; height:50;} 16 .CClosTableHeader {background-color: #BBBBBB; text-align: center; font-weight:bold;} 17 .CClosTableFooter {background-color: #BBBBBB; direction: LTR; } 18 .CClosTR1 {background-color: #DDDDDD;} 19 .CClosTR2 {background-color: #FFFFFF;} 20 .CClosTR3 {background-color: #EEEEFF;} 21 .RepTable {font-family:tahoma; font-size:9pt; direction: RTL; } 22 .RepTable td {padding:5;border:1pt solid gray;} 23 .RepTable a {text-decoration:none; color:#222288;} 24 .RepTable a:hover {text-decoration:underline;} 25 .RepTableTitle {background-color: #CCCCFF; text-align: center; font-weight:bold; height:50;} 26 .RepTableHeader {background-color: #BBBBBB; text-align: center; font-weight:bold;} 27 .RepTableFooter {background-color: #BBBBBB; direction: LTR; } 28 .RepTR1 {background-color: #DDDDDD;} 29 .RepTR2 {background-color: #FFFFFF;} 30 .GenInput { font-family:tahoma; font-size: 9pt;} 31 .GenButton { font-family:tahoma; font-size: 9pt; border: 1px solid black; } 32</STYLE> 33<% 34function Link2Trace(OrderNo) 35 Link2Trace="<A HREF='../order/TraceOrder.asp?act=show&order="& OrderNo & "' target='_balnk'>"& OrderNo & "</A>" 36end function 37 38if request("act")="showCashRegReport" AND request("CashRegID")<>"" then 39 CashRegID=request("CashRegID") 40 if not isnumeric(CashRegID) then 41 response.write "<br>" 42 call showAlert ("���� ������ ���� �����",CONST_MSG_ERROR) 43 response.end 44 end if 45 46 mySQL="SELECT Bankers.Name AS BankerName, CashRegisters.*, Users.RealName FROM CashRegisters INNER JOIN Users ON CashRegisters.Cashier = Users.ID INNER JOIN Bankers ON CashRegisters.Banker = Bankers.ID WHERE (CashRegisters.ID='"& CashRegID & "')" 47 Set RS1= conn.Execute(mySQL) 48 if RS1.eof then 49 response.write "<br>" 50 call showAlert ("���� ������ ���� �����",CONST_MSG_ERROR) 51 response.end 52 else 53 BankerName=RS1("BankerName") 54 CashRegName=RS1("NameDate") 55 CashierName=RS1("RealName") 56 OpenningDate=RS1("OpenDate") 57 OpenningAmount=cdbl(RS1("OpeningAmount")) 58 totalCashAmountA=Separate(RS1("cashAmountA")) ' SAM 59 totalCashAmountB=Separate(RS1("cashAmountB")) ' SAM 60 totalChequeAmount=Separate(RS1("chequeAmount")) 61 totalChequeQtty=RS1("chequeQtty") 62 TotalAmount=Separate(cdbl(RS1("cashAmountA")) + cdbl(RS1("cashAmountB")) + cdbl(RS1("chequeAmount"))) 63 64 Set RS1=nothing 65 end if 66 67 mySQL="SELECT CashRegisterLines.*, ISNULL(Receipts.CashAmount,0) AS CashAmount, ISNULL(Receipts.ChequeAmount,0) AS ChequeAmount, Receipts.ChequeQtty, Payments.CashAmount AS PayAmount, Accounts_1.AccountTitle AS PayAccTitle, Accounts_2.AccountTitle AS RcpAccTitle, Accounts_1.ID AS PayAccID, Accounts_2.ID AS RcpAccID FROM CashRegisterLines LEFT OUTER JOIN Accounts Accounts_1 INNER JOIN Payments ON Accounts_1.ID = Payments.Account ON CashRegisterLines.Link = Payments.ID LEFT OUTER JOIN Accounts Accounts_2 INNER JOIN Receipts ON Accounts_2.ID = Receipts.Customer ON CashRegisterLines.Link = Receipts.ID WHERE (CashRegisterLines.CashReg = '"& CashRegID & "') ORDER BY CashRegisterLines.ID" 68 Set RS1 = conn.execute(mySQL) 69 Remained = 0 70 Totalcredit = 0 71 TotalDebit = 0 72 tempCounter = 0 73 74 if Not (RS1.EOF AND OpenningAmount=0) then 75%> 76 <br> 77 <TABLE class="RepTable" width='100%' align='center'> 78 <TR> 79 <TD class="RepTableTitle" colspan=9 dir='rtl' align='center'><br><B>����� ����� <span dir='LTR'><%=CashRegName%></span> - <%=CashierName%></B><BR>(���: <%=BankerName%>)<br> 80 </TD> 81 </TR> 82 <TR class="RepTableHeader"> 83 <TD>#</TD> 84 <TD width="50px">�����</TD> 85 <TD width="10px">����</TD> 86 <TD width="60px">�������</TD> 87 <td width="30px">���/�</td> 88 <TD>����</TD> 89 <TD width="60px">������</TD> 90 <TD width="60px">��������</TD> 91 <TD width="60px">�����</TD> 92 </TR> 93<% 94 if OpenningAmount<>0 then 95 Remained = OpenningAmount 96 Credit = OpenningAmount 97 Totalcredit = OpenningAmount 98 tempCounter = 0 99%> <TR class='<%if tempCounter MOD 2 = 0 then response.write "RepTR1" else response.write "RepTR2"%>'> 100 <td><%=tempCounter%></td> 101 <td dir='LTR'><%=CashRegName%></td> 102 <td colspan='3'>����� ����� �����</td> 103 <td dir='LTR' align='right'><%=Separate(Debit)%> </td> 104 <td dir='LTR' align='right'><%=Separate(Credit)%> </td> 105 <td dir='LTR' align='right'><%=Separate(Remained)%> </td> 106 </TR> 107<% end if 108 While Not (RS1.EOF) 109 tempCounter=tempCounter+1 110 if RS1("Type")=1 then 111 sourceLink="../AR/AccountReport.asp?act=showReceipt&receipt="& RS1("Link") 112' voidLink="Void.asp?act=voidReceipt&receipt="& RS1("Link") 113 Description = "������ " 114 myAND="" 115 116 CashAmount=cdbl(RS1("CashAmount")) 117 ChequeAmount=cdbl(RS1("ChequeAmount")) 118 119 if CashAmount<>0 then 120 Description=Description & "��� " 121 myAND="� " 122 end if 123 if RS1("ChequeQtty")<>0 then 124 Description=Description & myAND & RS1("ChequeQtty") & " ���� �� " 125 end if 126 AccID=RS1("RcpAccID") 127 AccTitle=RS1("RcpAccTitle") 128 Credit= CashAmount + ChequeAmount 129 Debit=0 130 131 elseif RS1("Type")=2 then 132 sourceLink="../AR/AccountReport.asp?act=showPayment&payment="& RS1("Link") 133' voidLink="Void.asp?act=voidPayment&payment="& RS1("Link") 134 Description = "������ ���" 135 AccID=RS1("PayAccID") 136 AccTitle=RS1("PayAccTitle") 137 Credit=0 138 Debit=RS1("PayAmount") 139 else 140 sourceLink="javascript:void(0);" 141' voidLink="javascript:void(0);" 142 Description = "" 143 AccountInfo="" 144 Credit=0 145 Debit=0 146 end if 147 TotalDebit = TotalDebit + CLng(Debit) 148 Totalcredit = Totalcredit + CLng(Credit) 149 Remained = Remained + CLng(Credit) - CLng(Debit) 150%> <TR class='<%if tempCounter MOD 2 = 0 then response.write "RepTR1" else response.write "RepTR2"%>'> 151 <td><%=tempCounter%></td> 152 <td dir='LTR'><%=RS1("Date")%></td> 153 <td dir='LTR'><%=RS1("Time")%></td> 154 <td><A HREF='<%=sourceLink%>' target='_blank'><%=Description%></A></td> 155 <td align="center"><% 156 if CBool(rs1("isA")) then 157 response.write("<b>���</b>") 158 else 159 response.write("�") 160 end if 161 %></td> 162 <td><A HREF='../AR/AccountReport.asp?act=show&selectedCustomer=<%=AccID%>' target='_blank'><%=AccTitle%></A></td> 163 <td dir='LTR' align='right'><%=Separate(Debit)%></td> 164 <td dir='LTR' align='right'><%=Separate(Credit) %></td> 165 <td dir='LTR' align='right'> 166<% if RS1("Voided")=TRUE then 167%> <div style="position:absolute;width:650;"><hr style="color:red;"></div> 168<% response.write "xx xx xx" '& Separate(remained) & "xx" 169 TotalDebit = TotalDebit - CLng(Debit) 170 Totalcredit = Totalcredit - CLng(Credit) 171 Remained = Remained - CLng(Credit) + CLng(Debit) 172 else 173 response.write Separate(remained) 174 end if 175%> </td> 176 </TR> 177<% 178 RS1.MoveNext 179 Wend 180 if Remained>=0 then 181 remainedColor="green" 182 else 183 remainedColor="red" 184 end if 185%> 186 <TR> 187 <TD class="RepTableFooter" colspan='6'> : ���</td> 188 <TD class="RepTableFooter" align='right'><%=Separate(totaldebit)%></td> 189 <TD class="RepTableFooter" align='right'><%=Separate(totalcredit)%></td> 190 <TD class="RepTableFooter" align='right'><FONT COLOR='<%=remainedColor%>'><%=Separate(Remained)%></FONT></td> 191 </TR> 192 </TABLE> 193 <br> 194 <TABLE class="CClosTable" width='90%' align='center' style="page-break-before:always;"> 195<% 196 mySQL="SELECT ReceivedCheques.ChequeNo, ReceivedCheques.ChequeDate, ReceivedCheques.Description, ReceivedCheques.BankOfOrigin, receivedCheques.Amount, CashRegisterLines.* FROM ReceivedCheques INNER JOIN Receipts ON ReceivedCheques.Receipt = Receipts.ID INNER JOIN CashRegisterLines ON Receipts.ID = CashRegisterLines.Link WHERE (CashRegisterLines.CashReg = '"& CashRegID & "') AND (CashRegisterLines.Type = 1) ORDER BY CashRegisterLines.[Date], CashRegisterLines.[Time]" 197 Set RS1 = conn.execute(mySQL) 198 199 Remained = OpenningAmount 200 Credit = OpenningAmount 201 Totalcredit = OpenningAmount 202 TotalDebit = 0 203 tempCounter = 0 204%> <TR class='CClosTR3'> 205 <td colspan='7' align='center'>����� ����� ����� <span dir='LTR'><%=CashRegName%></span> (��������: <%=CashierName%>� ���: <%=BankerName%>)</TD> 206 </TR> 207 <TR> 208 <TD colspan='6' class="CClosTableFooter">:����� ���</td> 209 <TD class="CClosTableFooter" align='right'><span id='cashAmount'><%=Separate(cdbl(totalCashAmountA) + Cdbl(totalCashAmountB))%></span></TD> 210 </TR> 211 <TR> 212 <TD colspan='6' class="CClosTableFooter" style='direction:RTL;text-align=left;'>����� �� (<span id='chequeQtty'><%=totalChequeQtty%></span> ����) :</td> 213 <TD class="CClosTableFooter" align='right'><%=totalChequeAmount%></TD> 214 </TR> 215 <TR> 216 <TD colspan='6' class="CClosTableFooter">: ���</td> 217 <TD class="CClosTableFooter" align='right'><%=TotalAmount%></td> 218 </TR> 219 <TR class='CClosTR3'> 220 <td colspan='7' align='right'>���� �� ��:</td> 221 </TR> 222 <TR class="CClosTableHeader"> 223 <TD width="10px">#</TD> 224 <TD width="100px">����� ������</TD> 225 <TD width="50px">�����</TD> 226 <TD width="50px">����</TD> 227 <TD width="70px">����� ��</TD> 228 <TD width="220px">�������</TD> 229 <TD width="70px">����</TD> 230 </TR> 231<% 232 While Not (RS1.EOF) 233 tempCounter=tempCounter+1 234 sourceLink="../AR/AccountReport.asp?act=showReceipt&receipt="& RS1("Link") 235 Description = "������ " 236 myAND="" 237 238 Amount=Separate(RS1("Amount")) 239 240 if RS1("Voided") then 241 tempCounter=tempCounter-1%> 242 <TR class='CClosTR4'> 243 <td>-</td> 244 <td dir='LTR'><A HREF='<%=sourceLink%>' target='_blank'><%=RS1("Date") & " @ " & RS1("Time")%></A></td> 245 <td><%=RS1("ChequeNo")%></td> 246 <td><%=RS1("BankOfOrigin")%></td> 247 <td dir='LTR'><%=RS1("ChequeDate")%></td> 248 <td><%=RS1("Description")%></td> 249 <td dir='LTR'> 250 <div style="position:absolute;width:600;"><hr style="color:red;"></div><div align='right'><%=Amount%></div> 251<% else%> 252 <TR class='<%if tempCounter MOD 2 = 0 then response.write "CClosTR1" else response.write "CClosTR2"%>'> 253 <td><%=tempCounter%></td> 254 <td dir='LTR'><A HREF='<%=sourceLink%>' target='_blank'><%=RS1("Date") & " @ " & RS1("Time")%></A></td> 255 <td><%=RS1("ChequeNo")%></td> 256 <td><%=RS1("BankOfOrigin")%></td> 257 <td dir='LTR'><%=RS1("ChequeDate")%></td> 258 <td><%=RS1("Description")%></td> 259 <td dir='LTR' align='right'> 260 <%=Amount%> 261<% end if 262%> </td> 263 </TR> 264<% 265 RS1.MoveNext 266 Wend 267%> 268 </TABLE> 269 <br> 270<% end if 271else 272%> 273 <BR><BR> 274 <TABLE class="RepTable" align='center'> 275 <TR class="RepTableTitle"> 276 <TD colspan=<% if Auth(9,9) then response.write "11" else response.write "6" end if%>> ����� ���� ��� �� ������ ���� </TD> 277 </TR> 278<% 279 280 Banker = request("Banker") 281 connector = "" 282 Criteria = "" 283 284 if isnumeric(Banker) then Banker = cint(Banker) else Banker = 0 285 286 if Banker <> 0 then 287 Criteria = Criteria & connector & "(CashRegisters.Banker = " & Banker & ")" 288 connector = " AND " 289 end if 290 291 Cashier = request("Cashier") 292 if isnumeric(Cashier) then Cashier = cint(Cashier) else Cashier = 0 293 294 if Cashier <> 0 then 295 Criteria = Criteria & connector & "(CashRegisters.Cashier = " & Cashier & ")" 296 connector = " AND " 297 end if 298 299 openDateStart = sqlSafe(request("openDateStart")) 300 openDateEnd = sqlSafe(request("openDateEnd")) 301 if openDateStart <> "" then 302 Criteria = Criteria & connector & "(CashRegisters.openDate >= '" & openDateStart & "')" 303 connector = " AND " 304 end if 305 if openDateEnd <> "" then 306 Criteria = Criteria & connector & "(CashRegisters.openDate <= '" & openDateEnd & "')" 307 connector = " AND " 308 end if 309 310 closeDateStart= sqlSafe(request("closeDateStart")) 311 closeDateEnd = sqlSafe(request("closeDateEnd")) 312 if closeDateStart <> "" then 313 Criteria = Criteria & connector & "(CashRegisters.closeDate >= '" & closeDateStart & "')" 314 connector = " AND " 315 end if 316 if closeDateEnd <> "" then 317 Criteria = Criteria & connector & "(CashRegisters.closeDate <= '" & closeDateEnd & "')" 318 connector = " AND " 319 end if 320 321 hasTheDate = sqlSafe(request("hasTheDate")) 322 if hasTheDate <> "" then 323 Criteria = Criteria & connector & "(CashRegisters.openDate <= '" & hasTheDate & "') AND (CashRegisters.closeDate >= '" & hasTheDate & "')" 324 connector = " AND " 325 end if 326 327 if Criteria <> "" then Criteria = " WHERE " & Criteria 328 329 Sort = request("Sort") 330 if isnumeric(Sort) then Sort = cint(Sort) else Sort = 0 331 332 OrderBy="" 333 Select Case Sort 334 Case 0: 335 OrderBy="ORDER BY CashRegisters.IsOpen DESC, CashRegisters.OpenDate DESC" 336 Case 1: 337 OrderBy="ORDER BY CashRegisters.NameDate DESC" 338 Case 2: 339 OrderBy="ORDER BY CashierName" 340 Case 3: 341 OrderBy="ORDER BY BankerName" 342 Case 4: 343 OrderBy="ORDER BY CashRegisters.OpenDate DESC" 344 Case 5: 345 OrderBy="ORDER BY CashRegisters.CloseDate DESC" 346 End Select 347 348 PageLink = "Banker=" & Banker & "&Cashier=" & Cashier & "&openDateStart=" & openDateStart & "&openDateEnd=" & openDateEnd & "&closeDateStart=" & closeDateStart & "&closeDateEnd=" & closeDateEnd & "&hasTheDate=" & hasTheDate & "&Sort=" & Sort 349 350%> 351 <FORM METHOD=POST ACTION="?"> 352 <TR class="RepTableTitle"> 353 <TD colspan=<% if Auth(9,9) then response.write "11" else response.write "6" end if%>><table border=0 width=100%> 354 <tr> 355 <td align='left'>���:</td> 356 <td colspan=2><SELECT NAME="Banker" class="GenInput"> 357 <option Value=""> -- ������ ���� -- </option> 358<% mySQL="SELECT * FROM Bankers WHERE (IsBankAccount <> 1)" 359 Set RS1 = conn.Execute(mySQL) 360 do while not (RS1.eof) 361 if cint(RS1("ID")) = Banker then selectedText="selected" else selectedText="" 362%> <option Value="<%=RS1("ID")%>" <%=selectedText%>><%=RS1("Name")%></option> 363<% 364 RS1.movenext 365 loop 366 RS1.close 367%> </SELECT> 368 </td> 369 <td align='left'>��������:</td> 370 <td colspan=2><SELECT NAME="Cashier" class="GenInput"> 371 <option Value=""> -- ������ ���� -- </option> 372<% mySQL="SELECT * FROM Users WHERE Display=1 ORDER BY RealName" 373 Set RS1 = conn.Execute(mySQL) 374 do while not (RS1.eof) 375 if cint(RS1("ID")) = Cashier then selectedText="selected" else selectedText="" 376%> <option Value="<%=RS1("ID")%>" <%=selectedText%>><%=RS1("RealName")%></option> 377<% 378 RS1.movenext 379 loop 380 RS1.close 381%> </SELECT> 382 383 384 </td> 385 </tr> 386 <tr> 387 <td align='left'>��� ���:</td> 388 <td>��:<INPUT TYPE="text" NAME="openDateStart" value="<%=openDateStart%>" style="width:75px;direction:LTR;" maxlength=10 OnBlur="return acceptDate(this);"></td> 389 <td>��:<INPUT TYPE="text" NAME="openDateEnd" value="<%=openDateEnd%>" style="width:75px;direction:LTR;" maxlength=10 OnBlur="return acceptDate(this);"></td> 390 <td>���� ������:</td> 391 <td colspan=2><SELECT NAME="Sort" class="GenInput"> 392 <option Value="0" <%if Sort = 0 then response.write "selected"%>> ��� ��� </option> 393 <option Value="1" <%if Sort = 1 then response.write "selected"%>> ����� ����� </option> 394 <option Value="2" <%if Sort = 2 then response.write "selected"%>> �������� </option> 395 <option Value="3" <%if Sort = 3 then response.write "selected"%>> ��� </option> 396 <option Value="4" <%if Sort = 4 then response.write "selected"%>> ����� ����� </option> 397 <option Value="5" <%if Sort = 5 then response.write "selected"%>> ����� ���� </option> 398 </SELECT> 399 </td> 400 </tr> 401 <tr> 402 <td align='left'>���� ���:</td> 403 <td>��:<INPUT TYPE="text" NAME="closeDateStart" value="<%=closeDateStart%>" style="width:75px;direction:LTR;" maxlength=10 OnBlur="return acceptDate(this);"></td> 404 <td>��:<INPUT TYPE="text" NAME="closeDateEnd" value="<%=closeDateEnd%>" style="width:75px;direction:LTR;" maxlength=10 OnBlur="return acceptDate(this);"></td> 405 <td align='left'>���� �����:</td> 406 407 <td> 408 <INPUT TYPE="text" NAME="hasTheDate" value="<%=hasTheDate%>" style="width:75px;direction:LTR;" maxlength=10 OnBlur="return acceptDate(this);"> 409 </td> 410 <td align=center> 411 <INPUT TYPE="submit" class="GenButton" value="�����"> 412 </td> 413 </tr> 414 </table> 415 </TD> 416 </TR> 417 </FORM> 418 <FORM METHOD=POST ACTION="?act=showCashRegReport"> 419<% 420 421 if Auth(9,9) then 422 mySQL="SELECT CashRegisters.ID, MAX(Users.RealName) AS CashierName, MAX(Bankers.Name) AS BankerName, CashRegisters.NameDate, CashRegisters.CloseDate, isnull(SUM(case when CashRegisterLines.isA=1 and CashRegisterLines.Type=1 then ISNULL(Receipts.CashAmount,0) end),0) AS sumCashAmountA, isnull(SUM(case when CashRegisterLines.isA=0 and CashRegisterLines.Type=1 then ISNULL(Receipts.CashAmount,0) end),0) AS sumCashAmountB, SUM(ISNULL(case when CashRegisterLines.Type=1 then Receipts.ChequeAmount end,0)) AS sumChequeAmount, SUM(case when CashRegisterLines.isA=1 and CashRegisterLines.Type=2 then ISNULL(Payments.CashAmount,0) end) AS sumPayAmountA, SUM(case when CashRegisterLines.isA=0 and CashRegisterLines.Type=2 then ISNULL(Payments.CashAmount,0) end) AS sumPayAmountB FROM CashRegisters INNER JOIN Users ON CashRegisters.Cashier = Users.ID INNER JOIN Bankers ON CashRegisters.Banker = Bankers.ID LEFT OUTER JOIN CashRegisterLines ON CashRegisters.ID = CashRegisterLines.CashReg and CashRegisterLines.voided=0 LEFT OUTER JOIN Payments ON CashRegisterLines.Link = Payments.ID LEFT OUTER JOIN Receipts ON CashRegisterLines.Link = Receipts.ID " &Criteria& " GROUP BY CashRegisters.ID,CashRegisters.NameDate, CashRegisters.CloseDate, CashRegisters.IsOpen, CashRegisters.OpenDate, CashRegisters.Banker, CashRegisters.Cashier "& OrderBy 423 else 424 mySQL="SELECT CashRegisters.ID, Users.RealName AS CashierName, Bankers.Name AS BankerName, CashRegisters.NameDate, CashRegisters.CloseDate FROM CashRegisters INNER JOIN Users ON CashRegisters.Cashier = Users.ID INNER JOIN Bankers ON CashRegisters.Banker = Bankers.ID " & Criteria & " " & OrderBy 425 end if 426 '-------------------Add by Sam 427 if Auth(9,9) then 428 mySQLsum = "SELECT SUM(case when CashRegisterLines.isA=1 and CashRegisterLines.Type=1 then ISNULL(Receipts.CashAmount,0) end) AS sumCashAmountA, SUM(case when CashRegisterLines.isA=0 and CashRegisterLines.Type=1 then ISNULL(Receipts.CashAmount,0) end) AS sumCashAmountB, SUM(ISNULL(case when CashRegisterLines.Type=1 then Receipts.ChequeAmount end,0)) AS sumChequeAmount, SUM(case when CashRegisterLines.isA=1 and CashRegisterLines.Type=2 then ISNULL(Payments.CashAmount,0) end) AS sumPayAmountA, SUM(case when CashRegisterLines.isA=0 and CashRegisterLines.Type=2 then ISNULL(Payments.CashAmount,0) end) AS sumPayAmountB FROM CashRegisters INNER JOIN Users ON CashRegisters.Cashier = Users.ID INNER JOIN Bankers ON CashRegisters.Banker = Bankers.ID LEFT OUTER JOIN CashRegisterLines ON CashRegisters.ID = CashRegisterLines.CashReg and CashRegisterLines.voided=0 LEFT OUTER JOIN Payments ON CashRegisterLines.Link = Payments.ID LEFT OUTER JOIN Receipts ON CashRegisterLines.Link = Receipts.ID " &Criteria 429 Set rsSUM = Conn.Execute(mySQLsum) 430 end if 431 Set rs=Server.CreateObject("ADODB.Recordset")'Conn.Execute(mySQL) 432 433 PageSize = 20 434 rs.PageSize = PageSize 435 436 rs.CursorLocation=3 'in ADOVBS_INC adUseClient=3 437 rs.Open mySQL ,Conn,3 438 TotalPages = rs.PageCount 439 440 CurrentPage=1 441 442 if isnumeric(Request.QueryString("p")) then 443 pp=clng(Request.QueryString("p")) 444 if pp <= TotalPages AND pp > 0 then 445 CurrentPage = pp 446 end if 447 end if 448 449 if not rs.eof then 450 rs.AbsolutePage=CurrentPage 451 end if 452 453 if rs.eof then 454%> <tr> 455 <td colspan=<% if Auth(9,9) then response.write "11" else response.write "7" end if%> class="CusTD3" style='direction:RTL;'>��� .</td> 456 </tr> 457<% else 458%> <tr class="RepTableHeader"> 459 <td width="20px">#</td> 460 <td width="10px"><input disabled type="radio"></td> 461 <td> ����� ����� </td> 462 <td> �������� </td> 463 <td> ��� </td> 464 <td> ����� ���� </td> 465 <% 466 '-------------------Add by Sam 467 if Auth(9,9) then 468 %> 469 <td>������ ��� ���</td> 470 <td>������ ��� �</td> 471 <td>������ ��</td> 472 <td>������ ���</td> 473 <td>������ �</td> 474 <% 475 end if 476 %> 477 </tr> 478 <% 479 '-------------------Add by Sam 480 if (Auth(9,9)) then 481 if NOT rsSUM.eof then 482 %> 483 <TR class='RepTR1'> 484 <TD colspan=6 align="center" style="font-weight: bold;">��� ��</TD> 485 <% 486 487 if Auth(9,9) then 488 %> 489 <td><%=Separate(rsSUM("sumCashAmountA"))%></td> 490 <td><%=Separate(rsSUM("sumCashAmountB"))%></td> 491 <td><%=Separate(rsSUM("sumChequeAmount"))%></td> 492 <td><%=Separate(rsSUM("sumPayAmountA"))%></td> 493 <td><%=Separate(rsSUM("sumPayAmountB"))%></td> 494 <% 495 end if 496 %> 497 </TR> 498 <% end if 499 end if 500 tempCounter=(CurrentPage - 1) * PageSize 501 502 Do While NOT rs.eof AND (rs.AbsolutePage = CurrentPage) 503 tempCounter = tempCounter+1 504 CloseDate=rs("CloseDate") 505 if isnull(CloseDate) then 506 CloseDate="<FONT COLOR='Red'>���� ��� ���</FONT>" 507 end if 508%> 509 <TR class='<%if tempCounter MOD 2 = 0 then response.write "RepTR1" else response.write "RepTR2"%>'> 510 <TD><%=tempCounter%></TD> 511 <TD><INPUT TYPE="radio" NAME="CashRegID" Value='<%=rs("ID")%>'></TD> 512 <TD dir='LTR'><%=rs("NameDate")%></TD> 513 <TD><%=rs("CashierName")%></TD> 514 <TD><%=rs("BankerName")%></TD> 515 <TD dir='LTR'><%=CloseDate%></TD> 516 <% 517 '-------------------Add by Sam 518 if Auth(9,9) then 519 %> 520 <td><%=Separate(rs("sumCashAmountA"))%></td> 521 <td><%=Separate(rs("sumCashAmountB"))%></td> 522 <td><%=Separate(rs("sumChequeAmount"))%></td> 523 <td><%=Separate(rs("sumPayAmountA"))%></td> 524 <td><%=Separate(rs("sumPayAmountB"))%></td> 525 <% 526 end if 527 %> 528 </TR> 529 530<% 531 rs.MoveNext 532 Loop 533%> <tr class="RepTableTitle"> 534 <td align='right' colspan=<% if Auth(9,9) then response.write "11" else response.write "6" end if%>> 535<% 536 if TotalPages > 1 then 537 response.write "���� " 538 for i=1 to TotalPages 539 if i = CurrentPage then 540%> [<%=i%>] 541<% else 542%> <A HREF="?<%=PageLink%>&p=<%=i%>"><%=i%></A> 543<% end if 544 if i mod 16 = 0 then response.write "<br>" 545 next 546 end if 547 end if 548%> <BR> 549 <P align=center><INPUT TYPE="submit" Value="������" class="GenButton"></P> 550 </td> 551 </tr> 552 </TABLE> 553 </FORM> 554<% 555end if 556conn.Close 557%> 558</font> 559<!--#include file="tah.asp" -->