FrmPurchaseInDepotBill.xml 93 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <Forms>
  3. <Form Name="FrmPurchaseInDepotBill">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @SetFlag=1;
  9. @SetFlag1=1;
  10. @Title="采购入库单";
  11. GetSchema();
  12. ChangeMode("Search");
  13. Search("SearchProcess");
  14. Search("SearchLocation");
  15. Search("SearchOneLocation","p");
  16. Search("SearchPurchaseOrderBillProduct","p","p");
  17. Search("SearchProduct","p");
  18. Search("SearchLocationByNo","p");
  19. @StockAndInDepot = #Process.StockAndInDepot_SystemSetting;
  20. dgProduct.NoMember="No_PurchaseInDepotBillProduct";
  21. Search("SearchBillType");
  22. ]]>
  23. </Load>
  24. <Closing>
  25. ;<!--TODO-->
  26. </Closing>
  27. <Closed>
  28. ;<!--TODO-->
  29. </Closed>
  30. </Events>
  31. <Mode>
  32. <Search>
  33. <Lable name="Search" />
  34. </Search>
  35. <New>
  36. <Lable name="New" />
  37. </New>
  38. <View>
  39. <Lable name="View" />
  40. </View>
  41. <Modify>
  42. <Lable name="Modify" />
  43. </Modify>
  44. </Mode>
  45. <Controls>
  46. <IKTextButton name="tbNo" DataSource="PurchaseInDepotBill.No_PurchaseInDepotBill">
  47. <Events>
  48. <Enter>
  49. <![CDATA[
  50. if(tbNo.ReadOnly == false)
  51. {
  52. if(tbNo.CValue != StringEmpty())
  53. {
  54. UpdateForm(false, "");
  55. if(Search("SearchPurchaseInDepotBillWithNo", tbNo.CValue))
  56. {
  57. ChangeMode("View");
  58. }
  59. else
  60. {
  61. MessageBox("该采购入库单号不存在!",@Title);
  62. }
  63. }
  64. else
  65. {
  66. MessageBox("请输入采购入库单号!", @Title);
  67. }
  68. }
  69. ]]>
  70. </Enter>
  71. <Click>
  72. ShowSearchBox("BillSearch","HAVEDEPOT", "tbNo",tbNo.CValue);
  73. </Click>
  74. </Events>
  75. </IKTextButton>
  76. <IKDataTimePicker name="timeMake" DataSource="PurchaseInDepotBill.Date_PurchaseInDepotBill" />
  77. <IKTextButton name="tbNoSupplier" DataSource="PurchaseInDepotBill.No_Supplier" >
  78. <Events>
  79. <Enter>
  80. UpdateForm(false,"");
  81. if(tbNoSupplier.CValue!=StringEmpty())
  82. {
  83. if(!Search("SearchSupplier",tbNoSupplier.CValue))
  84. {
  85. MessageBox("该供应商不存在!",@Title);
  86. @temp = ShowSearchBox("SupplierSearch","INFOMATION",tbNoSupplier.CValue);
  87. if(@temp != "")
  88. {
  89. tbNoSupplier.CValue = @temp;
  90. ActiveControlEvent("tbNoSupplier", "Enter");
  91. }
  92. }
  93. else
  94. {
  95. if (!Equals(#Supplier.SuspendDate_Supplier,DBNull()))
  96. {
  97. MessageBox("该供应商已停用!",@Title);
  98. }
  99. #PurchaseInDepotBill.ID_Supplier=#Supplier.ID_Supplier;
  100. #PurchaseInDepotBill.ShortName_Supplier=#Supplier.ShortName_Supplier;
  101. }
  102. }
  103. else
  104. {
  105. MessageBox("请输入供应商编号!",@Title);
  106. #PurchaseInDepotBill.ID_Supplier=GuidEmpty();
  107. #PurchaseInDepotBill.ShortName_Supplier="";
  108. tbNoSupplier.Focus();
  109. }
  110. UpdateForm(true,"");
  111. </Enter>
  112. <Click>
  113. <![CDATA[
  114. if (tbNoSupplier.ReadOnly == false)
  115. {
  116. @temp = ShowSearchBox("SupplierSearch","INFOMATION",tbNoSupplier.CValue);
  117. if( @temp == "" )
  118. return;
  119. tbNoSupplier.CValue = @temp;
  120. ActiveControlEvent("tbNoSupplier", "Enter");
  121. }
  122. ]]>
  123. </Click>
  124. </Events>
  125. </IKTextButton>
  126. <IKTextBox name="txtShortName" DataSource="PurchaseInDepotBill.EncasementNo_PurchaseInDepotBill">
  127. <Events>
  128. <Enter>
  129. <![CDATA[
  130. if(txtShortName.CValue!=StringEmpty())
  131. {
  132. if(Search("SearchByEncasementNo",txtShortName.CValue))
  133. {
  134. if(!Equals(#OnShipProduct.SuspendDate_Product,DBNull()))
  135. {
  136. MessageBox("该产品已停用!");
  137. }
  138. MergeTable("#OnShipProduct","#PurchaseInDepotBillProduct");
  139. SuspendLayout();
  140. for(@i=0;@i<RowCount("#PurchaseInDepotBillProduct");@i=@i+1)
  141. {
  142. SetPosition("#PurchaseInDepotBillProduct",@i);
  143. #PurchaseInDepotBillProduct.No_PurchaseInDepotBillProduct = @i + 1;
  144. }
  145. ResumeLayout();
  146. dgProduct.RowHeaderCheck=true;
  147. }
  148. else
  149. {
  150. MessageBox("您输入的装箱单号不存在!",@Title);
  151. txtShortName.Focus();
  152. }
  153. }
  154. else
  155. {
  156. MessageBox("请输入装箱单号!");
  157. txtShortName.Focus();
  158. }
  159. ]]>
  160. </Enter>
  161. </Events>
  162. </IKTextBox>
  163. <IKTextBox name="txtSupplierShortName" DataSource="PurchaseInDepotBill.ShortName_Supplier"/>
  164. <IKComboBoxEx name="cbProposer" ValueSource="PurchaseInDepotBill.ID_QA" DisplaySource="PurchaseInDepotBill.Name_Principal" NoSource="PurchaseInDepotBill.No_Principal" DataSource="Principal" DisplayMember="Name_Principal" NoMember="No_Principal" ValueMember="ID_Employee">
  165. <Events>
  166. <Reload>
  167. UpdateForm(false, "cbProposer");
  168. Search("SearchPrincipal");
  169. UpdateForm(true, "cbProposer");
  170. </Reload>
  171. </Events>
  172. </IKComboBoxEx>
  173. <IKComboBoxEx name="cbLocation" DisplaySource="PurchaseInDepotBill.Name_Location" NoSource="PurchaseInDepotBill.No_Location"
  174. ValueSource="PurchaseInDepotBill.ID_Location" DataSource="Location" DisplayMember="Name_Location"
  175. NoMember="No_Location" ValueMember="ID_Location">
  176. <Events>
  177. <Reload>
  178. UpdateForm(false, "cbLocation");
  179. Search("SearchLocation");
  180. UpdateForm(true, "cbLocation");
  181. </Reload>
  182. <!-- <SelectedIndexChanged>
  183. if (RowCount("#PurchaseInDepotBillProduct") &gt; 0)
  184. {
  185. SuspendLayout();
  186. for (@i=0;@i &lt; RowCount("#PurchaseInDepotBillProduct");@i=@i+1)
  187. {
  188. SetPosition("#PurchaseInDepotBillProduct", @i);
  189. #PurchaseInDepotBillProduct.Name_Location ="";
  190. #PurchaseInDepotBillProduct.ID_Location=GuidEmpty();
  191. }
  192. ResumeLayout();
  193. }
  194. </SelectedIndexChanged>-->
  195. </Events>
  196. </IKComboBoxEx>
  197. <IKTextBox name="txtComment" DataSource="PurchaseInDepotBill.Comment_PurchaseInDepotBill" />
  198. <IKTextBox name="txtMaker" DataSource="PurchaseInDepotBill.Creator" />
  199. <IKTextBox name="txtAssessor" DataSource="PurchaseInDepotBill.Assessor" />
  200. <IKDateTimeText name="dtAssessDate" DataSource="PurchaseInDepotBill.AssessDate_PurchaseInDepotBill" />
  201. <IKTextBox name="txtlastModUser" DataSource="PurchaseInDepotBill.LastModUser" />
  202. <IKDateTimeText name="dtLastModDate" DataSource="PurchaseInDepotBill.LastModDate_PurchaseInDepotBill" />
  203. <IKDataGridEx name="dgProduct" DataSource="PurchaseInDepotBillProduct" TableStyleIndex="0">
  204. <DataColumn Index="0" DataSource="PurchaseInDepotBillProduct.No_PurchaseInDepotBillProduct" />
  205. <DataColumn Index="1" DataSource="PurchaseInDepotBillProduct.Name_BillType" >
  206. <IKDataGridComboBoxColumn DisplaySourceEx="PurchaseInDepotBillProduct.Name_BillType" ValueSourceEx="PurchaseInDepotBillProduct.Type_FromBill" DataSourceEx="BillType" DisplayMemberEx="Name_BillType" ValueMemberEx="Value_BillType">
  207. <Events>
  208. <Reload>
  209. Search("SearchBillType");
  210. SetDataGridColumnDataSource(1,"dgProduct");
  211. </Reload>
  212. </Events>
  213. </IKDataGridComboBoxColumn>
  214. </DataColumn>
  215. <DataColumn Index="2" DataSource="PurchaseInDepotBillProduct.No_FromBill" />
  216. <DataColumn Index="3" DataSource="PurchaseInDepotBillProduct.No_FromBillProduct" />
  217. <DataColumn Index="4" DataSource="PurchaseInDepotBillProduct.RefNo_PurchaseInDepotBill" />
  218. <DataColumn Index="5" DataSource="PurchaseInDepotBillProduct.No_Product" >
  219. <IKDataGridTextButtonColumn>
  220. <Events>
  221. <Click>
  222. @SetFlag=1;
  223. ShowSearchBox("ProductSearch","INFOMATION",#PurchaseInDepotBillProduct.No_Product);
  224. </Click>
  225. <SetFlagBeforeClick>
  226. @SetFlag=0;
  227. </SetFlagBeforeClick>
  228. </Events>
  229. </IKDataGridTextButtonColumn>
  230. </DataColumn>
  231. <DataColumn Index="6" DataSource="PurchaseInDepotBillProduct.Name_Product" />
  232. <DataColumn Index="7" DataSource="PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct" />
  233. <DataColumn Index="8" DataSource="PurchaseInDepotBillProduct.Unit_Product" />
  234. <DataColumn Index="9" DataSource="PurchaseInDepotBillProduct.No_Location" >
  235. <IKDataGridTextButtonColumn>
  236. <Events>
  237. <Click>
  238. @SetFlag1=1;
  239. @LocationNo = ShowSearchBox("LocationSearch","INFOMATION",#PurchaseInDepotBillProduct.No_Location);
  240. if(@LocationNo != "")
  241. #PurchaseInDepotBillProduct.No_Location = @LocationNo;
  242. </Click>
  243. <SetFlagBeforeClick>
  244. @SetFlag1=0;
  245. </SetFlagBeforeClick>
  246. </Events>
  247. </IKDataGridTextButtonColumn>
  248. </DataColumn>
  249. <DataColumn Index="10" DataSource="PurchaseInDepotBillProduct.Name_Location" />
  250. <DataColumn Index="11" DataSource="PurchaseInDepotBillProduct.Comment_PurchaseInDepotBillProduct" />
  251. </IKDataGridEx>
  252. <IKFormToolBar name="toolBar">
  253. <Events>
  254. <ClickFirst>
  255. if(Search("SearchPurchaseInDepotBillFirst"))
  256. {
  257. ChangeMode("View");
  258. }
  259. </ClickFirst>
  260. <ClickPrev>
  261. if(Search("SearchPurchaseInDepotBillPrev", tbNo.CValue))
  262. {
  263. ChangeMode("View");
  264. }
  265. </ClickPrev>
  266. <ClickNext>
  267. if(Search("SearchPurchaseInDepotBillNext",tbNo.CValue))
  268. {
  269. ChangeMode("View");
  270. }
  271. </ClickNext>
  272. <ClickLast>
  273. if(Search("SearchPurchaseInDepotBillLast"))
  274. {
  275. ChangeMode("View");
  276. }
  277. </ClickLast>
  278. <ClickNew>
  279. <![CDATA[
  280. @NextNo = GetNextAutoNumber(true);
  281. if (!Equals(@NextNo, ""))
  282. {
  283. ChangeMode("New");
  284. #PurchaseInDepotBill.No_PurchaseInDepotBill= @NextNo;
  285. UpdateForm(true, "tbNo");
  286. }
  287. ]]>
  288. </ClickNew>
  289. <ClickEmpty>
  290. ChangeMode("Search");
  291. </ClickEmpty>
  292. <ClickSubmit>
  293. <Lable name="SubmitButtonClick" />
  294. </ClickSubmit>
  295. <ClickModify>
  296. ChangeMode("Modify");
  297. txtNumSum.CValue=SumOfCol("#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct");
  298. </ClickModify>
  299. <ClickDelete>
  300. Delete(); ChangeMode("Search");
  301. </ClickDelete>
  302. <ClickPrint>
  303. ShowPrintBox("BillSearch",#PurchaseInDepotBill.No_PurchaseInDepotBill,#PurchaseInDepotBill.No_PurchaseInDepotBill);
  304. </ClickPrint>
  305. <ClickAudit>
  306. <![CDATA[
  307. @tag = 0;
  308. SuspendLayout();
  309. for (@i=0;@i<RowCount("#PurchaseInDepotBillProduct");@i=@i+1)
  310. {
  311. SetPosition("#PurchaseInDepotBillProduct", @i);
  312. if(Search("SearchExistsProduct",#PurchaseInDepotBillProduct.No_Location,#PurchaseInDepotBillProduct.No_Product))
  313. {
  314. dgProduct.CurrentRowIndex = @i;
  315. dgProduct.Focus();
  316. MessageBox("该库位已被其他产品占用,审核失败!",@Title);
  317. ResumeLayout(); return;
  318. }
  319. Register_Set("1",#PurchaseInDepotBillProduct.No_Location);
  320. Register_Set("2",#PurchaseInDepotBillProduct.No_Product);
  321. for(@j=@i+1;@j<=RowCount("#PurchaseInDepotBillProduct")-1;@j=@j+1)
  322. {
  323. SetPosition("#PurchaseInDepotBillProduct",@j);
  324. if(Equals(Register_Get("1"),#PurchaseInDepotBillProduct.No_Location) && !Equals(Register_Get("2"),#PurchaseInDepotBillProduct.No_Product))
  325. {
  326. @tag = @tag + 1;
  327. }
  328. }
  329. Register_Remove("1");
  330. Register_Remove("2");
  331. if(@tag > 0)
  332. {
  333. dgProduct.Focus();
  334. MessageBox("该单据存在相同库位,审核失败!",@Title);
  335. ResumeLayout();return;
  336. }
  337. }
  338. ResumeLayout();
  339. if(@StockAndInDepot==false)
  340. {
  341. SuspendLayout();
  342. for (@i=0;@i<RowCount("#PurchaseInDepotBillProduct");@i=@i+1)
  343. {
  344. SetPosition("#PurchaseInDepotBillProduct", @i);
  345. if(#PurchaseInDepotBillProduct.Type_FromBill!=0&&#PurchaseInDepotBillProduct.No_FromBill!=StringEmpty()&&Search("SearchPurchaseOrderBill",#PurchaseInDepotBillProduct.No_FromBill))
  346. {
  347. if(Equals(#PurchaseOrderBill.ID_Assessor,DBNull()))
  348. {
  349. dgProduct.CurrentRowIndex = @i;
  350. @DialogResult=MessageBox("来源单据未经审核,确定要审核么?",@Title,MB_OKCANCEL);
  351. if(@DialogResult == DialogResult("CANCEL"))
  352. {
  353. dgProduct.Focus();
  354. ResumeLayout();
  355. return;
  356. }
  357. }
  358. }
  359. }
  360. ResumeLayout();
  361. }
  362. BeginAudit();
  363. #PurchaseInDepotBill.ID_Assessor=GetLoginUserID();
  364. #PurchaseInDepotBill.Assessor=GetCurrentUser();
  365. #PurchaseInDepotBill.AssessDate_PurchaseInDepotBill=DateTimeNow();
  366. Audit();
  367. ChangeMode("View");
  368. EndAudit();
  369. txtNumSum.CValue=SumOfCol("#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct");
  370. ]]>
  371. </ClickAudit>
  372. <ClickUnAudit>
  373. if(#PurchaseInDepotBill.CostVerify_PurchaseInDepotBill == true)
  374. {
  375. @DialogResult=MessageBox("该单据已经成本核算,确定要取消审核吗?",@Title,MB_OKCANCEL);
  376. if(@DialogResult == DialogResult("CANCEL"))
  377. return;
  378. }
  379. BeginUnAudit();
  380. #PurchaseInDepotBill.ID_Assessor=DBNull();
  381. #PurchaseInDepotBill.Assessor=DBNull();
  382. #PurchaseInDepotBill.AssessDate_PurchaseInDepotBill=DateTimeNow();
  383. UnAudit();
  384. ChangeMode("View");
  385. EndUnAudit();
  386. txtNumSum.CValue=SumOfCol("#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct");
  387. </ClickUnAudit>
  388. <ClickImport>
  389. ;
  390. </ClickImport>
  391. <ClickExport>
  392. ;
  393. </ClickExport>
  394. <ClickClose>
  395. ;
  396. </ClickClose>
  397. <ClickExpand>
  398. ;
  399. </ClickExpand>
  400. <ClickImportItem>
  401. <![CDATA[
  402. if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="采购订单")
  403. {
  404. if(Search("SearchContr"))
  405. {
  406. ShowSearchBox("ImportPurchaseOrderBillControl","BILLCONVERT","#PurchaseInDepotBillProduct.Type_FromBill",41,"#PurchaseInDepotBillProduct.Name_BillType","采购订单");
  407. }
  408. else
  409. {
  410. ShowSearchBox("ImportPurchaseOrderBillUnControl","BILLCONVERT");
  411. }
  412. }
  413. ]]>
  414. <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
  415. </ClickImportItem>
  416. <ClickExportItem>
  417. ;<!--初始化目标数据-->
  418. <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
  419. </ClickExportItem>
  420. </Events>
  421. </IKFormToolBar>
  422. </Controls>
  423. <Tables>
  424. <Table name="PurchaseInDepotBillProduct">
  425. <Events>
  426. <ColumnsChanged>
  427. <Name_BillType>
  428. <![CDATA[
  429. if(#PurchaseInDepotBillProduct.Name_BillType!=StringEmpty()&&#PurchaseInDepotBillProduct.No_FromBill!=StringEmpty()&&#PurchaseInDepotBillProduct.No_FromBillProduct!=StringEmpty())
  430. {
  431. if(Search("SearchPurchaseOrderBillProduct",#PurchaseInDepotBillProduct.No_FromBill,#PurchaseInDepotBillProduct.No_FromBillProduct))
  432. {
  433. if(!Equals(#PurchaseOrderBillProduct.SuspendDate_Product,DBNull()))
  434. {
  435. MessageBox("该产品已停用!");
  436. }
  437. #PurchaseInDepotBillProduct.ID_Product=#PurchaseOrderBillProduct.ID_Product;
  438. #PurchaseInDepotBillProduct.Name_Product=#PurchaseOrderBillProduct.Name_Product;
  439. #PurchaseInDepotBillProduct.Unit_Product=#PurchaseOrderBillProduct.Unit_Product;
  440. #PurchaseInDepotBillProduct.No_Product=#PurchaseOrderBillProduct.No_Product;
  441. #PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct=#PurchaseOrderBillProduct.Quantity;
  442. #PurchaseInDepotBillProduct.RefNo_PurchaseInDepotBill=#PurchaseOrderBillProduct.RefNo_PurchaseOrderBill;
  443. txtNumSum.CValue=SumOfCol("#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct");
  444. if( Search("SearchOneLocation",#PurchaseOrderBillProduct.No_Product))
  445. {
  446. #PurchaseInDepotBillProduct.No_Location = #OneLocation.No_Location;
  447. #PurchaseInDepotBillProduct.Name_Location = #OneLocation.Name_Location;
  448. #PurchaseInDepotBillProduct.ID_Location = #OneLocation.ID_Location;
  449. }
  450. }
  451. }
  452. ]]>
  453. </Name_BillType>
  454. <No_FromBill>
  455. <![CDATA[
  456. if(#PurchaseInDepotBillProduct.Name_BillType!=StringEmpty()&&#PurchaseInDepotBillProduct.No_FromBill!=StringEmpty()&&#PurchaseInDepotBillProduct.No_FromBillProduct!=StringEmpty())
  457. {
  458. if(Search("SearchPurchaseOrderBillProduct",#PurchaseInDepotBillProduct.No_FromBill,#PurchaseInDepotBillProduct.No_FromBillProduct))
  459. {
  460. if(!Equals(#PurchaseOrderBillProduct.SuspendDate_Product,DBNull()))
  461. {
  462. MessageBox("该产品已停用!");
  463. }
  464. #PurchaseInDepotBillProduct.ID_Product=#PurchaseOrderBillProduct.ID_Product;
  465. #PurchaseInDepotBillProduct.Name_Product=#PurchaseOrderBillProduct.Name_Product;
  466. #PurchaseInDepotBillProduct.Unit_Product=#PurchaseOrderBillProduct.Unit_Product;
  467. #PurchaseInDepotBillProduct.No_Product=#PurchaseOrderBillProduct.No_Product;
  468. #PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct=#PurchaseOrderBillProduct.Quantity;
  469. #PurchaseInDepotBillProduct.RefNo_PurchaseInDepotBill=#PurchaseOrderBillProduct.RefNo_PurchaseOrderBill;
  470. txtNumSum.CValue=SumOfCol("#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct");
  471. if( Search("SearchOneLocation",#PurchaseOrderBillProduct.No_Product))
  472. {
  473. #PurchaseInDepotBillProduct.No_Location = #OneLocation.No_Location;
  474. #PurchaseInDepotBillProduct.Name_Location = #OneLocation.Name_Location;
  475. #PurchaseInDepotBillProduct.ID_Location = #OneLocation.ID_Location;
  476. }
  477. }
  478. }
  479. ]]>
  480. </No_FromBill>
  481. <No_FromBillProduct>
  482. <![CDATA[
  483. if(#PurchaseInDepotBillProduct.Name_BillType!=StringEmpty()&&#PurchaseInDepotBillProduct.No_FromBill!=StringEmpty()&&#PurchaseInDepotBillProduct.No_FromBillProduct!=StringEmpty())
  484. {
  485. if(Search("SearchPurchaseOrderBillProduct",#PurchaseInDepotBillProduct.No_FromBill,#PurchaseInDepotBillProduct.No_FromBillProduct))
  486. {
  487. if(!Equals(#PurchaseOrderBillProduct.SuspendDate_Product,DBNull()))
  488. {
  489. MessageBox("该产品已停用!");
  490. }
  491. #PurchaseInDepotBillProduct.ID_Product=#PurchaseOrderBillProduct.ID_Product;
  492. #PurchaseInDepotBillProduct.Name_Product=#PurchaseOrderBillProduct.Name_Product;
  493. #PurchaseInDepotBillProduct.Unit_Product=#PurchaseOrderBillProduct.Unit_Product;
  494. #PurchaseInDepotBillProduct.No_Product=#PurchaseOrderBillProduct.No_Product;
  495. #PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct=#PurchaseOrderBillProduct.Quantity;
  496. #PurchaseInDepotBillProduct.RefNo_PurchaseInDepotBill=#PurchaseOrderBillProduct.RefNo_PurchaseOrderBill;
  497. txtNumSum.CValue=SumOfCol("#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct");
  498. if( Search("SearchOneLocation",#PurchaseOrderBillProduct.No_Product))
  499. {
  500. #PurchaseInDepotBillProduct.No_Location = #OneLocation.No_Location;
  501. #PurchaseInDepotBillProduct.Name_Location = #OneLocation.Name_Location;
  502. #PurchaseInDepotBillProduct.ID_Location = #OneLocation.ID_Location;
  503. }
  504. }
  505. }
  506. ]]>
  507. </No_FromBillProduct>
  508. <No_Product>
  509. if(@SetFlag==0)
  510. {
  511. return;
  512. }
  513. if(#PurchaseInDepotBillProduct.No_Product!=StringEmpty())
  514. {
  515. if(!Search("SearchProduct",#PurchaseInDepotBillProduct.No_Product))
  516. {
  517. MessageBox("不存在此产品编号",@Title);
  518. #PurchaseInDepotBillProduct.ID_Product=GuidEmpty();
  519. #PurchaseInDepotBillProduct.Name_Product=StringEmpty();
  520. #PurchaseInDepotBillProduct.Unit_Product=StringEmpty();
  521. @temp = ShowSearchBox("InputSearchProduct","INFOMATION",#PurchaseInDepotBillProduct.No_Product);
  522. if(@temp != "")
  523. {
  524. ResumeColumnEvent("#PurchaseInDepotBillProduct.No_Product");
  525. #PurchaseInDepotBillProduct.No_Product = @temp;
  526. ClearColumnEvent();
  527. }
  528. }
  529. else
  530. {
  531. if(!Equals(#Product.SuspendDate_Product,DBNull()))
  532. {
  533. MessageBox("该产品已停用!");
  534. }
  535. #PurchaseInDepotBillProduct.ID_Product=#Product.ID_Product;
  536. #PurchaseInDepotBillProduct.Name_Product=#Product.Name_Product;
  537. #PurchaseInDepotBillProduct.Unit_Product=#Product.Unit_Product;
  538. if(Search("SearchOneLocation",#PurchaseInDepotBillProduct.No_Product))
  539. {
  540. #PurchaseInDepotBillProduct.No_Location = #OneLocation.No_Location;
  541. #PurchaseInDepotBillProduct.Name_Location = #OneLocation.Name_Location;
  542. #PurchaseInDepotBillProduct.ID_Location = #OneLocation.ID_Location;
  543. }
  544. }
  545. }else{
  546. #PurchaseInDepotBillProduct.ID_Product=GuidEmpty();
  547. #PurchaseInDepotBillProduct.Name_Product=StringEmpty();
  548. #PurchaseInDepotBillProduct.Unit_Product=StringEmpty();
  549. }
  550. </No_Product>
  551. <No_Location>
  552. if(@SetFlag1==0)
  553. {
  554. return;
  555. }
  556. if(#PurchaseInDepotBillProduct.No_Location != StringEmpty())
  557. {
  558. if(!Search("SearchLocationByNo",#PurchaseInDepotBillProduct.No_Location))
  559. {
  560. MessageBox("不存在此库位编号",@Title);
  561. #PurchaseInDepotBillProduct.ID_Location=GuidEmpty();
  562. #PurchaseInDepotBillProduct.Name_Location=StringEmpty();
  563. }
  564. else
  565. {
  566. #PurchaseInDepotBillProduct.ID_Location=#Location.ID_Location;
  567. #PurchaseInDepotBillProduct.Name_Location=#Location.Name_Location;
  568. }
  569. }
  570. </No_Location>
  571. <Quantity_PurchaseInDepotBillProduct>
  572. txtNumSum.CValue=SumOfCol("#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct");
  573. </Quantity_PurchaseInDepotBillProduct>
  574. </ColumnsChanged>
  575. <RowDeleted>
  576. txtNumSum.CValue=SumOfCol("#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct");
  577. </RowDeleted>
  578. </Events>
  579. </Table>
  580. </Tables>
  581. <LockInfomation LockID="ID_PurchaseInDepotBill" LockNO="No_PurchaseInDepotBill" LockSearchFunction="SearchPurchaseInDepotBillWithNo" LockAudit="ID_Assessor"/>
  582. <ChildForms>
  583. <ChildForm name="BillSearch" DataSource="PurchaseInDepotBill" SearchFunction="SearchAllBill" SearchFunctionByNo="SearchPurchaseInDepotBillWithNo">
  584. <DataColumn Index="0" MappingName="#PurchaseInDepotBill.No_PurchaseInDepotBill" HeaderText="采购入库单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  585. <DataColumn Index="1" MappingName="#PurchaseInDepotBill.Date_PurchaseInDepotBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  586. <DataColumn Index="2" MappingName="#PurchaseInDepotBill.No_Supplier" HeaderText="供应商编号" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  587. <DataColumn Index="3" MappingName="#PurchaseInDepotBill.ShortName_Supplier" HeaderText="供应商简称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  588. <DataColumn Index="4" MappingName="#PurchaseInDepotBill.EncasementNo_PurchaseInDepotBill" HeaderText="装箱单号" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  589. <DataColumn Index="5" MappingName="#PurchaseInDepotBill.Comment_PurchaseInDepotBill" HeaderText="备注" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  590. </ChildForm>
  591. <ChildForm name="SupplierSearch" DataSource="Supplier" SearchFunction="SearchAllSupplier" SearchFunctionByNo="" MappingName="供应商">
  592. <DataColumn Index="0" MappingName="#Supplier.No_Supplier" HeaderText="供应商编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  593. <DataColumn Index="1" MappingName="#Supplier.ShortName_Supplier" HeaderText="供应商简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  594. </ChildForm>
  595. <ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品" ReturnDataSource="PurchaseInDepotBillProduct" ShowCheckBox="true">
  596. <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn" ReturnMappingName="#PurchaseInDepotBillProduct.No_Product" />
  597. <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  598. <DataColumn Index="2" MappingName="#Product.Type_Product" HeaderText="产品类型" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  599. <DataColumn Index="3" MappingName="#Product.Price_Product" HeaderText="标准售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
  600. <DataColumn Index="4" MappingName="#Product.LowSalePrice_Product" HeaderText="最低售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
  601. <DataColumn Index="5" MappingName="#Product.SafetyQty_Product" HeaderText="安全存量" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  602. </ChildForm>
  603. <ChildForm name="LocationSearch" DataSource="Location" SearchFunction="SearchAllLocation" SearchFunctionByNo="" MappingName="库位" ReturnDataSource="PurchaseInDepotBillProduct" ShowCheckBox="false">
  604. <DataColumn Index="0" MappingName="#Location.No_Location" HeaderText="库位编号" Width="120" ColumnType="IKDataGridTextBoxColumn" ReturnMappingName="#PurchaseInDepotBillProduct.No_Location" />
  605. <DataColumn Index="1" MappingName="#Location.Name_Location" HeaderText="库位名称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  606. </ChildForm>
  607. <ChildForm name="InputSearchProduct" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品">
  608. <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  609. <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  610. <DataColumn Index="2" MappingName="#Product.Type_Product" HeaderText="产品类型" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  611. <DataColumn Index="3" MappingName="#Product.Price_Product" HeaderText="标准售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
  612. <DataColumn Index="4" MappingName="#Product.LowSalePrice_Product" HeaderText="最低售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
  613. <DataColumn Index="5" MappingName="#Product.SafetyQty_Product" HeaderText="安全存量" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  614. </ChildForm>
  615. <ChildForm name="ImportPurchaseOrderBillControl" >
  616. <DataGridIndex DataSource="PurchaseOrderBill" SearchFunction="SearchAllPurchaseOrderBill" SearchFunctionByNo="" MappingName="" ReturnDataSource="PurchaseInDepotBillProduct">
  617. <DataColumn Index="0" MappingName="#PurchaseOrderBill.No_PurchaseOrderBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseInDepotBillProduct.No_FromBill"/>
  618. <DataColumn Index="1" MappingName="#PurchaseOrderBill.Date_PurchaseOrderBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  619. <DataColumn Index="2" MappingName="#PurchaseOrderBill.No_Supplier" HeaderText="供应商编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseInDepotBill.No_Supplier"/>
  620. <DataColumn Index="3" MappingName="#PurchaseOrderBill.ShortName_Customer" HeaderText="供应商简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  621. <DataColumn Index="4" MappingName="#PurchaseOrderBill.State_PurchaseOrderBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  622. <DataColumn Index="5" MappingName="#PurchaseOrderBill.Name_Location" HeaderText="到货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseInDepotBill.Name_Location"/>
  623. </DataGridIndex>
  624. <DataGridIndex DataSource="PurchaseOrderBillProduct" SearchFunction="SearchAllPurchaseOrderBillProduct" SearchFunctionByNo="" MappingName="">
  625. <DataColumn Index="0" MappingName="#PurchaseOrderBillProduct.No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  626. <DataColumn Index="1" MappingName="#PurchaseOrderBillProduct.No_PurchaseOrderBillProduct" HeaderText="产品序号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseInDepotBillProduct.No_FromBillProduct"/>
  627. <DataColumn Index="2" MappingName="#PurchaseOrderBillProduct.Name_Product" HeaderText="产品名称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  628. <DataColumn Index="3" MappingName="#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct" HeaderText="数量" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
  629. <DataColumn Index="4" MappingName="#PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct" HeaderText="单价" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
  630. </DataGridIndex>
  631. </ChildForm>
  632. <ChildForm name="ImportPurchaseOrderBillUnControl" >
  633. <DataGridIndex DataSource="PurchaseOrderBill" SearchFunction="SearchAllPurchaseOrderBill" SearchFunctionByNo="" MappingName="" ReturnDataSource="PurchaseInDepotBillProduct">
  634. <DataColumn Index="0" MappingName="#PurchaseOrderBill.No_PurchaseOrderBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseInDepotBillProduct.Comment_PurchaseInDepotBillProduct"/>
  635. <DataColumn Index="1" MappingName="#PurchaseOrderBill.Date_PurchaseOrderBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  636. <DataColumn Index="2" MappingName="#PurchaseOrderBill.No_Supplier" HeaderText="供应商编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseInDepotBill.No_Supplier"/>
  637. <DataColumn Index="3" MappingName="#PurchaseOrderBill.ShortName_Customer" HeaderText="供应商简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  638. <DataColumn Index="4" MappingName="#PurchaseOrderBill.State_PurchaseOrderBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  639. <DataColumn Index="5" MappingName="#PurchaseOrderBill.Name_Location" HeaderText="到货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseInDepotBill.Name_Location"/>
  640. </DataGridIndex>
  641. <DataGridIndex DataSource="PurchaseOrderBillProduct" SearchFunction="SearchAllPurchaseOrderBillProduct" SearchFunctionByNo="" MappingName="">
  642. <DataColumn Index="0" MappingName="#PurchaseOrderBillProduct.No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseInDepotBillProduct.No_Product"/>
  643. <DataColumn Index="1" MappingName="#PurchaseOrderBillProduct.No_PurchaseOrderBillProduct" HeaderText="产品序号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  644. <DataColumn Index="2" MappingName="#PurchaseOrderBillProduct.Name_Product" HeaderText="产品名称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  645. <DataColumn Index="3" MappingName="#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct" HeaderText="数量" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
  646. <DataColumn Index="4" MappingName="#PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct" HeaderText="单价" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
  647. </DataGridIndex>
  648. </ChildForm>
  649. </ChildForms>
  650. <ImportedInfo>
  651. UpdateForm(true, "tbNoSupplier");
  652. tbNoSupplier.Focus();
  653. Search("SearchLocation");
  654. cbLocation.Text = #PurchaseInDepotBill.Name_Location;
  655. ActiveControlEvent("tbNoSupplier", "Enter");
  656. </ImportedInfo>
  657. </Client>
  658. <Server>
  659. <Tables>
  660. <Table name="PurchaseInDepotBill" Type="Parent">
  661. <GetSchema CmdType="Text" CmdText="SELECT Top 0 PurchaseInDepotBill.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Location.Name_Location,Location.No_Location,Employee.No_Employee As No_Principal,Employee.Name_Employee As Name_Principal,Supplier.No_Supplier,Supplier.ShortName_Supplier
  662. FROM PurchaseInDepotBill
  663. LEFT JOIN AppUser a ON PurchaseInDepotBill.ID_Creator=a.ID_User
  664. LEFT JOIN AppUser b ON PurchaseInDepotBill.ID_Assessor=b.ID_User
  665. LEFT JOIN AppUser c ON PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=c.ID_User
  666. LEFT JOIN Location ON PurchaseInDepotBill.ID_Location=Location.ID_Location
  667. LEFT JOIN Employee ON Employee.ID_Employee=PurchaseInDepotBill.ID_QA
  668. LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseInDepotBill.ID_Supplier" />
  669. <New CmdType="Text" CmdText="
  670. INSERT INTO PurchaseInDepotBill(ID_PurchaseInDepotBill,Date_PurchaseInDepotBill,No_PurchaseInDepotBill,
  671. EncasementNo_PurchaseInDepotBill,ID_Location,ID_QA,ID_Creator,ID_Assessor,AssessDate_PurchaseInDepotBill,Comment_PurchaseInDepotBill,
  672. CreateDate_PurchaseInDepotBill,LastModUser_PurchaseInDepotBill,LastModDate_PurchaseInDepotBill,ID_Supplier)
  673. VALUES(@ID_PurchaseInDepotBill,@Date_PurchaseInDepotBill,@No_PurchaseInDepotBill,
  674. @EncasementNo_PurchaseInDepotBill,@ID_Location,@ID_QA,@ID_Creator,@ID_Assessor,@AssessDate_PurchaseInDepotBill,@Comment_PurchaseInDepotBill,
  675. @CreateDate_PurchaseInDepotBill,@LastModUser_PurchaseInDepotBill,@LastModDate_PurchaseInDepotBill,@ID_Supplier)
  676. ">
  677. <Params>
  678. <Param name="@ID_PurchaseInDepotBill" type="PurchaseInDepotBill.ID_PurchaseInDepotBill" sourceColumn="ID_PurchaseInDepotBill" />
  679. <Param name="@Date_PurchaseInDepotBill" type="PurchaseInDepotBill.Date_PurchaseInDepotBill" sourceColumn="Date_PurchaseInDepotBill" />
  680. <Param name="@No_PurchaseInDepotBill" type="PurchaseInDepotBill.No_PurchaseInDepotBill" sourceColumn="No_PurchaseInDepotBill" />
  681. <Param name="@EncasementNo_PurchaseInDepotBill" type="PurchaseInDepotBill.EncasementNo_PurchaseInDepotBill" sourceColumn="EncasementNo_PurchaseInDepotBill" />
  682. <Param name="@ID_Location" type="PurchaseInDepotBill.ID_Location" sourceColumn="ID_Location" />
  683. <Param name="@ID_QA" type="PurchaseInDepotBill.ID_QA" sourceColumn="ID_QA" />
  684. <Param name="@ID_Creator" type="PurchaseInDepotBill.ID_Creator" sourceColumn="ID_Creator" />
  685. <Param name="@ID_Assessor" type="PurchaseInDepotBill.ID_Assessor" sourceColumn="ID_Assessor" />
  686. <Param name="@AssessDate_PurchaseInDepotBill" type="PurchaseInDepotBill.AssessDate_PurchaseInDepotBill" sourceColumn="AssessDate_PurchaseInDepotBill" />
  687. <Param name="@Comment_PurchaseInDepotBill" type="PurchaseInDepotBill.Comment_PurchaseInDepotBill" sourceColumn="Comment_PurchaseInDepotBill" />
  688. <Param name="@CreateDate_PurchaseInDepotBill" type="PurchaseInDepotBill.CreateDate_PurchaseInDepotBill" sourceColumn="CreateDate_PurchaseInDepotBill" />
  689. <Param name="@LastModDate_PurchaseInDepotBill" type="PurchaseInDepotBill.LastModDate_PurchaseInDepotBill" sourceColumn="LastModDate_PurchaseInDepotBill" />
  690. <Param name="@LastModUser_PurchaseInDepotBill" type="PurchaseInDepotBill.LastModUser_PurchaseInDepotBill" sourceColumn="LastModUser_PurchaseInDepotBill" />
  691. <Param name="@ID_Supplier" type="PurchaseInDepotBill.ID_Supplier" sourceColumn="ID_Supplier" />
  692. </Params>
  693. </New>
  694. <Update CmdType="Text" CmdText="Update PurchaseInDepotBill SET ID_Location=@ID_Location, ID_QA=@ID_QA,EncasementNo_PurchaseInDepotBill=@EncasementNo_PurchaseInDepotBill, Comment_PurchaseInDepotBill=@Comment_PurchaseInDepotBill, LastModUser_PurchaseInDepotBill=@LastModUser_PurchaseInDepotBill,
  695. LastModDate_PurchaseInDepotBill=@LastModDate_PurchaseInDepotBill,ID_Supplier=@ID_Supplier WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill">
  696. <Params>
  697. <Param name="@ID_Location" type="PurchaseInDepotBill.ID_Location" sourceColumn="ID_Location" />
  698. <Param name="@ID_QA" type="PurchaseInDepotBill.ID_QA" sourceColumn="ID_QA" />
  699. <Param name="@Comment_PurchaseInDepotBill" type="PurchaseInDepotBill.Comment_PurchaseInDepotBill" sourceColumn="Comment_PurchaseInDepotBill" />
  700. <Param name="@LastModUser_PurchaseInDepotBill" type="PurchaseInDepotBill.LastModUser_PurchaseInDepotBill" sourceColumn="LastModUser_PurchaseInDepotBill" />
  701. <Param name="@LastModDate_PurchaseInDepotBill" type="PurchaseInDepotBill.LastModDate_PurchaseInDepotBill" sourceColumn="LastModDate_PurchaseInDepotBill" />
  702. <Param name="@ID_PurchaseInDepotBill" type="PurchaseInDepotBill.ID_PurchaseInDepotBill" sourceColumn="ID_PurchaseInDepotBill" />
  703. <Param name="@ID_Supplier" type="PurchaseInDepotBill.ID_Supplier" sourceColumn="ID_Supplier" />
  704. <Param name="@EncasementNo_PurchaseInDepotBill" type="PurchaseInDepotBill.EncasementNo_PurchaseInDepotBill" sourceColumn="EncasementNo_PurchaseInDepotBill" />
  705. </Params>
  706. </Update>
  707. <Delete CmdType="Text" CmdText="DELETE FROM PurchaseInDepotBillProduct WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
  708. DELETE FROM PurchaseInDepotBill WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill">
  709. <Params>
  710. <Param name="@ID_PurchaseInDepotBill" type="PurchaseInDepotBill.ID_PurchaseInDepotBill"
  711. sourceColumn="ID_PurchaseInDepotBill" />
  712. </Params>
  713. </Delete>
  714. <Audit CmdType="Text" CmdText=" DECLARE @StockAndInDepot bit
  715. DECLARE @ChildLocation uniqueidentifier
  716. DECLARE @ChildSupplier uniqueidentifier
  717. DECLARE @Quantity_PurchaseInDepotBillProduct decimal(14,4)
  718. DECLARE @ID_Product uniqueidentifier
  719. DECLARE @ID_OnShip uniqueidentifier
  720. DECLARE @ID_PurchaseSourceBillProduct uniqueidentifier
  721. DECLARE @ID_PurchaseInDepotBillProduct uniqueidentifier
  722. DECLARE @No_PurchaseInDepotBillProduct nvarchar(64)
  723. DECLARE @Info nvarchar(100)
  724. DECLARE @Quantity_OnShipProduct decimal(14,4)
  725. DECLARE @AssessPurchaseOrderBill uniqueidentifier
  726. SELECT @StockAndInDepot=StockAndInDepot_SystemSetting FROM SystemSetting
  727. If(@StockAndInDepot=1 AND @ID_Assessor IS NOT NULL)
  728. BEGIN
  729. SELECT @ID_OnShip=ID_OnShip FROM OnShip WHERE EncasementNo_OnShip=@EncasementNo_PurchaseInDepotBill
  730. IF(@ID_OnShip IS NOT NULL)
  731. BEGIN
  732. DECLARE cur_p cursor FOR SELECT OnShipProduct.ID_PurchaseSourceBillProduct,OnShipProduct.Quantity_OnShipProduct
  733. FROM OnShipProduct LEFT JOIN OnShip ON OnShip.ID_OnShip=OnShipProduct.ID_OnShip WHERE EncasementNo_OnShip=@EncasementNo_PurchaseInDepotBill
  734. OPEN cur_p
  735. FETCH Next FROM cur_p INTO @ID_PurchaseSourceBillProduct,@Quantity_OnShipProduct
  736. WHILE @@fetch_status=0
  737. BEGIN
  738. UPDATE PurchaseSourceBillProduct SET Quantity_OnShip=Quantity_OnShip-@Quantity_OnShipProduct
  739. WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct
  740. FETCH Next FROM cur_p Into @ID_PurchaseSourceBillProduct,@Quantity_OnShipProduct
  741. END
  742. DELETE FROM OnShipProduct WHERE ID_OnShip=@ID_OnShip
  743. DELETE FROM OnShip WHERE EncasementNo_OnShip=@EncasementNo_PurchaseInDepotBill
  744. END
  745. END
  746. DECLARE cur CURSOR FOR SELECT PurchaseInDepotBillProduct.ID_Location,Quantity_PurchaseInDepotBillProduct,PurchaseInDepotBillProduct.ID_Product,PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct,No_PurchaseInDepotBillProduct,PurchaseOrderBill.ID_Assessor,PurchaseInDepotBillProduct.ID_PurchaseInDepotBillProduct,PurchaseOrderBill.ID_Supplier
  747. FROM PurchaseInDepotBillProduct
  748. LEFT JOIN PurchaseOrderBill ON PurchaseOrderBill.No_PurchaseOrderBill=PurchaseInDepotBillProduct.No_FromBill
  749. LEFT JOIN PurchaseOrderBillProduct ON PurchaseOrderBill.ID_PurchaseOrderBill=PurchaseOrderBillProduct.ID_PurchaseOrderBill And PurchaseOrderBillProduct.No_PurchaseOrderBillProduct=PurchaseInDepotBillProduct.No_FromBillProduct
  750. WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
  751. Order By No_PurchaseInDepotBillProduct
  752. OPEN cur
  753. FETCH Next FROM cur INTO @ChildLocation,@Quantity_PurchaseInDepotBillProduct,@ID_Product,@ID_PurchaseSourceBillProduct,@No_PurchaseInDepotBillProduct,@AssessPurchaseOrderBill,@ID_PurchaseInDepotBillProduct,@ChildSupplier
  754. WHILE @@fetch_status=0
  755. BEGIN
  756. IF(@ID_Assessor IS NOT NULL)
  757. BEGIN
  758. IF(@StockAndInDepot=1)
  759. BEGIN
  760. IF(@ChildSupplier Is Null)
  761. BEGIN
  762. SET @Info=N'产品序号为'+@No_PurchaseInDepotBillProduct+N'的来源单据不存在,审核失败!'
  763. RAISERROR(@Info,16,1)
  764. RETURN
  765. END
  766. IF(@AssessPurchaseOrderBill Is Null)
  767. BEGIN
  768. SET @Info=N'产品序号为'+@No_PurchaseInDepotBillProduct+N'的来源单据尚未经过审核,审核失败!'
  769. RAISERROR(@Info,16,1)
  770. RETURN
  771. END
  772. IF(@ChildSupplier!=@ID_Supplier)
  773. BEGIN
  774. SET @Info=N'产品序号为'+@No_PurchaseInDepotBillProduct+N'的来源单据的供应商与本单据的供应商不一致,审核失败!'
  775. RAISERROR(@Info,16,1)
  776. RETURN
  777. END
  778. If(@Quantity_PurchaseInDepotBillProduct &gt; (SELECT (Quantity_Order-Quantity_InDepot-Quantity_OnShip-Quantity_EndCase)
  779. FROM PurchaseSourceBillProduct WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct))
  780. BEGIN
  781. SET @Info='序号为'+@No_PurchaseInDepotBillProduct+'的产品入库数量超过可入库数量(=采购数量-已入库数量-在途数量-强制结案数量),审核失败!请于关联单据处查询。'
  782. RAISERROR(@Info,16,1)
  783. RETURN
  784. END
  785. ELSE
  786. BEGIN
  787. UPDATE PurchaseSourceBillProduct SET Quantity_InDepot=Quantity_InDepot+@Quantity_PurchaseInDepotBillProduct
  788. WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct
  789. UPDATE PurchaseInDepotBillProduct SET ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct WHERE ID_PurchaseInDepotBillProduct=@ID_PurchaseInDepotBillProduct
  790. END
  791. END
  792. IF(EXISTS(SELECT * FROM ProductStocks WHERE ID_Product=@ID_Product AND ID_Location=@ChildLocation))
  793. UPDATE ProductStocks SET StockQty_ProductStocks=StockQty_ProductStocks+@Quantity_PurchaseInDepotBillProduct
  794. WHERE ID_Product=@ID_Product AND ID_Location=@ChildLocation
  795. ELSE
  796. INSERT INTO ProductStocks(ID_ProductStocks,ID_Location,ID_Product,StockQty_ProductStocks) VALUES(newID(),@ChildLocation,@ID_Product,@Quantity_PurchaseInDepotBillProduct)
  797. IF(EXISTS(SELECT * FROM ProductStocks WHERE ID_Product=@ID_Product And ID_Location=@ID_Location))
  798. UPDATE ProductStocks Set AvailableQty_ProductStocks=AvailableQty_ProductStocks+@Quantity_PurchaseInDepotBillProduct
  799. WHERE ID_Product=@ID_Product AND ID_Location=@ID_Location
  800. ELSE
  801. INSERT INTO ProductStocks(ID_ProductStocks,ID_Location,ID_Product,AvailableQty_ProductStocks) VALUES(newID(),@ID_Location,@ID_Product,@Quantity_PurchaseInDepotBillProduct)
  802. END
  803. ELSE
  804. BEGIN
  805. IF(@StockAndInDepot=1)
  806. UPDATE PurchaseSourceBillProduct SET Quantity_InDepot=Quantity_InDepot-@Quantity_PurchaseInDepotBillProduct
  807. WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct
  808. IF((SELECT StockQty_ProductStocks FROM ProductStocks WHERE ID_Product=@ID_Product AND ID_Location=@ChildLocation ) &lt; @Quantity_PurchaseInDepotBillProduct)
  809. BEGIN
  810. SET @Info='序号为'+@No_PurchaseInDepotBillProduct+'的产品库存数量不足,取消审核失败!。'
  811. RAISERROR(@Info,16,1)
  812. RETURN
  813. END
  814. UPDATE ProductStocks SET StockQty_ProductStocks=StockQty_ProductStocks-@Quantity_PurchaseInDepotBillProduct
  815. WHERE ID_Product=@ID_Product And ID_Location=@ChildLocation
  816. UPDATE ProductStocks SET AvailableQty_ProductStocks=AvailableQty_ProductStocks-@Quantity_PurchaseInDepotBillProduct
  817. WHERE ID_Product=@ID_Product AND ID_Location=@ID_Location
  818. END
  819. FETCH Next FROM cur INTO @ChildLocation,@Quantity_PurchaseInDepotBillProduct,@ID_Product,@ID_PurchaseSourceBillProduct,@No_PurchaseInDepotBillProduct,@AssessPurchaseOrderBill,@ID_PurchaseInDepotBillProduct,@ChildSupplier
  820. END
  821. DEALLOCATE cur
  822. UPDATE PurchaseInDepotBill SET ID_Assessor=@ID_Assessor,AssessDate_PurchaseInDepotBill=@AssessDate_PurchaseInDepotBill
  823. WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
  824. ">
  825. <Params>
  826. <Param name="@ID_PurchaseInDepotBill" type="PurchaseInDepotBill.ID_PurchaseInDepotBill" sourceColumn="ID_PurchaseInDepotBill" />
  827. <Param name="@ID_Location" type="PurchaseInDepotBill.ID_Location" sourceColumn="ID_Location" />
  828. <Param name="@ID_Assessor" type="PurchaseInDepotBill.ID_Assessor" sourceColumn="ID_Assessor" />
  829. <Param name="@AssessDate_PurchaseInDepotBill" type="PurchaseInDepotBill.AssessDate_PurchaseInDepotBill" sourceColumn="AssessDate_PurchaseInDepotBill" />
  830. <Param name="@EncasementNo_PurchaseInDepotBill" type="PurchaseInDepotBill.EncasementNo_PurchaseInDepotBill" sourceColumn="EncasementNo_PurchaseInDepotBill" />
  831. <Param name="@ID_Supplier" type="PurchaseInDepotBill.ID_Supplier" sourceColumn="ID_Supplier" />
  832. </Params>
  833. </Audit>
  834. <FKErrorReport ErrorMessage="该单据已被其他单据引用,删除失败!" />
  835. <UNIQUEErrorReport ErrorMessage="采购入库单号已存在,提交失败!" />
  836. </Table>
  837. <Table name="PurchaseInDepotBillProduct" Type="Child">
  838. <GetSchema CmdType="Text" CmdText="
  839. SELECT Top 0 PurchaseInDepotBillProduct.*,'' as No_PurchaseInDepotBill,Product.No_Product,Name_Product,Product.Unit_Product,Location.Name_Location,Location.ID_Location,Location.No_Location, BillType.Name_BillType
  840. FROM PurchaseInDepotBillProduct
  841. LEFT JOIN Location ON Location.ID_Location=PurchaseInDepotBillProduct.ID_Location
  842. LEFT JOIN Product ON PurchaseInDepotBillProduct.ID_Product=Product.ID_Product
  843. LEFT JOIN BillType ON BillType.Value_BillType=PurchaseInDepotBillProduct.Type_FromBill
  844. " />
  845. <New CmdType="Text" CmdText=" INSERT INTO PurchaseInDepotBillProduct(ID_PurchaseInDepotBillProduct,No_PurchaseInDepotBillProduct,ID_PurchaseInDepotBill,Type_FromBill,
  846. No_FromBill,ID_PurchaseSourceBillProduct,No_FromBillProduct,RefNo_PurchaseInDepotBill,ID_Product,ID_Location,Quantity_PurchaseInDepotBillProduct, Comment_PurchaseInDepotBillProduct)
  847. VALUES(@ID_PurchaseInDepotBillProduct,@No_PurchaseInDepotBillProduct,@ID_PurchaseInDepotBill,@Type_FromBill,@No_FromBill,@ID_PurchaseSourceBillProduct,@No_FromBillProduct,@RefNo_PurchaseInDepotBill,@ID_Product,@ID_Location,@Quantity_PurchaseInDepotBillProduct, @Comment_PurchaseInDepotBillProduct)">
  848. <Params>
  849. <Param name="@ID_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.ID_PurchaseInDepotBillProduct" sourceColumn="ID_PurchaseInDepotBillProduct" />
  850. <Param name="@No_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.No_PurchaseInDepotBillProduct" sourceColumn="No_PurchaseInDepotBillProduct" />
  851. <Param name="@ID_PurchaseInDepotBill" type="PurchaseInDepotBillProduct.ID_PurchaseInDepotBill" sourceColumn="ID_PurchaseInDepotBill" />
  852. <Param name="@Type_FromBill" type="PurchaseInDepotBillProduct.Type_FromBill" sourceColumn="Type_FromBill" />
  853. <Param name="@No_FromBill" type="PurchaseInDepotBillProduct.No_FromBill" sourceColumn="No_FromBill" />
  854. <Param name="@RefNo_PurchaseInDepotBill" type="PurchaseInDepotBillProduct.RefNo_PurchaseInDepotBill" sourceColumn="RefNo_PurchaseInDepotBill" />
  855. <Param name="@ID_Product" type="PurchaseInDepotBillProduct.ID_Product" sourceColumn="ID_Product" />
  856. <Param name="@ID_Location" type="PurchaseInDepotBillProduct.ID_Location" sourceColumn="ID_Location" />
  857. <Param name="@Quantity_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct" sourceColumn="Quantity_PurchaseInDepotBillProduct" />
  858. <Param name="@Comment_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.Comment_PurchaseInDepotBillProduct" sourceColumn="Comment_PurchaseInDepotBillProduct" />
  859. <Param name="@ID_PurchaseSourceBillProduct" type="PurchaseInDepotBillProduct.ID_PurchaseSourceBillProduct" sourceColumn="ID_PurchaseSourceBillProduct" />
  860. <Param name="@No_FromBillProduct" type="PurchaseInDepotBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
  861. </Params>
  862. </New>
  863. <Update CmdType="Text" CmdText="
  864. DECLARE @StockAndInDepot bit
  865. DECLARE @Info nvarchar(256)
  866. DECLARE @AssessDate datetime
  867. Select @AssessDate=AssessDate_PurchaseInDepotBill From PurchaseInDepotBill Where ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
  868. SELECT @StockAndInDepot=StockAndInDepot_SystemSetting FROM SystemSetting
  869. IF(@StockAndInDepot=1)
  870. BEGIN
  871. IF(@AssessDate IS NOT NULL AND @Quantity_PurchaseInDepotBillProduct &gt;(SELECT (Quantity_Order-Quantity_InDepot-Quantity_OnShip-Quantity_EndCase)
  872. FROM PurchaseSourceBillProduct WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct))
  873. BEGIN
  874. SET @Info='序号为'+@No_PurchaseInDepotBillProduct+'的产品入库数量超过可入库数量,提交失败!请于关联单据处查询。'
  875. RAISERROR(@Info,16,1)
  876. RETURN
  877. END
  878. END
  879. UPDATE PurchaseInDepotBillProduct SET No_PurchaseInDepotBillProduct=@No_PurchaseInDepotBillProduct, ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill,
  880. Type_FromBill=@Type_FromBill,No_FromBill=@No_FromBill,RefNo_PurchaseInDepotBill=@RefNo_PurchaseInDepotBill,ID_Product=@ID_Product,
  881. ID_Location=@ID_Location,Quantity_PurchaseInDepotBillProduct=@Quantity_PurchaseInDepotBillProduct,Comment_PurchaseInDepotBillProduct=@Comment_PurchaseInDepotBillProduct,
  882. ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct,No_FromBillProduct=@No_FromBillProduct WHERE ID_PurchaseInDepotBillProduct=@ID_PurchaseInDepotBillProduct">
  883. <Params>
  884. <Param name="@ID_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.ID_PurchaseInDepotBillProduct" sourceColumn="ID_PurchaseInDepotBillProduct" />
  885. <Param name="@No_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.No_PurchaseInDepotBillProduct" sourceColumn="No_PurchaseInDepotBillProduct" />
  886. <Param name="@ID_PurchaseInDepotBill" type="PurchaseInDepotBillProduct.ID_PurchaseInDepotBill" sourceColumn="ID_PurchaseInDepotBill" />
  887. <Param name="@Type_FromBill" type="PurchaseInDepotBillProduct.Type_FromBill" sourceColumn="Type_FromBill" />
  888. <Param name="@No_FromBill" type="PurchaseInDepotBillProduct.No_FromBill" sourceColumn="No_FromBill" />
  889. <Param name="@RefNo_PurchaseInDepotBill" type="PurchaseInDepotBillProduct.RefNo_PurchaseInDepotBill" sourceColumn="RefNo_PurchaseInDepotBill" />
  890. <Param name="@ID_Product" type="PurchaseInDepotBillProduct.ID_Product" sourceColumn="ID_Product" />
  891. <Param name="@ID_Location" type="PurchaseInDepotBillProduct.ID_Location" sourceColumn="ID_Location" />
  892. <Param name="@Quantity_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct" sourceColumn="Quantity_PurchaseInDepotBillProduct" />
  893. <Param name="@Comment_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.Comment_PurchaseInDepotBillProduct" sourceColumn="Comment_PurchaseInDepotBillProduct" />
  894. <Param name="@ID_PurchaseSourceBillProduct" type="PurchaseInDepotBillProduct.ID_PurchaseSourceBillProduct" sourceColumn="ID_PurchaseSourceBillProduct" />
  895. <Param name="@No_FromBillProduct" type="PurchaseInDepotBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
  896. </Params>
  897. </Update>
  898. <Delete CmdType="Text" CmdText="Delete FROM PurchaseInDepotBillProduct WHERE ID_PurchaseInDepotBillProduct=@ID_PurchaseInDepotBillProduct">
  899. <Params>
  900. <Param name="@ID_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.ID_PurchaseInDepotBillProduct"
  901. sourceColumn="ID_PurchaseInDepotBillProduct" />
  902. </Params>
  903. </Delete>
  904. </Table>
  905. </Tables>
  906. <Search>
  907. <SearchAllBill CmdType="Text" CmdText=" SELECT PurchaseInDepotBill.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Location.Name_Location,Location.No_Location,Employee.No_Employee As No_Principal,Employee.Name_Employee As Name_Principal
  908. ,No_Supplier,ShortName_Supplier
  909. FROM PurchaseInDepotBill
  910. LEFT JOIN AppUser a ON PurchaseInDepotBill.ID_Creator=a.ID_User
  911. LEFT JOIN AppUser b ON PurchaseInDepotBill.ID_Assessor=b.ID_User
  912. LEFT JOIN AppUser c ON PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=c.ID_User
  913. LEFT JOIN Location ON PurchaseInDepotBill.ID_Location=Location.ID_Location
  914. LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseInDepotBill.ID_Supplier
  915. LEFT JOIN Employee ON Employee.ID_Employee=PurchaseInDepotBill.ID_QA">
  916. <Tables>
  917. <Table name="AllBill" />
  918. </Tables>
  919. </SearchAllBill>
  920. <SearchAllSupplier CmdType="Text" CmdText="SELECT Supplier.No_Supplier,Supplier.ShortName_Supplier FROM Supplier ">
  921. <Tables>
  922. <Table name="AllSupplier" />
  923. </Tables>
  924. </SearchAllSupplier>
  925. <SearchAllProduct CmdType="Text" CmdText="SELECT Product.No_Product,Product.Name_Product ,Type_Product, Price_Product, LowSalePrice_Product, SafetyQty_Product FROM Product ">
  926. <Tables>
  927. <Table name="AllProduct" />
  928. </Tables>
  929. </SearchAllProduct>
  930. <SearchAllLocation CmdType="Text" CmdText="SELECT No_Location,Name_Location FROM Location ">
  931. <Tables>
  932. <Table name="Location" />
  933. </Tables>
  934. </SearchAllLocation>
  935. <SearchContr CmdType="Text" CmdText=" SELECT SystemSetting.StockAndInDepot_SystemSetting FROM SystemSetting WHERE SystemSetting.StockAndInDepot_SystemSetting = 1">
  936. <Tables>
  937. <Table name="SystemOutIn" />
  938. </Tables>
  939. </SearchContr>
  940. <SearchPurchaseInDepotBillWithNo CmdType="Text" CmdText="SELECT PurchaseInDepotBill.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Location.Name_Location,Location.No_Location,Employee.No_Employee As No_Principal,Employee.Name_Employee As Name_Principal,Supplier.No_Supplier,Supplier.ShortName_Supplier
  941. FROM PurchaseInDepotBill
  942. LEFT JOIN AppUser a ON PurchaseInDepotBill.ID_Creator=a.ID_User
  943. LEFT JOIN AppUser b ON PurchaseInDepotBill.ID_Assessor=b.ID_User
  944. LEFT JOIN AppUser c ON PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=c.ID_User
  945. LEFT JOIN Location ON PurchaseInDepotBill.ID_Location=Location.ID_Location
  946. LEFT JOIN Employee ON Employee.ID_Employee=PurchaseInDepotBill.ID_QA
  947. LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseInDepotBill.ID_Supplier
  948. WHERE No_PurchaseInDepotBill=@No_PurchaseInDepotBill
  949. SELECT PurchaseInDepotBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,Location.Name_Location,Location.ID_Location,Location.No_Location,BillType.Name_BillType,@No_PurchaseInDepotBill as No_PurchaseInDepotBill
  950. FROM PurchaseInDepotBillProduct
  951. LEFT JOIN Product ON PurchaseInDepotBillProduct.ID_Product=Product.ID_Product
  952. LEFT JOIN PurchaseInDepotBill ON PurchaseInDepotBillProduct.ID_PurchaseInDepotBill=PurchaseInDepotBill.ID_PurchaseInDepotBill
  953. LEFT JOIN Location ON Location.ID_Location=PurchaseInDepotBillProduct.ID_Location
  954. LEFT JOIN BillType ON BillType.Value_BillType=PurchaseInDepotBillProduct.Type_FromBill
  955. WHERE No_PurchaseInDepotBill=@No_PurchaseInDepotBill
  956. ORDER BY CAST(No_PurchaseInDepotBillProduct AS INT)
  957. ">
  958. <Params>
  959. <Param name="@No_PurchaseInDepotBill" type="PurchaseInDepotBill.No_PurchaseInDepotBill" Index="0" />
  960. </Params>
  961. <Tables>
  962. <Table name="PurchaseInDepotBill" />
  963. <Table name="PurchaseInDepotBillProduct" />
  964. </Tables>
  965. </SearchPurchaseInDepotBillWithNo>
  966. <SearchPrincipal CmdType="Text" CmdText="
  967. SELECT Employee.ID_Employee,Employee.No_Employee AS No_Principal, Employee.Name_Employee AS Name_Principal
  968. FROM Employee
  969. ORDER BY No_Employee
  970. ">
  971. <Tables>
  972. <Table name="Principal" />
  973. </Tables>
  974. </SearchPrincipal>
  975. <SearchLocation CmdType="Text" CmdText="SELECT Name_Location,ID_Location,No_Location FROM Location WHERE SubjectionID_Location Is Null">
  976. <Tables>
  977. <Table name="Location" />
  978. </Tables>
  979. </SearchLocation>
  980. <SearchByEncasementNo CmdType="Text" CmdText="Select * From (
  981. SELECT Name_BillType='采购订单',Type_FromBill=41,OnShipProduct.No_FromBill,OnShipProduct.ID_PurchaseSourceBillProduct,OnShipProduct.No_FromBillProduct,OnShipProduct.ID_Product,OnShipProduct.Quantity_OnShipProduct As Quantity_PurchaseInDepotBillProduct,Product.No_Product,Name_Product,Product.Unit_Product,Product.SuspendDate_Product
  982. ,IsNull(lc.No_Location,'') As No_Location,IsNull(lc.Name_Location,'') As Name_Location,lc.ID_Location
  983. FROM OnShipProduct LEFT JOIN OnShip ON OnShip.ID_OnShip=OnShipProduct.ID_OnShip
  984. LEFT JOIN Product ON Product.ID_Product=OnShipProduct.ID_Product
  985. Left Join (SELECT Location.ID_Location,No_Location,Name_Location,ID_Product FROM ProductStocks
  986. LEFT JOIN Location ON ProductStocks.ID_Location = Location.ID_Location
  987. WHERE SubjectionID_Location is not Null) lc On lc.ID_Product = OnShipProduct.ID_Product
  988. WHERE EncasementNo_OnShip=@EncasementNo_OnShip) al
  989. Where Not Exists (Select 1 From (
  990. SELECT Name_BillType='采购订单',Type_FromBill=41,OnShipProduct.No_FromBill,OnShipProduct.ID_PurchaseSourceBillProduct,OnShipProduct.No_FromBillProduct,OnShipProduct.ID_Product,OnShipProduct.Quantity_OnShipProduct As Quantity_PurchaseInDepotBillProduct,Product.No_Product,Name_Product,Product.Unit_Product,Product.SuspendDate_Product
  991. ,IsNull(lc.No_Location,'') As No_Location,IsNull(lc.Name_Location,'') As Name_Location
  992. FROM OnShipProduct LEFT JOIN OnShip ON OnShip.ID_OnShip=OnShipProduct.ID_OnShip
  993. LEFT JOIN Product ON Product.ID_Product=OnShipProduct.ID_Product
  994. Left Join (SELECT Location.ID_Location,No_Location,Name_Location,ID_Product FROM ProductStocks
  995. LEFT JOIN Location ON ProductStocks.ID_Location = Location.ID_Location
  996. WHERE SubjectionID_Location is not Null) lc On lc.ID_Product = OnShipProduct.ID_Product
  997. WHERE EncasementNo_OnShip=@EncasementNo_OnShip) bl Where bl.ID_Product = al.ID_Product And bl.No_Location &gt; al.No_Location)
  998. Order By No_FromBillProduct">
  999. <Params>
  1000. <Param name="@EncasementNo_OnShip" type="OnShip.EncasementNo_OnShip" sourceColumn="EncasementNo_OnShip" />
  1001. </Params>
  1002. <Tables>
  1003. <Table name="OnShipProduct" />
  1004. </Tables>
  1005. </SearchByEncasementNo>
  1006. <SearchChildLocation CmdType="Text" CmdText="
  1007. SELECT Name_Location,ID_Location FROM Location
  1008. WHERE ID_Warehouse=@ID_Warehouse And LowestLevel_Location=1
  1009. ">
  1010. <Params>
  1011. <Param name="@ID_Warehouse" type="Location.ID_Warehouse" Index="0" />
  1012. </Params>
  1013. <Tables>
  1014. <Table name="ChildLocations" />
  1015. </Tables>
  1016. </SearchChildLocation>
  1017. <SearchLocationRelationShips CmdType="Text" CmdText="SELECT * FROM Location WHERE ID_Location=@ID_Location and ID_Warehouse=@ID_Warehouse And LowestLevel_Location=1 ">
  1018. <Params>
  1019. <Param name="@ID_Location" type="Location.ID_Location" Index="0" />
  1020. <Param name="@ID_Warehouse" type="Location.ID_Warehouse" Index="1" />
  1021. </Params>
  1022. <Tables>
  1023. <Table name="SLR" />
  1024. </Tables>
  1025. </SearchLocationRelationShips>
  1026. <SearchProduct CmdType="Text" CmdText="
  1027. SELECT ID_Product,Name_Product,Unit_Product,SuspendDate_Product
  1028. FROM Product
  1029. WHERE No_Product=@No_Product
  1030. ">
  1031. <Params>
  1032. <Param name="@No_Product" type="Product.No_Product" Index="0" />
  1033. </Params>
  1034. <Tables>
  1035. <Table name="Product" />
  1036. </Tables>
  1037. </SearchProduct>
  1038. <SearchLocationByNo CmdType="Text" CmdText="
  1039. SELECT ID_Location, Name_Location FROM Location WHERE No_Location=@No_Location
  1040. ">
  1041. <Params>
  1042. <Param name="@No_Location" type="Location.No_Location" Index="0" />
  1043. </Params>
  1044. <Tables>
  1045. <Table name="Location" />
  1046. </Tables>
  1047. </SearchLocationByNo>
  1048. <SearchSupplier CmdType="Text" CmdText="
  1049. SELECT ID_Supplier,ShortName_Supplier,SuspendDate_Supplier FROM Supplier
  1050. WHERE No_Supplier=@No_Supplier
  1051. ">
  1052. <Params>
  1053. <Param name="@No_Supplier" type="Supplier.No_Supplier" Index="0"/>
  1054. </Params>
  1055. <Tables>
  1056. <Table name="Supplier"/>
  1057. </Tables>
  1058. </SearchSupplier>
  1059. <SearchStockSettle CmdType="Text" CmdText="
  1060. Select * From StockSettleAccounts
  1061. Where DateDiff(Day,@Date_PurchaseInDepotBill,FromDate_StockSettleAccounts) &lt;=0
  1062. And DateDiff(Day,@Date_PurchaseInDepotBill,EndDate_StockSettleAccounts) &gt;=0
  1063. And Status_StockSettleAccounts=0
  1064. ">
  1065. <Params>
  1066. <Param name="@Date_PurchaseInDepotBill" type="PurchaseInDepotBill.Date_PurchaseInDepotBill" Index="0"/>
  1067. </Params>
  1068. <Tables>
  1069. <Table name="StockSettle"/>
  1070. </Tables>
  1071. </SearchStockSettle>
  1072. <SearchPurchaseOrderBill CmdType="Text" CmdText="
  1073. SELECT ID_Assessor,ID_Supplier FROM PurchaseOrderBill
  1074. WHERE No_PurchaseOrderBill=@No_PurchaseOrderBill
  1075. ">
  1076. <Params>
  1077. <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0" />
  1078. </Params>
  1079. <Tables>
  1080. <Table name="PurchaseOrderBill" />
  1081. </Tables>
  1082. </SearchPurchaseOrderBill>
  1083. <SearchPurchaseOrderBillProduct CmdType="Text" CmdText="
  1084. SELECT PurchaseOrderBillProduct.* ,Name_Product,Product.No_Product,Product.Unit_Product,Product.SuspendDate_Product,Quantity=IsNull((Quantity_Order-Quantity_InDepot),PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct)
  1085. ,PurchaseOrderBill.RefNo_PurchaseOrderBill
  1086. FROM PurchaseOrderBillProduct
  1087. LEFT JOIN Product ON PurchaseOrderBillProduct.ID_Product=Product.ID_Product
  1088. LEFT JOIN PurchaseOrderBill ON PurchaseOrderBill.ID_PurchaseOrderBill=PurchaseOrderBillProduct.ID_PurchaseOrderBill
  1089. LEFT JOIN PurchaseSourceBillProduct ON PurchaseSourceBillProduct.ID_PurchaseSourceBillProduct=PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct
  1090. WHERE No_PurchaseOrderBill=@No_PurchaseOrderBill and No_PurchaseOrderBillProduct=@No_PurchaseOrderBillProduct
  1091. ">
  1092. <Params>
  1093. <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0" />
  1094. <Param name="@No_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.No_PurchaseOrderBillProduct"
  1095. Index="1" />
  1096. </Params>
  1097. <Tables>
  1098. <Table name="PurchaseOrderBillProduct" />
  1099. </Tables>
  1100. </SearchPurchaseOrderBillProduct>
  1101. <SearchBillType CmdType="Text" CmdText="SELECT * FROM BillType WHERE Value_BillType =41 OR Value_BillType = 0 ORDER BY Value_BillType
  1102. ">
  1103. <Tables>
  1104. <Table name="BillType"/>
  1105. </Tables>
  1106. </SearchBillType>
  1107. <SearchProcess CmdType="Text" CmdText="SELECT StockAndInDepot_SystemSetting FROM SystemSetting">
  1108. <Tables>
  1109. <Table name="Process"/>
  1110. </Tables>
  1111. </SearchProcess>
  1112. <SearchPurchaseInDepotBillFirst CmdType="Text" CmdText="DECLARE @ID_PurchaseInDepotBill uniqueidentifier
  1113. DECLARE @No_PurchaseInDepotBill nvarchar(64)
  1114. SELECT Top 1 @ID_PurchaseInDepotBill=ID_PurchaseInDepotBill FROM PurchaseInDepotBill ORDER BY No_PurchaseInDepotBill
  1115. SELECT Top 1 @No_PurchaseInDepotBill=No_PurchaseInDepotBill FROM PurchaseInDepotBill ORDER BY No_PurchaseInDepotBill
  1116. SELECT PurchaseInDepotBill.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Location.Name_Location,Location.No_Location,Employee.No_Employee As No_Principal,Employee.Name_Employee As Name_Principal,Supplier.No_Supplier,Supplier.ShortName_Supplier
  1117. FROM PurchaseInDepotBill
  1118. LEFT JOIN AppUser a ON PurchaseInDepotBill.ID_Creator=a.ID_User
  1119. LEFT JOIN AppUser b ON PurchaseInDepotBill.ID_Assessor=b.ID_User
  1120. LEFT JOIN AppUser c ON PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=c.ID_User
  1121. LEFT JOIN Location ON PurchaseInDepotBill.ID_Location=Location.ID_Location
  1122. LEFT JOIN Employee ON Employee.ID_Employee=PurchaseInDepotBill.ID_QA
  1123. LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseInDepotBill.ID_Supplier
  1124. WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
  1125. SELECT PurchaseInDepotBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,Location.Name_Location,Location.ID_Location,Location.No_Location,BillType.Name_BillType,@No_PurchaseInDepotBill as No_PurchaseInDepotBill
  1126. FROM PurchaseInDepotBillProduct
  1127. LEFT JOIN Location ON Location.ID_Location=PurchaseInDepotBillProduct.ID_Location
  1128. LEFT JOIN Product ON PurchaseInDepotBillProduct.ID_Product=Product.ID_Product
  1129. LEFT JOIN BillType ON BillType.Value_BillType=PurchaseInDepotBillProduct.Type_FromBill
  1130. WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
  1131. ORDER BY CAST(No_PurchaseInDepotBillProduct AS INT)
  1132. ">
  1133. <Tables>
  1134. <Table name="PurchaseInDepotBill" />
  1135. <Table name="PurchaseInDepotBillProduct" />
  1136. </Tables>
  1137. </SearchPurchaseInDepotBillFirst>
  1138. <SearchPurchaseInDepotBillPrev CmdType="Text" CmdText=" DECLARE @ID_PurchaseInDepotBill uniqueidentifier
  1139. DECLARE @No_PurchaseInDepot nvarchar(64)
  1140. SELECT Top 1 @ID_PurchaseInDepotBill=ID_PurchaseInDepotBill FROM PurchaseInDepotBill
  1141. WHERE No_PurchaseInDepotBill &lt; @No_PurchaseInDepotBill
  1142. ORDER BY No_PurchaseInDepotBill Desc
  1143. SELECT Top 1 @No_PurchaseInDepot=No_PurchaseInDepotBill FROM PurchaseInDepotBill
  1144. WHERE No_PurchaseInDepotBill &lt; @No_PurchaseInDepotBill
  1145. ORDER BY No_PurchaseInDepotBill Desc
  1146. SELECT Top 1 PurchaseInDepotBill.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Location.Name_Location,Location.No_Location,Employee.No_Employee As No_Principal,Employee.Name_Employee As Name_Principal,Supplier.No_Supplier,Supplier.ShortName_Supplier
  1147. FROM PurchaseInDepotBill
  1148. LEFT JOIN AppUser a ON PurchaseInDepotBill.ID_Creator=a.ID_User
  1149. LEFT JOIN AppUser b ON PurchaseInDepotBill.ID_Assessor=b.ID_User
  1150. LEFT JOIN AppUser c ON PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=c.ID_User
  1151. LEFT JOIN Location ON PurchaseInDepotBill.ID_Location=Location.ID_Location
  1152. LEFT JOIN Employee ON Employee.ID_Employee=PurchaseInDepotBill.ID_QA
  1153. LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseInDepotBill.ID_Supplier
  1154. WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
  1155. SELECT PurchaseInDepotBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,Location.Name_Location,Location.ID_Location,Location.No_Location,BillType.Name_BillType,@No_PurchaseInDepot as No_PurchaseInDepotBill
  1156. FROM PurchaseInDepotBillProduct
  1157. LEFT JOIN Location ON Location.ID_Location=PurchaseInDepotBillProduct.ID_Location
  1158. LEFT JOIN BillType ON BillType.Value_BillType=PurchaseInDepotBillProduct.Type_FromBill
  1159. LEFT JOIN Product ON PurchaseInDepotBillProduct.ID_Product=Product.ID_Product
  1160. WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
  1161. ORDER BY CAST(No_PurchaseInDepotBillProduct AS INT)
  1162. ">
  1163. <Params>
  1164. <Param name="@No_PurchaseInDepotBill" type="PurchaseInDepotBill.No_PurchaseInDepotBill" Index="0" />
  1165. </Params>
  1166. <Tables>
  1167. <Table name="PurchaseInDepotBill" />
  1168. <Table name="PurchaseInDepotBillProduct" />
  1169. </Tables>
  1170. </SearchPurchaseInDepotBillPrev>
  1171. <SearchPurchaseInDepotBillNext CmdType="Text" CmdText="
  1172. DECLARE @ID_PurchaseInDepotBill uniqueidentifier
  1173. DECLARE @No_PurchaseInDepot nvarchar(64)
  1174. SELECT Top 1 @ID_PurchaseInDepotBill=ID_PurchaseInDepotBill FROM PurchaseInDepotBill
  1175. WHERE No_PurchaseInDepotBill &gt; @No_PurchaseInDepotBill
  1176. ORDER BY No_PurchaseInDepotBill
  1177. SELECT @No_PurchaseInDepot=No_PurchaseInDepotBill FROM PurchaseInDepotBill where ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
  1178. SELECT Top 1 PurchaseInDepotBill.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Location.Name_Location,Location.No_Location,Employee.No_Employee As No_Principal,Employee.Name_Employee As Name_Principal,Supplier.No_Supplier,Supplier.ShortName_Supplier
  1179. FROM PurchaseInDepotBill
  1180. LEFT JOIN AppUser a ON PurchaseInDepotBill.ID_Creator=a.ID_User
  1181. LEFT JOIN AppUser b ON PurchaseInDepotBill.ID_Assessor=b.ID_User
  1182. LEFT JOIN AppUser c ON PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=c.ID_User
  1183. LEFT JOIN Location ON PurchaseInDepotBill.ID_Location=Location.ID_Location
  1184. LEFT JOIN Employee ON Employee.ID_Employee=PurchaseInDepotBill.ID_QA
  1185. LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseInDepotBill.ID_Supplier
  1186. WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
  1187. SELECT PurchaseInDepotBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,Name_Location,Location.ID_Location,Location.No_Location,BillType.Name_BillType,@No_PurchaseInDepot as No_PurchaseInDepotBill
  1188. FROM PurchaseInDepotBillProduct
  1189. LEFT JOIN Location ON Location.ID_Location=PurchaseInDepotBillProduct.ID_Location
  1190. LEFT JOIN Product ON PurchaseInDepotBillProduct.ID_Product=Product.ID_Product
  1191. LEFT JOIN BillType ON BillType.Value_BillType=PurchaseInDepotBillProduct.Type_FromBill
  1192. WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
  1193. ORDER BY CAST(No_PurchaseInDepotBillProduct AS INT)
  1194. ">
  1195. <Params>
  1196. <Param name="@No_PurchaseInDepotBill" type="PurchaseInDepotBill.No_PurchaseInDepotBill" Index="0" />
  1197. </Params>
  1198. <Tables>
  1199. <Table name="PurchaseInDepotBill" />
  1200. <Table name="PurchaseInDepotBillProduct" />
  1201. </Tables>
  1202. </SearchPurchaseInDepotBillNext>
  1203. <SearchPurchaseInDepotBillLast CmdType="Text" CmdText="
  1204. declare @ID_PurchaseInDepotBill uniqueidentifier
  1205. DECLARE @No_PurchaseInDepot nvarchar(64)
  1206. SELECT Top 1 @ID_PurchaseInDepotBill=ID_PurchaseInDepotBill FROM PurchaseInDepotBill ORDER BY No_PurchaseInDepotBill Desc
  1207. SELECT Top 1 @No_PurchaseInDepot=No_PurchaseInDepotBill FROM PurchaseInDepotBill ORDER BY No_PurchaseInDepotBill Desc
  1208. SELECT PurchaseInDepotBill.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Location.Name_Location,Location.No_Location,Employee.No_Employee As No_Principal,Employee.Name_Employee As Name_Principal,Supplier.No_Supplier,Supplier.ShortName_Supplier
  1209. FROM PurchaseInDepotBill
  1210. LEFT JOIN AppUser a ON PurchaseInDepotBill.ID_Creator=a.ID_User
  1211. LEFT JOIN AppUser b ON PurchaseInDepotBill.ID_Assessor=b.ID_User
  1212. LEFT JOIN AppUser c ON PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=c.ID_User
  1213. LEFT JOIN Location ON PurchaseInDepotBill.ID_Location=Location.ID_Location
  1214. LEFT JOIN Employee ON Employee.ID_Employee=PurchaseInDepotBill.ID_QA
  1215. LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseInDepotBill.ID_Supplier
  1216. WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
  1217. SELECT PurchaseInDepotBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,Name_Location,Location.ID_Location,Location.No_Location,BillType.Name_BillType,@No_PurchaseInDepot as No_PurchaseInDepotBill
  1218. FROM PurchaseInDepotBillProduct
  1219. LEFT JOIN Location ON Location.ID_Location=PurchaseInDepotBillProduct.ID_Location
  1220. LEFT JOIN Product ON PurchaseInDepotBillProduct.ID_Product=Product.ID_Product
  1221. LEFT JOIN BillType ON BillType.Value_BillType=PurchaseInDepotBillProduct.Type_FromBill
  1222. WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
  1223. ORDER BY CAST(No_PurchaseInDepotBillProduct AS INT)
  1224. ">
  1225. <Tables>
  1226. <Table name="PurchaseInDepotBill" />
  1227. <Table name="PurchaseInDepotBillProduct" />
  1228. </Tables>
  1229. </SearchPurchaseInDepotBillLast>
  1230. <SearchAllPurchaseOrderBill CmdType="Text" CmdText="Select PurchaseOrderBill.ID_PurchaseOrderBill,PurchaseOrderBill.No_PurchaseOrderBill,PurchaseOrderBill.Date_PurchaseOrderBill,Supplier.No_Supplier,Supplier.ShortName_Supplier, No_Employee, ID_Employee, Name_Employee, Case When PurchaseOrderBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_PurchaseOrderBill,Location.Name_Location From PurchaseOrderBill
  1231. Inner Join Supplier On PurchaseOrderBill.ID_Supplier = Supplier.ID_Supplier
  1232. Inner Join Location On Location.ID_Location = PurchaseOrderBill.ID_Location
  1233. Inner Join Employee On PurchaseOrderBill.ID_Principal = Employee.ID_Employee" >
  1234. <Tables>
  1235. <Table name="AllSaleOutDepotBill" />
  1236. </Tables>
  1237. </SearchAllPurchaseOrderBill>
  1238. <SearchAllPurchaseOrderBillProduct CmdType="Text" CmdText="Select Product.No_Product,PurchaseOrderBillProduct.No_PurchaseOrderBillProduct,Product.Name_Product,PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct,PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct From PurchaseOrderBillProduct
  1239. Inner Join Product On Product.ID_Product = PurchaseOrderBillProduct.ID_Product
  1240. Inner Join PurchaseOrderBill On PurchaseOrderBill.ID_PurchaseOrderBill = PurchaseOrderBillProduct.ID_PurchaseOrderBill" >
  1241. <Tables>
  1242. <Table name="AllSaleOutDepotBillProduct" />
  1243. </Tables>
  1244. </SearchAllPurchaseOrderBillProduct>
  1245. <SearchOneLocation CmdType="" CmdText="SELECT Top 1 Location.ID_Location,No_Location,Name_Location FROM ProductStocks
  1246. LEFT JOIN Location ON ProductStocks.ID_Location = Location.ID_Location
  1247. Left Join Product On Product.ID_Product = ProductStocks.ID_Product
  1248. WHERE No_Product = @No_Product AND SubjectionID_Location is not Null">
  1249. <Params>
  1250. <Param name="@No_Product" type="Product.No_Product" Index="0" />
  1251. </Params>
  1252. <Tables>
  1253. <Table name="OneLocation" />
  1254. </Tables>
  1255. </SearchOneLocation>
  1256. <SearchExistsProduct CmdType="" CmdText="SELECT * FROM ProductStocks
  1257. LEFT JOIN Location ON ProductStocks.ID_Location = Location.ID_Location
  1258. Left Join Product On Product.ID_Product = ProductStocks.ID_Product
  1259. WHERE SubjectionID_Location is not Null
  1260. And No_Location = @No_Location And No_Product Not In (@No_Product)
  1261. And Mark_ProductStocks = 1">
  1262. <Params>
  1263. <Param name="@No_Location" type="Location.No_Location" Index="0" />
  1264. <Param name="@No_Product" type="Product.No_Product" Index="1" />
  1265. </Params>
  1266. <Tables>
  1267. <Table name="ExistsProduct" />
  1268. </Tables>
  1269. </SearchExistsProduct>
  1270. </Search>
  1271. </Server>
  1272. <Lables>
  1273. <Search>
  1274. Empty();
  1275. NewInstance();
  1276. tbNo.ReadOnly=false;
  1277. timeMake.Enabled=false;
  1278. tbNoSupplier.ReadOnly=true;
  1279. txtShortName.ReadOnly=true;
  1280. cbProposer.Enabled=false;
  1281. cbLocation.Enabled=false;
  1282. dgProduct.ReadOnly=true;
  1283. txtComment.ReadOnly=true;
  1284. txtNumSum.CValue=0.00;
  1285. ikLabel3.CValue="(未核算成本)";
  1286. #PurchaseInDepotBill.Creator=DBNull();
  1287. #PurchaseInDepotBill.ID_Creator=DBNull();
  1288. #PurchaseInDepotBill.Assessor=DBNull();
  1289. #PurchaseInDepotBill.ID_Assessor=DBNull();
  1290. #PurchaseInDepotBill.AssessDate_PurchaseInDepotBill=DBNull();
  1291. #PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=DBNull();
  1292. #PurchaseInDepotBill.LastModUser=DBNull();
  1293. #PurchaseInDepotBill.LastModDate_PurchaseInDepotBill=DBNull();
  1294. toolBar.EnableSubmit=false;
  1295. toolBar.EnableModify=false;
  1296. toolBar.EnableDelete=false;
  1297. toolBar.EnableAudit=false;
  1298. toolBar.EnableUnAudit=false;
  1299. toolBar.EnableNew=GetRight(@Title,"新增");
  1300. toolBar.EnablePrint=false;
  1301. toolBar.EnableImport = false;
  1302. UpdateForm(true,"");
  1303. @Status=0;
  1304. </Search>
  1305. <New>
  1306. Empty();
  1307. NewInstance();
  1308. tbNo.ReadOnly=true;
  1309. timeMake.Enabled=true;
  1310. timeMake.Focus();
  1311. cbProposer.Enabled=true;
  1312. cbLocation.Enabled=true;
  1313. dgProduct.ReadOnly=false;
  1314. tbNoSupplier.ReadOnly=false;
  1315. txtShortName.ReadOnly=false;
  1316. txtComment.ReadOnly=false;
  1317. txtNumSum.CValue=0.00;
  1318. ikLabel3.CValue="(未核算成本)";
  1319. #PurchaseInDepotBill.ID_PurchaseInDepotBill=NewGuid();
  1320. #PurchaseInDepotBill.Creator=GetCurrentUser();
  1321. #PurchaseInDepotBill.ID_Creator=GetLoginUserID();
  1322. #PurchaseInDepotBill.Assessor=DBNull();
  1323. #PurchaseInDepotBill.ID_Assessor=DBNull();
  1324. #PurchaseInDepotBill.AssessDate_PurchaseInDepotBill=DBNull();
  1325. #PurchaseInDepotBill.LastModUser=DBNull();
  1326. #PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=DBNull();
  1327. #PurchaseInDepotBill.LastModDate_PurchaseInDepotBill=DBNull();
  1328. #PurchaseInDepotBill.ID_Location=GetCurrentDepotID();
  1329. #PurchaseInDepotBill.Name_Location=GetCurrentDepot();
  1330. #PurchaseInDepotBill.No_Location=GetCurrentDepotNo();
  1331. #PurchaseInDepotBill.Date_PurchaseInDepotBill=GetCurrentTime();
  1332. toolBar.EnableSubmit=GetRight(@Title,"新增");
  1333. toolBar.EnableModify=false;
  1334. toolBar.EnableDelete=false;
  1335. toolBar.EnableAudit=false;
  1336. toolBar.EnableUnAudit=false;
  1337. toolBar.EnableNew=false;
  1338. toolBar.EnablePrint=false;
  1339. toolBar.EnableImport = true;
  1340. dgProduct.SetColumnReadOnly(1, false);
  1341. dgProduct.SetColumnReadOnly(2, false);
  1342. dgProduct.SetColumnReadOnly(3, false);
  1343. dgProduct.SetColumnReadOnly(5, false);
  1344. dgProduct.RowHeaderCheck=true;
  1345. dgProduct.AllowNew(true);
  1346. dgProduct.AllowDelete(true);
  1347. UpdateForm(true,"");
  1348. SetColumnDefaultValue("PurchaseInDepotBillProduct", "Quantity_PurchaseInDepotBillProduct",1 );
  1349. @Status=1;
  1350. </New>
  1351. <View>
  1352. tbNo.ReadOnly=false;
  1353. timeMake.Enabled=false;
  1354. cbLocation.Enabled=false;
  1355. cbProposer.Enabled=false;
  1356. dgProduct.ReadOnly=true;
  1357. tbNoSupplier.ReadOnly=true;
  1358. txtShortName.ReadOnly=true;
  1359. txtComment.ReadOnly=true;
  1360. txtNumSum.CValue=SumOfCol("#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct");
  1361. toolBar.EnableSubmit=false;
  1362. toolBar.EnableNew=GetRight(@Title,"新增");
  1363. toolBar.EnableImport= false;
  1364. if(Search("SearchStockSettle",#PurchaseInDepotBill.Date_PurchaseInDepotBill))
  1365. {
  1366. toolBar.EnablePrint=GetRight(@Title,"打印");
  1367. if(Equals(#PurchaseInDepotBill.ID_Assessor, DBNull()))
  1368. {
  1369. toolBar.EnableAudit=GetRight(@Title,"审核");
  1370. toolBar.EnableUnAudit=false;
  1371. toolBar.EnableModify=GetRight(@Title,"修改");
  1372. toolBar.EnableDelete=GetRight(@Title,"删除");
  1373. }
  1374. else
  1375. {
  1376. toolBar.EnableAudit=false;
  1377. toolBar.EnableUnAudit=GetRight(@Title,"取消审核");
  1378. toolBar.EnableModify=false;
  1379. toolBar.EnableDelete=false;
  1380. }
  1381. }
  1382. else
  1383. {
  1384. toolBar.EnablePrint=false;
  1385. toolBar.EnableAudit=false;
  1386. toolBar.EnableUnAudit=false;
  1387. toolBar.EnableModify=false;
  1388. toolBar.EnableDelete=false;
  1389. }
  1390. if(#purchaseInDepotBill.CostVerify_PurchaseInDepotBill==true)
  1391. ikLabel3.CValue="(已核算成本)";
  1392. else
  1393. ikLabel3.CValue="(未核算成本)";
  1394. UpdateForm(true, "");
  1395. @Status=2;
  1396. </View>
  1397. <Modify>
  1398. tbNo.ReadOnly=true;
  1399. timeMake.Enabled=false;
  1400. cbLocation.Enabled=true;
  1401. cbProposer.Enabled=true;
  1402. dgProduct.ReadOnly=false;
  1403. tbNoSupplier.ReadOnly=false;
  1404. txtShortName.ReadOnly=false;
  1405. txtComment.ReadOnly=false;
  1406. toolBar.EnableSubmit=GetRight(@Title,"修改");
  1407. toolBar.EnableModify=false;
  1408. toolBar.EnableDelete=false;
  1409. toolBar.EnableAudit=false;
  1410. toolBar.EnableUnAudit=false;
  1411. toolBar.EnableNew=false;
  1412. toolBar.EnablePrint=false;
  1413. toolBar.EnableImport = false;
  1414. #PurchaseInDepotBill.LastModUser=GetCurrentUser();
  1415. #PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=GetLoginUserID();
  1416. #PurchaseInDepotBill.LastModDate_PurchaseInDepotBill=GetCurrentTime();
  1417. @HaveAccessed = !Equals(#PurchaseInDepotBill.AssessDate_PurchaseInDepotBill,DBNull());
  1418. dgProduct.SetColumnReadOnly(1, @HaveAccessed);
  1419. dgProduct.SetColumnReadOnly(2, @HaveAccessed);
  1420. dgProduct.SetColumnReadOnly(3, @HaveAccessed);
  1421. dgProduct.SetColumnReadOnly(5, @HaveAccessed);
  1422. dgProduct.AllowNew(!@HaveAccessed);
  1423. dgProduct.AllowDelete(!@HaveAccessed);
  1424. dgProduct.RowHeaderCheck=!@HaveAccessed;
  1425. UpdateForm(true, "");
  1426. SetColumnDefaultValue("PurchaseInDepotBillProduct", "Quantity_PurchaseInDepotBillProduct",1 );
  1427. @Status=3;
  1428. </Modify>
  1429. <SubmitButtonClick>
  1430. <![CDATA[
  1431. @tag = 0;
  1432. if(!Search("SearchStockSettle",timeMake.Value))
  1433. {
  1434. MessageBox("制单日期不在开帐区间内,提交失败!");
  1435. return;
  1436. }
  1437. if(!Search("SearchSupplier",tbNoSupplier.CValue)|| !Equals(#PurchaseInDepotBill.ID_Supplier,#Supplier.ID_Supplier))
  1438. {
  1439. MessageBox("请输入有效的供应商,回车以示确认!",@Title);
  1440. tbNoSupplier.Focus();
  1441. return;
  1442. }
  1443. if(txtShortName.CValue==StringEmpty())
  1444. {
  1445. MessageBox("请输入装箱单号!",@Title);
  1446. txtShortName.Focus();
  1447. return;
  1448. }
  1449. if(!cbLocation.CheckSelectedItem())
  1450. {
  1451. MessageBox("请选择有效的入货仓库!",@Title);
  1452. cbLocation.Focus();
  1453. return;
  1454. }
  1455. if(!cbProposer.CheckSelectedItem())
  1456. {
  1457. MessageBox("请选择有效的质检人!",@Title);
  1458. cbProposer.Focus();
  1459. return;
  1460. }
  1461. if(RowCount("#PurchaseInDepotBillProduct")==0)
  1462. {
  1463. MessageBox("请输入采购入库产品!",@Title);
  1464. dgProduct.Focus();
  1465. return;
  1466. }
  1467. UpdateForm(false, "");
  1468. SuspendLayout();
  1469. for(@i=0;@i<RowCount("#PurchaseInDepotBillProduct");@i=@i+1)
  1470. {
  1471. SetPosition("#PurchaseInDepotBillProduct",@i);
  1472. if(@StockAndInDepot==true)
  1473. {
  1474. if(#PurchaseInDepotBillProduct.Type_FromBill==0)
  1475. {
  1476. dgProduct.CurrentRowIndex = @i;
  1477. MessageBox("请选择来源单据!",@Title);
  1478. dgProduct.Focus();
  1479. ResumeLayout();
  1480. return;
  1481. }
  1482. if(#PurchaseInDepotBillProduct.No_FromBill==StringEmpty())
  1483. {
  1484. dgProduct.CurrentRowIndex = @i;
  1485. MessageBox("请输入来源单据单号!",@Title);
  1486. dgProduct.Focus();
  1487. ResumeLayout();
  1488. return;
  1489. }
  1490. else
  1491. {
  1492. Search("SearchPurchaseOrderBill",#PurchaseInDepotBillProduct.No_FromBill);
  1493. if(!Equals(#PurchaseInDepotBill.ID_Supplier,#PurchaseOrderBill.ID_Supplier))
  1494. {
  1495. dgProduct.CurrentRowIndex = @i;
  1496. MessageBox("该来源单据的供应商与本次采购入库单的供应商不一致!",@Title);
  1497. dgProduct.Focus();
  1498. ResumeLayout();
  1499. return;
  1500. }
  1501. }
  1502. if(#PurchaseInDepotBillProduct.No_FromBillProduct==StringEmpty())
  1503. {
  1504. dgProduct.CurrentRowIndex = @i;
  1505. MessageBox("请输入来源单据产品序号!",@Title);
  1506. dgProduct.Focus();
  1507. ResumeLayout();
  1508. return;
  1509. }
  1510. if(!Search("SearchPurchaseOrderBillProduct",#PurchaseInDepotBillProduct.No_FromBill,#PurchaseInDepotBillProduct.No_FromBillProduct))
  1511. {
  1512. dgProduct.CurrentRowIndex = @i;
  1513. MessageBox("该来源信息有误,请确认!",@Title);
  1514. dgProduct.Focus();
  1515. ResumeLayout();
  1516. return;
  1517. }
  1518. else
  1519. {
  1520. if(#PurchaseOrderBillProduct.No_Product!=#PurchaseInDepotBillProduct.No_Product)
  1521. {
  1522. dgProduct.CurrentRowIndex = @i;
  1523. MessageBox("该来源单据中指定的产品与后改写的产品不匹配!",@Title);
  1524. dgProduct.Focus();
  1525. ResumeLayout();
  1526. return;
  1527. }
  1528. }
  1529. if(Search("SearchPurchaseOrderBill",#PurchaseInDepotBillProduct.No_FromBill))
  1530. {
  1531. if(Equals(#PurchaseOrderBill.ID_Assessor,DBNull()))
  1532. {
  1533. dgProduct.CurrentRowIndex = @i;
  1534. if(MessageBox("该来源单据未经审核,确定要提交吗?",@Title,MB_OKCANCEL)==DialogResult("CANCEL"))
  1535. {
  1536. dgProduct.Focus();
  1537. ResumeLayout();
  1538. return;
  1539. }
  1540. }
  1541. }
  1542. }
  1543. else
  1544. {
  1545. if(#PurchaseInDepotBillProduct.Type_FromBill!=0&&#PurchaseInDepotBillProduct.No_FromBill!=StringEmpty()&&Search("SearchPurchaseOrderBill",#PurchaseInDepotBillProduct.No_FromBill))
  1546. {
  1547. if(Equals(#PurchaseOrderBill.ID_Assessor,DBNull()))
  1548. {
  1549. dgProduct.CurrentRowIndex = @i;
  1550. @DialogResult=MessageBox("该来源单据未经审核,确定要保留来源单据资料吗?",@Title,MB_YESNOCANCEL);
  1551. if(@DialogResult==DialogResult("NO"))
  1552. {
  1553. #PurchaseInDepotBillProduct.Type_FromBill = 0;
  1554. #PurchaseInDepotBillProduct.Name_BillType="";
  1555. #PurchaseInDepotBillProduct.No_FromBill = "";
  1556. #PurchaseInDepotBillProduct.No_FromBillProduct = "";
  1557. }
  1558. if(@DialogResult==DialogResult("CANCEL"))
  1559. {
  1560. dgProduct.Focus();
  1561. ResumeLayout();
  1562. return;
  1563. }
  1564. }
  1565. }
  1566. if(#PurchaseInDepotBillProduct.No_Product==StringEmpty())
  1567. {
  1568. dgProduct.CurrentRowIndex = @i;
  1569. MessageBox("请输入产品编号!",@Title);
  1570. dgProduct.Focus();
  1571. ResumeLayout();
  1572. return;
  1573. }
  1574. if(!Search("SearchProduct",#PurchaseInDepotBillProduct.No_Product))
  1575. {
  1576. dgProduct.CurrentRowIndex = @i;
  1577. MessageBox("产品中无此产品编号,请重新填写!",@Title);
  1578. dgProduct.Focus();
  1579. ResumeLayout();
  1580. return;
  1581. }
  1582. }
  1583. if(#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct<=0)
  1584. {
  1585. dgProduct.CurrentRowIndex = @i;
  1586. MessageBox("数量不得小于等于0!",@Title);
  1587. dgProduct.Focus();
  1588. ResumeLayout();
  1589. return;
  1590. }
  1591. if(Equals(#PurchaseInDepotBillProduct.ID_Location,GuidEmpty()) || Equals(#PurchaseInDepotBillProduct.ID_Location,DBNull()))
  1592. {
  1593. dgProduct.CurrentRowIndex = @i;
  1594. MessageBox("请输入有效的入库库位!",@Title);
  1595. dgProduct.Focus();
  1596. ResumeLayout();
  1597. return;
  1598. }
  1599. else
  1600. {
  1601. if(!Search("SearchLocationRelationShips",#PurchaseInDepotBillProduct.ID_Location,#PurchaseInDepotBill.ID_Location))
  1602. {
  1603. dgProduct.CurrentRowIndex = @i;
  1604. MessageBox("该库位不属于所选仓库,请重新选择!",@Title);
  1605. dgProduct.Focus();
  1606. ResumeLayout();
  1607. return;
  1608. }
  1609. }
  1610. if(Search("SearchExistsProduct",#PurchaseInDepotBillProduct.No_Location,#PurchaseInDepotBillProduct.No_Product))
  1611. {
  1612. dgProduct.CurrentRowIndex = @i;
  1613. dgProduct.Focus();
  1614. @DialogResult=MessageBox("该库位已被其他产品占用,确定要提交吗?",@Title,MB_OKCANCEL);
  1615. if(@DialogResult == DialogResult("CANCEL"))
  1616. {
  1617. ResumeLayout(); return;
  1618. }
  1619. }
  1620. if(Equals(#PurchaseInDepotBillProduct.ID_PurchaseInDepotBillProduct,GuidEmpty()))
  1621. {
  1622. #PurchaseInDepotBillProduct.ID_PurchaseInDepotBillProduct=NewGuid();
  1623. }
  1624. #PurchaseInDepotBillProduct.ID_PurchaseInDepotBill=#PurchaseInDepotBill.ID_PurchaseInDepotBill;
  1625. Register_Set("1",#PurchaseInDepotBillProduct.No_Location);
  1626. Register_Set("2",#PurchaseInDepotBillProduct.No_Product);
  1627. for(@j=@i+1;@j<=RowCount("#PurchaseInDepotBillProduct")-1;@j=@j+1)
  1628. {
  1629. SetPosition("#PurchaseInDepotBillProduct",@j);
  1630. if(Equals(Register_Get("1"),#PurchaseInDepotBillProduct.No_Location) && !Equals(Register_Get("2"),#PurchaseInDepotBillProduct.No_Product))
  1631. {
  1632. @tag = @tag + 1;
  1633. }
  1634. }
  1635. Register_Remove("1");
  1636. Register_Remove("2");
  1637. if(@tag > 0)
  1638. {
  1639. dgProduct.Focus();
  1640. @DialogResult=MessageBox("该单据中存在相同库位,确定要提交吗?",@Title,MB_OKCANCEL);
  1641. if(@DialogResult == DialogResult("CANCEL"))
  1642. {
  1643. ResumeLayout();return;
  1644. }
  1645. }
  1646. }
  1647. ResumeLayout();
  1648. if(@Status==1)
  1649. {
  1650. #PurchaseInDepotBill.CreateDate_PurchaseInDepotBill=GetCurrentTime();
  1651. #PurchaseInDepotBill.No_PurchaseInDepotBill = New("#PurchaseInDepotBill.No_PurchaseInDepotBill", timeMake.CValue);
  1652. }
  1653. else if(@Status==3)
  1654. {
  1655. #PurchaseInDepotBill.LastModUser=GetCurrentUser();
  1656. #PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=GetLoginUserID();
  1657. #PurchaseInDepotBill.LastModDate_PurchaseInDepotBill=GetCurrentTime();
  1658. Update();
  1659. }
  1660. ChangeMode("View");
  1661. ]]>
  1662. </SubmitButtonClick>
  1663. </Lables>
  1664. </Form>
  1665. </Forms>