/beta/AP/APReport.asp
ASP | 213 lines | 186 code | 17 blank | 10 comment | 25 complexity | 108ecb04f317e6b968de8df4b267e06b MD5 | raw file
1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><% 2'AP (7) 3PageTitle= "����� ����" 4SubmenuItem=7 5if not Auth(7 , 7) then NotAllowdToViewThisPage() 6 7%> 8<!--#include file="top.asp" --> 9<!--#include File="../include_farsiDateHandling.asp"--> 10<!--#include File="../include_JS_InputMasks.asp"--> 11 12<BR><BR><BR> 13<% 14 15selectedCustomer = request("selectedCustomer") 16if selectedCustomer="" then selectedCustomer=1000 17 18%> 19<% 20if not Auth(6 , 9) then 21 selectedCustomer = session("id") 22else 23%> 24<a href="?act=showRemain">����� ���ȝ��� ��������</a> 25<FORM METHOD=POST ACTION="?act=show"> 26<CENTER>����� ������: <select name="selectedCustomer" class=inputBut ></CENTER> 27 <option value="1000">��� (�����)</option> 28 <option value="2000">-------------------</option> 29<% set RSV=Conn.Execute ("SELECT * FROM Users WHERE Display=1 ORDER BY RealName") 30Do while not RSV.eof 31%> 32 <option value="<%=RSV("ID")%>" <% 33 if trim(RSV("ID"))=trim(selectedCustomer) then 34 response.write " selected " 35 end if 36 %>><%=RSV("RealName")%></option> 37<% 38RSV.moveNext 39Loop 40RSV.close 41%> 42</select> 43<INPUT TYPE="submit" value="������"><BR> 44<INPUT TYPE="checkbox" <% if request("showZero") = "on" then%>checked <% end if %> NAME="showZero"> ����� ����� ��� ��� 45</form> 46<% 47end if 48if request("act")="showRemain" then 49%> 50<table> 51 <tr> 52 <td>���</td> 53 <td>���� �����</td> 54 <td>����� ����</td> 55 <td></td> 56 </tr> 57<% 58 set rs=Conn.execute("select * from accounts where apBalance<0") 59 while not rs.eof 60%> 61 <tr> 62 <td><a href="../CRM/AccountInfo.asp?act=show&selectedCustomer=<%=rs("id")%>"><%=rs("accountTitle")%></a></td> 63 <td><%=Separate(abs(CDbl(rs("apBalance"))))%></td> 64 <td><%=Separate(abs(CDbl(rs("arBalance"))))%></td> 65 <td><%if CDbl(rs("arBalance"))<0 then response.write " ��" else if CDbl(rs("arBalance")) >0 then response.write " ��"%></td> 66 </tr> 67<% 68 rs.moveNext 69 wend 70%> 71</table> 72<% 73end if 74'----------------------------------------------------------------------------------------------------- 75'------------------------------------------------------------------------------------ Send New Message 76'----------------------------------------------------------------------------------------------------- 77if request("act")="show" and selectedCustomer<>"" then 78 79 if not request("showZero") = "on" then 80 extraCond = "and not APBalance=0" 81 else 82 extraCond = " " 83 end if 84 85 '=========================================== All CSRs 86 '==================================================== 87 if selectedCustomer=1000 then '----- brief Report 88 set RSM = conn.Execute ("SELECT Accounts.CSR, COUNT(Accounts.APBalance) AS AccountsCOUNT, SUM(CONVERT(bigint, Accounts.APBalance)) AS sumAPBalance, Users.RealName FROM Accounts LEFT OUTER JOIN Users ON Accounts.CSR = Users.ID GROUP BY Accounts.CSR, Users.RealName ORDER BY sumAPBalance") 89 %> 90 <table style="font-family:tahoma;font-size:9pt; border:1 dashed #888888; direction:RTL;" align="center" Width="90%" Cellspacing="0" Cellpadding="5"> 91 <tbody id="AccountsTable"> 92 <tr bgcolor='#33AACC'> 93 <td> # </td> 94 <td> ����� ������</td> 95 <td> ����� ������</td> 96 <td width='80'> ����� ����</td> 97 </tr> 98 <% 99 SA_tempCounter= 0 100 while Not ( RSM.EOF) 101 AccountsCOUNT=RSM("AccountsCOUNT") 102 sumAPBalance=cdbl(RSM("sumAPBalance")) 103 RealName=RSM("RealName") 104 CSR=RSM("CSR") 105 106 if (cdbl(sumAPBalance) >= 0 )then 107 SA_tempBalanceColor="green" 108 else 109 SA_tempBalanceColor="red" 110 end if 111 112 SA_tempCounter=SA_tempCounter+1 113 if (SA_tempCounter Mod 2 = 1)then 114 SA_tempColor="#FFFFFF" 115 else 116 SA_tempColor="#DDDDDD" 117 end if 118 119 total = total + APBalance 120 121 %> <tr > 122 <td style="border-bottom: solid 1pt black"><%=SA_tempCounter %> </td> 123 <td style="border-bottom: solid 1pt black" class=alak2><A HREF="?act=show&selectedCustomer=<%=CSR%>"><%=RealName%></A> </td> 124 <td style="border-bottom: solid 1pt black"><%=AccountsCOUNT%> </td> 125 <td style="border-bottom: solid 1pt black; direction:LTR; text-align:right;"><FONT COLOR="<%=SA_tempBalanceColor%>"><%=Separate(sumAPBalance)%></FONT> </td> 126 </tr> 127 <% 128 'total = cdbl(total) + cdbl(sumAPBalance) 129 RSM.movenext 130 wend 131 %> 132 <tr bgcolor='#33AACC'> 133 <td align='right' colspan=3> ���� �� ���� ��� ��� ����� ���� ������ �� �����. </td> 134 <td dir=ltr><! <%=Separate(total)%> ></td> 135 136 </td> 137 </tr> 138 </table><BR><BR> 139<% 140 response.end 141 end if 142 '============================================ One CSR 143 '==================================================== 144 if selectedCustomer=2000 then '----- no csr Report 145 146 mySQL="SELECT * FROM Accounts WHERE (CSR IS NULL)"& extraCond & " ORDER BY APBalance" 147 else 148 mySQL="SELECT * FROM Accounts where CSR = " & selectedCustomer & " "& extraCond & " ORDER BY APBalance" 149 end if 150 151 set RSM = conn.Execute (mySQL) 152 %> 153 <table style="font-family:tahoma;font-size:9pt; border:1 dashed #888888; direction:RTL;" align="center" Width="90%" Cellspacing="0" Cellpadding="5"> 154 <tbody id="AccountsTable"> 155 <tr bgcolor='#33AACC'> 156 <td> # </td> 157 <td> ����� ���� </td> 158 <td> ��� ���� ��� </td> 159 <td width='80'> ����� ����</td> 160 </tr> 161 <% 162 SA_tempCounter= 0 163 while Not ( RSM.EOF) 164 AccountNo=RSM("ID") 165 AccountTitle=RSM("AccountTitle") 166 APBalance=cdbl(RSM("APBalance")) 167 CreditLimit=RSM("CreditLimit") 168 contact1 = RSM("Dear1") & " " & RSM("FirstName1") & " " & RSM("LastName1") 169 if RSM("Type") = 1 then 170 AccountTitle = AccountTitle & " (�������) " 171 end if 172 if isnull(SA_totalBalance) then 173 APBalance=0 174 totalBalanceText="<i>N / A</i>" 175 tempBalanceColor="gray" 176 else 177 if (APBalance>= 0 )then 178 SA_tempBalanceColor="green" 179 else 180 SA_tempBalanceColor="red" 181 end if 182 totalBalanceText=Separate(APBalance) 183 end if 184 SA_tempCounter=SA_tempCounter+1 185 if (SA_tempCounter Mod 2 = 1)then 186 SA_tempColor="#FFFFFF" 187 else 188 SA_tempColor="#DDDDDD" 189 end if 190 191' total = total + APBalance 192 193 %> <tr > 194 <td style="border-bottom: solid 1pt black"><%=SA_tempCounter %> </td> 195 <td style="border-bottom: solid 1pt black"><A href="../CRM/AccountInfo.asp?act=show&selectedCustomer=<%=AccountNo%>" target='_blank'><%=AccountTitle%></A> </td> 196 <td style="border-bottom: solid 1pt black"><%=contact1%> </td> 197 <td style="border-bottom: solid 1pt black; direction:LTR; text-align:right;"><FONT COLOR="<%=SA_tempBalanceColor%>"><%=totalBalanceText%></FONT> </td> 198 </tr> 199 <% RSM.movenext 200 wend 201 %> 202 <tr bgcolor='#33AACC'> 203 <td align='right' colspan=3> ���</td> 204 <td dir=ltr> <%=Separate(total)%> </td> 205 206 </td> 207 </tr> 208 </table><BR><BR> 209<% 210end if 211%> 212 213<!--#include file="tah.asp" -->