/beta/AP/report.asp
ASP | 249 lines | 217 code | 23 blank | 9 comment | 28 complexity | fa9a8516b2e1651c9243971c57d9a38b MD5 | raw file
1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><% 2'AP (7) 3PageTitle= " ����� ����" 4SubmenuItem=3 5if not Auth(7 , 3) then NotAllowdToViewThisPage() 6 7%> 8<!--#include file="top.asp" --> 9<!--#include File="../include_farsiDateHandling.asp"--> 10<!--#include File="../include_JS_InputMasks.asp"--> 11<% 12fromDate = request("fromDate") 13toDate = request("toDate") 14vouchers = request("vouchers") 15payments = request("payments") 16if request("Effective")="on" then 17 effective=1 18else 19 effective=0 20end if 21 22if payments="" then 23 paymentsSt = " " 24else 25 paymentsSt = "checked" 26end if 27 28if vouchers="" then 29 vouchersSt = " " 30else 31 vouchersSt = "checked" 32end if 33 34if toDate="" or fromDate="" then 35 toDate = shamsiToday() 36 fromDate = shamsiDate(Date()-7) 37 paymentsSt = "checked" 38 vouchersSt = "checked" 39 flag = "first" 40end if 41 42 43'----------------------------------------------------------------------------------------------------- 44'-------------------------------------------------------------------------------------------- Log FORM 45'----------------------------------------------------------------------------------------------------- 46%> 47<BR><BR> 48<FORM METHOD=POST ACTION="report.asp"> 49<TABLE border=0 align=center> 50<TR> 51 <TD colspan=5 align=center><H3>����� �������� ����</H3></TD> 52</TR> 53<TR> 54 <TD align=left>�� �����</TD> 55 <TD align=right><INPUT TYPE="text" NAME="fromDate" value="<%=fromDate%>" dir=ltr onKeyPress="return maskDate(this);" onblur="acceptDate(this)" maxlength="10"></TD> 56 <TD align=left width=20></TD> 57 <TD align=left>�� �����</TD> 58 <TD align=right><INPUT TYPE="text" NAME="toDate" value="<%=toDate%>" dir=ltr onKeyPress="return maskDate(this);" onblur="acceptDate(this)" maxlength="10"></TD> 59 <td> 60 <INPUT TYPE="submit" NAME="submit" class=inputBut value="������"> 61 </td> 62</TR> 63<!-- 64 65<TR height=10> 66 <TD colspan=4 align=center>����� �� ���� ����� ������ ����</TD> 67 <td><input type="checkbox" name="Effective" <%if effective then response.write " checked='checked' " %>></td> 68</TR> 69 70<TR> 71 <TD align=left></TD> 72 <TD align=right><INPUT TYPE="checkbox" NAME="vouchers" <%=vouchersSt%>> ��������</TD> 73 <TD align=left width=20><INPUT TYPE="checkbox" NAME="payments" <%=paymentsSt%>></TD> 74 <TD align=left>��������</TD> 75 <TD align=left></TD> 76</TR> 77--> 78</TABLE> 79</FORM> 80<% 81if flag = "first" then 82 response.end 83end if 84 85'----------------------------------------------------------------------------------------------------- 86'-------------------------------------------------------------------------------------------- Log Rows 87'----------------------------------------------------------------------------------------------------- 88 89if request("submit")="������"then 90 91 %> 92 93<TABLE dir=rtl align=center width=640 cellspacing=2 cellpadding=2 style="border:2 solid #330066;"> 94 <% 95 96 mySQL="SELECT Accounts.AccountTitle,Accounts.id as accountID, Vouchers.id, Vouchers.Title, Vouchers.TotalPrice, Vouchers.CreationTime, Vouchers.CreationDate, Vouchers.CreatedBy, Vouchers.verified, Vouchers.comment, Vouchers.ImageFileName, Vouchers.VendorID, Users.RealName, apItems.FullyApplied,apItems.RemainedAmount,EffectiveGLRows.GLDoc,Vouchers.effectiveDate,apItems.createdDate FROM Vouchers INNER JOIN Accounts ON Vouchers.VendorID = Accounts.ID INNER JOIN Users ON Vouchers.CreatedBy = Users.ID left outer join APItems on APItems.Type=6 and APItems.Link=Vouchers.id left outer join EffectiveGLRows on EffectiveGLRows.SYS='AP' and EffectiveGLRows.Link=apItems.ID WHERE (Vouchers.EffectiveDate >= N'"& fromDate & "' and Vouchers.EffectiveDate <= N'"& toDate & "') order by Vouchers.EffectiveDate" 97 'mySQL="SELECT Accounts.AccountTitle, Vouchers.id, Vouchers.Title, Vouchers.TotalPrice, Vouchers.CreationTime, Vouchers.CreationDate, Vouchers.CreatedBy, Vouchers.verified, Vouchers.comment, Vouchers.ImageFileName, Vouchers.VendorID, Users.RealName, apItems.FullyApplied,apItems.RemainedAmount,EffectiveGLRows.GLDoc FROM Vouchers INNER JOIN Accounts ON Vouchers.VendorID = Accounts.ID INNER JOIN Users ON Vouchers.CreatedBy = Users.ID left outer join APItems on APItems.Type=6 and APItems.Link=Vouchers.id left outer join EffectiveGLRows on EffectiveGLRows.SYS='AP' and EffectiveGLRows.Link=apItems.ID WHERE (Vouchers.CreationDate >= N'"& fromDate & "' and Vouchers.CreationDate <= N'"& toDate & "')" 98 set RSS=Conn.Execute (mySQL) 99 %> 100 <TR bgcolor="eeeeee" > 101 <TD colspan=6><H4>��������</H4></TD> 102 </TR> 103 <TR bgcolor="eeeeee" style="cursor:hand;" title="����� �����"> 104 <TD>�����</TD> 105 <TD>��� ����</TD> 106 <TD>����� ������</TD> 107 <TD>����</TD> 108 <TD>�����</TD> 109 <TD>�����</TD> 110 </TR> 111 <TR bgcolor="eeeeee" > 112 <TD colspan=6 height=2 bgcolor=0></TD> 113 </TR> 114 <% 115 116 SumRemain=0 117 tmpCounter=0 118 total=0 119 Do while not RSS.eof 120 tmpCounter = tmpCounter + 1 121 if tmpCounter mod 2 = 1 then 122 tmpColor="#FFFFFF" 123 tmpColor2="#FFFFBB" 124 Else 125 tmpColor="#DDDDDD" 126 tmpColor2="#EEEEBB" 127 End if 128 total = total + CDbl(RSS("TotalPrice")) 129 if not IsNull(RSS("remainedAmount")) then 130 SumRemain = SumRemain + CDbl(RSS("remainedAmount")) 131 end if 132 %> 133 <TR bgcolor="<%=tmpColor%>" title="<% 134 Comment = RSS("Comment") 135 if Comment<>"-" then 136 response.write "�����: " & Comment 137 else 138 response.write "����� �����" 139 end if 140 %>"> 141 <td title="����� ����� ������:<%=RSS("CreationDate")%> ����� ����� ������:<%=RSS("createdDate")%>"><%=RSS("effectiveDate")%></td> 142 <TD><a href="../CRM/AccountInfo.asp?act=show&selectedCustomer=<%=rss("accountID")%>"><%=RSS("AccountTitle")%></A></TD> 143 <TD><A HREF="AccountReport.asp?act=showVoucher&voucher=<%=RSS("ID")%>"><%=RSS("ID")%> - <%=RSS("Title")%></TD> 144 <TD><%=Separate(RSS("TotalPrice"))%></A></TD> 145 <td> 146 <% 147 if IsNull(RSS("remainedAmount")) then 148 response.write("����� ����") 149 else 150 response.write RSS("remainedAmount") 151 end if 152 %> 153 </td> 154 <TD><% if RSS("verified") then %>����� ��� <% else %>����� ����<% end if %>/ 155 <% if not IsNull(RSS("fullyApplied")) and RSS("fullyApplied") then %>������ ��� <% else %>������ ����<% end if %> 156 </TD> 157 </TR> 158 159 <% 160 RSS.moveNext 161 Loop 162 tmpCounter = tmpCounter + 1 163 if tmpCounter mod 2 = 1 then 164 tmpColor="#FFFFFF" 165 tmpColor2="#FFFFBB" 166 Else 167 tmpColor="#DDDDDD" 168 tmpColor2="#EEEEBB" 169 End if 170 %> 171 <tr bgcolor="<%=tmpColor%>"> 172 <td colspan=3>���</td> 173 <td><%=Separate(total)%></td> 174 <td><%=Separate(SumRemain)%></td> 175 <td></td> 176 </tr> 177 <% 178 179 180 mySQL="SELECT Payments.id, Payments.CashAmount, Payments.ChequeAmount, APItems.RemainedAmount, Accounts.AccountTitle,Accounts.id as accountID, Payments.CreatedBy, Payments.CreationDate, Payments.CreationTime, Users.RealName,apItems.EffectiveDate FROM APItems INNER JOIN Payments ON APItems.Link = Payments.id INNER JOIN Accounts ON APItems.Account = Accounts.ID INNER JOIN Users ON Payments.CreatedBy = Users.ID WHERE (Payments.EffectiveDate >= N'"& fromDate & "' and Payments.EffectiveDate <= N'"& toDate & "' and Payments.SYS = 'AP') ORDER BY Payments.EffectiveDate" 181 182 'mySQL="SELECT Payments.CashAmount, Payments.ChequeAmount, APItems.RemainedAmount, Accounts.AccountTitle, Payments.CreatedBy, Payments.CreationDate, Payments.CreationTime, Users.RealName FROM APItems INNER JOIN Payments ON APItems.Link = Payments.id INNER JOIN Accounts ON APItems.Account = Accounts.ID INNER JOIN Users ON Payments.CreatedBy = Users.ID WHERE (Payments.CreationDate >= N'"& fromDate & "' and Payments.CreationDate <= N'"& toDate & "' and Payments.SYS = 'AP') ORDER BY Payments.ID" 183 184 set RSS=Conn.Execute (mySQL) 185 %> 186 <TR bgcolor="eeeeee" > 187 <TD colspan=6><H4>��������</H4></TD> 188 </TR> 189 <TR bgcolor="eeeeee" > 190 <TD colspan=6 height=2 bgcolor=0></TD> 191 </TR> 192 <% 193 tmpCounter=0 194 total=0 195 totalRemain=0 196 Do while not RSS.eof 197 tmpCounter = tmpCounter + 1 198 if tmpCounter mod 2 = 1 then 199 tmpColor="#FFFFFF" 200 tmpColor2="#FFFFBB" 201 Else 202 tmpColor="#DDDDDD" 203 tmpColor2="#EEEEBB" 204 End if 205 total= total + cdbl(RSS("CashAmount")) + cdbl(RSS("ChequeAmount")) 206 totalRemain = totalRemain + CDbl(RSS("RemainedAmount")) 207 %> 208 <TR bgcolor="<%=tmpColor%>" > 209 <td title="����� �����:<%=RSS("CreationDate")%>"><%=RSS("effectiveDate")%></td> 210 <TD><a href="../CRM/AccountInfo.asp?act=show&selectedCustomer=<%=rss("accountID")%>"><%=RSS("AccountTitle")%></A></TD> 211 <TD title="����:<%=RSS("RealName")%>"> 212 <a href="../AP/AccountReport.asp?act=showPayment&payment=<%=rss("id")%>"> 213 <% 214 if cdbl(RSS("CashAmount"))>0 then response.write "���: " & Separate(cdbl(RSS("CashAmount"))) & " " 215 if cdbl(RSS("ChequeAmount"))>0 then response.write "��: " & Separate(cdbl(RSS("ChequeAmount"))) 216 %> 217 </a> 218 </TD> 219 <TD><%=Separate(cdbl(RSS("CashAmount")) + cdbl(RSS("ChequeAmount")))%> </TD> 220 <TD><%=Separate(RSS("RemainedAmount"))%></A></TD> 221 <TD></TD> 222 </TR> 223 224 <% 225 RSS.moveNext 226 Loop 227 tmpCounter = tmpCounter + 1 228 if tmpCounter mod 2 = 1 then 229 tmpColor="#FFFFFF" 230 tmpColor2="#FFFFBB" 231 Else 232 tmpColor="#DDDDDD" 233 tmpColor2="#EEEEBB" 234 End if 235 %> 236 <tr bgcolor="<%=tmpColor%>"> 237 <td colspan=3>���</td> 238 <td><%=Separate(total)%></td> 239 <td><%=Separate(totalRemain)%></td> 240 <td></td> 241 </tr> 242 243</TABLE><br> 244 <% 245 246end if 247%> 248 249<!--#include file="tah.asp" -->