1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485 |
- <?xml version="1.0" encoding="utf-8" ?>
- <Forms>
- <Form Name="FrmIndentBill">
- <Client>
- <Events>
- <Load>
- <![CDATA[
- @SetFlag=1;
- @Title="订货单";
- @viewMode=false;
- @importing=false;
- GetSchema();
- Search("SearchCessOut");
- Search("SearchLocation");
- Search("SearchContr");
-
- Search("SearchProductWithNo","p");
- Search("SearchRelation","p","p");
-
- if(!#SystemSetting.SaleAndOutDepot_SystemSetting || !#SystemSetting.OutDepotAndSaleBack_SystemSetting || !#SystemSetting.SaleRtnSourceBill_SystemSetting)
- toolBar.EnableExportItem(3,false);
- @CessOut = #System.CessOut_SystemSetting / 100;
- @PriceDecimal=#SystemSetting.PriceDecimal_SystemSetting;
- @SysCurrency=#System.SysCurrency_SystemSetting;
- @AuditMode = #System.SAudit_FunctionSetting;
- ChangeMode("Search");
- dgProduct.NoMember="No_IndentBillProduct";
- if(@AuditMode)
- {
- toolBar.VisibleAudit = false;
- toolBar.EnableAudit = false;
- }
- Search("SearchBillType");
- ]]>
- </Load>
- <Closing>
- ;
- </Closing>
- <Closed>
- ;
- </Closed>
- </Events>
- <Mode>
- <Search>
- <Lable name="Search" />
- </Search>
- <New>
- <Lable name="New" />
- </New>
- <View>
- <Lable name="View" />
- </View>
- <Modify>
- <Lable name="Modify" />
- </Modify>
- </Mode>
- <Controls>
- <IKDateTimePicker name="dtpDate" DataSource="IndentBill.Date_IndentBill"></IKDateTimePicker>
- <IKTextButton name="tbNo" DataSource="IndentBill.No_IndentBill">
- <Events>
- <Enter>
- <![CDATA[
- if(tbNo.ReadOnly == false)
- {
- if(tbNo.CValue != StringEmpty())
- {
- UpdateForm(false, "");
- if(Search("SearchIndentBillWithNo", tbNo.CValue))
- {
- if(!Search("SearchCustomersIsInRegionalLeader",#IndentBill.No_Customer, GetCurrentUser()))
- {
- MessageBox("你与客户不在同一个区域,不能查看!");
- ChangeMode("Search");
- return;
- }
- if((GetRight("客户基本资料","全权查看")||Equals(GetLoginUserID(),#IndentBill.CustomerCreator))&&(GetFieldRight(@Title,"特价单","查看")||!#IndentBill.Special_IndentBill))
- ChangeMode("View");
- else
- {
- @EnterNo=tbNo.CValue;
- ChangeMode("Search");
- tbNo.CValue=@EnterNo;
- MessageBox("你没有查看该单据资料的权限!",@Title);
- return;
- }
- }
- else
- {
-
- MessageBox("该销货单不存在!",@Title);
- }
- }
- else
- {
- MessageBox("请输入销货单号!",@Title);
- }
- }
- ]]>
- <Lable name="CountSum" />
- </Enter>
- <Click>
- ShowSearchBox("BillSearch","HAVEDEPOT", "tbNo",tbNo.CValue);
- </Click>
- </Events>
- </IKTextButton>
- <IKCheckBox name="ckSpecial" DataSource="IndentBill.Special_IndentBill"/>
- <IKButton name="btnDelete">
- <Events>
- <Click>
- BeginUnAudit();
- #IndentBill.ID_Assessor = DBNull();
- #IndentBill.Name_Assessor = "";
- #IndentBill.Disable_IndentBill=true;
- UnAudit(false);
- ChangeMode("View");
- EndUnAudit();
- <Lable name="CountSum" />
- </Click>
- </Events>
- </IKButton>
- <IKComboBoxEx name="cbLocation" DisplaySource="IndentBill.Name_Location" NoSource="IndentBill.No_Location" ValueSource="IndentBill.ID_Location" DataSource="Location" DisplayMember="Name_Location" NoMember="No_Location" ValueMember="ID_Location">
- <Events>
- <Reload>
- UpdateForm(false, "cbLocation");
- Search("SearchLocation");
- UpdateForm(true, "cbLocation");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKTextButton name="tbCustomerNo" DataSource="IndentBill.No_Customer">
- <Events>
- <Enter>
- <![CDATA[
- if (tbCustomerNo.ReadOnly == false)
- {
- UpdateForm(false, "");
- if (tbCustomerNo.CValue == "" || !Search("SearchCustomerWithNo", tbCustomerNo.CValue))
- {
- if (tbCustomerNo.CValue == "")
- {
- MessageBox("请输入客户编号!", @Title);
- }
- else
- {
- MessageBox("该客户不存在!",@Title);
- @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo.CValue);
- if(@temp != "")
- {
- tbCustomerNo.CValue = @temp;
- ActiveControlEvent("tbCustomerNo", "Enter");
- }
- }
- }
- else
- {
- if (!Search("SearchCustomersIsInRegionalLeader",tbCustomerNo.CValue, GetCurrentUser()))
- {
- MessageBox("你与客户不在同一个区域,不能填单!");
- tbCustomerNo.Text = "";
- return;
- }
- if (!Equals(#Customer.SuspendDate_Customer,DBNull()))
- {
- MessageBox("该客户已停用!",@Title);
- }
-
- #IndentBill.ID_Customer = #Customer.ID_Customer;
- #IndentBill.Discount_IndentBill = #Customer.LastDiscount_Customer;
- #IndentBill.Name_Customer = #Customer.Name_Customer;
- #IndentBill.ShortName_Customer = #Customer.ShortName_Customer;
- #IndentBill.Type_Customer = #Customer.Type_Customer;
- #IndentBill.GetMethod_IndentBill = #Customer.GetMethod_Customer;
- #IndentBill.ToGet_IndentBill = #Customer.ToGetBalance_Customer;
- #IndentBill.PostalCode_Customer = #Customer.PostalCode_Customer;
- #IndentBill.SendAddr_IndentBill = #Customer.SendAddr_Customer;
- #IndentBill.TaxCurrency_IndentBill = #Customer.LastTax_Customer;
- #IndentBill.Principal_IndentBill = #Customer.Name_Employee;
- #IndentBill.No_Principal = #Customer.No_Employee;
- #IndentBill.ID_Principal = #Customer.LastPrincipal_Customer;
- Empty("#ReportComment");
- Search("SearchTypeComment",#IndentBill.ID_Customer);
- MergeTable("#TypeComment","#ReportComment");
-
- if (RowCount("Linkman") > 0)
- {
- #IndentBill.Name_Linkman = #Linkman.Name_Linkman;
- }
- else
- {
- #IndentBill.Name_Linkman = DBNull();
- }
- if (RowCount("Telephone") > 0)
- {
- #IndentBill.Tel_IndentBill = #Telephone.No_Telephone;
- }
- else
- {
- #IndentBill.Tel_IndentBill = DBNull();
- }
- if (RowCount("Fax") > 0)
- {
- #IndentBill.Fax_IndentBill = #Fax.No_Fax;
- }
- else
- {
- #IndentBill.Fax_IndentBill = DBNull();
- }
- if (RowCount("Invoice") > 0)
- {
- #IndentBill.InvoiceTitle_Company = #Invoice.Title_Invoice;
- #IndentBill.InvoiceAddress_Company = #Invoice.Address_Invoice;
- }
- else
- {
- #IndentBill.InvoiceTitle_Company = DBNull();
- #IndentBill.InvoiceAddress_Company = DBNull();
- }
- }
- UpdateForm(true, "");
- }
- ]]>
- <Lable name="ChangeDiscount" />
- </Enter>
- <Click>
- <![CDATA[
- if (tbCustomerNo.ReadOnly == false)
- {
- @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo.CValue);
- if( @temp == "" )
- return;
- tbCustomerNo.CValue = @temp;
- ActiveControlEvent("tbCustomerNo", "Enter");
- }
- ]]>
- </Click>
- </Events>
- </IKTextButton>
- <IKTextBox name="txtCustomerShortName" DataSource="IndentBill.ShortName_Customer"></IKTextBox>
- <IKTextBox name="txtOrderBillNo" DataSource="IndentBill.No_OrderBill"></IKTextBox>
- <IKComboBoxEx name="cbGetMethod" DisplaySource="IndentBill.GetMethod_IndentBill" DataSource="GetMethod" DisplayMember="Result">
- <Events>
- <Reload>
- UpdateForm(false, "cbGetMethod");
- Search("SearchGetMethod");
- UpdateForm(true, "cbGetMethod");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKNumericTextBox name="ntbToGet" DataSource="IndentBill.ToGet_IndentBill"></IKNumericTextBox>
- <IKNumericTextBox name="ntbDiscount" DataSource="IndentBill.Discount_IndentBill">
- <Events>
- <Enter>
- UpdateForm(false, "ntbDiscount");
- <Lable name="ChangeDiscount" />
- </Enter>
- </Events>
- </IKNumericTextBox>
- <IKComboBoxEx name="cbTaxCurrency" DisplaySource="IndentBill.TaxCurrency_IndentBill">
- <Events>
- <SelectedIndexChanged>
- if(!@viewMode && !@importing)
- {
- <Lable name="CountPrice"/>
- }
- <Lable name="CountSum" />
- </SelectedIndexChanged>
- </Events>
- </IKComboBoxEx>
- <IKComboBoxEx name="cbCurrency" DisplaySource="IndentBill.Currency_IndentBill" DataSource="IndentBill">
- </IKComboBoxEx>
- <IKComboBoxEx name="cbPrincipal" ValueSource="IndentBill.ID_Principal" DisplaySource="IndentBill.Principal_IndentBill" NoSource="IndentBill.No_Principal" DataSource="Principal" DisplayMember="Principal_IndentBill" NoMember="No_Principal" ValueMember="ID_Employee">
- <Events>
- <Reload>
- UpdateForm(false, "cbPrincipal");
- Search("SearchAllPrincipal");
- UpdateForm(true, "cbPrincipal");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKTextBox name="txtMaker" DataSource="IndentBill.Name_Creator"></IKTextBox>
- <IKTextBox name="txtAudi" DataSource="IndentBill.Name_Assessor"></IKTextBox>
- <IKDateTimeText name="dtAssessDate" DataSource="IndentBill.AssessDate_IndentBill"></IKDateTimeText>
- <IKTextBox name="txtLastModUser" DataSource="IndentBill.LastModUserName"></IKTextBox>
- <IKDateTimeText name="dtLastModDate" DataSource="IndentBill.LastModDate_IndentBill"></IKDateTimeText>
- <IKTextBox name="txtCustomerName" DataSource="IndentBill.Name_Customer"></IKTextBox>
- <IKTextBox name="txtCustomerType" DataSource="IndentBill.Type_Customer"></IKTextBox>
- <IKComboBoxEx name="cbLinkman" DisplaySource="IndentBill.Name_Linkman" DataSource="Linkman" DisplayMember="Name_Linkman">
- <Events>
- <Reload>
- UpdateForm(false, "cbLinkman");
- Search("SearchLinkman", tbCustomerNo.CValue);
- UpdateForm(true, "cbLinkman");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKTextBox name="cbTele" DisplaySource="IndentBill.Tel_IndentBill" DataSource="Telephone" DisplayMember="No_Telephone">
- <Events>
- <Reload>
- UpdateForm(false, "cbTele");
- Search("SearchTele", tbCustomerNo.CValue);
- UpdateForm(true, "cbTele");
- </Reload>
- </Events>
- </IKTextBox>
- <IKTextBox name="cbFax" DisplaySource="IndentBill.Fax_IndentBill" DataSource="Fax" DisplayMember="No_Fax">
- <Events>
- <Reload>
- UpdateForm(false, "cbFax");
- Search("SearchFax", tbCustomerNo.CValue);
- UpdateForm(true, "cbFax");
- </Reload>
- </Events>
- </IKTextBox>
- <IKTextBox name="txtPostalcode" DataSource="IndentBill.PostalCode_Customer"></IKTextBox>
- <IKTextBox name="txtSendAddr" DataSource="IndentBill.SendAddr_IndentBill"></IKTextBox>
- <IKComboBoxEx name="cbInvoiceTitle" DisplaySource="IndentBill.InvoiceTitle_Company" ValueSource="IndentBill.InvoiceAddress_Company" DataSource="Invoice" DisplayMember="Title_Invoice" ValueMember="Address_Invoice">
- <Events>
- <Reload>
- UpdateForm(false, "cbInvoiceTitle");
- Search("SearchInvoice", tbCustomerNo.CValue);
- UpdateForm(true, "cbInvoiceTitle");
- </Reload>
- <SelectedIndexChanged>
- txtAdress.CValue=cbInvoiceTitle.SelectedValue1;
- </SelectedIndexChanged>
- </Events>
- </IKComboBoxEx>
- <IKTextBox name="txtAdress" DataSource="IndentBill.InvoiceAddress_Company"></IKTextBox>
- <IKNumericTextBox name="ntbNumSum" DataSource="IndentBill.NumSum"></IKNumericTextBox>
- <IKNumericTextBox name="ntbTaxSum" DataSource="IndentBill.TaxAmount_IndentBill"></IKNumericTextBox>
- <IKNumericTextBox name="ntbMoneySum" DataSource="IndentBill.GoodsAmount_IndentBill"></IKNumericTextBox>
- <IKNumericTextBox name="ntbSum" DataSource="IndentBill.Amount_IndentBill"></IKNumericTextBox>
- <IKDataGridEx name="dgProduct" DataSource="IndentBillProduct" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="IndentBillProduct.No_IndentBillProduct" />
- <DataColumn Index="1" DataSource="IndentBillProduct.No_Product" >
- <IKDataGridTextButtonColumn>
- <Events>
- <Click>
- @SetFlag=1;
- ShowSearchBox("ProductSearch","INFOMATION",#IndentBillProduct.No_Product);
- </Click>
- <SetFlagBeforeClick>
- @SetFlag=0;
- </SetFlagBeforeClick>
- </Events>
- </IKDataGridTextButtonColumn>
- </DataColumn>
- <DataColumn Index="2" DataSource="IndentBillProduct.Name_Product" />
- <DataColumn Index="3" DataSource="IndentBillProduct.Quantity_IndentBillProduct" />
- <DataColumn Index="4" DataSource="IndentBillProduct.Unit_Product" />
- <DataColumn Index="5" DataSource="IndentBillProduct.OrderPrice_IndentBillProduct" />
- <DataColumn Index="6" DataSource="IndentBillProduct.Discount_IndentBillProduct" />
- <DataColumn Index="7" DataSource="IndentBillProduct.UnitPrice_IndentBillProduct"/>
- <DataColumn Index="8" DataSource="IndentBillProduct.Amount_IndentBillProduct" />
- <DataColumn Index="9" DataSource="IndentBillProduct.Comment_IndentBillProduct" />
- <DataColumn Index="10" DataSource="IndentBillProduct.Name_BillType">
- <IKDataGridComboBoxColumn DisplaySourceEx="IndentBillProduct.Name_BillType" ValueSourceEx="IndentBillProduct.Type_FromBill" DataSourceEx="BillType" DisplayMemberEx="Name_BillType" ValueMemberEx="Value_BillType">
- <Events>
- <Reload>
- Search("SearchBillType");
- SetDataGridColumnDataSource(10,"dgProduct");
- </Reload>
- </Events>
- </IKDataGridComboBoxColumn>
- </DataColumn>
- <DataColumn Index="11" DataSource="IndentBillProduct.No_FromBill" />
- <DataColumn Index="12" DataSource="IndentBillProduct.No_FromBillProduct" />
- </IKDataGridEx>
- <IKDataGridEx name="dgRemark" DataSource="BillComment" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="BillComment.Comment_BillComment" />
- </IKDataGridEx>
- <IKDataGridEx name="dgReportComment" DataSource="ReportComment" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="ReportComment.Comment_ReportComment" />
- </IKDataGridEx>
- <!--<IKButton name="btnDelelte">
- <Events>
- <Click>
- if(#SystemSetting.SaleAndOutDepot_SystemSetting )
- {
- if(Search("SearchQuantitySale",#IndentBill.No_IndentBill))
- if(#QuantitySale.Quantity_Sale > 0)
- {
- MessageBox("该单据已有相应的销售记录,作废失败!",@Title);
- return;
- }
- }
- BeginUnAudit();
- #IndentBill.ID_Assessor = DBNull();
- #IndentBill.Name_Assessor = "";
- #IndentBill.Disable_IndentBill=true;
-
- UnAudit();
- ChangeMode("View");
-
- EndUnAudit();
- <Lable name="CountSum" />
- </Click>
- </Events>
- </IKButton>-->
- <IKButton name="btnCopy">
- <Events>
- <Click>
- ShowText("联系人:",#IndentBill.Name_Linkman,"联系电话:",#IndentBill.Tel_IndentBill,"传真:",#IndentBill.Fax_IndentBill,"发票抬头:",#IndentBill.InvoiceTitle_Company,"结算方式:",#IndentBill.GetMethod_IndentBill);
- </Click>
- </Events>
- </IKButton>
- <IKFormToolBar name="toolBar">
- <Events>
- <ClickFirst>
- if (Search("SearchIndentBillFirst",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight(@Title,"特价单","查看"),GetCurrentUser()))
- {
- ChangeMode("View");
- <Lable name="CountSum" />
- }
- </ClickFirst>
- <ClickPrev>
- if (Search("SearchIndentBillPrevious", tbNo.CValue,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight(@Title,"特价单","查看"),GetCurrentUser()))
- {
- ChangeMode("View");
- <Lable name="CountSum" />
- }
- </ClickPrev>
- <ClickNext>
- if (Search("SearchIndentBillNext", tbNo.CValue,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight(@Title,"特价单","查看"),GetCurrentUser()))
- {
- ChangeMode("View");
- <Lable name="CountSum" />
- }
- </ClickNext>
- <ClickLast>
- if (Search("SearchIndentBillLast",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight(@Title,"特价单","查看"),GetCurrentUser()))
- {
- ChangeMode("View");
- <Lable name="CountSum" />
- }
- </ClickLast>
- <ClickEmpty>
- ChangeMode("Search");
- </ClickEmpty>
- <ClickNew>
- <![CDATA[
- @NextNo = GetNextAutoNumber(true);
- if (!Equals(@NextNo, ""))
- {
- ChangeMode("New");
- #IndentBill.No_IndentBill = @NextNo;
- UpdateForm(true, "tbNo");
- }
- ]]>
- </ClickNew>
- <ClickSubmit>
- <Lable name="SubmitButtonClick" />
- if(@AuditMode)
- {
- <Lable name = "AuditLable"/>
- <Lable name="CountSum" />
- }
- </ClickSubmit>
- <ClickModify>
- ChangeMode("Modify");
- <Lable name="CountSum" />
- </ClickModify>
- <ClickDelete>
- Delete();
- ChangeMode("Search");
- </ClickDelete>
- <ClickPrint>
- ShowPrintBox("BillSearch",#IndentBill.No_IndentBill,#IndentBill.No_IndentBill,GetFieldRight(@Title,"特价单","查看")?"1":"0");
- </ClickPrint>
- <ClickAudit>
- if(@AuditMode)
- return;
- <Lable name = "AuditLable"/>
- <Lable name="CountSum" />
- </ClickAudit>
- <ClickUnAudit>
- BeginUnAudit();
- #IndentBill.ID_Assessor = DBNull();
- #IndentBill.Name_Assessor = "";
- UnAudit();
- ChangeMode("View");
- EndUnAudit();
- <Lable name="CountSum" />
- </ClickUnAudit>
- <ClickImport>
- ;
- </ClickImport>
- <ClickExport>
- ;
- </ClickExport>
- <ClickClose>
- ;
- </ClickClose>
- <ClickExpand>
- if(toolBar.ExpandForm==true)
- {
- pnRight.Visible=true;<!--PanelRight is not existed-->
- }
- else
- {
- pnRight.Visible=false;
- }
- </ClickExpand>
- <ClickImportItem>
- <![CDATA[
- if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="报价单")
- {
- ShowSearchBox("ImportPriceQueryBillControl","BILLCONVERT","#IndentBillProduct.Type_FromBill",23,"#IndentBillProduct.Name_BillType","报价单");
- }
- else
- if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="本单据")
- {
- @importing=true;
- ShowSearchBox("BillSearch","INFOMATIONCOPYNODEPOT","SearchIndentBillWithNo1",false,"#IndentBill.ID_IndentBill","#IndentBill.No_IndentBill","#IndentBill.Date_IndentBill","#IndentBill.ID_Assessor","#IndentBill.Name_Assessor","#IndentBill.LastModUser_IndentBill","#IndentBill.LastModUserName","#IndentBill.Name_Creator","#IndentBill.ID_Creator","#IndentBillProduct.ID_IndentBillProduct","#BillComment.ID_BillComment","#ReportComment.ID_ReportComment",RowCount("#IndentBillProduct"));
- @importing=false;
- }
- ]]>
- <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
- <Lable name="CountSum" />
- </ClickImportItem>
- <ClickExportItem>
- <![CDATA[
- if(toolBar.MenuItemText=="销货单")
- {
- ExportBillProductStart("#SaleBillProduct.Type_FromBill",24,"#SaleBillProduct.Name_BillType","订货单","#SaleBillProduct.No_FromBill",#IndentBill.No_IndentBill,"#SaleBill.No_Customer",#IndentBill.No_Customer,"#SaleBill.TaxCurrency_SaleBill",#IndentBill.TaxCurrency_IndentBill,"#SaleBill.Special_SaleBill",#IndentBill.Special_IndentBill,"#SaleBill.Principal_SaleBill",#IndentBill.Principal_IndentBill,"SaleBill.No_Principal",#IndentBill.No_Principal);
- ExportBillProduct("dgProduct","#IndentBillProduct","#SaleBillProduct.No_FromBillProduct","#IndentBillProduct.No_IndentBillProduct");
- }
-
- ]]>
- </ClickExportItem>
- </Events>
- </IKFormToolBar>
- </Controls>
- <Tables>
- <Table name="IndentBillProduct">
- <Events>
- <ColumnsChanged>
- <Name_BillType>
- <![CDATA[
- if (!Equals(#IndentBillProduct.Type_FromBill,0) && !Equals(#IndentBillProduct.Type_FromBill,DBNull())
- && !Equals(#IndentBillProduct.No_FromBill,"") && !Equals(#IndentBillProduct.No_FromBill,DBNull())
- && !Equals(#IndentBillProduct.No_FromBillProduct,"") && !Equals(#IndentBillProduct.No_FromBillProduct,DBNull()))
- {
- if (Search("SearchFromBillProductWithNo", #IndentBillProduct.No_FromBill, #IndentBillProduct.No_FromBillProduct))
- {
- if(!Equals(#FromBillProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
- if(#FromBillProduct.TaxCurrency_PriceQueryBill!=cbTaxCurrency.Text)
- {
- MessageBox("来源单据与当前单据币别不一致,请检查后修改!",@Title);
- }
- #IndentBillProduct.ID_Product = #FromBillProduct.ID_Product;
- #IndentBillProduct.No_Product = #FromBillProduct.No_Product;
- #IndentBillProduct.Name_Product = #FromBillProduct.Name_Product;
- #IndentBillProduct.Quantity_IndentBillProduct = #FromBillProduct.Quantity_PriceQueryBillProduct;
- #IndentBillProduct.Unit_Product = #FromBillProduct.Unit_Product;
- #IndentBillProduct.UnitPrice_IndentBillProduct = #FromBillProduct.UnitPrice_PriceQueryBillProduct;
- #IndentBillProduct.Discount_IndentBillProduct = #FromBillProduct.Discount_PriceQueryBillProduct;
- #IndentBillProduct.LowSalePrice_Product = #FromBillProduct.LowSalePrice_Product;
- #IndentBillProduct.OrderPrice_IndentBillProduct = #FromBillProduct.OrderPrice_PriceQueryBillProduct;
- #IndentBillProduct.Amount_IndentBillProduct =FormatNumber( #IndentBillProduct.UnitPrice_IndentBillProduct * #IndentBillProduct.Quantity_IndentBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- }
- }
- ]]>
- <Lable name="CountSum" />
- </Name_BillType>
- <No_FromBill>
- <![CDATA[
- if (!Equals(#IndentBillProduct.Type_FromBill,0) && !Equals(#IndentBillProduct.Type_FromBill,DBNull())
- && !Equals(#IndentBillProduct.No_FromBill,"") && !Equals(#IndentBillProduct.No_FromBill,DBNull())
- && !Equals(#IndentBillProduct.No_FromBillProduct,"") && !Equals(#IndentBillProduct.No_FromBillProduct,DBNull()))
- {
- if (Search("SearchFromBillProductWithNo", #IndentBillProduct.No_FromBill, #IndentBillProduct.No_FromBillProduct))
- {
- if(!Equals(#FromBillProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
- if(#FromBillProduct.TaxCurrency_PriceQueryBill!=cbTaxCurrency.Text)
- {
- MessageBox("来源单据与当前单据币别不一致,请检查后修改!",@Title);
- }
- #IndentBillProduct.ID_Product = #FromBillProduct.ID_Product;
- #IndentBillProduct.No_Product = #FromBillProduct.No_Product;
- #IndentBillProduct.Name_Product = #FromBillProduct.Name_Product;
- #IndentBillProduct.Quantity_IndentBillProduct = #FromBillProduct.Quantity_PriceQueryBillProduct;
- #IndentBillProduct.Unit_Product = #FromBillProduct.Unit_Product;
- #IndentBillProduct.UnitPrice_IndentBillProduct = #FromBillProduct.UnitPrice_PriceQueryBillProduct;
- #IndentBillProduct.Discount_IndentBillProduct = #FromBillProduct.Discount_PriceQueryBillProduct;
- #IndentBillProduct.LowSalePrice_Product = #FromBillProduct.LowSalePrice_Product;
- #IndentBillProduct.OrderPrice_IndentBillProduct = #FromBillProduct.OrderPrice_PriceQueryBillProduct;
- #IndentBillProduct.Amount_IndentBillProduct =FormatNumber( #IndentBillProduct.UnitPrice_IndentBillProduct * #IndentBillProduct.Quantity_IndentBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- }
- }
- ]]>
- <Lable name="CountSum" />
- </No_FromBill>
- <No_FromBillProduct>
- <![CDATA[
- if (!Equals(#IndentBillProduct.Type_FromBill,0) && !Equals(#IndentBillProduct.Type_FromBill,DBNull())
- && !Equals(#IndentBillProduct.No_FromBill,"") && !Equals(#IndentBillProduct.No_FromBill,DBNull())
- && !Equals(#IndentBillProduct.No_FromBillProduct,"") && !Equals(#IndentBillProduct.No_FromBillProduct,DBNull()))
- {
- if (Search("SearchFromBillProductWithNo", #IndentBillProduct.No_FromBill, #IndentBillProduct.No_FromBillProduct))
- {
- if(!Equals(#FromBillProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
- if(#FromBillProduct.TaxCurrency_PriceQueryBill!=cbTaxCurrency.Text)
- {
- MessageBox("来源单据与当前单据币别不一致,请检查后修改!",@Title);
- }
- #IndentBillProduct.ID_Product = #FromBillProduct.ID_Product;
- #IndentBillProduct.No_Product = #FromBillProduct.No_Product;
- #IndentBillProduct.Name_Product = #FromBillProduct.Name_Product;
- #IndentBillProduct.Quantity_IndentBillProduct = #FromBillProduct.Quantity_PriceQueryBillProduct;
- #IndentBillProduct.Unit_Product = #FromBillProduct.Unit_Product;
- #IndentBillProduct.UnitPrice_IndentBillProduct = #FromBillProduct.UnitPrice_PriceQueryBillProduct;
- #IndentBillProduct.Discount_IndentBillProduct = #FromBillProduct.Discount_PriceQueryBillProduct;
- #IndentBillProduct.LowSalePrice_Product = #FromBillProduct.LowSalePrice_Product;
- #IndentBillProduct.OrderPrice_IndentBillProduct = #FromBillProduct.OrderPrice_PriceQueryBillProduct;
- #IndentBillProduct.Amount_IndentBillProduct = FormatNumber( #IndentBillProduct.UnitPrice_IndentBillProduct * #IndentBillProduct.Quantity_IndentBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- }
- }
- ]]>
- <Lable name="CountSum" />
- </No_FromBillProduct>
- <No_Product>
- <![CDATA[
- if(@SetFlag==0)
- {
- return;
- }
- if (!Equals(#IndentBillProduct.No_Product,"") && !Equals(#IndentBillProduct.No_Product,DBNull()))
- {
- if (Search("SearchProductWithNo",#IndentBillProduct.No_Product))
- {
- if(!Equals(#Product.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
- #IndentBillProduct.ID_Product = #Product.ID_Product;
- #IndentBillProduct.Name_Product = #Product.Name_Product;
- #IndentBillProduct.Unit_Product = #Product.Unit_Product;
- if(cbTaxCurrency.Text=="内含")
- #IndentBillProduct.OrderPrice_IndentBillProduct=FormatNumber(#Product.Price_Product*(1+@CessOut),@PriceDecimal);
- else
- #IndentBillProduct.OrderPrice_IndentBillProduct=#Product.Price_Product;
- if(#IndentBillProduct.Discount_IndentBillProduct!=0)
- {
- #IndentBillProduct.UnitPrice_IndentBillProduct = FormatNumber(#IndentBillProduct.OrderPrice_IndentBillProduct*#IndentBillProduct.Discount_IndentBillProduct/100,@PriceDecimal);
- }
- else
- {
- if(Search("SearchRelation",#IndentBillProduct.No_Product,tbCustomerNo.CValue))
- {
- if(cbTaxCurrency.Text=="内含")
- #IndentBillProduct.UnitPrice_IndentBillProduct=#PriceReference.UnitPriceWithTax_PriceReference;
- else
- #IndentBillProduct.UnitPrice_IndentBillProduct = #PriceReference.UnitPrice_PriceReference;
- if(#IndentBillProduct.OrderPrice_IndentBillProduct==0)
- #IndentBillProduct.Discount_IndentBillProduct=100;
- else
- #IndentBillProduct.Discount_IndentBillProduct =FormatNumber(#IndentBillProduct.UnitPrice_IndentBillProduct/#IndentBillProduct.OrderPrice_IndentBillProduct*100,@PriceDecimal) ;
- }
- else
- {
- #IndentBillProduct.UnitPrice_IndentBillProduct = #IndentBillProduct.OrderPrice_IndentBillProduct;
- #IndentBillProduct.Discount_IndentBillProduct=100;
- }
- }
- #IndentBillProduct.LowSalePrice_Product = #Product.LowSalePrice_Product;
- #IndentBillProduct.Amount_IndentBillProduct =FormatNumber( #IndentBillProduct.UnitPrice_IndentBillProduct * #IndentBillProduct.Quantity_IndentBillProduct, @PriceDecimal);
-
- }
- else
- {
- MessageBox("该产品不存在!",@Title);
- #IndentBillProduct.ID_Product = GuidEmpty();
- #IndentBillProduct.Name_Product = "";
- #IndentBillProduct.Unit_Product = "";
- #IndentBillProduct.Quantity_IndentBillProduct = 0;
- #IndentBillProduct.UnitPrice_IndentBillProduct = 0;
- #IndentBillProduct.Amount_IndentBillProduct = 0;
- #IndentBillProduct.OrderPrice_IndentBillProduct = 0;
- @temp = ShowSearchBox("InputSearchProduct","INFOMATION",#IndentBillProduct.No_Product);
- if(@temp != "")
- {
- ResumeColumnEvent("#IndentBillProduct.No_Product");
- #IndentBillProduct.No_Product = @temp;
- ClearColumnEvent();
- }
- }
- }
- else
- {
- #IndentBillProduct.ID_Product = GuidEmpty();
- #IndentBillProduct.Name_Product = "";
- #IndentBillProduct.Unit_Product = "";
- #IndentBillProduct.Quantity_IndentBillProduct = 0;
- #IndentBillProduct.UnitPrice_IndentBillProduct = 0;
- #IndentBillProduct.Amount_IndentBillProduct = 0;
- #IndentBillProduct.OrderPrice_IndentBillProduct = 0;
- }
- ]]>
- <Lable name="CountSum" />
- </No_Product>
- <Quantity_IndentBillProduct>
- <![CDATA[
- #IndentBillProduct.Quantity_IndentBillProduct = FormatNumber(#IndentBillProduct.Quantity_IndentBillProduct, @PriceDecimal);
- UpdateForm(false, "cbLocation");
-
- #IndentBillProduct.Amount_IndentBillProduct = FormatNumber( #IndentBillProduct.UnitPrice_IndentBillProduct * #IndentBillProduct.Quantity_IndentBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- ]]><Lable name="CountSum" />
- </Quantity_IndentBillProduct>
- <UnitPrice_IndentBillProduct>
- #IndentBillProduct.UnitPrice_IndentBillProduct = FormatNumber(#IndentBillProduct.UnitPrice_IndentBillProduct, @PriceDecimal);
- if(#IndentBillProduct.OrderPrice_IndentBillProduct==0)
- #IndentBillProduct.Discount_IndentBillProduct=100;
- else
- #IndentBillProduct.Discount_IndentBillProduct =FormatNumber(#IndentBillProduct.UnitPrice_IndentBillProduct/#IndentBillProduct.OrderPrice_IndentBillProduct*100,@PriceDecimal) ;
- #IndentBillProduct.Amount_IndentBillProduct = FormatNumber(#IndentBillProduct.UnitPrice_IndentBillProduct * #IndentBillProduct.Quantity_IndentBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- <Lable name="CountSum" />
- </UnitPrice_IndentBillProduct>
- <Discount_IndentBillProduct>
- if(#IndentBillProduct.Discount_IndentBillProduct==0)
- {
- if(Search("SearchRelation",#IndentBillProduct.No_Product,tbCustomerNo.CValue))
- {
- if(cbTaxCurrency.Text=="内含")
- #IndentBillProduct.UnitPrice_IndentBillProduct=#PriceReference.UnitPriceWithTax_PriceReference;
- else
- #IndentBillProduct.UnitPrice_IndentBillProduct = #PriceReference.UnitPrice_PriceReference;
- if(#IndentBillProduct.OrderPrice_IndentBillProduct==0)
- #IndentBillProduct.Discount_IndentBillProduct=100;
- else
- #IndentBillProduct.Discount_IndentBillProduct =FormatNumber(#IndentBillProduct.UnitPrice_IndentBillProduct/#IndentBillProduct.OrderPrice_IndentBillProduct*100,@PriceDecimal) ;
- }
- else
- {
- #IndentBillProduct.UnitPrice_IndentBillProduct = #IndentBillProduct.OrderPrice_IndentBillProduct;
- #IndentBillProduct.Discount_IndentBillProduct=100;
- }
- }
- else
- {
- #IndentBillProduct.UnitPrice_IndentBillProduct =FormatNumber( #IndentBillProduct.OrderPrice_IndentBillProduct * #IndentBillProduct.Discount_IndentBillProduct/100,@PriceDecimal);
- }
- #IndentBillProduct.Amount_IndentBillProduct =FormatNumber( #IndentBillProduct.UnitPrice_IndentBillProduct * #IndentBillProduct.Quantity_IndentBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- <Lable name="CountSum" />
- </Discount_IndentBillProduct>
- </ColumnsChanged>
- <RowDeleted>
- <Lable name="CountSum" />
- </RowDeleted>
- </Events>
- </Table>
- </Tables>
- <LockInfomation LockID="ID_IndentBill" LockNO="No_IndentBill" LockSearchFunction="SearchIndentBillWithNo" LockAudit="ID_Assessor"/>
- <LogInfomation LogNO="#IndentBill.No_IndentBill" RecordFormField="" RecordDataGridField="#IndentBillProduct.No_Product,#IndentBillProduct.Quantity_IndentBillProduct,#IndentBillProduct.Amount_IndentBillProduct"/>
- <ChildFormsCheck ChildForm="ImportPriceQueryBillControl" Question="#PriceQueryBill.StateDay_PriceQueryBill" Value="无效" Message="此报价单的报价已超出有效期限,确认要转单吗?"/>
- <ChildForms>
- <ChildForm name="BillSearch" DataSource="IndentBill" SearchFunction="SearchAllBill" SearchFunctionCondition="SearchBillCondition" SearchFunctionByNo="SearchIndentBillWithNo">
- <DataColumn Index="0" MappingName="#IndentBill.No_IndentBill" HeaderText="订货单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="1" MappingName="#IndentBill.Date_IndentBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="2" MappingName="#IndentBill.No_Customer" HeaderText="客户编号" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="3" MappingName="#IndentBill.ShortName_Customer" HeaderText="客户名称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="4" MappingName="#IndentBill.Principal_IndentBill" HeaderText="业务负责" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="5" MappingName="#IndentBill.TaxCurrency_IndentBill" HeaderText="税别" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="5" MappingName="#IndentBill.Name_Linkman" HeaderText="联系人" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="6" MappingName="#IndentBill.Tel_IndentBill" HeaderText="电话" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="7" MappingName="#IndentBill.Fax_IndentBill" HeaderText="传真" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="CustomerSearch" DataSource="Customer" SearchFunction="SearchAllCustomer" SearchFunctionCondition="SearchCustomerCondition" SearchFunctionByNo="" MappingName="客户">
- <DataColumn Index="0" MappingName="#Customer.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="1" MappingName="#Customer.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="2" MappingName="#Customer.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="3" MappingName="#Customer.Level_Customer" HeaderText="客户等级" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="4" MappingName="#Customer.No_RegionalLeader" HeaderText="所属区域" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="5" MappingName="#Customer.IsGeneric_Customer" HeaderText="一般客户" Width="75" ColumnType="IKDataGridBoolColumn"/>
- <DataColumn Index="6" MappingName="#Customer.Zone_Customer" HeaderText="地区" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="7" MappingName="#Customer.SendAddr_Customer" HeaderText="送货地址" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="8" MappingName="#Customer.Name_Linkman" HeaderText="主要联系人" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="9" MappingName="#Customer.No_Telephone" HeaderText="客户电话" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="10" MappingName="#Customer.No_Fax" HeaderText="传真" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品" ReturnDataSource="IndentBillProduct" ShowCheckBox="true">
- <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn" ReturnMappingName="#IndentBillProduct.No_Product"/>
- <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="2" MappingName="#Product.Type_Product" HeaderText="产品类型" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="3" MappingName="#Product.Price_Product" HeaderText="标准售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
- <DataColumn Index="4" MappingName="#Product.LowSalePrice_Product" HeaderText="最低售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
- <DataColumn Index="5" MappingName="#Product.SafetyQty_Product" HeaderText="安全存量" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="InputSearchProduct" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品" >
- <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="2" MappingName="#Product.Type_Product" HeaderText="产品类型" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="3" MappingName="#Product.Price_Product" HeaderText="标准售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
- <DataColumn Index="4" MappingName="#Product.LowSalePrice_Product" HeaderText="最低售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
- <DataColumn Index="5" MappingName="#Product.SafetyQty_Product" HeaderText="安全存量" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="ImportPriceQueryBillControl" >
- <DataGridIndex DataSource="PriceQueryBill" SearchFunction="SearchAllPriceQueryBill" SearchFunctionByNo="" MappingName="" ReturnDataSource="IndentBillProduct">
- <DataColumn Index="0" MappingName="#PriceQueryBill.No_PriceQueryBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#IndentBillProduct.No_FromBill"/>
- <DataColumn Index="1" MappingName="#PriceQueryBill.Date_PriceQueryBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="2" MappingName="#PriceQueryBill.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#IndentBill.No_Customer"/>
- <DataColumn Index="3" MappingName="#PriceQueryBill.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="4" MappingName="#PriceQueryBill.State_PriceQueryBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="5" MappingName="#PriceQueryBill.StateDay_PriceQueryBill" HeaderText="有效单据" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="6" MappingName="#PriceQueryBill.TaxCurrency_PriceQueryBill" HeaderText="税别" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#IndentBill.TaxCurrency_IndentBill" />
- </DataGridIndex>
- <DataGridIndex DataSource="PriceQueryBillProduct" SearchFunction="SearchAllPriceQueryBillProduct" SearchFunctionByNo="" MappingName="">
- <DataColumn Index="0" MappingName="#PriceQueryBillProduct.No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="1" MappingName="#PriceQueryBillProduct.No_PriceQueryBillProduct" HeaderText="产品序号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#IndentBillProduct.No_FromBillProduct"/>
- <DataColumn Index="2" MappingName="#PriceQueryBillProduct.Name_Product" HeaderText="产品名称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="3" MappingName="#PriceQueryBillProduct.Quantity_PriceQueryBillProduct" HeaderText="数量" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
- <DataColumn Index="4" MappingName="#PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct" HeaderText="单价" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
- <DataColumn Index="5" MappingName="#PriceQueryBillProduct.Discount_PriceQueryBillProduct" HeaderText="折扣" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#IndentBillProduct.Discount_IndentBillProduct" Format="F2"/>
- </DataGridIndex>
- </ChildForm>
- </ChildForms>
- <FormatString>
- <Format name="SearchCustomerCondition">
- if(GetRight("客户基本资料","全权查看"))
- {
- FormatString("");
- }
- else
- {
- FormatString(" Customer.ID_Creator='{0}' ",GetLoginUserID());
- }
- </Format>
- <Format name="SearchBillCondition">
- if(GetRight("客户基本资料","全权查看"))
- {
- FormatString("");
- }
- else
- {
- FormatString(" Disable_IndentBill = 0 and Customer.ID_Creator='{0}' ",GetLoginUserID());
- }
- </Format>
- </FormatString>
- <ImportedInfo>
- @TaxCurrency=#IndentBill.TaxCurrency_IndentBill;
- UpdateForm(true, "tbCustomerNo");
- ActiveControlEvent("tbCustomerNo", "Enter");
- #IndentBill.TaxCurrency_IndentBill=@TaxCurrency;
- UpdateForm(true, "cbTaxCurrency");
- </ImportedInfo>
- </Client>
- <Server>
- <Tables>
- <Table name="IndentBill" Type="Parent">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 IndentBill.*, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer,
- Customer.Type_Customer, Customer.PostalCode_Customer,Customer.RegistedAddress_Customer,
- a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS LastModUserName,
- Location.No_Location, Location.Name_Location, CONVERT(decimal(18,6), 0) AS NumSum, CONVERT(decimal(18,6), 0) AS MoneySum,
- CONVERT(decimal(18,6), 0) AS TaxSum, Employee.No_Employee AS No_Principal ,Employee.Name_Employee AS Principal_IndentBill
- FROM IndentBill
- LEFT JOIN Customer ON Customer.ID_Customer = IndentBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = IndentBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = IndentBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = IndentBill.LastModUser_IndentBill
- LEFT JOIN Location ON Location.ID_Location = IndentBill.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee = IndentBill.ID_Principal" />
- <New CmdType="Text" CmdText="
- Insert Into IndentBill(ID_IndentBill,No_IndentBill,Date_IndentBill,ID_Location,ID_Customer,No_OrderBill
- ,GetMethod_IndentBill,ToGet_IndentBill,Name_Linkman,Tel_IndentBill,Fax_IndentBill,SendAddr_IndentBill
- ,InvoiceAddress_Company,InvoiceTitle_Company,TaxCurrency_IndentBill,Currency_IndentBill,ID_Principal
- ,ID_Creator,ID_Assessor,AssessDate_IndentBill,Disable_IndentBill,CreateDate_IndentBill,LastModUser_IndentBill
- ,LastModDate_IndentBill,Amount_IndentBill,GoodsAmount_IndentBill,TaxAmount_IndentBill,Discount_IndentBill,Special_IndentBill)
-
- Values(@ID_IndentBill, @No_IndentBill,@Date_IndentBill, @ID_Location, @ID_Customer, @No_OrderBill
- , @GetMethod_IndentBill, @ToGet_IndentBill, @Name_Linkman, @Tel_IndentBill, @Fax_IndentBill
- , @SendAddr_IndentBill, @InvoiceAddress_Company, @InvoiceTitle_Company, @TaxCurrency_IndentBill
- , @Currency_IndentBill, @ID_Principal, @ID_Creator, @ID_Assessor, @AssessDate_IndentBill, @Disable_IndentBill
- , @CreateDate_IndentBill,@LastModUser_IndentBill, @LastModDate_IndentBill, @Amount_IndentBill
- , @GoodsAmount_IndentBill, @TaxAmount_IndentBill, @Discount_IndentBill,@Special_IndentBill)
- ">
- <Params>
- <Param name="@ID_IndentBill" type="IndentBill.ID_IndentBill" sourceColumn="ID_IndentBill" />
- <Param name="@No_IndentBill" type="IndentBill.No_IndentBill" sourceColumn="No_IndentBill" />
- <Param name="@Date_IndentBill" type="IndentBill.Date_IndentBill" sourceColumn="Date_IndentBill" />
- <Param name="@ID_Location" type="IndentBill.ID_Location" sourceColumn="ID_Location" />
- <Param name="@ID_Customer" type="IndentBill.ID_Customer" sourceColumn="ID_Customer" />
- <Param name="@No_OrderBill" type="IndentBill.No_OrderBill" sourceColumn="No_OrderBill" />
- <Param name="@GetMethod_IndentBill" type="IndentBill.GetMethod_IndentBill" sourceColumn="GetMethod_IndentBill" />
- <Param name="@ToGet_IndentBill" type="IndentBill.ToGet_IndentBill" sourceColumn="ToGet_IndentBill" />
- <Param name="@Name_Linkman" type="IndentBill.Name_Linkman" sourceColumn="Name_Linkman" />
- <Param name="@Tel_IndentBill" type="IndentBill.Tel_IndentBill" sourceColumn="Tel_IndentBill" />
- <Param name="@Fax_IndentBill" type="IndentBill.Fax_IndentBill" sourceColumn="Fax_IndentBill" />
- <Param name="@SendAddr_IndentBill" type="IndentBill.SendAddr_IndentBill" sourceColumn="SendAddr_IndentBill" />
- <Param name="@InvoiceAddress_Company" type="IndentBill.InvoiceAddress_Company" sourceColumn="InvoiceAddress_Company" />
- <Param name="@InvoiceTitle_Company" type="IndentBill.InvoiceTitle_Company" sourceColumn="InvoiceTitle_Company" />
- <Param name="@TaxCurrency_IndentBill" type="IndentBill.TaxCurrency_IndentBill" sourceColumn="TaxCurrency_IndentBill" />
- <Param name="@Currency_IndentBill" type="IndentBill.Currency_IndentBill" sourceColumn="Currency_IndentBill" />
- <Param name="@ID_Principal" type="IndentBill.ID_Principal" sourceColumn="ID_Principal" />
- <Param name="@ID_Creator" type="IndentBill.ID_Creator" sourceColumn="ID_Creator" />
- <Param name="@ID_Assessor" type="IndentBill.ID_Assessor" sourceColumn="ID_Assessor" />
- <Param name="@AssessDate_IndentBill" type="IndentBill.AssessDate_IndentBill" sourceColumn="AssessDate_IndentBill" />
- <Param name="@Disable_IndentBill" type="IndentBill.Disable_IndentBill" sourceColumn="Disable_IndentBill" />
- <Param name="@CreateDate_IndentBill" type="IndentBill.CreateDate_IndentBill" sourceColumn="CreateDate_IndentBill" />
- <Param name="@LastModUser_IndentBill" type="IndentBill.LastModUser_IndentBill" sourceColumn="LastModUser_IndentBill" />
- <Param name="@LastModDate_IndentBill" type="IndentBill.LastModDate_IndentBill" sourceColumn="LastModDate_IndentBill" />
- <Param name="@Amount_IndentBill" type="IndentBill.Amount_IndentBill" sourceColumn="Amount_IndentBill" />
- <Param name="@GoodsAmount_IndentBill" type="IndentBill.GoodsAmount_IndentBill" sourceColumn="GoodsAmount_IndentBill" />
- <Param name="@TaxAmount_IndentBill" type="IndentBill.TaxAmount_IndentBill" sourceColumn="TaxAmount_IndentBill" />
- <Param name="@Discount_IndentBill" type="IndentBill.Discount_IndentBill" sourceColumn="Discount_IndentBill" />
- <Param name="@Special_IndentBill" type="IndentBill.Special_IndentBill" sourceColumn="Special_IndentBill" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText=" Update IndentBill Set
- No_IndentBill=@No_IndentBill,
- Date_IndentBill=@Date_IndentBill,
- ID_Location=@ID_Location,
- ID_Customer=@ID_Customer,
- No_OrderBill=@No_OrderBill,
- GetMethod_IndentBill=@GetMethod_IndentBill,
- ToGet_IndentBill=@ToGet_IndentBill,
- Name_Linkman=@Name_Linkman,
- Tel_IndentBill=@Tel_IndentBill,
- Fax_IndentBill=@Fax_IndentBill,
- SendAddr_IndentBill=@SendAddr_IndentBill,
- InvoiceAddress_Company=@InvoiceAddress_Company,
- InvoiceTitle_Company=@InvoiceTitle_Company,
- TaxCurrency_IndentBill=@TaxCurrency_IndentBill,
- Currency_IndentBill=@Currency_IndentBill,
- ID_Principal=@ID_Principal,
- ID_Creator=@ID_Creator,
- ID_Assessor=@ID_Assessor,
- AssessDate_IndentBill=@AssessDate_IndentBill,
- Disable_IndentBill=@Disable_IndentBill,
- CreateDate_IndentBill=@CreateDate_IndentBill,
- LastModUser_IndentBill=@LastModUser_IndentBill,
- LastModDate_IndentBill=@LastModDate_IndentBill,
- Amount_IndentBill=@Amount_IndentBill,
- GoodsAmount_IndentBill=@GoodsAmount_IndentBill,
- TaxAmount_IndentBill=@TaxAmount_IndentBill,
- Discount_IndentBill=@Discount_IndentBill,
- Special_IndentBill=@Special_IndentBill
- Where ID_IndentBill=@ID_IndentBill
- UPDATE Customer SET Customer.LastPrincipal_Customer=@ID_Principal,Customer.LastDiscount_Customer = @Discount_IndentBill, Customer.LastTax_Customer = @TaxCurrency_IndentBill WHERE Customer.ID_Customer = @ID_Customer
- ">
- <Params>
- <Param name="@ID_IndentBill" type="IndentBill.ID_IndentBill" sourceColumn="ID_IndentBill" />
- <Param name="@No_IndentBill" type="IndentBill.No_IndentBill" sourceColumn="No_IndentBill" />
- <Param name="@Date_IndentBill" type="IndentBill.Date_IndentBill" sourceColumn="Date_IndentBill" />
- <Param name="@ID_Location" type="IndentBill.ID_Location" sourceColumn="ID_Location" />
- <Param name="@ID_Customer" type="IndentBill.ID_Customer" sourceColumn="ID_Customer" />
- <Param name="@No_OrderBill" type="IndentBill.No_OrderBill" sourceColumn="No_OrderBill" />
- <Param name="@GetMethod_IndentBill" type="IndentBill.GetMethod_IndentBill" sourceColumn="GetMethod_IndentBill" />
- <Param name="@ToGet_IndentBill" type="IndentBill.ToGet_IndentBill" sourceColumn="ToGet_IndentBill" />
- <Param name="@Name_Linkman" type="IndentBill.Name_Linkman" sourceColumn="Name_Linkman" />
- <Param name="@Tel_IndentBill" type="IndentBill.Tel_IndentBill" sourceColumn="Tel_IndentBill" />
- <Param name="@Fax_IndentBill" type="IndentBill.Fax_IndentBill" sourceColumn="Fax_IndentBill" />
- <Param name="@SendAddr_IndentBill" type="IndentBill.SendAddr_IndentBill" sourceColumn="SendAddr_IndentBill" />
- <Param name="@InvoiceAddress_Company" type="IndentBill.InvoiceAddress_Company" sourceColumn="InvoiceAddress_Company" />
- <Param name="@InvoiceTitle_Company" type="IndentBill.InvoiceTitle_Company" sourceColumn="InvoiceTitle_Company" />
- <Param name="@TaxCurrency_IndentBill" type="IndentBill.TaxCurrency_IndentBill" sourceColumn="TaxCurrency_IndentBill" />
- <Param name="@Currency_IndentBill" type="IndentBill.Currency_IndentBill" sourceColumn="Currency_IndentBill" />
- <Param name="@ID_Principal" type="IndentBill.ID_Principal" sourceColumn="ID_Principal" />
- <Param name="@ID_Creator" type="IndentBill.ID_Creator" sourceColumn="ID_Creator" />
- <Param name="@ID_Assessor" type="IndentBill.ID_Assessor" sourceColumn="ID_Assessor" />
- <Param name="@AssessDate_IndentBill" type="IndentBill.AssessDate_IndentBill" sourceColumn="AssessDate_IndentBill" />
- <Param name="@Disable_IndentBill" type="IndentBill.Disable_IndentBill" sourceColumn="Disable_IndentBill" />
- <Param name="@CreateDate_IndentBill" type="IndentBill.CreateDate_IndentBill" sourceColumn="CreateDate_IndentBill" />
- <Param name="@LastModUser_IndentBill" type="IndentBill.LastModUser_IndentBill" sourceColumn="LastModUser_IndentBill" />
- <Param name="@LastModDate_IndentBill" type="IndentBill.LastModDate_IndentBill" sourceColumn="LastModDate_IndentBill" />
- <Param name="@Amount_IndentBill" type="IndentBill.Amount_IndentBill" sourceColumn="Amount_IndentBill" />
- <Param name="@GoodsAmount_IndentBill" type="IndentBill.GoodsAmount_IndentBill" sourceColumn="GoodsAmount_IndentBill" />
- <Param name="@TaxAmount_IndentBill" type="IndentBill.TaxAmount_IndentBill" sourceColumn="TaxAmount_IndentBill" />
- <Param name="@Discount_IndentBill" type="IndentBill.Discount_IndentBill" sourceColumn="Discount_IndentBill" />
- <Param name="@Special_IndentBill" type="IndentBill.Special_IndentBill" sourceColumn="Special_IndentBill" />
- </Params>
- </Update>
- <Audit CmdType="Text" CmdText=" DECLARE @SaleAndOutDepot bit
- DECLARE @Quantity_Sale decimal(14,4)
- DECLARE @Quantity_Indent decimal(14,4)
-
- SELECT @SaleAndOutDepot = SystemSetting.SaleAndOutDepot_SystemSetting FROM SystemSetting
- IF (@ID_Assessor IS NULL)
- BEGIN
- IF (@SaleAndOutDepot = 1 and @Disable_IndentBill=0)
- BEGIN
- SELECT @Quantity_Sale = SUM(IndentBillProduct.Quantity_Sale), @Quantity_Indent = SUM(IndentBillProduct.Quantity_IndentBillProduct) FROM IndentBillProduct
- WHERE IndentBillProduct.ID_IndentBill = @ID_IndentBill
- IF (@Quantity_Sale = @Quantity_Indent) or (@Quantity_Sale > @Quantity_Indent) AND (@Quantity_Sale > 0) AND (@Quantity_Indent > 0)
- BEGIN
- RAISERROR('该单据产品已经全部销货,取消审核失败!',16,1)
- RETURN
- END
- END
-
- END
-
- UPDATE IndentBill SET ID_Assessor = @ID_Assessor, AssessDate_IndentBill = @AssessDate_IndentBill,Disable_IndentBill=@Disable_IndentBill WHERE ID_IndentBill = @ID_IndentBill
-
-
- ">
- <Params>
- <Param name="@ID_IndentBill" type="IndentBill.ID_IndentBill" sourceColumn="ID_IndentBill" />
- <Param name="@ID_Location" type="IndentBill.ID_Location" sourceColumn="ID_Location" />
- <Param name="@ID_Assessor" type="IndentBill.ID_Assessor" sourceColumn="ID_Assessor" />
- <Param name="@AssessDate_IndentBill" type="IndentBill.AssessDate_IndentBill" sourceColumn="AssessDate_IndentBill" />
- <Param name="@ID_Customer" type="IndentBill.ID_Customer" sourceColumn="ID_Customer" />
- <Param name="@Disable_IndentBill" type="IndentBill.Disable_IndentBill" sourceColumn="Disable_IndentBill" />
- </Params>
- </Audit>
- <Delete CmdType="Text" CmdText=" DECLARE @SaleAndOutDepot bit
- DECLARE @Quantity_Sale decimal(14,4)
- SELECT @SaleAndOutDepot = SystemSetting.SaleAndOutDepot_SystemSetting FROM SystemSetting
- IF (@SaleAndOutDepot = 1)
- BEGIN
- SELECT @Quantity_Sale = SUM(IndentBillProduct.Quantity_Sale)
- FROM IndentBillProduct WHERE IndentBillProduct.ID_IndentBill = @ID_IndentBill
- IF (@Quantity_Sale > 0)
- BEGIN
- RAISERROR('该单据已有相应的销售记录,删除失败!',16,1)
- RETURN
- END
-
-
- END
- DELETE IndentBillProduct WHERE IndentBillProduct.ID_IndentBill = @ID_IndentBill
- DELETE BillComment WHERE BillComment.ID_Bill = @ID_IndentBill
- DELETE ReportComment WHERE ReportComment.ID_Bill = @ID_IndentBill
- IF (@SaleAndOutDepot = 1)
- BEGIN
- DELETE IndentBill WHERE IndentBill.ID_IndentBill = @ID_IndentBill
- END
- ELSE
- BEGIN
- UPDATE IndentBill SET IndentBill.Disable_IndentBill = 1 WHERE IndentBill.ID_IndentBill = @ID_IndentBill
- END">
- <Params>
- <Param name="@ID_IndentBill" type="IndentBill.ID_IndentBill" sourceColumn="ID_IndentBill" />
- </Params>
- </Delete>
- <FKErrorReport ErrorMessage="该单据已被其他单据引用,删除失败!" />
- <UNIQUEErrorReport ErrorMessage="该订货单号已存在,提交失败!" />
- </Table>
- <Table name="IndentBillProduct" Type="Child">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 IndentBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product,
- Product.LowSalePrice_Product, CONVERT(decimal(18,6), 0) AS Amount_IndentBillProduct, BillType.Name_BillType ,Convert(nvarchar(64),'') as No_IndentBill
- FROM IndentBillProduct
- LEFT JOIN Product ON Product.ID_Product = IndentBillProduct.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType = IndentBillProduct.Type_FromBill"/>
- <New CmdType="Text" CmdText="
- Insert Into IndentBillProduct(ID_IndentBillProduct, No_IndentBillProduct, ID_IndentBill, Type_FromBill, No_FromBill, No_FromBillProduct, ID_Product, Quantity_IndentBillProduct, OrderPrice_IndentBillProduct, Discount_IndentBillProduct, UnitPrice_IndentBillProduct, Comment_IndentBillProduct, Quantity_Sale)
- Values(@ID_IndentBillProduct, @No_IndentBillProduct, @ID_IndentBill, @Type_FromBill, @No_FromBill, @No_FromBillProduct, @ID_Product, @Quantity_IndentBillProduct, @OrderPrice_IndentBillProduct, @Discount_IndentBillProduct, @UnitPrice_IndentBillProduct, @Comment_IndentBillProduct, @Quantity_Sale)
-
- ">
- <Params>
- <Param name="@ID_IndentBillProduct" type="IndentBillProduct.ID_IndentBillProduct" sourceColumn="ID_IndentBillProduct" />
- <Param name="@No_IndentBillProduct" type="IndentBillProduct.No_IndentBillProduct" sourceColumn="No_IndentBillProduct" />
- <Param name="@ID_IndentBill" type="IndentBillProduct.ID_IndentBill" sourceColumn="ID_IndentBill" />
- <Param name="@Type_FromBill" type="IndentBillProduct.Type_FromBill" sourceColumn="Type_FromBill" />
- <Param name="@No_FromBill" type="IndentBillProduct.No_FromBill" sourceColumn="No_FromBill" />
- <Param name="@No_FromBillProduct" type="IndentBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
- <Param name="@ID_Product" type="IndentBillProduct.ID_Product" sourceColumn="ID_Product" />
- <Param name="@Quantity_IndentBillProduct" type="IndentBillProduct.Quantity_IndentBillProduct" sourceColumn="Quantity_IndentBillProduct" />
- <Param name="@OrderPrice_IndentBillProduct" type="IndentBillProduct.OrderPrice_IndentBillProduct" sourceColumn="OrderPrice_IndentBillProduct" />
- <Param name="@Discount_IndentBillProduct" type="IndentBillProduct.Discount_IndentBillProduct" sourceColumn="Discount_IndentBillProduct" />
- <Param name="@UnitPrice_IndentBillProduct" type="IndentBillProduct.UnitPrice_IndentBillProduct" sourceColumn="UnitPrice_IndentBillProduct" />
- <Param name="@Comment_IndentBillProduct" type="IndentBillProduct.Comment_IndentBillProduct" sourceColumn="Comment_IndentBillProduct" />
- <Param name="@Quantity_Sale" type="IndentBillProduct.Quantity_Sale" sourceColumn="Quantity_Sale" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText=" DECLARE @SaleAndOutDepot bit
- DECLARE @AvailableQty decimal(14,4)
- DECLARE @error nvarchar(64)
- DECLARE @IsGeneric_Customer BIT
- SELECT @IsGeneric_Customer=Customer.IsGeneric_Customer FROM Customer
- JOIN IndentBill ON Customer.ID_Customer=IndentBill.ID_Customer
- WHERE IndentBill.ID_IndentBill = @ID_IndentBill
-
- /*SELECT @SaleAndOutDepot = SystemSetting.SaleAndOutDepot_SystemSetting FROM SystemSetting
- IF (@SaleAndOutDepot = 1)
- BEGIN
- SELECT @AvailableQty = SUM(ProductStocks.AvailableQty_ProductStocks) FROM ProductStocks WHERE ProductStocks.ID_Product = @ID_Product
- IF @Quantity_IndentBillProduct > @AvailableQty
- BEGIN
- SET @error = N'序号为'+@No_IndentBillProduct+N'的订货数量大于可用库存数量,提交失败!请于关联单据处查询。'
- RAISERROR (@error,16,1)
- RETURN
- END
- END*/
- Update IndentBillProduct Set
- No_IndentBillProduct=@No_IndentBillProduct,
- ID_IndentBill=@ID_IndentBill,
- Type_FromBill=@Type_FromBill,
- No_FromBill=@No_FromBill,
- No_FromBillProduct=@No_FromBillProduct,
- ID_Product=@ID_Product,
- Quantity_IndentBillProduct=@Quantity_IndentBillProduct,
- OrderPrice_IndentBillProduct=@OrderPrice_IndentBillProduct,
- Discount_IndentBillProduct=@Discount_IndentBillProduct,
- UnitPrice_IndentBillProduct=@UnitPrice_IndentBillProduct,
- Comment_IndentBillProduct=@Comment_IndentBillProduct,
- Quantity_Sale=@Quantity_Sale
- Where ID_IndentBillProduct=@ID_IndentBillProduct
-
- ">
- <Params>
- <Param name="@ID_IndentBillProduct" type="IndentBillProduct.ID_IndentBillProduct" sourceColumn="ID_IndentBillProduct" />
- <Param name="@No_IndentBillProduct" type="IndentBillProduct.No_IndentBillProduct" sourceColumn="No_IndentBillProduct" />
- <Param name="@ID_IndentBill" type="IndentBillProduct.ID_IndentBill" sourceColumn="ID_IndentBill" />
- <Param name="@Type_FromBill" type="IndentBillProduct.Type_FromBill" sourceColumn="Type_FromBill" />
- <Param name="@No_FromBill" type="IndentBillProduct.No_FromBill" sourceColumn="No_FromBill" />
- <Param name="@No_FromBillProduct" type="IndentBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
- <Param name="@ID_Product" type="IndentBillProduct.ID_Product" sourceColumn="ID_Product" />
- <Param name="@Quantity_IndentBillProduct" type="IndentBillProduct.Quantity_IndentBillProduct" sourceColumn="Quantity_IndentBillProduct" />
- <Param name="@OrderPrice_IndentBillProduct" type="IndentBillProduct.OrderPrice_IndentBillProduct" sourceColumn="OrderPrice_IndentBillProduct" />
- <Param name="@Discount_IndentBillProduct" type="IndentBillProduct.Discount_IndentBillProduct" sourceColumn="Discount_IndentBillProduct" />
- <Param name="@UnitPrice_IndentBillProduct" type="IndentBillProduct.UnitPrice_IndentBillProduct" sourceColumn="UnitPrice_IndentBillProduct" />
- <Param name="@Comment_IndentBillProduct" type="IndentBillProduct.Comment_IndentBillProduct" sourceColumn="Comment_IndentBillProduct" />
- <Param name="@Quantity_Sale" type="IndentBillProduct.Quantity_Sale" sourceColumn="Quantity_Sale" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText=" DELETE IndentBillProduct WHERE ID_IndentBillProduct = @ID_IndentBillProduct">
- <Params>
- <Param name="@ID_IndentBillProduct" type="IndentBillProduct.ID_IndentBillProduct" sourceColumn="ID_IndentBillProduct" />
- <Param name="@No_IndentBillProduct" type="IndentBillProduct.No_IndentBillProduct" sourceColumn="No_IndentBillProduct" />
- <Param name="@ID_IndentBill" type="IndentBillProduct.ID_IndentBill" sourceColumn="ID_IndentBill" />
- <Param name="@Type_FromBill" type="IndentBillProduct.Type_FromBill" sourceColumn="Type_FromBill" />
- <Param name="@No_FromBill" type="IndentBillProduct.No_FromBill" sourceColumn="No_FromBill" />
- <Param name="@No_FromBillProduct" type="IndentBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
- <Param name="@ID_Product" type="IndentBillProduct.ID_Product" sourceColumn="ID_Product" />
- <Param name="@Quantity_IndentBillProduct" type="IndentBillProduct.Quantity_IndentBillProduct" sourceColumn="Quantity_IndentBillProduct" />
- <Param name="@OrderPrice_IndentBillProduct" type="IndentBillProduct.OrderPrice_IndentBillProduct" sourceColumn="OrderPrice_IndentBillProduct" />
- <Param name="@Discount_IndentBillProduct" type="IndentBillProduct.Discount_IndentBillProduct" sourceColumn="Discount_IndentBillProduct" />
- <Param name="@UnitPrice_IndentBillProduct" type="IndentBillProduct.UnitPrice_IndentBillProduct" sourceColumn="UnitPrice_IndentBillProduct" />
- <Param name="@Comment_IndentBillProduct" type="IndentBillProduct.Comment_IndentBillProduct" sourceColumn="Comment_IndentBillProduct" />
- <Param name="@Quantity_Sale" type="IndentBillProduct.Quantity_Sale" sourceColumn="Quantity_Sale" />
- </Params>
- </Delete>
- </Table>
- <Table name="BillComment" Type="Child">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 BillComment.* FROM BillComment"/>
- <New CmdType="Text" CmdText=" INSERT INTO BillComment (ID_BillComment, ID_Bill, Comment_BillComment)
- VALUES (@ID_BillComment, @ID_Bill, @Comment_BillComment)">
- <Params>
- <Param name="@ID_BillComment" type="BillComment.ID_BillComment" sourceColumn="ID_BillComment" />
- <Param name="@ID_Bill" type="BillComment.ID_Bill" sourceColumn="ID_Bill" />
- <Param name="@Comment_BillComment" type="BillComment.Comment_BillComment" sourceColumn="Comment_BillComment" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText=" UPDATE BillComment SET ID_Bill = @ID_Bill, Comment_BillComment = @Comment_BillComment
- WHERE ID_BillComment = @ID_BillComment">
- <Params>
- <Param name="@ID_BillComment" type="BillComment.ID_BillComment" sourceColumn="ID_BillComment" />
- <Param name="@ID_Bill" type="BillComment.ID_Bill" sourceColumn="ID_Bill" />
- <Param name="@Comment_BillComment" type="BillComment.Comment_BillComment" sourceColumn="Comment_BillComment" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText=" DELETE BillComment WHERE ID_BillComment = @ID_BillComment">
- <Params>
- <Param name="@ID_BillComment" type="BillComment.ID_BillComment" sourceColumn="ID_BillComment" />
- </Params>
- </Delete>
- </Table>
- <Table name="ReportComment" Type="Child">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 ReportComment.*,Convert(nvarchar(64),'') as No_IndentBill FROM ReportComment"/>
- <New CmdType="Text" CmdText=" INSERT INTO ReportComment (ID_ReportComment, ID_Bill, Comment_ReportComment)
- VALUES (@ID_ReportComment, @ID_Bill, @Comment_ReportComment)">
- <Params>
- <Param name="@ID_ReportComment" type="ReportComment.ID_ReportComment" sourceColumn="ID_ReportComment" />
- <Param name="@ID_Bill" type="ReportComment.ID_Bill" sourceColumn="ID_Bill" />
- <Param name="@Comment_ReportComment" type="ReportComment.Comment_ReportComment" sourceColumn="Comment_ReportComment" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText=" UPDATE ReportComment SET ID_Bill = @ID_Bill, Comment_ReportComment = @Comment_ReportComment
- WHERE ID_ReportComment = @ID_ReportComment">
- <Params>
- <Param name="@ID_ReportComment" type="ReportComment.ID_ReportComment" sourceColumn="ID_ReportComment" />
- <Param name="@ID_Bill" type="ReportComment.ID_Bill" sourceColumn="ID_Bill" />
- <Param name="@Comment_ReportComment" type="ReportComment.Comment_ReportComment" sourceColumn="Comment_ReportComment" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText=" DELETE ReportComment WHERE ID_ReportComment = @ID_ReportComment">
- <Params>
- <Param name="@ID_ReportComment" type="ReportComment.ID_ReportComment" sourceColumn="ID_ReportComment" />
- </Params>
- </Delete>
- </Table>
- </Tables>
- <Search>
- <SearchAllBill CmdType="Text" CmdText=" SELECT IndentBill.*, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer,
- Customer.Type_Customer, Customer.LastDiscount_Customer, Customer.PostalCode_Customer,
- a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS LastModUserName,
- Location.No_Location, Location.Name_Location, CONVERT(decimal(18,6), 0) AS NumSum, CONVERT(decimal(18,6), 0) AS MoneySum,
- CONVERT(decimal(18,6), 0) AS TaxSum, Employee.No_Employee AS No_Principal, Employee.Name_Employee AS Principal_IndentBill,
- statu= Case isnull(DataLength(IndentBill.ID_Assessor),0) WHEN 0 THEN CASE Disable_IndentBill WHEN 1 THEN '作废' ELSE '未审核' END ELSE '已审核' END
- FROM IndentBill
- LEFT JOIN Customer ON Customer.ID_Customer = IndentBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = IndentBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = IndentBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User= IndentBill.LastModUser_IndentBill
- LEFT JOIN Location ON Location.ID_Location = IndentBill.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee = IndentBill.ID_Principal
- ">
- <Tables>
- <Table name="AllBill" />
- </Tables>
- </SearchAllBill>
- <SearchCessOut CmdType="Text" CmdText=" SELECT SystemSetting.CessOut_SystemSetting,SysCurrency_SystemSetting,SAudit_FunctionSetting FROM SystemSetting, FunctionSetting">
- <Tables>
- <Table name="System" />
- </Tables>
- </SearchCessOut>
- <SearchContr CmdType="Text" CmdText=" SELECT SaleAndOutDepot_SystemSetting,OutDepotAndSaleBack_SystemSetting,SaleRtnSourceBill_SystemSetting,PriceDecimal_SystemSetting FROM SystemSetting">
- <Tables>
- <Table name="SystemSetting" />
- </Tables>
- </SearchContr>
- <SearchIndentBillWithNo CmdType="Text" CmdText=" DECLARE @ID_IndentBill uniqueidentifier
- SELECT IndentBill.*, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer, Customer.Type_Customer,
- Customer.LastDiscount_Customer, Customer.PostalCode_Customer,
- a.Name_User AS Name_Creator, ISNULL(b.Name_User, '') AS Name_Assessor, ISNULL(c.Name_User, '') AS LastModUserName,
- Location.No_Location, Location.Name_Location, Employee.No_Employee AS No_Principal,Employee.Name_Employee AS Principal_IndentBill,Customer.ID_Creator As CustomerCreator
- FROM IndentBill
- LEFT JOIN Customer ON Customer.ID_Customer = IndentBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = IndentBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = IndentBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = IndentBill.LastModUser_IndentBill
- LEFT JOIN Location ON Location.ID_Location = IndentBill.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee = IndentBill.ID_Principal
- WHERE IndentBill.No_IndentBill = @No_IndentBill
- SELECT @ID_IndentBill = IndentBill.ID_IndentBill FROM IndentBill WHERE IndentBill.No_IndentBill = @No_IndentBill
- SELECT IndentBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product,
- Product.LowSalePrice_Product, BillType.Name_BillType,
- (IndentBillProduct.Quantity_IndentBillProduct * IndentBillProduct.UnitPrice_IndentBillProduct) AS Amount_IndentBillProduct ,@No_IndentBill as No_IndentBill
- FROM IndentBillProduct
- LEFT JOIN Product ON Product.ID_Product = IndentBillProduct.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType = IndentBillProduct.Type_FromBill
- WHERE IndentBillProduct.ID_IndentBill = @ID_IndentBill ORDER BY CAST(IndentBillProduct.No_IndentBillProduct AS INT)
- SELECT BillComment.* FROM BillComment WHERE BillComment.ID_Bill = @ID_IndentBill order by BillComment.No_BillComment
- SELECT ReportComment.* FROM ReportComment WHERE ReportComment.ID_Bill = @ID_IndentBill order by ReportComment.No_ReportComment">
- <Params>
- <Param name="@No_IndentBill" type="IndentBill.No_IndentBill" Index="0" />
- </Params>
- <Tables>
- <Table name="IndentBill" />
- <Table name="IndentBillProduct" />
- <Table name="BillComment" />
- <Table name="ReportComment" />
- </Tables>
- </SearchIndentBillWithNo>
- <SearchLocation CmdType="Text" CmdText=" SELECT Location.ID_Location, Location.No_Location, Location.Name_Location FROM Location WHERE Location.Level_Location = 0 ORDER BY Location.No_Location">
- <Tables>
- <Table name="Location" />
- </Tables>
- </SearchLocation>
- <!--SELECT N.*,isnull(M.ToGetBalance_Customer,0.00) as ToGetBalance_Customer
- FROM
- (SELECT Customer.ID_Customer,Customer.IsGeneric_Customer, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer, Customer.Type_Customer, Customer.GetMethod_Customer, Customer.PostalCode_Customer, ISNULL(Customer.LastDiscount_Customer, 100) AS LastDiscount_Customer, Customer.SendAddr_Customer, Customer.SuspendDate_Customer, ISNULL(Customer.LastTax_Customer, '外加') AS LastTax_Customer
- FROM Customer
- WHERE Customer.No_Customer = @No_Customer
- )N
- Left join ( Select No_Customer,SUM(InvoiceMoney-IsNull(StrikedMoney,0)) As ToGetBalance_Customer
- From SaleInvoice Join Customer On Customer.ID_Customer=SaleInvoice.ID_Customer
- Join
- (
- Select ID_SaleInvoice,Sum(Quantity_SaleInvoiceProduct*UnitPrice_SaleInvoiceProduct*(1+TaxRate_SaleInvoiceProduct)) As InvoiceMoney
- From SaleInvoiceProduct
- Group By ID_SaleInvoice
- ) a On SaleInvoice.ID_SaleInvoice=a.ID_SaleInvoice
- Left Join
- (
- Select No_SaleInvoice,Sum(GoodsAmount_ReceivablesStrikeBills+TaxAmount_ReceivablesStrikeBills+GoodsDiscount_ReceivablesStrikeBills+TaxDiscount_ReceivablesStrikeBills) As StrikedMoney
- From ReceivablesStrikeBills
- Join ReceivablesStrike On ReceivablesStrike.ID_ReceivablesStrike=ReceivablesStrikeBills.ID_ReceivablesStrike
- Where ReceivablesStrike.ID_Assessor Is Not Null
- Group By No_SaleInvoice
- )b On SaleInvoice.No_SaleInvoice=b.No_SaleInvoice
- WHERE Customer.No_Customer = @No_Customer AND SaleInvoice.ID_Assessor IS NOT NULL AND SaleInvoice.Disable_SaleInvoice=0 AND (InvoiceMoney-IsNull(StrikedMoney,0)) > 0
- Group by No_Customer
- )M ON M.No_Customer=N.No_Customer-->
- <SearchCustomerWithNo CmdType="Text" CmdText=" declare @LastTax_Customer1 nvarchar(64)
- declare @LastTax_Customer2 nvarchar(64)
- declare @LastTax_Customer3 nvarchar(64)
- declare @STaxDefault1_FunctionSetting int
- declare @STaxDefault2_FunctionSetting int
- declare @STaxDefault3_FunctionSetting int
-
- select @STaxDefault1_FunctionSetting = STaxDefault1_FunctionSetting,
- @STaxDefault2_FunctionSetting = STaxDefault2_FunctionSetting, @STaxDefault3_FunctionSetting = STaxDefault3_FunctionSetting
- from FunctionSetting
- if @STaxDefault1_FunctionSetting=0
- begin
- select @LastTax_Customer1 = Customer.LastTax_Customer
- from Customer
- WHERE Customer.No_Customer = @No_Customer
- end
- else if @STaxDefault1_FunctionSetting = 1
- begin
- select top 1 @LastTax_Customer1 = TaxCurrency_IndentBill
- from IndentBill
- order by Date_IndentBill desc
- end
- else
- begin
- set @LastTax_Customer1 = '外加'
- end
- if @STaxDefault2_FunctionSetting=0
- begin
- select @LastTax_Customer2 = Customer.LastTax_Customer
- from Customer
- WHERE Customer.No_Customer = @No_Customer
- end
- else if @STaxDefault2_FunctionSetting = 1
- begin
- select top 1 @LastTax_Customer2 = TaxCurrency_IndentBill
- from IndentBill
- order by Date_IndentBill desc
-
- end
- else
- begin
- set @LastTax_Customer2 = '外加'
- end
- if @STaxDefault3_FunctionSetting=0
- begin
- select @LastTax_Customer3 = Customer.LastTax_Customer
- from Customer
- WHERE Customer.No_Customer = @No_Customer
- end
- else if @STaxDefault3_FunctionSetting = 1
- begin
- select top 1 @LastTax_Customer3 = TaxCurrency_IndentBill
- from IndentBill
- order by Date_IndentBill desc
-
- end
- else
- begin
- set @LastTax_Customer3 = '外加'
- end
- if @LastTax_Customer1 is null
- set @LastTax_Customer1 = isnull(@LastTax_Customer2, @LastTax_Customer3)
- DECLARE @ID_Customer uniqueidentifier
-
-
- SELECT Customer.ID_Customer,Customer.IsGeneric_Customer, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer, Customer.Type_Customer, Customer.GetMethod_Customer, Customer.PostalCode_Customer, ISNULL(Customer.LastDiscount_Customer, 100) AS LastDiscount_Customer, Customer.SendAddr_Customer, Customer.SuspendDate_Customer
- , ISNULL(@LastTax_Customer1, '外加') AS LastTax_Customer ,
- isnull(ToGetBalance_Customer,0.00) as ToGetBalance_Customer
-
- ,Employee.Name_Employee,Employee.No_Employee,Employee.ID_Employee As LastPrincipal_Customer
- FROM Customer
- --left join Employee on Customer.LastPrincipal_Customer = Employee.ID_Employee
- Left Join Principal On Principal.ID_Person = Customer.ID_Customer and IsMain_Principal = 1
- Left join Employee On Employee.ID_Employee = Principal.ID_Employee
- WHERE Customer.No_Customer = @No_Customer
- SELECT @ID_Customer = Customer.ID_Customer FROM Customer WHERE Customer.No_Customer = @No_Customer
- SELECT Telephone.No_Telephone FROM Telephone WHERE Telephone.ID_Person = @ID_Customer
- SELECT Fax.No_Fax FROM Fax WHERE Fax.ID_Person = @ID_Customer
- SELECT Linkman.Name_Linkman FROM Linkman WHERE Linkman.ID_Person = @ID_Customer And IsMain_Linkman=1
- SELECT Invoice.Title_Invoice, Invoice.Address_Invoice FROM Invoice WHERE Invoice.ID_Customer = @ID_Customer AND Invoice.Common_Invoice = 1
- ">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="Customer" />
- <Table name="Telephone" />
- <Table name="Fax" />
- <Table name="Linkman" />
- <Table name="Invoice" />
- </Tables>
- </SearchCustomerWithNo>
- <SearchAllCustomer CmdType="Text" CmdText="SELECT Customer.*,Linkman.Name_Linkman,Linkman.Tel_Linkman
- ,No_Telephone,No_Fax,RegionalLeader.No_RegionalLeader
- FROM
- (
- SELECT Customer.ID_Customer,Customer.No_Customer
- ,Customer.ShortName_Customer,Customer.Zone_Customer
- ,Customer.SendAddr_Customer,RegistedAddress_Customer
- ,SuspendDate_Customer,Customer.Type_Customer
- ,Customer.Level_Customer,Customer.IsGeneric_Customer
- ,ID_Linkman=(Select Top 1 ID_Linkman
- From Linkman
- Where ID_Person=Customer.ID_Customer
- And IsMain_Linkman=1 order by name_linkman)
- ,ID_RegionalLeader= (Select TOP 1 ID_RegionalLeader
- FROM RegionalLeader
- WHERE ID_RegionalLeader = Customer.ID_RegionalLeader)
- From Customer
- )Customer
- Left Join Linkman On Customer.ID_Linkman=Linkman.ID_Linkman
- LEFT JOIN RegionalLeader ON RegionalLeader.ID_RegionalLeader = Customer.ID_RegionalLeader
- LEFT JOIN Telephone ON Telephone.ID_Person = Customer.ID_Customer and Focus_Telephone = 1
- left join Fax ON Fax.ID_Person = Customer.ID_Customer and Focus_Fax = 1">
- <Tables>
- <Table name="AllCustomer" />
- </Tables>
- </SearchAllCustomer>
- <SearchAllProduct CmdType="Text" CmdText="SELECT Product.No_Product,Product.Name_Product,Type_Product, Price_Product, LowSalePrice_Product, SafetyQty_Product FROM Product ">
- <Tables>
- <Table name="AllProduct" />
- </Tables>
- </SearchAllProduct>
- <SearchAllPriceQueryBill CmdType="Text" CmdText="Select PriceQueryBill.ID_PriceQueryBill,PriceQueryBill.No_PriceQueryBill,PriceQueryBill.TaxCurrency_PriceQueryBill,PriceQueryBill.Date_PriceQueryBill,Customer.No_Customer,Customer.ShortName_Customer,Case When PriceQueryBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_PriceQueryBill ,Case When DateDiff(Day,GETDATE ( ),ValidDate_PriceQueryBill) > 0 Or DateDiff(Day,GETDATE ( ),ValidDate_PriceQueryBill) = 0 Then '有效' Else '无效' End As StateDay_PriceQueryBill From PriceQueryBill
- Inner Join Customer On PriceQueryBill.ID_Customer = Customer.ID_Customer " >
- <Tables>
- <Table name="AllPriceQueryBill" />
- </Tables>
- </SearchAllPriceQueryBill>
- <SearchAllPriceQueryBillProduct CmdType="Text" CmdText="Select Product.No_Product,PriceQueryBillProduct.No_PriceQueryBillProduct,Product.Name_Product,PriceQueryBillProduct.Quantity_PriceQueryBillProduct,PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct,PriceQueryBillProduct.Discount_PriceQueryBillProduct From PriceQueryBillProduct
- Inner Join Product On Product.ID_Product = PriceQueryBillProduct.ID_Product
- Inner Join PriceQueryBill On PriceQueryBill.ID_PriceQueryBill = PriceQueryBillProduct.ID_PriceQueryBill" >
- <Tables>
- <Table name="AllPriceQueryBillProduct" />
- </Tables>
- </SearchAllPriceQueryBillProduct>
- <SearchGetMethod CmdType="Text" CmdText=" CREATE TABLE GetMethod
- (
- [Type] nvarchar(64)
- )
- INSERT INTO GetMethod VALUES ('先款后货')
- INSERT INTO GetMethod VALUES ('月结')
- INSERT INTO GetMethod VALUES ('两月结')
- INSERT INTO GetMethod VALUES ('三月结')
- INSERT INTO GetMethod VALUES ('四月结')
- INSERT INTO GetMethod VALUES ('票到付款')
- SELECT Type AS Result FROM GetMethod
- DROP TABLE GetMethod">
- <Tables>
- <Table name="GetMethod" />
- </Tables>
- </SearchGetMethod>
- <SearchAllPrincipal CmdType="Text" CmdText="SELECT Employee.ID_Employee,Employee.No_Employee AS No_Principal, Employee.Name_Employee AS Principal_IndentBill
- FROM Employee order by Employee.No_Employee ">
- <Tables>
- <Table name="Principal" />
- </Tables>
- </SearchAllPrincipal>
- <SearchLinkman CmdType="Text" CmdText=" SELECT Linkman.Name_Linkman
- FROM Linkman
- INNER JOIN Customer ON Customer.ID_Customer = Linkman.ID_Person
- WHERE Customer.No_Customer = @No_Customer">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="Linkman" />
- </Tables>
- </SearchLinkman>
- <SearchTele CmdType="Text" CmdText=" SELECT Telephone.No_Telephone
- FROM Telephone
- INNER JOIN Customer ON Customer.ID_Customer = Telephone.ID_Person
- WHERE Customer.No_Customer = @No_Customer">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="Telephone" />
- </Tables>
- </SearchTele>
- <SearchFax CmdType="Text" CmdText=" SELECT Fax.No_Fax
- FROM Fax
- INNER JOIN Customer ON Customer.ID_Customer = Fax.ID_Person
- WHERE Customer.No_Customer = @No_Customer">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="Fax" />
- </Tables>
- </SearchFax>
- <SearchInvoice CmdType="Text" CmdText=" SELECT Invoice.Title_Invoice, Invoice.Address_Invoice
- FROM Invoice
- INNER JOIN Customer ON Customer.ID_Customer = Invoice.ID_Customer
- WHERE Customer.No_Customer = @No_Customer">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="Invoice" />
- </Tables>
- </SearchInvoice>
- <SearchBillType CmdType="Text" CmdText=" SELECT * FROM BillType WHERE Value_BillType = 23 OR Value_BillType = 0 ORDER BY Value_BillType">
- <Tables>
- <Table name="BillType" />
- </Tables>
- </SearchBillType>
- <SearchFromBillWithNo CmdType="Text" CmdText=" SELECT * FROM PriceQueryBill WHERE PriceQueryBill.No_PriceQueryBill = @No_PriceQueryBill">
- <Params>
- <Param name="@No_PriceQueryBill" type="PriceQueryBill.No_PriceQueryBill" Index="0" />
- </Params>
- <Tables>
- <Table name="FromBill" />
- </Tables>
- </SearchFromBillWithNo>
- <SearchFromBillProductWithNo CmdType="Text" CmdText=" SELECT PriceQueryBillProduct.ID_Product, PriceQueryBillProduct.Quantity_PriceQueryBillProduct,
- PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct, PriceQueryBillProduct.Discount_PriceQueryBillProduct, PriceQueryBillProduct.OrderPrice_PriceQueryBillProduct,
- Product.No_Product, Product.Name_Product, Product.Unit_Product, Product.SuspendDate_Product, Product.LowSalePrice_Product,PriceQueryBill.TaxCurrency_PriceQueryBill
- FROM PriceQueryBillProduct
- INNER JOIN PriceQueryBill ON PriceQueryBill.ID_PriceQueryBill = PriceQueryBillProduct.ID_PriceQueryBill
- INNER JOIN Product ON Product.ID_Product = PriceQueryBillProduct.ID_Product
- WHERE PriceQueryBill.No_PriceQueryBill = @No_PriceQueryBill AND PriceQueryBillProduct.No_PriceQueryBillProduct = @No_PriceQueryBillProduct">
- <Params>
- <Param name="@No_PriceQueryBill" type="PriceQueryBill.No_PriceQueryBill" Index="0" />
- <Param name="@No_PriceQueryBillProduct" type="PriceQueryBillProduct.No_PriceQueryBillProduct" Index="1" />
- </Params>
- <Tables>
- <Table name="FromBillProduct" />
- </Tables>
- </SearchFromBillProductWithNo>
- <SearchProductStocks CmdType="Text" CmdText=" SELECT AvailableQty_ProductStocks FROM ProductStocks WHERE ID_Product=@ID_Product AND ID_Location=@ID_Location">
- <Params>
- <Param name="@ID_Product" type="ProductStocks.ID_Product" Index="0" />
- <Param name="@ID_Location" type="ProductStocks.ID_Location" Index="1" />
- </Params>
- <Tables>
- <Table name="ProductStocks" />
- </Tables>
- </SearchProductStocks>
- <SearchProductWithNo CmdType="Text" CmdText=" SELECT ID_Product, Name_Product, Unit_Product, Price_Product, SuspendDate_Product, LowSalePrice_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>
- </SearchProductWithNo>
- <SearchRelation CmdType="Text" CmdText=" Select UnitPrice_PriceReference,UnitPriceWithTax_PriceReference From PriceReference
- Left Join Product On Product.ID_Product = PriceReference.ID_Product
- Left Join Customer On Customer.ID_Customer = PriceReference.ID_Customer
- Where No_Product = @No_Product And No_Customer = @No_Customer">
- <Params>
- <Param name="@No_Product" type="Product.No_Product" Index="0" />
- <Param name="@No_Customer" type="Customer.No_Customer" Index="1" />
- </Params>
- <Tables>
- <Table name="PriceReference" />
- </Tables>
- </SearchRelation>
- <SearchIndentBillFirst CmdType="Text" CmdText=" DECLARE @ID_IndentBill uniqueidentifier
- DECLARE @IndentBillNo nvarchar(64)
- SELECT TOP 1 @IndentBillNo = IndentBill.No_IndentBill FROM IndentBill
- Join Customer On Customer.ID_Customer=IndentBill.ID_Customer
- WHERE Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End --added for validating right
- and Special_IndentBill=case @Special when 1 then Special_IndentBill else 0 End --added for Special
- and Customer.ID_RegionalLeader in
- (Select ID_RegionalLeader From Principal
- Where ID_Employee in(select ID_Employee from Employee where Name_Employee=@Name_Employee)
- )
- ORDER BY IndentBill.No_IndentBill
- SELECT IndentBill.*, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer, Customer.Type_Customer,
- Customer.LastDiscount_Customer, Customer.PostalCode_Customer,
- a.Name_User AS Name_Creator, ISNULL(b.Name_User, '') AS Name_Assessor, ISNULL(c.Name_User, '') AS LastModUserName,
- Location.No_Location, Location.Name_Location, Employee.No_Employee AS No_Principal ,Employee.Name_Employee AS Principal_IndentBill
- FROM IndentBill
- LEFT JOIN Customer ON Customer.ID_Customer = IndentBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = IndentBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = IndentBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = IndentBill.LastModUser_IndentBill
- LEFT JOIN Location ON Location.ID_Location = IndentBill.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee = IndentBill.ID_Principal
- WHERE IndentBill.No_IndentBill = @IndentBillNo
- SELECT @ID_IndentBill = IndentBill.ID_IndentBill FROM IndentBill WHERE IndentBill.No_IndentBill = @IndentBillNo
- SELECT IndentBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product,
- Product.LowSalePrice_Product, BillType.Name_BillType,
- (IndentBillProduct.Quantity_IndentBillProduct * IndentBillProduct.UnitPrice_IndentBillProduct) AS Amount_IndentBillProduct,@IndentBillNo as No_IndentBill
- FROM IndentBillProduct
- LEFT JOIN Product ON Product.ID_Product = IndentBillProduct.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType = IndentBillProduct.Type_FromBill
- WHERE IndentBillProduct.ID_IndentBill = @ID_IndentBill ORDER BY CAST(IndentBillProduct.No_IndentBillProduct AS INT)
- SELECT BillComment.* FROM BillComment WHERE BillComment.ID_Bill = @ID_IndentBill order by BillComment.No_BillComment
- SELECT ReportComment.*,@IndentBillNo as No_IndentBill FROM ReportComment WHERE ReportComment.ID_Bill = @ID_IndentBill order by ReportComment.No_ReportComment">
- <Params>
- <Param name="@Right" type="IndentBill.ID_Customer" Index="0" />
- <Param name="@Special" type="IndentBill.Special_IndentBill" Index="1" />
- <Param name="@Name_Employee" type="Employee.Name_Employee" Index="2" />
- </Params>
- <Tables>
- <Table name="IndentBill" />
- <Table name="IndentBillProduct" />
- <Table name="BillComment" />
- <Table name="ReportComment" />
- </Tables>
- </SearchIndentBillFirst>
- <SearchIndentBillPrevious CmdType="Text" CmdText=" DECLARE @ID_IndentBill uniqueidentifier
- DECLARE @IndentBillNo nvarchar(64)
- SELECT TOP 1 @IndentBillNo = IndentBill.No_IndentBill FROM IndentBill
- Join Customer On Customer.ID_Customer=IndentBill.ID_Customer
- WHERE IndentBill.No_IndentBill < @No_IndentBill
- And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End --added for validating right
- and Special_IndentBill=case @Special when 1 then Special_IndentBill else 0 End --added for Special
- and Customer.ID_RegionalLeader in
- (Select ID_RegionalLeader From Principal
- Where ID_Employee in(select ID_Employee from Employee where Name_Employee=@Name_Employee)
- )
- ORDER BY IndentBill.No_IndentBill DESC
- SELECT IndentBill.*, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer, Customer.Type_Customer,
- Customer.LastDiscount_Customer, Customer.PostalCode_Customer,
- a.Name_User AS Name_Creator, ISNULL(b.Name_User, '') AS Name_Assessor, ISNULL(c.Name_User, '') AS LastModUserName,
- Location.No_Location, Location.Name_Location, Employee.No_Employee AS No_Principal ,Employee.Name_Employee AS Principal_IndentBill
- FROM IndentBill
- LEFT JOIN Customer ON Customer.ID_Customer = IndentBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = IndentBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = IndentBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = IndentBill.LastModUser_IndentBill
- LEFT JOIN Location ON Location.ID_Location = IndentBill.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee = IndentBill.ID_Principal
- WHERE IndentBill.No_IndentBill = @IndentBillNo
- SELECT @ID_IndentBill = IndentBill.ID_IndentBill FROM IndentBill WHERE IndentBill.No_IndentBill = @IndentBillNo
- SELECT IndentBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product,
- Product.LowSalePrice_Product, BillType.Name_BillType,
- (IndentBillProduct.Quantity_IndentBillProduct * IndentBillProduct.UnitPrice_IndentBillProduct) AS Amount_IndentBillProduct,@IndentBillNo as No_IndentBill
- FROM IndentBillProduct
- LEFT JOIN Product ON Product.ID_Product = IndentBillProduct.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType = IndentBillProduct.Type_FromBill
- WHERE IndentBillProduct.ID_IndentBill = @ID_IndentBill ORDER BY CAST(IndentBillProduct.No_IndentBillProduct AS INT)
- SELECT BillComment.* FROM BillComment WHERE BillComment.ID_Bill = @ID_IndentBill order by BillComment.No_BillComment
- SELECT ReportComment.*,@IndentBillNo as No_IndentBill FROM ReportComment WHERE ReportComment.ID_Bill = @ID_IndentBill order by ReportComment.No_ReportComment">
- <Params>
- <Param name="@No_IndentBill" type="IndentBill.No_IndentBill" Index="0" />
- <Param name="@Right" type="IndentBill.ID_Customer" Index="1" />
- <Param name="@Special" type="IndentBill.Special_IndentBill" Index="2" />
- <Param name="@Name_Employee" type="Employee.Name_Employee" Index="3" />
- </Params>
- <Tables>
- <Table name="IndentBill" />
- <Table name="IndentBillProduct" />
- <Table name="BillComment" />
- <Table name="ReportComment" />
- </Tables>
- </SearchIndentBillPrevious>
- <SearchIndentBillNext CmdType="Text" CmdText=" DECLARE @ID_IndentBill uniqueidentifier
- DECLARE @IndentBillNo nvarchar(64)
- SELECT TOP 1 @IndentBillNo = IndentBill.No_IndentBill FROM IndentBill
- Join Customer On Customer.ID_Customer=IndentBill.ID_Customer
- WHERE IndentBill.No_IndentBill > @No_IndentBill
- And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End --added for validating right
- and Special_IndentBill=case @Special when 1 then Special_IndentBill else 0 End --added for Special
- and Customer.ID_RegionalLeader in
- (Select ID_RegionalLeader From Principal
- Where ID_Employee in(select ID_Employee from Employee where Name_Employee=@Name_Employee)
- )
- ORDER BY IndentBill.No_IndentBill
- SELECT IndentBill.*, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer, Customer.Type_Customer,
- Customer.LastDiscount_Customer, Customer.PostalCode_Customer,
- a.Name_User AS Name_Creator, ISNULL(b.Name_User, '') AS Name_Assessor, ISNULL(c.Name_User, '') AS LastModUserName,
- Location.No_Location, Location.Name_Location, Employee.No_Employee AS No_Principal ,Employee.Name_Employee AS Principal_IndentBill
- FROM IndentBill
- LEFT JOIN Customer ON Customer.ID_Customer = IndentBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = IndentBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = IndentBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = IndentBill.LastModUser_IndentBill
- LEFT JOIN Location ON Location.ID_Location = IndentBill.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee = IndentBill.ID_Principal
- WHERE IndentBill.No_IndentBill = @IndentBillNo
- SELECT @ID_IndentBill = IndentBill.ID_IndentBill FROM IndentBill WHERE IndentBill.No_IndentBill = @IndentBillNo
- SELECT IndentBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product,
- Product.LowSalePrice_Product, BillType.Name_BillType,
- (IndentBillProduct.Quantity_IndentBillProduct * IndentBillProduct.UnitPrice_IndentBillProduct) AS Amount_IndentBillProduct,@IndentBillNo as No_IndentBill
- FROM IndentBillProduct
- LEFT JOIN Product ON Product.ID_Product = IndentBillProduct.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType = IndentBillProduct.Type_FromBill
- WHERE IndentBillProduct.ID_IndentBill = @ID_IndentBill ORDER BY CAST(IndentBillProduct.No_IndentBillProduct AS INT)
- SELECT BillComment.* FROM BillComment WHERE BillComment.ID_Bill = @ID_IndentBill order by BillComment.No_BillComment
- SELECT ReportComment.*,@IndentBillNo as No_IndentBill FROM ReportComment WHERE ReportComment.ID_Bill = @ID_IndentBill order by ReportComment.No_ReportComment">
- <Params>
- <Param name="@No_IndentBill" type="IndentBill.No_IndentBill" Index="0" />
- <Param name="@Right" type="IndentBill.ID_Customer" Index="1" />
- <Param name="@Special" type="IndentBill.Special_IndentBill" Index="2" />
- <Param name="@Name_Employee" type="Employee.Name_Employee" Index="3" />
- </Params>
- <Tables>
- <Table name="IndentBill" />
- <Table name="IndentBillProduct" />
- <Table name="BillComment" />
- <Table name="ReportComment" />
- </Tables>
- </SearchIndentBillNext>
- <SearchSale CmdType="Text" CmdText=" SELECT ISNULL(SUM(Quantity_Sale), 0) AS Quantity_Sale FROM IndentBillProduct WHERE ID_IndentBill = @ID_IndentBill" >
- <Params>
- <Param name="@ID_IndentBill" type="IndentBill.ID_IndentBill" Index="0" />
- </Params>
- <Tables>
- <Table name="SaleQuantity" />
- </Tables>
- </SearchSale>
- <SearchIndentBillLast CmdType="Text" CmdText=" DECLARE @ID_IndentBill uniqueidentifier
- DECLARE @IndentBillNo nvarchar(64)
- SELECT TOP 1 @IndentBillNo = IndentBill.No_IndentBill FROM IndentBill
- Join Customer On Customer.ID_Customer=IndentBill.ID_Customer
- WHERE Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End --added for validating right
- and Special_IndentBill=case @Special when 1 then Special_IndentBill else 0 End --added for Special
- and Customer.ID_RegionalLeader in
- (Select ID_RegionalLeader From Principal
- Where ID_Employee in(select ID_Employee from Employee where Name_Employee=@Name_Employee)
- )
- ORDER BY IndentBill.No_IndentBill DESC
- SELECT IndentBill.*, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer, Customer.Type_Customer,
- Customer.LastDiscount_Customer, Customer.PostalCode_Customer,
- a.Name_User AS Name_Creator, ISNULL(b.Name_User, '') AS Name_Assessor, ISNULL(c.Name_User, '') AS LastModUserName,
- Location.No_Location, Location.Name_Location, Employee.No_Employee AS No_Principal ,Employee.Name_Employee AS Principal_IndentBill
- FROM IndentBill LEFT JOIN Customer ON Customer.ID_Customer = IndentBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = IndentBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = IndentBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = IndentBill.LastModUser_IndentBill
- LEFT JOIN Location ON Location.ID_Location = IndentBill.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee = IndentBill.ID_Principal
- WHERE IndentBill.No_IndentBill = @IndentBillNo
- SELECT @ID_IndentBill = IndentBill.ID_IndentBill FROM IndentBill WHERE IndentBill.No_IndentBill = @IndentBillNo
- SELECT IndentBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product,
- Product.LowSalePrice_Product, BillType.Name_BillType,
- (IndentBillProduct.Quantity_IndentBillProduct * IndentBillProduct.UnitPrice_IndentBillProduct) AS Amount_IndentBillProduct,@IndentBillNo as No_IndentBill
- FROM IndentBillProduct
- LEFT JOIN Product ON Product.ID_Product = IndentBillProduct.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType = IndentBillProduct.Type_FromBill
- WHERE IndentBillProduct.ID_IndentBill = @ID_IndentBill ORDER BY CAST(IndentBillProduct.No_IndentBillProduct AS INT)
- SELECT BillComment.* FROM BillComment WHERE BillComment.ID_Bill = @ID_IndentBill order by BillComment.No_BillComment
- SELECT ReportComment.*,@IndentBillNo as No_IndentBill FROM ReportComment WHERE ReportComment.ID_Bill = @ID_IndentBill order by ReportComment.No_ReportComment">
- <Params>
- <Param name="@Right" type="IndentBill.ID_Customer" Index="0" />
- <Param name="@Special" type="IndentBill.Special_IndentBill" Index="1" />
- <Param name="@Name_Employee" type="Employee.Name_Employee" Index="2" />
- </Params>
- <Tables>
- <Table name="IndentBill" />
- <Table name="IndentBillProduct" />
- <Table name="BillComment" />
- <Table name="ReportComment" />
- </Tables>
- </SearchIndentBillLast>
- <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>
- <SearchTypeComment CmdType="Text" CmdText=" declare @SRemark1_FunctionSetting int
- declare @SRemark2_FunctionSetting int
- Select @SRemark1_FunctionSetting = SRemark1_FunctionSetting, @SRemark2_FunctionSetting = SRemark2_FunctionSetting
- from FunctionSetting
- declare @ID_IndentBill uniqueidentifier
- declare @flag int
- set @flag = 0
-
- if @SRemark1_FunctionSetting = 0
- begin
- select top 1 @ID_IndentBill = IndentBill.ID_IndentBill
- from IndentBill
- where ID_Customer = @ID_Customer
- order by IndentBill.Date_IndentBill desc
- if exists( select ReportComment.* from ReportComment where ReportComment.ID_Bill = @ID_IndentBill)
- begin
- select ReportComment.Comment_ReportComment from ReportComment where ReportComment.ID_Bill = @ID_IndentBill order by ReportComment.No_ReportComment
- set @flag = 1
- end
- end
- else
- begin
- if exists(SELECT Name_TypeDef FROM TypeDef WHERE Type_TypeDef=26 )
- begin
- SELECT Name_TypeDef as Comment_ReportComment FROM TypeDef WHERE Type_TypeDef=26
- set @flag = 1
- end
- end
- if @flag = 0
- begin
- if @SRemark2_FunctionSetting = 0
- begin
- select top 1 @ID_IndentBill = IndentBill.ID_IndentBill
- from IndentBill
- where ID_Customer = @ID_Customer
- order by IndentBill.Date_IndentBill desc
- select ReportComment.Comment_ReportComment from ReportComment where ReportComment.ID_Bill = @ID_IndentBill order by ReportComment.No_ReportComment
- end
- else
- begin
- SELECT Name_TypeDef as Comment_ReportComment FROM TypeDef WHERE Type_TypeDef=26
- end
- end
- ">
- <Params>
- <Param name="@ID_Customer" type="IndentBill.ID_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="TypeComment" />
- </Tables>
- </SearchTypeComment>
- <SearchRespiteForIndentBill CmdType="Text" CmdText="
- SELECT Name_TypeDef as Result FROM TypeDef WHERE Type_TypeDef=0
- ">
- <Tables>
- <Table name="RespiteForIndentBill" />
- </Tables>
- </SearchRespiteForIndentBill>
- <SearchQuantitySale CmdType="Text" CmdText="Select Quantity_Sale From IndentBillProduct
- Left join IndentBill On IndentBill.ID_IndentBill = IndentBillProduct.ID_IndentBill
- Where No_IndentBill = @No_IndentBill">
- <Params>
- <Param name="@No_IndentBill" type="IndentBill.No_IndentBill" Index="0" />
- </Params>
- <Tables>
- <Table name="QuantitySale" />
- </Tables>
- </SearchQuantitySale>
- <SearchIndentBillWithNo1 CmdType="Text" CmdText=" DECLARE @ID_IndentBill uniqueidentifier
- SELECT IndentBill.*, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer, Customer.Type_Customer,
- Customer.LastDiscount_Customer, Customer.PostalCode_Customer,
- a.Name_User AS Name_Creator, ISNULL(b.Name_User, '') AS Name_Assessor, ISNULL(c.Name_User, '') AS LastModUserName,
- Location.No_Location, Location.Name_Location, Employee.No_Employee AS No_Principal,Employee.Name_Employee AS Principal_IndentBill,Customer.ID_Creator As CustomerCreator
- FROM IndentBill
- LEFT JOIN Customer ON Customer.ID_Customer = IndentBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = IndentBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = IndentBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = IndentBill.LastModUser_IndentBill
- LEFT JOIN Location ON Location.ID_Location = IndentBill.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee = IndentBill.ID_Principal
- WHERE IndentBill.No_IndentBill = @No_IndentBill
- SELECT @ID_IndentBill = IndentBill.ID_IndentBill FROM IndentBill WHERE IndentBill.No_IndentBill = @No_IndentBill
-
- Select identity(int,1,1) as No_IndentBillProduct, ID_IndentBillProduct,ID_IndentBill,Type_FromBill,No_FromBill,No_FromBillProduct,ID_Product,
- Quantity_IndentBillProduct,OrderPrice_IndentBillProduct,Discount_IndentBillProduct,UnitPrice_IndentBillProduct,Comment_IndentBillProduct,Quantity_Sale Into #IndentBillProduct From IndentBillProduct
- Where ID_IndentBill = @ID_IndentBill
-
- SELECT (@Count+No_IndentBillProduct) as No_IndentBillProduct, ID_IndentBillProduct,ID_IndentBill,Type_FromBill,No_FromBill,No_FromBillProduct,#IndentBillProduct.ID_Product,
- Quantity_IndentBillProduct,OrderPrice_IndentBillProduct,Discount_IndentBillProduct,UnitPrice_IndentBillProduct,Comment_IndentBillProduct,Quantity_Sale, Product.No_Product, Product.Name_Product, Product.Unit_Product,
- Product.LowSalePrice_Product, BillType.Name_BillType,
- (#IndentBillProduct.Quantity_IndentBillProduct * #IndentBillProduct.UnitPrice_IndentBillProduct) AS Amount_IndentBillProduct ,@No_IndentBill as No_IndentBill
- FROM #IndentBillProduct
- LEFT JOIN Product ON Product.ID_Product = #IndentBillProduct.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType = #IndentBillProduct.Type_FromBill
- WHERE #IndentBillProduct.ID_IndentBill = @ID_IndentBill ORDER BY CAST(#IndentBillProduct.No_IndentBillProduct AS INT)
- Drop Table #IndentBillProduct
-
- SELECT BillComment.* FROM BillComment WHERE BillComment.ID_Bill = @ID_IndentBill order by BillComment.No_BillComment
- SELECT ReportComment.* FROM ReportComment WHERE ReportComment.ID_Bill = @ID_IndentBill order by ReportComment.No_ReportComment">
- <Params>
- <Param name="@No_IndentBill" type="IndentBill.No_IndentBill" Index="0" />
- <Param name="@Count" type="SaleBillProduct.Type_FromBill" Index="1" />
- </Params>
- <Tables>
- <Table name="IndentBill" />
- <Table name="IndentBillProduct" />
- <Table name="BillComment" />
- <Table name="ReportComment" />
- </Tables>
- </SearchIndentBillWithNo1>
- <SearchLowSalePrice CmdType="Text" CmdText="Select * From Product Where ID_Product = @ID_Product">
- <Params>
- <Param name="@ID_Product" type="Product.ID_Product" Index="0" />
- </Params>
- <Tables>
- <Table name="LowSalePrice" />
- </Tables>
- </SearchLowSalePrice>
- <SearchCustomersIsInRegionalLeader CmdType="Text" CmdText="select * from Employee
- where ID_Employee
- in
- (
- Select ID_Employee from Principal
- where ID_RegionalLeader
- in
- (
- select ID_RegionalLeader from Customer
- where No_Customer = @No_Customer
- )
- )
- and Employee.Name_Employee = @Name_Employee
- ">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" />
- <Param name="@Name_Employee" type="Employee.Name_Employee" />
- </Params>
- <Tables>
- <Table name="IsInRegionalLeader" />
- </Tables>
- </SearchCustomersIsInRegionalLeader>
- </Search>
- </Server>
- <Lables>
- <Search>
- Empty();
- NewInstance();
- dtpDate.Enabled = false;
- tbNo.ReadOnly = false;
- cbLocation.Enabled = false;
- tbCustomerNo.ReadOnly = true;
- txtOrderBillNo.ReadOnly = true;
- cbGetMethod.Enabled = false;
- ntbDiscount.ReadOnly = true;
- cbTaxCurrency.Enabled = false;
- cbPrincipal.Enabled = false;
- cbLinkman.Enabled = false;
- cbTele.Enabled = false;
- ckSpecial.Enabled=false;
- cbFax.Enabled = false;
- txtSendAddr.ReadOnly = true;
- cbInvoiceTitle.Enabled = false;
- txtAdress.ReadOnly = true;
- dgProduct.ReadOnly = true;
- dgRemark.ReadOnly = true;
- dgReportComment.ReadOnly = true;
- toolBar.EnableNew = GetRight(@Title,"新增");
- toolBar.EnableSubmit = false;
- toolBar.EnableModify = false;
- toolBar.EnableDelete = false;
- toolBar.EnableAudit = false;
- toolBar.EnableUnAudit = false;
- toolBar.EnablePrint = false;
- toolBar.EnableExport = false;
- toolBar.EnableImport = false;
- toolBar.EnableAssess = false;
- toolBar.EnableUnAssess = false;
- btnDelete.Enabled = false;
- #IndentBill.ID_Location = DBNull();
- #IndentBill.ToGet_IndentBill = 0;
- #IndentBill.Discount_IndentBill = 0;
- #IndentBill.TaxCurrency_IndentBill = "";
- #IndentBill.Currency_IndentBill = "";
- #IndentBill.AssessDate_IndentBill = DBNull();
- #IndentBill.LastModUser_IndentBill = DBNull();
- #IndentBill.LastModDate_IndentBill = DBNull();
- #IndentBill.NumSum = 0;
- #IndentBill.MoneySum = 0;
- #IndentBill.TaxSum = 0;
- #IndentBill.Amount_IndentBill = 0;
- UpdateForm(true, "");
- tbNo.Focus();
- @Status = 0;
- </Search>
- <New>
- Empty();
- NewInstance();
- @viewMode = false;
- dtpDate.Enabled = true;
- tbNo.ReadOnly = true;
- cbLocation.Enabled = true;
- tbCustomerNo.ReadOnly = false;
- txtOrderBillNo.ReadOnly = false;
- cbGetMethod.Enabled = true;
- ntbDiscount.ReadOnly = false;
- cbTaxCurrency.Enabled = true;
- cbPrincipal.Enabled = true;
- cbLinkman.Enabled = true;
- cbTele.Enabled = true;
- cbFax.Enabled = true;
- ckSpecial.Enabled=GetFieldRight(@Title,"特价单","修改");
- txtSendAddr.ReadOnly = false;
- cbInvoiceTitle.Enabled = true;
- txtAdress.ReadOnly = false;
- dgProduct.ReadOnly = false;
- dgRemark.ReadOnly = false;
- dgReportComment.ReadOnly = false;
- toolBar.EnableNew = false;
- toolBar.EnableSubmit = GetRight(@Title,"新增");
- toolBar.EnableModify = false;
- toolBar.EnableDelete = false;
- toolBar.EnableAudit = false;
- toolBar.EnableUnAudit = false;
- toolBar.EnablePrint = false;
- toolBar.EnableExport = false;
- toolBar.EnableImport = true;
- toolBar.EnableAssess = false;
- toolBar.EnableUnAssess = false;
- btnDelete.Enabled = false;
- #IndentBill.ID_IndentBill = NewGuid();
- #IndentBill.ID_Location = DBNull();
- #IndentBill.ToGet_IndentBill = 0;
- #IndentBill.Discount_IndentBill = 100;
- #IndentBill.TaxCurrency_IndentBill = "外加";
- #IndentBill.Currency_IndentBill = @SysCurrency;
- #IndentBill.ID_Creator = GetLoginUserID();
- #IndentBill.Name_Creator = GetCurrentUser();
- #IndentBill.ID_Assessor = DBNull();
- #IndentBill.AssessDate_IndentBill = DBNull();
- #IndentBill.LastModUser_IndentBill = DBNull();
- #IndentBill.LastModDate_IndentBill = DBNull();
- #IndentBill.NumSum = 0;
- #IndentBill.MoneySum = 0;
- #IndentBill.TaxSum = 0;
- #IndentBill.Amount_IndentBill = 0;
- #IndentBill.ID_Location = GetCurrentDepotID();
- #IndentBill.Name_Location = GetCurrentDepot();
- #IndentBill.No_Location = GetCurrentDepotNo();
- #IndentBill.Date_IndentBill = GetCurrentTime();
- dgProduct.SetColumnReadOnly(1, false);
- dgProduct.SetColumnReadOnly(9, false);
- dgProduct.SetColumnReadOnly(10, false);
- dgProduct.SetColumnReadOnly(11, false);
- dgProduct.RowHeaderCheck=true;
- dgProduct.AllowNew(true);
- dgProduct.AllowDelete(true);
- SetColumnDefaultValue("IndentBillProduct", "Discount_IndentBillProduct", #IndentBill.Discount_IndentBill);
- SetColumnDefaultValue("IndentBillProduct", "Quantity_IndentBillProduct", 1);
- UpdateForm(true, "");
- dtpDate.Focus();
- @Status = 1;
- </New>
- <View>
- @viewMode = true;
- dtpDate.Enabled = false;
- tbNo.ReadOnly = false;
- cbLocation.Enabled = false;
- tbCustomerNo.ReadOnly = true;
- txtOrderBillNo.ReadOnly = true;
- cbGetMethod.Enabled = false;
- ntbDiscount.ReadOnly = true;
- cbTaxCurrency.Enabled = false;
- cbPrincipal.Enabled = false;
- cbLinkman.Enabled = false;
- cbTele.Enabled = false;
- cbFax.Enabled = false;
- ckSpecial.Enabled=false;
- txtSendAddr.ReadOnly = true;
- cbInvoiceTitle.Enabled = false;
- txtAdress.ReadOnly = true;
- dgProduct.ReadOnly = true;
- dgRemark.ReadOnly = true;
- dgReportComment.ReadOnly = true;
- toolBar.EnableNew = GetRight(@Title,"新增");
- toolBar.EnableSubmit = false;
- if(Equals(#IndentBill.ID_Assessor, DBNull()))
- {
- if(#IndentBill.Disable_IndentBill==false)
- {
- toolBar.EnableModify = GetRight(@Title,"修改");
- toolBar.EnableDelete = GetRight(@Title,"删除");
- toolBar.EnableAudit = GetRight(@Title,"审核");
- }
- else
- {
- toolBar.EnableAudit = false;
- toolBar.EnableModify = false;
- toolBar.EnableDelete = false;
- }
- toolBar.EnableUnAudit = false;
- toolBar.EnableAssess = false;
- toolBar.EnableUnAssess = false;
- btnDelete.Enabled = false;
- }
- else
- {
- toolBar.EnableModify = false;
- toolBar.EnableDelete = false;
- toolBar.EnableAudit = false;
- toolBar.EnableUnAudit = GetRight(@Title,"取消审核");
- btnDelete.Enabled = GetRight(@Title,"取消审核")&&GetRight(@Title,"删除");
- <!--if(#IndentBill.Assess_IndentBill == 0)
- {
- toolBar.EnableAssess = GetRight(@Title,"审核");
- toolBar.EnableUnAssess = false;
- }
- else
- {
- toolBar.EnableUnAssess = GetRight(@Title,"取消审核");
- toolBar.EnableAssess = false;
- }-->
- }
- toolBar.EnablePrint = GetRight(@Title,"打印");
- toolBar.EnableExport = true;
- toolBar.EnableImport = false;
- UpdateForm(true, "");
- UpdateForm(true, "cbTaxCurrency");
- @Status = 2;
- tbNo.Focus();
- <!--if (!Search("SearchCustomersIsInRegionalLeader",tbCustomerNo.CValue, GetCurrentUser()))
- {
- MessageBox("你与客户不在同一个区域,不能填单!");
- tbCustomerNo.Text = "";
- return;
- }-->
- </View>
- <Modify>
- @viewMode = false;
- dtpDate.Enabled = false;
- tbNo.ReadOnly = true;
- cbLocation.Enabled = true;
- tbCustomerNo.ReadOnly = false;
- txtOrderBillNo.ReadOnly = false;
- cbGetMethod.Enabled = true;
- ntbDiscount.ReadOnly = false;
- cbPrincipal.Enabled = true;
- cbLinkman.Enabled = true;
- cbTele.Enabled = true;
- cbFax.Enabled = true;
- ckSpecial.Enabled=GetFieldRight(@Title,"特价单","修改");
- txtSendAddr.ReadOnly = false;
- cbInvoiceTitle.Enabled = true;
- txtAdress.ReadOnly = false;
- dgProduct.ReadOnly = false;
- dgRemark.ReadOnly = false;
- dgReportComment.ReadOnly = false;
- toolBar.EnableNew = false;
- toolBar.EnableSubmit = GetRight(@Title,"修改");
- toolBar.EnableModify = false;
- toolBar.EnableDelete = false;
- toolBar.EnableAudit = false;
- toolBar.EnableUnAudit = false;
- toolBar.EnablePrint = false;
- toolBar.EnableExport = false;
- toolBar.EnableImport = false;
- toolBar.EnableAssess = false;
- toolBar.EnableUnAssess = false;
- btnDelete.Enabled = false;
- #IndentBill.LastModUser_IndentBill = GetLoginUserID();
- #IndentBill.LastModUserName = GetCurrentUser();
- #IndentBill.LastModDate_IndentBill = DateTimeNow();
- @HaveAccessed = !Equals(#IndentBill.AssessDate_IndentBill,DBNull());
- if(@HaveAccessed)
- cbTaxCurrency.Enabled = false;
- else
- cbTaxCurrency.Enabled = true;
- dgProduct.SetColumnReadOnly(1, @HaveAccessed);
- <!--dgProduct.SetColumnReadOnly(2, !Equal(#IndentBill.ID_AssessDate,DBNull()));wja-->
- dgProduct.SetColumnReadOnly(10, @HaveAccessed);
- dgProduct.SetColumnReadOnly(11, @HaveAccessed);
- dgProduct.SetColumnReadOnly(12, @HaveAccessed);
- dgProduct.AllowNew(!@HaveAccessed);
- dgProduct.AllowDelete(!@HaveAccessed);
- dgProduct.RowHeaderCheck=!@HaveAccessed;
- SetColumnDefaultValue("IndentBillProduct", "Discount_IndentBillProduct", #IndentBill.Discount_IndentBill);
- SetColumnDefaultValue("IndentBillProduct", "Quantity_IndentBillProduct", 1);
- UpdateForm(true, "");
- @Status = 3;
- </Modify>
- <SubmitButtonClick>
- <![CDATA[
- if (!Search("SearchCustomerWithNo", tbCustomerNo.CValue) || !Equals(#IndentBill.ID_Customer,#Customer.ID_Customer))
- {
- MessageBox("请输入有效的客户编号,并按回车确认!",@Title);
- tbCustomerNo.Focus();
- return;
- }
- if (!cbLocation.CheckSelectedItem())
- {
- MessageBox("请选择有效的出货仓库!",@Title);
- tbDetail.SelectedIndex = 0;
- cbLocation.Focus();
- return;
- }
- if (!cbGetMethod.CheckSelectedItem())
- {
- MessageBox("请选择有效的收款方式!",@Title);
- tbDetail.SelectedIndex = 0;
- cbGetMethod.Focus();
- return;
- }
- if (!cbTaxCurrency.CheckSelectedItem())
- {
- MessageBox("请选择有效的税别!",@Title);
- tbDetail.SelectedIndex = 0;
- cbTaxCurrency.Focus();
- return;
- }
- if (!cbPrincipal.CheckSelectedItem())
- {
- MessageBox("请选择有效的负责业务!",@Title);
- tbDetail.SelectedIndex = 0;
- cbPrincipal.Focus();
- return;
- }
- if (RowCount("#IndentBillProduct") == 0)
- {
- MessageBox("请输入销售产品!",@Title);
- tbDetail.SelectedIndex = 1;
- dgProduct.Focus();
- return;
- }
-
- UpdateForm(false, "");
- SuspendLayout();
-
- for (@i=0;@i<RowCount("#IndentBillProduct");@i=@i+1)
- {
- SetPosition("#IndentBillProduct", @i);
- if (#IndentBillProduct.Type_FromBill != 0 && #IndentBillProduct.No_FromBill != "" && Search("SearchFromBillWithNo",#IndentBillProduct.No_FromBill))
- {
- if (Equals(#FromBill.ID_Assessor,DBNull()))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- @ClickResult = MessageBox("该来源单据未经审核,确定要保留来源单据资料吗?",@Title,MB_YESNOCANCEL);
- if (@ClickResult == DialogResult("CANCEL"))
- {
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- else if (@ClickResult == DialogResult("NO"))
- {
- #IndentBillProduct.Name_BillType = "";
- #IndentBillProduct.Type_FromBill = 0;
- #IndentBillProduct.No_FromBill = "";
- #IndentBillProduct.No_FromBillProduct = "";
- }
- }
- }
- if(Equals(#IndentBillProduct.No_Product,""))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- MessageBox("请填入产品编号!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if(Equals(#IndentBillProduct.ID_Product,GuidEmpty()))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该产品不存在!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if (#IndentBillProduct.Quantity_IndentBillProduct <= 0 || #IndentBillProduct.UnitPrice_IndentBillProduct < 0 || #IndentBillProduct.Discount_IndentBillProduct < 0)
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- if(#IndentBillProduct.Quantity_IndentBillProduct < 0)
- MessageBox("数量不得小于0!",@Title);
- else if(#IndentBillProduct.UnitPrice_IndentBillProduct < 0)
- MessageBox("单价不得小于0!",@Title);
- else
- MessageBox("折扣不得小于0!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
-
- Search("SearchLowSalePrice",#IndentBillProduct.ID_Product);
- if(ckSpecial.Checked == false)
- {
- if(cbTaxCurrency.SelectedName=="内含")
- {
- if (#IndentBillProduct.UnitPrice_IndentBillProduct/1.17 < #LowSalePrice.LowSalePrice_Product)
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- MessageBox("产品单价低于最低售价,提交失败!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
- else
- {
- if (#IndentBillProduct.UnitPrice_IndentBillProduct < #LowSalePrice.LowSalePrice_Product)
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- MessageBox("产品单价低于最低售价,提交失败!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
- }
- @AvaQuantity = AvailableQty(#IndentBillProduct.ID_Product,#IndentBill.ID_Location);
-
-
- if (Equals(#IndentBillProduct.ID_IndentBillProduct,GuidEmpty()))
- #IndentBillProduct.ID_IndentBillProduct = NewGuid();
- #IndentBillProduct.ID_IndentBill =#IndentBill.ID_IndentBill;
- }
-
- for (@i=0;@i<RowCount("#BillComment");@i=@i+1)
- {
- SetPosition("#BillComment", @i);
- if (Equals(#BillComment.ID_BillComment,GuidEmpty()))
- #BillComment.ID_BillComment = NewGuid();
- #BillComment.ID_Bill = #IndentBill.ID_IndentBill;
- }
- for (@i=0;@i<RowCount("#ReportComment");@i=@i+1)
- {
- SetPosition("#ReportComment", @i);
- if (Equals(#ReportComment.ID_ReportComment,GuidEmpty()))
- #ReportComment.ID_ReportComment = NewGuid();
- #ReportComment.ID_Bill = #IndentBill.ID_IndentBill;
- }
-
- ResumeLayout();
- if(@Status == 1)
- {
- #IndentBill.CreateDate_IndentBill = DateTimeNow();
- #IndentBill.No_IndentBill = New("#IndentBill.No_IndentBill", dtpDate.CValue);
- }
- else if(@Status == 3)
- {
- #IndentBill.LastModDate_IndentBill = DateTimeNow();
- Update();
- }
- ChangeMode("View");
- ]]>
- </SubmitButtonClick>
- <CountSum>
- <![CDATA[
- if (RowCount("#IndentBillProduct") == 0)
- {
- #IndentBill.NumSum = 0;
- #IndentBill.GoodsAmount_IndentBill = 0;
- #IndentBill.TaxAmount_IndentBill = 0;
- #IndentBill.Amount_IndentBill = 0;
- }
- else
- {
- #IndentBill.NumSum = SumOfCol("#IndentBillProduct.Quantity_IndentBillProduct");
- switch (cbTaxCurrency.SelectedName)
- {
- case "外加":
- #IndentBill.GoodsAmount_IndentBill = SumOfCol("#IndentBillProduct.Amount_IndentBillProduct");
- #IndentBill.TaxAmount_IndentBill=0;
- SuspendLayout();
- for(@i=0;@i < RowCount("#IndentBillProduct");@i++)
- {
- SetPosition("#IndentBillProduct",@i);
- #IndentBill.TaxAmount_IndentBill +=FormatNumber(#IndentBillProduct.Amount_IndentBillProduct * @CessOut, #SystemSetting.PriceDecimal_SystemSetting);
- }
- ResumeLayout();
- #IndentBill.Amount_IndentBill = #IndentBill.GoodsAmount_IndentBill + #IndentBill.TaxAmount_IndentBill;
- break;
- case "内含":
- #IndentBill.Amount_IndentBill = SumOfCol("#IndentBillProduct.Amount_IndentBillProduct");
-
- #IndentBill.TaxAmount_IndentBill = 0;
- SuspendLayout();
- for(@i=0;@i < RowCount("#IndentBillProduct");@i++)
- {
- SetPosition("#IndentBillProduct",@i);
- #IndentBill.TaxAmount_IndentBill +=FormatNumber(#IndentBillProduct.Amount_IndentBillProduct * @CessOut / (1 + @CessOut), #SystemSetting.PriceDecimal_SystemSetting);
- }
- ResumeLayout();
- #IndentBill.GoodsAmount_IndentBill = #IndentBill.Amount_IndentBill - #IndentBill.TaxAmount_IndentBill;
- break;
- case "零税":
- case "免税":
- #IndentBill.GoodsAmount_IndentBill = SumOfCol("#IndentBillProduct.Amount_IndentBillProduct");
- #IndentBill.TaxAmount_IndentBill = 0;
- #IndentBill.Amount_IndentBill = #IndentBill.GoodsAmount_IndentBill;
- break;
- }
- }
- UpdateForm(true, "ntbNumSum");
- UpdateForm(true, "ntbMoneySum");
- UpdateForm(true, "ntbTaxSum");
- UpdateForm(true, "ntbSum");
- ]]>
- </CountSum>
- <CountPrice>
- <![CDATA[
- if (RowCount("#IndentBillProduct") != 0)
- {
- switch (cbTaxCurrency.SelectedName)
- {
- case "内含":
- SuspendLayout();
- for(@j=0;@j<RowCount("#IndentBillProduct");@j=@j+1)
- {
- SetPosition("#IndentBillProduct", @j);
- if(Search("SearchProductWithNo",#IndentBillProduct.No_Product))
- {
- @Price=#Product.Price_Product;
- #IndentBillProduct.OrderPrice_IndentBillProduct=FormatNumber(@Price*(1 + @CessOut),@PriceDecimal);
- #IndentBillProduct.UnitPrice_IndentBillProduct = FormatNumber(#IndentBillProduct.OrderPrice_IndentBillProduct*#IndentBillProduct.Discount_IndentBillProduct/100,@PriceDecimal);
- }
- }
- ResumeLayout();
- break;
- case "外加":
- case "零税":
- case "免税":
- SuspendLayout();
- for(@j=0;@j<RowCount("#IndentBillProduct");@j=@j+1)
- {
- SetPosition("#IndentBillProduct", @j);
- if(Search("SearchProductWithNo",#IndentBillProduct.No_Product))
- {
- @Price=#Product.Price_Product;
- #IndentBillProduct.OrderPrice_IndentBillProduct=@Price;
- #IndentBillProduct.UnitPrice_IndentBillProduct =FormatNumber( #IndentBillProduct.OrderPrice_IndentBillProduct*#IndentBillProduct.Discount_IndentBillProduct/100,@PriceDecimal);
- }
- }
- ResumeLayout();
- break;
- }
- }
- ]]>
- </CountPrice>
- <ChangeDiscount>
- <![CDATA[
- if (RowCount("#IndentBillProduct") > 0)
- {
- SuspendLayout();
- for (@a=0;@a<RowCount("#IndentBillProduct");@a=@a+1)
- {
- SetPosition("#IndentBillProduct", @a);
- #IndentBillProduct.Discount_IndentBillProduct = #IndentBill.Discount_IndentBill;
- }
- ResumeLayout();
- }
- SetColumnDefaultValue("IndentBillProduct", "Discount_IndentBillProduct", #IndentBill.Discount_IndentBill);
- ]]>
- </ChangeDiscount>
- <AuditLable>
- <![CDATA[
- SuspendLayout();
- for (@i=0;@i<RowCount("#IndentBillProduct");@i=@i+1)
- {
- SetPosition("#IndentBillProduct", @i);
- if (#IndentBillProduct.Type_FromBill != 0 && #IndentBillProduct.No_FromBill != "" && Search("SearchFromBillWithNo",#IndentBillProduct.No_FromBill))
- {
- if (Equals(#FromBill.ID_Assessor,DBNull()))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- if (MessageBox("该来源单据未经审核,确定要审核吗?",@Title,MB_OKCANCEL) == DialogResult("CANCEL"))
- {
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
- }
- }
- ResumeLayout();
- ]]>
- BeginAudit();
- #IndentBill.ID_Assessor = GetLoginUserID();
- #IndentBill.Name_Assessor = GetCurrentUser();
- #IndentBill.AssessDate_IndentBill = DateTimeNow();
- Audit();
- ChangeMode("View");
- EndAudit();
- </AuditLable>
- </Lables>
- </Form>
- </Forms>
|