FrmSaleOutDepotBill.xml 118 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <Forms>
  3. <Form Name="FrmSaleOutDepotBill">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @SetFlag=1;
  9. @SetFlag1=1;
  10. @Title="销货出库单";
  11. GetSchema();
  12. Search("SearchLocation");
  13. Search("SearchSystemSetting");
  14. Search("SearchOneLocation", DBNull());
  15. Search("SearchNo_SaleBillProduct","p","p");
  16. Search("SearchNo_Product","p");
  17. Search("SearchLocationByNo","p");
  18. if(#System.SaleAndOutDepot_SystemSetting && #System.OutDepotAndSaleBack_SystemSetting && #System.SaleRtnSourceBill_SystemSetting)
  19. toolBar.EnableExportItem(0,false);
  20. dgProduct.NoMember="No_SaleOutDepotBillProduct";
  21. @SaleAndOutDepot = #System.SaleAndOutDepot_SystemSetting;
  22. @OutDepotAndSaleBack = #System.OutDepotAndSaleBack_SystemSetting;
  23. @ImportClicked = 0;
  24. @CessOut = #System.CessOut_SystemSetting / 100;
  25. dgProduct.ColumnVisibleByColumnName("UnitPrice_SaleOutDepotBillProduct",!GetFieldRight(@Title,"成本","查看"));
  26. toolBar.VisibleCheck = GetRight(@Title,"审核");
  27. Search("SearchBillType");
  28. ]]>
  29. </Load>
  30. <EndLoad>
  31. ChangeMode("Search");
  32. </EndLoad>
  33. <Closing>
  34. ;<!--TODO-->
  35. </Closing>
  36. <Closed>
  37. ;<!--TODO-->
  38. </Closed>
  39. </Events>
  40. <Mode>
  41. <Search>
  42. <Lable name="Search" />
  43. </Search>
  44. <New>
  45. <Lable name="New" />
  46. </New>
  47. <View>
  48. <Lable name="View" />
  49. </View>
  50. <Modify>
  51. <Lable name="Modify" />
  52. </Modify>
  53. </Mode>
  54. <Controls>
  55. <IKDateTimePicker name="timeMake" DataSource="SaleOutDepotBill.Date_SaleOutDepotBill" />
  56. <IKTextButton name="tbNo" DataSource="SaleOutDepotBill.No_SaleOutDepotBill">
  57. <Events>
  58. <Enter>
  59. <![CDATA[
  60. if(tbNo.ReadOnly == false)
  61. {
  62. if(tbNo.CValue != StringEmpty())
  63. {
  64. UpdateForm(false, "");
  65. if(Search("SearchSaleOutDepotBillWithNo", tbNo.CValue))
  66. {
  67. ChangeMode("View");
  68. }
  69. else
  70. {
  71. MessageBox("该出库单不存在!",@Title);
  72. }
  73. }
  74. else
  75. {
  76. MessageBox("请输入出库单号!", @Title);
  77. }
  78. }
  79. ]]>
  80. <Lable name="CountSum" />
  81. </Enter>
  82. <Click>
  83. ShowSearchBox("BillSearch","HAVEDEPOT", "tbNo",tbNo.CValue);
  84. </Click>
  85. </Events>
  86. </IKTextButton>
  87. <IKTextButton name="tbCustomerNo" DataSource="SaleOutDepotBill.No_Customer">
  88. <Events>
  89. <Enter>
  90. <![CDATA[
  91. if (tbCustomerNo.ReadOnly == false)
  92. {
  93. UpdateForm(false, "");
  94. if (tbCustomerNo.CValue == "" || !Search("SearchCustomerWithNo", tbCustomerNo.CValue))
  95. {
  96. if (tbCustomerNo.CValue == "")
  97. {
  98. MessageBox("请输入客户编号!", @Title);
  99. }
  100. else
  101. {
  102. MessageBox("该客户不存在!",@Title);
  103. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo.CValue);
  104. if(@temp != "")
  105. {
  106. tbCustomerNo.CValue = @temp;
  107. ActiveControlEvent("tbCustomerNo", "Enter");
  108. }
  109. }
  110. }
  111. else
  112. {
  113. if (!Equals(#Customer.SuspendDate_Customer,DBNull()))
  114. {
  115. MessageBox("该客户已停用!",@Title);
  116. }
  117. #SaleOutDepotBill.ShortName_Customer = #Customer.ShortName_Customer;
  118. #SaleOutDepotBill.ID_Customer = #Customer.ID_Customer;
  119. #SaleOutDepotBill.No_Customer = #Customer.No_Customer;
  120. Empty("#ReportComment");
  121. Search("SearchTypeComment",#SaleOutDepotBill.ID_Customer);
  122. MergeTable("#TypeComment","#ReportComment");
  123. }
  124. UpdateForm(true, "");
  125. }
  126. ]]>
  127. </Enter>
  128. <Click>
  129. <![CDATA[
  130. if (tbCustomerNo.ReadOnly == false)
  131. {
  132. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo.CValue);
  133. if( @temp == "" )
  134. return;
  135. tbCustomerNo.CValue = @temp;
  136. ActiveControlEvent("tbCustomerNo", "Enter");
  137. }
  138. ]]>
  139. </Click>
  140. </Events>
  141. </IKTextButton>
  142. <IKTextBox name="txtCustomerShortName" DataSource="SaleOutDepotBill.ShortName_Customer"></IKTextBox>
  143. <IKComboBoxEx name="cbLocation" DisplaySource="SaleOutDepotBill.Name_Location" NoSource="SaleOutDepotBill.No_Location" ValueSource="SaleOutDepotBill.ID_Location" DataSource="Location" DisplayMember="Name_Location" NoMember="No_Location" ValueMember="ID_Location">
  144. <Events>
  145. <Reload>
  146. UpdateForm(false, "cbLocation");
  147. Search("SearchLocation");
  148. UpdateForm(true, "cbLocation");
  149. </Reload>
  150. </Events>
  151. </IKComboBoxEx>
  152. <IKButton name="btnDelete">
  153. <Events>
  154. <Click>
  155. if(Search("SearchSaleRtn",#SaleOutDepotBill.ID_SaleOutDepotBill))
  156. {
  157. if(#SaleRtn.RtnQuantity_SaleOutDepotBillProduct > 0 || #SaleRtnFromSaleBill.Num > 0)
  158. {
  159. MessageBox("该单据已有相应的销售退货记录,作废失败!",@Title);
  160. return;
  161. }
  162. }
  163. BeginUnAudit();
  164. #SaleOutDepotBill.ID_Assessor = DBNull();
  165. #SaleOutDepotBill.Name_UserAuti = "";
  166. #SaleOutDepotBill.Disable_SaleOutDepotBill =true;
  167. UnAudit();
  168. ChangeMode("View");
  169. EndUnAudit();
  170. <Lable name="CountSum" />
  171. </Click>
  172. </Events>
  173. </IKButton>
  174. <IKTextBox name="txtMaker" DataSource="SaleOutDepotBill.Name_User" />
  175. <IKTextBox name="txtAudi" DataSource="SaleOutDepotBill.Name_UserAuti" />
  176. <IKDateTimeText name="dttCreateDate" DataSource="SaleOutDepotBill.AssessDate_SaleOutDepotBill" />
  177. <IKTextBox name="txtlastmoduser" DataSource="SaleOutDepotBill.Name_LastModUser" />
  178. <IKDateTimeText name="dttlastmoddate" DataSource="SaleOutDepotBill.LastModDate_SaleOutDepotBill" />
  179. <IKDataGridEx name="dgProduct" DataSource="SaleOutDepotBillProduct" TableStyleIndex="0">
  180. <DataColumn Index="0" DataSource="SaleOutDepotBillProduct.No_SaleOutDepotBillProduct" />
  181. <DataColumn Index="1" DataSource="SaleOutDepotBillProduct.Name_FromBill">
  182. <IKDataGridComboBoxColumn DisplaySourceEx="SaleOutDepotBillProduct.Name_FromBill" ValueSourceEx="SaleOutDepotBillProduct.Type_FromBill"
  183. DataSourceEx="SaleBillType" DisplayMemberEx="Name_BillType" ValueMemberEx="Value_BillType">
  184. <Events>
  185. <Reload>
  186. Search("SearchBillType");
  187. SetDataGridColumnDataSource(1,"dgProduct");
  188. </Reload>
  189. </Events>
  190. </IKDataGridComboBoxColumn>
  191. </DataColumn>
  192. <DataColumn Index="2" DataSource="SaleOutDepotBillProduct.No_FromBill" />
  193. <DataColumn Index="3" DataSource="SaleOutDepotBillProduct.No_FromBillProduct" />
  194. <DataColumn Index="4" DataSource="SaleOutDepotBillProduct.No_Product">
  195. <IKDataGridTextButtonColumn>
  196. <Events>
  197. <Click>
  198. @SetFlag=1;
  199. ShowSearchBox("ProductSearch","INFOMATION",#SaleOutDepotBillProduct.No_Product);
  200. </Click>
  201. <SetFlagBeforeClick>
  202. @SetFlag=0;
  203. </SetFlagBeforeClick>
  204. </Events>
  205. </IKDataGridTextButtonColumn>
  206. </DataColumn>
  207. <DataColumn Index="5" DataSource="SaleOutDepotBillProduct.Name_Product" />
  208. <DataColumn Index="6" DataSource="SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct" />
  209. <DataColumn Index="7" DataSource="SaleOutDepotBillProduct.Unit_Product" />
  210. <DataColumn Index="8" DataSource="SaleOutDepotBillProduct.UnitPrice_SaleOutDepotBillProduct" />
  211. <DataColumn Index="9" DataSource="SaleOutDepotBillProduct.No_Location">
  212. <IKDataGridTextButtonColumn>
  213. <Events>
  214. <Click>
  215. @SetFlag1=1;
  216. @LocationNo = ShowSearchBox("LocationSearch","INFOMATION",#SaleOutDepotBillProduct.No_Location);
  217. if(@LocationNo != "")
  218. #SaleOutDepotBillProduct.No_Location = @LocationNo;
  219. </Click>
  220. <SetFlagBeforeClick>
  221. @SetFlag1=0;
  222. </SetFlagBeforeClick>
  223. </Events>
  224. </IKDataGridTextButtonColumn>
  225. </DataColumn>
  226. <DataColumn Index="10" DataSource="SaleOutDepotBillProduct.Name_Location"/>
  227. <DataColumn Index="11" DataSource="SaleOutDepotBillProduct.Comment_SaleOutDepotBillProduct" />
  228. </IKDataGridEx>
  229. <IKDataGridEx name="dgRemark" DataSource="BillComment" TableStyleIndex="0">
  230. <DataColumn Index="0" DataSource="BillComment.Comment_BillComment" />
  231. </IKDataGridEx>
  232. <IKDataGridEx name="dgReportComment" DataSource="ReportComment" TableStyleIndex="0">
  233. <DataColumn Index="0" DataSource="ReportComment.Comment_ReportComment" />
  234. </IKDataGridEx>
  235. <!--<IKButton name="BarCode">
  236. <Events>
  237. <Click>
  238. UpdateForm(false, "");
  239. if(Search("SearchSaleOutDepotBillWithNo", Read("test.txt",0)))
  240. {
  241. ChangeMode("View");
  242. }
  243. else
  244. {
  245. @a = ShowSearchNo();
  246. if(Search("SearchSaleOutDepotBillWithNo", @a))
  247. {
  248. ChangeMode("View");
  249. ShowFrmBarProduct(Read("test.txt",1),@a);
  250. return;
  251. }
  252. else
  253. {
  254. MessageBox("该出库单不存在!",@Title);
  255. return;
  256. }
  257. }
  258. ShowFrmBarProduct(Read("test.txt",1),"");
  259. <Lable name="CountSum" />
  260. </Click>
  261. </Events>
  262. </IKButton>-->
  263. <IKFormToolBar name="toolBar">
  264. <Events>
  265. <ClickFirst>
  266. if(Search("SearchSaleOutDepotBillFirst", tbNo.CValue))
  267. {
  268. ChangeMode("View");
  269. <Lable name="CountSum" />
  270. }
  271. </ClickFirst>
  272. <ClickPrev>
  273. if(Search("SearchSaleOutDepotBillPrevious", tbNo.CValue))
  274. {
  275. ChangeMode("View");
  276. <Lable name="CountSum" />
  277. }
  278. </ClickPrev>
  279. <ClickNext>
  280. if(Search("SearchSaleOutDepotBillNext", tbNo.CValue))
  281. {
  282. ChangeMode("View");
  283. <Lable name="CountSum" />
  284. }
  285. </ClickNext>
  286. <ClickLast>
  287. if(Search("SearchSaleOutDepotBillLast", tbNo.CValue))
  288. {
  289. ChangeMode("View");
  290. <Lable name="CountSum" />
  291. }
  292. </ClickLast>
  293. <ClickNew>
  294. @NewNumber=GetNextAutoNumber(true);
  295. if(@NewNumber != "")
  296. {
  297. ChangeMode("New");
  298. tbNo.CValue=@NewNumber;
  299. }
  300. </ClickNew>
  301. <ClickEmpty>
  302. ChangeMode("Search");
  303. </ClickEmpty>
  304. <ClickSubmit>
  305. <Lable name="SubmitButtonClick" />
  306. <Lable name="CountSum" />
  307. </ClickSubmit>
  308. <ClickModify>
  309. ChangeMode("Modify");
  310. <Lable name="CountSum" />
  311. </ClickModify>
  312. <ClickDelete>
  313. Delete();
  314. ChangeMode("Search");
  315. </ClickDelete>
  316. <ClickPrint>
  317. ShowPrintBox("BillSearch",#SaleOutDepotBill.No_SaleOutDepotBill,#SaleOutDepotBill.No_SaleOutDepotBill,GetFieldRight(@Title,"成本","查看"));
  318. </ClickPrint>
  319. <ClickPrintBarCode>
  320. PrintBarCode("BillSearch",#SaleOutDepotBill.No_SaleOutDepotBill,#SaleOutDepotBill.No_SaleOutDepotBill);
  321. </ClickPrintBarCode>
  322. <ClickAudit>
  323. <![CDATA[
  324. if(Search("SearchID_Customer",#SaleOutDepotBillProduct.No_FromBill))
  325. {
  326. if(!Equals(#SaleOutDepotBill.ID_Customer,#SaleBillCustomer.ID_Customer))
  327. {
  328. MessageBox("该来源单据的客户与本单据的客户不一致,请检查!",@Title);
  329. dgProduct.Focus();
  330. return;
  331. }
  332. }
  333. Search("SearchCheck",#SaleOutDepotBill.No_SaleOutDepotBill);
  334. if(#Check.Check_SaleOutDepotBill == 0)
  335. {
  336. @DialogResult=MessageBox("该单据未经校验,确定要审核吗?",@Title,MB_OKCANCEL);
  337. if(@DialogResult == DialogResult("CANCEL"))
  338. {
  339. return;
  340. }
  341. }
  342. SuspendLayout();
  343. if(@SaleAndOutDepot==false)
  344. {
  345. for (@i=0;@i<RowCount("#SaleOutDepotBillProduct");@i=@i+1)
  346. {
  347. SetPosition("#SaleOutDepotBillProduct", @i);
  348. if(!Equals(#SaleOutDepotBillProduct.No_FromBill,"") && #SaleOutDepotBillProduct.Type_FromBill!=0 && Search("SearchSaleBillAuditWithNo",#SaleOutDepotBillProduct.No_FromBill))
  349. {
  350. if(Equals(#SaleBillAudit.ID_Assessor,DBNull()))
  351. {
  352. dgProduct.CurrentRowIndex = @i;
  353. @DialogResult=MessageBox("该来源单据未经审核,确定要审核吗?",@Title,MB_OKCANCEL);
  354. if(@DialogResult == DialogResult("CANCEL"))
  355. {
  356. dgProduct.Focus();
  357. ResumeLayout();
  358. return;
  359. }
  360. }
  361. }
  362. }
  363. }
  364. ResumeLayout();
  365. BeginAudit();
  366. #SaleOutDepotBill.ID_Assessor = GetLoginUserID();
  367. #SaleOutDepotBill.Name_UserAuti = GetCurrentUser();
  368. #SaleOutDepotBill.AssessDate_SaleOutDepotBill = DateTimeNow();
  369. Audit();
  370. ChangeMode("View");
  371. EndAudit();
  372. ]]>
  373. <Lable name="CountSum" />
  374. </ClickAudit>
  375. <ClickUnAudit>
  376. <![CDATA[
  377. BeginUnAudit();
  378. #SaleOutDepotBill.ID_Assessor = DBNull();
  379. #SaleOutDepotBill.Name_UserAuti = "";
  380. UnAudit();
  381. ChangeMode("View");
  382. EndUnAudit();
  383. ]]>
  384. <Lable name="CountSum" />
  385. </ClickUnAudit>
  386. <ClickImport>
  387. ;
  388. </ClickImport>
  389. <ClickExport>
  390. ;
  391. </ClickExport>
  392. <ClickClose>
  393. ;
  394. </ClickClose>
  395. <ClickExpand>
  396. ;
  397. </ClickExpand>
  398. <ClickImportItem>
  399. <![CDATA[
  400. if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="销货单")
  401. {
  402. @ImportClicked = 1;
  403. @ImportSucceed = false;
  404. if(Search("SearchContrOut"))
  405. {
  406. @ImportSucceed = ShowSearchBox("ImportSaleBillControl","BILLCONVERT","#SaleOutDepotBillProduct.Type_FromBill",21,"#SaleOutDepotBillProduct.Name_FromBill","销货单");
  407. }
  408. else
  409. {
  410. @ImportSucceed = ShowSearchBox("ImportSaleBillUnControl","BILLCONVERT");
  411. }
  412. if(@ImportSucceed)
  413. {
  414. EmptyTable("ReportComment");
  415. SuspendLayout();
  416. @sql = "Select ReportComment.Comment_ReportComment from ReportComment Left join SaleBill on SaleBill.ID_SaleBill = ReportComment.ID_Bill Where SaleBill.No_SaleBill in (";
  417. for (@i=0;@i<=RowCount("#SaleOutDepotBillProduct")-1;@i=@i+1)
  418. {
  419. SetPosition("#SaleOutDepotBillProduct", @i);
  420. if(@i != RowCount("#SaleOutDepotBillProduct")-1)
  421. @sql = @sql + "'"+ #SaleOutDepotBillProduct.No_FromBill+"',";
  422. else
  423. @sql = @sql + "'"+ #SaleOutDepotBillProduct.No_FromBill+"')";
  424. }
  425. @sql = @sql + " Order by ReportComment.No_ReportComment";
  426. ResumeLayout();
  427. SearchEx(@sql, "SaleBillComment");
  428. MergeFiled("#SaleBillComment.Comment_ReportComment", "#ReportComment.Comment_ReportComment");
  429. }
  430. }
  431. ]]>
  432. <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
  433. <Lable name="CountSum" />
  434. </ClickImportItem>
  435. <ClickExportItem>
  436. if(toolBar.MenuItemText=="销售退货单")
  437. {
  438. if(Search("SearchContr"))
  439. {
  440. ExportBillProductStart("#SaleRtnBillProduct.Type_FromBill",2,"#SaleRtnBillProduct.FromBill_SaleRtnBillProduct","销货出库单","#SaleRtnBillProduct.No_FromBill",#SaleOutDepotBill.No_SaleOutDepotBill,"#SaleRtnBill.No_Customer",#SaleOutDepotBill.No_Customer,"#SaleRtnBill.Name_Location",#SaleOutDepotBill.Name_Location);
  441. ExportBillProduct("dgProduct","#SaleOutDepotBillProduct","#SaleRtnBillProduct.No_FromBillProduct","#SaleOutDepotBillProduct.No_SaleOutDepotBillProduct");
  442. }
  443. else
  444. {
  445. ExportBillProductStart("#SaleRtnBill.No_Customer",#SaleOutDepotBill.No_Customer,"#SaleRtnBillProduct.Comment_SaleRtnBillProduct","销货出库单:"+#SaleOutDepotBill.No_SaleOutDepotBill,"#SaleRtnBill.Name_Location",#SaleOutDepotBill.Name_Location);
  446. ExportBillProduct("dgProduct","#SaleOutDepotBillProduct","#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct","#SaleOutDepotBillProduct.No_Product");
  447. }
  448. }
  449. <!--初始化目标数据-->
  450. <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
  451. </ClickExportItem>
  452. <ClickCheck>
  453. @DialogResult=MessageBox("是否进行分校验?(选否进行总校验)",@Title,MB_YESNO);
  454. if(@DialogResult == DialogResult("YES"))
  455. {
  456. ShowFrmSaleOutProductCheck(#SaleOutDepotBill.No_SaleOutDepotBill);
  457. }
  458. else
  459. {
  460. if(Read("BarCode.txt",0)=="")
  461. MessageBox("条码信息所在文件不存在或信息为空!",@Title);
  462. else
  463. {
  464. ChangeMode("Search");
  465. if(Search("SearchSaleOutDepotBillWithNo", Read("BarCode.txt",0)))<!--参数为0取txt第一条,为1取txt全部 -->
  466. {
  467. Search("SearchStatusWithNo",Read("BarCode.txt",0));
  468. if(#Status.Check_SaleOutDepotBill == 0)
  469. {
  470. ChangeMode("View");
  471. <Lable name="CountSum" />
  472. }
  473. else
  474. {
  475. ChangeMode("Search");
  476. MessageBox("该单据已校验!",@Title);
  477. return;
  478. }
  479. }
  480. else
  481. {
  482. @a = ShowSearchNo();
  483. if(Search("SearchSaleOutDepotBillWithNo", @a))
  484. {
  485. Search("SearchStatusWithNo",@a);
  486. if(#Status.Check_SaleOutDepotBill == 0)
  487. {
  488. ChangeMode("View");
  489. <Lable name="CountSum" />
  490. ShowFrmBarProduct(Read("BarCode.txt",1),@a);
  491. return;
  492. }
  493. else
  494. {
  495. ChangeMode("Search");
  496. MessageBox("该单据已校验!",@Title);
  497. return;
  498. }
  499. }
  500. else
  501. {
  502. MessageBox("该出库单不存在!",@Title);
  503. return;
  504. }
  505. }
  506. ShowFrmBarProduct(Read("BarCode.txt",1),"");
  507. }
  508. }
  509. </ClickCheck>
  510. </Events>
  511. </IKFormToolBar>
  512. </Controls>
  513. <Tables>
  514. <Table name="SaleOutDepotBillProduct">
  515. <Events>
  516. <ColumnsChanged>
  517. <Name_FromBill>
  518. <![CDATA[
  519. if(!Equals(#SaleOutDepotBillProduct.Name_FromBill,StringEmpty()) && !Equals(#SaleOutDepotBillProduct.No_FromBill,StringEmpty()) && !Equals(#SaleOutDepotBillProduct.No_FromBillProduct,StringEmpty()))
  520. {
  521. if(Search("SearchNo_SaleBillProduct",#SaleOutDepotBillProduct.No_FromBill,#SaleOutDepotBillProduct.No_FromBillProduct))
  522. {
  523. if(!Equals(#NoSBProduct.SuspendDate_Product,DBNull()))
  524. {
  525. MessageBox("该产品已停用!",@Title);
  526. }
  527. #SaleOutDepotBillProduct.No_FromBillProduct = #NoSBProduct.No_SaleBillProduct;
  528. #SaleOutDepotBillProduct.ID_Product = #NoSBProduct.ID_Product;
  529. #SaleOutDepotBillProduct.No_Product = #NoSBProduct.No_Product;
  530. #SaleOutDepotBillProduct.Unit_Product = #NoSBProduct.Unit_Product;
  531. #SaleOutDepotBillProduct.Name_Product = #NoSBProduct.Name_Product;
  532. #SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct = #NoSBProduct.Mount;
  533. #SaleOutDepotBillProduct.Comment_SaleOutDepotBillProduct = #NoSBProduct.Comment_SaleBillProduct;
  534. #SaleOutDepotBillProduct.ID_IndentBillOnNetProduct = #NoSBProduct.ID_IndentBillOnNetProduct;
  535. if(Search("SearchOneLocation", #NoSBProduct.ID_Product))
  536. {
  537. #SaleOutDepotBillProduct.No_Location = #OneLocation.No_Location;
  538. #SaleOutDepotBillProduct.Name_Location = #OneLocation.Name_Location;
  539. #SaleOutDepotBillProduct.ID_Location = #OneLocation.ID_Location;
  540. }
  541. }
  542. }
  543. ]]>
  544. <Lable name="CountSum" />
  545. </Name_FromBill>
  546. <No_FromBill>
  547. <![CDATA[
  548. if(!Equals(#SaleOutDepotBillProduct.Name_FromBill,"") && !Equals(#SaleOutDepotBillProduct.Name_FromBill,DBNull()) && !Equals(#SaleOutDepotBillProduct.No_FromBill,"") && !Equals(#SaleOutDepotBillProduct.No_FromBill,DBNull()) && !Equals(#SaleOutDepotBillProduct.No_FromBillProduct,"") && !Equals(#SaleOutDepotBillProduct.No_FromBillProduct,DBNull()))
  549. {
  550. if(Search("SearchNo_SaleBillProduct",#SaleOutDepotBillProduct.No_FromBill,#SaleOutDepotBillProduct.No_FromBillProduct))
  551. {
  552. if(!Equals(#NoSBProduct.SuspendDate_Product,DBNull()))
  553. {
  554. MessageBox("该产品已停用!",@Title);
  555. }
  556. #SaleOutDepotBillProduct.No_FromBillProduct = #NoSBProduct.No_SaleBillProduct;
  557. #SaleOutDepotBillProduct.ID_Product = #NoSBProduct.ID_Product;
  558. #SaleOutDepotBillProduct.No_Product = #NoSBProduct.No_Product;
  559. #SaleOutDepotBillProduct.Unit_Product = #NoSBProduct.Unit_Product;
  560. #SaleOutDepotBillProduct.Name_Product = #NoSBProduct.Name_Product;
  561. #SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct = #NoSBProduct.Mount;
  562. #SaleOutDepotBillProduct.Comment_SaleOutDepotBillProduct = #NoSBProduct.Comment_SaleBillProduct;
  563. #SaleOutDepotBillProduct.ID_IndentBillOnNetProduct = #NoSBProduct.ID_IndentBillOnNetProduct;
  564. if(Search("SearchOneLocation",#NoSBProduct.ID_Product))
  565. {
  566. #SaleOutDepotBillProduct.No_Location = #OneLocation.No_Location;
  567. #SaleOutDepotBillProduct.Name_Location = #OneLocation.Name_Location;
  568. #SaleOutDepotBillProduct.ID_Location = #OneLocation.ID_Location;
  569. }
  570. }
  571. }
  572. ]]>
  573. <Lable name="CountSum" />
  574. </No_FromBill>
  575. <No_FromBillProduct>
  576. <![CDATA[
  577. if(!Equals(#SaleOutDepotBillProduct.Name_FromBill,"") && !Equals(#SaleOutDepotBillProduct.No_FromBill,"") && !Equals(#SaleOutDepotBillProduct.No_FromBillProduct,""))
  578. {
  579. if(Search("SearchNo_SaleBillProduct",#SaleOutDepotBillProduct.No_FromBill,#SaleOutDepotBillProduct.No_FromBillProduct))
  580. {
  581. if(!Equals(#NoSBProduct.SuspendDate_Product,DBNull()))
  582. {
  583. MessageBox("该产品已停用!",@Title);
  584. }
  585. #SaleOutDepotBillProduct.No_FromBillProduct = #NoSBProduct.No_SaleBillProduct;
  586. #SaleOutDepotBillProduct.ID_Product = #NoSBProduct.ID_Product;
  587. #SaleOutDepotBillProduct.No_Product = #NoSBProduct.No_Product;
  588. #SaleOutDepotBillProduct.Unit_Product = #NoSBProduct.Unit_Product;
  589. #SaleOutDepotBillProduct.Name_Product = #NoSBProduct.Name_Product;
  590. #SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct = #NoSBProduct.Mount;
  591. #SaleOutDepotBillProduct.Comment_SaleOutDepotBillProduct = #NoSBProduct.Comment_SaleBillProduct;
  592. #SaleOutDepotBillProduct.ID_IndentBillOnNetProduct = #NoSBProduct.ID_IndentBillOnNetProduct;
  593. if( Search("SearchOneLocation", #NoSBProduct.ID_Product))
  594. {
  595. #SaleOutDepotBillProduct.No_Location = #OneLocation.No_Location;
  596. #SaleOutDepotBillProduct.Name_Location = #OneLocation.Name_Location;
  597. #SaleOutDepotBillProduct.ID_Location = #OneLocation.ID_Location;
  598. }
  599. }
  600. }
  601. ]]>
  602. <Lable name="CountSum" />
  603. </No_FromBillProduct>
  604. <No_Product>
  605. <![CDATA[
  606. if(@SetFlag==0)
  607. {
  608. return;
  609. }
  610. if(#SaleOutDepotBillProduct.No_Product == "" || !Search("SearchNo_Product",#SaleOutDepotBillProduct.No_Product))
  611. {
  612. if(#SaleOutDepotBillProduct.No_Product != "")
  613. MessageBox("该产品不存在!",@Title);
  614. #SaleOutDepotBillProduct.ID_Product = GuidEmpty();
  615. #SaleOutDepotBillProduct.Unit_Product = "";
  616. #SaleOutDepotBillProduct.Name_Product = "";
  617. @temp = ShowSearchBox("InputSearchProduct","INFOMATION",#SaleOutDepotBillProduct.No_Product);
  618. if(@temp != "")
  619. {
  620. ResumeColumnEvent("#SaleOutDepotBillProduct.No_Product");
  621. #SaleOutDepotBillProduct.No_Product = @temp;
  622. ClearColumnEvent();
  623. }
  624. }
  625. else
  626. {
  627. if(!Equals(#NoProduct.SuspendDate_Product,DBNull()))
  628. {
  629. MessageBox("该产品已停用!",@Title);
  630. }
  631. #SaleOutDepotBillProduct.ID_Product = #NoProduct.ID_Product;
  632. #SaleOutDepotBillProduct.Unit_Product = #NoProduct.Unit_Product;
  633. #SaleOutDepotBillProduct.Name_Product = #NoProduct.Name_Product;
  634. #SaleOutDepotBillProduct.UnitPrice_SaleOutDepotBillProduct = #NoProduct.Cost_Product;
  635. if(Search("SearchOneLocation", #NoProduct.ID_Product))
  636. {
  637. #SaleOutDepotBillProduct.No_Location = #OneLocation.No_Location;
  638. #SaleOutDepotBillProduct.Name_Location = #OneLocation.Name_Location;
  639. #SaleOutDepotBillProduct.ID_Location = #OneLocation.ID_Location;
  640. }
  641. }
  642. ]]>
  643. <Lable name="CountSum" />
  644. </No_Product>
  645. <No_Location>
  646. if(@SetFlag1==0)
  647. {
  648. return;
  649. }
  650. if(#SaleOutDepotBillProduct.No_Location != StringEmpty())
  651. {
  652. if(!Search("SearchLocationByNo",#SaleOutDepotBillProduct.No_Location))
  653. {
  654. MessageBox("不存在此库位编号",@Title);
  655. #SaleOutDepotBillProduct.ID_Location=GuidEmpty();
  656. #SaleOutDepotBillProduct.Name_Location=StringEmpty();
  657. }
  658. else
  659. {
  660. #SaleOutDepotBillProduct.ID_Location=#Location.ID_Location;
  661. #SaleOutDepotBillProduct.Name_Location=#Location.Name_Location;
  662. }
  663. }
  664. </No_Location>
  665. <Quantity_SaleOutDepotBillProduct>
  666. <![CDATA[
  667. #SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct = FormatNumber(#SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct, #System.QuantityDecimal_SystemSetting);
  668. ]]>
  669. <Lable name="CountSum" />
  670. </Quantity_SaleOutDepotBillProduct>
  671. </ColumnsChanged>
  672. <RowDeleted>
  673. <Lable name="CountSum" />
  674. </RowDeleted>
  675. </Events>
  676. </Table>
  677. </Tables>
  678. <LockInfomation LockID="ID_SaleOutDepotBill" LockNO="No_SaleOutDepotBill" LockSearchFunction="SearchSaleOutDepotBillWithNo"
  679. LockAudit="ID_Assessor" />
  680. <LogInfomation LogNO="#SaleOutDepotBill.No_SaleOutDepotBill" RecordFormField="" RecordDataGridField="#SaleOutDepotBillProduct.No_Product,#SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct" />
  681. <ChildForms>
  682. <ChildForm name="CustomerSearch" DataSource="Customer" SearchFunction="SearchAllCustomer" SearchFunctionByNo="" MappingName="客户">
  683. <DataColumn Index="0" MappingName="#Customer.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn" />
  684. <DataColumn Index="1" MappingName="#Customer.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn" />
  685. <DataColumn Index="2" MappingName="#Customer.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn" />
  686. <DataColumn Index="3" MappingName="#Customer.Level_Customer" HeaderText="客户等级" Width="75" ColumnType="IKDataGridTextBoxColumn" />
  687. <DataColumn Index="4" MappingName="#Customer.IsGeneric_Customer" HeaderText="一般客户" Width="75" ColumnType="IKDataGridBoolColumn" />
  688. </ChildForm>
  689. <ChildForm name="BillSearch" DataSource="SaleOutDepotBill" SearchFunction="SearchAllBill" SearchFunctionByNo="SearchSaleOutDepotBillWithNo">
  690. <DataColumn Index="0" MappingName="#SaleOutDepotBill.No_SaleOutDepotBill" HeaderText="销货出库单号" Width="90" ColumnType="IKDataGridTextBoxColumn" />
  691. <DataColumn Index="1" MappingName="#SaleOutDepotBill.Date_SaleOutDepotBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" />
  692. <DataColumn Index="2" MappingName="#SaleOutDepotBill.No_Customer" HeaderText="客户编号" Width="75" ColumnType="IKDataGridTextBoxColumn" />
  693. <DataColumn Index="3" MappingName="#SaleOutDepotBill.ShortName_Customer" HeaderText="客户简称" Width="75" ColumnType="IKDataGridTextBoxColumn" />
  694. <DataColumn Index="4" MappingName="#SaleOutDepotBill.Comment_SaleOutDepotBill" HeaderText="备注" Width="75" ColumnType="IKDataGridTextBoxColumn" />
  695. <DataColumn Index="5" MappingName="#SaleOutDepotBill.Check_SaleOutDepotBill" HeaderText="校验状态" Width="75" ColumnType="IKDataGridTextBoxColumn" />
  696. </ChildForm>
  697. <ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品" ReturnDataSource="SaleOutDepotBillProduct" ShowCheckBox="true">
  698. <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn" ReturnMappingName="#SaleOutDepotBillProduct.No_Product" />
  699. <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn" />
  700. <DataColumn Index="2" MappingName="#Product.Type_Product" HeaderText="产品类型" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  701. <DataColumn Index="3" MappingName="#Product.Price_Product" HeaderText="标准售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
  702. <DataColumn Index="4" MappingName="#Product.LowSalePrice_Product" HeaderText="最低售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
  703. <DataColumn Index="5" MappingName="#Product.SafetyQty_Product" HeaderText="安全存量" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  704. </ChildForm>
  705. <ChildForm name="LocationSearch" DataSource="Location" SearchFunction="SearchAllLocation" SearchFunctionByNo="" MappingName="库位" ReturnDataSource="SaleOutDepotBillProduct" ShowCheckBox="false">
  706. <DataColumn Index="0" MappingName="#Location.No_Location" HeaderText="库位编号" Width="120" ColumnType="IKDataGridTextBoxColumn" ReturnMappingName="#SaleOutDepotBillProduct.No_Location" />
  707. <DataColumn Index="1" MappingName="#Location.Name_Location" HeaderText="库位名称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  708. </ChildForm>
  709. <ChildForm name="InputSearchProduct" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品">
  710. <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn" />
  711. <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn" />
  712. <DataColumn Index="2" MappingName="#Product.Type_Product" HeaderText="产品类型" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  713. <DataColumn Index="3" MappingName="#Product.Price_Product" HeaderText="标准售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
  714. <DataColumn Index="4" MappingName="#Product.LowSalePrice_Product" HeaderText="最低售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
  715. <DataColumn Index="5" MappingName="#Product.SafetyQty_Product" HeaderText="安全存量" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  716. </ChildForm>
  717. <ChildForm name="ImportSaleBillControl">
  718. <DataGridIndex DataSource="SaleBill" SearchFunction="SearchAllSaleBill" SearchFunctionByNo="" MappingName="" ReturnDataSource="SaleOutDepotBillProduct">
  719. <DataColumn Index="0" MappingName="#SaleBill.No_SaleBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleOutDepotBillProduct.No_FromBill" />
  720. <DataColumn Index="1" MappingName="#SaleBill.Date_SaleBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
  721. <DataColumn Index="2" MappingName="#SaleBill.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#SaleOutDepotBill.No_Customer" />
  722. <DataColumn Index="3" MappingName="#SaleBill.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
  723. <DataColumn Index="4" MappingName="#SaleBill.State_SaleBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
  724. <DataColumn Index="5" MappingName="#SaleBill.Name_Location" HeaderText="出货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn"
  725. ReturnPath="parent" ReturnMappingName="#SaleOutDepotBill.Name_Location" />
  726. <DataColumn Index="6" MappingName="#SaleBill.OutStatus_SaleBill" HeaderText="发货状态" Width="90" ColumnType="IKDataGridTextBoxColumn"
  727. ReturnPath="child" />
  728. </DataGridIndex>
  729. <DataGridIndex DataSource="SaleBillProduct" SearchFunction="SearchAllSaleBillProduct" SearchFunctionByNo=""
  730. MappingName="">
  731. <DataColumn Index="0" MappingName="#SaleBillProduct.No_Product" HeaderText="产品编号" Width="90"
  732. ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
  733. <DataColumn Index="1" MappingName="#SaleBillProduct.No_SaleBillProduct" HeaderText="产品序号" Width="90"
  734. ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleOutDepotBillProduct.No_FromBillProduct" />
  735. <DataColumn Index="2" MappingName="#SaleBillProduct.Name_Product" HeaderText="产品名称" Width="90"
  736. ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
  737. <DataColumn Index="3" MappingName="#SaleBillProduct.Quantity_SaleBillProduct" HeaderText="数量"
  738. Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2" />
  739. <DataColumn Index="4" MappingName="#SaleBillProduct.UnitPrice_SaleBillProduct" HeaderText="单价"
  740. Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2" />
  741. <DataColumn Index="5" MappingName="#SaleBillProduct.Comment_SaleBillProduct" HeaderText="备注"
  742. Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleOutDepotBillProduct.Comment_SaleOutDepotBillProduct"/>
  743. </DataGridIndex>
  744. </ChildForm>
  745. <ChildForm name="ImportSaleBillUnControl">
  746. <DataGridIndex DataSource="SaleBill" SearchFunction="SearchAllSaleBill" SearchFunctionByNo="" MappingName=""
  747. ReturnDataSource="SaleOutDepotBillProduct">
  748. <DataColumn Index="0" MappingName="#SaleBill.No_SaleBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn"
  749. ReturnPath="child" ReturnMappingName="#SaleOutDepotBillProduct.Comment_SaleOutDepotBillProduct" />
  750. <DataColumn Index="1" MappingName="#SaleBill.Date_SaleBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"
  751. ReturnPath="child" />
  752. <DataColumn Index="2" MappingName="#SaleBill.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"
  753. ReturnPath="parent" ReturnMappingName="#SaleOutDepotBill.No_Customer" />
  754. <DataColumn Index="3" MappingName="#SaleBill.ShortName_Customer" HeaderText="客户简称" Width="90"
  755. ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
  756. <DataColumn Index="4" MappingName="#SaleBill.State_SaleBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn"
  757. ReturnPath="child" />
  758. <DataColumn Index="5" MappingName="#SaleBill.Name_Location" HeaderText="出货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn"
  759. ReturnPath="parent" ReturnMappingName="#SaleOutDepotBill.Name_Location" />
  760. <DataColumn Index="6" MappingName="#SaleBill.OutStatus_SaleBill" HeaderText="发货状态" Width="90" ColumnType="IKDataGridTextBoxColumn"
  761. ReturnPath="child" />
  762. </DataGridIndex>
  763. <DataGridIndex DataSource="SaleBillProduct" SearchFunction="SearchAllSaleBillProduct" SearchFunctionByNo=""
  764. MappingName="">
  765. <DataColumn Index="0" MappingName="#SaleBillProduct.No_Product" HeaderText="产品编号" Width="90"
  766. ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleOutDepotBillProduct.No_Product" />
  767. <DataColumn Index="1" MappingName="#SaleBillProduct.No_SaleBillProduct" HeaderText="产品序号" Width="90"
  768. ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
  769. <DataColumn Index="2" MappingName="#SaleBillProduct.Name_Product" HeaderText="产品名称" Width="90"
  770. ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
  771. <DataColumn Index="3" MappingName="#SaleBillProduct.Quantity_SaleBillProduct" HeaderText="数量"
  772. Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2" />
  773. <DataColumn Index="4" MappingName="#SaleBillProduct.UnitPrice_SaleBillProduct" HeaderText="单价"
  774. Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2" />
  775. <DataColumn Index="5" MappingName="#SaleBillProduct.Comment_SaleBillProduct" HeaderText="备注"
  776. Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleOutDepotBillProduct.Comment_SaleOutDepotBillProduct"/>
  777. </DataGridIndex>
  778. </ChildForm>
  779. </ChildForms>
  780. <ImportedInfo>
  781. UpdateForm(true, "tbCustomerNo");
  782. Search("SearchLocation");
  783. cbLocation.Text = #SaleOutDepotBill.Name_Location;
  784. tbCustomerNo.Focus();
  785. ActiveControlEvent("tbCustomerNo", "Enter");
  786. </ImportedInfo>
  787. </Client>
  788. <Server>
  789. <Tables>
  790. <Table name="SaleOutDepotBill" Type="Parent">
  791. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 SaleOutDepotBill.*
  792. ,a.Name_User,b.Name_User as Name_UserAuti,c.Name_User as Name_LastModUser
  793. ,Location.Name_Location,Location.No_Location,Customer.Name_Customer
  794. ,Customer.ShortName_Customer,Customer.No_Customer
  795. FROM SaleOutDepotBill
  796. LEFT JOIN Customer ON Customer.ID_Customer = SaleOutDepotBill.ID_Customer
  797. LEFT JOIN AppUser a ON a.ID_User = SaleOutDepotBill.ID_Creator
  798. LEFT JOIN AppUser b ON b.ID_User = SaleOutDepotBill.ID_Assessor
  799. Left JOIN AppUser c ON c.ID_User = SaleOutDepotBill.LastModUser_SaleOutDepotBill
  800. LEFT JOIN Location ON Location.ID_Location = SaleOutDepotBill.ID_Location
  801. " />
  802. <New CmdType="Text" CmdText="insert into SaleOutDepotBill(ID_SaleOutDepotBill,No_SaleOutDepotBill,Date_SaleOutDepotBill,ID_Location, ID_Creator,ID_Assessor,AssessDate_SaleOutDepotBill,Comment_SaleOutDepotBill,Disable_SaleOutDepotBill,CreateDate_SaleOutDepotBill,LastModUser_SaleOutDepotBill,LastModDate_SaleOutDepotBill,ID_Customer)
  803. values (@ID_SaleOutDepotBill,@No_SaleOutDepotBill,@Date_SaleOutDepotBill,@ID_Location,@ID_Creator,@ID_Assessor,@AssessDate_SaleOutDepotBill,@Comment_SaleOutDepotBill,@Disable_SaleOutDepotBill,@CreateDate_SaleOutDepotBill,@LastModUser_SaleOutDepotBill,@LastModDate_SaleOutDepotBill,@ID_Customer)
  804. ">
  805. <Params>
  806. <Param name="@ID_SaleOutDepotBill" type="SaleOutDepotBill.ID_SaleOutDepotBill" sourceColumn="ID_SaleOutDepotBill" />
  807. <Param name="@No_SaleOutDepotBill" type="SaleOutDepotBill.No_SaleOutDepotBill" sourceColumn="No_SaleOutDepotBill" />
  808. <Param name="@Date_SaleOutDepotBill" type="SaleOutDepotBill.Date_SaleOutDepotBill" sourceColumn="Date_SaleOutDepotBill" />
  809. <Param name="@ID_Location" type="SaleOutDepotBill.ID_Location" sourceColumn="ID_Location" />
  810. <Param name="@ID_Creator" type="SaleOutDepotBill.ID_Creator" sourceColumn="ID_Creator" />
  811. <Param name="@ID_Assessor" type="SaleOutDepotBill.ID_Assessor" sourceColumn="ID_Assessor" />
  812. <Param name="@AssessDate_SaleOutDepotBill" type="SaleOutDepotBill.AssessDate_SaleOutDepotBill"
  813. sourceColumn="AssessDate_SaleOutDepotBill" />
  814. <Param name="@Comment_SaleOutDepotBill" type="SaleOutDepotBill.Comment_SaleOutDepotBill"
  815. sourceColumn="Comment_SaleOutDepotBill" />
  816. <Param name="@Disable_SaleOutDepotBill" type="SaleOutDepotBill.Disable_SaleOutDepotBill"
  817. sourceColumn="Disable_SaleOutDepotBill" />
  818. <Param name="@CreateDate_SaleOutDepotBill" type="SaleOutDepotBill.CreateDate_SaleOutDepotBill"
  819. sourceColumn="CreateDate_SaleOutDepotBill" />
  820. <Param name="@LastModUser_SaleOutDepotBill" type="SaleOutDepotBill.LastModUser_SaleOutDepotBill"
  821. sourceColumn="LastModUser_SaleOutDepotBill" />
  822. <Param name="@LastModDate_SaleOutDepotBill" type="SaleOutDepotBill.LastModDate_SaleOutDepotBill"
  823. sourceColumn="LastModDate_SaleOutDepotBill" />
  824. <Param name="@ID_Customer" type="SaleOutDepotBill.ID_Customer" sourceColumn="ID_Customer" />
  825. </Params>
  826. </New>
  827. <Update CmdType="Text" CmdText=" update SaleOutDepotBill set
  828. No_SaleOutDepotBill=@No_SaleOutDepotBill,
  829. Date_SaleOutDepotBill=@Date_SaleOutDepotBill,
  830. ID_Location=@ID_Location,
  831. ID_Creator=@ID_Creator,
  832. ID_Assessor=@ID_Assessor,
  833. AssessDate_SaleOutDepotBill=@AssessDate_SaleOutDepotBill,
  834. Comment_SaleOutDepotBill=@Comment_SaleOutDepotBill,
  835. Disable_SaleOutDepotBill=@Disable_SaleOutDepotBill,
  836. CreateDate_SaleOutDepotBill=@CreateDate_SaleOutDepotBill,
  837. LastModUser_SaleOutDepotBill=@LastModUser_SaleOutDepotBill,
  838. LastModDate_SaleOutDepotBill=@LastModDate_SaleOutDepotBill,
  839. ID_Customer=@ID_Customer
  840. WHERE ID_SaleOutDepotBill=@ID_SaleOutDepotBill">
  841. <Params>
  842. <Param name="@ID_SaleOutDepotBill" type="SaleOutDepotBill.ID_SaleOutDepotBill" sourceColumn="ID_SaleOutDepotBill" />
  843. <Param name="@No_SaleOutDepotBill" type="SaleOutDepotBill.No_SaleOutDepotBill" sourceColumn="No_SaleOutDepotBill" />
  844. <Param name="@Date_SaleOutDepotBill" type="SaleOutDepotBill.Date_SaleOutDepotBill" sourceColumn="Date_SaleOutDepotBill" />
  845. <Param name="@ID_Location" type="SaleOutDepotBill.ID_Location" sourceColumn="ID_Location" />
  846. <Param name="@ID_Creator" type="SaleOutDepotBill.ID_Creator" sourceColumn="ID_Creator" />
  847. <Param name="@ID_Assessor" type="SaleOutDepotBill.ID_Assessor" sourceColumn="ID_Assessor" />
  848. <Param name="@AssessDate_SaleOutDepotBill" type="SaleOutDepotBill.AssessDate_SaleOutDepotBill"
  849. sourceColumn="AssessDate_SaleOutDepotBill" />
  850. <Param name="@Comment_SaleOutDepotBill" type="SaleOutDepotBill.Comment_SaleOutDepotBill"
  851. sourceColumn="Comment_SaleOutDepotBill" />
  852. <Param name="@Disable_SaleOutDepotBill" type="SaleOutDepotBill.Disable_SaleOutDepotBill"
  853. sourceColumn="Disable_SaleOutDepotBill" />
  854. <Param name="@CreateDate_SaleOutDepotBill" type="SaleOutDepotBill.CreateDate_SaleOutDepotBill"
  855. sourceColumn="CreateDate_SaleOutDepotBill" />
  856. <Param name="@LastModUser_SaleOutDepotBill" type="SaleOutDepotBill.LastModUser_SaleOutDepotBill"
  857. sourceColumn="LastModUser_SaleOutDepotBill" />
  858. <Param name="@LastModDate_SaleOutDepotBill" type="SaleOutDepotBill.LastModDate_SaleOutDepotBill"
  859. sourceColumn="LastModDate_SaleOutDepotBill" />
  860. <Param name="@ID_Customer" type="SaleOutDepotBill.ID_Customer" sourceColumn="ID_Customer" />
  861. </Params>
  862. </Update>
  863. <Audit CmdType="Text" CmdText=" DECLARE @Quantity_OutDepot DECIMAL(14,4)
  864. DECLARE @Quantity_Sale DECIMAL(14,4)
  865. Declare @Quantity_SaleRtn DECIMAL(14,4)
  866. DECLARE @SumQuantity_OutDepot DECIMAL(14,4)
  867. DECLARE @SumQuantity_SaleRtn DECIMAL(14,4)
  868. DECLARE @AMOUNT DECIMAL(14,4)
  869. DECLARE @AVAI DECIMAL(14,4)
  870. DECLARE @COUNT DECIMAL(14,4)
  871. DECLARE @ID_SaleSourceBillProduct UNIQUEIDENTIFIER
  872. DECLARE @ID_Product UNIQUEIDENTIFIER
  873. DECLARE @SaleAndOutDepot bit
  874. DECLARE @OutDepotAndSaleBack bit
  875. DECLARE @No_SaleBill nvarchar(64)
  876. DECLARE @No_SaleOutDepotBillProduct nvarchar(64)
  877. DECLARE @error nvarchar(64)
  878. DECLARE @ID_AssessorSaleBill UNIQUEIDENTIFIER
  879. DECLARE @ThisID_SaleSourceBillProduct UNIQUEIDENTIFIER
  880. DECLARE @ID_SaleOutDepotBillProduct UNIQUEIDENTIFIER
  881. DECLARE @ID_Location UNIQUEIDENTIFIER
  882. Declare @RtnQuantity_SaleOutDepotBillProduct decimal(14,4)
  883. Declare @SaleRtnSourceBill_SystemSetting bit
  884. SELECT @SaleAndOutDepot=SaleAndOutDepot_SystemSetting,@OutDepotAndSaleBack=OutDepotAndSaleBack_SystemSetting,@SaleRtnSourceBill_SystemSetting=SaleRtnSourceBill_SystemSetting FROM SystemSetting
  885. IF (@ID_Assessor IS NULL AND @SaleAndOutDepot = 1)
  886. BEGIN
  887. SELECT @SumQuantity_OutDepot=sum(Quantity_SaleOutDepotBillProduct),@SumQuantity_SaleRtn=sum(RtnQuantity_SaleOutDepotBillProduct)
  888. FROM SaleOutDepotBillProduct
  889. WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBill = @ID_SaleOutDepotBill
  890. if(@SumQuantity_OutDepot-@SumQuantity_SaleRtn=0 AND @SumQuantity_OutDepot!=0 AND @SumQuantity_SaleRtn != 0 )
  891. BEGIN
  892. RAISERROR('该单据产品已经全部退货,取消审核失败!',16,1)
  893. RETURN
  894. END
  895. Update SaleOutDepotBill Set Check_SaleOutDepotBill = 0 Where ID_SaleOutDepotBill = @ID_SaleOutDepotBill
  896. END
  897. DECLARE CUR CURSOR FOR SELECT SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct,
  898. SaleBillProduct.ID_SaleSourceBillProduct,
  899. SaleOutDepotBillProduct.ID_Product,
  900. SaleOutDepotBillProduct.No_FromBill,
  901. SaleOutDepotBillProduct.ID_SaleSourceBillProduct,
  902. SaleOutDepotBillProduct.ID_SaleOutDepotBillProduct,
  903. SaleOutDepotBillProduct.ID_Location,
  904. SaleOutDepotBillProduct.No_SaleOutDepotBillProduct,
  905. SaleOutDepotBillProduct.RtnQuantity_SaleOutDepotBillProduct
  906. FROM SaleOutDepotBillProduct
  907. LEFT JOIN SaleBill on SaleOutDepotBillProduct.No_FromBill=SaleBill.No_SaleBill
  908. LEFT JOIN SaleBillProduct ON SaleBillProduct.ID_SaleBill=SaleBill.ID_SaleBill and SaleOutDepotBillProduct.No_FromBillProduct=SaleBillProduct.No_SaleBillProduct
  909. WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBill=@ID_SaleOutDepotBill
  910. OPEN CUR
  911. FETCH NEXT FROM CUR INTO @AMOUNT,@ID_SaleSourceBillProduct,@ID_Product,@No_SaleBill,@ThisID_SaleSourceBillProduct,@ID_SaleOutDepotBillProduct,@ID_Location,@No_SaleOutDepotBillProduct,@RtnQuantity_SaleOutDepotBillProduct
  912. WHILE @@FETCH_STATUS = 0
  913. BEGIN
  914. SELECT @AVAI=ISNULL(StockQty_ProductStocks,0) FROM ProductStocks
  915. WHERE ProductStocks.ID_Product=@ID_Product AND ProductStocks.ID_Location=@ID_Location
  916. IF (@ID_Assessor IS NOT NULL)
  917. BEGIN
  918. SELECT @COUNT =COUNT(StockQty_ProductStocks) FROM ProductStocks
  919. WHERE ProductStocks.ID_Product=@ID_Product AND ProductStocks.ID_Location=@ID_Location
  920. IF(@COUNT=0)
  921. BEGIN
  922. SET @error = N'对应库位中不存在序号为'+@No_SaleOutDepotBillProduct+N'的产品,审核失败!'
  923. RAISERROR(@error,16,1)
  924. RETURN
  925. END
  926. IF (@SaleAndOutDepot != 0)
  927. BEGIN
  928. SELECT @ID_AssessorSaleBill=ID_Assessor FROM SaleBill WHERE No_SaleBill=@No_SaleBill
  929. IF(@ID_AssessorSaleBill is NULL)
  930. BEGIN
  931. SET @error = N'产品序号为'+@No_SaleOutDepotBillProduct+N'的来源单据尚未经过审核,审核失败!'
  932. RAISERROR(@error,16,1)
  933. return
  934. END
  935. if(@ID_SaleSourceBillProduct is not null)
  936. BEGIN
  937. SELECT @Quantity_OutDepot=ISNULL(Quantity_OutDepot,0),
  938. @Quantity_Sale=ISNULL(Quantity_Sale,0),
  939. @Quantity_SaleRtn=ISNULL(Quantity_SaleRtn,0)
  940. FROM SaleSourceBillProduct
  941. WHERE ID_SaleSourceBillProduct=@ID_SaleSourceBillProduct
  942. IF((@Quantity_Sale-@Quantity_OutDepot) &lt; @AMOUNT)
  943. BEGIN
  944. SET @error = N'序号为'+@No_SaleOutDepotBillProduct+N'的产品的累计出库数量大于相应销货数量,审核失败!请于关联单据处查询。'
  945. RAISERROR(@error,16,1)
  946. RETURN
  947. END
  948. IF(@AMOUNT &lt;@RtnQuantity_SaleOutDepotBillProduct)
  949. BEGIN
  950. SET @error = N'序号为'+@No_SaleOutDepotBillProduct+N'的产品的累计出库数量小于相应退货数量,审核失败!请于关联单据处查询。'
  951. RAISERROR(@error,16,1)
  952. RETURN
  953. END
  954. IF(@SaleRtnSourceBill_SystemSetting=0)
  955. BEGIN
  956. IF(@Quantity_SaleRtn &gt;(@Quantity_OutDepot+@AMOUNT))
  957. BEGIN
  958. SET @error = N'序号为'+@No_SaleOutDepotBillProduct+N'的产品的累计出库数量小于相应退货数量,审核失败!请于关联单据处查询。'
  959. RAISERROR(@error,16,1)
  960. RETURN
  961. END
  962. END
  963. END
  964. UPDATE SaleSourceBillProduct set Quantity_OutDepot=Quantity_OutDepot+@AMOUNT
  965. WHERE ID_SaleSourceBillProduct=@ID_SaleSourceBillProduct
  966. UPDATE SaleOutDepotBillProduct set ID_SaleSourceBillProduct=@ID_SaleSourceBillProduct
  967. WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBillProduct=@ID_SaleOutDepotBillProduct
  968. END
  969. IF (@SaleAndOutDepot=0)
  970. BEGIN
  971. IF(@OutDepotAndSaleBack != 0)
  972. BEGIN
  973. IF(@AMOUNT &lt;@RtnQuantity_SaleOutDepotBillProduct)
  974. BEGIN
  975. SET @error = N'序号为'+@No_SaleOutDepotBillProduct+N'的产品的累计出库数量小于相应退货数量,审核失败!请于关联单据处查询。'
  976. RAISERROR(@error,16,1)
  977. RETURN
  978. END
  979. IF(EXISTS(SELECT * FROM SaleSourceBillProduct
  980. WHERE ID_SaleSourceBillProduct = @ThisID_SaleSourceBillProduct))
  981. BEGIN
  982. UPDATE SaleSourceBillProduct set Quantity_OutDepot=Quantity_OutDepot+@AMOUNT
  983. WHERE ID_SaleSourceBillProduct=@ThisID_SaleSourceBillProduct
  984. END
  985. ELSE
  986. BEGIN
  987. INSERT INTO SaleSourceBillProduct (ID_SaleSourceBillProduct,Quantity_OutDepot)
  988. VALUES(@ThisID_SaleSourceBillProduct,@AMOUNT)
  989. UPDATE SaleOutDepotBillProduct set ID_SaleSourceBillProduct=@ThisID_SaleSourceBillProduct
  990. WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBillProduct=@ID_SaleOutDepotBillProduct
  991. END
  992. END
  993. END
  994. IF (@AVAI &lt; @AMOUNT)
  995. BEGIN
  996. SET @error = N'序号为'+@No_SaleOutDepotBillProduct+N'的产品库存数量不足,审核失败!'
  997. RAISERROR(@error,16,1)
  998. RETURN
  999. END
  1000. UPDATE ProductStocks SET StockQty_ProductStocks=StockQty_ProductStocks-@AMOUNT
  1001. WHERE ProductStocks.ID_Product=@ID_Product AND ProductStocks.ID_Location=@ID_Location
  1002. END
  1003. ELSE IF (@ID_Assessor IS NULL)
  1004. BEGIN
  1005. IF (@OutDepotAndSaleBack != 0 OR @SaleAndOutDepot != 0)
  1006. BEGIN
  1007. UPDATE SaleSourceBillProduct set Quantity_OutDepot=Quantity_OutDepot-@AMOUNT
  1008. WHERE ID_SaleSourceBillProduct=@ThisID_SaleSourceBillProduct
  1009. END
  1010. UPDATE ProductStocks SET StockQty_ProductStocks=StockQty_ProductStocks+@AMOUNT
  1011. WHERE ProductStocks.ID_Product=@ID_Product AND ProductStocks.ID_Location=@ID_Location
  1012. END
  1013. FETCH NEXT FROM CUR INTO @AMOUNT,@ID_SaleSourceBillProduct,@ID_Product,@No_SaleBill,@ThisID_SaleSourceBillProduct,@ID_SaleOutDepotBillProduct,@ID_Location,@No_SaleOutDepotBillProduct,@RtnQuantity_SaleOutDepotBillProduct
  1014. END
  1015. CLOSE CUR
  1016. DEALLOCATE CUR
  1017. UPDATE SaleOutDepotBill SET
  1018. ID_Assessor=@ID_Assessor,
  1019. AssessDate_SaleOutDepotBill=@AssessDate_SaleOutDepotBill,
  1020. Disable_SaleOutDepotBill=@Disable_SaleOutDepotBill
  1021. WHERE ID_SaleOutDepotBill=@ID_SaleOutDepotBill">
  1022. <Params>
  1023. <Param name="@ID_SaleOutDepotBill" type="SaleOutDepotBill.ID_SaleOutDepotBill" sourceColumn="ID_SaleOutDepotBill" />
  1024. <Param name="@No_SaleOutDepotBill" type="SaleOutDepotBill.No_SaleOutDepotBill" sourceColumn="No_SaleOutDepotBill" />
  1025. <Param name="@ID_Assessor" type="SaleOutDepotBill.ID_Assessor" sourceColumn="ID_Assessor" />
  1026. <Param name="@AssessDate_SaleOutDepotBill" type="SaleOutDepotBill.AssessDate_SaleOutDepotBill"
  1027. sourceColumn="AssessDate_SaleOutDepotBill" />
  1028. <Param name="@Disable_SaleOutDepotBill" type="SaleOutDepotBill.Disable_SaleOutDepotBill" sourceColumn="Disable_SaleOutDepotBill" />
  1029. </Params>
  1030. </Audit>
  1031. <Delete CmdType="Text" CmdText="
  1032. DECLARE @SumRtnQuantity decimal(14,4)
  1033. DECLARE @ID_SaleSourceBillProduct UNIQUEIDENTIFIER
  1034. DECLARE @SaleAndOutDepot bit
  1035. DECLARE @OutDepotAndSaleBack bit
  1036. DECLARE @SaleRtnSourceBill_SystemSetting bit
  1037. SELECT @SaleAndOutDepot=SaleAndOutDepot_SystemSetting,@OutDepotAndSaleBack=OutDepotAndSaleBack_SystemSetting,@SaleRtnSourceBill_SystemSetting=SaleRtnSourceBill_SystemSetting FROM SystemSetting
  1038. SELECT @SumRtnQuantity = Sum(RtnQuantity_SaleOutDepotBillProduct)
  1039. FROM SaleOutDepotBillProduct
  1040. WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBill = @ID_SaleOutDepotBill
  1041. if(@SumRtnQuantity &gt; 0)
  1042. BEGIN
  1043. RAISERROR('该单据已有相应的销售退货记录,删除失败!',16,1)
  1044. return
  1045. END
  1046. if(@AssessDate_SaleOutDepotBill Is Not Null And @SaleRtnSourceBill_SystemSetting=0)
  1047. BEGIN
  1048. IF(Select Count(*)
  1049. From SaleOutDepotBillProduct
  1050. LEFT JOIN SaleSourceBillProduct ON SaleSourceBillProduct.ID_SaleSourceBillProduct=SaleOutDepotBillProduct.ID_SaleSourceBillProduct
  1051. Where ID_SaleOutDepotBill=@ID_SaleOutDepotBill And (Quantity_OutDepot-Quantity_SaleRtn) &lt; 0 ) &gt; 0
  1052. BEGIN
  1053. RAISERROR('该单据已有相应的销售退货记录,删除失败!',16,1)
  1054. return
  1055. END
  1056. END
  1057. if(@SaleAndOutDepot=0 AND @OutDepotAndSaleBack != 0)
  1058. BEGIN
  1059. DELETE SaleSourceBillProduct WHERE ID_SaleSourceBillProduct in (SELECT ID_SaleSourceBillProduct FROM SaleOutDepotBillProduct where SaleOutDepotBillProduct.ID_SaleOutDepotBill=@ID_SaleOutDepotBill)
  1060. END
  1061. DELETE SaleOutDepotBillProduct WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBill = @ID_SaleOutDepotBill
  1062. DELETE FROM BillComment WHERE ID_Bill = @ID_SaleOutDepotBill
  1063. DELETE FROM ReportComment WHERE ID_Bill=@ID_SaleOutDepotBill
  1064. if(@SaleAndOutDepot=0 and @OutDepotAndSaleBack=0)
  1065. BEGIN
  1066. UPDATE SaleOutDepotBill set Disable_SaleOutDepotBill=1 where SaleOutDepotBill.ID_SaleOutDepotBill = @ID_SaleOutDepotBill
  1067. END
  1068. ELSE
  1069. BEGIN
  1070. DELETE SaleOutDepotBill WHERE SaleOutDepotBill.ID_SaleOutDepotBill = @ID_SaleOutDepotBill
  1071. END">
  1072. <Params>
  1073. <Param name="@ID_SaleOutDepotBill" type="SaleOutDepotBill.ID_SaleOutDepotBill" sourceColumn="ID_SaleOutDepotBill" />
  1074. <Param name="@AssessDate_SaleOutDepotBill" type="SaleOutDepotBill.AssessDate_SaleOutDepotBill"
  1075. sourceColumn="AssessDate_SaleOutDepotBill" />
  1076. </Params>
  1077. </Delete>
  1078. <FKErrorReport ErrorMessage="本记录被其他单据使用过,删除失败!" />
  1079. <UNIQUEErrorReport ErrorMessage="销货出库单号已存在,提交失败!" />
  1080. </Table>
  1081. <Table name="SaleOutDepotBillProduct" Type="Child">
  1082. <GetSchema CmdType="Text" CmdText="SELECT TOP 0 SaleOutDepotBillProduct.*,
  1083. BillType.Name_BillType AS Name_FromBill,
  1084. No_FromBill AS No_SaleOutDepotBill,
  1085. Product.No_Product,
  1086. Product.Name_Product,
  1087. Product.Unit_Product, Product.Name_Product AS No_SaleOutDepotBill,
  1088. Location.Name_Location, Location.ID_Location,Location.No_Location
  1089. FROM SaleOutDepotBillProduct
  1090. LEFT JOIN BillType ON BillType.Value_BillType=SaleOutDepotBillProduct.Type_FromBill
  1091. LEFT JOIN Location ON Location.ID_Location=SaleOutDepotBillProduct.ID_Location
  1092. LEFT JOIN Product ON SaleOutDepotBillProduct.ID_Product=Product.ID_Product
  1093. " />
  1094. <New CmdType="Text" CmdText="
  1095. Declare @Error nvarchar(256)
  1096. IF(@Quantity_SaleOutDepotBillProduct>(Select IsNull(StockQty_ProductStocks,0) From ProductStocks Where ID_Product=@ID_Product And ID_Location=@ID_Location))
  1097. Begin
  1098. SET @Error = N'序号为'+@No_SaleOutDepotBillProduct+N'的产品的出库数量大于相应库存数量,提交失败!'
  1099. RAISERROR(@Error,16,1)
  1100. RETURN
  1101. End
  1102. SET @ID_SaleSourceBillProduct = NULL
  1103. if(@ID_IndentBillOnNetProduct='00000000-0000-0000-0000-000000000000') Set @ID_IndentBillOnNetProduct=Null
  1104. INSERT INTO SaleOutDepotBillProduct(ID_SaleOutDepotBillProduct,
  1105. No_SaleOutDepotBillProduct,
  1106. ID_SaleOutDepotBill,
  1107. ID_SaleSourceBillProduct,
  1108. Type_FromBill,
  1109. No_FromBill,
  1110. No_FromBillProduct,
  1111. ID_Product,
  1112. ID_Location,
  1113. Quantity_SaleOutDepotBillProduct,
  1114. UnitPrice_SaleOutDepotBillProduct,
  1115. Comment_SaleOutDepotBillProduct,
  1116. ID_IndentBillOnNetProduct)
  1117. VALUES( @ID_SaleOutDepotBillProduct,
  1118. @No_SaleOutDepotBillProduct,
  1119. @ID_SaleOutDepotBill,
  1120. @ID_SaleSourceBillProduct,
  1121. @Type_FromBill,
  1122. @No_FromBill,
  1123. @No_FromBillProduct,
  1124. @ID_Product,
  1125. @ID_Location,
  1126. @Quantity_SaleOutDepotBillProduct,
  1127. @UnitPrice_SaleOutDepotBillProduct,
  1128. @Comment_SaleOutDepotBillProduct,
  1129. @ID_IndentBillOnNetProduct)">
  1130. <Params>
  1131. <Param name="@ID_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.ID_SaleOutDepotBillProduct"
  1132. sourceColumn="ID_SaleOutDepotBillProduct" />
  1133. <Param name="@No_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.No_SaleOutDepotBillProduct"
  1134. sourceColumn="No_SaleOutDepotBillProduct" />
  1135. <Param name="@ID_SaleOutDepotBill" type="SaleOutDepotBillProduct.ID_SaleOutDepotBill" sourceColumn="ID_SaleOutDepotBill" />
  1136. <Param name="@ID_SaleSourceBillProduct" type="SaleOutDepotBillProduct.ID_SaleSourceBillProduct"
  1137. sourceColumn="ID_SaleSourceBillProduct" />
  1138. <Param name="@Type_FromBill" type="SaleOutDepotBillProduct.Type_FromBill" sourceColumn="Type_FromBill" />
  1139. <Param name="@No_FromBill" type="SaleOutDepotBillProduct.No_FromBill" sourceColumn="No_FromBill" />
  1140. <Param name="@No_FromBillProduct" type="SaleOutDepotBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
  1141. <Param name="@ID_Product" type="SaleOutDepotBillProduct.ID_Product" sourceColumn="ID_Product" />
  1142. <Param name="@ID_Location" type="SaleOutDepotBillProduct.ID_Location" sourceColumn="ID_Location" />
  1143. <Param name="@Quantity_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct"
  1144. sourceColumn="Quantity_SaleOutDepotBillProduct" />
  1145. <Param name="@Comment_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.Comment_SaleOutDepotBillProduct"
  1146. sourceColumn="Comment_SaleOutDepotBillProduct" />
  1147. <Param name="@UnitPrice_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.UnitPrice_SaleOutDepotBillProduct"
  1148. sourceColumn="UnitPrice_SaleOutDepotBillProduct" />
  1149. <Param name="@ID_IndentBillOnNetProduct" type="SaleBillProduct.ID_IndentBillOnNetProduct" sourceColumn="ID_IndentBillOnNetProduct" />
  1150. </Params>
  1151. </New>
  1152. <Update CmdType="Text" CmdText="DECLARE @SaleAndOutDepot bit
  1153. DECLARE @OutDepotAndSaleBack bit
  1154. DECLARE @Quantity_Sale decimal(16,4)
  1155. DECLARE @Quantity_SaleRtn decimal(16,4)
  1156. DECLARE @Quantity_OutDepot decimal(16,4)
  1157. DECLARE @AssessDate_SaleOutDepotBill datetime
  1158. DECLARE @error nvarchar(64)
  1159. SELECT @SaleAndOutDepot=SaleAndOutDepot_SystemSetting,@OutDepotAndSaleBack=OutDepotAndSaleBack_SystemSetting FROM SystemSetting
  1160. SELECT @AssessDate_SaleOutDepotBill=AssessDate_SaleOutDepotBill FROM SaleOutDepotBill WHERE ID_SaleOutDepotBill = @ID_SaleOutDepotBill
  1161. IF(@SaleAndOutDepot=1 AND @AssessDate_SaleOutDepotBill IS NOT NULL)
  1162. BEGIN
  1163. SELECT @Quantity_Sale=Quantity_Sale,@Quantity_OutDepot=Quantity_OutDepot,@Quantity_SaleRtn=Quantity_SaleRtn FROM SaleSourceBillProduct
  1164. WHERE ID_SaleSourceBillProduct=@ID_SaleSourceBillProduct
  1165. IF(@Quantity_SaleOutDepotBillProduct+@Quantity_OutDepot &gt; @Quantity_Sale)
  1166. BEGIN
  1167. SET @error = N'序号为'+@No_SaleOutDepotBillProduct+N'的产品的累计出库数量大于相应销货数量,提交失败!请于关联单据处查询。'
  1168. RAISERROR(@error,16,1)
  1169. RETURN
  1170. END
  1171. IF(@Quantity_SaleOutDepotBillProduct &lt;@RtnQuantity_SaleOutDepotBillProduct)
  1172. BEGIN
  1173. SET @error = N'序号为'+@No_SaleOutDepotBillProduct+N'的产品的累计出库数量小于相应退货数量,审核失败!请于关联单据处查询。'
  1174. RAISERROR(@error,16,1)
  1175. RETURN
  1176. END
  1177. END
  1178. IF(@SaleAndOutDepot=0 AND @OutDepotAndSaleBack=1 AND @AssessDate_SaleOutDepotBill IS NOT NULL )
  1179. IF(@Quantity_SaleOutDepotBillProduct &lt;@RtnQuantity_SaleOutDepotBillProduct)
  1180. BEGIN
  1181. SET @error = N'序号为'+@No_SaleOutDepotBillProduct+N'的产品的累计出库数量小于相应退货数量,审核失败!请于关联单据处查询。'
  1182. RAISERROR(@error,16,1)
  1183. RETURN
  1184. END
  1185. UPDATE SaleOutDepotBillProduct SET
  1186. No_SaleOutDepotBillProduct=@No_SaleOutDepotBillProduct,
  1187. ID_SaleOutDepotBill=@ID_SaleOutDepotBill,
  1188. ID_SaleSourceBillProduct=@ID_SaleSourceBillProduct,
  1189. Type_FromBill=@Type_FromBill,
  1190. No_FromBill=@No_FromBill,
  1191. No_FromBillProduct=@No_FromBillProduct,
  1192. ID_Product=@ID_Product,
  1193. ID_Location=@ID_Location,
  1194. Quantity_SaleOutDepotBillProduct=@Quantity_SaleOutDepotBillProduct,
  1195. UnitPrice_SaleOutDepotBillProduct=@UnitPrice_SaleOutDepotBillProduct,
  1196. Comment_SaleOutDepotBillProduct=@Comment_SaleOutDepotBillProduct,
  1197. ID_IndentBillOnNetProduct=@ID_IndentBillOnNetProduct
  1198. WHERE ID_SaleOutDepotBillProduct=@ID_SaleOutDepotBillProduct">
  1199. <Params>
  1200. <Param name="@ID_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.ID_SaleOutDepotBillProduct"
  1201. sourceColumn="ID_SaleOutDepotBillProduct" />
  1202. <Param name="@No_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.No_SaleOutDepotBillProduct"
  1203. sourceColumn="No_SaleOutDepotBillProduct" />
  1204. <Param name="@ID_SaleOutDepotBill" type="SaleOutDepotBillProduct.ID_SaleOutDepotBill" sourceColumn="ID_SaleOutDepotBill" />
  1205. <Param name="@ID_SaleSourceBillProduct" type="SaleOutDepotBillProduct.ID_SaleSourceBillProduct"
  1206. sourceColumn="ID_SaleSourceBillProduct" />
  1207. <Param name="@Type_FromBill" type="SaleOutDepotBillProduct.Type_FromBill" sourceColumn="Type_FromBill" />
  1208. <Param name="@No_FromBill" type="SaleOutDepotBillProduct.No_FromBill" sourceColumn="No_FromBill" />
  1209. <Param name="@No_FromBillProduct" type="SaleOutDepotBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
  1210. <Param name="@ID_Product" type="SaleOutDepotBillProduct.ID_Product" sourceColumn="ID_Product" />
  1211. <Param name="@ID_Location" type="SaleOutDepotBillProduct.ID_Location" sourceColumn="ID_Location" />
  1212. <Param name="@Quantity_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct"
  1213. sourceColumn="Quantity_SaleOutDepotBillProduct" />
  1214. <Param name="@Comment_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.Comment_SaleOutDepotBillProduct"
  1215. sourceColumn="Comment_SaleOutDepotBillProduct" />
  1216. <Param name="@RtnQuantity_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.RtnQuantity_SaleOutDepotBillProduct"
  1217. sourceColumn="RtnQuantity_SaleOutDepotBillProduct" />
  1218. <Param name="@UnitPrice_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.UnitPrice_SaleOutDepotBillProduct"
  1219. sourceColumn="UnitPrice_SaleOutDepotBillProduct" />
  1220. <Param name="@ID_IndentBillOnNetProduct" type="SaleBillProduct.ID_IndentBillOnNetProduct" sourceColumn="ID_IndentBillOnNetProduct" />
  1221. </Params>
  1222. </Update>
  1223. <Delete CmdType="Text" CmdText="DELETE SaleOutDepotBillProduct WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBillProduct = @ID_SaleOutDepotBillProduct">
  1224. <Params>
  1225. <Param name="@ID_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.ID_SaleOutDepotBillProduct"
  1226. sourceColumn="ID_SaleOutDepotBillProduct" />
  1227. </Params>
  1228. </Delete>
  1229. </Table>
  1230. <Table name="BillComment" Type="Child">
  1231. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 BillComment.* FROM BillComment" />
  1232. <New CmdType="Text" CmdText=" INSERT INTO BillComment (ID_BillComment, ID_Bill, Comment_BillComment)
  1233. VALUES (@ID_BillComment, @ID_Bill, @Comment_BillComment)">
  1234. <Params>
  1235. <Param name="@ID_BillComment" type="BillComment.ID_BillComment" sourceColumn="ID_BillComment" />
  1236. <Param name="@ID_Bill" type="BillComment.ID_Bill" sourceColumn="ID_Bill" />
  1237. <Param name="@Comment_BillComment" type="BillComment.Comment_BillComment" sourceColumn="Comment_BillComment" />
  1238. </Params>
  1239. </New>
  1240. <Update CmdType="Text" CmdText=" UPDATE BillComment SET ID_Bill = @ID_Bill, Comment_BillComment = @Comment_BillComment
  1241. WHERE ID_BillComment = @ID_BillComment">
  1242. <Params>
  1243. <Param name="@ID_BillComment" type="BillComment.ID_BillComment" sourceColumn="ID_BillComment" />
  1244. <Param name="@ID_Bill" type="BillComment.ID_Bill" sourceColumn="ID_Bill" />
  1245. <Param name="@Comment_BillComment" type="BillComment.Comment_BillComment" sourceColumn="Comment_BillComment" />
  1246. </Params>
  1247. </Update>
  1248. <Delete CmdType="Text" CmdText=" DELETE BillComment WHERE ID_BillComment = @ID_BillComment">
  1249. <Params>
  1250. <Param name="@ID_BillComment" type="BillComment.ID_BillComment" sourceColumn="ID_BillComment" />
  1251. </Params>
  1252. </Delete>
  1253. </Table>
  1254. <Table name="ReportComment" Type="Child">
  1255. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 ReportComment.* ,Convert(nvarchar(64), '') as No_SaleOutDepotBill FROM ReportComment" />
  1256. <New CmdType="Text" CmdText=" INSERT INTO ReportComment (ID_ReportComment, ID_Bill, Comment_ReportComment)
  1257. VALUES (@ID_ReportComment, @ID_Bill, @Comment_ReportComment)">
  1258. <Params>
  1259. <Param name="@ID_ReportComment" type="ReportComment.ID_BillComment" sourceColumn="ID_ReportComment" />
  1260. <Param name="@ID_Bill" type="ReportComment.ID_Bill" sourceColumn="ID_Bill" />
  1261. <Param name="@Comment_ReportComment" type="ReportComment.Comment_ReportComment" sourceColumn="Comment_ReportComment" />
  1262. </Params>
  1263. </New>
  1264. <Update CmdType="Text" CmdText=" UPDATE ReportComment SET ID_Bill = @ID_Bill, Comment_ReportComment = @Comment_ReportComment
  1265. WHERE ID_ReportComment = @ID_ReportComment">
  1266. <Params>
  1267. <Param name="@ID_ReportComment" type="ReportComment.ID_BillComment" sourceColumn="ID_ReportComment" />
  1268. <Param name="@ID_Bill" type="ReportComment.ID_Bill" sourceColumn="ID_Bill" />
  1269. <Param name="@Comment_ReportComment" type="ReportComment.Comment_ReportComment" sourceColumn="Comment_ReportComment" />
  1270. </Params>
  1271. </Update>
  1272. <Delete CmdType="Text" CmdText=" DELETE ReportComment WHERE ID_ReportComment = @ID_ReportComment">
  1273. <Params>
  1274. <Param name="@ID_ReportComment" type="ReportComment.ID_ReportComment" sourceColumn="ID_ReportComment" />
  1275. </Params>
  1276. </Delete>
  1277. </Table>
  1278. <Table name="SaleBillComment" Type="Other">
  1279. <GetSchema CmdType="Text" CmdText="Select Top 0 Comment_ReportComment from ReportComment" />
  1280. </Table>
  1281. </Tables>
  1282. <Search>
  1283. <SearchAllBill CmdType="Text" CmdText=" SELECT SaleOutDepotBill.*,a.Name_User,b.Name_User as Name_UserAuti
  1284. ,c.Name_User as Name_LastModUser,
  1285. Location.Name_Location,Location.No_Location
  1286. ,Customer.Name_Customer, Customer.ShortName_Customer,Customer.No_Customer
  1287. FROM SaleOutDepotBill
  1288. LEFT JOIN Customer ON Customer.ID_Customer = SaleOutDepotBill.ID_Customer
  1289. LEFT JOIN AppUser a ON a.ID_User = SaleOutDepotBill.ID_Creator
  1290. LEFT JOIN AppUser b ON b.ID_User = SaleOutDepotBill.ID_Assessor
  1291. Left JOIN AppUser c ON c.ID_User = SaleOutDepotBill.LastModUser_SaleOutDepotBill
  1292. LEFT JOIN Location ON Location.ID_Location = SaleOutDepotBill.ID_Location
  1293. WHERE Disable_SaleOutDepotBill = 0
  1294. ">
  1295. <Tables>
  1296. <Table name="AllBill" />
  1297. </Tables>
  1298. </SearchAllBill>
  1299. <SearchAllProduct CmdType="Text" CmdText="SELECT Product.No_Product,Product.Name_Product ,Type_Product, Price_Product, LowSalePrice_Product, SafetyQty_Product FROM Product ">
  1300. <Tables>
  1301. <Table name="AllProduct" />
  1302. </Tables>
  1303. </SearchAllProduct>
  1304. <SearchAllLocation CmdType="Text" CmdText="SELECT No_Location,Name_Location FROM Location ">
  1305. <Tables>
  1306. <Table name="Location" />
  1307. </Tables>
  1308. </SearchAllLocation>
  1309. <SearchSystemSetting CmdType="Text" CmdText=" SELECT CessOut_SystemSetting,SaleAndOutDepot_SystemSetting,OutDepotAndSaleBack_SystemSetting,SaleRtnSourceBill_SystemSetting,SysCurrency_SystemSetting,
  1310. UnitPriceDecimal_SystemSetting, PriceDecimal_SystemSetting, QuantityDecimal_SystemSetting,CostDecimal_SystemSetting FROM SystemSetting">
  1311. <Tables>
  1312. <Table name="System" />
  1313. </Tables>
  1314. </SearchSystemSetting>
  1315. <SearchContr CmdType="Text" CmdText=" SELECT SystemSetting.OutDepotAndSaleBack_SystemSetting FROM SystemSetting WHERE SystemSetting.OutDepotAndSaleBack_SystemSetting = 1">
  1316. <Tables>
  1317. <Table name="SystemInDepot" />
  1318. </Tables>
  1319. </SearchContr>
  1320. <SearchContrOut CmdType="Text" CmdText=" SELECT SystemSetting.SaleAndOutDepot_SystemSetting FROM SystemSetting WHERE SystemSetting.SaleAndOutDepot_SystemSetting = 1">
  1321. <Tables>
  1322. <Table name="SystemSaleAndOutDepot" />
  1323. </Tables>
  1324. </SearchContrOut>
  1325. <SearchSaleOutDepotBillWithNo CmdType="Text" CmdText=" DECLARE @ID_SaleOutDepotBill uniqueidentifier
  1326. SELECT SaleOutDepotBill.*,a.Name_User
  1327. ,b.Name_User as Name_UserAuti,c.Name_User as Name_LastModUser
  1328. ,Location.Name_Location,Location.No_Location
  1329. ,Customer.Name_Customer,Customer.ShortName_Customer
  1330. ,Customer.No_Customer
  1331. FROM SaleOutDepotBill
  1332. LEFT JOIN Customer ON Customer.ID_Customer = SaleOutDepotBill.ID_Customer
  1333. LEFT JOIN AppUser a ON a.ID_User = SaleOutDepotBill.ID_Creator
  1334. LEFT JOIN AppUser b ON b.ID_User = SaleOutDepotBill.ID_Assessor
  1335. Left JOIN AppUser c ON c.ID_User = SaleOutDepotBill.LastModUser_SaleOutDepotBill
  1336. LEFT JOIN Location ON Location.ID_Location = SaleOutDepotBill.ID_Location
  1337. WHERE No_SaleOutDepotBill = @No_SaleOutDepotBill
  1338. SELECT @ID_SaleOutDepotBill=ID_SaleOutDepotBill
  1339. FROM SaleOutDepotBill
  1340. WHERE No_SaleOutDepotBill = @No_SaleOutDepotBill
  1341. SELECT SaleOutDepotBillProduct.*,
  1342. BillType.Name_BillType AS Name_FromBill,
  1343. No_FromBill AS No_SaleOutDepotBill,
  1344. Product.No_Product,
  1345. Product.Name_Product,
  1346. Product.Unit_Product,Product.Name_Product AS No_SaleOutDepotBill
  1347. ,Location.Name_Location, Location.ID_Location
  1348. ,Location.No_Location
  1349. FROM SaleOutDepotBillProduct
  1350. LEFT JOIN BillType ON BillType.Value_BillType=SaleOutDepotBillProduct.Type_FromBill
  1351. LEFT JOIN Location ON Location.ID_Location=SaleOutDepotBillProduct.ID_Location
  1352. LEFT JOIN Product ON SaleOutDepotBillProduct.ID_Product=Product.ID_Product
  1353. WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBill=@ID_SaleOutDepotBill
  1354. ORDER BY CAST(No_SaleOutDepotBillProduct AS INT)
  1355. SELECT BillComment.*
  1356. FROM BillComment
  1357. LEFT JOIN SaleOutDepotBill ON SaleOutDepotBill.ID_SaleOutDepotBill=BillComment.ID_Bill
  1358. WHERE ID_SaleOutDepotBill=@ID_SaleOutDepotBill
  1359. order by BillComment.No_BillComment
  1360. SELECT ReportComment.*,@No_SaleOutDepotBill as No_SaleOutDepotBill
  1361. FROM ReportComment
  1362. LEFT JOIN SaleOutDepotBill ON SaleOutDepotBill.ID_SaleOutDepotBill=ReportComment.ID_Bill
  1363. WHERE ID_SaleOutDepotBill=@ID_SaleOutDepotBill
  1364. order by ReportComment.No_ReportComment
  1365. ">
  1366. <Params>
  1367. <Param name="@No_SaleOutDepotBill" type="SaleOutDepotBill.No_SaleOutDepotBill" Index="0" />
  1368. </Params>
  1369. <Tables>
  1370. <Table name="SaleOutDepotBill" />
  1371. <Table name="SaleOutDepotBillProduct" />
  1372. <Table name="BillComment" />
  1373. <Table name="ReportComment" />
  1374. </Tables>
  1375. </SearchSaleOutDepotBillWithNo>
  1376. <SearchLocationByNo CmdType="Text" CmdText="
  1377. SELECT ID_Location, Name_Location FROM Location WHERE No_Location=@No_Location
  1378. ">
  1379. <Params>
  1380. <Param name="@No_Location" type="Location.No_Location" Index="0" />
  1381. </Params>
  1382. <Tables>
  1383. <Table name="Location" />
  1384. </Tables>
  1385. </SearchLocationByNo>
  1386. <SearchLocation CmdType="Text" CmdText="SELECT Name_Location,ID_Location,No_Location FROM Location WHERE SubjectionID_Location Is Null">
  1387. <Tables>
  1388. <Table name="Location" />
  1389. </Tables>
  1390. </SearchLocation>
  1391. <SearchProductLocation CmdType="Text" CmdText=" SELECT Name_Location,ID_Location FROM Location WHERE ID_Warehouse=@ID_Location AND LowestLevel_Location=1">
  1392. <Params>
  1393. <Param name="@ID_Location" type="Location.ID_Location" Index="0" />
  1394. </Params>
  1395. <Tables>
  1396. <Table name="ProductLocationFromWarehouse" />
  1397. </Tables>
  1398. </SearchProductLocation>
  1399. <SearchJudgeLocationAndWarehouse CmdType="Text" CmdText="SELECT Name_Location,ID_Location FROM Location WHERE ID_Warehouse=@ID_Warehouse AND ID_Location=@ID_Location and LowestLevel_Location=1">
  1400. <Params>
  1401. <Param name="@ID_Warehouse" type="Location.ID_Warehouse" Index="0" />
  1402. <Param name="@ID_Location" type="Location.ID_Location" Index="1" />
  1403. </Params>
  1404. <Tables>
  1405. <Table name="JudgeLocationAndWarehouse" />
  1406. </Tables>
  1407. </SearchJudgeLocationAndWarehouse>
  1408. <SearchLocationWithName CmdType="Text" CmdText="SELECT ID_Location FROM Location WHERE Name_Location=@Name_Location">
  1409. <Params>
  1410. <Param name="@Name_Location" type="Location.Name_Location" Index="0" />
  1411. </Params>
  1412. <Tables>
  1413. <Table name="JudgeLocation" />
  1414. </Tables>
  1415. </SearchLocationWithName>
  1416. <SearchAppUserPopedom CmdType="Text" CmdText=" SELECT * FROM SaleOutDepotBill WHERE SaleOutDepotBill.ID_Creator=@ID_User">
  1417. <Params>
  1418. <Param name="@ID_User" type="AppUser.ID_User" Index="0" />
  1419. </Params>
  1420. <Tables>
  1421. <Table name="AppUserPopedom" />
  1422. </Tables>
  1423. </SearchAppUserPopedom>
  1424. <SearchNo_FromBill CmdType="Text" CmdText="SELECT * FROM SaleBill WHERE No_SaleBill=@No_SaleBill">
  1425. <Params>
  1426. <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" Index="0" />
  1427. </Params>
  1428. <Tables>
  1429. <Table name="NoFromBill" />
  1430. </Tables>
  1431. </SearchNo_FromBill>
  1432. <SearchBillTypeWithName CmdType="Text" CmdText=" SELECT BillType.Value_BillType FROM BillType WHERE BillType.Name_BillType = @Name_BillType">
  1433. <Params>
  1434. <Param name="@Name_BillType" type="BillType.Name_BillType" Index="0" />
  1435. </Params>
  1436. <Tables>
  1437. <Table name="BillType" />
  1438. </Tables>
  1439. </SearchBillTypeWithName>
  1440. <SearchBillType CmdType="Text" CmdText=" SELECT BillType.Value_BillType,BillType.Name_BillType FROM BillType WHERE BillType.Value_BillType = 21 or BillType.Value_BillType=0 order by Value_BillType">
  1441. <Tables>
  1442. <Table name="SaleBillType" />
  1443. </Tables>
  1444. </SearchBillType>
  1445. <SearchNo_SaleBillProduct CmdType="Text" CmdText=" DECLARE @ID_SaleBill uniqueidentifier
  1446. declare @TaxCurrency_SaleBill nvarchar(64)
  1447. SELECT @ID_SaleBill=ID_SaleBill,@TaxCurrency_SaleBill=TaxCurrency_SaleBill FROM SaleBill WHERE No_SaleBill=@No_SaleBill and SaleBill.Disable_SaleBill=0
  1448. SELECT SaleBillProduct.*,@TaxCurrency_SaleBill as TaxCurrency_SaleBill, Product.ID_Product, Product.No_Product,
  1449. Product.Name_Product,Product.SuspendDate_Product,Comment_NoSBProduct = Case WHEN No_OrderBill='' THEN No_OrderBill else '订:'+ No_OrderBill END,
  1450. Product.Unit_Product,Product.Cost_Product,Product.AvailableQty_ProductStocks,
  1451. ISNULL(convert(decimal(18,2),SaleSourceBillProduct.Quantity_Sale-SaleSourceBillProduct.Quantity_OutDepot),0) as Mount
  1452. FROM SaleBillProduct
  1453. LEFT JOIN SaleBill ON SaleBill.ID_SaleBill = SaleBillProduct.ID_SaleBill
  1454. LEFT JOIN Product ON Product.ID_Product=SaleBillProduct.ID_Product
  1455. LEFT JOIN SaleSourceBillProduct ON SaleSourceBillProduct.ID_SaleSourceBillProduct=SaleBillProduct.ID_SaleSourceBillProduct
  1456. WHERE SaleBillProduct.ID_SaleBill=@ID_SaleBill AND SaleBillProduct.No_SaleBillProduct=@No_SaleBillProduct">
  1457. <Params>
  1458. <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" Index="0" />
  1459. <Param name="@No_SaleBillProduct" type="SaleBillProduct.No_SaleBillProduct" Index="1" />
  1460. </Params>
  1461. <Tables>
  1462. <Table name="NoSBProduct" />
  1463. </Tables>
  1464. </SearchNo_SaleBillProduct>
  1465. <SearchNo_Product CmdType="Text" CmdText=" SELECT Product.Price_Product,Product.ID_Product, Product.No_Product,Product.Name_Product,Product.SuspendDate_Product, Product.Unit_Product,Product.Cost_Product
  1466. FROM Product WHERE Product.No_Product=@No_Product">
  1467. <Params>
  1468. <Param name="@No_Product" type="Product.No_Product" Index="0" />
  1469. </Params>
  1470. <Tables>
  1471. <Table name="NoProduct" />
  1472. </Tables>
  1473. </SearchNo_Product>
  1474. <SearchCallBackOut_FunctionSetting CmdType="Text" CmdText="SELECT SaleFeedBackOut_FunctionSetting FROM FunctionSetting">
  1475. <Tables>
  1476. <Table name="FunctionSetting" />
  1477. </Tables>>
  1478. </SearchCallBackOut_FunctionSetting>
  1479. <SearchSaleBillAuditWithNo CmdType="Text" CmdText="SELECT ID_Assessor FROM SaleBill WHERE No_SaleBill=@No_SaleBill">
  1480. <Params>
  1481. <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" Index="0" />
  1482. </Params>
  1483. <Tables>
  1484. <Table name="SaleBillAudit" />
  1485. </Tables>
  1486. </SearchSaleBillAuditWithNo>
  1487. <SearchSaleOutDepotBillFirst CmdType="Text" CmdText=" DECLARE @SaleOutDepotBillNo nvarchar(64)
  1488. DECLARE @ID_SaleOutDepotBill uniqueidentifier
  1489. SELECT TOP 1 @ID_SaleOutDepotBill = SaleOutDepotBill.ID_SaleOutDepotBill
  1490. ,@SaleOutDepotBillNo = SaleOutDepotBill.No_SaleOutDepotBill
  1491. FROM SaleOutDepotBill
  1492. ORDER BY SaleOutDepotBill.No_SaleOutDepotBill
  1493. SELECT SaleOutDepotBill.*
  1494. ,a.Name_User,b.Name_User as Name_UserAuti
  1495. ,c.Name_User as Name_LastModUser
  1496. ,Location.Name_Location ,Location.No_Location
  1497. ,Customer.Name_Customer,Customer.ShortName_Customer
  1498. ,Customer.No_Customer
  1499. FROM SaleOutDepotBill
  1500. LEFT JOIN Customer ON Customer.ID_Customer = SaleOutDepotBill.ID_Customer
  1501. LEFT JOIN AppUser a ON a.ID_User = SaleOutDepotBill.ID_Creator
  1502. LEFT JOIN AppUser b ON b.ID_User = SaleOutDepotBill.ID_Assessor
  1503. Left JOIN AppUser c ON c.ID_User = SaleOutDepotBill.LastModUser_SaleOutDepotBill
  1504. LEFT JOIN Location ON Location.ID_Location = SaleOutDepotBill.ID_Location
  1505. WHERE No_SaleOutDepotBill = @SaleOutDepotBillNo
  1506. SELECT SaleOutDepotBillProduct.*
  1507. ,BillType.Name_BillType AS Name_FromBill
  1508. ,No_FromBill AS No_SaleOutDepotBill
  1509. ,Product.No_Product,Product.Name_Product
  1510. ,Product.Unit_Product,Product.Name_Product AS No_SaleOutDepotBill
  1511. ,Location.Name_Location, Location.ID_Location
  1512. ,Location.No_Location
  1513. FROM SaleOutDepotBillProduct
  1514. LEFT JOIN BillType ON BillType.Value_BillType=SaleOutDepotBillProduct.Type_FromBill
  1515. LEFT JOIN Location ON Location.ID_Location=SaleOutDepotBillProduct.ID_Location
  1516. LEFT JOIN Product ON SaleOutDepotBillProduct.ID_Product=Product.ID_Product
  1517. WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBill=@ID_SaleOutDepotBill
  1518. ORDER BY CAST(No_SaleOutDepotBillProduct AS INT)
  1519. SELECT BillComment.*
  1520. FROM BillComment
  1521. WHERE ID_Bill=@ID_SaleOutDepotBill
  1522. order by BillComment.No_BillComment
  1523. SELECT ReportComment.*,@SaleOutDepotBillNo as No_SaleOutDepotBill
  1524. FROM ReportComment
  1525. WHERE ID_Bill=@ID_SaleOutDepotBill
  1526. Order by ReportComment.No_ReportComment
  1527. ">
  1528. <Params>
  1529. <Param name="@No_SaleOutDepotBill" type="SaleOutDepotBill.No_SaleOutDepotBill" Index="0" />
  1530. </Params>
  1531. <Tables>
  1532. <Table name="SaleOutDepotBill" />
  1533. <Table name="SaleOutDepotBillProduct" />
  1534. <Table name="BillComment" />
  1535. <Table name="ReportComment" />
  1536. </Tables>
  1537. </SearchSaleOutDepotBillFirst>
  1538. <SearchSaleOutDepotBillPrevious CmdType="Text" CmdText="DECLARE @SaleOutDepotBillNo nvarchar(64)
  1539. DECLARE @ID_SaleOutDepotBill uniqueidentifier
  1540. SELECT TOP 1 @ID_SaleOutDepotBill = ID_SaleOutDepotBill,@SaleOutDepotBillNo = SaleOutDepotBill.No_SaleOutDepotBill FROM SaleOutDepotBill WHERE SaleOutDepotBill.No_SaleOutDepotBill &lt; @No_SaleOutDepotBill ORDER BY SaleOutDepotBill.No_SaleOutDepotBill DESC
  1541. SELECT SaleOutDepotBill.*,a.Name_User,b.Name_User as Name_UserAuti,c.Name_User as Name_LastModUser,
  1542. Location.Name_Location,Location.No_Location,Customer.Name_Customer, Customer.ShortName_Customer,Customer.No_Customer
  1543. FROM SaleOutDepotBill
  1544. LEFT JOIN Customer ON Customer.ID_Customer = SaleOutDepotBill.ID_Customer
  1545. LEFT JOIN AppUser a ON a.ID_User = SaleOutDepotBill.ID_Creator
  1546. LEFT JOIN AppUser b ON b.ID_User = SaleOutDepotBill.ID_Assessor
  1547. Left JOIN AppUser c ON c.ID_User = SaleOutDepotBill.LastModUser_SaleOutDepotBill
  1548. LEFT JOIN Location ON Location.ID_Location = SaleOutDepotBill.ID_Location
  1549. WHERE No_SaleOutDepotBill = @SaleOutDepotBillNo
  1550. SELECT SaleOutDepotBillProduct.*,
  1551. BillType.Name_BillType AS Name_FromBill,
  1552. No_FromBill AS No_SaleOutDepotBill,
  1553. Product.No_Product,
  1554. Product.Name_Product,
  1555. Product.Unit_Product, Product.Name_Product AS No_SaleOutDepotBill,
  1556. Location.Name_Location, Location.ID_Location,Location.No_Location
  1557. FROM SaleOutDepotBillProduct
  1558. LEFT JOIN BillType ON BillType.Value_BillType=SaleOutDepotBillProduct.Type_FromBill
  1559. LEFT JOIN Location ON Location.ID_Location=SaleOutDepotBillProduct.ID_Location
  1560. LEFT JOIN Product ON SaleOutDepotBillProduct.ID_Product=Product.ID_Product
  1561. WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBill=@ID_SaleOutDepotBill
  1562. ORDER BY CAST(No_SaleOutDepotBillProduct AS INT)
  1563. SELECT BillComment.*
  1564. FROM BillComment
  1565. WHERE ID_Bill=@ID_SaleOutDepotBill
  1566. order by BillComment.No_BillComment
  1567. SELECT ReportComment.*,@SaleOutDepotBillNo as No_SaleOutDepotBill
  1568. FROM ReportComment
  1569. WHERE ID_Bill=@ID_SaleOutDepotBill
  1570. Order by ReportComment.No_ReportComment
  1571. ">
  1572. <Params>
  1573. <Param name="@No_SaleOutDepotBill" type="SaleOutDepotBill.No_SaleOutDepotBill" Index="0" />
  1574. </Params>
  1575. <Tables>
  1576. <Table name="SaleOutDepotBill" />
  1577. <Table name="SaleOutDepotBillProduct" />
  1578. <Table name="BillComment" />
  1579. <Table name="ReportComment" />
  1580. </Tables>
  1581. </SearchSaleOutDepotBillPrevious>
  1582. <SearchSaleOutDepotBillNext CmdType="Text" CmdText="DECLARE @SaleOutDepotBillNo nvarchar(64)
  1583. DECLARE @ID_SaleOutDepotBill uniqueidentifier
  1584. SELECT TOP 1 @ID_SaleOutDepotBill = ID_SaleOutDepotBill, @SaleOutDepotBillNo = SaleOutDepotBill.No_SaleOutDepotBill FROM SaleOutDepotBill WHERE SaleOutDepotBill.No_SaleOutDepotBill &gt; @No_SaleOutDepotBill ORDER BY SaleOutDepotBill.No_SaleOutDepotBill
  1585. SELECT SaleOutDepotBill.*,a.Name_User,b.Name_User as Name_UserAuti,c.Name_User as Name_LastModUser,
  1586. Location.Name_Location,Location.No_Location ,Customer.Name_Customer, Customer.ShortName_Customer,Customer.No_Customer
  1587. FROM SaleOutDepotBill
  1588. LEFT JOIN Customer ON Customer.ID_Customer = SaleOutDepotBill.ID_Customer
  1589. LEFT JOIN AppUser a ON a.ID_User = SaleOutDepotBill.ID_Creator
  1590. LEFT JOIN AppUser b ON b.ID_User = SaleOutDepotBill.ID_Assessor
  1591. LEFT JOIN AppUser c ON c.ID_User = SaleOutDepotBill.LastModUser_SaleOutDepotBill
  1592. LEFT JOIN Location ON Location.ID_Location = SaleOutDepotBill.ID_Location
  1593. WHERE No_SaleOutDepotBill = @SaleOutDepotBillNo
  1594. SELECT SaleOutDepotBillProduct.*,
  1595. BillType.Name_BillType AS Name_FromBill,
  1596. No_FromBill AS No_SaleOutDepotBill,
  1597. Product.No_Product,
  1598. Product.Name_Product,
  1599. Product.Unit_Product, Product.Name_Product AS No_SaleOutDepotBill,
  1600. Location.Name_Location, Location.ID_Location,Location.No_Location
  1601. FROM SaleOutDepotBillProduct
  1602. LEFT JOIN BillType ON BillType.Value_BillType=SaleOutDepotBillProduct.Type_FromBill
  1603. LEFT JOIN Location ON Location.ID_Location=SaleOutDepotBillProduct.ID_Location
  1604. LEFT JOIN Product ON SaleOutDepotBillProduct.ID_Product=Product.ID_Product
  1605. WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBill=@ID_SaleOutDepotBill
  1606. ORDER BY CAST(No_SaleOutDepotBillProduct AS INT)
  1607. SELECT BillComment.*
  1608. FROM BillComment
  1609. WHERE ID_Bill=@ID_SaleOutDepotBill
  1610. order by BillComment.No_BillComment
  1611. SELECT ReportComment.*,@SaleOutDepotBillNo as No_SaleOutDepotBill
  1612. FROM ReportComment
  1613. WHERE ID_Bill=@ID_SaleOutDepotBill
  1614. Order by ReportComment.No_ReportComment
  1615. ">
  1616. <Params>
  1617. <Param name="@No_SaleOutDepotBill" type="SaleOutDepotBill.No_SaleOutDepotBill" Index="0" />
  1618. </Params>
  1619. <Tables>
  1620. <Table name="SaleOutDepotBill" />
  1621. <Table name="SaleOutDepotBillProduct" />
  1622. <Table name="BillComment" />
  1623. <Table name="ReportComment" />
  1624. </Tables>
  1625. </SearchSaleOutDepotBillNext>
  1626. <SearchSaleOutDepotBillLast CmdType="Text" CmdText=" DECLARE @SaleOutDepotBillNo nvarchar(64)
  1627. DECLARE @ID_SaleOutDepotBill uniqueidentifier
  1628. SELECT TOP 1 @ID_SaleOutDepotBill = SaleOutDepotBill.ID_SaleOutDepotBill,@SaleOutDepotBillNo = SaleOutDepotBill.No_SaleOutDepotBill FROM SaleOutDepotBill ORDER BY SaleOutDepotBill.No_SaleOutDepotBill DESC
  1629. SELECT SaleOutDepotBill.*,a.Name_User,b.Name_User as Name_UserAuti,c.Name_User as Name_LastModUser,
  1630. Location.Name_Location,Location.No_Location , Customer.Name_Customer, Customer.ShortName_Customer,Customer.No_Customer
  1631. FROM SaleOutDepotBill
  1632. LEFT JOIN Customer ON Customer.ID_Customer = SaleOutDepotBill.ID_Customer
  1633. LEFT JOIN AppUser a ON a.ID_User = SaleOutDepotBill.ID_Creator
  1634. LEFT JOIN AppUser b ON b.ID_User = SaleOutDepotBill.ID_Assessor
  1635. Left JOIN AppUser c ON c.ID_User = SaleOutDepotBill.LastModUser_SaleOutDepotBill
  1636. LEFT JOIN Location ON Location.ID_Location = SaleOutDepotBill.ID_Location
  1637. WHERE No_SaleOutDepotBill = @SaleOutDepotBillNo
  1638. SELECT SaleOutDepotBillProduct.*,
  1639. BillType.Name_BillType AS Name_FromBill,
  1640. No_FromBill AS No_SaleOutDepotBill,
  1641. Product.No_Product,
  1642. Product.Name_Product,
  1643. Product.Unit_Product, Product.Name_Product AS No_SaleOutDepotBill,
  1644. Location.Name_Location, Location.ID_Location,Location.No_Location
  1645. FROM SaleOutDepotBillProduct
  1646. LEFT JOIN BillType ON BillType.Value_BillType=SaleOutDepotBillProduct.Type_FromBill
  1647. LEFT JOIN Location ON Location.ID_Location=SaleOutDepotBillProduct.ID_Location
  1648. LEFT JOIN Product ON SaleOutDepotBillProduct.ID_Product=Product.ID_Product
  1649. WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBill=@ID_SaleOutDepotBill
  1650. ORDER BY CAST(No_SaleOutDepotBillProduct AS INT)
  1651. SELECT BillComment.*
  1652. FROM BillComment
  1653. WHERE ID_Bill=@ID_SaleOutDepotBill
  1654. order by BillComment.No_BillComment
  1655. SELECT ReportComment.*,@SaleOutDepotBillNo as No_SaleOutDepotBill
  1656. FROM ReportComment
  1657. WHERE ID_Bill=@ID_SaleOutDepotBill
  1658. Order by ReportComment.No_ReportComment
  1659. ">
  1660. <Tables>
  1661. <Table name="SaleOutDepotBill" />
  1662. <Table name="SaleOutDepotBillProduct" />
  1663. <Table name="BillComment" />
  1664. <Table name="ReportComment" />
  1665. </Tables>
  1666. </SearchSaleOutDepotBillLast>
  1667. <SearchQuantity CmdType="Text" CmdText="SELECT Quantity_Sale,Quantity_SaleRtn FROM SaleSourceBillProduct WHERE ID_SaleSourceBillProduct=@ID_SaleSourceBillProduct">
  1668. <Params>
  1669. <Param name="@ID_SaleSourceBillProduct" type="SaleSourceBillProduct.ID_SaleSourceBillProduct"
  1670. Index="0" />
  1671. </Params>
  1672. <Tables>
  1673. <Table name="Quantity" />
  1674. </Tables>
  1675. </SearchQuantity>
  1676. <SearchAllCustomer CmdType="Text" CmdText="SELECT Customer.No_Customer,Customer.ShortName_Customer,Customer.Type_Customer,Customer.Level_Customer,Customer.IsGeneric_Customer FROM Customer ">
  1677. <Tables>
  1678. <Table name="AllCustomer" />
  1679. </Tables>
  1680. </SearchAllCustomer>
  1681. <SearchCustomerWithNo CmdType="Text" CmdText=" SELECT Customer.ID_Customer, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer,SuspendDate_Customer
  1682. FROM Customer WHERE Customer.No_Customer = @No_Customer
  1683. ">
  1684. <Params>
  1685. <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
  1686. </Params>
  1687. <Tables>
  1688. <Table name="Customer" />
  1689. </Tables>
  1690. </SearchCustomerWithNo>
  1691. <SearchID_Customer CmdType="Text" CmdText=" SELECT SaleBill.ID_Customer
  1692. FROM SaleBill WHERE SaleBill.No_SaleBill = @No_SaleBill">
  1693. <Params>
  1694. <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" Index="0" />
  1695. </Params>
  1696. <Tables>
  1697. <Table name="SaleBillCustomer" />
  1698. </Tables>
  1699. </SearchID_Customer>
  1700. <SearchAllSaleBill CmdType="Text" CmdText="Select SaleBill.OutStatus_SaleBill,SaleBill.TaxCurrency_SaleBill, SaleBill.Currency_SaleBill,SaleBill.ID_SaleBill,SaleBill.No_SaleBill,SaleBill.Date_SaleBill,Customer.No_Customer,Customer.ShortName_Customer,Case When SaleBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_SaleBill,Location.Name_Location From SaleBill
  1701. Inner Join Customer On SaleBill.ID_Customer = Customer.ID_Customer
  1702. Inner Join Location On Location.ID_Location = SaleBill.ID_Location WHERE SaleBill.Disable_SaleBill = 0">
  1703. <Tables>
  1704. <Table name="AllSaleBill" />
  1705. </Tables>
  1706. </SearchAllSaleBill>
  1707. <SearchAllSaleBillProduct CmdType="Text" CmdText="Select Product.No_Product,SaleBillProduct.No_SaleBillProduct,Product.Name_Product,SaleBillProduct.Quantity_SaleBillProduct,SaleBillProduct.UnitPrice_SaleBillProduct,Comment_SaleBillProduct From SaleBillProduct
  1708. Inner Join Product On Product.ID_Product = SaleBillProduct.ID_Product
  1709. Inner Join SaleBill On SaleBill.ID_SaleBill =SaleBillProduct.ID_SaleBill">
  1710. <Tables>
  1711. <Table name="AllSaleBillProduct" />
  1712. </Tables>
  1713. </SearchAllSaleBillProduct>
  1714. <SearchStockSettle CmdType="Text" CmdText="
  1715. Select * From StockSettleAccounts
  1716. Where DateDiff(Day,@Date_SaleOutDepotBill,FromDate_StockSettleAccounts) &lt;=0
  1717. And DateDiff(Day,@Date_SaleOutDepotBill,EndDate_StockSettleAccounts) &gt;=0
  1718. And Status_StockSettleAccounts=0
  1719. ">
  1720. <Params>
  1721. <Param name="@Date_SaleOutDepotBill" type="PurchaseInDepotBill.Date_SaleOutDepotBill" Index="0" />
  1722. </Params>
  1723. <Tables>
  1724. <Table name="StockSettle" />
  1725. </Tables>
  1726. </SearchStockSettle>
  1727. <SearchTypeComment CmdType="Text" CmdText="
  1728. declare @SRemark1_FunctionSetting int
  1729. declare @SRemark2_FunctionSetting int
  1730. Select @SRemark1_FunctionSetting = SRemark1_FunctionSetting, @SRemark2_FunctionSetting = SRemark2_FunctionSetting
  1731. from FunctionSetting
  1732. declare @ID_SaleOutDepotBill uniqueidentifier
  1733. declare @flag int
  1734. set @flag = 0
  1735. if @SRemark1_FunctionSetting = 0
  1736. begin
  1737. select top 1 @ID_SaleOutDepotBill = SaleOutDepotBill.ID_SaleOutDepotBill
  1738. from SaleOutDepotBill
  1739. where ID_Customer = @ID_Customer
  1740. order by SaleOutDepotBill.Date_SaleOutDepotBill desc
  1741. if exists(select ReportComment.* from ReportComment where ReportComment.ID_Bill = @ID_SaleOutDepotBill)
  1742. begin
  1743. select ReportComment.Comment_ReportComment from ReportComment where ReportComment.ID_Bill = @ID_SaleOutDepotBill
  1744. order by ReportComment.No_ReportComment
  1745. set @flag = 1
  1746. end
  1747. end
  1748. else
  1749. begin
  1750. if exists(SELECT Name_TypeDef FROM TypeDef WHERE Type_TypeDef=26 )
  1751. begin
  1752. SELECT Name_TypeDef as Comment_ReportComment FROM TypeDef WHERE Type_TypeDef=26
  1753. set @flag = 1
  1754. end
  1755. end
  1756. if @flag = 0
  1757. begin
  1758. if @SRemark2_FunctionSetting = 0
  1759. begin
  1760. select top 1 @ID_SaleOutDepotBill = SaleOutDepotBill.ID_SaleOutDepotBill
  1761. from SaleOutDepotBill
  1762. where ID_Customer = @ID_Customer
  1763. order by SaleOutDepotBill.Date_SaleOutDepotBill desc
  1764. select ReportComment.Comment_ReportComment from ReportComment where ReportComment.ID_Bill = @ID_SaleOutDepotBill
  1765. order by ReportComment.No_ReportComment
  1766. end
  1767. else
  1768. begin
  1769. SELECT Name_TypeDef as Comment_BillComment FROM TypeDef WHERE Type_TypeDef=26
  1770. end
  1771. end
  1772. ">
  1773. <Params>
  1774. <Param name="@ID_Customer" type="SaleOutDepotBill.ID_Customer" Index="0" />
  1775. </Params>
  1776. <Tables>
  1777. <Table name="TypeComment" />
  1778. </Tables>
  1779. </SearchTypeComment>
  1780. <SearchSaleRtn CmdType="Text" CmdText="
  1781. Select Sum(RtnQuantity_SaleOutDepotBillProduct) As RtnQuantity_SaleOutDepotBillProduct
  1782. FROM SaleOutDepotBillProduct
  1783. WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBill = @ID_SaleOutDepotBill
  1784. Select Count(*) As Num
  1785. From SaleOutDepotBillProduct
  1786. LEFT JOIN SaleSourceBillProduct ON SaleSourceBillProduct.ID_SaleSourceBillProduct=SaleOutDepotBillProduct.ID_SaleSourceBillProduct
  1787. Where ID_SaleOutDepotBill=@ID_SaleOutDepotBill And (Quantity_OutDepot-Quantity_SaleRtn-Quantity_SaleOutDepotBillProduct) &lt; 0
  1788. ">
  1789. <Params>
  1790. <Param name="@ID_SaleOutDepotBill" type="SaleOutDepotBill.ID_SaleOutDepotBill" Index="0" />
  1791. </Params>
  1792. <Tables>
  1793. <Table name="SaleRtn" />
  1794. <Table name="SaleRtnFromSaleBill" />
  1795. </Tables>
  1796. </SearchSaleRtn>
  1797. <SearchStatusWithNo CmdType="Text" CmdText="Select Check_SaleOutDepotBill From SaleOutDepotBill Where No_SaleOutDepotBill = @No_SaleOutDepotBill">
  1798. <Params>
  1799. <Param name="@No_SaleOutDepotBill" type="SaleOutDepotBill.No_SaleOutDepotBill" Index="0" />
  1800. </Params>
  1801. <Tables>
  1802. <Table name="Status" />
  1803. </Tables>
  1804. </SearchStatusWithNo>
  1805. <SearchCheck CmdType="Text" CmdText="Select Check_SaleOutDepotBill From SaleOutDepotBill Where No_SaleOutDepotBill = @No_SaleOutDepotBill">
  1806. <Params>
  1807. <Param name="@No_SaleOutDepotBill" type="SaleOutDepotBill.No_SaleOutDepotBill" Index="0" />
  1808. </Params>
  1809. <Tables>
  1810. <Table name="Check" />
  1811. </Tables>
  1812. </SearchCheck>
  1813. <SearchOneLocation CmdType="" CmdText=" SELECT Top 1 Location.ID_Location,No_Location,Name_Location FROM ProductStocks LEFT JOIN Location ON ProductStocks.ID_Location = Location.ID_Location
  1814. WHERE ID_Product = @ID_Product AND SubjectionID_Location is not Null And Mark_ProductStocks = 1">
  1815. <Params>
  1816. <Param name="@ID_Product" type="SaleOutDepotBillProduct.ID_Product" Index="0" />
  1817. </Params>
  1818. <Tables>
  1819. <Table name="OneLocation" />
  1820. </Tables>
  1821. </SearchOneLocation>
  1822. <SearchCreateDate CmdType="Text" CmdText=" Select CONVERT(varchar(100), CreateDate_SaleOutDepotBill, 23) as CreateDate_SaleOutDepotBill
  1823. , CONVERT(varchar(100), @CurrentDate, 23) as CurrentDate
  1824. From SaleOutDepotBill
  1825. Where No_SaleOutDepotBill=@No_SaleOutDepotBill
  1826. ">
  1827. <Params>
  1828. <Param name="@No_SaleOutDepotBill" type="SaleOutDepotBill.No_SaleOutDepotBill" Index="0" />
  1829. <Param name="@CurrentDate" type="SaleOutDepotBill.CreateDate_SaleOutDepotBill" Index="1" />
  1830. </Params>
  1831. <Tables>
  1832. <Table name="searchcreatedate" />
  1833. </Tables>
  1834. </SearchCreateDate>
  1835. </Search>
  1836. </Server>
  1837. <Lables>
  1838. <Search>
  1839. Empty();
  1840. NewInstance();
  1841. @ImportClicked = 0;
  1842. timeMake.Enabled =false;
  1843. tbNo.ReadOnly =false;
  1844. cbLocation.Enabled =false;
  1845. dgProduct.ReadOnly =true;
  1846. dgRemark.ReadOnly =true;
  1847. dgReportComment.ReadOnly =true;
  1848. tbCustomerNo.ReadOnly =true;
  1849. toolBar.EnableSubmit =false;
  1850. toolBar.EnableModify =false;
  1851. toolBar.EnableDelete =false;
  1852. toolBar.EnableAudit =false;
  1853. toolBar.EnableUnAudit =false;
  1854. toolBar.EnableNew =GetRight(@Title,"新增");
  1855. toolBar.EnablePrint =false;
  1856. toolBar.EnablePrintBarCode =false;
  1857. toolBar.EnableExport = false;
  1858. toolBar.EnableImport = false;
  1859. toolBar.EnableCheck =true;
  1860. #SaleOutDepotBill.AssessDate_SaleOutDepotBill =DBNull();
  1861. #SaleOutDepotBill.ID_Assessor =DBNull();
  1862. #SaleOutDepotBill.ID_Creator =DBNull();
  1863. #SaleOutDepotBill.LastModUser_SaleOutDepotBill =DBNull();
  1864. #SaleOutDepotBill.LastModDate_SaleOutDepotBill =DBNull();
  1865. ikNumericTextBox1.CValue = 0;
  1866. UpdateForm(true,"");
  1867. tbNo.Focus();
  1868. @Status=0;
  1869. btnDelete.Enabled = false;
  1870. </Search>
  1871. <New>
  1872. Empty();
  1873. NewInstance();
  1874. @ImportClicked = 0;
  1875. timeMake.Enabled =true;
  1876. tbCustomerNo.ReadOnly = false;
  1877. tbNo.ReadOnly =true;
  1878. cbLocation.Enabled =true;
  1879. dgProduct.ReadOnly =false;
  1880. dgRemark.ReadOnly =false;
  1881. dgReportComment.ReadOnly =false;
  1882. toolBar.EnableSubmit =GetRight(@Title,"新增");
  1883. toolBar.EnableModify =false;
  1884. toolBar.EnableDelete =false;
  1885. toolBar.EnableAudit =false;
  1886. toolBar.EnableUnAudit =false;
  1887. toolBar.EnableNew =false;
  1888. toolBar.EnablePrint =false;
  1889. toolBar.EnablePrintBarCode =false;
  1890. toolBar.EnableExport = false;
  1891. toolBar.EnableImport = true;
  1892. toolBar.EnableCheck = false;
  1893. #SaleOutDepotBill.ID_SaleOutDepotBill =NewGuid();
  1894. #SaleOutDepotBill.ID_Creator =GetLoginUserID();
  1895. #SaleOutDepotBill.Name_User =GetCurrentUser();
  1896. #SaleOutDepotBill.AssessDate_SaleOutDepotBill =DBNull();
  1897. #SaleOutDepotBill.ID_Assessor =DBNull();
  1898. #SaleOutDepotBill.LastModUser_SaleOutDepotBill =DBNull();
  1899. #SaleOutDepotBill.Name_LastModUser =DBNull();
  1900. #SaleOutDepotBill.LastModDate_SaleOutDepotBill =DBNull();
  1901. #SaleOutDepotBill.ID_Location =GetCurrentDepotID();
  1902. #SaleOutDepotBill.Name_Location =GetCurrentDepot();
  1903. #SaleOutDepotBill.No_Location =GetCurrentDepotNo();
  1904. #SaleOutDepotBill.Date_SaleOutDepotBill =GetCurrentTime();
  1905. ikNumericTextBox1.CValue = 0;
  1906. dgProduct.SetColumnReadOnly(1, false);
  1907. dgProduct.SetColumnReadOnly(2, false);
  1908. dgProduct.SetColumnReadOnly(3, false);
  1909. dgProduct.SetColumnReadOnly(4, false);
  1910. dgProduct.RowHeaderCheck=true;
  1911. dgProduct.AllowNew(true);
  1912. dgProduct.AllowDelete(true);
  1913. UpdateForm(true,"");
  1914. timeMake.Focus();
  1915. @Status=1;
  1916. btnDelete.Enabled = false;
  1917. </New>
  1918. <View>
  1919. @ImportClicked = 0;
  1920. timeMake.Enabled =false;
  1921. tbCustomerNo.ReadOnly =true;
  1922. tbNo.ReadOnly =false;
  1923. cbLocation.Enabled =false;
  1924. dgProduct.ReadOnly =true;
  1925. dgRemark.ReadOnly =true;
  1926. dgReportComment.ReadOnly =true;
  1927. toolBar.EnableSubmit =false;
  1928. toolBar.EnableNew =GetRight(@Title,"新增");
  1929. if(Search("SearchStockSettle",#SaleOutDepotBill.Date_SaleOutDepotBill))
  1930. {
  1931. if(Equals(#SaleOutDepotBill.ID_Assessor, DBNull()))
  1932. {
  1933. if(#SaleOutDepotBill.Disable_SaleOutDepotBill==false)
  1934. {
  1935. toolBar.EnableAudit=GetRight(@Title,"审核");
  1936. toolBar.EnableModify=GetRight(@Title,"修改");
  1937. toolBar.EnableDelete=GetRight(@Title,"删除");
  1938. }
  1939. else
  1940. {
  1941. toolBar.EnableAudit = false;
  1942. toolBar.EnableModify = false;
  1943. toolBar.EnableDelete = false;
  1944. }
  1945. toolBar.EnableUnAudit = false;
  1946. btnDelete.Enabled = false;
  1947. toolBar.EnablePrintBarCode=false;
  1948. }
  1949. else
  1950. {
  1951. toolBar.EnableAudit=false;
  1952. toolBar.EnableUnAudit=GetRight(@Title,"取消审核");
  1953. toolBar.EnableModify=false;
  1954. toolBar.EnableDelete=false;
  1955. btnDelete.Enabled = GetRight(@Title,"取消审核")&amp;&amp;GetRight(@Title,"删除");
  1956. toolBar.EnablePrintBarCode=GetRight(@Title,"打印");
  1957. }
  1958. toolBar.EnablePrint =GetRight(@Title,"打印");
  1959. }
  1960. else
  1961. {
  1962. toolBar.EnablePrintBarCode=false;
  1963. toolBar.EnableAudit=false;
  1964. toolBar.EnableUnAudit=false;
  1965. toolBar.EnableModify=false;
  1966. toolBar.EnableDelete=false;
  1967. btnDelete.Enabled = false;
  1968. }
  1969. toolBar.EnablePrint = GetRight(@Title,"打印");
  1970. toolBar.EnableExport = true;
  1971. toolBar.EnableImport = false;
  1972. if(Search("SearchCreateDate",#SaleOutDepotBill.No_SaleOutDepotBill,GetCurrentTime()))
  1973. {
  1974. if(!Equals(#searchcreatedate.CreateDate_SaleOutDepotBill,#searchcreatedate.CurrentDate))
  1975. toolBar.EnableCheck = false;
  1976. else
  1977. toolBar.EnableCheck = true;
  1978. }
  1979. <!--toolBar.EnableCheck = true;-->
  1980. UpdateForm(true, "");
  1981. @Status=2;
  1982. </View>
  1983. <Modify>
  1984. @ImportClicked = 0;
  1985. timeMake.Enabled =false;
  1986. tbNo.ReadOnly =true;
  1987. tbCustomerNo.ReadOnly =false;
  1988. cbLocation.Enabled =true;
  1989. dgProduct.ReadOnly =false;
  1990. dgRemark.ReadOnly =false;
  1991. dgReportComment.ReadOnly =false;
  1992. toolBar.EnableSubmit =GetRight(@Title,"修改");
  1993. toolBar.EnableModify =false;
  1994. toolBar.EnableDelete =false;
  1995. toolBar.EnableAudit =false;
  1996. toolBar.EnableUnAudit =false;
  1997. toolBar.EnableNew =false;
  1998. toolBar.EnablePrint =false;
  1999. toolBar.EnablePrintBarCode =false;
  2000. toolBar.EnableExport = false;
  2001. toolBar.EnableImport = false;
  2002. toolBar.EnableCheck = false;
  2003. #SaleOutDepotBill.LastModUser_SaleOutDepotBill =GetLoginUserID();
  2004. #SaleOutDepotBill.Name_LastModUser =GetCurrentUser();
  2005. #SaleOutDepotBill.LastModDate_SaleOutDepotBill =DateTimeNow();
  2006. @HaveAccessed = !Equals(#SaleOutDepotBill.AssessDate_SaleOutDepotBill,DBNull());
  2007. dgProduct.SetColumnReadOnly(1, @HaveAccessed);
  2008. dgProduct.SetColumnReadOnly(2, @HaveAccessed);
  2009. dgProduct.SetColumnReadOnly(3, @HaveAccessed);
  2010. dgProduct.SetColumnReadOnly(4, @HaveAccessed);
  2011. dgProduct.AllowNew(!@HaveAccessed);
  2012. dgProduct.AllowDelete(!@HaveAccessed);
  2013. dgProduct.RowHeaderCheck=!@HaveAccessed;
  2014. @HaveAccessed = !Equals(#SaleOutDepotBill.AssessDate_SaleOutDepotBill,DBNull());
  2015. UpdateForm(true, "");
  2016. @Status=3;
  2017. btnDelete.Enabled = false;
  2018. </Modify>
  2019. <SubmitButtonClick>
  2020. <![CDATA[
  2021. if(!Search("SearchStockSettle",timeMake.Value))
  2022. {
  2023. MessageBox("制单日期不在开帐区间内,提交失败!");
  2024. return;
  2025. }
  2026. if (!cbLocation.CheckSelectedItem())
  2027. {
  2028. MessageBox("请选择有效的出货仓库!",@Title);
  2029. cbLocation.Focus();
  2030. return;
  2031. }
  2032. if(RowCount("#SaleOutDepotBillProduct")==0)
  2033. {
  2034. MessageBox("请输入出库产品!",@Title);
  2035. dgProduct.Focus();
  2036. return;
  2037. }
  2038. if(@SaleAndOutDepot == true)
  2039. {
  2040. if(tbCustomerNo.CValue == "")
  2041. {
  2042. MessageBox("请填入客户编号!",@Title);
  2043. tbCustomerNo.Focus();
  2044. return;
  2045. }
  2046. }
  2047. UpdateForm(false, "");
  2048. SuspendLayout();
  2049. for (@i=0;@i<=RowCount("#SaleOutDepotBillProduct")-1;@i=@i+1)
  2050. {
  2051. SetPosition("#SaleOutDepotBillProduct", @i);
  2052. if(@SaleAndOutDepot == true)
  2053. {
  2054. if (Equals(#SaleOutDepotBillProduct.Name_FromBill,DBNull()) || Equals(#SaleOutDepotBillProduct.Name_FromBill,""))
  2055. {
  2056. dgProduct.CurrentRowIndex = @i;
  2057. MessageBox("请选择来源单据!",@Title);
  2058. dgProduct.Focus();
  2059. ResumeLayout();
  2060. return;
  2061. }
  2062. if(Equals(#SaleOutDepotBillProduct.No_FromBill,DBNull()) || #SaleOutDepotBillProduct.No_FromBill=="")
  2063. {
  2064. dgProduct.CurrentRowIndex = @i;
  2065. MessageBox("请输入来源单据单号!",@Title);
  2066. dgProduct.Focus();
  2067. ResumeLayout();
  2068. return;
  2069. }
  2070. if(Equals(#SaleOutDepotBillProduct.No_FromBillProduct,DBNull()) || #SaleOutDepotBillProduct.No_FromBillProduct=="")
  2071. {
  2072. dgProduct.CurrentRowIndex = @i;
  2073. MessageBox("请输入来源单据产品序号!",@Title);
  2074. dgProduct.Focus();
  2075. ResumeLayout();
  2076. return;
  2077. }
  2078. if(!Search("SearchNo_SaleBillProduct",#SaleOutDepotBillProduct.No_FromBill,#SaleOutDepotBillProduct.No_FromBillProduct))
  2079. {
  2080. dgProduct.CurrentRowIndex = @i;
  2081. MessageBox("该来源信息有误,请确认!",@Title);
  2082. dgProduct.Focus();
  2083. ResumeLayout();
  2084. return;
  2085. }
  2086. if(!Equals(#NoSBProduct.ID_Product,#SaleOutDepotBillProduct.ID_Product))
  2087. {
  2088. dgProduct.CurrentRowIndex = @i;
  2089. MessageBox("该来源单据产品单中指定的产品与后改写的产品不匹配!",@Title);
  2090. dgProduct.Focus();
  2091. ResumeLayout();
  2092. return;
  2093. }
  2094. if(!Equals(#SaleOutDepotBillProduct.No_FromBill,"") && #SaleOutDepotBillProduct.Type_FromBill!=0 && Search("SearchSaleBillAuditWithNo",#SaleOutDepotBillProduct.No_FromBill))
  2095. {
  2096. if(Equals(#SaleBillAudit.ID_Assessor,DBNull()))
  2097. {
  2098. dgProduct.CurrentRowIndex = @i;
  2099. if(MessageBox("该来源单据未经审核,确定要提交吗?",@Title,MB_OKCANCEL)==DialogResult("CANCEL"))
  2100. {
  2101. dgProduct.Focus();
  2102. ResumeLayout();
  2103. return;
  2104. }
  2105. }
  2106. }
  2107. if(Search("SearchID_Customer",#SaleOutDepotBillProduct.No_FromBill))
  2108. {
  2109. if(!Equals(#SaleOutDepotBill.ID_Customer,#SaleBillCustomer.ID_Customer))
  2110. {
  2111. dgProduct.CurrentRowIndex = @i;
  2112. MessageBox("该来源单据的客户与本单据的客户不一致,请检查!",@Title);
  2113. dgProduct.Focus();
  2114. ResumeLayout();
  2115. return;
  2116. }
  2117. }
  2118. }
  2119. else
  2120. {
  2121. if(#SaleOutDepotBillProduct.Type_FromBill != 0 && #SaleOutDepotBillProduct.No_FromBill != "" && Search("SearchSaleBillAuditWithNo",#SaleOutDepotBillProduct.No_FromBill))
  2122. {
  2123. if(Equals(#SaleBillAudit.ID_Assessor,DBNull()))
  2124. {
  2125. dgProduct.CurrentRowIndex = @i;
  2126. @DialogResult=MessageBox("该来源单据未经审核,确定要保留来源单据资料吗?",@Title,MB_YESNOCANCEL);
  2127. if(@DialogResult==DialogResult("NO"))
  2128. {
  2129. #SaleOutDepotBillProduct.Type_FromBill = 0;
  2130. #SaleOutDepotBillProduct.Name_FromBill = "";
  2131. #SaleOutDepotBillProduct.No_FromBill = "";
  2132. #SaleOutDepotBillProduct.No_FromBillProduct = "";
  2133. }
  2134. if(@DialogResult==DialogResult("CANCEL"))
  2135. {
  2136. dgProduct.Focus();
  2137. ResumeLayout();
  2138. return;
  2139. }
  2140. }
  2141. }
  2142. if (Equals(#SaleOutDepotBillProduct.No_Product,""))
  2143. {
  2144. dgProduct.CurrentRowIndex = @i;
  2145. MessageBox("请输入产品编号!",@Title);
  2146. dgProduct.Focus();
  2147. ResumeLayout();
  2148. return;
  2149. }
  2150. if(Equals(#SaleOutDepotBillProduct.ID_Product,GuidEmpty()))
  2151. {
  2152. dgProduct.CurrentRowIndex = @i;
  2153. MessageBox("该产品不存在!",@Title);
  2154. dgProduct.Focus();
  2155. ResumeLayout();
  2156. return;
  2157. }
  2158. }
  2159. if(Equals(#SaleOutDepotBillProduct.ID_Location,DBNull()) || Equals(#SaleOutDepotBillProduct.ID_Location,GuidEmpty()))
  2160. {
  2161. dgProduct.CurrentRowIndex = @i;
  2162. MessageBox("请输入有效的出库库位!",@Title);
  2163. dgProduct.Focus();
  2164. ResumeLayout();
  2165. return;
  2166. }
  2167. if(!Search("SearchJudgeLocationAndWarehouse",#SaleOutDepotBill.ID_Location,#SaleOutDepotBillProduct.ID_Location))
  2168. {
  2169. dgProduct.CurrentRowIndex = @i;
  2170. MessageBox("该库位不属于所选仓库,请重新选择!",@Title);
  2171. dgProduct.Focus();
  2172. ResumeLayout();
  2173. return;
  2174. }
  2175. if(#SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct<=0)
  2176. {
  2177. dgProduct.CurrentRowIndex = @i;
  2178. MessageBox("数量不得小于等于0!",@Title);
  2179. dgProduct.Focus();
  2180. ResumeLayout();
  2181. return;
  2182. }
  2183. if (Equals(#SaleOutDepotBillProduct.ID_SaleOutDepotBillProduct,GuidEmpty()))
  2184. {
  2185. #SaleOutDepotBillProduct.ID_SaleOutDepotBillProduct = NewGuid();
  2186. }
  2187. #SaleOutDepotBillProduct.ID_SaleOutDepotBill=#SaleOutDepotBill.ID_SaleOutDepotBill;
  2188. }
  2189. for(@j=0;@j<RowCount("#BillComment");@j++)
  2190. {
  2191. SetPosition("#BillComment",@j);
  2192. if(Equals(#BillComment.ID_BillComment,GuidEmpty()))
  2193. {
  2194. #BillComment.ID_BillComment=NewGuid();
  2195. }
  2196. #BillComment.ID_Bill=#SaleOutDepotBill.ID_SaleOutDepotBill;
  2197. }
  2198. for(@j=0;@j<RowCount("#ReportComment");@j++)
  2199. {
  2200. SetPosition("#ReportComment",@j);
  2201. if(Equals(#ReportComment.ID_ReportComment,GuidEmpty()))
  2202. {
  2203. #ReportComment.ID_ReportComment=NewGuid();
  2204. }
  2205. #ReportComment.ID_Bill=#SaleOutDepotBill.ID_SaleOutDepotBill;
  2206. }
  2207. ResumeLayout();
  2208. if(@Status == 1)
  2209. {
  2210. #SaleOutDepotBill.CreateDate_SaleOutDepotBill=DateTimeNow();
  2211. #SaleOutDepotBill.No_SaleOutDepotBill = New("#SaleOutDepotBill.No_SaleOutDepotBill", timeMake.CValue);
  2212. }
  2213. else if(@Status == 3)
  2214. {
  2215. #SaleOutDepotBill.LastModDate_SaleOutDepotBill =DateTimeNow();
  2216. Update();
  2217. }
  2218. ChangeMode("View");
  2219. ]]>
  2220. </SubmitButtonClick>
  2221. <CountSum>
  2222. <![CDATA[
  2223. if (RowCount("#SaleOutDepotBillProduct") == 0)
  2224. {
  2225. ikNumericTextBox1.CValue = 0;
  2226. }
  2227. else
  2228. {
  2229. ikNumericTextBox1.CValue = SumOfCol("#SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct");
  2230. }
  2231. ]]>
  2232. </CountSum>
  2233. </Lables>
  2234. </Form>
  2235. </Forms>