FrmSaleRtnNoInDepot.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Forms>
  3. <Form Name="FrmSaleRtnNoInDepot">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @Title="销退未入库";
  9. GetSchema();
  10. Search("SearchSystemSetting");
  11. @SaleBackAndInDepot = #System.SaleBackAndInDepot_SystemSetting;
  12. if(@SaleBackAndInDepot != 0)
  13. {
  14. if(Search("SearchSaleRtnNoInBillHaveFlow",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID()))
  15. Search("SearchSaleRtnNoInBillProductHaveFlow",#SaleRtnNoInBill.No_SaleRtnBill,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  16. }
  17. else
  18. {
  19. if(Search("SearchSaleRtnNoInBillNoFlow",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID()))
  20. Search("SearchSaleRtnNoInBillProductNoFlow",#SaleRtnNoInBill.No_SaleRtnBill,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  21. }
  22. txtSalRtnSum.CValue = SumOfCol("#SaleRtnNoInBillProduct.Quantity_SaleRtn");
  23. txtIndepotSum.CValue = SumOfCol("#SaleRtnNoInBillProduct.Quantity_InDepot");
  24. ]]>
  25. </Load>
  26. </Events>
  27. <Mode>
  28. <Search>
  29. <Lable name="Search"/>
  30. </Search>
  31. </Mode>
  32. <Controls>
  33. <IKExtendGrid name="dgSaleRtnBill" DataSource="SaleRtnNoInBill" TableStyleIndex="0">
  34. <DataColumn Index="0" DataSource="SaleRtnNoInBill.No_SaleRtnBill" />
  35. <DataColumn Index="1" DataSource="SaleRtnNoInBill.Date_SaleRtnBill"/>
  36. <DataColumn Index="2" DataSource="SaleRtnNoInBill.No_Customer" />
  37. <DataColumn Index="3" DataSource="SaleRtnNoInBill.ShortName_Customer" />
  38. <DataColumn Index="4" DataSource="SaleRtnNoInBill.Reason_SaleRtnBill" />
  39. <Events>
  40. <ClickPaste>
  41. ;
  42. </ClickPaste>
  43. <ClickExcel>
  44. ;
  45. </ClickExcel>
  46. <ClickPrint>
  47. ;
  48. </ClickPrint>
  49. <ClickPreview>
  50. PrintReport(dgSaleRtnBill.CurrentView,"FrmSaleRtnNoInDepot",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  51. </ClickPreview>
  52. <ClickRefresh>
  53. Empty();
  54. if(@SaleBackAndInDepot != 0)
  55. {
  56. if(Search("SearchSaleRtnNoInBillHaveFlow",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID()))
  57. Search("SearchSaleRtnNoInBillProductHaveFlow",#SaleRtnNoInBill.No_SaleRtnBill,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  58. }
  59. else
  60. {
  61. if(Search("SearchSaleRtnNoInBillNoFlow",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID()))
  62. Search("SearchSaleRtnNoInBillProductNoFlow",#SaleRtnNoInBill.No_SaleRtnBill,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  63. }
  64. txtSalRtnSum.CValue = SumOfCol("#SaleRtnNoInBillProduct.Quantity_SaleRtn");
  65. txtIndepotSum.CValue = SumOfCol("#SaleRtnNoInBillProduct.Quantity_InDepot");
  66. </ClickRefresh>
  67. <ClickFirstPage>
  68. ;
  69. </ClickFirstPage>
  70. <ClickPrevPage>
  71. </ClickPrevPage>
  72. ;
  73. <ClickNextPage>
  74. ;
  75. </ClickNextPage>
  76. <ClickLastPage>
  77. ;
  78. </ClickLastPage>
  79. <ClickFilter>
  80. <![CDATA[
  81. Empty("#SaleRtnNoInBillProduct");
  82. if(RowCount("#SaleRtnNoInBill","IKExtendGrid") != 0)
  83. {
  84. if(@SaleBackAndInDepot != 0)
  85. Search("SearchSaleRtnNoInBillProductHaveFlow",dgSaleRtnBill.GetCurrentSpecifyValue("No_SaleRtnBill"),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  86. else
  87. Search("SearchSaleRtnNoInBillProductNoFlow",dgSaleRtnBill.GetCurrentSpecifyValue("No_SaleRtnBill"),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  88. }
  89. txtSalRtnSum.CValue = SumOfCol("#SaleRtnNoInBillProduct.Quantity_SaleRtn");
  90. txtIndepotSum.CValue = SumOfCol("#SaleRtnNoInBillProduct.Quantity_InDepot");
  91. ]]>
  92. </ClickFilter>
  93. <ClickNOFilter>
  94. <![CDATA[
  95. Empty("#SaleRtnNoInBillProduct");
  96. if(RowCount("#SaleRtnNoInBill","IKExtendGrid") != 0)
  97. {
  98. if(@SaleBackAndInDepot != 0)
  99. Search("SearchSaleRtnNoInBillProductHaveFlow",dgSaleRtnBill.GetCurrentSpecifyValue("No_SaleRtnBill"),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  100. else
  101. Search("SearchSaleRtnNoInBillProductNoFlow",dgSaleRtnBill.GetCurrentSpecifyValue("No_SaleRtnBill"),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  102. }
  103. txtSalRtnSum.CValue = SumOfCol("#SaleRtnNoInBillProduct.Quantity_SaleRtn");
  104. txtIndepotSum.CValue = SumOfCol("#SaleRtnNoInBillProduct.Quantity_InDepot");
  105. ]]>
  106. </ClickNOFilter>
  107. <ClickAdd>
  108. ;
  109. </ClickAdd>
  110. <ClickRemove>
  111. ;
  112. </ClickRemove>
  113. <CurrentCellChanged>
  114. <![CDATA[
  115. Empty("#SaleRtnNoInBillProduct");
  116. if(RowCount("#SaleRtnNoInBill","IKExtendGrid") != 0)
  117. {
  118. if(@SaleBackAndInDepot != 0)
  119. Search("SearchSaleRtnNoInBillProductHaveFlow",dgSaleRtnBill.GetCurrentSpecifyValue("No_SaleRtnBill"),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  120. else
  121. Search("SearchSaleRtnNoInBillProductNoFlow",dgSaleRtnBill.GetCurrentSpecifyValue("No_SaleRtnBill"),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  122. }
  123. txtSalRtnSum.CValue = SumOfCol("#SaleRtnNoInBillProduct.Quantity_SaleRtn");
  124. txtIndepotSum.CValue = SumOfCol("#SaleRtnNoInBillProduct.Quantity_InDepot");
  125. ]]>
  126. </CurrentCellChanged>
  127. </Events>
  128. </IKExtendGrid>
  129. <IKDataGridEx name="dgProduct" DataSource="SaleRtnNoInBillProduct" TableStyleIndex="0">
  130. <DataColumn Index="0" DataSource="SaleRtnNoInBillProduct.No_Product" />
  131. <DataColumn Index="1" DataSource="SaleRtnNoInBillProduct.Name_Product" />
  132. <DataColumn Index="2" DataSource="SaleRtnNoInBillProduct.Quantity_SaleRtn" />
  133. <DataColumn Index="3" DataSource="SaleRtnNoInBillProduct.Quantity_InDepot"/>
  134. </IKDataGridEx>
  135. </Controls>
  136. </Client>
  137. <Server>
  138. <Tables>
  139. <Table name="SaleRtnNoInBill" Type="Parent">
  140. <GetSchema CmdType="Text" CmdText="select top 0 SaleRtnBill.No_SaleRtnBill,SaleRtnBill.Date_SaleRtnBill,Customer.No_Customer,
  141. Customer.ShortName_Customer,SaleRtnBill.Reason_SaleRtnBill
  142. from SaleRtnBill
  143. left join Customer on Customer.ID_Customer=SaleRtnBill.ID_Customer"/>
  144. </Table>
  145. <Table name="SaleRtnNoInBillProduct" Type="Child">
  146. <GetSchema CmdType="Text" CmdText="select top 0 Product.No_Product,
  147. Product.Name_Product,SaleSourceBillProduct.Quantity_SaleRtn,SaleSourceBillProduct.Quantity_InDepot
  148. from SaleRtnBill
  149. left join SaleRtnBillProduct on SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
  150. left join SaleSourceBillProduct on SaleSourceBillProduct.ID_SaleSourceBillProduct=SaleRtnBillProduct.ID_SaleSourceBillProduct
  151. left join Product on SaleRtnBillProduct.ID_Product=Product.ID_Product"/>
  152. </Table>
  153. </Tables>
  154. <Search>
  155. <SearchSaleRtnNoInBillHaveFlow CmdType="Text" CmdText="SELECT distinct F.No_SaleRtnBill, F.Date_SaleRtnBill,F.Reason_SaleRtnBill, G.No_Customer, G.ShortName_Customer
  156. FROM
  157. (
  158. SELECT ID_SaleRtnBill, No_SaleRtnBill, ID_Product, isnull(SUM(Quantity_SaleRtnBillProduct),0.00) AS Quantity_SaleRtn, isnull(SUM(Quantity_ModifyDepotBillProduct),0.00) AS Quantity_InDepot
  159. FROM
  160. (
  161. SELECT A.ID_SaleRtnBill, A.No_SaleRtnBill, B.ID_Product, B.Quantity_SaleRtnBillProduct, C.Quantity_ModifyDepotBillProduct
  162. FROM SaleRtnBill A
  163. LEFT JOIN SaleRtnBillProduct B on A.ID_SaleRtnBill=B.ID_SaleRtnBill
  164. left join (select Sum(Quantity_ModifyDepotBillProduct) as Quantity_ModifyDepotBillProduct,No_FromBill,No_FromBillProduct,Type_FromBill from ModifyDepotBillProduct
  165. left join ModifyDepotBill on ModifyDepotBill.ID_ModifyDepotBill = ModifyDepotBillProduct.ID_ModifyDepotBill
  166. where ModifyDepotBill.ID_Assessor is not null
  167. Group by No_FromBill,No_FromBillProduct,Type_FromBill
  168. )C on
  169. C.No_FromBill = A.No_SaleRtnBill and
  170. C.No_FromBillProduct=B.No_SaleRtnBillProduct and
  171. C.Type_FromBill=22
  172. WHERE A.ID_Assessor is not null
  173. ) D
  174. GROUP BY ID_SaleRtnBill, No_SaleRtnBill, ID_Product
  175. ) E
  176. LEFT JOIN SaleRtnBill F ON E.ID_SaleRtnBill = F.ID_SaleRtnBill
  177. LEFT JOIN Customer G ON F.ID_Customer = G.ID_Customer
  178. LEFT JOIN Product H ON E.ID_Product = H.ID_Product
  179. WHERE E.Quantity_SaleRtn &gt; E.Quantity_InDepot
  180. And G.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then G.ID_Creator Else @Right End --added for validating right
  181. Order By F.No_SaleRtnBill">
  182. <Params>
  183. <Param name="@Right" type="SaleBill.ID_Customer" Index="0" />
  184. </Params>
  185. <Tables>
  186. <Table name="SaleRtnNoInBill"/>
  187. </Tables>
  188. </SearchSaleRtnNoInBillHaveFlow>
  189. <SearchSaleRtnNoInBillProductHaveFlow CmdType="Text" CmdText="SELECT H.No_Product, H.Name_Product, E.Quantity_SaleRtn, E.Quantity_InDepot
  190. FROM
  191. (
  192. SELECT ID_SaleRtnBill, No_SaleRtnBill, ID_Product, isnull(SUM(Quantity_SaleRtnBillProduct),0.00) AS Quantity_SaleRtn, isnull(SUM(Quantity_ModifyDepotBillProduct),0.00) AS Quantity_InDepot
  193. FROM
  194. (
  195. SELECT A.ID_SaleRtnBill, A.No_SaleRtnBill, B.ID_Product, B.Quantity_SaleRtnBillProduct, C.Quantity_ModifyDepotBillProduct
  196. FROM SaleRtnBill A
  197. LEFT JOIN SaleRtnBillProduct B on A.ID_SaleRtnBill=B.ID_SaleRtnBill
  198. left join (select Sum(Quantity_ModifyDepotBillProduct) as Quantity_ModifyDepotBillProduct,No_FromBill,No_FromBillProduct,Type_FromBill from ModifyDepotBillProduct
  199. left join ModifyDepotBill on ModifyDepotBill.ID_ModifyDepotBill = ModifyDepotBillProduct.ID_ModifyDepotBill
  200. where ModifyDepotBill.ID_Assessor is not null
  201. Group by No_FromBill,No_FromBillProduct,Type_FromBill
  202. )C on
  203. C.No_FromBill = A.No_SaleRtnBill and
  204. C.No_FromBillProduct=B.No_SaleRtnBillProduct and
  205. C.Type_FromBill=22
  206. WHERE A.ID_Assessor is not null AND A.No_SaleRtnBill = @No_SaleRtnBill
  207. ) D
  208. GROUP BY ID_SaleRtnBill, No_SaleRtnBill, ID_Product
  209. ) E
  210. LEFT JOIN SaleRtnBill F ON E.ID_SaleRtnBill = F.ID_SaleRtnBill
  211. LEFT JOIN Customer G ON F.ID_Customer = G.ID_Customer
  212. LEFT JOIN Product H ON E.ID_Product = H.ID_Product
  213. WHERE E.Quantity_SaleRtn &gt; E.Quantity_InDepot AND F.No_SaleRtnBill = @No_SaleRtnBill
  214. And G.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then G.ID_Creator Else @Right End --added for validating right
  215. Order By F.No_SaleRtnBill">
  216. <Params>
  217. <Param name="@No_SaleRtnBill" type="SaleRtnBill.No_SaleRtnBill" Index="0" />
  218. <Param name="@Right" type="SaleBill.ID_Customer" Index="1" />
  219. </Params>
  220. <Tables>
  221. <Table name="SaleRtnNoInBillProduct"/>
  222. </Tables>
  223. </SearchSaleRtnNoInBillProductHaveFlow>
  224. <SearchSystemSetting CmdType="Text" CmdText=" SELECT SaleBackAndInDepot_SystemSetting FROM SystemSetting">
  225. <Tables>
  226. <Table name="System"/>
  227. </Tables>
  228. </SearchSystemSetting>
  229. <SearchSaleRtnNoInBillNoFlow CmdType="Text" CmdText="SELECT distinct F.No_SaleRtnBill, F.Date_SaleRtnBill,F.Reason_SaleRtnBill, G.No_Customer, G.ShortName_Customer
  230. FROM
  231. (
  232. SELECT ID_SaleRtnBill, No_SaleRtnBill, ID_Product, isnull(SUM(Quantity_SaleRtnBillProduct),0.00) AS Quantity_SaleRtn, isnull(SUM(Quantity_ModifyDepotBillProduct),0.00) AS Quantity_InDepot
  233. FROM
  234. (
  235. SELECT A.ID_SaleRtnBill, A.No_SaleRtnBill, B.ID_Product, B.Quantity_SaleRtnBillProduct, C.Quantity_ModifyDepotBillProduct
  236. FROM SaleRtnBill A
  237. LEFT JOIN SaleRtnBillProduct B on A.ID_SaleRtnBill=B.ID_SaleRtnBill
  238. left join (select Sum(Quantity_ModifyDepotBillProduct) as Quantity_ModifyDepotBillProduct,No_FromBill,No_FromBillProduct,Type_FromBill from ModifyDepotBillProduct
  239. left join ModifyDepotBill on ModifyDepotBill.ID_ModifyDepotBill = ModifyDepotBillProduct.ID_ModifyDepotBill
  240. where ModifyDepotBill.ID_Assessor is not null
  241. Group by No_FromBill,No_FromBillProduct,Type_FromBill
  242. )C on
  243. C.No_FromBill = A.No_SaleRtnBill and
  244. C.No_FromBillProduct=B.No_SaleRtnBillProduct and
  245. C.Type_FromBill=22
  246. WHERE A.ID_Assessor is not null
  247. ) D
  248. GROUP BY ID_SaleRtnBill, No_SaleRtnBill, ID_Product
  249. ) E
  250. LEFT JOIN SaleRtnBill F ON E.ID_SaleRtnBill = F.ID_SaleRtnBill
  251. LEFT JOIN Customer G ON F.ID_Customer = G.ID_Customer
  252. LEFT JOIN Product H ON E.ID_Product = H.ID_Product
  253. WHERE E.Quantity_SaleRtn &gt; E.Quantity_InDepot
  254. And G.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then G.ID_Creator Else @Right End --added for validating right
  255. Order By F.No_SaleRtnBill">
  256. <Params>
  257. <Param name="@Right" type="SaleBill.ID_Customer" Index="0" />
  258. </Params>
  259. <Tables>
  260. <Table name="SaleRtnNoInBill"/>
  261. </Tables>
  262. </SearchSaleRtnNoInBillNoFlow>
  263. <SearchSaleRtnNoInBillProductNoFlow CmdType="Text" CmdText="SELECT H.No_Product, H.Name_Product, E.Quantity_SaleRtn, E.Quantity_InDepot
  264. FROM
  265. (
  266. SELECT ID_SaleRtnBill, No_SaleRtnBill, ID_Product, isnull(SUM(Quantity_SaleRtnBillProduct),0.00) AS Quantity_SaleRtn, isnull(SUM(Quantity_ModifyDepotBillProduct),0.00) AS Quantity_InDepot
  267. FROM
  268. (
  269. SELECT A.ID_SaleRtnBill, A.No_SaleRtnBill, B.ID_Product, B.Quantity_SaleRtnBillProduct, C.Quantity_ModifyDepotBillProduct
  270. FROM SaleRtnBill A
  271. LEFT JOIN SaleRtnBillProduct B on A.ID_SaleRtnBill=B.ID_SaleRtnBill
  272. left join (select Sum(Quantity_ModifyDepotBillProduct) as Quantity_ModifyDepotBillProduct,No_FromBill,No_FromBillProduct,Type_FromBill from ModifyDepotBillProduct
  273. left join ModifyDepotBill on ModifyDepotBill.ID_ModifyDepotBill = ModifyDepotBillProduct.ID_ModifyDepotBill
  274. where ModifyDepotBill.ID_Assessor is not null
  275. Group by No_FromBill,No_FromBillProduct,Type_FromBill
  276. )C on
  277. C.No_FromBill = A.No_SaleRtnBill and
  278. C.No_FromBillProduct=B.No_SaleRtnBillProduct and
  279. C.Type_FromBill=22
  280. WHERE A.ID_Assessor is not null and A.No_SaleRtnBill = @No_SaleRtnBill
  281. ) D
  282. GROUP BY ID_SaleRtnBill, No_SaleRtnBill, ID_Product
  283. ) E
  284. LEFT JOIN SaleRtnBill F ON E.ID_SaleRtnBill = F.ID_SaleRtnBill
  285. LEFT JOIN Customer G ON F.ID_Customer = G.ID_Customer
  286. LEFT JOIN Product H ON E.ID_Product = H.ID_Product
  287. WHERE E.Quantity_SaleRtn &gt; E.Quantity_InDepot AND F.No_SaleRtnBill = @No_SaleRtnBill
  288. And G.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then G.ID_Creator Else @Right End --added for validating right
  289. Order By F.No_SaleRtnBill">
  290. <Params>
  291. <Param name="@No_SaleRtnBill" type="SaleRtnBill.No_SaleRtnBill" Index="0" />
  292. <Param name="@Right" type="SaleBill.ID_Customer" Index="1" />
  293. </Params>
  294. <Tables>
  295. <Table name="SaleRtnNoInBillProduct"/>
  296. </Tables>
  297. </SearchSaleRtnNoInBillProductNoFlow>
  298. </Search>
  299. </Server>
  300. <Lables>
  301. <Search>
  302. </Search>
  303. <New>
  304. </New>
  305. <View>
  306. </View>
  307. <Modify>
  308. </Modify>
  309. </Lables>
  310. </Form>
  311. </Forms>