FrmPayableStrike.xml 64 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <Forms>
  3. <Form Name="FrmPayableStrike">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @Title = "应付帐款冲帐";
  9. @ErrorDetail="";
  10. GetSchema();
  11. Search("SearchPayer");
  12. Search("SearchFromBillInInvoice","p");
  13. Search("SearchSystemSetting");
  14. @SysCurrency=#SystemSetting.SysCurrency_SystemSetting;
  15. ChangeMode("Search");
  16. dgReceiveMoney.NoMember = "No_PayablesStrikeMethod";
  17. dgBill.NoMember = "No_PayablesStrikeBills";
  18. Search("SearchPayablesStrikeMethod");
  19. ]]>
  20. </Load>
  21. <Closing>
  22. ;
  23. </Closing>
  24. <Closed>
  25. ;
  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. <IKDateTimePicker name="dtDate" DataSource="PayablesStrike.Date_PayablesStrike"></IKDateTimePicker>
  44. <IKTextButton name="tbNo" DataSource="PayablesStrike.No_PayablesStrike">
  45. <Events>
  46. <Enter>
  47. <![CDATA[
  48. if (tbNo.ReadOnly == false)
  49. {
  50. if (tbNo.CValue != StringEmpty())
  51. {
  52. UpdateForm(false, "");
  53. if (Search("SearchPayablesStrikeWithNo", tbNo.CValue))
  54. {
  55. ChangeMode("View",#PayablesStrike.ID_Assessor);
  56. }
  57. else
  58. {
  59. MessageBox("该应付帐款冲帐单据不存在!", @Title);
  60. return;
  61. }
  62. }
  63. else
  64. {
  65. MessageBox("请输入应付帐款冲帐单号!", @Title);
  66. return;
  67. }
  68. }
  69. ]]>
  70. <Lable name="CountSum" />
  71. </Enter>
  72. <Click>
  73. ShowSearchBox("BillSearch","NODEPOT", "tbNo", tbNo.CValue);
  74. </Click>
  75. </Events>
  76. </IKTextButton>
  77. <IKCheckBox name="cbPrev" DataSource="PayablesStrike.Prev_PayablesStrike">
  78. <Events>
  79. <CheckedChanged>
  80. <![CDATA[
  81. if (cbPrev.Checked)
  82. {
  83. btnSearchByInvoice.Enabled = false;
  84. btnAutoStrike.Enabled = false;
  85. }
  86. else
  87. {
  88. btnSearchByInvoice.Enabled = true;
  89. btnAutoStrike.Enabled = true;
  90. }
  91. ]]>
  92. </CheckedChanged>
  93. </Events>
  94. </IKCheckBox>
  95. <IKTextButton name="tbSupplierNo" DataSource="PayablesStrike.No_Supplier">
  96. <Events>
  97. <Enter>
  98. <![CDATA[
  99. if (tbSupplierNo.ReadOnly == false)
  100. {
  101. UpdateForm(false, "");
  102. if (tbSupplierNo.CValue == "" || !Search("SearchSupplierWithNo", #PayablesStrike.No_Supplier))
  103. {
  104. if (tbSupplierNo.CValue == "")
  105. {
  106. MessageBox("请输入供应商编号!", @Title);
  107. }
  108. else
  109. {
  110. MessageBox("该供应商不存在!", @Title);
  111. @temp = ShowSearchBox("SupplierSearch","INFOMATION",tbSupplierNo.CValue);
  112. if (@temp != "")
  113. {
  114. tbSupplierNo.CValue = @temp;
  115. ActiveControlEvent("tbSupplierNo", "Enter");
  116. return;
  117. }
  118. }
  119. #PayablesStrike.ID_Supplier = GuidEmpty();
  120. #PayablesStrike.ShortName_Supplier = "";
  121. #PayablesStrike.PreGetBalance_Supplier = 0;
  122. }
  123. else
  124. {
  125. if (!Equals(#Supplier.SuspendDate_Supplier,DBNull()))
  126. {
  127. MessageBox("该供应商已停用!", @Title);
  128. }
  129. #PayablesStrike.ID_Supplier = #Supplier.ID_Supplier;
  130. #PayablesStrike.ShortName_Supplier = #Supplier.ShortName_Supplier;
  131. #PayablesStrike.PreGetBalance_Supplier = #Supplier.PreGetBalance_Supplier;
  132. }
  133. UpdateForm(true, "");
  134. }
  135. ]]>
  136. </Enter>
  137. <Click>
  138. <![CDATA[
  139. if (tbSupplierNo.ReadOnly == false)
  140. {
  141. @temp = ShowSearchBox("SupplierSearch","INFOMATION",tbSupplierNo.CValue);
  142. if ( @temp == "" )
  143. return;
  144. tbSupplierNo.CValue = @temp;
  145. ActiveControlEvent("tbSupplierNo", "Enter");
  146. }
  147. ]]>
  148. </Click>
  149. </Events>
  150. </IKTextButton>
  151. <IKTextBox name="txtSupplierName" DataSource="PayablesStrike.ShortName_Supplier"></IKTextBox>
  152. <IKComboBoxEx name="cbGetCurrency" DisplaySource="PayablesStrike.GetCurrency_PayablesStrike" DataSource="PayablesStrike"></IKComboBoxEx>
  153. <IKComboBoxEx name="cbBillCurrency" DisplaySource="PayablesStrike.BillCurrency_PayablesStrike" DataSource="PayablesStrike"></IKComboBoxEx>
  154. <IKNumericTextBox name="txtRate" DataSource="PayablesStrike.Rate_PayablesStrike"></IKNumericTextBox>
  155. <IKComboBoxEx name="cbPayer" ValueSource="PayablesStrike.ID_Payer" DisplaySource="PayablesStrike.Name_Employee" NoSource="PayablesStrike.No_Payer" DataSource="Payer" DisplayMember="Name_Employee" NoMember="No_Employee" ValueMember="ID_Employee">
  156. <Events>
  157. <Reload>
  158. UpdateForm(false, "cbPayer");
  159. Search("SearchPayer");
  160. UpdateForm(true, "cbPayer");
  161. </Reload>
  162. </Events>
  163. </IKComboBoxEx>
  164. <IKTextBox name="txtMaker" DataSource="PayablesStrike.Name_Creator"></IKTextBox>
  165. <IKTextBox name="txtAssessor" DataSource="PayablesStrike.Name_Assessor"></IKTextBox>
  166. <IKTextBox name="dtAssessDate" DataSource="PayablesStrike.AssessDate_PayablesStrike"></IKTextBox>
  167. <IKTextBox name="txtLastModUser" DataSource="PayablesStrike.Name_LastModUser"></IKTextBox>
  168. <IKTextBox name="dtLastModDate" DataSource="PayablesStrike.LastModDate_PayablesStrike"></IKTextBox>
  169. <IKTextBox name="txtComment" DataSource="PayablesStrike.Comment_PayablesStrike"></IKTextBox>
  170. <IKButton name="btnSearchByInvoice">
  171. <Events>
  172. <Click>
  173. <![CDATA[
  174. @DateStart = DBNull();
  175. @DateEnd = DBNull();
  176. if (dtStart.Checked)
  177. {
  178. @DateStart = dtStart.CValue;
  179. }
  180. if (dtEnd.Checked)
  181. {
  182. @DateEnd = dtEnd.CValue;
  183. }
  184. ShowSearchBox("", "STRIKEIMPORT", "进项发票", "#PayablesStrikeBills", @DateStart, @DateEnd);
  185. if (RowCount("#PayablesStrikeBills") > 0)
  186. {
  187. for (@i=0; @i<RowCount("#PayablesStrikeBills"); @i=@i+1)
  188. {
  189. dgBill.CurrentRowIndex = @i;
  190. }
  191. dgBill.CurrentRowIndex = 0;
  192. }
  193. ]]>
  194. </Click>
  195. </Events>
  196. </IKButton>
  197. <IKButton name="btnVerify">
  198. <Events>
  199. <Click>
  200. <Lable name="Verify" />
  201. MessageBox("校验已通过!",@Title);
  202. </Click>
  203. </Events>
  204. </IKButton>
  205. <IKButton name="btnAutoStrike">
  206. <Events>
  207. <Click>
  208. <![CDATA[
  209. if (RowCount("#PayablesStrikeMethod") > 0 && RowCount("#PayablesStrikeBills") > 0)
  210. {
  211. @AllStrikeAmount = SumOfCol("#PayablesStrikeMethod.Amount_PayablesStrikeMethod");
  212. SuspendLayout();
  213. for (@j=0; @j<RowCount("#PayablesStrikeBills"); @j=@j+1)
  214. {
  215. SetPosition("#PayablesStrikeBills", @j);
  216. if (@AllStrikeAmount >= #PayablesStrikeBills.ToPayAmount_PayablesStrikeBills)
  217. {
  218. @AllStrikeAmount -= #PayablesStrikeBills.ToPayAmount_PayablesStrikeBills;
  219. #PayablesStrikeBills.Strike_PayablesStrikeBills = #PayablesStrikeBills.ToPayAmount_PayablesStrikeBills;
  220. }
  221. else
  222. {
  223. #PayablesStrikeBills.Strike_PayablesStrikeBills = @AllStrikeAmount;
  224. @AllStrikeAmount = 0;
  225. }
  226. }
  227. ResumeLayout();
  228. }
  229. ]]>
  230. <Lable name="CountSum" />
  231. </Click>
  232. </Events>
  233. </IKButton>
  234. <IKDataGridEx name="dgReceiveMoney" DataSource="PayablesStrikeMethod" TableStyleIndex="0">
  235. <DataColumn Index="0" DataSource="PayablesStrikeMethod.No_PayablesStrikeMethod" />
  236. <DataColumn Index="1" DataSource="PayablesStrikeMethod.Type_PayablesStrikeMethod">
  237. <IKDataGridComboBoxColumn DisplaySourceEx="PayablesStrikeMethod.Type_PayablesStrikeMethod" ValueSourceEx="PayablesStrikeMethod.Type_PayablesStrikeMethod" DataSourceEx="Method" DisplayMemberEx="Result" ValueMemberEx="Result">
  238. <Events>
  239. <Reload>
  240. Search("SearchPayablesStrikeMethod");
  241. SetDataGridColumnDataSource(1,"dgReceiveMoney");
  242. </Reload>
  243. </Events>
  244. </IKDataGridComboBoxColumn>
  245. </DataColumn>
  246. <DataColumn Index="2" DataSource="PayablesStrikeMethod.Amount_PayablesStrikeMethod" />
  247. <DataColumn Index="3" DataSource="PayablesStrikeMethod.Comment_PayablesStrikeMethod" />
  248. </IKDataGridEx>
  249. <IKDataGridEx name="dgBill" DataSource="PayablesStrikeBills" TableStyleIndex="0">
  250. <DataColumn Index="0" DataSource="PayablesStrikeBills.No_PayablesStrikeBills" />
  251. <DataColumn Index="1" DataSource="PayablesStrikeBills.No_PurchaseInvoice" />
  252. <DataColumn Index="2" DataSource="PayablesStrikeBills.No_Invoice" />
  253. <DataColumn Index="3" DataSource="PayablesStrikeBills.PayDate_PayablesStrikeBills" />
  254. <DataColumn Index="4" DataSource="PayablesStrikeBills.Amount_FromBill" />
  255. <DataColumn Index="5" DataSource="PayablesStrikeBills.ToPayAmount_PayablesStrikeBills" />
  256. <DataColumn Index="6" DataSource="PayablesStrikeBills.Strike_PayablesStrikeBills" />
  257. <DataColumn Index="7" DataSource="PayablesStrikeBills.Discount_PayablesStrikeBills" />
  258. <DataColumn Index="8" DataSource="PayablesStrikeBills.StrikedAmount_PayablesStrikeBills" />
  259. </IKDataGridEx>
  260. <IKFormToolBar name="toolBar">
  261. <Events>
  262. <ClickFirst>
  263. if (Search("SearchPayablesStrikeFirst", tbNo.CValue))
  264. {
  265. ChangeMode("View",#PayablesStrike.ID_Assessor);
  266. <Lable name="CountSum" />
  267. }
  268. </ClickFirst>
  269. <ClickPrev>
  270. if (Search("SearchPayablesStrikePrevious", tbNo.CValue))
  271. {
  272. ChangeMode("View",#PayablesStrike.ID_Assessor);
  273. <Lable name="CountSum" />
  274. }
  275. </ClickPrev>
  276. <ClickNext>
  277. if (Search("SearchPayablesStrikeNext", tbNo.CValue))
  278. {
  279. ChangeMode("View",#PayablesStrike.ID_Assessor);
  280. <Lable name="CountSum" />
  281. }
  282. </ClickNext>
  283. <ClickLast>
  284. if (Search("SearchPayablesStrikeLast", tbNo.CValue))
  285. {
  286. ChangeMode("View",#PayablesStrike.ID_Assessor);
  287. <Lable name="CountSum" />
  288. }
  289. </ClickLast>
  290. <ClickEmpty>
  291. ChangeMode("Search");
  292. </ClickEmpty>
  293. <ClickNew>
  294. <![CDATA[
  295. @NextNo = GetNextAutoNumber(true);
  296. if (!Equals(@NextNo, ""))
  297. {
  298. ChangeMode("New");
  299. #PayablesStrike.No_PayablesStrike = @NextNo;
  300. UpdateForm(true, "tbNo");
  301. }
  302. ]]>
  303. </ClickNew>
  304. <ClickSubmit>
  305. <Lable name="Verify" />
  306. <Lable name="SubmitButtonClick" />
  307. </ClickSubmit>
  308. <ClickModify>
  309. ChangeMode("Modify");
  310. <Lable name="CountSum" />
  311. </ClickModify>
  312. <ClickDelete>
  313. Delete();
  314. ChangeMode("Search");
  315. </ClickDelete>
  316. <ClickPrint>
  317. PrintReport();
  318. </ClickPrint>
  319. <ClickAudit>
  320. BeginAudit();
  321. #PayablesStrike.ID_Assessor = GetLoginUserID();
  322. #PayablesStrike.Name_Assessor = GetCurrentUser();
  323. #PayablesStrike.AssessDate_PayablesStrike = DateTimeNow();
  324. Audit();
  325. ChangeMode("View",#PayablesStrike.ID_Assessor);
  326. EndAudit();
  327. <Lable name="CountSum" />
  328. </ClickAudit>
  329. <ClickUnAudit>
  330. BeginUnAudit();
  331. #PayablesStrike.ID_Assessor = DBNull();
  332. #PayablesStrike.Name_Assessor = "";
  333. UnAudit();
  334. ChangeMode("View",#PayablesStrike.ID_Assessor);
  335. EndUnAudit();
  336. <Lable name="CountSum" />
  337. </ClickUnAudit>
  338. <ClickImport>
  339. ;
  340. </ClickImport>
  341. <ClickExport>
  342. ;
  343. </ClickExport>
  344. <ClickClose>
  345. ;
  346. </ClickClose>
  347. <ClickExpand>
  348. if (toolBar.ExpandForm==true)
  349. {
  350. pnRight.Visible=true;<!--PanelRight is not existed-->
  351. }
  352. else
  353. {
  354. pnRight.Visible=false;
  355. }
  356. </ClickExpand>
  357. </Events>
  358. </IKFormToolBar>
  359. </Controls>
  360. <Tables>
  361. <Table name="PayablesStrikeBills">
  362. <Events>
  363. <ColumnsChanged>
  364. <No_PurchaseInvoice>
  365. <Lable name="GetFromBill" />
  366. </No_PurchaseInvoice>
  367. <Discount_PayablesStrikeBills>
  368. #PayablesStrikeBills.ToPayAmount_PayablesStrikeBills=#PayablesStrikeBills.Amount_FromBill-#PayablesStrikeBills.StrikedAmount_PayablesStrikeBills-#PayablesStrikeBills.Discount_PayablesStrikeBills;
  369. <Lable name="CountSum" />
  370. </Discount_PayablesStrikeBills>
  371. </ColumnsChanged>
  372. <RowDeleted>
  373. <Lable name="CountSum" />
  374. </RowDeleted>
  375. </Events>
  376. </Table>
  377. </Tables>
  378. <LockInfomation LockID="ID_PayablesStrike" LockNO="No_PayablesStrike" LockSearchFunction="SearchPayablesStrikeWithNo" LockAudit="ID_Assessor"/>
  379. <LogInfomation LogNO="#PayablesStrike.No_PayablesStrike" RecordFormField="供应商编号:#PayablesStrike.No_Supplier" RecordDataGridField="#PayablesStrikeBills.No_FromBill,#PayablesStrikeBills.Strike_PayablesStrikeBills,#PayablesStrikeMethod.Amount_PayablesStrikeMethod"/>
  380. <ChildForms>
  381. <ChildForm name="BillSearch" DataSource="PayablesStrike" SearchFunction="SearchAllBill" SearchFunctionByNo="SearchPayablesStrikeWithNo">
  382. <DataColumn Index="0" MappingName="#PayablesStrike.No_PayablesStrike" HeaderText="应付帐款冲帐单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  383. <DataColumn Index="1" MappingName="#PayablesStrike.Date_PayablesStrike" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  384. <DataColumn Index="2" MappingName="#PayablesStrike.ShortName_Supplier" HeaderText="供应商简称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  385. </ChildForm>
  386. <ChildForm name="SupplierSearch" DataSource="Supplier" SearchFunction="SearchAllSupplier" SearchFunctionByNo="" MappingName="供应商">
  387. <DataColumn Index="0" MappingName="#Supplier.No_Supplier" HeaderText="供应商编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  388. <DataColumn Index="1" MappingName="#Supplier.ShortName_Supplier" HeaderText="供应商简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  389. </ChildForm>
  390. </ChildForms>
  391. </Client>
  392. <Server>
  393. <Tables>
  394. <Table name="PayablesStrike" Type="Parent">
  395. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 PayablesStrike.*, Supplier.No_Supplier, Supplier.ShortName_Supplier, Supplier.PreGetBalance_Supplier, Employee.No_Employee AS No_Payer,Employee.Name_Employee,
  396. a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS Name_LastModUser,
  397. CONVERT(decimal(18,6), 0) AS SumPay
  398. FROM PayablesStrike
  399. LEFT JOIN Supplier ON Supplier.ID_Supplier = PayablesStrike.ID_Supplier
  400. LEFT JOIN Employee ON Employee.ID_Employee = PayablesStrike.ID_Payer
  401. LEFT JOIN AppUser a ON a.ID_User = PayablesStrike.ID_Creator
  402. LEFT JOIN AppUser b ON b.ID_User = PayablesStrike.ID_Assessor
  403. LEFT JOIN AppUser c ON c.ID_User = PayablesStrike.LastModUser_PayablesStrike" />
  404. <New CmdType="Text" CmdText=" INSERT INTO PayablesStrike (ID_PayablesStrike, No_PayablesStrike, Date_PayablesStrike,
  405. ID_Supplier, GetCurrency_PayablesStrike, BillCurrency_PayablesStrike, Rate_PayablesStrike,
  406. ID_Payer, ID_Creator, Comment_PayablesStrike, CreateDate_PayablesStrike, Prev_PayablesStrike)
  407. VALUES (@ID_PayablesStrike, @No_PayablesStrike, @Date_PayablesStrike,
  408. @ID_Supplier, @GetCurrency_PayablesStrike, @BillCurrency_PayablesStrike, @Rate_PayablesStrike,
  409. @ID_Payer, @ID_Creator, @Comment_PayablesStrike, @CreateDate_PayablesStrike, @Prev_PayablesStrike)">
  410. <Params>
  411. <Param name="@ID_PayablesStrike" type="PayablesStrike.ID_PayablesStrike" sourceColumn="ID_PayablesStrike" />
  412. <Param name="@No_PayablesStrike" type="PayablesStrike.No_PayablesStrike" sourceColumn="No_PayablesStrike" />
  413. <Param name="@Date_PayablesStrike" type="PayablesStrike.Date_PayablesStrike" sourceColumn="Date_PayablesStrike" />
  414. <Param name="@ID_Supplier" type="PayablesStrike.ID_Supplier" sourceColumn="ID_Supplier" />
  415. <Param name="@GetCurrency_PayablesStrike" type="PayablesStrike.GetCurrency_PayablesStrike" sourceColumn="GetCurrency_PayablesStrike" />
  416. <Param name="@BillCurrency_PayablesStrike" type="PayablesStrike.BillCurrency_PayablesStrike" sourceColumn="BillCurrency_PayablesStrike" />
  417. <Param name="@Rate_PayablesStrike" type="PayablesStrike.Rate_PayablesStrike" sourceColumn="Rate_PayablesStrike" />
  418. <Param name="@ID_Payer" type="PayablesStrike.ID_Payer" sourceColumn="ID_Payer" />
  419. <Param name="@ID_Creator" type="PayablesStrike.ID_Creator" sourceColumn="ID_Creator" />
  420. <Param name="@Comment_PayablesStrike" type="PayablesStrike.Comment_PayablesStrike" sourceColumn="Comment_PayablesStrike" />
  421. <Param name="@CreateDate_PayablesStrike" type="PayablesStrike.CreateDate_PayablesStrike" sourceColumn="CreateDate_PayablesStrike" />
  422. <Param name="@Prev_PayablesStrike" type="PayablesStrike.Prev_PayablesStrike" sourceColumn="Prev_PayablesStrike" />
  423. </Params>
  424. </New>
  425. <Update CmdType="Text" CmdText=" UPDATE PayablesStrike SET Date_PayablesStrike = @Date_PayablesStrike,
  426. ID_Supplier = @ID_Supplier, GetCurrency_PayablesStrike = @GetCurrency_PayablesStrike,
  427. BillCurrency_PayablesStrike = @BillCurrency_PayablesStrike, Rate_PayablesStrike = @Rate_PayablesStrike,
  428. ID_Payer = @ID_Payer, Comment_PayablesStrike = @Comment_PayablesStrike,
  429. LastModUser_PayablesStrike = @LastModUser_PayablesStrike, LastModDate_PayablesStrike = @LastModDate_PayablesStrike,
  430. Prev_PayablesStrike = @Prev_PayablesStrike
  431. WHERE ID_PayablesStrike = @ID_PayablesStrike">
  432. <Params>
  433. <Param name="@ID_PayablesStrike" type="PayablesStrike.ID_PayablesStrike" sourceColumn="ID_PayablesStrike" />
  434. <Param name="@Date_PayablesStrike" type="PayablesStrike.Date_PayablesStrike" sourceColumn="Date_PayablesStrike" />
  435. <Param name="@ID_Supplier" type="PayablesStrike.ID_Supplier" sourceColumn="ID_Supplier" />
  436. <Param name="@GetCurrency_PayablesStrike" type="PayablesStrike.GetCurrency_PayablesStrike" sourceColumn="GetCurrency_PayablesStrike" />
  437. <Param name="@BillCurrency_PayablesStrike" type="PayablesStrike.BillCurrency_PayablesStrike" sourceColumn="BillCurrency_PayablesStrike" />
  438. <Param name="@Rate_PayablesStrike" type="PayablesStrike.Rate_PayablesStrike" sourceColumn="Rate_PayablesStrike" />
  439. <Param name="@ID_Payer" type="PayablesStrike.ID_Payer" sourceColumn="ID_Payer" />
  440. <Param name="@Comment_PayablesStrike" type="PayablesStrike.Comment_PayablesStrike" sourceColumn="Comment_PayablesStrike" />
  441. <Param name="@LastModUser_PayablesStrike" type="PayablesStrike.LastModUser_PayablesStrike" sourceColumn="LastModUser_PayablesStrike" />
  442. <Param name="@LastModDate_PayablesStrike" type="PayablesStrike.LastModDate_PayablesStrike" sourceColumn="LastModDate_PayablesStrike" />
  443. <Param name="@Prev_PayablesStrike" type="PayablesStrike.Prev_PayablesStrike" sourceColumn="Prev_PayablesStrike" />
  444. </Params>
  445. </Update>
  446. <Audit CmdType="Text" CmdText="
  447. Declare @No_PurchaseInvoice nvarchar(64)
  448. Declare @Strike_PayablesStrikeBills decimal(18,6)
  449. Declare @Discount_PayablesStrikeBills decimal(18,6)
  450. Declare @Type_PayablesStrikeMethod nvarchar(64)
  451. Declare @Amount_PayablesStrikeMethod decimal(18,6)
  452. Declare @ID_Assessor_PurchaseInvoice uniqueidentifier
  453. Declare @Disable_PurchaseInvoice bit
  454. Declare @Amount_PurchaseInvoice decimal(18,6)
  455. Declare @StrikedAmount_PurchaseInvoice decimal(18,6)
  456. Declare @error nvarchar(256)
  457. DECLARE @StrikePreGet decimal(18,6)
  458. DECLARE @StrikeAll decimal(18,6)
  459. SELECT @StrikePreGet = ISNULL(SUM(PayablesStrikeMethod.Amount_PayablesStrikeMethod),0) FROM PayablesStrikeMethod WHERE PayablesStrikeMethod.ID_PayablesStrike = @ID_PayablesStrike AND PayablesStrikeMethod.Type_PayablesStrikeMethod = '冲减预付款'
  460. SELECT @StrikeAll = SUM(PayablesStrikeMethod.Amount_PayablesStrikeMethod) FROM PayablesStrikeMethod WHERE PayablesStrikeMethod.ID_PayablesStrike = @ID_PayablesStrike
  461. IF (@ID_Assessor IS NOT NULL)
  462. BEGIN
  463. IF ((SELECT PreGetBalance_Supplier FROM Supplier WHERE ID_Supplier = @ID_Supplier) &lt; @StrikePreGet)
  464. BEGIN
  465. SET @error = N'该供应商的预付帐款余额小于此次冲帐所使用的金额,审核失败!'
  466. RAISERROR(@error,16,1)
  467. RETURN
  468. END
  469. END
  470. ELSE
  471. BEGIN
  472. SET @StrikePreGet = - @StrikePreGet
  473. SET @StrikeAll = - @StrikeAll
  474. END
  475. IF (@Prev_PayablesStrike = 0)
  476. BEGIN
  477. DECLARE CUR CURSOR FOR SELECT PayablesStrikeBills.No_PurchaseInvoice,Strike_PayablesStrikeBills,Discount_PayablesStrikeBills,
  478. PurchaseInvoice.ID_Assessor ,PurchaseInvoice.Disable_PurchaseInvoice,PurchaseInvoice.Amount_PurchaseInvoice,PurchaseInvoice.StrikedAmount_PurchaseInvoice
  479. FROM PayablesStrikeBills
  480. Left Join PurchaseInvoice On PurchaseInvoice.No_PurchaseInvoice=PayablesStrikeBills.No_PurchaseInvoice
  481. WHERE ID_PayablesStrike = @ID_PayablesStrike
  482. OPEN CUR
  483. FETCH NEXT FROM CUR INTO @No_PurchaseInvoice, @Strike_PayablesStrikeBills, @Discount_PayablesStrikeBills, @ID_Assessor_PurchaseInvoice, @Disable_PurchaseInvoice, @Amount_PurchaseInvoice,@StrikedAmount_PurchaseInvoice
  484. WHILE @@FETCH_STATUS = 0
  485. BEGIN
  486. IF (@ID_Assessor IS NULL)
  487. BEGIN
  488. set @Strike_PayablesStrikeBills = -@Strike_PayablesStrikeBills
  489. set @Discount_PayablesStrikeBills = -@Discount_PayablesStrikeBills
  490. END
  491. IF (@ID_Assessor IS NOT NULL)
  492. BEGIN
  493. IF(@ID_Assessor_PurchaseInvoice IS NULL)
  494. BEGIN
  495. SET @error = N'编号为' + @No_PurchaseInvoice + '的进项发票尚未经过审核,审核失败!'
  496. RAISERROR(@error,16,1)
  497. RETURN
  498. END
  499. IF(@Disable_PurchaseInvoice=1)
  500. BEGIN
  501. SET @error = N'编号为' + @No_PurchaseInvoice+ '的发票已作废,审核失败!'
  502. RAISERROR(@error,16,1)
  503. RETURN
  504. END
  505. IF ((@Strike_PayablesStrikeBills + @Discount_PayablesStrikeBills) &gt; ( @Amount_PurchaseInvoice-@StrikedAmount_PurchaseInvoice))
  506. BEGIN
  507. SET @error = N'编号为' + @No_PurchaseInvoice + '的发票未冲减金额小于本次冲帐和本次折让的和,审核失败!'
  508. RAISERROR(@error,16,1)
  509. RETURN
  510. END
  511. END
  512. Update PurchaseInvoice Set StrikedAmount_PurchaseInvoice=(StrikedAmount_PurchaseInvoice+@Strike_PayablesStrikeBills + @Discount_PayablesStrikeBills)
  513. Where No_PurchaseInvoice=@No_PurchaseInvoice
  514. FETCH NEXT FROM CUR INTO @No_PurchaseInvoice, @Strike_PayablesStrikeBills, @Discount_PayablesStrikeBills, @ID_Assessor_PurchaseInvoice, @Disable_PurchaseInvoice, @Amount_PurchaseInvoice,@StrikedAmount_PurchaseInvoice
  515. END
  516. CLOSE CUR
  517. DEALLOCATE CUR
  518. END
  519. UPDATE Supplier SET PreGetBalance_Supplier = (PreGetBalance_Supplier - @StrikePreGet), ToPayBalance_Supplier = (ToPayBalance_Supplier - @StrikeAll) WHERE ID_Supplier = @ID_Supplier
  520. UPDATE PayablesStrike SET ID_Assessor = @ID_Assessor, AssessDate_PayablesStrike = @AssessDate_PayablesStrike WHERE ID_PayablesStrike = @ID_PayablesStrike
  521. ">
  522. <Params>
  523. <Param name="@ID_PayablesStrike" type="PayablesStrike.ID_PayablesStrike" sourceColumn="ID_PayablesStrike" />
  524. <Param name="@ID_Supplier" type="PayablesStrike.ID_Supplier" sourceColumn="ID_Supplier" />
  525. <Param name="@ID_Assessor" type="PayablesStrike.ID_Assessor" sourceColumn="ID_Assessor" />
  526. <Param name="@AssessDate_PayablesStrike" type="PayablesStrike.AssessDate_PayablesStrike" sourceColumn="AssessDate_PayablesStrike" />
  527. <Param name="@Prev_PayablesStrike" type="PayablesStrike.Prev_PayablesStrike" sourceColumn="Prev_PayablesStrike" />
  528. </Params>
  529. </Audit>
  530. <Delete CmdType="Text" CmdText=" DELETE PayablesStrikeMethod WHERE PayablesStrikeMethod.ID_PayablesStrike = @ID_PayablesStrike
  531. DELETE PayablesStrikeBills WHERE PayablesStrikeBills.ID_PayablesStrike = @ID_PayablesStrike
  532. DELETE PayablesStrike WHERE PayablesStrike.ID_PayablesStrike = @ID_PayablesStrike">
  533. <Params>
  534. <Param name="@ID_PayablesStrike" type="PayablesStrike.ID_PayablesStrike" sourceColumn="ID_PayablesStrike" />
  535. </Params>
  536. </Delete>
  537. <FKErrorReport ErrorMessage="该单据已被其他单据引用,删除失败!" />
  538. <UNIQUEErrorReport ErrorMessage="该应付帐款冲帐单号已存在,提交失败!" />
  539. </Table>
  540. <Table name="PayablesStrikeMethod" Type="Child">
  541. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 PayablesStrikeMethod.* FROM PayablesStrikeMethod" />
  542. <New CmdType="Text" CmdText=" INSERT INTO PayablesStrikeMethod (ID_PayablesStrikeMethod, No_PayablesStrikeMethod, ID_PayablesStrike,
  543. Type_PayablesStrikeMethod, Amount_PayablesStrikeMethod, Comment_PayablesStrikeMethod)
  544. VALUES (@ID_PayablesStrikeMethod, @No_PayablesStrikeMethod, @ID_PayablesStrike,
  545. @Type_PayablesStrikeMethod, @Amount_PayablesStrikeMethod, @Comment_PayablesStrikeMethod)">
  546. <Params>
  547. <Param name="@ID_PayablesStrikeMethod" type="PayablesStrikeMethod.ID_PayablesStrikeMethod" sourceColumn="ID_PayablesStrikeMethod" />
  548. <Param name="@No_PayablesStrikeMethod" type="PayablesStrikeMethod.No_PayablesStrikeMethod" sourceColumn="No_PayablesStrikeMethod" />
  549. <Param name="@ID_PayablesStrike" type="PayablesStrikeMethod.ID_PayablesStrike" sourceColumn="ID_PayablesStrike" />
  550. <Param name="@Type_PayablesStrikeMethod" type="PayablesStrikeMethod.Type_PayablesStrikeMethod" sourceColumn="Type_PayablesStrikeMethod" />
  551. <Param name="@Amount_PayablesStrikeMethod" type="PayablesStrikeMethod.Amount_PayablesStrikeMethod" sourceColumn="Amount_PayablesStrikeMethod" />
  552. <Param name="@Comment_PayablesStrikeMethod" type="PayablesStrikeMethod.Comment_PayablesStrikeMethod" sourceColumn="Comment_PayablesStrikeMethod" />
  553. </Params>
  554. </New>
  555. <Update CmdType="Text" CmdText=" UPDATE PayablesStrikeMethod SET Type_PayablesStrikeMethod = @Type_PayablesStrikeMethod,
  556. Amount_PayablesStrikeMethod = @Amount_PayablesStrikeMethod, Comment_PayablesStrikeMethod = @Comment_PayablesStrikeMethod
  557. WHERE ID_PayablesStrikeMethod = @ID_PayablesStrikeMethod">
  558. <Params>
  559. <Param name="@ID_PayablesStrikeMethod" type="PayablesStrikeMethod.ID_PayablesStrikeMethod" sourceColumn="ID_PayablesStrikeMethod" />
  560. <Param name="@Type_PayablesStrikeMethod" type="PayablesStrikeMethod.Type_PayablesStrikeMethod" sourceColumn="Type_PayablesStrikeMethod" />
  561. <Param name="@Amount_PayablesStrikeMethod" type="PayablesStrikeMethod.Amount_PayablesStrikeMethod" sourceColumn="Amount_PayablesStrikeMethod" />
  562. <Param name="@Comment_PayablesStrikeMethod" type="PayablesStrikeMethod.Comment_PayablesStrikeMethod" sourceColumn="Comment_PayablesStrikeMethod" />
  563. </Params>
  564. </Update>
  565. <Delete CmdType="Text" CmdText=" DELETE PayablesStrikeMethod WHERE ID_PayablesStrikeMethod = @ID_PayablesStrikeMethod">
  566. <Params>
  567. <Param name="@ID_PayablesStrikeMethod" type="PayablesStrikeMethod.ID_PayablesStrikeMethod" sourceColumn="ID_PayablesStrikeMethod" />
  568. </Params>
  569. </Delete>
  570. </Table>
  571. <Table name="PayablesStrikeBills" Type="Child">
  572. <GetSchema CmdType="Text" CmdText="
  573. SELECT TOP 0 PayablesStrikeBills.*
  574. FROM PayablesStrikeBills
  575. " />
  576. <New CmdType="Text" CmdText=" INSERT INTO PayablesStrikeBills (ID_PayablesStrikeBills, No_PayablesStrikeBills,
  577. ID_PayablesStrike,No_PurchaseInvoice, No_Invoice,
  578. PayDate_PayablesStrikeBills,Amount_FromBill,ToPayAmount_PayablesStrikeBills,Strike_PayablesStrikeBills,Discount_PayablesStrikeBills,StrikedAmount_PayablesStrikeBills )
  579. VALUES (@ID_PayablesStrikeBills, @No_PayablesStrikeBills,
  580. @ID_PayablesStrike, @No_PurchaseInvoice, @No_Invoice,
  581. @PayDate_PayablesStrikeBills,@Amount_FromBill,@ToPayAmount_PayablesStrikeBills,@Strike_PayablesStrikeBills,@Discount_PayablesStrikeBills,@StrikedAmount_PayablesStrikeBills ) ">
  582. <Params>
  583. <Param name="@ID_PayablesStrikeBills" type="PayablesStrikeBills.ID_PayablesStrikeBills" sourceColumn="ID_PayablesStrikeBills" />
  584. <Param name="@No_PayablesStrikeBills" type="PayablesStrikeBills.No_PayablesStrikeBills" sourceColumn="No_PayablesStrikeBills" />
  585. <Param name="@ID_PayablesStrike" type="PayablesStrikeBills.ID_PayablesStrike" sourceColumn="ID_PayablesStrike" />
  586. <Param name="@No_PurchaseInvoice" type="PayablesStrikeBills.No_PurchaseInvoice" sourceColumn="No_PurchaseInvoice" />
  587. <Param name="@No_Invoice" type="PayablesStrikeBills.No_Invoice" sourceColumn="No_Invoice" />
  588. <Param name="@PayDate_PayablesStrikeBills" type="PayablesStrikeBills.PayDate_PayablesStrikeBills" sourceColumn="PayDate_PayablesStrikeBills" />
  589. <Param name="@Amount_FromBill" type="PayablesStrikeBills.Amount_FromBill" sourceColumn="Amount_FromBill" />
  590. <Param name="@ToPayAmount_PayablesStrikeBills" type="PayablesStrikeBills.ToPayAmount_PayablesStrikeBills" sourceColumn="ToPayAmount_PayablesStrikeBills" />
  591. <Param name="@Strike_PayablesStrikeBills" type="PayablesStrikeBills.Strike_PayablesStrikeBills" sourceColumn="Strike_PayablesStrikeBills" />
  592. <Param name="@Discount_PayablesStrikeBills" type="PayablesStrikeBills.Discount_PayablesStrikeBills" sourceColumn="Discount_PayablesStrikeBills" />
  593. <Param name="@StrikedAmount_PayablesStrikeBills" type="PayablesStrikeBills.StrikedAmount_PayablesStrikeBills" sourceColumn="StrikedAmount_PayablesStrikeBills" />
  594. </Params>
  595. </New>
  596. <Update CmdType="Text" CmdText=" UPDATE PayablesStrikeBills SET No_PayablesStrikeBills = @No_PayablesStrikeBills,
  597. No_PurchaseInvoice = @No_PurchaseInvoice, No_Invoice = @No_Invoice,
  598. PayDate_PayablesStrikeBills = @PayDate_PayablesStrikeBills,
  599. Amount_FromBill = @Amount_FromBill,
  600. ToPayAmount_PayablesStrikeBills = @ToPayAmount_PayablesStrikeBills,
  601. Strike_PayablesStrikeBills = @Strike_PayablesStrikeBills,
  602. Discount_PayablesStrikeBills = @Discount_PayablesStrikeBills,
  603. StrikedAmount_PayablesStrikeBills =@StrikedAmount_PayablesStrikeBills
  604. WHERE ID_PayablesStrikeBills = @ID_PayablesStrikeBills">
  605. <Params>
  606. <Param name="@ID_PayablesStrikeBills" type="PayablesStrikeBills.ID_PayablesStrikeBills" sourceColumn="ID_PayablesStrikeBills" />
  607. <Param name="@No_PayablesStrikeBills" type="PayablesStrikeBills.No_PayablesStrikeBills" sourceColumn="No_PayablesStrikeBills" />
  608. <Param name="@ID_PayablesStrike" type="PayablesStrikeBills.ID_PayablesStrike" sourceColumn="ID_PayablesStrike" />
  609. <Param name="@No_PurchaseInvoice" type="PayablesStrikeBills.No_PurchaseInvoice" sourceColumn="No_PurchaseInvoice" />
  610. <Param name="@No_Invoice" type="PayablesStrikeBills.No_Invoice" sourceColumn="No_Invoice" />
  611. <Param name="@PayDate_PayablesStrikeBills" type="PayablesStrikeBills.PayDate_PayablesStrikeBills" sourceColumn="PayDate_PayablesStrikeBills" />
  612. <Param name="@Amount_FromBill" type="PayablesStrikeBills.Amount_FromBill" sourceColumn="Amount_FromBill" />
  613. <Param name="@ToPayAmount_PayablesStrikeBills" type="PayablesStrikeBills.ToPayAmount_PayablesStrikeBills" sourceColumn="ToPayAmount_PayablesStrikeBills" />
  614. <Param name="@Strike_PayablesStrikeBills" type="PayablesStrikeBills.Strike_PayablesStrikeBills" sourceColumn="Strike_PayablesStrikeBills" />
  615. <Param name="@Discount_PayablesStrikeBills" type="PayablesStrikeBills.Discount_PayablesStrikeBills" sourceColumn="Discount_PayablesStrikeBills" />
  616. <Param name="@StrikedAmount_PayablesStrikeBills" type="PayablesStrikeBills.StrikedAmount_PayablesStrikeBills" sourceColumn="StrikedAmount_PayablesStrikeBills" />
  617. </Params>
  618. </Update>
  619. <Delete CmdType="Text" CmdText=" DELETE PayablesStrikeBills WHERE ID_PayablesStrikeBills = @ID_PayablesStrikeBills">
  620. <Params>
  621. <Param name="@ID_PayablesStrikeBills" type="PayablesStrikeBills.ID_PayablesStrikeBills" sourceColumn="ID_PayablesStrikeBills" />
  622. </Params>
  623. </Delete>
  624. </Table>
  625. </Tables>
  626. <Search>
  627. <SearchAllSupplier CmdType="Text" CmdText="SELECT Supplier.No_Supplier,Supplier.ShortName_Supplier FROM Supplier ">
  628. <Tables>
  629. <Table name="AllSupplier" />
  630. </Tables>
  631. </SearchAllSupplier>
  632. <SearchAllBill CmdType="Text" CmdText=" SELECT PayablesStrike.*, Supplier.No_Supplier, Supplier.ShortName_Supplier, Supplier.PreGetBalance_Supplier, Employee.No_Employee AS No_Payer,
  633. a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS Name_LastModUser,
  634. CONVERT(decimal(18,6), 0) AS SumSale, CONVERT(decimal(18,6), 0) AS SumRtn, CONVERT(decimal(18,6), 0) AS SumPay
  635. FROM PayablesStrike
  636. LEFT JOIN Supplier ON Supplier.ID_Supplier = PayablesStrike.ID_Supplier
  637. LEFT JOIN Employee ON Employee.ID_Employee = PayablesStrike.ID_Payer
  638. LEFT JOIN AppUser a ON a.ID_User = PayablesStrike.ID_Creator
  639. LEFT JOIN AppUser b ON b.ID_User = PayablesStrike.ID_Assessor
  640. LEFT JOIN AppUser c ON c.ID_User = PayablesStrike.LastModUser_PayablesStrike ">
  641. <Tables>
  642. <Table name="AllBill" />
  643. </Tables>
  644. </SearchAllBill>
  645. <SearchPayablesStrikeWithNo CmdType="Text" CmdText=" DECLARE @ID_PayablesStrike uniqueidentifier
  646. SELECT @ID_PayablesStrike = PayablesStrike.ID_PayablesStrike FROM PayablesStrike WHERE PayablesStrike.No_PayablesStrike = @No_PayablesStrike
  647. SELECT PayablesStrike.*, Supplier.No_Supplier, Supplier.ShortName_Supplier, Supplier.PreGetBalance_Supplier, Employee.No_Employee AS No_Payer, Employee.Name_Employee,
  648. a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS Name_LastModUser,
  649. CONVERT(decimal(18,6), 0) AS SumSale, CONVERT(decimal(18,6), 0) AS SumRtn, CONVERT(decimal(18,6), 0) AS SumPay
  650. FROM PayablesStrike
  651. LEFT JOIN Supplier ON Supplier.ID_Supplier = PayablesStrike.ID_Supplier
  652. LEFT JOIN Employee ON Employee.ID_Employee = PayablesStrike.ID_Payer
  653. LEFT JOIN AppUser a ON a.ID_User = PayablesStrike.ID_Creator
  654. LEFT JOIN AppUser b ON b.ID_User = PayablesStrike.ID_Assessor
  655. LEFT JOIN AppUser c ON c.ID_User = PayablesStrike.LastModUser_PayablesStrike
  656. WHERE PayablesStrike.ID_PayablesStrike = @ID_PayablesStrike
  657. SELECT PayablesStrikeMethod.* FROM PayablesStrikeMethod WHERE PayablesStrikeMethod.ID_PayablesStrike = @ID_PayablesStrike ORDER BY PayablesStrikeMethod.No_PayablesStrikeMethod
  658. SELECT PayablesStrikeBills.* FROM PayablesStrikeBills
  659. WHERE PayablesStrikeBills.ID_PayablesStrike = @ID_PayablesStrike ORDER BY PayablesStrikeBills.No_PayablesStrikeBills">
  660. <Params>
  661. <Param name="@No_PayablesStrike" type="PayablesStrike.No_PayablesStrike" Index="0" />
  662. </Params>
  663. <Tables>
  664. <Table name="PayablesStrike" />
  665. <Table name="PayablesStrikeMethod" />
  666. <Table name="PayablesStrikeBills" />
  667. </Tables>
  668. </SearchPayablesStrikeWithNo>
  669. <SearchSupplierWithNo CmdType="Text" CmdText=" SELECT Supplier.* FROM Supplier WHERE Supplier.No_Supplier = @No_Supplier">
  670. <Params>
  671. <Param name="@No_Supplier" type="PayablesStrike.No_Supplier" Index="0" />
  672. </Params>
  673. <Tables>
  674. <Table name="Supplier" />
  675. </Tables>
  676. </SearchSupplierWithNo>
  677. <SearchPayer CmdType="Text" CmdText=" SELECT Employee.No_Employee,Employee.ID_Employee, Employee.Name_Employee FROM Employee WHERE Employee.SuspendDate_Employee IS NULL">
  678. <Tables>
  679. <Table name="Payer" />
  680. </Tables>
  681. </SearchPayer>
  682. <SearchSystemSetting CmdType="Text" CmdText="SELECT SysCurrency_SystemSetting From SystemSetting">
  683. <Tables>
  684. <Table name="SystemSetting"/>
  685. </Tables>
  686. </SearchSystemSetting>
  687. <SearchPayablesStrikeMethod CmdType="Text" CmdText=" SELECT '现金' AS Result
  688. UNION
  689. SELECT '刷卡' AS Result
  690. UNION
  691. SELECT '支票' AS Result
  692. UNION
  693. SELECT '冲减预付款' AS Result
  694. UNION
  695. SELECT '抵帐' AS Result
  696. UNION
  697. SELECT '转帐' AS Result
  698. UNION
  699. SELECT '银行汇票' AS Result
  700. UNION
  701. SELECT '银行承兑汇票' AS Result
  702. ">
  703. <Tables>
  704. <Table name="Method" />
  705. </Tables>
  706. </SearchPayablesStrikeMethod>
  707. <SearchBillType CmdType="Text" CmdText=" SELECT * FROM BillType WHERE Value_BillType = 1 OR Value_BillType = 41 OR Value_BillType=0 ORDER BY Value_BillType">
  708. <Tables>
  709. <Table name="BillType" />
  710. </Tables>
  711. </SearchBillType>
  712. <SearchFromBillWithNo CmdType="Text" CmdText=" IF @Type_FromBill = 1
  713. BEGIN
  714. SELECT ID_Supplier AS Supplier,Currency_PurchaseInDepotBill AS Currency,ID_Assessor,
  715. AssessDate_PurchaseInDepotBill AS AssessDate, AssessDate_PurchaseInDepotBill AS PayDate,
  716. GoodsAmount_PurchaseInDepotBill AS GoodsAmount, TaxAmount_PurchaseInDepotBill AS TaxAmount,
  717. StrikedGoodsAmount_PurchaseInDepotBill AS StrikedGoodsAmount, StrikedTaxAmount_PurchaseInDepotBill AS StrikedTaxAmount
  718. FROM PurchaseInDepotBill
  719. WHERE No_PurchaseInDepotBill = @No_FromBill
  720. END
  721. ELSE
  722. BEGIN
  723. SELECT ID_Supplier AS Supplier, Currency_PurchaseOrderBill AS Currency,ID_Assessor,
  724. AssessDate_PurchaseOrderBill AS AssessDate, AssessDate_PurchaseOrderBill AS PayDate,
  725. GoodsAmount_PurchaseOrderBill AS GoodsAmount, TaxAmount_PurchaseOrderBill AS TaxAmount,
  726. StrikedGoodsAmount_PurchaseOrderBill AS StrikedGoodsAmount, StrikedTaxAmount_PurchaseOrderBill AS StrikedTaxAmount
  727. FROM PurchaseOrderBill WHERE No_PurchaseOrderBill = @No_FromBill
  728. END">
  729. <Params>
  730. <Param name="@Type_FromBill" type="PayablesStrikeBills.Type_FromBill" Index="0" />
  731. <Param name="@No_FromBill" type="PayablesStrikeBills.No_FromBill" Index="1" />
  732. </Params>
  733. <Tables>
  734. <Table name="FromBill" />
  735. </Tables>
  736. </SearchFromBillWithNo>
  737. <SearchFromBillInInvoice CmdType="Text" CmdText="
  738. Select PurchaseInvoice.No_Invoice,Amount_PurchaseInvoice,PayDate_PurchaseInvoice,StrikedAmount_PurchaseInvoice,ID_Assessor,Disable_PurchaseInvoice,ID_Supplier
  739. From PurchaseInvoice
  740. Where No_PurchaseInvoice=@No_PurchaseInvoice
  741. ">
  742. <Params>
  743. <Param name="@No_PurchaseInvoice" type="ReceivablesStrikeBills.No_PurchaseInvoice" Index="0" />
  744. </Params>
  745. <Tables>
  746. <Table name="FromBill" />
  747. </Tables>
  748. </SearchFromBillInInvoice>
  749. <SearchPayablesStrikeFirst CmdType="Text" CmdText=" DECLARE @ID_PayablesStrike uniqueidentifier
  750. SELECT TOP 1 @ID_PayablesStrike = PayablesStrike.ID_PayablesStrike FROM PayablesStrike ORDER BY PayablesStrike.No_PayablesStrike
  751. SELECT PayablesStrike.*, Supplier.No_Supplier, Supplier.ShortName_Supplier, Supplier.PreGetBalance_Supplier, Employee.No_Employee AS No_Payer, Employee.Name_Employee,
  752. a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS Name_LastModUser,
  753. CONVERT(decimal(18,6), 0) AS SumSale, CONVERT(decimal(18,6), 0) AS SumRtn, CONVERT(decimal(18,6), 0) AS SumPay
  754. FROM PayablesStrike
  755. LEFT JOIN Supplier ON Supplier.ID_Supplier = PayablesStrike.ID_Supplier
  756. LEFT JOIN Employee ON Employee.ID_Employee = PayablesStrike.ID_Payer
  757. LEFT JOIN AppUser a ON a.ID_User = PayablesStrike.ID_Creator
  758. LEFT JOIN AppUser b ON b.ID_User = PayablesStrike.ID_Assessor
  759. LEFT JOIN AppUser c ON c.ID_User = PayablesStrike.LastModUser_PayablesStrike
  760. WHERE PayablesStrike.ID_PayablesStrike = @ID_PayablesStrike
  761. SELECT PayablesStrikeMethod.* FROM PayablesStrikeMethod WHERE PayablesStrikeMethod.ID_PayablesStrike = @ID_PayablesStrike ORDER BY PayablesStrikeMethod.No_PayablesStrikeMethod
  762. SELECT PayablesStrikeBills.* FROM PayablesStrikeBills
  763. WHERE PayablesStrikeBills.ID_PayablesStrike = @ID_PayablesStrike ORDER BY PayablesStrikeBills.No_PayablesStrikeBills">
  764. <Tables>
  765. <Table name="PayablesStrike" />
  766. <Table name="PayablesStrikeMethod" />
  767. <Table name="PayablesStrikeBills" />
  768. </Tables>
  769. </SearchPayablesStrikeFirst>
  770. <SearchPayablesStrikePrevious CmdType="Text" CmdText=" DECLARE @ID_PayablesStrike uniqueidentifier
  771. SELECT TOP 1 @ID_PayablesStrike = PayablesStrike.ID_PayablesStrike FROM PayablesStrike WHERE PayablesStrike.No_PayablesStrike &lt; @No_PayablesStrike ORDER BY PayablesStrike.No_PayablesStrike DESC
  772. SELECT PayablesStrike.*, Supplier.No_Supplier, Supplier.ShortName_Supplier, Supplier.PreGetBalance_Supplier, Employee.No_Employee AS No_Payer, Employee.Name_Employee,
  773. a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS Name_LastModUser,
  774. CONVERT(decimal(18,6), 0) AS SumSale, CONVERT(decimal(18,6), 0) AS SumRtn, CONVERT(decimal(18,6), 0) AS SumPay
  775. FROM PayablesStrike
  776. LEFT JOIN Supplier ON Supplier.ID_Supplier = PayablesStrike.ID_Supplier
  777. LEFT JOIN Employee ON Employee.ID_Employee = PayablesStrike.ID_Payer
  778. LEFT JOIN AppUser a ON a.ID_User = PayablesStrike.ID_Creator
  779. LEFT JOIN AppUser b ON b.ID_User = PayablesStrike.ID_Assessor
  780. LEFT JOIN AppUser c ON c.ID_User = PayablesStrike.LastModUser_PayablesStrike
  781. WHERE PayablesStrike.ID_PayablesStrike = @ID_PayablesStrike
  782. SELECT PayablesStrikeMethod.* FROM PayablesStrikeMethod WHERE PayablesStrikeMethod.ID_PayablesStrike = @ID_PayablesStrike ORDER BY PayablesStrikeMethod.No_PayablesStrikeMethod
  783. SELECT PayablesStrikeBills.* FROM PayablesStrikeBills
  784. WHERE PayablesStrikeBills.ID_PayablesStrike = @ID_PayablesStrike ORDER BY PayablesStrikeBills.No_PayablesStrikeBills">
  785. <Params>
  786. <Param name="@No_PayablesStrike" type="PayablesStrike.No_PayablesStrike" Index="0" />
  787. </Params>
  788. <Tables>
  789. <Table name="PayablesStrike" />
  790. <Table name="PayablesStrikeMethod" />
  791. <Table name="PayablesStrikeBills" />
  792. </Tables>
  793. </SearchPayablesStrikePrevious>
  794. <SearchPayablesStrikeNext CmdType="Text" CmdText=" DECLARE @ID_PayablesStrike uniqueidentifier
  795. SELECT TOP 1 @ID_PayablesStrike = PayablesStrike.ID_PayablesStrike FROM PayablesStrike WHERE PayablesStrike.No_PayablesStrike &gt; @No_PayablesStrike ORDER BY PayablesStrike.No_PayablesStrike
  796. SELECT PayablesStrike.*, Supplier.No_Supplier, Supplier.ShortName_Supplier, Supplier.PreGetBalance_Supplier, Employee.No_Employee AS No_Payer,Employee.Name_Employee,
  797. a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS Name_LastModUser,
  798. CONVERT(decimal(18,6), 0) AS SumSale, CONVERT(decimal(18,6), 0) AS SumRtn, CONVERT(decimal(18,6), 0) AS SumPay
  799. FROM PayablesStrike
  800. LEFT JOIN Supplier ON Supplier.ID_Supplier = PayablesStrike.ID_Supplier
  801. LEFT JOIN Employee ON Employee.ID_Employee = PayablesStrike.ID_Payer
  802. LEFT JOIN AppUser a ON a.ID_User = PayablesStrike.ID_Creator
  803. LEFT JOIN AppUser b ON b.ID_User = PayablesStrike.ID_Assessor
  804. LEFT JOIN AppUser c ON c.ID_User = PayablesStrike.LastModUser_PayablesStrike
  805. WHERE PayablesStrike.ID_PayablesStrike = @ID_PayablesStrike
  806. SELECT PayablesStrikeMethod.* FROM PayablesStrikeMethod WHERE PayablesStrikeMethod.ID_PayablesStrike = @ID_PayablesStrike ORDER BY PayablesStrikeMethod.No_PayablesStrikeMethod
  807. SELECT PayablesStrikeBills.* FROM PayablesStrikeBills
  808. WHERE PayablesStrikeBills.ID_PayablesStrike = @ID_PayablesStrike ORDER BY PayablesStrikeBills.No_PayablesStrikeBills">
  809. <Params>
  810. <Param name="@No_PayablesStrike" type="PayablesStrike.No_PayablesStrike" Index="0" />
  811. </Params>
  812. <Tables>
  813. <Table name="PayablesStrike" />
  814. <Table name="PayablesStrikeMethod" />
  815. <Table name="PayablesStrikeBills" />
  816. </Tables>
  817. </SearchPayablesStrikeNext>
  818. <SearchPayablesStrikeLast CmdType="Text" CmdText=" DECLARE @ID_PayablesStrike uniqueidentifier
  819. SELECT TOP 1 @ID_PayablesStrike = PayablesStrike.ID_PayablesStrike FROM PayablesStrike ORDER BY PayablesStrike.No_PayablesStrike DESC
  820. SELECT PayablesStrike.*, Supplier.No_Supplier, Supplier.ShortName_Supplier, Supplier.PreGetBalance_Supplier, Employee.No_Employee AS No_Payer,Employee.Name_Employee,
  821. a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS Name_LastModUser,
  822. CONVERT(decimal(18,6), 0) AS SumSale, CONVERT(decimal(18,6), 0) AS SumRtn, CONVERT(decimal(18,6), 0) AS SumPay
  823. FROM PayablesStrike
  824. LEFT JOIN Supplier ON Supplier.ID_Supplier = PayablesStrike.ID_Supplier
  825. LEFT JOIN Employee ON Employee.ID_Employee = PayablesStrike.ID_Payer
  826. LEFT JOIN AppUser a ON a.ID_User = PayablesStrike.ID_Creator
  827. LEFT JOIN AppUser b ON b.ID_User = PayablesStrike.ID_Assessor
  828. LEFT JOIN AppUser c ON c.ID_User = PayablesStrike.LastModUser_PayablesStrike
  829. WHERE PayablesStrike.ID_PayablesStrike = @ID_PayablesStrike
  830. SELECT PayablesStrikeMethod.* FROM PayablesStrikeMethod WHERE PayablesStrikeMethod.ID_PayablesStrike = @ID_PayablesStrike ORDER BY PayablesStrikeMethod.No_PayablesStrikeMethod
  831. SELECT PayablesStrikeBills.* FROM PayablesStrikeBills
  832. WHERE PayablesStrikeBills.ID_PayablesStrike = @ID_PayablesStrike ORDER BY PayablesStrikeBills.No_PayablesStrikeBills">
  833. <Tables>
  834. <Table name="PayablesStrike" />
  835. <Table name="PayablesStrikeMethod" />
  836. <Table name="PayablesStrikeBills" />
  837. </Tables>
  838. </SearchPayablesStrikeLast>
  839. </Search>
  840. </Server>
  841. <Lables>
  842. <Search>
  843. Empty();
  844. NewInstance();
  845. dtDate.Enabled = false;
  846. tbNo.ReadOnly = false;
  847. tbSupplierNo.ReadOnly = true;
  848. cbPayer.Enabled = false;
  849. txtComment.ReadOnly = true;
  850. txtSumPay.CValue = 0.00;
  851. dtStart.Enabled = false;
  852. dtEnd.Enabled = false;
  853. dgReceiveMoney.ReadOnly = true;
  854. dgBill.ReadOnly = true;
  855. toolBar.EnableNew = GetRight(@Title,"新增");
  856. toolBar.EnableSubmit = false;
  857. toolBar.EnableModify = false;
  858. toolBar.EnableDelete = false;
  859. toolBar.EnableAudit = false;
  860. toolBar.EnableUnAudit = false;
  861. toolBar.EnablePrint = false;
  862. cbPrev.Enabled = false;
  863. btnSearchByInvoice.Enabled = false;
  864. btnAutoStrike.Enabled = false;
  865. btnVerify.Enabled = false;
  866. #PayablesStrike.GetCurrency_PayablesStrike = "";
  867. #PayablesStrike.BillCurrency_PayablesStrike = "";
  868. #PayablesStrike.Rate_PayablesStrike = 0;
  869. #PayablesStrike.AssessDate_PayablesStrike = DBNull();
  870. #PayablesStrike.LastModDate_PayablesStrike = DBNull();
  871. UpdateForm(true, "");
  872. tbNo.Focus();
  873. @Status = 0;
  874. </Search>
  875. <New>
  876. Empty();
  877. NewInstance();
  878. dtDate.Enabled = true;
  879. tbNo.ReadOnly = true;
  880. tbSupplierNo.ReadOnly = false;
  881. cbPayer.Enabled = true;
  882. txtComment.ReadOnly = false;
  883. txtSumPay.CValue = 0.00;
  884. dtStart.Enabled = true;
  885. dtEnd.Enabled = true;
  886. dgReceiveMoney.ReadOnly = false;
  887. dgBill.ReadOnly = false;
  888. toolBar.EnableNew = false;
  889. toolBar.EnableSubmit = GetRight(@Title,"新增");
  890. toolBar.EnableModify = false;
  891. toolBar.EnableDelete = false;
  892. toolBar.EnableAudit = false;
  893. toolBar.EnableUnAudit = false;
  894. toolBar.EnablePrint = false;
  895. cbPrev.Enabled = true;
  896. btnSearchByInvoice.Enabled = true;
  897. btnAutoStrike.Enabled = true;
  898. btnVerify.Enabled = true;
  899. dgReceiveMoney.AllowNew(true);
  900. dgReceiveMoney.AllowDelete(true);
  901. dgReceiveMoney.SetColumnReadOnly(1, false);
  902. dgReceiveMoney.RowHeaderCheck = true;
  903. dgBill.AllowNew(true);
  904. dgBill.AllowDelete(true);
  905. dgBill.SetColumnReadOnly(1, false);
  906. dgBill.RowHeaderCheck = true;
  907. #PayablesStrike.ID_PayablesStrike = NewGuid();
  908. #PayablesStrike.ID_Creator = GetLoginUserID();
  909. #PayablesStrike.Name_Creator = GetCurrentUser();
  910. #PayablesStrike.ID_Assessor = DBNull();
  911. #PayablesStrike.AssessDate_PayablesStrike = DBNull();
  912. #PayablesStrike.LastModUser_PayablesStrike = DBNull();
  913. #PayablesStrike.LastModDate_PayablesStrike = DBNull();
  914. #PayablesStrike.GetCurrency_PayablesStrike = @SysCurrency;
  915. #PayablesStrike.BillCurrency_PayablesStrike = @SysCurrency;
  916. #PayablesStrike.Rate_PayablesStrike = 1;
  917. SetColumnDefaultValue("PayablesStrikeBills", "PayDate_PayablesStrikeBills", DBNull());
  918. UpdateForm(true, "");
  919. @Status = 1;
  920. </New>
  921. <View>
  922. dtDate.Enabled = false;
  923. tbNo.ReadOnly = true;
  924. tbSupplierNo.ReadOnly = true;
  925. cbPayer.Enabled = false;
  926. txtComment.ReadOnly = true;
  927. dgReceiveMoney.ReadOnly = true;
  928. dgBill.ReadOnly = true;
  929. dtStart.Enabled = false;
  930. dtEnd.Enabled = false;
  931. toolBar.EnableNew = GetRight(@Title,"新增");
  932. toolBar.EnableSubmit = false;
  933. if (Equals(#PayablesStrike.ID_Assessor, DBNull()))
  934. {
  935. toolBar.EnableModify = GetRight(@Title,"修改");
  936. toolBar.EnableDelete = GetRight(@Title,"删除");
  937. toolBar.EnableAudit = GetRight(@Title,"审核");
  938. toolBar.EnableUnAudit = false;
  939. }
  940. else
  941. {
  942. toolBar.EnableModify = false;
  943. toolBar.EnableDelete = false;
  944. toolBar.EnableAudit = false;
  945. toolBar.EnableUnAudit = GetRight(@Title,"取消审核");
  946. }
  947. toolBar.EnablePrint = GetRight(@Title,"打印");
  948. cbPrev.Enabled = false;
  949. btnSearchByInvoice.Enabled = false;
  950. btnAutoStrike.Enabled = false;
  951. btnVerify.Enabled = false;
  952. UpdateForm(true, "");
  953. @Status = 2;
  954. </View>
  955. <Modify>
  956. dtDate.Enabled = false;
  957. tbNo.ReadOnly = true;
  958. tbSupplierNo.ReadOnly = true;
  959. cbPayer.Enabled = true;
  960. txtComment.ReadOnly = false;
  961. dgReceiveMoney.ReadOnly = false;
  962. dgBill.ReadOnly = false;
  963. toolBar.EnableNew = false;
  964. toolBar.EnableSubmit = GetRight(@Title,"修改");
  965. toolBar.EnableModify = false;
  966. toolBar.EnableDelete = false;
  967. toolBar.EnableAudit = false;
  968. toolBar.EnableUnAudit = false;
  969. toolBar.EnablePrint = false;
  970. @NotAssess = Equals(#PayablesStrike.AssessDate_PayablesStrike, DBNull());
  971. cbPrev.Enabled = @NotAssess;
  972. if (cbPrev.Checked)
  973. {
  974. btnSearchByInvoice.Enabled = false;
  975. btnAutoStrike.Enabled = false;
  976. dtStart.Enabled = false;
  977. dtEnd.Enabled = false;
  978. }
  979. else
  980. {
  981. btnSearchByInvoice.Enabled = @NotAssess;
  982. btnAutoStrike.Enabled = true;
  983. dtStart.Enabled = true;
  984. dtEnd.Enabled = true;
  985. }
  986. btnVerify.Enabled = true;
  987. dgReceiveMoney.AllowNew(@NotAssess);
  988. dgReceiveMoney.AllowDelete(@NotAssess);
  989. dgReceiveMoney.SetColumnReadOnly(1, !@NotAssess);
  990. dgReceiveMoney.RowHeaderCheck = @NotAssess;
  991. dgBill.AllowNew(@NotAssess);
  992. dgBill.AllowDelete(@NotAssess);
  993. dgBill.SetColumnReadOnly(1, !@NotAssess);
  994. dgBill.RowHeaderCheck = @NotAssess;
  995. #PayablesStrike.LastModUser_PayablesStrike = GetLoginUserID();
  996. #PayablesStrike.Name_LastModUser = GetCurrentUser();
  997. #PayablesStrike.LastModDate_PayablesStrike = DateTimeNow();
  998. SetColumnDefaultValue("PayablesStrikeBills", "PayDate_PayablesStrikeBills", DBNull());
  999. UpdateForm(true, "");
  1000. @Status = 3;
  1001. </Modify>
  1002. <SubmitButtonClick>
  1003. <![CDATA[
  1004. if (!cbPayer.CheckSelectedItem())
  1005. {
  1006. MessageBox("请选择有效的经办人!",@Title);
  1007. cbPayer.Focus();
  1008. return;
  1009. }
  1010. SuspendLayout();
  1011. if (#PayablesStrike.PreGetBalance_Supplier < SumOfCol("#PayablesStrikeMethod.Amount_PayablesStrikeMethod", "Type_PayablesStrikeMethod = '冲减预付款'", false))
  1012. {
  1013. MessageBox("该供应商的预付帐款余额不得小于此次冲帐所使用的金额!",@Title);
  1014. dgReceiveMoney.Focus();
  1015. ResumeLayout();
  1016. tbDetail.SelectedIndex = 1;
  1017. return;
  1018. }
  1019. for (@i=0; @i<RowCount("#PayablesStrikeMethod"); @i=@i+1)
  1020. {
  1021. SetPosition("#PayablesStrikeMethod", @i);
  1022. if (Equals(#PayablesStrikeMethod.ID_PayablesStrikeMethod,GuidEmpty()))
  1023. #PayablesStrikeMethod.ID_PayablesStrikeMethod = NewGuid();
  1024. #PayablesStrikeMethod.ID_PayablesStrike = #PayablesStrike.ID_PayablesStrike;
  1025. }
  1026. for (@i=0; @i<RowCount("#PayablesStrikeBills"); @i=@i+1)
  1027. {
  1028. SetPosition("#PayablesStrikeBills", @i);
  1029. if (Equals(#PayablesStrikeBills.ID_PayablesStrikeBills,GuidEmpty()))
  1030. #PayablesStrikeBills.ID_PayablesStrikeBills = NewGuid();
  1031. #PayablesStrikeBills.ID_PayablesStrike = #PayablesStrike.ID_PayablesStrike;
  1032. }
  1033. ResumeLayout();
  1034. UpdateForm(false, "");
  1035. if (@Status == 1)
  1036. {
  1037. #PayablesStrike.CreateDate_PayablesStrike = DateTimeNow();
  1038. #PayablesStrike.No_PayablesStrike = New("#PayablesStrike.No_PayablesStrike",dtDate.CValue);
  1039. }
  1040. else if (@Status == 3)
  1041. {
  1042. #PayablesStrike.LastModDate_PayablesStrike = DateTimeNow();
  1043. Update();
  1044. }
  1045. ChangeMode("View",#PayablesStrike.ID_Assessor);
  1046. ]]>
  1047. </SubmitButtonClick>
  1048. <GetFromBill>
  1049. <![CDATA[
  1050. if(Search("SearchFromBillInInvoice",#PayablesStrikeBills.No_PurchaseInvoice))
  1051. {
  1052. if(Equals(#FromBill.ID_Assessor,DBNull()))
  1053. {
  1054. MessageBox("该进项发票未经审核!",@Title);
  1055. return;
  1056. }
  1057. else if(#FromBill.Disable_PurchaseInvoice == true)
  1058. {
  1059. MessageBox("该进项发票已作废!",@Title);
  1060. return;
  1061. }
  1062. else if(#FromBill.Amount_PurchaseInvoice <= #FromBill.StrikedAmount_PurchaseInvoice)
  1063. {
  1064. MessageBox("该进项发票金额已全部冲减完毕!",@Title);
  1065. return;
  1066. }
  1067. #PayablesStrikeBills.No_Invoice=#FromBill.No_Invoice;
  1068. #PayablesStrikeBills.PayDate_PayablesStrikeBills=#FromBill.PayDate_PurchaseInvoice;
  1069. #PayablesStrikeBills.Amount_FromBill=#FromBill.Amount_PurchaseInvoice;
  1070. #PayablesStrikeBills.StrikedAmount_PayablesStrikeBills=#FromBill.StrikedAmount_PurchaseInvoice;
  1071. #PayablesStrikeBills.ToPayAmount_PayablesStrikeBills=#FromBill.Amount_PurchaseInvoice-#FromBill.StrikedAmount_PurchaseInvoice;
  1072. }
  1073. else
  1074. {
  1075. MessageBox("该进项发票不存在!",@Title);
  1076. return;
  1077. }
  1078. ]]>
  1079. </GetFromBill>
  1080. <CountSum>
  1081. <![CDATA[
  1082. txtSumPay.CValue = SumOfCol("#PayablesStrikeBills.Strike_PayablesStrikeBills");
  1083. ]]>
  1084. </CountSum>
  1085. <Verify>
  1086. <![CDATA[
  1087. UpdateForm(false, "");
  1088. if (!Search("SearchSupplierWithNo", tbSupplierNo.CValue) || !Equals(#PayablesStrike.ID_Supplier,#Supplier.ID_Supplier))
  1089. {
  1090. MessageBox("请输入有效的供应商编号,并按回车确认!",@Title);
  1091. tbSupplierNo.Focus();
  1092. return;
  1093. }
  1094. if(!cbPayer.CheckSelectedItem())
  1095. {
  1096. MessageBox("请选择有效的经办人!",@Title);
  1097. cbPayer.Focus();
  1098. tbDetail.SelectedIndex = 0;
  1099. return;
  1100. }
  1101. if (RowCount("#PayablesStrikeMethod") == 0)
  1102. {
  1103. MessageBox("收款方式及收款金额列表不能为空!",@Title);
  1104. tbDetail.SelectedIndex = 0;
  1105. dgReceiveMoney.Focus();
  1106. return;
  1107. }
  1108. if (!cbPrev.Checked && RowCount("#PayablesStrikeBills") == 0)
  1109. {
  1110. MessageBox("冲帐单据列表不能为空!",@Title);
  1111. tbDetail.SelectedIndex = 1;
  1112. dgBill.Focus();
  1113. return;
  1114. }
  1115. SuspendLayout();
  1116. for (@i=0; @i<RowCount("#PayablesStrikeMethod"); @i=@i+1)
  1117. {
  1118. SetPosition("#PayablesStrikeMethod", @i);
  1119. if (#PayablesStrikeMethod.Amount_PayablesStrikeMethod < 0)
  1120. {
  1121. MessageBox("付款金额不得小于0!",@Title);
  1122. dgReceiveMoney.Focus();
  1123. ResumeLayout();
  1124. tbDetail.SelectedIndex = 0;
  1125. dgReceiveMoney.CurrentRowIndex = @i;
  1126. return;
  1127. }
  1128. }
  1129. @AllStrikeAmount = SumOfCol("#PayablesStrikeMethod.Amount_PayablesStrikeMethod") ;
  1130. if (@AllStrikeAmount == 0)
  1131. {
  1132. MessageBox("本次出帐金额不得为0!",@Title);
  1133. dgReceiveMoney.Focus();
  1134. ResumeLayout();
  1135. tbDetail.SelectedIndex = 0;
  1136. return;
  1137. }
  1138. for (@i=0; @i<RowCount("#PayablesStrikeBills"); @i=@i+1)
  1139. {
  1140. SetPosition("#PayablesStrikeBills", @i);
  1141. if (Equals(#PayablesStrike.Prev_PayablesStrike, false))
  1142. {
  1143. if (Equals(#PayablesStrikeBills.No_PurchaseInvoice, ""))
  1144. {
  1145. MessageBox("请填入进项发票单号!",@Title);
  1146. dgBill.Focus();
  1147. ResumeLayout();
  1148. tbDetail.SelectedIndex = 1;
  1149. dgBill.CurrentRowIndex = @i;
  1150. return;
  1151. }
  1152. if(Search("SearchFromBillInInvoice",#PayablesStrikeBills.No_PurchaseInvoice))
  1153. {
  1154. if(Equals(#FromBill.ID_Assessor,DBNull()))
  1155. {
  1156. MessageBox("该进项发票未经审核!",@Title);
  1157. dgBill.Focus();
  1158. ResumeLayout();
  1159. tbDetail.SelectedIndex = 1;
  1160. dgBill.CurrentRowIndex = @i;
  1161. return;
  1162. }
  1163. else if(#FromBill.Disable_PurchaseInvoice==1)
  1164. {
  1165. MessageBox("该进项发票已作废!",@Title);
  1166. dgBill.Focus();
  1167. ResumeLayout();
  1168. tbDetail.SelectedIndex = 1;
  1169. dgBill.CurrentRowIndex = @i;
  1170. return;
  1171. }
  1172. else if(#FromBill.Amount_PurchaseInvoice <= #FromBill.StrikedAmount_PurchaseInvoice)
  1173. {
  1174. MessageBox("该进项发票金额已全部冲减完毕!",@Title);
  1175. dgBill.Focus();
  1176. ResumeLayout();
  1177. tbDetail.SelectedIndex = 1;
  1178. dgBill.CurrentRowIndex = @i;
  1179. return;
  1180. }
  1181. else if(!Equals(#FromBill.ID_Supplier,#PayablesStrike.ID_Supplier))
  1182. {
  1183. MessageBox("该进项发票的供应商与本单据的供应商不一致!",@Title);
  1184. dgBill.Focus();
  1185. ResumeLayout();
  1186. tbDetail.SelectedIndex = 1;
  1187. dgBill.CurrentRowIndex = @i;
  1188. return;
  1189. }
  1190. }
  1191. else
  1192. {
  1193. MessageBox("该进项发票不存在!",@Title);
  1194. dgBill.Focus();
  1195. ResumeLayout();
  1196. tbDetail.SelectedIndex = 1;
  1197. dgBill.CurrentRowIndex = @i;
  1198. return;
  1199. }
  1200. }
  1201. if (#PayablesStrikeBills.Strike_PayablesStrikeBills < 0)
  1202. {
  1203. MessageBox("本次冲帐金额不得小于0!",@Title);
  1204. dgBill.Focus();
  1205. ResumeLayout();
  1206. tbDetail.SelectedIndex = 1;
  1207. dgBill.CurrentRowIndex = @i;
  1208. return;
  1209. }
  1210. if (#PayablesStrikeBills.Discount_PayablesStrikeBills < 0)
  1211. {
  1212. MessageBox("本次冲帐折让金额不得小于0!",@Title);
  1213. dgBill.Focus();
  1214. ResumeLayout();
  1215. tbDetail.SelectedIndex = 1;
  1216. dgBill.CurrentRowIndex = @i;
  1217. return;
  1218. }
  1219. if (#PayablesStrikeBills.Strike_PayablesStrikeBills > #PayablesStrikeBills.ToPayAmount_PayablesStrikeBills )
  1220. {
  1221. MessageBox("本次冲账不得大于本次应付!",@Title);
  1222. dgBill.Focus();
  1223. ResumeLayout();
  1224. tbDetail.SelectedIndex = 1;
  1225. dgBill.CurrentRowIndex = @i;
  1226. return;
  1227. }
  1228. }
  1229. ResumeLayout();
  1230. if (SumOfCol("#PayablesStrikeMethod.Amount_PayablesStrikeMethod")!=SumOfCol("#PayablesStrikeBills.Strike_PayablesStrikeBills"))
  1231. {
  1232. MessageBox("本次冲帐金额和出帐金额不相等!",@Title);
  1233. dgBill.Focus();
  1234. tbDetail.SelectedIndex = 1;
  1235. return;
  1236. }
  1237. ]]>
  1238. </Verify>
  1239. </Lables>
  1240. </Form>
  1241. </Forms>