FrmConstraintEndCase.xml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <Forms>
  3. <Form Name="FrmConstraintEndCase">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @Title="强制结案";
  9. GetSchema();
  10. ChangeMode("Search");
  11. ]]>
  12. </Load>
  13. <Closing>
  14. ;
  15. </Closing>
  16. <Closed>
  17. ;
  18. </Closed>
  19. </Events>
  20. <Mode>
  21. <Search>
  22. <Lable name="Search" />
  23. </Search>
  24. <New>
  25. <Lable name="New" />
  26. </New>
  27. <View>
  28. <Lable name="View" />
  29. </View>
  30. <Modify>
  31. <Lable name="Modify" />
  32. </Modify>
  33. </Mode>
  34. <Controls>
  35. <IKTextButton name="tbNo" DataSource="PurchaseOrderBill.No_PurchaseOrderBill">
  36. <Events>
  37. <Enter>
  38. <![CDATA[
  39. if(tbNo.ReadOnly == false)
  40. {
  41. if(tbNo.CValue != StringEmpty())
  42. {
  43. UpdateForm(false, "");
  44. if(!Search("SearchPurchaseOrderBill",tbNo.CValue))
  45. {
  46. MessageBox("该采购订单不存在!",@Title);
  47. }
  48. else
  49. {
  50. if(Search("SearchPurchaseOrderBillWithNo", tbNo.CValue))
  51. {
  52. ChangeMode("Modify");
  53. }
  54. else
  55. {
  56. MessageBox("该采购订单未审核!",@Title);
  57. if(Search("SearchPurchaseOrderBillNoAssess",tbNo.CValue));
  58. ChangeMode("View");
  59. }
  60. }
  61. }
  62. else
  63. {
  64. MessageBox("请输入采购单号!",@Title);
  65. }
  66. }
  67. ]]>
  68. </Enter>
  69. <Click>
  70. ShowSearchBox("BillSearch","HAVEDEPOT", "tbNo",tbNo.CValue);
  71. </Click>
  72. </Events>
  73. </IKTextButton>
  74. <IKTextBox name="refNo" DataSource="PurchaseOrderBill.RefNo_PurchaseOrderBill"/>
  75. <IKDateTimeText name="dtDate" DataSource="PurchaseOrderBill.Date_PurchaseOrderBill"/>
  76. <IKDateTimeText name="dtArrivalDate" DataSource="PurchaseOrderBill.ArrivalDate_PurchaseOrderBill"/>
  77. <IKTextBox name="txtSupplierNo" DataSource="PurchaseOrderBill.No_Supplier"/>
  78. <IKTextBox name="txtSupplierName" DataSource="PurchaseOrderBill.ShortName_Supplier"/>
  79. <IKTextBox name="txtAssessor" DataSource="PurchaseOrderBill.Assessor"/>
  80. <IKDateTimeText name="dtAssessDate" DataSource="PurchaseOrderBill.AssessDate_PurchaseOrderBill"/>
  81. <IKTextBox name="txtComment" DataSource="PurchaseOrderBill.Comment_EndCase"/>
  82. <IKDataGridEx name="ikDataGridEx1" DataSource="PurchaseSourceBillProduct" TableStyleIndex="0">
  83. <DataColumn Index="0" DataSource="PurchaseSourceBillProduct.No_Product" />
  84. <DataColumn Index="1" DataSource="PurchaseSourceBillProduct.Name_Product" />
  85. <DataColumn Index="2" DataSource="PurchaseSourceBillProduct.Quantity_Order" />
  86. <DataColumn Index="3" DataSource="PurchaseSourceBillProduct.Amount" />
  87. <DataColumn Index="4" DataSource="PurchaseSourceBillProduct.Date_EndCase" />
  88. <DataColumn Index="5" DataSource="PurchaseSourceBillProduct.Quantity_EndCase" />
  89. <DataColumn Index="6" DataSource="PurchaseSourceBillProduct.Quantity_InDepot" />
  90. <DataColumn Index="7" DataSource="PurchaseSourceBillProduct.Quantity_OnShip" />
  91. </IKDataGridEx>
  92. <IKFormToolBar name="toolBar">
  93. <Events>
  94. <ClickFirst>
  95. if (Search("SearchFirst", tbNo.CValue))
  96. {
  97. ChangeMode("View");
  98. }
  99. </ClickFirst>
  100. <ClickPrev>
  101. if (Search("SearchPrevious", tbNo.CValue))
  102. {
  103. ChangeMode("View");
  104. }
  105. </ClickPrev>
  106. <ClickNext>
  107. if (Search("SearchNext", tbNo.CValue))
  108. {
  109. ChangeMode("View");
  110. }
  111. </ClickNext>
  112. <ClickLast>
  113. if (Search("SearchLast", tbNo.CValue))
  114. {
  115. ChangeMode("View");
  116. }
  117. </ClickLast>
  118. <ClickEmpty>
  119. ChangeMode("Search");
  120. </ClickEmpty>
  121. <ClickSubmit>
  122. <Lable name="SubmitButtonClick" />
  123. </ClickSubmit>
  124. <ClickImport>
  125. ;
  126. </ClickImport>
  127. <ClickExport>
  128. ;
  129. </ClickExport>
  130. <ClickClose>
  131. ;
  132. </ClickClose>
  133. <ClickExpand>
  134. ;
  135. </ClickExpand>
  136. <ClickPrint>
  137. PrintReport();
  138. </ClickPrint>
  139. </Events>
  140. </IKFormToolBar>
  141. </Controls>
  142. <!--<LockInfomation LockID="ID_PurchaseOrderBill" LockNO="No_PurchaseOrderBill" LockSearchFunction="SearchPurchaseOrderBillWithNo" LockAudit="ID_Assessor"/>-->
  143. <LogInfomation LogNO="#PurchaseOrderBill.No_PurchaseOrderBill" RecordFormField="" RecordDataGridField="#PurchaseSourceBillProduct.No_Product,#PurchaseSourceBillProduct.Amount"/>
  144. <ChildForms>
  145. <ChildForm name="BillSearch" DataSource="PurchaseOrderBill" SearchFunction="SearchAllBill" SearchFunctionByNo="SearchPurchaseOrderBillWithNo">
  146. <DataColumn Index="0" MappingName="#PurchaseOrderBill.No_PurchaseOrderBill" HeaderText="采购订单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  147. <DataColumn Index="1" MappingName="#PurchaseOrderBill.Date_PurchaseOrderBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  148. <DataColumn Index="2" MappingName="#PurchaseOrderBill.ShortName_Supplier" HeaderText="供应商简称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  149. </ChildForm>
  150. </ChildForms>
  151. </Client>
  152. <Server>
  153. <Tables>
  154. <Table name="PurchaseOrderBill" Type="Parent">
  155. <GetSchema CmdType="Text" CmdText="SELECT TOP 0 PurchaseOrderBill.*, No_Supplier, ShortName_Supplier, Name_User AS Assessor From PurchaseOrderBill
  156. LEFT JOIN Supplier ON Supplier.ID_Supplier = PurchaseOrderBill.ID_Supplier
  157. LEFT JOIN AppUser ON AppUser.ID_User = PurchaseOrderBill.ID_Assessor"/>
  158. <New CmdType="Text" CmdText="
  159. IF(@Comment_EndCase != '')
  160. BEGIN
  161. INSERT INTO BillComment (ID_BillComment, ID_Bill, Comment_BillComment)
  162. VALUES(NEWID(),@ID_PurchaseOrderBill,@Comment_EndCase)
  163. END">
  164. <Params>
  165. <Param name="@ID_PurchaseOrderBill" type="PurchaseOrderBill.ID_PurchaseOrderBill" sourceColumn="ID_PurchaseOrderBill" />
  166. <Param name="@Comment_EndCase" type="PurchaseOrderBill.Comment_EndCase" sourceColumn="Comment_EndCase" />
  167. </Params>
  168. </New>
  169. <Update CmdType="Text" CmdText="
  170. UPDATE PurchaseOrderBill SET Comment_EndCase = @Comment_EndCase WHERE ID_PurchaseOrderBill = @ID_PurchaseOrderBill
  171. IF(@Comment_EndCase != '')
  172. BEGIN
  173. INSERT INTO BillComment (ID_BillComment, ID_Bill, Comment_BillComment)
  174. VALUES(NEWID(),@ID_PurchaseOrderBill,@Comment_EndCase)
  175. END">
  176. <Params>
  177. <Param name="@ID_PurchaseOrderBill" type="PurchaseOrderBill.ID_PurchaseOrderBill" sourceColumn="ID_PurchaseOrderBill" />
  178. <Param name="@Comment_EndCase" type="PurchaseOrderBill.Comment_EndCase" sourceColumn="Comment_EndCase" />
  179. </Params>
  180. </Update>
  181. </Table>
  182. <Table name="PurchaseSourceBillProduct" Type="Child">
  183. <GetSchema CmdType="Text" CmdText="SELECT TOP 0 PurchaseSourceBillProduct.*, CONVERT(DECIMAL(14,2),0) AS Amount,Product.ID_Product, No_Product,Name_Product FROM PurchaseSourceBillProduct
  184. LEFT JOIN PurchaseOrderBillProduct ON PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct = PurchaseSourceBillProduct.ID_PurchaseSourceBillProduct
  185. LEFT JOIN Product ON Product.ID_Product = PurchaseOrderBillProduct.ID_Product"/>
  186. <New CmdType="Text" CmdText="INSERT INTO PurchaseSourceBillProduct(ID_PurchaseSourceBillProduct, Quantity_Order, Quantity_InDepot, Quantity_OnShip, Quantity_EndCase,Date_EndCase)
  187. VALUES(@ID_PurchaseSourceBillProduct, @Quantity_Order, @Quantity_InDepot, @Quantity_OnShip, @Quantity_EndCase,GetDate())
  188. ">
  189. <Params>
  190. <Param name="@ID_PurchaseSourceBillProduct" type="PurchaseSourceBillProduct.ID_PurchaseSourceBillProduct" sourceColumn="ID_PurchaseSourceBillProduct" />
  191. <Param name="@Quantity_Order" type="PurchaseSourceBillProduct.Quantity_Order" sourceColumn="Quantity_Order" />
  192. <Param name="@Quantity_InDepot" type="PurchaseSourceBillProduct.Quantity_InDepot" sourceColumn="Quantity_InDepot" />
  193. <Param name="@Quantity_OnShip" type="PurchaseSourceBillProduct.Quantity_OnShip" sourceColumn="Quantity_OnShip" />
  194. <Param name="@Quantity_EndCase" type="PurchaseSourceBillProduct.Quantity_EndCase" sourceColumn="Quantity_EndCase" />
  195. </Params>
  196. </New>
  197. <Update CmdType="Text" CmdText="IF(0 &gt; @Quantity_EndCase)
  198. BEGIN
  199. RAISERROR('该采购订单产品已全部结案,提交失败!',16,1)
  200. RETURN
  201. END
  202. UPDATE PurchaseSourceBillProduct SET Quantity_Order =@Quantity_Order, Quantity_InDepot =@Quantity_InDepot, Quantity_OnShip =@Quantity_OnShip, Quantity_EndCase =@Quantity_EndCase,Date_EndCase = GetDate()
  203. WHERE ID_PurchaseSourceBillProduct =@ID_PurchaseSourceBillProduct">
  204. <Params>
  205. <Param name="@ID_PurchaseSourceBillProduct" type="PurchaseSourceBillProduct.ID_PurchaseSourceBillProduct" sourceColumn="ID_PurchaseSourceBillProduct" />
  206. <Param name="@Quantity_Order" type="PurchaseSourceBillProduct.Quantity_Order" sourceColumn="Quantity_Order" />
  207. <Param name="@Quantity_InDepot" type="PurchaseSourceBillProduct.Quantity_InDepot" sourceColumn="Quantity_InDepot" />
  208. <Param name="@Quantity_OnShip" type="PurchaseSourceBillProduct.Quantity_OnShip" sourceColumn="Quantity_OnShip" />
  209. <Param name="@Quantity_EndCase" type="PurchaseSourceBillProduct.Quantity_EndCase" sourceColumn="Quantity_EndCase" />
  210. </Params>
  211. </Update>
  212. </Table>
  213. </Tables>
  214. <Search>
  215. <SearchAllBill CmdType="Text" CmdText=" SELECT PurchaseOrderBill.*,a.Name_User As Creator,b.Name_User As Assessor,c.Name_User As LastModUser,No_Supplier,Name_Supplier=CASE ISNULL(Supplier.SuspendDate_Supplier,0) WHEN 0 THEN Name_Supplier ELSE Name_Supplier+'(已暂停!)'END, ShortName_Supplier,RegistedAddress_Supplier,PostalCode_Supplier,Name_Location,No_Location,EmpA.No_Employee,EmpB.No_Employee As No_Linkman,convert(decimal(18,6),'0.00') As MoneySum,convert(decimal(18,6),'0.00') As TaxSum
  216. FROM PurchaseOrderBill
  217. LEFT JOIN AppUser a ON a.ID_User=PurchaseOrderBill.ID_Creator
  218. LEFT JOIN AppUser b ON b.ID_User=PurchaseOrderBill.ID_Assessor
  219. LEFT JOIN AppUser c ON c.ID_User=PurchaseOrderBill.LastModUser_PurchaseOrderBill
  220. LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseOrderBill.ID_Supplier
  221. LEFT JOIN Location ON Location.ID_Location=PurchaseOrderBill.ID_Location
  222. LEFT JOIN Employee EmpA ON EmpA.ID_Employee=PurchaseOrderBill.ID_Principal
  223. LEFT JOIN Employee EmpB ON EmpB.Name_Employee=PurchaseOrderBill.Name_Linkman
  224. WHERE Disable_PurchaseOrderBill = 0">
  225. <Tables>
  226. <Table name="AllBill" />
  227. </Tables>
  228. </SearchAllBill>
  229. <SearchPurchaseOrderBill CmdType="Text" CmdText="SELECT * FROM PurchaseOrderBill WHERE No_PurchaseOrderBill = @No_PurchaseOrderBill">
  230. <Params>
  231. <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0" />
  232. </Params>
  233. <Tables>
  234. <Table name="123" />
  235. </Tables>
  236. </SearchPurchaseOrderBill>
  237. <SearchPurchaseOrderBillWithNo CmdType="Text" CmdText="DECLARE @ID_PurchaseOrderBill UNIQUEIDENTIFIER
  238. SELECT @ID_PurchaseOrderBill = ID_PurchaseOrderBill FROM PurchaseOrderBill
  239. WHERE No_PurchaseOrderBill = @No_PurchaseOrderBill AND ID_Assessor IS NOT NULL
  240. SELECT PurchaseOrderBill.*, No_Supplier, ShortName_Supplier,Name_User AS Assessor From PurchaseOrderBill
  241. LEFT JOIN Supplier ON Supplier.ID_Supplier = PurchaseOrderBill.ID_Supplier
  242. LEFT JOIN AppUser ON AppUser.ID_User = PurchaseOrderBill.ID_Assessor
  243. WHERE No_PurchaseOrderBill = @No_PurchaseOrderBill AND ID_Assessor IS NOT NULL
  244. SELECT PurchaseSourceBillProduct.*, (Quantity_Order-Quantity_EndCase-Quantity_InDepot-Quantity_OnShip) AS Amount,Product.ID_Product, No_Product,Name_Product FROM PurchaseSourceBillProduct
  245. LEFT JOIN PurchaseOrderBillProduct ON PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct = PurchaseSourceBillProduct.ID_PurchaseSourceBillProduct
  246. LEFT JOIN Product ON Product.ID_Product = PurchaseOrderBillProduct.ID_Product
  247. LEFT JOIN PurchaseOrderBill ON PurchaseOrderBill.ID_PurchaseOrderBill = PurchaseOrderBillProduct.ID_PurchaseOrderBill
  248. WHERE PurchaseOrderBill.ID_PurchaseOrderBill = @ID_PurchaseOrderBill">
  249. <Params>
  250. <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0" />
  251. </Params>
  252. <Tables>
  253. <Table name="PurchaseOrderBill" />
  254. <Table name="PurchaseSourceBillProduct" />
  255. </Tables>
  256. </SearchPurchaseOrderBillWithNo>
  257. <SearchPurchaseOrderBillNoAssess CmdType="Text" CmdText="DECLARE @ID_PurchaseOrderBill UNIQUEIDENTIFIER
  258. SELECT @ID_PurchaseOrderBill = ID_PurchaseOrderBill FROM PurchaseOrderBill
  259. WHERE No_PurchaseOrderBill = @No_PurchaseOrderBill
  260. SELECT PurchaseOrderBill.*, No_Supplier, ShortName_Supplier,Name_User AS Assessor From PurchaseOrderBill
  261. LEFT JOIN Supplier ON Supplier.ID_Supplier = PurchaseOrderBill.ID_Supplier
  262. LEFT JOIN AppUser ON AppUser.ID_User = PurchaseOrderBill.ID_Assessor
  263. WHERE No_PurchaseOrderBill = @No_PurchaseOrderBill
  264. SELECT PurchaseSourceBillProduct.*, (Quantity_Order-Quantity_EndCase-Quantity_InDepot-Quantity_OnShip) AS Amount,Product.ID_Product, No_Product,Name_Product FROM PurchaseSourceBillProduct
  265. LEFT JOIN PurchaseOrderBillProduct ON PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct = PurchaseSourceBillProduct.ID_PurchaseSourceBillProduct
  266. LEFT JOIN Product ON Product.ID_Product = PurchaseOrderBillProduct.ID_Product
  267. LEFT JOIN PurchaseOrderBill ON PurchaseOrderBill.ID_PurchaseOrderBill = PurchaseOrderBillProduct.ID_PurchaseOrderBill
  268. WHERE PurchaseOrderBill.ID_PurchaseOrderBill = @ID_PurchaseOrderBill">
  269. <Params>
  270. <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0" />
  271. </Params>
  272. <Tables>
  273. <Table name="PurchaseOrderBill" />
  274. <Table name="PurchaseSourceBillProduct" />
  275. </Tables>
  276. </SearchPurchaseOrderBillNoAssess>
  277. <SearchFirst CmdType="Text" CmdText="DECLARE @NextNo Nvarchar(64)
  278. SELECT TOP 1 @NextNo = PurchaseOrderBill.No_PurchaseOrderBill FROM PurchaseOrderBill ORDER BY PurchaseOrderBill.No_PurchaseOrderBill
  279. DECLARE @ID_PurchaseOrderBill UNIQUEIDENTIFIER
  280. SELECT @ID_PurchaseOrderBill = ID_PurchaseOrderBill FROM PurchaseOrderBill
  281. WHERE No_PurchaseOrderBill = @NextNo
  282. SELECT PurchaseOrderBill.*, No_Supplier, ShortName_Supplier, Name_User AS Assessor From PurchaseOrderBill
  283. LEFT JOIN Supplier ON Supplier.ID_Supplier = PurchaseOrderBill.ID_Supplier
  284. LEFT JOIN AppUser ON AppUser.ID_User = PurchaseOrderBill.ID_Assessor
  285. WHERE No_PurchaseOrderBill = @NextNo
  286. SELECT PurchaseSourceBillProduct.*, (Quantity_Order-Quantity_EndCase-Quantity_InDepot-Quantity_OnShip) AS Amount,Product.ID_Product, No_Product,Name_Product FROM PurchaseSourceBillProduct
  287. LEFT JOIN PurchaseOrderBillProduct ON PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct = PurchaseSourceBillProduct.ID_PurchaseSourceBillProduct
  288. LEFT JOIN Product ON Product.ID_Product = PurchaseOrderBillProduct.ID_Product
  289. LEFT JOIN PurchaseOrderBill ON PurchaseOrderBill.ID_PurchaseOrderBill = PurchaseOrderBillProduct.ID_PurchaseOrderBill
  290. WHERE PurchaseOrderBill.ID_PurchaseOrderBill = @ID_PurchaseOrderBill">
  291. <Params>
  292. <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0" />
  293. </Params>
  294. <Tables>
  295. <Table name="PurchaseOrderBill" />
  296. <Table name="PurchaseSourceBillProduct" />
  297. </Tables>
  298. </SearchFirst>
  299. <SearchPrevious CmdType="Text" CmdText="DECLARE @NextNo Nvarchar(64)
  300. SELECT TOP 1 @NextNo = PurchaseOrderBill.No_PurchaseOrderBill FROM PurchaseOrderBill WHERE No_PurchaseOrderBill &lt; @No_PurchaseOrderBill ORDER BY PurchaseOrderBill.No_PurchaseOrderBill DESC
  301. DECLARE @ID_PurchaseOrderBill UNIQUEIDENTIFIER
  302. SELECT @ID_PurchaseOrderBill = ID_PurchaseOrderBill FROM PurchaseOrderBill
  303. WHERE No_PurchaseOrderBill = @NextNo
  304. SELECT PurchaseOrderBill.*, No_Supplier, ShortName_Supplier,Name_User AS Assessor From PurchaseOrderBill
  305. LEFT JOIN Supplier ON Supplier.ID_Supplier = PurchaseOrderBill.ID_Supplier
  306. LEFT JOIN AppUser ON AppUser.ID_User = PurchaseOrderBill.ID_Assessor
  307. WHERE No_PurchaseOrderBill = @NextNo
  308. SELECT PurchaseSourceBillProduct.*, (Quantity_Order-Quantity_EndCase-Quantity_InDepot-Quantity_OnShip) AS Amount,Product.ID_Product, No_Product,Name_Product FROM PurchaseSourceBillProduct
  309. LEFT JOIN PurchaseOrderBillProduct ON PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct = PurchaseSourceBillProduct.ID_PurchaseSourceBillProduct
  310. LEFT JOIN Product ON Product.ID_Product = PurchaseOrderBillProduct.ID_Product
  311. LEFT JOIN PurchaseOrderBill ON PurchaseOrderBill.ID_PurchaseOrderBill = PurchaseOrderBillProduct.ID_PurchaseOrderBill
  312. WHERE PurchaseOrderBill.ID_PurchaseOrderBill = @ID_PurchaseOrderBill">
  313. <Params>
  314. <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0" />
  315. </Params>
  316. <Tables>
  317. <Table name="PurchaseOrderBill" />
  318. <Table name="PurchaseSourceBillProduct" />
  319. </Tables>
  320. </SearchPrevious>
  321. <SearchNext CmdType="Text" CmdText="DECLARE @NextNo Nvarchar(64)
  322. SELECT TOP 1 @NextNo = PurchaseOrderBill.No_PurchaseOrderBill FROM PurchaseOrderBill WHERE No_PurchaseOrderBill &gt; @No_PurchaseOrderBill ORDER BY PurchaseOrderBill.No_PurchaseOrderBill
  323. DECLARE @ID_PurchaseOrderBill UNIQUEIDENTIFIER
  324. SELECT @ID_PurchaseOrderBill = ID_PurchaseOrderBill FROM PurchaseOrderBill
  325. WHERE No_PurchaseOrderBill = @NextNo
  326. SELECT PurchaseOrderBill.*, No_Supplier, ShortName_Supplier,Name_User AS Assessor From PurchaseOrderBill
  327. LEFT JOIN Supplier ON Supplier.ID_Supplier = PurchaseOrderBill.ID_Supplier
  328. LEFT JOIN AppUser ON AppUser.ID_User = PurchaseOrderBill.ID_Assessor
  329. WHERE No_PurchaseOrderBill = @NextNo
  330. SELECT PurchaseSourceBillProduct.*, (Quantity_Order-Quantity_EndCase-Quantity_InDepot-Quantity_OnShip) AS Amount,Product.ID_Product, No_Product,Name_Product FROM PurchaseSourceBillProduct
  331. LEFT JOIN PurchaseOrderBillProduct ON PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct = PurchaseSourceBillProduct.ID_PurchaseSourceBillProduct
  332. LEFT JOIN Product ON Product.ID_Product = PurchaseOrderBillProduct.ID_Product
  333. LEFT JOIN PurchaseOrderBill ON PurchaseOrderBill.ID_PurchaseOrderBill = PurchaseOrderBillProduct.ID_PurchaseOrderBill
  334. WHERE PurchaseOrderBill.ID_PurchaseOrderBill = @ID_PurchaseOrderBill">
  335. <Params>
  336. <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0" />
  337. </Params>
  338. <Tables>
  339. <Table name="PurchaseOrderBill" />
  340. <Table name="PurchaseSourceBillProduct" />
  341. </Tables>
  342. </SearchNext>
  343. <SearchLast CmdType="Text" CmdText="DECLARE @NextNo Nvarchar(64)
  344. SELECT TOP 1 @NextNo = PurchaseOrderBill.No_PurchaseOrderBill FROM PurchaseOrderBill ORDER BY PurchaseOrderBill.No_PurchaseOrderBill DESC
  345. DECLARE @ID_PurchaseOrderBill UNIQUEIDENTIFIER
  346. SELECT @ID_PurchaseOrderBill = ID_PurchaseOrderBill FROM PurchaseOrderBill
  347. WHERE No_PurchaseOrderBill = @NextNo
  348. SELECT PurchaseOrderBill.*, No_Supplier, ShortName_Supplier,Name_User AS Assessor From PurchaseOrderBill
  349. LEFT JOIN Supplier ON Supplier.ID_Supplier = PurchaseOrderBill.ID_Supplier
  350. LEFT JOIN AppUser ON AppUser.ID_User = PurchaseOrderBill.ID_Assessor
  351. WHERE No_PurchaseOrderBill = @NextNo
  352. SELECT PurchaseSourceBillProduct.*, (Quantity_Order-Quantity_EndCase-Quantity_InDepot-Quantity_OnShip) AS Amount,Product.ID_Product, No_Product,Name_Product FROM PurchaseSourceBillProduct
  353. LEFT JOIN PurchaseOrderBillProduct ON PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct = PurchaseSourceBillProduct.ID_PurchaseSourceBillProduct
  354. LEFT JOIN Product ON Product.ID_Product = PurchaseOrderBillProduct.ID_Product
  355. LEFT JOIN PurchaseOrderBill ON PurchaseOrderBill.ID_PurchaseOrderBill = PurchaseOrderBillProduct.ID_PurchaseOrderBill
  356. WHERE PurchaseOrderBill.ID_PurchaseOrderBill = @ID_PurchaseOrderBill">
  357. <Params>
  358. <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0" />
  359. </Params>
  360. <Tables>
  361. <Table name="PurchaseOrderBill" />
  362. <Table name="PurchaseSourceBillProduct" />
  363. </Tables>
  364. </SearchLast>
  365. </Search>
  366. </Server>
  367. <Lables>
  368. <Search>
  369. Empty();
  370. NewInstance();
  371. tbNo.ReadOnly = false;
  372. refNo.ReadOnly = true;
  373. dtDate.ReadOnly = true;
  374. dtArrivalDate.ReadOnly = true;
  375. txtSupplierNo.ReadOnly = true;
  376. txtSupplierName.ReadOnly = true;
  377. txtAssessor.ReadOnly = true;
  378. dtAssessDate.ReadOnly = true;
  379. txtComment.ReadOnly = true;
  380. ikDataGridEx1.ReadOnly = true;
  381. toolBar.EnableSubmit = false;
  382. #PurchaseOrderBill.Date_PurchaseOrderBill = DBNull();
  383. #PurchaseOrderBill.ArrivalDate_PurchaseOrderBill = DBNull();
  384. #PurchaseOrderBill.AssessDate_PurchaseOrderBill = DBNull();
  385. UpdateForm(true, "");
  386. tbNo.Focus();
  387. @Status=0;
  388. </Search>
  389. <New>
  390. Empty();
  391. NewInstance();
  392. tbNo.ReadOnly = true;
  393. refNo.ReadOnly = true;
  394. dtDate.ReadOnly = true;
  395. dtArrivalDate.ReadOnly = true;
  396. txtSupplierNo.ReadOnly = true;
  397. txtSupplierName.ReadOnly = true;
  398. txtAssessor.ReadOnly = true;
  399. dtAssessDate.ReadOnly = true;
  400. txtComment.ReadOnly = false;
  401. ikDataGridEx1.ReadOnly = false;
  402. toolBar.EnableSubmit = true;
  403. ikDataGridEx1.AllowNew(true);
  404. ikDataGridEx1.AllowDelete(true);
  405. UpdateForm(true, "");
  406. @Status=1;
  407. </New>
  408. <View>
  409. tbNo.ReadOnly = true;
  410. refNo.ReadOnly = true;
  411. dtDate.ReadOnly = true;
  412. dtArrivalDate.ReadOnly = true;
  413. txtSupplierNo.ReadOnly = true;
  414. txtSupplierName.ReadOnly = true;
  415. txtAssessor.ReadOnly = true;
  416. dtAssessDate.ReadOnly = true;
  417. txtComment.ReadOnly = true;
  418. ikDataGridEx1.ReadOnly = true;
  419. toolBar.EnableSubmit = false;
  420. UpdateForm(true, "");
  421. @Status=2;
  422. </View>
  423. <Modify>
  424. tbNo.ReadOnly = true;
  425. refNo.ReadOnly = true;
  426. dtDate.ReadOnly = true;
  427. dtArrivalDate.ReadOnly = true;
  428. txtSupplierNo.ReadOnly = true;
  429. txtSupplierName.ReadOnly = true;
  430. txtAssessor.ReadOnly = true;
  431. dtAssessDate.ReadOnly = true;
  432. txtComment.ReadOnly = false;
  433. ikDataGridEx1.ReadOnly = false;
  434. toolBar.EnableSubmit = true;
  435. ikDataGridEx1.AllowNew(false);
  436. ikDataGridEx1.AllowDelete(false);
  437. UpdateForm(true, "");
  438. @Status=3;
  439. </Modify>
  440. <SubmitButtonClick>
  441. <![CDATA[
  442. UpdateForm(false, "");
  443. if((#PurchaseSourceBillProduct.Amount + #PurchaseSourceBillProduct.Quantity_EndCase + #PurchaseSourceBillProduct.Quantity_InDepot + #PurchaseSourceBillProduct.Quantity_OnShip)>#PurchaseSourceBillProduct.Quantity_Order)
  444. {
  445. MessageBox("强制结案数量大于可结案数量(订单数量-已结案-已入库-在途),提交失败!",@Title);
  446. return;
  447. }
  448. SuspendLayout();
  449. for(@i=0;@i<RowCount("#PurchaseSourceBillProduct");@i=@i+1)
  450. {
  451. SetPosition("#PurchaseSourceBillProduct",@i);
  452. if(#PurchaseSourceBillProduct.Amount < 0 )
  453. {
  454. ikDataGridEx1.CurrentRowIndex=@i;
  455. MessageBox("强制结案数量不得小于0!",@Title);
  456. ikDataGridEx1.Focus();
  457. ResumeLayout();
  458. return;
  459. }
  460. #PurchaseSourceBillProduct.Quantity_EndCase = #PurchaseSourceBillProduct.Quantity_EndCase + #PurchaseSourceBillProduct.Amount;
  461. }
  462. ResumeLayout();
  463. Update();
  464. ChangeMode("View");
  465. ]]>
  466. </SubmitButtonClick>
  467. </Lables>
  468. </Form>
  469. </Forms>