FrmPurchaseBill.xml 107 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Forms>
  3. <Form Name="FrmPurchaseBill">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @SetFlag=1;
  9. @Title="采购订单";
  10. GetSchema();
  11. Search("SearchFormat");
  12. Search("SearchLocation");
  13. Search("SearchCessIn");
  14. Search("SearchProduct","p");
  15. Search("SearchPurchaseQueryBill","p");
  16. Search("SearchPurchaseQueryBillProduct","p","p");
  17. @CessIn=#SystemSetting.CessIn_SystemSetting/100;
  18. @SysCurrency=#SystemSetting.SysCurrency_SystemSetting;
  19. @AuditMode = #SystemSetting.PurAudit_FunctionSetting;
  20. @UnitPriceDecimal = #SystemSettingFormat.UnitPriceDecimal_SystemSetting;
  21. @PriceDecimal = #SystemSettingFormat.PriceDecimal_SystemSetting;
  22. @QuantityDecimal = #SystemSettingFormat.QuantityDecimal_SystemSetting;
  23. ChangeMode("Search");
  24. dgProduct.NoMember="No_PurchaseOrderBillProduct";
  25. if(@AuditMode)
  26. {
  27. toolBar.VisibleAudit = false;
  28. toolBar.EnableAudit = false;
  29. }
  30. Search("SearchBillType");
  31. ]]>
  32. </Load>
  33. <Closing>
  34. ;<!--TODO-->
  35. </Closing>
  36. <Closed>
  37. ;<!--TODO-->
  38. </Closed>
  39. </Events>
  40. <Mode>
  41. <Search>
  42. <Lable name="Search" />
  43. </Search>
  44. <New>
  45. <Lable name="New" />
  46. </New>
  47. <View>
  48. <Lable name="View" />
  49. </View>
  50. <Modify>
  51. <Lable name="Modify" />
  52. </Modify>
  53. </Mode>
  54. <Controls>
  55. <IKTextButton name="tbNo" DataSource="PurchaseOrderBill.No_PurchaseOrderBill">
  56. <Events>
  57. <Enter>
  58. if(tbNo.ReadOnly == false)
  59. {
  60. if(tbNo.CValue != StringEmpty())
  61. {
  62. UpdateForm(false, "");
  63. if(Search("SearchPurchaseOrderBillWithNo", tbNo.CValue))
  64. {
  65. ChangeMode("View");
  66. <Lable name="CountSum"/>
  67. }
  68. else
  69. {
  70. MessageBox("该采购订单不存在!",@Title);
  71. }
  72. }
  73. else
  74. {
  75. MessageBox("请输入采购订单号!", @Title);
  76. }
  77. }
  78. </Enter>
  79. <Click>
  80. ShowSearchBox("BillSearch","HAVEDEPOT", "tbNo",tbNo.CValue);
  81. </Click>
  82. </Events>
  83. </IKTextButton>
  84. <IKDataTimePicker name="timeMake" DataSource="PurchaseOrderBill.Date_PurchaseOrderBill" />
  85. <IKTextBox name="refNo" DataSource="PurchaseOrderBill.RefNo_PurchaseOrderBill"/>
  86. <IKComboBoxEx name="cbLocation" DisplaySource="PurchaseOrderBill.Name_Location" NoSource="PurchaseOrderBill.No_Location" ValueSource="PurchaseOrderBill.ID_Location" DataSource="Location" DisplayMember="Name_Location" NoMember="No_Location" ValueMember="ID_Location">
  87. <Events>
  88. <Reload>
  89. UpdateForm(false, "cbLocation");
  90. Search("SearchLocation");
  91. UpdateForm(true, "cbLocation");
  92. </Reload>
  93. </Events>
  94. </IKComboBoxEx>
  95. <IKTextButton name="tbNoSupplier" DataSource="PurchaseOrderBill.No_Supplier" >
  96. <Events>
  97. <Enter>
  98. UpdateForm(false,"");
  99. if(tbNoSupplier.CValue!=StringEmpty())
  100. {
  101. if(!Search("SearchSupplier",tbNoSupplier.CValue))
  102. {
  103. MessageBox("该供应商不存在!",@Title);
  104. @temp = ShowSearchBox("SupplierSearch","INFOMATION",tbNoSupplier.CValue);
  105. if(@temp != "")
  106. {
  107. tbNoSupplier.CValue = @temp;
  108. ActiveControlEvent("tbNoSupplier", "Enter");
  109. }
  110. }
  111. else
  112. {
  113. if (!Equals(#Supplier.SuspendDate_Supplier,DBNull()))
  114. {
  115. MessageBox("该供应商已停用!",@Title);
  116. }
  117. #PurchaseOrderBill.ID_Supplier=#Supplier.ID_Supplier;
  118. #PurchaseOrderBill.Name_Supplier=#Supplier.Name_Supplier;
  119. #PurchaseOrderBill.ShortName_Supplier=#Supplier.ShortName_Supplier;
  120. #PurchaseOrderBill.PostalCode_Supplier=#Supplier.PostalCode_Supplier;
  121. #PurchaseOrderBill.RegistedAddress_Supplier=#Supplier.RegistedAddress_Supplier;
  122. #PurchaseOrderBill.Name_Linkman="";
  123. #PurchaseOrderBill.TaxCurrency_PurchaseOrderBill=#Supplier.LastTax_Supplier;
  124. Empty("#ReportComment");
  125. Search("SearchTypeComment",#PurchaseOrderBill.ID_Supplier);
  126. MergeTable("#TypeComment","#ReportComment");
  127. if(Search("SearchLinkman",#Supplier.ID_Supplier))
  128. {
  129. #PurchaseOrderBill.Name_Linkman=#linkman.Name_Linkman;
  130. }
  131. else
  132. {
  133. #PurchaseOrderBill.Name_Linkman="";
  134. }
  135. if(Search("SearchFocusTelephone",#Supplier.ID_Supplier))
  136. {
  137. #PurchaseOrderBill.Name_Telephone=#FocusTelephone.No_Telephone;
  138. }
  139. else
  140. {
  141. #PurchaseOrderBill.Name_Telephone="";
  142. }
  143. if(Search("SearchFocusFax",#Supplier.ID_Supplier))
  144. {
  145. #PurchaseOrderBill.Fax_Telephone=#FocusFax.No_Fax;
  146. }
  147. else
  148. {
  149. #PurchaseOrderBill.Fax_Telephone="";
  150. }
  151. }
  152. }
  153. else
  154. {
  155. MessageBox("请输入供应商编号!",@Title);
  156. #PurchaseOrderBill.ID_Supplier=GuidEmpty();
  157. #PurchaseOrderBill.ShortName_Supplier="";
  158. #PurchaseOrderBill.Name_Principal="";
  159. #PurchaseOrderBill.Name_Supplier="";
  160. #PurchaseOrderBill.Name_Linkman="";
  161. #PurchaseOrderBill.Name_Telephone="";
  162. #PurchaseOrderBill.Fax_Telephone="";
  163. #PurchaseOrderBill.PostalCode_Supplier="";
  164. #PurchaseOrderBill.RegistedAddress_Supplier="";
  165. tbNoSupplier.Focus();
  166. }
  167. UpdateForm(true,"");
  168. </Enter>
  169. <Click>
  170. <![CDATA[
  171. if (tbNoSupplier.ReadOnly == false)
  172. {
  173. @temp = ShowSearchBox("SupplierSearch","INFOMATION",tbNoSupplier.CValue);
  174. if( @temp == "" )
  175. return;
  176. tbNoSupplier.CValue = @temp;
  177. ActiveControlEvent("tbNoSupplier", "Enter");
  178. }
  179. ]]>
  180. </Click>
  181. </Events>
  182. </IKTextButton>
  183. <IKTextBox name="txtSupplierShortName" DataSource="PurchaseOrderBill.ShortName_Supplier"/>
  184. <IKComboBoxEx name="cbTaxCurrency" DisplaySource="PurchaseOrderBill.TaxCurrency_PurchaseOrderBill">
  185. <Events>
  186. <SelectedIndexChanged>
  187. <Lable name="CountSum" />
  188. </SelectedIndexChanged>
  189. </Events>
  190. </IKComboBoxEx>
  191. <IKComboBoxEx name="cbCurrency" DisplaySource="PurchaseOrderBill.Currency_PurchaseOrderBill" DataSource="PurchaseOrderBill"/>
  192. <IKDataTimePicker name="arrivalDate" DataSource="PurchaseOrderBill.ArrivalDate_PurchaseOrderBill" />
  193. <IKComboBoxEx name="cbPrincipal" ValueSource="PurchaseOrderBill.ID_Principal" DisplaySource="PurchaseOrderBill.Name_Principal" NoSource="PurchaseOrderBill.No_Principal" DataSource="Principal" DisplayMember="Name_Principal" NoMember="No_Principal" ValueMember="ID_Employee">
  194. <Events>
  195. <Reload>
  196. UpdateForm(false, "cbPrincipal");
  197. Search("SearchPrincipal");
  198. UpdateForm(true, "cbPrincipal");
  199. </Reload>
  200. </Events>
  201. </IKComboBoxEx>
  202. <IKTextBox name="txtMaker" DataSource="PurchaseOrderBill.Creator" />
  203. <IKTextBox name="txtAssessor" DataSource="PurchaseOrderBill.Assessor" />
  204. <IKDateTimeText name="dtAssessDate" DataSource="PurchaseOrderBill.AssessDate_PurchaseOrderBill" />
  205. <IKTextBox name="txtLastModUser" DataSource="PurchaseOrderBill.LastModUser"/>
  206. <IKDateTimeText name="dtLastModDate" DataSource="PurchaseOrderBill.LastModDate_PurchaseOrderBill"/>
  207. <IKTextBox name="txtNameSupplier" DataSource="PurchaseOrderBill.Name_Supplier"/>
  208. <IKComboBoxEx name="cbLinkman" DisplaySource="PurchaseOrderBill.Name_Linkman" DataSource="Linkman" DisplayMember="Name_Linkman">
  209. <Events>
  210. <Reload>
  211. UpdateForm(false, "cbLinkman");
  212. Search("SearchLinkman",#PurchaseOrderBill.ID_Supplier);
  213. UpdateForm(true, "cbLinkman");
  214. </Reload>
  215. </Events>
  216. </IKComboBoxEx>
  217. <IKComboBoxEx name="cbTelephone" DisplaySource="PurchaseOrderBill.Name_Telephone" DataSource="Telephone" DisplayMember="No_Telephone">
  218. <Events>
  219. <Reload>
  220. UpdateForm(false, "cbTelephone");
  221. Search("SearchTelephone",#PurchaseOrderBill.ID_Supplier);
  222. UpdateForm(true, "cbTelephone");
  223. </Reload>
  224. </Events>
  225. </IKComboBoxEx>
  226. <IKComboBoxEx name="cbFax" DisplaySource="PurchaseOrderBill.Fax_Telephone" DataSource="Fax" DisplayMember="No_Fax">
  227. <Events>
  228. <Reload>
  229. UpdateForm(false, "cbFax");
  230. Search("SearchFax",#PurchaseOrderBill.ID_Supplier);
  231. UpdateForm(true, "cbFax");
  232. </Reload>
  233. </Events>
  234. </IKComboBoxEx>
  235. <IKTextBox name="txtPostalcode" DataSource="PurchaseOrderBill.PostalCode_Supplier"/>
  236. <IKTextBox name="txtAddress" DataSource="PurchaseOrderBill.RegistedAddress_Supplier"/>
  237. <IKDataGridEx name="dgProduct" DataSource="PurchaseOrderBillProduct" TableStyleIndex="0">
  238. <DataColumn Index="0" DataSource="PurchaseOrderBillProduct.No_PurchaseOrderBillProduct"/>
  239. <DataColumn Index="1" DataSource="PurchaseOrderBillProduct.Name_BillType" >
  240. <IKDataGridComboBoxColumn DisplaySourceEx="PurchaseOrderBillProduct.Name_BillType" ValueSourceEx="PurchaseOrderBillProduct.Type_FromBill" DataSourceEx="BillType" DisplayMemberEx="Name_BillType" ValueMemberEx="Value_BillType">
  241. <Events>
  242. <Reload>
  243. Search("SearchBillType");
  244. SetDataGridColumnDataSource(1,"dgProduct");
  245. </Reload>
  246. </Events>
  247. </IKDataGridComboBoxColumn>
  248. </DataColumn>
  249. <DataColumn Index="2" DataSource="PurchaseOrderBillProduct.No_FromBill" />
  250. <DataColumn Index="3" DataSource="PurchaseOrderBillProduct.No_FromBillProduct" />
  251. <DataColumn Index="4" DataSource="PurchaseOrderBillProduct.No_Product" >
  252. <IKDataGridTextButtonColumn>
  253. <Events>
  254. <Click>
  255. @SetFlag=1;
  256. ShowSearchBox("ProductSearch","INFOMATION",#PurchaseOrderBillProduct.No_Product);
  257. </Click>
  258. <SetFlagBeforeClick>
  259. @SetFlag=0;
  260. </SetFlagBeforeClick>
  261. </Events>
  262. </IKDataGridTextButtonColumn>
  263. </DataColumn>
  264. <DataColumn Index="5" DataSource="PurchaseOrderBillProduct.Name_Product" />
  265. <DataColumn Index="6" DataSource="PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct" />
  266. <DataColumn Index="7" DataSource="PurchaseOrderBillProduct.Unit_Product" />
  267. <DataColumn Index="8" DataSource="PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct" />
  268. <DataColumn Index="9" DataSource="PurchaseOrderBillProduct.Money" />
  269. <DataColumn Index="10" DataSource="PurchaseOrderBillProduct.Comment_PurchaseOrderBillProduct" />
  270. </IKDataGridEx>
  271. <IKDataGridEx name="dgRemark" DataSource="BillComment" TableStyleIndex="0">
  272. <DataColumn Index="0" DataSource="BillComment.Comment_BillComment" />
  273. </IKDataGridEx>
  274. <IKDataGridEx name="dgReportComment" DataSource="ReportComment" TableStyleIndex="0">
  275. <DataColumn Index="0" DataSource="ReportComment.Comment_ReportComment" />
  276. </IKDataGridEx>
  277. <IKNumericTextBox name="txtSum" DataSource="PurchaseOrderBill.Amount_PurchaseOrderBill"/>
  278. <IKNumericTextBox name="txtMoneySum" DataSource="PurchaseOrderBill.GoodsAmount_PurchaseOrderBill"/>
  279. <IKNumericTextBox name="txtTaxSum" DataSource="PurchaseOrderBill.TaxAmount_PurchaseOrderBill"/>
  280. <IKFormToolBar name="toolBar">
  281. <Events>
  282. <ClickFirst>
  283. if(Search("SearchPurchaseOrderBillFirst"))
  284. {
  285. ChangeMode("View");
  286. <Lable name="CountSum"/>
  287. }
  288. </ClickFirst>
  289. <ClickPrev>
  290. if(Search("SearchPurchaseOrderBillPrev", tbNo.CValue))
  291. {
  292. ChangeMode("View");
  293. <Lable name="CountSum"/>
  294. }
  295. </ClickPrev>
  296. <ClickNext>
  297. if(Search("SearchPurchaseOrderBillNext",tbNo.CValue))
  298. {
  299. ChangeMode("View");
  300. <Lable name="CountSum"/>
  301. }
  302. </ClickNext>
  303. <ClickLast>
  304. if(Search("SearchPurchaseOrderBillLast"))
  305. {
  306. ChangeMode("View");
  307. <Lable name="CountSum"/>
  308. }
  309. </ClickLast>
  310. <ClickNew>
  311. <![CDATA[
  312. @NextNo = GetNextAutoNumber(true);
  313. if (!Equals(@NextNo, ""))
  314. {
  315. ChangeMode("New");
  316. #PurchaseOrderBill.No_PurchaseOrderBill= @NextNo;
  317. UpdateForm(true, "tbNo");
  318. }
  319. ]]>
  320. </ClickNew>
  321. <ClickEmpty>
  322. ChangeMode("Search");
  323. </ClickEmpty>
  324. <ClickSubmit>
  325. <Lable name="SubmitButtonClick" />
  326. if(@AuditMode)
  327. {
  328. <Lable name = "AuditLable"/>
  329. <Lable name="CountSum"/>
  330. }
  331. </ClickSubmit>
  332. <ClickModify>
  333. ChangeMode("Modify");
  334. <Lable name="CountSum"/>
  335. </ClickModify>
  336. <ClickDelete>
  337. Delete(); ChangeMode("Search");
  338. </ClickDelete>
  339. <ClickPrint>
  340. ShowPrintBox("BillSearch",#PurchaseOrderBill.No_PurchaseOrderBill,#PurchaseOrderBill.No_PurchaseOrderBill);
  341. </ClickPrint>
  342. <ClickAudit>
  343. if(@AuditMode)
  344. return;
  345. <Lable name = "AuditLable"/>
  346. <Lable name="CountSum"/>
  347. </ClickAudit>
  348. <ClickUnAudit>
  349. BeginUnAudit();
  350. #PurchaseOrderBill.ID_Assessor=DBNull();
  351. #PurchaseOrderBill.Assessor=DBNull();
  352. #PurchaseOrderBill.AssessDate_PurchaseOrderBill=DataTimeNow();
  353. UnAudit();
  354. ChangeMode("View");
  355. EndUnAudit();
  356. <Lable name="CountSum"/>
  357. </ClickUnAudit>
  358. <ClickImport>
  359. ;
  360. </ClickImport>
  361. <ClickExport>
  362. ;
  363. </ClickExport>
  364. <ClickClose>
  365. ;
  366. </ClickClose>
  367. <ClickExpand>
  368. ;
  369. </ClickExpand>
  370. <ClickImportItem>
  371. <![CDATA[
  372. if(@Status == 1 || @Status == 3)
  373. {
  374. if(toolBar.MenuItemText=="报价单")
  375. {
  376. ShowSearchBox("ImportPriceQueryBillControl","BILLCONVERT");
  377. }
  378. else if(toolBar.MenuItemText=="销货单")
  379. {
  380. ShowSearchBox("ImportSaleBillControl","BILLCONVERT");
  381. }
  382. else if(toolBar.MenuItemText=="询价单")
  383. {
  384. ShowSearchBox("ImportPurchaseQueryBillControl","BILLCONVERT","#PurchaseOrderBillProduct.Type_FromBill",43,"#PurchaseOrderBillProduct.Name_BillType","询价单");
  385. }
  386. tbNoSupplier.Focus();
  387. }
  388. ]]>
  389. <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
  390. </ClickImportItem>
  391. <ClickExportItem>
  392. if(toolBar.MenuItemText=="采购入库单")
  393. {
  394. if(Search("SearchContr"))
  395. {
  396. ExportBillProductStart("#PurchaseInDepotBillProduct.Type_FromBill",41,"#PurchaseInDepotBillProduct.Name_BillType","采购订单","#PurchaseInDepotBillProduct.No_FromBill",#PurchaseOrderBill.No_PurchaseOrderBill,"#PurchaseInDepotBill.No_Supplier",#PurchaseOrderBill.No_Supplier);
  397. ExportBillProduct("dgProduct","#PurchaseOrderBillProduct","#PurchaseInDepotBillProduct.No_FromBillProduct","#PurchaseOrderBillProduct.No_PurchaseOrderBillProduct");
  398. }
  399. else
  400. {
  401. ExportBillProductStart("#PurchaseInDepotBill.No_Supplier",#PurchaseOrderBill.No_Supplier,"#PurchaseInDepotBillProduct.Comment_PurchaseInDepotBillProduct","采购订单"+#PurchaseOrderBill.No_PurchaseOrderBill);
  402. ExportBillProduct("dgProduct","#PurchaseOrderBillProduct","#PurchaseInDepotBillProduct.No_Product","#PurchaseOrderBillProduct.No_Product");
  403. }
  404. }
  405. <!--初始化目标数据-->
  406. <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
  407. </ClickExportItem>
  408. </Events>
  409. </IKFormToolBar>
  410. </Controls>
  411. <Tables>
  412. <Table name="PurchaseOrderBillProduct">
  413. <Events>
  414. <ColumnsChanged>
  415. <Name_BillType>
  416. if(#PurchaseOrderBillProduct.Name_BillType!=StringEmpty()&amp;&amp;#PurchaseOrderBillProduct.No_FromBill!=StringEmpty()&amp;&amp;#PurchaseOrderBillProduct.No_FromBillProduct!=StringEmpty())
  417. {
  418. if ( Search("SearchPurchaseQueryBill",#PurchaseOrderBillProduct.No_FromBill))
  419. {
  420. if(!Equals(#PurchaseQueryBill.TaxCurrency_PurchaseQueryBill,cbTaxCurrency.Text))
  421. {
  422. MessageBox("请注意,来源单据税别为"+#PurchaseQueryBill.TaxCurrency_PurchaseQueryBill+"!",@Title);
  423. }
  424. }
  425. if(Search("SearchPurchaseQueryBillProduct",#PurchaseOrderBillProduct.No_FromBill,#PurchaseOrderBillProduct.No_FromBillProduct))
  426. {
  427. if(!Equals(#PurchaseQueryBillProduct.SuspendDate_Product,DBNull()))
  428. {
  429. MessageBox("该产品已停用!",@Title);
  430. }
  431. #PurchaseOrderBillProduct.ID_Product=#PurchaseQueryBillProduct.ID_Product;
  432. #PurchaseOrderBillProduct.No_Product=#PurchaseQueryBillProduct.No_Product;
  433. #PurchaseOrderBillProduct.Name_Product=#PurchaseQueryBillProduct.Name_Product;
  434. #PurchaseOrderBillProduct.Unit_Product=#PurchaseQueryBillProduct.Unit_Product;
  435. #PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct=#PurchaseQueryBillProduct.Quantity_PurchaseQueryBillProduct;
  436. #PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct=#PurchaseQueryBillProduct.UnitPrice_PurchaseQueryBillProduct;
  437. #PurchaseOrderBillProduct.Money=#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct*#PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct;
  438. <Lable name="CountSum" />
  439. }
  440. }
  441. </Name_BillType>
  442. <No_FromBill>
  443. if(#PurchaseOrderBillProduct.Name_BillType!=StringEmpty()&amp;&amp;#PurchaseOrderBillProduct.No_FromBill!=StringEmpty()&amp;&amp;#PurchaseOrderBillProduct.No_FromBillProduct!=StringEmpty())
  444. {
  445. if (Search("SearchPurchaseQueryBill",#PurchaseOrderBillProduct.No_FromBill))
  446. {
  447. if(!Equals(#PurchaseQueryBill.TaxCurrency_PurchaseQueryBill,cbTaxCurrency.Text))
  448. {
  449. MessageBox("请注意,来源单据税别为"+#PurchaseQueryBill.TaxCurrency_PurchaseQueryBill+"!",@Title);
  450. }
  451. }
  452. if(Search("SearchPurchaseQueryBillProduct",#PurchaseOrderBillProduct.No_FromBill,#PurchaseOrderBillProduct.No_FromBillProduct))
  453. {
  454. if(!Equals(#PurchaseQueryBillProduct.SuspendDate_Product,DBNull()))
  455. {
  456. MessageBox("该产品已停用!",@Title);
  457. }
  458. #PurchaseOrderBillProduct.ID_Product=#PurchaseQueryBillProduct.ID_Product;
  459. #PurchaseOrderBillProduct.No_Product=#PurchaseQueryBillProduct.No_Product;
  460. #PurchaseOrderBillProduct.Name_Product=#PurchaseQueryBillProduct.Name_Product;
  461. #PurchaseOrderBillProduct.Unit_Product=#PurchaseQueryBillProduct.Unit_Product;
  462. #PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct=#PurchaseQueryBillProduct.Quantity_PurchaseQueryBillProduct;
  463. #PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct=#PurchaseQueryBillProduct.UnitPrice_PurchaseQueryBillProduct;
  464. #PurchaseOrderBillProduct.Money=#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct*#PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct;
  465. <Lable name="CountSum" />
  466. }
  467. }
  468. </No_FromBill>
  469. <No_FromBillProduct>
  470. if(#PurchaseOrderBillProduct.Name_BillType!=StringEmpty()&amp;&amp;#PurchaseOrderBillProduct.No_FromBill!=StringEmpty()&amp;&amp;#PurchaseOrderBillProduct.No_FromBillProduct!=StringEmpty())
  471. {
  472. if (Search("SearchPurchaseQueryBill",#PurchaseOrderBillProduct.No_FromBill))
  473. {
  474. if(!Equals(#PurchaseQueryBill.TaxCurrency_PurchaseQueryBill,cbTaxCurrency.Text))
  475. {
  476. MessageBox("请注意,来源单据税别为"+#PurchaseQueryBill.TaxCurrency_PurchaseQueryBill+"!",@Title);
  477. }
  478. }
  479. if(Search("SearchPurchaseQueryBillProduct",#PurchaseOrderBillProduct.No_FromBill,#PurchaseOrderBillProduct.No_FromBillProduct))
  480. {
  481. if(!Equals(#PurchaseQueryBillProduct.SuspendDate_Product,DBNull()))
  482. {
  483. MessageBox("该产品已停用!",@Title);
  484. }
  485. #PurchaseOrderBillProduct.ID_Product=#PurchaseQueryBillProduct.ID_Product;
  486. #PurchaseOrderBillProduct.No_Product=#PurchaseQueryBillProduct.No_Product;
  487. #PurchaseOrderBillProduct.Name_Product=#PurchaseQueryBillProduct.Name_Product;
  488. #PurchaseOrderBillProduct.Unit_Product=#PurchaseQueryBillProduct.Unit_Product;
  489. #PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct=#PurchaseQueryBillProduct.Quantity_PurchaseQueryBillProduct;
  490. #PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct=#PurchaseQueryBillProduct.UnitPrice_PurchaseQueryBillProduct;
  491. #PurchaseOrderBillProduct.Money=#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct*#PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct;
  492. <Lable name="CountSum" />
  493. }
  494. }
  495. </No_FromBillProduct>
  496. <No_Product>
  497. if(@SetFlag==0)
  498. {
  499. return;
  500. }
  501. if(#PurchaseOrderBillProduct.No_Product==StringEmpty() || !Search("SearchProduct",#PurchaseOrderBillProduct.No_Product))
  502. {
  503. if(#PurchaseOrderBillProduct.No_Product!=StringEmpty())
  504. MessageBox("该产品不存在!",@Title);
  505. #PurchaseOrderBillProduct.ID_Product=GuidEmpty();
  506. #PurchaseOrderBillProduct.Name_Product="";
  507. #PurchaseOrderBillProduct.Unit_Product="";
  508. @temp = ShowSearchBox("InputSearchProduct","INFOMATION",#PurchaseOrderBillProduct.No_Product);
  509. if(@temp != "")
  510. {
  511. ResumeColumnEvent("#PurchaseOrderBillProduct.No_Product");
  512. #PurchaseOrderBillProduct.No_Product = @temp;
  513. ClearColumnEvent();
  514. }
  515. }else{
  516. if(!Equals(#Product.SuspendDate_Product,DBNull()))
  517. {
  518. MessageBox("该产品已停用!",@Title);
  519. }
  520. #PurchaseOrderBillProduct.ID_Product=#Product.ID_Product;
  521. #PurchaseOrderBillProduct.Name_Product=#Product.Name_Product;
  522. #PurchaseOrderBillProduct.Unit_Product=#Product.Unit_Product;
  523. }
  524. </No_Product>
  525. <Quantity_PurchaseOrderBillProduct>
  526. #PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct=FormatNumber(#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct,@QuantityDecimal);
  527. #PurchaseOrderBillProduct.Money=FormatNumber(FormatNumber(#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct,@QuantityDecimal)*FormatNumber(#PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct,@UnitPriceDecimal),@PriceDecimal);
  528. <Lable name="CountSum"/>
  529. </Quantity_PurchaseOrderBillProduct>
  530. <UnitPrice_PurchaseOrderBillProduct>
  531. #PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct=FormatNumber(#PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct,@UnitPriceDecimal);
  532. #PurchaseOrderBillProduct.Money=FormatNumber(FormatNumber(#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct,@QuantityDecimal)*FormatNumber(#PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct,@UnitPriceDecimal),@PriceDecimal);
  533. <Lable name="CountSum"/>
  534. </UnitPrice_PurchaseOrderBillProduct>
  535. </ColumnsChanged>
  536. <RowDeleted>
  537. <Lable name="CountSum"/>
  538. </RowDeleted>
  539. </Events>
  540. </Table>
  541. </Tables>
  542. <LockInfomation LockID="ID_PurchaseOrderBill" LockNO="No_PurchaseOrderBill" LockSearchFunction="SearchPurchaseOrderBillWithNo" LockAudit="ID_Assessor"/>
  543. <LogInfomation LogNO="#PurchaseOrderBill.No_PurchaseOrderBill" RecordFormField="" RecordDataGridField="#PurchaseOrderBillProduct.No_Product,#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct,#PurchaseOrderBillProduct.Money"/>
  544. <ChildForms>
  545. <ChildForm name="BillSearch" DataSource="PurchaseOrderBill" SearchFunction="SearchAllBill" SearchFunctionByNo="SearchPurchaseOrderBillWithNo">
  546. <DataColumn Index="0" MappingName="#PurchaseOrderBill.No_PurchaseOrderBill" HeaderText="采购订单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  547. <DataColumn Index="1" MappingName="#PurchaseOrderBill.Date_PurchaseOrderBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  548. <DataColumn Index="2" MappingName="#PurchaseOrderBill.No_Supplier" HeaderText="供应商编号" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  549. <DataColumn Index="3" MappingName="#PurchaseOrderBill.ShortName_Supplier" HeaderText="供应商简称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  550. <DataColumn Index="4" MappingName="#PurchaseOrderBill.RefNo_PurchaseOrderBill" HeaderText="参考单号" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  551. <DataColumn Index="5" MappingName="#PurchaseOrderBill.Name_Principal" HeaderText="业务负责" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  552. <DataColumn Index="6" MappingName="#PurchaseOrderBill.TaxCurrency_PurchaseOrderBill" HeaderText="税别" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  553. <DataColumn Index="7" MappingName="#PurchaseOrderBill.ArrivalDate_PurchaseOrderBill" HeaderText="到货日期" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  554. <DataColumn Index="8" MappingName="#PurchaseOrderBill.Name_Linkman" HeaderText="联系人" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  555. <DataColumn Index="9" MappingName="#PurchaseOrderBill.Name_Telephone" HeaderText="电话" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  556. <DataColumn Index="10" MappingName="#PurchaseOrderBill.Fax_Telephone" HeaderText="传真" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  557. </ChildForm>
  558. <ChildForm name="SupplierSearch" DataSource="Supplier" SearchFunction="SearchAllSupplier" SearchFunctionByNo="" MappingName="供应商">
  559. <DataColumn Index="0" MappingName="#Supplier.No_Supplier" HeaderText="供应商编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  560. <DataColumn Index="1" MappingName="#Supplier.ShortName_Supplier" HeaderText="供应商简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  561. </ChildForm>
  562. <ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品" ReturnDataSource="PurchaseOrderBillProduct" ShowCheckBox="true">
  563. <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn" ReturnMappingName="#PurchaseOrderBillProduct.No_Product"/>
  564. <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  565. </ChildForm>
  566. <ChildForm name="InputSearchProduct" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品">
  567. <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  568. <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  569. </ChildForm>
  570. <ChildForm name="ImportPriceQueryBillControl" >
  571. <DataGridIndex DataSource="PriceQueryBill" SearchFunction="SearchAllPriceQueryBill" SearchFunctionByNo="" MappingName="" ReturnDataSource="PurchaseOrderBillProduct">
  572. <DataColumn Index="0" MappingName="#PriceQueryBill.No_PriceQueryBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseOrderBillProduct.Comment_PurchaseOrderBillProduct"/>
  573. <DataColumn Index="1" MappingName="#PriceQueryBill.Date_PriceQueryBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  574. <DataColumn Index="2" MappingName="#PriceQueryBill.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseOrderBill.No_Supplier"/>
  575. <DataColumn Index="3" MappingName="#PriceQueryBill.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  576. <DataColumn Index="4" MappingName="#PriceQueryBill.State_PriceQueryBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  577. <DataColumn Index="5" MappingName="#PriceQueryBill.TaxCurrency_PriceQueryBill" HeaderText="税别" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseOrderBill.TaxCurrency_PurchaseOrderBill" />
  578. </DataGridIndex>
  579. <DataGridIndex DataSource="PriceQueryBillProduct" SearchFunction="SearchAllPriceQueryBillProduct" SearchFunctionByNo="" MappingName="">
  580. <DataColumn Index="0" MappingName="#PriceQueryBillProduct.No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseOrderBillProduct.No_Product"/>
  581. <DataColumn Index="1" MappingName="#PriceQueryBillProduct.No_PriceQueryBillProduct" HeaderText="产品序号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  582. <DataColumn Index="2" MappingName="#PriceQueryBillProduct.Name_Product" HeaderText="产品名称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  583. <DataColumn Index="3" MappingName="#PriceQueryBillProduct.Quantity_PriceQueryBillProduct" HeaderText="数量" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
  584. <DataColumn Index="4" MappingName="#PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct" HeaderText="单价" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
  585. </DataGridIndex>
  586. </ChildForm>
  587. <ChildForm name="ImportSaleBillControl" >
  588. <DataGridIndex DataSource="SaleBill" SearchFunction="SearchAllSaleBill" SearchFunctionByNo="" MappingName="" ReturnDataSource="PurchaseOrderBillProduct">
  589. <DataColumn Index="0" MappingName="#SaleBill.No_SaleBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseOrderBillProduct.Comment_PurchaseOrderBillProduct"/>
  590. <DataColumn Index="1" MappingName="#SaleBill.Date_SaleBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  591. <DataColumn Index="2" MappingName="#SaleBill.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseOrderBill.No_Supplier"/>
  592. <DataColumn Index="3" MappingName="#SaleBill.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  593. <DataColumn Index="4" MappingName="#SaleBill.State_SaleBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  594. <DataColumn Index="5" MappingName="#SaleBill.Name_Location" HeaderText="出货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseOrderBill.Name_Location"/>
  595. <DataColumn Index="6" MappingName="#SaleBill.TaxCurrency_SaleBill" HeaderText="税别" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseOrderBill.TaxCurrency_PurchaseOrderBill" />
  596. </DataGridIndex>
  597. <DataGridIndex DataSource="SaleBillProduct" SearchFunction="SearchAllSaleBillProduct" SearchFunctionByNo="" MappingName="">
  598. <DataColumn Index="0" MappingName="#SaleBillProduct.No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseOrderBillProduct.No_Product"/>
  599. <DataColumn Index="1" MappingName="#SaleBillProduct.No_SaleBillProduct" HeaderText="产品序号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  600. <DataColumn Index="2" MappingName="#SaleBillProduct.Name_Product" HeaderText="产品名称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  601. <DataColumn Index="3" MappingName="#SaleBillProduct.Quantity_SaleBillProduct" HeaderText="数量" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
  602. <DataColumn Index="4" MappingName="#SaleBillProduct.UnitPrice_SaleBillProduct" HeaderText="单价" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
  603. </DataGridIndex>
  604. </ChildForm>
  605. <ChildForm name="ImportPurchaseQueryBillControl" >
  606. <DataGridIndex DataSource="PurchaseQueryBill" SearchFunction="SearchAllPurchaseQueryBill" SearchFunctionByNo="" MappingName="" ReturnDataSource="PurchaseOrderBillProduct">
  607. <DataColumn Index="0" MappingName="#PurchaseQueryBill.No_PurchaseQueryBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseOrderBillProduct.No_FromBill"/>
  608. <DataColumn Index="1" MappingName="#PurchaseQueryBill.Date_PurchaseQueryBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  609. <DataColumn Index="2" MappingName="#PurchaseQueryBill.No_Supplier" HeaderText="供应商编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseOrderBill.No_Supplier"/>
  610. <DataColumn Index="3" MappingName="#PurchaseQueryBill.ShortName_Supplier" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  611. <DataColumn Index="4" MappingName="#PurchaseQueryBill.State_PurchaseQueryBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  612. <DataColumn Index="5" MappingName="#PurchaseQueryBill.TaxCurrency_PurchaseQueryBill" HeaderText="税别" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseOrderBill.TaxCurrency_PurchaseOrderBill" />
  613. <DataColumn Index="6" MappingName="#PurchaseQueryBill.No_Principal" HeaderText="采购负责号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseOrderBill.No_Principal"/>
  614. <DataColumn Index="6" MappingName="#PurchaseQueryBill.Name_Principal" HeaderText="采购负责人" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseOrderBill.Name_Principal"/>
  615. </DataGridIndex>
  616. <DataGridIndex DataSource="PurchaseQueryBillProduct" SearchFunction="SearchAllPurchaseQueryBillProduct" SearchFunctionByNo="" MappingName="">
  617. <DataColumn Index="0" MappingName="#PurchaseQueryBillProduct.No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseOrderBillProduct.No_Product"/>
  618. <DataColumn Index="1" MappingName="#PurchaseQueryBillProduct.No_PurchaseQueryBillProduct" HeaderText="产品序号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseOrderBillProduct.No_FromBillProduct"/>
  619. <DataColumn Index="2" MappingName="#PurchaseQueryBillProduct.Name_Product" HeaderText="产品名称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  620. <DataColumn Index="3" MappingName="#PurchaseQueryBillProduct.Quantity_PurchaseQueryBillProduct" HeaderText="数量" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
  621. <DataColumn Index="4" MappingName="#PurchaseQueryBillProduct.UnitPrice_PurchaseQueryBillProduct" HeaderText="单价" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
  622. </DataGridIndex>
  623. </ChildForm>
  624. </ChildForms>
  625. <ImportedInfo>
  626. Search("SearchPrincipal");
  627. cbPrincipal.SelectedNo = #PurchaseOrderBill.No_Principal;
  628. cbPrincipal.SelectedName = #PurchaseOrderBill.Name_Principal;
  629. @TaxCurrency=#PurchaseOrderBill.TaxCurrency_PurchaseOrderBill;
  630. UpdateForm(true, "tbNoSupplier");
  631. tbNoSupplier.Focus();
  632. Search("SearchLocation");
  633. cbLocation.Text = #PurchaseOrderBill.Name_Location;
  634. ActiveControlEvent("tbNoSupplier", "Enter");
  635. #PurchaseOrderBill.TaxCurrency_PurchaseOrderBill=@TaxCurrency;
  636. UpdateForm(true, "cbTaxCurrency");
  637. </ImportedInfo>
  638. </Client>
  639. <Server>
  640. <Tables>
  641. <Table name="PurchaseOrderBill" Type="Parent">
  642. <GetSchema CmdType="Text" CmdText=" SELECT Top 0 PurchaseOrderBill.*,a.Name_User As Creator,b.Name_User As Assessor,c.Name_User As LastModUser,No_Supplier,Name_Supplier=CASE ISNULL(Supplier.SuspendDate_Supplier,0) WHEN 0 THEN Name_Supplier ELSE Name_Supplier+'(已暂停!)'END, ShortName_Supplier,RegistedAddress_Supplier,PostalCode_Supplier,Name_Location,No_Location,EmpA.Name_Employee As Name_Principal,EmpA.No_Employee As No_Principal,EmpB.No_Employee As No_Linkman,convert(decimal(18,6),0.00) As MoneySum,convert(decimal(18,6),0.00) As TaxSum
  643. FROM PurchaseOrderBill
  644. LEFT JOIN AppUser a ON a.ID_User=PurchaseOrderBill.ID_Creator
  645. LEFT JOIN AppUser b ON b.ID_User=PurchaseOrderBill.ID_Assessor
  646. LEFT JOIN AppUser c ON c.ID_User=PurchaseOrderBill.LastModUser_PurchaseOrderBill
  647. LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseOrderBill.ID_Supplier
  648. LEFT JOIN Location ON Location.ID_Location=PurchaseOrderBill.ID_Location
  649. LEFT JOIN Employee EmpA ON EmpA.ID_Employee=PurchaseOrderBill.ID_Principal
  650. LEFT JOIN Employee EmpB ON EmpB.Name_Employee=PurchaseOrderBill.Name_Linkman"/>
  651. <New CmdType="Text" CmdText="
  652. INSERT INTO PurchaseOrderBill(ID_PurchaseOrderBill,
  653. No_PurchaseOrderBill,
  654. Date_PurchaseOrderBill,
  655. RefNo_PurchaseOrderBill,
  656. ID_Location,
  657. ID_Supplier,
  658. Name_Linkman,
  659. Name_Telephone,
  660. Fax_Telephone,
  661. ID_Principal,
  662. TaxCurrency_PurchaseOrderBill,
  663. Currency_PurchaseOrderBill,
  664. ArrivalDate_PurchaseOrderBill,
  665. ID_Creator,
  666. ID_Assessor,
  667. AssessDate_PurchaseOrderBill,
  668. CreateDate_PurchaseOrderBill,
  669. LastModDate_PurchaseOrderBill,
  670. LastModUser_PurchaseOrderBill,
  671. Amount_PurchaseOrderBill,
  672. GoodsAmount_PurchaseOrderBill,
  673. TaxAmount_PurchaseOrderBill)
  674. Values(@ID_PurchaseOrderBill,
  675. @No_PurchaseOrderBill,
  676. @Date_PurchaseOrderBill,
  677. @RefNo_PurchaseOrderBill,
  678. @ID_Location,
  679. @ID_Supplier,
  680. @Name_Linkman,
  681. @Name_Telephone,
  682. @Fax_Telephone,
  683. @ID_Principal,
  684. @TaxCurrency_PurchaseOrderBill,
  685. @Currency_PurchaseOrderBill,
  686. @ArrivalDate_PurchaseOrderBill,
  687. @ID_Creator,
  688. @ID_Assessor,
  689. @AssessDate_PurchaseOrderBill,
  690. @CreateDate_PurchaseOrderBill,
  691. @LastModDate_PurchaseOrderBill,
  692. @LastModUser_PurchaseOrderBill,
  693. @Amount_PurchaseOrderBill,
  694. @GoodsAmount_PurchaseOrderBill,
  695. @TaxAmount_PurchaseOrderBill)
  696. ">
  697. <Params>
  698. <Param name="@ID_PurchaseOrderBill" type="PurchaseOrderBill.ID_PurchaseOrderBill" sourceColumn="ID_PurchaseOrderBill" />
  699. <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" sourceColumn="No_PurchaseOrderBill" />
  700. <Param name="@Date_PurchaseOrderBill" type="PurchaseOrderBill.Date_PurchaseOrderBill" sourceColumn="Date_PurchaseOrderBill" />
  701. <Param name="@RefNo_PurchaseOrderBill" type="PurchaseOrderBill.RefNo_PurchaseOrderBill" sourceColumn="RefNo_PurchaseOrderBill" />
  702. <Param name="@ID_Location" type="PurchaseOrderBill.ID_Location" sourceColumn="ID_Location" />
  703. <Param name="@ID_Supplier" type="PurchaseOrderBill.ID_Supplier" sourceColumn="ID_Supplier" />
  704. <Param name="@Name_Linkman" type="PurchaseOrderBill.Name_Linkman" sourceColumn="Name_Linkman" />
  705. <Param name="@Name_Telephone" type="PurchaseOrderBill.Name_Telephone" sourceColumn="Name_Telephone" />
  706. <Param name="@Fax_Telephone" type="PurchaseOrderBill.Fax_Telephone" sourceColumn="Fax_Telephone" />
  707. <Param name="@ID_Principal" type="PurchaseOrderBill.ID_Principal" sourceColumn="ID_Principal" />
  708. <Param name="@TaxCurrency_PurchaseOrderBill" type="PurchaseOrderBill.TaxCurrency_PurchaseOrderBill" sourceColumn="TaxCurrency_PurchaseOrderBill" />
  709. <Param name="@Currency_PurchaseOrderBill" type="PurchaseOrderBill.Currency_PurchaseOrderBill" sourceColumn="Currency_PurchaseOrderBill" />
  710. <Param name="@ArrivalDate_PurchaseOrderBill" type="PurchaseOrderBill.ArrivalDate_PurchaseOrderBill" sourceColumn="ArrivalDate_PurchaseOrderBill" />
  711. <Param name="@ID_Creator" type="PurchaseOrderBill.ID_Creator" sourceColumn="ID_Creator" />
  712. <Param name="@ID_Assessor" type="PurchaseOrderBill.ID_Assessor" sourceColumn="ID_Assessor" />
  713. <Param name="@AssessDate_PurchaseOrderBill" type="PurchaseOrderBill.AssessDate_PurchaseOrderBill" sourceColumn="AssessDate_PurchaseOrderBill" />
  714. <Param name="@CreateDate_PurchaseOrderBill" type="PurchaseOrderBill.CreateDate_PurchaseOrderBill" sourceColumn="CreateDate_PurchaseOrderBill" />
  715. <Param name="@LastModDate_PurchaseOrderBill" type="PurchaseOrderBill.LastModDate_PurchaseOrderBill" sourceColumn="LastModDate_PurchaseOrderBill" />
  716. <Param name="@LastModUser_PurchaseOrderBill" type="PurchaseOrderBill.LastModUser_PurchaseOrderBill" sourceColumn="LastModUser_PurchaseOrderBill" />
  717. <Param name="@Amount_PurchaseOrderBill" type="PurchaseOrderBill.Amount_PurchaseOrderBill" sourceColumn="Amount_PurchaseOrderBill" />
  718. <Param name="@GoodsAmount_PurchaseOrderBill" type="PurchaseOrderBill.GoodsAmount_PurchaseOrderBill" sourceColumn="GoodsAmount_PurchaseOrderBill" />
  719. <Param name="@TaxAmount_PurchaseOrderBill" type="PurchaseOrderBill.TaxAmount_PurchaseOrderBill" sourceColumn="TaxAmount_PurchaseOrderBill" />
  720. </Params>
  721. </New>
  722. <Update CmdType="Text" CmdText="
  723. UPDATE PurchaseOrderBill
  724. SET No_PurchaseOrderBill=@No_PurchaseOrderBill,
  725. Date_PurchaseOrderBill=@Date_PurchaseOrderBill,
  726. RefNo_PurchaseOrderBill=@RefNo_PurchaseOrderBill,
  727. ID_Location=@ID_Location,
  728. ID_Supplier=@ID_Supplier,
  729. Name_Linkman=@Name_Linkman,
  730. Name_Telephone=@Name_Telephone,
  731. Fax_Telephone=@Fax_Telephone,
  732. ID_Principal=@ID_Principal,
  733. TaxCurrency_PurchaseOrderBill=@TaxCurrency_PurchaseOrderBill,
  734. Currency_PurchaseOrderBill=@Currency_PurchaseOrderBill,
  735. ArrivalDate_PurchaseOrderBill=@ArrivalDate_PurchaseOrderBill,
  736. ID_Creator=@ID_Creator,
  737. ID_Assessor=@ID_Assessor,
  738. AssessDate_PurchaseOrderBill=@AssessDate_PurchaseOrderBill,
  739. CreateDate_PurchaseOrderBill=@CreateDate_PurchaseOrderBill,
  740. LastModDate_PurchaseOrderBill=@LastModDate_PurchaseOrderBill,
  741. LastModUser_PurchaseOrderBill=@LastModUser_PurchaseOrderBill,
  742. Amount_PurchaseOrderBill=@Amount_PurchaseOrderBill,
  743. GoodsAmount_PurchaseOrderBill=@GoodsAmount_PurchaseOrderBill,
  744. TaxAmount_PurchaseOrderBill=@TaxAmount_PurchaseOrderBill
  745. WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
  746. ">
  747. <Params>
  748. <Param name="@ID_PurchaseOrderBill" type="PurchaseOrderBill.ID_PurchaseOrderBill" sourceColumn="ID_PurchaseOrderBill" />
  749. <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" sourceColumn="No_PurchaseOrderBill" />
  750. <Param name="@Date_PurchaseOrderBill" type="PurchaseOrderBill.Date_PurchaseOrderBill" sourceColumn="Date_PurchaseOrderBill" />
  751. <Param name="@RefNo_PurchaseOrderBill" type="PurchaseOrderBill.RefNo_PurchaseOrderBill" sourceColumn="RefNo_PurchaseOrderBill" />
  752. <Param name="@ID_Location" type="PurchaseOrderBill.ID_Location" sourceColumn="ID_Location" />
  753. <Param name="@ID_Supplier" type="PurchaseOrderBill.ID_Supplier" sourceColumn="ID_Supplier" />
  754. <Param name="@Name_Linkman" type="PurchaseOrderBill.Name_Linkman" sourceColumn="Name_Linkman" />
  755. <Param name="@Name_Telephone" type="PurchaseOrderBill.Name_Telephone" sourceColumn="Name_Telephone" />
  756. <Param name="@Fax_Telephone" type="PurchaseOrderBill.Fax_Telephone" sourceColumn="Fax_Telephone" />
  757. <Param name="@ID_Principal" type="PurchaseOrderBill.ID_Principal" sourceColumn="ID_Principal" />
  758. <Param name="@TaxCurrency_PurchaseOrderBill" type="PurchaseOrderBill.TaxCurrency_PurchaseOrderBill" sourceColumn="TaxCurrency_PurchaseOrderBill" />
  759. <Param name="@Currency_PurchaseOrderBill" type="PurchaseOrderBill.Currency_PurchaseOrderBill" sourceColumn="Currency_PurchaseOrderBill" />
  760. <Param name="@ArrivalDate_PurchaseOrderBill" type="PurchaseOrderBill.ArrivalDate_PurchaseOrderBill" sourceColumn="ArrivalDate_PurchaseOrderBill" />
  761. <Param name="@ID_Creator" type="PurchaseOrderBill.ID_Creator" sourceColumn="ID_Creator" />
  762. <Param name="@ID_Assessor" type="PurchaseOrderBill.ID_Assessor" sourceColumn="ID_Assessor" />
  763. <Param name="@AssessDate_PurchaseOrderBill" type="PurchaseOrderBill.AssessDate_PurchaseOrderBill" sourceColumn="AssessDate_PurchaseOrderBill" />
  764. <Param name="@CreateDate_PurchaseOrderBill" type="PurchaseOrderBill.CreateDate_PurchaseOrderBill" sourceColumn="CreateDate_PurchaseOrderBill" />
  765. <Param name="@LastModDate_PurchaseOrderBill" type="PurchaseOrderBill.LastModDate_PurchaseOrderBill" sourceColumn="LastModDate_PurchaseOrderBill" />
  766. <Param name="@LastModUser_PurchaseOrderBill" type="PurchaseOrderBill.LastModUser_PurchaseOrderBill" sourceColumn="LastModUser_PurchaseOrderBill" />
  767. <Param name="@Amount_PurchaseOrderBill" type="PurchaseOrderBill.Amount_PurchaseOrderBill" sourceColumn="Amount_PurchaseOrderBill" />
  768. <Param name="@GoodsAmount_PurchaseOrderBill" type="PurchaseOrderBill.GoodsAmount_PurchaseOrderBill" sourceColumn="GoodsAmount_PurchaseOrderBill" />
  769. <Param name="@TaxAmount_PurchaseOrderBill" type="PurchaseOrderBill.TaxAmount_PurchaseOrderBill" sourceColumn="TaxAmount_PurchaseOrderBill" />
  770. </Params>
  771. </Update>
  772. <Delete CmdType="Text" CmdText="
  773. DECLARE @StockAndInDepot bit
  774. SELECT @StockAndInDepot=StockAndInDepot_SystemSetting FROM SystemSetting
  775. IF(@AssessDate_PurchaseOrderBill IS NOT NULL)
  776. BEGIN
  777. IF(@StockAndInDepot=1)
  778. BEGIN
  779. DECLARE @Quantity_InDepot decimal(14,4)
  780. DECLARE @Quantity_OnShip decimal(14,4)
  781. DECLARE @Quantity_EndCase decimal(14,4)
  782. SELECT @Quantity_InDepot=sum(Quantity_InDepot),@Quantity_OnShip=sum(Quantity_OnShip),@Quantity_EndCase=sum(Quantity_EndCase)
  783. FROM PurchaseOrderBillProduct
  784. LEFT JOIN PurchaseSourceBillProduct ON PurchaseSourceBillProduct.ID_PurchaseSourceBillProduct=PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct
  785. WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
  786. IF(@Quantity_InDepot &gt; 0)
  787. BEGIN
  788. RAISERROR('该采购订单已有产品入库,删除失败!',16,1)
  789. return
  790. END
  791. IF(@Quantity_OnShip &gt; 0)
  792. BEGIN
  793. RAISERROR('该采购订单已有产品在途,删除失败!',16,1)
  794. return
  795. END
  796. IF(@Quantity_EndCase &gt;0)
  797. BEGIN
  798. RAISERROR('该采购订单已有产品强制结案,删除失败!',16,1)
  799. return
  800. END
  801. DELETE FROM PurchaseSourceBillProduct WHERE ID_PurchaseSourceBillProduct IN
  802. (SELECT ID_PurchaseOrderBillProduct FROM PurchaseOrderBillProduct WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill)
  803. END
  804. END
  805. DELETE FROM PurchaseOrderBillProduct WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
  806. DELETE FROM BillComment WHERE ID_Bill = @ID_PurchaseOrderBill
  807. DELETE FROM ReportComment WHERE ID_Bill=@ID_PurchaseOrderBill
  808. IF(@StockAndInDepot=1)
  809. DELETE FROM PurchaseOrderBill WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
  810. ELSE
  811. UPDATE PurchaseOrderBill SET Disable_PurchaseOrderBill=1 WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
  812. ">
  813. <Params>
  814. <Param name="@ID_PurchaseOrderBill" type="PurchaseOrderBill.ID_PurchaseOrderBill" sourceColumn="ID_PurchaseOrderBill" />
  815. <Param name="@AssessDate_PurchaseOrderBill" type="PurchaseOrderBill.AssessDate_PurchaseOrderBill" sourceColumn="AssessDate_PurchaseOrderBill" />
  816. </Params>
  817. </Delete>
  818. <Audit CmdType="Text" CmdText="
  819. DECLARE @StockAndInDepot bit
  820. DECLARE @Quantity_PurchaseOrderBillProduct decimal(14,4)
  821. DECLARE @ID_PurchaseSourceBillProduct uniqueidentifier
  822. Declare @No_PurchaseOrderBillProduct nvarchar(64)
  823. Declare @Total decimal(14,4)
  824. DECLARE @InDepot decimal(14,4)
  825. DECLARE @Error nvarchar(256)
  826. SELECT @StockAndInDepot=StockAndInDepot_SystemSetting FROM SystemSetting
  827. IF(@StockAndInDepot=1)
  828. BEGIN
  829. IF(@ID_Assessor IS NULL)
  830. BEGIN
  831. SELECT @Total=Sum(Quantity_Order),@InDepot=Sum(Quantity_InDepot+Quantity_OnShip+Quantity_EndCase) FROM PurchaseSourceBillProduct
  832. JOIN PurchaseOrderBillProduct ON PurchaseSourceBillProduct.ID_PurchaseSourceBillProduct=PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
  833. IF(@Total=@InDepot And @Total!=0)
  834. BEGIN
  835. RAISERROR('此单据产品已经全部入库,取消审核失败!',16,1)
  836. RETURN
  837. END
  838. END
  839. DECLARE cur CURSOR FOR SELECT PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct,PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct,No_PurchaseOrderBillProduct
  840. FROM PurchaseOrderBillProduct WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
  841. OPEN cur
  842. FETCH Next FROM cur INTO @Quantity_PurchaseOrderBillProduct,@ID_PurchaseSourceBillProduct,@No_PurchaseOrderBillProduct
  843. WHILE @@fetch_status=0
  844. BEGIN
  845. IF(@ID_Assessor IS NOT NULL)
  846. BEGIN
  847. IF(NOT EXISTS(SELECT * FROM PurchaseSourceBillProduct WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct))
  848. BEGIN
  849. INSERT INTO PurchaseSourceBillProduct(ID_PurchaseSourceBillProduct,Quantity_Order) Values(@ID_PurchaseSourceBillProduct,@Quantity_PurchaseOrderBillProduct)
  850. UPDATE PurchaseOrderBillProduct SET ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct WHERE ID_PurchaseOrderBillProduct=@ID_PurchaseSourceBillProduct
  851. END
  852. ELSE
  853. BEGIN
  854. IF(@Quantity_PurchaseOrderBillProduct &lt; (SELECT (Quantity_OnShip+Quantity_InDepot+Quantity_EndCase)
  855. FROM PurchaseSourceBillProduct WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct))
  856. BEGIN
  857. SET @Error='序号为'+@No_PurchaseOrderBillProduct+'的产品采购数量小于该采购订单已发货与强制结案数量之和,审核失败!请于关联单据处查询。'
  858. RAISERROR(@Error,16,1)
  859. RETURN
  860. END
  861. UPDATE PurchaseSourceBillProduct SET Quantity_Order=@Quantity_PurchaseOrderBillProduct WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct
  862. END
  863. END
  864. ELSE
  865. BEGIN
  866. UPDATE PurchaseSourceBillProduct SET Quantity_Order=0 WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct
  867. END
  868. FETCH Next FROM cur INTO @Quantity_PurchaseOrderBillProduct,@ID_PurchaseSourceBillProduct,@No_PurchaseOrderBillProduct
  869. END
  870. DEALLOCATE cur
  871. END
  872. UPDATE PurchaseOrderBill SET ID_Assessor=@ID_Assessor,AssessDate_PurchaseOrderBill=@AssessDate_PurchaseOrderBill WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
  873. ">
  874. <Params>
  875. <Param name="@ID_PurchaseOrderBill" type="PurchaseOrderBill.ID_PurchaseOrderBill" sourceColumn="ID_PurchaseOrderBill"/>
  876. <Param name="@ID_Assessor" type="PurchaseOrderBill.ID_Assessor" sourceColumn="ID_Assessor"/>
  877. <Param name="@AssessDate_PurchaseOrderBill" type="PurchaseOrderBill.AssessDate_PurchaseOrderBill" sourceColumn="AssessDate_PurchaseOrderBill"/>
  878. </Params>
  879. </Audit>
  880. <FKErrorReport ErrorMessage="该单据已被其他单据引用,删除失败!"/>
  881. <UNIQUEErrorReport ErrorMessage="采购订库单编号已存在,提交失败!"/>
  882. </Table>
  883. <Table name="PurchaseOrderBillProduct" Type="Child">
  884. <GetSchema CmdType="Text" CmdText="
  885. SELECT Top 0 PurchaseOrderBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct*PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct As Money,BillType.Name_BillType,Convert(nvarchar(64), '') as No_PurchaseOrderBill
  886. FROM PurchaseOrderBillProduct
  887. LEFT JOIN Product ON PurchaseOrderBillProduct.ID_Product=Product.ID_Product
  888. LEFT JOIN BillType ON BillType.Value_BillType=PurchaseOrderBillProduct.Type_FromBill
  889. "/>
  890. <New CmdType="Text" CmdText="
  891. INSERT INTO PurchaseOrderBillProduct(ID_PurchaseOrderBillProduct,
  892. No_PurchaseOrderBillProduct,
  893. ID_PurchaseOrderBill,
  894. Type_FromBill,
  895. No_FromBill,
  896. No_FromBillProduct,
  897. ID_Product,
  898. Quantity_PurchaseOrderBillProduct,
  899. UnitPrice_PurchaseOrderBillProduct,
  900. Comment_PurchaseOrderBillProduct)
  901. Values(@ID_PurchaseOrderBillProduct,
  902. @No_PurchaseOrderBillProduct,
  903. @ID_PurchaseOrderBill,
  904. @Type_FromBill,
  905. @No_FromBill,
  906. @No_FromBillProduct,
  907. @ID_Product,
  908. @Quantity_PurchaseOrderBillProduct,
  909. @UnitPrice_PurchaseOrderBillProduct,
  910. @Comment_PurchaseOrderBillProduct)
  911. ">
  912. <Params>
  913. <Param name="@ID_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct" sourceColumn="ID_PurchaseOrderBillProduct" />
  914. <Param name="@No_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.No_PurchaseOrderBillProduct" sourceColumn="No_PurchaseOrderBillProduct" />
  915. <Param name="@ID_PurchaseOrderBill" type="PurchaseOrderBillProduct.ID_PurchaseOrderBill" sourceColumn="ID_PurchaseOrderBill" />
  916. <Param name="@Type_FromBill" type="PurchaseOrderBillProduct.Type_FromBill" sourceColumn="Type_FromBill" />
  917. <Param name="@No_FromBill" type="PurchaseOrderBillProduct.No_FromBill" sourceColumn="No_FromBill" />
  918. <Param name="@No_FromBillProduct" type="PurchaseOrderBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
  919. <Param name="@ID_Product" type="PurchaseOrderBillProduct.ID_Product" sourceColumn="ID_Product" />
  920. <Param name="@Quantity_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct" sourceColumn="Quantity_PurchaseOrderBillProduct" />
  921. <Param name="@UnitPrice_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct" sourceColumn="UnitPrice_PurchaseOrderBillProduct" />
  922. <Param name="@Comment_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.Comment_PurchaseOrderBillProduct" sourceColumn="Comment_PurchaseOrderBillProduct" />
  923. </Params>
  924. </New>
  925. <Update CmdType="Text" CmdText="
  926. Declare @Error nvarchar(100)
  927. IF(@ID_PurchaseSourceBillProduct Is Not Null AND
  928. @Quantity_PurchaseOrderBillProduct &lt; (SELECT (Quantity_InDepot+Quantity_OnShip+Quantity_EndCase)
  929. FROM PurchaseSourceBillProduct
  930. WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseOrderBillProduct))
  931. BEGIN
  932. SET @Error='序号为'+@No_PurchaseOrderBillProduct+'的产品采购数量小于该采购订单已发货与强制结案数量之和,提交失败!请于关联单据处查询。'
  933. RAISERROR(@Error,16,1)
  934. return
  935. END
  936. UPDATE PurchaseOrderBillProduct
  937. SET No_PurchaseOrderBillProduct=@No_PurchaseOrderBillProduct,
  938. Type_FromBill=@Type_FromBill,
  939. No_FromBill=@No_FromBill,
  940. No_FromBillProduct=@No_FromBillProduct,
  941. ID_Product=@ID_Product,
  942. Quantity_PurchaseOrderBillProduct=@Quantity_PurchaseOrderBillProduct,
  943. UnitPrice_PurchaseOrderBillProduct=@UnitPrice_PurchaseOrderBillProduct,
  944. Comment_PurchaseOrderBillProduct=@Comment_PurchaseOrderBillProduct
  945. WHERE ID_PurchaseOrderBillProduct=@ID_PurchaseOrderBillProduct
  946. ">
  947. <Params>
  948. <Param name="@ID_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct" sourceColumn="ID_PurchaseOrderBillProduct" />
  949. <Param name="@No_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.No_PurchaseOrderBillProduct" sourceColumn="No_PurchaseOrderBillProduct" />
  950. <Param name="@Type_FromBill" type="PurchaseOrderBillProduct.Type_FromBill" sourceColumn="Type_FromBill" />
  951. <Param name="@No_FromBill" type="PurchaseOrderBillProduct.No_FromBill" sourceColumn="No_FromBill" />
  952. <Param name="@No_FromBillProduct" type="PurchaseOrderBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
  953. <Param name="@ID_Product" type="PurchaseOrderBillProduct.ID_Product" sourceColumn="ID_Product" />
  954. <Param name="@Quantity_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct" sourceColumn="Quantity_PurchaseOrderBillProduct" />
  955. <Param name="@UnitPrice_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct" sourceColumn="UnitPrice_PurchaseOrderBillProduct" />
  956. <Param name="@Comment_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.Comment_PurchaseOrderBillProduct" sourceColumn="Comment_PurchaseOrderBillProduct" />
  957. <Param name="@ID_PurchaseSourceBillProduct" type="PurchaseOrderBillProduct.ID_PurchaseSourceBillProduct" sourceColumn="ID_PurchaseSourceBillProduct" />
  958. </Params>
  959. </Update>
  960. <Delete CmdType="Text" CmdText="DELETE FROM PurchaseOrderBillProduct WHERE ID_PurchaseOrderBillProduct=@ID_PurchaseOrderBillProduct">
  961. <Params>
  962. <Param name="@ID_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct" sourceColumn="ID_PurchaseOrderBillProduct"/>
  963. </Params>
  964. </Delete>
  965. </Table>
  966. <Table name="BillComment" Type="Child">
  967. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 BillComment.* FROM BillComment"/>
  968. <New CmdType="Text" CmdText=" INSERT INTO BillComment (ID_BillComment, ID_Bill, Comment_BillComment)
  969. VALUES (@ID_BillComment, @ID_Bill, @Comment_BillComment)">
  970. <Params>
  971. <Param name="@ID_BillComment" type="BillComment.ID_BillComment" sourceColumn="ID_BillComment" />
  972. <Param name="@ID_Bill" type="BillComment.ID_Bill" sourceColumn="ID_Bill" />
  973. <Param name="@Comment_BillComment" type="BillComment.Comment_BillComment" sourceColumn="Comment_BillComment" />
  974. </Params>
  975. </New>
  976. <Update CmdType="Text" CmdText=" UPDATE BillComment SET ID_Bill = @ID_Bill, Comment_BillComment = @Comment_BillComment
  977. WHERE ID_BillComment = @ID_BillComment">
  978. <Params>
  979. <Param name="@ID_BillComment" type="BillComment.ID_BillComment" sourceColumn="ID_BillComment" />
  980. <Param name="@ID_Bill" type="BillComment.ID_Bill" sourceColumn="ID_Bill" />
  981. <Param name="@Comment_BillComment" type="BillComment.Comment_BillComment" sourceColumn="Comment_BillComment" />
  982. </Params>
  983. </Update>
  984. <Delete CmdType="Text" CmdText=" DELETE BillComment WHERE ID_BillComment = @ID_BillComment">
  985. <Params>
  986. <Param name="@ID_BillComment" type="BillComment.ID_BillComment" sourceColumn="ID_BillComment" />
  987. </Params>
  988. </Delete>
  989. </Table>
  990. <Table name="ReportComment" Type="Child">
  991. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 ReportComment.* ,Convert(nvarchar(64), '') as No_PurchaseOrderBill FROM ReportComment"/>
  992. <New CmdType="Text" CmdText=" INSERT INTO ReportComment (ID_ReportComment, ID_Bill, Comment_ReportComment)
  993. VALUES (@ID_ReportComment, @ID_Bill, @Comment_ReportComment)">
  994. <Params>
  995. <Param name="@ID_ReportComment" type="ReportComment.ID_BillComment" sourceColumn="ID_ReportComment" />
  996. <Param name="@ID_Bill" type="ReportComment.ID_Bill" sourceColumn="ID_Bill" />
  997. <Param name="@Comment_ReportComment" type="ReportComment.Comment_ReportComment" sourceColumn="Comment_ReportComment" />
  998. </Params>
  999. </New>
  1000. <Update CmdType="Text" CmdText=" UPDATE ReportComment SET ID_Bill = @ID_Bill, Comment_ReportComment = @Comment_ReportComment
  1001. WHERE ID_ReportComment = @ID_ReportComment">
  1002. <Params>
  1003. <Param name="@ID_ReportComment" type="ReportComment.ID_BillComment" sourceColumn="ID_ReportComment" />
  1004. <Param name="@ID_Bill" type="ReportComment.ID_Bill" sourceColumn="ID_Bill" />
  1005. <Param name="@Comment_ReportComment" type="ReportComment.Comment_ReportComment" sourceColumn="Comment_ReportComment" />
  1006. </Params>
  1007. </Update>
  1008. <Delete CmdType="Text" CmdText=" DELETE ReportComment WHERE ID_ReportComment = @ID_ReportComment">
  1009. <Params>
  1010. <Param name="@ID_ReportComment" type="ReportComment.ID_ReportComment" sourceColumn="ID_ReportComment" />
  1011. </Params>
  1012. </Delete>
  1013. </Table>
  1014. </Tables>
  1015. <Search>
  1016. <SearchAllBill CmdType="Text" CmdText=" SELECT PurchaseOrderBill.*,a.Name_User As Creator,b.Name_User As Assessor,c.Name_User As LastModUser,No_Supplier,Name_Supplier=CASE ISNULL(Supplier.SuspendDate_Supplier,0) WHEN 0 THEN Name_Supplier ELSE Name_Supplier+'(已暂停!)'END, ShortName_Supplier,RegistedAddress_Supplier,PostalCode_Supplier,Name_Location,No_Location,EmpA.Name_Employee As Name_Principal,EmpA.No_Employee As No_Principal,EmpB.No_Employee As No_Linkman,convert(decimal(18,6),'0.00') As MoneySum,convert(decimal(18,6),'0.00') As TaxSum
  1017. FROM PurchaseOrderBill
  1018. LEFT JOIN AppUser a ON a.ID_User=PurchaseOrderBill.ID_Creator
  1019. LEFT JOIN AppUser b ON b.ID_User=PurchaseOrderBill.ID_Assessor
  1020. LEFT JOIN AppUser c ON c.ID_User=PurchaseOrderBill.LastModUser_PurchaseOrderBill
  1021. LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseOrderBill.ID_Supplier
  1022. LEFT JOIN Location ON Location.ID_Location=PurchaseOrderBill.ID_Location
  1023. LEFT JOIN Employee EmpA ON EmpA.ID_Employee=PurchaseOrderBill.ID_Principal
  1024. LEFT JOIN Employee EmpB ON EmpB.Name_Employee=PurchaseOrderBill.Name_Linkman
  1025. WHERE Disable_PurchaseOrderBill = 0">
  1026. <Tables>
  1027. <Table name="AllBill" />
  1028. </Tables>
  1029. </SearchAllBill>
  1030. <SearchAllSupplier CmdType="Text" CmdText="SELECT Supplier.No_Supplier,Supplier.ShortName_Supplier FROM Supplier ">
  1031. <Tables>
  1032. <Table name="AllSupplier" />
  1033. </Tables>
  1034. </SearchAllSupplier>
  1035. <SearchAllProduct CmdType="Text" CmdText="SELECT Product.No_Product,Product.Name_Product FROM Product ">
  1036. <Tables>
  1037. <Table name="AllProduct" />
  1038. </Tables>
  1039. </SearchAllProduct>
  1040. <SearchContr CmdType="Text" CmdText=" SELECT SystemSetting.StockAndInDepot_SystemSetting FROM SystemSetting WHERE SystemSetting.StockAndInDepot_SystemSetting = 1">
  1041. <Tables>
  1042. <Table name="SystemSaleAndOutDepot" />
  1043. </Tables>
  1044. </SearchContr>
  1045. <SearchPurchaseOrderBillWithNo CmdType="Text" CmdText="
  1046. SELECT PurchaseOrderBill.*,a.Name_User As Creator,b.Name_User As Assessor,c.Name_User As LastModUser,No_Supplier,ShortName_Supplier,Name_Supplier=CASE ISNULL(Supplier.SuspendDate_Supplier,0) WHEN 0 THEN Name_Supplier ELSE Name_Supplier+'(已暂停!)'END,RegistedAddress_Supplier,PostalCode_Supplier,Name_Location,No_Location,EmpA.Name_Employee As Name_Principal,EmpA.No_Employee As No_Principal,EmpB.No_Employee As No_Linkman
  1047. FROM PurchaseOrderBill
  1048. LEFT JOIN AppUser a ON a.ID_User=PurchaseOrderBill.ID_Creator
  1049. LEFT JOIN AppUser b ON b.ID_User=PurchaseOrderBill.ID_Assessor
  1050. LEFT JOIN AppUser c ON c.ID_User=PurchaseOrderBill.LastModUser_PurchaseOrderBill
  1051. LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseOrderBill.ID_Supplier
  1052. LEFT JOIN Location ON Location.ID_Location=PurchaseOrderBill.ID_Location
  1053. LEFT JOIN Employee EmpA ON EmpA.ID_Employee=PurchaseOrderBill.ID_Principal
  1054. LEFT JOIN Employee EmpB ON EmpB.Name_Employee=PurchaseOrderBill.Name_Linkman
  1055. WHERE No_PurchaseOrderBill=@No_PurchaseOrderBill AND Disable_PurchaseOrderBill=0
  1056. SELECT PurchaseOrderBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct*PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct As Money,BillType.Name_BillType,@No_PurchaseOrderBill as No_PurchaseOrderBill
  1057. FROM PurchaseOrderBillProduct
  1058. LEFT JOIN Product ON PurchaseOrderBillProduct.ID_Product=Product.ID_Product
  1059. LEFT JOIN BillType ON BillType.Value_BillType=PurchaseOrderBillProduct.Type_FromBill
  1060. LEFT JOIN PurchaseOrderBill ON PurchaseOrderBillProduct.ID_PurchaseOrderBill=PurchaseOrderBill.ID_PurchaseOrderBill
  1061. WHERE No_PurchaseOrderBill=@No_PurchaseOrderBill AND Disable_PurchaseOrderBill=0
  1062. Order By CAST(No_PurchaseOrderBillProduct AS INT)
  1063. SELECT BillComment.*
  1064. FROM BillComment
  1065. LEFT JOIN PurchaseOrderBill ON PurchaseOrderBill.ID_PurchaseOrderBill=BillComment.ID_Bill
  1066. WHERE No_PurchaseOrderBill=@No_PurchaseOrderBill AND Disable_PurchaseOrderBill=0
  1067. ORDER BY BillComment.No_BillComment
  1068. SELECT ReportComment.*,@No_PurchaseOrderBill as No_PurchaseOrderBill
  1069. FROM ReportComment
  1070. LEFT JOIN PurchaseOrderBill ON PurchaseOrderBill.ID_PurchaseOrderBill=ReportComment.ID_Bill
  1071. WHERE No_PurchaseOrderBill=@No_PurchaseOrderBill AND Disable_PurchaseOrderBill=0
  1072. ORDER BY ReportComment.No_ReportComment
  1073. ">
  1074. <Params>
  1075. <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0"/>
  1076. </Params>
  1077. <Tables>
  1078. <Table name="PurchaseOrderBill"/>
  1079. <Table name="PurchaseOrderBillProduct"/>
  1080. <Table name="BillComment"/>
  1081. <Table name="ReportComment"/>
  1082. </Tables>
  1083. </SearchPurchaseOrderBillWithNo>
  1084. <SearchLocation CmdType="Text" CmdText="SELECT Name_Location,ID_Location,No_Location FROM Location WHERE SubjectionID_Location IS Null Order By No_Location">
  1085. <Tables>
  1086. <Table name="Location"/>
  1087. </Tables>
  1088. </SearchLocation>
  1089. <SearchSupplier CmdType="Text" CmdText="
  1090. declare @LastTax_Supplier1 nvarchar(64)
  1091. declare @LastTax_Supplier2 nvarchar(64)
  1092. declare @LastTax_Supplier3 nvarchar(64)
  1093. declare @PurTaxDefault1_FunctionSetting int
  1094. declare @PurTaxDefault2_FunctionSetting int
  1095. declare @PurTaxDefault3_FunctionSetting int
  1096. select @PurTaxDefault1_FunctionSetting = PurTaxDefault1_FunctionSetting,
  1097. @PurTaxDefault2_FunctionSetting = PurTaxDefault2_FunctionSetting, @PurTaxDefault3_FunctionSetting = PurTaxDefault3_FunctionSetting
  1098. from FunctionSetting
  1099. if @PurTaxDefault1_FunctionSetting=0
  1100. begin
  1101. select top 1 @LastTax_Supplier1 = PurchaseOrderBill.TaxCurrency_PurchaseOrderBill
  1102. from PurchaseOrderBill
  1103. Left join Supplier
  1104. on Supplier.ID_Supplier = PurchaseOrderBill.ID_Supplier
  1105. where Supplier.No_Supplier = @No_Supplier
  1106. order by Date_PurchaseOrderBill desc
  1107. end
  1108. else if @PurTaxDefault1_FunctionSetting = 1
  1109. begin
  1110. select top 1 @LastTax_Supplier1 = TaxCurrency_PurchaseOrderBill
  1111. from PurchaseOrderBill
  1112. order by Date_PurchaseOrderBill desc
  1113. end
  1114. else
  1115. begin
  1116. set @LastTax_Supplier1 = '外加'
  1117. end
  1118. if @PurTaxDefault2_FunctionSetting=0
  1119. begin
  1120. select top 1 @LastTax_Supplier2 = PurchaseOrderBill.TaxCurrency_PurchaseOrderBill
  1121. from PurchaseOrderBill
  1122. Left join Supplier
  1123. on Supplier.ID_Supplier = PurchaseOrderBill.ID_Supplier
  1124. where Supplier.No_Supplier = @No_Supplier
  1125. order by Date_PurchaseOrderBill desc
  1126. end
  1127. else if @PurTaxDefault2_FunctionSetting = 1
  1128. begin
  1129. select top 1 @LastTax_Supplier2 = TaxCurrency_PurchaseOrderBill
  1130. from PurchaseOrderBill
  1131. order by Date_PurchaseOrderBill desc
  1132. end
  1133. else
  1134. begin
  1135. set @LastTax_Supplier2 = '外加'
  1136. end
  1137. if @PurTaxDefault3_FunctionSetting=0
  1138. begin
  1139. select top 1 @LastTax_Supplier3 = PurchaseOrderBill.TaxCurrency_PurchaseOrderBill
  1140. from PurchaseOrderBill
  1141. Left join Supplier
  1142. on Supplier.ID_Supplier = PurchaseOrderBill.ID_Supplier
  1143. where Supplier.No_Supplier = @No_Supplier
  1144. order by Date_PurchaseOrderBill desc
  1145. end
  1146. else if @PurTaxDefault3_FunctionSetting = 1
  1147. begin
  1148. select top 1 @LastTax_Supplier3 = TaxCurrency_PurchaseOrderBill
  1149. from PurchaseOrderBill
  1150. order by Date_PurchaseOrderBill desc
  1151. end
  1152. else
  1153. begin
  1154. set @LastTax_Supplier3 = '外加'
  1155. end
  1156. if @LastTax_Supplier1 is null
  1157. set @LastTax_Supplier1 = isnull(@LastTax_Supplier2, @LastTax_Supplier3)
  1158. SELECT *, ISNULL(@LastTax_Supplier1, '外加') AS LastTax_Supplier FROM Supplier
  1159. WHERE No_Supplier=@No_Supplier
  1160. ">
  1161. <Params>
  1162. <Param name="@No_Supplier" type="Supplier.No_Supplier" Index="0"/>
  1163. </Params>
  1164. <Tables>
  1165. <Table name="Supplier"/>
  1166. </Tables>
  1167. </SearchSupplier>
  1168. <SearchEmployee CmdType="Text" CmdText="
  1169. SELECT No_Employee,Name_Employee
  1170. FROM Employee
  1171. ">
  1172. <Tables>
  1173. <Table name="Employee"/>
  1174. </Tables>
  1175. </SearchEmployee>
  1176. <SearchPrincipal CmdType="Text" CmdText="SELECT Employee.ID_Employee,Employee.No_Employee AS No_Principal, Employee.Name_Employee AS Name_Principal
  1177. FROM Employee
  1178. ORDER BY No_Employee
  1179. ">
  1180. <Tables>
  1181. <Table name="Principal" />
  1182. </Tables>
  1183. </SearchPrincipal>
  1184. <SearchLinkman CmdType="Text" CmdText="
  1185. SELECT Name_Linkman,No_Employee
  1186. FROM Linkman
  1187. LEFT JOIN Employee ON Linkman.Name_Linkman=Employee.Name_Employee
  1188. WHERE ID_Person=@ID_Supplier
  1189. Order By No_Employee
  1190. ">
  1191. <Params>
  1192. <Param name="@ID_Supplier" type="PurchaseOrderBill.ID_Supplier" Index="0"/>
  1193. </Params>
  1194. <Tables>
  1195. <Table name="Linkman"/>
  1196. </Tables>
  1197. </SearchLinkman>
  1198. <SearchTelephone CmdType="Text" CmdText="
  1199. SELECT No_Telephone
  1200. FROM Telephone
  1201. WHERE ID_Person=@ID_Supplier
  1202. ">
  1203. <Params>
  1204. <Param name="@ID_Supplier" type="PurchaseOrderBill.ID_Supplier" Index="0"/>
  1205. </Params>
  1206. <Tables>
  1207. <Table name="Telephone"/>
  1208. </Tables>
  1209. </SearchTelephone>
  1210. <SearchFocusTelephone CmdType="Text" CmdText="
  1211. SELECT No_Telephone
  1212. FROM Telephone
  1213. WHERE ID_Person=@ID_Supplier AND Focus_Telephone=1
  1214. ">
  1215. <Params>
  1216. <Param name="@ID_Supplier" type="PurchaseOrderBill.ID_Supplier" Index="0"/>
  1217. </Params>
  1218. <Tables>
  1219. <Table name="FocusTelephone"/>
  1220. </Tables>
  1221. </SearchFocusTelephone>
  1222. <SearchFax CmdType="Text" CmdText="
  1223. SELECT No_Fax
  1224. FROM Fax
  1225. WHERE ID_Person=@ID_Supplier
  1226. ">
  1227. <Params>
  1228. <Param name="@ID_Supplier" type="PurchaseOrderBill.ID_Supplier" Index="0"/>
  1229. </Params>
  1230. <Tables>
  1231. <Table name="Fax"/>
  1232. </Tables>
  1233. </SearchFax>
  1234. <SearchFocusFax CmdType="Text" CmdText="
  1235. SELECT No_Fax
  1236. FROM Fax
  1237. WHERE ID_Person=@ID_Supplier AND Focus_Fax=1
  1238. ">
  1239. <Params>
  1240. <Param name="@ID_Supplier" type="PurchaseOrderBill.ID_Supplier" Index="0"/>
  1241. </Params>
  1242. <Tables>
  1243. <Table name="FocusFax"/>
  1244. </Tables>
  1245. </SearchFocusFax>
  1246. <SearchPurchaseQueryBill CmdType="Text" CmdText="
  1247. SELECT * FROM
  1248. PurchaseQueryBill
  1249. WHERE No_PurchaseQueryBill=@No_PurchaseQueryBill
  1250. ">
  1251. <Params>
  1252. <Param name="@No_PurchaseQueryBill" type="PurchaseQueryBill.No_PurchaseQueryBill" Index="0"/>
  1253. </Params>
  1254. <Tables>
  1255. <Table name="PurchaseQueryBill"/>
  1256. </Tables>
  1257. </SearchPurchaseQueryBill>
  1258. <SearchPurchaseQueryBillProduct CmdType="Text" CmdText="
  1259. SELECT PurchaseQueryBillProduct.*,No_Product,Name_Product,Unit_Product,SuspendDate_Product
  1260. FROM PurchaseQueryBillProduct
  1261. LEFT JOIN PurchaseQueryBill ON PurchaseQueryBillProduct.ID_PurchaseQueryBill=PurchaseQueryBill.ID_PurchaseQueryBill
  1262. LEFT JOIN Product ON PurchaseQueryBillProduct.ID_Product=Product.ID_Product
  1263. WHERE No_PurchaseQueryBill=@No_PurchaseQueryBill and No_PurchaseQueryBillProduct=@No_PurchaseQueryBillProduct
  1264. ">
  1265. <Params>
  1266. <Param name="@No_PurchaseQueryBill" type="PurchaseQueryBill.No_PurchaseQueryBill" Index="0"/>
  1267. <Param name="@No_PurchaseQueryBillProduct" type="PurchaseQueryBillProduct.No_PurchaseQueryBillProduct" Index="1"/>
  1268. </Params>
  1269. <Tables>
  1270. <Table name="PurchaseQueryBillProduct"/>
  1271. </Tables>
  1272. </SearchPurchaseQueryBillProduct>
  1273. <SearchProduct CmdType="Text" CmdText="
  1274. SELECT ID_Product, Name_Product,Unit_Product,Price_Product,SuspendDate_Product
  1275. FROM Product
  1276. WHERE No_Product=@No_Product
  1277. ">
  1278. <Params>
  1279. <Param name="@No_Product" type="Product.No_Product" Index="0"/>
  1280. </Params>
  1281. <Tables>
  1282. <Table name="Product"/>
  1283. </Tables>
  1284. </SearchProduct>
  1285. <SearchBillType CmdType="Text" CmdText="
  1286. SELECT * FROM BillType WHERE Value_BillType = 43 OR Value_BillType = 0 ORDER BY Value_BillType
  1287. ">
  1288. <Tables>
  1289. <Table name="BillType"/>
  1290. </Tables>
  1291. </SearchBillType>
  1292. <SearchCessIn CmdType="Text" CmdText="
  1293. SELECT CessIn_SystemSetting,SysCurrency_SystemSetting,PurAudit_FunctionSetting FROM SystemSetting,FunctionSetting">
  1294. <Tables>
  1295. <Table name="SystemSetting"/>
  1296. </Tables>
  1297. </SearchCessIn>
  1298. <SearchFormat CmdType="Text" CmdText="
  1299. Select * from SystemSetting">
  1300. <Tables>
  1301. <Table name="SystemSettingFormat"/>
  1302. </Tables>
  1303. </SearchFormat>
  1304. <SearchPurchaseOrderBillFirst CmdType="Text" CmdText=" DECLARE @No_PurchaseOrderBill nvarchar(64)
  1305. DECLARE @ID_PurchaseOrderBill uniqueidentifier
  1306. SELECT Top 1 @ID_PurchaseOrderBill=ID_PurchaseOrderBill, @No_PurchaseOrderBill = No_PurchaseOrderBill
  1307. FROM PurchaseOrderBill
  1308. WHERE Disable_PurchaseOrderBill=0
  1309. Order By No_PurchaseOrderBill
  1310. SELECT PurchaseOrderBill.*,a.Name_User As Creator,b.Name_User As Assessor,c.Name_User As LastModUser,No_Supplier,ShortName_Supplier,Name_Supplier=CASE ISNULL(Supplier.SuspendDate_Supplier,0) WHEN 0 THEN Name_Supplier ELSE Name_Supplier+'(已暂停!)'END,RegistedAddress_Supplier,PostalCode_Supplier,Name_Location,No_Location,EmpA.Name_Employee As Name_Principal,EmpA.No_Employee As No_Principal,EmpB.No_Employee As No_Linkman
  1311. FROM PurchaseOrderBill
  1312. LEFT JOIN AppUser a ON a.ID_User=PurchaseOrderBill.ID_Creator
  1313. LEFT JOIN AppUser b ON b.ID_User=PurchaseOrderBill.ID_Assessor
  1314. LEFT JOIN AppUser c ON c.ID_User=PurchaseOrderBill.LastModUser_PurchaseOrderBill
  1315. LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseOrderBill.ID_Supplier
  1316. LEFT JOIN Location ON Location.ID_Location=PurchaseOrderBill.ID_Location
  1317. LEFT JOIN Employee EmpA ON EmpA.ID_Employee=PurchaseOrderBill.ID_Principal
  1318. LEFT JOIN Employee EmpB ON EmpB.Name_Employee=PurchaseOrderBill.Name_Linkman
  1319. WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
  1320. SELECT PurchaseOrderBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct*PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct As Money,BillType.Name_BillType,@No_PurchaseOrderBill as No_PurchaseOrderBill
  1321. FROM PurchaseOrderBillProduct
  1322. LEFT JOIN Product ON PurchaseOrderBillProduct.ID_Product=Product.ID_Product
  1323. LEFT JOIN BillType ON BillType.Value_BillType=PurchaseOrderBillProduct.Type_FromBill
  1324. WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
  1325. Order By CAST(No_PurchaseOrderBillProduct AS INT)
  1326. SELECT BillComment.*
  1327. FROM BillComment
  1328. WHERE ID_Bill=@ID_PurchaseOrderBill
  1329. ORDER BY BillComment.No_BillComment
  1330. SELECT ReportComment.*,@No_PurchaseOrderBill as No_PurchaseOrderBill
  1331. FROM ReportComment
  1332. WHERE ID_Bill=@ID_PurchaseOrderBill
  1333. ORDER BY ReportComment.No_ReportComment
  1334. ">
  1335. <Tables>
  1336. <Table name="PurchaseOrderBill"/>
  1337. <Table name="PurchaseOrderBillProduct"/>
  1338. <Table name="BillComment"/>
  1339. <Table name="ReportComment"/>
  1340. </Tables>
  1341. </SearchPurchaseOrderBillFirst>
  1342. <SearchPurchaseOrderBillPrev CmdType="Text" CmdText=" DECLARE @NoNext nvarchar(64)
  1343. DECLARE @ID_PurchaseOrderBill uniqueidentifier
  1344. SELECT Top 1 @ID_PurchaseOrderBill=ID_PurchaseOrderBill,@NoNext = No_PurchaseOrderBill
  1345. FROM PurchaseOrderBill
  1346. WHERE No_PurchaseOrderBill &lt; @No_PurchaseOrderBill AND Disable_PurchaseOrderBill=0
  1347. ORDER By No_PurchaseOrderBill Desc
  1348. SELECT PurchaseOrderBill.*,a.Name_User As Creator,b.Name_User As Assessor,c.Name_User As LastModUser,No_Supplier,ShortName_Supplier,Name_Supplier=CASE ISNULL(Supplier.SuspendDate_Supplier,0) WHEN 0 THEN Name_Supplier ELSE Name_Supplier+'(已暂停!)'END,RegistedAddress_Supplier,PostalCode_Supplier,Name_Location,No_Location,EmpA.Name_Employee As Name_Principal,EmpA.No_Employee As No_Principal,EmpB.No_Employee As No_Linkman
  1349. FROM PurchaseOrderBill
  1350. LEFT JOIN AppUser a ON a.ID_User=PurchaseOrderBill.ID_Creator
  1351. LEFT JOIN AppUser b ON b.ID_User=PurchaseOrderBill.ID_Assessor
  1352. LEFT JOIN AppUser c ON c.ID_User=PurchaseOrderBill.LastModUser_PurchaseOrderBill
  1353. LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseOrderBill.ID_Supplier
  1354. LEFT JOIN Location ON Location.ID_Location=PurchaseOrderBill.ID_Location
  1355. LEFT JOIN Employee EmpA ON EmpA.ID_Employee=PurchaseOrderBill.ID_Principal
  1356. LEFT JOIN Employee EmpB ON EmpB.Name_Employee=PurchaseOrderBill.Name_Linkman
  1357. WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
  1358. SELECT PurchaseOrderBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct*PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct As Money,BillType.Name_BillType,@NoNext as No_PurchaseOrderBill
  1359. FROM PurchaseOrderBillProduct
  1360. LEFT JOIN Product ON PurchaseOrderBillProduct.ID_Product=Product.ID_Product
  1361. LEFT JOIN BillType ON BillType.Value_BillType=PurchaseOrderBillProduct.Type_FromBill
  1362. WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
  1363. Order By CAST(No_PurchaseOrderBillProduct AS INT)
  1364. SELECT BillComment.*
  1365. FROM BillComment
  1366. WHERE ID_Bill=@ID_PurchaseOrderBill
  1367. ORDER BY BillComment.No_BillComment
  1368. SELECT ReportComment.*,@NoNext as No_PurchaseOrderBill
  1369. FROM ReportComment
  1370. WHERE ID_Bill=@ID_PurchaseOrderBill
  1371. ORDER BY ReportComment.No_ReportComment
  1372. ">
  1373. <Params>
  1374. <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0"/>
  1375. </Params>
  1376. <Tables>
  1377. <Table name="PurchaseOrderBill"/>
  1378. <Table name="PurchaseOrderBillProduct"/>
  1379. <Table name="BillComment"/>
  1380. <Table name="ReportComment"/>
  1381. </Tables>
  1382. </SearchPurchaseOrderBillPrev>
  1383. <SearchPurchaseOrderBillNext CmdType="Text" CmdText=" DECLARE @NoNext nvarchar(64)
  1384. DECLARE @ID_PurchaseOrderBill uniqueidentifier
  1385. SELECT Top 1 @ID_PurchaseOrderBill=ID_PurchaseOrderBill,@NoNext = No_PurchaseOrderBill
  1386. FROM PurchaseOrderBill
  1387. WHERE No_PurchaseOrderBill &gt; @No_PurchaseOrderBill
  1388. ORDER By No_PurchaseOrderBill
  1389. SELECT PurchaseOrderBill.*,a.Name_User As Creator,b.Name_User As Assessor,c.Name_User As LastModUser,No_Supplier,ShortName_Supplier,Name_Supplier=CASE ISNULL(Supplier.SuspendDate_Supplier,0) WHEN 0 THEN Name_Supplier ELSE Name_Supplier+'(已暂停!)'END,RegistedAddress_Supplier,PostalCode_Supplier,Name_Location,No_Location,EmpA.Name_Employee As Name_Principal,EmpA.No_Employee As No_Principal,EmpB.No_Employee As No_Linkman
  1390. FROM PurchaseOrderBill
  1391. LEFT JOIN AppUser a ON a.ID_User=PurchaseOrderBill.ID_Creator
  1392. LEFT JOIN AppUser b ON b.ID_User=PurchaseOrderBill.ID_Assessor
  1393. LEFT JOIN AppUser c ON c.ID_User=PurchaseOrderBill.LastModUser_PurchaseOrderBill
  1394. LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseOrderBill.ID_Supplier
  1395. LEFT JOIN Location ON Location.ID_Location=PurchaseOrderBill.ID_Location
  1396. LEFT JOIN Employee EmpA ON EmpA.ID_Employee=PurchaseOrderBill.ID_Principal
  1397. LEFT JOIN Employee EmpB ON EmpB.Name_Employee=PurchaseOrderBill.Name_Linkman
  1398. WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
  1399. SELECT PurchaseOrderBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct*PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct As Money,BillType.Name_BillType,@NoNext as No_PurchaseOrderBill
  1400. FROM PurchaseOrderBillProduct
  1401. LEFT JOIN Product ON PurchaseOrderBillProduct.ID_Product=Product.ID_Product
  1402. LEFT JOIN BillType ON BillType.Value_BillType=PurchaseOrderBillProduct.Type_FromBill
  1403. WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
  1404. Order By CAST(No_PurchaseOrderBillProduct AS INT)
  1405. SELECT BillComment.*
  1406. FROM BillComment
  1407. WHERE ID_Bill=@ID_PurchaseOrderBill
  1408. ORDER BY BillComment.No_BillComment
  1409. SELECT ReportComment.*,@NoNext as No_PurchaseOrderBill
  1410. FROM ReportComment
  1411. WHERE ID_Bill=@ID_PurchaseOrderBill
  1412. ORDER BY ReportComment.No_ReportComment
  1413. ">
  1414. <Params>
  1415. <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0"/>
  1416. </Params>
  1417. <Tables>
  1418. <Table name="PurchaseOrderBill"/>
  1419. <Table name="PurchaseOrderBillProduct"/>
  1420. <Table name="BillComment"/>
  1421. <Table name="ReportComment"/>
  1422. </Tables>
  1423. </SearchPurchaseOrderBillNext>
  1424. <SearchPurchaseOrderBillLast CmdType="Text" CmdText="DECLARE @No_PurchaseOrderBill nvarchar(64)
  1425. DECLARE @ID_PurchaseOrderBill uniqueidentifier
  1426. SELECT Top 1 @ID_PurchaseOrderBill=ID_PurchaseOrderBill,@No_PurchaseOrderBill = No_PurchaseOrderBill
  1427. FROM PurchaseOrderBill
  1428. WHERE Disable_PurchaseOrderBill=0
  1429. Order By No_PurchaseOrderBill Desc
  1430. SELECT PurchaseOrderBill.*,a.Name_User As Creator,b.Name_User As Assessor,c.Name_User As LastModUser,No_Supplier,ShortName_Supplier,Name_Supplier=CASE ISNULL(Supplier.SuspendDate_Supplier,0) WHEN 0 THEN Name_Supplier ELSE Name_Supplier+'(已暂停!)'END,RegistedAddress_Supplier,PostalCode_Supplier,Name_Location,No_Location,EmpA.Name_Employee As Name_Principal,EmpA.No_Employee As No_Principal,EmpB.No_Employee As No_Linkman
  1431. FROM PurchaseOrderBill
  1432. LEFT JOIN AppUser a ON a.ID_User=PurchaseOrderBill.ID_Creator
  1433. LEFT JOIN AppUser b ON b.ID_User=PurchaseOrderBill.ID_Assessor
  1434. LEFT JOIN AppUser c ON c.ID_User=PurchaseOrderBill.LastModUser_PurchaseOrderBill
  1435. LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseOrderBill.ID_Supplier
  1436. LEFT JOIN Location ON Location.ID_Location=PurchaseOrderBill.ID_Location
  1437. LEFT JOIN Employee EmpA ON EmpA.ID_Employee=PurchaseOrderBill.ID_Principal
  1438. LEFT JOIN Employee EmpB ON EmpB.Name_Employee=PurchaseOrderBill.Name_Linkman
  1439. WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
  1440. SELECT PurchaseOrderBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct*PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct As Money,BillType.Name_BillType,@No_PurchaseOrderBill as No_PurchaseOrderBill
  1441. FROM PurchaseOrderBillProduct
  1442. LEFT JOIN Product ON PurchaseOrderBillProduct.ID_Product=Product.ID_Product
  1443. LEFT JOIN BillType ON BillType.Value_BillType=PurchaseOrderBillProduct.Type_FromBill
  1444. WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
  1445. Order By CAST(No_PurchaseOrderBillProduct AS INT)
  1446. SELECT BillComment.*
  1447. FROM BillComment
  1448. WHERE ID_Bill=@ID_PurchaseOrderBill
  1449. ORDER BY BillComment.No_BillComment
  1450. SELECT ReportComment.*,@No_PurchaseOrderBill as No_PurchaseOrderBill
  1451. FROM ReportComment
  1452. WHERE ID_Bill=@ID_PurchaseOrderBill
  1453. ORDER BY ReportComment.No_ReportComment
  1454. ">
  1455. <Tables>
  1456. <Table name="PurchaseOrderBill"/>
  1457. <Table name="PurchaseOrderBillProduct"/>
  1458. <Table name="BillComment"/>
  1459. <Table name="ReportComment"/>
  1460. </Tables>
  1461. </SearchPurchaseOrderBillLast>
  1462. <SearchAllPriceQueryBill CmdType="Text" CmdText="Select PriceQueryBill.TaxCurrency_PriceQueryBill,PriceQueryBill.ID_PriceQueryBill,PriceQueryBill.No_PriceQueryBill,PriceQueryBill.Date_PriceQueryBill,Customer.No_Customer,Customer.ShortName_Customer,Case When PriceQueryBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_PriceQueryBill From PriceQueryBill
  1463. Inner Join Customer On PriceQueryBill.ID_Customer = Customer.ID_Customer" >
  1464. <Tables>
  1465. <Table name="AllPriceQueryBill" />
  1466. </Tables>
  1467. </SearchAllPriceQueryBill>
  1468. <SearchAllSaleBill CmdType="Text" CmdText="Select SaleBill.TaxCurrency_SaleBill, SaleBill.ID_SaleBill,SaleBill.No_SaleBill,SaleBill.Date_SaleBill,Customer.No_Customer,Customer.ShortName_Customer,Case When SaleBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_SaleBill,Location.Name_Location From SaleBill
  1469. Inner Join Customer On SaleBill.ID_Customer = Customer.ID_Customer
  1470. Inner Join Location On Location.ID_Location = SaleBill.ID_Location" >
  1471. <Tables>
  1472. <Table name="AllSaleBill" />
  1473. </Tables>
  1474. </SearchAllSaleBill>
  1475. <SearchAllPurchaseQueryBill CmdType="Text" CmdText="Select EmpA.No_Employee As No_Principal,EmpA.Name_Employee As Name_Principal,PurchaseQueryBill.TaxCurrency_PurchaseQueryBill,PurchaseQueryBill.ID_PurchaseQueryBill,PurchaseQueryBill.No_PurchaseQueryBill,PurchaseQueryBill.Date_PurchaseQueryBill,Supplier.No_Supplier,Supplier.ShortName_Supplier,Case When PurchaseQueryBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_PurchaseQueryBill From PurchaseQueryBill
  1476. Inner Join Supplier On PurchaseQueryBill.ID_Supplier = Supplier.ID_Supplier
  1477. LEFT JOIN Employee EmpA ON EmpA.ID_Employee=PurchaseQueryBill.ID_Principal" >
  1478. <Tables>
  1479. <Table name="AllPurchaseQueryBill" />
  1480. </Tables>
  1481. </SearchAllPurchaseQueryBill>
  1482. <SearchAllPriceQueryBillProduct CmdType="Text" CmdText="Select Product.No_Product,PriceQueryBillProduct.No_PriceQueryBillProduct,Product.Name_Product,PriceQueryBillProduct.Quantity_PriceQueryBillProduct,PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct From PriceQueryBillProduct
  1483. Inner Join Product On Product.ID_Product = PriceQueryBillProduct.ID_Product
  1484. Inner Join PriceQueryBill On PriceQueryBill.ID_PriceQueryBill = PriceQueryBillProduct.ID_PriceQueryBill" >
  1485. <Tables>
  1486. <Table name="AllPriceQueryBillProduct" />
  1487. </Tables>
  1488. </SearchAllPriceQueryBillProduct>
  1489. <SearchAllSaleBillProduct CmdType="Text" CmdText="Select Product.No_Product,SaleBillProduct.No_SaleBillProduct,Product.Name_Product,SaleBillProduct.Quantity_SaleBillProduct,SaleBillProduct.UnitPrice_SaleBillProduct From SaleBillProduct
  1490. Inner Join Product On Product.ID_Product = SaleBillProduct.ID_Product
  1491. Inner Join SaleBill On SaleBill.ID_SaleBill =SaleBillProduct.ID_SaleBill" >
  1492. <Tables>
  1493. <Table name="AllSaleBillProduct" />
  1494. </Tables>
  1495. </SearchAllSaleBillProduct>
  1496. <SearchAllPurchaseQueryBillProduct CmdType="Text" CmdText="Select Product.No_Product,PurchaseQueryBillProduct.No_PurchaseQueryBillProduct,Product.Name_Product,PurchaseQueryBillProduct.Quantity_PurchaseQueryBillProduct,PurchaseQueryBillProduct.UnitPrice_PurchaseQueryBillProduct From PurchaseQueryBillProduct
  1497. Inner Join Product On Product.ID_Product = PurchaseQueryBillProduct.ID_Product
  1498. Inner Join PurchaseQueryBill On PurchaseQueryBill.ID_PurchaseQueryBill =PurchaseQueryBillProduct.ID_PurchaseQueryBill" >
  1499. <Tables>
  1500. <Table name="AllPurchaseQueryBillProduct" />
  1501. </Tables>
  1502. </SearchAllPurchaseQueryBillProduct>
  1503. <SearchTypeComment CmdType="Text" CmdText="
  1504. declare @PurRemark1_FunctionSetting int
  1505. declare @PurRemark2_FunctionSetting int
  1506. Select @PurRemark1_FunctionSetting = PurRemark1_FunctionSetting, @PurRemark2_FunctionSetting = PurRemark2_FunctionSetting
  1507. from FunctionSetting
  1508. declare @ID_PurchaseOrderBill uniqueidentifier
  1509. declare @flag int
  1510. set @flag = 0
  1511. if @PurRemark1_FunctionSetting = 0
  1512. begin
  1513. select top 1 @ID_PurchaseOrderBill = PurchaseOrderBill.ID_PurchaseOrderBill
  1514. from PurchaseOrderBill
  1515. where ID_Supplier = @ID_Supplier
  1516. order by PurchaseOrderBill.Date_PurchaseOrderBill desc
  1517. if exists(select ReportComment.* from ReportComment where ReportComment.ID_Bill = @ID_PurchaseOrderBill)
  1518. begin
  1519. select ReportComment.Comment_ReportComment from ReportComment where ReportComment.ID_Bill = @ID_PurchaseOrderBill
  1520. ORDER BY ReportComment.No_ReportComment
  1521. set @flag = 1
  1522. end
  1523. end
  1524. else
  1525. begin
  1526. if exists(SELECT Name_TypeDef FROM TypeDef WHERE Type_TypeDef=26 )
  1527. begin
  1528. SELECT Name_TypeDef as Comment_ReportComment FROM TypeDef WHERE Type_TypeDef=26
  1529. set @flag = 1
  1530. end
  1531. end
  1532. if @flag = 0
  1533. begin
  1534. if @PurRemark2_FunctionSetting = 0
  1535. begin
  1536. select top 1 @ID_PurchaseOrderBill = PurchaseOrderBill.ID_PurchaseOrderBill
  1537. from PurchaseOrderBill
  1538. where ID_Supplier = @ID_Supplier
  1539. order by PurchaseOrderBill.Date_PurchaseOrderBill desc
  1540. select ReportComment.Comment_ReportComment from ReportComment where ReportComment.ID_Bill = @ID_PurchaseOrderBill
  1541. ORDER BY ReportComment.No_ReportComment
  1542. end
  1543. else
  1544. begin
  1545. SELECT Name_TypeDef as Comment_BillComment FROM TypeDef WHERE Type_TypeDef=26
  1546. end
  1547. end
  1548. ">
  1549. <Params>
  1550. <Param name="@ID_Supplier" type="PurchaseOrderBill.ID_Supplier" Index="0" />
  1551. </Params>
  1552. <Tables>
  1553. <Table name="TypeComment" />
  1554. </Tables>
  1555. </SearchTypeComment>
  1556. <SearchStockSettle CmdType="Text" CmdText="
  1557. Select * From StockSettleAccounts
  1558. Where DateDiff(Day,@Date_SaleOutDepotBill,FromDate_StockSettleAccounts) &lt;=0
  1559. And DateDiff(Day,@Date_SaleOutDepotBill,EndDate_StockSettleAccounts) &gt;=0
  1560. And Status_StockSettleAccounts=0
  1561. ">
  1562. <Params>
  1563. <Param name="@Date_SaleOutDepotBill" type="PurchaseInDepotBill.Date_SaleOutDepotBill" Index="0" />
  1564. </Params>
  1565. <Tables>
  1566. <Table name="StockSettle" />
  1567. </Tables>
  1568. </SearchStockSettle>
  1569. </Search>
  1570. </Server>
  1571. <Lables>
  1572. <Search>
  1573. Empty();
  1574. NewInstance();
  1575. tbNo.ReadOnly=false;
  1576. timeMake.Enabled=false;
  1577. refNo.ReadOnly=true;
  1578. cbLocation.Enabled=false;
  1579. tbNoSupplier.ReadOnly=true;
  1580. cbTaxCurrency.Enabled=false;
  1581. cbCurrency.Enabled=false;
  1582. arrivalDate.Enabled=false;
  1583. cbPrincipal.Enabled=false;
  1584. cbLinkman.Enabled=false;
  1585. cbTelephone.Enabled=false;
  1586. cbFax.Enabled=false;
  1587. dgProduct.ReadOnly=true;
  1588. dgRemark.ReadOnly=true;
  1589. dgReportComment.ReadOnly=true;
  1590. txtNumSum.CValue=0.00;
  1591. txtMoneySum.CValue=0.00;
  1592. txtTaxSum.CValue=0.00;
  1593. txtSum.CValue=0.00;
  1594. cbTaxCurrency.Text="";
  1595. #PurchaseOrderBill.Creator=DBNull();
  1596. #PurchaseOrderBill.ID_Creator=DBNull();
  1597. #PurchaseOrderBill.Assessor=DBNull();
  1598. #PurchaseOrderBill.ID_Assessor=DBNull();
  1599. #PurchaseOrderBill.AssessDate_PurchaseOrderBill=DBNull();
  1600. #PurchaseOrderBill.LastModUser_PurchaseOrderBill=DBNull();
  1601. #PurchaseOrderBill.LastModUser=DBNull();
  1602. #PurchaseOrderBill.LastModDate_PurchaseOrderBill=DBNull();
  1603. toolBar.EnableSubmit=false;
  1604. toolBar.EnableModify=false;
  1605. toolBar.EnableDelete=false;
  1606. toolBar.EnableAudit=false;
  1607. toolBar.EnableUnAudit=false;
  1608. toolBar.EnablePrint=false;
  1609. toolBar.EnableNew=GetRight(@Title,"新增");
  1610. toolBar.EnableExport = false;
  1611. toolBar.EnableImport = false;
  1612. UpdateForm(true,"");
  1613. tbNo.Focus();
  1614. @Status=0;
  1615. </Search>
  1616. <New>
  1617. Empty();
  1618. NewInstance();
  1619. tbNo.ReadOnly=true;
  1620. timeMake.Enabled=true;
  1621. refNo.ReadOnly=false;
  1622. cbLocation.Enabled=true;
  1623. tbNoSupplier.ReadOnly=false;
  1624. cbTaxCurrency.Enabled=true;
  1625. cbCurrency.Enabled=false;
  1626. arrivalDate.Enabled=true;
  1627. cbPrincipal.Enabled=true;
  1628. cbLinkman.Enabled=true;
  1629. cbTelephone.Enabled=true;
  1630. cbFax.Enabled=true;
  1631. dgProduct.ReadOnly=false;
  1632. dgRemark.ReadOnly=false;
  1633. dgReportComment.ReadOnly=false;
  1634. txtNumSum.CValue=0.00;
  1635. txtMoneySum.CValue=0.00;
  1636. txtTaxSum.CValue=0.00;
  1637. txtSum.CValue=0.00;
  1638. timeMake.Focus();
  1639. #PurchaseOrderBill.TaxCurrency_PurchaseOrderBill= "外加";
  1640. #PurchaseOrderBill.Currency_PurchaseOrderBill= @SysCurrency;
  1641. #PurchaseOrderBill.ID_PurchaseOrderBill=NewGuid();
  1642. #PurchaseOrderBill.Creator=GetCurrentUser();
  1643. #PurchaseOrderBill.ID_Creator=GetLoginUserID();
  1644. #PurchaseOrderBill.Assessor=DBNull();
  1645. #PurchaseOrderBill.ID_Assessor=DBNull();
  1646. #PurchaseOrderBill.AssessDate_PurchaseOrderBill=DBNull();
  1647. #PurchaseOrderBill.LastModUser=DBNull();
  1648. #PurchaseOrderBill.LastModUser_PurchaseOrderBill=DBNull();
  1649. #PurchaseOrderBill.LastModDate_PurchaseOrderBill=DBNull();
  1650. #PurchaseOrderBill.ID_Location=GetCurrentDepotID();
  1651. #PurchaseOrderBill.Name_Location=GetCurrentDepot();
  1652. #PurchaseOrderBill.No_Location=GetCurrentDepotNo();
  1653. #PurchaseOrderBill.Date_PurchaseOrderBill=GetCurrentTime();
  1654. toolBar.EnableSubmit=GetRight(@Title,"新增");
  1655. toolBar.EnableModify=false;
  1656. toolBar.EnableDelete=false;
  1657. toolBar.EnableAudit=false;
  1658. toolBar.EnableUnAudit=false;
  1659. toolBar.EnableNew=false;
  1660. toolBar.EnablePrint=false;
  1661. toolBar.EnableExport = false;
  1662. toolBar.EnableImport = true;
  1663. dgProduct.SetColumnReadOnly(1, false);
  1664. dgProduct.SetColumnReadOnly(2, false);
  1665. dgProduct.SetColumnReadOnly(3, false);
  1666. dgProduct.SetColumnReadOnly(4, false);
  1667. dgProduct.RowHeaderCheck=true;
  1668. dgProduct.AllowNew(true);
  1669. dgProduct.AllowDelete(true);
  1670. SetColumnDefaultValue("PurchaseOrderBillProduct", "Quantity_PurchaseOrderBillProduct",1 );
  1671. UpdateForm(true,"");
  1672. @Status=1;
  1673. </New>
  1674. <View>
  1675. tbNo.ReadOnly=false;
  1676. timeMake.Enabled=false;
  1677. refNo.ReadOnly=true;
  1678. cbLocation.Enabled=false;
  1679. tbNoSupplier.ReadOnly=true;
  1680. cbTaxCurrency.Enabled=false;
  1681. cbCurrency.Enabled=false;
  1682. arrivalDate.Enabled=false;
  1683. cbPrincipal.Enabled=false;
  1684. cbLinkman.Enabled=false;
  1685. cbTelephone.Enabled=false;
  1686. cbFax.Enabled=false;
  1687. dgProduct.ReadOnly=true;
  1688. dgRemark.ReadOnly=true;
  1689. dgReportComment.ReadOnly=true;
  1690. toolBar.EnableSubmit=false;
  1691. toolBar.EnablePrint=GetRight(@Title,"打印");
  1692. toolBar.EnableNew=GetRight(@Title,"新增");
  1693. if(Search("SearchStockSettle",#PurchaseOrderBill.Date_PurchaseOrderBill))
  1694. {
  1695. if(Equals(#PurchaseOrderBill.ID_Assessor, DBNull()))
  1696. {
  1697. toolBar.EnableAudit=GetRight(@Title,"审核");
  1698. toolBar.EnableUnAudit=false;
  1699. toolBar.EnableModify=GetRight(@Title,"修改");
  1700. toolBar.EnableDelete=GetRight(@Title,"删除");
  1701. }
  1702. else
  1703. {
  1704. toolBar.EnableAudit=false;
  1705. toolBar.EnableUnAudit=GetRight(@Title,"取消审核");
  1706. toolBar.EnableModify=false;
  1707. toolBar.EnableDelete=false;
  1708. }
  1709. }
  1710. else
  1711. {
  1712. toolBar.EnablePrint=false;
  1713. toolBar.EnableAudit=false;
  1714. toolBar.EnableUnAudit=false;
  1715. toolBar.EnableModify=false;
  1716. toolBar.EnableDelete=false;
  1717. }
  1718. toolBar.EnableExport = true;
  1719. toolBar.EnableImport = false;
  1720. tbNo.Focus();
  1721. UpdateForm(true, "");
  1722. @Status=2;
  1723. </View>
  1724. <Modify>
  1725. tbNo.ReadOnly=true;
  1726. timeMake.Enabled=false;
  1727. refNo.ReadOnly=false;
  1728. cbLocation.Enabled=true;
  1729. tbNoSupplier.ReadOnly=false;
  1730. cbCurrency.Enabled=false;
  1731. arrivalDate.Enabled=true;
  1732. cbPrincipal.Enabled=true;
  1733. cbLinkman.Enabled=true;
  1734. cbTelephone.Enabled=true;
  1735. cbFax.Enabled=true;
  1736. dgProduct.ReadOnly=false;
  1737. dgRemark.ReadOnly=false;
  1738. dgReportComment.ReadOnly=false;
  1739. #PurchaseOrderBill.LastModUser=GetCurrentUser();
  1740. #PurchaseOrderBill.LastModUser_PurchaseOrderBill=GetLoginUserID();
  1741. #PurchaseOrderBill.LastModDate_PurchaseOrderBill=GetCurrentTime();
  1742. toolBar.EnableSubmit=GetRight(@Title,"修改");
  1743. toolBar.EnableModify=false;
  1744. toolBar.EnableDelete=false;
  1745. toolBar.EnableAudit=false;
  1746. toolBar.EnableUnAudit=false;
  1747. toolBar.EnableNew=false;
  1748. toolBar.EnablePrint=false;
  1749. toolBar.EnableExport = false;
  1750. toolBar.EnableImport = false;
  1751. @HaveAccessed = !Equals(#PurchaseOrderBill.AssessDate_PurchaseOrderBill,DBNull());
  1752. dgProduct.SetColumnReadOnly(1, @HaveAccessed);
  1753. dgProduct.SetColumnReadOnly(2, @HaveAccessed);
  1754. dgProduct.SetColumnReadOnly(3, @HaveAccessed);
  1755. dgProduct.SetColumnReadOnly(4, @HaveAccessed);
  1756. dgProduct.AllowNew(!@HaveAccessed);
  1757. dgProduct.AllowDelete(!@HaveAccessed);
  1758. dgProduct.RowHeaderCheck=!@HaveAccessed;
  1759. SetColumnDefaultValue("PurchaseOrderBillProduct", "Quantity_PurchaseOrderBillProduct",1 );
  1760. @HaveAccessed = !Equals(#PurchaseOrderBill.AssessDate_PurchaseOrderBill,DBNull());
  1761. if(@HaveAccessed)
  1762. cbTaxCurrency.Enabled = false;
  1763. else
  1764. cbTaxCurrency.Enabled = true;
  1765. UpdateForm(true, "");
  1766. @Status=3;
  1767. </Modify>
  1768. <SubmitButtonClick>
  1769. <![CDATA[
  1770. if(!Search("SearchStockSettle",timeMake.Value))
  1771. {
  1772. MessageBox("制单日期不在开帐区间内,提交失败!");
  1773. return;
  1774. }
  1775. if(!Search("SearchSupplier",tbNoSupplier.CValue)|| !Equals(#PurchaseOrderBill.ID_Supplier,#Supplier.ID_Supplier))
  1776. {
  1777. MessageBox("请输入有效的供应商,回车以示确认!",@Title);
  1778. tbDetail.SelectedIndex = 0;
  1779. tbNoSupplier.Focus();
  1780. return;
  1781. }
  1782. if (!cbLocation.CheckSelectedItem())
  1783. {
  1784. MessageBox("请选择有效的入库仓库!",@Title);
  1785. tbDetail.SelectedIndex = 0;
  1786. cbLocation.Focus();
  1787. return;
  1788. }
  1789. if (!cbTaxCurrency.CheckSelectedItem())
  1790. {
  1791. MessageBox("请选择有效的税别!",@Title);
  1792. tbDetail.SelectedIndex = 0;
  1793. cbTaxCurrency.Focus();
  1794. return;
  1795. }
  1796. if (!cbPrincipal.CheckSelectedItem())
  1797. {
  1798. MessageBox("请选择有效的负责业务!",@Title);
  1799. tbDetail.SelectedIndex = 0;
  1800. cbPrincipal.Focus();
  1801. return;
  1802. }
  1803. if(RowCount("#PurchaseOrderBillProduct")==0)
  1804. {
  1805. MessageBox("请输入采购产品!",@Title);
  1806. tbDetail.SelectedIndex = 1;
  1807. dgProduct.Focus();
  1808. return;
  1809. }
  1810. UpdateForm(false, "");
  1811. SuspendLayout();
  1812. for(@i=0;@i<RowCount("#PurchaseOrderBillProduct");@i=@i+1)
  1813. {
  1814. SetPosition("#PurchaseOrderBillProduct",@i);
  1815. if (#PurchaseOrderBillProduct.Type_FromBill != 0 &&#PurchaseOrderBillProduct.No_FromBill!=StringEmpty() && Search("SearchPurchaseQueryBill",#PurchaseOrderBillProduct.No_FromBill))
  1816. {
  1817. if (Equals(#PurchaseQueryBill.ID_Assessor,DBNull()))
  1818. {
  1819. tbDetail.SelectedIndex = 1;
  1820. dgProduct.CurrentRowIndex = @i;
  1821. @ClickResult = MessageBox("该来源单据未经审核,确定要保留来源单据资料吗?",@Title,MB_YESNOCANCEL);
  1822. if (@ClickResult == DialogResult("CANCEL"))
  1823. {
  1824. dgProduct.Focus();
  1825. ResumeLayout();
  1826. return;
  1827. }
  1828. else if (@ClickResult == DialogResult("NO"))
  1829. {
  1830. #PurchaseOrderBillProduct.Name_BillType = "";
  1831. #PurchaseOrderBillProduct.Type_FromBill = 0;
  1832. #PurchaseOrderBillProduct.No_FromBill = "";
  1833. #PurchaseOrderBillProduct.No_FromBillProduct = "";
  1834. }
  1835. }
  1836. }
  1837. if(Equals(#PurchaseOrderBillProduct.No_Product,""))
  1838. {
  1839. tbDetail.SelectedIndex = 1;
  1840. dgProduct.CurrentRowIndex=@i;
  1841. MessageBox("请输入产品编号!",@Title);
  1842. ResumeLayout();
  1843. return;
  1844. }
  1845. if(Equals(#PurchaseOrderBillProduct.ID_Product,GuidEmpty()))
  1846. {
  1847. tbDetail.SelectedIndex = 1;
  1848. dgProduct.CurrentRowIndex=@i;
  1849. MessageBox("该产品不存在!",@Title);
  1850. ResumeLayout();
  1851. return;
  1852. }
  1853. if(#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct<=0)
  1854. {
  1855. tbDetail.SelectedIndex = 1;
  1856. dgProduct.CurrentRowIndex=@i;
  1857. MessageBox("数量不得小于等于0!",@Title);
  1858. ResumeLayout();
  1859. return;
  1860. }
  1861. if(#PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct<0)
  1862. {
  1863. tbDetail.SelectedIndex = 1;
  1864. dgProduct.CurrentRowIndex=@i;
  1865. MessageBox("单价不得小于0!",@Title);
  1866. ResumeLayout();
  1867. return;
  1868. }
  1869. if(Equals(#PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct,GuidEmpty()))
  1870. {
  1871. #PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct=NewGuid();
  1872. }
  1873. #PurchaseOrderBillProduct.ID_PurchaseOrderBill=#PurchaseOrderBill.ID_PurchaseOrderBill;
  1874. }
  1875. for(@j=0;@j<RowCount("#BillComment");@j++)
  1876. {
  1877. SetPosition("#BillComment",@j);
  1878. if(Equals(#BillComment.ID_BillComment,GuidEmpty()))
  1879. {
  1880. #BillComment.ID_BillComment=NewGuid();
  1881. }
  1882. #BillComment.ID_Bill=#PurchaseOrderBill.ID_PurchaseOrderBill;
  1883. }
  1884. for(@j=0;@j<RowCount("#ReportComment");@j++)
  1885. {
  1886. SetPosition("#ReportComment",@j);
  1887. if(Equals(#ReportComment.ID_ReportComment,GuidEmpty()))
  1888. {
  1889. #ReportComment.ID_ReportComment=NewGuid();
  1890. }
  1891. #ReportComment.ID_Bill=#PurchaseOrderBill.ID_PurchaseOrderBill;
  1892. }
  1893. ResumeLayout();
  1894. if(@Status==1)
  1895. { #PurchaseOrderBill.CreateDate_PurchaseOrderBill=GetCurrentTime();
  1896. #PurchaseOrderBill.No_PurchaseOrderBill = New("PurchaseOrderBill.No_PurchaseOrderBill",timeMake.CValue);
  1897. }
  1898. else if(@Status==3)
  1899. {
  1900. #PurchaseOrderBill.LastModUser=GetCurrentUser();
  1901. #PurchaseOrderBill.LastModUser_PurchaseOrderBill=GetLoginUserID();
  1902. #PurchaseOrderBill.LastModDate_PurchaseOrderBill=GetCurrentTime();
  1903. Update();
  1904. }
  1905. ChangeMode("View");
  1906. ]]>
  1907. </SubmitButtonClick>
  1908. <CountSum>
  1909. <![CDATA[
  1910. if (RowCount("#PurchaseOrderBillProduct") == 0)
  1911. {
  1912. txtNumSum.CValue=0;
  1913. txtMoneySum.CValue=0;;
  1914. txtTaxSum.CValue=0;
  1915. txtSum.CValue=0;
  1916. }
  1917. else
  1918. {
  1919. txtNumSum.CValue = SumOfCol("#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct");
  1920. switch (cbTaxCurrency.SelectedName)
  1921. {
  1922. case "外加":
  1923. txtMoneySum.CValue=SumOfCol("#PurchaseOrderBillProduct.Money");
  1924. txtTaxSum.CValue=FormatNumber(txtMoneySum.CValue*@CessIn,@PriceDecimal);
  1925. txtSum.CValue=txtMoneySum.CValue+txtTaxSum.CValue;
  1926. break;
  1927. case "内含":
  1928. txtSum.CValue=SumOfCol("#PurchaseOrderBillProduct.Money");
  1929. txtMoneySum.CValue=FormatNumber(txtSum.CValue/(1+@CessIn),@PriceDecimal);
  1930. txtTaxSum.CValue=txtSum.CValue-txtMoneySum.CValue;
  1931. break;
  1932. case "零税":
  1933. case "免税":
  1934. txtMoneySum.CValue=SumOfCol("#PurchaseOrderBillProduct.Money");
  1935. txtTaxSum.CValue=0;
  1936. txtSum.CValue=txtMoneySum.CValue+txtTaxSum.CValue;
  1937. break;
  1938. }
  1939. UpdateForm(false, "txtMoneySum");
  1940. UpdateForm(false, "txtTaxSum");
  1941. UpdateForm(false, "txtSum");
  1942. }
  1943. ]]>
  1944. </CountSum>
  1945. <AuditLable>
  1946. <![CDATA[
  1947. SuspendLayout();
  1948. for (@i=0;@i<RowCount("#PurchaseOrderBillProduct");@i=@i+1)
  1949. {
  1950. SetPosition("#PurchaseOrderBillProduct", @i);
  1951. if (#PurchaseOrderBillProduct.Type_FromBill != 0 && #PurchaseOrderBillProduct.No_FromBill!=StringEmpty() && Search("SearchPurchaseQueryBill",#PurchaseOrderBillProduct.No_FromBill))
  1952. {
  1953. if (Equals(#PurchaseQueryBill.ID_Assessor,DBNull()))
  1954. {
  1955. tbDetail.SelectedIndex = 1;
  1956. dgProduct.CurrentRowIndex = @i;
  1957. @ClickResult = MessageBox("该来源单据未经审核,确定要审核吗?",@Title,MB_OKCANCEL);
  1958. if (@ClickResult == DialogResult("CANCEL"))
  1959. {
  1960. dgProduct.Focus();
  1961. ResumeLayout();
  1962. return;
  1963. }
  1964. }
  1965. }
  1966. }
  1967. ResumeLayout();
  1968. ]]>
  1969. BeginAudit();
  1970. #PurchaseOrderBill.ID_Assessor=GetLoginUserID();
  1971. #PurchaseOrderBill.Assessor=GetCurrentUser();
  1972. #PurchaseOrderBill.AssessDate_PurchaseOrderBill=DateTimeNow();
  1973. Audit();
  1974. ChangeMode("View");
  1975. EndAudit();
  1976. <Lable name="CountSum"/>
  1977. </AuditLable>
  1978. </Lables>
  1979. </Form>
  1980. </Forms>