/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. <BR><BR>
  33. </Td>
  34. </Tr>
  35. <Tr>
  36. <Td colspan="2" valign="top" align="center">
  37. <table class="CustTable" cellspacing='1' style='width:90%;'>
  38. <tr>
  39. <td colspan="5" class="CusTableHeader"> ( )</td>
  40. </tr>
  41. <%
  42. mySQL="SELECT * FROM PurchaseOrders WHERE (Vendor_ID = '"& cusID & "') AND (Status <> N'OK' AND Status <> N'CANCEL') ORDER BY OrdDate DESC, ID"
  43. Set RS1 = conn.execute(mySQL)
  44. if RS1.eof then
  45. %>
  46. <tr>
  47. <td colspan="5" class="CusTD3"></td>
  48. </tr>
  49. <%
  50. else
  51. %> <tr>
  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. tmpCounter = tmpCounter + 1
  61. if tmpCounter mod 2 = 1 then
  62. tmpColor="#FFFFFF"
  63. tmpColor2="#FFFFBB"
  64. Else
  65. tmpColor="#DDDDDD"
  66. tmpColor2="#EEEEBB"
  67. End if
  68. 'alert(this.getElementByTagName('td').items(0).data);
  69. %>
  70. <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")%>');">
  71. <TD style="height:30px;"><%=tmpCounter%></TD>
  72. <TD style="height:30px;"><%=RS1("ID")%></TD>
  73. <TD dir="LTR" align='right'><%=RS1("OrdDate")%>&nbsp;</TD>
  74. <TD><%=RS1("TypeName")%>&nbsp;</TD>
  75. <TD><%=RS1("Status")%>&nbsp;</TD>
  76. </TR>
  77. <% RS1.moveNext
  78. Loop
  79. end if
  80. %>
  81. </table>
  82. </Td>
  83. </Tr>
  84. <Tr>
  85. <Td colspan="2" valign="top" align="center">
  86. <table class="CustTable" cellspacing='1' style='width:90%;'>
  87. <tr>
  88. <td colspan="7" class="CusTableHeader" style="background-color:#CCCC99;"> ( )</td>
  89. </tr>
  90. <%
  91. 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"
  92. Set RS1 = conn.execute(mySQL)
  93. if RS1.eof then
  94. %>
  95. <tr>
  96. <td colspan="7" class="CusTD3"></td>
  97. </tr>
  98. <%
  99. else
  100. %> <tr>
  101. <td class="CusTD3">#</td>
  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. </tr>
  108. <% tmpCounter=0
  109. Do while not RS1.eof
  110. RelatedPurchaseOrders = ""
  111. tmpsep=""
  112. mySQL="SELECT RelatedPurchaseOrderID FROM VoucherLines WHERE (Voucher_ID = '"& RS1("ID") & "')"
  113. Set RS2 = conn.execute(mySQL)
  114. Do While not RS2.eof
  115. RelatedPurchaseOrders = RelatedPurchaseOrders & tmpsep & RS2("RelatedPurchaseOrderID")
  116. tmpsep=", "
  117. RS2.Movenext
  118. Loop
  119. RS2.close
  120. Set Rs2=Nothing
  121. tmpCounter = tmpCounter + 1
  122. if tmpCounter mod 2 = 1 then
  123. tmpColor="#FFFFFF"
  124. tmpColor2="#FFFFBB"
  125. Else
  126. tmpColor="#DDDDDD"
  127. tmpColor2="#EEEEBB"
  128. End if
  129. 'alert(this.getElementByTagName('td').items(0).data);
  130. %>
  131. <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")%>');">
  132. <TD style="height:30px;"><%=tmpCounter%></TD>
  133. <TD style="height:30px;"><%=RS1("ID")%></TD>
  134. <TD><%=RS1("Creator")%>&nbsp;</TD>
  135. <TD dir="LTR" align='right'><%=RS1("CreationDate")%>&nbsp;</TD>
  136. <TD dir="LTR" align='right'><%=RelatedPurchaseOrders%>&nbsp;</TD>
  137. <TD><%=Separate(RS1("TotalPrice"))%>&nbsp;</TD>
  138. </TR>
  139. <% RS1.moveNext
  140. Loop
  141. end if
  142. %>
  143. </table>
  144. </Td>
  145. </Tr>
  146. <Tr>
  147. <Td colspan="2" valign="top" align="center">
  148. <table class="CustTable" cellspacing='1' style='width:90%;'>
  149. <tr>
  150. <td colspan="10" class="CusTableHeader" style="background-color:#CCAA99;"> ( )</td>
  151. </tr>
  152. <%
  153. 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"
  154. 'response.write mySQL
  155. 'response.end
  156. Set RS1 = conn.execute(mySQL)
  157. if RS1.eof then
  158. %>
  159. <tr>
  160. <td colspan="10" class="CusTD3"></td>
  161. </tr>
  162. <%
  163. else
  164. %> <tr>
  165. <td class="CusTD3">#</td>
  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. </tr>
  175. <% tmpCounter=0
  176. Do while not RS1.eof
  177. tmpCounter = tmpCounter + 1
  178. if tmpCounter mod 2 = 1 then
  179. tmpColor="#FFFFFF"
  180. tmpColor2="#FFFFBB"
  181. Else
  182. tmpColor="#DDDDDD"
  183. tmpColor2="#EEEEBB"
  184. End if
  185. 'alert(this.getElementByTagName('td').items(0).data);
  186. %>
  187. <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")%>');">
  188. <TD style="height:30px;"><%=tmpCounter%></TD>
  189. <TD style="height:30px;"><%=RS1("ID")%></TD>
  190. <TD><%=RS1("Creator")%>&nbsp;</TD>
  191. <TD dir="LTR" align='right'><%=RS1("CreationDate")%>&nbsp;</TD>
  192. <TD><%=RS1("Approver")%>&nbsp;</TD>
  193. <TD dir="LTR" align='right'><%=RS1("ApprovedDate")%>&nbsp;</TD>
  194. <TD dir="LTR" align='right'><%=RS1("EffectiveDate")%>&nbsp;</TD>
  195. <TD><%=Separate(RS1("TotalPrice"))%>&nbsp;</TD>
  196. <TD><%=Separate(RS1("RemainedAmount"))%>&nbsp;</TD>
  197. </TR>
  198. <% RS1.moveNext
  199. Loop
  200. end if
  201. %>
  202. </table>
  203. </Td>
  204. </Tr>