PageRenderTime 46ms CodeModel.GetById 37ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/beta/CRM/include_CRM_APData.asp

http://github.com/khaneh/Orders
ASP | 208 lines | 194 code | 4 blank | 10 comment | 17 complexity | f63aada0bc70b12268fc421c5108f8ae MD5 | raw file
  1<%'
  2  'This Include file needs the variables below:
  3  '
  4  '		Conn	
  5  '		cusID	(Customer ID)
  6  '
  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	  <Tr>
 25		<Td colspan="2" valign="center" align="center">
 26			<BR>
 27			<% if Auth(7 , 1) then %><input class="GenButton" type="button" value="���� ������" onclick="window.open('../AP/voucherInput.asp?act=show&selectedCustomer=<%=cusID%>');" <% if AccountIsDisabled then %> disabled <% end if %>> <% end if %> 
 28			<% if Auth(7 , 4) then %><input class="GenButton" type="button" value="���� �������" onclick="window.open('../AP/MemoInput.asp?act=getMemo&selectedCustomer=<%=cusID%>');" <% if AccountIsDisabled then %> disabled <% end if %>> <% end if %> 
 29			<% if Auth(7 , 6) then %><input class="GenButton" type="button" value="�����" onclick="window.open('../AP/ItemsRelation.asp?sys=AR&act=relate&selectedCustomer=<%=CusID%>');"> <% end if %> 
 30			<% if Auth(7 , 5) then %><input class="GenButton" type="button" value="����� ����" onclick="window.open('../AP/AccountReport.asp?sys=AR&act=show&selectedCustomer=<%=CusID%>');"> <% end if %> 
 31			<% if Auth(7 , 3) then %><input class="GenButton" type="button" value="����� ���" onclick="window.open('../AP/IsA-VouchersReport.asp?selectedCustomer=<%=CusID%>');"> <% end if %> 
 32
 33			<BR><BR>
 34		</Td>
 35	  </Tr>
 36	  <Tr>
 37		<Td colspan="2" valign="top" align="center">
 38			<table class="CustTable" cellspacing='1' style='width:90%;'>
 39				<tr>
 40					<td colspan="5" class="CusTableHeader">����� ��� ���� �� ����� (���� ���� � ���� ����)</td>
 41				</tr>
 42				<%
 43				mySQL="SELECT * FROM PurchaseOrders WHERE (Vendor_ID = '"& cusID & "') AND (Status <> N'OK' AND Status <> N'CANCEL') ORDER BY OrdDate DESC, ID"
 44				Set RS1 = conn.execute(mySQL)
 45				if RS1.eof then
 46%>
 47					<tr>
 48						<td colspan="5" class="CusTD3">���</td>
 49					</tr>
 50<%
 51				else
 52%>					<tr>
 53						<td class="CusTD3">#</td>
 54						<td class="CusTD3">�����</td>
 55						<td class="CusTD3">�����</td>
 56						<td class="CusTD3">���</td>
 57						<td class="CusTD3">�����</td>
 58					</tr>
 59<%					tmpCounter=0
 60					Do while not RS1.eof 
 61						tmpCounter = tmpCounter + 1
 62						if tmpCounter mod 2 = 1 then
 63							tmpColor="#FFFFFF"
 64							tmpColor2="#FFFFBB"
 65						Else
 66							tmpColor="#DDDDDD"
 67							tmpColor2="#EEEEBB"
 68						End if 
 69						'alert(this.getElementByTagName('td').items(0).data);
 70%>
 71						<TR bgcolor="<%=tmpColor%>" style="cursor: hand;" onMouseOver="this.style.backgroundColor='<%=tmpColor2%>'" onMouseOut="this.style.backgroundColor='<%=tmpColor%>'" onclick="window.open('../purchase/outServiceTrace.asp?od=<%=RS1("ID")%>');">
 72							<TD style="height:30px;"><%=tmpCounter%></TD>
 73							<TD style="height:30px;"><%=RS1("ID")%></TD>
 74							<TD dir="LTR" align='right'><%=RS1("OrdDate")%>&nbsp;</TD>
 75							<TD><%=RS1("TypeName")%>&nbsp;</TD>
 76							<TD><%=RS1("Status")%>&nbsp;</TD>
 77						</TR>
 78<%						RS1.moveNext
 79					Loop
 80				end if
 81				%>
 82			</table>
 83		</Td>
 84	  </Tr>
 85	  <Tr>
 86		<Td colspan="2" valign="top" align="center">
 87			<table class="CustTable" cellspacing='1' style='width:90%;'>
 88				<tr>
 89					<td colspan="7" class="CusTableHeader" style="background-color:#CCCC99;">������ ��� ���� �� ����� (����� ����)</td>
 90				</tr>
 91				<%
 92				mySQL="SELECT Vouchers.id, Vouchers.CreationDate, Users.RealName AS Creator, Vouchers.TotalPrice FROM Vouchers INNER JOIN Users ON Vouchers.CreatedBy = Users.ID WHERE (Vouchers.Voided = 0) AND (Vouchers.VendorID = '"& cusID & "') AND (Vouchers.Verified = 0) ORDER BY Vouchers.CreationDate DESC, Vouchers.id"
 93				Set RS1 = conn.execute(mySQL)
 94				if RS1.eof then
 95%>
 96					<tr>
 97						<td colspan="7" class="CusTD3">���</td>
 98					</tr>
 99<%
