FrmSaleInvoicce.xml1 150 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Forms>
  3. <Form Name="FrmSaleInvoicce">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @Title="销项发票";
  9. GetSchema();
  10. Search("SearchCessOut");
  11. Search("SearchSaleBillProduct","p","p");
  12. Search("SearchSaleRtnBillProduct","p","p");
  13. Search("SearchProduct","p");
  14. @CessOut=#SystemSetting.CessOut_SystemSetting/100;
  15. @PriceDecimal=#SystemSetting.PriceDecimal_SystemSetting;
  16. @SysCurrency=#SystemSetting.SysCurrency_SystemSetting;
  17. SetColumnDefaultValue("SaleInvoiceProduct", "TaxRate_SaleInvoiceProduct",@CessOut);
  18. ChangeMode("Search");
  19. Search("SearchBillType");
  20. Search("SearchTemp");
  21. ]]>
  22. </Load>
  23. <Closing>
  24. ;<!--TODO-->
  25. </Closing>
  26. <Closed>
  27. ;<!--TODO-->
  28. </Closed>
  29. </Events>
  30. <Mode>
  31. <Search>
  32. <Lable name="Search" />
  33. </Search>
  34. <New>
  35. <Lable name="New" />
  36. </New>
  37. <View>
  38. <Lable name="View" />
  39. </View>
  40. <Modify>
  41. <Lable name="Modify" />
  42. </Modify>
  43. </Mode>
  44. <Controls>
  45. <IKTextButton name="tbNo" DataSource="SaleInvoice.No_SaleInvoice">
  46. <Events>
  47. <Enter>
  48. if(tbNo.ReadOnly == false)
  49. {
  50. if(tbNo.CValue != StringEmpty())
  51. {
  52. UpdateForm(false, "");
  53. if(Search("SearchSaleInvoiceWithNo", tbNo.CValue))
  54. {
  55. ChangeMode("View",#SaleInvoice.ID_Assessor);
  56. if(#SaleInvoice.Disable_SaleInvoice==true)
  57. ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)";
  58. <Lable name="CountSum"/>
  59. }
  60. else
  61. {
  62. MessageBox("该销项发票不存在!",@Title);
  63. }
  64. }
  65. else
  66. {
  67. MessageBox("请输入销项发票单号!", @Title);
  68. }
  69. }
  70. </Enter>
  71. <Click>
  72. ShowSearchBox("BillSearch","NODEPOT", "tbNo", tbNo.CValue);
  73. </Click>
  74. </Events>
  75. </IKTextButton>
  76. <IKDataTimePicker name="dtDate" DataSource="SaleInvoice.Date_SaleInvoice" />
  77. <IKComboBoxEx name="cbType" DisplaySource="SaleInvoice.TypeName">
  78. <Events>
  79. <SelectedIndexChanged>
  80. #SaleInvoice.Type_SaleInvoice=cbType.SelectedIndex;
  81. </SelectedIndexChanged>
  82. </Events>
  83. </IKComboBoxEx>
  84. <IKDataTimePicker name="dtInvoiceDate" DataSource="SaleInvoice.InvoiceDate_SaleInvoice" >
  85. <Events>
  86. <ValueChanged>
  87. if(!Equals(#SaleInvoice.ID_Customer,GuidEmpty()))
  88. {
  89. if(Equals(#SaleInvoice.GetMethod_Customer,"先款后货"))
  90. #SaleInvoice.PayDate_SaleInvoice=dtInvoiceDate.Value;
  91. else if(Equals(#SaleInvoice.GetMethod_Customer,"票到当月结"))
  92. {
  93. Search("SearchPayDate",dtInvoiceDate.Value,#Customer.DunDate_Customer);
  94. #SaleInvoice.PayDate_SaleInvoice= #PayDate.NextEndDate;
  95. }
  96. else if(Equals(#SaleInvoice.GetMethod_Customer,"两月结"))
  97. {
  98. Search("SearchPayDate2",dtInvoiceDate.Value,#Customer.DunDate_Customer);
  99. #SaleInvoice.PayDate_SaleInvoice=#PayDate2.NextEndDate;
  100. }
  101. else if(Equals(#SaleInvoice.GetMethod_Customer,"三月结"))
  102. {
  103. Search("SearchPayDate3",dtInvoiceDate.Value,#Customer.DunDate_Customer);
  104. #SaleInvoice.PayDate_SaleInvoice=#PayDate3.NextEndDate;
  105. }
  106. else if(Equals(#SaleInvoice.GetMethod_Customer,"四月结"))
  107. {
  108. Search("SearchPayDate4",dtInvoiceDate.Value,#Customer.DunDate_Customer);
  109. #SaleInvoice.PayDate_SaleInvoice=#PayDate4.NextEndDate;
  110. }
  111. else if(Equals(#SaleInvoice.GetMethod_Customer,"票到付款"))
  112. {
  113. Search("SearchPayDate5",dtInvoiceDate.Value,#Customer.DunDate_Customer);
  114. #SaleInvoice.PayDate_SaleInvoice=#PayDate5.NextEndDate;
  115. }
  116. UpdateForm(true,"dtPayDate");
  117. }
  118. </ValueChanged>
  119. </Events>
  120. </IKDataTimePicker>
  121. <IKTextBox name="txtInvoiceNo" DataSource="SaleInvoice.No_Invoice"/>
  122. <IKButton name="btnModify">
  123. <Events>
  124. <Click>
  125. if(Equals(btnModify.Text,"修改"))
  126. {
  127. txtInvoiceNo.ReadOnly=false;
  128. btnModify.Text="保存";
  129. }
  130. else
  131. {
  132. if(Equals(txtInvoiceNo.CValue,""))
  133. {
  134. MessageBox("请填入发票编号!",@Title);
  135. txtInvoiceNo.Focus();
  136. }
  137. else
  138. {
  139. if(Search("SearchInvoiceNo",txtInvoiceNo.CValue,#SaleInvoice.No_SaleInvoice))
  140. {
  141. MessageBox("此发票号码已存在,请重新填入发票编号!",@Title);
  142. txtInvoiceNo.Focus();
  143. return;
  144. }
  145. else
  146. {
  147. #SaleInvoice.LastModUser=GetCurrentUser();
  148. #SaleInvoice.LastModUser_SaleInvoice=GetLoginUserID();
  149. #SaleInvoice.LastModDate_SaleInvoice=GetCurrentTime();
  150. UpdateForm(false,"");
  151. #SaleInvoice.Type_SaleInvoice=cbType.SelectedIndex;
  152. Update();
  153. txtInvoiceNo.ReadOnly=true;
  154. btnModify.Text="修改";
  155. }
  156. }
  157. }
  158. </Click>
  159. </Events>
  160. </IKButton>
  161. <IKTextBox name="txtMaker" DataSource="SaleInvoice.Creator" />
  162. <IKTextButton name="tbCustomerNo" DataSource="SaleInvoice.No_Customer" >
  163. <Events>
  164. <Enter>
  165. UpdateForm(false,"");
  166. if(tbCustomerNo.CValue!=StringEmpty())
  167. {
  168. if(!Search("SearchCustomer",tbCustomerNo.CValue))
  169. {
  170. MessageBox("该客户不存在!",@Title);
  171. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo.CValue);
  172. if(@temp != "")
  173. {
  174. tbCustomerNo.CValue = @temp;
  175. ActiveControlEvent("tbCustomerNo", "Enter");
  176. }
  177. }
  178. else
  179. {
  180. if(!Equals(#Customer.SuspendDate_Customer,DBNull()))
  181. {
  182. MessageBox("该客户已暂停!",@Title);
  183. }
  184. #SaleInvoice.ID_Customer=#Customer.ID_Customer;
  185. #SaleInvoice.ShortName_Customer=#Customer.ShortName_Customer;
  186. #SaleInvoice.RevenueRegisterNo_Customer=#Customer.RevenueRegisterNo_Customer;
  187. #SaleInvoice.Bank_SaleInvoice=#Customer.Bank_Customer;
  188. #SaleInvoice.Account_SaleInvoice=#Customer.Account_Customer;
  189. #SaleInvoice.GetMethod_Customer=#Customer.GetMethod_Customer;
  190. #SaleInvoice.InvoiceTitle_SaleInvoice=#Customer.Title_Invoice;
  191. #SaleInvoice.InvoiceAddress_SaleInvoice=#Customer.Address_Invoice;
  192. #SaleInvoice.Company_Customer=#Customer.Company_Customer;
  193. if(Equals(#SaleInvoice.GetMethod_Customer,"先款后货"))
  194. #SaleInvoice.PayDate_SaleInvoice=dtInvoiceDate.Value;
  195. else if(Equals(#SaleInvoice.GetMethod_Customer,"票到当月结"))
  196. {
  197. Search("SearchPayDate",dtInvoiceDate.Value,#Customer.DunDate_Customer);
  198. #SaleInvoice.PayDate_SaleInvoice= #PayDate.NextEndDate;
  199. }
  200. else if(Equals(#SaleInvoice.GetMethod_Customer,"两月结"))
  201. {
  202. Search("SearchPayDate2",dtInvoiceDate.Value,#Customer.DunDate_Customer);
  203. #SaleInvoice.PayDate_SaleInvoice=#PayDate2.NextEndDate;
  204. }
  205. else if(Equals(#SaleInvoice.GetMethod_Customer,"三月结"))
  206. {
  207. Search("SearchPayDate3",dtInvoiceDate.Value,#Customer.DunDate_Customer);
  208. #SaleInvoice.PayDate_SaleInvoice=#PayDate3.NextEndDate;
  209. }
  210. else if(Equals(#SaleInvoice.GetMethod_Customer,"四月结"))
  211. {
  212. Search("SearchPayDate4",dtInvoiceDate.Value,#Customer.DunDate_Customer);
  213. #SaleInvoice.PayDate_SaleInvoice=#PayDate4.NextEndDate;
  214. }
  215. else if(Equals(#SaleInvoice.GetMethod_Customer,"票到付款"))
  216. {
  217. Search("SearchPayDate5",dtInvoiceDate.Value,#Customer.DunDate_Customer);
  218. #SaleInvoice.PayDate_SaleInvoice=#PayDate5.NextEndDate;
  219. }
  220. }
  221. }
  222. else
  223. {
  224. MessageBox("请输入客户编号!",@Title);
  225. #SaleInvoice.ID_Customer=GuidEmpty();
  226. #SaleInvoice.ShortName_Customer="";
  227. #SaleInvoice.InvoiceTitle_SaleInvoice="";
  228. #SaleInvoice.InvoiceAddress_SaleInvoice="";
  229. #SaleInvoice.RevenueRegisterNo_Customer="";
  230. #SaleInvoice.Bank_SaleInvoice="";
  231. #SaleInvoice.Account_SaleInvoice="";
  232. #SaleInvoice.GetMethod_Customer="";
  233. #SaleInvoice.Company_Customer="";
  234. tbCustomerNo.Focus();
  235. }
  236. UpdateForm(true,"");
  237. </Enter>
  238. <Click>
  239. <![CDATA[
  240. if (tbCustomerNo.ReadOnly == false)
  241. {
  242. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo.CValue);
  243. if( @temp == "" )
  244. return;
  245. tbCustomerNo.CValue = @temp;
  246. ActiveControlEvent("tbCustomerNo", "Enter");
  247. }
  248. ]]>
  249. </Click>
  250. </Events>
  251. </IKTextButton>
  252. <IKTextBox name="txtCustomerName" DataSource="SaleInvoice.ShortName_Customer"/>
  253. <IKComboBoxEx name="cbInvoiceTitle" DisplaySource="SaleInvoice.InvoiceTitle_SaleInvoice" DataSource="InvoiceTitle" DisplayMember="Title_Invoice">
  254. <Events>
  255. <Reload>
  256. UpdateForm(false, "cbInvoiceTitle");
  257. Search("SearchInvoiceTitle",#SaleInvoice.ID_Customer);
  258. UpdateForm(true, "cbInvoiceTitle");
  259. </Reload>
  260. </Events>
  261. </IKComboBoxEx>
  262. <IKComboBoxEx name="cbInvoiceAddress" DisplaySource="SaleInvoice.InvoiceAddress_SaleInvoice" DataSource="InvoiceAddress" DisplayMember="Address_Invoice">
  263. <Events>
  264. <Reload>
  265. UpdateForm(false, "cbInvoiceAddress");
  266. Search("SearchInvoiceAddress",#SaleInvoice.ID_Customer);
  267. UpdateForm(true, "cbInvoiceAddress");
  268. </Reload>
  269. </Events>
  270. </IKComboBoxEx>
  271. <IKComboBoxEx name="cbCurrency" DisplaySource="SaleInvoice.Currency_SaleInvoice" />
  272. <IKTextBox name="ikTextBox1" DataSource="SaleInvoice.RevenueRegisterNo_Customer"/>
  273. <IKComboBoxEx name="cbBank" DisplaySource="SaleInvoice.Bank_SaleInvoice" DataSource="Bank" DisplayMember="Name_TypeDef">
  274. <Events>
  275. <Reload>
  276. UpdateForm(false, "cbBank");
  277. Search("SearchBank");
  278. UpdateForm(true, "cbBank");
  279. </Reload>
  280. </Events>
  281. </IKComboBoxEx>
  282. <IKTextBox name="txtAccount" DataSource="SaleInvoice.Account_SaleInvoice" />
  283. <IKTextBox name="ikTextBox3" DataSource="SaleInvoice.GetMethod_Customer" />
  284. <IKTextBox name="txtCompany" DataSource="SaleInvoice.Company_Customer" />
  285. <IKDataTimePicker name="dtPayDate" DataSource="SaleInvoice.PayDate_SaleInvoice" />
  286. <IKTextBox name="txtAssessor" DataSource="SaleInvoice.Assessor" />
  287. <IKDateTimeText name="dtAssessDate" DataSource="SaleInvoice.AssessDate_SaleInvoice" />
  288. <IKTextBox name="txtLastModUser" DataSource="SaleInvoice.LastModUser"/>
  289. <IKDateTimeText name="dtLastModDate" DataSource="SaleInvoice.LastModDate_SaleInvoice"/>
  290. <IKNumericTextBox name="txtMoneySum" DataSource="SaleInvoice.GoodsAmount_SaleInvoice"/>
  291. <IKNumericTextBox name="txtTaxSum" DataSource="SaleInvoice.TaxAmount_SaleInvoice"/>
  292. <IKNumericTextBox name="txtSum" DataSource="SaleInvoice.Amount_SaleInvoice"/>
  293. <IKDataGridEx name="dgProduct" DataSource="SaleInvoiceProduct" TableStyleIndex="0">
  294. <DataColumn Index="0" DataSource="SaleInvoiceProduct.Name_BillType" >
  295. <IKDataGridComboBoxColumn DisplaySourceEx="SaleInvoiceProduct.Name_BillType" ValueSourceEx="SaleInvoiceProduct.Type_FromBill" DataSourceEx="BillType" DisplayMemberEx="Name_BillType" ValueMemberEx="Value_BillType">
  296. <Events>
  297. <Reload>
  298. Search("SearchBillType");
  299. SetDataGridColumnDataSource(0,"dgProduct");
  300. </Reload>
  301. </Events>
  302. </IKDataGridComboBoxColumn>
  303. </DataColumn>
  304. <DataColumn Index="1" DataSource="SaleInvoiceProduct.No_FromBill" />
  305. <DataColumn Index="2" DataSource="SaleInvoiceProduct.No_FromBillProduct" />
  306. <DataColumn Index="3" DataSource="SaleInvoiceProduct.No_Customer" />
  307. <DataColumn Index="4" DataSource="SaleInvoiceProduct.ShortName_Customer" />
  308. <DataColumn Index="5" DataSource="SaleInvoiceProduct.No_Product" >
  309. <IKDataGridTextButtonColumn>
  310. <Events>
  311. <Click>
  312. ShowSearchBox("ProductSearch","INFOMATION",#SaleInvoiceProduct.No_Product);
  313. </Click>
  314. </Events>
  315. </IKDataGridTextButtonColumn>
  316. </DataColumn>
  317. <DataColumn Index="6" DataSource="SaleInvoiceProduct.Name_Product" />
  318. <DataColumn Index="7" DataSource="SaleInvoiceProduct.InvoiceName_Product" />
  319. <DataColumn Index="8" DataSource="SaleInvoiceProduct.Unit_Product" />
  320. <DataColumn Index="9" DataSource="SaleInvoiceProduct.Quantity_SaleInvoiceProduct" />
  321. <DataColumn Index="10" DataSource="SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct" />
  322. <DataColumn Index="11" DataSource="SaleInvoiceProduct.Amount_SaleInvoiceProduct" />
  323. <DataColumn Index="12" DataSource="SaleInvoiceProduct.TaxRate_SaleInvoiceProduct" />
  324. <DataColumn Index="13" DataSource="SaleInvoiceProduct.TaxAmount_SaleInvoiceProduct" />
  325. <DataColumn Index="14" DataSource="SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct" />
  326. <DataColumn Index="15" DataSource="SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct" />
  327. <DataColumn Index="16" DataSource="SaleInvoiceProduct.Comment_SaleInvoiceProduct" />
  328. </IKDataGridEx>
  329. <IKDateTimePicker name = "dtStart" DataSource="SaleInvoice.StartDate">
  330. <Events>
  331. <CheckedChanged>
  332. dtEnd.Checked = dtStart.Checked;
  333. </CheckedChanged>
  334. <ValueChanged>
  335. dtEnd.CValue = dtStart.CValue;
  336. </ValueChanged>
  337. </Events>
  338. </IKDateTimePicker>
  339. <IKDateTimePicker name = "dtEnd" DataSource="SaleInvoice.EndDate"/>
  340. <IKCheckBox name="ckRtn" DataSource="SaleInvoice.ckRtn"/>
  341. <IKButton name ="btnSearch">
  342. <Events>
  343. <Click>
  344. MergeTable("#SaleInvoiceProduct","#Temp");
  345. Empty("#SaleInvoiceProduct");
  346. @DateStart = null;
  347. @DateEnd = null;
  348. @ckRtn = 0;
  349. if (dtStart.Checked)
  350. @DateStart = dtStart.CValue;
  351. else
  352. {
  353. MessageBox("请选择日期!");
  354. return;
  355. }
  356. if (dtEnd.Checked)
  357. @DateEnd = dtEnd.CValue;
  358. if (ckRtn.Checked)
  359. {
  360. @ckRtn = 1;
  361. if(Search("SearchAllSaleAndRtnBill",#SaleInvoice.No_Customer,@DateStart,@DateEnd,@ckRtn))
  362. {
  363. MergeTable("#SaleInvoiceProduct1","#SaleInvoiceProduct");
  364. }
  365. }
  366. else
  367. {
  368. @ckRtn = 0;
  369. if(Search("SearchAllSale",#SaleInvoice.No_Customer,@DateStart,@DateEnd,@ckRtn))
  370. MergeTable("#SaleInvoiceProduct2","#SaleInvoiceProduct");
  371. }
  372. dgProduct.SetColumnReadOnly(14,true);
  373. <Lable name="CountSum"/>
  374. </Click>
  375. </Events>
  376. </IKButton>
  377. <IKFormToolBar name="toolBar">
  378. <Events>
  379. <ClickFirst>
  380. if(Search("SearchSaleInvoiceFirst"))
  381. {
  382. ChangeMode("View",#SaleInvoice.ID_Assessor);
  383. if(#SaleInvoice.Disable_SaleInvoice==true)
  384. ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)";
  385. <Lable name="CountSum"/>
  386. }
  387. </ClickFirst>
  388. <ClickPrev>
  389. if(Search("SearchSaleInvoicePrevious", tbNo.CValue))
  390. {
  391. ChangeMode("View",#SaleInvoice.ID_Assessor);
  392. if(#SaleInvoice.Disable_SaleInvoice==true)
  393. ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)";
  394. <Lable name="CountSum"/>
  395. }
  396. </ClickPrev>
  397. <ClickNext>
  398. if(Search("SearchSaleInvoiceNext",tbNo.CValue))
  399. {
  400. ChangeMode("View",#SaleInvoice.ID_Assessor);
  401. if(#SaleInvoice.Disable_SaleInvoice==true)
  402. ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)";
  403. <Lable name="CountSum"/>
  404. }
  405. </ClickNext>
  406. <ClickLast>
  407. if(Search("SearchSaleInvoiceLast"))
  408. {
  409. ChangeMode("View",#SaleInvoice.ID_Assessor);
  410. if(#SaleInvoice.Disable_SaleInvoice==true)
  411. ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)";
  412. <Lable name="CountSum"/>
  413. }
  414. </ClickLast>
  415. <ClickNew>
  416. <![CDATA[
  417. @NextNo = GetNextAutoNumber(true);
  418. if (!Equals(@NextNo, ""))
  419. {
  420. ChangeMode("New");
  421. #SaleInvoice.No_SaleInvoice= @NextNo;
  422. UpdateForm(true, "tbNo");
  423. }
  424. ]]>
  425. </ClickNew>
  426. <ClickEmpty>
  427. ChangeMode("Search");
  428. </ClickEmpty>
  429. <ClickSubmit>
  430. <Lable name="SubmitButtonClick" />
  431. </ClickSubmit>
  432. <ClickModify>
  433. ChangeMode("Modify");
  434. <Lable name="CountSum"/>
  435. </ClickModify>
  436. <ClickDelete>
  437. Delete();
  438. ChangeMode("Search");
  439. </ClickDelete>
  440. <ClickBlank>
  441. BeginBlank();
  442. #SaleInvoice.Disable_SaleInvoice=true;
  443. Blank();
  444. EndBlank();
  445. ChangeMode("View",#SaleInvoice.ID_Assessor);
  446. if(#SaleInvoice.Disable_SaleInvoice==true)
  447. ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)";
  448. <Lable name="CountSum"/>
  449. </ClickBlank>
  450. <ClickPrint>
  451. ShowPrintBox("BillSearch",#SaleInvoice.No_SaleInvoice,#SaleInvoice.No_SaleInvoice);
  452. </ClickPrint>
  453. <ClickAudit>
  454. <![CDATA[
  455. SuspendLayout();
  456. for (@i=0;@i<RowCount("#SaleInvoiceProduct");@i=@i+1)
  457. {
  458. SetPosition("#SaleInvoiceProduct", @i);
  459. if(Equals(#SaleInvoiceProduct.Name_BillType,"销货单"))
  460. {
  461. if(Search("SearchSaleBill",#SaleInvoiceProduct.No_FromBill,#SaleInvoiceProduct.No_FromBillProduct))
  462. {
  463. if (Equals(#SaleBill.ID_Assessor,DBNull()))
  464. {
  465. tbDetail.SelectedIndex = 1;
  466. dgProduct.CurrentRowIndex = @i;
  467. MessageBox("该来源单据未经审核,审核失败!",@Title);
  468. dgProduct.Focus();
  469. ResumeLayout();
  470. return;
  471. }
  472. if (!Search("SearchCustomerRelation",#SaleInvoice.ID_Customer,#SaleBill.ID_Customer))
  473. {
  474. tbDetail.SelectedIndex = 1;
  475. dgProduct.CurrentRowIndex = @i;
  476. MessageBox("该来源单据的客户与本销项发票的客户或下级客户不一致,审核失败!",@Title);
  477. dgProduct.Focus();
  478. ResumeLayout();
  479. return;
  480. }
  481. }
  482. }
  483. if(Equals(#SaleInvoiceProduct.Name_BillType,"销售退货单"))
  484. {
  485. if(Search("SearchSaleRtnBill",#SaleInvoiceProduct.No_FromBill,#SaleInvoiceProduct.No_FromBillProduct))
  486. {
  487. if (Equals(#SaleRtnBill.ID_Assessor,DBNull()))
  488. {
  489. tbDetail.SelectedIndex = 1;
  490. dgProduct.CurrentRowIndex = @i;
  491. MessageBox("该来源单据未经审核,提交失败!",@Title);
  492. dgProduct.Focus();
  493. ResumeLayout();
  494. return;
  495. }
  496. if (!Search("SearchCustomerRelation",#SaleInvoice.ID_Customer,#SaleRtnBill.ID_Customer))
  497. {
  498. tbDetail.SelectedIndex = 1;
  499. dgProduct.CurrentRowIndex = @i;
  500. MessageBox("该来源单据的客户与本销项发票的客户或下级客户不一致,审核失败!",@Title);
  501. dgProduct.Focus();
  502. ResumeLayout();
  503. return;
  504. }
  505. }
  506. }
  507. }
  508. ResumeLayout();
  509. ]]>
  510. BeginAudit();
  511. #SaleInvoice.ID_Assessor=GetLoginUserID();
  512. #SaleInvoice.Assessor=GetCurrentUser();
  513. #SaleInvoice.AssessDate_SaleInvoice=DateTimeNow();
  514. Audit();
  515. ChangeMode("View",#SaleInvoice.ID_Assessor);
  516. EndAudit();
  517. <Lable name="CountSum"/>
  518. </ClickAudit>
  519. <ClickUnAudit>
  520. BeginUnAudit();
  521. #SaleInvoice.ID_Assessor=DBNull();
  522. #SaleInvoice.Assessor=DBNull();
  523. #SaleInvoice.AssessDate_SaleInvoice=DataTimeNow();
  524. UnAudit();
  525. ChangeMode("View",#SaleInvoice.ID_Assessor);
  526. EndUnAudit();
  527. <Lable name="CountSum"/>
  528. </ClickUnAudit>
  529. <ClickImportItem>
  530. <![CDATA[
  531. if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="销售退货单")
  532. {
  533. if(Search("SearchContr"))
  534. {
  535. ShowSearchBox("ImportSaleRtnBillControl","BILLCONVERTEX","#SaleInvoiceProduct.Type_FromBill",22,"#SaleInvoiceProduct.Name_BillType","销售退货单");
  536. }
  537. else
  538. {
  539. ShowSearchBox("ImportSaleRtnBillUnControl","BILLCONVERTEX");
  540. }
  541. }
  542. else if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="销货单")
  543. {
  544. @ImportClicked = 1;
  545. if(Search("SearchContrSOB"))
  546. {
  547. ShowSearchBox("ImportSaleBillControl","BILLCONVERTEX","#SaleInvoiceProduct.Type_FromBill",21,"#SaleInvoiceProduct.Name_BillType","销货单");
  548. }
  549. else
  550. {
  551. ShowSearchBox("ImportSaleBillUnControl","BILLCONVERTEX");
  552. }
  553. }
  554. ]]>
  555. <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
  556. </ClickImportItem>
  557. <ClickExport>
  558. ;
  559. </ClickExport>
  560. <ClickClose>
  561. ;
  562. </ClickClose>
  563. <ClickExpand>
  564. ;
  565. </ClickExpand>
  566. </Events>
  567. </IKFormToolBar>
  568. </Controls>
  569. <Tables>
  570. <Table name="SaleInvoiceProduct">
  571. <Events>
  572. <ColumnsChanged>
  573. <Name_BillType>
  574. <Lable name="FromBillChange"/>
  575. <Lable name="CountSum" />
  576. </Name_BillType>
  577. <No_FromBill>
  578. <Lable name="FromBillChange"/>
  579. <Lable name="CountSum" />
  580. </No_FromBill>
  581. <No_FromBillProduct>
  582. <Lable name="FromBillChange"/>
  583. <Lable name="CountSum" />
  584. </No_FromBillProduct>
  585. <No_Product>
  586. if(Equals(#SaleInvoiceProduct.No_Product,"") || !Search("SearchProduct",#SaleInvoiceProduct.No_Product))
  587. {
  588. if(!Equals(#SaleInvoiceProduct.No_Product,""))
  589. MessageBox("该产品不存在!",@Title);
  590. #SaleInvoiceProduct.ID_Product=GuidEmpty();
  591. #SaleInvoiceProduct.Name_Product="";
  592. #SaleInvoiceProduct.Unit_Product="";
  593. #SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct=0.00;
  594. #SaleInvoiceProduct.InvoiceName_Product="";
  595. @temp = ShowSearchBox("InputSearchProduct","INFOMATION",#SaleInvoiceProduct.No_Product);
  596. if(@temp != "")
  597. {
  598. ResumeColumnEvent("#SaleInvoiceProduct.No_Product");
  599. #SaleInvoiceProduct.No_Product = @temp;
  600. ClearColumnEvent();
  601. }
  602. }
  603. else
  604. {
  605. #SaleInvoiceProduct.ID_Product=#Product.ID_Product;
  606. #SaleInvoiceProduct.Name_Product=#Product.Name_Product;
  607. #SaleInvoiceProduct.Unit_Product=#Product.Unit_Product;
  608. #SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct=#Product.Price_Product;
  609. #SaleInvoiceProduct.InvoiceName_Product=#Product.InvoiceName_Product;
  610. }
  611. <Lable name="CountAmount"/>
  612. <Lable name="CountSum"/>
  613. </No_Product>
  614. <Quantity_SaleInvoiceProduct>
  615. <Lable name="CountAmount"/>
  616. <Lable name="CountSum"/>
  617. </Quantity_SaleInvoiceProduct>
  618. <UnitPrice_SaleInvoiceProduct>
  619. <Lable name="CountAmount"/>
  620. <Lable name="CountSum"/>
  621. </UnitPrice_SaleInvoiceProduct>
  622. <TaxRate_SaleInvoiceProduct>
  623. <Lable name="CountAmount"/>
  624. <Lable name="CountSum"/>
  625. </TaxRate_SaleInvoiceProduct>
  626. <TaxCurrency_SaleInvoiceProduct>
  627. <Lable name="CountAmount"/>
  628. <Lable name="CountSum"/>
  629. </TaxCurrency_SaleInvoiceProduct>
  630. </ColumnsChanged>
  631. <RowDeleted>
  632. <Lable name="CountSum"/>
  633. </RowDeleted>
  634. </Events>
  635. </Table>
  636. </Tables>
  637. <LockInfomation LockID="ID_SaleInvoice" LockNO="No_SaleInvoice" LockSearchFunction="SearchSaleInvoiceWithNo" LockAudit="ID_Assessor" LockBlank="Disable_SaleInvoice" />
  638. <LogInfomation LogNO="#SaleInvoice.No_SaleInvoice" RecordFormField="发票号码:#SaleInvoice.No_Invoice,客户编号:#SaleInvoice.No_Customer,银行帐号:#SaleInvoice.Account_Customer" RecordDataGridField="#SaleInvoiceProduct.No_Product,#SaleInvoiceProduct.Quantity_SaleInvoiceProduct,#SaleInvoiceProduct.Amount_SaleInvoiceProduct"/>
  639. <ChildForms>
  640. <ChildForm name="BillSearch" DataSource="SaleInvoice" SearchFunction="SearchAllBill" SearchFunctionByNo="SearchSaleInvoiceWithNo">
  641. <DataColumn Index="0" MappingName="#SaleInvoice.No_SaleInvoice" HeaderText="销项发票单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  642. <DataColumn Index="1" MappingName="#SaleInvoice.Date_SaleInvoice" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  643. <DataColumn Index="2" MappingName="#SaleInvoice.ShortName_Customer" HeaderText="客户简称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  644. <DataColumn Index="3" MappingName="#SaleInvoice.No_Invoice" HeaderText="发票号码" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  645. </ChildForm>
  646. <ChildForm name="CustomerSearch" DataSource="Customer" SearchFunction="SearchAllCustomer" SearchFunctionByNo="" MappingName="客户">
  647. <DataColumn Index="0" MappingName="#Customer.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  648. <DataColumn Index="1" MappingName="#Customer.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  649. <DataColumn Index="2" MappingName="#Customer.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  650. <DataColumn Index="3" MappingName="#Customer.Level_Customer" HeaderText="客户等级" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  651. <DataColumn Index="4" MappingName="#Customer.IsGeneric_Customer" HeaderText="一般客户" Width="75" ColumnType="IKDataGridBoolColumn"/>
  652. </ChildForm>
  653. <ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品" ReturnDataSource="SaleInvoiceProduct" ShowCheckBox="true">
  654. <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn" ReturnMappingName="#SaleInvoiceProduct.No_Product"/>
  655. <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  656. </ChildForm>
  657. <ChildForm name="InputSearchProduct" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品">
  658. <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  659. <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  660. </ChildForm>
  661. <ChildForm name="ImportSaleBillControl" >
  662. <DataGridIndex DataSource="SaleBill" SearchFunction="SearchAllSaleBill" SearchFunctionStandby="SearchAllSaleBillProduct" SearchFunctionByNo="" MappingName="" ReturnDataSource="SaleInvoiceProduct">
  663. <DataColumn Index="0" MappingName="#SaleBill.No_SaleBill" ReadOnly="true" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  664. <DataColumn Index="1" MappingName="#SaleBill.Date_SaleBill" ReadOnly="true" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  665. <DataColumn Index="2" MappingName="#SaleBill.No_Customer" ReadOnly="true" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#SaleInvoice.No_Customer"/>
  666. <DataColumn Index="3" MappingName="#SaleBill.ShortName_Customer" ReadOnly="true" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  667. <DataColumn Index="4" MappingName="#SaleBill.TaxCurrency_SaleBill" ReadOnly="true" HeaderText="税别" Width="30" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
  668. <DataColumn Index="5" MappingName="#SaleBill.Currency_SaleBill" ReadOnly="true" HeaderText="币别" Width="30" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent"/>
  669. <DataColumn Index="6" MappingName="#SaleBill.State_SaleBill" ReadOnly="true" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  670. <DataColumn Index="7" MappingName="#SaleBill.Name_Location" ReadOnly="true" HeaderText="出货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" />
  671. <DataColumn Index="8" MappingName="#SaleBill.InvoiceAddress_Company" ReadOnly="true" HeaderText="发票地址" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#SaleInvoice.InvoiceAddress_SaleInvoice"/>
  672. <DataColumn Index="9" MappingName="#SaleBill.InvoiceTitle_Company" ReadOnly="true" HeaderText="发票抬头" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#SaleInvoice.InvoiceTitle_SaleInvoice"/>
  673. </DataGridIndex>
  674. <ReturnFieldMapping>
  675. <DataColumn Index="0" MappingName="#SaleBill.No_SaleBill" ReturnPath="child" ReturnMappingName="#SaleInvoiceProduct.No_FromBill"/>
  676. <DataColumn Index="0" MappingName="#SaleBillProduct.No_SaleBillProduct" ReturnPath="child" ReturnMappingName="#SaleInvoiceProduct.No_FromBillProduct"/>
  677. </ReturnFieldMapping>
  678. </ChildForm>
  679. <ChildForm name="ImportSaleBillUnControl">
  680. <DataGridIndex DataSource="SaleBill" SearchFunction="SearchAllSaleBill" SearchFunctionStandby="SearchAllSaleBillProduct" SearchFunctionByNo="" MappingName=""
  681. ReturnDataSource="SaleInvoiceProduct">
  682. <DataColumn Index="0" MappingName="#SaleBill.No_SaleBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReadOnly="true"
  683. ReturnPath="child" ReturnMappingName="#SaleInvoiceProduct.SaleInvoiceProduct" />
  684. <DataColumn Index="1" MappingName="#SaleBill.Date_SaleBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReadOnly="true"
  685. ReturnPath="child" />
  686. <DataColumn Index="2" MappingName="#SaleBill.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReadOnly="true"
  687. ReturnPath="parent" ReturnMappingName="#SaleInvoice.No_Customer" />
  688. <DataColumn Index="3" MappingName="#SaleBill.ShortName_Customer" HeaderText="客户简称" Width="90" ReadOnly="true"
  689. ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
  690. <DataColumn Index="4" MappingName="#SaleBill.TaxCurrency_SaleBill" HeaderText="税别" Width="90" ReadOnly="true" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" />
  691. <DataColumn Index="5" MappingName="#SaleBill.State_SaleBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReadOnly="true"
  692. ReturnPath="child" />
  693. <DataColumn Index="6" MappingName="#SaleBill.Name_Location" HeaderText="出货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn" ReadOnly="true"
  694. ReturnPath="parent" />
  695. <DataColumn Index="7" MappingName="#SaleBill.OutStatus_SaleBill" HeaderText="发货状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReadOnly="true"
  696. ReturnPath="child" />
  697. </DataGridIndex>
  698. <ReturnFieldMapping>
  699. <DataColumn Index="0" MappingName="#SaleBillProduct.No_Product" ReturnPath="child" ReturnMappingName="#SaleInvoiceProduct.No_Product"/>
  700. </ReturnFieldMapping>
  701. </ChildForm>
  702. <ChildForm name="ImportSaleRtnBillControl">
  703. <DataGridIndex DataSource="SaleRtnBill" SearchFunction="SearchAllSaleRtnBill" SearchFunctionStandby="SearchAllSaleRtnBillProduct" SearchFunctionByNo=""
  704. MappingName="" ReturnDataSource="SaleInvoiceProduct">
  705. <DataColumn Index="0" MappingName="#SaleRtnBill.No_SaleRtnBill" HeaderText="单据编号" Width="90" ReadOnly="true"
  706. ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleInvoiceProduct.No_FromBill" />
  707. <DataColumn Index="1" MappingName="#SaleRtnBill.Date_SaleRtnBill" HeaderText="制单日期" Width="90" ReadOnly="true"
  708. ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
  709. <DataColumn Index="2" MappingName="#SaleRtnBill.No_Customer" HeaderText="客户编号" Width="90" ReadOnly="true" ColumnType="IKDataGridTextBoxColumn"
  710. ReturnPath="parent" ReturnMappingName="#SaleInvoice.No_Customer"/>
  711. <DataColumn Index="3" MappingName="#SaleRtnBill.ShortName_Customer" HeaderText="客户简称" Width="90" ReadOnly="true"
  712. ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
  713. <DataColumn Index="4" MappingName="#SaleRtnBill.State_SaleRtnBill" HeaderText="单据状态" Width="90" ReadOnly="true"
  714. ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
  715. <DataColumn Index="5" MappingName="#SaleRtnBill.Name_Location" HeaderText="入库仓库" Width="90" ReadOnly="true"
  716. ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" />
  717. </DataGridIndex>
  718. <ReturnFieldMapping>
  719. <DataColumn Index="0" MappingName="#SaleRtnBillProduct.No_SaleRtnBillProduct" ReturnPath="child" ReturnMappingName="#SaleInvoiceProduct.No_FromBillProduct"/>
  720. </ReturnFieldMapping>
  721. </ChildForm>
  722. <ChildForm name="ImportSaleRtnBillUnControl">
  723. <DataGridIndex DataSource="SaleRtnBill" SearchFunction="SearchAllSaleRtnBill" SearchFunctionStandby="SearchAllSaleRtnBillProduct" SearchFunctionByNo=""
  724. MappingName="" ReturnDataSource="SaleInvoiceProduct">
  725. <DataColumn Index="0" MappingName="#SaleRtnBill.No_SaleRtnBill" HeaderText="单据编号" Width="90" ReadOnly="true"
  726. ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleInvoiceProduct.Comment_SaleInvoiceProduct" />
  727. <DataColumn Index="1" MappingName="#SaleRtnBill.Date_SaleRtnBill" HeaderText="制单日期" Width="90" ReadOnly="true"
  728. ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
  729. <DataColumn Index="2" MappingName="#SaleRtnBill.No_Customer" HeaderText="客户编号" Width="90" ReadOnly="true" ColumnType="IKDataGridTextBoxColumn"
  730. ReturnPath="parent" ReturnMappingName="#SaleInvoice.No_Customer"/>
  731. <DataColumn Index="3" MappingName="#SaleRtnBill.ShortName_Customer" HeaderText="客户简称" Width="90" ReadOnly="true"
  732. ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
  733. <DataColumn Index="4" MappingName="#SaleRtnBill.State_SaleRtnBill" HeaderText="单据状态" Width="90" ReadOnly="true"
  734. ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
  735. <DataColumn Index="5" MappingName="#SaleRtnBill.Name_Location" HeaderText="入库仓库" Width="90" ReadOnly="true"
  736. ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" />
  737. </DataGridIndex>
  738. <ReturnFieldMapping>
  739. <DataColumn Index="0" MappingName="#SaleRtnBillProduct.No_Product" ReturnPath="child" ReturnMappingName="#SaleInvoiceProduct.No_Product"/>
  740. </ReturnFieldMapping>
  741. </ChildForm>
  742. </ChildForms>
  743. <ImportedInfo>
  744. UpdateForm(true, "tbCustomerNo");
  745. @InvoiceAddress=#SaleInvoice.InvoiceAddress_SaleInvoice;
  746. @InvoiceTitle=#SaleInvoice.InvoiceTitle_SaleInvoice;
  747. ActiveControlEvent("tbCustomerNo", "Enter");
  748. #SaleInvoice.InvoiceAddress_SaleInvoice=@InvoiceAddress;
  749. #SaleInvoice.InvoiceTitle_SaleInvoice=@InvoiceTitle;
  750. UpdateForm(true, "cbInvoiceTitle");
  751. UpdateForm(true, "cbInvoiceAddress");
  752. </ImportedInfo>
  753. </Client>
  754. <Server>
  755. <Tables>
  756. <Table name="SaleInvoice" Type="Parent">
  757. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 SaleInvoice.*,a.Name_User As Creator
  758. ,b.Name_User As Assessor,c.Name_User As LastModUser
  759. ,Customer.No_Customer,Customer.ShortName_Customer
  760. ,Customer.RevenueRegisterNo_Customer,Customer.Bank_Customer
  761. ,Customer.Account_Customer,Customer.GetMethod_Customer
  762. ,Customer.Company_Customer
  763. ,convert(nvarchar(64),'') As TypeName
  764. ,Convert(DateTime,getdate()) as StartDate
  765. ,Convert(DateTime,getdate()) as EndDate
  766. ,Convert(bit,0) as ckRtn
  767. FROM SaleInvoice
  768. LEFT JOIN AppUser a ON SaleInvoice.ID_Creator=a.ID_User
  769. LEFT JOIN AppUser b ON SaleInvoice.ID_Assessor=b.ID_User
  770. LEFT JOIN AppUser c ON SaleInvoice.LastModUser_SaleInvoice=c.ID_User
  771. Left JOIN Customer On Customer.ID_Customer=SaleInvoice.ID_Customer
  772. ">
  773. </GetSchema>
  774. <New CmdType="Text" CmdText=" INSERT INTO SaleInvoice(ID_SaleInvoice
  775. ,No_SaleInvoice
  776. ,Date_SaleInvoice
  777. ,Type_SaleInvoice
  778. ,PayDate_SaleInvoice
  779. ,InvoiceDate_SaleInvoice
  780. ,No_Invoice
  781. ,ID_Customer
  782. ,InvoiceAddress_SaleInvoice
  783. ,InvoiceTitle_SaleInvoice
  784. ,Bank_SaleInvoice
  785. ,Account_SaleInvoice
  786. ,Currency_SaleInvoice
  787. ,ID_Creator
  788. ,CreateDate_SaleInvoice
  789. ,LastModUser_SaleInvoice
  790. ,LastModDate_SaleInvoice
  791. ,ID_Assessor
  792. ,AssessDate_SaleInvoice
  793. ,Amount_SaleInvoice
  794. ,IncludeTax_SaleInvoice
  795. ,GoodsAmount_SaleInvoice
  796. ,TaxAmount_SaleInvoice
  797. )
  798. VALUES(@ID_SaleInvoice
  799. ,@No_SaleInvoice
  800. ,@Date_SaleInvoice
  801. ,@Type_SaleInvoice
  802. ,@PayDate_SaleInvoice
  803. ,@InvoiceDate_SaleInvoice
  804. ,@No_Invoice
  805. ,@ID_Customer
  806. ,@InvoiceAddress_SaleInvoice
  807. ,@InvoiceTitle_SaleInvoice
  808. ,@Bank_SaleInvoice
  809. ,@Account_SaleInvoice
  810. ,@Currency_SaleInvoice
  811. ,@ID_Creator
  812. ,@CreateDate_SaleInvoice
  813. ,@LastModUser_SaleInvoice
  814. ,@LastModDate_SaleInvoice
  815. ,@ID_Assessor
  816. ,@AssessDate_SaleInvoice
  817. ,@Amount_SaleInvoice
  818. ,@IncludeTax_SaleInvoice
  819. ,@GoodsAmount_SaleInvoice
  820. ,@TaxAmount_SaleInvoice
  821. )
  822. ">
  823. <Params>
  824. <Param name="@ID_SaleInvoice" type="SaleInvoice.ID_SaleInvoice" sourceColumn="ID_SaleInvoice" />
  825. <Param name="@No_SaleInvoice" type="SaleInvoice.No_SaleInvoice" sourceColumn="No_SaleInvoice" />
  826. <Param name="@Date_SaleInvoice" type="SaleInvoice.Date_SaleInvoice" sourceColumn="Date_SaleInvoice" />
  827. <Param name="@Type_SaleInvoice" type="SaleInvoice.Type_SaleInvoice" sourceColumn="Type_SaleInvoice" />
  828. <Param name="@PayDate_SaleInvoice" type="SaleInvoice.PayDate_SaleInvoice" sourceColumn="PayDate_SaleInvoice" />
  829. <Param name="@InvoiceDate_SaleInvoice" type="SaleInvoice.InvoiceDate_SaleInvoice" sourceColumn="InvoiceDate_SaleInvoice" />
  830. <Param name="@No_Invoice" type="SaleInvoice.No_Invoice" sourceColumn="No_Invoice" />
  831. <Param name="@ID_Customer" type="SaleInvoice.ID_Customer" sourceColumn="ID_Customer" />
  832. <Param name="@InvoiceAddress_SaleInvoice" type="SaleInvoice.InvoiceAddress_SaleInvoice" sourceColumn="InvoiceAddress_SaleInvoice" />
  833. <Param name="@InvoiceTitle_SaleInvoice" type="SaleInvoice.InvoiceTitle_SaleInvoice" sourceColumn="InvoiceTitle_SaleInvoice" />
  834. <Param name="@Bank_SaleInvoice" type="SaleInvoice.Bank_SaleInvoice" sourceColumn="Bank_SaleInvoice" />
  835. <Param name="@Account_SaleInvoice" type="SaleInvoice.Account_SaleInvoice" sourceColumn="Account_SaleInvoice" />
  836. <Param name="@Currency_SaleInvoice" type="SaleInvoice.Currency_SaleInvoice" sourceColumn="Currency_SaleInvoice" />
  837. <Param name="@ID_Creator" type="SaleInvoice.ID_Creator" sourceColumn="ID_Creator" />
  838. <Param name="@CreateDate_SaleInvoice" type="SaleInvoice.CreateDate_SaleInvoice" sourceColumn="CreateDate_SaleInvoice" />
  839. <Param name="@LastModUser_SaleInvoice" type="SaleInvoice.LastModUser_SaleInvoice" sourceColumn="LastModUser_SaleInvoice" />
  840. <Param name="@LastModDate_SaleInvoice" type="SaleInvoice.LastModDate_SaleInvoice" sourceColumn="LastModDate_SaleInvoice" />
  841. <Param name="@ID_Assessor" type="SaleInvoice.ID_Assessor" sourceColumn="ID_Assessor" />
  842. <Param name="@AssessDate_SaleInvoice" type="SaleInvoice.AssessDate_SaleInvoice" sourceColumn="AssessDate_SaleInvoice" />
  843. <Param name="@Amount_SaleInvoice" type="SaleInvoice.Amount_SaleInvoice" sourceColumn="Amount_SaleInvoice" />
  844. <Param name="@IncludeTax_SaleInvoice" type="SaleInvoice.IncludeTax_SaleInvoice" sourceColumn="IncludeTax_SaleInvoice" />
  845. <Param name="@GoodsAmount_SaleInvoice" type="SaleInvoice.GoodsAmount_SaleInvoice" sourceColumn="GoodsAmount_SaleInvoice" />
  846. <Param name="@TaxAmount_SaleInvoice" type="SaleInvoice.TaxAmount_SaleInvoice" sourceColumn="TaxAmount_SaleInvoice" />
  847. </Params>
  848. </New>
  849. <Update CmdType="Text" CmdText=" UPDATE SaleInvoice
  850. SET No_SaleInvoice=@No_SaleInvoice
  851. ,Date_SaleInvoice=@Date_SaleInvoice
  852. ,Type_SaleInvoice=@Type_SaleInvoice
  853. ,PayDate_SaleInvoice=@PayDate_SaleInvoice
  854. ,InvoiceDate_SaleInvoice=@InvoiceDate_SaleInvoice
  855. ,No_Invoice=@No_Invoice
  856. ,ID_Customer=@ID_Customer
  857. ,InvoiceAddress_SaleInvoice=@InvoiceAddress_SaleInvoice
  858. ,InvoiceTitle_SaleInvoice=@InvoiceTitle_SaleInvoice
  859. ,Bank_SaleInvoice=@Bank_SaleInvoice
  860. ,Account_SaleInvoice=@Account_SaleInvoice
  861. ,Currency_SaleInvoice=@Currency_SaleInvoice
  862. ,ID_Creator=@ID_Creator
  863. ,CreateDate_SaleInvoice=@CreateDate_SaleInvoice
  864. ,LastModUser_SaleInvoice=@LastModUser_SaleInvoice
  865. ,LastModDate_SaleInvoice=@LastModDate_SaleInvoice
  866. ,ID_Assessor=@ID_Assessor
  867. ,AssessDate_SaleInvoice=@AssessDate_SaleInvoice
  868. ,Amount_SaleInvoice=@Amount_SaleInvoice
  869. ,IncludeTax_SaleInvoice=@IncludeTax_SaleInvoice
  870. ,GoodsAmount_SaleInvoice=@GoodsAmount_SaleInvoice
  871. ,TaxAmount_SaleInvoice=@TaxAmount_SaleInvoice
  872. WHERE ID_SaleInvoice=@ID_SaleInvoice
  873. ">
  874. <Params>
  875. <Param name="@ID_SaleInvoice" type="SaleInvoice.ID_SaleInvoice" sourceColumn="ID_SaleInvoice" />
  876. <Param name="@No_SaleInvoice" type="SaleInvoice.No_SaleInvoice" sourceColumn="No_SaleInvoice" />
  877. <Param name="@Date_SaleInvoice" type="SaleInvoice.Date_SaleInvoice" sourceColumn="Date_SaleInvoice" />
  878. <Param name="@Type_SaleInvoice" type="SaleInvoice.Type_SaleInvoice" sourceColumn="Type_SaleInvoice" />
  879. <Param name="@PayDate_SaleInvoice" type="SaleInvoice.PayDate_SaleInvoice" sourceColumn="PayDate_SaleInvoice" />
  880. <Param name="@InvoiceDate_SaleInvoice" type="SaleInvoice.InvoiceDate_SaleInvoice" sourceColumn="InvoiceDate_SaleInvoice" />
  881. <Param name="@No_Invoice" type="SaleInvoice.No_Invoice" sourceColumn="No_Invoice" />
  882. <Param name="@ID_Customer" type="SaleInvoice.ID_Customer" sourceColumn="ID_Customer" />
  883. <Param name="@InvoiceAddress_SaleInvoice" type="SaleInvoice.InvoiceAddress_SaleInvoice" sourceColumn="InvoiceAddress_SaleInvoice" />
  884. <Param name="@InvoiceTitle_SaleInvoice" type="SaleInvoice.InvoiceTitle_SaleInvoice" sourceColumn="InvoiceTitle_SaleInvoice" />
  885. <Param name="@Bank_SaleInvoice" type="SaleInvoice.Bank_SaleInvoice" sourceColumn="Bank_SaleInvoice" />
  886. <Param name="@Account_SaleInvoice" type="SaleInvoice.Account_SaleInvoice" sourceColumn="Account_SaleInvoice" />
  887. <Param name="@Currency_SaleInvoice" type="SaleInvoice.Currency_SaleInvoice" sourceColumn="Currency_SaleInvoice" />
  888. <Param name="@ID_Creator" type="SaleInvoice.ID_Creator" sourceColumn="ID_Creator" />
  889. <Param name="@CreateDate_SaleInvoice" type="SaleInvoice.CreateDate_SaleInvoice" sourceColumn="CreateDate_SaleInvoice" />
  890. <Param name="@LastModUser_SaleInvoice" type="SaleInvoice.LastModUser_SaleInvoice" sourceColumn="LastModUser_SaleInvoice" />
  891. <Param name="@LastModDate_SaleInvoice" type="SaleInvoice.LastModDate_SaleInvoice" sourceColumn="LastModDate_SaleInvoice" />
  892. <Param name="@ID_Assessor" type="SaleInvoice.ID_Assessor" sourceColumn="ID_Assessor" />
  893. <Param name="@AssessDate_SaleInvoice" type="SaleInvoice.AssessDate_SaleInvoice" sourceColumn="AssessDate_SaleInvoice" />
  894. <Param name="@Amount_SaleInvoice" type="SaleInvoice.Amount_SaleInvoice" sourceColumn="Amount_SaleInvoice" />
  895. <Param name="@IncludeTax_SaleInvoice" type="SaleInvoice.IncludeTax_SaleInvoice" sourceColumn="IncludeTax_SaleInvoice" />
  896. <Param name="@GoodsAmount_SaleInvoice" type="SaleInvoice.GoodsAmount_SaleInvoice" sourceColumn="GoodsAmount_SaleInvoice" />
  897. <Param name="@TaxAmount_SaleInvoice" type="SaleInvoice.TaxAmount_SaleInvoice" sourceColumn="TaxAmount_SaleInvoice" />
  898. </Params>
  899. </Update>
  900. <Delete CmdType="Text" CmdText=" DELETE FROM SaleInvoiceProduct WHERE ID_SaleInvoice=@ID_SaleInvoice
  901. DELETE FROM SaleInvoice WHERE ID_SaleInvoice=@ID_SaleInvoice
  902. ">
  903. <Params>
  904. <Param name="@ID_SaleInvoice" type="SaleInvoice.ID_SaleInvoice" sourceColumn="ID_SaleInvoice" />
  905. </Params>
  906. </Delete>
  907. <Audit CmdType="Text" CmdText=" UPDATE Customer
  908. SET Customer.ToGetBalance_Customer = Customer.ToGetBalance_Customer+@Amount_SaleInvoice
  909. WHERE Customer.ID_Customer=@ID_Customer
  910. DECLARE @No_SaleBill NVARCHAR(64)
  911. DECLARE CUR CURSOR
  912. FOR
  913. SELECT No_FromBill
  914. FROM SaleInvoiceProduct
  915. WHERE ID_SaleInvoice=@ID_SaleInvoice
  916. OPEN CUR
  917. FETCH NEXT FROM CUR INTO @No_SaleBill
  918. WHILE @@FETCH_STATUS=0
  919. BEGIN
  920. UPDATE SaleBill SET Assess_SaleBill=1 WHERE No_SaleBill=@No_SaleBill
  921. UPDATE SaleRtnBill SET Assess_SaleRtnBill=1 WHERE No_SaleRtnBill=@No_SaleBill
  922. FETCH NEXT FROM CUR INTO @No_SaleBill
  923. END
  924. DEALLOCATE CUR
  925. UPDATE SaleInvoice SET ID_Assessor=@ID_Assessor,AssessDate_SaleInvoice=@AssessDate_SaleInvoice WHERE ID_SaleInvoice=@ID_SaleInvoice
  926. ">
  927. <Params>
  928. <Param name="@ID_SaleInvoice" type="SaleInvoice.ID_SaleInvoice" sourceColumn="ID_SaleInvoice"/>
  929. <Param name="@ID_Assessor" type="SaleInvoice.ID_Assessor" sourceColumn="ID_Assessor"/>
  930. <Param name="@ID_Customer" type="SaleInvoice.ID_Customer" sourceColumn="ID_Customer"/>
  931. <Param name="@AssessDate_SaleInvoice" type="SaleInvoice.AssessDate_SaleInvoice" sourceColumn="AssessDate_SaleInvoice"/>
  932. <Param name="@Amount_SaleInvoice" type="SaleInvoice.Amount_SaleInvoice" sourceColumn="Amount_SaleInvoice" />
  933. </Params>
  934. </Audit>
  935. <Blank CmdType="Text" CmdText="
  936. UPDATE Customer
  937. SET ToGetBalance_Customer = ToGetBalance_Customer-@Amount_SaleInvoice
  938. WHERE ID_Customer=@ID_Customer
  939. DECLARE @No_SaleBill NVARCHAR(64)
  940. DECLARE CUR CURSOR
  941. FOR
  942. SELECT No_FromBill
  943. FROM SaleInvoiceProduct
  944. WHERE ID_SaleInvoice=@ID_SaleInvoice
  945. OPEN CUR
  946. FETCH NEXT FROM CUR INTO @No_SaleBill
  947. WHILE @@FETCH_STATUS=0
  948. BEGIN
  949. UPDATE SaleBill SET Assess_SaleBill=0 WHERE No_SaleBill=@No_SaleBill
  950. UPDATE SaleRtnBill SET Assess_SaleRtnBill=0 WHERE No_SaleRtnBill=@No_SaleBill
  951. FETCH NEXT FROM CUR INTO @No_SaleBill
  952. END
  953. DEALLOCATE CUR
  954. UPDATE SaleInvoice
  955. SET Disable_SaleInvoice=@Disable_SaleInvoice
  956. Where ID_SaleInvoice=@ID_SaleInvoice
  957. ">
  958. <Params>
  959. <Param name="@ID_SaleInvoice" type="SaleInvoice.ID_SaleInvoice" sourceColumn="ID_SaleInvoice" />
  960. <Param name="@No_SaleInvoice" type="SaleInvoice.No_SaleInvoice" sourceColumn="No_SaleInvoice" />
  961. <Param name="@ID_Customer" type="SaleInvoice.ID_Customer" sourceColumn="ID_Customer"/>
  962. <Param name="@Disable_SaleInvoice" type="SaleInvoice.Disable_SaleInvoice" sourceColumn="Disable_SaleInvoice"/>
  963. <Param name="@Amount_SaleInvoice" type="SaleInvoice.Amount_SaleInvoice" sourceColumn="Amount_SaleInvoice" />
  964. <Param name="@StrikedAmount_SaleInvoice" type="SaleInvoice.StrikedAmount_SaleInvoice" sourceColumn="StrikedAmount_SaleInvoice" />
  965. </Params>
  966. </Blank>
  967. </Table>
  968. <Table name="SaleInvoiceProduct" Type="Child">
  969. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 SaleInvoiceProduct.*,
  970. convert(nvarchar(64),'') As Name_BillType
  971. ,Product.No_Product
  972. ,Product.Name_Product
  973. ,Product.InvoiceName_Product
  974. ,Product.Unit_Product
  975. ,convert(bit,0) AS Negative
  976. ,Convert(nvarchar(64),'') As No_Customer
  977. ,Convert(nvarchar(64),'') As ShortName_Customer
  978. FROM SaleInvoiceProduct
  979. LEFT JOIN Product On Product.ID_Product=SaleInvoiceProduct.ID_Product
  980. ">
  981. </GetSchema>
  982. <New CmdType="Text" CmdText=" INSERT INTO SaleInvoiceProduct(ID_SaleInvoiceProduct
  983. ,ID_SaleInvoice
  984. ,Type_FromBill
  985. ,No_FromBill
  986. ,No_FromBillProduct
  987. ,ID_Product
  988. ,Quantity_SaleInvoiceProduct
  989. ,UnitPrice_SaleInvoiceProduct
  990. ,TaxRate_SaleInvoiceProduct
  991. ,Comment_SaleInvoiceProduct
  992. ,Amount_SaleInvoiceProduct
  993. ,TaxAmount_SaleInvoiceProduct
  994. ,GoodsAmount_SaleInvoiceProduct
  995. ,TaxCurrency_SaleInvoiceProduct)
  996. Values(@ID_SaleInvoiceProduct
  997. ,@ID_SaleInvoice
  998. ,@Type_FromBill
  999. ,@No_FromBill
  1000. ,@No_FromBillProduct
  1001. ,@ID_Product
  1002. ,@Quantity_SaleInvoiceProduct
  1003. ,@UnitPrice_SaleInvoiceProduct
  1004. ,@TaxRate_SaleInvoiceProduct
  1005. ,@Comment_SaleInvoiceProduct
  1006. ,@Amount_SaleInvoiceProduct
  1007. ,@TaxAmount_SaleInvoiceProduct
  1008. ,@GoodsAmount_SaleInvoiceProduct
  1009. ,@TaxCurrency_SaleInvoiceProduct)
  1010. ">
  1011. <Params>
  1012. <Param name="@ID_SaleInvoiceProduct" type="SaleInvoiceProduct.ID_SaleInvoiceProduct" sourceColumn="ID_SaleInvoiceProduct" />
  1013. <Param name="@ID_SaleInvoice" type="SaleInvoiceProduct.ID_SaleInvoice" sourceColumn="ID_SaleInvoice" />
  1014. <Param name="@Type_FromBill" type="SaleInvoiceProduct.Type_FromBill" sourceColumn="Type_FromBill" />
  1015. <Param name="@No_FromBill" type="SaleInvoiceProduct.No_FromBill" sourceColumn="No_FromBill" />
  1016. <Param name="@No_FromBillProduct" type="SaleInvoiceProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
  1017. <Param name="@ID_Product" type="SaleInvoiceProduct.ID_Product" sourceColumn="ID_Product" />
  1018. <Param name="@Quantity_SaleInvoiceProduct" type="SaleInvoiceProduct.Quantity_SaleInvoiceProduct" sourceColumn="Quantity_SaleInvoiceProduct" />
  1019. <Param name="@UnitPrice_SaleInvoiceProduct" type="SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct" sourceColumn="UnitPrice_SaleInvoiceProduct" />
  1020. <Param name="@TaxRate_SaleInvoiceProduct" type="SaleInvoiceProduct.TaxRate_SaleInvoiceProduct" sourceColumn="TaxRate_SaleInvoiceProduct" />
  1021. <Param name="@Comment_SaleInvoiceProduct" type="SaleInvoiceProduct.Comment_SaleInvoiceProduct" sourceColumn="Comment_SaleInvoiceProduct" />
  1022. <Param name="@Amount_SaleInvoiceProduct" type="SaleInvoiceProduct.Amount_SaleInvoiceProduct" sourceColumn="Amount_SaleInvoiceProduct" />
  1023. <Param name="@TaxAmount_SaleInvoiceProduct" type="SaleInvoiceProduct.TaxAmount_SaleInvoiceProduct" sourceColumn="TaxAmount_SaleInvoiceProduct" />
  1024. <Param name="@GoodsAmount_SaleInvoiceProduct" type="SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct" sourceColumn="GoodsAmount_SaleInvoiceProduct" />
  1025. <Param name="@TaxCurrency_SaleInvoiceProduct" type="SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct" sourceColumn="TaxCurrency_SaleInvoiceProduct" />
  1026. </Params>
  1027. </New>
  1028. <Update CmdType="Text" CmdText=" UPDATE SaleInvoiceProduct
  1029. SET ID_SaleInvoice=@ID_SaleInvoice
  1030. ,Type_FromBill=@Type_FromBill
  1031. ,No_FromBill=@No_FromBill
  1032. ,No_FromBillProduct=@No_FromBillProduct
  1033. ,ID_Product=@ID_Product
  1034. ,Quantity_SaleInvoiceProduct=@Quantity_SaleInvoiceProduct
  1035. ,UnitPrice_SaleInvoiceProduct=@UnitPrice_SaleInvoiceProduct
  1036. ,TaxRate_SaleInvoiceProduct=@TaxRate_SaleInvoiceProduct
  1037. ,Comment_SaleInvoiceProduct=@Comment_SaleInvoiceProduct
  1038. ,Amount_SaleInvoiceProduct=@Amount_SaleInvoiceProduct
  1039. ,TaxAmount_SaleInvoiceProduct=@TaxAmount_SaleInvoiceProduct
  1040. ,GoodsAmount_SaleInvoiceProduct=@GoodsAmount_SaleInvoiceProduct
  1041. ,TaxCurrency_SaleInvoiceProduct=@TaxCurrency_SaleInvoiceProduct
  1042. WHERE ID_SaleInvoiceProduct=@ID_SaleInvoiceProduct
  1043. ">
  1044. <Params>
  1045. <Param name="@ID_SaleInvoiceProduct" type="SaleInvoiceProduct.ID_SaleInvoiceProduct" sourceColumn="ID_SaleInvoiceProduct" />
  1046. <Param name="@ID_SaleInvoice" type="SaleInvoiceProduct.ID_SaleInvoice" sourceColumn="ID_SaleInvoice" />
  1047. <Param name="@Type_FromBill" type="SaleInvoiceProduct.Type_FromBill" sourceColumn="Type_FromBill" />
  1048. <Param name="@No_FromBill" type="SaleInvoiceProduct.No_FromBill" sourceColumn="No_FromBill" />
  1049. <Param name="@No_FromBillProduct" type="SaleInvoiceProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
  1050. <Param name="@ID_Product" type="SaleInvoiceProduct.ID_Product" sourceColumn="ID_Product" />
  1051. <Param name="@Quantity_SaleInvoiceProduct" type="SaleInvoiceProduct.Quantity_SaleInvoiceProduct" sourceColumn="Quantity_SaleInvoiceProduct" />
  1052. <Param name="@UnitPrice_SaleInvoiceProduct" type="SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct" sourceColumn="UnitPrice_SaleInvoiceProduct" />
  1053. <Param name="@TaxRate_SaleInvoiceProduct" type="SaleInvoiceProduct.TaxRate_SaleInvoiceProduct" sourceColumn="TaxRate_SaleInvoiceProduct" />
  1054. <Param name="@Comment_SaleInvoiceProduct" type="SaleInvoiceProduct.Comment_SaleInvoiceProduct" sourceColumn="Comment_SaleInvoiceProduct" />
  1055. <Param name="@Amount_SaleInvoiceProduct" type="SaleInvoiceProduct.Amount_SaleInvoiceProduct" sourceColumn="Amount_SaleInvoiceProduct" />
  1056. <Param name="@TaxAmount_SaleInvoiceProduct" type="SaleInvoiceProduct.TaxAmount_SaleInvoiceProduct" sourceColumn="TaxAmount_SaleInvoiceProduct" />
  1057. <Param name="@GoodsAmount_SaleInvoiceProduct" type="SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct" sourceColumn="GoodsAmount_SaleInvoiceProduct" />
  1058. <Param name="@TaxCurrency_SaleInvoiceProduct" type="SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct" sourceColumn="TaxCurrency_SaleInvoiceProduct" />
  1059. </Params>
  1060. </Update>
  1061. <Delete CmdType="Text" CmdText=" DELETE FROM SaleInvoiceProduct WHERE ID_SaleInvoiceProduct=@ID_SaleInvoiceProduct">
  1062. <Params>
  1063. <Param name="@ID_SaleInvoiceProduct" type="SaleInvoiceProduct.ID_SaleInvoiceProduct" sourceColumn="ID_SaleInvoiceProduct" />
  1064. </Params>
  1065. </Delete>
  1066. </Table>
  1067. </Tables>
  1068. <Search>
  1069. <SearchAllBill CmdType="Text" CmdText=" SELECT SaleInvoice.*,a.Name_User As Creator ,b.Name_User As Assessor
  1070. ,c.Name_User As LastModUser,Customer.No_Customer,Customer.ShortName_Customer
  1071. ,Customer.RevenueRegisterNo_Customer,Customer.Bank_Customer,Customer.Account_Customer
  1072. ,Customer.GetMethod_Customer,convert(nvarchar(64),'') As TypeName,Customer.Company_Customer
  1073. FROM SaleInvoice
  1074. LEFT JOIN AppUser a ON SaleInvoice.ID_Creator=a.ID_User
  1075. LEFT JOIN AppUser b ON SaleInvoice.ID_Assessor=b.ID_User
  1076. LEFT JOIN AppUser c ON SaleInvoice.LastModUser_SaleInvoice=c.ID_User
  1077. Left JOIN Customer On Customer.ID_Customer=SaleInvoice.ID_Customer">
  1078. <Tables>
  1079. <Table name="AllBill" />
  1080. </Tables>
  1081. </SearchAllBill>
  1082. <SearchAllCustomer CmdType="Text" CmdText="SELECT Customer.No_Customer,Customer.ShortName_Customer
  1083. ,Customer.Type_Customer,Customer.Level_Customer,Customer.IsGeneric_Customer
  1084. FROM Customer ">
  1085. <Tables>
  1086. <Table name="AllCustomer" />
  1087. </Tables>
  1088. </SearchAllCustomer>
  1089. <SearchAllProduct CmdType="Text" CmdText="SELECT Product.No_Product,Product.Name_Product FROM Product ">
  1090. <Tables>
  1091. <Table name="AllProduct" />
  1092. </Tables>
  1093. </SearchAllProduct>
  1094. <SearchCustomer CmdType="Text" CmdText=" SELECT Top 1 Customer.ID_Customer,ShortName_Customer,RevenueRegisterNo_Customer
  1095. ,Bank_Customer,Account_Customer,GetMethod_Customer,SuspendDate_Customer
  1096. ,DunDate_Customer,Title_Invoice ,Address_Invoice,Company_Customer
  1097. From Customer
  1098. Left Join Invoice On Invoice.ID_Customer = Customer.ID_Customer And Invoice.Common_Invoice = 1
  1099. WHERE No_Customer=@No_Customer
  1100. And IsCustomersCustomer_Customer = 0
  1101. ">
  1102. <Params>
  1103. <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
  1104. </Params>
  1105. <Tables>
  1106. <Table name="Customer"/>
  1107. </Tables>
  1108. </SearchCustomer>
  1109. <SearchInvoiceTitle CmdType="Text" CmdText=" SELECT Title_Invoice FROM Invoice WHERE ID_Customer=@ID_Customer">
  1110. <Params>
  1111. <Param name="@ID_Customer" type="Customer.ID_Customer" Index="0" />
  1112. </Params>
  1113. <Tables>
  1114. <Table name="InvoiceTitle"/>
  1115. </Tables>
  1116. </SearchInvoiceTitle>
  1117. <SearchInvoiceAddress CmdType="Text" CmdText=" SELECT Address_Invoice FROM Invoice WHERE ID_Customer=@ID_Customer">
  1118. <Params>
  1119. <Param name="@ID_Customer" type="Customer.ID_Customer" Index="0" />
  1120. </Params>
  1121. <Tables>
  1122. <Table name="InvoiceAddress"/>
  1123. </Tables>
  1124. </SearchInvoiceAddress>
  1125. <SearchBank CmdType="Text" CmdText="SELECT Name_TypeDef FROM TypeDef WHERE Type_TypeDef = 6">
  1126. <Tables>
  1127. <Table name="Bank" />
  1128. </Tables>
  1129. </SearchBank>
  1130. <SearchCompany CmdType="Text" CmdText="SELECT Name_TypeDef FROM TypeDef WHERE Type_TypeDef = 30">
  1131. <Tables>
  1132. <Table name="Company" />
  1133. </Tables>
  1134. </SearchCompany>
  1135. <SearchSaleBill CmdType="Text" CmdText="SELECT SaleBill.InvoiceAddress_Company,SaleBill.InvoiceTitle_Company
  1136. ,ID_Assessor,ID_Customer,ID_Product,TaxCurrency_SaleBill
  1137. FROM SaleBill
  1138. Join SaleBillProduct On SaleBillProduct.ID_SaleBill=SaleBill.ID_SaleBill
  1139. WHERE No_SaleBill=@No_SaleBill AND No_SaleBillProduct=@No_SaleBillProduct
  1140. ">
  1141. <Params>
  1142. <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" Index="0" />
  1143. <Param name="@No_SaleBillProduct" type="SaleBillProduct.No_SaleBillProduct" Index="1" />
  1144. </Params>
  1145. <Tables>
  1146. <Table name="SaleBill"/>
  1147. </Tables>
  1148. </SearchSaleBill>
  1149. <SearchSaleRtnBill CmdType="Text" CmdText=" SELECT ID_Assessor,ID_Customer,ID_Product,SaleRtnBill.TaxCurrency_SaleRtnBill
  1150. FROM SaleRtnBillProduct
  1151. LEFT JOIN SaleRtnBill On SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
  1152. WHERE No_SaleRtnBill=@No_SaleRtnBill AND No_SaleRtnBillProduct=@No_SaleRtnBillProduct
  1153. ">
  1154. <Params>
  1155. <Param name="@No_SaleRtnBill" type="SaleRtnBill.No_SaleRtnBill" Index="0" />
  1156. <Param name="@No_SaleRtnBillProduct" type="SaleRtnBillProduct.No_SaleRtnBillProduct" Index="1" />
  1157. </Params>
  1158. <Tables>
  1159. <Table name="SaleRtnBill"/>
  1160. </Tables>
  1161. </SearchSaleRtnBill>
  1162. <SearchSaleBillProduct CmdType="Text" CmdText="SELECT SaleBill.TaxCurrency_SaleBill
  1163. ,SaleBillProduct.ID_Product
  1164. ,SaleBillProduct.Quantity_SaleBillProduct
  1165. ,SaleBillProduct.UnitPrice_SaleBillProduct
  1166. ,SaleBillProduct.Discount_SaleBillProduct
  1167. ,Product.No_Product
  1168. ,Product.Name_Product
  1169. ,Product.InvoiceName_Product
  1170. ,Product.Unit_Product
  1171. ,Customer.No_Customer
  1172. ,Customer.ShortName_Customer
  1173. FROM SaleBillProduct
  1174. LEFT JOIN SaleBill On SaleBill.ID_SaleBill=SaleBillProduct.ID_SaleBill
  1175. LEFT JOIN Product On Product.ID_Product=SaleBillProduct.ID_Product
  1176. Left join Customer on Customer.ID_Customer = SaleBill.ID_Customer
  1177. WHERE No_SaleBill=@No_SaleBill
  1178. AND No_SaleBillProduct=@No_SaleBillProduct
  1179. ">
  1180. <Params>
  1181. <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" Index="0" />
  1182. <Param name="@No_SaleBillProduct" type="SaleBillProduct.No_SaleBillProduct" Index="1" />
  1183. </Params>
  1184. <Tables>
  1185. <Table name="SaleBillProduct"/>
  1186. </Tables>
  1187. </SearchSaleBillProduct>
  1188. <SearchSaleRtnBillProduct CmdType="Text" CmdText=" SELECT SaleRtnBill.TaxCurrency_SaleRtnBill
  1189. ,SaleRtnBillProduct.ID_Product
  1190. ,SaleRtnBillProduct.Quantity_SaleRtnBillProduct
  1191. ,SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct
  1192. ,Product.No_Product
  1193. ,Product.Name_Product
  1194. ,Product.InvoiceName_Product
  1195. ,Product.Unit_Product
  1196. ,Customer.No_Customer
  1197. ,Customer.ShortName_Customer
  1198. FROM SaleRtnBillProduct
  1199. LEFT JOIN SaleRtnBill On SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
  1200. LEFT JOIN Product On Product.ID_Product=SaleRtnBillProduct.ID_Product
  1201. Left join Customer on Customer.ID_Customer = SaleRtnBill.ID_Customer
  1202. WHERE No_SaleRtnBill=@No_SaleRtnBill AND No_SaleRtnBillProduct=@No_SaleRtnBillProduct
  1203. ">
  1204. <Params>
  1205. <Param name="@No_SaleRtnBill" type="SaleRtnBill.No_SaleRtnBill" Index="0" />
  1206. <Param name="@No_SaleRtnBillProduct" type="SaleRtnBillProduct.No_SaleRtnBillProduct" Index="1" />
  1207. </Params>
  1208. <Tables>
  1209. <Table name="SaleRtnBillProduct"/>
  1210. </Tables>
  1211. </SearchSaleRtnBillProduct>
  1212. <SearchProduct CmdType="Text" CmdText=" SELECT Product.ID_Product,Product.Name_Product,Product.InvoiceName_Product
  1213. ,Product.Unit_Product,Product.Price_Product
  1214. FROM Product
  1215. WHERE No_Product=@No_Product
  1216. ">
  1217. <Params>
  1218. <Param name="@No_Product" type="Product.No_Product" Index="0" />
  1219. </Params>
  1220. <Tables>
  1221. <Table name="Product"/>
  1222. </Tables>
  1223. </SearchProduct>
  1224. <SearchCessOut CmdType="Text" CmdText="SELECT CessOut_SystemSetting,SysCurrency_SystemSetting,PriceDecimal_SystemSetting From SystemSetting">
  1225. <Tables>
  1226. <Table name="SystemSetting"/>
  1227. </Tables>
  1228. </SearchCessOut>
  1229. <SearchSaleInvoiceWithNo CmdType="Text" CmdText=" SELECT SaleInvoice.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser
  1230. ,Customer.No_Customer,Customer.ShortName_Customer,Customer.RevenueRegisterNo_Customer
  1231. ,Customer.Bank_Customer,Customer.Account_Customer,Customer.GetMethod_Customer
  1232. ,Customer.Company_Customer
  1233. ,TypeName=CASE Type_SaleInvoice When 0 Then '普通发票' ELSE '增值税发票' End
  1234. ,Convert(DateTime,getdate()) as StartDate
  1235. ,Convert(DateTime,getdate()) as EndDate
  1236. ,Convert(bit,0) as ckRtn
  1237. FROM SaleInvoice
  1238. LEFT JOIN AppUser a ON SaleInvoice.ID_Creator=a.ID_User
  1239. LEFT JOIN AppUser b ON SaleInvoice.ID_Assessor=b.ID_User
  1240. LEFT JOIN AppUser c ON SaleInvoice.LastModUser_SaleInvoice=c.ID_User
  1241. Left JOIN Customer On Customer.ID_Customer=SaleInvoice.ID_Customer
  1242. WHERE No_SaleInvoice=@No_SaleInvoice
  1243. SELECT SaleInvoiceProduct.*
  1244. ,Product.No_Product,Product.Name_Product
  1245. ,Product.InvoiceName_Product
  1246. ,Product.Unit_Product,BillType.Name_BillType
  1247. ,A.No_Customer As No_Customer
  1248. ,A.ShortName_Customer As ShortName_Customer
  1249. FROM SaleInvoiceProduct
  1250. LEFT JOIN Product On Product.ID_Product=SaleInvoiceProduct.ID_Product
  1251. LEFT JOIN SaleInvoice On SaleInvoice.ID_SaleInvoice=SaleInvoiceProduct.ID_SaleInvoice
  1252. LEFT JOIN BillType On BillType.Value_BillType=SaleInvoiceProduct.Type_FromBill
  1253. Left Join (select No_SaleBill As No_Bill
  1254. ,Customer.No_Customer As No_Customer
  1255. ,Customer.ShortName_Customer As ShortName_Customer
  1256. From SaleBill
  1257. Left join Customer on Customer.ID_Customer=SaleBill.ID_Customer
  1258. Where ID_Assessor Is Not Null
  1259. Union All
  1260. select No_SaleRtnBill As No_Bill
  1261. ,Customer.No_Customer As No_Customer
  1262. ,Customer.ShortName_Customer As ShortName_Customer
  1263. From SaleRtnBill
  1264. Left join Customer on Customer.ID_Customer=SaleRtnBill.ID_Customer
  1265. Where ID_Assessor Is Not Null) A On A.No_Bill = SaleInvoiceProduct.No_FromBill
  1266. WHERE No_SaleInvoice=@No_SaleInvoice
  1267. ">
  1268. <Params>
  1269. <Param name="@No_SaleInvoice" type="SaleInvoice.No_SaleInvoice" Index="0" />
  1270. </Params>
  1271. <Tables>
  1272. <Table name="SaleInvoice"/>
  1273. <Table name="SaleInvoiceProduct"/>
  1274. </Tables>
  1275. </SearchSaleInvoiceWithNo>
  1276. <SearchInvoiceNo CmdType="Text" CmdText="Select * From SaleInvoice Where No_Invoice=@No_Invoice And No_SaleInvoice!=@No_SaleInvoice">
  1277. <Params>
  1278. <Param name="@No_Invoice" type="SaleInvoice.No_Invoice" Index="0" />
  1279. <Param name="@No_SaleInvoice" type="SaleInvoice.No_SaleInvoice" Index="1" />
  1280. </Params>
  1281. <Tables>
  1282. <Table name="SaleInvoiceNo"/>
  1283. </Tables>
  1284. </SearchInvoiceNo>
  1285. <SearchBillType CmdType="Text" CmdText=" SELECT * FROM BillType WHERE Value_BillType = 21 OR Value_BillType = 0 OR Value_BillType = 22 ORDER BY Value_BillType">
  1286. <Tables>
  1287. <Table name="BillType" />
  1288. </Tables>
  1289. </SearchBillType>
  1290. <SearchCurrency CmdType="Text" CmdText=" CREATE TABLE GetTaxCurrency
  1291. (
  1292. [Type] nvarchar(64)
  1293. )
  1294. INSERT INTO GetTaxCurrency VALUES ('外加')
  1295. INSERT INTO GetTaxCurrency VALUES ('内含')
  1296. SELECT Type AS TaxCurrency_SaleInvoiceProduct FROM GetTaxCurrency
  1297. DROP TABLE GetTaxCurrency
  1298. ">
  1299. <Tables>
  1300. <Table name="GetTaxCurrency" />
  1301. </Tables>
  1302. </SearchCurrency>
  1303. <SearchSaleInvoiceFirst CmdType="Text" CmdText="DECLARE @ID_SaleInvoice UNIQUEIDENTIFIER
  1304. SELECT TOP 1 @ID_SaleInvoice=ID_SaleInvoice
  1305. FROM SaleInvoice ORDER BY No_SaleInvoice
  1306. SELECT SaleInvoice.*,a.Name_User As Creator ,b.Name_User As Assessor
  1307. ,c.Name_User As LastModUser,Customer.No_Customer,Customer.ShortName_Customer
  1308. ,Customer.RevenueRegisterNo_Customer,Customer.Bank_Customer
  1309. ,Customer.Account_Customer,Customer.GetMethod_Customer
  1310. ,Customer.Company_Customer
  1311. ,TypeName=CASE Type_SaleInvoice When 0 Then '普通发票' ELSE '增值税发票' End
  1312. FROM SaleInvoice
  1313. LEFT JOIN AppUser a ON SaleInvoice.ID_Creator=a.ID_User
  1314. LEFT JOIN AppUser b ON SaleInvoice.ID_Assessor=b.ID_User
  1315. LEFT JOIN AppUser c ON SaleInvoice.LastModUser_SaleInvoice=c.ID_User
  1316. Left JOIN Customer On Customer.ID_Customer=SaleInvoice.ID_Customer
  1317. WHERE ID_SaleInvoice=@ID_SaleInvoice
  1318. SELECT SaleInvoiceProduct.*
  1319. ,Product.No_Product,Product.Name_Product
  1320. ,Product.InvoiceName_Product
  1321. ,Product.Unit_Product,BillType.Name_BillType
  1322. ,A.No_Customer As No_Customer
  1323. ,A.ShortName_Customer As ShortName_Customer
  1324. FROM SaleInvoiceProduct
  1325. LEFT JOIN Product On Product.ID_Product=SaleInvoiceProduct.ID_Product
  1326. LEFT JOIN BillType On BillType.Value_BillType=SaleInvoiceProduct.Type_FromBill
  1327. Left Join (select No_SaleBill As No_Bill
  1328. ,Customer.No_Customer As No_Customer
  1329. ,Customer.ShortName_Customer As ShortName_Customer
  1330. From SaleBill
  1331. Left join Customer on Customer.ID_Customer=SaleBill.ID_Customer
  1332. Where ID_Assessor Is Not Null
  1333. Union All
  1334. select No_SaleRtnBill As No_Bill
  1335. ,Customer.No_Customer As No_Customer
  1336. ,Customer.ShortName_Customer As ShortName_Customer
  1337. From SaleRtnBill
  1338. Left join Customer on Customer.ID_Customer=SaleRtnBill.ID_Customer
  1339. Where ID_Assessor Is Not Null) A On A.No_Bill = SaleInvoiceProduct.No_FromBill
  1340. WHERE ID_SaleInvoice=@ID_SaleInvoice
  1341. ">
  1342. <Tables>
  1343. <Table name="SaleInvoice"/>
  1344. <Table name="SaleInvoiceProduct"/>
  1345. </Tables>
  1346. </SearchSaleInvoiceFirst>
  1347. <SearchSaleInvoiceLast CmdType="Text" CmdText=" DECLARE @ID_SaleInvoice UNIQUEIDENTIFIER
  1348. SELECT TOP 1 @ID_SaleInvoice=ID_SaleInvoice
  1349. FROM SaleInvoice ORDER BY No_SaleInvoice DESC
  1350. SELECT SaleInvoice.*,a.Name_User As Creator ,b.Name_User As Assessor
  1351. ,c.Name_User As LastModUser,Customer.No_Customer,Customer.ShortName_Customer
  1352. ,Customer.RevenueRegisterNo_Customer,Customer.Bank_Customer
  1353. ,Customer.Account_Customer,Customer.GetMethod_Customer
  1354. ,Customer.Company_Customer
  1355. ,TypeName=CASE Type_SaleInvoice When 0 Then '普通发票' ELSE '增值税发票' End
  1356. FROM SaleInvoice
  1357. LEFT JOIN AppUser a ON SaleInvoice.ID_Creator=a.ID_User
  1358. LEFT JOIN AppUser b ON SaleInvoice.ID_Assessor=b.ID_User
  1359. LEFT JOIN AppUser c ON SaleInvoice.LastModUser_SaleInvoice=c.ID_User
  1360. Left JOIN Customer On Customer.ID_Customer=SaleInvoice.ID_Customer
  1361. WHERE ID_SaleInvoice=@ID_SaleInvoice
  1362. SELECT SaleInvoiceProduct.*
  1363. ,Product.No_Product,Product.Name_Product
  1364. ,Product.InvoiceName_Product
  1365. ,Product.Unit_Product,BillType.Name_BillType
  1366. ,A.No_Customer As No_Customer
  1367. ,A.ShortName_Customer As ShortName_Customer
  1368. FROM SaleInvoiceProduct
  1369. LEFT JOIN Product On Product.ID_Product=SaleInvoiceProduct.ID_Product
  1370. LEFT JOIN BillType On BillType.Value_BillType=SaleInvoiceProduct.Type_FromBill
  1371. Left Join (select No_SaleBill As No_Bill
  1372. ,Customer.No_Customer As No_Customer
  1373. ,Customer.ShortName_Customer As ShortName_Customer
  1374. From SaleBill
  1375. Left join Customer on Customer.ID_Customer=SaleBill.ID_Customer
  1376. Where ID_Assessor Is Not Null
  1377. Union All
  1378. select No_SaleRtnBill As No_Bill
  1379. ,Customer.No_Customer As No_Customer
  1380. ,Customer.ShortName_Customer As ShortName_Customer
  1381. From SaleRtnBill
  1382. Left join Customer on Customer.ID_Customer=SaleRtnBill.ID_Customer
  1383. Where ID_Assessor Is Not Null) A On A.No_Bill = SaleInvoiceProduct.No_FromBill
  1384. WHERE ID_SaleInvoice=@ID_SaleInvoice
  1385. ">
  1386. <Tables>
  1387. <Table name="SaleInvoice"/>
  1388. <Table name="SaleInvoiceProduct"/>
  1389. </Tables>
  1390. </SearchSaleInvoiceLast>
  1391. <SearchSaleInvoicePrevious CmdType="Text" CmdText=" DECLARE @ID_SaleInvoice UNIQUEIDENTIFIER
  1392. SELECT TOP 1 @ID_SaleInvoice=ID_SaleInvoice FROM SaleInvoice
  1393. WHERE No_SaleInvoice &lt; @No_SaleInvoice
  1394. ORDER BY No_SaleInvoice DESC
  1395. SELECT SaleInvoice.*,a.Name_User As Creator ,b.Name_User As Assessor
  1396. ,c.Name_User As LastModUser,Customer.No_Customer,Customer.ShortName_Customer
  1397. ,Customer.RevenueRegisterNo_Customer,Customer.Bank_Customer
  1398. ,Customer.Account_Customer,Customer.GetMethod_Customer
  1399. ,Customer.Company_Customer
  1400. ,TypeName=CASE Type_SaleInvoice When 0 Then '普通发票' ELSE '增值税发票' End
  1401. FROM SaleInvoice
  1402. LEFT JOIN AppUser a ON SaleInvoice.ID_Creator=a.ID_User
  1403. LEFT JOIN AppUser b ON SaleInvoice.ID_Assessor=b.ID_User
  1404. LEFT JOIN AppUser c ON SaleInvoice.LastModUser_SaleInvoice=c.ID_User
  1405. Left JOIN Customer On Customer.ID_Customer=SaleInvoice.ID_Customer
  1406. WHERE ID_SaleInvoice=@ID_SaleInvoice
  1407. SELECT SaleInvoiceProduct.*
  1408. ,Product.No_Product,Product.Name_Product
  1409. ,Product.InvoiceName_Product
  1410. ,Product.Unit_Product,BillType.Name_BillType
  1411. ,A.No_Customer As No_Customer
  1412. ,A.ShortName_Customer As ShortName_Customer
  1413. FROM SaleInvoiceProduct
  1414. LEFT JOIN Product On Product.ID_Product=SaleInvoiceProduct.ID_Product
  1415. LEFT JOIN BillType On BillType.Value_BillType=SaleInvoiceProduct.Type_FromBill
  1416. Left Join (select No_SaleBill As No_Bill
  1417. ,Customer.No_Customer As No_Customer
  1418. ,Customer.ShortName_Customer As ShortName_Customer
  1419. From SaleBill
  1420. Left join Customer on Customer.ID_Customer=SaleBill.ID_Customer
  1421. Where ID_Assessor Is Not Null
  1422. Union All
  1423. select No_SaleRtnBill As No_Bill
  1424. ,Customer.No_Customer As No_Customer
  1425. ,Customer.ShortName_Customer As ShortName_Customer
  1426. From SaleRtnBill
  1427. Left join Customer on Customer.ID_Customer=SaleRtnBill.ID_Customer
  1428. Where ID_Assessor Is Not Null) A On A.No_Bill = SaleInvoiceProduct.No_FromBill
  1429. WHERE ID_SaleInvoice=@ID_SaleInvoice
  1430. ">
  1431. <Params>
  1432. <Param name="@No_SaleInvoice" type="SaleInvoice.No_SaleInvoice" Index="0" />
  1433. </Params>
  1434. <Tables>
  1435. <Table name="SaleInvoice"/>
  1436. <Table name="SaleInvoiceProduct"/>
  1437. </Tables>
  1438. </SearchSaleInvoicePrevious>
  1439. <SearchSaleInvoiceNext CmdType="Text" CmdText=" DECLARE @ID_SaleInvoice UNIQUEIDENTIFIER
  1440. SELECT TOP 1 @ID_SaleInvoice=ID_SaleInvoice FROM SaleInvoice
  1441. WHERE No_SaleInvoice &gt; @No_SaleInvoice
  1442. ORDER BY No_SaleInvoice
  1443. SELECT SaleInvoice.*,a.Name_User As Creator ,b.Name_User As Assessor
  1444. ,c.Name_User As LastModUser,Customer.No_Customer,Customer.ShortName_Customer
  1445. ,Customer.RevenueRegisterNo_Customer,Customer.Bank_Customer
  1446. ,Customer.Account_Customer,Customer.GetMethod_Customer
  1447. ,Customer.Company_Customer
  1448. ,TypeName=CASE Type_SaleInvoice When 0 Then '普通发票' ELSE '增值税发票' End
  1449. FROM SaleInvoice
  1450. LEFT JOIN AppUser a ON SaleInvoice.ID_Creator=a.ID_User
  1451. LEFT JOIN AppUser b ON SaleInvoice.ID_Assessor=b.ID_User
  1452. LEFT JOIN AppUser c ON SaleInvoice.LastModUser_SaleInvoice=c.ID_User
  1453. Left JOIN Customer On Customer.ID_Customer=SaleInvoice.ID_Customer
  1454. WHERE ID_SaleInvoice=@ID_SaleInvoice
  1455. SELECT SaleInvoiceProduct.*
  1456. ,Product.No_Product,Product.Name_Product
  1457. ,Product.InvoiceName_Product
  1458. ,Product.Unit_Product,BillType.Name_BillType
  1459. ,A.No_Customer As No_Customer
  1460. ,A.ShortName_Customer As ShortName_Customer
  1461. FROM SaleInvoiceProduct
  1462. LEFT JOIN Product On Product.ID_Product=SaleInvoiceProduct.ID_Product
  1463. LEFT JOIN BillType On BillType.Value_BillType=SaleInvoiceProduct.Type_FromBill
  1464. Left Join (select No_SaleBill As No_Bill
  1465. ,Customer.No_Customer As No_Customer
  1466. ,Customer.ShortName_Customer As ShortName_Customer
  1467. From SaleBill
  1468. Left join Customer on Customer.ID_Customer=SaleBill.ID_Customer
  1469. Where ID_Assessor Is Not Null
  1470. Union All
  1471. select No_SaleRtnBill As No_Bill
  1472. ,Customer.No_Customer As No_Customer
  1473. ,Customer.ShortName_Customer As ShortName_Customer
  1474. From SaleRtnBill
  1475. Left join Customer on Customer.ID_Customer=SaleRtnBill.ID_Customer
  1476. Where ID_Assessor Is Not Null) A On A.No_Bill = SaleInvoiceProduct.No_FromBill
  1477. WHERE ID_SaleInvoice=@ID_SaleInvoice
  1478. ">
  1479. <Params>
  1480. <Param name="@No_SaleInvoice" type="SaleInvoice.No_SaleInvoice" Index="0" />
  1481. </Params>
  1482. <Tables>
  1483. <Table name="SaleInvoice"/>
  1484. <Table name="SaleInvoiceProduct"/>
  1485. </Tables>
  1486. </SearchSaleInvoiceNext>
  1487. <SearchContrSOB CmdType="Text" CmdText=" SELECT SystemSetting.SaleAndOutDepot_SystemSetting,SystemSetting.OutDepotAndSaleBack_SystemSetting
  1488. FROM SystemSetting
  1489. WHERE SystemSetting.OutDepotAndSaleBack_SystemSetting = 1
  1490. And SystemSetting.SaleAndOutDepot_SystemSetting=1">
  1491. <Tables>
  1492. <Table name="SystemOutIn" />
  1493. </Tables>
  1494. </SearchContrSOB>
  1495. <SearchContr CmdType="Text" CmdText=" SELECT SystemSetting.SaleBackAndInDepot_SystemSetting
  1496. FROM SystemSetting
  1497. WHERE SystemSetting.SaleBackAndInDepot_SystemSetting = 1">
  1498. <Tables>
  1499. <Table name="SystemSaleAndOutDepot" />
  1500. </Tables>
  1501. </SearchContr>
  1502. <SearchAllSaleBill CmdType="Text" CmdText="Select SaleBill.Currency_SaleBill ,SaleBill.TaxCurrency_SaleBill
  1503. ,SaleBill.ID_SaleBill,SaleBill.No_SaleBill,SaleBill.Date_SaleBill
  1504. ,Customer.No_Customer,Customer.ShortName_Customer
  1505. ,Case When SaleBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_SaleBill
  1506. ,Location.Name_Location,SaleBill.InvoiceAddress_Company,SaleBill.InvoiceTitle_Company
  1507. From SaleBill
  1508. Inner Join Customer On SaleBill.ID_Customer = Customer.ID_Customer
  1509. Inner Join Location On Location.ID_Location = SaleBill.ID_Location" >
  1510. <Tables>
  1511. <Table name="AllSaleBill" />
  1512. </Tables>
  1513. </SearchAllSaleBill>
  1514. <SearchAllSaleBillProduct CmdType="Text" CmdText="Select SaleBill.No_SaleBill,Product.No_Product,SaleBillProduct.No_SaleBillProduct
  1515. ,Product.Name_Product,SaleBillProduct.Quantity_SaleBillProduct
  1516. ,SaleBillProduct.UnitPrice_SaleBillProduct,SaleBill.TaxCurrency_SaleBill
  1517. From SaleBillProduct
  1518. Inner Join Product On Product.ID_Product = SaleBillProduct.ID_Product
  1519. Inner Join SaleBill On SaleBill.ID_SaleBill =SaleBillProduct.ID_SaleBill" >
  1520. <Tables>
  1521. <Table name="AllSaleBillProduct" />
  1522. </Tables>
  1523. </SearchAllSaleBillProduct>
  1524. <SearchAllSaleRtnBill CmdType="Text" CmdText="Select SaleRtnBill.ID_SaleRtnBill,SaleRtnBill.No_SaleRtnBill
  1525. ,SaleRtnBill.Date_SaleRtnBill,Customer.No_Customer,Customer.ShortName_Customer
  1526. ,Case When SaleRtnBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_SaleRtnBill
  1527. ,Location.Name_Location
  1528. From SaleRtnBill
  1529. Inner Join Customer On SaleRtnBill.ID_Customer = Customer.ID_Customer
  1530. Inner Join Location On Location.ID_Location = SaleRtnBill.ID_Location">
  1531. <Tables>
  1532. <Table name="AllSaleRtnBill" />
  1533. </Tables>
  1534. </SearchAllSaleRtnBill>
  1535. <SearchAllSaleRtnBillProduct CmdType="Text" CmdText="Select SaleRtnBill.No_SaleRtnBill,Product.No_Product
  1536. ,SaleRtnBillProduct.No_SaleRtnBillProduct,Product.Name_Product
  1537. ,SaleRtnBillProduct.Quantity_SaleRtnBillProduct
  1538. ,SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct
  1539. ,SaleRtnBill.TaxCurrency_SaleRtnBill
  1540. From SaleRtnBillProduct
  1541. Inner Join Product On Product.ID_Product = SaleRtnBillProduct.ID_Product
  1542. Inner Join SaleRtnBill On SaleRtnBill.ID_SaleRtnBill = SaleRtnBillProduct.ID_SaleRtnBill">
  1543. <Tables>
  1544. <Table name="AllSaleRtnBillProduct" />
  1545. </Tables>
  1546. </SearchAllSaleRtnBillProduct>
  1547. <SearchAllSaleAndRtnBill CmdType="Text" CmdText=" Declare @ID_Customer Uniqueidentifier
  1548. Declare @CessOut decimal(5,2)
  1549. Select @ID_Customer = ID_Customer
  1550. From Customer
  1551. Where No_Customer = @No_Customer
  1552. select @CessOut = CessOut_SystemSetting/100
  1553. from SystemSetting
  1554. Declare @Customer Table(ID_Customer Uniqueidentifier)
  1555. Insert Into @Customer Values(@ID_Customer)
  1556. Insert Into @Customer
  1557. Select ID_Customer
  1558. From Customer
  1559. Where CustomerID_Customer = @ID_Customer
  1560. SELECT '销货单' as Name_BillType
  1561. ,No_SaleBill As No_FromBill
  1562. ,No_SaleBillProduct As No_FromBillProduct
  1563. ,Customer.No_Customer as No_Customer
  1564. ,Customer.ShortName_customer as ShortName_customer
  1565. ,SaleBillProduct.ID_Product
  1566. ,isnull(SaleBillProduct.Quantity_SaleBillProduct,0) As Quantity_SaleInvoiceProduct
  1567. ,isnull(SaleBillProduct.UnitPrice_SaleBillProduct,0) As UnitPrice_SaleInvoiceProduct
  1568. ,Product.No_Product
  1569. ,Product.Name_Product
  1570. ,Product.InvoiceName_Product
  1571. ,Product.Unit_Product
  1572. ,Amount_SaleInvoiceProduct = isnull(SaleBillProduct.Quantity_SaleBillProduct,0)*isnull(SaleBillProduct.UnitPrice_SaleBillProduct,0)
  1573. ,TaxAmount_SaleInvoiceProduct=case SaleBill.TaxCurrency_SaleBill when '外加'
  1574. then Convert(decimal(18,2),Convert(decimal(18,2),isnull(SaleBillProduct.UnitPrice_SaleBillProduct,0)*isnull(SaleBillProduct.Quantity_SaleBillProduct,0))*@CessOut)
  1575. when '内含'
  1576. then Convert(decimal(18,2),(Convert(decimal(18,2),isnull(SaleBillProduct.UnitPrice_SaleBillProduct,0)*isnull(SaleBillProduct.Quantity_SaleBillProduct,0))*@CessOut)/(1+@CessOut))
  1577. else 0 end
  1578. ,Type_FromBill = 21
  1579. ,SaleBill.TaxCurrency_SaleBill As TaxCurrency_SaleInvoiceProduct
  1580. ,GoodsAmount_SaleInvoiceProduct=case SaleBill.TaxCurrency_SaleBill When '内含'
  1581. Then (isnull(Quantity_SaleBillProduct,0)*isnull(UnitPrice_SaleBillProduct,0))/(1+@CessOut)
  1582. else (isnull(Quantity_SaleBillProduct,0)*isnull(UnitPrice_SaleBillProduct,0)) end
  1583. FROM SaleBillProduct
  1584. LEFT JOIN SaleBill On SaleBill.ID_SaleBill=SaleBillProduct.ID_SaleBill
  1585. LEFT JOIN Product On Product.ID_Product=SaleBillProduct.ID_Product
  1586. LEFT JOIN Customer on Customer.ID_Customer=SaleBill.ID_Customer
  1587. WHERE SaleBillProduct.Quantity_SaleBillProduct > 0
  1588. AND SaleBillProduct.ID_SaleBill in (Select ID_SaleBill From SaleBill)
  1589. And SaleBill.ID_Customer in (Select ID_Customer From @Customer)
  1590. And Date_SaleBill Between isnull(DateAdd(day,DateDiff(day,0,@StartDate),0),Date_SaleBill) AND Isnull(DateAdd(day,DateDiff(day,0,@EndDate),1),Date_SaleBill)
  1591. And SaleBill.ID_Assessor is not null
  1592. And Assess_SaleBill = 0
  1593. And SaleBill.Disable_SaleBill = 0
  1594. And @ckRtn =1
  1595. Union All
  1596. SELECT '销售退货单' as Name_BillType
  1597. ,No_SaleRtnBill As No_FromBill
  1598. ,No_SaleRtnBillProduct As No_FromBillProduct
  1599. ,Customer.No_Customer as No_Customer
  1600. ,Customer.ShortName_customer as ShortName_customer
  1601. ,SaleRtnBillProduct.ID_Product
  1602. ,isnull(SaleRtnBillProduct.Quantity_SaleRtnBillProduct,0) As Quantity_SaleInvoiceProduct
  1603. ,isnull(SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct,0) As UnitPrice_SaleInvoiceProduct
  1604. ,Product.No_Product,Product.Name_Product
  1605. ,Product.InvoiceName_Product
  1606. ,Product.Unit_Product
  1607. ,Amount_SaleInvoiceProduct=isnull(SaleRtnBillProduct.Quantity_SaleRtnBillProduct,0)*isnull(SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct,0)
  1608. ,TaxAmount_SaleInvoiceProduct=case SaleRtnBill.TaxCurrency_SaleRtnBill
  1609. when '外加'
  1610. then Convert(decimal(18,2)
  1611. ,Convert(decimal(18,2)
  1612. ,isnull(SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct,0)*isnull(SaleRtnBillProduct.Quantity_SaleRtnBillProduct,0)
  1613. )*@CessOut
  1614. )
  1615. when '内含'
  1616. then Convert(decimal(18,2)
  1617. ,(Convert(decimal(18,2)
  1618. ,isnull(SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct,0)*isnull(SaleRtnBillProduct.Quantity_SaleRtnBillProduct,0) )*@CessOut
  1619. )/(1+@CessOut)
  1620. ) else 0 end
  1621. ,Type_FromBill = 22
  1622. ,SaleRtnBill.TaxCurrency_SaleRtnBill As TaxCurrency_SaleInvoiceProduct
  1623. ,GoodsAmount_SaleInvoiceProduct=case SaleRtnBill.TaxCurrency_SaleRtnBill
  1624. When '内含'
  1625. Then (isnull(Quantity_SaleRtnBillProduct,0)*isnull(UnitPrice_SaleRtnBillProduct,0))/(1+@CessOut)
  1626. else (isnull(Quantity_SaleRtnBillProduct,0)*isnull(UnitPrice_SaleRtnBillProduct,0)) end
  1627. FROM SaleRtnBillProduct
  1628. LEFT JOIN SaleRtnBill On SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
  1629. LEFT JOIN Product On Product.ID_Product=SaleRtnBillProduct.ID_Product
  1630. LEFT JOIN Customer on Customer.ID_Customer=SaleRtnBill.ID_Customer
  1631. Where SaleRtnBill.ID_Assessor Is Not Null
  1632. And SaleRtnBill.ID_Customer in (Select ID_Customer From @Customer)
  1633. And @ckRtn =1
  1634. And No_FromBill in (Select No_SaleBill From SaleBill
  1635. Where Date_SaleBill Between isnull(DateAdd(day,DateDiff(day,0,@StartDate),0),Date_SaleBill)
  1636. AND Isnull(DateAdd(day,DateDiff(day,0,@EndDate),1),Date_SaleBill)
  1637. And SaleBill.ID_Assessor is not null
  1638. And SaleBill.Assess_SaleBill = 0
  1639. And SaleBill.Disable_SaleBill = 0
  1640. )
  1641. And Assess_SaleRtnBill = 0
  1642. And Disable_SaleRtnBill = 0
  1643. ">
  1644. <Params>
  1645. <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
  1646. <Param name="@StartDate" type="Customer.BeginDate_Customer" Index="1" />
  1647. <Param name="@EndDate" type="Customer.BeginDate_Customer" Index="2" />
  1648. <Param name="@ckRtn" type="Customer.IsCustomersCustomer_Customer" Index="3" />
  1649. </Params>
  1650. <Tables>
  1651. <Table name="SaleInvoiceProduct1"/>
  1652. </Tables>
  1653. </SearchAllSaleAndRtnBill>
  1654. <SearchAllSale CmdType="Text" CmdText=" Declare @ID_Customer Uniqueidentifier
  1655. Declare @CessOut decimal(5,2)
  1656. Select @ID_Customer = ID_Customer
  1657. From Customer
  1658. Where No_Customer = @No_Customer
  1659. select @CessOut = CessOut_SystemSetting/100 from SystemSetting
  1660. Declare @Customer Table(ID_Customer Uniqueidentifier)
  1661. Insert Into @Customer Values(@ID_Customer)
  1662. Insert Into @Customer
  1663. Select ID_Customer
  1664. From Customer
  1665. Where CustomerID_Customer = @ID_Customer
  1666. SELECT '销货单' as Name_BillType
  1667. ,No_SaleBill As No_FromBill
  1668. ,No_SaleBillProduct As No_FromBillProduct
  1669. ,Customer.No_Customer as No_Customer
  1670. ,Customer.ShortName_customer as ShortName_customer
  1671. ,SaleBillProduct.ID_Product
  1672. ,isnull(SaleBillProduct.Quantity_SaleBillProduct,0) As Quantity_SaleInvoiceProduct
  1673. ,isnull(SaleBillProduct.UnitPrice_SaleBillProduct,0) As UnitPrice_SaleInvoiceProduct
  1674. ,Product.No_Product
  1675. ,Product.Name_Product
  1676. ,Product.InvoiceName_Product
  1677. ,Product.Unit_Product
  1678. ,Amount_SaleInvoiceProduct = isnull(SaleBillProduct.Quantity_SaleBillProduct,0)*isnull(SaleBillProduct.UnitPrice_SaleBillProduct,0)
  1679. ,case SaleBill.TaxCurrency_SaleBill when '外加'
  1680. then Convert(decimal(18,2),Convert(decimal(18,2),isnull(SaleBillProduct.UnitPrice_SaleBillProduct,0)*isnull(SaleBillProduct.Quantity_SaleBillProduct,0))*@CessOut)
  1681. when '内含'
  1682. then Convert(decimal(18,2),(Convert(decimal(18,2),isnull(SaleBillProduct.UnitPrice_SaleBillProduct,0)*isnull(SaleBillProduct.Quantity_SaleBillProduct,0))*@CessOut)/(1+@CessOut))
  1683. else 0 end as TaxAmount_SaleInvoiceProduct
  1684. ,Type_FromBill = 21
  1685. ,SaleBill.TaxCurrency_SaleBill As TaxCurrency_SaleInvoiceProduct
  1686. ,GoodsAmount_SaleInvoiceProduct=case SaleBill.TaxCurrency_SaleBill When '内含'
  1687. Then (isnull(Quantity_SaleBillProduct,0)*isnull(UnitPrice_SaleBillProduct,0))/(1+@CessOut)
  1688. else (isnull(Quantity_SaleBillProduct,0)*isnull(UnitPrice_SaleBillProduct,0)) end
  1689. FROM SaleBillProduct
  1690. LEFT JOIN SaleBill On SaleBill.ID_SaleBill=SaleBillProduct.ID_SaleBill
  1691. LEFT JOIN Product On Product.ID_Product=SaleBillProduct.ID_Product
  1692. LEFT JOIN Customer on Customer.ID_Customer=SaleBill.ID_Customer
  1693. WHERE SaleBillProduct.Quantity_SaleBillProduct > 0
  1694. AND SaleBillProduct.ID_SaleBill in (Select ID_SaleBill From SaleBill)
  1695. And SaleBill.ID_Customer in (Select ID_Customer From @Customer)
  1696. And Date_SaleBill Between isnull(DateAdd(day,DateDiff(day,0,@StartDate),0),Date_SaleBill) AND Isnull(DateAdd(day,DateDiff(day,0,@EndDate),1),Date_SaleBill)
  1697. And SaleBill.ID_Assessor is not null
  1698. And Assess_SaleBill = 0
  1699. And SaleBill.Disable_SaleBill = 0
  1700. And @ckRtn =0
  1701. ">
  1702. <Params>
  1703. <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
  1704. <Param name="@StartDate" type="Customer.BeginDate_Customer" Index="1" />
  1705. <Param name="@EndDate" type="Customer.BeginDate_Customer" Index="2" />
  1706. <Param name="@ckRtn" type="Customer.IsCustomersCustomer_Customer" Index="3" />
  1707. </Params>
  1708. <Tables>
  1709. <Table name="SaleInvoiceProduct2"/>
  1710. </Tables>
  1711. </SearchAllSale>
  1712. <SearchCustomerRelation CmdType="Text" CmdText ="if (@CustomerIDSaleInvoice = @CustomerIDBill)
  1713. Begin
  1714. select *
  1715. from Customer
  1716. where id_customer = @CustomerIDSaleInvoice
  1717. End
  1718. else
  1719. Begin
  1720. select *
  1721. from Customer
  1722. where id_customer =@CustomerIDBill
  1723. and CustomerID_Customer = @CustomerIDSaleInvoice
  1724. End">
  1725. <Params>
  1726. <Param name="@CustomerIDSaleInvoice" type="Customer.ID_Customer" Index="0" />
  1727. <Param name="@CustomerIDBill" type="Customer.ID_Customer" Index="1" />
  1728. </Params>
  1729. <Tables>
  1730. <Table name="CustomerRelation"/>
  1731. </Tables>
  1732. </SearchCustomerRelation>
  1733. <SearchTemp CmdType="Text" CmdText="SELECT TOP 0 SaleInvoiceProduct.*,
  1734. convert(nvarchar(64),'') As Name_BillType
  1735. ,Product.No_Product
  1736. ,Product.Name_Product
  1737. ,Product.InvoiceName_Product
  1738. ,Product.Unit_Product
  1739. ,convert(bit,0) AS Negative
  1740. ,Convert(nvarchar(64),'') As No_Customer
  1741. ,Convert(nvarchar(64),'') As ShortName_Customer
  1742. FROM SaleInvoiceProduct
  1743. LEFT JOIN Product On Product.ID_Product=SaleInvoiceProduct.ID_Product">
  1744. <Tables>
  1745. <Table name="Temp"/>
  1746. </Tables>
  1747. </SearchTemp>
  1748. <DeleteRow CmdType="Text" CmdText=" Delete SaleInvoiceProduct Where ID_SaleInvoiceProduct = @ID_SaleInvoiceProduct
  1749. Select 1
  1750. ">
  1751. <Params>
  1752. <Param name="@ID_SaleInvoiceProduct" type="SaleInvoiceProduct.ID_SaleInvoiceProduct" Index="0" />
  1753. </Params>
  1754. <Tables>
  1755. <Table name="delete"/>
  1756. </Tables>
  1757. </DeleteRow>
  1758. <SearchPayDate CmdType="Text" CmdText=" select dateadd(month,datediff(month,0,@date)+2,0)-1+ @DunDate as NextEndDate
  1759. ">
  1760. <Params>
  1761. <Param name="@date" type="SaleInvoice.PayDate_SaleInvoice" Index="0" />
  1762. <Param name="@DunDate" type="Customer.DunDate_Customer" Index="1" />
  1763. </Params>
  1764. <Tables>
  1765. <Table name="PayDate"/>
  1766. </Tables>
  1767. </SearchPayDate>
  1768. <SearchPayDate2 CmdType="Text" CmdText=" select dateadd(month,datediff(month,0,@date)+3,0)-1+ @DunDate as NextEndDate
  1769. ">
  1770. <Params>
  1771. <Param name="@date" type="SaleInvoice.PayDate_SaleInvoice" Index="0" />
  1772. <Param name="@DunDate" type="Customer.DunDate_Customer" Index="1" />
  1773. </Params>
  1774. <Tables>
  1775. <Table name="PayDate2"/>
  1776. </Tables>
  1777. </SearchPayDate2>
  1778. <SearchPayDate3 CmdType="Text" CmdText=" select dateadd(month,datediff(month,0,@date)+4,0)-1+ @DunDate as NextEndDate
  1779. ">
  1780. <Params>
  1781. <Param name="@date" type="SaleInvoice.PayDate_SaleInvoice" Index="0" />
  1782. <Param name="@DunDate" type="Customer.DunDate_Customer" Index="1" />
  1783. </Params>
  1784. <Tables>
  1785. <Table name="PayDate3"/>
  1786. </Tables>
  1787. </SearchPayDate3>
  1788. <SearchPayDate4 CmdType="Text" CmdText=" select dateadd(month,datediff(month,0,@date)+5,0)-1+ @DunDate as NextEndDate
  1789. ">
  1790. <Params>
  1791. <Param name="@date" type="SaleInvoice.PayDate_SaleInvoice" Index="0" />
  1792. <Param name="@DunDate" type="Customer.DunDate_Customer" Index="1" />
  1793. </Params>
  1794. <Tables>
  1795. <Table name="PayDate4"/>
  1796. </Tables>
  1797. </SearchPayDate4>
  1798. <SearchPayDate5 CmdType="Text" CmdText=" select dateadd(month,datediff(month,0,@date)+1,10)-1+ @DunDate as NextEndDate
  1799. ">
  1800. <Params>
  1801. <Param name="@date" type="SaleInvoice.PayDate_SaleInvoice" Index="0" />
  1802. <Param name="@DunDate" type="Customer.DunDate_Customer" Index="1" />
  1803. </Params>
  1804. <Tables>
  1805. <Table name="PayDate5"/>
  1806. </Tables>
  1807. </SearchPayDate5>
  1808. </Search>
  1809. </Server>
  1810. <Lables>
  1811. <Search>
  1812. Empty();
  1813. NewInstance();
  1814. tbNo.ReadOnly=false;
  1815. dtDate.Enabled=false;
  1816. cbType.Enabled=false;
  1817. dtInvoiceDate.Enabled=false;
  1818. txtInvoiceNo.ReadOnly=true;
  1819. btnModify.Enabled=false;
  1820. tbCustomerNo.ReadOnly=true;
  1821. cbInvoiceTitle.Enabled=false;
  1822. cbInvoiceAddress.Enabled=false;
  1823. cbBank.Enabled=false;
  1824. txtAccount.ReadOnly=true;
  1825. dtPayDate.Enabled=false;
  1826. dgProduct.ReadOnly=true;
  1827. txtMoneySum.CValue=0.00;
  1828. txtTaxSum.CValue=0.00;
  1829. txtSum.CValue=0.00;
  1830. dtStart.Enabled = false;
  1831. dtEnd.Enabled = false;
  1832. ckRtn.Enabled = false;
  1833. btnSearch.Enabled=false;
  1834. #SaleInvoice.Creator=DBNull();
  1835. #SaleInvoice.ID_Creator=DBNull();
  1836. #SaleInvoice.Assessor=DBNull();
  1837. #SaleInvoice.ID_Assessor=DBNull();
  1838. #SaleInvoice.AssessDate_SaleInvoice=DBNull();
  1839. #SaleInvoice.LastModUser_SaleInvoice=DBNull();
  1840. #SaleInvoice.LastModUser=DBNull();
  1841. #SaleInvoice.LastModDate_SaleInvoice=DBNull();
  1842. toolBar.EnableSubmit=false;
  1843. toolBar.EnableModify=false;
  1844. toolBar.EnableDelete=false;
  1845. toolBar.EnableAudit=false;
  1846. toolBar.EnableNew=GetRight(@Title,"新增");
  1847. toolBar.EnablePrint=false;
  1848. toolBar.EnableBlank=false;
  1849. toolBar.EnableImport = false;
  1850. OperateControlEvent("dtInvoiceDate","ValueChanged",false);
  1851. UpdateForm(true,"");
  1852. OperateControlEvent("dtInvoiceDate","ValueChanged",true);
  1853. tbNo.Focus();
  1854. cbType.Text="";
  1855. @Status=0;
  1856. </Search>
  1857. <New>
  1858. Empty();
  1859. NewInstance();
  1860. tbNo.ReadOnly=true;
  1861. dtDate.Enabled=true;
  1862. cbType.Enabled=true;
  1863. dtInvoiceDate.Enabled=true;
  1864. txtInvoiceNo.ReadOnly=false;
  1865. btnModify.Enabled=false;
  1866. tbCustomerNo.ReadOnly=false;
  1867. cbInvoiceTitle.Enabled=true;
  1868. cbInvoiceAddress.Enabled=true;
  1869. cbBank.Enabled=true;
  1870. txtAccount.ReadOnly=false;
  1871. dtPayDate.Enabled=false;
  1872. dgProduct.ReadOnly=false;
  1873. txtMoneySum.CValue=0.00;
  1874. txtTaxSum.CValue=0.00;
  1875. txtSum.CValue=0.00;
  1876. dtStart.Enabled = true;
  1877. dtEnd.Enabled = true;
  1878. ckRtn.Enabled = true;
  1879. btnSearch.Enabled=true;
  1880. dtDate.Focus();
  1881. #SaleInvoice.TypeName="增值税发票";
  1882. #SaleInvoice.Currency_SaleInvoice= @SysCurrency;
  1883. #SaleInvoice.ID_SaleInvoice=NewGuid();
  1884. #SaleInvoice.Creator=GetCurrentUser();
  1885. #SaleInvoice.ID_Creator=GetLoginUserID();
  1886. #SaleInvoice.Assessor=DBNull();
  1887. #SaleInvoice.ID_Assessor=DBNull();
  1888. #SaleInvoice.AssessDate_SaleInvoice=DBNull();
  1889. #SaleInvoice.LastModUser_SaleInvoice=DBNull();
  1890. #SaleInvoice.LastModUser=DBNull();
  1891. #SaleInvoice.LastModDate_SaleInvoice=DBNull();
  1892. toolBar.EnableSubmit=GetRight(@Title,"新增");
  1893. toolBar.EnableModify=false;
  1894. toolBar.EnableDelete=false;
  1895. toolBar.EnableAudit=false;
  1896. toolBar.EnableNew=false;
  1897. toolBar.EnablePrint=false;
  1898. toolBar.EnableBlank=false;
  1899. toolBar.EnableImport = true;
  1900. OperateControlEvent("dtInvoiceDate","ValueChanged",false);
  1901. UpdateForm(true,"");
  1902. OperateControlEvent("dtInvoiceDate","ValueChanged",true);
  1903. <!--cbType.SelectedIndex=1;-->
  1904. @Status=1;
  1905. </New>
  1906. <View>
  1907. tbNo.ReadOnly=true;
  1908. dtDate.Enabled=false;
  1909. cbType.Enabled=false;
  1910. dtInvoiceDate.Enabled=false;
  1911. txtInvoiceNo.ReadOnly=true;
  1912. if(!Equals(#SaleInvoice.ID_Assessor,DBNull())&amp;&amp;#SaleInvoice.Disable_SaleInvoice==false)
  1913. btnModify.Enabled=true;
  1914. else
  1915. btnModify.Enabled=false;
  1916. tbCustomerNo.ReadOnly=true;
  1917. cbInvoiceTitle.Enabled=false;
  1918. cbInvoiceAddress.Enabled=false;
  1919. cbBank.Enabled=false;
  1920. txtAccount.ReadOnly=true;
  1921. dtPayDate.Enabled=false;
  1922. dgProduct.ReadOnly=true;
  1923. dtStart.Enabled = false;
  1924. dtEnd.Enabled = false;
  1925. ckRtn.Enabled = false;
  1926. btnSearch.Enabled=false;
  1927. toolBar.EnableSubmit=false;
  1928. toolBar.EnableNew=GetRight(@Title,"新增");
  1929. if(Equals(#SaleInvoice.ID_Assessor, DBNull()))
  1930. {
  1931. toolBar.EnableAudit=GetRight(@Title,"审核");
  1932. toolBar.EnableModify=GetRight(@Title,"修改");
  1933. toolBar.EnableDelete=GetRight(@Title,"删除");
  1934. toolBar.EnableBlank=false;
  1935. }
  1936. else
  1937. {
  1938. toolBar.EnableAudit=false;
  1939. toolBar.EnableModify=false;
  1940. toolBar.EnableDelete=false;
  1941. if(#SaleInvoice.Disable_SaleInvoice==false)
  1942. toolBar.EnableBlank=GetRight(@Title,"审核");
  1943. else
  1944. toolBar.EnableBlank=false;
  1945. }
  1946. toolBar.EnablePrint=GetRight(@Title,"打印");
  1947. toolBar.EnableImport = false;
  1948. OperateControlEvent("dtInvoiceDate","ValueChanged",false);
  1949. UpdateForm(true,"");
  1950. OperateControlEvent("dtInvoiceDate","ValueChanged",true);
  1951. <!--if(#SaleInvoice.Disable_SaleInvoice==true)
  1952. ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)";-->
  1953. @Status=2;
  1954. </View>
  1955. <Modify>
  1956. tbNo.ReadOnly=true;
  1957. dtDate.Enabled=false;
  1958. cbType.Enabled=true;
  1959. dtInvoiceDate.Enabled=true;
  1960. txtInvoiceNo.ReadOnly=false;
  1961. btnModify.Enabled=false;
  1962. tbCustomerNo.ReadOnly=false;
  1963. cbInvoiceTitle.Enabled=true;
  1964. cbInvoiceAddress.Enabled=true;
  1965. cbBank.Enabled=true;
  1966. txtAccount.ReadOnly=false;
  1967. dtPayDate.Enabled=false;
  1968. dgProduct.ReadOnly=false;
  1969. dtStart.Enabled = true;
  1970. dtEnd.Enabled = true;
  1971. ckRtn.Enabled = true;
  1972. btnSearch.Enabled=true;
  1973. #SaleInvoice.LastModUser=GetCurrentUser();
  1974. #SaleInvoice.LastModUser_SaleInvoice=GetLoginUserID();
  1975. #SaleInvoice.LastModDate_SaleInvoice=GetCurrentTime();
  1976. toolBar.EnableSubmit=GetRight(@Title,"修改");
  1977. toolBar.EnableModify=false;
  1978. toolBar.EnableDelete=false;
  1979. toolBar.EnableAudit=false;
  1980. toolBar.EnableNew=false;
  1981. toolBar.EnablePrint=false;
  1982. toolBar.EnableImport = true;
  1983. OperateControlEvent("dtInvoiceDate","ValueChanged",false);
  1984. UpdateForm(true,"");
  1985. OperateControlEvent("dtInvoiceDate","ValueChanged",true);
  1986. @Status=3;
  1987. </Modify>
  1988. <SubmitButtonClick>
  1989. <![CDATA[
  1990. if(cbType.Text==StringEmpty())
  1991. {
  1992. MessageBox("请输入有效的发票种类!",@Title);
  1993. tbDetail.SelectedIndex = 0;
  1994. cbType.Focus();
  1995. return;
  1996. }
  1997. if(!Equals(txtInvoiceNo.CValue,""))
  1998. {
  1999. if(Search("SearchInvoiceNo",txtInvoiceNo.CValue,tbNo.CValue))
  2000. {
  2001. MessageBox("该发票号码已存在!",@Title);
  2002. tbDetail.SelectedIndex = 0;
  2003. txtInvoiceNo.Focus();
  2004. return;
  2005. }
  2006. }
  2007. if(!Search("SearchCustomer",tbCustomerNo.CValue)|| !Equals(#SaleInvoice.ID_Customer,#Customer.ID_Customer))
  2008. {
  2009. MessageBox("请输入有效客户,回车以示确认!",@Title);
  2010. tbDetail.SelectedIndex = 0;
  2011. tbCustomerNo.Focus();
  2012. return;
  2013. }
  2014. if(!cbInvoiceTitle.CheckSelectedItem())
  2015. {
  2016. MessageBox("请输入有效的发票抬头!",@Title);
  2017. tbDetail.SelectedIndex = 0;
  2018. cbInvoiceTitle.Focus();
  2019. return;
  2020. }
  2021. if(!cbInvoiceAddress.CheckSelectedItem())
  2022. {
  2023. MessageBox("请输入有效的发票地址!",@Title);
  2024. tbDetail.SelectedIndex = 0;
  2025. cbInvoiceAddress.Focus();
  2026. return;
  2027. }
  2028. if(!cbBank.CheckSelectedItem())
  2029. {
  2030. MessageBox("请输入有效的开户行!",@Title);
  2031. tbDetail.SelectedIndex = 0;
  2032. cbBank.Focus();
  2033. return;
  2034. }
  2035. if(txtAccount.CValue==StringEmpty())
  2036. {
  2037. MessageBox("请输入有效的银行帐号!",@Title);
  2038. tbDetail.SelectedIndex = 0;
  2039. txtAccount.Focus();
  2040. return;
  2041. }
  2042. if(RowCount("SaleInvoiceProduct")==0)
  2043. {
  2044. MessageBox("请输入销项发票产品!",@Title);
  2045. tbDetail.SelectedIndex = 1;
  2046. dgProduct.Focus();
  2047. return;
  2048. }
  2049. UpdateForm(false, "");
  2050. SuspendLayout();
  2051. for(@index=0;@index<RowCount("#Temp");@index=@index+1)
  2052. {
  2053. SetPosition("#Temp",@index);
  2054. Search("DeleteRow",#Temp.ID_SaleInvoiceProduct);
  2055. }
  2056. for(@i=0;@i<RowCount("#SaleInvoiceProduct");@i=@i+1)
  2057. {
  2058. SetPosition("#SaleInvoiceProduct",@i);
  2059. if (Equals(#SaleInvoiceProduct.Name_BillType,"销货单"))
  2060. {
  2061. if(Search("SearchSaleBill",#SaleInvoiceProduct.No_FromBill,#SaleInvoiceProduct.No_FromBillProduct))
  2062. {
  2063. if (Equals(#SaleBill.ID_Assessor,DBNull()))
  2064. {
  2065. tbDetail.SelectedIndex = 1;
  2066. dgProduct.CurrentRowIndex = @i;
  2067. MessageBox("该来源单据未经审核,提交失败!",@Title);
  2068. dgProduct.Focus();
  2069. ResumeLayout();
  2070. return;
  2071. }
  2072. if (!Search("SearchCustomerRelation",#SaleInvoice.ID_Customer,#SaleBill.ID_Customer))
  2073. {
  2074. tbDetail.SelectedIndex = 1;
  2075. dgProduct.CurrentRowIndex = @i;
  2076. MessageBox("该来源单据的客户与本销项发票的客户或下级客户不一致,提交失败!",@Title);
  2077. dgProduct.Focus();
  2078. ResumeLayout();
  2079. return;
  2080. }
  2081. if(#SaleBill.InvoiceAddress_Company!=#SaleInvoice.InvoiceAddress_SaleInvoice||#SaleBill.InvoiceTitle_Company!=#SaleInvoice.InvoiceTitle_SaleInvoice)
  2082. {
  2083. tbDetail.SelectedIndex = 1;
  2084. dgProduct.CurrentRowIndex=@i;
  2085. @ClickResult = MessageBox("销货单中的发票抬头(发票地址)与页面不一致,是否继续?",@Title,MB_OKCANCEL);
  2086. if (@ClickResult == DialogResult("CANCEL"))
  2087. {
  2088. dgProduct.Focus();
  2089. ResumeLayout();
  2090. return;
  2091. }
  2092. }
  2093. if(!Equals(#SaleInvoiceProduct.ID_Product,#SaleBill.ID_Product))
  2094. {
  2095. tbDetail.SelectedIndex = 1;
  2096. dgProduct.CurrentRowIndex = @i;
  2097. MessageBox("该来源单据产品单中指定的产品与后改写的产品不匹配!",@Title);
  2098. dgProduct.Focus();
  2099. ResumeLayout();
  2100. return;
  2101. }
  2102. }
  2103. }
  2104. if (Equals(#SaleInvoiceProduct.Name_BillType,"销售退货单"))
  2105. {
  2106. if(Search("SearchSaleRtnBill",#SaleInvoiceProduct.No_FromBill,#SaleInvoiceProduct.No_FromBillProduct))
  2107. {
  2108. if (Equals(#SaleRtnBill.ID_Assessor,DBNull()))
  2109. {
  2110. tbDetail.SelectedIndex = 1;
  2111. dgProduct.CurrentRowIndex = @i;
  2112. MessageBox("该来源单据未经审核,提交失败!",@Title);
  2113. dgProduct.Focus();
  2114. ResumeLayout();
  2115. return;
  2116. }
  2117. if (!Search("SearchCustomerRelation",#SaleInvoice.ID_Customer,#SaleRtnBill.ID_Customer))
  2118. {
  2119. tbDetail.SelectedIndex = 1;
  2120. dgProduct.CurrentRowIndex = @i;
  2121. MessageBox("该来源单据的客户与本销项发票的客户或下级不一致,提交失败!",@Title);
  2122. dgProduct.Focus();
  2123. ResumeLayout();
  2124. return;
  2125. }
  2126. if(!Equals(#SaleInvoiceProduct.ID_Product,#SaleRtnBill.ID_Product))
  2127. {
  2128. tbDetail.SelectedIndex = 1;
  2129. dgProduct.CurrentRowIndex = @i;
  2130. MessageBox("该来源单据产品单中指定的产品与后改写的产品不匹配!",@Title);
  2131. dgProduct.Focus();
  2132. ResumeLayout();
  2133. return;
  2134. }
  2135. }
  2136. }
  2137. if(Equals(#SaleInvoiceProduct.No_Product,""))
  2138. {
  2139. tbDetail.SelectedIndex = 1;
  2140. dgProduct.CurrentRowIndex=@i;
  2141. MessageBox("请输入产品编号!",@Title);
  2142. ResumeLayout();
  2143. return;
  2144. }
  2145. if(Equals(#SaleInvoiceProduct.ID_Product,GuidEmpty()))
  2146. {
  2147. tbDetail.SelectedIndex = 1;
  2148. dgProduct.CurrentRowIndex=@i;
  2149. MessageBox("该产品不存在!",@Title);
  2150. ResumeLayout();
  2151. return;
  2152. }
  2153. if(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct<=0)
  2154. {
  2155. tbDetail.SelectedIndex = 1;
  2156. dgProduct.CurrentRowIndex=@i;
  2157. MessageBox("数量不得小于等于0!",@Title);
  2158. ResumeLayout();
  2159. return;
  2160. }
  2161. if(Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,""))
  2162. {
  2163. tbDetail.SelectedIndex = 1;
  2164. dgProduct.CurrentRowIndex=@i;
  2165. MessageBox("请输入税别!",@Title);
  2166. ResumeLayout();
  2167. return;
  2168. }
  2169. if(Equals(#SaleInvoiceProduct.ID_SaleInvoiceProduct,GuidEmpty()))
  2170. {
  2171. #SaleInvoiceProduct.ID_SaleInvoiceProduct=NewGuid();
  2172. }
  2173. #SaleInvoiceProduct.ID_SaleInvoice=#SaleInvoice.ID_SaleInvoice;
  2174. }
  2175. ResumeLayout();
  2176. if(@Status==1)
  2177. { #SaleInvoice.CreateDate_SaleInvoice=GetCurrentTime();
  2178. #SaleInvoice.No_SaleInvoice = New("#SaleInvoice.No_SaleInvoice", dtDate.CValue);
  2179. }
  2180. else if(@Status==3)
  2181. {
  2182. #SaleInvoice.LastModUser=GetCurrentUser();
  2183. #SaleInvoice.LastModUser_SaleInvoice=GetLoginUserID();
  2184. #SaleInvoice.LastModDate_SaleInvoice=GetCurrentTime();
  2185. Update();
  2186. }
  2187. ChangeMode("View",#SaleInvoice.ID_Assessor);
  2188. ]]>
  2189. </SubmitButtonClick>
  2190. <CountSum>
  2191. <![CDATA[
  2192. if (RowCount("#SaleInvoiceProduct") == 0)
  2193. {
  2194. txtMoneySum.CValue=0;
  2195. txtTaxSum.CValue=0;
  2196. txtSum.CValue=0;
  2197. }
  2198. else
  2199. {
  2200. @txtMoneySumTemp=0;
  2201. @txtTaxSumTemp=0;
  2202. SuspendLayout();
  2203. for(@i=0;@i<RowCount("#SaleInvoiceProduct");@i++)
  2204. {
  2205. SetPosition("#SaleInvoiceProduct",@i);
  2206. if(#SaleInvoiceProduct.Type_FromBill==22)
  2207. {
  2208. @txtMoneySumTemp=FormatNumber(@txtMoneySumTemp-#SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct,@PriceDecimal);
  2209. @txtTaxSumTemp=FormatNumber(@txtTaxSumTemp-#SaleInvoiceProduct.TaxAmount_SaleInvoiceProduct,@PriceDecimal);
  2210. }
  2211. else
  2212. {
  2213. @txtMoneySumTemp=FormatNumber(@txtMoneySumTemp+#SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct,@PriceDecimal);
  2214. @txtTaxSumTemp=FormatNumber(@txtTaxSumTemp+#SaleInvoiceProduct.TaxAmount_SaleInvoiceProduct,@PriceDecimal);
  2215. }
  2216. }
  2217. ResumeLayout();
  2218. txtMoneySum.CValue=@txtMoneySumTemp;
  2219. txtTaxSum.CValue=@txtTaxSumTemp;
  2220. txtSum.CValue=txtMoneySum.CValue+txtTaxSum.CValue;
  2221. }
  2222. UpdateForm(false,"txtSum");
  2223. UpdateForm(false,"txtMoneySum");
  2224. UpdateForm(false,"txtTaxSum");
  2225. ]]>
  2226. </CountSum>
  2227. <FromBillChange>
  2228. if(!Equals(#SaleInvoiceProduct.Name_BillType,"")&amp;&amp;!Equals(#SaleInvoiceProduct.No_FromBill,"")&amp;&amp; !Equals(#SaleInvoiceProduct.No_FromBillProduct,""))
  2229. {
  2230. if(Equals(#SaleInvoiceProduct.Name_BillType,"销货单")&amp;&amp;Search("SearchSaleBillProduct",#SaleInvoiceProduct.No_FromBill,#SaleInvoiceProduct.No_FromBillProduct))
  2231. {
  2232. #SaleInvoiceProduct.ID_Product=#SaleBillProduct.ID_Product;
  2233. #SaleInvoiceProduct.No_Product=#SaleBillProduct.No_Product;
  2234. #SaleInvoiceProduct.Name_Product=#SaleBillProduct.Name_Product;
  2235. #SaleInvoiceProduct.Unit_Product=#SaleBillProduct.Unit_Product;
  2236. #SaleInvoiceProduct.Quantity_SaleInvoiceProduct=#SaleBillProduct.Quantity_SaleBillProduct;
  2237. #SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct=#SaleBillProduct.UnitPrice_SaleBillProduct;
  2238. #SaleInvoiceProduct.InvoiceName_Product=#SaleBillProduct.InvoiceName_Product;
  2239. #SaleInvoiceProduct.Amount_SaleInvoiceProduct=FormatNumber(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,@PriceDecimal);
  2240. #SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct=#SaleBillProduct.TaxCurrency_SaleBill;
  2241. if(Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"内含"))
  2242. {
  2243. #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber((#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct)/(1+#SaleInvoiceProduct.TaxRate_SaleInvoiceProduct),@PriceDecimal);
  2244. }
  2245. else
  2246. {
  2247. #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,@PriceDecimal);
  2248. }
  2249. #SaleInvoiceProduct.No_Customer=#SaleBillProduct.No_Customer;
  2250. #SaleInvoiceProduct.ShortName_Customer=#SaleBillProduct.ShortName_Customer;
  2251. #SaleInvoiceProduct.TaxAmount_SaleInvoiceProduct=FormatNumber(#SaleInvoiceProduct.Amount_SaleInvoiceProduct*#SaleInvoiceProduct.TaxRate_SaleInvoiceProduct,@PriceDecimal);
  2252. }
  2253. if(Equals(#SaleInvoiceProduct.Name_BillType,"销售退货单")&amp;&amp;Search("SearchSaleRtnBillProduct",#SaleInvoiceProduct.No_FromBill,#SaleInvoiceProduct.No_FromBillProduct))
  2254. {
  2255. #SaleInvoiceProduct.ID_Product=#SaleRtnBillProduct.ID_Product;
  2256. #SaleInvoiceProduct.No_Product=#SaleRtnBillProduct.No_Product;
  2257. #SaleInvoiceProduct.Name_Product=#SaleRtnBillProduct.Name_Product;
  2258. #SaleInvoiceProduct.Unit_Product=#SaleRtnBillProduct.Unit_Product;
  2259. #SaleInvoiceProduct.Quantity_SaleInvoiceProduct=#SaleRtnBillProduct.Quantity_SaleRtnBillProduct;
  2260. #SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct=#SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct;
  2261. #SaleInvoiceProduct.InvoiceName_Product=#SaleRtnBillProduct.InvoiceName_Product;
  2262. #SaleInvoiceProduct.Amount_SaleInvoiceProduct=FormatNumber(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,@PriceDecimal);
  2263. #SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct=#SaleRtnBillProduct.TaxCurrency_SaleRtnBill;
  2264. if(Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"内含"))
  2265. {
  2266. #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber((#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct)/(1+#SaleInvoiceProduct.TaxRate_SaleInvoiceProduct),@PriceDecimal);
  2267. }
  2268. else
  2269. {
  2270. #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,@PriceDecimal);
  2271. }
  2272. #SaleInvoiceProduct.No_Customer=#SaleRtnBillProduct.No_Customer;
  2273. #SaleInvoiceProduct.ShortName_Customer=#SaleRtnBillProduct.ShortName_Customer;
  2274. #SaleInvoiceProduct.TaxAmount_SaleInvoiceProduct=FormatNumber(#SaleInvoiceProduct.Amount_SaleInvoiceProduct*#SaleInvoiceProduct.TaxRate_SaleInvoiceProduct,@PriceDecimal);
  2275. }
  2276. dgProduct.SetColumnReadOnly(14, true);
  2277. }
  2278. </FromBillChange>
  2279. <CountAmount>
  2280. if(Equals(#SaleInvoiceProduct.Name_BillType,"销货单")&amp;&amp;Search("SearchSaleBillProduct",#SaleInvoiceProduct.No_FromBill,#SaleInvoiceProduct.No_FromBillProduct))
  2281. {
  2282. dgProduct.SetColumnReadOnly(14,true);
  2283. if(Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"内含"))
  2284. {
  2285. #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber((#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct)/(1+#SaleInvoiceProduct.TaxRate_SaleInvoiceProduct),@PriceDecimal);
  2286. }
  2287. else
  2288. {
  2289. #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,@PriceDecimal);
  2290. }
  2291. }
  2292. if(Equals(#SaleInvoiceProduct.Name_BillType,"销售退货单")&amp;&amp;Search("SearchSaleRtnBillProduct",#SaleInvoiceProduct.No_FromBill,#SaleInvoiceProduct.No_FromBillProduct))
  2293. {
  2294. dgProduct.SetColumnReadOnly(14,true);
  2295. if(Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"内含"))
  2296. {
  2297. #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber((#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct)/(1+#SaleInvoiceProduct.TaxRate_SaleInvoiceProduct),@PriceDecimal);
  2298. }
  2299. else
  2300. {
  2301. #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,@PriceDecimal);
  2302. }
  2303. }
  2304. if(Equals(#SaleInvoiceProduct.Name_BillType,"")&amp;&amp;Equals(#SaleInvoiceProduct.No_FromBill,"")&amp;&amp;Equals(#SaleInvoiceProduct.No_FromBillProduct,""))
  2305. {
  2306. if(!Equals(#SaleInvoiceProduct.No_Product,"")&amp;&amp;!Equals(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct,"")&amp;&amp;!Equals(#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,""))
  2307. {
  2308. dgProduct.SetColumnReadOnly(14, false);
  2309. if(!Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,""))
  2310. {
  2311. if(Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"内含"))
  2312. {
  2313. #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct=FormatNumber((#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct)/(1+#SaleInvoiceProduct.TaxRate_SaleInvoiceProduct),@PriceDecimal);
  2314. }
  2315. else if(Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"外加"))
  2316. {
  2317. #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,@PriceDecimal);
  2318. }
  2319. else if(Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"零税"))
  2320. {
  2321. #SaleInvoiceProduct.TaxRate_SaleInvoiceProduct = 0.00;
  2322. #SaleInvoiceProduct.TaxAmount_SaleInvoiceProduct = 0.00;
  2323. #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,@PriceDecimal);
  2324. }
  2325. else if(Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"免税"))
  2326. {
  2327. #SaleInvoiceProduct.TaxRate_SaleInvoiceProduct = 0.00;
  2328. #SaleInvoiceProduct.TaxAmount_SaleInvoiceProduct = 0.00;
  2329. #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,@PriceDecimal);
  2330. }
  2331. else if(!Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"免税")||!Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"零税")||!Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"内含")||!Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"外加"))
  2332. {
  2333. MessageBox("您输入的税别不正确,请重新输入!",@Title);
  2334. return;
  2335. }
  2336. }
  2337. }
  2338. }
  2339. #SaleInvoiceProduct.Amount_SaleInvoiceProduct=FormatNumber(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,@PriceDecimal);
  2340. #SaleInvoiceProduct.TaxAmount_SaleInvoiceProduct=FormatNumber(#SaleInvoiceProduct.Amount_SaleInvoiceProduct*#SaleInvoiceProduct.TaxRate_SaleInvoiceProduct,@PriceDecimal);
  2341. </CountAmount>
  2342. </Lables>
  2343. </Form>
  2344. </Forms>