FrmPurchaseCosting.xml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <Forms>
  3. <Form Name="FrmPurchaseCosting">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @Title="成本核算";
  9. GetSchema();
  10. Search("SearchSystemSetting");
  11. @SysCurrency=#SystemSetting.SysCurrency_SystemSetting;
  12. ChangeMode("Search");
  13. ]]>
  14. </Load>
  15. <Closing>
  16. ;
  17. </Closing>
  18. <Closed>
  19. ;
  20. </Closed>
  21. </Events>
  22. <Mode>
  23. <Search>
  24. <Lable name="Search" />
  25. </Search>
  26. <New>
  27. <Lable name="New" />
  28. </New>
  29. <View>
  30. <Lable name="View" />
  31. </View>
  32. <Modify>
  33. <Lable name="Modify" />
  34. </Modify>
  35. </Mode>
  36. <Controls>
  37. <IKTextButton name="tbNo" DataSource="PurchaseInDepotBill.No_PurchaseInDepotBill">
  38. <Events>
  39. <Enter>
  40. <![CDATA[
  41. Empty();
  42. NewInstance();
  43. if(tbNo.ReadOnly == false)
  44. {
  45. if(tbNo.CValue != StringEmpty())
  46. {
  47. UpdateForm(false, "");
  48. if(Search("SearchPurchaseInDepotBillWithNo", tbNo.CValue))
  49. {
  50. if (#PurchaseInDepotBill.CostVerify_PurchaseInDepotBill == true)
  51. {
  52. ChangeMode("View");
  53. }
  54. else
  55. {
  56. if (GetRight(@Title,"新增") != true)
  57. {
  58. MessageBox("您没有权限进行成本核算!",@Title);
  59. return;
  60. }
  61. ChangeMode("Modify");
  62. }
  63. }
  64. else
  65. {
  66. MessageBox("该入库单不存在!",@Title);
  67. }
  68. }
  69. else
  70. {
  71. MessageBox("请输入入库单号!", @Title);
  72. }
  73. }
  74. ]]>
  75. </Enter>
  76. <Click>
  77. ShowSearchBox("BillSearch","HAVEDEPOT","tbNo",tbNo.CValue);
  78. </Click>
  79. </Events>
  80. </IKTextButton>
  81. <IKTextBox name="txtShortName" DataSource="PurchaseInDepotBill.EncasementNo_PurchaseInDepotBill"/>
  82. <IKTextBox name="txtAssessor" DataSource="PurchaseInDepotBill.Name_UserAudit"/>
  83. <IKDateTimeText name="dtAssessDate" DataSource="PurchaseInDepotBill.AssessDate_PurchaseInDepotBill"/>
  84. <IKTextBox name="txtComment" DataSource="PurchaseInDepotBill.Comment_PurchaseInDepotBill"/>
  85. <IKTextBox name="txtlastModUser" DataSource="PurchaseInDepotBill.Name_UserMod"/>
  86. <IKDateTimeText name="dtLastModDate" DataSource="PurchaseInDepotBill.CostingDate_PurchaseInDepotBill"/>
  87. <IKTextButton name="tbOutDepotBillNo" DataSource="PurchaseInDepotBill.InvoiceNo_PurchaseInDepotBill"/>
  88. <IKComboBoxEx name="cbCurrency" DisplaySource="PurchaseInDepotBill.Currency_PurchaseInDepotBill" DataSource="PurchaseInDepotBill"/>
  89. <IKNumericTextBox name="txtMoney" DataSource="PurchaseInDepotBill.GoodsAmount_PurchaseInDepotBill">
  90. <Events>
  91. <Leave>
  92. UpdateForm(false,"");
  93. <Lable name="CountSum" />
  94. </Leave>
  95. </Events>
  96. </IKNumericTextBox>
  97. <IKNumericTextBox name="txttax" DataSource="PurchaseInDepotBill.TaxAmount_PurchaseInDepotBill">
  98. <Events>
  99. <Leave>
  100. UpdateForm(false,"");
  101. <Lable name="CountSum" />
  102. </Leave>
  103. </Events>
  104. </IKNumericTextBox>
  105. <IKNumericTextBox name="txtcount" DataSource="PurchaseInDepotBill.count"/>
  106. <IKNumericTextBox name="txtCustom" DataSource="PurchaseInDepotBill.Custom_PurchaseInDepotBill">
  107. <Events>
  108. <Leave>
  109. UpdateForm(false,"");
  110. <Lable name="CountSum" />
  111. </Leave>
  112. </Events>
  113. </IKNumericTextBox>
  114. <IKNumericTextBox name="txtAgent" DataSource="PurchaseInDepotBill.Agent_PurchaseInDepotBill">
  115. <Events>
  116. <Leave>
  117. UpdateForm(false,"");
  118. <Lable name="CountSum" />
  119. </Leave>
  120. </Events>
  121. </IKNumericTextBox>
  122. <IKNumericTextBox name="txtCarriage" DataSource="PurchaseInDepotBill.Carriage_PurchaseInDepotBill">
  123. <Events>
  124. <Leave>
  125. UpdateForm(false,"");
  126. <Lable name="CountSum" />
  127. </Leave>
  128. </Events>
  129. </IKNumericTextBox>
  130. <IKNumericTextBox name="txtHandling" DataSource="PurchaseInDepotBill.Handling_PurchaseInDepotBill">
  131. <Events>
  132. <Leave>
  133. UpdateForm(false,"");
  134. <Lable name="CountSum" />
  135. </Leave>
  136. </Events>
  137. </IKNumericTextBox>
  138. <IKNumericTextBox name="txtOthers" DataSource="PurchaseInDepotBill.Others_PurchaseInDepotBill">
  139. <Events>
  140. <Leave>
  141. UpdateForm(false,"");
  142. <Lable name="CountSum" />
  143. </Leave>
  144. </Events>
  145. </IKNumericTextBox>
  146. <IKNumericTextBox name="txtAllMoney" DataSource="PurchaseInDepotBill.Amount_PurchaseInDepotBill"/>
  147. <IKButton name="btnCostCounting">
  148. <Events>
  149. <Click>
  150. if (#PurchaseInDepotBill.Amount_PurchaseInDepotBill == 0 || SumOfCol("#PurchaseInDepotBillProduct.Cost_PurchaseInDepotBillProduct") == 0)
  151. {
  152. MessageBox("『金额总计/采购金额』数值有误,请确认货款、费用及产品采购单价是否已录入!",@Title);
  153. return;
  154. }
  155. <Lable name="CostCounting" />
  156. </Click>
  157. </Events>
  158. </IKButton>
  159. <IKDataGridEx name="dgProduct" DataSource="PurchaseInDepotBillProduct" TableStyleIndex="0">
  160. <DataColumn Index="0" DataSource="PurchaseInDepotBillProduct.No_Product" />
  161. <DataColumn Index="1" DataSource="PurchaseInDepotBillProduct.Name_Product" />
  162. <DataColumn Index="2" DataSource="PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct" />
  163. <DataColumn Index="3" DataSource="PurchaseInDepotBillProduct.Unit_Product" />
  164. <DataColumn Index="4" DataSource="PurchaseInDepotBillProduct.Cost_PurchaseInDepotBillProduct" />
  165. <DataColumn Index="5" DataSource="PurchaseInDepotBillProduct.Money" />
  166. <DataColumn Index="6" DataSource="PurchaseInDepotBillProduct.Comment_PurchaseInDepotBillProduct" />
  167. </IKDataGridEx>
  168. <IKFormToolBar name="toolBar">
  169. <Events>
  170. <ClickFirst>
  171. ;
  172. </ClickFirst>
  173. <ClickPrev>
  174. ;
  175. </ClickPrev>
  176. <ClickNext>
  177. ;
  178. </ClickNext>
  179. <ClickLast>
  180. ;
  181. </ClickLast>
  182. <ClickNew>
  183. ;
  184. </ClickNew>
  185. <ClickEmpty>
  186. ChangeMode("Search");
  187. </ClickEmpty>
  188. <ClickSubmit>
  189. if (#PurchaseInDepotBill.Amount_PurchaseInDepotBill == 0 || SumOfCol("#PurchaseInDepotBillProduct.Cost_PurchaseInDepotBillProduct") == 0)
  190. {
  191. MessageBox("『金额总计/采购金额』数值有误,请确认货款、费用及产品采购单价是否已录入!",@Title);
  192. return;
  193. }
  194. if (MessageBox("该操作将更新库存成本单价,其后的入库业务都将以此成本核算。确定要提交数据吗?",@Title,MB_YESNO)==DialogResult("NO"))
  195. {
  196. return;
  197. }
  198. <Lable name="SubmitButtonClick" />
  199. </ClickSubmit>
  200. <ClickModify>
  201. ChangeMode("Modify");
  202. </ClickModify>
  203. <ClickDelete>
  204. ;
  205. </ClickDelete>
  206. <ClickPrint>
  207. PrintReport();
  208. </ClickPrint>
  209. <ClickAudit>
  210. ;
  211. </ClickAudit>
  212. <ClickUnAudit>
  213. ;
  214. </ClickUnAudit>
  215. <ClickImport>
  216. ;
  217. </ClickImport>
  218. <ClickExport>
  219. ;
  220. </ClickExport>
  221. <ClickClose>
  222. ;
  223. </ClickClose>
  224. <ClickExpand>
  225. ;
  226. </ClickExpand>
  227. </Events>
  228. </IKFormToolBar>
  229. </Controls>
  230. <Tables>
  231. <Table name="PurchaseInDepotBillProduct">
  232. <Events>
  233. <ColumnsChanged>
  234. <Cost_PurchaseInDepotBillProduct>
  235. #PurchaseInDepotBillProduct.Money = #PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct * #PurchaseInDepotBillProduct.Cost_PurchaseInDepotBillProduct;
  236. </Cost_PurchaseInDepotBillProduct>
  237. </ColumnsChanged>
  238. </Events>
  239. </Table>
  240. </Tables>
  241. <LockInfomation LockID="ID_PurchaseInDepotBill" LockNO="No_PurchaseInDepotBill" LockSearchFunction="SearchPurchaseInDepotBillWithNo"/>
  242. <LogInfomation LogNO="#PurchaseInDepotBill.No_PurchaseInDepotBill" RecordFormField="采购入库单号:#PurchaseInDepotBill.No_PurchaseInDepotBill,发票号码:#PurchaseInDepotBill.InvoiceNo_PurchaseInDepotBill,金额总计:#PurchaseInDepotBill.Amount_PurchaseInDepotBill" RecordDataGridField=""/>
  243. <ChildForms>
  244. <ChildForm name="BillSearch" DataSource="PurchaseInDepotBill" SearchFunction="SearchAllBill" SearchFunctionByNo="SearchPurchaseInDepotBillWithNo">
  245. <DataColumn Index="0" MappingName="#PurchaseInDepotBill.No_PurchaseInDepotBill" HeaderText="采购入库单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  246. <DataColumn Index="1" MappingName="#PurchaseInDepotBill.Date_PurchaseInDepotBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  247. <DataColumn Index="2" MappingName="#PurchaseInDepotBill.CostVerify_PurchaseInDepotBill" HeaderText="已成本核算" Width="90" ColumnType="IKDataGridBoolColumn"/>
  248. </ChildForm>
  249. </ChildForms>
  250. </Client>
  251. <Server>
  252. <Tables>
  253. <Table name="PurchaseInDepotBill" Type="Parent">
  254. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 PurchaseInDepotBill.*, a.Name_User as Name_UserAudit, b.Name_User as Name_UserMod, CONVERT(decimal(18,6),0) AS count
  255. FROM PurchaseInDepotBill
  256. LEFT JOIN AppUser a ON a.ID_User = PurchaseInDepotBill.ID_Assessor
  257. LEFT JOIN AppUser b ON b.ID_User = PurchaseInDepotBill.Creator_PurchaseInDepotBill"/>
  258. <Update CmdType="Text" CmdText=" DECLARE @ID_Assessor uniqueidentifier
  259. SELECT @ID_Assessor = PurchaseInDepotBill.ID_Assessor FROM PurchaseInDepotBill WHERE PurchaseInDepotBill.ID_PurchaseInDepotBill = @ID_PurchaseInDepotBill
  260. IF (@ID_Assessor IS NULL)
  261. BEGIN
  262. RAISERROR('该采购入库单未经审核,不能进行成本核算!',16,1)
  263. RETURN
  264. END
  265. UPDATE PurchaseInDepotBill
  266. SET CostVerify_PurchaseInDepotBill = 1,
  267. Creator_PurchaseInDepotBill = @Creator_PurchaseInDepotBill,
  268. CostingDate_PurchaseInDepotBill = @CostingDate_PurchaseInDepotBill,
  269. InvoiceNo_PurchaseInDepotBill = @InvoiceNo_PurchaseInDepotBill,
  270. Currency_PurchaseInDepotBill = @Currency_PurchaseInDepotBill,
  271. GoodsAmount_PurchaseInDepotBill = @GoodsAmount_PurchaseInDepotBill,
  272. TaxAmount_PurchaseInDepotBill = @TaxAmount_PurchaseInDepotBill,
  273. Custom_PurchaseInDepotBill = @Custom_PurchaseInDepotBill,
  274. Agent_PurchaseInDepotBill = @Agent_PurchaseInDepotBill,
  275. Handling_PurchaseInDepotBill = @Handling_PurchaseInDepotBill,
  276. Carriage_PurchaseInDepotBill = @Carriage_PurchaseInDepotBill,
  277. Others_PurchaseInDepotBill = @Others_PurchaseInDepotBill,
  278. Amount_PurchaseInDepotBill = @Amount_PurchaseInDepotBill
  279. WHERE ID_PurchaseInDepotBill = @ID_PurchaseInDepotBill">
  280. <Params>
  281. <Param name="@ID_PurchaseInDepotBill" type="PurchaseInDepotBill.ID_PurchaseInDepotBill" sourceColumn="ID_PurchaseInDepotBill"/>
  282. <Param name="@Creator_PurchaseInDepotBill" type="PurchaseInDepotBill.Creator_PurchaseInDepotBill" sourceColumn="Creator_PurchaseInDepotBill"/>
  283. <Param name="@CostingDate_PurchaseInDepotBill" type="PurchaseInDepotBill.CostingDate_PurchaseInDepotBill" sourceColumn="CostingDate_PurchaseInDepotBill"/>
  284. <Param name="@InvoiceNo_PurchaseInDepotBill" type="PurchaseInDepotBill.InvoiceNo_PurchaseInDepotBill" sourceColumn="InvoiceNo_PurchaseInDepotBill"/>
  285. <Param name="@Currency_PurchaseInDepotBill" type="PurchaseInDepotBill.Currency_PurchaseInDepotBill" sourceColumn="Currency_PurchaseInDepotBill"/>
  286. <Param name="@GoodsAmount_PurchaseInDepotBill" type="PurchaseInDepotBill.GoodsAmount_PurchaseInDepotBill" sourceColumn="GoodsAmount_PurchaseInDepotBill"/>
  287. <Param name="@TaxAmount_PurchaseInDepotBill" type="PurchaseInDepotBill.TaxAmount_PurchaseInDepotBill" sourceColumn="TaxAmount_PurchaseInDepotBill"/>
  288. <Param name="@Custom_PurchaseInDepotBill" type="PurchaseInDepotBill.Custom_PurchaseInDepotBill" sourceColumn="Custom_PurchaseInDepotBill"/>
  289. <Param name="@Agent_PurchaseInDepotBill" type="PurchaseInDepotBill.Agent_PurchaseInDepotBill" sourceColumn="Agent_PurchaseInDepotBill"/>
  290. <Param name="@Handling_PurchaseInDepotBill" type="PurchaseInDepotBill.Handling_PurchaseInDepotBill" sourceColumn="Handling_PurchaseInDepotBill"/>
  291. <Param name="@Carriage_PurchaseInDepotBill" type="PurchaseInDepotBill.Carriage_PurchaseInDepotBill" sourceColumn="Carriage_PurchaseInDepotBill"/>
  292. <Param name="@Others_PurchaseInDepotBill" type="PurchaseInDepotBill.Others_PurchaseInDepotBill" sourceColumn="Others_PurchaseInDepotBill"/>
  293. <Param name="@Amount_PurchaseInDepotBill" type="PurchaseInDepotBill.Amount_PurchaseInDepotBill" sourceColumn="Amount_PurchaseInDepotBill"/>
  294. </Params>
  295. </Update>
  296. </Table>
  297. <Table name="PurchaseInDepotBillProduct" Type="Child">
  298. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 PurchaseInDepotBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product, CONVERT(decimal(18,6),0) AS Money
  299. FROM PurchaseInDepotBillProduct
  300. LEFT JOIN Product ON Product.ID_Product = PurchaseInDepotBillProduct.ID_Product"/>
  301. <Update CmdType="Text" CmdText=" UPDATE Product SET Product.Cost_Product = @Cost_PurchaseInDepotBillProduct WHERE Product.ID_Product = @ID_Product
  302. UPDATE PurchaseInDepotBillProduct SET PurchaseInDepotBillProduct.Cost_PurchaseInDepotBillProduct = @Cost_PurchaseInDepotBillProduct WHERE PurchaseInDepotBillProduct.ID_PurchaseInDepotBillProduct = @ID_PurchaseInDepotBillProduct">
  303. <Params>
  304. <Param name="@ID_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.ID_PurchaseInDepotBillProduct" sourceColumn="ID_PurchaseInDepotBillProduct"/>
  305. <Param name="@ID_Product" type="PurchaseInDepotBillProduct.ID_Product" sourceColumn="ID_Product"/>
  306. <Param name="@Cost_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.Cost_PurchaseInDepotBillProduct" sourceColumn="Cost_PurchaseInDepotBillProduct"/>
  307. </Params>
  308. </Update>
  309. </Table>
  310. </Tables>
  311. <Search>
  312. <SearchSystemSetting CmdType="Text" CmdText="SELECT SysCurrency_SystemSetting From SystemSetting">
  313. <Tables>
  314. <Table name="SystemSetting"/>
  315. </Tables>
  316. </SearchSystemSetting>
  317. <SearchAllBill CmdType="Text" CmdText=" SELECT PurchaseInDepotBill.*, a.Name_User as Name_UserAudit, b.Name_User as Name_UserMod, CONVERT(decimal(18,6),0) AS count
  318. FROM PurchaseInDepotBill
  319. LEFT JOIN AppUser a ON a.ID_User = PurchaseInDepotBill.ID_Assessor
  320. LEFT JOIN AppUser b ON b.ID_User = PurchaseInDepotBill.Creator_PurchaseInDepotBill
  321. WHERE PurchaseInDepotBill.ID_Assessor is not null ">
  322. <Tables>
  323. <Table name="AllBill" />
  324. </Tables>
  325. </SearchAllBill>
  326. <SearchPurchaseInDepotBillWithNo CmdType="Text" CmdText=" DECLARE @ID_PurchaseInDepotBill uniqueidentifier
  327. DECLARE @CostVerify bit
  328. DECLARE @ID_Assessor uniqueidentifier
  329. SELECT @ID_PurchaseInDepotBill = ID_PurchaseInDepotBill, @CostVerify = CostVerify_PurchaseInDepotBill, @ID_Assessor = ID_Assessor FROM PurchaseInDepotBill WHERE No_PurchaseInDepotBill = @No_PurchaseInDepotBill
  330. IF (@CostVerify = 0 AND @ID_Assessor IS NULL)
  331. BEGIN
  332. RAISERROR('该采购入库单未经审核,不能进行成本核算!',16,1)
  333. RETURN
  334. END
  335. SELECT PurchaseInDepotBill.*, a.Name_User as Name_UserAudit, b.Name_User as Name_UserMod,
  336. CONVERT(decimal(18,6),PurchaseInDepotBill.GoodsAmount_PurchaseInDepotBill + PurchaseInDepotBill.TaxAmount_PurchaseInDepotBill) AS count
  337. FROM PurchaseInDepotBill
  338. LEFT JOIN AppUser a ON a.ID_User = PurchaseInDepotBill.ID_Assessor
  339. LEFT JOIN AppUser b ON b.ID_User = PurchaseInDepotBill.Creator_PurchaseInDepotBill
  340. WHERE PurchaseInDepotBill.ID_PurchaseInDepotBill = @ID_PurchaseInDepotBill
  341. SELECT PurchaseInDepotBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product,
  342. CONVERT(decimal(18,6),PurchaseInDepotBillProduct.Cost_PurchaseInDepotBillProduct * PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct) AS Money
  343. FROM PurchaseInDepotBillProduct
  344. LEFT JOIN Product ON Product.ID_Product = PurchaseInDepotBillProduct.ID_Product
  345. WHERE PurchaseInDepotBillProduct.ID_PurchaseInDepotBill = @ID_PurchaseInDepotBill
  346. Order By Product.Name_Product ">
  347. <Params>
  348. <Param name="@No_PurchaseInDepotBill" type="PurchaseInDepotBill.No_PurchaseInDepotBill" Index="0" />
  349. </Params>
  350. <Tables>
  351. <Table name="PurchaseInDepotBill" />
  352. <Table name="PurchaseInDepotBillProduct" />
  353. </Tables>
  354. </SearchPurchaseInDepotBillWithNo>
  355. <SearchPurchaseInDepotBillWithNonoVerify CmdType="Text" CmdText=" DECLARE @ID_PurchaseInDepotBill uniqueidentifier
  356. DECLARE @CostVerify bit
  357. DECLARE @ID_Assessor uniqueidentifier
  358. SELECT @ID_PurchaseInDepotBill = ID_PurchaseInDepotBill FROM PurchaseInDepotBill WHERE No_PurchaseInDepotBill = @No_PurchaseInDepotBill
  359. SELECT PurchaseInDepotBill.*, a.Name_User as Name_UserAudit, b.Name_User as Name_UserMod,
  360. CONVERT(decimal(18,6),PurchaseInDepotBill.GoodsAmount_PurchaseInDepotBill + PurchaseInDepotBill.TaxAmount_PurchaseInDepotBill) AS count
  361. FROM PurchaseInDepotBill
  362. LEFT JOIN AppUser a ON a.ID_User = PurchaseInDepotBill.ID_Assessor
  363. LEFT JOIN AppUser b ON b.ID_User = PurchaseInDepotBill.Creator_PurchaseInDepotBill
  364. WHERE PurchaseInDepotBill.ID_PurchaseInDepotBill = @ID_PurchaseInDepotBill and PurchaseInDepotBill.CostVerify_PurchaseInDepotBill=0 and PurchaseInDepotBill.ID_Assessor is not null
  365. SELECT PurchaseInDepotBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product,
  366. CONVERT(decimal(18,6),PurchaseInDepotBillProduct.Cost_PurchaseInDepotBillProduct * PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct) AS Money
  367. FROM PurchaseInDepotBillProduct
  368. LEFT JOIN Product ON Product.ID_Product = PurchaseInDepotBillProduct.ID_Product
  369. WHERE PurchaseInDepotBillProduct.ID_PurchaseInDepotBill = @ID_PurchaseInDepotBill and PurchaseInDepotBill.CostVerify_PurchaseInDepotBill=0 and PurchaseInDepotBill.ID_Assessor is not null
  370. Order By Product.Name_Product ">
  371. <Params>
  372. <Param name="@No_PurchaseInDepotBill" type="PurchaseInDepotBill.No_PurchaseInDepotBill" Index="0" />
  373. </Params>
  374. <Tables>
  375. <Table name="PurchaseInDepotBill" />
  376. <Table name="PurchaseInDepotBillProduct" />
  377. </Tables>
  378. </SearchPurchaseInDepotBillWithNonoVerify>
  379. </Search>
  380. </Server>
  381. <Lables>
  382. <Search>
  383. Empty();
  384. NewInstance();
  385. tbNo.ReadOnly = false;
  386. tbOutDepotBillNo.ReadOnly = true;
  387. cbCurrency.Enabled = false;
  388. txtMoney.ReadOnly = true;
  389. txttax.ReadOnly = true;
  390. txtCustom.ReadOnly = true;
  391. txtAgent.ReadOnly = true;
  392. txtCarriage.ReadOnly = true;
  393. txtHandling.ReadOnly = true;
  394. txtOthers.ReadOnly = true;
  395. toolBar.EnableSubmit = false;
  396. toolBar.EnableModify=false;
  397. dgProduct.ReadOnly = true;
  398. #PurchaseInDepotBill.AssessDate_PurchaseInDepotBill = DBNull();
  399. #PurchaseInDepotBill.CostingDate_PurchaseInDepotBill = DBNull();
  400. UpdateForm(true,"");
  401. btnCostCounting.Enabled = false;
  402. tbNo.Focus();
  403. @Status = 0;
  404. </Search>
  405. <New>
  406. ;
  407. </New>
  408. <View>
  409. tbNo.ReadOnly = true;
  410. tbOutDepotBillNo.ReadOnly = true;
  411. cbCurrency.Enabled = false;
  412. txtMoney.ReadOnly = true;
  413. txttax.ReadOnly = true;
  414. txtCustom.ReadOnly = true;
  415. txtAgent.ReadOnly = true;
  416. txtCarriage.ReadOnly = true;
  417. txtHandling.ReadOnly = true;
  418. txtOthers.ReadOnly = true;
  419. toolBar.EnableSubmit = false;
  420. toolBar.EnableModify=true;
  421. dgProduct.ReadOnly = true;
  422. UpdateForm(true,"");
  423. btnCostCounting.Enabled = false;
  424. @Status = 2;
  425. </View>
  426. <Modify>
  427. tbNo.ReadOnly = true;
  428. tbOutDepotBillNo.ReadOnly = false;
  429. cbCurrency.Enabled = false;
  430. txtMoney.ReadOnly = false;
  431. txttax.ReadOnly = false;
  432. txtCustom.ReadOnly = false;
  433. txtAgent.ReadOnly = false;
  434. txtCarriage.ReadOnly = false;
  435. txtHandling.ReadOnly = false;
  436. txtOthers.ReadOnly = false;
  437. toolBar.EnableSubmit = true;
  438. toolBar.EnableModify=false;
  439. dgProduct.ReadOnly = false;
  440. #PurchaseInDepotBill.Currency_PurchaseInDepotBill =@SysCurrency;
  441. #PurchaseInDepotBill.Creator_PurchaseInDepotBill = GetLoginUserID();
  442. #PurchaseInDepotBill.Name_UserMod = GetCurrentUser();
  443. #PurchaseInDepotBill.CostingDate_PurchaseInDepotBill = DateTimeNow();
  444. dgProduct.AllowNew(false);
  445. dgProduct.AllowDelete(false);
  446. btnCostCounting.Enabled = true;
  447. UpdateForm(true,"");
  448. @Status = 3;
  449. </Modify>
  450. <SubmitButtonClick>
  451. UpdateForm(false,"");
  452. if (@Status == 3)
  453. {
  454. Update();
  455. }
  456. ChangeMode("View");
  457. </SubmitButtonClick>
  458. <CountSum>
  459. #PurchaseInDepotBill.count = #PurchaseInDepotBill.GoodsAmount_PurchaseInDepotBill + #PurchaseInDepotBill.TaxAmount_PurchaseInDepotBill;
  460. #PurchaseInDepotBill.Amount_PurchaseInDepotBill = #PurchaseInDepotBill.count + #PurchaseInDepotBill.Custom_PurchaseInDepotBill + #PurchaseInDepotBill.Agent_PurchaseInDepotBill + #PurchaseInDepotBill.Carriage_PurchaseInDepotBill + #PurchaseInDepotBill.Handling_PurchaseInDepotBill + #PurchaseInDepotBill.Others_PurchaseInDepotBill;
  461. UpdateForm(true,"");
  462. </CountSum>
  463. <CostCounting>
  464. <![CDATA[
  465. @SumOfMoney = SumOfCol("#PurchaseInDepotBillProduct.Money");
  466. SuspendLayout();
  467. for (@i=0;@i<RowCount("#PurchaseInDepotBillProduct");@i=@i+1)
  468. {
  469. SetPosition("#PurchaseInDepotBillProduct", @i);
  470. #PurchaseInDepotBillProduct.Money = #PurchaseInDepotBill.Amount_PurchaseInDepotBill * #PurchaseInDepotBillProduct.Money / @SumOfMoney;
  471. #PurchaseInDepotBillProduct.Cost_PurchaseInDepotBillProduct = #PurchaseInDepotBillProduct.Money / #PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct;
  472. }
  473. ResumeLayout();
  474. ]]>
  475. </CostCounting>
  476. </Lables>
  477. </Form>
  478. </Forms>