FrmSaleNoOutDepot.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Forms>
  3. <Form Name="FrmSaleNoOutDepot">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @Title="销货未出库";
  9. GetSchema();
  10. @CurrentRowIndex=0;
  11. if(Search("SearchSaleNoOutBill",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID()))
  12. {
  13. Search("SearchSaleNoOutBillProduct",#SaleNoOutBill.No_SaleBill,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  14. }
  15. txtSalSum.CValue = SumOfCol("#SaleNoOutBillProduct.Quantity_Sale");
  16. txtOutdepotSum.CValue = SumOfCol("#SaleNoOutBillProduct.Quantity_OutDepot");
  17. ]]>
  18. </Load>
  19. <Mode>
  20. <Search>
  21. <Lable name="Search" />
  22. </Search>
  23. </Mode>
  24. </Events>
  25. <Controls>
  26. <!--<IKExtendGrid name="dgProduct" DataSource="SaleNoOutDepot" TableStyleIndex="0">
  27. <DataColumn Index="0" DataSource="SaleNoOutDepot.No_SaleBill" />
  28. <DataColumn Index="1" DataSource="SaleNoOutDepot.Date_SaleBill"/>
  29. <DataColumn Index="2" DataSource="SaleNoOutDepot.No_Customer" />
  30. <DataColumn Index="3" DataSource="SaleNoOutDepot.ShortName_Customer" />
  31. <DataColumn Index="4" DataSource="SaleNoOutDepot.GetMethod_SaleBill" />
  32. <DataColumn Index="5" DataSource="SaleNoOutDepot.Respite_SaleBill" />
  33. <DataColumn Index="6" DataSource="SaleNoOutDepot.No_Product" />
  34. <DataColumn Index="7" DataSource="SaleNoOutDepot.Name_Product" />
  35. <DataColumn Index="8" DataSource="SaleNoOutDepot.Quantity_Sale" />
  36. <DataColumn Index="9" DataSource="SaleNoOutDepot.Quantity_OutDepot"/>
  37. <DataColumn Index="10" DataSource="SaleNoOutDepot.AvailableQty_ProductStocks"/>
  38. <DataColumn Index="11" DataSource="SaleNoOutDepot.StockQty_ProductStocks"/>
  39. <Events>
  40. <ClickPaste>
  41. ;
  42. </ClickPaste>
  43. <ClickExcel>
  44. ;
  45. </ClickExcel>
  46. <ClickPrint>
  47. ;
  48. </ClickPrint>
  49. <ClickPreview>
  50. PrintReport(dgProduct.CurrentView);
  51. </ClickPreview>
  52. <ClickRefresh>
  53. Empty();
  54. Search("SearchSaleNoOutDepot",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  55. </ClickRefresh>
  56. <ClickFirstPage>
  57. ;
  58. </ClickFirstPage>
  59. <ClickPrevPage>
  60. </ClickPrevPage>
  61. ;
  62. <ClickNextPage>
  63. ;
  64. </ClickNextPage>
  65. <ClickLastPage>
  66. ;
  67. </ClickLastPage>
  68. <ClickFilter>
  69. txtSalSum.CValue = SumOfCol("#SaleNoOutDepot.Quantity_Sale",dgProduct.FilterCondition,true);
  70. txtOutdepotSum.CValue = SumOfCol("#SaleNoOutDepot.Quantity_OutDepot",dgProduct.FilterCondition,true);
  71. </ClickFilter>
  72. <ClickNOFilter>
  73. txtSalSum.CValue = SumOfCol("#SaleNoOutDepot.Quantity_Sale",dgProduct.FilterCondition,true);
  74. txtOutdepotSum.CValue = SumOfCol("#SaleNoOutDepot.Quantity_OutDepot",dgProduct.FilterCondition,true);
  75. </ClickNOFilter>
  76. <ClickAdd>
  77. ;
  78. </ClickAdd>
  79. <ClickRemove>
  80. ;
  81. </ClickRemove>
  82. </Events>
  83. </IKExtendGrid>-->
  84. <IKExtendGrid name="dgSaleBill" DataSource="SaleNoOutBill" TableStyleIndex="0">
  85. <DataColumn Index="0" DataSource="SaleNoOutBill.No_SaleBill" />
  86. <DataColumn Index="1" DataSource="SaleNoOutBill.Date_SaleBill"/>
  87. <DataColumn Index="2" DataSource="SaleNoOutBill.No_Customer" />
  88. <DataColumn Index="3" DataSource="SaleNoOutBill.ShortName_Customer" />
  89. <DataColumn Index="4" DataSource="SaleNoOutBill.GetMethod_SaleBill" />
  90. <DataColumn Index="5" DataSource="SaleNoOutBill.Respite_SaleBill" />
  91. <Events>
  92. <ClickPaste>
  93. ;
  94. </ClickPaste>
  95. <ClickExcel>
  96. ;
  97. </ClickExcel>
  98. <ClickPrint>
  99. ;
  100. </ClickPrint>
  101. <ClickPreview>
  102. Search("SearchTotal",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  103. PrintReport("FrmSaleNoOutDepot","SaleBillDetail");
  104. </ClickPreview>
  105. <ClickRefresh>
  106. if(Search("SearchSaleNoOutBill",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID()))
  107. {
  108. Search("SearchSaleNoOutBillProduct",#SaleNoOutBill.No_SaleBill,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  109. }
  110. </ClickRefresh>
  111. <ClickFirstPage>
  112. ;
  113. </ClickFirstPage>
  114. <ClickPrevPage>
  115. </ClickPrevPage>
  116. ;
  117. <ClickNextPage>
  118. ;
  119. </ClickNextPage>
  120. <ClickLastPage>
  121. ;
  122. </ClickLastPage>
  123. <ClickFilter>
  124. <![CDATA[
  125. Empty("#SaleNoOutBillProduct");
  126. if(RowCount("#SaleNoOutBill","IKExtendGrid") != 0)
  127. Search("SearchSaleNoOutBillProduct",dgSaleBill.GetCurrentSpecifyValue("No_SaleBill"),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  128. txtSalSum.CValue = SumOfCol("#SaleNoOutBillProduct.Quantity_Sale");
  129. txtOutdepotSum.CValue = SumOfCol("#SaleNoOutBillProduct.Quantity_OutDepot");
  130. ]]>
  131. </ClickFilter>
  132. <ClickNOFilter>
  133. <![CDATA[
  134. Empty("#SaleNoOutBillProduct");
  135. if(RowCount("#SaleNoOutBill","IKExtendGrid") != 0)
  136. Search("SearchSaleNoOutBillProduct",dgSaleBill.GetCurrentSpecifyValue("No_SaleBill"),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  137. txtSalSum.CValue = SumOfCol("#SaleNoOutBillProduct.Quantity_Sale");
  138. txtOutdepotSum.CValue = SumOfCol("#SaleNoOutBillProduct.Quantity_OutDepot");
  139. ]]>
  140. </ClickNOFilter>
  141. <ClickAdd>
  142. ;
  143. </ClickAdd>
  144. <ClickRemove>
  145. ;
  146. </ClickRemove>
  147. <CurrentCellChanged>
  148. <![CDATA[
  149. if(dgSaleBill.dataGrid.CurrentRowIndex!=@CurrentRowIndex)
  150. {
  151. @CurrentRowIndex=dgSaleBill.dataGrid.CurrentRowIndex;
  152. Empty("#SaleNoOutBillProduct");
  153. if(RowCount("#SaleNoOutBill","IKExtendGrid") != 0)
  154. Search("SearchSaleNoOutBillProduct",dgSaleBill.GetCurrentSpecifyValue("No_SaleBill"),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  155. txtSalSum.CValue = SumOfCol("#SaleNoOutBillProduct.Quantity_Sale");
  156. txtOutdepotSum.CValue = SumOfCol("#SaleNoOutBillProduct.Quantity_OutDepot");
  157. }
  158. ]]>
  159. </CurrentCellChanged>
  160. </Events>
  161. </IKExtendGrid>
  162. <IKDataGridEx name="dgProduct" DataSource="SaleNoOutBillProduct" TableStyleIndex="0">
  163. <DataColumn Index="0" DataSource="SaleNoOutBillProduct.No_Product" />
  164. <DataColumn Index="1" DataSource="SaleNoOutBillProduct.Name_Product" />
  165. <DataColumn Index="2" DataSource="SaleNoOutBillProduct.Quantity_Sale" />
  166. <DataColumn Index="3" DataSource="SaleNoOutBillProduct.Quantity_OutDepot"/>
  167. <DataColumn Index="4" DataSource="SaleNoOutBillProduct.AvailableQty_ProductStocks"/>
  168. <DataColumn Index="5" DataSource="SaleNoOutBillProduct.StockQty_ProductStocks"/>
  169. </IKDataGridEx>
  170. </Controls>
  171. </Client>
  172. <Server>
  173. <Tables>
  174. <Table name="SaleNoOutBill" Type="Parent">
  175. <GetSchema CmdType="Text" CmdText="Select Top 0 No_SaleBill,Date_SaleBill,No_Customer,ShortName_Customer,GetMethod_SaleBill,Convert(Nvarchar(64),'') as Respite_SaleBill From SaleBill
  176. Left Join Customer On Customer.ID_Customer = SaleBill.ID_Customer"/>
  177. </Table>
  178. <Table name="SaleNoOutBillProduct" Type="Child">
  179. <GetSchema CmdType="Text" CmdText="Select Top 0 No_Product,Name_Product,SaleSourceBillProduct.Quantity_Sale,SaleSourceBillProduct.Quantity_OutDepot,CONVERT(DECIMAL,0.00) AS AvailableQty_ProductStocks,CONVERT(DECIMAL,0.00) AS StockQty_ProductStocks From SaleBillProduct
  180. Left Join SaleSourceBillProduct on SaleSourceBillProduct.ID_SaleSourceBillProduct=SaleBillProduct.ID_SaleSourceBillProduct
  181. Left join Product On Product.ID_Product = SaleBillProduct.ID_Product"/>
  182. </Table>
  183. </Tables>
  184. <Search>
  185. <SearchSaleNoOutBill CmdType="Text" CmdText="
  186. DECLARE @SaleAndOutDepot_SystemSetting bit
  187. SELECT @SaleAndOutDepot_SystemSetting=SaleAndOutDepot_SystemSetting from SystemSetting
  188. IF(@SaleAndOutDepot_SystemSetting != 0)
  189. Begin
  190. Select No_SaleBill,Date_SaleBill,No_Customer,ShortName_Customer,GetMethod_SaleBill,OutStatus_SaleBill As Respite_SaleBill
  191. From
  192. (
  193. Select ID_SaleBill,Sum(Quantity_Sale) As Quantity_Sale,Sum(Quantity_OutDepot) As Quantity_OutDepot
  194. From SaleSourceBillProduct
  195. Left Join SaleBillProduct On SaleBillProduct.ID_SaleBillProduct=SaleSourceBillProduct.ID_SaleSourceBillProduct
  196. Group By ID_SaleBill
  197. Having (Sum(Quantity_Sale)-Sum(Quantity_OutDepot)) &gt; 0
  198. )A
  199. Left Join SaleBill On SaleBill.ID_SaleBill=A.ID_SaleBill
  200. Left Join Customer On Customer.ID_Customer=SaleBill.ID_Customer
  201. Where SaleBill.ID_Assessor Is Not Null
  202. And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End
  203. Order By No_SaleBill
  204. End
  205. Else
  206. Begin
  207. Select No_SaleBill,Date_SaleBill,No_Customer,ShortName_Customer,GetMethod_SaleBill,OutStatus_SaleBill As Respite_SaleBill
  208. From
  209. (
  210. Select ID_SaleBill,Sum(Quantity_SaleBillProduct) As Quantity_Sale
  211. From SaleBillProduct
  212. Group By ID_SaleBill
  213. )a
  214. Left Join
  215. (
  216. Select SaleBill.ID_SaleBill,Sum(SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct) As Quantity_OutDepot
  217. From SaleOutDepotBillProduct
  218. Join SaleOutDepotBill On SaleOutDepotBill.ID_SaleOutDepotBill=SaleOutDepotBillProduct.ID_SaleOutDepotBill
  219. Join SaleBill On SaleBill.No_SaleBill=SaleOutDepotBillProduct.No_FromBill
  220. Where SaleOutDepotBill.ID_Assessor Is Not Null
  221. Group By SaleBill.ID_SaleBill
  222. )b On b.ID_SaleBill=a.ID_SaleBill
  223. Left Join SaleBill On SaleBill.ID_SaleBill=a.ID_SaleBill
  224. Left Join Customer On Customer.ID_Customer=SaleBill.ID_Customer
  225. Where SaleBill.ID_Assessor Is Not Null And (a.Quantity_Sale-b.Quantity_OutDepot) &gt; 0
  226. And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End
  227. Order By No_SaleBill
  228. End
  229. ">
  230. <Params>
  231. <Param name="@Right" type="SaleBill.ID_Customer" Index="0" />
  232. </Params>
  233. <Tables>
  234. <Table name="SaleNoOutBill"/>
  235. </Tables>
  236. </SearchSaleNoOutBill>
  237. <SearchSaleNoOutBillProduct CmdType="Text" CmdText="
  238. DECLARE @SaleAndOutDepot_SystemSetting bit
  239. Declare @ID_Location uniqueidentifier
  240. Select @ID_Location=ID_Location From SaleBill
  241. Where No_SaleBill=@No_SaleBill
  242. SELECT @SaleAndOutDepot_SystemSetting=SaleAndOutDepot_SystemSetting from SystemSetting
  243. IF(@SaleAndOutDepot_SystemSetting != 0)
  244. Begin
  245. Select Product.No_Product,Product.Name_Product,A.Quantity_Sale,A.Quantity_OutDepot,C.AvailableQty_ProductStocks,C.StockQty_ProductStocks
  246. From Product
  247. Join
  248. (
  249. Select ID_Product,Sum(Quantity_Sale) As Quantity_Sale,Sum(Quantity_OutDepot) As Quantity_OutDepot
  250. From SaleBillProduct
  251. Left Join SaleBill On SaleBillProduct.ID_SaleBill=SaleBill.ID_SaleBill
  252. Left Join SaleSourceBillProduct On SaleSourceBillProduct.ID_SaleSourceBillProduct=SaleBillProduct.ID_SaleBillProduct
  253. Where No_SaleBill=@No_SaleBill
  254. Group By ID_Product
  255. Having (Sum(Quantity_Sale)-Sum(Quantity_OutDepot)) &gt; 0
  256. )A On Product.ID_Product=A.ID_Product
  257. Join
  258. (
  259. Select ID_Product,Sum(StockQty_ProductStocks) As StockQty_ProductStocks ,Sum(AvailableQty_ProductStocks) As AvailableQty_ProductStocks
  260. From ProductStocks
  261. Join Location On Location.ID_Location=ProductStocks.ID_Location
  262. Where Location.ID_WareHouse=@ID_Location
  263. Group By ID_Product
  264. )C On Product.ID_Product=C.ID_Product
  265. Order By No_Product
  266. End
  267. Else
  268. Begin
  269. Select Product.No_Product,Product.Name_Product,A.Quantity_Sale,B.Quantity_OutDepot,C.AvailableQty_ProductStocks,C.StockQty_ProductStocks
  270. From Product
  271. Join
  272. (
  273. Select ID_Product,Sum(Quantity_SaleBillProduct) As Quantity_Sale
  274. From SaleBillProduct
  275. Left Join SaleBill On SaleBillProduct.ID_SaleBill=SaleBill.ID_SaleBill
  276. Where No_SaleBill=@No_SaleBill
  277. Group By ID_Product
  278. )A On Product.ID_Product=A.ID_Product
  279. Left Join
  280. (
  281. Select ID_Product,Sum(SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct) As Quantity_OutDepot
  282. From SaleOutDepotBillProduct
  283. Join SaleOutDepotBill On SaleOutDepotBill.ID_SaleOutDepotBill=SaleOutDepotBillProduct.ID_SaleOutDepotBill
  284. Where No_FromBill=@No_SaleBill
  285. And SaleOutDepotBill.ID_Assessor Is Not Null
  286. Group By ID_Product
  287. )B On Product.ID_Product=B.ID_Product
  288. Join
  289. (
  290. Select ID_Product,Sum(StockQty_ProductStocks) As StockQty_ProductStocks ,Sum(AvailableQty_ProductStocks) As AvailableQty_ProductStocks
  291. From ProductStocks
  292. Join Location On Location.ID_Location=ProductStocks.ID_Location
  293. Where Location.ID_WareHouse=@ID_Location
  294. Group By ID_Product
  295. )C On Product.ID_Product=C.ID_Product
  296. Where (A.Quantity_Sale-B.Quantity_OutDepot) &gt; 0
  297. Order By No_Product
  298. End
  299. ">
  300. <Params>
  301. <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" Index="0" />
  302. <Param name="@Right" type="SaleBill.ID_Customer" Index="1" />
  303. </Params>
  304. <Tables>
  305. <Table name="SaleNoOutBillProduct"/>
  306. </Tables>
  307. </SearchSaleNoOutBillProduct>
  308. <SearchTotal CmdType="Text" CmdText="
  309. DECLARE @SaleAndOutDepot_SystemSetting bit
  310. SELECT @SaleAndOutDepot_SystemSetting=SaleAndOutDepot_SystemSetting from SystemSetting
  311. IF(@SaleAndOutDepot_SystemSetting != 0)
  312. Begin
  313. Select No_SaleBill,Date_SaleBill,No_Customer,ShortName_Customer,GetMethod_SaleBill,OutStatus_SaleBill As Respite_SaleBill,No_Product,Name_Product,Quantity_Sale,Quantity_OutDepot
  314. From
  315. (
  316. Select ID_SaleBill,ID_Product,Sum(Quantity_Sale) As Quantity_Sale,Sum(Quantity_OutDepot) As Quantity_OutDepot
  317. From SaleSourceBillProduct
  318. Left Join SaleBillProduct On SaleBillProduct.ID_SaleBillProduct=SaleSourceBillProduct.ID_SaleSourceBillProduct
  319. Group By ID_SaleBill,ID_Product
  320. Having (Sum(Quantity_Sale)-Sum(Quantity_OutDepot)) &gt; 0
  321. )A
  322. Left Join SaleBill On SaleBill.ID_SaleBill=A.ID_SaleBill
  323. Left Join Product On Product.ID_Product=A.ID_Product
  324. Left Join Customer On Customer.ID_Customer=SaleBill.ID_Customer
  325. Where SaleBill.ID_Assessor Is Not Null
  326. And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End
  327. Order By No_SaleBill
  328. End
  329. Else
  330. Begin
  331. Select No_SaleBill,Date_SaleBill,No_Customer,ShortName_Customer,GetMethod_SaleBill,OutStatus_SaleBill As Respite_SaleBill,No_Product,Name_Product,Quantity_Sale,IsNull(Quantity_OutDepot,0)
  332. From
  333. (
  334. Select ID_SaleBill,SaleBillProduct.ID_Product,Sum(Quantity_SaleBillProduct) As Quantity_Sale
  335. From SaleBillProduct
  336. Group By ID_SaleBill,ID_Product
  337. )a
  338. Left Join
  339. (
  340. Select SaleBill.ID_SaleBill,SaleOutDepotBillProduct.ID_Product,Sum(SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct) As Quantity_OutDepot
  341. From SaleOutDepotBillProduct
  342. Join SaleOutDepotBill On SaleOutDepotBill.ID_SaleOutDepotBill=SaleOutDepotBillProduct.ID_SaleOutDepotBill
  343. Join SaleBill On SaleBill.No_SaleBill=SaleOutDepotBillProduct.No_FromBill
  344. Where SaleOutDepotBill.ID_Assessor Is Not Null
  345. Group By SaleBill.ID_SaleBill,SaleOutDepotBillProduct.ID_Product
  346. )b On b.ID_SaleBill=a.ID_SaleBill And b.ID_Product=a.ID_Product
  347. Join Product On Product.ID_Product=a.ID_Product
  348. Join SaleBill On SaleBill.ID_SaleBill=a.ID_SaleBill
  349. Join Customer On Customer.ID_Customer=SaleBill.ID_Customer
  350. Where SaleBill.ID_Assessor Is Not Null And (a.Quantity_Sale-IsNull(b.Quantity_OutDepot,0)) &gt; 0
  351. And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End
  352. Order By SaleBill.No_SaleBill
  353. End
  354. ">
  355. <Params>
  356. <Param name="@Right" type="SaleBill.ID_Customer" Index="0" />
  357. </Params>
  358. <Tables>
  359. <Table name="SaleBillDetail"/>
  360. </Tables>
  361. </SearchTotal>
  362. </Search>
  363. </Server>
  364. <Lables>
  365. <Search>
  366. </Search>
  367. <New>
  368. </New>
  369. <View>
  370. </View>
  371. <Modify>
  372. </Modify>
  373. </Lables>
  374. </Form>
  375. </Forms>