FrmIndentNoSale.xml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Forms>
  3. <Form Name="FrmIndentNoSale">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @Title="订货未销";
  9. GetSchema();
  10. @CurrentRowIndex=0;
  11. if(Search("SearchIndentNoSaleBill",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID()))
  12. {
  13. Search("SearchIndentNoSaleBillProduct",#IndentBill.No_IndentBill);
  14. }
  15. ]]>
  16. </Load>
  17. <Mode>
  18. <Search>
  19. <Lable name="Search" />
  20. </Search>
  21. </Mode>
  22. </Events>
  23. <Controls>
  24. <IKExtendGrid name="dgBill" DataSource="IndentBill" TableStyleIndex="0">
  25. <DataColumn Index="0" DataSource="IndentBill.No_IndentBill" />
  26. <DataColumn Index="1" DataSource="IndentBill.Date_IndentBill"/>
  27. <DataColumn Index="2" DataSource="IndentBill.No_Customer" />
  28. <DataColumn Index="3" DataSource="IndentBill.ShortName_Customer" />
  29. <Events>
  30. <ClickPaste>
  31. ;
  32. </ClickPaste>
  33. <ClickExcel>
  34. ;
  35. </ClickExcel>
  36. <ClickPrint>
  37. ;
  38. </ClickPrint>
  39. <ClickPreview>
  40. Search("SearchTotal",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  41. PrintReport("FrmIndentNoSale","IndentBillNoSale");
  42. </ClickPreview>
  43. <ClickRefresh>
  44. Empty();
  45. if(Search("SearchIndentNoSaleBill",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID()))
  46. {
  47. Search("SearchIndentNoSaleBillProduct",#IndentBill.No_IndentBill);
  48. }
  49. </ClickRefresh>
  50. <ClickFirstPage>
  51. ;
  52. </ClickFirstPage>
  53. <ClickPrevPage>
  54. </ClickPrevPage>
  55. ;
  56. <ClickNextPage>
  57. ;
  58. </ClickNextPage>
  59. <ClickLastPage>
  60. ;
  61. </ClickLastPage>
  62. <ClickFilter>
  63. ;
  64. </ClickFilter>
  65. <ClickNOFilter>
  66. ;
  67. </ClickNOFilter>
  68. <ClickAdd>
  69. ;
  70. </ClickAdd>
  71. <ClickRemove>
  72. ;
  73. </ClickRemove>
  74. <CurrentCellChanged>
  75. <![CDATA[
  76. if(dgBill.dataGrid.CurrentRowIndex!=@CurrentRowIndex)
  77. {
  78. @CurrentRowIndex=dgBill.dataGrid.CurrentRowIndex;
  79. Empty("#IndentBillProduct");
  80. if(RowCount("#IndentBill","IKExtendGrid") != 0)
  81. Search("SearchIndentNoSaleBillProduct",dgBill.GetCurrentSpecifyValue("No_IndentBill"));
  82. }
  83. ]]>
  84. </CurrentCellChanged>
  85. </Events>
  86. </IKExtendGrid>
  87. <IKDataGridEx name="dgProduct" DataSource="IndentBillProduct" TableStyleIndex="0">
  88. <DataColumn Index="0" DataSource="IndentBillProduct.No_Product" />
  89. <DataColumn Index="1" DataSource="IndentBillProduct.Name_Product" />
  90. <DataColumn Index="2" DataSource="IndentBillProduct.Quantity_IndentBillProduct" />
  91. <DataColumn Index="3" DataSource="IndentBillProduct.Quantity_Sale"/>
  92. <DataColumn Index="4" DataSource="IndentBillProduct.AvailableQty_ProductStocks"/>
  93. <DataColumn Index="5" DataSource="IndentBillProduct.StockQty_ProductStocks"/>
  94. </IKDataGridEx>
  95. </Controls>
  96. </Client>
  97. <Server>
  98. <Tables>
  99. <Table name="IndentBill" Type="Parent">
  100. <GetSchema CmdType="Text" CmdText="
  101. Select Top 0 No_IndentBill,Date_IndentBill,No_Customer,ShortName_Customer
  102. From IndentBill
  103. Left Join Customer On Customer.ID_Customer = IndentBill.ID_Customer"/>
  104. </Table>
  105. <Table name="IndentBillProduct" Type="Child">
  106. <GetSchema CmdType="Text" CmdText="
  107. Select Top 0 No_Product,Name_Product,Quantity_IndentBillProduct,Quantity_Sale,CONVERT(DECIMAL,0.00) AS AvailableQty_ProductStocks,CONVERT(DECIMAL,0.00) AS StockQty_ProductStocks
  108. From IndentBillProduct
  109. Left Join Product On Product.ID_Product = IndentBillProduct.ID_Product
  110. "/>
  111. </Table>
  112. </Tables>
  113. <Search>
  114. <SearchIndentNoSaleBill CmdType="Text" CmdText="
  115. Select IndentBill.No_IndentBill,IndentBill.Date_IndentBill,No_Customer,ShortName_Customer
  116. From
  117. (
  118. Select distinct ID_IndentBill
  119. From IndentBillProduct
  120. where (Quantity_IndentBillProduct-Quantity_Sale) &gt; 0
  121. )A
  122. Left Join IndentBill On IndentBill.ID_IndentBill=A.ID_IndentBill
  123. Left Join Customer On Customer.ID_Customer=IndentBill.ID_Customer
  124. Where IndentBill.ID_Assessor Is Not Null
  125. And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End
  126. Order By No_IndentBill
  127. ">
  128. <Params>
  129. <Param name="@Right" type="IndentBill.ID_Customer" Index="0" />
  130. </Params>
  131. <Tables>
  132. <Table name="IndentBill"/>
  133. </Tables>
  134. </SearchIndentNoSaleBill>
  135. <SearchIndentNoSaleBillProduct CmdType="Text" CmdText="
  136. Declare @ID_Location uniqueidentifier
  137. SELECT @ID_Location=ID_Location From IndentBill Where No_IndentBill= @No_IndentBill
  138. SELECT D.No_Product, D.Name_Product, D.Quantity_IndentBillProduct, D.Quantity_Sale, ISNULL(E.StockQty_ProductStocks, 0) AS StockQty_ProductStocks, ISNULL(E.AvailableQty_ProductStocks, 0) AS AvailableQty_ProductStocks
  139. FROM
  140. (
  141. SELECT B.ID_Product, C.No_Product, C.Name_Product, ISNULL((B.Quantity_IndentBillProduct),0) As Quantity_IndentBillProduct, ISNULL((B.Quantity_Sale), 0) As Quantity_Sale
  142. FROM IndentBill A LEFT JOIN IndentBillProduct B ON A.ID_IndentBill = B.ID_IndentBill
  143. LEFT JOIN Product C ON B.ID_Product = C.ID_Product
  144. WHERE A.No_IndentBill = @No_IndentBill
  145. --Group By B.ID_Product, C.No_Product, C.Name_Product
  146. and ((B.Quantity_IndentBillProduct)-(B.Quantity_Sale)) &gt; 0
  147. ) D LEFT JOIN
  148. (
  149. SELECT A.ID_Product, ISNULL(Sum(A.StockQty_ProductStocks), 0) As StockQty_ProductStocks, ISNULL(Sum(A.AvailableQty_ProductStocks), 0) As AvailableQty_ProductStocks
  150. FROM ProductStocks A
  151. LEFT JOIN Location B On B.ID_Location = A.ID_Location
  152. WHERE B.ID_WareHouse = @ID_Location
  153. GROUP BY A.ID_Product
  154. ) E ON D.ID_Product = E.ID_Product
  155. ">
  156. <Params>
  157. <Param name="@No_IndentBill" type="IndentBill.No_IndentBill" Index="0" />
  158. </Params>
  159. <Tables>
  160. <Table name="IndentBillProduct"/>
  161. </Tables>
  162. </SearchIndentNoSaleBillProduct>
  163. <SearchTotal CmdType="Text" CmdText="
  164. Select No_IndentBill,Date_IndentBill,No_Customer,ShortName_Customer,No_Product,Name_Product,Quantity_IndentBillProduct,Quantity_Sale
  165. From
  166. (
  167. Select ID_IndentBill,ID_Product,Sum(Quantity_IndentBillProduct) As Quantity_IndentBillProduct,Sum(Quantity_Sale) As Quantity_Sale
  168. From IndentBillProduct
  169. where (Quantity_IndentBillProduct-Quantity_Sale) &gt; 0
  170. Group By ID_IndentBill,ID_Product
  171. )A
  172. Left Join IndentBill On IndentBill.ID_IndentBill=A.ID_IndentBill
  173. /*Left Join
  174. (
  175. Select ID_Product,ID_WareHouse,Sum(AvailableQty_ProductStocks),Sum(StockQty_ProductStocks)
  176. From ProductStocks
  177. left Join Location On Location.ID_Location=ProductStocks.ID_Location
  178. Group By ID_Product,ID_WareHouse
  179. )B On A.ID_Product=B.ID_Product And IndentBill.ID_Location=B.ID_WareHouse*/
  180. Left Join Product On Product.ID_Product=A.ID_Product
  181. Left Join Customer On Customer.ID_Customer=IndentBill.ID_Customer
  182. Where IndentBill.ID_Assessor Is Not Null
  183. And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End
  184. Order By No_IndentBill
  185. ">
  186. <Params>
  187. <Param name="@Right" type="IndentBill.ID_Customer" Index="0" />
  188. </Params>
  189. <Tables>
  190. <Table name="IndentBillNoSale"/>
  191. </Tables>
  192. </SearchTotal>
  193. </Search>
  194. </Server>
  195. <Lables>
  196. <Search>
  197. </Search>
  198. </Lables>
  199. </Form>
  200. </Forms>