PageRenderTime 25ms CodeModel.GetById 16ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 1ms

/beta/AR/include_CustomerInvoices.asp

http://github.com/khaneh/Orders
ASP | 208 lines | 200 code | 0 blank | 8 comment | 12 complexity | 951d9a37b68ad8e59415b2abc3976008 MD5 | raw file
  1<%'
  2  'This Include file needs the variables below:
  3  '
  4  '		Conn	
  5  '		cusID	(Customer ID)
  6  '		AccountTitle
  7%>
  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;height:30;}
 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</STYLE>
 24	  <TaBlE style="width:100%; background-color:#C3DBEB;" cellspacing="2" cellspacing="2">
 25	  <Tr>
 26			<Td align="center">
 27			<table class="CustTable" cellspacing='1' style='width:90%;'>
 28				<tr><td class="CusTableHeader" style="background-color: #CCCCCC; height:50;">
 29					<B><A target="_blank" HREF="../CRM/AccountInfo.asp?act=show&selectedCustomer=<%=cusID%>">����� �� <%=AccountTitle%> (<%=CusID%>)</A></B></td>
 30				</tr>
 31			</table>
 32			</Td>
 33	  </Tr>
 34	  <Tr>
 35		<Td colspan="2" valign="top" align="center">
 36			<table class="CustTable" cellspacing='1' style='width:90%;'>
 37				<tr>
 38					<td colspan="7" class="CusTableHeader" style="background-color:#CCCC99;">������ ��� �� ����� (����� ����)</td>
 39				</tr>
 40				<%
 41				mySQL="SELECT Invoices.ID, Invoices.CreatedDate, Users.RealName AS Creator, Invoices.TotalReceivable FROM Invoices INNER JOIN Users ON Invoices.CreatedBy = Users.ID WHERE (Invoices.Customer='"& cusID & "') AND (Invoices.Voided = 0) AND (Invoices.Approved = 0) ORDER BY Invoices.CreatedDate DESC, Invoices.ID"
 42				Set RS1 = conn.execute(mySQL)
 43				if RS1.eof then
 44%>
 45					<tr>
 46						<td colspan="7" class="CusTD3">���</td>
 47					</tr>
 48<%
 49				else
 50%>					<tr>
 51						<td class="CusTD3">#</td>
 52						<td class="CusTD3">����� ������</td>
 53						<td class="CusTD3">����� �����</td>
 54						<td class="CusTD3">�����</td>
 55						<td class="CusTD3">����� �� ����� ���</td>
 56						<td class="CusTD3">����</td>
 57					</tr>
 58<%					tmpCounter=0
 59					Do while not RS1.eof 
 60						RelatedOrders = ""
 61						tmpsep=""
 62						mySQL="SELECT [Order] FROM InvoiceOrderRelations WHERE Invoice='"& RS1("ID") & "'"
 63						Set RS2 = conn.execute(mySQL)
 64						Do While not RS2.eof 
 65							RelatedOrders = RelatedOrders & tmpsep & RS2("Order")
 66							tmpsep=", "
 67							RS2.Movenext
 68						Loop
 69						RS2.close
 70						Set Rs2=Nothing
 71						tmpCounter = tmpCounter + 1
 72						if tmpCounter mod 2 = 1 then
 73							tmpColor="#FFFFFF"
 74							tmpColor2="#FFFFBB"
 75						Else
 76							tmpColor="#DDDDDD"
 77							tmpColor2="#EEEEBB"
 78						End if 
 79						'alert(this.getElementByTagName('td').items(0).data);
 80%>
 81						<TR bgcolor="<%=tmpColor%>" style="cursor: hand;" onMouseOver="this.style.backgroundColor='<%=tmpColor2%>'" onMouseOut="this.style.backgroundColor='<%=tmpColor%>'" onclick="window.location='../AR/AccountReport.asp?act=showInvoice&invoice=<%=RS1("ID")%>';">
 82							<TD style="height:30px;"><%=tmpCounter%></TD>
 83							<TD style="height:30px;"><%=RS1("ID")%></TD>
 84							<TD><%=RS1("�Creator")%>&nbsp;</TD>
 85							<TD dir="LTR" align='right'><%=RS1("CreatedDate")%>&nbsp;</TD>
 86							<TD dir="LTR" align='right'><%=RelatedOrders%>&nbsp;</TD>
 87							<TD><%=Separate(RS1("TotalReceivable"))%>&nbsp;</TD>
 88						</TR>
 89<%						RS1.moveNext
 90					Loop
 91				end if
 92				%>
 93			</table>
 94		</Td>
 95	  </Tr>
 96	  <Tr>
 97		<Td colspan="2" valign="top" align="center">
 98			<table class="CustTable" cellspacing='1' style='width:90%;'>
 99				<tr>
