123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307 |
- <?xml version="1.0" encoding="utf-8" ?>
- <Forms>
- <Form Name="FrmSaleOutDepotBill">
- <Client>
- <Events>
- <Load>
- <![CDATA[
- @SetFlag=1;
- @SetFlag1=1;
- @Title="销货出库单";
- GetSchema();
- Search("SearchLocation");
- Search("SearchSystemSetting");
- Search("SearchOneLocation", DBNull());
- Search("SearchNo_SaleBillProduct","p","p");
- Search("SearchNo_Product","p");
- Search("SearchLocationByNo","p");
-
- if(#System.SaleAndOutDepot_SystemSetting && #System.OutDepotAndSaleBack_SystemSetting && #System.SaleRtnSourceBill_SystemSetting)
- toolBar.EnableExportItem(0,false);
- dgProduct.NoMember="No_SaleOutDepotBillProduct";
- @SaleAndOutDepot = #System.SaleAndOutDepot_SystemSetting;
- @OutDepotAndSaleBack = #System.OutDepotAndSaleBack_SystemSetting;
- @ImportClicked = 0;
- @CessOut = #System.CessOut_SystemSetting / 100;
- dgProduct.ColumnVisibleByColumnName("UnitPrice_SaleOutDepotBillProduct",!GetFieldRight(@Title,"成本","查看"));
- toolBar.VisibleCheck = GetRight(@Title,"审核");
- Search("SearchBillType");
- ]]>
- </Load>
- <EndLoad>
- ChangeMode("Search");
- </EndLoad>
- <Closing>
- ;<!--TODO-->
- </Closing>
- <Closed>
- ;<!--TODO-->
- </Closed>
- </Events>
- <Mode>
- <Search>
- <Lable name="Search" />
- </Search>
- <New>
- <Lable name="New" />
- </New>
- <View>
- <Lable name="View" />
- </View>
- <Modify>
- <Lable name="Modify" />
- </Modify>
- </Mode>
- <Controls>
- <IKDateTimePicker name="timeMake" DataSource="SaleOutDepotBill.Date_SaleOutDepotBill" />
- <IKTextButton name="tbNo" DataSource="SaleOutDepotBill.No_SaleOutDepotBill">
- <Events>
- <Enter>
- <![CDATA[
- if(tbNo.ReadOnly == false)
- {
- if(tbNo.CValue != StringEmpty())
- {
- UpdateForm(false, "");
- if(Search("SearchSaleOutDepotBillWithNo", tbNo.CValue))
- {
- ChangeMode("View");
- }
- else
- {
- MessageBox("该出库单不存在!",@Title);
- }
- }
- else
- {
- MessageBox("请输入出库单号!", @Title);
-
- }
- }
- ]]>
- <Lable name="CountSum" />
-
- </Enter>
- <Click>
- ShowSearchBox("BillSearch","HAVEDEPOT", "tbNo",tbNo.CValue);
- </Click>
- </Events>
- </IKTextButton>
- <IKTextButton name="tbCustomerNo" DataSource="SaleOutDepotBill.No_Customer">
- <Events>
- <Enter>
- <![CDATA[
- if (tbCustomerNo.ReadOnly == false)
- {
- UpdateForm(false, "");
- if (tbCustomerNo.CValue == "" || !Search("SearchCustomerWithNo", tbCustomerNo.CValue))
- {
- if (tbCustomerNo.CValue == "")
- {
- MessageBox("请输入客户编号!", @Title);
- }
- else
- {
- MessageBox("该客户不存在!",@Title);
- @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo.CValue);
- if(@temp != "")
- {
- tbCustomerNo.CValue = @temp;
- ActiveControlEvent("tbCustomerNo", "Enter");
- }
- }
- }
- else
- {
- if (!Equals(#Customer.SuspendDate_Customer,DBNull()))
- {
- MessageBox("该客户已停用!",@Title);
- }
- #SaleOutDepotBill.ShortName_Customer = #Customer.ShortName_Customer;
- #SaleOutDepotBill.ID_Customer = #Customer.ID_Customer;
- #SaleOutDepotBill.No_Customer = #Customer.No_Customer;
- Empty("#ReportComment");
- Search("SearchTypeComment",#SaleOutDepotBill.ID_Customer);
- MergeTable("#TypeComment","#ReportComment");
- }
- UpdateForm(true, "");
- }
- ]]>
- </Enter>
- <Click>
- <![CDATA[
- if (tbCustomerNo.ReadOnly == false)
- {
- @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo.CValue);
- if( @temp == "" )
- return;
- tbCustomerNo.CValue = @temp;
- ActiveControlEvent("tbCustomerNo", "Enter");
- }
- ]]>
- </Click>
- </Events>
- </IKTextButton>
- <IKTextBox name="txtCustomerShortName" DataSource="SaleOutDepotBill.ShortName_Customer"></IKTextBox>
- <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">
- <Events>
- <Reload>
- UpdateForm(false, "cbLocation");
- Search("SearchLocation");
- UpdateForm(true, "cbLocation");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKButton name="btnDelete">
- <Events>
- <Click>
- if(Search("SearchSaleRtn",#SaleOutDepotBill.ID_SaleOutDepotBill))
- {
- if(#SaleRtn.RtnQuantity_SaleOutDepotBillProduct > 0 || #SaleRtnFromSaleBill.Num > 0)
- {
- MessageBox("该单据已有相应的销售退货记录,作废失败!",@Title);
- return;
- }
- }
- BeginUnAudit();
- #SaleOutDepotBill.ID_Assessor = DBNull();
- #SaleOutDepotBill.Name_UserAuti = "";
- #SaleOutDepotBill.Disable_SaleOutDepotBill =true;
- UnAudit();
- ChangeMode("View");
- EndUnAudit();
- <Lable name="CountSum" />
- </Click>
- </Events>
- </IKButton>
- <IKTextBox name="txtMaker" DataSource="SaleOutDepotBill.Name_User" />
- <IKTextBox name="txtAudi" DataSource="SaleOutDepotBill.Name_UserAuti" />
- <IKDateTimeText name="dttCreateDate" DataSource="SaleOutDepotBill.AssessDate_SaleOutDepotBill" />
- <IKTextBox name="txtlastmoduser" DataSource="SaleOutDepotBill.Name_LastModUser" />
- <IKDateTimeText name="dttlastmoddate" DataSource="SaleOutDepotBill.LastModDate_SaleOutDepotBill" />
- <IKDataGridEx name="dgProduct" DataSource="SaleOutDepotBillProduct" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="SaleOutDepotBillProduct.No_SaleOutDepotBillProduct" />
- <DataColumn Index="1" DataSource="SaleOutDepotBillProduct.Name_FromBill">
- <IKDataGridComboBoxColumn DisplaySourceEx="SaleOutDepotBillProduct.Name_FromBill" ValueSourceEx="SaleOutDepotBillProduct.Type_FromBill"
- DataSourceEx="SaleBillType" DisplayMemberEx="Name_BillType" ValueMemberEx="Value_BillType">
- <Events>
- <Reload>
- Search("SearchBillType");
- SetDataGridColumnDataSource(1,"dgProduct");
- </Reload>
- </Events>
- </IKDataGridComboBoxColumn>
- </DataColumn>
- <DataColumn Index="2" DataSource="SaleOutDepotBillProduct.No_FromBill" />
- <DataColumn Index="3" DataSource="SaleOutDepotBillProduct.No_FromBillProduct" />
- <DataColumn Index="4" DataSource="SaleOutDepotBillProduct.No_Product">
- <IKDataGridTextButtonColumn>
- <Events>
- <Click>
- @SetFlag=1;
- ShowSearchBox("ProductSearch","INFOMATION",#SaleOutDepotBillProduct.No_Product);
- </Click>
- <SetFlagBeforeClick>
- @SetFlag=0;
- </SetFlagBeforeClick>
- </Events>
- </IKDataGridTextButtonColumn>
- </DataColumn>
- <DataColumn Index="5" DataSource="SaleOutDepotBillProduct.Name_Product" />
- <DataColumn Index="6" DataSource="SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct" />
- <DataColumn Index="7" DataSource="SaleOutDepotBillProduct.Unit_Product" />
- <DataColumn Index="8" DataSource="SaleOutDepotBillProduct.UnitPrice_SaleOutDepotBillProduct" />
- <DataColumn Index="9" DataSource="SaleOutDepotBillProduct.No_Location">
- <IKDataGridTextButtonColumn>
- <Events>
- <Click>
- @SetFlag1=1;
- @LocationNo = ShowSearchBox("LocationSearch","INFOMATION",#SaleOutDepotBillProduct.No_Location);
- if(@LocationNo != "")
- #SaleOutDepotBillProduct.No_Location = @LocationNo;
- </Click>
- <SetFlagBeforeClick>
- @SetFlag1=0;
- </SetFlagBeforeClick>
- </Events>
- </IKDataGridTextButtonColumn>
- </DataColumn>
- <DataColumn Index="10" DataSource="SaleOutDepotBillProduct.Name_Location"/>
- <DataColumn Index="11" DataSource="SaleOutDepotBillProduct.Comment_SaleOutDepotBillProduct" />
- </IKDataGridEx>
- <IKDataGridEx name="dgRemark" DataSource="BillComment" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="BillComment.Comment_BillComment" />
- </IKDataGridEx>
- <IKDataGridEx name="dgReportComment" DataSource="ReportComment" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="ReportComment.Comment_ReportComment" />
- </IKDataGridEx>
- <!--<IKButton name="BarCode">
- <Events>
- <Click>
-
- UpdateForm(false, "");
- if(Search("SearchSaleOutDepotBillWithNo", Read("test.txt",0)))
- {
- ChangeMode("View");
- }
- else
- {
- @a = ShowSearchNo();
- if(Search("SearchSaleOutDepotBillWithNo", @a))
- {
- ChangeMode("View");
- ShowFrmBarProduct(Read("test.txt",1),@a);
- return;
- }
- else
- {
- MessageBox("该出库单不存在!",@Title);
- return;
- }
- }
-
- ShowFrmBarProduct(Read("test.txt",1),"");
-
- <Lable name="CountSum" />
-
- </Click>
- </Events>
- </IKButton>-->
- <IKFormToolBar name="toolBar">
- <Events>
- <ClickFirst>
- if(Search("SearchSaleOutDepotBillFirst", tbNo.CValue))
- {
- ChangeMode("View");
- <Lable name="CountSum" />
- }
- </ClickFirst>
- <ClickPrev>
- if(Search("SearchSaleOutDepotBillPrevious", tbNo.CValue))
- {
- ChangeMode("View");
- <Lable name="CountSum" />
- }
- </ClickPrev>
- <ClickNext>
- if(Search("SearchSaleOutDepotBillNext", tbNo.CValue))
- {
- ChangeMode("View");
- <Lable name="CountSum" />
- }
- </ClickNext>
- <ClickLast>
- if(Search("SearchSaleOutDepotBillLast", tbNo.CValue))
- {
- ChangeMode("View");
- <Lable name="CountSum" />
- }
- </ClickLast>
- <ClickNew>
- @NewNumber=GetNextAutoNumber(true);
- if(@NewNumber != "")
- {
- ChangeMode("New");
- tbNo.CValue=@NewNumber;
- }
- </ClickNew>
- <ClickEmpty>
- ChangeMode("Search");
- </ClickEmpty>
- <ClickSubmit>
- <Lable name="SubmitButtonClick" />
- <Lable name="CountSum" />
- </ClickSubmit>
- <ClickModify>
- ChangeMode("Modify");
- <Lable name="CountSum" />
- </ClickModify>
- <ClickDelete>
- Delete();
- ChangeMode("Search");
- </ClickDelete>
- <ClickPrint>
- ShowPrintBox("BillSearch",#SaleOutDepotBill.No_SaleOutDepotBill,#SaleOutDepotBill.No_SaleOutDepotBill,GetFieldRight(@Title,"成本","查看"));
- </ClickPrint>
- <ClickPrintBarCode>
- PrintBarCode("BillSearch",#SaleOutDepotBill.No_SaleOutDepotBill,#SaleOutDepotBill.No_SaleOutDepotBill);
- </ClickPrintBarCode>
- <ClickAudit>
- <![CDATA[
- if(Search("SearchID_Customer",#SaleOutDepotBillProduct.No_FromBill))
- {
- if(!Equals(#SaleOutDepotBill.ID_Customer,#SaleBillCustomer.ID_Customer))
- {
- MessageBox("该来源单据的客户与本单据的客户不一致,请检查!",@Title);
- dgProduct.Focus();
- return;
- }
- }
- Search("SearchCheck",#SaleOutDepotBill.No_SaleOutDepotBill);
- if(#Check.Check_SaleOutDepotBill == 0)
- {
- @DialogResult=MessageBox("该单据未经校验,确定要审核吗?",@Title,MB_OKCANCEL);
- if(@DialogResult == DialogResult("CANCEL"))
- {
- return;
- }
- }
-
- SuspendLayout();
- if(@SaleAndOutDepot==false)
- {
-
- for (@i=0;@i<RowCount("#SaleOutDepotBillProduct");@i=@i+1)
- {
- SetPosition("#SaleOutDepotBillProduct", @i);
- if(!Equals(#SaleOutDepotBillProduct.No_FromBill,"") && #SaleOutDepotBillProduct.Type_FromBill!=0 && Search("SearchSaleBillAuditWithNo",#SaleOutDepotBillProduct.No_FromBill))
- {
- if(Equals(#SaleBillAudit.ID_Assessor,DBNull()))
- {
- dgProduct.CurrentRowIndex = @i;
- @DialogResult=MessageBox("该来源单据未经审核,确定要审核吗?",@Title,MB_OKCANCEL);
- if(@DialogResult == DialogResult("CANCEL"))
- {
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
-
-
- }
- }
- }
- ResumeLayout();
- BeginAudit();
- #SaleOutDepotBill.ID_Assessor = GetLoginUserID();
- #SaleOutDepotBill.Name_UserAuti = GetCurrentUser();
- #SaleOutDepotBill.AssessDate_SaleOutDepotBill = DateTimeNow();
- Audit();
- ChangeMode("View");
- EndAudit();
-
- ]]>
- <Lable name="CountSum" />
- </ClickAudit>
- <ClickUnAudit>
- <![CDATA[
- BeginUnAudit();
- #SaleOutDepotBill.ID_Assessor = DBNull();
- #SaleOutDepotBill.Name_UserAuti = "";
- UnAudit();
- ChangeMode("View");
- EndUnAudit();
-
- ]]>
- <Lable name="CountSum" />
- </ClickUnAudit>
- <ClickImport>
- ;
- </ClickImport>
- <ClickExport>
- ;
- </ClickExport>
- <ClickClose>
- ;
- </ClickClose>
- <ClickExpand>
- ;
- </ClickExpand>
- <ClickImportItem>
- <![CDATA[
- if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="销货单")
- {
- @ImportClicked = 1;
- @ImportSucceed = false;
- if(Search("SearchContrOut"))
- {
- @ImportSucceed = ShowSearchBox("ImportSaleBillControl","BILLCONVERT","#SaleOutDepotBillProduct.Type_FromBill",21,"#SaleOutDepotBillProduct.Name_FromBill","销货单");
- }
- else
- {
- @ImportSucceed = ShowSearchBox("ImportSaleBillUnControl","BILLCONVERT");
- }
- if(@ImportSucceed)
- {
- EmptyTable("ReportComment");
- SuspendLayout();
- @sql = "Select ReportComment.Comment_ReportComment from ReportComment Left join SaleBill on SaleBill.ID_SaleBill = ReportComment.ID_Bill Where SaleBill.No_SaleBill in (";
- for (@i=0;@i<=RowCount("#SaleOutDepotBillProduct")-1;@i=@i+1)
- {
- SetPosition("#SaleOutDepotBillProduct", @i);
- if(@i != RowCount("#SaleOutDepotBillProduct")-1)
- @sql = @sql + "'"+ #SaleOutDepotBillProduct.No_FromBill+"',";
- else
- @sql = @sql + "'"+ #SaleOutDepotBillProduct.No_FromBill+"')";
- }
- @sql = @sql + " Order by ReportComment.No_ReportComment";
- ResumeLayout();
- SearchEx(@sql, "SaleBillComment");
- MergeFiled("#SaleBillComment.Comment_ReportComment", "#ReportComment.Comment_ReportComment");
- }
- }
- ]]>
- <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
- <Lable name="CountSum" />
- </ClickImportItem>
- <ClickExportItem>
- if(toolBar.MenuItemText=="销售退货单")
- {
- if(Search("SearchContr"))
- {
- 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);
- ExportBillProduct("dgProduct","#SaleOutDepotBillProduct","#SaleRtnBillProduct.No_FromBillProduct","#SaleOutDepotBillProduct.No_SaleOutDepotBillProduct");
- }
- else
- {
- ExportBillProductStart("#SaleRtnBill.No_Customer",#SaleOutDepotBill.No_Customer,"#SaleRtnBillProduct.Comment_SaleRtnBillProduct","销货出库单:"+#SaleOutDepotBill.No_SaleOutDepotBill,"#SaleRtnBill.Name_Location",#SaleOutDepotBill.Name_Location);
- ExportBillProduct("dgProduct","#SaleOutDepotBillProduct","#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct","#SaleOutDepotBillProduct.No_Product");
- }
- }
- <!--初始化目标数据-->
- <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
- </ClickExportItem>
- <ClickCheck>
- @DialogResult=MessageBox("是否进行分校验?(选否进行总校验)",@Title,MB_YESNO);
- if(@DialogResult == DialogResult("YES"))
- {
- ShowFrmSaleOutProductCheck(#SaleOutDepotBill.No_SaleOutDepotBill);
- }
- else
- {
- if(Read("BarCode.txt",0)=="")
- MessageBox("条码信息所在文件不存在或信息为空!",@Title);
- else
- {
- ChangeMode("Search");
- if(Search("SearchSaleOutDepotBillWithNo", Read("BarCode.txt",0)))<!--参数为0取txt第一条,为1取txt全部 -->
- {
-
- Search("SearchStatusWithNo",Read("BarCode.txt",0));
- if(#Status.Check_SaleOutDepotBill == 0)
- {
- ChangeMode("View");
- <Lable name="CountSum" />
- }
- else
- {
- ChangeMode("Search");
- MessageBox("该单据已校验!",@Title);
- return;
- }
-
- }
- else
- {
- @a = ShowSearchNo();
- if(Search("SearchSaleOutDepotBillWithNo", @a))
- {
-
- Search("SearchStatusWithNo",@a);
- if(#Status.Check_SaleOutDepotBill == 0)
- {
- ChangeMode("View");
- <Lable name="CountSum" />
- ShowFrmBarProduct(Read("BarCode.txt",1),@a);
- return;
- }
- else
- {
- ChangeMode("Search");
- MessageBox("该单据已校验!",@Title);
- return;
- }
-
- }
- else
- {
- MessageBox("该出库单不存在!",@Title);
- return;
- }
- }
-
- ShowFrmBarProduct(Read("BarCode.txt",1),"");
- }
- }
- </ClickCheck>
- </Events>
- </IKFormToolBar>
- </Controls>
- <Tables>
- <Table name="SaleOutDepotBillProduct">
- <Events>
- <ColumnsChanged>
- <Name_FromBill>
- <![CDATA[
- if(!Equals(#SaleOutDepotBillProduct.Name_FromBill,StringEmpty()) && !Equals(#SaleOutDepotBillProduct.No_FromBill,StringEmpty()) && !Equals(#SaleOutDepotBillProduct.No_FromBillProduct,StringEmpty()))
- {
- if(Search("SearchNo_SaleBillProduct",#SaleOutDepotBillProduct.No_FromBill,#SaleOutDepotBillProduct.No_FromBillProduct))
- {
- if(!Equals(#NoSBProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
-
- #SaleOutDepotBillProduct.No_FromBillProduct = #NoSBProduct.No_SaleBillProduct;
- #SaleOutDepotBillProduct.ID_Product = #NoSBProduct.ID_Product;
- #SaleOutDepotBillProduct.No_Product = #NoSBProduct.No_Product;
- #SaleOutDepotBillProduct.Unit_Product = #NoSBProduct.Unit_Product;
- #SaleOutDepotBillProduct.Name_Product = #NoSBProduct.Name_Product;
- #SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct = #NoSBProduct.Mount;
- #SaleOutDepotBillProduct.Comment_SaleOutDepotBillProduct = #NoSBProduct.Comment_SaleBillProduct;
- #SaleOutDepotBillProduct.ID_IndentBillOnNetProduct = #NoSBProduct.ID_IndentBillOnNetProduct;
- if(Search("SearchOneLocation", #NoSBProduct.ID_Product))
- {
- #SaleOutDepotBillProduct.No_Location = #OneLocation.No_Location;
- #SaleOutDepotBillProduct.Name_Location = #OneLocation.Name_Location;
- #SaleOutDepotBillProduct.ID_Location = #OneLocation.ID_Location;
- }
- }
- }
- ]]>
- <Lable name="CountSum" />
- </Name_FromBill>
- <No_FromBill>
- <![CDATA[
- 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()))
- {
- if(Search("SearchNo_SaleBillProduct",#SaleOutDepotBillProduct.No_FromBill,#SaleOutDepotBillProduct.No_FromBillProduct))
- {
- if(!Equals(#NoSBProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
-
- #SaleOutDepotBillProduct.No_FromBillProduct = #NoSBProduct.No_SaleBillProduct;
- #SaleOutDepotBillProduct.ID_Product = #NoSBProduct.ID_Product;
- #SaleOutDepotBillProduct.No_Product = #NoSBProduct.No_Product;
- #SaleOutDepotBillProduct.Unit_Product = #NoSBProduct.Unit_Product;
- #SaleOutDepotBillProduct.Name_Product = #NoSBProduct.Name_Product;
- #SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct = #NoSBProduct.Mount;
- #SaleOutDepotBillProduct.Comment_SaleOutDepotBillProduct = #NoSBProduct.Comment_SaleBillProduct;
- #SaleOutDepotBillProduct.ID_IndentBillOnNetProduct = #NoSBProduct.ID_IndentBillOnNetProduct;
- if(Search("SearchOneLocation",#NoSBProduct.ID_Product))
- {
- #SaleOutDepotBillProduct.No_Location = #OneLocation.No_Location;
- #SaleOutDepotBillProduct.Name_Location = #OneLocation.Name_Location;
- #SaleOutDepotBillProduct.ID_Location = #OneLocation.ID_Location;
- }
- }
- }
- ]]>
- <Lable name="CountSum" />
- </No_FromBill>
- <No_FromBillProduct>
- <![CDATA[
- if(!Equals(#SaleOutDepotBillProduct.Name_FromBill,"") && !Equals(#SaleOutDepotBillProduct.No_FromBill,"") && !Equals(#SaleOutDepotBillProduct.No_FromBillProduct,""))
- {
- if(Search("SearchNo_SaleBillProduct",#SaleOutDepotBillProduct.No_FromBill,#SaleOutDepotBillProduct.No_FromBillProduct))
- {
- if(!Equals(#NoSBProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
-
- #SaleOutDepotBillProduct.No_FromBillProduct = #NoSBProduct.No_SaleBillProduct;
- #SaleOutDepotBillProduct.ID_Product = #NoSBProduct.ID_Product;
- #SaleOutDepotBillProduct.No_Product = #NoSBProduct.No_Product;
- #SaleOutDepotBillProduct.Unit_Product = #NoSBProduct.Unit_Product;
- #SaleOutDepotBillProduct.Name_Product = #NoSBProduct.Name_Product;
- #SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct = #NoSBProduct.Mount;
- #SaleOutDepotBillProduct.Comment_SaleOutDepotBillProduct = #NoSBProduct.Comment_SaleBillProduct;
- #SaleOutDepotBillProduct.ID_IndentBillOnNetProduct = #NoSBProduct.ID_IndentBillOnNetProduct;
- if( Search("SearchOneLocation", #NoSBProduct.ID_Product))
- {
- #SaleOutDepotBillProduct.No_Location = #OneLocation.No_Location;
- #SaleOutDepotBillProduct.Name_Location = #OneLocation.Name_Location;
- #SaleOutDepotBillProduct.ID_Location = #OneLocation.ID_Location;
- }
- }
- }
- ]]>
- <Lable name="CountSum" />
- </No_FromBillProduct>
- <No_Product>
- <![CDATA[
- if(@SetFlag==0)
- {
- return;
- }
- if(#SaleOutDepotBillProduct.No_Product == "" || !Search("SearchNo_Product",#SaleOutDepotBillProduct.No_Product))
- {
- if(#SaleOutDepotBillProduct.No_Product != "")
- MessageBox("该产品不存在!",@Title);
- #SaleOutDepotBillProduct.ID_Product = GuidEmpty();
- #SaleOutDepotBillProduct.Unit_Product = "";
- #SaleOutDepotBillProduct.Name_Product = "";
- @temp = ShowSearchBox("InputSearchProduct","INFOMATION",#SaleOutDepotBillProduct.No_Product);
- if(@temp != "")
- {
- ResumeColumnEvent("#SaleOutDepotBillProduct.No_Product");
- #SaleOutDepotBillProduct.No_Product = @temp;
- ClearColumnEvent();
- }
- }
- else
- {
- if(!Equals(#NoProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
-
- #SaleOutDepotBillProduct.ID_Product = #NoProduct.ID_Product;
- #SaleOutDepotBillProduct.Unit_Product = #NoProduct.Unit_Product;
- #SaleOutDepotBillProduct.Name_Product = #NoProduct.Name_Product;
- #SaleOutDepotBillProduct.UnitPrice_SaleOutDepotBillProduct = #NoProduct.Cost_Product;
- if(Search("SearchOneLocation", #NoProduct.ID_Product))
- {
- #SaleOutDepotBillProduct.No_Location = #OneLocation.No_Location;
- #SaleOutDepotBillProduct.Name_Location = #OneLocation.Name_Location;
- #SaleOutDepotBillProduct.ID_Location = #OneLocation.ID_Location;
- }
- }
-
- ]]>
- <Lable name="CountSum" />
- </No_Product>
- <No_Location>
- if(@SetFlag1==0)
- {
- return;
- }
- if(#SaleOutDepotBillProduct.No_Location != StringEmpty())
- {
- if(!Search("SearchLocationByNo",#SaleOutDepotBillProduct.No_Location))
- {
- MessageBox("不存在此库位编号",@Title);
- #SaleOutDepotBillProduct.ID_Location=GuidEmpty();
- #SaleOutDepotBillProduct.Name_Location=StringEmpty();
- }
- else
- {
- #SaleOutDepotBillProduct.ID_Location=#Location.ID_Location;
- #SaleOutDepotBillProduct.Name_Location=#Location.Name_Location;
- }
- }
- </No_Location>
- <Quantity_SaleOutDepotBillProduct>
- <![CDATA[
- #SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct = FormatNumber(#SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct, #System.QuantityDecimal_SystemSetting);
-
- ]]>
- <Lable name="CountSum" />
- </Quantity_SaleOutDepotBillProduct>
-
- </ColumnsChanged>
- <RowDeleted>
- <Lable name="CountSum" />
- </RowDeleted>
- </Events>
- </Table>
- </Tables>
- <LockInfomation LockID="ID_SaleOutDepotBill" LockNO="No_SaleOutDepotBill" LockSearchFunction="SearchSaleOutDepotBillWithNo"
- LockAudit="ID_Assessor" />
- <LogInfomation LogNO="#SaleOutDepotBill.No_SaleOutDepotBill" RecordFormField="" RecordDataGridField="#SaleOutDepotBillProduct.No_Product,#SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct" />
- <ChildForms>
- <ChildForm name="CustomerSearch" DataSource="Customer" SearchFunction="SearchAllCustomer" SearchFunctionByNo="" MappingName="客户">
- <DataColumn Index="0" MappingName="#Customer.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="1" MappingName="#Customer.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="2" MappingName="#Customer.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="3" MappingName="#Customer.Level_Customer" HeaderText="客户等级" Width="75" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="4" MappingName="#Customer.IsGeneric_Customer" HeaderText="一般客户" Width="75" ColumnType="IKDataGridBoolColumn" />
- </ChildForm>
- <ChildForm name="BillSearch" DataSource="SaleOutDepotBill" SearchFunction="SearchAllBill" SearchFunctionByNo="SearchSaleOutDepotBillWithNo">
- <DataColumn Index="0" MappingName="#SaleOutDepotBill.No_SaleOutDepotBill" HeaderText="销货出库单号" Width="90" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="1" MappingName="#SaleOutDepotBill.Date_SaleOutDepotBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="2" MappingName="#SaleOutDepotBill.No_Customer" HeaderText="客户编号" Width="75" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="3" MappingName="#SaleOutDepotBill.ShortName_Customer" HeaderText="客户简称" Width="75" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="4" MappingName="#SaleOutDepotBill.Comment_SaleOutDepotBill" HeaderText="备注" Width="75" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="5" MappingName="#SaleOutDepotBill.Check_SaleOutDepotBill" HeaderText="校验状态" Width="75" ColumnType="IKDataGridTextBoxColumn" />
- </ChildForm>
- <ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品" ReturnDataSource="SaleOutDepotBillProduct" ShowCheckBox="true">
- <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn" ReturnMappingName="#SaleOutDepotBillProduct.No_Product" />
- <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="2" MappingName="#Product.Type_Product" HeaderText="产品类型" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="3" MappingName="#Product.Price_Product" HeaderText="标准售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
- <DataColumn Index="4" MappingName="#Product.LowSalePrice_Product" HeaderText="最低售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
- <DataColumn Index="5" MappingName="#Product.SafetyQty_Product" HeaderText="安全存量" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="LocationSearch" DataSource="Location" SearchFunction="SearchAllLocation" SearchFunctionByNo="" MappingName="库位" ReturnDataSource="SaleOutDepotBillProduct" ShowCheckBox="false">
- <DataColumn Index="0" MappingName="#Location.No_Location" HeaderText="库位编号" Width="120" ColumnType="IKDataGridTextBoxColumn" ReturnMappingName="#SaleOutDepotBillProduct.No_Location" />
- <DataColumn Index="1" MappingName="#Location.Name_Location" HeaderText="库位名称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="InputSearchProduct" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品">
- <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="2" MappingName="#Product.Type_Product" HeaderText="产品类型" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="3" MappingName="#Product.Price_Product" HeaderText="标准售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
- <DataColumn Index="4" MappingName="#Product.LowSalePrice_Product" HeaderText="最低售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
- <DataColumn Index="5" MappingName="#Product.SafetyQty_Product" HeaderText="安全存量" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="ImportSaleBillControl">
- <DataGridIndex DataSource="SaleBill" SearchFunction="SearchAllSaleBill" SearchFunctionByNo="" MappingName="" ReturnDataSource="SaleOutDepotBillProduct">
- <DataColumn Index="0" MappingName="#SaleBill.No_SaleBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleOutDepotBillProduct.No_FromBill" />
- <DataColumn Index="1" MappingName="#SaleBill.Date_SaleBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="2" MappingName="#SaleBill.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#SaleOutDepotBill.No_Customer" />
- <DataColumn Index="3" MappingName="#SaleBill.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="4" MappingName="#SaleBill.State_SaleBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="5" MappingName="#SaleBill.Name_Location" HeaderText="出货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn"
- ReturnPath="parent" ReturnMappingName="#SaleOutDepotBill.Name_Location" />
- <DataColumn Index="6" MappingName="#SaleBill.OutStatus_SaleBill" HeaderText="发货状态" Width="90" ColumnType="IKDataGridTextBoxColumn"
- ReturnPath="child" />
- </DataGridIndex>
- <DataGridIndex DataSource="SaleBillProduct" SearchFunction="SearchAllSaleBillProduct" SearchFunctionByNo=""
- MappingName="">
- <DataColumn Index="0" MappingName="#SaleBillProduct.No_Product" HeaderText="产品编号" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="1" MappingName="#SaleBillProduct.No_SaleBillProduct" HeaderText="产品序号" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleOutDepotBillProduct.No_FromBillProduct" />
- <DataColumn Index="2" MappingName="#SaleBillProduct.Name_Product" HeaderText="产品名称" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="3" MappingName="#SaleBillProduct.Quantity_SaleBillProduct" HeaderText="数量"
- Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2" />
- <DataColumn Index="4" MappingName="#SaleBillProduct.UnitPrice_SaleBillProduct" HeaderText="单价"
- Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2" />
- <DataColumn Index="5" MappingName="#SaleBillProduct.Comment_SaleBillProduct" HeaderText="备注"
- Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleOutDepotBillProduct.Comment_SaleOutDepotBillProduct"/>
- </DataGridIndex>
- </ChildForm>
- <ChildForm name="ImportSaleBillUnControl">
- <DataGridIndex DataSource="SaleBill" SearchFunction="SearchAllSaleBill" SearchFunctionByNo="" MappingName=""
- ReturnDataSource="SaleOutDepotBillProduct">
- <DataColumn Index="0" MappingName="#SaleBill.No_SaleBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn"
- ReturnPath="child" ReturnMappingName="#SaleOutDepotBillProduct.Comment_SaleOutDepotBillProduct" />
- <DataColumn Index="1" MappingName="#SaleBill.Date_SaleBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"
- ReturnPath="child" />
- <DataColumn Index="2" MappingName="#SaleBill.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"
- ReturnPath="parent" ReturnMappingName="#SaleOutDepotBill.No_Customer" />
- <DataColumn Index="3" MappingName="#SaleBill.ShortName_Customer" HeaderText="客户简称" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
-
- <DataColumn Index="4" MappingName="#SaleBill.State_SaleBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn"
- ReturnPath="child" />
- <DataColumn Index="5" MappingName="#SaleBill.Name_Location" HeaderText="出货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn"
- ReturnPath="parent" ReturnMappingName="#SaleOutDepotBill.Name_Location" />
- <DataColumn Index="6" MappingName="#SaleBill.OutStatus_SaleBill" HeaderText="发货状态" Width="90" ColumnType="IKDataGridTextBoxColumn"
- ReturnPath="child" />
- </DataGridIndex>
- <DataGridIndex DataSource="SaleBillProduct" SearchFunction="SearchAllSaleBillProduct" SearchFunctionByNo=""
- MappingName="">
- <DataColumn Index="0" MappingName="#SaleBillProduct.No_Product" HeaderText="产品编号" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleOutDepotBillProduct.No_Product" />
- <DataColumn Index="1" MappingName="#SaleBillProduct.No_SaleBillProduct" HeaderText="产品序号" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="2" MappingName="#SaleBillProduct.Name_Product" HeaderText="产品名称" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="3" MappingName="#SaleBillProduct.Quantity_SaleBillProduct" HeaderText="数量"
- Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2" />
- <DataColumn Index="4" MappingName="#SaleBillProduct.UnitPrice_SaleBillProduct" HeaderText="单价"
- Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2" />
- <DataColumn Index="5" MappingName="#SaleBillProduct.Comment_SaleBillProduct" HeaderText="备注"
- Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleOutDepotBillProduct.Comment_SaleOutDepotBillProduct"/>
- </DataGridIndex>
- </ChildForm>
- </ChildForms>
- <ImportedInfo>
-
- UpdateForm(true, "tbCustomerNo");
- Search("SearchLocation");
- cbLocation.Text = #SaleOutDepotBill.Name_Location;
- tbCustomerNo.Focus();
- ActiveControlEvent("tbCustomerNo", "Enter");
-
- </ImportedInfo>
- </Client>
- <Server>
- <Tables>
- <Table name="SaleOutDepotBill" Type="Parent">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 SaleOutDepotBill.*
- ,a.Name_User,b.Name_User as Name_UserAuti,c.Name_User as Name_LastModUser
- ,Location.Name_Location,Location.No_Location,Customer.Name_Customer
- ,Customer.ShortName_Customer,Customer.No_Customer
- FROM SaleOutDepotBill
- LEFT JOIN Customer ON Customer.ID_Customer = SaleOutDepotBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = SaleOutDepotBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = SaleOutDepotBill.ID_Assessor
- Left JOIN AppUser c ON c.ID_User = SaleOutDepotBill.LastModUser_SaleOutDepotBill
- LEFT JOIN Location ON Location.ID_Location = SaleOutDepotBill.ID_Location
- " />
- <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)
- 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)
- ">
- <Params>
- <Param name="@ID_SaleOutDepotBill" type="SaleOutDepotBill.ID_SaleOutDepotBill" sourceColumn="ID_SaleOutDepotBill" />
- <Param name="@No_SaleOutDepotBill" type="SaleOutDepotBill.No_SaleOutDepotBill" sourceColumn="No_SaleOutDepotBill" />
- <Param name="@Date_SaleOutDepotBill" type="SaleOutDepotBill.Date_SaleOutDepotBill" sourceColumn="Date_SaleOutDepotBill" />
- <Param name="@ID_Location" type="SaleOutDepotBill.ID_Location" sourceColumn="ID_Location" />
-
- <Param name="@ID_Creator" type="SaleOutDepotBill.ID_Creator" sourceColumn="ID_Creator" />
- <Param name="@ID_Assessor" type="SaleOutDepotBill.ID_Assessor" sourceColumn="ID_Assessor" />
- <Param name="@AssessDate_SaleOutDepotBill" type="SaleOutDepotBill.AssessDate_SaleOutDepotBill"
- sourceColumn="AssessDate_SaleOutDepotBill" />
- <Param name="@Comment_SaleOutDepotBill" type="SaleOutDepotBill.Comment_SaleOutDepotBill"
- sourceColumn="Comment_SaleOutDepotBill" />
- <Param name="@Disable_SaleOutDepotBill" type="SaleOutDepotBill.Disable_SaleOutDepotBill"
- sourceColumn="Disable_SaleOutDepotBill" />
- <Param name="@CreateDate_SaleOutDepotBill" type="SaleOutDepotBill.CreateDate_SaleOutDepotBill"
- sourceColumn="CreateDate_SaleOutDepotBill" />
- <Param name="@LastModUser_SaleOutDepotBill" type="SaleOutDepotBill.LastModUser_SaleOutDepotBill"
- sourceColumn="LastModUser_SaleOutDepotBill" />
- <Param name="@LastModDate_SaleOutDepotBill" type="SaleOutDepotBill.LastModDate_SaleOutDepotBill"
- sourceColumn="LastModDate_SaleOutDepotBill" />
- <Param name="@ID_Customer" type="SaleOutDepotBill.ID_Customer" sourceColumn="ID_Customer" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText=" update SaleOutDepotBill set
- No_SaleOutDepotBill=@No_SaleOutDepotBill,
- Date_SaleOutDepotBill=@Date_SaleOutDepotBill,
- ID_Location=@ID_Location,
-
-
- ID_Creator=@ID_Creator,
- ID_Assessor=@ID_Assessor,
- AssessDate_SaleOutDepotBill=@AssessDate_SaleOutDepotBill,
- Comment_SaleOutDepotBill=@Comment_SaleOutDepotBill,
- Disable_SaleOutDepotBill=@Disable_SaleOutDepotBill,
- CreateDate_SaleOutDepotBill=@CreateDate_SaleOutDepotBill,
- LastModUser_SaleOutDepotBill=@LastModUser_SaleOutDepotBill,
- LastModDate_SaleOutDepotBill=@LastModDate_SaleOutDepotBill,
- ID_Customer=@ID_Customer
- WHERE ID_SaleOutDepotBill=@ID_SaleOutDepotBill">
- <Params>
- <Param name="@ID_SaleOutDepotBill" type="SaleOutDepotBill.ID_SaleOutDepotBill" sourceColumn="ID_SaleOutDepotBill" />
- <Param name="@No_SaleOutDepotBill" type="SaleOutDepotBill.No_SaleOutDepotBill" sourceColumn="No_SaleOutDepotBill" />
- <Param name="@Date_SaleOutDepotBill" type="SaleOutDepotBill.Date_SaleOutDepotBill" sourceColumn="Date_SaleOutDepotBill" />
- <Param name="@ID_Location" type="SaleOutDepotBill.ID_Location" sourceColumn="ID_Location" />
- <Param name="@ID_Creator" type="SaleOutDepotBill.ID_Creator" sourceColumn="ID_Creator" />
- <Param name="@ID_Assessor" type="SaleOutDepotBill.ID_Assessor" sourceColumn="ID_Assessor" />
- <Param name="@AssessDate_SaleOutDepotBill" type="SaleOutDepotBill.AssessDate_SaleOutDepotBill"
- sourceColumn="AssessDate_SaleOutDepotBill" />
- <Param name="@Comment_SaleOutDepotBill" type="SaleOutDepotBill.Comment_SaleOutDepotBill"
- sourceColumn="Comment_SaleOutDepotBill" />
- <Param name="@Disable_SaleOutDepotBill" type="SaleOutDepotBill.Disable_SaleOutDepotBill"
- sourceColumn="Disable_SaleOutDepotBill" />
- <Param name="@CreateDate_SaleOutDepotBill" type="SaleOutDepotBill.CreateDate_SaleOutDepotBill"
- sourceColumn="CreateDate_SaleOutDepotBill" />
- <Param name="@LastModUser_SaleOutDepotBill" type="SaleOutDepotBill.LastModUser_SaleOutDepotBill"
- sourceColumn="LastModUser_SaleOutDepotBill" />
- <Param name="@LastModDate_SaleOutDepotBill" type="SaleOutDepotBill.LastModDate_SaleOutDepotBill"
- sourceColumn="LastModDate_SaleOutDepotBill" />
- <Param name="@ID_Customer" type="SaleOutDepotBill.ID_Customer" sourceColumn="ID_Customer" />
- </Params>
- </Update>
- <Audit CmdType="Text" CmdText=" DECLARE @Quantity_OutDepot DECIMAL(14,4)
- DECLARE @Quantity_Sale DECIMAL(14,4)
- Declare @Quantity_SaleRtn DECIMAL(14,4)
- DECLARE @SumQuantity_OutDepot DECIMAL(14,4)
- DECLARE @SumQuantity_SaleRtn DECIMAL(14,4)
- DECLARE @AMOUNT DECIMAL(14,4)
- DECLARE @AVAI DECIMAL(14,4)
- DECLARE @COUNT DECIMAL(14,4)
- DECLARE @ID_SaleSourceBillProduct UNIQUEIDENTIFIER
- DECLARE @ID_Product UNIQUEIDENTIFIER
- DECLARE @SaleAndOutDepot bit
-
- DECLARE @OutDepotAndSaleBack bit
- DECLARE @No_SaleBill nvarchar(64)
- DECLARE @No_SaleOutDepotBillProduct nvarchar(64)
- DECLARE @error nvarchar(64)
- DECLARE @ID_AssessorSaleBill UNIQUEIDENTIFIER
- DECLARE @ThisID_SaleSourceBillProduct UNIQUEIDENTIFIER
- DECLARE @ID_SaleOutDepotBillProduct UNIQUEIDENTIFIER
- DECLARE @ID_Location UNIQUEIDENTIFIER
- Declare @RtnQuantity_SaleOutDepotBillProduct decimal(14,4)
- Declare @SaleRtnSourceBill_SystemSetting bit
-
- SELECT @SaleAndOutDepot=SaleAndOutDepot_SystemSetting,@OutDepotAndSaleBack=OutDepotAndSaleBack_SystemSetting,@SaleRtnSourceBill_SystemSetting=SaleRtnSourceBill_SystemSetting FROM SystemSetting
- IF (@ID_Assessor IS NULL AND @SaleAndOutDepot = 1)
- BEGIN
- SELECT @SumQuantity_OutDepot=sum(Quantity_SaleOutDepotBillProduct),@SumQuantity_SaleRtn=sum(RtnQuantity_SaleOutDepotBillProduct)
- FROM SaleOutDepotBillProduct
- WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBill = @ID_SaleOutDepotBill
- if(@SumQuantity_OutDepot-@SumQuantity_SaleRtn=0 AND @SumQuantity_OutDepot!=0 AND @SumQuantity_SaleRtn != 0 )
- BEGIN
- RAISERROR('该单据产品已经全部退货,取消审核失败!',16,1)
- RETURN
- END
- Update SaleOutDepotBill Set Check_SaleOutDepotBill = 0 Where ID_SaleOutDepotBill = @ID_SaleOutDepotBill
- END
-
- DECLARE CUR CURSOR FOR SELECT SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct,
- SaleBillProduct.ID_SaleSourceBillProduct,
- SaleOutDepotBillProduct.ID_Product,
- SaleOutDepotBillProduct.No_FromBill,
- SaleOutDepotBillProduct.ID_SaleSourceBillProduct,
- SaleOutDepotBillProduct.ID_SaleOutDepotBillProduct,
- SaleOutDepotBillProduct.ID_Location,
- SaleOutDepotBillProduct.No_SaleOutDepotBillProduct,
- SaleOutDepotBillProduct.RtnQuantity_SaleOutDepotBillProduct
- FROM SaleOutDepotBillProduct
- LEFT JOIN SaleBill on SaleOutDepotBillProduct.No_FromBill=SaleBill.No_SaleBill
- LEFT JOIN SaleBillProduct ON SaleBillProduct.ID_SaleBill=SaleBill.ID_SaleBill and SaleOutDepotBillProduct.No_FromBillProduct=SaleBillProduct.No_SaleBillProduct
- WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBill=@ID_SaleOutDepotBill
- OPEN CUR
- FETCH NEXT FROM CUR INTO @AMOUNT,@ID_SaleSourceBillProduct,@ID_Product,@No_SaleBill,@ThisID_SaleSourceBillProduct,@ID_SaleOutDepotBillProduct,@ID_Location,@No_SaleOutDepotBillProduct,@RtnQuantity_SaleOutDepotBillProduct
- WHILE @@FETCH_STATUS = 0
- BEGIN
- SELECT @AVAI=ISNULL(StockQty_ProductStocks,0) FROM ProductStocks
- WHERE ProductStocks.ID_Product=@ID_Product AND ProductStocks.ID_Location=@ID_Location
-
- IF (@ID_Assessor IS NOT NULL)
- BEGIN
- SELECT @COUNT =COUNT(StockQty_ProductStocks) FROM ProductStocks
- WHERE ProductStocks.ID_Product=@ID_Product AND ProductStocks.ID_Location=@ID_Location
- IF(@COUNT=0)
- BEGIN
- SET @error = N'对应库位中不存在序号为'+@No_SaleOutDepotBillProduct+N'的产品,审核失败!'
- RAISERROR(@error,16,1)
- RETURN
- END
- IF (@SaleAndOutDepot != 0)
- BEGIN
- SELECT @ID_AssessorSaleBill=ID_Assessor FROM SaleBill WHERE No_SaleBill=@No_SaleBill
- IF(@ID_AssessorSaleBill is NULL)
- BEGIN
- SET @error = N'产品序号为'+@No_SaleOutDepotBillProduct+N'的来源单据尚未经过审核,审核失败!'
- RAISERROR(@error,16,1)
- return
- END
- if(@ID_SaleSourceBillProduct is not null)
- BEGIN
- SELECT @Quantity_OutDepot=ISNULL(Quantity_OutDepot,0),
- @Quantity_Sale=ISNULL(Quantity_Sale,0),
- @Quantity_SaleRtn=ISNULL(Quantity_SaleRtn,0)
- FROM SaleSourceBillProduct
- WHERE ID_SaleSourceBillProduct=@ID_SaleSourceBillProduct
- IF((@Quantity_Sale-@Quantity_OutDepot) < @AMOUNT)
- BEGIN
- SET @error = N'序号为'+@No_SaleOutDepotBillProduct+N'的产品的累计出库数量大于相应销货数量,审核失败!请于关联单据处查询。'
- RAISERROR(@error,16,1)
- RETURN
- END
- IF(@AMOUNT <@RtnQuantity_SaleOutDepotBillProduct)
- BEGIN
- SET @error = N'序号为'+@No_SaleOutDepotBillProduct+N'的产品的累计出库数量小于相应退货数量,审核失败!请于关联单据处查询。'
- RAISERROR(@error,16,1)
- RETURN
- END
- IF(@SaleRtnSourceBill_SystemSetting=0)
- BEGIN
- IF(@Quantity_SaleRtn >(@Quantity_OutDepot+@AMOUNT))
- BEGIN
- SET @error = N'序号为'+@No_SaleOutDepotBillProduct+N'的产品的累计出库数量小于相应退货数量,审核失败!请于关联单据处查询。'
- RAISERROR(@error,16,1)
- RETURN
- END
- END
- END
- UPDATE SaleSourceBillProduct set Quantity_OutDepot=Quantity_OutDepot+@AMOUNT
- WHERE ID_SaleSourceBillProduct=@ID_SaleSourceBillProduct
-
- UPDATE SaleOutDepotBillProduct set ID_SaleSourceBillProduct=@ID_SaleSourceBillProduct
- WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBillProduct=@ID_SaleOutDepotBillProduct
-
- END
- IF (@SaleAndOutDepot=0)
- BEGIN
- IF(@OutDepotAndSaleBack != 0)
- BEGIN
- IF(@AMOUNT <@RtnQuantity_SaleOutDepotBillProduct)
- BEGIN
- SET @error = N'序号为'+@No_SaleOutDepotBillProduct+N'的产品的累计出库数量小于相应退货数量,审核失败!请于关联单据处查询。'
- RAISERROR(@error,16,1)
- RETURN
- END
- IF(EXISTS(SELECT * FROM SaleSourceBillProduct
- WHERE ID_SaleSourceBillProduct = @ThisID_SaleSourceBillProduct))
- BEGIN
- UPDATE SaleSourceBillProduct set Quantity_OutDepot=Quantity_OutDepot+@AMOUNT
- WHERE ID_SaleSourceBillProduct=@ThisID_SaleSourceBillProduct
- END
- ELSE
- BEGIN
- INSERT INTO SaleSourceBillProduct (ID_SaleSourceBillProduct,Quantity_OutDepot)
- VALUES(@ThisID_SaleSourceBillProduct,@AMOUNT)
- UPDATE SaleOutDepotBillProduct set ID_SaleSourceBillProduct=@ThisID_SaleSourceBillProduct
- WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBillProduct=@ID_SaleOutDepotBillProduct
- END
- END
- END
- IF (@AVAI < @AMOUNT)
- BEGIN
- SET @error = N'序号为'+@No_SaleOutDepotBillProduct+N'的产品库存数量不足,审核失败!'
- RAISERROR(@error,16,1)
- RETURN
- END
- UPDATE ProductStocks SET StockQty_ProductStocks=StockQty_ProductStocks-@AMOUNT
- WHERE ProductStocks.ID_Product=@ID_Product AND ProductStocks.ID_Location=@ID_Location
- END
- ELSE IF (@ID_Assessor IS NULL)
- BEGIN
- IF (@OutDepotAndSaleBack != 0 OR @SaleAndOutDepot != 0)
- BEGIN
- UPDATE SaleSourceBillProduct set Quantity_OutDepot=Quantity_OutDepot-@AMOUNT
- WHERE ID_SaleSourceBillProduct=@ThisID_SaleSourceBillProduct
- END
- UPDATE ProductStocks SET StockQty_ProductStocks=StockQty_ProductStocks+@AMOUNT
- WHERE ProductStocks.ID_Product=@ID_Product AND ProductStocks.ID_Location=@ID_Location
- END
- FETCH NEXT FROM CUR INTO @AMOUNT,@ID_SaleSourceBillProduct,@ID_Product,@No_SaleBill,@ThisID_SaleSourceBillProduct,@ID_SaleOutDepotBillProduct,@ID_Location,@No_SaleOutDepotBillProduct,@RtnQuantity_SaleOutDepotBillProduct
- END
- CLOSE CUR
- DEALLOCATE CUR
-
- UPDATE SaleOutDepotBill SET
- ID_Assessor=@ID_Assessor,
- AssessDate_SaleOutDepotBill=@AssessDate_SaleOutDepotBill,
- Disable_SaleOutDepotBill=@Disable_SaleOutDepotBill
- WHERE ID_SaleOutDepotBill=@ID_SaleOutDepotBill">
- <Params>
- <Param name="@ID_SaleOutDepotBill" type="SaleOutDepotBill.ID_SaleOutDepotBill" sourceColumn="ID_SaleOutDepotBill" />
- <Param name="@No_SaleOutDepotBill" type="SaleOutDepotBill.No_SaleOutDepotBill" sourceColumn="No_SaleOutDepotBill" />
- <Param name="@ID_Assessor" type="SaleOutDepotBill.ID_Assessor" sourceColumn="ID_Assessor" />
- <Param name="@AssessDate_SaleOutDepotBill" type="SaleOutDepotBill.AssessDate_SaleOutDepotBill"
- sourceColumn="AssessDate_SaleOutDepotBill" />
- <Param name="@Disable_SaleOutDepotBill" type="SaleOutDepotBill.Disable_SaleOutDepotBill" sourceColumn="Disable_SaleOutDepotBill" />
- </Params>
- </Audit>
- <Delete CmdType="Text" CmdText="
- DECLARE @SumRtnQuantity decimal(14,4)
- DECLARE @ID_SaleSourceBillProduct UNIQUEIDENTIFIER
- DECLARE @SaleAndOutDepot bit
- DECLARE @OutDepotAndSaleBack bit
- DECLARE @SaleRtnSourceBill_SystemSetting bit
-
- SELECT @SaleAndOutDepot=SaleAndOutDepot_SystemSetting,@OutDepotAndSaleBack=OutDepotAndSaleBack_SystemSetting,@SaleRtnSourceBill_SystemSetting=SaleRtnSourceBill_SystemSetting FROM SystemSetting
- SELECT @SumRtnQuantity = Sum(RtnQuantity_SaleOutDepotBillProduct)
- FROM SaleOutDepotBillProduct
- WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBill = @ID_SaleOutDepotBill
-
- if(@SumRtnQuantity > 0)
- BEGIN
- RAISERROR('该单据已有相应的销售退货记录,删除失败!',16,1)
- return
- END
- if(@AssessDate_SaleOutDepotBill Is Not Null And @SaleRtnSourceBill_SystemSetting=0)
- BEGIN
- IF(Select Count(*)
- From SaleOutDepotBillProduct
- LEFT JOIN SaleSourceBillProduct ON SaleSourceBillProduct.ID_SaleSourceBillProduct=SaleOutDepotBillProduct.ID_SaleSourceBillProduct
- Where ID_SaleOutDepotBill=@ID_SaleOutDepotBill And (Quantity_OutDepot-Quantity_SaleRtn) < 0 ) > 0
- BEGIN
- RAISERROR('该单据已有相应的销售退货记录,删除失败!',16,1)
- return
- END
- END
- if(@SaleAndOutDepot=0 AND @OutDepotAndSaleBack != 0)
- BEGIN
- DELETE SaleSourceBillProduct WHERE ID_SaleSourceBillProduct in (SELECT ID_SaleSourceBillProduct FROM SaleOutDepotBillProduct where SaleOutDepotBillProduct.ID_SaleOutDepotBill=@ID_SaleOutDepotBill)
- END
- DELETE SaleOutDepotBillProduct WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBill = @ID_SaleOutDepotBill
- DELETE FROM BillComment WHERE ID_Bill = @ID_SaleOutDepotBill
- DELETE FROM ReportComment WHERE ID_Bill=@ID_SaleOutDepotBill
- if(@SaleAndOutDepot=0 and @OutDepotAndSaleBack=0)
- BEGIN
- UPDATE SaleOutDepotBill set Disable_SaleOutDepotBill=1 where SaleOutDepotBill.ID_SaleOutDepotBill = @ID_SaleOutDepotBill
- END
- ELSE
- BEGIN
- DELETE SaleOutDepotBill WHERE SaleOutDepotBill.ID_SaleOutDepotBill = @ID_SaleOutDepotBill
- END">
- <Params>
- <Param name="@ID_SaleOutDepotBill" type="SaleOutDepotBill.ID_SaleOutDepotBill" sourceColumn="ID_SaleOutDepotBill" />
- <Param name="@AssessDate_SaleOutDepotBill" type="SaleOutDepotBill.AssessDate_SaleOutDepotBill"
- sourceColumn="AssessDate_SaleOutDepotBill" />
- </Params>
- </Delete>
- <FKErrorReport ErrorMessage="本记录被其他单据使用过,删除失败!" />
- <UNIQUEErrorReport ErrorMessage="销货出库单号已存在,提交失败!" />
- </Table>
- <Table name="SaleOutDepotBillProduct" Type="Child">
- <GetSchema CmdType="Text" CmdText="SELECT TOP 0 SaleOutDepotBillProduct.*,
- BillType.Name_BillType AS Name_FromBill,
- No_FromBill AS No_SaleOutDepotBill,
- Product.No_Product,
- Product.Name_Product,
- Product.Unit_Product, Product.Name_Product AS No_SaleOutDepotBill,
- Location.Name_Location, Location.ID_Location,Location.No_Location
- FROM SaleOutDepotBillProduct
- LEFT JOIN BillType ON BillType.Value_BillType=SaleOutDepotBillProduct.Type_FromBill
- LEFT JOIN Location ON Location.ID_Location=SaleOutDepotBillProduct.ID_Location
- LEFT JOIN Product ON SaleOutDepotBillProduct.ID_Product=Product.ID_Product
- " />
- <New CmdType="Text" CmdText="
- Declare @Error nvarchar(256)
- IF(@Quantity_SaleOutDepotBillProduct>(Select IsNull(StockQty_ProductStocks,0) From ProductStocks Where ID_Product=@ID_Product And ID_Location=@ID_Location))
- Begin
- SET @Error = N'序号为'+@No_SaleOutDepotBillProduct+N'的产品的出库数量大于相应库存数量,提交失败!'
- RAISERROR(@Error,16,1)
- RETURN
- End
-
- SET @ID_SaleSourceBillProduct = NULL
- if(@ID_IndentBillOnNetProduct='00000000-0000-0000-0000-000000000000') Set @ID_IndentBillOnNetProduct=Null
- INSERT INTO SaleOutDepotBillProduct(ID_SaleOutDepotBillProduct,
- No_SaleOutDepotBillProduct,
- ID_SaleOutDepotBill,
- ID_SaleSourceBillProduct,
- Type_FromBill,
- No_FromBill,
- No_FromBillProduct,
- ID_Product,
- ID_Location,
- Quantity_SaleOutDepotBillProduct,
- UnitPrice_SaleOutDepotBillProduct,
- Comment_SaleOutDepotBillProduct,
- ID_IndentBillOnNetProduct)
- VALUES( @ID_SaleOutDepotBillProduct,
- @No_SaleOutDepotBillProduct,
- @ID_SaleOutDepotBill,
- @ID_SaleSourceBillProduct,
- @Type_FromBill,
- @No_FromBill,
- @No_FromBillProduct,
- @ID_Product,
- @ID_Location,
- @Quantity_SaleOutDepotBillProduct,
- @UnitPrice_SaleOutDepotBillProduct,
- @Comment_SaleOutDepotBillProduct,
- @ID_IndentBillOnNetProduct)">
- <Params>
- <Param name="@ID_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.ID_SaleOutDepotBillProduct"
- sourceColumn="ID_SaleOutDepotBillProduct" />
- <Param name="@No_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.No_SaleOutDepotBillProduct"
- sourceColumn="No_SaleOutDepotBillProduct" />
- <Param name="@ID_SaleOutDepotBill" type="SaleOutDepotBillProduct.ID_SaleOutDepotBill" sourceColumn="ID_SaleOutDepotBill" />
- <Param name="@ID_SaleSourceBillProduct" type="SaleOutDepotBillProduct.ID_SaleSourceBillProduct"
- sourceColumn="ID_SaleSourceBillProduct" />
- <Param name="@Type_FromBill" type="SaleOutDepotBillProduct.Type_FromBill" sourceColumn="Type_FromBill" />
- <Param name="@No_FromBill" type="SaleOutDepotBillProduct.No_FromBill" sourceColumn="No_FromBill" />
- <Param name="@No_FromBillProduct" type="SaleOutDepotBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
- <Param name="@ID_Product" type="SaleOutDepotBillProduct.ID_Product" sourceColumn="ID_Product" />
- <Param name="@ID_Location" type="SaleOutDepotBillProduct.ID_Location" sourceColumn="ID_Location" />
- <Param name="@Quantity_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct"
- sourceColumn="Quantity_SaleOutDepotBillProduct" />
- <Param name="@Comment_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.Comment_SaleOutDepotBillProduct"
- sourceColumn="Comment_SaleOutDepotBillProduct" />
- <Param name="@UnitPrice_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.UnitPrice_SaleOutDepotBillProduct"
- sourceColumn="UnitPrice_SaleOutDepotBillProduct" />
- <Param name="@ID_IndentBillOnNetProduct" type="SaleBillProduct.ID_IndentBillOnNetProduct" sourceColumn="ID_IndentBillOnNetProduct" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText="DECLARE @SaleAndOutDepot bit
- DECLARE @OutDepotAndSaleBack bit
- DECLARE @Quantity_Sale decimal(16,4)
- DECLARE @Quantity_SaleRtn decimal(16,4)
- DECLARE @Quantity_OutDepot decimal(16,4)
- DECLARE @AssessDate_SaleOutDepotBill datetime
- DECLARE @error nvarchar(64)
- SELECT @SaleAndOutDepot=SaleAndOutDepot_SystemSetting,@OutDepotAndSaleBack=OutDepotAndSaleBack_SystemSetting FROM SystemSetting
- SELECT @AssessDate_SaleOutDepotBill=AssessDate_SaleOutDepotBill FROM SaleOutDepotBill WHERE ID_SaleOutDepotBill = @ID_SaleOutDepotBill
- IF(@SaleAndOutDepot=1 AND @AssessDate_SaleOutDepotBill IS NOT NULL)
- BEGIN
- SELECT @Quantity_Sale=Quantity_Sale,@Quantity_OutDepot=Quantity_OutDepot,@Quantity_SaleRtn=Quantity_SaleRtn FROM SaleSourceBillProduct
- WHERE ID_SaleSourceBillProduct=@ID_SaleSourceBillProduct
- IF(@Quantity_SaleOutDepotBillProduct+@Quantity_OutDepot > @Quantity_Sale)
- BEGIN
- SET @error = N'序号为'+@No_SaleOutDepotBillProduct+N'的产品的累计出库数量大于相应销货数量,提交失败!请于关联单据处查询。'
- RAISERROR(@error,16,1)
- RETURN
- END
- IF(@Quantity_SaleOutDepotBillProduct <@RtnQuantity_SaleOutDepotBillProduct)
- BEGIN
- SET @error = N'序号为'+@No_SaleOutDepotBillProduct+N'的产品的累计出库数量小于相应退货数量,审核失败!请于关联单据处查询。'
- RAISERROR(@error,16,1)
- RETURN
- END
- END
- IF(@SaleAndOutDepot=0 AND @OutDepotAndSaleBack=1 AND @AssessDate_SaleOutDepotBill IS NOT NULL )
- IF(@Quantity_SaleOutDepotBillProduct <@RtnQuantity_SaleOutDepotBillProduct)
- BEGIN
- SET @error = N'序号为'+@No_SaleOutDepotBillProduct+N'的产品的累计出库数量小于相应退货数量,审核失败!请于关联单据处查询。'
- RAISERROR(@error,16,1)
- RETURN
- END
-
- UPDATE SaleOutDepotBillProduct SET
- No_SaleOutDepotBillProduct=@No_SaleOutDepotBillProduct,
- ID_SaleOutDepotBill=@ID_SaleOutDepotBill,
- ID_SaleSourceBillProduct=@ID_SaleSourceBillProduct,
- Type_FromBill=@Type_FromBill,
- No_FromBill=@No_FromBill,
- No_FromBillProduct=@No_FromBillProduct,
- ID_Product=@ID_Product,
- ID_Location=@ID_Location,
- Quantity_SaleOutDepotBillProduct=@Quantity_SaleOutDepotBillProduct,
- UnitPrice_SaleOutDepotBillProduct=@UnitPrice_SaleOutDepotBillProduct,
- Comment_SaleOutDepotBillProduct=@Comment_SaleOutDepotBillProduct,
- ID_IndentBillOnNetProduct=@ID_IndentBillOnNetProduct
- WHERE ID_SaleOutDepotBillProduct=@ID_SaleOutDepotBillProduct">
- <Params>
- <Param name="@ID_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.ID_SaleOutDepotBillProduct"
- sourceColumn="ID_SaleOutDepotBillProduct" />
- <Param name="@No_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.No_SaleOutDepotBillProduct"
- sourceColumn="No_SaleOutDepotBillProduct" />
- <Param name="@ID_SaleOutDepotBill" type="SaleOutDepotBillProduct.ID_SaleOutDepotBill" sourceColumn="ID_SaleOutDepotBill" />
- <Param name="@ID_SaleSourceBillProduct" type="SaleOutDepotBillProduct.ID_SaleSourceBillProduct"
- sourceColumn="ID_SaleSourceBillProduct" />
- <Param name="@Type_FromBill" type="SaleOutDepotBillProduct.Type_FromBill" sourceColumn="Type_FromBill" />
- <Param name="@No_FromBill" type="SaleOutDepotBillProduct.No_FromBill" sourceColumn="No_FromBill" />
- <Param name="@No_FromBillProduct" type="SaleOutDepotBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
- <Param name="@ID_Product" type="SaleOutDepotBillProduct.ID_Product" sourceColumn="ID_Product" />
- <Param name="@ID_Location" type="SaleOutDepotBillProduct.ID_Location" sourceColumn="ID_Location" />
- <Param name="@Quantity_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct"
- sourceColumn="Quantity_SaleOutDepotBillProduct" />
- <Param name="@Comment_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.Comment_SaleOutDepotBillProduct"
- sourceColumn="Comment_SaleOutDepotBillProduct" />
- <Param name="@RtnQuantity_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.RtnQuantity_SaleOutDepotBillProduct"
- sourceColumn="RtnQuantity_SaleOutDepotBillProduct" />
- <Param name="@UnitPrice_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.UnitPrice_SaleOutDepotBillProduct"
- sourceColumn="UnitPrice_SaleOutDepotBillProduct" />
- <Param name="@ID_IndentBillOnNetProduct" type="SaleBillProduct.ID_IndentBillOnNetProduct" sourceColumn="ID_IndentBillOnNetProduct" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText="DELETE SaleOutDepotBillProduct WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBillProduct = @ID_SaleOutDepotBillProduct">
- <Params>
- <Param name="@ID_SaleOutDepotBillProduct" type="SaleOutDepotBillProduct.ID_SaleOutDepotBillProduct"
- sourceColumn="ID_SaleOutDepotBillProduct" />
- </Params>
- </Delete>
- </Table>
- <Table name="BillComment" Type="Child">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 BillComment.* FROM BillComment" />
- <New CmdType="Text" CmdText=" INSERT INTO BillComment (ID_BillComment, ID_Bill, Comment_BillComment)
- VALUES (@ID_BillComment, @ID_Bill, @Comment_BillComment)">
- <Params>
- <Param name="@ID_BillComment" type="BillComment.ID_BillComment" sourceColumn="ID_BillComment" />
- <Param name="@ID_Bill" type="BillComment.ID_Bill" sourceColumn="ID_Bill" />
- <Param name="@Comment_BillComment" type="BillComment.Comment_BillComment" sourceColumn="Comment_BillComment" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText=" UPDATE BillComment SET ID_Bill = @ID_Bill, Comment_BillComment = @Comment_BillComment
- WHERE ID_BillComment = @ID_BillComment">
- <Params>
- <Param name="@ID_BillComment" type="BillComment.ID_BillComment" sourceColumn="ID_BillComment" />
- <Param name="@ID_Bill" type="BillComment.ID_Bill" sourceColumn="ID_Bill" />
- <Param name="@Comment_BillComment" type="BillComment.Comment_BillComment" sourceColumn="Comment_BillComment" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText=" DELETE BillComment WHERE ID_BillComment = @ID_BillComment">
- <Params>
- <Param name="@ID_BillComment" type="BillComment.ID_BillComment" sourceColumn="ID_BillComment" />
- </Params>
- </Delete>
- </Table>
- <Table name="ReportComment" Type="Child">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 ReportComment.* ,Convert(nvarchar(64), '') as No_SaleOutDepotBill FROM ReportComment" />
- <New CmdType="Text" CmdText=" INSERT INTO ReportComment (ID_ReportComment, ID_Bill, Comment_ReportComment)
- VALUES (@ID_ReportComment, @ID_Bill, @Comment_ReportComment)">
- <Params>
- <Param name="@ID_ReportComment" type="ReportComment.ID_BillComment" sourceColumn="ID_ReportComment" />
- <Param name="@ID_Bill" type="ReportComment.ID_Bill" sourceColumn="ID_Bill" />
- <Param name="@Comment_ReportComment" type="ReportComment.Comment_ReportComment" sourceColumn="Comment_ReportComment" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText=" UPDATE ReportComment SET ID_Bill = @ID_Bill, Comment_ReportComment = @Comment_ReportComment
- WHERE ID_ReportComment = @ID_ReportComment">
- <Params>
- <Param name="@ID_ReportComment" type="ReportComment.ID_BillComment" sourceColumn="ID_ReportComment" />
- <Param name="@ID_Bill" type="ReportComment.ID_Bill" sourceColumn="ID_Bill" />
- <Param name="@Comment_ReportComment" type="ReportComment.Comment_ReportComment" sourceColumn="Comment_ReportComment" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText=" DELETE ReportComment WHERE ID_ReportComment = @ID_ReportComment">
- <Params>
- <Param name="@ID_ReportComment" type="ReportComment.ID_ReportComment" sourceColumn="ID_ReportComment" />
- </Params>
- </Delete>
- </Table>
- <Table name="SaleBillComment" Type="Other">
- <GetSchema CmdType="Text" CmdText="Select Top 0 Comment_ReportComment from ReportComment" />
- </Table>
- </Tables>
- <Search>
- <SearchAllBill CmdType="Text" CmdText=" SELECT SaleOutDepotBill.*,a.Name_User,b.Name_User as Name_UserAuti
- ,c.Name_User as Name_LastModUser,
- Location.Name_Location,Location.No_Location
- ,Customer.Name_Customer, Customer.ShortName_Customer,Customer.No_Customer
- FROM SaleOutDepotBill
- LEFT JOIN Customer ON Customer.ID_Customer = SaleOutDepotBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = SaleOutDepotBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = SaleOutDepotBill.ID_Assessor
- Left JOIN AppUser c ON c.ID_User = SaleOutDepotBill.LastModUser_SaleOutDepotBill
- LEFT JOIN Location ON Location.ID_Location = SaleOutDepotBill.ID_Location
- WHERE Disable_SaleOutDepotBill = 0
- ">
- <Tables>
- <Table name="AllBill" />
- </Tables>
- </SearchAllBill>
- <SearchAllProduct CmdType="Text" CmdText="SELECT Product.No_Product,Product.Name_Product ,Type_Product, Price_Product, LowSalePrice_Product, SafetyQty_Product FROM Product ">
- <Tables>
- <Table name="AllProduct" />
- </Tables>
- </SearchAllProduct>
- <SearchAllLocation CmdType="Text" CmdText="SELECT No_Location,Name_Location FROM Location ">
- <Tables>
- <Table name="Location" />
- </Tables>
- </SearchAllLocation>
- <SearchSystemSetting CmdType="Text" CmdText=" SELECT CessOut_SystemSetting,SaleAndOutDepot_SystemSetting,OutDepotAndSaleBack_SystemSetting,SaleRtnSourceBill_SystemSetting,SysCurrency_SystemSetting,
- UnitPriceDecimal_SystemSetting, PriceDecimal_SystemSetting, QuantityDecimal_SystemSetting,CostDecimal_SystemSetting FROM SystemSetting">
- <Tables>
- <Table name="System" />
- </Tables>
- </SearchSystemSetting>
- <SearchContr CmdType="Text" CmdText=" SELECT SystemSetting.OutDepotAndSaleBack_SystemSetting FROM SystemSetting WHERE SystemSetting.OutDepotAndSaleBack_SystemSetting = 1">
- <Tables>
- <Table name="SystemInDepot" />
- </Tables>
- </SearchContr>
- <SearchContrOut CmdType="Text" CmdText=" SELECT SystemSetting.SaleAndOutDepot_SystemSetting FROM SystemSetting WHERE SystemSetting.SaleAndOutDepot_SystemSetting = 1">
- <Tables>
- <Table name="SystemSaleAndOutDepot" />
- </Tables>
- </SearchContrOut>
- <SearchSaleOutDepotBillWithNo CmdType="Text" CmdText=" DECLARE @ID_SaleOutDepotBill uniqueidentifier
- SELECT SaleOutDepotBill.*,a.Name_User
- ,b.Name_User as Name_UserAuti,c.Name_User as Name_LastModUser
- ,Location.Name_Location,Location.No_Location
- ,Customer.Name_Customer,Customer.ShortName_Customer
- ,Customer.No_Customer
- FROM SaleOutDepotBill
- LEFT JOIN Customer ON Customer.ID_Customer = SaleOutDepotBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = SaleOutDepotBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = SaleOutDepotBill.ID_Assessor
- Left JOIN AppUser c ON c.ID_User = SaleOutDepotBill.LastModUser_SaleOutDepotBill
- LEFT JOIN Location ON Location.ID_Location = SaleOutDepotBill.ID_Location
- WHERE No_SaleOutDepotBill = @No_SaleOutDepotBill
-
- SELECT @ID_SaleOutDepotBill=ID_SaleOutDepotBill
- FROM SaleOutDepotBill
- WHERE No_SaleOutDepotBill = @No_SaleOutDepotBill
-
- SELECT SaleOutDepotBillProduct.*,
- BillType.Name_BillType AS Name_FromBill,
- No_FromBill AS No_SaleOutDepotBill,
- Product.No_Product,
- Product.Name_Product,
- Product.Unit_Product,Product.Name_Product AS No_SaleOutDepotBill
- ,Location.Name_Location, Location.ID_Location
- ,Location.No_Location
- FROM SaleOutDepotBillProduct
- LEFT JOIN BillType ON BillType.Value_BillType=SaleOutDepotBillProduct.Type_FromBill
- LEFT JOIN Location ON Location.ID_Location=SaleOutDepotBillProduct.ID_Location
- LEFT JOIN Product ON SaleOutDepotBillProduct.ID_Product=Product.ID_Product
- WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBill=@ID_SaleOutDepotBill
- ORDER BY CAST(No_SaleOutDepotBillProduct AS INT)
-
- SELECT BillComment.*
- FROM BillComment
- LEFT JOIN SaleOutDepotBill ON SaleOutDepotBill.ID_SaleOutDepotBill=BillComment.ID_Bill
- WHERE ID_SaleOutDepotBill=@ID_SaleOutDepotBill
- order by BillComment.No_BillComment
-
- SELECT ReportComment.*,@No_SaleOutDepotBill as No_SaleOutDepotBill
- FROM ReportComment
- LEFT JOIN SaleOutDepotBill ON SaleOutDepotBill.ID_SaleOutDepotBill=ReportComment.ID_Bill
- WHERE ID_SaleOutDepotBill=@ID_SaleOutDepotBill
- order by ReportComment.No_ReportComment
- ">
- <Params>
- <Param name="@No_SaleOutDepotBill" type="SaleOutDepotBill.No_SaleOutDepotBill" Index="0" />
- </Params>
- <Tables>
- <Table name="SaleOutDepotBill" />
- <Table name="SaleOutDepotBillProduct" />
- <Table name="BillComment" />
- <Table name="ReportComment" />
- </Tables>
- </SearchSaleOutDepotBillWithNo>
- <SearchLocationByNo CmdType="Text" CmdText="
- SELECT ID_Location, Name_Location FROM Location WHERE No_Location=@No_Location
- ">
- <Params>
- <Param name="@No_Location" type="Location.No_Location" Index="0" />
- </Params>
- <Tables>
- <Table name="Location" />
- </Tables>
- </SearchLocationByNo>
- <SearchLocation CmdType="Text" CmdText="SELECT Name_Location,ID_Location,No_Location FROM Location WHERE SubjectionID_Location Is Null">
- <Tables>
- <Table name="Location" />
- </Tables>
- </SearchLocation>
- <SearchProductLocation CmdType="Text" CmdText=" SELECT Name_Location,ID_Location FROM Location WHERE ID_Warehouse=@ID_Location AND LowestLevel_Location=1">
- <Params>
- <Param name="@ID_Location" type="Location.ID_Location" Index="0" />
- </Params>
- <Tables>
- <Table name="ProductLocationFromWarehouse" />
- </Tables>
- </SearchProductLocation>
- <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">
- <Params>
- <Param name="@ID_Warehouse" type="Location.ID_Warehouse" Index="0" />
- <Param name="@ID_Location" type="Location.ID_Location" Index="1" />
- </Params>
- <Tables>
- <Table name="JudgeLocationAndWarehouse" />
- </Tables>
- </SearchJudgeLocationAndWarehouse>
- <SearchLocationWithName CmdType="Text" CmdText="SELECT ID_Location FROM Location WHERE Name_Location=@Name_Location">
- <Params>
- <Param name="@Name_Location" type="Location.Name_Location" Index="0" />
- </Params>
- <Tables>
- <Table name="JudgeLocation" />
- </Tables>
- </SearchLocationWithName>
- <SearchAppUserPopedom CmdType="Text" CmdText=" SELECT * FROM SaleOutDepotBill WHERE SaleOutDepotBill.ID_Creator=@ID_User">
- <Params>
- <Param name="@ID_User" type="AppUser.ID_User" Index="0" />
- </Params>
- <Tables>
- <Table name="AppUserPopedom" />
- </Tables>
- </SearchAppUserPopedom>
- <SearchNo_FromBill CmdType="Text" CmdText="SELECT * FROM SaleBill WHERE No_SaleBill=@No_SaleBill">
- <Params>
- <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" Index="0" />
- </Params>
- <Tables>
- <Table name="NoFromBill" />
- </Tables>
- </SearchNo_FromBill>
- <SearchBillTypeWithName CmdType="Text" CmdText=" SELECT BillType.Value_BillType FROM BillType WHERE BillType.Name_BillType = @Name_BillType">
- <Params>
- <Param name="@Name_BillType" type="BillType.Name_BillType" Index="0" />
- </Params>
- <Tables>
- <Table name="BillType" />
- </Tables>
- </SearchBillTypeWithName>
- <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">
- <Tables>
- <Table name="SaleBillType" />
- </Tables>
- </SearchBillType>
- <SearchNo_SaleBillProduct CmdType="Text" CmdText=" DECLARE @ID_SaleBill uniqueidentifier
- declare @TaxCurrency_SaleBill nvarchar(64)
- SELECT @ID_SaleBill=ID_SaleBill,@TaxCurrency_SaleBill=TaxCurrency_SaleBill FROM SaleBill WHERE No_SaleBill=@No_SaleBill and SaleBill.Disable_SaleBill=0
- SELECT SaleBillProduct.*,@TaxCurrency_SaleBill as TaxCurrency_SaleBill, Product.ID_Product, Product.No_Product,
- Product.Name_Product,Product.SuspendDate_Product,Comment_NoSBProduct = Case WHEN No_OrderBill='' THEN No_OrderBill else '订:'+ No_OrderBill END,
- Product.Unit_Product,Product.Cost_Product,Product.AvailableQty_ProductStocks,
- ISNULL(convert(decimal(18,2),SaleSourceBillProduct.Quantity_Sale-SaleSourceBillProduct.Quantity_OutDepot),0) as Mount
- FROM SaleBillProduct
- LEFT JOIN SaleBill ON SaleBill.ID_SaleBill = SaleBillProduct.ID_SaleBill
- LEFT JOIN Product ON Product.ID_Product=SaleBillProduct.ID_Product
- LEFT JOIN SaleSourceBillProduct ON SaleSourceBillProduct.ID_SaleSourceBillProduct=SaleBillProduct.ID_SaleSourceBillProduct
- WHERE SaleBillProduct.ID_SaleBill=@ID_SaleBill AND SaleBillProduct.No_SaleBillProduct=@No_SaleBillProduct">
- <Params>
- <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" Index="0" />
- <Param name="@No_SaleBillProduct" type="SaleBillProduct.No_SaleBillProduct" Index="1" />
- </Params>
- <Tables>
- <Table name="NoSBProduct" />
- </Tables>
- </SearchNo_SaleBillProduct>
- <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
- FROM Product WHERE Product.No_Product=@No_Product">
- <Params>
- <Param name="@No_Product" type="Product.No_Product" Index="0" />
- </Params>
- <Tables>
- <Table name="NoProduct" />
- </Tables>
- </SearchNo_Product>
- <SearchCallBackOut_FunctionSetting CmdType="Text" CmdText="SELECT SaleFeedBackOut_FunctionSetting FROM FunctionSetting">
- <Tables>
- <Table name="FunctionSetting" />
- </Tables>>
- </SearchCallBackOut_FunctionSetting>
- <SearchSaleBillAuditWithNo CmdType="Text" CmdText="SELECT ID_Assessor FROM SaleBill WHERE No_SaleBill=@No_SaleBill">
- <Params>
- <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" Index="0" />
- </Params>
- <Tables>
- <Table name="SaleBillAudit" />
- </Tables>
- </SearchSaleBillAuditWithNo>
- <SearchSaleOutDepotBillFirst CmdType="Text" CmdText=" DECLARE @SaleOutDepotBillNo nvarchar(64)
- DECLARE @ID_SaleOutDepotBill uniqueidentifier
- SELECT TOP 1 @ID_SaleOutDepotBill = SaleOutDepotBill.ID_SaleOutDepotBill
- ,@SaleOutDepotBillNo = SaleOutDepotBill.No_SaleOutDepotBill
- FROM SaleOutDepotBill
- ORDER BY SaleOutDepotBill.No_SaleOutDepotBill
-
- SELECT SaleOutDepotBill.*
- ,a.Name_User,b.Name_User as Name_UserAuti
- ,c.Name_User as Name_LastModUser
- ,Location.Name_Location ,Location.No_Location
- ,Customer.Name_Customer,Customer.ShortName_Customer
- ,Customer.No_Customer
- FROM SaleOutDepotBill
- LEFT JOIN Customer ON Customer.ID_Customer = SaleOutDepotBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = SaleOutDepotBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = SaleOutDepotBill.ID_Assessor
- Left JOIN AppUser c ON c.ID_User = SaleOutDepotBill.LastModUser_SaleOutDepotBill
- LEFT JOIN Location ON Location.ID_Location = SaleOutDepotBill.ID_Location
- WHERE No_SaleOutDepotBill = @SaleOutDepotBillNo
-
- SELECT SaleOutDepotBillProduct.*
- ,BillType.Name_BillType AS Name_FromBill
- ,No_FromBill AS No_SaleOutDepotBill
- ,Product.No_Product,Product.Name_Product
- ,Product.Unit_Product,Product.Name_Product AS No_SaleOutDepotBill
- ,Location.Name_Location, Location.ID_Location
- ,Location.No_Location
- FROM SaleOutDepotBillProduct
- LEFT JOIN BillType ON BillType.Value_BillType=SaleOutDepotBillProduct.Type_FromBill
- LEFT JOIN Location ON Location.ID_Location=SaleOutDepotBillProduct.ID_Location
- LEFT JOIN Product ON SaleOutDepotBillProduct.ID_Product=Product.ID_Product
- WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBill=@ID_SaleOutDepotBill
- ORDER BY CAST(No_SaleOutDepotBillProduct AS INT)
-
- SELECT BillComment.*
- FROM BillComment
- WHERE ID_Bill=@ID_SaleOutDepotBill
- order by BillComment.No_BillComment
-
- SELECT ReportComment.*,@SaleOutDepotBillNo as No_SaleOutDepotBill
- FROM ReportComment
- WHERE ID_Bill=@ID_SaleOutDepotBill
- Order by ReportComment.No_ReportComment
- ">
- <Params>
- <Param name="@No_SaleOutDepotBill" type="SaleOutDepotBill.No_SaleOutDepotBill" Index="0" />
- </Params>
- <Tables>
- <Table name="SaleOutDepotBill" />
- <Table name="SaleOutDepotBillProduct" />
- <Table name="BillComment" />
- <Table name="ReportComment" />
- </Tables>
- </SearchSaleOutDepotBillFirst>
- <SearchSaleOutDepotBillPrevious CmdType="Text" CmdText="DECLARE @SaleOutDepotBillNo nvarchar(64)
- DECLARE @ID_SaleOutDepotBill uniqueidentifier
- SELECT TOP 1 @ID_SaleOutDepotBill = ID_SaleOutDepotBill,@SaleOutDepotBillNo = SaleOutDepotBill.No_SaleOutDepotBill FROM SaleOutDepotBill WHERE SaleOutDepotBill.No_SaleOutDepotBill < @No_SaleOutDepotBill ORDER BY SaleOutDepotBill.No_SaleOutDepotBill DESC
- SELECT SaleOutDepotBill.*,a.Name_User,b.Name_User as Name_UserAuti,c.Name_User as Name_LastModUser,
- Location.Name_Location,Location.No_Location,Customer.Name_Customer, Customer.ShortName_Customer,Customer.No_Customer
- FROM SaleOutDepotBill
- LEFT JOIN Customer ON Customer.ID_Customer = SaleOutDepotBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = SaleOutDepotBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = SaleOutDepotBill.ID_Assessor
- Left JOIN AppUser c ON c.ID_User = SaleOutDepotBill.LastModUser_SaleOutDepotBill
- LEFT JOIN Location ON Location.ID_Location = SaleOutDepotBill.ID_Location
- WHERE No_SaleOutDepotBill = @SaleOutDepotBillNo
- SELECT SaleOutDepotBillProduct.*,
- BillType.Name_BillType AS Name_FromBill,
- No_FromBill AS No_SaleOutDepotBill,
- Product.No_Product,
- Product.Name_Product,
- Product.Unit_Product, Product.Name_Product AS No_SaleOutDepotBill,
- Location.Name_Location, Location.ID_Location,Location.No_Location
- FROM SaleOutDepotBillProduct
- LEFT JOIN BillType ON BillType.Value_BillType=SaleOutDepotBillProduct.Type_FromBill
- LEFT JOIN Location ON Location.ID_Location=SaleOutDepotBillProduct.ID_Location
- LEFT JOIN Product ON SaleOutDepotBillProduct.ID_Product=Product.ID_Product
- WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBill=@ID_SaleOutDepotBill
- ORDER BY CAST(No_SaleOutDepotBillProduct AS INT)
-
- SELECT BillComment.*
- FROM BillComment
- WHERE ID_Bill=@ID_SaleOutDepotBill
- order by BillComment.No_BillComment
-
- SELECT ReportComment.*,@SaleOutDepotBillNo as No_SaleOutDepotBill
- FROM ReportComment
- WHERE ID_Bill=@ID_SaleOutDepotBill
- Order by ReportComment.No_ReportComment
- ">
- <Params>
- <Param name="@No_SaleOutDepotBill" type="SaleOutDepotBill.No_SaleOutDepotBill" Index="0" />
- </Params>
- <Tables>
- <Table name="SaleOutDepotBill" />
- <Table name="SaleOutDepotBillProduct" />
- <Table name="BillComment" />
- <Table name="ReportComment" />
- </Tables>
- </SearchSaleOutDepotBillPrevious>
- <SearchSaleOutDepotBillNext CmdType="Text" CmdText="DECLARE @SaleOutDepotBillNo nvarchar(64)
- DECLARE @ID_SaleOutDepotBill uniqueidentifier
- SELECT TOP 1 @ID_SaleOutDepotBill = ID_SaleOutDepotBill, @SaleOutDepotBillNo = SaleOutDepotBill.No_SaleOutDepotBill FROM SaleOutDepotBill WHERE SaleOutDepotBill.No_SaleOutDepotBill > @No_SaleOutDepotBill ORDER BY SaleOutDepotBill.No_SaleOutDepotBill
- SELECT SaleOutDepotBill.*,a.Name_User,b.Name_User as Name_UserAuti,c.Name_User as Name_LastModUser,
- Location.Name_Location,Location.No_Location ,Customer.Name_Customer, Customer.ShortName_Customer,Customer.No_Customer
- FROM SaleOutDepotBill
- LEFT JOIN Customer ON Customer.ID_Customer = SaleOutDepotBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = SaleOutDepotBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = SaleOutDepotBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = SaleOutDepotBill.LastModUser_SaleOutDepotBill
- LEFT JOIN Location ON Location.ID_Location = SaleOutDepotBill.ID_Location
- WHERE No_SaleOutDepotBill = @SaleOutDepotBillNo
-
- SELECT SaleOutDepotBillProduct.*,
- BillType.Name_BillType AS Name_FromBill,
- No_FromBill AS No_SaleOutDepotBill,
- Product.No_Product,
- Product.Name_Product,
- Product.Unit_Product, Product.Name_Product AS No_SaleOutDepotBill,
- Location.Name_Location, Location.ID_Location,Location.No_Location
- FROM SaleOutDepotBillProduct
- LEFT JOIN BillType ON BillType.Value_BillType=SaleOutDepotBillProduct.Type_FromBill
- LEFT JOIN Location ON Location.ID_Location=SaleOutDepotBillProduct.ID_Location
- LEFT JOIN Product ON SaleOutDepotBillProduct.ID_Product=Product.ID_Product
- WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBill=@ID_SaleOutDepotBill
- ORDER BY CAST(No_SaleOutDepotBillProduct AS INT)
-
- SELECT BillComment.*
- FROM BillComment
- WHERE ID_Bill=@ID_SaleOutDepotBill
- order by BillComment.No_BillComment
-
- SELECT ReportComment.*,@SaleOutDepotBillNo as No_SaleOutDepotBill
- FROM ReportComment
- WHERE ID_Bill=@ID_SaleOutDepotBill
- Order by ReportComment.No_ReportComment
- ">
- <Params>
- <Param name="@No_SaleOutDepotBill" type="SaleOutDepotBill.No_SaleOutDepotBill" Index="0" />
- </Params>
- <Tables>
- <Table name="SaleOutDepotBill" />
- <Table name="SaleOutDepotBillProduct" />
- <Table name="BillComment" />
- <Table name="ReportComment" />
- </Tables>
- </SearchSaleOutDepotBillNext>
- <SearchSaleOutDepotBillLast CmdType="Text" CmdText=" DECLARE @SaleOutDepotBillNo nvarchar(64)
- DECLARE @ID_SaleOutDepotBill uniqueidentifier
- SELECT TOP 1 @ID_SaleOutDepotBill = SaleOutDepotBill.ID_SaleOutDepotBill,@SaleOutDepotBillNo = SaleOutDepotBill.No_SaleOutDepotBill FROM SaleOutDepotBill ORDER BY SaleOutDepotBill.No_SaleOutDepotBill DESC
- SELECT SaleOutDepotBill.*,a.Name_User,b.Name_User as Name_UserAuti,c.Name_User as Name_LastModUser,
- Location.Name_Location,Location.No_Location , Customer.Name_Customer, Customer.ShortName_Customer,Customer.No_Customer
- FROM SaleOutDepotBill
- LEFT JOIN Customer ON Customer.ID_Customer = SaleOutDepotBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = SaleOutDepotBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = SaleOutDepotBill.ID_Assessor
- Left JOIN AppUser c ON c.ID_User = SaleOutDepotBill.LastModUser_SaleOutDepotBill
- LEFT JOIN Location ON Location.ID_Location = SaleOutDepotBill.ID_Location
- WHERE No_SaleOutDepotBill = @SaleOutDepotBillNo
-
- SELECT SaleOutDepotBillProduct.*,
- BillType.Name_BillType AS Name_FromBill,
- No_FromBill AS No_SaleOutDepotBill,
- Product.No_Product,
- Product.Name_Product,
- Product.Unit_Product, Product.Name_Product AS No_SaleOutDepotBill,
- Location.Name_Location, Location.ID_Location,Location.No_Location
- FROM SaleOutDepotBillProduct
- LEFT JOIN BillType ON BillType.Value_BillType=SaleOutDepotBillProduct.Type_FromBill
- LEFT JOIN Location ON Location.ID_Location=SaleOutDepotBillProduct.ID_Location
- LEFT JOIN Product ON SaleOutDepotBillProduct.ID_Product=Product.ID_Product
- WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBill=@ID_SaleOutDepotBill
- ORDER BY CAST(No_SaleOutDepotBillProduct AS INT)
-
- SELECT BillComment.*
- FROM BillComment
- WHERE ID_Bill=@ID_SaleOutDepotBill
- order by BillComment.No_BillComment
-
- SELECT ReportComment.*,@SaleOutDepotBillNo as No_SaleOutDepotBill
- FROM ReportComment
- WHERE ID_Bill=@ID_SaleOutDepotBill
- Order by ReportComment.No_ReportComment
- ">
- <Tables>
- <Table name="SaleOutDepotBill" />
- <Table name="SaleOutDepotBillProduct" />
- <Table name="BillComment" />
- <Table name="ReportComment" />
- </Tables>
- </SearchSaleOutDepotBillLast>
- <SearchQuantity CmdType="Text" CmdText="SELECT Quantity_Sale,Quantity_SaleRtn FROM SaleSourceBillProduct WHERE ID_SaleSourceBillProduct=@ID_SaleSourceBillProduct">
- <Params>
- <Param name="@ID_SaleSourceBillProduct" type="SaleSourceBillProduct.ID_SaleSourceBillProduct"
- Index="0" />
- </Params>
- <Tables>
- <Table name="Quantity" />
- </Tables>
- </SearchQuantity>
- <SearchAllCustomer CmdType="Text" CmdText="SELECT Customer.No_Customer,Customer.ShortName_Customer,Customer.Type_Customer,Customer.Level_Customer,Customer.IsGeneric_Customer FROM Customer ">
- <Tables>
- <Table name="AllCustomer" />
- </Tables>
- </SearchAllCustomer>
- <SearchCustomerWithNo CmdType="Text" CmdText=" SELECT Customer.ID_Customer, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer,SuspendDate_Customer
- FROM Customer WHERE Customer.No_Customer = @No_Customer
- ">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="Customer" />
- </Tables>
- </SearchCustomerWithNo>
- <SearchID_Customer CmdType="Text" CmdText=" SELECT SaleBill.ID_Customer
- FROM SaleBill WHERE SaleBill.No_SaleBill = @No_SaleBill">
- <Params>
- <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" Index="0" />
- </Params>
- <Tables>
- <Table name="SaleBillCustomer" />
- </Tables>
- </SearchID_Customer>
- <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
- Inner Join Customer On SaleBill.ID_Customer = Customer.ID_Customer
- Inner Join Location On Location.ID_Location = SaleBill.ID_Location WHERE SaleBill.Disable_SaleBill = 0">
- <Tables>
- <Table name="AllSaleBill" />
- </Tables>
- </SearchAllSaleBill>
- <SearchAllSaleBillProduct CmdType="Text" CmdText="Select Product.No_Product,SaleBillProduct.No_SaleBillProduct,Product.Name_Product,SaleBillProduct.Quantity_SaleBillProduct,SaleBillProduct.UnitPrice_SaleBillProduct,Comment_SaleBillProduct From SaleBillProduct
- Inner Join Product On Product.ID_Product = SaleBillProduct.ID_Product
- Inner Join SaleBill On SaleBill.ID_SaleBill =SaleBillProduct.ID_SaleBill">
- <Tables>
- <Table name="AllSaleBillProduct" />
- </Tables>
- </SearchAllSaleBillProduct>
- <SearchStockSettle CmdType="Text" CmdText="
- Select * From StockSettleAccounts
- Where DateDiff(Day,@Date_SaleOutDepotBill,FromDate_StockSettleAccounts) <=0
- And DateDiff(Day,@Date_SaleOutDepotBill,EndDate_StockSettleAccounts) >=0
- And Status_StockSettleAccounts=0
- ">
- <Params>
- <Param name="@Date_SaleOutDepotBill" type="PurchaseInDepotBill.Date_SaleOutDepotBill" Index="0" />
- </Params>
- <Tables>
- <Table name="StockSettle" />
- </Tables>
- </SearchStockSettle>
- <SearchTypeComment CmdType="Text" CmdText="
- declare @SRemark1_FunctionSetting int
- declare @SRemark2_FunctionSetting int
- Select @SRemark1_FunctionSetting = SRemark1_FunctionSetting, @SRemark2_FunctionSetting = SRemark2_FunctionSetting
- from FunctionSetting
- declare @ID_SaleOutDepotBill uniqueidentifier
- declare @flag int
- set @flag = 0
- if @SRemark1_FunctionSetting = 0
- begin
- select top 1 @ID_SaleOutDepotBill = SaleOutDepotBill.ID_SaleOutDepotBill
- from SaleOutDepotBill
- where ID_Customer = @ID_Customer
- order by SaleOutDepotBill.Date_SaleOutDepotBill desc
- if exists(select ReportComment.* from ReportComment where ReportComment.ID_Bill = @ID_SaleOutDepotBill)
- begin
- select ReportComment.Comment_ReportComment from ReportComment where ReportComment.ID_Bill = @ID_SaleOutDepotBill
- order by ReportComment.No_ReportComment
- set @flag = 1
- end
- end
- else
- begin
- if exists(SELECT Name_TypeDef FROM TypeDef WHERE Type_TypeDef=26 )
- begin
- SELECT Name_TypeDef as Comment_ReportComment FROM TypeDef WHERE Type_TypeDef=26
- set @flag = 1
- end
- end
- if @flag = 0
- begin
- if @SRemark2_FunctionSetting = 0
- begin
- select top 1 @ID_SaleOutDepotBill = SaleOutDepotBill.ID_SaleOutDepotBill
- from SaleOutDepotBill
- where ID_Customer = @ID_Customer
- order by SaleOutDepotBill.Date_SaleOutDepotBill desc
- select ReportComment.Comment_ReportComment from ReportComment where ReportComment.ID_Bill = @ID_SaleOutDepotBill
- order by ReportComment.No_ReportComment
- end
- else
- begin
- SELECT Name_TypeDef as Comment_BillComment FROM TypeDef WHERE Type_TypeDef=26
- end
- end
- ">
- <Params>
- <Param name="@ID_Customer" type="SaleOutDepotBill.ID_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="TypeComment" />
- </Tables>
- </SearchTypeComment>
- <SearchSaleRtn CmdType="Text" CmdText="
- Select Sum(RtnQuantity_SaleOutDepotBillProduct) As RtnQuantity_SaleOutDepotBillProduct
- FROM SaleOutDepotBillProduct
- WHERE SaleOutDepotBillProduct.ID_SaleOutDepotBill = @ID_SaleOutDepotBill
-
- Select Count(*) As Num
- From SaleOutDepotBillProduct
- LEFT JOIN SaleSourceBillProduct ON SaleSourceBillProduct.ID_SaleSourceBillProduct=SaleOutDepotBillProduct.ID_SaleSourceBillProduct
- Where ID_SaleOutDepotBill=@ID_SaleOutDepotBill And (Quantity_OutDepot-Quantity_SaleRtn-Quantity_SaleOutDepotBillProduct) < 0
-
- ">
- <Params>
- <Param name="@ID_SaleOutDepotBill" type="SaleOutDepotBill.ID_SaleOutDepotBill" Index="0" />
- </Params>
- <Tables>
- <Table name="SaleRtn" />
- <Table name="SaleRtnFromSaleBill" />
- </Tables>
- </SearchSaleRtn>
- <SearchStatusWithNo CmdType="Text" CmdText="Select Check_SaleOutDepotBill From SaleOutDepotBill Where No_SaleOutDepotBill = @No_SaleOutDepotBill">
- <Params>
- <Param name="@No_SaleOutDepotBill" type="SaleOutDepotBill.No_SaleOutDepotBill" Index="0" />
- </Params>
- <Tables>
- <Table name="Status" />
- </Tables>
- </SearchStatusWithNo>
- <SearchCheck CmdType="Text" CmdText="Select Check_SaleOutDepotBill From SaleOutDepotBill Where No_SaleOutDepotBill = @No_SaleOutDepotBill">
- <Params>
- <Param name="@No_SaleOutDepotBill" type="SaleOutDepotBill.No_SaleOutDepotBill" Index="0" />
- </Params>
- <Tables>
- <Table name="Check" />
- </Tables>
- </SearchCheck>
- <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
- WHERE ID_Product = @ID_Product AND SubjectionID_Location is not Null And Mark_ProductStocks = 1">
- <Params>
- <Param name="@ID_Product" type="SaleOutDepotBillProduct.ID_Product" Index="0" />
- </Params>
- <Tables>
- <Table name="OneLocation" />
- </Tables>
- </SearchOneLocation>
- <SearchCreateDate CmdType="Text" CmdText=" Select CONVERT(varchar(100), CreateDate_SaleOutDepotBill, 23) as CreateDate_SaleOutDepotBill
- , CONVERT(varchar(100), @CurrentDate, 23) as CurrentDate
- From SaleOutDepotBill
- Where No_SaleOutDepotBill=@No_SaleOutDepotBill
- ">
- <Params>
- <Param name="@No_SaleOutDepotBill" type="SaleOutDepotBill.No_SaleOutDepotBill" Index="0" />
- <Param name="@CurrentDate" type="SaleOutDepotBill.CreateDate_SaleOutDepotBill" Index="1" />
- </Params>
- <Tables>
- <Table name="searchcreatedate" />
- </Tables>
- </SearchCreateDate>
- </Search>
- </Server>
- <Lables>
- <Search>
- Empty();
- NewInstance();
- @ImportClicked = 0;
- timeMake.Enabled =false;
- tbNo.ReadOnly =false;
- cbLocation.Enabled =false;
- dgProduct.ReadOnly =true;
- dgRemark.ReadOnly =true;
- dgReportComment.ReadOnly =true;
- tbCustomerNo.ReadOnly =true;
- toolBar.EnableSubmit =false;
- toolBar.EnableModify =false;
- toolBar.EnableDelete =false;
- toolBar.EnableAudit =false;
- toolBar.EnableUnAudit =false;
- toolBar.EnableNew =GetRight(@Title,"新增");
- toolBar.EnablePrint =false;
- toolBar.EnablePrintBarCode =false;
- toolBar.EnableExport = false;
- toolBar.EnableImport = false;
-
- toolBar.EnableCheck =true;
- #SaleOutDepotBill.AssessDate_SaleOutDepotBill =DBNull();
- #SaleOutDepotBill.ID_Assessor =DBNull();
- #SaleOutDepotBill.ID_Creator =DBNull();
- #SaleOutDepotBill.LastModUser_SaleOutDepotBill =DBNull();
- #SaleOutDepotBill.LastModDate_SaleOutDepotBill =DBNull();
- ikNumericTextBox1.CValue = 0;
- UpdateForm(true,"");
- tbNo.Focus();
- @Status=0;
- btnDelete.Enabled = false;
- </Search>
- <New>
- Empty();
- NewInstance();
- @ImportClicked = 0;
- timeMake.Enabled =true;
- tbCustomerNo.ReadOnly = false;
- tbNo.ReadOnly =true;
- cbLocation.Enabled =true;
- dgProduct.ReadOnly =false;
- dgRemark.ReadOnly =false;
- dgReportComment.ReadOnly =false;
- toolBar.EnableSubmit =GetRight(@Title,"新增");
- toolBar.EnableModify =false;
- toolBar.EnableDelete =false;
- toolBar.EnableAudit =false;
- toolBar.EnableUnAudit =false;
- toolBar.EnableNew =false;
- toolBar.EnablePrint =false;
- toolBar.EnablePrintBarCode =false;
- toolBar.EnableExport = false;
- toolBar.EnableImport = true;
- toolBar.EnableCheck = false;
- #SaleOutDepotBill.ID_SaleOutDepotBill =NewGuid();
- #SaleOutDepotBill.ID_Creator =GetLoginUserID();
- #SaleOutDepotBill.Name_User =GetCurrentUser();
- #SaleOutDepotBill.AssessDate_SaleOutDepotBill =DBNull();
- #SaleOutDepotBill.ID_Assessor =DBNull();
- #SaleOutDepotBill.LastModUser_SaleOutDepotBill =DBNull();
- #SaleOutDepotBill.Name_LastModUser =DBNull();
- #SaleOutDepotBill.LastModDate_SaleOutDepotBill =DBNull();
- #SaleOutDepotBill.ID_Location =GetCurrentDepotID();
- #SaleOutDepotBill.Name_Location =GetCurrentDepot();
- #SaleOutDepotBill.No_Location =GetCurrentDepotNo();
- #SaleOutDepotBill.Date_SaleOutDepotBill =GetCurrentTime();
- ikNumericTextBox1.CValue = 0;
- dgProduct.SetColumnReadOnly(1, false);
- dgProduct.SetColumnReadOnly(2, false);
- dgProduct.SetColumnReadOnly(3, false);
- dgProduct.SetColumnReadOnly(4, false);
- dgProduct.RowHeaderCheck=true;
- dgProduct.AllowNew(true);
- dgProduct.AllowDelete(true);
- UpdateForm(true,"");
- timeMake.Focus();
- @Status=1;
- btnDelete.Enabled = false;
- </New>
- <View>
- @ImportClicked = 0;
- timeMake.Enabled =false;
- tbCustomerNo.ReadOnly =true;
- tbNo.ReadOnly =false;
- cbLocation.Enabled =false;
- dgProduct.ReadOnly =true;
- dgRemark.ReadOnly =true;
- dgReportComment.ReadOnly =true;
- toolBar.EnableSubmit =false;
- toolBar.EnableNew =GetRight(@Title,"新增");
- if(Search("SearchStockSettle",#SaleOutDepotBill.Date_SaleOutDepotBill))
- {
- if(Equals(#SaleOutDepotBill.ID_Assessor, DBNull()))
- {
- if(#SaleOutDepotBill.Disable_SaleOutDepotBill==false)
- {
- toolBar.EnableAudit=GetRight(@Title,"审核");
- toolBar.EnableModify=GetRight(@Title,"修改");
- toolBar.EnableDelete=GetRight(@Title,"删除");
- }
- else
- {
- toolBar.EnableAudit = false;
- toolBar.EnableModify = false;
- toolBar.EnableDelete = false;
- }
- toolBar.EnableUnAudit = false;
- btnDelete.Enabled = false;
- toolBar.EnablePrintBarCode=false;
- }
- else
- {
- toolBar.EnableAudit=false;
- toolBar.EnableUnAudit=GetRight(@Title,"取消审核");
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- btnDelete.Enabled = GetRight(@Title,"取消审核")&&GetRight(@Title,"删除");
- toolBar.EnablePrintBarCode=GetRight(@Title,"打印");
- }
- toolBar.EnablePrint =GetRight(@Title,"打印");
- }
- else
- {
- toolBar.EnablePrintBarCode=false;
- toolBar.EnableAudit=false;
- toolBar.EnableUnAudit=false;
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- btnDelete.Enabled = false;
- }
- toolBar.EnablePrint = GetRight(@Title,"打印");
- toolBar.EnableExport = true;
- toolBar.EnableImport = false;
- if(Search("SearchCreateDate",#SaleOutDepotBill.No_SaleOutDepotBill,GetCurrentTime()))
- {
- if(!Equals(#searchcreatedate.CreateDate_SaleOutDepotBill,#searchcreatedate.CurrentDate))
- toolBar.EnableCheck = false;
- else
- toolBar.EnableCheck = true;
- }
- <!--toolBar.EnableCheck = true;-->
- UpdateForm(true, "");
- @Status=2;
- </View>
- <Modify>
- @ImportClicked = 0;
- timeMake.Enabled =false;
- tbNo.ReadOnly =true;
- tbCustomerNo.ReadOnly =false;
- cbLocation.Enabled =true;
- dgProduct.ReadOnly =false;
- dgRemark.ReadOnly =false;
- dgReportComment.ReadOnly =false;
- toolBar.EnableSubmit =GetRight(@Title,"修改");
- toolBar.EnableModify =false;
- toolBar.EnableDelete =false;
- toolBar.EnableAudit =false;
- toolBar.EnableUnAudit =false;
- toolBar.EnableNew =false;
- toolBar.EnablePrint =false;
- toolBar.EnablePrintBarCode =false;
- toolBar.EnableExport = false;
- toolBar.EnableImport = false;
- toolBar.EnableCheck = false;
- #SaleOutDepotBill.LastModUser_SaleOutDepotBill =GetLoginUserID();
- #SaleOutDepotBill.Name_LastModUser =GetCurrentUser();
- #SaleOutDepotBill.LastModDate_SaleOutDepotBill =DateTimeNow();
- @HaveAccessed = !Equals(#SaleOutDepotBill.AssessDate_SaleOutDepotBill,DBNull());
- dgProduct.SetColumnReadOnly(1, @HaveAccessed);
- dgProduct.SetColumnReadOnly(2, @HaveAccessed);
- dgProduct.SetColumnReadOnly(3, @HaveAccessed);
- dgProduct.SetColumnReadOnly(4, @HaveAccessed);
- dgProduct.AllowNew(!@HaveAccessed);
- dgProduct.AllowDelete(!@HaveAccessed);
- dgProduct.RowHeaderCheck=!@HaveAccessed;
- @HaveAccessed = !Equals(#SaleOutDepotBill.AssessDate_SaleOutDepotBill,DBNull());
-
- UpdateForm(true, "");
- @Status=3;
- btnDelete.Enabled = false;
- </Modify>
- <SubmitButtonClick>
- <![CDATA[
- if(!Search("SearchStockSettle",timeMake.Value))
- {
- MessageBox("制单日期不在开帐区间内,提交失败!");
- return;
- }
- if (!cbLocation.CheckSelectedItem())
- {
- MessageBox("请选择有效的出货仓库!",@Title);
- cbLocation.Focus();
- return;
- }
- if(RowCount("#SaleOutDepotBillProduct")==0)
- {
- MessageBox("请输入出库产品!",@Title);
- dgProduct.Focus();
- return;
- }
- if(@SaleAndOutDepot == true)
- {
- if(tbCustomerNo.CValue == "")
- {
- MessageBox("请填入客户编号!",@Title);
- tbCustomerNo.Focus();
- return;
- }
- }
- UpdateForm(false, "");
- SuspendLayout();
- for (@i=0;@i<=RowCount("#SaleOutDepotBillProduct")-1;@i=@i+1)
- {
- SetPosition("#SaleOutDepotBillProduct", @i);
- if(@SaleAndOutDepot == true)
- {
- if (Equals(#SaleOutDepotBillProduct.Name_FromBill,DBNull()) || Equals(#SaleOutDepotBillProduct.Name_FromBill,""))
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("请选择来源单据!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if(Equals(#SaleOutDepotBillProduct.No_FromBill,DBNull()) || #SaleOutDepotBillProduct.No_FromBill=="")
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("请输入来源单据单号!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if(Equals(#SaleOutDepotBillProduct.No_FromBillProduct,DBNull()) || #SaleOutDepotBillProduct.No_FromBillProduct=="")
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("请输入来源单据产品序号!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if(!Search("SearchNo_SaleBillProduct",#SaleOutDepotBillProduct.No_FromBill,#SaleOutDepotBillProduct.No_FromBillProduct))
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该来源信息有误,请确认!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if(!Equals(#NoSBProduct.ID_Product,#SaleOutDepotBillProduct.ID_Product))
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该来源单据产品单中指定的产品与后改写的产品不匹配!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if(!Equals(#SaleOutDepotBillProduct.No_FromBill,"") && #SaleOutDepotBillProduct.Type_FromBill!=0 && Search("SearchSaleBillAuditWithNo",#SaleOutDepotBillProduct.No_FromBill))
- {
- if(Equals(#SaleBillAudit.ID_Assessor,DBNull()))
- {
- dgProduct.CurrentRowIndex = @i;
- if(MessageBox("该来源单据未经审核,确定要提交吗?",@Title,MB_OKCANCEL)==DialogResult("CANCEL"))
- {
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
- }
- if(Search("SearchID_Customer",#SaleOutDepotBillProduct.No_FromBill))
- {
- if(!Equals(#SaleOutDepotBill.ID_Customer,#SaleBillCustomer.ID_Customer))
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该来源单据的客户与本单据的客户不一致,请检查!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
- }
- else
- {
- if(#SaleOutDepotBillProduct.Type_FromBill != 0 && #SaleOutDepotBillProduct.No_FromBill != "" && Search("SearchSaleBillAuditWithNo",#SaleOutDepotBillProduct.No_FromBill))
- {
- if(Equals(#SaleBillAudit.ID_Assessor,DBNull()))
- {
- dgProduct.CurrentRowIndex = @i;
- @DialogResult=MessageBox("该来源单据未经审核,确定要保留来源单据资料吗?",@Title,MB_YESNOCANCEL);
- if(@DialogResult==DialogResult("NO"))
- {
- #SaleOutDepotBillProduct.Type_FromBill = 0;
- #SaleOutDepotBillProduct.Name_FromBill = "";
- #SaleOutDepotBillProduct.No_FromBill = "";
- #SaleOutDepotBillProduct.No_FromBillProduct = "";
- }
- if(@DialogResult==DialogResult("CANCEL"))
- {
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
- }
- if (Equals(#SaleOutDepotBillProduct.No_Product,""))
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("请输入产品编号!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if(Equals(#SaleOutDepotBillProduct.ID_Product,GuidEmpty()))
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该产品不存在!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
-
- if(Equals(#SaleOutDepotBillProduct.ID_Location,DBNull()) || Equals(#SaleOutDepotBillProduct.ID_Location,GuidEmpty()))
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("请输入有效的出库库位!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if(!Search("SearchJudgeLocationAndWarehouse",#SaleOutDepotBill.ID_Location,#SaleOutDepotBillProduct.ID_Location))
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该库位不属于所选仓库,请重新选择!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if(#SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct<=0)
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("数量不得小于等于0!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
-
- if (Equals(#SaleOutDepotBillProduct.ID_SaleOutDepotBillProduct,GuidEmpty()))
- {
- #SaleOutDepotBillProduct.ID_SaleOutDepotBillProduct = NewGuid();
- }
- #SaleOutDepotBillProduct.ID_SaleOutDepotBill=#SaleOutDepotBill.ID_SaleOutDepotBill;
- }
- for(@j=0;@j<RowCount("#BillComment");@j++)
- {
- SetPosition("#BillComment",@j);
- if(Equals(#BillComment.ID_BillComment,GuidEmpty()))
- {
- #BillComment.ID_BillComment=NewGuid();
- }
- #BillComment.ID_Bill=#SaleOutDepotBill.ID_SaleOutDepotBill;
- }
- for(@j=0;@j<RowCount("#ReportComment");@j++)
- {
- SetPosition("#ReportComment",@j);
- if(Equals(#ReportComment.ID_ReportComment,GuidEmpty()))
- {
- #ReportComment.ID_ReportComment=NewGuid();
- }
- #ReportComment.ID_Bill=#SaleOutDepotBill.ID_SaleOutDepotBill;
- }
- ResumeLayout();
- if(@Status == 1)
- {
- #SaleOutDepotBill.CreateDate_SaleOutDepotBill=DateTimeNow();
- #SaleOutDepotBill.No_SaleOutDepotBill = New("#SaleOutDepotBill.No_SaleOutDepotBill", timeMake.CValue);
- }
- else if(@Status == 3)
- {
- #SaleOutDepotBill.LastModDate_SaleOutDepotBill =DateTimeNow();
- Update();
- }
- ChangeMode("View");
- ]]>
-
- </SubmitButtonClick>
- <CountSum>
- <![CDATA[
- if (RowCount("#SaleOutDepotBillProduct") == 0)
- {
- ikNumericTextBox1.CValue = 0;
- }
- else
- {
- ikNumericTextBox1.CValue = SumOfCol("#SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct");
-
- }
- ]]>
- </CountSum>
- </Lables>
- </Form>
- </Forms>
|