1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140 |
- <?xml version="1.0" encoding="utf-8" ?>
- <Forms>
- <Form Name="FrmSaleRtnBill">
- <Client>
- <Events>
- <Load>
- <![CDATA[
- @SetFlag=1;
- @Title="销售退货单";
- GetSchema();
- Search("SearchLocation");
- Search("SearchSystemSetting");
-
- Search("SearchProductWithNo","p");
- Search("SearchFromBillProductNo",1,"p","p");
-
- @SysCurrency=#SystemSetting.SysCurrency_SystemSetting;
- if(#SystemSetting.SaleRtnSourceBill_SystemSetting)
- toolBar.EnableImportItem(0,false);
- else
- toolBar.EnableImportItem(1,false);
- @CessOut = #SystemSetting.CessOut_SystemSetting / 100;
- @ImportClicked = 0;
- dgProduct.ColumnVisibleByColumnName("Cost_Product",true);
- ChangeMode("Search");
- dgProduct.NoMember="No_SaleRtnBillProduct";
- Search("SearchBillType");
- ]]></Load>
- <Closing>
- ;
- </Closing>
- <Closed>
- ;
- </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="dtpDate" DataSource="SaleRtnBill.Date_SaleRtnBill"/>
- <IKTextButton name="tbNo" DataSource="SaleRtnBill.No_SaleRtnBill">
- <Events>
- <Enter>
- <![CDATA[
- if(tbNo.ReadOnly == false)
- {
- if(tbNo.CValue != StringEmpty())
- {
- UpdateForm(false, "");
- if(Search("SearchBillWithNo", tbNo.CValue))
- {
- if(GetRight("客户基本资料","全权查看")||Equals(GetLoginUserID(),#SaleRtnBill.CustomerCreator))
- ChangeMode("View");
- else
- {
- @EnterNo=tbNo.CValue;
- ChangeMode("Search");
- tbNo.CValue=@EnterNo;
- MessageBox("你没有查看该单据资料的权限!",@Title);
- return;
- }
- }
- else
- {
- MessageBox("该销退单不存在!",@Title);
- tbNo.Focus();
- }
- }
- else
- {
- MessageBox("请输入销退单号",@Title);
- tbNo.Focus();
- }
- }
- ]]>
- <Lable name="Money"/>
- </Enter>
- <Click>
- ShowSearchBox("BillSearch","HAVEDEPOT", "tbNo",tbNo.CValue);
- </Click>
- </Events>
- </IKTextButton>
- <IKCheckBox name="ckPrevBill" DataSource="SaleRtnBill.IsPrevBill_SaleRtnBill"/>
- <IKTextButton name="tbCustomerNo" DataSource="SaleRtnBill.No_Customer">
- <Events>
- <Enter><![CDATA[
- if(!tbCustomerNo.ReadOnly)
- {
- if(tbCustomerNo.CValue != StringEmpty())
- {
- UpdateForm(false, "");
- if(Search("SearchCustomerWithNo", tbCustomerNo.CValue))
- {
- if(!Equals(#Customer.SuspendDate_Customer,DBNull()))
- {
- MessageBox("该客户已停用!",@Title);
- tbCustomerNo.Focus();
- }
- #SaleRtnBill.ShortName_Customer=#Customer.ShortName_Customer;
- #SaleRtnBill.ID_Customer = #Customer.ID_Customer;
- #SaleRtnBill.TaxCurrency_SaleRtnBill = #Customer.LastTax_Customer;
-
- UpdateForm(true, "");
- }
- else
- {
- MessageBox("该客户不存在!",@Title);
- @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo.CValue);
- if(@temp != "")
- {
- tbCustomerNo.CValue = @temp;
- ActiveControlEvent("tbCustomerNo", "Enter");
- }
- }
- }
- else
- {
- MessageBox("请输入客户编号",@Title);
- tbCustomerNo.Focus();
- }
- }
- ]]>
- </Enter>
- <Click>
- <![CDATA[
- if (tbCustomerNo.ReadOnly == false )
- {
- @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo.CValue);
- if( @temp == "" )
- return;
- tbCustomerNo.CValue = @temp;
- ActiveControlEvent("tbCustomerNo", "Enter");
- UpdateForm(true, "txtCustomerShortName");
- UpdateForm(true, "cbPrincipal");
- }
- ]]>
- </Click>
- </Events>
- </IKTextButton>
- <IKTextBox name="txtCustomerShortName" DataSource="SaleRtnBill.ShortName_Customer"/>
- <IKComboBoxEx name="cbTaxCurrency" DisplaySource="SaleRtnBill.TaxCurrency_SaleRtnBill">
- <Events>
- <SelectedIndexChanged>
- <Lable name="Money"/>
- </SelectedIndexChanged>
- </Events>
- </IKComboBoxEx>
- <IKComboBoxEx name="cbCurrency" DisplaySource="SaleRtnBill.Currency_SaleRtnBill" DataSource="SaleRtnBill" DisplayMember="Currency_SaleRtnBill"/>
- <IKComboBoxEx name="cbLocation" ValueSource="SaleRtnBill.ID_Location" NoSource="SaleRtnBill.No_Location" DisplaySource="SaleRtnBill.Name_Location" DataSource="Location" ValueMember="ID_Location" NoMember="No_Location" DisplayMember="Name_Location">
- <Events>
- <Reload>
- UpdateForm(false, "cbLocation");
- Search("SearchLocation");
- UpdateForm(true, "cbLocation");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKComboBoxEx name="cbPrincipal" ValueSource="SaleRtnBill.ID_Principal" DisplaySource="SaleRtnBill.Principal_SaleRtnBill" NoSource="SaleRtnBill.No_Principal" DataSource="Employee" ValueMember="ID_Employee" DisplayMember="Name_Employee" NoMember="No_Employee" >
- <Events>
- <Reload>
- UpdateForm(false, "cbPrincipal");
- Search("SearchPrincipal");
- UpdateForm(true, "cbPrincipal");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKComboBoxEx name="cbReason" DisplaySource="SaleRtnBill.Reason_SaleRtnBill" DataSource="Reason" DisplayMember="Result">
- <Events>
- <Reload>
- UpdateForm(false, "cbReason");
- Search("SearchReason");
- UpdateForm(true, "cbReason");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKComboBoxEx name="cbComment" DisplaySource="SaleRtnBill.Comment_SaleRtnBill" DataSource="Comment" DisplayMember="Result">
- <Events>
- <Reload>
- UpdateForm(false, "cbComment");
- Search("SearchComment");
- UpdateForm(true, "cbComment");
- </Reload>
- </Events>
- </IKComboBoxEx>
-
- <IKButton name="btnDelete">
- <Events>
- <Click>
- if(MessageBox("确定作废当前单据吗?",@Title,MB_YESNO)==DialogResult("YES"))
- {
- if(Search("SearchInDepot",#SaleRtnBill.ID_SaleRtnBill))
- {
- if(#InDepot.Quantity_InDepot > 0)
- {
- MessageBox("该单据已有相应的销售退货入库记录,作废失败!",@Title);
- return;
- }
- }
- BeginUnAudit();
- #SaleRtnBill.ID_Assessor = DBNull();
- #SaleRtnBill.Name_Assessor = "";
- #SaleRtnBill.Disable_SaleRtnBill=true;
- UnAudit(false);
- ChangeMode("View");
- EndUnAudit();
- Search("UpdateCustomer",#SaleRtnBill.ID_Customer,#SaleRtnBill.Amount_SaleRtnBill,"1");
- }
- <Lable name="CountSum" />
- </Click>
- </Events>
- </IKButton>
- <IKTextBox name="ikTextBox1" DataSource="SaleRtnBill.PName_SaleRtnBill"/>
- <IKTextBox name="txtMaker" DataSource="SaleRtnBill.Name_Creator"/>
- <IKTextBox name="txtAudi" DataSource="SaleRtnBill.Name_Assessor"/>
- <IKDateTimeText name="dtAssessDate" DataSource="SaleRtnBill.AssessDate_SaleRtnBill"/>
- <IKTextBox name="txtLastModUser" DataSource="SaleRtnBill.LastModUserName_SaleRtnBill"/>
- <IKDateTimeText name="dtLastModDate" DataSource="SaleRtnBill.LastModDate_SaleRtnBill"/>
- <IKDataGridEx name="dgProduct" DataSource="SaleRtnBillProduct" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="SaleRtnBillProduct.No_SaleRtnBillProduct" />
- <DataColumn Index="1" DataSource="SaleRtnBillProduct.ProductNo_SaleRtnBillProduct" >
- <IKDataGridTextButtonColumn>
- <Events>
- <Click>
- @SetFlag=1;
- ShowSearchBox("ProductSearch","INFOMATION",#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct);
- </Click>
- <SetFlagBeforeClick>
- @SetFlag=0;
- </SetFlagBeforeClick>
- </Events>
- </IKDataGridTextButtonColumn>
- </DataColumn>
- <DataColumn Index="2" DataSource="SaleRtnBillProduct.ProductName_SaleRtnBillProduct" />
- <DataColumn Index="3" DataSource="SaleRtnBillProduct.Quantity_SaleRtnBillProduct" />
- <DataColumn Index="4" DataSource="SaleRtnBillProduct.ProductUnit_SaleRtnBillProduct" />
- <DataColumn Index="5" DataSource="SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct" />
- <DataColumn Index="6" DataSource="SaleRtnBillProduct.Cost_Product" />
- <DataColumn Index="7" DataSource="SaleRtnBillProduct.Cash_SaleRtnBillProduct" />
- <DataColumn Index="8" DataSource="SaleRtnBillProduct.Comment_SaleRtnBillProduct" />
- <DataColumn Index="9" DataSource="SaleRtnBillProduct.FromBill_SaleRtnBillProduct" >
- <IKDataGridComboBoxColumn DisplaySourceEx="SaleRtnBillProduct.FromBill_SaleRtnBillProduct" ValueSourceEx="SaleRtnBillProduct.Type_FromBill" DataSourceEx="BillType" DisplayMemberEx="Name_BillType" ValueMemberEx="Value_BillType">
- <Events>
- <Reload>
- Search("SearchBillType");
- SetDataGridColumnDataSource(9,"dgProduct");
- </Reload>
- </Events>
- </IKDataGridComboBoxColumn>
- </DataColumn>
- <DataColumn Index="10" DataSource="SaleRtnBillProduct.No_FromBill" />
- <DataColumn Index="11" DataSource="SaleRtnBillProduct.No_FromBillProduct" />
- </IKDataGridEx>
- <IKNumericTextBox name="txtNum" DataSource="SaleRtnBill.CountColume_SaleRtnBillProduct" />
- <IKNumericTextBox name="txtMoneySum" DataSource="SaleRtnBill.GoodsAmount_SaleRtnBill" />
- <IKNumericTextBox name="txtTaxSum" DataSource="SaleRtnBill.TaxAmount_SaleRtnBill" />
- <IKNumericTextBox name="txtSum" DataSource="SaleRtnBill.Amount_SaleRtnBill" />
- <IKFormToolBar name="toolBar">
- <Events>
- <ClickFirst>
- if(Search("SearchSaleRtnBillFirst",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID()))
- {
- ChangeMode("View");
- }
- <Lable name="Money"/>
- </ClickFirst>
- <ClickPrev>
- if(Search("SearchSaleRtnBillPrevious", tbNo.CValue,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID()))
- {
- ChangeMode("View");
- }
- <Lable name="Money"/>
- </ClickPrev>
- <ClickNext>
- if(Search("SearchSaleRtnBillNext", tbNo.CValue,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID()))
- {
- ChangeMode("View");
- }
- <Lable name="Money"/>
- </ClickNext>
- <ClickLast>
- if(Search("SearchSaleRtnBillLast",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID()))
- {
- ChangeMode("View");
- }
- <Lable name="Money"/>
- </ClickLast>
- <ClickEmpty>
- ChangeMode("Search");
- </ClickEmpty>
- <ClickSubmit>
- <Lable name="SubmitButtonClick"/>
- </ClickSubmit>
- <ClickNew>
- if(!Equals(@No=GetNextAutoNumber(true),""))
- {
- ChangeMode("New");
- tbNo.CValue=#SaleRtnBill.No_SaleRtnBill=@No;
- cbTaxCurrency.SelectedName="外加";
- }
- </ClickNew>
- <ClickModify>
- ChangeMode("Modify");
- <Lable name="Money"/>
- </ClickModify>
- <ClickPrint>
- ShowPrintBox("BillSearch",#SaleRtnBill.No_SaleRtnBill,#SaleRtnBill.No_SaleRtnBill);
- </ClickPrint>
- <ClickDelete>
- Delete(); ChangeMode("Search");
- </ClickDelete>
- <ClickAudit>
- <![CDATA[
- BeginAudit();
- SuspendLayout();
- if(Equals(ckPrevBill.CValue,true) || Equals(#SystemSetting.OutDepotAndSaleBack_SystemSetting,false))
- {
- for(@i=0;@i<RowCount("#SaleRtnBillProduct");@i++)
- {
- SetPosition("#SaleRtnBillProduct", @i);
- dgProduct.CurrentRowIndex = @i;
- if(#SaleRtnBillProduct.Type_FromBill!=0&&!Equals(#SaleRtnBillProduct.No_FromBill,StringEmpty())&&Search("SearchFromBillProductNo",#SaleRtnBillProduct.Type_FromBill,#SaleRtnBillProduct.No_FromBill,#SaleRtnBillProduct.No_FromBillProduct))
- {
- if(Equals(#SaleOutDepotBillProduct.ID_Assessor,DBNull()))
- {
- if(MessageBox("该来源单据未经审核,确定要审核吗?",@Title,MB_OKCANCEL)==DialogResult("CANCEL"))
- {
- ResumeLayout();
- return;
- }
- }
-
- }
- if(!ckPrevBill.Checked )
- {
- MessageBox("产品序号为"+ string(@i+1)+"的产品的来源单据的税别与本单据不符,审核失败!",@Title);
- ResumeLayout();
- return;
- }
- }
- }
- ResumeLayout();
- #SaleRtnBill.ID_Assessor=GetLoginUserID();
- #SaleRtnBill.Name_Assessor=GetCurrentUser();
- #SaleRtnBill.AssessDate_SaleRtnBill=DateTimeNow();
- Audit();
- Search("UpdateCustomer",#SaleRtnBill.ID_Customer,#SaleRtnBill.Amount_SaleRtnBill,"0");
- ChangeMode("View");
- EndAudit();
- ]]>
- <Lable name="Money"/>
- </ClickAudit>
- <ClickUnAudit>
- <![CDATA[
- BeginUnAudit();
- #SaleRtnBill.ID_Assessor=DBNull();
- #SaleRtnBill.Name_Assessor=DBNull();
- UnAudit();
- Search("UpdateCustomer",#SaleRtnBill.ID_Customer,#SaleRtnBill.Amount_SaleRtnBill,"1");
- ChangeMode("View");
- EndUnAudit();
- ]]>
- <Lable name="Money"/>
- </ClickUnAudit>
- <ClickAssess>
- #SaleRtnBill.Assess_SaleRtnBill = 1;
- <Lable name = "AssessClick"/>
- toolBar.EnableAssess = false;
- toolBar.EnableUnAssess = GetRight(@Title,"取消审核");
- </ClickAssess>
- <ClickUnAssess>
- #SaleRtnBill.Assess_SaleRtnBill = 0;
- <Lable name = "AssessClick"/>
- toolBar.EnableAssess = GetRight(@Title,"审核");
- toolBar.EnableUnAssess = false;
- </ClickUnAssess>
- <ClickImportItem>
- <![CDATA[
- @OrgTaxCurrency=#SaleRtnBill.TaxCurrency_SaleRtnBill;
- @RowCount=RowCount("#SaleRtnBillProduct");
- if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="销货出库单")
- {
- @ImportClicked = 1;
- if(Search("SearchContrOutIn"))
- {
- ShowSearchBox("ImportSaleOutDepotBillControl","BILLCONVERT","#SaleRtnBillProduct.Type_FromBill",2,"#SaleRtnBillProduct.FromBill_SaleRtnBillProduct","销货出库单");
- }
- else
- {
- ShowSearchBox("ImportSaleOutDepotBillUnControl","BILLCONVERT");
- }
- tbCustomerNo.Focus();
- }
- else
- if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="销货单")
- {
- @ImportClicked = 1;
-
- if(Search("SearchContrSOB"))
- {
- ShowSearchBox("ImportSaleBillControl","BILLCONVERT","#SaleRtnBillProduct.Type_FromBill",21,"#SaleRtnBillProduct.FromBill_SaleRtnBillProduct","销货单");
- }
- else
- {
- ShowSearchBox("ImportSaleBillUnControl","BILLCONVERT");
- }
-
-
- }
- if(!Equals(#SaleRtnBill.TaxCurrency_SaleRtnBill,@OrgTaxCurrency))
- {
-
- @Answer=MessageBox("单据税别不同,是否变为新税别?",@Title,MB_YESNO);
- if(@Answer==DialogResult("NO"))
- {
- if(@OrgTaxCurrency=="内含")
- {
- SuspendLayout();
- for(@k=@RowCount;@k<RowCount("SaleRtnBillProduct");@k++)
- {
- SetPosition("#SaleRtnBillProduct", @k);
- #SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct=FormatNumber(#SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct*(1+@CessOut),#SystemSetting.PriceDecimal_SystemSetting);
-
- }
- ResumeLayout();
- }
- else if(#SaleRtnBill.TaxCurrency_SaleRtnBill=="内含")
- {
- SuspendLayout();
- for(@k=@RowCount;@k<RowCount("SaleRtnBillProduct");@k++)
- {
- SetPosition("#SaleRtnBillProduct", @k);
- #SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct=FormatNumber(#SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct/(1+@CessOut),#SystemSetting.PriceDecimal_SystemSetting);
-
- }
- ResumeLayout();
- }
- #SaleRtnBill.TaxCurrency_SaleRtnBill=@OrgTaxCurrency;
-
- }
- else
- {
- if(@OrgTaxCurrency=="内含")
- {
- SuspendLayout();
- for(@k=0;@k<@RowCount;@k++)
- {
- SetPosition("#SaleRtnBillProduct", @k);
- #SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct=FormatNumber(#SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct/(1+@CessOut),#SystemSetting.PriceDecimal_SystemSetting);
-
- }
- ResumeLayout();
-
- }
- else if(#SaleRtnBill.TaxCurrency_SaleRtnBill=="内含")
- {
- SuspendLayout();
- for(@k=0;@k<@RowCount;@k++)
- {
- SetPosition("#SaleRtnBillProduct", @k);
- #SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct=FormatNumber(#SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct*(1+@CessOut),#SystemSetting.PriceDecimal_SystemSetting);
-
- }
- ResumeLayout();
- }
- }
- }
- UpdateForm(true, "cbTaxCurrency");
- ]]>
- <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
- </ClickImportItem>
- <ClickExportItem>
- if(toolBar.MenuItemText=="库存异动作业")
- {
- if(Search("SearchContr"))
- {
- ExportBillProductStart("#ModifyDepotBillProduct.Type_FromBill",22,"#ModifyDepotBillProduct.SourceBillName_ModifyDepotBillProduct","销售退货单","#ModifyDepotBillProduct.No_FromBill",#SaleRtnBill.No_SaleRtnBill,"#ModifyDepotBill.ModifyDepotBill_ModifyDepotBill","销退入库","#ModifyDepotBill.ChangedDepot_ModifyDepotBill",#SaleRtnBill.Name_Location);
- ExportBillProduct("dgProduct","#SaleRtnBillProduct","#ModifyDepotBillProduct.No_FromBillProduct","#SaleRtnBillProduct.No_SaleRtnBillProduct");
- }
- else
- {
- ExportBillProductStart("#ModifyDepotBillProduct.Comment_ModifyDepotBillProduct","销售退货单:"+#SaleRtnBill.No_SaleRtnBill,"#ModifyDepotBill.ModifyDepotBill_ModifyDepotBill","销退入库","#ModifyDepotBill.ChangedDepot_ModifyDepotBill",#SaleRtnBill.Name_Location);
- ExportBillProduct("dgProduct","#SaleRtnBillProduct","#ModifyDepotBillProduct.ProductNo_FromBillProduct","#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct");
- }
- }
- <!--初始化目标数据-->
- <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
- </ClickExportItem>
- </Events>
- </IKFormToolBar>
- </Controls>
- <Tables>
- <Table name="SaleRtnBillProduct">
- <Events>
- <ColumnsChanged>
- <FromBill_SaleRtnBillProduct>
- <Lable name="SeachProduct"/>
- #SaleRtnBillProduct.Cash_SaleRtnBillProduct=FormatNumber(#SaleRtnBillProduct.Quantity_SaleRtnBillProduct*#SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- <Lable name="Money"/>
- </FromBill_SaleRtnBillProduct>
- <No_FromBill>
- <Lable name="SeachProduct"/>
- #SaleRtnBillProduct.Cash_SaleRtnBillProduct=FormatNumber(#SaleRtnBillProduct.Quantity_SaleRtnBillProduct*#SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- <Lable name="Money"/>
- </No_FromBill>
- <No_FromBillProduct>
- <Lable name="SeachProduct"/>
- #SaleRtnBillProduct.Cash_SaleRtnBillProduct=FormatNumber(#SaleRtnBillProduct.Quantity_SaleRtnBillProduct*#SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- <Lable name="Money"/>
- </No_FromBillProduct>
- <ProductNo_SaleRtnBillProduct>
- if(@SetFlag==0)
- {
- return;
- }
- if( Equals(#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct,StringEmpty()) || !Search("SearchProductWithNo",#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct))
- {
- if(!Equals(#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct,StringEmpty()))
- MessageBox("该产品不存在!",@Title);
- #SaleRtnBillProduct.ID_Product = GuidEmpty();
- #SaleRtnBillProduct.ProductName_SaleRtnBillProduct = "";
- #SaleRtnBillProduct.ProductUnit_SaleRtnBillProduct = "";
- @temp = ShowSearchBox("InputSearchProduct","INFOMATION",#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct);
- if(@temp != "")
- {
- ResumeColumnEvent("#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct");
- #SaleRtnBillProduct.ProductNo_SaleRtnBillProduct = @temp;
- ClearColumnEvent();
- }
- }
- else
- {
- if(!Equals(#Product.SuspendDate_Product,DBNull()))
- MessageBox("该产品已停用!",@Title);
- #SaleRtnBillProduct.ID_Product=#Product.ID_Product;
- #SaleRtnBillProduct.ProductName_SaleRtnBillProduct=#Product.Name_Product;
- #SaleRtnBillProduct.ProductUnit_SaleRtnBillProduct=#Product.Unit_Product;
- #SaleRtnBillProduct.Cost_Product=#Product.Cost_Product;
- }
- </ProductNo_SaleRtnBillProduct>
- <Quantity_SaleRtnBillProduct>
- #SaleRtnBillProduct.Quantity_SaleRtnBillProduct = FormatNumber(#SaleRtnBillProduct.Quantity_SaleRtnBillProduct, #SystemSetting.QuantityDecimal_SystemSetting);
- #SaleRtnBillProduct.Cash_SaleRtnBillProduct=FormatNumber(#SaleRtnBillProduct.Quantity_SaleRtnBillProduct*#SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct,#SystemSetting.PriceDecimal_SystemSetting);
- <Lable name="Money"/>
- </Quantity_SaleRtnBillProduct>
- <UnitPrice_SaleRtnBillProduct>
- #SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct = FormatNumber(#SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct, #SystemSetting.UnitPriceDecimal_SystemSetting);
- #SaleRtnBillProduct.Cash_SaleRtnBillProduct=FormatNumber(#SaleRtnBillProduct.Quantity_SaleRtnBillProduct*#SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- <Lable name="Money"/>
- </UnitPrice_SaleRtnBillProduct>
- </ColumnsChanged>
- <RowDeleted>
- <Lable name="Money"/>
- </RowDeleted>
- </Events>
- </Table>
- </Tables>
- <LockInfomation LockID="ID_SaleRtnBill" LockNO="No_SaleRtnBill" LockSearchFunction="SearchBillWithNo" LockAudit="ID_Assessor"/>
- <LogInfomation LogNO="#SaleRtnBill.No_SaleRtnBill" RecordFormField="" RecordDataGridField="#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct,#SaleRtnBillProduct.Quantity_SaleRtnBillProduct,#SaleRtnBillProduct.Cash_SaleRtnBillProduct"/>
- <ChildForms>
- <ChildForm name="BillSearch" DataSource="SaleRtnBill" SearchFunction="SearchAllBill" SearchFunctionCondition="SearchBillCondition" SearchFunctionByNo="SearchBillWithNo">
- <DataColumn Index="0" MappingName="#SaleRtnBill.No_SaleRtnBill" HeaderText="销售退货单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="1" MappingName="#SaleRtnBill.Date_SaleRtnBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="2" MappingName="#SaleRtnBill.No_Customer" HeaderText="客户编号" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="3" MappingName="#SaleRtnBill.ShortName_Customer" HeaderText="客户名称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="4" MappingName="#SaleRtnBill.Reason_SaleRtnBill" HeaderText="退货原因" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="5" MappingName="#SaleRtnBill.Principal_SaleRtnBill" HeaderText="业务负责" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="6" MappingName="#SaleRtnBill.TaxCurrency_SaleRtnBill" HeaderText="税别" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="CustomerSearch" DataSource="Customer" SearchFunction="SearchAllCustomer" SearchFunctionCondition="SearchCustomerCondition" 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"/>
- <DataColumn Index="5" MappingName="#Customer.Zone_Customer" HeaderText="地区" Width="90" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="6" MappingName="#Customer.SendAddr_Customer" HeaderText="送货地址" Width="100" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="7" MappingName="#Customer.Name_Linkman" HeaderText="主要联系人" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="8" MappingName="#Customer.No_Telephone" HeaderText="客户电话" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="9" MappingName="#Customer.No_Fax" HeaderText="传真" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品" ReturnDataSource="SaleRtnBillProduct" ShowCheckBox="true">
- <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn" ReturnMappingName="#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct"/>
- <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="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="ImportSaleOutDepotBillControl" >
- <DataGridIndex DataSource="SaleOutDepotBill" SearchFunction="SearchAllSaleOutDepotBill" SearchFunctionByNo="" MappingName="" ReturnDataSource="SaleRtnBillProduct">
- <DataColumn Index="0" MappingName="#SaleOutDepotBill.No_SaleOutDepotBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleRtnBillProduct.No_FromBill"/>
- <DataColumn Index="1" MappingName="#SaleOutDepotBill.Date_SaleOutDepotBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="2" MappingName="#SaleOutDepotBill.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#SaleRtnBill.No_Customer"/>
- <DataColumn Index="3" MappingName="#SaleOutDepotBill.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="4" MappingName="#SaleOutDepotBill.State_SaleOutDepotBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="5" MappingName="#SaleOutDepotBill.Name_Location" HeaderText="出货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#SaleRtnBill.Name_Location"/>
- </DataGridIndex>
- <DataGridIndex DataSource="SaleOutDepotBillProduct" SearchFunction="SearchAllSaleOutDepotBillProduct" SearchFunctionByNo="" MappingName="">
- <DataColumn Index="0" MappingName="#SaleOutDepotBillProduct.No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="1" MappingName="#SaleOutDepotBillProduct.No_SaleOutDepotBillProduct" HeaderText="产品序号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleRtnBillProduct.No_FromBillProduct"/>
- <DataColumn Index="2" MappingName="#SaleOutDepotBillProduct.Name_Product" HeaderText="产品名称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="3" MappingName="#SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct" HeaderText="数量" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
- <DataColumn Index="4" MappingName="#SaleOutDepotBillProduct.UnitPrice_SaleOutDepotBillProduct" HeaderText="单价" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
- </DataGridIndex>
- </ChildForm>
- <ChildForm name="ImportSaleOutDepotBillUnControl" >
- <DataGridIndex DataSource="SaleOutDepotBill" SearchFunction="SearchAllSaleOutDepotBill" SearchFunctionByNo="" MappingName="" ReturnDataSource="SaleRtnBillProduct">
- <DataColumn Index="0" MappingName="#SaleOutDepotBill.No_SaleOutDepotBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleRtnBillProduct.Comment_SaleRtnBillProduct"/>
- <DataColumn Index="1" MappingName="#SaleOutDepotBill.Date_SaleOutDepotBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="2" MappingName="#SaleOutDepotBill.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#SaleRtnBill.No_Customer"/>
- <DataColumn Index="3" MappingName="#SaleOutDepotBill.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="4" MappingName="#SaleOutDepotBill.State_SaleOutDepotBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="5" MappingName="#SaleOutDepotBill.Name_Location" HeaderText="出货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#SaleRtnBill.Name_Location"/>
- </DataGridIndex>
- <DataGridIndex DataSource="SaleOutDepotBillProduct" SearchFunction="SearchAllSaleOutDepotBillProduct" SearchFunctionByNo="" MappingName="">
- <DataColumn Index="0" MappingName="#SaleOutDepotBillProduct.No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct"/>
- <DataColumn Index="1" MappingName="#SaleOutDepotBillProduct.No_SaleOutDepotBillProduct" HeaderText="产品序号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="2" MappingName="#SaleOutDepotBillProduct.Name_Product" HeaderText="产品名称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="3" MappingName="#SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct" HeaderText="数量" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
- <DataColumn Index="4" MappingName="#SaleOutDepotBillProduct.UnitPrice_SaleOutDepotBillProduct" HeaderText="单价" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
- </DataGridIndex>
- </ChildForm>
- <ChildForm name="ImportSaleBillControl" >
- <DataGridIndex DataSource="SaleBill" SearchFunction="SearchAllSaleBill" SearchFunctionByNo="" MappingName="" ReturnDataSource="SaleRtnBillProduct">
- <DataColumn Index="0" MappingName="#SaleBill.No_SaleBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleRtnBillProduct.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="#SaleRtnBill.No_Customer"/>
- <DataColumn Index="3" MappingName="#SaleBill.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="4" MappingName="#SaleBill.TaxCurrency_SaleBill" HeaderText="税别" Width="30" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#SaleRtnBill.TaxCurrency_SaleRtnBill"/>
- <DataColumn Index="5" MappingName="#SaleBill.Currency_SaleBill" HeaderText="币别" Width="30" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#SaleRtnBill.Currency_SaleRtnBill"/>
- <DataColumn Index="6" MappingName="#SaleBill.State_SaleBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="7" MappingName="#SaleBill.Name_Location" HeaderText="出货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#SaleRtnBill.Name_Location"/>
- <DataColumn Index="8" MappingName="#SaleBill.No_Principal" HeaderText="业务负责编号" Width="0" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#SaleRtnBill.No_Principal"/>
- <DataColumn Index="9" MappingName="#SaleBill.Principal_SaleBill" HeaderText="业务负责" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#SaleRtnBill.Principal_SaleRtnBill"/>
- <DataColumn Index="10" MappingName="#SaleBill.ID_Principal" HeaderText="ID" Width="0" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#SaleRtnBill.ID_Principal"/>
- </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="#SaleRtnBillProduct.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"/>
- </DataGridIndex>
- </ChildForm>
- </ChildForms>
- <FormatString>
- <Format name="SearchCustomerCondition">
- if(GetRight("客户基本资料","全权查看"))
- {
- FormatString("");
- }
- else
- {
- FormatString(" Customer.ID_Creator='{0}' ",GetLoginUserID());
- }
- </Format>
- <Format name="SearchBillCondition">
- if(GetRight("客户基本资料","全权查看"))
- {
- FormatString("");
- }
- else
- {
- FormatString(" Disable_SaleRtnBill=0 and Customer.ID_Creator='{0}' ",GetLoginUserID());
- }
- </Format>
- </FormatString>
- <ImportedInfo>
- <![CDATA[
- UpdateForm(true,"cbPrincipal");
- @TaxCurrency = #SaleRtnBill.TaxCurrency_SaleRtnBill;
- UpdateForm(true, "tbCustomerNo");
- UpdateForm(true, "cbCurrency");
- tbCustomerNo.Focus();
- Search("SearchLocation");
- cbLocation.Text = #SaleRtnBill.Name_Location;
- ActiveControlEvent("tbCustomerNo", "Enter");
- #SaleRtnBill.TaxCurrency_SaleRtnBill = @TaxCurrency;
- UpdateForm(true, "cbTaxCurrency");
- ]]>
- </ImportedInfo>
- </Client>
- <Server>
- <Tables>
- <Table name="SaleRtnBill" Type="Parent">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 SaleRtnBill.*,
- Customer.No_Customer,
- Customer.ShortName_Customer,
- Location.Name_Location,
- Location.No_Location,
- AppUser.LoginName_User as Name_Creator,
- A1.LoginName_User as Name_Assessor,
- A2.LoginName_User as LastModUserName_SaleRtnBill,
- convert(decimal(18,6),0) AS CountColume_SaleRtnBillProduct,
- convert(decimal(18,6),0) AS TaxCurrencyCash_SaleRtnBillProduct,
- convert(decimal(18,6),0) AS CurrencyCash_SaleRtnBillProduct,
- convert(nvarchar(64),'') AS No_Principal,
- convert(nvarchar(64),'') AS Principal_SaleRtnBill
- FROM SaleRtnBill
- JOIN Customer ON Customer.ID_Customer = SaleRtnBill.ID_Customer
- JOIN AppUser ON AppUser.ID_User = SaleRtnBill.ID_Creator
- LEFT JOIN AppUser A1 ON A1.ID_User = SaleRtnBill.ID_Assessor
- LEFT JOIN AppUser A2 ON A2.ID_User = SaleRtnBill.LastModUser_SaleRtnBill
- JOIN Location ON Location.ID_Location = SaleRtnBill.ID_Location"/>
- <New CmdType="Text" CmdText="INSERT INTO SaleRtnBill (ID_SaleRtnBill, No_SaleRtnBill, Date_SaleRtnBill, IsPrevBill_SaleRtnBill, ID_Location, ID_Customer, ID_Principal, Reason_SaleRtnBill, TaxCurrency_SaleRtnBill, Currency_SaleRtnBill, ID_Creator, ID_Assessor, AssessDate_SaleRtnBill, Comment_SaleRtnBill, Disable_SaleRtnBill, CreateDate_SaleRtnBill, LastModUser_SaleRtnBill, LastModDate_SaleRtnBill,Amount_SaleRtnBill,GoodsAmount_SaleRtnBill,TaxAmount_SaleRtnBill,PName_SaleRtnBill)
- VALUES(@ID_SaleRtnBill, @No_SaleRtnBill, @Date_SaleRtnBill, @IsPrevBill_SaleRtnBill, @ID_Location, @ID_Customer, @ID_Principal, @Reason_SaleRtnBill, @TaxCurrency_SaleRtnBill, @Currency_SaleRtnBill, @ID_Creator, @ID_Assessor, @AssessDate_SaleRtnBill, @Comment_SaleRtnBill, @Disable_SaleRtnBill, @CreateDate_SaleRtnBill, @LastModUser_SaleRtnBill, @LastModDate_SaleRtnBill,@Amount_SaleRtnBill,@GoodsAmount_SaleRtnBill,@TaxAmount_SaleRtnBill,@PName_SaleRtnBill)">
- <Params>
- <Param name="@ID_SaleRtnBill" type="SaleRtnBill.ID_SaleRtnBill" sourceColumn="ID_SaleRtnBill"/>
- <Param name="@No_SaleRtnBill" type="SaleRtnBill.No_SaleRtnBill" sourceColumn="No_SaleRtnBill"/>
- <Param name="@Date_SaleRtnBill" type="SaleRtnBill.Date_SaleRtnBill" sourceColumn="Date_SaleRtnBill"/>
- <Param name="@IsPrevBill_SaleRtnBill" type="SaleRtnBill.IsPrevBill_SaleRtnBill" sourceColumn="IsPrevBill_SaleRtnBill"/>
- <Param name="@ID_Location" type="SaleRtnBill.ID_Location" sourceColumn="ID_Location"/>
- <Param name="@ID_Customer" type="SaleRtnBill.ID_Customer" sourceColumn="ID_Customer"/>
- <Param name="@ID_Principal" type="SaleRtnBill.ID_Principal" sourceColumn="ID_Principal"/>
- <Param name="@Reason_SaleRtnBill" type="SaleRtnBill.Reason_SaleRtnBill" sourceColumn="Reason_SaleRtnBill"/>
- <Param name="@TaxCurrency_SaleRtnBill" type="SaleRtnBill.TaxCurrency_SaleRtnBill" sourceColumn="TaxCurrency_SaleRtnBill"/>
- <Param name="@Currency_SaleRtnBill" type="SaleRtnBill.Currency_SaleRtnBill" sourceColumn="Currency_SaleRtnBill"/>
- <Param name="@ID_Creator" type="SaleRtnBill.ID_Creator" sourceColumn="ID_Creator"/>
- <Param name="@ID_Assessor" type="SaleRtnBill.ID_Assessor" sourceColumn="ID_Assessor"/>
- <Param name="@AssessDate_SaleRtnBill" type="SaleRtnBill.AssessDate_SaleRtnBill" sourceColumn="AssessDate_SaleRtnBill"/>
- <Param name="@Comment_SaleRtnBill" type="SaleRtnBill.Comment_SaleRtnBill" sourceColumn="Comment_SaleRtnBill"/>
- <Param name="@Disable_SaleRtnBill" type="SaleRtnBill.Disable_SaleRtnBill" sourceColumn="Disable_SaleRtnBill"/>
- <Param name="@CreateDate_SaleRtnBill" type="SaleRtnBill.CreateDate_SaleRtnBill" sourceColumn="CreateDate_SaleRtnBill"/>
- <Param name="@LastModUser_SaleRtnBill" type="SaleRtnBill.LastModUser_SaleRtnBill" sourceColumn="LastModUser_SaleRtnBill"/>
- <Param name="@LastModDate_SaleRtnBill" type="SaleRtnBill.LastModDate_SaleRtnBill" sourceColumn="LastModDate_SaleRtnBill"/>
- <Param name="@Amount_SaleRtnBill" type="SaleRtnBill.Amount_SaleRtnBill" sourceColumn="Amount_SaleRtnBill"/>
- <Param name="@GoodsAmount_SaleRtnBill" type="SaleRtnBill.GoodsAmount_SaleRtnBill" sourceColumn="GoodsAmount_SaleRtnBill"/>
- <Param name="@TaxAmount_SaleRtnBill" type="SaleRtnBill.TaxAmount_SaleRtnBill" sourceColumn="TaxAmount_SaleRtnBill"/>
- <Param name="@PName_SaleRtnBill" type="SaleRtnBill.PName_SaleRtnBill" sourceColumn="PName_SaleRtnBill"/>
- </Params>
- </New>
- <Update CmdType="Text" CmdText="UPDATE SaleRtnBill SET
- No_SaleRtnBill = @No_SaleRtnBill,
- Date_SaleRtnBill = @Date_SaleRtnBill,
- IsPrevBill_SaleRtnBill = @IsPrevBill_SaleRtnBill,
- ID_Location = @ID_Location,
- ID_Customer = @ID_Customer,
- ID_Principal = @ID_Principal,
- Reason_SaleRtnBill = @Reason_SaleRtnBill,
- TaxCurrency_SaleRtnBill = @TaxCurrency_SaleRtnBill,
- Currency_SaleRtnBill = @Currency_SaleRtnBill,
- ID_Creator = @ID_Creator,
- ID_Assessor = @ID_Assessor,
- AssessDate_SaleRtnBill = @AssessDate_SaleRtnBill,
- Comment_SaleRtnBill = @Comment_SaleRtnBill,
- Disable_SaleRtnBill = @Disable_SaleRtnBill,
- CreateDate_SaleRtnBill = @CreateDate_SaleRtnBill,
- LastModUser_SaleRtnBill = @LastModUser_SaleRtnBill,
- LastModDate_SaleRtnBill = @LastModDate_SaleRtnBill,
- Amount_SaleRtnBill = @Amount_SaleRtnBill,
- GoodsAmount_SaleRtnBill=@GoodsAmount_SaleRtnBill,
- TaxAmount_SaleRtnBill=@TaxAmount_SaleRtnBill,
- PName_SaleRtnBill = @PName_SaleRtnBill,
- Assess_SaleRtnBill = @Assess_SaleRtnBill
- WHERE ID_SaleRtnBill = @ID_SaleRtnBill">
- <Params>
- <Param name="@ID_SaleRtnBill" type="SaleRtnBill.ID_SaleRtnBill" sourceColumn="ID_SaleRtnBill"/>
- <Param name="@No_SaleRtnBill" type="SaleRtnBill.No_SaleRtnBill" sourceColumn="No_SaleRtnBill"/>
- <Param name="@Date_SaleRtnBill" type="SaleRtnBill.Date_SaleRtnBill" sourceColumn="Date_SaleRtnBill"/>
- <Param name="@IsPrevBill_SaleRtnBill" type="SaleRtnBill.IsPrevBill_SaleRtnBill" sourceColumn="IsPrevBill_SaleRtnBill"/>
- <Param name="@ID_Location" type="SaleRtnBill.ID_Location" sourceColumn="ID_Location"/>
- <Param name="@ID_Customer" type="SaleRtnBill.ID_Customer" sourceColumn="ID_Customer"/>
- <Param name="@ID_Principal" type="SaleRtnBill.ID_Principal" sourceColumn="ID_Principal"/>
- <Param name="@Reason_SaleRtnBill" type="SaleRtnBill.Reason_SaleRtnBill" sourceColumn="Reason_SaleRtnBill"/>
- <Param name="@TaxCurrency_SaleRtnBill" type="SaleRtnBill.TaxCurrency_SaleRtnBill" sourceColumn="TaxCurrency_SaleRtnBill"/>
- <Param name="@Currency_SaleRtnBill" type="SaleRtnBill.Currency_SaleRtnBill" sourceColumn="Currency_SaleRtnBill"/>
- <Param name="@ID_Creator" type="SaleRtnBill.ID_Creator" sourceColumn="ID_Creator"/>
- <Param name="@ID_Assessor" type="SaleRtnBill.ID_Assessor" sourceColumn="ID_Assessor"/>
- <Param name="@AssessDate_SaleRtnBill" type="SaleRtnBill.AssessDate_SaleRtnBill" sourceColumn="AssessDate_SaleRtnBill"/>
- <Param name="@Comment_SaleRtnBill" type="SaleRtnBill.Comment_SaleRtnBill" sourceColumn="Comment_SaleRtnBill"/>
- <Param name="@Disable_SaleRtnBill" type="SaleRtnBill.Disable_SaleRtnBill" sourceColumn="Disable_SaleRtnBill"/>
- <Param name="@CreateDate_SaleRtnBill" type="SaleRtnBill.CreateDate_SaleRtnBill" sourceColumn="CreateDate_SaleRtnBill"/>
- <Param name="@LastModUser_SaleRtnBill" type="SaleRtnBill.LastModUser_SaleRtnBill" sourceColumn="LastModUser_SaleRtnBill"/>
- <Param name="@LastModDate_SaleRtnBill" type="SaleRtnBill.LastModDate_SaleRtnBill" sourceColumn="LastModDate_SaleRtnBill"/>
- <Param name="@Amount_SaleRtnBill" type="SaleRtnBill.Amount_SaleRtnBill" sourceColumn="Amount_SaleRtnBill"/>
- <Param name="@GoodsAmount_SaleRtnBill" type="SaleRtnBill.GoodsAmount_SaleRtnBill" sourceColumn="GoodsAmount_SaleRtnBill"/>
- <Param name="@TaxAmount_SaleRtnBill" type="SaleRtnBill.TaxAmount_SaleRtnBill" sourceColumn="TaxAmount_SaleRtnBill"/>
- <Param name="@PName_SaleRtnBill" type="SaleRtnBill.PName_SaleRtnBill" sourceColumn="PName_SaleRtnBill"/>
- <Param name="@Assess_SaleRtnBill" type="SaleRtnBill.Assess_SaleRtnBill" sourceColumn="Assess_SaleRtnBill"/>
- </Params>
- </Update>
- <Audit CmdType="Text" CmdText=" --DECLARE @OUTDEPOT DECIMAL(14,4)
- --DECLARE @SALERTN DECIMAL(14,4)
- --DECLARE @INDEPOT DECIMAL(14,4)
- DECLARE @Quantity_SaleRtnBillProduct DECIMAL(14,4)
- DECLARE @ID_SaleSourceBillProduct UNIQUEIDENTIFIER
- DECLARE @ID_SaleRtnBillProduct UNIQUEIDENTIFIER
- DECLARE @OutDepotAndSaleBack_SystemSetting BIT
- DECLARE @SaleBackAndInDepot_SystemSetting BIT
- DECLARE @SaleAndOutDepot_SystemSetting BIT
- DECLARE @SaleRtnSourceBill_SystemSetting BIT --
- --DECLARE @ID_SaleOutDepotBillAssessor UNIQUEIDENTIFIER
- --DECLARE @SumSalRtn DECIMAL(14,4)
- --DECLARE @SumInDepot DECIMAL(14,4)
- DECLARE @error nvarchar(64)
- DECLARE @No_SaleRtnBillProduct NVARCHAR(64)
- DECLARE @No_FromBillProduct NVARCHAR(64)
- DECLARE @SumQuantity_InDepot DECIMAL(14,4)
- DECLARE @SumQuantity_SaleRtn DECIMAL(14,4)
- DECLARE @Type_FromBill int
- DECLARE @No_FromBill NVARCHAR(64)
- DECLARE @Quantity_OutDepot DECIMAL(14,4)
- DECLARE @Quantity_SaleRtn DECIMAL(14,4)
- DECLARE @Quantity_InDepot DECIMAL(14,4)
- DECLARE @ChildCustomer UNIQUEIDENTIFIER
- DECLARE @Assess_SaleRtnBill bit
- SELECT @SaleAndOutDepot_SystemSetting=SaleAndOutDepot_SystemSetting,@SaleBackAndInDepot_SystemSetting=SaleBackAndInDepot_SystemSetting,@OutDepotAndSaleBack_SystemSetting=OutDepotAndSaleBack_SystemSetting FROM SystemSetting
-
- DECLARE CUR CURSOR FOR SELECT Type_FromBill,No_FromBill,ID_SaleRtnBillProduct,Quantity_SaleRtnBillProduct,No_SaleRtnBillProduct,No_FromBillProduct,InQuantity_SaleRtnBillProduct
- FROM SaleRtnBillProduct
- WHERE SaleRtnBillProduct.ID_SaleRtnBill = @ID_SaleRtnBill
- OPEN CUR
- FETCH NEXT FROM CUR INTO @Type_FromBill,@No_FromBill,@ID_SaleRtnBillProduct,@Quantity_SaleRtnBillProduct,@No_SaleRtnBillProduct,@No_FromBillProduct,@Quantity_InDepot
- WHILE @@FETCH_STATUS = 0
- BEGIN
- IF(@ID_Assessor IS NOT NULL)
- BEGIN
- IF( @OutDepotAndSaleBack_SystemSetting=1 AND @IsPrevBill_SaleRtnBill=0)
- BEGIN
- IF(@Type_FromBill=2)
- BEGIN
- IF NOT EXISTS(SELECT * FROM SaleOutDepotBill WHERE SaleOutDepotBill.No_SaleOutDepotBill=@No_FromBill AND SaleOutDepotBill.ID_Assessor IS NOT NULL)
- BEGIN
- SET @error = N'序号为'+@No_SaleRtnBillProduct+N'的产品来源单据未经审核!'
- RAISERROR(@error,16,1)
- RETURN
- END
- SELECT @ChildCustomer=SaleOutDepotBill.ID_Customer FROM SaleOutDepotBill WHERE SaleOutDepotBill.No_SaleOutDepotBill=@No_FromBill
- IF(@ChildCustomer!=@ID_Customer)
- BEGIN
- SET @error = N'序号为'+@No_SaleRtnBillProduct+N'的来源单据的客户与本单据的客户不一致!'
- RAISERROR(@error,16,1)
- RETURN
- END
- SELECT @ID_SaleSourceBillProduct = ID_SaleSourceBillProduct FROM SaleOutDepotBill A LEFT JOIN SaleOutDepotBillProduct B ON A.ID_SaleOutDepotBill = B.ID_SaleOutDepotBill
- WHERE A.No_SaleOutDepotBill = @No_FromBill AND B.No_SaleOutDepotBillProduct = @No_FromBillProduct
- END
- IF(@Type_FromBill=21)
- BEGIN
- IF(@SaleAndOutDepot_SystemSetting = 0)
- BEGIN
- RAISERROR('[销货- 出库]流程未进行控管,无法从销货单转入!',16,1)
- RETURN
- END
- IF NOT EXISTS(SELECT * FROM SaleBill WHERE SaleBill.No_SaleBill=@No_FromBill AND SaleBill.ID_Assessor IS NOT NULL)
- BEGIN
- SET @error = N'序号为'+@No_SaleRtnBillProduct+N'的产品来源单据未经审核!'
- RAISERROR(@error,16,1)
- RETURN
- END
- SELECT @ChildCustomer=SaleBill.ID_Customer FROM SaleBill WHERE SaleBill.No_SaleBill=@No_FromBill
- IF(@ChildCustomer!=@ID_Customer)
- BEGIN
- SET @error = N'序号为'+@No_SaleRtnBillProduct+N'的来源单据的客户与本单据的客户不一致!'
- RAISERROR(@error,16,1)
- RETURN
- END
- SELECT @ID_SaleSourceBillProduct = ID_SaleSourceBillProduct FROM SaleBill A LEFT JOIN SaleBillProduct B ON A.ID_SaleBill = B.ID_SaleBill
- WHERE A.No_SaleBill = @No_FromBill AND B.No_SaleBillProduct = @No_FromBillProduct
- END
-
- SELECT @Quantity_OutDepot=Quantity_OutDepot,@Quantity_SaleRtn=Quantity_SaleRtn
- From SaleSourceBillProduct
- WHERE SaleSourceBillProduct.ID_SaleSourceBillProduct = @ID_SaleSourceBillProduct
- IF (@Quantity_OutDepot < @Quantity_SaleRtnBillProduct+@Quantity_SaleRtn)
- BEGIN
- SET @error = N'序号为'+@No_SaleRtnBillProduct+N'的产品的累计退货数量大于相应出库数量,审核失败!请于关联单据处查询!'
- RAISERROR(@error,16,1)
- RETURN
- END
- IF(@Type_FromBill=2)
- BEGIN
- IF(@Quantity_SaleRtnBillProduct >(Select (Quantity_SaleOutDepotBillProduct-RtnQuantity_SaleOutDepotBillProduct)
- From SaleOutDepotBillProduct
- Join SaleOutDepotBill On SaleOutDepotBill.ID_SaleOutDepotBill=SaleOutDepotBillProduct.ID_SaleOutDepotBill
- Where No_SaleOutDepotBill=@No_FromBill And No_SaleOutDepotBillProduct=@No_FromBillProduct))
- BEGIN
- SET @error = N'序号为'+@No_SaleRtnBillProduct+N'的产品的累计退货数量大于相应出库数量,审核失败!请于关联单据处查询!'
- RAISERROR(@error,16,1)
- RETURN
- END
- END
-
- IF(@SaleBackAndInDepot_SystemSetting=1)
- BEGIN
- IF @Quantity_SaleRtnBillProduct < @Quantity_InDepot
- BEGIN
- SET @error = N'序号为'+@No_SaleRtnBillProduct+N'的产品的累计退货数量小于相应入库数量,审核失败!请于关联单据处查询!'
- RAISERROR(@error,16,1)
- RETURN
- END
- END
- UPDATE SaleRtnBillProduct SET ID_SaleSourceBillProduct=@ID_SaleSourceBillProduct
- WHERE ID_SaleRtnBillProduct=@ID_SaleRtnBillProduct
-
- UPDATE SaleSourceBillProduct SET Quantity_SaleRtn=IsNull(Quantity_SaleRtn,0)+@Quantity_SaleRtnBillProduct
- WHERE SaleSourceBillProduct.ID_SaleSourceBillProduct=@ID_SaleSourceBillProduct
-
- Update SaleOutDepotBillProduct Set RtnQuantity_SaleOutDepotBillProduct=IsNull(RtnQuantity_SaleOutDepotBillProduct,0)+@Quantity_SaleRtnBillProduct
- Where ID_SaleOutDepotBill=(Select ID_SaleOutDepotBill From SaleOutDepotBill Where No_SaleOutDepotBill=@No_FromBill) And No_SaleOutDepotBillProduct=@No_FromBillProduct
- END
- ELSE IF(@SaleBackAndInDepot_SystemSetting=1)
- BEGIN
- IF @Quantity_SaleRtnBillProduct < @Quantity_InDepot
- BEGIN
- SET @error = N'序号为'+@No_SaleRtnBillProduct+N'的产品的累计退货数量小于相应入库数量,审核失败!请于关联单据处查询!'
- RAISERROR(@error,16,1)
- RETURN
- END
- IF EXISTS(SELECT * FROM SaleSourceBillProduct WHERE ID_SaleSourceBillProduct=@ID_SaleRtnBillProduct)
- BEGIN
- UPDATE SaleSourceBillProduct SET Quantity_SaleRtn=@Quantity_SaleRtnBillProduct
- WHERE SaleSourceBillProduct.ID_SaleSourceBillProduct=@ID_SaleRtnBillProduct
- END
- ELSE
- BEGIN
- INSERT INTO SaleSourceBillProduct(ID_SaleSourceBillProduct,Quantity_Sale,Quantity_OutDepot,Quantity_SaleRtn,Quantity_InDepot)
- VALUES(@ID_SaleRtnBillProduct,0,0,@Quantity_SaleRtnBillProduct,0)
- END
- UPDATE SaleRtnBillProduct SET SaleRtnBillProduct.ID_SaleSourceBillProduct=@ID_SaleRtnBillProduct
- WHERE SaleRtnBillProduct.ID_SaleRtnBillProduct=@ID_SaleRtnBillProduct
- END
- END
- ELSE
- BEGIN
- SELECT @Assess_SaleRtnBill = SaleRtnBill.Assess_SaleRtnBill FROM SaleRtnBill WHERE SaleRtnBill.ID_SaleRtnBill = @ID_SaleRtnBill
- IF (@Assess_SaleRtnBill = 1)
- BEGIN
- RAISERROR('该单据已经财务复核,请先取消财务复核!',16,1)
- RETURN
- END
- IF(@SaleBackAndInDepot_SystemSetting = 1)
- BEGIN
- SELECT @SumQuantity_SaleRtn=sum(Quantity_SaleRtnBillProduct),@SumQuantity_InDepot=sum(InQuantity_SaleRtnBillProduct)
- FROM SaleRtnBillProduct
- WHERE SaleRtnBillProduct.ID_SaleRtnBill = @ID_SaleRtnBill
- IF(@SumQuantity_SaleRtn=@SumQuantity_InDepot AND @SumQuantity_InDepot!=0 AND @SumQuantity_SaleRtn != 0 )
- BEGIN
- RAISERROR('该单据产品已经全部入库,取消审核失败!',16,1)
- RETURN
- END
-
- END
- IF(@OutDepotAndSaleBack_SystemSetting=1 AND @IsPrevBill_SaleRtnBill=0)
- BEGIN
- Update SaleOutDepotBillProduct Set RtnQuantity_SaleOutDepotBillProduct=IsNull(RtnQuantity_SaleOutDepotBillProduct,0)-@Quantity_SaleRtnBillProduct
- Where ID_SaleOutDepotBill=(Select ID_SaleOutDepotBill From SaleOutDepotBill Where No_SaleOutDepotBill=@No_FromBill) And No_SaleOutDepotBillProduct=@No_FromBillProduct
- END
- IF(@SaleBackAndInDepot_SystemSetting = 1 OR (@OutDepotAndSaleBack_SystemSetting=1 AND @IsPrevBill_SaleRtnBill=0))
- BEGIN
- UPDATE SaleSourceBillProduct SET Quantity_SaleRtn=IsNull(Quantity_SaleRtn,0)-@Quantity_SaleRtnBillProduct
- WHERE SaleSourceBillProduct.ID_SaleSourceBillProduct=(Select ID_SaleSourceBillProduct From SaleRtnBillProduct Where ID_SaleRtnBillProduct=@ID_SaleRtnBillProduct)
- END
- END
- FETCH NEXT FROM CUR INTO @Type_FromBill,@No_FromBill,@ID_SaleRtnBillProduct,@Quantity_SaleRtnBillProduct,@No_SaleRtnBillProduct,@No_FromBillProduct,@Quantity_InDepot
- END
-
- UPDATE SaleRtnBill SET
- ID_Assessor = @ID_Assessor,
- AssessDate_SaleRtnBill = @AssessDate_SaleRtnBill,
- Disable_SaleRtnBill=@Disable_SaleRtnBill
- WHERE No_SaleRtnBill = @No_SaleRtnBill">
- <Params>
- <Param name="@ID_SaleRtnBill" type="SaleRtnBill.ID_SaleRtnBill" sourceColumn="ID_SaleRtnBill" />
- <Param name="@No_SaleRtnBill" type="SaleRtnBill.No_SaleRtnBill" sourceColumn="No_SaleRtnBill"/>
- <Param name="@ID_Assessor" type="SaleRtnBill.ID_Assessor" sourceColumn="ID_Assessor"/>
- <Param name="@ID_Customer" type="SaleRtnBill.ID_Customer" sourceColumn="ID_Customer"/>
- <Param name="@AssessDate_SaleRtnBill" type="SaleRtnBill.AssessDate_SaleRtnBill" sourceColumn="AssessDate_SaleRtnBill"/>
- <Param name="@IsPrevBill_SaleRtnBill" type="SaleRtnBill.IsPrevBill_SaleRtnBill" sourceColumn="IsPrevBill_SaleRtnBill"/>
- <Param name="@Disable_SaleRtnBill" type="SaleRtnBill.Disable_SaleRtnBill" sourceColumn="Disable_SaleRtnBill" />
- </Params>
- </Audit>
- <Delete CmdType="Text" CmdText="DECLARE @INDEPOT DECIMAL(14,4)
- DECLARE @OutDepotAndSaleBack_SystemSetting BIT
- DECLARE @SaleBackAndInDepot_SystemSetting BIT
- SELECT @OutDepotAndSaleBack_SystemSetting=OutDepotAndSaleBack_SystemSetting, @SaleBackAndInDepot_SystemSetting=SaleBackAndInDepot_SystemSetting FROM SystemSetting
-
- SELECT @INDEPOT=Sum(InQuantity_SaleRtnBillProduct)
- FROM SaleRtnBillProduct
- WHERE SaleRtnBillProduct.ID_SaleRtnBill=@ID_SaleRtnBill
- IF @INDEPOT!=0
- BEGIN
- RAISERROR('该单据已有相应的销售退货入库记录,删除失败!',18,19)
- RETURN
- END
-
- IF @OutDepotAndSaleBack_SystemSetting=0 AND @SaleBackAndInDepot_SystemSetting=1
- BEGIN
- DELETE SaleSourceBillProduct WHERE SaleSourceBillProduct.ID_SaleSourceBillProduct
- IN(SELECT ID_SaleSourceBillProduct FROM SaleRtnBillProduct WHERE SaleRtnBillProduct.ID_SaleRtnBill = @ID_SaleRtnBill)
- END
- DELETE SaleRtnBillProduct WHERE SaleRtnBillProduct.ID_SaleRtnBill = @ID_SaleRtnBill
- DELETE SaleRtnBill WHERE SaleRtnBill.ID_SaleRtnBill = @ID_SaleRtnBill">
- <Params>
- <Param name="@ID_SaleRtnBill" type="SaleRtnBill.ID_SaleRtnBill" sourceColumn="ID_SaleRtnBill"/>
- </Params>
- </Delete>
- <FKErrorReport ErrorMessage="该单据已被其他单据引用,删除失败!"/>
- <UNIQUEErrorReport ErrorMessage="销售退货单单号已存在,提交失败!"/>
- </Table>
- <Table name="SaleRtnBillProduct" Type="Child">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 SaleRtnBillProduct.*,
- BillType.Name_BillType AS FromBill_SaleRtnBillProduct,
- SaleRtnBill.IsPrevBill_SaleRtnBill,
- SaleRtnBill.AssessDate_SaleRtnBill,
- Product.No_Product AS ProductNo_SaleRtnBillProduct,
- Product.Name_Product AS ProductName_SaleRtnBillProduct,
- Product.Unit_Product AS ProductUnit_SaleRtnBillProduct,
- Product.Cost_Product AS Cost_Product,
- convert(decimal(18,6),0) AS Cash_SaleRtnBillProduct,
- convert(nvarchar(256),'') AS Comment_SaleRtnBillProduct ,
- convert(nvarchar(64),'') as No_SaleRtnBill
- FROM SaleRtnBillProduct
- JOIN Product ON Product.ID_Product=SaleRtnBillProduct.ID_Product
- JOIN SaleRtnBill ON SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
- LEFT JOIN BillType ON BillType.Value_BillType=SaleRtnBillProduct.Type_FromBill
- LEFT JOIN SaleOutDepotBillProduct ON SaleOutDepotBillProduct.No_SaleOutDepotBillProduct=SaleRtnBillProduct.No_FromBillProduct"/>
- <New CmdType="Text" CmdText="
-
- if(@ID_IndentBillOnNetProduct='00000000-0000-0000-0000-000000000000') Set @ID_IndentBillOnNetProduct=Null
- INSERT INTO SaleRtnBillProduct (ID_SaleRtnBillProduct, No_SaleRtnBillProduct, ID_SaleRtnBill, Type_FromBill, No_FromBill, No_FromBillProduct, ID_Product, Quantity_SaleRtnBillProduct, UnitPrice_SaleRtnBillProduct, Comment_SaleRtnBillProduct,ID_IndentBillOnNetProduct)
- values(@ID_SaleRtnBillProduct, @No_SaleRtnBillProduct, @ID_SaleRtnBill, @Type_FromBill, @No_FromBill, @No_FromBillProduct, @ID_Product, @Quantity_SaleRtnBillProduct, @UnitPrice_SaleRtnBillProduct, @Comment_SaleRtnBillProduct,@ID_IndentBillOnNetProduct)">
- <Params>
- <Param name="@ID_SaleRtnBillProduct" type="SaleRtnBillProduct.ID_SaleRtnBillProduct" sourceColumn="ID_SaleRtnBillProduct"/>
- <Param name="@No_SaleRtnBillProduct" type="SaleRtnBillProduct.No_SaleRtnBillProduct" sourceColumn="No_SaleRtnBillProduct"/>
- <Param name="@ID_SaleRtnBill" type="SaleRtnBillProduct.ID_SaleRtnBill" sourceColumn="ID_SaleRtnBill"/>
- <Param name="@Type_FromBill" type="SaleRtnBillProduct.Type_FromBill" sourceColumn="Type_FromBill"/>
- <Param name="@No_FromBill" type="SaleRtnBillProduct.No_FromBill" sourceColumn="No_FromBill"/>
- <Param name="@No_FromBillProduct" type="SaleRtnBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct"/>
- <Param name="@ID_Product" type="SaleRtnBillProduct.ID_Product" sourceColumn="ID_Product"/>
- <Param name="@Quantity_SaleRtnBillProduct" type="SaleRtnBillProduct.Quantity_SaleRtnBillProduct" sourceColumn="Quantity_SaleRtnBillProduct"/>
- <Param name="@UnitPrice_SaleRtnBillProduct" type="SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct" sourceColumn="UnitPrice_SaleRtnBillProduct"/>
- <Param name="@Comment_SaleRtnBillProduct" type="SaleRtnBillProduct.Comment_SaleRtnBillProduct" sourceColumn="Comment_SaleRtnBillProduct"/>
- <Param name="@ID_IndentBillOnNetProduct" type="SaleBillProduct.ID_IndentBillOnNetProduct" sourceColumn="ID_IndentBillOnNetProduct" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText="DECLARE @OutDepotAndSaleBack_SystemSetting BIT
- DECLARE @SaleBackAndInDepot_SystemSetting BIT
- DECLARE @Quantity_OutDepot DECIMAL(14,4)
- DECLARE @Quantity_SaleRtn DECIMAL(14,4)
- DECLARE @INDEPOT DECIMAL(14,4)
- DECLARE @ID_SaleOutDepotBill uniqueidentifier
- DECLARE @ERROR NVARCHAR(1000)
- SELECT @OutDepotAndSaleBack_SystemSetting=OutDepotAndSaleBack_SystemSetting,@SaleBackAndInDepot_SystemSetting=SaleBackAndInDepot_SystemSetting FROM SystemSetting
- IF @OutDepotAndSaleBack_SystemSetting=1 AND @IsPrevBill_SaleRtnBill=0 AND @AssessDate_SaleRtnBill IS NOT NULL
- BEGIN
- SELECT @Quantity_OutDepot=Quantity_OutDepot,@Quantity_SaleRtn=Quantity_SaleRtn
- From SaleSourceBillProduct
- WHERE SaleSourceBillProduct.ID_SaleSourceBillProduct = @ID_SaleSourceBillProduct
- IF (@Quantity_OutDepot < @Quantity_SaleRtnBillProduct+@Quantity_SaleRtn)
- BEGIN
- SET @ERROR = N'序号为'+@No_SaleRtnBillProduct+N'的产品的累计退货数量大于相应出库数量,审核失败!请于关联单据处查询!'
- RAISERROR(@ERROR,16,1)
- RETURN
- END
- IF(@Type_FromBill=2)
- BEGIN
- IF(@Quantity_SaleRtnBillProduct >(Select (Quantity_SaleOutDepotBillProduct-RtnQuantity_SaleOutDepotBillProduct)
- From SaleOutDepotBillProduct
- Join SaleOutDepotBill On SaleOutDepotBill.ID_SaleOutDepotBill=SaleOutDepotBillProduct.ID_SaleOutDepotBill
- Where No_SaleOutDepotBill=@No_FromBill And No_SaleOutDepotBillProduct=@No_FromBillProduct))
- BEGIN
- SET @ERROR = N'序号为'+@No_SaleRtnBillProduct+N'的产品的累计退货数量大于相应出库数量,审核失败!请于关联单据处查询!'
- RAISERROR(@ERROR,16,1)
- RETURN
- END
- END
- END
- IF @SaleBackAndInDepot_SystemSetting=1 AND @AssessDate_SaleRtnBill IS NOT NULL
- BEGIN
- IF @Quantity_SaleRtnBillProduct < @InQuantity_SaleRtnBillProduct
- BEGIN
- SET @ERROR = N'序号为'+@No_SaleRtnBillProduct+N'的产品的累计退货数量小于相应入库数量,提交失败!请于关联单据处查询!'
- RAISERROR(@ERROR,18,19)
- RETURN
- END
- END
- UPDATE SaleRtnBillProduct SET
- ID_SaleRtnBillProduct=@ID_SaleRtnBillProduct,
- No_SaleRtnBillProduct=@No_SaleRtnBillProduct,
- ID_SaleRtnBill=@ID_SaleRtnBill,
- Type_FromBill=@Type_FromBill,
- No_FromBill=@No_FromBill,
- No_FromBillProduct=@No_FromBillProduct,
- ID_Product=@ID_Product,
- Quantity_SaleRtnBillProduct=@Quantity_SaleRtnBillProduct,
- UnitPrice_SaleRtnBillProduct=@UnitPrice_SaleRtnBillProduct,
- Comment_SaleRtnBillProduct=@Comment_SaleRtnBillProduct,
- ID_IndentBillOnNetProduct=@ID_IndentBillOnNetProduct
- WHERE ID_SaleRtnBillProduct = @ID_SaleRtnBillProduct">
- <Params>
- <Param name="@ID_SaleRtnBillProduct" type="SaleRtnBillProduct.ID_SaleRtnBillProduct" sourceColumn="ID_SaleRtnBillProduct"/>
- <Param name="@No_SaleRtnBillProduct" type="SaleRtnBillProduct.No_SaleRtnBillProduct" sourceColumn="No_SaleRtnBillProduct"/>
- <Param name="@ID_SaleRtnBill" type="SaleRtnBillProduct.ID_SaleRtnBill" sourceColumn="ID_SaleRtnBill"/>
- <Param name="@Type_FromBill" type="SaleRtnBillProduct.Type_FromBill" sourceColumn="Type_FromBill"/>
- <Param name="@No_FromBill" type="SaleRtnBillProduct.No_FromBill" sourceColumn="No_FromBill"/>
- <Param name="@No_FromBillProduct" type="SaleRtnBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct"/>
- <Param name="@ID_Product" type="SaleRtnBillProduct.ID_Product" sourceColumn="ID_Product"/>
- <Param name="@ID_SaleSourceBillProduct" type="SaleRtnBillProduct.ID_SaleSourceBillProduct" sourceColumn="ID_SaleSourceBillProduct"/>
- <Param name="@Quantity_SaleRtnBillProduct" type="SaleRtnBillProduct.Quantity_SaleRtnBillProduct" sourceColumn="Quantity_SaleRtnBillProduct"/>
- <Param name="@UnitPrice_SaleRtnBillProduct" type="SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct" sourceColumn="UnitPrice_SaleRtnBillProduct"/>
- <Param name="@Comment_SaleRtnBillProduct" type="SaleRtnBillProduct.Comment_SaleRtnBillProduct" sourceColumn="Comment_SaleRtnBillProduct"/>
- <Param name="@IsPrevBill_SaleRtnBill" type="SaleRtnBillProduct.IsPrevBill_SaleRtnBill" sourceColumn="IsPrevBill_SaleRtnBill"/>
- <Param name="@AssessDate_SaleRtnBill" type="SaleRtnBillProduct.AssessDate_SaleRtnBill" sourceColumn="AssessDate_SaleRtnBill"/>
- <Param name="@InQuantity_SaleRtnBillProduct" type="SaleRtnBillProduct.InQuantity_SaleRtnBillProduct" sourceColumn="InQuantity_SaleRtnBillProduct"/>
- <Param name="@ID_IndentBillOnNetProduct" type="SaleBillProduct.ID_IndentBillOnNetProduct" sourceColumn="ID_IndentBillOnNetProduct" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText="DELETE SaleRtnBillProduct WHERE SaleRtnBillProduct.ID_SaleRtnBillProduct = @ID_SaleRtnBillProduct">
- <Params>
- <Param name="@ID_SaleRtnBillProduct" type="SaleRtnBillProduct.ID_SaleRtnBillProduct" sourceColumn="ID_SaleRtnBillProduct"/>
- </Params>
- </Delete>
- </Table>
- </Tables>
- <Search>
- <SearchAllBill CmdType="Text" CmdText=" SELECT SaleRtnBill.*,
- Customer.No_Customer,
- Customer.ShortName_Customer,
- Customer.ID_Creator,
- Location.Name_Location,
- Location.No_Location,
- AppUser.LoginName_User as Name_Creator,
- A1.LoginName_User as Name_Assessor,
- A2.LoginName_User as LastModUserName_SaleRtnBill,
- convert(decimal(18,6),0) AS CountColume_SaleRtnBillProduct,
- convert(decimal(18,6),0) AS TaxCurrencyCash_SaleRtnBillProduct,
- convert(decimal(18,6),0) AS CurrencyCash_SaleRtnBillProduct,
- Employee.No_Employee AS No_Principal,
- Employee.Name_Employee AS Principal_SaleRtnBill
- FROM SaleRtnBill
- JOIN Customer ON Customer.ID_Customer = SaleRtnBill.ID_Customer
- JOIN AppUser ON AppUser.ID_User = SaleRtnBill.ID_Creator
- LEFT JOIN AppUser A1 ON A1.ID_User = SaleRtnBill.ID_Assessor
- LEFT JOIN AppUser A2 ON A2.ID_User = SaleRtnBill.LastModUser_SaleRtnBill
- JOIN Location ON Location.ID_Location = SaleRtnBill.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal ">
- <Tables>
- <Table name="AllBill" />
- </Tables>
- </SearchAllBill>
- <SearchAllCustomer CmdType="Text" CmdText="SELECT Customer.*,Linkman.Name_Linkman,Linkman.Tel_Linkman,No_Telephone,No_Fax
- FROM
- (
- SELECT Customer.ID_Customer,Customer.No_Customer,Customer.ShortName_Customer,Customer.Zone_Customer,Customer.SendAddr_Customer,RegistedAddress_Customer,SuspendDate_Customer,Customer.Type_Customer,Customer.Level_Customer,Customer.IsGeneric_Customer,
- ID_Linkman=(Select Top 1 ID_Linkman From Linkman Where ID_Person=Customer.ID_Customer And IsMain_Linkman=1 order by name_linkman)
- From Customer
- )Customer
- Left Join Linkman On Customer.ID_Linkman=Linkman.ID_Linkman
- LEFT JOIN Telephone ON Telephone.ID_Person = Customer.ID_Customer and Focus_Telephone = 1
- left join Fax ON Fax.ID_Person = Customer.ID_Customer and Focus_Fax = 1">
- <Tables>
- <Table name="AllCustomer" />
- </Tables>
- </SearchAllCustomer>
- <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>
- <SearchAllSaleOutDepotBill CmdType="Text" CmdText="Select SaleOutDepotBill.ID_SaleOutDepotBill,SaleOutDepotBill.No_SaleOutDepotBill ,SaleOutDepotBill.Date_SaleOutDepotBill,Customer.No_Customer,Customer.ShortName_Customer,Case When SaleOutDepotBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_SaleOutDepotBill,Location.Name_Location From SaleOutDepotBill
- Inner Join Customer On SaleOutDepotBill.ID_Customer = Customer.ID_Customer
- Inner Join Location On Location.ID_Location = SaleOutDepotBill.ID_Location " >
- <Tables>
- <Table name="AllSaleOutDepotBill" />
- </Tables>
- </SearchAllSaleOutDepotBill>
- <SearchAllSaleOutDepotBillProduct CmdType="Text" CmdText="Select Product.No_Product,SaleOutDepotBillProduct.No_SaleOutDepotBillProduct,Product.Name_Product,SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct,SaleOutDepotBillProduct.UnitCost_SaleOutDepotBillProduct From SaleOutDepotBillProduct
- Inner Join Product On Product.ID_Product = SaleOutDepotBillProduct.ID_Product
- Inner Join SaleOutDepotBill On SaleOutDepotBill.ID_SaleOutDepotBill = SaleOutDepotBillProduct.ID_SaleOutDepotBill" >
- <Tables>
- <Table name="AllSaleOutDepotBillProduct" />
- </Tables>
- </SearchAllSaleOutDepotBillProduct>
- <SearchBillWithNo CmdType="Text" CmdText=" DECLARE @ID_SaleRtnBill uniqueidentifier
- DECLARE @ID_SaleOutDepotBill uniqueidentifier
- SELECT @ID_SaleRtnBill = SaleRtnBill.ID_SaleRtnBill FROM SaleRtnBill WHERE SaleRtnBill.No_SaleRtnBill=@No_SaleRtnBill
- SELECT @ID_SaleOutDepotBill = ID_SaleOutDepotBill FROM SaleOutDepotBill JOIN SaleRtnBillProduct ON SaleOutDepotBill.No_SaleOutDepotBill = SaleRtnBillProduct.No_FromBill
- SELECT SaleRtnBill.*, Customer.No_Customer, Customer.ShortName_Customer, Location.Name_Location,Location.No_Location,Customer.ID_Creator As CustomerCreator,
- SaleRtnBill.IsPrevBill_SaleRtnBill,
- SaleRtnBill.AssessDate_SaleRtnBill,
- AppUser.LoginName_User as Name_Creator, Employee.No_Employee AS No_Principal,
- Employee.Name_Employee AS Principal_SaleRtnBill,
- A1.LoginName_User as Name_Assessor,
- A2.LoginName_User as LastModUserName_SaleRtnBill
- FROM SaleRtnBill
- JOIN Customer ON Customer.ID_Customer = SaleRtnBill.ID_Customer
- JOIN Location ON Location.ID_Location = SaleRtnBill.ID_Location
- JOIN AppUser ON AppUser.ID_User = SaleRtnBill.ID_Creator
- LEFT JOIN AppUser A1 ON A1.ID_User = SaleRtnBill.ID_Assessor
- LEFT JOIN AppUser A2 ON A2.ID_User = SaleRtnBill.LastModUser_SaleRtnBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
- WHERE SaleRtnBill.No_SaleRtnBill=@No_SaleRtnBill
- ORDER BY No_SaleRtnBill
- SELECT SaleRtnBillProduct.*,
- BillType.Name_BillType AS FromBill_SaleRtnBillProduct,
- SaleRtnBill.IsPrevBill_SaleRtnBill,
- SaleRtnBill.AssessDate_SaleRtnBill,
- Product.No_Product AS ProductNo_SaleRtnBillProduct,
- Product.Name_Product AS ProductName_SaleRtnBillProduct,
- Product.Unit_Product AS ProductUnit_SaleRtnBillProduct,
- SaleOutDepotBillProduct.UnitCost_SaleOutDepotBillProduct AS UnitCost_SaleRtnBillProduct,
- SaleRtnBillProduct.Quantity_SaleRtnBillProduct * SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct AS Cash_SaleRtnBillProduct,@No_SaleRtnBill as No_SaleRtnBill
- FROM SaleRtnBillProduct
- JOIN SaleRtnBill ON SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
- JOIN Product ON Product.ID_Product=SaleRtnBillProduct.ID_Product
- JOIN BillType ON BillType.Value_BillType=SaleRtnBillProduct.Type_FromBill
- LEFT JOIN SaleOutDepotBillProduct ON SaleOutDepotBillProduct.No_SaleOutDepotBillProduct=SaleRtnBillProduct.No_FromBillProduct
- AND SaleOutDepotBillProduct.ID_SaleOutDepotBill=@ID_SaleOutDepotBill
- WHERE SaleRtnBillProduct.ID_SaleRtnBill=@ID_SaleRtnBill
- ORDER BY CAST(No_SaleRtnBillProduct AS INT)">
- <Params>
- <Param name="@No_SaleRtnBill" type="SaleRtnBill.No_SaleRtnBill" Index="0"/>
- </Params>
- <Tables>
- <Table name="SaleRtnBill"/>
- <Table name="SaleRtnBillProduct"/>
- </Tables>
- </SearchBillWithNo>
- <SearchCustomerWithNo CmdType="Text" CmdText="
- declare @LastTax_Customer1 nvarchar(64)
- declare @LastTax_Customer2 nvarchar(64)
- declare @LastTax_Customer3 nvarchar(64)
- declare @STaxDefault1_FunctionSetting int
- declare @STaxDefault2_FunctionSetting int
- declare @STaxDefault3_FunctionSetting int
-
- select @STaxDefault1_FunctionSetting = STaxDefault1_FunctionSetting,
- @STaxDefault2_FunctionSetting = STaxDefault2_FunctionSetting, @STaxDefault3_FunctionSetting = STaxDefault3_FunctionSetting
- from FunctionSetting
- if @STaxDefault1_FunctionSetting=0
- begin
- select @LastTax_Customer1 = Customer.LastTax_Customer
- from Customer
- WHERE Customer.No_Customer = @No_Customer
- end
- else if @STaxDefault1_FunctionSetting = 1
- begin
- select top 1 @LastTax_Customer1 = TaxCurrency_SaleRtnBill
- from SaleRtnBill
- order by Date_SaleRtnBill desc
- end
- else
- begin
- set @LastTax_Customer1 = '外加'
- end
- if @STaxDefault2_FunctionSetting=0
- begin
- select @LastTax_Customer2 = Customer.LastTax_Customer
- from Customer
- WHERE Customer.No_Customer = @No_Customer
- end
- else if @STaxDefault2_FunctionSetting = 1
- begin
- select top 1 @LastTax_Customer2 = TaxCurrency_SaleRtnBill
- from SaleRtnBill
- order by Date_SaleRtnBill desc
-
- end
- else
- begin
- set @LastTax_Customer2 = '外加'
- end
- if @STaxDefault3_FunctionSetting=0
- begin
- select @LastTax_Customer3 = Customer.LastTax_Customer
- from Customer
- WHERE Customer.No_Customer = @No_Customer
- end
- else if @STaxDefault3_FunctionSetting = 1
- begin
- select top 1 @LastTax_Customer3 = TaxCurrency_SaleRtnBill
- from SaleRtnBill
- order by Date_SaleRtnBill desc
-
- end
- else
- begin
- set @LastTax_Customer3 = '外加'
- end
- if @LastTax_Customer1 is null
- set @LastTax_Customer1 = isnull(@LastTax_Customer2, @LastTax_Customer3)
- DECLARE @NextNo nvarchar(64) DECLARE @ID_Customer uniqueidentifier
- SET @NextNo = @No_Customer
- SELECT @ID_Customer = Customer.ID_Customer FROM Customer WHERE Customer.No_Customer = @NextNo
- SELECT ID_Customer, ShortName_Customer, SuspendDate_Customer,ISNULL(@LastTax_Customer1, '外加') AS LastTax_Customer
- ,Employee.Name_Employee,Employee.No_Employee,LastPrincipal_Customer
- FROM Customer
- left join Employee on Customer.LastPrincipal_Customer = Employee.ID_Employee
- WHERE Customer.ID_Customer = @ID_Customer
- ORDER BY No_Customer">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0"/>
- </Params>
- <Tables>
- <Table name="Customer"/>
- </Tables>
- </SearchCustomerWithNo>
- <SearchPrincipal CmdType="Text" CmdText=" SELECT Employee.No_Employee,Employee.ID_Employee, Employee.Name_Employee FROM Employee Order By No_Employee
- ">
- <Tables>
- <Table name="Employee"/>
- </Tables>
- </SearchPrincipal>
- <SearchReason CmdType="Text" CmdText="SELECT TypeDef.Name_TypeDef AS Result FROM TypeDef WHERE Type_TypeDef = 21">
- <Tables>
- <Table name="Reason"/>
- </Tables>
- </SearchReason>
- <SearchComment CmdType="Text" CmdText="SELECT TypeDef.Name_TypeDef AS Result FROM TypeDef WHERE Type_TypeDef = 28">
- <Tables>
- <Table name="Comment"/>
- </Tables>
- </SearchComment>
- <SearchContr CmdType="Text" CmdText=" SELECT SystemSetting.SaleBackAndInDepot_SystemSetting FROM SystemSetting WHERE SystemSetting.SaleBackAndInDepot_SystemSetting = 1">
- <Tables>
- <Table name="SystemSaleAndOutDepot" />
- </Tables>
- </SearchContr>
- <SearchContrOutIn CmdType="Text" CmdText=" SELECT SystemSetting.OutDepotAndSaleBack_SystemSetting FROM SystemSetting WHERE SystemSetting.OutDepotAndSaleBack_SystemSetting = 1">
- <Tables>
- <Table name="SystemOutIn" />
- </Tables>
- </SearchContrOutIn>
- <SearchContrSOB CmdType="Text" CmdText=" SELECT SystemSetting.SaleAndOutDepot_SystemSetting,SystemSetting.OutDepotAndSaleBack_SystemSetting FROM SystemSetting WHERE SystemSetting.OutDepotAndSaleBack_SystemSetting = 1 and SystemSetting.SaleAndOutDepot_SystemSetting=1">
- <Tables>
- <Table name="SystemOutIn" />
- </Tables>
- </SearchContrSOB>
- <SearchSaleRtnBillFirst CmdType="Text" CmdText="DECLARE @NextNo nvarchar(64)
- DECLARE @ID_SaleRtnBill uniqueidentifier
- DECLARE @ID_SaleOutDepotBill uniqueidentifier
- SELECT TOP 1 @NextNo = SaleRtnBill.No_SaleRtnBill FROM SaleRtnBill
- Join Customer On Customer.ID_Customer=SaleRtnBill.ID_Customer
- WHERE Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End --added for validating right
- ORDER BY SaleRtnBill.No_SaleRtnBill
-
- SELECT @ID_SaleRtnBill = SaleRtnBill.ID_SaleRtnBill FROM SaleRtnBill WHERE SaleRtnBill.No_SaleRtnBill = @NextNo
- SELECT @ID_SaleOutDepotBill = ID_SaleOutDepotBill FROM SaleOutDepotBill JOIN SaleRtnBillProduct ON SaleOutDepotBill.No_SaleOutDepotBill = SaleRtnBillProduct.No_FromBill
- SELECT SaleRtnBill.*, Customer.No_Customer, Customer.ShortName_Customer, Location.Name_Location, Location.No_Location, AppUser.LoginName_User as Name_Creator, A1.LoginName_User as Name_Assessor, A2.LoginName_User as LastModUserName_SaleRtnBill
- ,Employee.No_Employee AS No_Principal,
- Employee.Name_Employee AS Principal_SaleRtnBill
- FROM SaleRtnBill
- JOIN Customer ON Customer.ID_Customer = SaleRtnBill.ID_Customer
- JOIN Location ON Location.ID_Location = SaleRtnBill.ID_Location
- JOIN AppUser ON AppUser.ID_User = SaleRtnBill.ID_Creator
- LEFT JOIN AppUser A1 ON A1.ID_User = SaleRtnBill.ID_Assessor
- LEFT JOIN AppUser A2 ON A2.ID_User = SaleRtnBill.LastModUser_SaleRtnBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
- WHERE SaleRtnBill.ID_SaleRtnBill=@ID_SaleRtnBill
- SELECT SaleRtnBillProduct.*,
- BillType.Name_BillType AS FromBill_SaleRtnBillProduct,
- SaleRtnBill.IsPrevBill_SaleRtnBill,
- SaleRtnBill.AssessDate_SaleRtnBill,
- Product.No_Product AS ProductNo_SaleRtnBillProduct,
- Product.Name_Product AS ProductName_SaleRtnBillProduct,
- Product.Unit_Product AS ProductUnit_SaleRtnBillProduct,
- SaleOutDepotBillProduct.UnitCost_SaleOutDepotBillProduct AS UnitCost_SaleRtnBillProduct,
- SaleRtnBillProduct.Quantity_SaleRtnBillProduct * SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct AS Cash_SaleRtnBillProduct,@NextNo as No_SaleRtnBill
- FROM SaleRtnBillProduct
- JOIN Product ON Product.ID_Product=SaleRtnBillProduct.ID_Product
- JOIN SaleRtnBill ON SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
- JOIN BillType ON BillType.Value_BillType=SaleRtnBillProduct.Type_FromBill
- LEFT JOIN SaleOutDepotBillProduct ON SaleOutDepotBillProduct.No_SaleOutDepotBillProduct=SaleRtnBillProduct.No_FromBillProduct
- AND SaleOutDepotBillProduct.ID_SaleOutDepotBill=@ID_SaleOutDepotBill
- WHERE SaleRtnBillProduct.ID_SaleRtnBill=@ID_SaleRtnBill
- ORDER BY CAST(No_SaleRtnBillProduct AS INT)">
- <Params>
- <Param name="@Right" type="SaleBill.ID_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="SaleRtnBill"/>
- <Table name="SaleRtnBillProduct"/>
- </Tables>
- </SearchSaleRtnBillFirst>
- <SearchSaleRtnBillLast CmdType="Text" CmdText=" DECLARE @NextNo nvarchar(64)
- DECLARE @ID_SaleRtnBill uniqueidentifier
- DECLARE @ID_SaleOutDepotBill uniqueidentifier
- SELECT TOP 1 @NextNo = SaleRtnBill.No_SaleRtnBill FROM SaleRtnBill
- Join Customer On Customer.ID_Customer=SaleRtnBill.ID_Customer
- WHERE Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End --added for validating right
- ORDER BY SaleRtnBill.No_SaleRtnBill DESC
-
- SELECT @ID_SaleRtnBill = SaleRtnBill.ID_SaleRtnBill FROM SaleRtnBill WHERE SaleRtnBill.No_SaleRtnBill = @NextNo
- SELECT @ID_SaleOutDepotBill = ID_SaleOutDepotBill FROM SaleOutDepotBill JOIN SaleRtnBillProduct ON SaleOutDepotBill.No_SaleOutDepotBill = SaleRtnBillProduct.No_FromBill
- SELECT SaleRtnBill.*, Customer.No_Customer, Customer.ShortName_Customer, Location.Name_Location, Location.No_Location, AppUser.LoginName_User as Name_Creator, A1.LoginName_User as Name_Assessor, A2.LoginName_User as LastModUserName_SaleRtnBill
- ,Employee.No_Employee AS No_Principal,
- Employee.Name_Employee AS Principal_SaleRtnBill
- FROM SaleRtnBill
- JOIN Customer ON Customer.ID_Customer = SaleRtnBill.ID_Customer
- JOIN Location ON Location.ID_Location = SaleRtnBill.ID_Location
- JOIN AppUser ON AppUser.ID_User = SaleRtnBill.ID_Creator
- LEFT JOIN AppUser A1 ON A1.ID_User = SaleRtnBill.ID_Assessor
- LEFT JOIN AppUser A2 ON A2.ID_User = SaleRtnBill.LastModUser_SaleRtnBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
- WHERE SaleRtnBill.ID_SaleRtnBill=@ID_SaleRtnBill
- SELECT SaleRtnBillProduct.*,
- BillType.Name_BillType AS FromBill_SaleRtnBillProduct,
- SaleRtnBill.IsPrevBill_SaleRtnBill,
- SaleRtnBill.AssessDate_SaleRtnBill,
- Product.No_Product AS ProductNo_SaleRtnBillProduct,
- Product.Name_Product AS ProductName_SaleRtnBillProduct,
- Product.Unit_Product AS ProductUnit_SaleRtnBillProduct,
- SaleOutDepotBillProduct.UnitCost_SaleOutDepotBillProduct AS UnitCost_SaleRtnBillProduct,
- SaleRtnBillProduct.Quantity_SaleRtnBillProduct * SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct AS Cash_SaleRtnBillProduct,@NextNo as No_SaleRtnBill
- FROM SaleRtnBillProduct
- JOIN SaleRtnBill ON SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
- JOIN Product ON Product.ID_Product=SaleRtnBillProduct.ID_Product
- JOIN BillType ON BillType.Value_BillType=SaleRtnBillProduct.Type_FromBill
- LEFT JOIN SaleOutDepotBillProduct ON SaleOutDepotBillProduct.No_SaleOutDepotBillProduct=SaleRtnBillProduct.No_FromBillProduct
- AND SaleOutDepotBillProduct.ID_SaleOutDepotBill=@ID_SaleOutDepotBill
- WHERE SaleRtnBillProduct.ID_SaleRtnBill=@ID_SaleRtnBill
- ORDER BY CAST(No_SaleRtnBillProduct AS INT)">
- <Params>
- <Param name="@Right" type="SaleBill.ID_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="SaleRtnBill"/>
- <Table name="SaleRtnBillProduct"/>
- </Tables>
- </SearchSaleRtnBillLast>
- <SearchSaleRtnBillPrevious CmdType="Text" CmdText=" DECLARE @NextNo nvarchar(64)
- DECLARE @ID_SaleRtnBill uniqueidentifier
- DECLARE @ID_SaleOutDepotBill uniqueidentifier
- SELECT TOP 1 @NextNo = SaleRtnBill.No_SaleRtnBill FROM SaleRtnBill
- Join Customer On Customer.ID_Customer=SaleRtnBill.ID_Customer
- WHERE SaleRtnBill.No_SaleRtnBill < @No_SaleRtnBill
- And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End --added for validating right
- ORDER BY SaleRtnBill.No_SaleRtnBill DESC
- SELECT @ID_SaleRtnBill = SaleRtnBill.ID_SaleRtnBill FROM SaleRtnBill WHERE SaleRtnBill.No_SaleRtnBill = @NextNo
- SELECT @ID_SaleOutDepotBill = ID_SaleOutDepotBill FROM SaleOutDepotBill JOIN SaleRtnBillProduct ON SaleOutDepotBill.No_SaleOutDepotBill = SaleRtnBillProduct.No_FromBill
- SELECT SaleRtnBill.*, Customer.No_Customer,Customer.ShortName_Customer, Location.Name_Location, Location.No_Location, AppUser.LoginName_User as Name_Creator, A1.LoginName_User as Name_Assessor, A2.LoginName_User as LastModUserName_SaleRtnBill
- ,Employee.No_Employee AS No_Principal,
- Employee.Name_Employee AS Principal_SaleRtnBill
- FROM SaleRtnBill
- JOIN Customer ON Customer.ID_Customer = SaleRtnBill.ID_Customer
- JOIN Location ON Location.ID_Location = SaleRtnBill.ID_Location
- JOIN AppUser ON AppUser.ID_User = SaleRtnBill.ID_Creator
- LEFT JOIN AppUser A1 ON A1.ID_User = SaleRtnBill.ID_Assessor
- LEFT JOIN AppUser A2 ON A2.ID_User = SaleRtnBill.LastModUser_SaleRtnBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
- WHERE SaleRtnBill.ID_SaleRtnBill=@ID_SaleRtnBill
- SELECT SaleRtnBillProduct.*,
- BillType.Name_BillType AS FromBill_SaleRtnBillProduct,
- SaleRtnBill.IsPrevBill_SaleRtnBill,
- SaleRtnBill.AssessDate_SaleRtnBill,
- Product.No_Product AS ProductNo_SaleRtnBillProduct,
- Product.Name_Product AS ProductName_SaleRtnBillProduct,
- Product.Unit_Product AS ProductUnit_SaleRtnBillProduct,
- SaleOutDepotBillProduct.UnitCost_SaleOutDepotBillProduct AS UnitCost_SaleRtnBillProduct,
- SaleRtnBillProduct.Quantity_SaleRtnBillProduct * SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct AS Cash_SaleRtnBillProduct,@NextNo as No_SaleRtnBill
- FROM SaleRtnBillProduct
- JOIN SaleRtnBill ON SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
- JOIN Product ON Product.ID_Product=SaleRtnBillProduct.ID_Product
- JOIN BillType ON BillType.Value_BillType=SaleRtnBillProduct.Type_FromBill
- LEFT JOIN SaleOutDepotBillProduct ON SaleOutDepotBillProduct.No_SaleOutDepotBillProduct=SaleRtnBillProduct.No_FromBillProduct
- AND SaleOutDepotBillProduct.ID_SaleOutDepotBill=@ID_SaleOutDepotBill
- WHERE SaleRtnBillProduct.ID_SaleRtnBill=@ID_SaleRtnBill
- ORDER BY CAST(No_SaleRtnBillProduct AS INT)">
- <Params>
- <Param name="@No_SaleRtnBill" type="SaleRtnBill.No_SaleRtnBill" Index="0"/>
- <Param name="@Right" type="SaleBill.ID_Customer" Index="1" />
- </Params>
- <Tables>
- <Table name="SaleRtnBill"/>
- <Table name="SaleRtnBillProduct"/>
- </Tables>
- </SearchSaleRtnBillPrevious>
- <SearchSaleRtnBillNext CmdType="Text" CmdText=" DECLARE @NextNo nvarchar(64)
- DECLARE @ID_SaleRtnBill uniqueidentifier
- DECLARE @ID_SaleOutDepotBill uniqueidentifier
- SELECT TOP 1 @NextNo = SaleRtnBill.No_SaleRtnBill FROM SaleRtnBill
- Join Customer On Customer.ID_Customer=SaleRtnBill.ID_Customer
- WHERE SaleRtnBill.No_SaleRtnBill > @No_SaleRtnBill
- And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End --added for validating right
- ORDER BY SaleRtnBill.No_SaleRtnBill
- SELECT @ID_SaleRtnBill = SaleRtnBill.ID_SaleRtnBill FROM SaleRtnBill WHERE SaleRtnBill.No_SaleRtnBill = @NextNo
- SELECT @ID_SaleOutDepotBill = ID_SaleOutDepotBill FROM SaleOutDepotBill JOIN SaleRtnBillProduct ON SaleOutDepotBill.No_SaleOutDepotBill = SaleRtnBillProduct.No_FromBill
- SELECT SaleRtnBill.*, Customer.No_Customer, Customer.ShortName_Customer, Location.Name_Location, Location.No_Location, AppUser.LoginName_User as Name_Creator, A1.LoginName_User as Name_Assessor, A2.LoginName_User as LastModUserName_SaleRtnBill
- ,Employee.No_Employee AS No_Principal,
- Employee.Name_Employee AS Principal_SaleRtnBill
- FROM SaleRtnBill
- JOIN Customer ON Customer.ID_Customer = SaleRtnBill.ID_Customer
- JOIN Location ON Location.ID_Location = SaleRtnBill.ID_Location
- JOIN AppUser ON AppUser.ID_User = SaleRtnBill.ID_Creator
- LEFT JOIN AppUser A1 ON A1.ID_User = SaleRtnBill.ID_Assessor
- LEFT JOIN AppUser A2 ON A2.ID_User = SaleRtnBill.LastModUser_SaleRtnBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
- WHERE SaleRtnBill.ID_SaleRtnBill=@ID_SaleRtnBill
- SELECT SaleRtnBillProduct.*,
- BillType.Name_BillType AS FromBill_SaleRtnBillProduct,
- SaleRtnBill.IsPrevBill_SaleRtnBill,
- SaleRtnBill.AssessDate_SaleRtnBill,
- Product.No_Product AS ProductNo_SaleRtnBillProduct,
- Product.Name_Product AS ProductName_SaleRtnBillProduct,
- Product.Unit_Product AS ProductUnit_SaleRtnBillProduct,
- SaleOutDepotBillProduct.UnitCost_SaleOutDepotBillProduct AS UnitCost_SaleRtnBillProduct,
- SaleRtnBillProduct.Quantity_SaleRtnBillProduct * SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct AS Cash_SaleRtnBillProduct,@NextNo as No_SaleRtnBill
- FROM SaleRtnBillProduct
- JOIN SaleRtnBill ON SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
- JOIN Product ON Product.ID_Product=SaleRtnBillProduct.ID_Product
- JOIN BillType ON BillType.Value_BillType=SaleRtnBillProduct.Type_FromBill
- LEFT JOIN SaleOutDepotBillProduct ON SaleOutDepotBillProduct.No_SaleOutDepotBillProduct=SaleRtnBillProduct.No_FromBillProduct
- AND SaleOutDepotBillProduct.ID_SaleOutDepotBill=@ID_SaleOutDepotBill
- WHERE SaleRtnBillProduct.ID_SaleRtnBill=@ID_SaleRtnBill
- ORDER BY CAST(No_SaleRtnBillProduct AS INT)">
- <Params>
- <Param name="@No_SaleRtnBill" type="SaleRtnBill.No_SaleRtnBill" Index="0"/>
- <Param name="@Right" type="SaleBill.ID_Customer" Index="1" />
- </Params>
- <Tables>
- <Table name="SaleRtnBill"/>
- <Table name="SaleRtnBillProduct"/>
- </Tables>
- </SearchSaleRtnBillNext>
- <SearchLocation CmdType="Text" CmdText="SELECT Location.ID_Location, Location.Name_Location, Location.No_Location FROM Location WHERE Location.Level_Location = 0 ORDER BY No_Location">
- <Tables>
- <Table name="Location"/>
- </Tables>
- </SearchLocation>
- <SearchFromBillProductNo CmdType="Text" CmdText=" IF(@Type_FromBill=2)
- BEGIN
- DECLARE @ID_SaleOutDepotBill uniqueidentifier
- SELECT @ID_SaleOutDepotBill = SaleOutDepotBill.ID_SaleOutDepotBill FROM SaleOutDepotBill WHERE No_SaleOutDepotBill = @No_FromBill
- SELECT ID_SaleOutDepotBillProduct AS ID_FromBill,
- ID_Assessor,ID_IndentBillOnNetProduct,
- No_SaleOutDepotBillProduct AS No_FromBillProduct,
- SaleOutDepotBillProduct.ID_SaleSourceBillProduct AS ID_SaleSourceBillProduct,
- Product.ID_Product,
- Product.No_Product,
- Product.Name_Product,
- Product.Unit_Product,
- Product.SuspendDate_Product,
- UnitCost_SaleOutDepotBillProduct AS UnitPrice_FromBillProduct,
- Convert(decimal(5,2),100) As Discount_FromBillProduct,
- CASE IsNull(DataLength(SaleOutDepotBill.ID_Assessor),0) When 0 Then 0 Else (Quantity_SaleOutDepotBillProduct-RtnQuantity_SaleOutDepotBillProduct) End As Quantity_SaleRtnBillProduct,
- SaleOutDepotBill.ID_Customer AS ID_Customer
- FROM
- SaleOutDepotBillProduct
- JOIN Product ON Product.ID_Product=SaleOutDepotBillProduct.ID_Product
- JOIN SaleOutDepotBill ON SaleOutDepotBill.ID_SaleOutDepotBill=SaleOutDepotBillProduct.ID_SaleOutDepotBill
- LEFT JOIN SaleSourceBillProduct ON SaleOutDepotBillProduct.ID_SaleSourceBillProduct=SaleSourceBillProduct.ID_SaleSourceBillProduct
- WHERE No_SaleOutDepotBillProduct = @No_FromBillProduct AND SaleOutDepotBillProduct.ID_SaleOutDepotBill =@ID_SaleOutDepotBill
- END
- Else IF(@Type_FromBill=21)
- BEGIN
- SELECT SaleBill.TaxCurrency_SaleBill as TaxCurrency,
- A.ID_SaleBill AS ID_FromBill,
- ID_Assessor,
- A.No_SaleBillProduct AS No_FromBillProduct,ID_IndentBillOnNetProduct,
- A.ID_SaleSourceBillProduct AS ID_SaleSourceBillProduct,
- A.UnitPrice_SaleBillProduct AS UnitPrice_FromBillProduct,
- A.Discount_SaleBillProduct As Discount_FromBillProduct,
- Product.ID_Product,
- Product.No_Product,
- Product.Name_Product,
- Product.SuspendDate_Product,
- Product.Unit_Product,
- (ISNULL(Quantity_OutDepot,0)-ISNULL(Quantity_SaleRtn,0)) As Quantity_SaleRtnBillProduct ,
- SaleBill.ID_Customer AS ID_Customer,TaxCurrency_SaleBill
- FROM SaleBill
- JOIN SaleBillProduct A ON SaleBill.ID_SaleBill = A.ID_SaleBill
- JOIN Product ON Product.ID_Product = A.ID_Product
- LEFT JOIN SaleSourceBillProduct ON A.ID_SaleSourceBillProduct=SaleSourceBillProduct.ID_SaleSourceBillProduct
- WHERE SaleBill.No_SaleBill=@No_FromBill AND A.No_SaleBillProduct=@No_FromBillProduct
- END
- ELSE
- BEGIN
- SELECT Top 0
- CONVERT(uniqueidentifier,null) As ID_FromBill,
- CONVERT(uniqueidentifier,null) As ID_Assessor,
- CONVERT(nvarchar(64),'') As No_FromBillProduct,
- CONVERT(uniqueidentifier,null) As ID_SaleSourceBillProduct,
- CONVERT(decimal(18,6),0) As UnitPrice_FromBillProduct,
- CONVERT(uniqueidentifier,null) As ID_Product,
- CONVERT(nvarchar(64),'') As No_Product,
- CONVERT(nvarchar(64),'') As Name_Product,
- CONVERT(datetime,getdate()) As SuspendDate_Product,
- CONVERT(nvarchar(64),'') as Unit_Product,
- CONVERT(decimal(14,4),0) As Quantity_SaleRtnBillProduct,
- CONVERT(uniqueidentifier,null) As ID_Customer
- END">
- <Params>
- <Param name="@Type_FromBill" type="SaleRtnBillProduct.Type_FromBill" Index="0" />
- <Param name="@No_FromBill" type="SaleRtnBillProduct.No_FromBill" Index="1" />
- <Param name="@No_FromBillProduct" type="SaleRtnBillProduct.No_FromBillProduct" Index="2" />
- </Params>
- <Tables>
- <Table name="SaleOutDepotBillProduct"/>
- </Tables>
- </SearchFromBillProductNo>
- <SearchProductWithNo CmdType="Text" CmdText="SELECT Product.Cost_Product, Product.ID_Product, Product.Name_Product, Product.Unit_Product, SuspendDate_Product FROM Product
- WHERE No_Product=@No_Product ORDER BY No_Product">
- <Params>
- <Param name="@No_Product" type="Product.No_Product" Index="0" />
- </Params>
- <Tables>
- <Table name="Product"/>
- </Tables>
- </SearchProductWithNo>
- <SearchSystemSetting CmdType="Text" CmdText="SELECT CessOut_SystemSetting, OutDepotAndSaleBack_SystemSetting, SaleBackAndInDepot_SystemSetting,SysCurrency_SystemSetting,
- UnitPriceDecimal_SystemSetting, PriceDecimal_SystemSetting, QuantityDecimal_SystemSetting,CostDecimal_SystemSetting,SaleRtnSourceBill_SystemSetting FROM SystemSetting">
- <Tables>
- <Table name="SystemSetting"/>
- </Tables>
- </SearchSystemSetting>
- <SearchBillType CmdType="Text" CmdText=" DECLARE @OutDepotAndSaleBack_SystemSetting bit
- DECLARE @SaleBackAndInDepot_SystemSetting bit
- DECLARE @SaleRtnSourceBill_SystemSetting bit
- SELECT @OutDepotAndSaleBack_SystemSetting=OutDepotAndSaleBack_SystemSetting,@SaleBackAndInDepot_SystemSetting=SaleBackAndInDepot_SystemSetting,
- @SaleRtnSourceBill_SystemSetting=SaleRtnSourceBill_SystemSetting FROM SystemSetting
- IF(@OutDepotAndSaleBack_SystemSetting = 1 AND @SaleBackAndInDepot_SystemSetting = 1 AND @SaleRtnSourceBill_SystemSetting = 1)
- SELECT * FROM BillType WHERE Value_BillType=0 OR Value_BillType=21 ORDER BY Value_BillType
- ELSE
- SELECT * FROM BillType WHERE Value_BillType = 2 OR Value_BillType=0 ORDER BY Value_BillType">
- <Tables>
- <Table name="BillType" />
- </Tables>
- </SearchBillType>
- <SearchAllSaleBill CmdType="Text" CmdText="Select SaleBill.ID_Principal,SaleBill.Currency_SaleBill ,SaleBill.TaxCurrency_SaleBill,SaleBill.ID_SaleBill,SaleBill.No_SaleBill,SaleBill.Date_SaleBill,Customer.No_Customer,Customer.ShortName_Customer,Case isnull(DataLength(SaleBill.ID_Assessor),0) WHEN 0 THEN CASE Disable_SaleBill WHEN 1 THEN '作废' ELSE '未审核' END ELSE '已审核' END As State_SaleBill,Location.Name_Location,
- Employee.Name_Employee AS Principal_SaleBill,Employee.No_Employee AS No_Principal From SaleBill
- Inner Join Customer On SaleBill.ID_Customer = Customer.ID_Customer
- Inner Join Location On Location.ID_Location = SaleBill.ID_Location
- Inner Join Employee ON Employee.ID_Employee = SaleBill.ID_Principal " >
- <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 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>
-
- <SearchInDepot CmdType="Text" CmdText="
- SELECT Quantity_InDepot=Sum(InQuantity_SaleRtnBillProduct)
- FROM SaleRtnBillProduct
- WHERE SaleRtnBillProduct.ID_SaleRtnBill=@ID_SaleRtnBill
- ">
- <Params>
- <Param name="@ID_SaleRtnBill" type="SaleBill.ID_SaleRtnBill" Index="0" />
- </Params>
- <Tables>
- <Table name="InDepot" />
- </Tables>
- </SearchInDepot>
- <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>
- <UpdateCustomer CmdType="Text" CmdText="if (@IsAudit = '1')
- Begin
- Update Customer Set Saleroom_Customer = Saleroom_Customer + @Amount_SaleRtnBill
- Where Customer.ID_Customer = @ID_Customer
- End
- if (@IsAudit = '0')
- Begin
- Update Customer Set Saleroom_Customer = Saleroom_Customer - @Amount_SaleRtnBill
- Where Customer.ID_Customer = @ID_Customer
- End
- Select 1">
- <Params>
- <Param name="@ID_Customer" type="Customer.ID_Customer" Index="0" />
- <Param name="Amount_SaleRtnBill" type="SaleRtnBill.Amount_SaleRtnBill" Index="1" />
- <Param name="IsAudit" type="SaleBill.No_SaleBill" Index="2" />
- </Params>
- <Tables>
- <Table name="Audit" />
- </Tables>
- </UpdateCustomer>
- </Search>
- </Server>
- <Lables>
- <Search>
- Empty();
- NewInstance();
- @ImportClicked = 0;
- dtpDate.Enabled=false;
- tbNo.ReadOnly=false;
- ckPrevBill.Enabled=false;
- tbCustomerNo.ReadOnly=true;
- cbTaxCurrency.Enabled=false;
- cbCurrency.Enabled=false;
- cbLocation.Enabled=false;
- cbPrincipal.Enabled=false;
- cbReason.Enabled=false;
- cbComment.Enabled=false;
- ikTextBox1.ReadOnly=true;
- dgProduct.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.EnableExport = false;
- toolBar.EnableImport = false;
- toolBar.EnableAssess = false;
- toolBar.EnableUnAssess = false;
- btnDelete.Enabled = false;
- #SaleRtnBill.ID_Assessor=DBNull();
- #SaleRtnBill.AssessDate_SaleRtnBill=DBNull();
- #SaleRtnBill.LastModUser_SaleRtnBill=DBNull();
- #SaleRtnBill.LastModDate_SaleRtnBill=DBNull();
- UpdateForm(true, "");
- tbNo.Focus();
- @Status=0;
- </Search>
- <New>
- Empty();
- NewInstance();
- @ImportClicked = 0;
- tbNo.ReadOnly=true;
- dtpDate.Enabled=true;
- ckPrevBill.Enabled=true;
- tbCustomerNo.ReadOnly=false;
- cbTaxCurrency.Enabled=true;
- cbCurrency.Enabled=false;
- cbLocation.Enabled=true;
- cbPrincipal.Enabled=true;
- cbReason.Enabled=true;
- cbComment.Enabled=true;
- ikTextBox1.ReadOnly=false;
- dgProduct.ReadOnly=false;
- dgProduct.SetColumnReadOnly(8, false);
- dgProduct.SetColumnReadOnly(9, false);
- dgProduct.SetColumnReadOnly(1, false);
- dgProduct.RowHeaderCheck=true;
- dgProduct.AllowNew(true);
- dgProduct.AllowDelete(true);
- toolBar.EnableSubmit=GetRight(@Title,"新增");
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- toolBar.EnableAudit=false;
- toolBar.EnableUnAudit=false;
- toolBar.EnableNew=false;
- toolBar.EnablePrint=false;
- toolBar.EnableExport = false;
- toolBar.EnableImport = true;
- toolBar.EnableAssess = false;
- toolBar.EnableUnAssess = false;
- btnDelete.Enabled = false;
- #SaleRtnBill.ID_SaleRtnBill=NewGuid();
- #SaleRtnBill.ID_Assessor=DBNull();
- #SaleRtnBill.AssessDate_SaleRtnBill=DBNull();
- #SaleRtnBill.LastModUser_SaleRtnBill=DBNull();
- #SaleRtnBill.LastModDate_SaleRtnBill=DBNull();
- #SaleRtnBill.ID_Creator=GetLoginUserID();
- #SaleRtnBill.Name_Creator=GetCurrentUser();
- #SaleRtnBill.Date_SaleRtnBill=DateTimeNow();
- #SaleRtnBill.Currency_SaleRtnBill=@SysCurrency;
- #SaleRtnBill.ID_Location=GetCurrentDepotID();
- #SaleRtnBill.Name_Location=GetCurrentDepot();
- #SaleRtnBill.No_Location=GetCurrentDepotNo();
- #SaleRtnBill.Date_SaleRtnBill=GetCurrentTime();
- SetColumnDefaultValue("SaleRtnBillProduct", "Quantity_SaleRtnBillProduct", 1);
- UpdateForm(true, "");
- dtpDate.Focus();
- @Status=1;
- </New>
- <View>
- @ImportClicked = 0;
- dtpDate.Enabled=false;
- tbNo.ReadOnly=false;
- ckPrevBill.Enabled=false;
- tbCustomerNo.ReadOnly=true;
- cbTaxCurrency.Enabled=false;
- cbCurrency.Enabled=false;
- cbLocation.Enabled=false;
- cbPrincipal.Enabled=false;
- cbReason.Enabled=false;
- cbComment.Enabled=false;
- ikTextBox1.ReadOnly=true;
- dgProduct.ReadOnly=true;
- toolBar.EnableSubmit=false;
- toolBar.EnableNew=GetRight(@Title,"新增");
- if(Search("SearchStockSettle",#SaleRtnBill.Date_SaleRtnBill))
- {
- if(Equals(#SaleRtnBill.ID_Assessor, DBNull()))
- {
- if(#SaleRtnBill.Disable_SaleRtnBill==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;
- toolBar.EnableAssess = false;
- btnDelete.Enabled = false;
- toolBar.EnableUnAssess = false;
- }
- else
- {
- toolBar.EnableAudit=false;
- toolBar.EnableUnAudit=GetRight(@Title,"取消审核");
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- btnDelete.Enabled = GetRight(@Title,"取消审核")&&GetRight(@Title,"删除");
- if(#SaleRtnBill.Assess_SaleRtnBill == 0)
- {
- toolBar.EnableAssess = GetRight(@Title,"审核");
- toolBar.EnableUnAssess = false;
- }
- else
- {
- toolBar.EnableUnAssess = GetRight(@Title,"取消审核");
- toolBar.EnableAssess = false;
- }
- }
- }
- else
- {
- toolBar.EnablePrint=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;
- UpdateForm(true, "");
- @Status=2;
- </View>
- <Modify>
- UpdateForm(false, "");
- @ImportClicked = 0;
- dtpDate.Enabled=false;
- ckPrevBill.Enabled=false;
- tbCustomerNo.ReadOnly=false;
- tbNo.ReadOnly=true;
- cbCurrency.Enabled=false;
- cbLocation.Enabled=true;
- cbPrincipal.Enabled=true;
- cbReason.Enabled=true;
- cbComment.Enabled=true;
- ikTextBox1.ReadOnly=false;
- dgProduct.ReadOnly=false;
- @HaveAccessed = !Equals(#SaleRtnBill.AssessDate_SaleRtnBill,DBNull());
- dgProduct.SetColumnReadOnly(9, @HaveAccessed);
- dgProduct.SetColumnReadOnly(10, @HaveAccessed);
- dgProduct.SetColumnReadOnly(11, @HaveAccessed);
- dgProduct.SetColumnReadOnly(1, @HaveAccessed);
- dgProduct.AllowNew(!@HaveAccessed);
- dgProduct.AllowDelete(!@HaveAccessed);
- dgProduct.RowHeaderCheck=!@HaveAccessed;
- toolBar.EnableSubmit=GetRight(@Title,"修改");
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- toolBar.EnableAudit=false;
- toolBar.EnableUnAudit=false;
- toolBar.EnableNew=false;
- toolBar.EnablePrint=false;
- toolBar.EnableExport = false;
- toolBar.EnableImport = false;
- toolBar.EnableAssess = false;
- toolBar.EnableUnAssess = false;
- btnDelete.Enabled = false;
- #SaleRtnBill.LastModUser_SaleRtnBill=GetLoginUserID();
- #SaleRtnBill.LastModUserName_SaleRtnBill=GetCurrentUser();
- #SaleRtnBill.LastModDate_SaleRtnBill=DateTimeNow();
- SetColumnDefaultValue("SaleRtnBillProduct", "Quantity_SaleRtnBillProduct", 1);
- @HaveAccessed = !Equals(#SaleRtnBill.AssessDate_SaleRtnBill,DBNull());
- if(@HaveAccessed)
- cbTaxCurrency.Enabled = false;
- else
- cbTaxCurrency.Enabled = true;
- UpdateForm(true, "");
- tbNo.Focus();
- @Status=3;
- </Modify>
- <SeachProduct>
- <![CDATA[
- if(ckPrevBill.CValue==false&&!Equals(#SaleRtnBillProduct.FromBill_SaleRtnBillProduct,StringEmpty())&&!Equals(#SaleRtnBillProduct.No_FromBill,StringEmpty())&&!Equals(#SaleRtnBillProduct.No_FromBillProduct,StringEmpty()))
- {
- if(Search("SearchFromBillProductNo",#SaleRtnBillProduct.Type_FromBill,#SaleRtnBillProduct.No_FromBill,#SaleRtnBillProduct.No_FromBillProduct))
- {
- if(#SaleRtnBillProduct.Type_FromBill == 21 && !Equals(cbTaxCurrency.SelectedItem,#SaleOutDepotBillProduct.TaxCurrency_SaleBill))
- {
- MessageBox("该来源单据的税别与本单据的税别不一致!",@Title);
- return;
- }
-
- if(!Equals(#SaleOutDepotBillProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
- #SaleRtnBillProduct.ID_Product=#SaleOutDepotBillProduct.ID_Product;
- #SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct=#SaleOutDepotBillProduct.UnitPrice_FromBillProduct;
- #SaleRtnBillProduct.ProductNo_SaleRtnBillProduct=#SaleOutDepotBillProduct.No_Product;
- #SaleRtnBillProduct.ProductName_SaleRtnBillProduct=#SaleOutDepotBillProduct.Name_Product;
- #SaleRtnBillProduct.ProductUnit_SaleRtnBillProduct=#SaleOutDepotBillProduct.Unit_Product;
- #SaleRtnBillProduct.Quantity_SaleRtnBillProduct=#SaleOutDepotBillProduct.Quantity_SaleRtnBillProduct;
- #SaleRtnBillProduct.ID_IndentBillOnNetProduct=#SaleOutDepotBillProduct.ID_IndentBillOnNetProduct;
- }
- }
- ]]>
- </SeachProduct>
- <Money>
- <![CDATA[
- if(cbTaxCurrency.SelectedName=="外加")
- {
- txtMoneySum.CValue=#SaleRtnBill.GoodsAmount_SaleRtnBill=SumOfCol("#SaleRtnBillProduct.Cash_SaleRtnBillProduct");
- txtTaxSum.CValue=#SaleRtnBill.TaxAmount_SaleRtnBill=FormatNumber(#SaleRtnBill.GoodsAmount_SaleRtnBill*#SystemSetting.CessOut_SystemSetting/100, #SystemSetting.PriceDecimal_SystemSetting);
- txtSum.CValue=#SaleRtnBill.Amount_SaleRtnBill=#SaleRtnBill.GoodsAmount_SaleRtnBill+#SaleRtnBill.TaxAmount_SaleRtnBill;
- }
- else if(cbTaxCurrency.SelectedName=="内含")
- {
- txtSum.CValue=#SaleRtnBill.Amount_SaleRtnBill=SumOfCol("#SaleRtnBillProduct.Cash_SaleRtnBillProduct");
- txtMoneySum.CValue=#SaleRtnBill.GoodsAmount_SaleRtnBill=FormatNumber(#SaleRtnBill.Amount_SaleRtnBill/(1+#SystemSetting.CessOut_SystemSetting/100), #SystemSetting.PriceDecimal_SystemSetting);
- txtTaxSum.CValue=#SaleRtnBill.TaxAmount_SaleRtnBill=#SaleRtnBill.Amount_SaleRtnBill-#SaleRtnBill.GoodsAmount_SaleRtnBill;
- }
- else if(cbTaxCurrency.SelectedName=="零税"||cbTaxCurrency.SelectedName=="免税")
- {
- txtSum.CValue=txtMoneySum.CValue=#SaleRtnBill.Amount_SaleRtnBill=#SaleRtnBill.GoodsAmount_SaleRtnBill=SumOfCol("#SaleRtnBillProduct.Cash_SaleRtnBillProduct");
- txtTaxSum.CValue=#SaleRtnBill.TaxAmount_SaleRtnBill=0;
- }
- txtNum.CValue=#SaleRtnBill.CountColume_SaleRtnBillProduct=SumOfCol("#SaleRtnBillProduct.Quantity_SaleRtnBillProduct");
- ]]>
- </Money>
- <AssessClick>
- Update();
- </AssessClick>
- <SubmitButtonClick>
- <![CDATA[
- if(!Search("SearchStockSettle",dtpDate.Value))
- {
- MessageBox("制单日期不在开帐区间内,提交失败!");
- return;
- }
- if(!Search("SearchCustomerWithNo", tbCustomerNo.CValue) || !Equals(#SaleRtnBill.ID_Customer,#Customer.ID_Customer))
- {
- MessageBox("请输入客户编号后,回车以示确认!",@Title);
- tbCustomerNo.Focus();
- return;
- }
- if (!cbLocation.CheckSelectedItem())
- {
- MessageBox("请选择有效的入库仓库!",@Title);
- cbLocation.Focus();
- return;
- }
- if (!cbPrincipal.CheckSelectedItem())
- {
- MessageBox("请选择有效的负责业务人!",@Title);
- cbPrincipal.Focus();
- return;
- }
- if(RowCount("#SaleRtnBillProduct")==0)
- {
- MessageBox("请输入退货商品!",@Title);
- return;
- }
- UpdateForm(false, "");
- SuspendLayout();
- for(@i=0;@i<RowCount("#SaleRtnBillProduct");@i++)
- {
- SetPosition("#SaleRtnBillProduct", @i);
- if(Equals(#SystemSetting.OutDepotAndSaleBack_SystemSetting,true)&&Equals(ckPrevBill.CValue,false))
- {
- if(Equals(#SaleRtnBillProduct.FromBill_SaleRtnBillProduct,StringEmpty()))
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("请选择来源单据!",@Title);
- ResumeLayout();
- return;
- }
- if(#SaleRtnBillProduct.No_FromBill==StringEmpty())
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("请填入来源单据单号!",@Title);
- ResumeLayout();
- return;
- }
-
- if(#SaleRtnBillProduct.No_FromBillProduct==StringEmpty())
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("请填入来源单据产品序号!",@Title);
- ResumeLayout();
- return;
- }
-
- if(!Search("SearchFromBillProductNo",#SaleRtnBillProduct.Type_FromBill,#SaleRtnBillProduct.No_FromBill,#SaleRtnBillProduct.No_FromBillProduct))
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该来源信息有误,请确认!",@Title);
- ResumeLayout();
- return;
- }
- else
- {
- if(!Equals(#SaleRtnBill.ID_Customer,#SaleOutDepotBillProduct.ID_Customer))
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该来源单据的客户与本单据的客户不一致,请检查!",@Title);
- ResumeLayout();
- return;
- }
- }
- if(!Equals(#SaleRtnBillProduct.ID_Product,#SaleOutDepotBillProduct.ID_Product))
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该来源单据产品单中指定的产品与后改写的产品不匹配!",@Title);
- ResumeLayout();
- return;
- }
- if(!Equals(#SaleRtnBillProduct.Type_FromBill,0)&&!Equals(#SaleRtnBillProduct.No_FromBill,StringEmpty()))
- {
- if(Equals(#SaleOutDepotBillProduct.ID_Assessor,DBNull()))
- {
- dgProduct.CurrentRowIndex = @i;
- if(MessageBox("该来源单据未经审核,确定要提交吗?",@Title,MB_OKCANCEL)==DialogResult("CANCEL"))
- {
- ResumeLayout();
- return;
- }
- }
- }
- }
- else
- {
- if(#SaleRtnBillProduct.Type_FromBill != 0 && #SaleRtnBillProduct.No_FromBill != "" && Search("SearchFromBillProductNo",#SaleRtnBillProduct.Type_FromBill,#SaleRtnBillProduct.No_FromBill,#SaleRtnBillProduct.No_FromBillProduct))
- {
- if(Equals(#SaleOutDepotBillProduct.ID_Assessor,DBNull()))
- {
- dgProduct.CurrentRowIndex = @i;
- @Answer=MessageBox("该来源单据未经审核,确定要保留来源单据资料吗?",@Title,MB_YESNOCANCEL);
- if(@Answer==DialogResult("NO"))
- {
- #SaleRtnBillProduct.Type_FromBill=0;
- #SaleRtnBillProduct.No_FromBill="";
- #SaleRtnBillProduct.No_FromBillProduct=="";
- }
- else if(@Answer==DialogResult("CANCEL"))
- {
- ResumeLayout();
- return;
- }
- }
- }
- if (Equals(#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct,""))
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("请填入产品编号!",@Title);
- ResumeLayout();
- return;
- }
- if(!Search("SearchProductWithNo",#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct))
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该产品不存在!",@Title);
- ResumeLayout();
- return;
- }
- }
- if(#SaleRtnBillProduct.Quantity_SaleRtnBillProduct<=0)
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("数量不得小于等于0!",@Title);
- ResumeLayout();
- return;
- }
- if(#SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct<0)
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("单价不得小于0!",@Title);
- ResumeLayout();
- return;
- }
- if(Equals(#SaleRtnBillProduct.ID_SaleRtnBillProduct,GuidEmpty()))
- #SaleRtnBillProduct.ID_SaleRtnBillProduct = NewGuid();
- #SaleRtnBillProduct.ID_SaleRtnBill=#SaleRtnBill.ID_SaleRtnBill;
- }
- ResumeLayout();
- if(@Status==1)
- {
- #SaleRtnBill.CreateDate_SaleRtnBill=DateTimeNow();
- #SaleRtnBill.No_SaleRtnBill = New("#SaleRtnBill.No_SaleRtnBill", dtpDate.CValue);
- }
- else if(@Status==3)
- {
- #SaleRtnBill.LastModDate_SaleRtnBill=DateTimeNow();
- Update();
- }
- ChangeMode("View");
- ]]>
- </SubmitButtonClick>
- </Lables>
- </Form>
- </Forms>
|