1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470 |
- <?xml version="1.0" encoding="UTF-8"?>
- <Forms>
- <Form Name="FrmSaleInvoicce">
- <Client>
- <Events>
- <Load>
- <![CDATA[
- @Title="销项发票";
- GetSchema();
- Search("SearchCessOut");
-
- Search("SearchSaleBillProduct","p","p");
- Search("SearchSaleRtnBillProduct","p","p");
- Search("SearchProduct","p");
-
- @CessOut=#SystemSetting.CessOut_SystemSetting/100;
- @PriceDecimal=#SystemSetting.PriceDecimal_SystemSetting;
- @SysCurrency=#SystemSetting.SysCurrency_SystemSetting;
- SetColumnDefaultValue("SaleInvoiceProduct", "TaxRate_SaleInvoiceProduct",@CessOut);
- ChangeMode("Search");
- Search("SearchBillType");
- Search("SearchTemp");
- ]]>
- </Load>
- <Closing>
- ;<!--TODO-->
- </Closing>
- <Closed>
- ;<!--TODO-->
- </Closed>
- </Events>
- <Mode>
- <Search>
- <Lable name="Search" />
- </Search>
- <New>
- <Lable name="New" />
- </New>
- <View>
- <Lable name="View" />
- </View>
- <Modify>
- <Lable name="Modify" />
- </Modify>
- </Mode>
- <Controls>
- <IKTextButton name="tbNo" DataSource="SaleInvoice.No_SaleInvoice">
- <Events>
- <Enter>
- if(tbNo.ReadOnly == false)
- {
- if(tbNo.CValue != StringEmpty())
- {
- UpdateForm(false, "");
- if(Search("SearchSaleInvoiceWithNo", tbNo.CValue))
- {
- ChangeMode("View",#SaleInvoice.ID_Assessor);
- if(#SaleInvoice.Disable_SaleInvoice==true)
- ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)";
- <Lable name="CountSum"/>
- }
- else
- {
- MessageBox("该销项发票不存在!",@Title);
- }
-
- }
- else
- {
- MessageBox("请输入销项发票单号!", @Title);
- }
- }
- </Enter>
- <Click>
- ShowSearchBox("BillSearch","NODEPOT", "tbNo", tbNo.CValue);
- </Click>
- </Events>
- </IKTextButton>
- <IKDataTimePicker name="dtDate" DataSource="SaleInvoice.Date_SaleInvoice" />
- <IKComboBoxEx name="cbType" DisplaySource="SaleInvoice.TypeName">
- <Events>
- <SelectedIndexChanged>
- #SaleInvoice.Type_SaleInvoice=cbType.SelectedIndex;
- </SelectedIndexChanged>
- </Events>
- </IKComboBoxEx>
- <IKDataTimePicker name="dtInvoiceDate" DataSource="SaleInvoice.InvoiceDate_SaleInvoice" >
- <Events>
- <ValueChanged>
- if(!Equals(#SaleInvoice.ID_Customer,GuidEmpty()))
- {
- if(Equals(#SaleInvoice.GetMethod_Customer,"先款后货"))
- #SaleInvoice.PayDate_SaleInvoice=dtInvoiceDate.Value;
- else if(Equals(#SaleInvoice.GetMethod_Customer,"票到当月结"))
- {
- Search("SearchPayDate",dtInvoiceDate.Value,#Customer.DunDate_Customer);
- #SaleInvoice.PayDate_SaleInvoice= #PayDate.NextEndDate;
- }
- else if(Equals(#SaleInvoice.GetMethod_Customer,"两月结"))
- {
- Search("SearchPayDate2",dtInvoiceDate.Value,#Customer.DunDate_Customer);
- #SaleInvoice.PayDate_SaleInvoice=#PayDate2.NextEndDate;
- }
- else if(Equals(#SaleInvoice.GetMethod_Customer,"三月结"))
- {
- Search("SearchPayDate3",dtInvoiceDate.Value,#Customer.DunDate_Customer);
- #SaleInvoice.PayDate_SaleInvoice=#PayDate3.NextEndDate;
- }
- else if(Equals(#SaleInvoice.GetMethod_Customer,"四月结"))
- {
- Search("SearchPayDate4",dtInvoiceDate.Value,#Customer.DunDate_Customer);
- #SaleInvoice.PayDate_SaleInvoice=#PayDate4.NextEndDate;
- }
- else if(Equals(#SaleInvoice.GetMethod_Customer,"票到付款"))
- {
- Search("SearchPayDate5",dtInvoiceDate.Value,#Customer.DunDate_Customer);
- #SaleInvoice.PayDate_SaleInvoice=#PayDate5.NextEndDate;
- }
- UpdateForm(true,"dtPayDate");
- }
- </ValueChanged>
- </Events>
- </IKDataTimePicker>
- <IKTextBox name="txtInvoiceNo" DataSource="SaleInvoice.No_Invoice"/>
- <IKButton name="btnModify">
- <Events>
- <Click>
- if(Equals(btnModify.Text,"修改"))
- {
- txtInvoiceNo.ReadOnly=false;
- btnModify.Text="保存";
- }
- else
- {
- if(Equals(txtInvoiceNo.CValue,""))
- {
- MessageBox("请填入发票编号!",@Title);
- txtInvoiceNo.Focus();
- }
- else
- {
- if(Search("SearchInvoiceNo",txtInvoiceNo.CValue,#SaleInvoice.No_SaleInvoice))
- {
- MessageBox("此发票号码已存在,请重新填入发票编号!",@Title);
- txtInvoiceNo.Focus();
- return;
- }
- else
- {
- #SaleInvoice.LastModUser=GetCurrentUser();
- #SaleInvoice.LastModUser_SaleInvoice=GetLoginUserID();
- #SaleInvoice.LastModDate_SaleInvoice=GetCurrentTime();
- UpdateForm(false,"");
- #SaleInvoice.Type_SaleInvoice=cbType.SelectedIndex;
- Update();
- txtInvoiceNo.ReadOnly=true;
- btnModify.Text="修改";
- }
- }
- }
- </Click>
- </Events>
- </IKButton>
- <IKTextBox name="txtMaker" DataSource="SaleInvoice.Creator" />
- <IKTextButton name="tbCustomerNo" DataSource="SaleInvoice.No_Customer" >
- <Events>
- <Enter>
- UpdateForm(false,"");
- if(tbCustomerNo.CValue!=StringEmpty())
- {
- if(!Search("SearchCustomer",tbCustomerNo.CValue))
- {
- MessageBox("该客户不存在!",@Title);
- @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo.CValue);
- if(@temp != "")
- {
- tbCustomerNo.CValue = @temp;
- ActiveControlEvent("tbCustomerNo", "Enter");
- }
- }
- else
- {
- if(!Equals(#Customer.SuspendDate_Customer,DBNull()))
- {
- MessageBox("该客户已暂停!",@Title);
- }
- #SaleInvoice.ID_Customer=#Customer.ID_Customer;
- #SaleInvoice.ShortName_Customer=#Customer.ShortName_Customer;
- #SaleInvoice.RevenueRegisterNo_Customer=#Customer.RevenueRegisterNo_Customer;
- #SaleInvoice.Bank_SaleInvoice=#Customer.Bank_Customer;
- #SaleInvoice.Account_SaleInvoice=#Customer.Account_Customer;
- #SaleInvoice.GetMethod_Customer=#Customer.GetMethod_Customer;
- #SaleInvoice.InvoiceTitle_SaleInvoice=#Customer.Title_Invoice;
- #SaleInvoice.InvoiceAddress_SaleInvoice=#Customer.Address_Invoice;
- #SaleInvoice.Company_Customer=#Customer.Company_Customer;
- if(Equals(#SaleInvoice.GetMethod_Customer,"先款后货"))
- #SaleInvoice.PayDate_SaleInvoice=dtInvoiceDate.Value;
- else if(Equals(#SaleInvoice.GetMethod_Customer,"票到当月结"))
- {
- Search("SearchPayDate",dtInvoiceDate.Value,#Customer.DunDate_Customer);
- #SaleInvoice.PayDate_SaleInvoice= #PayDate.NextEndDate;
- }
- else if(Equals(#SaleInvoice.GetMethod_Customer,"两月结"))
- {
- Search("SearchPayDate2",dtInvoiceDate.Value,#Customer.DunDate_Customer);
- #SaleInvoice.PayDate_SaleInvoice=#PayDate2.NextEndDate;
- }
- else if(Equals(#SaleInvoice.GetMethod_Customer,"三月结"))
- {
- Search("SearchPayDate3",dtInvoiceDate.Value,#Customer.DunDate_Customer);
- #SaleInvoice.PayDate_SaleInvoice=#PayDate3.NextEndDate;
- }
- else if(Equals(#SaleInvoice.GetMethod_Customer,"四月结"))
- {
- Search("SearchPayDate4",dtInvoiceDate.Value,#Customer.DunDate_Customer);
- #SaleInvoice.PayDate_SaleInvoice=#PayDate4.NextEndDate;
- }
- else if(Equals(#SaleInvoice.GetMethod_Customer,"票到付款"))
- {
- Search("SearchPayDate5",dtInvoiceDate.Value,#Customer.DunDate_Customer);
- #SaleInvoice.PayDate_SaleInvoice=#PayDate5.NextEndDate;
- }
- }
- }
- else
- {
- MessageBox("请输入客户编号!",@Title);
- #SaleInvoice.ID_Customer=GuidEmpty();
- #SaleInvoice.ShortName_Customer="";
- #SaleInvoice.InvoiceTitle_SaleInvoice="";
- #SaleInvoice.InvoiceAddress_SaleInvoice="";
- #SaleInvoice.RevenueRegisterNo_Customer="";
- #SaleInvoice.Bank_SaleInvoice="";
- #SaleInvoice.Account_SaleInvoice="";
- #SaleInvoice.GetMethod_Customer="";
- #SaleInvoice.Company_Customer="";
- tbCustomerNo.Focus();
- }
- UpdateForm(true,"");
- </Enter>
- <Click>
- <![CDATA[
- if (tbCustomerNo.ReadOnly == false)
- {
- @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo.CValue);
- if( @temp == "" )
- return;
- tbCustomerNo.CValue = @temp;
- ActiveControlEvent("tbCustomerNo", "Enter");
- }
- ]]>
- </Click>
- </Events>
- </IKTextButton>
- <IKTextBox name="txtCustomerName" DataSource="SaleInvoice.ShortName_Customer"/>
- <IKComboBoxEx name="cbInvoiceTitle" DisplaySource="SaleInvoice.InvoiceTitle_SaleInvoice" DataSource="InvoiceTitle" DisplayMember="Title_Invoice">
- <Events>
- <Reload>
- UpdateForm(false, "cbInvoiceTitle");
- Search("SearchInvoiceTitle",#SaleInvoice.ID_Customer);
- UpdateForm(true, "cbInvoiceTitle");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKComboBoxEx name="cbInvoiceAddress" DisplaySource="SaleInvoice.InvoiceAddress_SaleInvoice" DataSource="InvoiceAddress" DisplayMember="Address_Invoice">
- <Events>
- <Reload>
- UpdateForm(false, "cbInvoiceAddress");
- Search("SearchInvoiceAddress",#SaleInvoice.ID_Customer);
- UpdateForm(true, "cbInvoiceAddress");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKComboBoxEx name="cbCurrency" DisplaySource="SaleInvoice.Currency_SaleInvoice" />
- <IKTextBox name="ikTextBox1" DataSource="SaleInvoice.RevenueRegisterNo_Customer"/>
- <IKComboBoxEx name="cbBank" DisplaySource="SaleInvoice.Bank_SaleInvoice" DataSource="Bank" DisplayMember="Name_TypeDef">
- <Events>
- <Reload>
- UpdateForm(false, "cbBank");
- Search("SearchBank");
- UpdateForm(true, "cbBank");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKTextBox name="txtAccount" DataSource="SaleInvoice.Account_SaleInvoice" />
- <IKTextBox name="ikTextBox3" DataSource="SaleInvoice.GetMethod_Customer" />
- <IKTextBox name="txtCompany" DataSource="SaleInvoice.Company_Customer" />
- <IKDataTimePicker name="dtPayDate" DataSource="SaleInvoice.PayDate_SaleInvoice" />
- <IKTextBox name="txtAssessor" DataSource="SaleInvoice.Assessor" />
- <IKDateTimeText name="dtAssessDate" DataSource="SaleInvoice.AssessDate_SaleInvoice" />
- <IKTextBox name="txtLastModUser" DataSource="SaleInvoice.LastModUser"/>
- <IKDateTimeText name="dtLastModDate" DataSource="SaleInvoice.LastModDate_SaleInvoice"/>
- <IKNumericTextBox name="txtMoneySum" DataSource="SaleInvoice.GoodsAmount_SaleInvoice"/>
- <IKNumericTextBox name="txtTaxSum" DataSource="SaleInvoice.TaxAmount_SaleInvoice"/>
- <IKNumericTextBox name="txtSum" DataSource="SaleInvoice.Amount_SaleInvoice"/>
- <IKDataGridEx name="dgProduct" DataSource="SaleInvoiceProduct" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="SaleInvoiceProduct.Name_BillType" >
- <IKDataGridComboBoxColumn DisplaySourceEx="SaleInvoiceProduct.Name_BillType" ValueSourceEx="SaleInvoiceProduct.Type_FromBill" DataSourceEx="BillType" DisplayMemberEx="Name_BillType" ValueMemberEx="Value_BillType">
- <Events>
- <Reload>
- Search("SearchBillType");
- SetDataGridColumnDataSource(0,"dgProduct");
- </Reload>
- </Events>
- </IKDataGridComboBoxColumn>
- </DataColumn>
- <DataColumn Index="1" DataSource="SaleInvoiceProduct.No_FromBill" />
- <DataColumn Index="2" DataSource="SaleInvoiceProduct.No_FromBillProduct" />
- <DataColumn Index="3" DataSource="SaleInvoiceProduct.No_Customer" />
- <DataColumn Index="4" DataSource="SaleInvoiceProduct.ShortName_Customer" />
- <DataColumn Index="5" DataSource="SaleInvoiceProduct.No_Product" >
- <IKDataGridTextButtonColumn>
- <Events>
- <Click>
- ShowSearchBox("ProductSearch","INFOMATION",#SaleInvoiceProduct.No_Product);
- </Click>
- </Events>
- </IKDataGridTextButtonColumn>
- </DataColumn>
- <DataColumn Index="6" DataSource="SaleInvoiceProduct.Name_Product" />
- <DataColumn Index="7" DataSource="SaleInvoiceProduct.InvoiceName_Product" />
- <DataColumn Index="8" DataSource="SaleInvoiceProduct.Unit_Product" />
- <DataColumn Index="9" DataSource="SaleInvoiceProduct.Quantity_SaleInvoiceProduct" />
- <DataColumn Index="10" DataSource="SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct" />
- <DataColumn Index="11" DataSource="SaleInvoiceProduct.Amount_SaleInvoiceProduct" />
- <DataColumn Index="12" DataSource="SaleInvoiceProduct.TaxRate_SaleInvoiceProduct" />
- <DataColumn Index="13" DataSource="SaleInvoiceProduct.TaxAmount_SaleInvoiceProduct" />
- <DataColumn Index="14" DataSource="SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct" />
- <DataColumn Index="15" DataSource="SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct" />
- <DataColumn Index="16" DataSource="SaleInvoiceProduct.Comment_SaleInvoiceProduct" />
- </IKDataGridEx>
- <IKDateTimePicker name = "dtStart" DataSource="SaleInvoice.StartDate">
- <Events>
- <CheckedChanged>
- dtEnd.Checked = dtStart.Checked;
- </CheckedChanged>
- <ValueChanged>
- dtEnd.CValue = dtStart.CValue;
- </ValueChanged>
- </Events>
- </IKDateTimePicker>
- <IKDateTimePicker name = "dtEnd" DataSource="SaleInvoice.EndDate"/>
- <IKCheckBox name="ckRtn" DataSource="SaleInvoice.ckRtn"/>
- <IKButton name ="btnSearch">
- <Events>
- <Click>
- MergeTable("#SaleInvoiceProduct","#Temp");
- Empty("#SaleInvoiceProduct");
- @DateStart = null;
- @DateEnd = null;
- @ckRtn = 0;
- if (dtStart.Checked)
- @DateStart = dtStart.CValue;
- else
- {
- MessageBox("请选择日期!");
- return;
- }
- if (dtEnd.Checked)
- @DateEnd = dtEnd.CValue;
-
- if (ckRtn.Checked)
- {
- @ckRtn = 1;
- if(Search("SearchAllSaleAndRtnBill",#SaleInvoice.No_Customer,@DateStart,@DateEnd,@ckRtn))
- {
- MergeTable("#SaleInvoiceProduct1","#SaleInvoiceProduct");
- }
- }
- else
- {
- @ckRtn = 0;
- if(Search("SearchAllSale",#SaleInvoice.No_Customer,@DateStart,@DateEnd,@ckRtn))
- MergeTable("#SaleInvoiceProduct2","#SaleInvoiceProduct");
- }
- dgProduct.SetColumnReadOnly(14,true);
- <Lable name="CountSum"/>
- </Click>
- </Events>
- </IKButton>
- <IKFormToolBar name="toolBar">
- <Events>
- <ClickFirst>
- if(Search("SearchSaleInvoiceFirst"))
- {
- ChangeMode("View",#SaleInvoice.ID_Assessor);
- if(#SaleInvoice.Disable_SaleInvoice==true)
- ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)";
- <Lable name="CountSum"/>
- }
- </ClickFirst>
- <ClickPrev>
- if(Search("SearchSaleInvoicePrevious", tbNo.CValue))
- {
- ChangeMode("View",#SaleInvoice.ID_Assessor);
- if(#SaleInvoice.Disable_SaleInvoice==true)
- ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)";
- <Lable name="CountSum"/>
- }
- </ClickPrev>
- <ClickNext>
- if(Search("SearchSaleInvoiceNext",tbNo.CValue))
- {
- ChangeMode("View",#SaleInvoice.ID_Assessor);
- if(#SaleInvoice.Disable_SaleInvoice==true)
- ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)";
- <Lable name="CountSum"/>
- }
- </ClickNext>
- <ClickLast>
- if(Search("SearchSaleInvoiceLast"))
- {
- ChangeMode("View",#SaleInvoice.ID_Assessor);
- if(#SaleInvoice.Disable_SaleInvoice==true)
- ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)";
- <Lable name="CountSum"/>
- }
- </ClickLast>
- <ClickNew>
- <![CDATA[
- @NextNo = GetNextAutoNumber(true);
- if (!Equals(@NextNo, ""))
- {
- ChangeMode("New");
- #SaleInvoice.No_SaleInvoice= @NextNo;
- UpdateForm(true, "tbNo");
- }
- ]]>
- </ClickNew>
- <ClickEmpty>
- ChangeMode("Search");
- </ClickEmpty>
- <ClickSubmit>
- <Lable name="SubmitButtonClick" />
- </ClickSubmit>
- <ClickModify>
- ChangeMode("Modify");
- <Lable name="CountSum"/>
- </ClickModify>
- <ClickDelete>
- Delete();
- ChangeMode("Search");
- </ClickDelete>
- <ClickBlank>
- BeginBlank();
- #SaleInvoice.Disable_SaleInvoice=true;
- Blank();
- EndBlank();
- ChangeMode("View",#SaleInvoice.ID_Assessor);
- if(#SaleInvoice.Disable_SaleInvoice==true)
- ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)";
- <Lable name="CountSum"/>
- </ClickBlank>
- <ClickPrint>
- ShowPrintBox("BillSearch",#SaleInvoice.No_SaleInvoice,#SaleInvoice.No_SaleInvoice);
- </ClickPrint>
- <ClickAudit>
- <![CDATA[
- SuspendLayout();
- for (@i=0;@i<RowCount("#SaleInvoiceProduct");@i=@i+1)
- {
- SetPosition("#SaleInvoiceProduct", @i);
- if(Equals(#SaleInvoiceProduct.Name_BillType,"销货单"))
- {
- if(Search("SearchSaleBill",#SaleInvoiceProduct.No_FromBill,#SaleInvoiceProduct.No_FromBillProduct))
- {
- if (Equals(#SaleBill.ID_Assessor,DBNull()))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该来源单据未经审核,审核失败!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if (!Search("SearchCustomerRelation",#SaleInvoice.ID_Customer,#SaleBill.ID_Customer))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该来源单据的客户与本销项发票的客户或下级客户不一致,审核失败!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
-
- }
- if(Equals(#SaleInvoiceProduct.Name_BillType,"销售退货单"))
- {
- if(Search("SearchSaleRtnBill",#SaleInvoiceProduct.No_FromBill,#SaleInvoiceProduct.No_FromBillProduct))
- {
- if (Equals(#SaleRtnBill.ID_Assessor,DBNull()))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该来源单据未经审核,提交失败!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if (!Search("SearchCustomerRelation",#SaleInvoice.ID_Customer,#SaleRtnBill.ID_Customer))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该来源单据的客户与本销项发票的客户或下级客户不一致,审核失败!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
-
- }
- }
- ResumeLayout();
- ]]>
- BeginAudit();
- #SaleInvoice.ID_Assessor=GetLoginUserID();
- #SaleInvoice.Assessor=GetCurrentUser();
- #SaleInvoice.AssessDate_SaleInvoice=DateTimeNow();
- Audit();
- ChangeMode("View",#SaleInvoice.ID_Assessor);
- EndAudit();
- <Lable name="CountSum"/>
- </ClickAudit>
- <ClickUnAudit>
- BeginUnAudit();
- #SaleInvoice.ID_Assessor=DBNull();
- #SaleInvoice.Assessor=DBNull();
- #SaleInvoice.AssessDate_SaleInvoice=DataTimeNow();
- UnAudit();
- ChangeMode("View",#SaleInvoice.ID_Assessor);
- EndUnAudit();
- <Lable name="CountSum"/>
- </ClickUnAudit>
- <ClickImportItem>
- <![CDATA[
- if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="销售退货单")
- {
- if(Search("SearchContr"))
- {
- ShowSearchBox("ImportSaleRtnBillControl","BILLCONVERTEX","#SaleInvoiceProduct.Type_FromBill",22,"#SaleInvoiceProduct.Name_BillType","销售退货单");
- }
- else
- {
- ShowSearchBox("ImportSaleRtnBillUnControl","BILLCONVERTEX");
- }
- }
- else if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="销货单")
- {
- @ImportClicked = 1;
- if(Search("SearchContrSOB"))
- {
- ShowSearchBox("ImportSaleBillControl","BILLCONVERTEX","#SaleInvoiceProduct.Type_FromBill",21,"#SaleInvoiceProduct.Name_BillType","销货单");
- }
- else
- {
- ShowSearchBox("ImportSaleBillUnControl","BILLCONVERTEX");
- }
- }
- ]]>
- <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
- </ClickImportItem>
- <ClickExport>
- ;
- </ClickExport>
- <ClickClose>
- ;
- </ClickClose>
- <ClickExpand>
- ;
- </ClickExpand>
- </Events>
- </IKFormToolBar>
- </Controls>
- <Tables>
- <Table name="SaleInvoiceProduct">
- <Events>
- <ColumnsChanged>
- <Name_BillType>
- <Lable name="FromBillChange"/>
- <Lable name="CountSum" />
- </Name_BillType>
- <No_FromBill>
- <Lable name="FromBillChange"/>
- <Lable name="CountSum" />
- </No_FromBill>
- <No_FromBillProduct>
- <Lable name="FromBillChange"/>
- <Lable name="CountSum" />
- </No_FromBillProduct>
- <No_Product>
- if(Equals(#SaleInvoiceProduct.No_Product,"") || !Search("SearchProduct",#SaleInvoiceProduct.No_Product))
- {
- if(!Equals(#SaleInvoiceProduct.No_Product,""))
- MessageBox("该产品不存在!",@Title);
- #SaleInvoiceProduct.ID_Product=GuidEmpty();
- #SaleInvoiceProduct.Name_Product="";
- #SaleInvoiceProduct.Unit_Product="";
- #SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct=0.00;
- #SaleInvoiceProduct.InvoiceName_Product="";
- @temp = ShowSearchBox("InputSearchProduct","INFOMATION",#SaleInvoiceProduct.No_Product);
- if(@temp != "")
- {
- ResumeColumnEvent("#SaleInvoiceProduct.No_Product");
- #SaleInvoiceProduct.No_Product = @temp;
- ClearColumnEvent();
- }
- }
- else
- {
- #SaleInvoiceProduct.ID_Product=#Product.ID_Product;
- #SaleInvoiceProduct.Name_Product=#Product.Name_Product;
- #SaleInvoiceProduct.Unit_Product=#Product.Unit_Product;
- #SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct=#Product.Price_Product;
- #SaleInvoiceProduct.InvoiceName_Product=#Product.InvoiceName_Product;
- }
- <Lable name="CountAmount"/>
- <Lable name="CountSum"/>
- </No_Product>
- <Quantity_SaleInvoiceProduct>
- <Lable name="CountAmount"/>
- <Lable name="CountSum"/>
- </Quantity_SaleInvoiceProduct>
- <UnitPrice_SaleInvoiceProduct>
- <Lable name="CountAmount"/>
- <Lable name="CountSum"/>
- </UnitPrice_SaleInvoiceProduct>
- <TaxRate_SaleInvoiceProduct>
- <Lable name="CountAmount"/>
- <Lable name="CountSum"/>
- </TaxRate_SaleInvoiceProduct>
- <TaxCurrency_SaleInvoiceProduct>
- <Lable name="CountAmount"/>
- <Lable name="CountSum"/>
- </TaxCurrency_SaleInvoiceProduct>
- </ColumnsChanged>
- <RowDeleted>
- <Lable name="CountSum"/>
- </RowDeleted>
- </Events>
- </Table>
- </Tables>
- <LockInfomation LockID="ID_SaleInvoice" LockNO="No_SaleInvoice" LockSearchFunction="SearchSaleInvoiceWithNo" LockAudit="ID_Assessor" LockBlank="Disable_SaleInvoice" />
- <LogInfomation LogNO="#SaleInvoice.No_SaleInvoice" RecordFormField="发票号码:#SaleInvoice.No_Invoice,客户编号:#SaleInvoice.No_Customer,银行帐号:#SaleInvoice.Account_Customer" RecordDataGridField="#SaleInvoiceProduct.No_Product,#SaleInvoiceProduct.Quantity_SaleInvoiceProduct,#SaleInvoiceProduct.Amount_SaleInvoiceProduct"/>
- <ChildForms>
- <ChildForm name="BillSearch" DataSource="SaleInvoice" SearchFunction="SearchAllBill" SearchFunctionByNo="SearchSaleInvoiceWithNo">
- <DataColumn Index="0" MappingName="#SaleInvoice.No_SaleInvoice" HeaderText="销项发票单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="1" MappingName="#SaleInvoice.Date_SaleInvoice" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="2" MappingName="#SaleInvoice.ShortName_Customer" HeaderText="客户简称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="3" MappingName="#SaleInvoice.No_Invoice" HeaderText="发票号码" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="CustomerSearch" DataSource="Customer" SearchFunction="SearchAllCustomer" SearchFunctionByNo="" MappingName="客户">
- <DataColumn Index="0" MappingName="#Customer.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="1" MappingName="#Customer.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="2" MappingName="#Customer.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="3" MappingName="#Customer.Level_Customer" HeaderText="客户等级" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="4" MappingName="#Customer.IsGeneric_Customer" HeaderText="一般客户" Width="75" ColumnType="IKDataGridBoolColumn"/>
- </ChildForm>
- <ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品" ReturnDataSource="SaleInvoiceProduct" ShowCheckBox="true">
- <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn" ReturnMappingName="#SaleInvoiceProduct.No_Product"/>
- <DataColumn Index="1" MappingName="#Product.Name_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"/>
- </ChildForm>
- <ChildForm name="ImportSaleBillControl" >
- <DataGridIndex DataSource="SaleBill" SearchFunction="SearchAllSaleBill" SearchFunctionStandby="SearchAllSaleBillProduct" SearchFunctionByNo="" MappingName="" ReturnDataSource="SaleInvoiceProduct">
- <DataColumn Index="0" MappingName="#SaleBill.No_SaleBill" ReadOnly="true" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="1" MappingName="#SaleBill.Date_SaleBill" ReadOnly="true" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="2" MappingName="#SaleBill.No_Customer" ReadOnly="true" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#SaleInvoice.No_Customer"/>
- <DataColumn Index="3" MappingName="#SaleBill.ShortName_Customer" ReadOnly="true" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="4" MappingName="#SaleBill.TaxCurrency_SaleBill" ReadOnly="true" HeaderText="税别" Width="30" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="5" MappingName="#SaleBill.Currency_SaleBill" ReadOnly="true" HeaderText="币别" Width="30" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent"/>
- <DataColumn Index="6" MappingName="#SaleBill.State_SaleBill" ReadOnly="true" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="7" MappingName="#SaleBill.Name_Location" ReadOnly="true" HeaderText="出货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" />
- <DataColumn Index="8" MappingName="#SaleBill.InvoiceAddress_Company" ReadOnly="true" HeaderText="发票地址" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#SaleInvoice.InvoiceAddress_SaleInvoice"/>
- <DataColumn Index="9" MappingName="#SaleBill.InvoiceTitle_Company" ReadOnly="true" HeaderText="发票抬头" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#SaleInvoice.InvoiceTitle_SaleInvoice"/>
- </DataGridIndex>
- <ReturnFieldMapping>
- <DataColumn Index="0" MappingName="#SaleBill.No_SaleBill" ReturnPath="child" ReturnMappingName="#SaleInvoiceProduct.No_FromBill"/>
- <DataColumn Index="0" MappingName="#SaleBillProduct.No_SaleBillProduct" ReturnPath="child" ReturnMappingName="#SaleInvoiceProduct.No_FromBillProduct"/>
- </ReturnFieldMapping>
- </ChildForm>
- <ChildForm name="ImportSaleBillUnControl">
- <DataGridIndex DataSource="SaleBill" SearchFunction="SearchAllSaleBill" SearchFunctionStandby="SearchAllSaleBillProduct" SearchFunctionByNo="" MappingName=""
- ReturnDataSource="SaleInvoiceProduct">
- <DataColumn Index="0" MappingName="#SaleBill.No_SaleBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReadOnly="true"
- ReturnPath="child" ReturnMappingName="#SaleInvoiceProduct.SaleInvoiceProduct" />
- <DataColumn Index="1" MappingName="#SaleBill.Date_SaleBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReadOnly="true"
- ReturnPath="child" />
- <DataColumn Index="2" MappingName="#SaleBill.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReadOnly="true"
- ReturnPath="parent" ReturnMappingName="#SaleInvoice.No_Customer" />
- <DataColumn Index="3" MappingName="#SaleBill.ShortName_Customer" HeaderText="客户简称" Width="90" ReadOnly="true"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="4" MappingName="#SaleBill.TaxCurrency_SaleBill" HeaderText="税别" Width="90" ReadOnly="true" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" />
- <DataColumn Index="5" MappingName="#SaleBill.State_SaleBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReadOnly="true"
- ReturnPath="child" />
- <DataColumn Index="6" MappingName="#SaleBill.Name_Location" HeaderText="出货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn" ReadOnly="true"
- ReturnPath="parent" />
- <DataColumn Index="7" MappingName="#SaleBill.OutStatus_SaleBill" HeaderText="发货状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReadOnly="true"
- ReturnPath="child" />
- </DataGridIndex>
- <ReturnFieldMapping>
- <DataColumn Index="0" MappingName="#SaleBillProduct.No_Product" ReturnPath="child" ReturnMappingName="#SaleInvoiceProduct.No_Product"/>
- </ReturnFieldMapping>
- </ChildForm>
- <ChildForm name="ImportSaleRtnBillControl">
- <DataGridIndex DataSource="SaleRtnBill" SearchFunction="SearchAllSaleRtnBill" SearchFunctionStandby="SearchAllSaleRtnBillProduct" SearchFunctionByNo=""
- MappingName="" ReturnDataSource="SaleInvoiceProduct">
- <DataColumn Index="0" MappingName="#SaleRtnBill.No_SaleRtnBill" HeaderText="单据编号" Width="90" ReadOnly="true"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleInvoiceProduct.No_FromBill" />
- <DataColumn Index="1" MappingName="#SaleRtnBill.Date_SaleRtnBill" HeaderText="制单日期" Width="90" ReadOnly="true"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="2" MappingName="#SaleRtnBill.No_Customer" HeaderText="客户编号" Width="90" ReadOnly="true" ColumnType="IKDataGridTextBoxColumn"
- ReturnPath="parent" ReturnMappingName="#SaleInvoice.No_Customer"/>
- <DataColumn Index="3" MappingName="#SaleRtnBill.ShortName_Customer" HeaderText="客户简称" Width="90" ReadOnly="true"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="4" MappingName="#SaleRtnBill.State_SaleRtnBill" HeaderText="单据状态" Width="90" ReadOnly="true"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="5" MappingName="#SaleRtnBill.Name_Location" HeaderText="入库仓库" Width="90" ReadOnly="true"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" />
- </DataGridIndex>
- <ReturnFieldMapping>
- <DataColumn Index="0" MappingName="#SaleRtnBillProduct.No_SaleRtnBillProduct" ReturnPath="child" ReturnMappingName="#SaleInvoiceProduct.No_FromBillProduct"/>
- </ReturnFieldMapping>
- </ChildForm>
- <ChildForm name="ImportSaleRtnBillUnControl">
- <DataGridIndex DataSource="SaleRtnBill" SearchFunction="SearchAllSaleRtnBill" SearchFunctionStandby="SearchAllSaleRtnBillProduct" SearchFunctionByNo=""
- MappingName="" ReturnDataSource="SaleInvoiceProduct">
- <DataColumn Index="0" MappingName="#SaleRtnBill.No_SaleRtnBill" HeaderText="单据编号" Width="90" ReadOnly="true"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleInvoiceProduct.Comment_SaleInvoiceProduct" />
- <DataColumn Index="1" MappingName="#SaleRtnBill.Date_SaleRtnBill" HeaderText="制单日期" Width="90" ReadOnly="true"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="2" MappingName="#SaleRtnBill.No_Customer" HeaderText="客户编号" Width="90" ReadOnly="true" ColumnType="IKDataGridTextBoxColumn"
- ReturnPath="parent" ReturnMappingName="#SaleInvoice.No_Customer"/>
- <DataColumn Index="3" MappingName="#SaleRtnBill.ShortName_Customer" HeaderText="客户简称" Width="90" ReadOnly="true"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="4" MappingName="#SaleRtnBill.State_SaleRtnBill" HeaderText="单据状态" Width="90" ReadOnly="true"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="5" MappingName="#SaleRtnBill.Name_Location" HeaderText="入库仓库" Width="90" ReadOnly="true"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" />
- </DataGridIndex>
- <ReturnFieldMapping>
- <DataColumn Index="0" MappingName="#SaleRtnBillProduct.No_Product" ReturnPath="child" ReturnMappingName="#SaleInvoiceProduct.No_Product"/>
- </ReturnFieldMapping>
- </ChildForm>
- </ChildForms>
- <ImportedInfo>
- UpdateForm(true, "tbCustomerNo");
- @InvoiceAddress=#SaleInvoice.InvoiceAddress_SaleInvoice;
- @InvoiceTitle=#SaleInvoice.InvoiceTitle_SaleInvoice;
- ActiveControlEvent("tbCustomerNo", "Enter");
- #SaleInvoice.InvoiceAddress_SaleInvoice=@InvoiceAddress;
- #SaleInvoice.InvoiceTitle_SaleInvoice=@InvoiceTitle;
- UpdateForm(true, "cbInvoiceTitle");
- UpdateForm(true, "cbInvoiceAddress");
- </ImportedInfo>
- </Client>
- <Server>
- <Tables>
- <Table name="SaleInvoice" Type="Parent">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 SaleInvoice.*,a.Name_User As Creator
- ,b.Name_User As Assessor,c.Name_User As LastModUser
- ,Customer.No_Customer,Customer.ShortName_Customer
- ,Customer.RevenueRegisterNo_Customer,Customer.Bank_Customer
- ,Customer.Account_Customer,Customer.GetMethod_Customer
- ,Customer.Company_Customer
- ,convert(nvarchar(64),'') As TypeName
- ,Convert(DateTime,getdate()) as StartDate
- ,Convert(DateTime,getdate()) as EndDate
- ,Convert(bit,0) as ckRtn
- FROM SaleInvoice
- LEFT JOIN AppUser a ON SaleInvoice.ID_Creator=a.ID_User
- LEFT JOIN AppUser b ON SaleInvoice.ID_Assessor=b.ID_User
- LEFT JOIN AppUser c ON SaleInvoice.LastModUser_SaleInvoice=c.ID_User
- Left JOIN Customer On Customer.ID_Customer=SaleInvoice.ID_Customer
- ">
- </GetSchema>
- <New CmdType="Text" CmdText=" INSERT INTO SaleInvoice(ID_SaleInvoice
- ,No_SaleInvoice
- ,Date_SaleInvoice
- ,Type_SaleInvoice
- ,PayDate_SaleInvoice
- ,InvoiceDate_SaleInvoice
- ,No_Invoice
- ,ID_Customer
- ,InvoiceAddress_SaleInvoice
- ,InvoiceTitle_SaleInvoice
- ,Bank_SaleInvoice
- ,Account_SaleInvoice
- ,Currency_SaleInvoice
- ,ID_Creator
- ,CreateDate_SaleInvoice
- ,LastModUser_SaleInvoice
- ,LastModDate_SaleInvoice
- ,ID_Assessor
- ,AssessDate_SaleInvoice
- ,Amount_SaleInvoice
- ,IncludeTax_SaleInvoice
- ,GoodsAmount_SaleInvoice
- ,TaxAmount_SaleInvoice
- )
-
- VALUES(@ID_SaleInvoice
- ,@No_SaleInvoice
- ,@Date_SaleInvoice
- ,@Type_SaleInvoice
- ,@PayDate_SaleInvoice
- ,@InvoiceDate_SaleInvoice
- ,@No_Invoice
- ,@ID_Customer
- ,@InvoiceAddress_SaleInvoice
- ,@InvoiceTitle_SaleInvoice
- ,@Bank_SaleInvoice
- ,@Account_SaleInvoice
- ,@Currency_SaleInvoice
- ,@ID_Creator
- ,@CreateDate_SaleInvoice
- ,@LastModUser_SaleInvoice
- ,@LastModDate_SaleInvoice
- ,@ID_Assessor
- ,@AssessDate_SaleInvoice
- ,@Amount_SaleInvoice
- ,@IncludeTax_SaleInvoice
- ,@GoodsAmount_SaleInvoice
- ,@TaxAmount_SaleInvoice
- )
- ">
- <Params>
- <Param name="@ID_SaleInvoice" type="SaleInvoice.ID_SaleInvoice" sourceColumn="ID_SaleInvoice" />
- <Param name="@No_SaleInvoice" type="SaleInvoice.No_SaleInvoice" sourceColumn="No_SaleInvoice" />
- <Param name="@Date_SaleInvoice" type="SaleInvoice.Date_SaleInvoice" sourceColumn="Date_SaleInvoice" />
- <Param name="@Type_SaleInvoice" type="SaleInvoice.Type_SaleInvoice" sourceColumn="Type_SaleInvoice" />
- <Param name="@PayDate_SaleInvoice" type="SaleInvoice.PayDate_SaleInvoice" sourceColumn="PayDate_SaleInvoice" />
- <Param name="@InvoiceDate_SaleInvoice" type="SaleInvoice.InvoiceDate_SaleInvoice" sourceColumn="InvoiceDate_SaleInvoice" />
- <Param name="@No_Invoice" type="SaleInvoice.No_Invoice" sourceColumn="No_Invoice" />
- <Param name="@ID_Customer" type="SaleInvoice.ID_Customer" sourceColumn="ID_Customer" />
- <Param name="@InvoiceAddress_SaleInvoice" type="SaleInvoice.InvoiceAddress_SaleInvoice" sourceColumn="InvoiceAddress_SaleInvoice" />
- <Param name="@InvoiceTitle_SaleInvoice" type="SaleInvoice.InvoiceTitle_SaleInvoice" sourceColumn="InvoiceTitle_SaleInvoice" />
- <Param name="@Bank_SaleInvoice" type="SaleInvoice.Bank_SaleInvoice" sourceColumn="Bank_SaleInvoice" />
- <Param name="@Account_SaleInvoice" type="SaleInvoice.Account_SaleInvoice" sourceColumn="Account_SaleInvoice" />
- <Param name="@Currency_SaleInvoice" type="SaleInvoice.Currency_SaleInvoice" sourceColumn="Currency_SaleInvoice" />
- <Param name="@ID_Creator" type="SaleInvoice.ID_Creator" sourceColumn="ID_Creator" />
- <Param name="@CreateDate_SaleInvoice" type="SaleInvoice.CreateDate_SaleInvoice" sourceColumn="CreateDate_SaleInvoice" />
- <Param name="@LastModUser_SaleInvoice" type="SaleInvoice.LastModUser_SaleInvoice" sourceColumn="LastModUser_SaleInvoice" />
- <Param name="@LastModDate_SaleInvoice" type="SaleInvoice.LastModDate_SaleInvoice" sourceColumn="LastModDate_SaleInvoice" />
- <Param name="@ID_Assessor" type="SaleInvoice.ID_Assessor" sourceColumn="ID_Assessor" />
- <Param name="@AssessDate_SaleInvoice" type="SaleInvoice.AssessDate_SaleInvoice" sourceColumn="AssessDate_SaleInvoice" />
- <Param name="@Amount_SaleInvoice" type="SaleInvoice.Amount_SaleInvoice" sourceColumn="Amount_SaleInvoice" />
- <Param name="@IncludeTax_SaleInvoice" type="SaleInvoice.IncludeTax_SaleInvoice" sourceColumn="IncludeTax_SaleInvoice" />
- <Param name="@GoodsAmount_SaleInvoice" type="SaleInvoice.GoodsAmount_SaleInvoice" sourceColumn="GoodsAmount_SaleInvoice" />
- <Param name="@TaxAmount_SaleInvoice" type="SaleInvoice.TaxAmount_SaleInvoice" sourceColumn="TaxAmount_SaleInvoice" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText=" UPDATE SaleInvoice
- SET No_SaleInvoice=@No_SaleInvoice
- ,Date_SaleInvoice=@Date_SaleInvoice
- ,Type_SaleInvoice=@Type_SaleInvoice
- ,PayDate_SaleInvoice=@PayDate_SaleInvoice
- ,InvoiceDate_SaleInvoice=@InvoiceDate_SaleInvoice
- ,No_Invoice=@No_Invoice
- ,ID_Customer=@ID_Customer
- ,InvoiceAddress_SaleInvoice=@InvoiceAddress_SaleInvoice
- ,InvoiceTitle_SaleInvoice=@InvoiceTitle_SaleInvoice
- ,Bank_SaleInvoice=@Bank_SaleInvoice
- ,Account_SaleInvoice=@Account_SaleInvoice
- ,Currency_SaleInvoice=@Currency_SaleInvoice
- ,ID_Creator=@ID_Creator
- ,CreateDate_SaleInvoice=@CreateDate_SaleInvoice
- ,LastModUser_SaleInvoice=@LastModUser_SaleInvoice
- ,LastModDate_SaleInvoice=@LastModDate_SaleInvoice
- ,ID_Assessor=@ID_Assessor
- ,AssessDate_SaleInvoice=@AssessDate_SaleInvoice
- ,Amount_SaleInvoice=@Amount_SaleInvoice
- ,IncludeTax_SaleInvoice=@IncludeTax_SaleInvoice
- ,GoodsAmount_SaleInvoice=@GoodsAmount_SaleInvoice
- ,TaxAmount_SaleInvoice=@TaxAmount_SaleInvoice
- WHERE ID_SaleInvoice=@ID_SaleInvoice
- ">
- <Params>
- <Param name="@ID_SaleInvoice" type="SaleInvoice.ID_SaleInvoice" sourceColumn="ID_SaleInvoice" />
- <Param name="@No_SaleInvoice" type="SaleInvoice.No_SaleInvoice" sourceColumn="No_SaleInvoice" />
- <Param name="@Date_SaleInvoice" type="SaleInvoice.Date_SaleInvoice" sourceColumn="Date_SaleInvoice" />
- <Param name="@Type_SaleInvoice" type="SaleInvoice.Type_SaleInvoice" sourceColumn="Type_SaleInvoice" />
- <Param name="@PayDate_SaleInvoice" type="SaleInvoice.PayDate_SaleInvoice" sourceColumn="PayDate_SaleInvoice" />
- <Param name="@InvoiceDate_SaleInvoice" type="SaleInvoice.InvoiceDate_SaleInvoice" sourceColumn="InvoiceDate_SaleInvoice" />
- <Param name="@No_Invoice" type="SaleInvoice.No_Invoice" sourceColumn="No_Invoice" />
- <Param name="@ID_Customer" type="SaleInvoice.ID_Customer" sourceColumn="ID_Customer" />
- <Param name="@InvoiceAddress_SaleInvoice" type="SaleInvoice.InvoiceAddress_SaleInvoice" sourceColumn="InvoiceAddress_SaleInvoice" />
- <Param name="@InvoiceTitle_SaleInvoice" type="SaleInvoice.InvoiceTitle_SaleInvoice" sourceColumn="InvoiceTitle_SaleInvoice" />
- <Param name="@Bank_SaleInvoice" type="SaleInvoice.Bank_SaleInvoice" sourceColumn="Bank_SaleInvoice" />
- <Param name="@Account_SaleInvoice" type="SaleInvoice.Account_SaleInvoice" sourceColumn="Account_SaleInvoice" />
- <Param name="@Currency_SaleInvoice" type="SaleInvoice.Currency_SaleInvoice" sourceColumn="Currency_SaleInvoice" />
- <Param name="@ID_Creator" type="SaleInvoice.ID_Creator" sourceColumn="ID_Creator" />
- <Param name="@CreateDate_SaleInvoice" type="SaleInvoice.CreateDate_SaleInvoice" sourceColumn="CreateDate_SaleInvoice" />
- <Param name="@LastModUser_SaleInvoice" type="SaleInvoice.LastModUser_SaleInvoice" sourceColumn="LastModUser_SaleInvoice" />
- <Param name="@LastModDate_SaleInvoice" type="SaleInvoice.LastModDate_SaleInvoice" sourceColumn="LastModDate_SaleInvoice" />
- <Param name="@ID_Assessor" type="SaleInvoice.ID_Assessor" sourceColumn="ID_Assessor" />
- <Param name="@AssessDate_SaleInvoice" type="SaleInvoice.AssessDate_SaleInvoice" sourceColumn="AssessDate_SaleInvoice" />
- <Param name="@Amount_SaleInvoice" type="SaleInvoice.Amount_SaleInvoice" sourceColumn="Amount_SaleInvoice" />
- <Param name="@IncludeTax_SaleInvoice" type="SaleInvoice.IncludeTax_SaleInvoice" sourceColumn="IncludeTax_SaleInvoice" />
- <Param name="@GoodsAmount_SaleInvoice" type="SaleInvoice.GoodsAmount_SaleInvoice" sourceColumn="GoodsAmount_SaleInvoice" />
- <Param name="@TaxAmount_SaleInvoice" type="SaleInvoice.TaxAmount_SaleInvoice" sourceColumn="TaxAmount_SaleInvoice" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText=" DELETE FROM SaleInvoiceProduct WHERE ID_SaleInvoice=@ID_SaleInvoice
- DELETE FROM SaleInvoice WHERE ID_SaleInvoice=@ID_SaleInvoice
- ">
- <Params>
- <Param name="@ID_SaleInvoice" type="SaleInvoice.ID_SaleInvoice" sourceColumn="ID_SaleInvoice" />
- </Params>
- </Delete>
- <Audit CmdType="Text" CmdText=" UPDATE Customer
- SET Customer.ToGetBalance_Customer = Customer.ToGetBalance_Customer+@Amount_SaleInvoice
- WHERE Customer.ID_Customer=@ID_Customer
- DECLARE @No_SaleBill NVARCHAR(64)
- DECLARE CUR CURSOR
- FOR
- SELECT No_FromBill
- FROM SaleInvoiceProduct
- WHERE ID_SaleInvoice=@ID_SaleInvoice
- OPEN CUR
- FETCH NEXT FROM CUR INTO @No_SaleBill
- WHILE @@FETCH_STATUS=0
- BEGIN
- UPDATE SaleBill SET Assess_SaleBill=1 WHERE No_SaleBill=@No_SaleBill
- UPDATE SaleRtnBill SET Assess_SaleRtnBill=1 WHERE No_SaleRtnBill=@No_SaleBill
- FETCH NEXT FROM CUR INTO @No_SaleBill
- END
- DEALLOCATE CUR
-
- UPDATE SaleInvoice SET ID_Assessor=@ID_Assessor,AssessDate_SaleInvoice=@AssessDate_SaleInvoice WHERE ID_SaleInvoice=@ID_SaleInvoice
-
- ">
- <Params>
- <Param name="@ID_SaleInvoice" type="SaleInvoice.ID_SaleInvoice" sourceColumn="ID_SaleInvoice"/>
- <Param name="@ID_Assessor" type="SaleInvoice.ID_Assessor" sourceColumn="ID_Assessor"/>
- <Param name="@ID_Customer" type="SaleInvoice.ID_Customer" sourceColumn="ID_Customer"/>
- <Param name="@AssessDate_SaleInvoice" type="SaleInvoice.AssessDate_SaleInvoice" sourceColumn="AssessDate_SaleInvoice"/>
- <Param name="@Amount_SaleInvoice" type="SaleInvoice.Amount_SaleInvoice" sourceColumn="Amount_SaleInvoice" />
- </Params>
- </Audit>
- <Blank CmdType="Text" CmdText="
- UPDATE Customer
- SET ToGetBalance_Customer = ToGetBalance_Customer-@Amount_SaleInvoice
- WHERE ID_Customer=@ID_Customer
-
- DECLARE @No_SaleBill NVARCHAR(64)
- DECLARE CUR CURSOR
- FOR
- SELECT No_FromBill
- FROM SaleInvoiceProduct
- WHERE ID_SaleInvoice=@ID_SaleInvoice
- OPEN CUR
- FETCH NEXT FROM CUR INTO @No_SaleBill
- WHILE @@FETCH_STATUS=0
- BEGIN
- UPDATE SaleBill SET Assess_SaleBill=0 WHERE No_SaleBill=@No_SaleBill
- UPDATE SaleRtnBill SET Assess_SaleRtnBill=0 WHERE No_SaleRtnBill=@No_SaleBill
- FETCH NEXT FROM CUR INTO @No_SaleBill
- END
- DEALLOCATE CUR
-
- UPDATE SaleInvoice
- SET Disable_SaleInvoice=@Disable_SaleInvoice
- Where ID_SaleInvoice=@ID_SaleInvoice
- ">
- <Params>
- <Param name="@ID_SaleInvoice" type="SaleInvoice.ID_SaleInvoice" sourceColumn="ID_SaleInvoice" />
- <Param name="@No_SaleInvoice" type="SaleInvoice.No_SaleInvoice" sourceColumn="No_SaleInvoice" />
- <Param name="@ID_Customer" type="SaleInvoice.ID_Customer" sourceColumn="ID_Customer"/>
- <Param name="@Disable_SaleInvoice" type="SaleInvoice.Disable_SaleInvoice" sourceColumn="Disable_SaleInvoice"/>
- <Param name="@Amount_SaleInvoice" type="SaleInvoice.Amount_SaleInvoice" sourceColumn="Amount_SaleInvoice" />
- <Param name="@StrikedAmount_SaleInvoice" type="SaleInvoice.StrikedAmount_SaleInvoice" sourceColumn="StrikedAmount_SaleInvoice" />
- </Params>
- </Blank>
- </Table>
- <Table name="SaleInvoiceProduct" Type="Child">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 SaleInvoiceProduct.*,
- convert(nvarchar(64),'') As Name_BillType
- ,Product.No_Product
- ,Product.Name_Product
- ,Product.InvoiceName_Product
- ,Product.Unit_Product
- ,convert(bit,0) AS Negative
- ,Convert(nvarchar(64),'') As No_Customer
- ,Convert(nvarchar(64),'') As ShortName_Customer
- FROM SaleInvoiceProduct
- LEFT JOIN Product On Product.ID_Product=SaleInvoiceProduct.ID_Product
- ">
- </GetSchema>
- <New CmdType="Text" CmdText=" INSERT INTO SaleInvoiceProduct(ID_SaleInvoiceProduct
- ,ID_SaleInvoice
- ,Type_FromBill
- ,No_FromBill
- ,No_FromBillProduct
- ,ID_Product
- ,Quantity_SaleInvoiceProduct
- ,UnitPrice_SaleInvoiceProduct
- ,TaxRate_SaleInvoiceProduct
- ,Comment_SaleInvoiceProduct
- ,Amount_SaleInvoiceProduct
- ,TaxAmount_SaleInvoiceProduct
- ,GoodsAmount_SaleInvoiceProduct
- ,TaxCurrency_SaleInvoiceProduct)
-
- Values(@ID_SaleInvoiceProduct
- ,@ID_SaleInvoice
- ,@Type_FromBill
- ,@No_FromBill
- ,@No_FromBillProduct
- ,@ID_Product
- ,@Quantity_SaleInvoiceProduct
- ,@UnitPrice_SaleInvoiceProduct
- ,@TaxRate_SaleInvoiceProduct
- ,@Comment_SaleInvoiceProduct
- ,@Amount_SaleInvoiceProduct
- ,@TaxAmount_SaleInvoiceProduct
- ,@GoodsAmount_SaleInvoiceProduct
- ,@TaxCurrency_SaleInvoiceProduct)
- ">
- <Params>
- <Param name="@ID_SaleInvoiceProduct" type="SaleInvoiceProduct.ID_SaleInvoiceProduct" sourceColumn="ID_SaleInvoiceProduct" />
- <Param name="@ID_SaleInvoice" type="SaleInvoiceProduct.ID_SaleInvoice" sourceColumn="ID_SaleInvoice" />
- <Param name="@Type_FromBill" type="SaleInvoiceProduct.Type_FromBill" sourceColumn="Type_FromBill" />
- <Param name="@No_FromBill" type="SaleInvoiceProduct.No_FromBill" sourceColumn="No_FromBill" />
- <Param name="@No_FromBillProduct" type="SaleInvoiceProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
- <Param name="@ID_Product" type="SaleInvoiceProduct.ID_Product" sourceColumn="ID_Product" />
- <Param name="@Quantity_SaleInvoiceProduct" type="SaleInvoiceProduct.Quantity_SaleInvoiceProduct" sourceColumn="Quantity_SaleInvoiceProduct" />
- <Param name="@UnitPrice_SaleInvoiceProduct" type="SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct" sourceColumn="UnitPrice_SaleInvoiceProduct" />
- <Param name="@TaxRate_SaleInvoiceProduct" type="SaleInvoiceProduct.TaxRate_SaleInvoiceProduct" sourceColumn="TaxRate_SaleInvoiceProduct" />
- <Param name="@Comment_SaleInvoiceProduct" type="SaleInvoiceProduct.Comment_SaleInvoiceProduct" sourceColumn="Comment_SaleInvoiceProduct" />
- <Param name="@Amount_SaleInvoiceProduct" type="SaleInvoiceProduct.Amount_SaleInvoiceProduct" sourceColumn="Amount_SaleInvoiceProduct" />
- <Param name="@TaxAmount_SaleInvoiceProduct" type="SaleInvoiceProduct.TaxAmount_SaleInvoiceProduct" sourceColumn="TaxAmount_SaleInvoiceProduct" />
- <Param name="@GoodsAmount_SaleInvoiceProduct" type="SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct" sourceColumn="GoodsAmount_SaleInvoiceProduct" />
- <Param name="@TaxCurrency_SaleInvoiceProduct" type="SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct" sourceColumn="TaxCurrency_SaleInvoiceProduct" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText=" UPDATE SaleInvoiceProduct
- SET ID_SaleInvoice=@ID_SaleInvoice
- ,Type_FromBill=@Type_FromBill
- ,No_FromBill=@No_FromBill
- ,No_FromBillProduct=@No_FromBillProduct
- ,ID_Product=@ID_Product
- ,Quantity_SaleInvoiceProduct=@Quantity_SaleInvoiceProduct
- ,UnitPrice_SaleInvoiceProduct=@UnitPrice_SaleInvoiceProduct
- ,TaxRate_SaleInvoiceProduct=@TaxRate_SaleInvoiceProduct
- ,Comment_SaleInvoiceProduct=@Comment_SaleInvoiceProduct
- ,Amount_SaleInvoiceProduct=@Amount_SaleInvoiceProduct
- ,TaxAmount_SaleInvoiceProduct=@TaxAmount_SaleInvoiceProduct
- ,GoodsAmount_SaleInvoiceProduct=@GoodsAmount_SaleInvoiceProduct
- ,TaxCurrency_SaleInvoiceProduct=@TaxCurrency_SaleInvoiceProduct
- WHERE ID_SaleInvoiceProduct=@ID_SaleInvoiceProduct
- ">
- <Params>
- <Param name="@ID_SaleInvoiceProduct" type="SaleInvoiceProduct.ID_SaleInvoiceProduct" sourceColumn="ID_SaleInvoiceProduct" />
- <Param name="@ID_SaleInvoice" type="SaleInvoiceProduct.ID_SaleInvoice" sourceColumn="ID_SaleInvoice" />
- <Param name="@Type_FromBill" type="SaleInvoiceProduct.Type_FromBill" sourceColumn="Type_FromBill" />
- <Param name="@No_FromBill" type="SaleInvoiceProduct.No_FromBill" sourceColumn="No_FromBill" />
- <Param name="@No_FromBillProduct" type="SaleInvoiceProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
- <Param name="@ID_Product" type="SaleInvoiceProduct.ID_Product" sourceColumn="ID_Product" />
- <Param name="@Quantity_SaleInvoiceProduct" type="SaleInvoiceProduct.Quantity_SaleInvoiceProduct" sourceColumn="Quantity_SaleInvoiceProduct" />
- <Param name="@UnitPrice_SaleInvoiceProduct" type="SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct" sourceColumn="UnitPrice_SaleInvoiceProduct" />
- <Param name="@TaxRate_SaleInvoiceProduct" type="SaleInvoiceProduct.TaxRate_SaleInvoiceProduct" sourceColumn="TaxRate_SaleInvoiceProduct" />
- <Param name="@Comment_SaleInvoiceProduct" type="SaleInvoiceProduct.Comment_SaleInvoiceProduct" sourceColumn="Comment_SaleInvoiceProduct" />
- <Param name="@Amount_SaleInvoiceProduct" type="SaleInvoiceProduct.Amount_SaleInvoiceProduct" sourceColumn="Amount_SaleInvoiceProduct" />
- <Param name="@TaxAmount_SaleInvoiceProduct" type="SaleInvoiceProduct.TaxAmount_SaleInvoiceProduct" sourceColumn="TaxAmount_SaleInvoiceProduct" />
- <Param name="@GoodsAmount_SaleInvoiceProduct" type="SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct" sourceColumn="GoodsAmount_SaleInvoiceProduct" />
- <Param name="@TaxCurrency_SaleInvoiceProduct" type="SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct" sourceColumn="TaxCurrency_SaleInvoiceProduct" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText=" DELETE FROM SaleInvoiceProduct WHERE ID_SaleInvoiceProduct=@ID_SaleInvoiceProduct">
- <Params>
- <Param name="@ID_SaleInvoiceProduct" type="SaleInvoiceProduct.ID_SaleInvoiceProduct" sourceColumn="ID_SaleInvoiceProduct" />
- </Params>
- </Delete>
- </Table>
- </Tables>
- <Search>
- <SearchAllBill CmdType="Text" CmdText=" SELECT SaleInvoice.*,a.Name_User As Creator ,b.Name_User As Assessor
- ,c.Name_User As LastModUser,Customer.No_Customer,Customer.ShortName_Customer
- ,Customer.RevenueRegisterNo_Customer,Customer.Bank_Customer,Customer.Account_Customer
- ,Customer.GetMethod_Customer,convert(nvarchar(64),'') As TypeName,Customer.Company_Customer
- FROM SaleInvoice
-
- LEFT JOIN AppUser a ON SaleInvoice.ID_Creator=a.ID_User
- LEFT JOIN AppUser b ON SaleInvoice.ID_Assessor=b.ID_User
- LEFT JOIN AppUser c ON SaleInvoice.LastModUser_SaleInvoice=c.ID_User
- Left JOIN Customer On Customer.ID_Customer=SaleInvoice.ID_Customer">
- <Tables>
- <Table name="AllBill" />
- </Tables>
- </SearchAllBill>
- <SearchAllCustomer CmdType="Text" CmdText="SELECT Customer.No_Customer,Customer.ShortName_Customer
- ,Customer.Type_Customer,Customer.Level_Customer,Customer.IsGeneric_Customer
- FROM Customer ">
- <Tables>
- <Table name="AllCustomer" />
- </Tables>
- </SearchAllCustomer>
- <SearchAllProduct CmdType="Text" CmdText="SELECT Product.No_Product,Product.Name_Product FROM Product ">
- <Tables>
- <Table name="AllProduct" />
- </Tables>
- </SearchAllProduct>
- <SearchCustomer CmdType="Text" CmdText=" SELECT Top 1 Customer.ID_Customer,ShortName_Customer,RevenueRegisterNo_Customer
- ,Bank_Customer,Account_Customer,GetMethod_Customer,SuspendDate_Customer
- ,DunDate_Customer,Title_Invoice ,Address_Invoice,Company_Customer
- From Customer
- Left Join Invoice On Invoice.ID_Customer = Customer.ID_Customer And Invoice.Common_Invoice = 1
- WHERE No_Customer=@No_Customer
- And IsCustomersCustomer_Customer = 0
- ">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="Customer"/>
- </Tables>
- </SearchCustomer>
- <SearchInvoiceTitle CmdType="Text" CmdText=" SELECT Title_Invoice FROM Invoice WHERE ID_Customer=@ID_Customer">
- <Params>
- <Param name="@ID_Customer" type="Customer.ID_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="InvoiceTitle"/>
- </Tables>
- </SearchInvoiceTitle>
- <SearchInvoiceAddress CmdType="Text" CmdText=" SELECT Address_Invoice FROM Invoice WHERE ID_Customer=@ID_Customer">
- <Params>
- <Param name="@ID_Customer" type="Customer.ID_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="InvoiceAddress"/>
- </Tables>
- </SearchInvoiceAddress>
- <SearchBank CmdType="Text" CmdText="SELECT Name_TypeDef FROM TypeDef WHERE Type_TypeDef = 6">
- <Tables>
- <Table name="Bank" />
- </Tables>
- </SearchBank>
- <SearchCompany CmdType="Text" CmdText="SELECT Name_TypeDef FROM TypeDef WHERE Type_TypeDef = 30">
- <Tables>
- <Table name="Company" />
- </Tables>
- </SearchCompany>
- <SearchSaleBill CmdType="Text" CmdText="SELECT SaleBill.InvoiceAddress_Company,SaleBill.InvoiceTitle_Company
- ,ID_Assessor,ID_Customer,ID_Product,TaxCurrency_SaleBill
- FROM SaleBill
- Join SaleBillProduct On SaleBillProduct.ID_SaleBill=SaleBill.ID_SaleBill
- WHERE No_SaleBill=@No_SaleBill AND No_SaleBillProduct=@No_SaleBillProduct
- ">
- <Params>
- <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" Index="0" />
- <Param name="@No_SaleBillProduct" type="SaleBillProduct.No_SaleBillProduct" Index="1" />
- </Params>
- <Tables>
- <Table name="SaleBill"/>
- </Tables>
- </SearchSaleBill>
- <SearchSaleRtnBill CmdType="Text" CmdText=" SELECT ID_Assessor,ID_Customer,ID_Product,SaleRtnBill.TaxCurrency_SaleRtnBill
- FROM SaleRtnBillProduct
- LEFT JOIN SaleRtnBill On SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
- WHERE No_SaleRtnBill=@No_SaleRtnBill AND No_SaleRtnBillProduct=@No_SaleRtnBillProduct
- ">
- <Params>
- <Param name="@No_SaleRtnBill" type="SaleRtnBill.No_SaleRtnBill" Index="0" />
- <Param name="@No_SaleRtnBillProduct" type="SaleRtnBillProduct.No_SaleRtnBillProduct" Index="1" />
- </Params>
- <Tables>
- <Table name="SaleRtnBill"/>
- </Tables>
- </SearchSaleRtnBill>
- <SearchSaleBillProduct CmdType="Text" CmdText="SELECT SaleBill.TaxCurrency_SaleBill
- ,SaleBillProduct.ID_Product
- ,SaleBillProduct.Quantity_SaleBillProduct
- ,SaleBillProduct.UnitPrice_SaleBillProduct
- ,SaleBillProduct.Discount_SaleBillProduct
- ,Product.No_Product
- ,Product.Name_Product
- ,Product.InvoiceName_Product
- ,Product.Unit_Product
- ,Customer.No_Customer
- ,Customer.ShortName_Customer
- FROM SaleBillProduct
-
- LEFT JOIN SaleBill On SaleBill.ID_SaleBill=SaleBillProduct.ID_SaleBill
- LEFT JOIN Product On Product.ID_Product=SaleBillProduct.ID_Product
- Left join Customer on Customer.ID_Customer = SaleBill.ID_Customer
- WHERE No_SaleBill=@No_SaleBill
- AND No_SaleBillProduct=@No_SaleBillProduct
- ">
- <Params>
- <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" Index="0" />
- <Param name="@No_SaleBillProduct" type="SaleBillProduct.No_SaleBillProduct" Index="1" />
- </Params>
- <Tables>
- <Table name="SaleBillProduct"/>
- </Tables>
- </SearchSaleBillProduct>
- <SearchSaleRtnBillProduct CmdType="Text" CmdText=" SELECT SaleRtnBill.TaxCurrency_SaleRtnBill
- ,SaleRtnBillProduct.ID_Product
- ,SaleRtnBillProduct.Quantity_SaleRtnBillProduct
- ,SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct
- ,Product.No_Product
- ,Product.Name_Product
- ,Product.InvoiceName_Product
- ,Product.Unit_Product
- ,Customer.No_Customer
- ,Customer.ShortName_Customer
- FROM SaleRtnBillProduct
-
- LEFT JOIN SaleRtnBill On SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
- LEFT JOIN Product On Product.ID_Product=SaleRtnBillProduct.ID_Product
- Left join Customer on Customer.ID_Customer = SaleRtnBill.ID_Customer
- WHERE No_SaleRtnBill=@No_SaleRtnBill AND No_SaleRtnBillProduct=@No_SaleRtnBillProduct
- ">
- <Params>
- <Param name="@No_SaleRtnBill" type="SaleRtnBill.No_SaleRtnBill" Index="0" />
- <Param name="@No_SaleRtnBillProduct" type="SaleRtnBillProduct.No_SaleRtnBillProduct" Index="1" />
- </Params>
- <Tables>
- <Table name="SaleRtnBillProduct"/>
- </Tables>
- </SearchSaleRtnBillProduct>
- <SearchProduct CmdType="Text" CmdText=" SELECT Product.ID_Product,Product.Name_Product,Product.InvoiceName_Product
- ,Product.Unit_Product,Product.Price_Product
- FROM Product
- WHERE No_Product=@No_Product
- ">
- <Params>
- <Param name="@No_Product" type="Product.No_Product" Index="0" />
- </Params>
- <Tables>
- <Table name="Product"/>
- </Tables>
- </SearchProduct>
- <SearchCessOut CmdType="Text" CmdText="SELECT CessOut_SystemSetting,SysCurrency_SystemSetting,PriceDecimal_SystemSetting From SystemSetting">
- <Tables>
- <Table name="SystemSetting"/>
- </Tables>
- </SearchCessOut>
- <SearchSaleInvoiceWithNo CmdType="Text" CmdText=" SELECT SaleInvoice.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser
- ,Customer.No_Customer,Customer.ShortName_Customer,Customer.RevenueRegisterNo_Customer
- ,Customer.Bank_Customer,Customer.Account_Customer,Customer.GetMethod_Customer
- ,Customer.Company_Customer
- ,TypeName=CASE Type_SaleInvoice When 0 Then '普通发票' ELSE '增值税发票' End
- ,Convert(DateTime,getdate()) as StartDate
- ,Convert(DateTime,getdate()) as EndDate
- ,Convert(bit,0) as ckRtn
- FROM SaleInvoice
- LEFT JOIN AppUser a ON SaleInvoice.ID_Creator=a.ID_User
- LEFT JOIN AppUser b ON SaleInvoice.ID_Assessor=b.ID_User
- LEFT JOIN AppUser c ON SaleInvoice.LastModUser_SaleInvoice=c.ID_User
- Left JOIN Customer On Customer.ID_Customer=SaleInvoice.ID_Customer
- WHERE No_SaleInvoice=@No_SaleInvoice
-
- SELECT SaleInvoiceProduct.*
- ,Product.No_Product,Product.Name_Product
- ,Product.InvoiceName_Product
- ,Product.Unit_Product,BillType.Name_BillType
- ,A.No_Customer As No_Customer
- ,A.ShortName_Customer As ShortName_Customer
- FROM SaleInvoiceProduct
-
- LEFT JOIN Product On Product.ID_Product=SaleInvoiceProduct.ID_Product
- LEFT JOIN SaleInvoice On SaleInvoice.ID_SaleInvoice=SaleInvoiceProduct.ID_SaleInvoice
- LEFT JOIN BillType On BillType.Value_BillType=SaleInvoiceProduct.Type_FromBill
- Left Join (select No_SaleBill As No_Bill
- ,Customer.No_Customer As No_Customer
- ,Customer.ShortName_Customer As ShortName_Customer
- From SaleBill
- Left join Customer on Customer.ID_Customer=SaleBill.ID_Customer
- Where ID_Assessor Is Not Null
- Union All
- select No_SaleRtnBill As No_Bill
- ,Customer.No_Customer As No_Customer
- ,Customer.ShortName_Customer As ShortName_Customer
- From SaleRtnBill
- Left join Customer on Customer.ID_Customer=SaleRtnBill.ID_Customer
- Where ID_Assessor Is Not Null) A On A.No_Bill = SaleInvoiceProduct.No_FromBill
- WHERE No_SaleInvoice=@No_SaleInvoice
- ">
- <Params>
- <Param name="@No_SaleInvoice" type="SaleInvoice.No_SaleInvoice" Index="0" />
- </Params>
- <Tables>
- <Table name="SaleInvoice"/>
- <Table name="SaleInvoiceProduct"/>
- </Tables>
- </SearchSaleInvoiceWithNo>
- <SearchInvoiceNo CmdType="Text" CmdText="Select * From SaleInvoice Where No_Invoice=@No_Invoice And No_SaleInvoice!=@No_SaleInvoice">
- <Params>
- <Param name="@No_Invoice" type="SaleInvoice.No_Invoice" Index="0" />
- <Param name="@No_SaleInvoice" type="SaleInvoice.No_SaleInvoice" Index="1" />
- </Params>
- <Tables>
- <Table name="SaleInvoiceNo"/>
- </Tables>
- </SearchInvoiceNo>
- <SearchBillType CmdType="Text" CmdText=" SELECT * FROM BillType WHERE Value_BillType = 21 OR Value_BillType = 0 OR Value_BillType = 22 ORDER BY Value_BillType">
- <Tables>
- <Table name="BillType" />
- </Tables>
- </SearchBillType>
-
- <SearchCurrency CmdType="Text" CmdText=" CREATE TABLE GetTaxCurrency
- (
- [Type] nvarchar(64)
- )
- INSERT INTO GetTaxCurrency VALUES ('外加')
- INSERT INTO GetTaxCurrency VALUES ('内含')
- SELECT Type AS TaxCurrency_SaleInvoiceProduct FROM GetTaxCurrency
- DROP TABLE GetTaxCurrency
- ">
- <Tables>
- <Table name="GetTaxCurrency" />
- </Tables>
- </SearchCurrency>
- <SearchSaleInvoiceFirst CmdType="Text" CmdText="DECLARE @ID_SaleInvoice UNIQUEIDENTIFIER
- SELECT TOP 1 @ID_SaleInvoice=ID_SaleInvoice
- FROM SaleInvoice ORDER BY No_SaleInvoice
- SELECT SaleInvoice.*,a.Name_User As Creator ,b.Name_User As Assessor
- ,c.Name_User As LastModUser,Customer.No_Customer,Customer.ShortName_Customer
- ,Customer.RevenueRegisterNo_Customer,Customer.Bank_Customer
- ,Customer.Account_Customer,Customer.GetMethod_Customer
- ,Customer.Company_Customer
- ,TypeName=CASE Type_SaleInvoice When 0 Then '普通发票' ELSE '增值税发票' End
- FROM SaleInvoice
- LEFT JOIN AppUser a ON SaleInvoice.ID_Creator=a.ID_User
- LEFT JOIN AppUser b ON SaleInvoice.ID_Assessor=b.ID_User
- LEFT JOIN AppUser c ON SaleInvoice.LastModUser_SaleInvoice=c.ID_User
- Left JOIN Customer On Customer.ID_Customer=SaleInvoice.ID_Customer
- WHERE ID_SaleInvoice=@ID_SaleInvoice
- SELECT SaleInvoiceProduct.*
- ,Product.No_Product,Product.Name_Product
- ,Product.InvoiceName_Product
- ,Product.Unit_Product,BillType.Name_BillType
- ,A.No_Customer As No_Customer
- ,A.ShortName_Customer As ShortName_Customer
- FROM SaleInvoiceProduct
- LEFT JOIN Product On Product.ID_Product=SaleInvoiceProduct.ID_Product
- LEFT JOIN BillType On BillType.Value_BillType=SaleInvoiceProduct.Type_FromBill
- Left Join (select No_SaleBill As No_Bill
- ,Customer.No_Customer As No_Customer
- ,Customer.ShortName_Customer As ShortName_Customer
- From SaleBill
- Left join Customer on Customer.ID_Customer=SaleBill.ID_Customer
- Where ID_Assessor Is Not Null
- Union All
- select No_SaleRtnBill As No_Bill
- ,Customer.No_Customer As No_Customer
- ,Customer.ShortName_Customer As ShortName_Customer
- From SaleRtnBill
- Left join Customer on Customer.ID_Customer=SaleRtnBill.ID_Customer
- Where ID_Assessor Is Not Null) A On A.No_Bill = SaleInvoiceProduct.No_FromBill
- WHERE ID_SaleInvoice=@ID_SaleInvoice
- ">
- <Tables>
- <Table name="SaleInvoice"/>
- <Table name="SaleInvoiceProduct"/>
- </Tables>
- </SearchSaleInvoiceFirst>
- <SearchSaleInvoiceLast CmdType="Text" CmdText=" DECLARE @ID_SaleInvoice UNIQUEIDENTIFIER
- SELECT TOP 1 @ID_SaleInvoice=ID_SaleInvoice
- FROM SaleInvoice ORDER BY No_SaleInvoice DESC
- SELECT SaleInvoice.*,a.Name_User As Creator ,b.Name_User As Assessor
- ,c.Name_User As LastModUser,Customer.No_Customer,Customer.ShortName_Customer
- ,Customer.RevenueRegisterNo_Customer,Customer.Bank_Customer
- ,Customer.Account_Customer,Customer.GetMethod_Customer
- ,Customer.Company_Customer
- ,TypeName=CASE Type_SaleInvoice When 0 Then '普通发票' ELSE '增值税发票' End
- FROM SaleInvoice
- LEFT JOIN AppUser a ON SaleInvoice.ID_Creator=a.ID_User
- LEFT JOIN AppUser b ON SaleInvoice.ID_Assessor=b.ID_User
- LEFT JOIN AppUser c ON SaleInvoice.LastModUser_SaleInvoice=c.ID_User
- Left JOIN Customer On Customer.ID_Customer=SaleInvoice.ID_Customer
- WHERE ID_SaleInvoice=@ID_SaleInvoice
- SELECT SaleInvoiceProduct.*
- ,Product.No_Product,Product.Name_Product
- ,Product.InvoiceName_Product
- ,Product.Unit_Product,BillType.Name_BillType
- ,A.No_Customer As No_Customer
- ,A.ShortName_Customer As ShortName_Customer
- FROM SaleInvoiceProduct
- LEFT JOIN Product On Product.ID_Product=SaleInvoiceProduct.ID_Product
- LEFT JOIN BillType On BillType.Value_BillType=SaleInvoiceProduct.Type_FromBill
- Left Join (select No_SaleBill As No_Bill
- ,Customer.No_Customer As No_Customer
- ,Customer.ShortName_Customer As ShortName_Customer
- From SaleBill
- Left join Customer on Customer.ID_Customer=SaleBill.ID_Customer
- Where ID_Assessor Is Not Null
- Union All
- select No_SaleRtnBill As No_Bill
- ,Customer.No_Customer As No_Customer
- ,Customer.ShortName_Customer As ShortName_Customer
- From SaleRtnBill
- Left join Customer on Customer.ID_Customer=SaleRtnBill.ID_Customer
- Where ID_Assessor Is Not Null) A On A.No_Bill = SaleInvoiceProduct.No_FromBill
- WHERE ID_SaleInvoice=@ID_SaleInvoice
- ">
- <Tables>
- <Table name="SaleInvoice"/>
- <Table name="SaleInvoiceProduct"/>
- </Tables>
- </SearchSaleInvoiceLast>
- <SearchSaleInvoicePrevious CmdType="Text" CmdText=" DECLARE @ID_SaleInvoice UNIQUEIDENTIFIER
- SELECT TOP 1 @ID_SaleInvoice=ID_SaleInvoice FROM SaleInvoice
- WHERE No_SaleInvoice < @No_SaleInvoice
- ORDER BY No_SaleInvoice DESC
- SELECT SaleInvoice.*,a.Name_User As Creator ,b.Name_User As Assessor
- ,c.Name_User As LastModUser,Customer.No_Customer,Customer.ShortName_Customer
- ,Customer.RevenueRegisterNo_Customer,Customer.Bank_Customer
- ,Customer.Account_Customer,Customer.GetMethod_Customer
- ,Customer.Company_Customer
- ,TypeName=CASE Type_SaleInvoice When 0 Then '普通发票' ELSE '增值税发票' End
- FROM SaleInvoice
- LEFT JOIN AppUser a ON SaleInvoice.ID_Creator=a.ID_User
- LEFT JOIN AppUser b ON SaleInvoice.ID_Assessor=b.ID_User
- LEFT JOIN AppUser c ON SaleInvoice.LastModUser_SaleInvoice=c.ID_User
- Left JOIN Customer On Customer.ID_Customer=SaleInvoice.ID_Customer
- WHERE ID_SaleInvoice=@ID_SaleInvoice
- SELECT SaleInvoiceProduct.*
- ,Product.No_Product,Product.Name_Product
- ,Product.InvoiceName_Product
- ,Product.Unit_Product,BillType.Name_BillType
- ,A.No_Customer As No_Customer
- ,A.ShortName_Customer As ShortName_Customer
- FROM SaleInvoiceProduct
- LEFT JOIN Product On Product.ID_Product=SaleInvoiceProduct.ID_Product
- LEFT JOIN BillType On BillType.Value_BillType=SaleInvoiceProduct.Type_FromBill
- Left Join (select No_SaleBill As No_Bill
- ,Customer.No_Customer As No_Customer
- ,Customer.ShortName_Customer As ShortName_Customer
- From SaleBill
- Left join Customer on Customer.ID_Customer=SaleBill.ID_Customer
- Where ID_Assessor Is Not Null
- Union All
- select No_SaleRtnBill As No_Bill
- ,Customer.No_Customer As No_Customer
- ,Customer.ShortName_Customer As ShortName_Customer
- From SaleRtnBill
- Left join Customer on Customer.ID_Customer=SaleRtnBill.ID_Customer
- Where ID_Assessor Is Not Null) A On A.No_Bill = SaleInvoiceProduct.No_FromBill
- WHERE ID_SaleInvoice=@ID_SaleInvoice
- ">
- <Params>
- <Param name="@No_SaleInvoice" type="SaleInvoice.No_SaleInvoice" Index="0" />
- </Params>
- <Tables>
- <Table name="SaleInvoice"/>
- <Table name="SaleInvoiceProduct"/>
- </Tables>
- </SearchSaleInvoicePrevious>
- <SearchSaleInvoiceNext CmdType="Text" CmdText=" DECLARE @ID_SaleInvoice UNIQUEIDENTIFIER
- SELECT TOP 1 @ID_SaleInvoice=ID_SaleInvoice FROM SaleInvoice
- WHERE No_SaleInvoice > @No_SaleInvoice
- ORDER BY No_SaleInvoice
- SELECT SaleInvoice.*,a.Name_User As Creator ,b.Name_User As Assessor
- ,c.Name_User As LastModUser,Customer.No_Customer,Customer.ShortName_Customer
- ,Customer.RevenueRegisterNo_Customer,Customer.Bank_Customer
- ,Customer.Account_Customer,Customer.GetMethod_Customer
- ,Customer.Company_Customer
- ,TypeName=CASE Type_SaleInvoice When 0 Then '普通发票' ELSE '增值税发票' End
- FROM SaleInvoice
- LEFT JOIN AppUser a ON SaleInvoice.ID_Creator=a.ID_User
- LEFT JOIN AppUser b ON SaleInvoice.ID_Assessor=b.ID_User
- LEFT JOIN AppUser c ON SaleInvoice.LastModUser_SaleInvoice=c.ID_User
- Left JOIN Customer On Customer.ID_Customer=SaleInvoice.ID_Customer
- WHERE ID_SaleInvoice=@ID_SaleInvoice
- SELECT SaleInvoiceProduct.*
- ,Product.No_Product,Product.Name_Product
- ,Product.InvoiceName_Product
- ,Product.Unit_Product,BillType.Name_BillType
- ,A.No_Customer As No_Customer
- ,A.ShortName_Customer As ShortName_Customer
- FROM SaleInvoiceProduct
- LEFT JOIN Product On Product.ID_Product=SaleInvoiceProduct.ID_Product
- LEFT JOIN BillType On BillType.Value_BillType=SaleInvoiceProduct.Type_FromBill
- Left Join (select No_SaleBill As No_Bill
- ,Customer.No_Customer As No_Customer
- ,Customer.ShortName_Customer As ShortName_Customer
- From SaleBill
- Left join Customer on Customer.ID_Customer=SaleBill.ID_Customer
- Where ID_Assessor Is Not Null
- Union All
- select No_SaleRtnBill As No_Bill
- ,Customer.No_Customer As No_Customer
- ,Customer.ShortName_Customer As ShortName_Customer
- From SaleRtnBill
- Left join Customer on Customer.ID_Customer=SaleRtnBill.ID_Customer
- Where ID_Assessor Is Not Null) A On A.No_Bill = SaleInvoiceProduct.No_FromBill
- WHERE ID_SaleInvoice=@ID_SaleInvoice
- ">
- <Params>
- <Param name="@No_SaleInvoice" type="SaleInvoice.No_SaleInvoice" Index="0" />
- </Params>
- <Tables>
- <Table name="SaleInvoice"/>
- <Table name="SaleInvoiceProduct"/>
- </Tables>
- </SearchSaleInvoiceNext>
- <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>
- <SearchContr CmdType="Text" CmdText=" SELECT SystemSetting.SaleBackAndInDepot_SystemSetting
- FROM SystemSetting
- WHERE SystemSetting.SaleBackAndInDepot_SystemSetting = 1">
- <Tables>
- <Table name="SystemSaleAndOutDepot" />
- </Tables>
- </SearchContr>
- <SearchAllSaleBill CmdType="Text" CmdText="Select SaleBill.Currency_SaleBill ,SaleBill.TaxCurrency_SaleBill
- ,SaleBill.ID_SaleBill,SaleBill.No_SaleBill,SaleBill.Date_SaleBill
- ,Customer.No_Customer,Customer.ShortName_Customer
- ,Case When SaleBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_SaleBill
- ,Location.Name_Location,SaleBill.InvoiceAddress_Company,SaleBill.InvoiceTitle_Company
- From SaleBill
- Inner Join Customer On SaleBill.ID_Customer = Customer.ID_Customer
- Inner Join Location On Location.ID_Location = SaleBill.ID_Location" >
- <Tables>
- <Table name="AllSaleBill" />
- </Tables>
- </SearchAllSaleBill>
- <SearchAllSaleBillProduct CmdType="Text" CmdText="Select SaleBill.No_SaleBill,Product.No_Product,SaleBillProduct.No_SaleBillProduct
- ,Product.Name_Product,SaleBillProduct.Quantity_SaleBillProduct
- ,SaleBillProduct.UnitPrice_SaleBillProduct,SaleBill.TaxCurrency_SaleBill
- 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>
- <SearchAllSaleRtnBill CmdType="Text" CmdText="Select SaleRtnBill.ID_SaleRtnBill,SaleRtnBill.No_SaleRtnBill
- ,SaleRtnBill.Date_SaleRtnBill,Customer.No_Customer,Customer.ShortName_Customer
- ,Case When SaleRtnBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_SaleRtnBill
- ,Location.Name_Location
- From SaleRtnBill
- Inner Join Customer On SaleRtnBill.ID_Customer = Customer.ID_Customer
- Inner Join Location On Location.ID_Location = SaleRtnBill.ID_Location">
- <Tables>
- <Table name="AllSaleRtnBill" />
- </Tables>
- </SearchAllSaleRtnBill>
- <SearchAllSaleRtnBillProduct CmdType="Text" CmdText="Select SaleRtnBill.No_SaleRtnBill,Product.No_Product
- ,SaleRtnBillProduct.No_SaleRtnBillProduct,Product.Name_Product
- ,SaleRtnBillProduct.Quantity_SaleRtnBillProduct
- ,SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct
- ,SaleRtnBill.TaxCurrency_SaleRtnBill
- From SaleRtnBillProduct
- Inner Join Product On Product.ID_Product = SaleRtnBillProduct.ID_Product
- Inner Join SaleRtnBill On SaleRtnBill.ID_SaleRtnBill = SaleRtnBillProduct.ID_SaleRtnBill">
- <Tables>
- <Table name="AllSaleRtnBillProduct" />
- </Tables>
- </SearchAllSaleRtnBillProduct>
- <SearchAllSaleAndRtnBill CmdType="Text" CmdText=" Declare @ID_Customer Uniqueidentifier
- Declare @CessOut decimal(5,2)
- Select @ID_Customer = ID_Customer
- From Customer
- Where No_Customer = @No_Customer
- select @CessOut = CessOut_SystemSetting/100
- from SystemSetting
-
- Declare @Customer Table(ID_Customer Uniqueidentifier)
- Insert Into @Customer Values(@ID_Customer)
- Insert Into @Customer
- Select ID_Customer
- From Customer
- Where CustomerID_Customer = @ID_Customer
- SELECT '销货单' as Name_BillType
- ,No_SaleBill As No_FromBill
- ,No_SaleBillProduct As No_FromBillProduct
- ,Customer.No_Customer as No_Customer
- ,Customer.ShortName_customer as ShortName_customer
- ,SaleBillProduct.ID_Product
- ,isnull(SaleBillProduct.Quantity_SaleBillProduct,0) As Quantity_SaleInvoiceProduct
- ,isnull(SaleBillProduct.UnitPrice_SaleBillProduct,0) As UnitPrice_SaleInvoiceProduct
- ,Product.No_Product
- ,Product.Name_Product
- ,Product.InvoiceName_Product
- ,Product.Unit_Product
- ,Amount_SaleInvoiceProduct = isnull(SaleBillProduct.Quantity_SaleBillProduct,0)*isnull(SaleBillProduct.UnitPrice_SaleBillProduct,0)
- ,TaxAmount_SaleInvoiceProduct=case SaleBill.TaxCurrency_SaleBill when '外加'
- then Convert(decimal(18,2),Convert(decimal(18,2),isnull(SaleBillProduct.UnitPrice_SaleBillProduct,0)*isnull(SaleBillProduct.Quantity_SaleBillProduct,0))*@CessOut)
- when '内含'
- then Convert(decimal(18,2),(Convert(decimal(18,2),isnull(SaleBillProduct.UnitPrice_SaleBillProduct,0)*isnull(SaleBillProduct.Quantity_SaleBillProduct,0))*@CessOut)/(1+@CessOut))
- else 0 end
- ,Type_FromBill = 21
- ,SaleBill.TaxCurrency_SaleBill As TaxCurrency_SaleInvoiceProduct
- ,GoodsAmount_SaleInvoiceProduct=case SaleBill.TaxCurrency_SaleBill When '内含'
- Then (isnull(Quantity_SaleBillProduct,0)*isnull(UnitPrice_SaleBillProduct,0))/(1+@CessOut)
- else (isnull(Quantity_SaleBillProduct,0)*isnull(UnitPrice_SaleBillProduct,0)) end
- FROM SaleBillProduct
- LEFT JOIN SaleBill On SaleBill.ID_SaleBill=SaleBillProduct.ID_SaleBill
- LEFT JOIN Product On Product.ID_Product=SaleBillProduct.ID_Product
- LEFT JOIN Customer on Customer.ID_Customer=SaleBill.ID_Customer
- WHERE SaleBillProduct.Quantity_SaleBillProduct > 0
- AND SaleBillProduct.ID_SaleBill in (Select ID_SaleBill From SaleBill)
- And SaleBill.ID_Customer in (Select ID_Customer From @Customer)
- And Date_SaleBill Between isnull(DateAdd(day,DateDiff(day,0,@StartDate),0),Date_SaleBill) AND Isnull(DateAdd(day,DateDiff(day,0,@EndDate),1),Date_SaleBill)
- And SaleBill.ID_Assessor is not null
- And Assess_SaleBill = 0
- And SaleBill.Disable_SaleBill = 0
- And @ckRtn =1
- Union All
- SELECT '销售退货单' as Name_BillType
- ,No_SaleRtnBill As No_FromBill
- ,No_SaleRtnBillProduct As No_FromBillProduct
- ,Customer.No_Customer as No_Customer
- ,Customer.ShortName_customer as ShortName_customer
- ,SaleRtnBillProduct.ID_Product
- ,isnull(SaleRtnBillProduct.Quantity_SaleRtnBillProduct,0) As Quantity_SaleInvoiceProduct
- ,isnull(SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct,0) As UnitPrice_SaleInvoiceProduct
- ,Product.No_Product,Product.Name_Product
- ,Product.InvoiceName_Product
- ,Product.Unit_Product
- ,Amount_SaleInvoiceProduct=isnull(SaleRtnBillProduct.Quantity_SaleRtnBillProduct,0)*isnull(SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct,0)
- ,TaxAmount_SaleInvoiceProduct=case SaleRtnBill.TaxCurrency_SaleRtnBill
- when '外加'
- then Convert(decimal(18,2)
- ,Convert(decimal(18,2)
- ,isnull(SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct,0)*isnull(SaleRtnBillProduct.Quantity_SaleRtnBillProduct,0)
- )*@CessOut
- )
- when '内含'
- then Convert(decimal(18,2)
- ,(Convert(decimal(18,2)
- ,isnull(SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct,0)*isnull(SaleRtnBillProduct.Quantity_SaleRtnBillProduct,0) )*@CessOut
- )/(1+@CessOut)
- ) else 0 end
- ,Type_FromBill = 22
- ,SaleRtnBill.TaxCurrency_SaleRtnBill As TaxCurrency_SaleInvoiceProduct
- ,GoodsAmount_SaleInvoiceProduct=case SaleRtnBill.TaxCurrency_SaleRtnBill
- When '内含'
- Then (isnull(Quantity_SaleRtnBillProduct,0)*isnull(UnitPrice_SaleRtnBillProduct,0))/(1+@CessOut)
- else (isnull(Quantity_SaleRtnBillProduct,0)*isnull(UnitPrice_SaleRtnBillProduct,0)) end
- FROM SaleRtnBillProduct
- LEFT JOIN SaleRtnBill On SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
- LEFT JOIN Product On Product.ID_Product=SaleRtnBillProduct.ID_Product
- LEFT JOIN Customer on Customer.ID_Customer=SaleRtnBill.ID_Customer
- Where SaleRtnBill.ID_Assessor Is Not Null
- And SaleRtnBill.ID_Customer in (Select ID_Customer From @Customer)
- And @ckRtn =1
- And No_FromBill in (Select No_SaleBill From SaleBill
- Where Date_SaleBill Between isnull(DateAdd(day,DateDiff(day,0,@StartDate),0),Date_SaleBill)
- AND Isnull(DateAdd(day,DateDiff(day,0,@EndDate),1),Date_SaleBill)
- And SaleBill.ID_Assessor is not null
- And SaleBill.Assess_SaleBill = 0
- And SaleBill.Disable_SaleBill = 0
- )
- And Assess_SaleRtnBill = 0
- And Disable_SaleRtnBill = 0
- ">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- <Param name="@StartDate" type="Customer.BeginDate_Customer" Index="1" />
- <Param name="@EndDate" type="Customer.BeginDate_Customer" Index="2" />
- <Param name="@ckRtn" type="Customer.IsCustomersCustomer_Customer" Index="3" />
- </Params>
- <Tables>
- <Table name="SaleInvoiceProduct1"/>
- </Tables>
- </SearchAllSaleAndRtnBill>
- <SearchAllSale CmdType="Text" CmdText=" Declare @ID_Customer Uniqueidentifier
- Declare @CessOut decimal(5,2)
- Select @ID_Customer = ID_Customer
- From Customer
- Where No_Customer = @No_Customer
- select @CessOut = CessOut_SystemSetting/100 from SystemSetting
-
- Declare @Customer Table(ID_Customer Uniqueidentifier)
- Insert Into @Customer Values(@ID_Customer)
- Insert Into @Customer
- Select ID_Customer
- From Customer
- Where CustomerID_Customer = @ID_Customer
- SELECT '销货单' as Name_BillType
- ,No_SaleBill As No_FromBill
- ,No_SaleBillProduct As No_FromBillProduct
- ,Customer.No_Customer as No_Customer
- ,Customer.ShortName_customer as ShortName_customer
- ,SaleBillProduct.ID_Product
- ,isnull(SaleBillProduct.Quantity_SaleBillProduct,0) As Quantity_SaleInvoiceProduct
- ,isnull(SaleBillProduct.UnitPrice_SaleBillProduct,0) As UnitPrice_SaleInvoiceProduct
- ,Product.No_Product
- ,Product.Name_Product
- ,Product.InvoiceName_Product
- ,Product.Unit_Product
- ,Amount_SaleInvoiceProduct = isnull(SaleBillProduct.Quantity_SaleBillProduct,0)*isnull(SaleBillProduct.UnitPrice_SaleBillProduct,0)
- ,case SaleBill.TaxCurrency_SaleBill when '外加'
- then Convert(decimal(18,2),Convert(decimal(18,2),isnull(SaleBillProduct.UnitPrice_SaleBillProduct,0)*isnull(SaleBillProduct.Quantity_SaleBillProduct,0))*@CessOut)
- when '内含'
- then Convert(decimal(18,2),(Convert(decimal(18,2),isnull(SaleBillProduct.UnitPrice_SaleBillProduct,0)*isnull(SaleBillProduct.Quantity_SaleBillProduct,0))*@CessOut)/(1+@CessOut))
- else 0 end as TaxAmount_SaleInvoiceProduct
-
- ,Type_FromBill = 21
- ,SaleBill.TaxCurrency_SaleBill As TaxCurrency_SaleInvoiceProduct
- ,GoodsAmount_SaleInvoiceProduct=case SaleBill.TaxCurrency_SaleBill When '内含'
- Then (isnull(Quantity_SaleBillProduct,0)*isnull(UnitPrice_SaleBillProduct,0))/(1+@CessOut)
- else (isnull(Quantity_SaleBillProduct,0)*isnull(UnitPrice_SaleBillProduct,0)) end
- FROM SaleBillProduct
- LEFT JOIN SaleBill On SaleBill.ID_SaleBill=SaleBillProduct.ID_SaleBill
- LEFT JOIN Product On Product.ID_Product=SaleBillProduct.ID_Product
- LEFT JOIN Customer on Customer.ID_Customer=SaleBill.ID_Customer
- WHERE SaleBillProduct.Quantity_SaleBillProduct > 0
- AND SaleBillProduct.ID_SaleBill in (Select ID_SaleBill From SaleBill)
- And SaleBill.ID_Customer in (Select ID_Customer From @Customer)
- And Date_SaleBill Between isnull(DateAdd(day,DateDiff(day,0,@StartDate),0),Date_SaleBill) AND Isnull(DateAdd(day,DateDiff(day,0,@EndDate),1),Date_SaleBill)
- And SaleBill.ID_Assessor is not null
- And Assess_SaleBill = 0
- And SaleBill.Disable_SaleBill = 0
- And @ckRtn =0
- ">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- <Param name="@StartDate" type="Customer.BeginDate_Customer" Index="1" />
- <Param name="@EndDate" type="Customer.BeginDate_Customer" Index="2" />
- <Param name="@ckRtn" type="Customer.IsCustomersCustomer_Customer" Index="3" />
- </Params>
- <Tables>
- <Table name="SaleInvoiceProduct2"/>
- </Tables>
- </SearchAllSale>
- <SearchCustomerRelation CmdType="Text" CmdText ="if (@CustomerIDSaleInvoice = @CustomerIDBill)
- Begin
- select *
- from Customer
- where id_customer = @CustomerIDSaleInvoice
- End
- else
- Begin
- select *
- from Customer
- where id_customer =@CustomerIDBill
- and CustomerID_Customer = @CustomerIDSaleInvoice
- End">
- <Params>
- <Param name="@CustomerIDSaleInvoice" type="Customer.ID_Customer" Index="0" />
- <Param name="@CustomerIDBill" type="Customer.ID_Customer" Index="1" />
- </Params>
- <Tables>
- <Table name="CustomerRelation"/>
- </Tables>
- </SearchCustomerRelation>
- <SearchTemp CmdType="Text" CmdText="SELECT TOP 0 SaleInvoiceProduct.*,
- convert(nvarchar(64),'') As Name_BillType
- ,Product.No_Product
- ,Product.Name_Product
- ,Product.InvoiceName_Product
- ,Product.Unit_Product
- ,convert(bit,0) AS Negative
- ,Convert(nvarchar(64),'') As No_Customer
- ,Convert(nvarchar(64),'') As ShortName_Customer
- FROM SaleInvoiceProduct
- LEFT JOIN Product On Product.ID_Product=SaleInvoiceProduct.ID_Product">
- <Tables>
- <Table name="Temp"/>
- </Tables>
- </SearchTemp>
- <DeleteRow CmdType="Text" CmdText=" Delete SaleInvoiceProduct Where ID_SaleInvoiceProduct = @ID_SaleInvoiceProduct
- Select 1
- ">
- <Params>
- <Param name="@ID_SaleInvoiceProduct" type="SaleInvoiceProduct.ID_SaleInvoiceProduct" Index="0" />
- </Params>
- <Tables>
- <Table name="delete"/>
- </Tables>
- </DeleteRow>
- <SearchPayDate CmdType="Text" CmdText=" select dateadd(month,datediff(month,0,@date)+2,0)-1+ @DunDate as NextEndDate
- ">
- <Params>
- <Param name="@date" type="SaleInvoice.PayDate_SaleInvoice" Index="0" />
- <Param name="@DunDate" type="Customer.DunDate_Customer" Index="1" />
- </Params>
- <Tables>
- <Table name="PayDate"/>
- </Tables>
- </SearchPayDate>
- <SearchPayDate2 CmdType="Text" CmdText=" select dateadd(month,datediff(month,0,@date)+3,0)-1+ @DunDate as NextEndDate
- ">
- <Params>
- <Param name="@date" type="SaleInvoice.PayDate_SaleInvoice" Index="0" />
- <Param name="@DunDate" type="Customer.DunDate_Customer" Index="1" />
- </Params>
- <Tables>
- <Table name="PayDate2"/>
- </Tables>
- </SearchPayDate2>
- <SearchPayDate3 CmdType="Text" CmdText=" select dateadd(month,datediff(month,0,@date)+4,0)-1+ @DunDate as NextEndDate
- ">
- <Params>
- <Param name="@date" type="SaleInvoice.PayDate_SaleInvoice" Index="0" />
- <Param name="@DunDate" type="Customer.DunDate_Customer" Index="1" />
- </Params>
- <Tables>
- <Table name="PayDate3"/>
- </Tables>
- </SearchPayDate3>
- <SearchPayDate4 CmdType="Text" CmdText=" select dateadd(month,datediff(month,0,@date)+5,0)-1+ @DunDate as NextEndDate
- ">
- <Params>
- <Param name="@date" type="SaleInvoice.PayDate_SaleInvoice" Index="0" />
- <Param name="@DunDate" type="Customer.DunDate_Customer" Index="1" />
- </Params>
- <Tables>
- <Table name="PayDate4"/>
- </Tables>
- </SearchPayDate4>
- <SearchPayDate5 CmdType="Text" CmdText=" select dateadd(month,datediff(month,0,@date)+1,10)-1+ @DunDate as NextEndDate
- ">
- <Params>
- <Param name="@date" type="SaleInvoice.PayDate_SaleInvoice" Index="0" />
- <Param name="@DunDate" type="Customer.DunDate_Customer" Index="1" />
- </Params>
- <Tables>
- <Table name="PayDate5"/>
- </Tables>
- </SearchPayDate5>
- </Search>
- </Server>
- <Lables>
- <Search>
- Empty();
- NewInstance();
- tbNo.ReadOnly=false;
- dtDate.Enabled=false;
- cbType.Enabled=false;
- dtInvoiceDate.Enabled=false;
- txtInvoiceNo.ReadOnly=true;
- btnModify.Enabled=false;
- tbCustomerNo.ReadOnly=true;
- cbInvoiceTitle.Enabled=false;
- cbInvoiceAddress.Enabled=false;
- cbBank.Enabled=false;
- txtAccount.ReadOnly=true;
- dtPayDate.Enabled=false;
- dgProduct.ReadOnly=true;
- txtMoneySum.CValue=0.00;
- txtTaxSum.CValue=0.00;
- txtSum.CValue=0.00;
- dtStart.Enabled = false;
- dtEnd.Enabled = false;
- ckRtn.Enabled = false;
- btnSearch.Enabled=false;
- #SaleInvoice.Creator=DBNull();
- #SaleInvoice.ID_Creator=DBNull();
- #SaleInvoice.Assessor=DBNull();
- #SaleInvoice.ID_Assessor=DBNull();
- #SaleInvoice.AssessDate_SaleInvoice=DBNull();
- #SaleInvoice.LastModUser_SaleInvoice=DBNull();
- #SaleInvoice.LastModUser=DBNull();
- #SaleInvoice.LastModDate_SaleInvoice=DBNull();
- toolBar.EnableSubmit=false;
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- toolBar.EnableAudit=false;
- toolBar.EnableNew=GetRight(@Title,"新增");
- toolBar.EnablePrint=false;
- toolBar.EnableBlank=false;
- toolBar.EnableImport = false;
- OperateControlEvent("dtInvoiceDate","ValueChanged",false);
- UpdateForm(true,"");
- OperateControlEvent("dtInvoiceDate","ValueChanged",true);
- tbNo.Focus();
- cbType.Text="";
- @Status=0;
- </Search>
- <New>
- Empty();
- NewInstance();
- tbNo.ReadOnly=true;
- dtDate.Enabled=true;
- cbType.Enabled=true;
- dtInvoiceDate.Enabled=true;
- txtInvoiceNo.ReadOnly=false;
- btnModify.Enabled=false;
- tbCustomerNo.ReadOnly=false;
- cbInvoiceTitle.Enabled=true;
- cbInvoiceAddress.Enabled=true;
- cbBank.Enabled=true;
- txtAccount.ReadOnly=false;
- dtPayDate.Enabled=false;
- dgProduct.ReadOnly=false;
- txtMoneySum.CValue=0.00;
- txtTaxSum.CValue=0.00;
- txtSum.CValue=0.00;
- dtStart.Enabled = true;
- dtEnd.Enabled = true;
- ckRtn.Enabled = true;
- btnSearch.Enabled=true;
- dtDate.Focus();
- #SaleInvoice.TypeName="增值税发票";
- #SaleInvoice.Currency_SaleInvoice= @SysCurrency;
- #SaleInvoice.ID_SaleInvoice=NewGuid();
- #SaleInvoice.Creator=GetCurrentUser();
- #SaleInvoice.ID_Creator=GetLoginUserID();
- #SaleInvoice.Assessor=DBNull();
- #SaleInvoice.ID_Assessor=DBNull();
- #SaleInvoice.AssessDate_SaleInvoice=DBNull();
- #SaleInvoice.LastModUser_SaleInvoice=DBNull();
- #SaleInvoice.LastModUser=DBNull();
- #SaleInvoice.LastModDate_SaleInvoice=DBNull();
- toolBar.EnableSubmit=GetRight(@Title,"新增");
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- toolBar.EnableAudit=false;
- toolBar.EnableNew=false;
- toolBar.EnablePrint=false;
- toolBar.EnableBlank=false;
- toolBar.EnableImport = true;
- OperateControlEvent("dtInvoiceDate","ValueChanged",false);
- UpdateForm(true,"");
- OperateControlEvent("dtInvoiceDate","ValueChanged",true);
- <!--cbType.SelectedIndex=1;-->
- @Status=1;
- </New>
- <View>
- tbNo.ReadOnly=true;
- dtDate.Enabled=false;
- cbType.Enabled=false;
- dtInvoiceDate.Enabled=false;
- txtInvoiceNo.ReadOnly=true;
- if(!Equals(#SaleInvoice.ID_Assessor,DBNull())&&#SaleInvoice.Disable_SaleInvoice==false)
- btnModify.Enabled=true;
- else
- btnModify.Enabled=false;
- tbCustomerNo.ReadOnly=true;
- cbInvoiceTitle.Enabled=false;
- cbInvoiceAddress.Enabled=false;
- cbBank.Enabled=false;
- txtAccount.ReadOnly=true;
- dtPayDate.Enabled=false;
- dgProduct.ReadOnly=true;
- dtStart.Enabled = false;
- dtEnd.Enabled = false;
- ckRtn.Enabled = false;
- btnSearch.Enabled=false;
- toolBar.EnableSubmit=false;
- toolBar.EnableNew=GetRight(@Title,"新增");
- if(Equals(#SaleInvoice.ID_Assessor, DBNull()))
- {
- toolBar.EnableAudit=GetRight(@Title,"审核");
- toolBar.EnableModify=GetRight(@Title,"修改");
- toolBar.EnableDelete=GetRight(@Title,"删除");
- toolBar.EnableBlank=false;
- }
- else
- {
- toolBar.EnableAudit=false;
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- if(#SaleInvoice.Disable_SaleInvoice==false)
- toolBar.EnableBlank=GetRight(@Title,"审核");
- else
- toolBar.EnableBlank=false;
- }
- toolBar.EnablePrint=GetRight(@Title,"打印");
- toolBar.EnableImport = false;
- OperateControlEvent("dtInvoiceDate","ValueChanged",false);
- UpdateForm(true,"");
- OperateControlEvent("dtInvoiceDate","ValueChanged",true);
- <!--if(#SaleInvoice.Disable_SaleInvoice==true)
- ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)";-->
- @Status=2;
- </View>
- <Modify>
- tbNo.ReadOnly=true;
- dtDate.Enabled=false;
- cbType.Enabled=true;
- dtInvoiceDate.Enabled=true;
- txtInvoiceNo.ReadOnly=false;
- btnModify.Enabled=false;
- tbCustomerNo.ReadOnly=false;
- cbInvoiceTitle.Enabled=true;
- cbInvoiceAddress.Enabled=true;
- cbBank.Enabled=true;
- txtAccount.ReadOnly=false;
- dtPayDate.Enabled=false;
- dgProduct.ReadOnly=false;
- dtStart.Enabled = true;
- dtEnd.Enabled = true;
- ckRtn.Enabled = true;
- btnSearch.Enabled=true;
- #SaleInvoice.LastModUser=GetCurrentUser();
- #SaleInvoice.LastModUser_SaleInvoice=GetLoginUserID();
- #SaleInvoice.LastModDate_SaleInvoice=GetCurrentTime();
- toolBar.EnableSubmit=GetRight(@Title,"修改");
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- toolBar.EnableAudit=false;
- toolBar.EnableNew=false;
- toolBar.EnablePrint=false;
- toolBar.EnableImport = true;
- OperateControlEvent("dtInvoiceDate","ValueChanged",false);
- UpdateForm(true,"");
- OperateControlEvent("dtInvoiceDate","ValueChanged",true);
- @Status=3;
- </Modify>
- <SubmitButtonClick>
- <![CDATA[
- if(cbType.Text==StringEmpty())
- {
- MessageBox("请输入有效的发票种类!",@Title);
- tbDetail.SelectedIndex = 0;
- cbType.Focus();
- return;
- }
- if(!Equals(txtInvoiceNo.CValue,""))
- {
- if(Search("SearchInvoiceNo",txtInvoiceNo.CValue,tbNo.CValue))
- {
- MessageBox("该发票号码已存在!",@Title);
- tbDetail.SelectedIndex = 0;
- txtInvoiceNo.Focus();
- return;
- }
- }
- if(!Search("SearchCustomer",tbCustomerNo.CValue)|| !Equals(#SaleInvoice.ID_Customer,#Customer.ID_Customer))
- {
- MessageBox("请输入有效客户,回车以示确认!",@Title);
- tbDetail.SelectedIndex = 0;
- tbCustomerNo.Focus();
- return;
- }
- if(!cbInvoiceTitle.CheckSelectedItem())
- {
- MessageBox("请输入有效的发票抬头!",@Title);
- tbDetail.SelectedIndex = 0;
- cbInvoiceTitle.Focus();
- return;
- }
- if(!cbInvoiceAddress.CheckSelectedItem())
- {
- MessageBox("请输入有效的发票地址!",@Title);
- tbDetail.SelectedIndex = 0;
- cbInvoiceAddress.Focus();
- return;
- }
- if(!cbBank.CheckSelectedItem())
- {
- MessageBox("请输入有效的开户行!",@Title);
- tbDetail.SelectedIndex = 0;
- cbBank.Focus();
- return;
- }
-
- if(txtAccount.CValue==StringEmpty())
- {
- MessageBox("请输入有效的银行帐号!",@Title);
- tbDetail.SelectedIndex = 0;
- txtAccount.Focus();
- return;
- }
- if(RowCount("SaleInvoiceProduct")==0)
- {
- MessageBox("请输入销项发票产品!",@Title);
- tbDetail.SelectedIndex = 1;
- dgProduct.Focus();
- return;
- }
- UpdateForm(false, "");
- SuspendLayout();
- for(@index=0;@index<RowCount("#Temp");@index=@index+1)
- {
- SetPosition("#Temp",@index);
- Search("DeleteRow",#Temp.ID_SaleInvoiceProduct);
- }
-
- for(@i=0;@i<RowCount("#SaleInvoiceProduct");@i=@i+1)
- {
- SetPosition("#SaleInvoiceProduct",@i);
-
- if (Equals(#SaleInvoiceProduct.Name_BillType,"销货单"))
- {
- if(Search("SearchSaleBill",#SaleInvoiceProduct.No_FromBill,#SaleInvoiceProduct.No_FromBillProduct))
- {
- if (Equals(#SaleBill.ID_Assessor,DBNull()))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该来源单据未经审核,提交失败!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
-
- if (!Search("SearchCustomerRelation",#SaleInvoice.ID_Customer,#SaleBill.ID_Customer))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该来源单据的客户与本销项发票的客户或下级客户不一致,提交失败!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if(#SaleBill.InvoiceAddress_Company!=#SaleInvoice.InvoiceAddress_SaleInvoice||#SaleBill.InvoiceTitle_Company!=#SaleInvoice.InvoiceTitle_SaleInvoice)
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex=@i;
- @ClickResult = MessageBox("销货单中的发票抬头(发票地址)与页面不一致,是否继续?",@Title,MB_OKCANCEL);
- if (@ClickResult == DialogResult("CANCEL"))
- {
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
- if(!Equals(#SaleInvoiceProduct.ID_Product,#SaleBill.ID_Product))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该来源单据产品单中指定的产品与后改写的产品不匹配!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
-
- }
- if (Equals(#SaleInvoiceProduct.Name_BillType,"销售退货单"))
- {
- if(Search("SearchSaleRtnBill",#SaleInvoiceProduct.No_FromBill,#SaleInvoiceProduct.No_FromBillProduct))
- {
- if (Equals(#SaleRtnBill.ID_Assessor,DBNull()))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该来源单据未经审核,提交失败!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if (!Search("SearchCustomerRelation",#SaleInvoice.ID_Customer,#SaleRtnBill.ID_Customer))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该来源单据的客户与本销项发票的客户或下级不一致,提交失败!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if(!Equals(#SaleInvoiceProduct.ID_Product,#SaleRtnBill.ID_Product))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该来源单据产品单中指定的产品与后改写的产品不匹配!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
- }
- if(Equals(#SaleInvoiceProduct.No_Product,""))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex=@i;
- MessageBox("请输入产品编号!",@Title);
- ResumeLayout();
- return;
- }
- if(Equals(#SaleInvoiceProduct.ID_Product,GuidEmpty()))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex=@i;
- MessageBox("该产品不存在!",@Title);
- ResumeLayout();
- return;
- }
- if(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct<=0)
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex=@i;
- MessageBox("数量不得小于等于0!",@Title);
- ResumeLayout();
- return;
- }
- if(Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,""))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex=@i;
- MessageBox("请输入税别!",@Title);
- ResumeLayout();
- return;
- }
- if(Equals(#SaleInvoiceProduct.ID_SaleInvoiceProduct,GuidEmpty()))
- {
- #SaleInvoiceProduct.ID_SaleInvoiceProduct=NewGuid();
- }
- #SaleInvoiceProduct.ID_SaleInvoice=#SaleInvoice.ID_SaleInvoice;
- }
- ResumeLayout();
- if(@Status==1)
- { #SaleInvoice.CreateDate_SaleInvoice=GetCurrentTime();
- #SaleInvoice.No_SaleInvoice = New("#SaleInvoice.No_SaleInvoice", dtDate.CValue);
- }
- else if(@Status==3)
- {
- #SaleInvoice.LastModUser=GetCurrentUser();
- #SaleInvoice.LastModUser_SaleInvoice=GetLoginUserID();
- #SaleInvoice.LastModDate_SaleInvoice=GetCurrentTime();
- Update();
- }
- ChangeMode("View",#SaleInvoice.ID_Assessor);
- ]]>
- </SubmitButtonClick>
- <CountSum>
- <![CDATA[
- if (RowCount("#SaleInvoiceProduct") == 0)
- {
- txtMoneySum.CValue=0;
- txtTaxSum.CValue=0;
- txtSum.CValue=0;
- }
- else
- {
- @txtMoneySumTemp=0;
- @txtTaxSumTemp=0;
- SuspendLayout();
- for(@i=0;@i<RowCount("#SaleInvoiceProduct");@i++)
- {
- SetPosition("#SaleInvoiceProduct",@i);
- if(#SaleInvoiceProduct.Type_FromBill==22)
- {
- @txtMoneySumTemp=FormatNumber(@txtMoneySumTemp-#SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct,@PriceDecimal);
- @txtTaxSumTemp=FormatNumber(@txtTaxSumTemp-#SaleInvoiceProduct.TaxAmount_SaleInvoiceProduct,@PriceDecimal);
- }
- else
- {
- @txtMoneySumTemp=FormatNumber(@txtMoneySumTemp+#SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct,@PriceDecimal);
- @txtTaxSumTemp=FormatNumber(@txtTaxSumTemp+#SaleInvoiceProduct.TaxAmount_SaleInvoiceProduct,@PriceDecimal);
- }
- }
- ResumeLayout();
- txtMoneySum.CValue=@txtMoneySumTemp;
- txtTaxSum.CValue=@txtTaxSumTemp;
- txtSum.CValue=txtMoneySum.CValue+txtTaxSum.CValue;
- }
- UpdateForm(false,"txtSum");
- UpdateForm(false,"txtMoneySum");
- UpdateForm(false,"txtTaxSum");
- ]]>
- </CountSum>
- <FromBillChange>
- if(!Equals(#SaleInvoiceProduct.Name_BillType,"")&&!Equals(#SaleInvoiceProduct.No_FromBill,"")&& !Equals(#SaleInvoiceProduct.No_FromBillProduct,""))
- {
- if(Equals(#SaleInvoiceProduct.Name_BillType,"销货单")&&Search("SearchSaleBillProduct",#SaleInvoiceProduct.No_FromBill,#SaleInvoiceProduct.No_FromBillProduct))
- {
- #SaleInvoiceProduct.ID_Product=#SaleBillProduct.ID_Product;
- #SaleInvoiceProduct.No_Product=#SaleBillProduct.No_Product;
- #SaleInvoiceProduct.Name_Product=#SaleBillProduct.Name_Product;
- #SaleInvoiceProduct.Unit_Product=#SaleBillProduct.Unit_Product;
- #SaleInvoiceProduct.Quantity_SaleInvoiceProduct=#SaleBillProduct.Quantity_SaleBillProduct;
- #SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct=#SaleBillProduct.UnitPrice_SaleBillProduct;
- #SaleInvoiceProduct.InvoiceName_Product=#SaleBillProduct.InvoiceName_Product;
- #SaleInvoiceProduct.Amount_SaleInvoiceProduct=FormatNumber(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,@PriceDecimal);
- #SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct=#SaleBillProduct.TaxCurrency_SaleBill;
- if(Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"内含"))
- {
- #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber((#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct)/(1+#SaleInvoiceProduct.TaxRate_SaleInvoiceProduct),@PriceDecimal);
- }
- else
- {
- #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,@PriceDecimal);
- }
- #SaleInvoiceProduct.No_Customer=#SaleBillProduct.No_Customer;
- #SaleInvoiceProduct.ShortName_Customer=#SaleBillProduct.ShortName_Customer;
- #SaleInvoiceProduct.TaxAmount_SaleInvoiceProduct=FormatNumber(#SaleInvoiceProduct.Amount_SaleInvoiceProduct*#SaleInvoiceProduct.TaxRate_SaleInvoiceProduct,@PriceDecimal);
- }
- if(Equals(#SaleInvoiceProduct.Name_BillType,"销售退货单")&&Search("SearchSaleRtnBillProduct",#SaleInvoiceProduct.No_FromBill,#SaleInvoiceProduct.No_FromBillProduct))
- {
- #SaleInvoiceProduct.ID_Product=#SaleRtnBillProduct.ID_Product;
- #SaleInvoiceProduct.No_Product=#SaleRtnBillProduct.No_Product;
- #SaleInvoiceProduct.Name_Product=#SaleRtnBillProduct.Name_Product;
- #SaleInvoiceProduct.Unit_Product=#SaleRtnBillProduct.Unit_Product;
- #SaleInvoiceProduct.Quantity_SaleInvoiceProduct=#SaleRtnBillProduct.Quantity_SaleRtnBillProduct;
- #SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct=#SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct;
- #SaleInvoiceProduct.InvoiceName_Product=#SaleRtnBillProduct.InvoiceName_Product;
- #SaleInvoiceProduct.Amount_SaleInvoiceProduct=FormatNumber(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,@PriceDecimal);
- #SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct=#SaleRtnBillProduct.TaxCurrency_SaleRtnBill;
- if(Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"内含"))
- {
- #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber((#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct)/(1+#SaleInvoiceProduct.TaxRate_SaleInvoiceProduct),@PriceDecimal);
- }
- else
- {
- #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,@PriceDecimal);
- }
- #SaleInvoiceProduct.No_Customer=#SaleRtnBillProduct.No_Customer;
- #SaleInvoiceProduct.ShortName_Customer=#SaleRtnBillProduct.ShortName_Customer;
- #SaleInvoiceProduct.TaxAmount_SaleInvoiceProduct=FormatNumber(#SaleInvoiceProduct.Amount_SaleInvoiceProduct*#SaleInvoiceProduct.TaxRate_SaleInvoiceProduct,@PriceDecimal);
- }
- dgProduct.SetColumnReadOnly(14, true);
- }
- </FromBillChange>
- <CountAmount>
- if(Equals(#SaleInvoiceProduct.Name_BillType,"销货单")&&Search("SearchSaleBillProduct",#SaleInvoiceProduct.No_FromBill,#SaleInvoiceProduct.No_FromBillProduct))
- {
- dgProduct.SetColumnReadOnly(14,true);
- if(Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"内含"))
- {
- #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber((#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct)/(1+#SaleInvoiceProduct.TaxRate_SaleInvoiceProduct),@PriceDecimal);
- }
- else
- {
- #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,@PriceDecimal);
- }
- }
- if(Equals(#SaleInvoiceProduct.Name_BillType,"销售退货单")&&Search("SearchSaleRtnBillProduct",#SaleInvoiceProduct.No_FromBill,#SaleInvoiceProduct.No_FromBillProduct))
- {
- dgProduct.SetColumnReadOnly(14,true);
- if(Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"内含"))
- {
- #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber((#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct)/(1+#SaleInvoiceProduct.TaxRate_SaleInvoiceProduct),@PriceDecimal);
- }
- else
- {
- #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,@PriceDecimal);
- }
- }
- if(Equals(#SaleInvoiceProduct.Name_BillType,"")&&Equals(#SaleInvoiceProduct.No_FromBill,"")&&Equals(#SaleInvoiceProduct.No_FromBillProduct,""))
- {
- if(!Equals(#SaleInvoiceProduct.No_Product,"")&&!Equals(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct,"")&&!Equals(#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,""))
- {
- dgProduct.SetColumnReadOnly(14, false);
- if(!Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,""))
- {
- if(Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"内含"))
- {
- #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct=FormatNumber((#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct)/(1+#SaleInvoiceProduct.TaxRate_SaleInvoiceProduct),@PriceDecimal);
- }
- else if(Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"外加"))
- {
- #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,@PriceDecimal);
- }
- else if(Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"零税"))
- {
- #SaleInvoiceProduct.TaxRate_SaleInvoiceProduct = 0.00;
- #SaleInvoiceProduct.TaxAmount_SaleInvoiceProduct = 0.00;
- #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,@PriceDecimal);
- }
- else if(Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"免税"))
- {
- #SaleInvoiceProduct.TaxRate_SaleInvoiceProduct = 0.00;
- #SaleInvoiceProduct.TaxAmount_SaleInvoiceProduct = 0.00;
- #SaleInvoiceProduct.GoodsAmount_SaleInvoiceProduct = FormatNumber(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,@PriceDecimal);
- }
- else if(!Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"免税")||!Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"零税")||!Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"内含")||!Equals(#SaleInvoiceProduct.TaxCurrency_SaleInvoiceProduct,"外加"))
- {
- MessageBox("您输入的税别不正确,请重新输入!",@Title);
- return;
- }
- }
- }
- }
- #SaleInvoiceProduct.Amount_SaleInvoiceProduct=FormatNumber(#SaleInvoiceProduct.Quantity_SaleInvoiceProduct*#SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct,@PriceDecimal);
- #SaleInvoiceProduct.TaxAmount_SaleInvoiceProduct=FormatNumber(#SaleInvoiceProduct.Amount_SaleInvoiceProduct*#SaleInvoiceProduct.TaxRate_SaleInvoiceProduct,@PriceDecimal);
- </CountAmount>
- </Lables>
- </Form>
- </Forms>
|