100				else
101%>					<tr>
102						<td class="CusTD3">#</td>
103						<td class="CusTD3"># ������ ����</td>
104						<td class="CusTD3">����� �����</td>
105						<td class="CusTD3">����� �����</td>
106						<td class="CusTD3">����� �� ����� ����</td>
107						<td class="CusTD3">����</td>
108					</tr>
109<%					tmpCounter=0
110					Do while not RS1.eof 
111						RelatedPurchaseOrders = ""
112						tmpsep=""
113
114						mySQL="SELECT RelatedPurchaseOrderID FROM VoucherLines WHERE (Voucher_ID = '"& RS1("ID") & "')"
115
116						Set RS2 = conn.execute(mySQL)
117						Do While not RS2.eof 
118							RelatedPurchaseOrders = RelatedPurchaseOrders & tmpsep & RS2("RelatedPurchaseOrderID")
119							tmpsep=", "
120							RS2.Movenext
121						Loop
122						RS2.close
123						Set Rs2=Nothing
124						tmpCounter = tmpCounter + 1
125						if tmpCounter mod 2 = 1 then
126							tmpColor="#FFFFFF"
127							tmpColor2="#FFFFBB"
128						Else
129							tmpColor="#DDDDDD"
130							tmpColor2="#EEEEBB"
131						End if 
132						'alert(this.getElementByTagName('td').items(0).data);
133%>
134						<TR bgcolor="<%=tmpColor%>" style="cursor: hand;" onMouseOver="this.style.backgroundColor='<%=tmpColor2%>'" onMouseOut="this.style.backgroundColor='<%=tmpColor%>'" onclick="window.open('../AP/AccountReport.asp?act=showVoucher&voucher=<%=RS1("ID")%>');">
135							<TD style="height:30px;"><%=tmpCounter%></TD>
136							<TD style="height:30px;"><%=RS1("ID")%></TD>
137							<TD><%=RS1("�Creator")%>&nbsp;</TD>
138							<TD dir="LTR" align='right'><%=RS1("CreationDate")%>&nbsp;</TD>
139							<TD dir="LTR" align='right'><%=RelatedPurchaseOrders%>&nbsp;</TD>
140							<TD><%=Separate(RS1("TotalPrice"))%>&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 Vouchers.id, Vouchers.CreationDate, Users.RealName AS Creator, Vouchers.TotalPrice, Users_1.RealName AS Approver, APItems.CreatedDate AS ApprovedDate, APItems.RemainedAmount, APItems.EffectiveDate FROM Vouchers INNER JOIN Users ON Vouchers.CreatedBy = Users.ID INNER JOIN APItems ON Vouchers.id = APItems.Link INNER JOIN Users Users_1 ON APItems.CreatedBy = Users_1.ID WHERE (Vouchers.VendorID = '"& cusID & "') AND (Vouchers.Voided = 0) AND (Vouchers.Verified = 1) AND (APItems.RemainedAmount > 0) AND (APItems.Type = 6) ORDER BY Vouchers.CreationDate DESC, Vouchers.id"
157
158'response.write mySQL
159'response.end
160				Set RS1 = conn.execute(mySQL)
161				if RS1.eof then
162%>
163					<tr>
164						<td colspan="10" class="CusTD3">���</td>
165					</tr>
166<%
167				else
168%>					<tr>
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						<td class="CusTD3">����</td>
177						<td class="CusTD3">�����</td>
178					</tr>
179<%					tmpCounter=0
180					Do while not RS1.eof 
181						tmpCounter = tmpCounter + 1
182						if tmpCounter mod 2 = 1 then
183							tmpColor="#FFFFFF"
184							tmpColor2="#FFFFBB"
185						Else
186							tmpColor="#DDDDDD"
187							tmpColor2="#EEEEBB"
188						End if 
189						'alert(this.getElementByTagName('td').items(0).data);
190%>
191						<TR bgcolor="<%=tmpColor%>" style="cursor: hand;" onMouseOver="this.style.backgroundColor='<%=tmpColor2%>'" onMouseOut="this.style.backgroundColor='<%=tmpColor%>'" onclick="window.open('../AP/AccountReport.asp?act=showVoucher&voucher=<%=RS1("ID")%>');">
192							<TD style="height:30px;"><%=tmpCounter%></TD>
193							<TD style="height:30px;"><%=RS1("ID")%></TD>
194							<TD><%=RS1("�Creator")%>&nbsp;</TD>
195							<TD dir="LTR" align='right'><%=RS1("CreationDate")%>&nbsp;</TD>
196							<TD><%=RS1("Approver")%>&nbsp;</TD>
197							<TD dir="LTR" align='right'><%=RS1("ApprovedDate")%>&nbsp;</TD>
198							<TD dir="LTR" align='right'><%=RS1("EffectiveDate")%>&nbsp;</TD>
199							<TD><%=Separate(RS1("TotalPrice"))%>&nbsp;</TD>
200							<TD><%=Separate(RS1("RemainedAmount"))%>&nbsp;</TD>
201						</TR>
202<%						RS1.moveNext
203					Loop
204				end if
205				%>
206			</table>
207		</Td>
208	  </Tr>