FrmPurchaseInvoice.xml 73 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Forms>
  3. <Form Name="FrmPurchaseInvoice">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @Title="进项发票";
  9. GetSchema();
  10. Search("SearchCessIn");
  11. Search("SearchPurchaseOrderBillProduct","p","p");
  12. Search("SearchPurchaseInDepotBillProduct","p","p");
  13. Search("SearchProduct","p");
  14. @CessIn=#SystemSetting.CessIn_SystemSetting/100;
  15. @PriceDecimal=#SystemSetting.PriceDecimal_SystemSetting;
  16. SetColumnDefaultValue("PurchaseInvoiceProduct", "TaxRate_PurchaseInvoiceProduct",@CessIn);
  17. ChangeMode("Search");
  18. Search("SearchBillType");
  19. ]]>
  20. </Load>
  21. <Closing>
  22. ;<!--TODO-->
  23. </Closing>
  24. <Closed>
  25. ;<!--TODO-->
  26. </Closed>
  27. </Events>
  28. <Mode>
  29. <Search>
  30. <Lable name="Search" />
  31. </Search>
  32. <New>
  33. <Lable name="New" />
  34. </New>
  35. <View>
  36. <Lable name="View" />
  37. </View>
  38. <Modify>
  39. <Lable name="Modify" />
  40. </Modify>
  41. </Mode>
  42. <Controls>
  43. <IKTextButton name="tbNo" DataSource="PurchaseInvoice.No_PurchaseInvoice">
  44. <Events>
  45. <Enter>
  46. if(tbNo.ReadOnly == false)
  47. {
  48. if(tbNo.CValue != StringEmpty())
  49. {
  50. UpdateForm(false, "");
  51. if(Search("SearchPurchaseInvoiceWithNo", tbNo.CValue))
  52. {
  53. ChangeMode("View",#PurchaseInvoice.ID_Assessor);
  54. if(#PurchaseInvoice.Disable_PurchaseInvoice==true)
  55. ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)";
  56. <Lable name="CountSum"/>
  57. }
  58. else
  59. {
  60. MessageBox("该进项发票不存在!",@Title);
  61. }
  62. }
  63. else
  64. {
  65. MessageBox("请输入进项发票单号!", @Title);
  66. }
  67. }
  68. </Enter>
  69. <Click>
  70. ShowSearchBox("BillSearch","NODEPOT", "tbNo", tbNo.CValue);
  71. </Click>
  72. </Events>
  73. </IKTextButton>
  74. <IKDataTimePicker name="dtDate" DataSource="PurchaseInvoice.Date_PurchaseInvoice" />
  75. <IKCheckBox name="ckIncludeTax" DataSource="PurchaseInvoice.IncludeTax_PurchaseInvoice" >
  76. <Events>
  77. <CheckedChanged>
  78. if(RowCount("#PurchaseInvoiceProduct") &gt; 0)
  79. {
  80. SuspendLayout();
  81. for(@j=0;@j &lt; RowCount("#PurchaseInvoiceProduct");@j++)
  82. {
  83. SetPosition("#PurchaseInvoiceProduct",@j);
  84. <Lable name="CountAmount"/>
  85. }
  86. ResumeLayout();
  87. }
  88. <Lable name="CountSum"/>
  89. </CheckedChanged>
  90. </Events>
  91. </IKCheckBox>
  92. <IKComboBoxEx name="cbType" DisplaySource="PurchaseInvoice.TypeName">
  93. <Events>
  94. <SelectedIndexChanged>
  95. #PurchaseInvoice.Type_PurchaseInvoice=cbType.SelectedIndex;
  96. </SelectedIndexChanged>
  97. </Events>
  98. </IKComboBoxEx>
  99. <IKDataTimePicker name="dtInvoiceDate" DataSource="PurchaseInvoice.InvoiceDate_PurchaseInvoice" />
  100. <IKTextBox name="txtInvoiceNo" DataSource="PurchaseInvoice.No_Invoice"/>
  101. <IKButton name="btnModify">
  102. <Events>
  103. <Click>
  104. if(Equals(btnModify.Text,"修改"))
  105. {
  106. txtInvoiceNo.ReadOnly=false;
  107. btnModify.Text="保存";
  108. }
  109. else
  110. {
  111. if(Equals(txtInvoiceNo.CValue,""))
  112. {
  113. MessageBox("请填入发票编号!",@Title);
  114. txtInvoiceNo.Focus();
  115. }
  116. else
  117. {
  118. if(Search("SearchInvoiceNo",txtInvoiceNo.CValue,#PurchaseInvoice.No_PurchaseInvoice))
  119. {
  120. MessageBox("此发票号码已存在,请重新填入发票编号!",@Title);
  121. txtInvoiceNo.Focus();
  122. return;
  123. }
  124. else
  125. {
  126. #PurchaseInvoice.LastModUser=GetCurrentUser();
  127. #PurchaseInvoice.LastModUser_PurchaseInvoice=GetLoginUserID();
  128. #PurchaseInvoice.LastModDate_PurchaseInvoice=GetCurrentTime();
  129. UpdateForm(false,"");
  130. #PurchaseInvoice.Type_PurchaseInvoice=cbType.SelectedIndex;
  131. Update();
  132. txtInvoiceNo.ReadOnly=true;
  133. btnModify.Text="修改";
  134. }
  135. }
  136. }
  137. </Click>
  138. </Events>
  139. </IKButton>
  140. <IKTextBox name="txtMaker" DataSource="PurchaseInvoice.Creator" />
  141. <IKTextButton name="tbSupplierNo" DataSource="PurchaseInvoice.No_Supplier" >
  142. <Events>
  143. <Enter>
  144. UpdateForm(false,"");
  145. if(tbSupplierNo.CValue!=StringEmpty())
  146. {
  147. if(!Search("SearchSupplier",tbSupplierNo.CValue))
  148. {
  149. MessageBox("该供应商不存在!",@Title);
  150. @temp = ShowSearchBox("SupplierSearch","INFOMATION",tbSupplierNo.CValue);
  151. if(@temp != "")
  152. {
  153. tbSupplierNo.CValue = @temp;
  154. ActiveControlEvent("tbSupplierNo", "Enter");
  155. }
  156. }
  157. else
  158. {
  159. if(!Equals(#Supplier.SuspendDate_Supplier,DBNull()))
  160. {
  161. MessageBox("该供应商已暂停!",@Title);
  162. }
  163. #PurchaseInvoice.ID_Supplier=#Supplier.ID_Supplier;
  164. #PurchaseInvoice.ShortName_Supplier=#Supplier.ShortName_Supplier;
  165. }
  166. }
  167. else
  168. {
  169. MessageBox("请输入供应商编号!",@Title);
  170. #PurchaseInvoice.ID_Supplier=GuidEmpty();
  171. #PurchaseInvoice.ShortName_Supplier="";
  172. tbSupplierNo.Focus();
  173. }
  174. UpdateForm(true,"");
  175. </Enter>
  176. <Click>
  177. <![CDATA[
  178. if (tbSupplierNo.ReadOnly == false)
  179. {
  180. @temp = ShowSearchBox("SupplierSearch","INFOMATION",tbSupplierNo.CValue);
  181. if( @temp == "" )
  182. return;
  183. tbSupplierNo.CValue = @temp;
  184. ActiveControlEvent("tbSupplierNo", "Enter");
  185. }
  186. ]]>
  187. </Click>
  188. </Events>
  189. </IKTextButton>
  190. <IKTextBox name="txtSupplierName" DataSource="PurchaseInvoice.ShortName_Supplier"/>
  191. <IKDataTimePicker name="dtPayDate" DataSource="PurchaseInvoice.PayDate_PurchaseInvoice" />
  192. <IKTextBox name="txtAssessor" DataSource="PurchaseInvoice.Assessor" />
  193. <IKDateTimeText name="dtAssessDate" DataSource="PurchaseInvoice.AssessDate_PurchaseInvoice" />
  194. <IKTextBox name="txtLastModUser" DataSource="PurchaseInvoice.LastModUser"/>
  195. <IKDateTimeText name="dtLastModDate" DataSource="PurchaseInvoice.LastModDate_PurchaseInvoice"/>
  196. <IKTextBox name="txtComment" DataSource="PurchaseInvoice.Comment_PurchaseInvoice"/>
  197. <IKNumericTextBox name="txtSum" DataSource="PurchaseInvoice.Amount_PurchaseInvoice"/>
  198. <IKNumericTextBox name="txtMoneySum" DataSource="PurchaseInvoice.GoodsAmount_PurchaseInvoice"/>
  199. <IKNumericTextBox name="txtTaxSum" DataSource="PurchaseInvoice.TaxAmount_PurchaseInvoice"/>
  200. <IKDataGridEx name="dgProduct" DataSource="PurchaseInvoiceProduct" TableStyleIndex="0">
  201. <DataColumn Index="0" DataSource="PurchaseInvoiceProduct.Name_BillType" >
  202. <IKDataGridComboBoxColumn DisplaySourceEx="PurchaseInvoiceProduct.Name_BillType" ValueSourceEx="PurchaseInvoiceProduct.Type_FromBill" DataSourceEx="BillType" DisplayMemberEx="Name_BillType" ValueMemberEx="Value_BillType">
  203. <Events>
  204. <Reload>
  205. Search("SearchBillType");
  206. SetDataGridColumnDataSource(0,"dgProduct");
  207. </Reload>
  208. </Events>
  209. </IKDataGridComboBoxColumn>
  210. </DataColumn>
  211. <DataColumn Index="1" DataSource="PurchaseInvoiceProduct.No_FromBill" />
  212. <DataColumn Index="2" DataSource="PurchaseInvoiceProduct.No_FromBillProduct" />
  213. <DataColumn Index="3" DataSource="PurchaseInvoiceProduct.No_Product">
  214. <IKDataGridTextButtonColumn>
  215. <Events>
  216. <Click>
  217. ShowSearchBox("ProductSearch","INFOMATION",#PurchaseInvoiceProduct.No_Product);
  218. </Click>
  219. </Events>
  220. </IKDataGridTextButtonColumn>
  221. </DataColumn>
  222. <DataColumn Index="4" DataSource="PurchaseInvoiceProduct.Name_Product" />
  223. <DataColumn Index="5" DataSource="PurchaseInvoiceProduct.InvoiceName_Product" />
  224. <DataColumn Index="6" DataSource="PurchaseInvoiceProduct.Unit_Product" />
  225. <DataColumn Index="7" DataSource="PurchaseInvoiceProduct.Quantity_PurchaseInvoiceProduct" />
  226. <DataColumn Index="8" DataSource="PurchaseInvoiceProduct.UnitPrice_PurchaseInvoiceProduct" />
  227. <DataColumn Index="9" DataSource="PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct" />
  228. <DataColumn Index="10" DataSource="PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct" />
  229. <DataColumn Index="11" DataSource="PurchaseInvoiceProduct.TaxAmount_PurchaseInvoiceProduct" />
  230. <DataColumn Index="12" DataSource="PurchaseInvoiceProduct.Comment_PurchaseInvoiceProduct" />
  231. </IKDataGridEx>
  232. <IKFormToolBar name="toolBar">
  233. <Events>
  234. <ClickFirst>
  235. if(Search("SearchPurchaseInvoiceFirst"))
  236. {
  237. ChangeMode("View",#PurchaseInvoice.ID_Assessor);
  238. if(#PurchaseInvoice.Disable_PurchaseInvoice==true)
  239. ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)";
  240. <Lable name="CountSum"/>
  241. }
  242. </ClickFirst>
  243. <ClickPrev>
  244. if(Search("SearchPurchaseInvoicePrevious", tbNo.CValue))
  245. {
  246. ChangeMode("View",#PurchaseInvoice.ID_Assessor);
  247. if(#PurchaseInvoice.Disable_PurchaseInvoice==true)
  248. ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)";
  249. <Lable name="CountSum"/>
  250. }
  251. </ClickPrev>
  252. <ClickNext>
  253. if(Search("SearchPurchaseInvoiceNext",tbNo.CValue))
  254. {
  255. ChangeMode("View",#PurchaseInvoice.ID_Assessor);
  256. if(#PurchaseInvoice.Disable_PurchaseInvoice==true)
  257. ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)";
  258. <Lable name="CountSum"/>
  259. }
  260. </ClickNext>
  261. <ClickLast>
  262. if(Search("SearchPurchaseInvoiceLast"))
  263. {
  264. ChangeMode("View",#PurchaseInvoice.ID_Assessor);
  265. if(#PurchaseInvoice.Disable_PurchaseInvoice==true)
  266. ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)";
  267. <Lable name="CountSum"/>
  268. }
  269. </ClickLast>
  270. <ClickNew>
  271. <![CDATA[
  272. @NextNo = GetNextAutoNumber(true);
  273. if (!Equals(@NextNo, ""))
  274. {
  275. ChangeMode("New");
  276. #PurchaseInvoice.No_PurchaseInvoice= @NextNo;
  277. UpdateForm(true, "tbNo");
  278. }
  279. ]]>
  280. </ClickNew>
  281. <ClickEmpty>
  282. ChangeMode("Search");
  283. </ClickEmpty>
  284. <ClickSubmit>
  285. <Lable name="SubmitButtonClick" />
  286. </ClickSubmit>
  287. <ClickModify>
  288. ChangeMode("Modify");
  289. <Lable name="CountSum"/>
  290. </ClickModify>
  291. <ClickDelete>
  292. Delete(); ChangeMode("Search");
  293. </ClickDelete>
  294. <ClickBlank>
  295. BeginBlank();
  296. #PurchaseInvoice.Disable_PurchaseInvoice=true;
  297. Blank();
  298. EndBlank();
  299. ChangeMode("View",#PurchaseInvoice.ID_Assessor);
  300. if(#PurchaseInvoice.Disable_PurchaseInvoice==true)
  301. ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)";
  302. <Lable name="CountSum"/>
  303. </ClickBlank>
  304. <ClickPrint>
  305. ShowPrintBox("BillSearch",#PurchaseInvoice.No_PurchaseInvoice,#PurchaseInvoice.No_PurchaseInvoice);
  306. </ClickPrint>
  307. <ClickAudit>
  308. <![CDATA[
  309. SuspendLayout();
  310. for (@i=0;@i<RowCount("#PurchaseInvoiceProduct");@i=@i+1)
  311. {
  312. SetPosition("#PurchaseInvoiceProduct", @i);
  313. if(Equals(#PurchaseInvoiceProduct.Name_BillType,"采购入库单"))
  314. {
  315. if(Search("SearchPurchaseInDepotBill",#PurchaseInvoiceProduct.No_FromBill,#PurchaseInvoiceProduct.No_FromBillProduct))
  316. {
  317. if(Equals(#PurchaseInDepotBill.ID_Assessor,DBNull()))
  318. {
  319. tbDetail.SelectedIndex = 1;
  320. dgProduct.CurrentRowIndex=@i;
  321. MessageBox("该来源单据未经审核,提交失败!",@Title);
  322. ResumeLayout();
  323. return;
  324. }
  325. if(!Equals(#PurchaseInDepotBill.ID_Supplier,#PurchaseInvoice.ID_Supplier))
  326. {
  327. tbDetail.SelectedIndex = 1;
  328. dgProduct.CurrentRowIndex=@i;
  329. MessageBox("该来源单据的供应商与本进项发票的供应商不一致,提交失败!",@Title);
  330. ResumeLayout();
  331. return;
  332. }
  333. }
  334. }
  335. if(Equals(#PurchaseInvoiceProduct.Name_BillType,"采购订单"))
  336. {
  337. if(Search("SearchPurchaseOrderBill",#PurchaseInvoiceProduct.No_FromBill,#PurchaseInvoiceProduct.No_FromBillProduct))
  338. {
  339. if(Equals(#PurchaseOrderBill.ID_Assessor,DBNull()))
  340. {
  341. tbDetail.SelectedIndex = 1;
  342. dgProduct.CurrentRowIndex=@i;
  343. MessageBox("该来源单据未经审核,提交失败!",@Title);
  344. ResumeLayout();
  345. return;
  346. }
  347. if(!Equals(#PurchaseOrderBill.ID_Supplier,#PurchaseInvoice.ID_Supplier))
  348. {
  349. tbDetail.SelectedIndex = 1;
  350. dgProduct.CurrentRowIndex=@i;
  351. MessageBox("该来源单据的供应商与本进项发票的供应商不一致,提交失败!",@Title);
  352. ResumeLayout();
  353. return;
  354. }
  355. }
  356. }
  357. }
  358. ResumeLayout();
  359. ]]>
  360. BeginAudit();
  361. #PurchaseInvoice.ID_Assessor=GetLoginUserID();
  362. #PurchaseInvoice.Assessor=GetCurrentUser();
  363. #PurchaseInvoice.AssessDate_PurchaseInvoice=DateTimeNow();
  364. Audit();
  365. ChangeMode("View",#PurchaseInvoice.ID_Assessor);
  366. EndAudit();
  367. <Lable name="CountSum"/>
  368. </ClickAudit>
  369. <ClickUnAudit>
  370. BeginUnAudit();
  371. #PurchaseInvoice.ID_Assessor=DBNull();
  372. #PurchaseInvoice.Assessor=DBNull();
  373. #PurchaseInvoice.AssessDate_PurchaseInvoice=DataTimeNow();
  374. UnAudit();
  375. ChangeMode("View",#PurchaseInvoice.ID_Assessor);
  376. EndUnAudit();
  377. <Lable name="CountSum"/>
  378. </ClickUnAudit>
  379. <ClickImportItem>
  380. <![CDATA[
  381. if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="采购订单")
  382. {
  383. if(Search("SearchContr"))
  384. {
  385. ShowSearchBox("ImportPurchaseOrderBillControl","BILLCONVERTEX","#PurchaseInvoiceProduct.Type_FromBill",41,"#PurchaseInvoiceProduct.Name_BillType","采购订单");
  386. }
  387. else
  388. {
  389. ShowSearchBox("ImportPurchaseOrderBillUnControl","BILLCONVERTEX");
  390. }
  391. }
  392. else if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="采购入库单")
  393. {
  394. ShowSearchBox("ImportPurchaseInDepotBill","BILLCONVERTEX","#PurchaseInvoiceProduct.Type_FromBill",1,"#PurchaseInvoiceProduct.Name_BillType","采购入库单");
  395. }
  396. ]]>
  397. <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
  398. </ClickImportItem>
  399. <ClickExport>
  400. ;
  401. </ClickExport>
  402. <ClickClose>
  403. ;
  404. </ClickClose>
  405. <ClickExpand>
  406. ;
  407. </ClickExpand>
  408. </Events>
  409. </IKFormToolBar>
  410. </Controls>
  411. <Tables>
  412. <Table name="PurchaseInvoiceProduct">
  413. <Events>
  414. <ColumnsChanged>
  415. <Name_BillType>
  416. <Lable name="FromBillChange"/>
  417. <Lable name="CountSum" />
  418. </Name_BillType>
  419. <No_FromBill>
  420. <Lable name="FromBillChange"/>
  421. <Lable name="CountSum" />
  422. </No_FromBill>
  423. <No_FromBillProduct>
  424. <Lable name="FromBillChange"/>
  425. <Lable name="CountSum" />
  426. </No_FromBillProduct>
  427. <No_Product>
  428. if(Equals(#PurchaseInvoiceProduct.No_Product,"") || !Search("SearchProduct",#PurchaseInvoiceProduct.No_Product))
  429. {
  430. if(!Equals(#PurchaseInvoiceProduct.No_Product,""))
  431. MessageBox("该产品不存在!",@Title);
  432. #PurchaseInvoiceProduct.ID_Product=GuidEmpty();
  433. #PurchaseInvoiceProduct.Name_Product="";
  434. #PurchaseInvoiceProduct.Unit_Product="";
  435. #PurchaseInvoiceProduct.UnitPrice_PurchaseInvoiceProduct=0.00;
  436. #PurchaseInvoiceProduct.InvoiceName_Product="";
  437. @temp = ShowSearchBox("InputSearchProduct","INFOMATION",#PurchaseInvoiceProduct.No_Product);
  438. if(@temp != "")
  439. {
  440. ResumeColumnEvent("#PurchaseInvoiceProduct.No_Product");
  441. #PurchaseInvoiceProduct.No_Product = @temp;
  442. ClearColumnEvent();
  443. }
  444. }
  445. else
  446. {
  447. #PurchaseInvoiceProduct.ID_Product=#Product.ID_Product;
  448. #PurchaseInvoiceProduct.Name_Product=#Product.Name_Product;
  449. #PurchaseInvoiceProduct.Unit_Product=#Product.Unit_Product;
  450. #PurchaseInvoiceProduct.UnitPrice_PurchaseInvoiceProduct=#Product.Price_Product;
  451. #PurchaseInvoiceProduct.InvoiceName_Product=#Product.InvoiceName_Product;
  452. }
  453. <Lable name="CountAmount"/>
  454. <Lable name="CountSum"/>
  455. </No_Product>
  456. <Quantity_PurchaseInvoiceProduct>
  457. <Lable name="CountAmount"/>
  458. <Lable name="CountSum"/>
  459. </Quantity_PurchaseInvoiceProduct>
  460. <UnitPrice_PurchaseInvoiceProduct>
  461. <Lable name="CountAmount"/>
  462. <Lable name="CountSum"/>
  463. </UnitPrice_PurchaseInvoiceProduct>
  464. <TaxRate_PurchaseInvoiceProduct>
  465. <Lable name="CountAmount"/>
  466. <Lable name="CountSum"/>
  467. </TaxRate_PurchaseInvoiceProduct>
  468. </ColumnsChanged>
  469. <RowDeleted>
  470. <Lable name="CountSum"/>
  471. </RowDeleted>
  472. </Events>
  473. </Table>
  474. </Tables>
  475. <LockInfomation LockID="ID_PurchaseInvoice" LockNO="No_PurchaseInvoice" LockSearchFunction="SearchPurchaseInvoiceWithNo" LockAudit="ID_Assessor" LockBlank="Disable_PurchaseInvoice"/>
  476. <LogInfomation LogNO="#PurchaseInvoice.No_PurchaseInvoice" RecordFormField="发票号码:#PurchaseInvoice.No_Invoice,供应商编号:#PurchaseInvoice.No_Supplier" RecordDataGridField="#PurchaseInvoiceProduct.No_Product,#PurchaseInvoiceProduct.Quantity_PurchaseInvoiceProduct,#PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct"/>
  477. <ChildForms>
  478. <ChildForm name="BillSearch" DataSource="PurchaseInvoice" SearchFunction="SearchAllBill" SearchFunctionByNo="SearchPurchaseInvoiceWithNo">
  479. <DataColumn Index="0" MappingName="#PurchaseInvoice.No_PurchaseInvoice" HeaderText="进项发票单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  480. <DataColumn Index="1" MappingName="#PurchaseInvoice.Date_PurchaseInvoice" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  481. <DataColumn Index="2" MappingName="#PurchaseInvoice.ShortName_Supplier" HeaderText="供应商简称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  482. </ChildForm>
  483. <ChildForm name="SupplierSearch" DataSource="Supplier" SearchFunction="SearchAllSupplier" SearchFunctionByNo="" MappingName="供应商">
  484. <DataColumn Index="0" MappingName="#Supplier.No_Supplier" HeaderText="供应商编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  485. <DataColumn Index="1" MappingName="#Supplier.ShortName_Supplier" HeaderText="供应商简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  486. </ChildForm>
  487. <ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品" ReturnDataSource="PurchaseInvoiceProduct" ShowCheckBox="true">
  488. <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnMappingName="#PurchaseInvoiceProduct.No_Product"/>
  489. <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  490. </ChildForm>
  491. <ChildForm name="InputSearchProduct" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品">
  492. <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  493. <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  494. </ChildForm>
  495. <ChildForm name="ImportPurchaseOrderBillControl" >
  496. <DataGridIndex DataSource="PurchaseOrderBill" SearchFunction="SearchAllPurchaseOrderBill" SearchFunctionStandby="SearchAllPurchaseOrderBillProduct" SearchFunctionByNo="" MappingName="" ReturnDataSource="PurchaseInvoiceProduct">
  497. <DataColumn Index="0" MappingName="#PurchaseOrderBill.No_PurchaseOrderBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseInvoiceProduct.No_FromBill"/>
  498. <DataColumn Index="1" MappingName="#PurchaseOrderBill.Date_PurchaseOrderBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  499. <DataColumn Index="2" MappingName="#PurchaseOrderBill.No_Supplier" HeaderText="供应商编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseInvoice.No_Supplier"/>
  500. <DataColumn Index="3" MappingName="#PurchaseOrderBill.ShortName_Supplier" HeaderText="供应商简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  501. <DataColumn Index="4" MappingName="#PurchaseOrderBill.State_PurchaseOrderBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  502. <DataColumn Index="5" MappingName="#PurchaseOrderBill.Name_Location" HeaderText="到货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent"/>
  503. </DataGridIndex>
  504. <ReturnFieldMapping>
  505. <DataColumn Index="0" MappingName="#PurchaseOrderBillProduct.No_PurchaseOrderBillProduct" ReturnPath="child" ReturnMappingName="#PurchaseInvoiceProduct.No_FromBillProduct"/>
  506. </ReturnFieldMapping>
  507. </ChildForm>
  508. <ChildForm name="ImportPurchaseOrderBillUnControl" >
  509. <DataGridIndex DataSource="PurchaseOrderBill" SearchFunction="SearchAllPurchaseOrderBill" SearchFunctionStandby="SearchAllPurchaseOrderBillProduct" SearchFunctionByNo="" MappingName="" ReturnDataSource="PurchaseInvoiceProduct">
  510. <DataColumn Index="0" MappingName="#PurchaseOrderBill.No_PurchaseOrderBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseInvoiceProduct.Comment_PurchaseInvoiceProduct"/>
  511. <DataColumn Index="1" MappingName="#PurchaseOrderBill.Date_PurchaseOrderBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  512. <DataColumn Index="2" MappingName="#PurchaseOrderBill.No_Supplier" HeaderText="供应商编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseInvoice.No_Supplier"/>
  513. <DataColumn Index="3" MappingName="#PurchaseOrderBill.ShortName_Supplier" HeaderText="供应商简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  514. <DataColumn Index="4" MappingName="#PurchaseOrderBill.State_PurchaseOrderBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  515. <DataColumn Index="5" MappingName="#PurchaseOrderBill.Name_Location" HeaderText="到货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent"/>
  516. </DataGridIndex>
  517. <ReturnFieldMapping>
  518. <DataColumn Index="0" MappingName="#PurchaseOrderBillProduct.No_Product" ReturnPath="child" ReturnMappingName="#PurchaseInvoiceProduct.No_Product"/>
  519. </ReturnFieldMapping>
  520. </ChildForm>
  521. <ChildForm name="ImportPurchaseInDepotBill" >
  522. <DataGridIndex DataSource="PurchaseInDepotBill" SearchFunction="SearchAllPurchaseInDepotBill" SearchFunctionStandby="SearchAllPurchaseInDepotBillProduct" SearchFunctionByNo="" MappingName="" ReturnDataSource="PurchaseInvoiceProduct">
  523. <DataColumn Index="0" MappingName="#PurchaseInDepotBill.No_PurchaseInDepotBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseInvoiceProduct.No_FromBill"/>
  524. <DataColumn Index="1" MappingName="#PurchaseInDepotBill.Date_PurchaseInDepotBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  525. <DataColumn Index="2" MappingName="#PurchaseInDepotBill.No_Supplier" HeaderText="供应商编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseInvoice.No_Supplier"/>
  526. <DataColumn Index="3" MappingName="#PurchaseInDepotBill.ShortName_Supplier" HeaderText="供应商简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  527. <DataColumn Index="4" MappingName="#PurchaseInDepotBill.State_PurchaseInDepotBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  528. <DataColumn Index="5" MappingName="#PurchaseInDepotBill.Name_Location" HeaderText="到货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent"/>
  529. </DataGridIndex>
  530. <ReturnFieldMapping>
  531. <DataColumn Index="0" MappingName="#PurchaseInDepotBillProduct.No_PurchaseInDepotBillProduct" ReturnPath="child" ReturnMappingName="#PurchaseInvoiceProduct.No_FromBillProduct"/>
  532. </ReturnFieldMapping>
  533. </ChildForm>
  534. </ChildForms>
  535. <ImportedInfo>
  536. UpdateForm(true, "tbSupplierNo");
  537. ActiveControlEvent("tbSupplierNo", "Enter");
  538. </ImportedInfo>
  539. </Client>
  540. <Server>
  541. <Tables>
  542. <Table name="PurchaseInvoice" Type="Parent">
  543. <GetSchema CmdType="Text" CmdText="
  544. SELECT TOP 0 PurchaseInvoice.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Supplier.No_Supplier,Supplier.ShortName_Supplier,convert(nvarchar(64),'') As TypeName
  545. FROM PurchaseInvoice
  546. LEFT JOIN AppUser a ON PurchaseInvoice.ID_Creator=a.ID_User
  547. LEFT JOIN AppUser b ON PurchaseInvoice.ID_Assessor=b.ID_User
  548. LEFT JOIN AppUser c ON PurchaseInvoice.LastModUser_PurchaseInvoice=c.ID_User
  549. Left JOIN Supplier On Supplier.ID_Supplier=PurchaseInvoice.ID_Supplier
  550. ">
  551. </GetSchema>
  552. <New CmdType="Text" CmdText="
  553. INSERT INTO PurchaseInvoice(ID_PurchaseInvoice,No_PurchaseInvoice,Date_PurchaseInvoice,Type_PurchaseInvoice,PayDate_PurchaseInvoice,InvoiceDate_PurchaseInvoice,No_Invoice,ID_Supplier,
  554. ID_Creator,CreateDate_PurchaseInvoice,LastModUser_PurchaseInvoice,LastModDate_PurchaseInvoice,ID_Assessor,AssessDate_PurchaseInvoice,Comment_PurchaseInvoice,Amount_PurchaseInvoice,GoodsAmount_PurchaseInvoice,TaxAmount_PurchaseInvoice,IncludeTax_PurchaseInvoice) VALUES(@ID_PurchaseInvoice,@No_PurchaseInvoice,@Date_PurchaseInvoice,@Type_PurchaseInvoice,@PayDate_PurchaseInvoice,@InvoiceDate_PurchaseInvoice,@No_Invoice,@ID_Supplier,
  555. @ID_Creator,@CreateDate_PurchaseInvoice,@LastModUser_PurchaseInvoice,@LastModDate_PurchaseInvoice,@ID_Assessor,@AssessDate_PurchaseInvoice,@Comment_PurchaseInvoice,@Amount_PurchaseInvoice,@GoodsAmount_PurchaseInvoice,@TaxAmount_PurchaseInvoice,@IncludeTax_PurchaseInvoice)
  556. ">
  557. <Params>
  558. <Param name="@ID_PurchaseInvoice" type="PurchaseInvoice.ID_PurchaseInvoice" sourceColumn="ID_PurchaseInvoice" />
  559. <Param name="@No_PurchaseInvoice" type="PurchaseInvoice.No_PurchaseInvoice" sourceColumn="No_PurchaseInvoice" />
  560. <Param name="@Date_PurchaseInvoice" type="PurchaseInvoice.Date_PurchaseInvoice" sourceColumn="Date_PurchaseInvoice" />
  561. <Param name="@Type_PurchaseInvoice" type="PurchaseInvoice.Type_PurchaseInvoice" sourceColumn="Type_PurchaseInvoice" />
  562. <Param name="@PayDate_PurchaseInvoice" type="PurchaseInvoice.PayDate_PurchaseInvoice" sourceColumn="PayDate_PurchaseInvoice" />
  563. <Param name="@InvoiceDate_PurchaseInvoice" type="PurchaseInvoice.InvoiceDate_PurchaseInvoice" sourceColumn="InvoiceDate_PurchaseInvoice" />
  564. <Param name="@No_Invoice" type="PurchaseInvoice.No_Invoice" sourceColumn="No_Invoice" />
  565. <Param name="@ID_Supplier" type="PurchaseInvoice.ID_Supplier" sourceColumn="ID_Supplier" />
  566. <Param name="@ID_Creator" type="PurchaseInvoice.ID_Creator" sourceColumn="ID_Creator" />
  567. <Param name="@CreateDate_PurchaseInvoice" type="PurchaseInvoice.CreateDate_PurchaseInvoice" sourceColumn="CreateDate_PurchaseInvoice" />
  568. <Param name="@LastModUser_PurchaseInvoice" type="PurchaseInvoice.LastModUser_PurchaseInvoice" sourceColumn="LastModUser_PurchaseInvoice" />
  569. <Param name="@LastModDate_PurchaseInvoice" type="PurchaseInvoice.LastModDate_PurchaseInvoice" sourceColumn="LastModDate_PurchaseInvoice" />
  570. <Param name="@ID_Assessor" type="PurchaseInvoice.ID_Assessor" sourceColumn="ID_Assessor" />
  571. <Param name="@AssessDate_PurchaseInvoice" type="PurchaseInvoice.AssessDate_PurchaseInvoice" sourceColumn="AssessDate_PurchaseInvoice" />
  572. <Param name="@Comment_PurchaseInvoice" type="PurchaseInvoice.Comment_PurchaseInvoice" sourceColumn="Comment_PurchaseInvoice" />
  573. <Param name="@Amount_PurchaseInvoice" type="PurchaseInvoice.Amount_PurchaseInvoice" sourceColumn="Amount_PurchaseInvoice" />
  574. <Param name="@GoodsAmount_PurchaseInvoice" type="PurchaseInvoice.GoodsAmount_PurchaseInvoice" sourceColumn="GoodsAmount_PurchaseInvoice" />
  575. <Param name="@TaxAmount_PurchaseInvoice" type="PurchaseInvoice.TaxAmount_PurchaseInvoice" sourceColumn="TaxAmount_PurchaseInvoice" />
  576. <Param name="@IncludeTax_PurchaseInvoice" type="PurchaseInvoice.IncludeTax_PurchaseInvoice" sourceColumn="IncludeTax_PurchaseInvoice" />
  577. </Params>
  578. </New>
  579. <Update CmdType="Text" CmdText="
  580. UPDATE PurchaseInvoice
  581. SET No_PurchaseInvoice=@No_PurchaseInvoice,Date_PurchaseInvoice=@Date_PurchaseInvoice,Type_PurchaseInvoice=@Type_PurchaseInvoice,
  582. PayDate_PurchaseInvoice=@PayDate_PurchaseInvoice,InvoiceDate_PurchaseInvoice=@InvoiceDate_PurchaseInvoice,No_Invoice=@No_Invoice,
  583. ID_Supplier=@ID_Supplier,ID_Creator=@ID_Creator,CreateDate_PurchaseInvoice=@CreateDate_PurchaseInvoice,LastModUser_PurchaseInvoice=@LastModUser_PurchaseInvoice,
  584. LastModDate_PurchaseInvoice=@LastModDate_PurchaseInvoice,ID_Assessor=@ID_Assessor,AssessDate_PurchaseInvoice=@AssessDate_PurchaseInvoice,Comment_PurchaseInvoice=@Comment_PurchaseInvoice,Amount_PurchaseInvoice=@Amount_PurchaseInvoice,
  585. GoodsAmount_PurchaseInvoice=@GoodsAmount_PurchaseInvoice,TaxAmount_PurchaseInvoice=@TaxAmount_PurchaseInvoice,IncludeTax_PurchaseInvoice=@IncludeTax_PurchaseInvoice
  586. WHERE ID_PurchaseInvoice=@ID_PurchaseInvoice
  587. ">
  588. <Params>
  589. <Param name="@ID_PurchaseInvoice" type="PurchaseInvoice.ID_PurchaseInvoice" sourceColumn="ID_PurchaseInvoice" />
  590. <Param name="@No_PurchaseInvoice" type="PurchaseInvoice.No_PurchaseInvoice" sourceColumn="No_PurchaseInvoice" />
  591. <Param name="@Date_PurchaseInvoice" type="PurchaseInvoice.Date_PurchaseInvoice" sourceColumn="Date_PurchaseInvoice" />
  592. <Param name="@Type_PurchaseInvoice" type="PurchaseInvoice.Type_PurchaseInvoice" sourceColumn="Type_PurchaseInvoice" />
  593. <Param name="@PayDate_PurchaseInvoice" type="PurchaseInvoice.PayDate_PurchaseInvoice" sourceColumn="PayDate_PurchaseInvoice" />
  594. <Param name="@InvoiceDate_PurchaseInvoice" type="PurchaseInvoice.InvoiceDate_PurchaseInvoice" sourceColumn="InvoiceDate_PurchaseInvoice" />
  595. <Param name="@No_Invoice" type="PurchaseInvoice.No_Invoice" sourceColumn="No_Invoice" />
  596. <Param name="@ID_Supplier" type="PurchaseInvoice.ID_Supplier" sourceColumn="ID_Supplier" />
  597. <Param name="@ID_Creator" type="PurchaseInvoice.ID_Creator" sourceColumn="ID_Creator" />
  598. <Param name="@CreateDate_PurchaseInvoice" type="PurchaseInvoice.CreateDate_PurchaseInvoice" sourceColumn="CreateDate_PurchaseInvoice" />
  599. <Param name="@LastModUser_PurchaseInvoice" type="PurchaseInvoice.LastModUser_PurchaseInvoice" sourceColumn="LastModUser_PurchaseInvoice" />
  600. <Param name="@LastModDate_PurchaseInvoice" type="PurchaseInvoice.LastModDate_PurchaseInvoice" sourceColumn="LastModDate_PurchaseInvoice" />
  601. <Param name="@ID_Assessor" type="PurchaseInvoice.ID_Assessor" sourceColumn="ID_Assessor" />
  602. <Param name="@AssessDate_PurchaseInvoice" type="PurchaseInvoice.AssessDate_PurchaseInvoice" sourceColumn="AssessDate_PurchaseInvoice" />
  603. <Param name="@Comment_PurchaseInvoice" type="PurchaseInvoice.Comment_PurchaseInvoice" sourceColumn="Comment_PurchaseInvoice" />
  604. <Param name="@Amount_PurchaseInvoice" type="PurchaseInvoice.Amount_PurchaseInvoice" sourceColumn="Amount_PurchaseInvoice" />
  605. <Param name="@GoodsAmount_PurchaseInvoice" type="PurchaseInvoice.GoodsAmount_PurchaseInvoice" sourceColumn="GoodsAmount_PurchaseInvoice" />
  606. <Param name="@TaxAmount_PurchaseInvoice" type="PurchaseInvoice.TaxAmount_PurchaseInvoice" sourceColumn="TaxAmount_PurchaseInvoice" />
  607. <Param name="@IncludeTax_PurchaseInvoice" type="PurchaseInvoice.IncludeTax_PurchaseInvoice" sourceColumn="IncludeTax_PurchaseInvoice" />
  608. </Params>
  609. </Update>
  610. <Delete CmdType="Text" CmdText="
  611. DELETE FROM PurchaseInvoiceProduct WHERE ID_PurchaseInvoice=@ID_PurchaseInvoice
  612. DELETE FROM PurchaseInvoice WHERE ID_PurchaseInvoice=@ID_PurchaseInvoice
  613. ">
  614. <Params>
  615. <Param name="@ID_PurchaseInvoice" type="PurchaseInvoice.ID_PurchaseInvoice" sourceColumn="ID_PurchaseInvoice" />
  616. </Params>
  617. </Delete>
  618. <Audit CmdType="Text" CmdText="
  619. UPDATE Supplier
  620. SET ToPayBalance_Supplier = ToPayBalance_Supplier+@Amount_PurchaseInvoice
  621. WHERE ID_Supplier=@ID_Supplier
  622. UPDATE PurchaseInvoice SET ID_Assessor=@ID_Assessor,AssessDate_PurchaseInvoice=@AssessDate_PurchaseInvoice WHERE ID_PurchaseInvoice=@ID_PurchaseInvoice
  623. ">
  624. <Params>
  625. <Param name="@ID_PurchaseInvoice" type="PurchaseInvoice.ID_PurchaseInvoice" sourceColumn="ID_PurchaseInvoice"/>
  626. <Param name="@ID_Assessor" type="PurchaseInvoice.ID_Assessor" sourceColumn="ID_Assessor"/>
  627. <Param name="@AssessDate_PurchaseInvoice" type="PurchaseInvoice.AssessDate_PurchaseInvoice" sourceColumn="AssessDate_PurchaseInvoice"/>
  628. <Param name="@ID_Supplier" type="PurchaseInvoice.ID_Supplier" sourceColumn="ID_Supplier"/>
  629. <Param name="@Amount_PurchaseInvoice" type="PurchaseInvoice.Amount_PurchaseInvoice" sourceColumn="Amount_PurchaseInvoice" />
  630. </Params>
  631. </Audit>
  632. <Blank CmdType="Text" CmdText="
  633. IF (@StrikedAmount_PurchaseInvoice!=0)
  634. BEGIN
  635. Raiserror('该单据已被冲帐,作废失败!',16,1)
  636. return
  637. END
  638. UPDATE Supplier
  639. SET ToPayBalance_Supplier = ToPayBalance_Supplier-@Amount_PurchaseInvoice
  640. WHERE ID_Supplier=@ID_Supplier
  641. UPDATE PurchaseInvoice
  642. SET Disable_PurchaseInvoice=@Disable_PurchaseInvoice
  643. Where ID_PurchaseInvoice=@ID_PurchaseInvoice
  644. ">
  645. <Params>
  646. <Param name="@ID_PurchaseInvoice" type="PurchaseInvoice.ID_PurchaseInvoice" sourceColumn="ID_PurchaseInvoice" />
  647. <Param name="@No_PurchaseInvoice" type="PurchaseInvoice.No_PurchaseInvoice" sourceColumn="No_PurchaseInvoice" />
  648. <Param name="@ID_Supplier" type="PurchaseInvoice.ID_Supplier" sourceColumn="ID_Supplier"/>
  649. <Param name="@Disable_PurchaseInvoice" type="PurchaseInvoice.Disable_PurchaseInvoice" sourceColumn="Disable_PurchaseInvoice"/>
  650. <Param name="@Amount_PurchaseInvoice" type="PurchaseInvoice.Amount_PurchaseInvoice" sourceColumn="Amount_PurchaseInvoice" />
  651. <Param name="@StrikedAmount_PurchaseInvoice" type="PurchaseInvoice.StrikedAmount_PurchaseInvoice" sourceColumn="StrikedAmount_PurchaseInvoice" />
  652. </Params>
  653. </Blank>
  654. </Table>
  655. <Table name="PurchaseInvoiceProduct" Type="Child">
  656. <GetSchema CmdType="Text" CmdText="
  657. SELECT TOP 0 PurchaseInvoiceProduct.*,
  658. convert(nvarchar(64),'') As Name_BillType,
  659. Product.No_Product,Product.Name_Product,Product.InvoiceName_Product,Product.Unit_Product
  660. FROM PurchaseInvoiceProduct
  661. LEFT JOIN Product On Product.ID_Product=PurchaseInvoiceProduct.ID_Product
  662. ">
  663. </GetSchema>
  664. <New CmdType="Text" CmdText="
  665. INSERT INTO PurchaseInvoiceProduct(ID_PurchaseInvoiceProduct,ID_PurchaseInvoice,Type_FromBill,No_FromBill,No_FromBillProduct,ID_Product,Quantity_PurchaseInvoiceProduct,UnitPrice_PurchaseInvoiceProduct,TaxRate_PurchaseInvoiceProduct,Comment_PurchaseInvoiceProduct,Amount_PurchaseInvoiceProduct,TaxAmount_PurchaseInvoiceProduct)
  666. Values(@ID_PurchaseInvoiceProduct,@ID_PurchaseInvoice,@Type_FromBill,@No_FromBill,@No_FromBillProduct,@ID_Product,@Quantity_PurchaseInvoiceProduct,@UnitPrice_PurchaseInvoiceProduct,@TaxRate_PurchaseInvoiceProduct,@Comment_PurchaseInvoiceProduct,@Amount_PurchaseInvoiceProduct,@TaxAmount_PurchaseInvoiceProduct)
  667. ">
  668. <Params>
  669. <Param name="@ID_PurchaseInvoiceProduct" type="PurchaseInvoiceProduct.ID_PurchaseInvoiceProduct" sourceColumn="ID_PurchaseInvoiceProduct" />
  670. <Param name="@ID_PurchaseInvoice" type="PurchaseInvoiceProduct.ID_PurchaseInvoice" sourceColumn="ID_PurchaseInvoice" />
  671. <Param name="@Type_FromBill" type="PurchaseInvoiceProduct.Type_FromBill" sourceColumn="Type_FromBill" />
  672. <Param name="@No_FromBill" type="PurchaseInvoiceProduct.No_FromBill" sourceColumn="No_FromBill" />
  673. <Param name="@No_FromBillProduct" type="PurchaseInvoiceProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
  674. <Param name="@ID_Product" type="PurchaseInvoiceProduct.ID_Product" sourceColumn="ID_Product" />
  675. <Param name="@Quantity_PurchaseInvoiceProduct" type="PurchaseInvoiceProduct.Quantity_PurchaseInvoiceProduct" sourceColumn="Quantity_PurchaseInvoiceProduct" />
  676. <Param name="@UnitPrice_PurchaseInvoiceProduct" type="PurchaseInvoiceProduct.UnitPrice_PurchaseInvoiceProduct" sourceColumn="UnitPrice_PurchaseInvoiceProduct" />
  677. <Param name="@TaxRate_PurchaseInvoiceProduct" type="PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct" sourceColumn="TaxRate_PurchaseInvoiceProduct" />
  678. <Param name="@Comment_PurchaseInvoiceProduct" type="PurchaseInvoiceProduct.Comment_PurchaseInvoiceProduct" sourceColumn="Comment_PurchaseInvoiceProduct" />
  679. <Param name="@Amount_PurchaseInvoiceProduct" type="PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct" sourceColumn="Amount_PurchaseInvoiceProduct" />
  680. <Param name="@TaxAmount_PurchaseInvoiceProduct" type="PurchaseInvoiceProduct.TaxAmount_PurchaseInvoiceProduct" sourceColumn="TaxAmount_PurchaseInvoiceProduct" />
  681. </Params>
  682. </New>
  683. <Update CmdType="Text" CmdText="
  684. UPDATE PurchaseInvoiceProduct
  685. SET ID_PurchaseInvoice=@ID_PurchaseInvoice,Type_FromBill=@Type_FromBill,No_FromBill=@No_FromBill,No_FromBillProduct=@No_FromBillProduct,ID_Product=@ID_Product,
  686. Quantity_PurchaseInvoiceProduct=@Quantity_PurchaseInvoiceProduct,UnitPrice_PurchaseInvoiceProduct=@UnitPrice_PurchaseInvoiceProduct,TaxRate_PurchaseInvoiceProduct=@TaxRate_PurchaseInvoiceProduct,Comment_PurchaseInvoiceProduct=@Comment_PurchaseInvoiceProduct,
  687. Amount_PurchaseInvoiceProduct=@Amount_PurchaseInvoiceProduct,TaxAmount_PurchaseInvoiceProduct=@TaxAmount_PurchaseInvoiceProduct
  688. WHERE ID_PurchaseInvoiceProduct=@ID_PurchaseInvoiceProduct
  689. ">
  690. <Params>
  691. <Param name="@ID_PurchaseInvoiceProduct" type="PurchaseInvoiceProduct.ID_PurchaseInvoiceProduct" sourceColumn="ID_PurchaseInvoiceProduct" />
  692. <Param name="@ID_PurchaseInvoice" type="PurchaseInvoiceProduct.ID_PurchaseInvoice" sourceColumn="ID_PurchaseInvoice" />
  693. <Param name="@Type_FromBill" type="PurchaseInvoiceProduct.Type_FromBill" sourceColumn="Type_FromBill" />
  694. <Param name="@No_FromBill" type="PurchaseInvoiceProduct.No_FromBill" sourceColumn="No_FromBill" />
  695. <Param name="@No_FromBillProduct" type="PurchaseInvoiceProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
  696. <Param name="@ID_Product" type="PurchaseInvoiceProduct.ID_Product" sourceColumn="ID_Product" />
  697. <Param name="@Quantity_PurchaseInvoiceProduct" type="PurchaseInvoiceProduct.Quantity_PurchaseInvoiceProduct" sourceColumn="Quantity_PurchaseInvoiceProduct" />
  698. <Param name="@UnitPrice_PurchaseInvoiceProduct" type="PurchaseInvoiceProduct.UnitPrice_PurchaseInvoiceProduct" sourceColumn="UnitPrice_PurchaseInvoiceProduct" />
  699. <Param name="@TaxRate_PurchaseInvoiceProduct" type="PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct" sourceColumn="TaxRate_PurchaseInvoiceProduct" />
  700. <Param name="@Comment_PurchaseInvoiceProduct" type="PurchaseInvoiceProduct.Comment_PurchaseInvoiceProduct" sourceColumn="Comment_PurchaseInvoiceProduct" />
  701. <Param name="@Amount_PurchaseInvoiceProduct" type="PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct" sourceColumn="Amount_PurchaseInvoiceProduct" />
  702. <Param name="@TaxAmount_PurchaseInvoiceProduct" type="PurchaseInvoiceProduct.TaxAmount_PurchaseInvoiceProduct" sourceColumn="TaxAmount_PurchaseInvoiceProduct" />
  703. </Params>
  704. </Update>
  705. <Delete CmdType="Text" CmdText="
  706. DELETE FROM PurchaseInvoiceProduct WHERE ID_PurchaseInvoiceProduct=@ID_PurchaseInvoiceProduct
  707. ">
  708. <Params>
  709. <Param name="@ID_PurchaseInvoiceProduct" type="PurchaseInvoiceProduct.ID_PurchaseInvoiceProduct" sourceColumn="ID_PurchaseInvoiceProduct" />
  710. </Params>
  711. </Delete>
  712. </Table>
  713. </Tables>
  714. <Search>
  715. <SearchAllBill CmdType="Text" CmdText=" SELECT PurchaseInvoice.No_PurchaseInvoice,PurchaseInvoice.Date_PurchaseInvoice,Supplier.ShortName_Supplier
  716. FROM PurchaseInvoice
  717. Left JOIN Supplier On Supplier.ID_Supplier=PurchaseInvoice.ID_Supplier">
  718. <Tables>
  719. <Table name="AllBill" />
  720. </Tables>
  721. </SearchAllBill>
  722. <SearchAllSupplier CmdType="Text" CmdText="SELECT Supplier.No_Supplier,Supplier.ShortName_Supplier FROM Supplier ">
  723. <Tables>
  724. <Table name="AllSupplier" />
  725. </Tables>
  726. </SearchAllSupplier>
  727. <SearchSupplier CmdType="Text" CmdText="
  728. SELECT ID_Supplier,ShortName_Supplier,SuspendDate_Supplier
  729. From Supplier
  730. WHERE No_Supplier=@No_Supplier
  731. ">
  732. <Params>
  733. <Param name="@No_Supplier" type="Supplier.No_Supplier" Index="0" />
  734. </Params>
  735. <Tables>
  736. <Table name="Supplier"/>
  737. </Tables>
  738. </SearchSupplier>
  739. <SearchAllProduct CmdType="Text" CmdText="SELECT Product.No_Product,Product.Name_Product FROM Product ">
  740. <Tables>
  741. <Table name="AllProduct" />
  742. </Tables>
  743. </SearchAllProduct>
  744. <SearchPurchaseOrderBillProduct CmdType="Text" CmdText="
  745. SELECT PurchaseOrderBillProduct.ID_Product,PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct,PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct,PurchaseOrderBill.TaxCurrency_PurchaseOrderBill,Product.No_Product,Product.Name_Product,Product.InvoiceName_Product,Product.Unit_Product
  746. FROM PurchaseOrderBillProduct
  747. LEFT JOIN PurchaseOrderBill On PurchaseOrderBill.ID_PurchaseOrderBill=PurchaseOrderBillProduct.ID_PurchaseOrderBill
  748. LEFT JOIN Product On Product.ID_Product=PurchaseOrderBillProduct.ID_Product
  749. WHERE No_PurchaseOrderBill=@No_PurchaseOrderBill AND No_PurchaseOrderBillProduct=@No_PurchaseOrderBillProduct
  750. ">
  751. <Params>
  752. <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0" />
  753. <Param name="@No_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.No_PurchaseOrderBillProduct" Index="1" />
  754. </Params>
  755. <Tables>
  756. <Table name="PurchaseOrderBillProduct"/>
  757. </Tables>
  758. </SearchPurchaseOrderBillProduct>
  759. <SearchPurchaseOrderBill CmdType="Text" CmdText="
  760. SELECT ID_Assessor,ID_Supplier,ID_Product
  761. FROM PurchaseOrderBillProduct
  762. LEFT JOIN PurchaseOrderBill On PurchaseOrderBill.ID_PurchaseOrderBill=PurchaseOrderBillProduct.ID_PurchaseOrderBill
  763. WHERE No_PurchaseOrderBill=@No_PurchaseOrderBill AND No_PurchaseOrderBillProduct=@No_PurchaseOrderBillProduct
  764. ">
  765. <Params>
  766. <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0" />
  767. <Param name="@No_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.No_PurchaseOrderBillProduct" Index="1" />
  768. </Params>
  769. <Tables>
  770. <Table name="PurchaseOrderBill"/>
  771. </Tables>
  772. </SearchPurchaseOrderBill>
  773. <SearchPurchaseInDepotBillProduct CmdType="Text" CmdText="
  774. SELECT PurchaseInDepotBillProduct.ID_Product,PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct,Product.Price_Product,Product.No_Product,Product.Name_Product,Product.InvoiceName_Product,Product.Unit_Product
  775. FROM PurchaseInDepotBillProduct
  776. LEFT JOIN PurchaseInDepotBill On PurchaseInDepotBillProduct.ID_PurchaseInDepotBill=PurchaseInDepotBill.ID_PurchaseInDepotBill
  777. LEFT JOIN Product On Product.ID_Product=PurchaseInDepotBillProduct.ID_Product
  778. WHERE No_PurchaseInDepotBill=@No_PurchaseInDepotBill AND No_PurchaseInDepotBillProduct=@No_PurchaseInDepotBillProduct
  779. ">
  780. <Params>
  781. <Param name="@No_PurchaseInDepotBill" type="PurchaseInDepotBill.No_PurchaseInDepotBill" Index="0" />
  782. <Param name="@No_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.No_PurchaseInDepotBillProduct" Index="1" />
  783. </Params>
  784. <Tables>
  785. <Table name="PurchaseInDepotBillProduct"/>
  786. </Tables>
  787. </SearchPurchaseInDepotBillProduct>
  788. <SearchPurchaseInDepotBill CmdType="Text" CmdText="
  789. SELECT ID_Assessor,ID_Supplier,ID_Product
  790. FROM PurchaseInDepotBillProduct
  791. LEFT JOIN PurchaseInDepotBill On PurchaseInDepotBillProduct.ID_PurchaseInDepotBill=PurchaseInDepotBill.ID_PurchaseInDepotBill
  792. WHERE No_PurchaseInDepotBill=@No_PurchaseInDepotBill AND No_PurchaseInDepotBillProduct=@No_PurchaseInDepotBillProduct
  793. ">
  794. <Params>
  795. <Param name="@No_PurchaseInDepotBill" type="PurchaseInDepotBill.No_PurchaseInDepotBill" Index="0" />
  796. <Param name="@No_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.No_PurchaseInDepotBillProduct" Index="1" />
  797. </Params>
  798. <Tables>
  799. <Table name="PurchaseInDepotBill"/>
  800. </Tables>
  801. </SearchPurchaseInDepotBill>
  802. <SearchProduct CmdType="Text" CmdText="
  803. SELECT Product.ID_Product,Product.Name_Product,Product.InvoiceName_Product,Product.Unit_Product,Product.Price_Product
  804. FROM Product
  805. WHERE No_Product=@No_Product
  806. ">
  807. <Params>
  808. <Param name="@No_Product" type="Product.No_Product" Index="0" />
  809. </Params>
  810. <Tables>
  811. <Table name="Product"/>
  812. </Tables>
  813. </SearchProduct>
  814. <SearchCessIn CmdType="Text" CmdText="SELECT CessIn_SystemSetting,PriceDecimal_SystemSetting From SystemSetting">
  815. <Tables>
  816. <Table name="SystemSetting"/>
  817. </Tables>
  818. </SearchCessIn>
  819. <SearchPurchaseInvoiceWithNo CmdType="Text" CmdText="
  820. SELECT PurchaseInvoice.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Supplier.No_Supplier,Supplier.ShortName_Supplier,TypeName=CASE Type_PurchaseInvoice When 0 Then '普通发票' ELSE '增值税发票' End
  821. FROM PurchaseInvoice
  822. LEFT JOIN AppUser a ON PurchaseInvoice.ID_Creator=a.ID_User
  823. LEFT JOIN AppUser b ON PurchaseInvoice.ID_Assessor=b.ID_User
  824. LEFT JOIN AppUser c ON PurchaseInvoice.LastModUser_PurchaseInvoice=c.ID_User
  825. Left JOIN Supplier On Supplier.ID_Supplier=PurchaseInvoice.ID_Supplier
  826. WHERE No_PurchaseInvoice=@No_PurchaseInvoice
  827. SELECT PurchaseInvoiceProduct.*,
  828. Product.No_Product,Product.Name_Product,Product.InvoiceName_Product,Product.Unit_Product,BillType.Name_BillType
  829. FROM PurchaseInvoiceProduct
  830. LEFT JOIN Product On Product.ID_Product=PurchaseInvoiceProduct.ID_Product
  831. LEFT JOIN PurchaseInvoice On PurchaseInvoice.ID_PurchaseInvoice=PurchaseInvoiceProduct.ID_PurchaseInvoice
  832. LEFT JOIN BillType On BillType.Value_BillType=PurchaseInvoiceProduct.Type_FromBill
  833. WHERE No_PurchaseInvoice=@No_PurchaseInvoice
  834. ">
  835. <Params>
  836. <Param name="@No_PurchaseInvoice" type="PurchaseInvoice.No_PurchaseInvoice" Index="0" />
  837. </Params>
  838. <Tables>
  839. <Table name="PurchaseInvoice"/>
  840. <Table name="PurchaseInvoiceProduct"/>
  841. </Tables>
  842. </SearchPurchaseInvoiceWithNo>
  843. <SearchBillType CmdType="Text" CmdText=" SELECT * FROM BillType WHERE Value_BillType = 41 OR Value_BillType = 0 OR Value_BillType = 1 ORDER BY Value_BillType">
  844. <Tables>
  845. <Table name="BillType" />
  846. </Tables>
  847. </SearchBillType>
  848. <SearchPurchaseInvoiceFirst CmdType="Text" CmdText="
  849. DECLARE @ID_PurchaseInvoice UNIQUEIDENTIFIER
  850. SELECT TOP 1 @ID_PurchaseInvoice=ID_PurchaseInvoice FROM PurchaseInvoice ORDER BY No_PurchaseInvoice
  851. SELECT PurchaseInvoice.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Supplier.No_Supplier,Supplier.ShortName_Supplier,TypeName=CASE Type_PurchaseInvoice When 0 Then '普通发票' ELSE '增值税发票' End
  852. FROM PurchaseInvoice
  853. LEFT JOIN AppUser a ON PurchaseInvoice.ID_Creator=a.ID_User
  854. LEFT JOIN AppUser b ON PurchaseInvoice.ID_Assessor=b.ID_User
  855. LEFT JOIN AppUser c ON PurchaseInvoice.LastModUser_PurchaseInvoice=c.ID_User
  856. Left JOIN Supplier On Supplier.ID_Supplier=PurchaseInvoice.ID_Supplier
  857. WHERE ID_PurchaseInvoice=@ID_PurchaseInvoice
  858. SELECT PurchaseInvoiceProduct.*,
  859. Product.No_Product,Product.Name_Product,Product.InvoiceName_Product,Product.Unit_Product,BillType.Name_BillType
  860. FROM PurchaseInvoiceProduct
  861. LEFT JOIN Product On Product.ID_Product=PurchaseInvoiceProduct.ID_Product
  862. LEFT JOIN BillType On BillType.Value_BillType=PurchaseInvoiceProduct.Type_FromBill
  863. WHERE ID_PurchaseInvoice=@ID_PurchaseInvoice
  864. ">
  865. <Tables>
  866. <Table name="PurchaseInvoice"/>
  867. <Table name="PurchaseInvoiceProduct"/>
  868. </Tables>
  869. </SearchPurchaseInvoiceFirst>
  870. <SearchPurchaseInvoiceLast CmdType="Text" CmdText="
  871. DECLARE @ID_PurchaseInvoice UNIQUEIDENTIFIER
  872. SELECT TOP 1 @ID_PurchaseInvoice=ID_PurchaseInvoice FROM PurchaseInvoice ORDER BY No_PurchaseInvoice DESC
  873. SELECT PurchaseInvoice.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Supplier.No_Supplier,Supplier.ShortName_Supplier,TypeName=CASE Type_PurchaseInvoice When 0 Then '普通发票' ELSE '增值税发票' End
  874. FROM PurchaseInvoice
  875. LEFT JOIN AppUser a ON PurchaseInvoice.ID_Creator=a.ID_User
  876. LEFT JOIN AppUser b ON PurchaseInvoice.ID_Assessor=b.ID_User
  877. LEFT JOIN AppUser c ON PurchaseInvoice.LastModUser_PurchaseInvoice=c.ID_User
  878. Left JOIN Supplier On Supplier.ID_Supplier=PurchaseInvoice.ID_Supplier
  879. WHERE ID_PurchaseInvoice=@ID_PurchaseInvoice
  880. SELECT PurchaseInvoiceProduct.*,
  881. Product.No_Product,Product.Name_Product,Product.InvoiceName_Product,Product.Unit_Product,BillType.Name_BillType
  882. FROM PurchaseInvoiceProduct
  883. LEFT JOIN Product On Product.ID_Product=PurchaseInvoiceProduct.ID_Product
  884. LEFT JOIN BillType On BillType.Value_BillType=PurchaseInvoiceProduct.Type_FromBill
  885. WHERE ID_PurchaseInvoice=@ID_PurchaseInvoice
  886. ">
  887. <Tables>
  888. <Table name="PurchaseInvoice"/>
  889. <Table name="PurchaseInvoiceProduct"/>
  890. </Tables>
  891. </SearchPurchaseInvoiceLast>
  892. <SearchPurchaseInvoicePrevious CmdType="Text" CmdText="
  893. DECLARE @ID_PurchaseInvoice UNIQUEIDENTIFIER
  894. SELECT TOP 1 @ID_PurchaseInvoice=ID_PurchaseInvoice FROM PurchaseInvoice
  895. WHERE No_PurchaseInvoice &lt; @No_PurchaseInvoice
  896. ORDER BY No_PurchaseInvoice DESC
  897. SELECT PurchaseInvoice.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Supplier.No_Supplier,Supplier.ShortName_Supplier,TypeName=CASE Type_PurchaseInvoice When 0 Then '普通发票' ELSE '增值税发票' End FROM PurchaseInvoice
  898. LEFT JOIN AppUser a ON PurchaseInvoice.ID_Creator=a.ID_User
  899. LEFT JOIN AppUser b ON PurchaseInvoice.ID_Assessor=b.ID_User
  900. LEFT JOIN AppUser c ON PurchaseInvoice.LastModUser_PurchaseInvoice=c.ID_User
  901. Left JOIN Supplier On Supplier.ID_Supplier=PurchaseInvoice.ID_Supplier
  902. WHERE ID_PurchaseInvoice=@ID_PurchaseInvoice
  903. SELECT PurchaseInvoiceProduct.*,
  904. Product.No_Product,Product.Name_Product,Product.InvoiceName_Product,Product.Unit_Product,BillType.Name_BillType
  905. FROM PurchaseInvoiceProduct
  906. LEFT JOIN Product On Product.ID_Product=PurchaseInvoiceProduct.ID_Product
  907. LEFT JOIN BillType On BillType.Value_BillType=PurchaseInvoiceProduct.Type_FromBill
  908. WHERE ID_PurchaseInvoice=@ID_PurchaseInvoice
  909. ">
  910. <Params>
  911. <Param name="@No_PurchaseInvoice" type="PurchaseInvoice.No_PurchaseInvoice" Index="0" />
  912. </Params>
  913. <Tables>
  914. <Table name="PurchaseInvoice"/>
  915. <Table name="PurchaseInvoiceProduct"/>
  916. </Tables>
  917. </SearchPurchaseInvoicePrevious>
  918. <SearchPurchaseInvoiceNext CmdType="Text" CmdText="
  919. DECLARE @ID_PurchaseInvoice UNIQUEIDENTIFIER
  920. SELECT TOP 1 @ID_PurchaseInvoice=ID_PurchaseInvoice FROM PurchaseInvoice
  921. WHERE No_PurchaseInvoice &gt; @No_PurchaseInvoice
  922. ORDER BY No_PurchaseInvoice
  923. SELECT PurchaseInvoice.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Supplier.No_Supplier,Supplier.ShortName_Supplier,TypeName=CASE Type_PurchaseInvoice When 0 Then '普通发票' ELSE '增值税发票' End
  924. FROM PurchaseInvoice
  925. LEFT JOIN AppUser a ON PurchaseInvoice.ID_Creator=a.ID_User
  926. LEFT JOIN AppUser b ON PurchaseInvoice.ID_Assessor=b.ID_User
  927. LEFT JOIN AppUser c ON PurchaseInvoice.LastModUser_PurchaseInvoice=c.ID_User
  928. Left JOIN Supplier On Supplier.ID_Supplier=PurchaseInvoice.ID_Supplier
  929. WHERE ID_PurchaseInvoice=@ID_PurchaseInvoice
  930. SELECT PurchaseInvoiceProduct.*,
  931. Product.No_Product,Product.Name_Product,Product.InvoiceName_Product,Product.Unit_Product,BillType.Name_BillType
  932. FROM PurchaseInvoiceProduct
  933. LEFT JOIN Product On Product.ID_Product=PurchaseInvoiceProduct.ID_Product
  934. LEFT JOIN BillType On BillType.Value_BillType=PurchaseInvoiceProduct.Type_FromBill
  935. WHERE ID_PurchaseInvoice=@ID_PurchaseInvoice
  936. ">
  937. <Params>
  938. <Param name="@No_PurchaseInvoice" type="PurchaseInvoice.No_PurchaseInvoice" Index="0" />
  939. </Params>
  940. <Tables>
  941. <Table name="PurchaseInvoice"/>
  942. <Table name="PurchaseInvoiceProduct"/>
  943. </Tables>
  944. </SearchPurchaseInvoiceNext>
  945. <SearchContr CmdType="Text" CmdText=" SELECT SystemSetting.StockAndInDepot_SystemSetting FROM SystemSetting WHERE SystemSetting.StockAndInDepot_SystemSetting = 1">
  946. <Tables>
  947. <Table name="SystemOutIn" />
  948. </Tables>
  949. </SearchContr>
  950. <SearchAllPurchaseOrderBill CmdType="Text" CmdText="Select PurchaseOrderBill.ID_PurchaseOrderBill,PurchaseOrderBill.No_PurchaseOrderBill,PurchaseOrderBill.Date_PurchaseOrderBill,Supplier.No_Supplier,Supplier.ShortName_Supplier,Case When PurchaseOrderBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_PurchaseOrderBill,Location.Name_Location From PurchaseOrderBill
  951. Inner Join Supplier On PurchaseOrderBill.ID_Supplier = Supplier.ID_Supplier
  952. Inner Join Location On Location.ID_Location = PurchaseOrderBill.ID_Location" >
  953. <Tables>
  954. <Table name="AllSaleOutDepotBill" />
  955. </Tables>
  956. </SearchAllPurchaseOrderBill>
  957. <SearchAllPurchaseOrderBillProduct CmdType="Text" CmdText="Select PurchaseOrderBill.No_PurchaseOrderBill, Product.No_Product,PurchaseOrderBillProduct.No_PurchaseOrderBillProduct,Product.Name_Product,PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct,PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct From PurchaseOrderBillProduct
  958. Inner Join Product On Product.ID_Product = PurchaseOrderBillProduct.ID_Product
  959. Inner Join PurchaseOrderBill On PurchaseOrderBill.ID_PurchaseOrderBill = PurchaseOrderBillProduct.ID_PurchaseOrderBill" >
  960. <Tables>
  961. <Table name="AllSaleOutDepotBillProduct" />
  962. </Tables>
  963. </SearchAllPurchaseOrderBillProduct>
  964. <SearchAllPurchaseInDepotBill CmdType="Text" CmdText="Select PurchaseInDepotBill.ID_PurchaseInDepotBill,PurchaseInDepotBill.No_PurchaseInDepotBill,PurchaseInDepotBill.Date_PurchaseInDepotBill,Supplier.No_Supplier,Supplier.ShortName_Supplier,Case When PurchaseInDepotBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_PurchaseInDepotBill,Location.Name_Location From PurchaseInDepotBill
  965. Inner Join Supplier On PurchaseInDepotBill.ID_Supplier = Supplier.ID_Supplier
  966. Inner Join Location On Location.ID_Location = PurchaseInDepotBill.ID_Location" >
  967. <Tables>
  968. <Table name="AllSaleOutDepotBill" />
  969. </Tables>
  970. </SearchAllPurchaseInDepotBill>
  971. <SearchAllPurchaseInDepotBillProduct CmdType="Text" CmdText="Select PurchaseInDepotBill.No_PurchaseInDepotBill,Product.No_Product,PurchaseInDepotBillProduct.No_PurchaseInDepotBillProduct,Product.Name_Product,PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct,PurchaseInDepotBillProduct.Cost_PurchaseInDepotBillProduct From PurchaseInDepotBillProduct
  972. Inner Join Product On Product.ID_Product = PurchaseInDepotBillProduct.ID_Product
  973. Inner Join PurchaseInDepotBill On PurchaseInDepotBill.ID_PurchaseInDepotBill = PurchaseInDepotBillProduct.ID_PurchaseInDepotBill" >
  974. <Tables>
  975. <Table name="AllSaleOutDepotBillProduct" />
  976. </Tables>
  977. </SearchAllPurchaseInDepotBillProduct>
  978. <SearchInvoiceNo CmdType="Text" CmdText="
  979. Select * From PurchaseInvoice Where No_Invoice=@No_Invoice And No_PurchaseInvoice!=@No_PurchaseInvoice
  980. ">
  981. <Params>
  982. <Param name="@No_Invoice" type="PurchaseInvoice.No_Invoice" Index="0" />
  983. <Param name="@No_PurchaseInvoice" type="PurchaseInvoice.No_PurchaseInvoice" Index="1" />
  984. </Params>
  985. <Tables>
  986. <Table name="PurchaseInvoiceNo"/>
  987. </Tables>
  988. </SearchInvoiceNo>
  989. </Search>
  990. </Server>
  991. <Lables>
  992. <Search>
  993. Empty();
  994. NewInstance();
  995. tbNo.ReadOnly=false;
  996. dtDate.Enabled=false;
  997. cbType.Enabled=false;
  998. dtInvoiceDate.Enabled=false;
  999. txtInvoiceNo.ReadOnly=true;
  1000. tbSupplierNo.ReadOnly=true;
  1001. dtPayDate.Enabled=false;
  1002. txtComment.ReadOnly=true;
  1003. dgProduct.ReadOnly=true;
  1004. txtMoneySum.CValue=0.00;
  1005. txtTaxSum.CValue=0.00;
  1006. txtSum.CValue=0.00;
  1007. ckIncludeTax.Enabled=false;
  1008. btnModify.Enabled=false;
  1009. tbNo.Focus();
  1010. #PurchaseInvoice.Creator=DBNull();
  1011. #PurchaseInvoice.ID_Creator=DBNull();
  1012. #PurchaseInvoice.Assessor=DBNull();
  1013. #PurchaseInvoice.ID_Assessor=DBNull();
  1014. #PurchaseInvoice.AssessDate_PurchaseInvoice=DBNull();
  1015. #PurchaseInvoice.LastModUser_PurchaseInvoice=DBNull();
  1016. #PurchaseInvoice.LastModUser=DBNull();
  1017. #PurchaseInvoice.LastModDate_PurchaseInvoice=DBNull();
  1018. toolBar.EnableSubmit=false;
  1019. toolBar.EnableModify=false;
  1020. toolBar.EnableDelete=false;
  1021. toolBar.EnableAudit=false;
  1022. toolBar.EnableNew=GetRight(@Title,"新增");
  1023. toolBar.EnableImport = false;
  1024. toolBar.EnablePrint=false;
  1025. toolBar.EnableBlank=false;
  1026. UpdateForm(true,"");
  1027. tbNo.Focus();
  1028. cbType.Text="";
  1029. @Status=0;
  1030. </Search>
  1031. <New>
  1032. Empty();
  1033. NewInstance();
  1034. tbNo.ReadOnly=true;
  1035. dtDate.Enabled=true;
  1036. cbType.Enabled=true;
  1037. ckIncludeTax.Enabled=true;
  1038. dtInvoiceDate.Enabled=true;
  1039. txtInvoiceNo.ReadOnly=false;
  1040. tbSupplierNo.ReadOnly=false;
  1041. dtPayDate.Enabled=true;
  1042. txtComment.ReadOnly=false;
  1043. dgProduct.ReadOnly=false;
  1044. btnModify.Enabled=false;
  1045. txtMoneySum.CValue=0.00;
  1046. txtTaxSum.CValue=0.00;
  1047. txtSum.CValue=0.00;
  1048. dtDate.Focus();
  1049. #PurchaseInvoice.TypeName="增值税发票";
  1050. #PurchaseInvoice.ID_PurchaseInvoice=NewGuid();
  1051. #PurchaseInvoice.Creator=GetCurrentUser();
  1052. #PurchaseInvoice.ID_Creator=GetLoginUserID();
  1053. #PurchaseInvoice.Assessor=DBNull();
  1054. #PurchaseInvoice.ID_Assessor=DBNull();
  1055. #PurchaseInvoice.AssessDate_PurchaseInvoice=DBNull();
  1056. #PurchaseInvoice.LastModUser_PurchaseInvoice=DBNull();
  1057. #PurchaseInvoice.LastModUser=DBNull();
  1058. #PurchaseInvoice.LastModDate_PurchaseInvoice=DBNull();
  1059. toolBar.EnableSubmit=GetRight(@Title,"新增");
  1060. toolBar.EnableModify=false;
  1061. toolBar.EnableDelete=false;
  1062. toolBar.EnableAudit=false;
  1063. toolBar.EnableNew=false;
  1064. toolBar.EnablePrint=false;
  1065. toolBar.EnableBlank=false;
  1066. toolBar.EnableImport = true;
  1067. UpdateForm(true,"");
  1068. <!--cbType.Text="增值税发票";-->
  1069. <!--cbType.SelectedIndex=1;-->
  1070. @Status=1;
  1071. </New>
  1072. <View>
  1073. tbNo.ReadOnly=true;
  1074. dtDate.Enabled=false;
  1075. cbType.Enabled=false;
  1076. ckIncludeTax.Enabled=false;
  1077. dtInvoiceDate.Enabled=false;
  1078. txtInvoiceNo.ReadOnly=true;
  1079. tbSupplierNo.ReadOnly=true;
  1080. txtComment.ReadOnly=true;
  1081. dtPayDate.Enabled=false;
  1082. dgProduct.ReadOnly=true;
  1083. if(!Equals(#PurchaseInvoice.ID_Assessor,DBNull())&amp;&amp;#PurchaseInvoice.Disable_PurchaseInvoice==false)
  1084. btnModify.Enabled=true;
  1085. else
  1086. btnModify.Enabled=false;
  1087. toolBar.EnableSubmit=false;
  1088. toolBar.EnableNew=GetRight(@Title,"新增");
  1089. if(Equals(#PurchaseInvoice.ID_Assessor, DBNull()))
  1090. {
  1091. toolBar.EnableAudit=GetRight(@Title,"审核");
  1092. toolBar.EnableModify=GetRight(@Title,"修改");
  1093. toolBar.EnableDelete=GetRight(@Title,"删除");
  1094. toolBar.EnableBlank=false;
  1095. }
  1096. else
  1097. {
  1098. toolBar.EnableAudit=false;
  1099. toolBar.EnableModify=false;
  1100. toolBar.EnableDelete=false;
  1101. if(#PurchaseInvoice.Disable_PurchaseInvoice==false)
  1102. toolBar.EnableBlank=GetRight(@Title,"审核");
  1103. else
  1104. toolBar.EnableBlank=false;
  1105. }
  1106. toolBar.EnablePrint=GetRight(@Title,"打印");
  1107. toolBar.EnableImport = false;
  1108. UpdateForm(true, "");
  1109. @Status=2;
  1110. </View>
  1111. <Modify>
  1112. tbNo.ReadOnly=true;
  1113. dtDate.Enabled=false;
  1114. cbType.Enabled=true;
  1115. ckIncludeTax.Enabled=true;
  1116. dtInvoiceDate.Enabled=true;
  1117. txtInvoiceNo.ReadOnly=false;
  1118. tbSupplierNo.ReadOnly=false;
  1119. dtPayDate.Enabled=true;
  1120. txtComment.ReadOnly=false;
  1121. btnModify.Enabled=false;
  1122. dgProduct.ReadOnly=false;
  1123. #PurchaseInvoice.LastModUser=GetCurrentUser();
  1124. #PurchaseInvoice.LastModUser_PurchaseInvoice=GetLoginUserID();
  1125. #PurchaseInvoice.LastModDate_PurchaseInvoice=GetCurrentTime();
  1126. toolBar.EnableSubmit=GetRight(@Title,"修改");
  1127. toolBar.EnableModify=false;
  1128. toolBar.EnableDelete=false;
  1129. toolBar.EnableAudit=false;
  1130. toolBar.EnableNew=false;
  1131. toolBar.EnablePrint=false;
  1132. toolBar.EnableBlank=false;
  1133. toolBar.EnableImport = true;
  1134. UpdateForm(true, "");
  1135. @Status=3;
  1136. </Modify>
  1137. <SubmitButtonClick>
  1138. <![CDATA[
  1139. if(cbType.Text==StringEmpty())
  1140. {
  1141. MessageBox("请输入有效的发票种类!",@Title);
  1142. tbDetail.SelectedIndex = 0;
  1143. cbType.Focus();
  1144. return;
  1145. }
  1146. if(!Search("SearchSupplier",tbSupplierNo.CValue)|| !Equals(#PurchaseInvoice.ID_Supplier,#Supplier.ID_Supplier))
  1147. {
  1148. MessageBox("请输入有效供应商,回车以示确认!",@Title);
  1149. tbDetail.SelectedIndex = 0;
  1150. tbSupplierNo.Focus();
  1151. return;
  1152. }
  1153. if(RowCount("PurchaseInvoiceProduct")==0)
  1154. {
  1155. MessageBox("请输入进项发票产品!",@Title);
  1156. tbDetail.SelectedIndex = 1;
  1157. dgProduct.Focus();
  1158. return;
  1159. }
  1160. UpdateForm(false, "");
  1161. SuspendLayout();
  1162. for(@i=0;@i<RowCount("#PurchaseInvoiceProduct");@i=@i+1)
  1163. {
  1164. SetPosition("#PurchaseInvoiceProduct",@i);
  1165. if(Equals(#PurchaseInvoiceProduct.Name_BillType,"采购订单"))
  1166. {
  1167. if(Search("SearchPurchaseOrderBill",#PurchaseInvoiceProduct.No_FromBill,#PurchaseInvoiceProduct.No_FromBillProduct))
  1168. {
  1169. if(Equals(#PurchaseOrderBill.ID_Assessor,DBNull()))
  1170. {
  1171. tbDetail.SelectedIndex = 1;
  1172. dgProduct.CurrentRowIndex=@i;
  1173. MessageBox("该来源单据未经审核,提交失败!",@Title);
  1174. ResumeLayout();
  1175. return;
  1176. }
  1177. if(!Equals(#PurchaseOrderBill.ID_Supplier,#PurchaseInvoice.ID_Supplier))
  1178. {
  1179. tbDetail.SelectedIndex = 1;
  1180. dgProduct.CurrentRowIndex=@i;
  1181. MessageBox("该来源单据的供应商与本进项发票的供应商不一致,提交失败!",@Title);
  1182. ResumeLayout();
  1183. return;
  1184. }
  1185. if(!Equals(#PurchaseInvoiceProduct.ID_Product,#PurchaseOrderBill.ID_Product))
  1186. {
  1187. tbDetail.SelectedIndex = 1;
  1188. dgProduct.CurrentRowIndex = @i;
  1189. MessageBox("该来源单据产品单中指定的产品与后改写的产品不匹配!",@Title);
  1190. dgProduct.Focus();
  1191. ResumeLayout();
  1192. return;
  1193. }
  1194. }
  1195. }
  1196. if(Equals(#PurchaseInvoiceProduct.Name_BillType,"采购入库单"))
  1197. {
  1198. if(Search("SearchPurchaseInDepotBill",#PurchaseInvoiceProduct.No_FromBill,#PurchaseInvoiceProduct.No_FromBillProduct))
  1199. {
  1200. if(Equals(#PurchaseInDepotBill.ID_Assessor,DBNull()))
  1201. {
  1202. tbDetail.SelectedIndex = 1;
  1203. dgProduct.CurrentRowIndex=@i;
  1204. MessageBox("该来源单据未经审核,提交失败!",@Title);
  1205. ResumeLayout();
  1206. return;
  1207. }
  1208. if(!Equals(#PurchaseInDepotBill.ID_Supplier,#PurchaseInvoice.ID_Supplier))
  1209. {
  1210. tbDetail.SelectedIndex = 1;
  1211. dgProduct.CurrentRowIndex=@i;
  1212. MessageBox("该来源单据的供应商与本进项发票的供应商不一致,提交失败!",@Title);
  1213. ResumeLayout();
  1214. return;
  1215. }
  1216. if(!Equals(#PurchaseInvoiceProduct.ID_Product,#PurchaseInDepotBill.ID_Product))
  1217. {
  1218. tbDetail.SelectedIndex = 1;
  1219. dgProduct.CurrentRowIndex = @i;
  1220. MessageBox("该来源单据产品单中指定的产品与后改写的产品不匹配!",@Title);
  1221. dgProduct.Focus();
  1222. ResumeLayout();
  1223. return;
  1224. }
  1225. }
  1226. }
  1227. if(Equals(#PurchaseInvoiceProduct.No_Product,""))
  1228. {
  1229. tbDetail.SelectedIndex = 1;
  1230. dgProduct.CurrentRowIndex=@i;
  1231. MessageBox("请输入产品编号!",@Title);
  1232. ResumeLayout();
  1233. return;
  1234. }
  1235. if(Equals(#PurchaseInvoiceProduct.ID_Product,GuidEmpty()))
  1236. {
  1237. tbDetail.SelectedIndex = 1;
  1238. dgProduct.CurrentRowIndex=@i;
  1239. MessageBox("该产品不存在!",@Title);
  1240. ResumeLayout();
  1241. return;
  1242. }
  1243. if(#PurchaseInvoiceProduct.Quantity_PurchaseInvoiceProduct<=0)
  1244. {
  1245. tbDetail.SelectedIndex = 1;
  1246. dgProduct.CurrentRowIndex=@i;
  1247. MessageBox("数量不得小于等于0!",@Title);
  1248. ResumeLayout();
  1249. return;
  1250. }
  1251. if(#PurchaseInvoiceProduct.UnitPrice_PurchaseInvoiceProduct<0)
  1252. {
  1253. tbDetail.SelectedIndex = 1;
  1254. dgProduct.CurrentRowIndex=@i;
  1255. MessageBox("单价不得小于0!",@Title);
  1256. ResumeLayout();
  1257. return;
  1258. }
  1259. if(Equals(#PurchaseInvoiceProduct.ID_PurchaseInvoiceProduct,GuidEmpty()))
  1260. {
  1261. #PurchaseInvoiceProduct.ID_PurchaseInvoiceProduct=NewGuid();
  1262. }
  1263. #PurchaseInvoiceProduct.ID_PurchaseInvoice=#PurchaseInvoice.ID_PurchaseInvoice;
  1264. }
  1265. ResumeLayout();
  1266. if(@Status==1)
  1267. { #PurchaseInvoice.CreateDate_PurchaseInvoice=GetCurrentTime();
  1268. #PurchaseInvoice.No_PurchaseInvoice = New("#PurchaseInvoice.No_PurchaseInvoice", dtDate.CValue);
  1269. }
  1270. else if(@Status==3)
  1271. {
  1272. #PurchaseInvoice.LastModUser=GetCurrentUser();
  1273. #PurchaseInvoice.LastModUser_PurchaseInvoice=GetLoginUserID();
  1274. #PurchaseInvoice.LastModDate_PurchaseInvoice=GetCurrentTime();
  1275. Update();
  1276. }
  1277. ChangeMode("View",#PurchaseInvoice.ID_Assessor);
  1278. ]]>
  1279. </SubmitButtonClick>
  1280. <CountSum>
  1281. <![CDATA[
  1282. if (RowCount("#PurchaseInvoiceProduct") == 0)
  1283. {
  1284. txtMoneySum.CValue=0;;
  1285. txtTaxSum.CValue=0;
  1286. txtSum.CValue=0;
  1287. }
  1288. else
  1289. {
  1290. if(!ckIncludeTax.Checked)
  1291. {
  1292. txtMoneySum.CValue=SumOfCol("#PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct");
  1293. txtTaxSum.CValue=SumOfCol("#PurchaseInvoiceProduct.TaxAmount_PurchaseInvoiceProduct");
  1294. txtSum.CValue=txtMoneySum.CValue+txtTaxSum.CValue;
  1295. }
  1296. else
  1297. {
  1298. txtSum.CValue=SumOfCol("#PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct");
  1299. txtTaxSum.CValue=SumOfCol("#PurchaseInvoiceProduct.TaxAmount_PurchaseInvoiceProduct");
  1300. txtMoneySum.CValue=txtSum.CValue-txtTaxSum.CValue;
  1301. }
  1302. }
  1303. UpdateForm(false,"txtSum");
  1304. UpdateForm(false,"txtTaxSum");
  1305. UpdateForm(false,"txtMoneySum");
  1306. ]]>
  1307. </CountSum>
  1308. <FromBillChange>
  1309. if (!Equals(#PurchaseInvoiceProduct.Name_BillType,"")&amp;&amp;!Equals(#PurchaseInvoiceProduct.No_FromBill,"")&amp;&amp; !Equals(#PurchaseInvoiceProduct.No_FromBillProduct,""))
  1310. {
  1311. if(Equals(#PurchaseInvoiceProduct.Name_BillType,"采购订单")&amp;&amp;Search("SearchPurchaseOrderBillProduct",#PurchaseInvoiceProduct.No_FromBill,#PurchaseInvoiceProduct.No_FromBillProduct))
  1312. {
  1313. #PurchaseInvoiceProduct.ID_Product=#PurchaseOrderBillProduct.ID_Product;
  1314. #PurchaseInvoiceProduct.No_Product=#PurchaseOrderBillProduct.No_Product;
  1315. #PurchaseInvoiceProduct.Name_Product=#PurchaseOrderBillProduct.Name_Product;
  1316. #PurchaseInvoiceProduct.Unit_Product=#PurchaseOrderBillProduct.Unit_Product;
  1317. #PurchaseInvoiceProduct.Quantity_PurchaseInvoiceProduct=#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct;
  1318. #PurchaseInvoiceProduct.UnitPrice_PurchaseInvoiceProduct=#PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct;
  1319. #PurchaseInvoiceProduct.InvoiceName_Product=#PurchaseOrderBillProduct.InvoiceName_Product;
  1320. #PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct=FormatNumber(#PurchaseInvoiceProduct.Quantity_PurchaseInvoiceProduct*#PurchaseInvoiceProduct.UnitPrice_PurchaseInvoiceProduct,@PriceDecimal);
  1321. if(ckIncludeTax.Checked)
  1322. {
  1323. #PurchaseInvoiceProduct.TaxAmount_PurchaseInvoiceProduct=FormatNumber(#PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct*#PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct/(1+#PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct),@PriceDecimal);
  1324. }
  1325. else
  1326. {
  1327. #PurchaseInvoiceProduct.TaxAmount_PurchaseInvoiceProduct=FormatNumber(#PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct*#PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct,@PriceDecimal);
  1328. }
  1329. }
  1330. if(Equals(#PurchaseInvoiceProduct.Name_BillType,"采购入库单")&amp;&amp;Search("SearchPurchaseInDepotBillProduct",#PurchaseInvoiceProduct.No_FromBill,#PurchaseInvoiceProduct.No_FromBillProduct))
  1331. {
  1332. #PurchaseInvoiceProduct.ID_Product=#PurchaseInDepotBillProduct.ID_Product;
  1333. #PurchaseInvoiceProduct.No_Product=#PurchaseInDepotBillProduct.No_Product;
  1334. #PurchaseInvoiceProduct.Name_Product=#PurchaseInDepotBillProduct.Name_Product;
  1335. #PurchaseInvoiceProduct.Unit_Product=#PurchaseInDepotBillProduct.Unit_Product;
  1336. #PurchaseInvoiceProduct.Quantity_PurchaseInvoiceProduct=#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct;
  1337. #PurchaseInvoiceProduct.InvoiceName_Product=#PurchaseInDepotBillProduct.InvoiceName_Product;
  1338. #PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct=FormatNumber(#PurchaseInvoiceProduct.Quantity_PurchaseInvoiceProduct*#PurchaseInvoiceProduct.UnitPrice_PurchaseInvoiceProduct,@PriceDecimal);
  1339. if(ckIncludeTax.Checked)
  1340. {
  1341. #PurchaseInvoiceProduct.TaxAmount_PurchaseInvoiceProduct=FormatNumber(#PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct*#PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct/(1+#PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct),@PriceDecimal);
  1342. }
  1343. else
  1344. {
  1345. #PurchaseInvoiceProduct.TaxAmount_PurchaseInvoiceProduct=FormatNumber(#PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct*#PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct,@PriceDecimal);
  1346. }
  1347. }
  1348. }
  1349. </FromBillChange>
  1350. <CountAmount>
  1351. #PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct=FormatNumber(#PurchaseInvoiceProduct.Quantity_PurchaseInvoiceProduct*#PurchaseInvoiceProduct.UnitPrice_PurchaseInvoiceProduct,@PriceDecimal);
  1352. if(ckIncludeTax.Checked)
  1353. {
  1354. #PurchaseInvoiceProduct.TaxAmount_PurchaseInvoiceProduct=FormatNumber(#PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct*#PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct/(1+#PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct),@PriceDecimal);
  1355. }
  1356. else
  1357. {
  1358. #PurchaseInvoiceProduct.TaxAmount_PurchaseInvoiceProduct=FormatNumber(#PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct*#PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct,@PriceDecimal);
  1359. }
  1360. </CountAmount>
  1361. </Lables>
  1362. </Form>
  1363. </Forms>