FrmIndentBill.xml 138 KB

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