100					<td colspan="7" class="CusTableHeader" style="background-color:#33BB99;">������ ��� ����� ��� (���� ����)</td>
101				</tr>
102				<%
103				mySQL="SELECT Invoices.ID, Invoices.CreatedDate, Users.RealName AS Creator, Invoices.ApprovedDate, Invoices.TotalReceivable, Users_1.RealName AS Approver FROM Invoices INNER JOIN Users ON Invoices.CreatedBy = Users.ID INNER JOIN Users Users_1 ON Invoices.ApprovedBy = Users_1.ID WHERE (Invoices.Customer='"& cusID & "') AND (Invoices.Voided = 0) AND (Invoices.Issued = 0) ORDER BY Invoices.CreatedDate DESC, Invoices.ID"
104				Set RS1 = conn.execute(mySQL)
105				if RS1.eof then
106%>
107					<tr>
108						<td colspan="7" class="CusTD3">���</td>
109					</tr>
110<%
111				else
112%>					<tr>
113						<td class="CusTD3">#</td>
114						<td class="CusTD3">����� ������</td>
115						<td class="CusTD3">����� �����</td>
116						<td class="CusTD3">�����</td>
117						<td class="CusTD3">����� �����</td>
118						<td class="CusTD3">����� �����</td>
119						<td class="CusTD3">����</td>
120					</tr>
121<%					tmpCounter=0
122					Do while not RS1.eof 
123						tmpCounter = tmpCounter + 1
124						if tmpCounter mod 2 = 1 then
125							tmpColor="#FFFFFF"
126							tmpColor2="#FFFFBB"
127						Else
128							tmpColor="#DDDDDD"
129							tmpColor2="#EEEEBB"
130						End if 
131						'alert(this.getElementByTagName('td').items(0).data);
132%>
133						<TR bgcolor="<%=tmpColor%>" style="cursor: hand;" onMouseOver="this.style.backgroundColor='<%=tmpColor2%>'" onMouseOut="this.style.backgroundColor='<%=tmpColor%>'" onclick="window.location='../AR/AccountReport.asp?act=showInvoice&invoice=<%=RS1("ID")%>';">
134							<TD style="height:30px;"><%=tmpCounter%></TD>
135							<TD style="height:30px;"><%=RS1("ID")%></TD>
136							<TD><%=RS1("�Creator")%>&nbsp;</TD>
137							<TD dir="LTR" align='right'><%=RS1("CreatedDate")%>&nbsp;</TD>
138							<TD><%=RS1("Approver")%>&nbsp;</TD>
139							<TD dir="LTR" align='right'><%=RS1("ApprovedDate")%>&nbsp;</TD>
140							<TD><%=Separate(RS1("TotalReceivable"))%>&nbsp;</TD>
141						</TR>
142<%						RS1.moveNext
143					Loop
144				end if
145				%>
146			</table>
147		</Td>
148	  </Tr>
149	  <Tr>
150		<Td colspan="2" valign="top" align="center">
151			<table class="CustTable" cellspacing='1' style='width:90%;'>
152				<tr>
153					<td colspan="10" class="CusTableHeader" style="background-color:#CCAA99;">������ ��� ���� ��� (����� ����)</td>
154				</tr>
155				<%
156				mySQL="SELECT Invoices.ID, Invoices.CreatedDate, Users.RealName AS Creator, Invoices.ApprovedDate, Invoices.TotalReceivable, Users_1.RealName AS Approver,  Users_2.RealName AS Issuer, Invoices.IssuedDate, ARItems.RemainedAmount FROM Invoices INNER JOIN Users ON Invoices.CreatedBy = Users.ID INNER JOIN Users Users_1 ON Invoices.ApprovedBy = Users_1.ID INNER JOIN Users Users_2 ON Invoices.IssuedBy = Users_2.ID INNER JOIN ARItems ON Invoices.ID = ARItems.Link WHERE (Invoices.Customer = '"& cusID & "') AND (Invoices.Voided = 0) AND (Invoices.Issued = 1) AND (ARItems.Type = 1) AND (ARItems.RemainedAmount > 0) ORDER BY Invoices.CreatedDate DESC, Invoices.ID"
157				Set RS1 = conn.execute(mySQL)
158				if RS1.eof then
159%>
160					<tr>
161						<td colspan="10" class="CusTD3">���</td>
162					</tr>
163<%
164				else
165%>					<tr>
166						<td class="CusTD3">#</td>
167						<td class="CusTD3">�����</td>
168						<td class="CusTD3">�����</td>
169						<td class="CusTD3">����� �����</td>
170						<td class="CusTD3">�����</td>
171						<td class="CusTD3">����� �����</td>
172						<td class="CusTD3">����</td>
173						<td class="CusTD3">����� ����</td>
174						<td class="CusTD3">����</td>
175						<td class="CusTD3">�����</td>
176					</tr>
177<%					tmpCounter=0
178					Do while not RS1.eof 
179						tmpCounter = tmpCounter + 1
180						if tmpCounter mod 2 = 1 then
181							tmpColor="#FFFFFF"
182							tmpColor2="#FFFFBB"
183						Else
184							tmpColor="#DDDDDD"
185							tmpColor2="#EEEEBB"
186						End if 
187						'alert(this.getElementByTagName('td').items(0).data);
188%>
189						<TR bgcolor="<%=tmpColor%>" style="cursor: hand;" onMouseOver="this.style.backgroundColor='<%=tmpColor2%>'" onMouseOut="this.style.backgroundColor='<%=tmpColor%>'" onclick="window.location='../AR/AccountReport.asp?act=showInvoice&invoice=<%=RS1("ID")%>';">
190							<TD style="height:30px;"><%=tmpCounter%></TD>
191							<TD style="height:30px;"><%=RS1("ID")%></TD>
192							<TD><%=RS1("�Creator")%>&nbsp;</TD>
193							<TD dir="LTR" align='right'><%=RS1("CreatedDate")%>&nbsp;</TD>
194							<TD><%=RS1("Approver")%>&nbsp;</TD>
195							<TD dir="LTR" align='right'><%=RS1("ApprovedDate")%>&nbsp;</TD>
196							<TD><%=RS1("Issuer")%>&nbsp;</TD>
197							<TD dir="LTR" align='right'><%=RS1("IssuedDate")%>&nbsp;</TD>
198							<TD><%=Separate(RS1("TotalReceivable"))%>&nbsp;</TD>
199							<TD><%=Separate(RS1("RemainedAmount"))%>&nbsp;</TD>
200						</TR>
201<%						RS1.moveNext
202					Loop
203				end if
204				%>
205			</table>
206		</Td>
207	  </Tr>
208 	</TaBlE>