1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691 |
- <?xml version="1.0" encoding="utf-8" ?>
- <Forms>
- <Form Name="FrmSaleBill">
- <Client>
- <Events>
- <Load>
- <![CDATA[
- @SetFlag=1;
- @Title="销货单";
- @viewMode=false;
- @importing=false;
-
- GetSchema();
- Search("SearchCessOut");
- Search("SearchLocation");
- Search("SearchContr");
-
- Search("SearchProductWithNo","p");
- Search("SearchFromBillProductWithNo","p","p");
- Search("SearchIndentBillProductWithNo","p","p");
- Search("SearchIndentBillOnNetProductWithNo","p","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_SaleBillProduct";
- 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="SaleBill.Date_SaleBill"></IKDateTimePicker>
- <IKTextButton name="tbNo" DataSource="SaleBill.No_SaleBill">
- <Events>
- <Enter>
- <![CDATA[
- if(tbNo.ReadOnly == false)
- {
- if(tbNo.CValue != StringEmpty())
- {
- UpdateForm(false, "");
- if(Search("SearchSaleBillWithNo", tbNo.CValue))
- {
- @tp=#SaleBill.No_SaleBill;
- if(!Search("SearchCustomersIsInRegionalLeader",#SaleBill.No_Customer, GetCurrentUser()))
- {
- ChangeMode("Search");
- tbNo.CValue=@tp;
- MessageBox("你与客户不在同一个区域,不能查看!");
- tbNo.CValue="";
- return;
- }
- if((GetRight("客户基本资料","全权查看")||Equals(GetLoginUserID(),#SaleBill.CustomerCreator))&&(GetFieldRight(@Title,"特价单","查看")||!#SaleBill.Special_SaleBill)&&(GetFieldRight(@Title,"特批单","查看")||!#SaleBill.Special2_SaleBill))
- 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="SaleBill.Special_SaleBill"/>
- <IKCheckBox name="ckSpecial1" DataSource="SaleBill.Special2_SaleBill"/>
- <IKComboBoxEx name="cbLocation" DisplaySource="SaleBill.Name_Location" NoSource="SaleBill.No_Location" ValueSource="SaleBill.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="SaleBill.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.CValue = "";
- return;
- }
- if (!Equals(#Customer.SuspendDate_Customer,DBNull()))
- {
- MessageBox("该客户被暂停,不能销货!",@Title);
- tbCustomerNo.Focus();
- return;
- }
-
- #SaleBill.ID_Customer = #Customer.ID_Customer;
- #SaleBill.Discount_SaleBill = #Customer.LastDiscount_Customer;
- #SaleBill.Name_Customer = #Customer.Name_Customer;
- #SaleBill.ShortName_Customer = #Customer.ShortName_Customer;
- #SaleBill.Type_Customer = #Customer.Type_Customer;
- #SaleBill.GetMethod_SaleBill = #Customer.GetMethod_Customer;
- #SaleBill.ToGet_SaleBill = #Customer.ToGetBalance_Customer;
- #SaleBill.PostalCode_Customer = #Customer.PostalCode_Customer;
- #SaleBill.SendAddr_SaleBill = #Customer.SendAddr_Customer;
- #SaleBill.TaxCurrency_SaleBill = #Customer.LastTax_Customer;
- #SaleBill.Principal_SaleBill = #Customer.Name_Employee;
- #SaleBill.No_Principal = #Customer.No_Employee;
- #SaleBill.ID_Principal = #Customer.LastPrincipal_Customer;
-
- if(#Customer.IsCustomersCustomer_Customer == true)
- {
- #SaleBill.OutStatus_SaleBill = "寄客户,红单不放";
- }
- if(#Customer.IsCustomersCustomer_Customer == false)
- {
- #SaleBill.OutStatus_SaleBill = "";
- }
-
- Empty("#ReportComment");
- Search("SearchTypeComment",#SaleBill.ID_Customer);
- MergeTable("#TypeComment","#ReportComment");
- if (RowCount("Linkman") > 0)
- {
- #SaleBill.Name_Linkman = #Linkman.Name_Linkman;
- }
- else
- {
- #SaleBill.Name_Linkman = DBNull();
- }
- if (RowCount("Telephone") > 0)
- {
- #SaleBill.Tel_SaleBill = #Telephone.No_Telephone;
- }
- else
- {
- #SaleBill.Tel_SaleBill = DBNull();
- }
- if (RowCount("Fax") > 0)
- {
- #SaleBill.Fax_SaleBill = #Fax.No_Fax;
- }
- else
- {
- #SaleBill.Fax_SaleBill = DBNull();
- }
- if (RowCount("Invoice") > 0)
- {
- #SaleBill.InvoiceTitle_Company = #Invoice.Title_Invoice;
- #SaleBill.InvoiceAddress_Company = #Invoice.Address_Invoice;
- }
- else
- {
- #SaleBill.InvoiceTitle_Company = DBNull();
- #SaleBill.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="SaleBill.ShortName_Customer"></IKTextBox>
- <IKTextBox name="txtOrderBillNo" DataSource="SaleBill.No_OrderBill"></IKTextBox>
- <IKComboBoxEx name="cbGetMethod" DisplaySource="SaleBill.GetMethod_SaleBill" DataSource="GetMethod" DisplayMember="Result">
- <Events>
- <Reload>
- UpdateForm(false, "cbGetMethod");
- Search("SearchGetMethod");
- UpdateForm(true, "cbGetMethod");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKNumericTextBox name="ntbToGet" DataSource="SaleBill.ToGet_SaleBill"></IKNumericTextBox>
- <IKComboBoxEx name="cbOutStatus" DisplaySource="SaleBill.OutStatus_SaleBill" DataSource="RespiteForSaleBill" DisplayMember="Result">
- <Events>
- <Reload>
- UpdateForm(false, "cbOutStatus");
- Search("SearchRespiteForSaleBill");
- UpdateForm(true, "cbOutStatus");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKNumericTextBox name="ntbDiscount" DataSource="SaleBill.Discount_SaleBill">
- <Events>
- <Enter>
- UpdateForm(false, "ntbDiscount");
- <Lable name="ChangeDiscount" />
- </Enter>
- </Events>
- </IKNumericTextBox>
- <IKComboBoxEx name="cbTaxCurrency" DisplaySource="SaleBill.TaxCurrency_SaleBill">
- <Events>
- <SelectedIndexChanged>
- if(!@viewMode && !@importing)
- {
- <Lable name="CountPrice"/>
- }
- <Lable name="CountSum" />
- </SelectedIndexChanged>
- </Events>
- </IKComboBoxEx>
- <IKComboBoxEx name="cbCurrency" DisplaySource="SaleBill.Currency_SaleBill" DataSource="SaleBill">
- </IKComboBoxEx>
- <IKComboBoxEx name="cbPrincipal" ValueSource="SaleBill.ID_Principal" DisplaySource="SaleBill.Principal_SaleBill" NoSource="SaleBill.No_Principal" DataSource="Principal" DisplayMember="Principal_SaleBill" NoMember="No_Principal" ValueMember="ID_Employee">
- <Events>
- <Reload>
- UpdateForm(false, "cbPrincipal");
- Search("SearchAllPrincipal");
- UpdateForm(true, "cbPrincipal");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKTextBox name="txtMaker" DataSource="SaleBill.Name_Creator"></IKTextBox>
- <IKTextBox name="txtAudi" DataSource="SaleBill.Name_Assessor"></IKTextBox>
- <IKDateTimeText name="dtAssessDate" DataSource="SaleBill.AssessDate_SaleBill"></IKDateTimeText>
- <IKTextBox name="txtLastModUser" DataSource="SaleBill.LastModUserName"></IKTextBox>
- <IKDateTimeText name="dtLastModDate" DataSource="SaleBill.LastModDate_SaleBill"></IKDateTimeText>
- <IKTextBox name="txtCustomerName" DataSource="SaleBill.Name_Customer"></IKTextBox>
- <IKTextBox name="txtCustomerType" DataSource="SaleBill.Type_Customer"></IKTextBox>
- <IKComboBoxEx name="cbLinkman" DisplaySource="SaleBill.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="SaleBill.Tel_SaleBill" DataSource="Telephone" DisplayMember="No_Telephone">
- <Events>
- <Reload>
- UpdateForm(false, "cbTele");
- Search("SearchTele", tbCustomerNo.CValue);
- UpdateForm(true, "cbTele");
- </Reload>
- </Events>
- </IKTextBox>
- <IKTextBox name="cbFax" DisplaySource="SaleBill.Fax_SaleBill" DataSource="Fax" DisplayMember="No_Fax">
- <Events>
- <Reload>
- UpdateForm(false, "cbFax");
- Search("SearchFax", tbCustomerNo.CValue);
- UpdateForm(true, "cbFax");
- </Reload>
- </Events>
- </IKTextBox>
- <IKTextBox name="txtPostalcode" DataSource="SaleBill.PostalCode_Customer"></IKTextBox>
- <IKTextBox name="txtSendAddr" DataSource="SaleBill.SendAddr_SaleBill"></IKTextBox>
- <IKComboBoxEx name="cbInvoiceTitle" DisplaySource="SaleBill.InvoiceTitle_Company" ValueSource="SaleBill.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="SaleBill.InvoiceAddress_Company"></IKTextBox>
- <IKNumericTextBox name="ntbNumSum" DataSource="SaleBill.NumSum"></IKNumericTextBox>
- <IKNumericTextBox name="ntbTaxSum" DataSource="SaleBill.TaxAmount_SaleBill"></IKNumericTextBox>
- <IKNumericTextBox name="ntbMoneySum" DataSource="SaleBill.GoodsAmount_SaleBill"></IKNumericTextBox>
- <IKNumericTextBox name="ntbSum" DataSource="SaleBill.Amount_SaleBill"></IKNumericTextBox>
- <IKDataGridEx name="dgProduct" DataSource="SaleBillProduct" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="SaleBillProduct.No_SaleBillProduct" />
- <DataColumn Index="1" DataSource="SaleBillProduct.No_Product" >
- <IKDataGridTextButtonColumn>
- <Events>
- <Click>
- @SetFlag=1;
- ShowSearchBox("ProductSearch","INFOMATION",#SaleBillProduct.No_Product);
- </Click>
- <SetFlagBeforeClick>
- @SetFlag=0;
- </SetFlagBeforeClick>
- </Events>
- </IKDataGridTextButtonColumn>
- </DataColumn>
- <DataColumn Index="2" DataSource="SaleBillProduct.Name_Product" />
- <DataColumn Index="3" DataSource="SaleBillProduct.Quantity_SaleBillProduct" />
- <DataColumn Index="4" DataSource="SaleBillProduct.Unit_Product" />
- <DataColumn Index="5" DataSource="SaleBillProduct.OrderPrice_SaleBillProduct" />
- <DataColumn Index="6" DataSource="SaleBillProduct.Discount_SaleBillProduct" />
- <DataColumn Index="7" DataSource="SaleBillProduct.UnitPrice_SaleBillProduct"/>
- <DataColumn Index="8" DataSource="SaleBillProduct.Amount_SaleBillProduct" />
- <DataColumn Index="9" DataSource="SaleBillProduct.Comment_SaleBillProduct" />
- <DataColumn Index="10" DataSource="SaleBillProduct.Name_BillType">
- <IKDataGridComboBoxColumn DisplaySourceEx="SaleBillProduct.Name_BillType" ValueSourceEx="SaleBillProduct.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="SaleBillProduct.No_FromBill" />
- <DataColumn Index="12" DataSource="SaleBillProduct.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("SearchOutDepot",#SaleBill.ID_SaleBill))
- {
- if(#OutDepot.Quantity_OutDepot > 0)
- {
- MessageBox("该单据已有相应的销售出库记录,作废失败!",@Title);
- return;
- }
- if(#OutDepot.Quantity_SaleRtn > 0)
- {
- MessageBox("该单据已有相应的销售退货记录,作废失败!",@Title);
- return;
- }
- if(#OutDepot.Quantity_InDepot > 0)
- {
- MessageBox("该单据已有相应的销售退货入库记录,作废失败!",@Title);
- return;
- }
- }
- }
- BeginUnAudit();
- #SaleBill.ID_Assessor = DBNull();
- #SaleBill.Name_Assessor = "";
- #SaleBill.TransBack_SaleBill=0;
- #SaleBill.Disable_SaleBill=true;
- #SaleBill.OutStatus_SaleBill="已作废";
- UnAudit(false);
- ChangeMode("View");
- cbOutStatus.Text="已作废";
- EndUnAudit();
- Search("UpdateCustomer",#SaleBill.ID_Customer,#SaleBill.Amount_SaleBill,"0");
- <Lable name="CountSum" />
- </Click>
- </Events>
- </IKButton>
- <IKButton name="btnCopy">
- <Events>
- <Click>
- ShowText("联系人:",#SaleBill.Name_Linkman,"联系电话:",#SaleBill.Tel_SaleBill,"传真:",#SaleBill.Fax_SaleBill,"发票抬头:",#SaleBill.InvoiceTitle_Company,"结算方式:",#SaleBill.GetMethod_SaleBill,"发货状态:",#SaleBill.OutStatus_SaleBill);
- </Click>
- </Events>
- </IKButton>
- <IKFormToolBar name="toolBar">
- <Events>
- <ClickFirst>
- if (Search("SearchSaleBillFirst",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight(@Title,"特价单","查看"),GetCurrentUser(),GetFieldRight(@Title,"特批单","查看")))
- {
- @tp1=#SaleBill.No_SaleBill;
- if(!Search("SearchCustomersIsInRegionalLeader",#SaleBill.No_Customer, GetCurrentUser()))
- {
- ChangeMode("Search");
- tbNo.CValue=@tp1;
- MessageBox("你与客户不在同一个区域,不能查看!");
- tbNo.CValue="";
- return;
- }
- ChangeMode("View");
- <Lable name="CountSum" />
- }
- </ClickFirst>
- <ClickPrev>
- if (Search("SearchSaleBillPrevious", tbNo.CValue,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight(@Title,"特价单","查看"),GetCurrentUser(),GetFieldRight(@Title,"特批单","查看")))
- {
- @tp2=#SaleBill.No_SaleBill;
- if(!Search("SearchCustomersIsInRegionalLeader",#SaleBill.No_Customer, GetCurrentUser()))
- {
- ChangeMode("Search");
- tbNo.CValue=@tp2;
- MessageBox("你与客户不在同一个区域,不能查看!");
- tbNo.CValue="";
- return;
- }
- ChangeMode("View");
- <Lable name="CountSum" />
- }
- </ClickPrev>
- <ClickNext>
- if (Search("SearchSaleBillNext", tbNo.CValue,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight(@Title,"特价单","查看"),GetCurrentUser(),GetFieldRight(@Title,"特批单","查看")))
- {
- @tp3=#SaleBill.No_SaleBill;
- if(!Search("SearchCustomersIsInRegionalLeader",#SaleBill.No_Customer, GetCurrentUser()))
- {
- ChangeMode("Search");
- tbNo.CValue=@tp3;
- MessageBox("你与客户不在同一个区域,不能查看!");
- tbNo.CValue="";
- return;
- }
- ChangeMode("View");
- <Lable name="CountSum" />
- }
- </ClickNext>
- <ClickLast>
- if (Search("SearchSaleBillLast",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight(@Title,"特价单","查看"),GetCurrentUser(),GetFieldRight(@Title,"特批单","查看")))
- {
- @tp4=#SaleBill.No_SaleBill;
- if(!Search("SearchCustomersIsInRegionalLeader",#SaleBill.No_Customer, GetCurrentUser()))
- {
- ChangeMode("Search");
- tbNo.CValue=@tp4;
- MessageBox("你与客户不在同一个区域,不能查看!");
- tbNo.CValue="";
- return;
- }
- ChangeMode("View");
- <Lable name="CountSum" />
- }
- </ClickLast>
- <ClickEmpty>
- ChangeMode("Search");
- </ClickEmpty>
- <ClickNew>
- <![CDATA[
- @NextNo = GetNextAutoNumber(true);
- if (!Equals(@NextNo, ""))
- {
- ChangeMode("New");
- #SaleBill.No_SaleBill = @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",#SaleBill.No_SaleBill,#SaleBill.No_SaleBill,GetFieldRight(@Title,"特价单","查看")?"1":"0");
- </ClickPrint>
- <ClickAudit>
- @temptogetvalue=0;
- UpdateForm(true, "");
- if(@AuditMode)
- return;
- <Lable name = "AuditLable"/>
- <Lable name="CountSum" />
- <![CDATA[
- SuspendLayout();
- for (@i=0;@i<RowCount("#SaleBillProduct");@i=@i+1)
- {
- SetPosition("#SaleBillProduct",@i);
- Search("AddIndentBillOnNetProduct",#SaleBillProduct.No_FromBill,#SaleBillProduct.ID_Product,#SaleBillProduct.Quantity_SaleBillProduct);
- }
- ResumeLayout();
- Search("UpdateCustomer",#SaleBill.ID_Customer,#SaleBill.Amount_SaleBill,"1");
-
- Search("SearchCustomerWithNo", tbCustomerNo.CValue);
- @temptogetvalue= #Customer.ToGetBalance_Customer;
-
- Search("UpdateToGet",@temptogetvalue,tbNo.CValue);
- ntbToGet.CValue=@temptogetvalue;
-
- ]]>
- </ClickAudit>
- <ClickUnAudit>
- @temptogetvalue2=0;
- BeginUnAudit();
- #SaleBill.ID_Assessor = DBNull();
- #SaleBill.Name_Assessor = "";
- #SaleBill.TransBack_SaleBill=0;
- UnAudit();
- ChangeMode("View");
- EndUnAudit();
- <Lable name="CountSum" />
- <![CDATA[
- SuspendLayout();
- for (@i=0;@i<RowCount("#SaleBillProduct");@i=@i+1)
- {
- SetPosition("#SaleBillProduct",@i);
- Search("ReduceIndentBillOnNetProduct",#SaleBillProduct.No_FromBill,#SaleBillProduct.ID_Product,#SaleBillProduct.Quantity_SaleBillProduct);
- }
- ResumeLayout();
- Search("UpdateCustomer",#SaleBill.ID_Customer,#SaleBill.Amount_SaleBill,"0");
-
- Search("SearchToGet", tbNo.CValue);
- @temptogetvalue2= #SearchToGet.ToGet_SaleBill;
- ntbToGet.CValue=@temptogetvalue2;
- ]]>
- </ClickUnAudit>
- <ClickAssess>
- #SaleBill.Assess_SaleBill = 1;
- <Lable name = "AssessClick"/>
- toolBar.EnableAssess = false;
- toolBar.EnableUnAssess = GetRight(@Title,"取消审核");
- </ClickAssess>
- <ClickUnAssess>
- #SaleBill.Assess_SaleBill = 0;
- <Lable name = "AssessClick"/>
- toolBar.EnableAssess = GetRight(@Title,"审核");
- toolBar.EnableUnAssess = false;
- </ClickUnAssess>
- <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","#SaleBillProduct.Type_FromBill",23,"#SaleBillProduct.Name_BillType","报价单");
- }
- else if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="网上订单")
- {
- ShowSearchBox("ImportIndentBillOnNetControl","BILLCONVERT","#SaleBillProduct.Type_FromBill",25,"#SaleBillProduct.Name_BillType","网上订单");
- }
- else
- if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="本单据")
- {
- @importing=true;
- ShowSearchBox("BillSearch","INFOMATIONCOPYNODEPOT","SearchSaleBillWithNo1",false,"#SaleBill.ID_SaleBill","#SaleBill.No_SaleBill","#SaleBill.Date_SaleBill","#SaleBill.ID_Assessor","#SaleBill.Name_Assessor","#SaleBill.LastModUser_SaleBill","#SaleBill.LastModUserName","#SaleBill.Name_Creator","#SaleBill.ID_Creator","#SaleBillProduct.ID_SaleBillProduct","#BillComment.ID_BillComment","#ReportComment.ID_ReportComment",RowCount("#SaleBillProduct"));
- @importing=false;
- }
- ]]>
- <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
- <Lable name="CountSum" />
- </ClickImportItem>
- <ClickExportItem>
- <![CDATA[
- if(toolBar.MenuItemText=="销货出库单")
- {
- ExportBillProductStart("#SaleOutDepotBillProduct.Type_FromBill",21,"#SaleOutDepotBillProduct.Name_FromBill","销货单","#SaleOutDepotBillProduct.No_FromBill",#SaleBill.No_SaleBill,"#SaleOutDepotBill.No_Customer",#SaleBill.No_Customer,"#SaleOutDepotBill.Name_Location",#SaleBill.Name_Location);
- SuspendLayout();
- for (@i=0;@i<=RowCount("#ReportComment")-1;@i=@i+1)
- {
- SetPosition("#ReportComment", @i);
-
- ExportBillCommand("ReportComment", "#ReportComment.Comment_ReportComment", #ReportComment.Comment_ReportComment);
- }
- ResumeLayout();
-
- ExportBillCommand("ReportComment", "#ReportComment.Comment_ReportComment", #SaleBill.OutStatus_SaleBill);
-
- ExportBillProduct("dgProduct","#SaleBillProduct","#SaleOutDepotBillProduct.No_FromBillProduct","#SaleBillProduct.No_SaleBillProduct");
- }
- else if(toolBar.MenuItemText=="采购订单")
- {
- ExportBillProductStart("#PurchaseOrderBillProduct.Comment_PurchaseOrderBillProduct",#SaleBill.No_SaleBill,"#PurchaseOrderBill.TaxCurrency_PurchaseOrderBill",#SaleBill.TaxCurrency_SaleBill);
- ExportBillProduct("dgProduct","#SaleBillProduct","#PurchaseOrderBillProduct.No_Product","#SaleBillProduct.No_Product");
- }
- else if(toolBar.MenuItemText=="询价单")
- {
- ExportBillProductStart("#PurchaseQueryBillProduct.Comment_PurchaseQueryBillProduct",#SaleBill.No_SaleBill,"#PurchaseQueryBill.TaxCurrency_PurchaseQueryBill",#SaleBill.TaxCurrency_SaleBill);
- ExportBillProduct("dgProduct","#SaleBillProduct","#PurchaseQueryBillProduct.No_Product","#SaleBillProduct.No_Product");
- }
- else if(toolBar.MenuItemText=="销售退货单")
- {
- if(Search("SearchContrSOB"))
- {
- ExportBillProductStart("#SaleRtnBillProduct.Type_FromBill",21,"#SaleRtnBillProduct.FromBill_SaleRtnBillProduct","销货单","#SaleRtnBillProduct.No_FromBill",#SaleBill.No_SaleBill,"#SaleRtnBill.No_Customer",#SaleBill.No_Customer,"#SaleRtnBill.Name_Location",#SaleBill.Name_Location,"#SaleRtnBill.TaxCurrency_SaleRtnBill",#SaleBill.TaxCurrency_SaleBill,"#SaleRtnBill.ID_Principal",#SaleBill.ID_Principal,"#SaleRtnBill.Principal_SaleRtnBill",#SaleBill.Principal_SaleBill,"#SaleRtnBill.No_Principal",#SaleBill.No_Principal);
- ExportBillProduct("dgProduct","#SaleBillProduct","#SaleRtnBillProduct.No_FromBillProduct","#SaleBillProduct.No_SaleBillProduct");
- }
- else
- {
- ExportBillProductStart("#SaleRtnBill.No_Customer",#SaleBill.No_Customer,"#SaleRtnBillProduct.Comment_SaleRtnBillProduct","销货单:"+#SaleBill.No_SaleBill,"#SaleRtnBill.Name_Location",#SaleBill.Name_Location,"#SaleRtnBill.TaxCurrency_SaleRtnBill",#SaleBill.TaxCurrency_SaleBill,"#SaleRtnBill.ID_Principal",#SaleBill.ID_Principal,"#SaleRtnBill.Principal_SaleRtnBill",#SaleBill.Principal_SaleBill,"#SaleRtnBill.No_Principal",SaleBill.No_Principal);
- ExportBillProduct("dgProduct","#SaleBillProduct","#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct","#SaleBillProduct.No_Product");
- }
- }
- ]]>
- </ClickExportItem>
- </Events>
- </IKFormToolBar>
- </Controls>
- <Tables>
- <Table name="SaleBillProduct">
- <Events>
- <ColumnsChanged>
- <Name_BillType>
- <![CDATA[
- #SaleBillProduct.ID_IndentBillOnNetProduct = DBNull();
- if (Equals(#SaleBillProduct.Type_FromBill,23) && !Equals(#SaleBillProduct.Type_FromBill,DBNull()) && !Equals(#SaleBillProduct.No_FromBill,"") && !Equals(#SaleBillProduct.No_FromBill,DBNull()) && !Equals(#SaleBillProduct.No_FromBillProduct,"") && !Equals(#SaleBillProduct.No_FromBillProduct,DBNull()))
- {
- if (Search("SearchFromBillProductWithNo", #SaleBillProduct.No_FromBill, #SaleBillProduct.No_FromBillProduct))
- {
- if(!Equals(#FromBillProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
- if(#FromBillProduct.TaxCurrency_PriceQueryBill!=cbTaxCurrency.Text)
- {
- MessageBox("来源单据与当前单据税别不一致,请检查后修改!",@Title);
- }
- #SaleBillProduct.ID_Product = #FromBillProduct.ID_Product;
- #SaleBillProduct.No_Product = #FromBillProduct.No_Product;
- #SaleBillProduct.Name_Product = #FromBillProduct.Name_Product;
- #SaleBillProduct.Quantity_SaleBillProduct = #FromBillProduct.Quantity_PriceQueryBillProduct;
- #SaleBillProduct.Unit_Product = #FromBillProduct.Unit_Product;
- #SaleBillProduct.UnitPrice_SaleBillProduct = #FromBillProduct.UnitPrice_PriceQueryBillProduct;
- #SaleBillProduct.Discount_SaleBillProduct = #FromBillProduct.Discount_PriceQueryBillProduct;
- #SaleBillProduct.LowSalePrice_Product = #FromBillProduct.LowSalePrice_Product;
- #SaleBillProduct.OrderPrice_SaleBillProduct = #FromBillProduct.OrderPrice_PriceQueryBillProduct;
- #SaleBillProduct.Amount_SaleBillProduct = FormatNumber( #SaleBillProduct.UnitPrice_SaleBillProduct * #SaleBillProduct.Quantity_SaleBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- }
- }
- if(Equals(#SaleBillProduct.Type_FromBill,24) && !Equals(#SaleBillProduct.Type_FromBill,DBNull()) && !Equals(#SaleBillProduct.No_FromBill,"") && !Equals(#SaleBillProduct.No_FromBill,DBNull()) && !Equals(#SaleBillProduct.No_FromBillProduct,"") && !Equals(#SaleBillProduct.No_FromBillProduct,DBNull()))
- {
- if (Search("SearchIndentBillProductWithNo", #SaleBillProduct.No_FromBill, #SaleBillProduct.No_FromBillProduct))
- {
- if(!Equals(#IndentBillProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
- if(#IndentBillProduct.TaxCurrency_IndentBill!=cbTaxCurrency.Text)
- {
- MessageBox("来源单据与当前单据税别不一致,请检查后修改!",@Title);
- }
- #SaleBillProduct.ID_Product = #IndentBillProduct.ID_Product;
- #SaleBillProduct.No_Product = #IndentBillProduct.No_Product;
- #SaleBillProduct.Name_Product = #IndentBillProduct.Name_Product;
- #SaleBillProduct.Quantity_SaleBillProduct = #IndentBillProduct.Quantity_IndentBillProduct;
- #SaleBillProduct.Unit_Product = #IndentBillProduct.Unit_Product;
- #SaleBillProduct.UnitPrice_SaleBillProduct = #IndentBillProduct.UnitPrice_IndentBillProduct;
- #SaleBillProduct.Discount_SaleBillProduct = #IndentBillProduct.Discount_IndentBillProduct;
- #SaleBillProduct.LowSalePrice_Product = #IndentBillProduct.LowSalePrice_Product;
- #SaleBillProduct.OrderPrice_SaleBillProduct = #IndentBillProduct.OrderPrice_IndentBillProduct;
- #SaleBillProduct.Amount_SaleBillProduct = FormatNumber( #SaleBillProduct.UnitPrice_SaleBillProduct * #SaleBillProduct.Quantity_SaleBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- }
- }
-
- if(Equals(#SaleBillProduct.Type_FromBill,25) && !Equals(#SaleBillProduct.Type_FromBill,DBNull()) && !Equals(#SaleBillProduct.No_FromBill,"") && !Equals(#SaleBillProduct.No_FromBill,DBNull()) && !Equals(#SaleBillProduct.No_FromBillProduct,"") && !Equals(#SaleBillProduct.No_FromBillProduct,DBNull()))
- {
- if (Search("SearchIndentBillOnNetProductWithNo", #SaleBillProduct.No_FromBill, #SaleBillProduct.No_FromBillProduct))
- {
- if(!Equals(#IndentBillOnNetProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
- if(#IndentBillOnNetProduct.TaxCurrency_IndentBillOnNet!=cbTaxCurrency.Text)
- {
- MessageBox("来源单据与当前单据税别不一致,请检查后修改!",@Title);
- }
- #SaleBillProduct.ID_Product = #IndentBillOnNetProduct.ID_Product;
- #SaleBillProduct.No_Product = #IndentBillOnNetProduct.No_Product;
- #SaleBillProduct.Name_Product = #IndentBillOnNetProduct.Name_Product;
- #SaleBillProduct.Quantity_SaleBillProduct = #IndentBillOnNetProduct.Quantity_IndentBillOnNetProduct;
- #SaleBillProduct.Unit_Product = #IndentBillOnNetProduct.Unit_Product;
- #SaleBillProduct.UnitPrice_SaleBillProduct = #IndentBillOnNetProduct.UnitPrice_IndentBillOnNetProduct;
- #SaleBillProduct.LowSalePrice_Product = #IndentBillOnNetProduct.LowSalePrice_Product;
- #SaleBillProduct.Amount_SaleBillProduct = FormatNumber( #SaleBillProduct.UnitPrice_SaleBillProduct * #SaleBillProduct.Quantity_SaleBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- #SaleBillProduct.ID_IndentBillOnNetProduct = #IndentBillOnNetProduct.ID_IndentBillOnNetProduct;
- }
- }
- ]]>
- <Lable name="CountSum" />
- </Name_BillType>
- <No_FromBill>
- <![CDATA[
- #SaleBillProduct.ID_IndentBillOnNetProduct = DBNull();
- if (Equals(#SaleBillProduct.Type_FromBill,23) && !Equals(#SaleBillProduct.Type_FromBill,DBNull()) && !Equals(#SaleBillProduct.No_FromBill,"") && !Equals(#SaleBillProduct.No_FromBill,DBNull()) && !Equals(#SaleBillProduct.No_FromBillProduct,"") && !Equals(#SaleBillProduct.No_FromBillProduct,DBNull()))
- {
- if (Search("SearchFromBillProductWithNo", #SaleBillProduct.No_FromBill, #SaleBillProduct.No_FromBillProduct))
- {
- if(!Equals(#FromBillProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
- if(#FromBillProduct.TaxCurrency_PriceQueryBill!=cbTaxCurrency.Text)
- {
- MessageBox("来源单据与当前单据税别不一致,请检查后修改!",@Title);
- }
- #SaleBillProduct.ID_Product = #FromBillProduct.ID_Product;
- #SaleBillProduct.No_Product = #FromBillProduct.No_Product;
- #SaleBillProduct.Name_Product = #FromBillProduct.Name_Product;
- #SaleBillProduct.Quantity_SaleBillProduct = #FromBillProduct.Quantity_PriceQueryBillProduct;
- #SaleBillProduct.Unit_Product = #FromBillProduct.Unit_Product;
- #SaleBillProduct.UnitPrice_SaleBillProduct = #FromBillProduct.UnitPrice_PriceQueryBillProduct;
- #SaleBillProduct.Discount_SaleBillProduct = #FromBillProduct.Discount_PriceQueryBillProduct;
- #SaleBillProduct.LowSalePrice_Product = #FromBillProduct.LowSalePrice_Product;
- #SaleBillProduct.OrderPrice_SaleBillProduct = #FromBillProduct.OrderPrice_PriceQueryBillProduct;
- #SaleBillProduct.Amount_SaleBillProduct = FormatNumber( #SaleBillProduct.UnitPrice_SaleBillProduct * #SaleBillProduct.Quantity_SaleBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- }
- }
- if(Equals(#SaleBillProduct.Type_FromBill,24) && !Equals(#SaleBillProduct.Type_FromBill,DBNull()) && !Equals(#SaleBillProduct.No_FromBill,"") && !Equals(#SaleBillProduct.No_FromBill,DBNull()) && !Equals(#SaleBillProduct.No_FromBillProduct,"") && !Equals(#SaleBillProduct.No_FromBillProduct,DBNull()))
- {
- if (Search("SearchIndentBillProductWithNo", #SaleBillProduct.No_FromBill, #SaleBillProduct.No_FromBillProduct))
- {
- if(!Equals(#IndentBillProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
- if(#IndentBillProduct.TaxCurrency_IndentBill!=cbTaxCurrency.Text)
- {
- MessageBox("来源单据与当前单据税别不一致,请检查后修改!",@Title);
- }
- #SaleBillProduct.ID_Product = #IndentBillProduct.ID_Product;
- #SaleBillProduct.No_Product = #IndentBillProduct.No_Product;
- #SaleBillProduct.Name_Product = #IndentBillProduct.Name_Product;
- #SaleBillProduct.Quantity_SaleBillProduct = #IndentBillProduct.Quantity_IndentBillProduct;
- #SaleBillProduct.Unit_Product = #IndentBillProduct.Unit_Product;
- #SaleBillProduct.UnitPrice_SaleBillProduct = #IndentBillProduct.UnitPrice_IndentBillProduct;
- #SaleBillProduct.Discount_SaleBillProduct = #IndentBillProduct.Discount_IndentBillProduct;
- #SaleBillProduct.LowSalePrice_Product = #IndentBillProduct.LowSalePrice_Product;
- #SaleBillProduct.OrderPrice_SaleBillProduct = #IndentBillProduct.OrderPrice_IndentBillProduct;
- #SaleBillProduct.Amount_SaleBillProduct = FormatNumber( #SaleBillProduct.UnitPrice_SaleBillProduct * #SaleBillProduct.Quantity_SaleBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- }
- }
- if(Equals(#SaleBillProduct.Type_FromBill,25) && !Equals(#SaleBillProduct.Type_FromBill,DBNull()) && !Equals(#SaleBillProduct.No_FromBill,"") && !Equals(#SaleBillProduct.No_FromBill,DBNull()) && !Equals(#SaleBillProduct.No_FromBillProduct,"") && !Equals(#SaleBillProduct.No_FromBillProduct,DBNull()))
- {
- if (Search("SearchIndentBillOnNetProductWithNo", #SaleBillProduct.No_FromBill, #SaleBillProduct.No_FromBillProduct))
- {
- if(!Equals(#IndentBillOnNetProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
- if(#IndentBillOnNetProduct.TaxCurrency_IndentBillOnNet!=cbTaxCurrency.Text)
- {
- MessageBox("来源单据与当前单据税别不一致,请检查后修改!",@Title);
- }
- #SaleBillProduct.ID_Product = #IndentBillOnNetProduct.ID_Product;
- #SaleBillProduct.No_Product = #IndentBillOnNetProduct.No_Product;
- #SaleBillProduct.Name_Product = #IndentBillOnNetProduct.Name_Product;
- #SaleBillProduct.Quantity_SaleBillProduct = #IndentBillOnNetProduct.Quantity_IndentBillOnNetProduct;
- #SaleBillProduct.Unit_Product = #IndentBillOnNetProduct.Unit_Product;
- #SaleBillProduct.UnitPrice_SaleBillProduct = #IndentBillOnNetProduct.UnitPrice_IndentBillOnNetProduct;
- #SaleBillProduct.LowSalePrice_Product = #IndentBillOnNetProduct.LowSalePrice_Product;
- #SaleBillProduct.Amount_SaleBillProduct = FormatNumber( #SaleBillProduct.UnitPrice_SaleBillProduct * #SaleBillProduct.Quantity_SaleBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- #SaleBillProduct.ID_IndentBillOnNetProduct = #IndentBillOnNetProduct.ID_IndentBillOnNetProduct;
- }
- }
- ]]>
- <Lable name="CountSum" />
- </No_FromBill>
- <No_FromBillProduct>
- <![CDATA[
- #SaleBillProduct.ID_IndentBillOnNetProduct = DBNull();
- if (Equals(#SaleBillProduct.Type_FromBill,23) && !Equals(#SaleBillProduct.Type_FromBill,DBNull()) && !Equals(#SaleBillProduct.No_FromBill,"") && !Equals(#SaleBillProduct.No_FromBill,DBNull()) && !Equals(#SaleBillProduct.No_FromBillProduct,"") && !Equals(#SaleBillProduct.No_FromBillProduct,DBNull()))
- {
- if (Search("SearchFromBillProductWithNo", #SaleBillProduct.No_FromBill, #SaleBillProduct.No_FromBillProduct))
- {
- if(!Equals(#FromBillProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
- if(#FromBillProduct.TaxCurrency_PriceQueryBill!=cbTaxCurrency.Text)
- {
- MessageBox("来源单据与当前单据税别不一致,请检查后修改!",@Title);
- }
- #SaleBillProduct.ID_Product = #FromBillProduct.ID_Product;
- #SaleBillProduct.No_Product = #FromBillProduct.No_Product;
- #SaleBillProduct.Name_Product = #FromBillProduct.Name_Product;
- #SaleBillProduct.Quantity_SaleBillProduct = #FromBillProduct.Quantity_PriceQueryBillProduct;
- #SaleBillProduct.Unit_Product = #FromBillProduct.Unit_Product;
- #SaleBillProduct.UnitPrice_SaleBillProduct = #FromBillProduct.UnitPrice_PriceQueryBillProduct;
- #SaleBillProduct.Discount_SaleBillProduct = #FromBillProduct.Discount_PriceQueryBillProduct;
- #SaleBillProduct.LowSalePrice_Product = #FromBillProduct.LowSalePrice_Product;
- #SaleBillProduct.OrderPrice_SaleBillProduct = #FromBillProduct.OrderPrice_PriceQueryBillProduct;
- #SaleBillProduct.Amount_SaleBillProduct = FormatNumber( #SaleBillProduct.UnitPrice_SaleBillProduct * #SaleBillProduct.Quantity_SaleBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- }
- }
- if(Equals(#SaleBillProduct.Type_FromBill,24) && !Equals(#SaleBillProduct.Type_FromBill,DBNull()) && !Equals(#SaleBillProduct.No_FromBill,"") && !Equals(#SaleBillProduct.No_FromBill,DBNull()) && !Equals(#SaleBillProduct.No_FromBillProduct,"") && !Equals(#SaleBillProduct.No_FromBillProduct,DBNull()))
- {
- if (Search("SearchIndentBillProductWithNo", #SaleBillProduct.No_FromBill, #SaleBillProduct.No_FromBillProduct))
- {
- if(!Equals(#IndentBillProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
- if(#IndentBillProduct.TaxCurrency_IndentBill!=cbTaxCurrency.Text)
- {
- MessageBox("来源单据与当前单据税别不一致,请检查后修改!",@Title);
- }
- #SaleBillProduct.ID_Product = #IndentBillProduct.ID_Product;
- #SaleBillProduct.No_Product = #IndentBillProduct.No_Product;
- #SaleBillProduct.Name_Product = #IndentBillProduct.Name_Product;
- #SaleBillProduct.Quantity_SaleBillProduct = #IndentBillProduct.Quantity_IndentBillProduct;
- #SaleBillProduct.Unit_Product = #IndentBillProduct.Unit_Product;
- #SaleBillProduct.UnitPrice_SaleBillProduct = #IndentBillProduct.UnitPrice_IndentBillProduct;
- #SaleBillProduct.Discount_SaleBillProduct = #IndentBillProduct.Discount_IndentBillProduct;
- #SaleBillProduct.LowSalePrice_Product = #IndentBillProduct.LowSalePrice_Product;
- #SaleBillProduct.OrderPrice_SaleBillProduct = #IndentBillProduct.OrderPrice_IndentBillProduct;
- #SaleBillProduct.Amount_SaleBillProduct = FormatNumber( #SaleBillProduct.UnitPrice_SaleBillProduct * #SaleBillProduct.Quantity_SaleBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- }
- }
- if(Equals(#SaleBillProduct.Type_FromBill,25) && !Equals(#SaleBillProduct.Type_FromBill,DBNull()) && !Equals(#SaleBillProduct.No_FromBill,"") && !Equals(#SaleBillProduct.No_FromBill,DBNull()) && !Equals(#SaleBillProduct.No_FromBillProduct,"") && !Equals(#SaleBillProduct.No_FromBillProduct,DBNull()))
- {
- if (Search("SearchIndentBillOnNetProductWithNo", #SaleBillProduct.No_FromBill, #SaleBillProduct.No_FromBillProduct))
- {
- if(!Equals(#IndentBillOnNetProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
-
- if(#IndentBillOnNetProduct.TaxCurrency_IndentBillOnNet!=cbTaxCurrency.Text)
- {
- MessageBox("来源单据与当前单据税别不一致,请检查后修改!",@Title);
- }
- #SaleBillProduct.ID_Product = #IndentBillOnNetProduct.ID_Product;
- #SaleBillProduct.No_Product = #IndentBillOnNetProduct.No_Product;
- #SaleBillProduct.Name_Product = #IndentBillOnNetProduct.Name_Product;
- #SaleBillProduct.Quantity_SaleBillProduct = #IndentBillOnNetProduct.Quantity_IndentBillOnNetProduct;
- #SaleBillProduct.Unit_Product = #IndentBillOnNetProduct.Unit_Product;
- #SaleBillProduct.UnitPrice_SaleBillProduct = #IndentBillOnNetProduct.UnitPrice_IndentBillOnNetProduct;
- #SaleBillProduct.LowSalePrice_Product = #IndentBillOnNetProduct.LowSalePrice_Product;
- #SaleBillProduct.Amount_SaleBillProduct = FormatNumber( #SaleBillProduct.UnitPrice_SaleBillProduct * #SaleBillProduct.Quantity_SaleBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- #SaleBillProduct.ID_IndentBillOnNetProduct = #IndentBillOnNetProduct.ID_IndentBillOnNetProduct;
- }
- }
- ]]>
- <Lable name="CountSum" />
- </No_FromBillProduct>
- <No_Product>
- <![CDATA[
- if (!Equals(#SaleBillProduct.No_Product,"") && !Equals(#SaleBillProduct.No_Product,DBNull()))
- {
- if (Search("SearchProductWithNo",#SaleBillProduct.No_Product))
- {
- if(!Equals(#Product.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
- #SaleBillProduct.ID_Product = #Product.ID_Product;
- #SaleBillProduct.Name_Product = #Product.Name_Product;
- #SaleBillProduct.Unit_Product = #Product.Unit_Product;
-
- if(cbTaxCurrency.Text=="内含")
- #SaleBillProduct.OrderPrice_SaleBillProduct=FormatNumber(#Product.Price_Product*(1+@CessOut),@PriceDecimal);
- else
- #SaleBillProduct.OrderPrice_SaleBillProduct=#Product.Price_Product;
-
- if(#SaleBillProduct.Discount_SaleBillProduct!=0)
- {
- #SaleBillProduct.UnitPrice_SaleBillProduct = FormatNumber(#SaleBillProduct.OrderPrice_SaleBillProduct*#SaleBillProduct.Discount_SaleBillProduct/100,@PriceDecimal);
- }
- else
- {
- if(Search("SearchRelation",#SaleBillProduct.No_Product,tbCustomerNo.CValue))
- {
- if(cbTaxCurrency.Text=="内含")
- #SaleBillProduct.UnitPrice_SaleBillProduct=#PriceReference.UnitPriceWithTax_PriceReference;
- else
- #SaleBillProduct.UnitPrice_SaleBillProduct = #PriceReference.UnitPrice_PriceReference;
- if(#SaleBillProduct.OrderPrice_SaleBillProduct==0)
- #SaleBillProduct.Discount_SaleBillProduct=100;
- else
- #SaleBillProduct.Discount_SaleBillProduct =#SaleBillProduct.UnitPrice_SaleBillProduct/#SaleBillProduct.OrderPrice_SaleBillProduct*100 ;
- }
- else
- {
- #SaleBillProduct.UnitPrice_SaleBillProduct = #SaleBillProduct.OrderPrice_SaleBillProduct;
- #SaleBillProduct.Discount_SaleBillProduct=100;
- }
- }
- #SaleBillProduct.LowSalePrice_Product = #Product.LowSalePrice_Product;
- #SaleBillProduct.Amount_SaleBillProduct =FormatNumber( #SaleBillProduct.UnitPrice_SaleBillProduct * #SaleBillProduct.Quantity_SaleBillProduct, @PriceDecimal);
- }
- else
- {
- MessageBox("该产品不存在!",@Title);
- #SaleBillProduct.ID_Product = GuidEmpty();
- #SaleBillProduct.Name_Product = "";
- #SaleBillProduct.Unit_Product = "";
- #SaleBillProduct.Quantity_SaleBillProduct = 0;
- #SaleBillProduct.UnitPrice_SaleBillProduct = 0;
- #SaleBillProduct.Amount_SaleBillProduct = 0;
- #SaleBillProduct.OrderPrice_SaleBillProduct = 0;
- @temp = ShowSearchBox("InputSearchProduct","INFOMATION",#SaleBillProduct.No_Product);
- if(@temp != "")
- {
- ResumeColumnEvent("#SaleBillProduct.No_Product");
- #SaleBillProduct.No_Product = @temp;
- ClearColumnEvent();
- }
- }
- }
- else
- {
- #SaleBillProduct.ID_Product = GuidEmpty();
- #SaleBillProduct.Name_Product = "";
- #SaleBillProduct.Unit_Product = "";
- #SaleBillProduct.Quantity_SaleBillProduct = 0;
- #SaleBillProduct.UnitPrice_SaleBillProduct = 0;
- #SaleBillProduct.Amount_SaleBillProduct = 0;
- #SaleBillProduct.OrderPrice_SaleBillProduct = 0;
- }
- ]]>
- <Lable name="CountSum" />
- </No_Product>
- <Quantity_SaleBillProduct>
- <![CDATA[
- #SaleBillProduct.Quantity_SaleBillProduct = FormatNumber(#SaleBillProduct.Quantity_SaleBillProduct, @PriceDecimal);
- UpdateForm(false, "cbLocation");
- if (!Equals(#SaleBill.ID_Location,DBNull()) && !Equals(#SaleBillProduct.Quantity_SaleBillProduct,DBNull()))
- {
- @AvaQuantity = AvailableQty(#SaleBillProduct.ID_Product,#SaleBill.ID_Location);
- if (#SaleBillProduct.Quantity_SaleBillProduct > @AvaQuantity)
- {
- @strMessage = #SaleBillProduct.No_Product +" 目前可用数量为" + (string)@AvaQuantity + ",不能满足此次销货需求!";
- MessageBox(@strMessage,@Title);
- }
- }
- #SaleBillProduct.Amount_SaleBillProduct = FormatNumber( #SaleBillProduct.UnitPrice_SaleBillProduct * #SaleBillProduct.Quantity_SaleBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- ]]>
- <Lable name="CountSum" />
- </Quantity_SaleBillProduct>
- <UnitPrice_SaleBillProduct>
- #SaleBillProduct.UnitPrice_SaleBillProduct = FormatNumber(#SaleBillProduct.UnitPrice_SaleBillProduct, @PriceDecimal);
- if(#SaleBillProduct.OrderPrice_SaleBillProduct==0)
- #SaleBillProduct.Discount_SaleBillProduct=100;
- else
- #SaleBillProduct.Discount_SaleBillProduct =#SaleBillProduct.UnitPrice_SaleBillProduct/#SaleBillProduct.OrderPrice_SaleBillProduct*100;
- #SaleBillProduct.Amount_SaleBillProduct = FormatNumber(#SaleBillProduct.UnitPrice_SaleBillProduct * #SaleBillProduct.Quantity_SaleBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- <Lable name="CountSum" />
- </UnitPrice_SaleBillProduct>
- <Discount_SaleBillProduct>
- #SaleBillProduct.Discount_SaleBillProduct = #SaleBillProduct.Discount_SaleBillProduct;
- if(#SaleBillProduct.Discount_SaleBillProduct==0)
- {
- if(Search("SearchRelation",#SaleBillProduct.No_Product,tbCustomerNo.CValue))
- {
- if(cbTaxCurrency.Text=="内含")
- #SaleBillProduct.UnitPrice_SaleBillProduct=#PriceReference.UnitPriceWithTax_PriceReference;
- else
- #SaleBillProduct.UnitPrice_SaleBillProduct = #PriceReference.UnitPrice_PriceReference;
- if(#SaleBillProduct.OrderPrice_SaleBillProduct==0)
- #SaleBillProduct.Discount_SaleBillProduct=100;
- else
- #SaleBillProduct.Discount_SaleBillProduct =#SaleBillProduct.UnitPrice_SaleBillProduct/#SaleBillProduct.OrderPrice_SaleBillProduct*100;
- }
- else
- {
- #SaleBillProduct.UnitPrice_SaleBillProduct = #SaleBillProduct.OrderPrice_SaleBillProduct;
- #SaleBillProduct.Discount_SaleBillProduct=100;
- }
- }
- else
- {
- #SaleBillProduct.UnitPrice_SaleBillProduct =FormatNumber( #SaleBillProduct.OrderPrice_SaleBillProduct * #SaleBillProduct.Discount_SaleBillProduct/100,@PriceDecimal);
- }
- #SaleBillProduct.Amount_SaleBillProduct =FormatNumber( #SaleBillProduct.UnitPrice_SaleBillProduct * #SaleBillProduct.Quantity_SaleBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
- <Lable name="CountSum" />
- </Discount_SaleBillProduct>
- </ColumnsChanged>
- <RowDeleted>
- <Lable name="CountSum" />
- </RowDeleted>
- </Events>
- </Table>
- </Tables>
- <LockInfomation LockID="ID_SaleBill" LockNO="No_SaleBill" LockSearchFunction="SearchSaleBillWithNo" LockAudit="ID_Assessor"/>
- <LogInfomation LogNO="#SaleBill.No_SaleBill" RecordFormField="" RecordDataGridField="#SaleBillProduct.No_Product,#SaleBillProduct.Quantity_SaleBillProduct,#SaleBillProduct.Amount_SaleBillProduct"/>
- <ChildFormsCheck ChildForm="ImportPriceQueryBillControl" Question="#PriceQueryBill.StateDay_PriceQueryBill" Value="无效" Message="此报价单的报价已超出有效期限,确认要转单吗?"/>
- <ChildForms>
- <ChildForm name="BillSearch" DataSource="SaleBill" SearchFunction="SearchAllBill" SearchFunctionCondition="SearchBillCondition" SearchFunctionByNo="SearchSaleBillWithNo">
- <DataColumn Index="0" MappingName="#SaleBill.No_SaleBill" HeaderText="销售单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="1" MappingName="#SaleBill.Date_SaleBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="2" MappingName="#SaleBill.No_Customer" HeaderText="客户编号" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="3" MappingName="#SaleBill.ShortName_Customer" HeaderText="客户名称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="4" MappingName="#SaleBill.Principal_SaleBill" HeaderText="业务负责" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="5" MappingName="#SaleBill.TaxCurrency_SaleBill" HeaderText="税别" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="5" MappingName="#SaleBill.Name_Linkman" HeaderText="联系人" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="6" MappingName="#SaleBill.Tel_SaleBill" HeaderText="电话" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="7" MappingName="#SaleBill.Fax_SaleBill" HeaderText="传真" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="8" MappingName="#SaleBill.statu" 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="SaleBillProduct" ShowCheckBox="true">
- <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn" ReturnMappingName="#SaleBillProduct.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="SaleBillProduct">
- <DataColumn Index="0" MappingName="#PriceQueryBill.No_PriceQueryBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleBillProduct.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="#SaleBill.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="#SaleBill.TaxCurrency_SaleBill" />
- </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="#SaleBillProduct.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="#SaleBillProduct.Discount_SaleBillProduct" Format="F2"/>
- </DataGridIndex>
- </ChildForm>
- <ChildForm name="ImportIndentBillOnNetControl" >
- <DataGridIndex DataSource="IndentBillOnNet" SearchFunction="SearchAllIndentBillOnNet" SearchFunctionByNo="" MappingName="" ReturnDataSource="SaleBillProduct">
- <DataColumn Index="0" MappingName="#IndentBillOnNet.No_IndentBillOnNet" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleBillProduct.No_FromBill"/>
- <DataColumn Index="1" MappingName="#IndentBillOnNet.Date_IndentBillOnNet" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="2" MappingName="#IndentBillOnNet.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#SaleBill.No_Customer"/>
- <DataColumn Index="3" MappingName="#IndentBillOnNet.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="4" MappingName="#IndentBillOnNet.State_IndentBillOnNet" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="5" MappingName="#IndentBillOnNet.TaxCurrency_IndentBillOnNet" HeaderText="税别" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#SaleBill.TaxCurrency_SaleBill" />
- </DataGridIndex>
- <DataGridIndex DataSource="IndentBillOnNetProduct" SearchFunction="SearchAllIndentBillOnNetProduct" SearchFunctionByNo="" MappingName="">
- <DataColumn Index="0" MappingName="#IndentBillOnNetProduct.No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleBillProduct.No_Product"/>
- <DataColumn Index="1" MappingName="#IndentBillOnNetProduct.No_IndentBillOnNetProduct" HeaderText="产品序号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#SaleBillProduct.No_FromBillProduct"/>
- <DataColumn Index="2" MappingName="#IndentBillOnNetProduct.Name_Product" HeaderText="产品名称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="3" MappingName="#IndentBillOnNetProduct.Quantity_IndentBillOnNetProduct" HeaderText="数量" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2" ReturnMappingName="#SaleBillProduct.Quantity_SaleBillProduct"/>
- <DataColumn Index="4" MappingName="#IndentBillOnNetProduct.OrderPrice_IndentBillOnNetProduct" HeaderText="单价" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2" ReturnMappingName="#SaleBillProduct.OrderPrice_SaleBillProduct"/>
- </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_SaleBill = 0 and Customer.ID_Creator='{0}' ",GetLoginUserID());
- }
- </Format>
- </FormatString>
- <ImportedInfo>
- @TaxCurrency=#SaleBill.TaxCurrency_SaleBill;
- @No_Principal=#SaleBill.No_Principal;
- @Name_Pricipal=#SaleBill.Principal_SaleBill;
- UpdateForm(true,"ckSpecial");
- UpdateForm(true,"ckSpecial1");
- UpdateForm(true, "tbCustomerNo");
- ActiveControlEvent("tbCustomerNo", "Enter");
- #SaleBill.TaxCurrency_SaleBill=@TaxCurrency;
- #SaleBill.No_Principal=@No_Principal;
- #SaleBill.Principal_SaleBill=@Name_Pricipal;
- if( Search("SearchPrincipalByNo",#SaleBill.No_Principal))
- #SaleBill.ID_Principal = #Principal1.ID_Employee;
- UpdateForm(true,"cbPrincipal");
- UpdateForm(true, "cbTaxCurrency");
- </ImportedInfo>
- </Client>
- <Server>
- <Tables>
- <Table name="SaleBill" Type="Parent">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 SaleBill.*
- ,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_SaleBill
- FROM SaleBill
-
- LEFT JOIN Customer ON Customer.ID_Customer = SaleBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = SaleBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = SaleBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = SaleBill.LastModUser_SaleBill
- LEFT JOIN Location ON Location.ID_Location = SaleBill.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- " />
- <New CmdType="Text" CmdText=" INSERT INTO SaleBill (ID_SaleBill
- ,No_SaleBill
- ,Date_SaleBill
- ,ID_Location
- ,ID_Customer
- ,No_OrderBill
- ,GetMethod_SaleBill
- ,ToGet_SaleBill
- ,Name_Linkman
- ,Tel_SaleBill
- ,Fax_SaleBill
- ,SendAddr_SaleBill
- ,InvoiceAddress_Company
- ,InvoiceTitle_Company
- ,TaxCurrency_SaleBill
- ,Currency_SaleBill
- ,ID_Principal
- ,ID_Creator
- ,CreateDate_SaleBill
- ,Amount_SaleBill
- ,Discount_SaleBill
- ,GoodsAmount_SaleBill
- ,TaxAmount_SaleBill
- ,OutStatus_SaleBill
- ,Special_SaleBill
- ,Special2_SaleBill)
- VALUES (@ID_SaleBill
- ,@No_SaleBill
- ,@Date_SaleBill
- ,@ID_Location
- ,@ID_Customer
- ,@No_OrderBill
- ,@GetMethod_SaleBill
- ,@ToGet_SaleBill
- ,@Name_Linkman
- ,@Tel_SaleBill
- ,@Fax_SaleBill
- ,@SendAddr_SaleBill
- ,@InvoiceAddress_Company
- ,@InvoiceTitle_Company
- ,@TaxCurrency_SaleBill
- ,@Currency_SaleBill
- ,@ID_Principal
- ,@ID_Creator
- ,@CreateDate_SaleBill
- ,@Amount_SaleBill
- ,@Discount_SaleBill
- ,@GoodsAmount_SaleBill
- ,@TaxAmount_SaleBill
- ,@OutStatus_SaleBill
- ,@Special_SaleBill
- ,@Special2_SaleBill)
-
- UPDATE Customer SET Customer.LastPrincipal_Customer=@ID_Principal
- ,Customer.LastDiscount_Customer = @Discount_SaleBill
- ,Customer.LastTax_Customer = @TaxCurrency_SaleBill
- WHERE Customer.ID_Customer = @ID_Customer
- ">
- <Params>
- <Param name="@ID_SaleBill" type="SaleBill.ID_SaleBill" sourceColumn="ID_SaleBill" />
- <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" sourceColumn="No_SaleBill" />
- <Param name="@Date_SaleBill" type="SaleBill.Date_SaleBill" sourceColumn="Date_SaleBill" />
- <Param name="@ID_Location" type="SaleBill.ID_Location" sourceColumn="ID_Location" />
- <Param name="@ID_Customer" type="SaleBill.ID_Customer" sourceColumn="ID_Customer" />
- <Param name="@No_OrderBill" type="SaleBill.No_OrderBill" sourceColumn="No_OrderBill" />
- <Param name="@GetMethod_SaleBill" type="SaleBill.GetMethod_SaleBill" sourceColumn="GetMethod_SaleBill" />
- <Param name="@ToGet_SaleBill" type="SaleBill.ToGet_SaleBill" sourceColumn="ToGet_SaleBill" />
- <Param name="@Name_Linkman" type="SaleBill.Name_Linkman" sourceColumn="Name_Linkman" />
- <Param name="@Tel_SaleBill" type="SaleBill.Tel_SaleBill" sourceColumn="Tel_SaleBill" />
- <Param name="@Fax_SaleBill" type="SaleBill.Fax_SaleBill" sourceColumn="Fax_SaleBill" />
- <Param name="@SendAddr_SaleBill" type="SaleBill.SendAddr_SaleBill" sourceColumn="SendAddr_SaleBill" />
- <Param name="@InvoiceAddress_Company" type="SaleBill.InvoiceAddress_Company" sourceColumn="InvoiceAddress_Company" />
- <Param name="@InvoiceTitle_Company" type="SaleBill.InvoiceTitle_Company" sourceColumn="InvoiceTitle_Company" />
- <Param name="@TaxCurrency_SaleBill" type="SaleBill.TaxCurrency_SaleBill" sourceColumn="TaxCurrency_SaleBill" />
- <Param name="@Currency_SaleBill" type="SaleBill.Currency_SaleBill" sourceColumn="Currency_SaleBill" />
- <Param name="@ID_Principal" type="SaleBill.ID_Principal" sourceColumn="ID_Principal" />
- <Param name="@ID_Creator" type="SaleBill.ID_Creator" sourceColumn="ID_Creator" />
- <Param name="@CreateDate_SaleBill" type="SaleBill.CreateDate_SaleBill" sourceColumn="CreateDate_SaleBill" />
- <Param name="@Amount_SaleBill" type="SaleBill.Amount_SaleBill" sourceColumn="Amount_SaleBill" />
- <Param name="@Discount_SaleBill" type="SaleBill.Discount_SaleBill" sourceColumn="Discount_SaleBill" />
- <Param name="@GoodsAmount_SaleBill" type="SaleBill.GoodsAmount_SaleBill" sourceColumn="GoodsAmount_SaleBill" />
- <Param name="@TaxAmount_SaleBill" type="SaleBill.TaxAmount_SaleBill" sourceColumn="TaxAmount_SaleBill" />
- <Param name="@OutStatus_SaleBill" type="SaleBill.OutStatus_SaleBill" sourceColumn="OutStatus_SaleBill" />
- <Param name="@Special_SaleBill" type="SaleBill.Special_SaleBill" sourceColumn="Special_SaleBill" />
- <Param name="@Special2_SaleBill" type="SaleBill.Special2_SaleBill" sourceColumn="Special2_SaleBill" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText=" UPDATE SaleBill SET Date_SaleBill = @Date_SaleBill
- ,ID_Location = @ID_Location
- ,ID_Customer = @ID_Customer
- ,No_OrderBill = @No_OrderBill
- ,GetMethod_SaleBill = @GetMethod_SaleBill
- ,ToGet_SaleBill = @ToGet_SaleBill
- ,Name_Linkman = @Name_Linkman
- ,Tel_SaleBill = @Tel_SaleBill
- ,Fax_SaleBill = @Fax_SaleBill
- ,SendAddr_SaleBill = @SendAddr_SaleBill
- ,InvoiceAddress_Company = @InvoiceAddress_Company
- ,InvoiceTitle_Company = @InvoiceTitle_Company
- ,TaxCurrency_SaleBill = @TaxCurrency_SaleBill
- ,Currency_SaleBill = @Currency_SaleBill
- ,ID_Principal = @ID_Principal
- ,Amount_SaleBill = @Amount_SaleBill
- ,LastModUser_SaleBill = @LastModUser_SaleBill
- ,LastModDate_SaleBill = @LastModDate_SaleBill
- ,Discount_SaleBill=@Discount_SaleBill
- ,GoodsAmount_SaleBill=@GoodsAmount_SaleBill
- ,TaxAmount_SaleBill=@TaxAmount_SaleBill
- ,Assess_SaleBill = @Assess_SaleBill
- ,OutStatus_SaleBill=@OutStatus_SaleBill
- ,Special_SaleBill=@Special_SaleBill
- ,Special2_SaleBill=@Special2_SaleBill
- WHERE ID_SaleBill = @ID_SaleBill
-
- UPDATE Customer SET Customer.LastPrincipal_Customer=@ID_Principal
- ,Customer.LastDiscount_Customer = @Discount_SaleBill
- ,Customer.LastTax_Customer = @TaxCurrency_SaleBill
- WHERE Customer.ID_Customer = @ID_Customer
- ">
- <Params>
- <Param name="@ID_SaleBill" type="SaleBill.ID_SaleBill" sourceColumn="ID_SaleBill" />
- <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" sourceColumn="No_SaleBill" />
- <Param name="@Date_SaleBill" type="SaleBill.Date_SaleBill" sourceColumn="Date_SaleBill" />
- <Param name="@ID_Location" type="SaleBill.ID_Location" sourceColumn="ID_Location" />
- <Param name="@ID_Customer" type="SaleBill.ID_Customer" sourceColumn="ID_Customer" />
- <Param name="@No_OrderBill" type="SaleBill.No_OrderBill" sourceColumn="No_OrderBill" />
- <Param name="@GetMethod_SaleBill" type="SaleBill.GetMethod_SaleBill" sourceColumn="GetMethod_SaleBill" />
- <Param name="@ToGet_SaleBill" type="SaleBill.ToGet_SaleBill" sourceColumn="ToGet_SaleBill" />
- <Param name="@Name_Linkman" type="SaleBill.Name_Linkman" sourceColumn="Name_Linkman" />
- <Param name="@Tel_SaleBill" type="SaleBill.Tel_SaleBill" sourceColumn="Tel_SaleBill" />
- <Param name="@Fax_SaleBill" type="SaleBill.Fax_SaleBill" sourceColumn="Fax_SaleBill" />
- <Param name="@SendAddr_SaleBill" type="SaleBill.SendAddr_SaleBill" sourceColumn="SendAddr_SaleBill" />
- <Param name="@InvoiceAddress_Company" type="SaleBill.InvoiceAddress_Company" sourceColumn="InvoiceAddress_Company" />
- <Param name="@InvoiceTitle_Company" type="SaleBill.InvoiceTitle_Company" sourceColumn="InvoiceTitle_Company" />
- <Param name="@TaxCurrency_SaleBill" type="SaleBill.TaxCurrency_SaleBill" sourceColumn="TaxCurrency_SaleBill" />
- <Param name="@Currency_SaleBill" type="SaleBill.Currency_SaleBill" sourceColumn="Currency_SaleBill" />
- <Param name="@ID_Principal" type="SaleBill.ID_Principal" sourceColumn="ID_Principal" />
- <Param name="@LastModUser_SaleBill" type="SaleBill.LastModUser_SaleBill" sourceColumn="LastModUser_SaleBill" />
- <Param name="@LastModDate_SaleBill" type="SaleBill.LastModDate_SaleBill" sourceColumn="LastModDate_SaleBill" />
- <Param name="@Amount_SaleBill" type="SaleBill.Amount_SaleBill" sourceColumn="Amount_SaleBill" />
- <Param name="@Discount_SaleBill" type="SaleBill.Discount_SaleBill" sourceColumn="Discount_SaleBill" />
- <Param name="@GoodsAmount_SaleBill" type="SaleBill.GoodsAmount_SaleBill" sourceColumn="GoodsAmount_SaleBill" />
- <Param name="@TaxAmount_SaleBill" type="SaleBill.TaxAmount_SaleBill" sourceColumn="TaxAmount_SaleBill" />
- <Param name="@Assess_SaleBill" type="SaleBill.Assess_SaleBill" sourceColumn="Assess_SaleBill" />
- <Param name="@OutStatus_SaleBill" type="SaleBill.OutStatus_SaleBill" sourceColumn="OutStatus_SaleBill" />
- <Param name="@Special_SaleBill" type="SaleBill.Special_SaleBill" sourceColumn="Special_SaleBill" />
- <Param name="@Special2_SaleBill" type="SaleBill.Special2_SaleBill" sourceColumn="Special2_SaleBill" />
- </Params>
- </Update>
- <Audit CmdType="Text" CmdText=" DECLARE @ID_SaleBillProduct uniqueidentifier
- DECLARE @No_SaleBillProduct nvarchar(64)
- DECLARE @ID_Product uniqueidentifier
- DECLARE @Quantity decimal(14,4)
- DECLARE @ID_SaleSourceBillProduct uniqueidentifier
- DECLARE @Quantity_Sale decimal(14,4)
- DECLARE @UnitPrice_SaleBillProduct decimal(14,4)
-
- DECLARE @Quantity_OutDepot decimal(14,4)
- DECLARE @AvailableQty decimal(14,4)
- DECLARE @Assess_SaleBill bit
- DECLARE @SaleAndOutDepot bit
- DECLARE @error nvarchar(64)
- DECLARE @ID_IndentBill uniqueidentifier
- DECLARE @No_FromBill nvarchar(64)
- DECLARE @UnitPrice_PriceReference decimal(14,4)
- DECLARE @UnitPriceWithTax_PriceReference decimal(14,4)
- DECLARE @CessOut decimal(14,4)
- Declare @No_FromBillProduct nvarchar(64)
-
- DECLARE CUR CURSOR FOR SELECT SaleBillProduct.ID_SaleBillProduct
- ,SaleBillProduct.No_SaleBillProduct
- ,SaleBillProduct.ID_Product
- ,SaleBillProduct.Quantity_SaleBillProduct
- ,SaleBillProduct.ID_SaleSourceBillProduct
- ,UnitPrice_SaleBillProduct
- ,No_FromBill
- ,No_FromBillProduct
- FROM SaleBillProduct
- WHERE SaleBillProduct.ID_SaleBill = @ID_SaleBill
-
- SELECT @SaleAndOutDepot = SystemSetting.SaleAndOutDepot_SystemSetting,@CessOut=CessOut_SystemSetting/100 FROM SystemSetting
- IF (@ID_Assessor IS NULL)
- BEGIN
- SELECT @Assess_SaleBill = SaleBill.Assess_SaleBill FROM SaleBill WHERE SaleBill.ID_SaleBill = @ID_SaleBill
- IF (@Assess_SaleBill = 1)
- BEGIN
- RAISERROR('该单据已经财务复核,请先取消财务复核!',16,1)
- RETURN
- END
- IF (@SaleAndOutDepot = 1 and @Disable_SaleBill=0)
- BEGIN
- SELECT @Quantity_Sale = SUM(SaleSourceBillProduct.Quantity_Sale), @Quantity_OutDepot = SUM(SaleSourceBillProduct.Quantity_OutDepot) FROM SaleSourceBillProduct
- INNER JOIN SaleBillProduct ON SaleBillProduct.ID_SaleSourceBillProduct = SaleSourceBillProduct.ID_SaleSourceBillProduct WHERE SaleBillProduct.ID_SaleBill = @ID_SaleBill
- IF (@Quantity_Sale = @Quantity_OutDepot) AND (@Quantity_Sale > 0) AND (@Quantity_OutDepot > 0)
- BEGIN
- RAISERROR('该单据产品已经全部出库,取消审核失败!',16,1)
- RETURN
- END
- END
-
- END
- OPEN CUR
- FETCH NEXT FROM CUR INTO @ID_SaleBillProduct, @No_SaleBillProduct, @ID_Product, @Quantity, @ID_SaleSourceBillProduct,@UnitPrice_SaleBillProduct,@No_FromBill,@No_FromBillProduct
- WHILE @@FETCH_STATUS = 0
- BEGIN
- IF (@ID_Assessor IS NOT NULL)
- BEGIN
- IF(@TaxCurrency_SaleBill='内含')
- BEGIN
- SET @UnitPrice_PriceReference=@UnitPrice_SaleBillProduct/(1+@CessOut)
- SET @UnitPriceWithTax_PriceReference=@UnitPrice_SaleBillProduct
- END
- ELSE
- BEGIN
- SET @UnitPrice_PriceReference=@UnitPrice_SaleBillProduct
- SET @UnitPriceWithTax_PriceReference=@UnitPrice_SaleBillProduct*(1+@CessOut)
- END
-
- IF Exists (Select * From PriceReference Where ID_Customer=@ID_Customer AND ID_Product=@ID_Product)
- Update PriceReference Set UnitPrice_PriceReference=Convert(decimal(18,2),@UnitPrice_PriceReference),UnitPriceWithTax_PriceReference=Convert(decimal(18,2),@UnitPriceWithTax_PriceReference) Where ID_Customer=@ID_Customer ANd ID_Product=@ID_Product
- Else
- Insert Into PriceReference(ID_PriceReference,ID_Customer,ID_Product,UnitPrice_PriceReference,UnitPriceWithTax_PriceReference) Values(newID(),@ID_Customer,@ID_Product,Convert(decimal(18,2),@UnitPrice_PriceReference),Convert(decimal(18,2),@UnitPriceWithTax_PriceReference))
- IF (@SaleAndOutDepot = 1)
- BEGIN
- IF (@ID_SaleSourceBillProduct IS NULL)
- BEGIN
- SET @ID_SaleSourceBillProduct = @ID_SaleBillProduct
- INSERT INTO SaleSourceBillProduct (ID_SaleSourceBillProduct, Quantity_Sale) VALUES (@ID_SaleSourceBillProduct, @Quantity)
- UPDATE SaleBillProduct SET SaleBillProduct.ID_SaleSourceBillProduct = @ID_SaleSourceBillProduct WHERE SaleBillProduct.ID_SaleBillProduct = @ID_SaleBillProduct
- END
- ELSE
- BEGIN
- SELECT @Quantity_OutDepot = SaleSourceBillProduct.Quantity_OutDepot FROM SaleSourceBillProduct WHERE SaleSourceBillProduct.ID_SaleSourceBillProduct = @ID_SaleSourceBillProduct
- IF (@Quantity < @Quantity_OutDepot)
- BEGIN
- SET @error = N'序号为'+@No_SaleBillProduct+N'的销售数量小于已出库数量,审核失败!请于关联单据处查询。'
- RAISERROR(@error,16,1)
- RETURN
- END
- ELSE
- BEGIN
- UPDATE SaleSourceBillProduct SET SaleSourceBillProduct.Quantity_Sale = @Quantity WHERE SaleSourceBillProduct.ID_SaleSourceBillProduct = @ID_SaleSourceBillProduct
- END
- END
- END
- SELECT @AvailableQty = ProductStocks.AvailableQty_ProductStocks FROM ProductStocks WHERE ProductStocks.ID_Product = @ID_Product AND ProductStocks.ID_Location = @ID_Location
- -- IF (@AvailableQty < @Quantity)
- -- BEGIN
- -- SET @error = N'产品编号为'+@No_SaleBillProduct+N'的产品目前可用数量为'+ convert(nvarchar(64),@AvailableQty) +',不能通过审核,请修改销货单!'
- -- RAISERROR(@error,16,1)
- -- RETURN
- -- END
- IF @AvailableQty IS NULL
- BEGIN
- SET @error = N'对应库位中不存在序号为'+@No_SaleBillProduct+N'的产品,审核失败!'
- RAISERROR(@error,16,1)
- RETURN
- END
- ELSE
- BEGIN
- SET @AvailableQty = NULL
- UPDATE ProductStocks SET ProductStocks.AvailableQty_ProductStocks = ProductStocks.AvailableQty_ProductStocks - @Quantity WHERE ProductStocks.ID_Product = @ID_Product AND ProductStocks.ID_Location = @ID_Location
- END
- Select @ID_IndentBill = ID_IndentBill From IndentBill WHERE No_IndentBill = @No_FromBill
- UPDATE IndentBillProduct SET Quantity_Sale = Quantity_Sale + @Quantity WHERE ID_IndentBill = @ID_IndentBill and No_IndentBillProduct = @No_FromBillProduct
- END
- ELSE
- BEGIN
- IF (@SaleAndOutDepot = 1)
- BEGIN
- UPDATE SaleSourceBillProduct SET SaleSourceBillProduct.Quantity_Sale = 0 WHERE SaleSourceBillProduct.ID_SaleSourceBillProduct = @ID_SaleSourceBillProduct
- END
- UPDATE ProductStocks SET ProductStocks.AvailableQty_ProductStocks = ProductStocks.AvailableQty_ProductStocks + @Quantity WHERE ProductStocks.ID_Product = @ID_Product AND ProductStocks.ID_Location = @ID_Location
- Select @ID_IndentBill = ID_IndentBill From IndentBill WHERE No_IndentBill = @No_FromBill
- UPDATE IndentBillProduct SET Quantity_Sale = Quantity_Sale - @Quantity WHERE ID_IndentBill = @ID_IndentBill and No_IndentBillProduct = @No_FromBillProduct
- END
- FETCH NEXT FROM CUR INTO @ID_SaleBillProduct, @No_SaleBillProduct, @ID_Product, @Quantity, @ID_SaleSourceBillProduct,@UnitPrice_SaleBillProduct,@No_FromBill,@No_FromBillProduct
- END
- CLOSE CUR
- DEALLOCATE CUR
-
- UPDATE SaleBill SET ID_Assessor = @ID_Assessor
- ,AssessDate_SaleBill = @AssessDate_SaleBill
- ,Disable_SaleBill=@Disable_SaleBill
- ,OutStatus_SaleBill=@OutStatus_SaleBill
- WHERE ID_SaleBill = @ID_SaleBill
- ">
- <Params>
- <Param name="@ID_SaleBill" type="SaleBill.ID_SaleBill" sourceColumn="ID_SaleBill" />
- <Param name="@ID_Location" type="SaleBill.ID_Location" sourceColumn="ID_Location" />
- <Param name="@ID_Assessor" type="SaleBill.ID_Assessor" sourceColumn="ID_Assessor" />
- <Param name="@AssessDate_SaleBill" type="SaleBill.AssessDate_SaleBill" sourceColumn="AssessDate_SaleBill" />
- <Param name="@ID_Customer" type="SaleBill.ID_Customer" sourceColumn="ID_Customer" />
- <Param name="@Disable_SaleBill" type="SaleBill.Disable_SaleBill" sourceColumn="Disable_SaleBill" />
- <Param name="@OutStatus_SaleBill" type="SaleBill.OutStatus_SaleBill" sourceColumn="OutStatus_SaleBill" />
- <Param name="@TaxCurrency_SaleBill" type="SaleBill.TaxCurrency_SaleBill" sourceColumn="TaxCurrency_SaleBill" />
- </Params>
- </Audit>
- <Delete CmdType="Text" CmdText=" DECLARE @SaleAndOutDepot bit
- DECLARE @Quantity_OutDepot decimal(14,4)
- DECLARE @Quantity_SaleRtn decimal(14,4)
- DECLARE @Quantity_InDepot decimal(14,4)
-
- SELECT @SaleAndOutDepot = SystemSetting.SaleAndOutDepot_SystemSetting FROM SystemSetting
- IF (@SaleAndOutDepot = 1)
- BEGIN
- SELECT @Quantity_OutDepot = SUM(SaleSourceBillProduct.Quantity_OutDepot), @Quantity_SaleRtn = SUM(SaleSourceBillProduct.Quantity_SaleRtn), @Quantity_InDepot = SUM(SaleSourceBillProduct.Quantity_InDepot)
- FROM SaleSourceBillProduct
- INNER JOIN SaleBillProduct ON SaleBillProduct.ID_SaleSourceBillProduct = SaleSourceBillProduct.ID_SaleSourceBillProduct
- WHERE SaleBillProduct.ID_SaleBill = @ID_SaleBill
-
- IF (@Quantity_OutDepot > 0)
- BEGIN
- RAISERROR('该单据已有相应的销售出库记录,删除失败!',16,1)
- RETURN
- END
- IF (@Quantity_SaleRtn > 0)
- BEGIN
- RAISERROR('该单据已有相应的销售退货记录,删除失败!',16,1)
- RETURN
- END
- IF (@Quantity_InDepot > 0)
- BEGIN
- RAISERROR('该单据已有相应的销售退货入库记录,删除失败!',16,1)
- RETURN
- END
- DELETE SaleSourceBillProduct WHERE ID_SaleSourceBillProduct IN (SELECT SaleBillProduct.ID_SaleSourceBillProduct FROM SaleBillProduct WHERE SaleBillProduct.ID_SaleBill = @ID_SaleBill)
- END
- DELETE SaleBillProduct WHERE SaleBillProduct.ID_SaleBill = @ID_SaleBill
- DELETE BillComment WHERE BillComment.ID_Bill = @ID_SaleBill
- DELETE ReportComment WHERE ReportComment.ID_Bill = @ID_SaleBill
- IF (@SaleAndOutDepot = 1)
- BEGIN
- DELETE SaleBill WHERE SaleBill.ID_SaleBill = @ID_SaleBill
- END
- ELSE
- BEGIN
- UPDATE SaleBill SET SaleBill.Disable_SaleBill = 1 WHERE SaleBill.ID_SaleBill = @ID_SaleBill
- END">
- <Params>
- <Param name="@ID_SaleBill" type="SaleBill.ID_SaleBill" sourceColumn="ID_SaleBill" />
- </Params>
- </Delete>
- <FKErrorReport ErrorMessage="该单据已被其他单据引用,删除失败!" />
- <UNIQUEErrorReport ErrorMessage="该销货单号已存在,提交失败!" />
- </Table>
- <Table name="SaleBillProduct" Type="Child">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 SaleBillProduct.*
- ,Product.No_Product
- ,Product.Name_Product
- ,Product.Unit_Product
- ,Product.LowSalePrice_Product
- ,CONVERT(decimal(18,6), 0) AS Amount_SaleBillProduct
- ,BillType.Name_BillType
- ,Convert(nvarchar(64),'') as No_SaleBill
- FROM SaleBillProduct
- LEFT JOIN Product ON Product.ID_Product = SaleBillProduct.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType = SaleBillProduct.Type_FromBill
- "/>
- <New CmdType="Text" CmdText=" SET @ID_SaleSourceBillProduct = NULL
- if(@ID_IndentBillOnNetProduct='00000000-0000-0000-0000-000000000000') Set @ID_IndentBillOnNetProduct=Null
- INSERT INTO SaleBillProduct (ID_SaleBillProduct
- ,No_SaleBillProduct
- ,ID_SaleBill
- ,Type_FromBill
- ,No_FromBill
- ,No_FromBillProduct
- ,ID_SaleSourceBillProduct
- ,ID_Product
- ,Quantity_SaleBillProduct
- ,UnitPrice_SaleBillProduct
- ,Discount_SaleBillProduct
- ,Comment_SaleBillProduct
- ,OrderPrice_SaleBillProduct
- ,ID_IndentBillOnNetProduct)
-
- VALUES (@ID_SaleBillProduct
- ,@No_SaleBillProduct
- ,@ID_SaleBill
- ,@Type_FromBill
- ,@No_FromBill
- ,@No_FromBillProduct
- ,@ID_SaleSourceBillProduct
- ,@ID_Product
- ,@Quantity_SaleBillProduct
- ,@UnitPrice_SaleBillProduct
- ,@Discount_SaleBillProduct
- ,@Comment_SaleBillProduct
- ,@OrderPrice_SaleBillProduct
- ,@ID_IndentBillOnNetProduct)
- ">
- <Params>
- <Param name="@ID_SaleBillProduct" type="SaleBillProduct.ID_SaleBillProduct" sourceColumn="ID_SaleBillProduct" />
- <Param name="@No_SaleBillProduct" type="SaleBillProduct.No_SaleBillProduct" sourceColumn="No_SaleBillProduct" />
- <Param name="@ID_SaleBill" type="SaleBillProduct.ID_SaleBill" sourceColumn="ID_SaleBill" />
- <Param name="@Type_FromBill" type="SaleBillProduct.Type_FromBill" sourceColumn="Type_FromBill" />
- <Param name="@No_FromBill" type="SaleBillProduct.No_FromBill" sourceColumn="No_FromBill" />
- <Param name="@No_FromBillProduct" type="SaleBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
- <Param name="@ID_SaleSourceBillProduct" type="SaleBillProduct.ID_SaleSourceBillProduct" sourceColumn="ID_SaleSourceBillProduct" />
- <Param name="@ID_Product" type="SaleBillProduct.ID_Product" sourceColumn="ID_Product" />
- <Param name="@Quantity_SaleBillProduct" type="SaleBillProduct.Quantity_SaleBillProduct" sourceColumn="Quantity_SaleBillProduct" />
- <Param name="@UnitPrice_SaleBillProduct" type="SaleBillProduct.UnitPrice_SaleBillProduct" sourceColumn="UnitPrice_SaleBillProduct" />
- <Param name="@Discount_SaleBillProduct" type="SaleBillProduct.Discount_SaleBillProduct" sourceColumn="Discount_SaleBillProduct" />
- <Param name="@Comment_SaleBillProduct" type="SaleBillProduct.Comment_SaleBillProduct" sourceColumn="Comment_SaleBillProduct" />
- <Param name="@OrderPrice_SaleBillProduct" type="SaleBillProduct.OrderPrice_SaleBillProduct" sourceColumn="OrderPrice_SaleBillProduct" />
- <Param name="@ID_IndentBillOnNetProduct" type="SaleBillProduct.ID_IndentBillOnNetProduct" sourceColumn="ID_IndentBillOnNetProduct" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText=" DECLARE @SaleAndOutDepot bit
- DECLARE @Quantity_OutDepot decimal(14,4)
- DECLARE @error nvarchar(64)
- DECLARE @IsGeneric_Customer BIT
-
- SELECT @IsGeneric_Customer=Customer.IsGeneric_Customer FROM Customer
- JOIN SaleBill ON Customer.ID_Customer=SaleBill.ID_Customer
- WHERE SaleBill.ID_SaleBill = @ID_SaleBill
-
- SELECT @SaleAndOutDepot = SystemSetting.SaleAndOutDepot_SystemSetting FROM SystemSetting
- IF (@SaleAndOutDepot = 1 AND @ID_SaleSourceBillProduct IS NOT NULL)
- BEGIN
- SELECT @Quantity_OutDepot = SaleSourceBillProduct.Quantity_OutDepot FROM SaleSourceBillProduct WHERE SaleSourceBillProduct.ID_SaleSourceBillProduct = @ID_SaleSourceBillProduct
- IF @Quantity_SaleBillProduct < @Quantity_OutDepot
- BEGIN
- SET @error = N'序号为'+@No_SaleBillProduct+N'的销售数量小于已出库数量,提交失败!请于关联单据处查询。'
- RAISERROR (@error,16,1)
- RETURN
- END
- END
- UPDATE SaleBillProduct SET ID_SaleBill = @ID_SaleBill
- ,Type_FromBill = @Type_FromBill
- ,No_FromBill = @No_FromBill
- ,No_FromBillProduct = @No_FromBillProduct
- ,ID_SaleSourceBillProduct = @ID_SaleSourceBillProduct
- ,ID_Product = @ID_Product
- ,Quantity_SaleBillProduct = @Quantity_SaleBillProduct
- ,UnitPrice_SaleBillProduct = @UnitPrice_SaleBillProduct
- ,Discount_SaleBillProduct = @Discount_SaleBillProduct
- ,Comment_SaleBillProduct = @Comment_SaleBillProduct
- ,OrderPrice_SaleBillProduct=@OrderPrice_SaleBillProduct
- ,ID_IndentBillOnNetProduct=@ID_IndentBillOnNetProduct
- WHERE ID_SaleBillProduct = @ID_SaleBillProduct
- ">
- <Params>
- <Param name="@ID_SaleBillProduct" type="SaleBillProduct.ID_SaleBillProduct" sourceColumn="ID_SaleBillProduct" />
- <Param name="@No_SaleBillProduct" type="SaleBillProduct.No_SaleBillProduct" sourceColumn="No_SaleBillProduct" />
- <Param name="@ID_SaleBill" type="SaleBillProduct.ID_SaleBill" sourceColumn="ID_SaleBill" />
- <Param name="@Type_FromBill" type="SaleBillProduct.Type_FromBill" sourceColumn="Type_FromBill" />
- <Param name="@No_FromBill" type="SaleBillProduct.No_FromBill" sourceColumn="No_FromBill" />
- <Param name="@No_FromBillProduct" type="SaleBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
- <Param name="@ID_SaleSourceBillProduct" type="SaleBillProduct.ID_SaleSourceBillProduct" sourceColumn="ID_SaleSourceBillProduct" />
- <Param name="@ID_Product" type="SaleBillProduct.ID_Product" sourceColumn="ID_Product" />
- <Param name="@Quantity_SaleBillProduct" type="SaleBillProduct.Quantity_SaleBillProduct" sourceColumn="Quantity_SaleBillProduct" />
- <Param name="@UnitPrice_SaleBillProduct" type="SaleBillProduct.UnitPrice_SaleBillProduct" sourceColumn="UnitPrice_SaleBillProduct" />
- <Param name="@Discount_SaleBillProduct" type="SaleBillProduct.Discount_SaleBillProduct" sourceColumn="Discount_SaleBillProduct" />
- <Param name="@Comment_SaleBillProduct" type="SaleBillProduct.Comment_SaleBillProduct" sourceColumn="Comment_SaleBillProduct" />
- <Param name="@OrderPrice_SaleBillProduct" type="SaleBillProduct.OrderPrice_SaleBillProduct" sourceColumn="OrderPrice_SaleBillProduct" />
- <Param name="@ID_IndentBillOnNetProduct" type="SaleBillProduct.ID_IndentBillOnNetProduct" sourceColumn="ID_IndentBillOnNetProduct" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText=" DELETE SaleBillProduct WHERE ID_SaleBillProduct = @ID_SaleBillProduct">
- <Params>
- <Param name="@ID_SaleBillProduct" type="SaleBillProduct.ID_SaleBillProduct" sourceColumn="ID_SaleBillProduct" />
- <Param name="@No_SaleBillProduct" type="SaleBillProduct.No_SaleBillProduct" sourceColumn="No_SaleBillProduct" />
- <Param name="@ID_SaleBill" type="SaleBillProduct.ID_SaleBill" sourceColumn="ID_SaleBill" />
- <Param name="@Type_FromBill" type="SaleBillProduct.Type_FromBill" sourceColumn="Type_FromBill" />
- <Param name="@No_FromBill" type="SaleBillProduct.No_FromBill" sourceColumn="No_FromBill" />
- <Param name="@No_FromBillProduct" type="SaleBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
- <Param name="@ID_SaleSourceBillProduct" type="SaleBillProduct.ID_SaleSourceBillProduct" sourceColumn="ID_SaleSourceBillProduct" />
- <Param name="@ID_Product" type="SaleBillProduct.ID_Product" sourceColumn="ID_Product" />
- <Param name="@Quantity_SaleBillProduct" type="SaleBillProduct.Quantity_SaleBillProduct" sourceColumn="Quantity_SaleBillProduct" />
- <Param name="@UnitPrice_SaleBillProduct" type="SaleBillProduct.UnitPrice_SaleBillProduct" sourceColumn="UnitPrice_SaleBillProduct" />
- <Param name="@Discount_SaleBillProduct" type="SaleBillProduct.Discount_SaleBillProduct" sourceColumn="Discount_SaleBillProduct" />
- <Param name="@Comment_SaleBillProduct" type="SaleBillProduct.Comment_SaleBillProduct" sourceColumn="Comment_SaleBillProduct" />
- </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_SaleBill 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 SaleBill.*
- ,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_SaleBill
- ,statu= Case isnull(DataLength(SaleBill.ID_Assessor),0) WHEN 0 THEN CASE Disable_SaleBill WHEN 1 THEN '作废' ELSE '未审核' END ELSE '已审核' END
- FROM SaleBill
- LEFT JOIN Customer ON Customer.ID_Customer = SaleBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = SaleBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = SaleBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User= SaleBill.LastModUser_SaleBill
- LEFT JOIN Location ON Location.ID_Location = SaleBill.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- ">
- <Tables>
- <Table name="AllBill" />
- </Tables>
- </SearchAllBill>
- <SearchAllIndentBillOnNet CmdType="Text" CmdText="Select IndentBillOnNet.ID_IndentBillOnNet
- ,IndentBillOnNet.No_IndentBillOnNet
- ,IndentBillOnNet.TaxCurrency_IndentBillOnNet
- ,IndentBillOnNet.Date_IndentBillOnNet
- ,Customer.No_Customer
- ,Customer.ShortName_Customer
- ,Case When IndentBillOnNet.ID_Assessor is null Then '未审核' Else '已审核' End As State_IndentBillOnNet
- From IndentBillOnNet
- Inner Join Customer On IndentBillOnNet.ID_Customer = Customer.ID_Customer
- " >
- <Tables>
- <Table name="AllIndentBillOnNet" />
- </Tables>
- </SearchAllIndentBillOnNet>
- <SearchAllIndentBillOnNetProduct CmdType="Text" CmdText=" Select Product.No_Product
- ,IndentBillOnNetProduct.No_IndentBillOnNetProduct
- ,Product.Name_Product
- ,IndentBillOnNetProduct.Quantity_IndentBillOnNetProduct
- ,UnitPrice_IndentBillOnNetProduct As OrderPrice_IndentBillOnNetProduct
- From IndentBillOnNetProduct
- Inner Join Product On Product.ID_Product = IndentBillOnNetProduct.ID_Product
- Inner Join IndentBillOnNet On IndentBillOnNet.ID_IndentBillOnNet = IndentBillOnNetProduct.ID_IndentBillOnNet
- " >
- <Tables>
- <Table name="AllIndentBillOnNetProduct" />
- </Tables>
- </SearchAllIndentBillOnNetProduct>
- <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>
- <SearchSaleBillWithNo CmdType="Text" CmdText=" DECLARE @ID_SaleBill uniqueidentifier
- SELECT SaleBill.*, 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_SaleBill,Customer.ID_Creator As CustomerCreator
- FROM SaleBill
- LEFT JOIN Customer ON Customer.ID_Customer = SaleBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = SaleBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = SaleBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = SaleBill.LastModUser_SaleBill
- LEFT JOIN Location ON Location.ID_Location = SaleBill.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- WHERE SaleBill.No_SaleBill = @No_SaleBill
-
- SELECT @ID_SaleBill = SaleBill.ID_SaleBill
- FROM SaleBill
- WHERE SaleBill.No_SaleBill = @No_SaleBill
-
- SELECT SaleBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product,
- Product.LowSalePrice_Product, BillType.Name_BillType,
- (SaleBillProduct.Quantity_SaleBillProduct * SaleBillProduct.UnitPrice_SaleBillProduct) AS Amount_SaleBillProduct
- ,@No_SaleBill as No_SaleBill
- FROM SaleBillProduct
- LEFT JOIN Product ON Product.ID_Product = SaleBillProduct.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType = SaleBillProduct.Type_FromBill
- WHERE SaleBillProduct.ID_SaleBill = @ID_SaleBill
- ORDER BY CAST(SaleBillProduct.No_SaleBillProduct AS INT)
-
- SELECT BillComment.*
- FROM BillComment
- WHERE BillComment.ID_Bill = @ID_SaleBill
- order by BillComment.No_BillComment
-
- SELECT ReportComment.*
- FROM ReportComment
- WHERE ReportComment.ID_Bill = @ID_SaleBill
- order by ReportComment.No_ReportComment
- ">
- <Params>
- <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" Index="0" />
- </Params>
- <Tables>
- <Table name="SaleBill" />
- <Table name="SaleBillProduct" />
- <Table name="BillComment" />
- <Table name="ReportComment" />
- </Tables>
- </SearchSaleBillWithNo>
- <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>
- <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_SaleBill
- From SaleBill
- order by Date_SaleBill 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_SaleBill
- from SaleBill
- order by Date_SaleBill 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_SaleBill
- from SaleBill
- order by Date_SaleBill 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
- DECLARE @CustoemrNo nvarchar(64)
- ,@CustomerID Uniqueidentifier
- ,@HighCustomerID Uniqueidentifier
- ,@Amount decimal(14,6)
- ,@Amount1 decimal(14,6)
- ,@IsCustomer int
- select @CustomerID=ID_Customer,@HighCustomerID=CustomerID_Customer
- ,@IsCustomer =IsCustomersCustomer_Customer
- From Customer
- Where No_Customer = @No_Customer
- IF (@IsCustomer=1)
- Begin
- select @Amount1=a.Amount
- from
- (
- SELECT ID_Customer,sum(IsNull(OpeningToGetBalance_Customer,0)+IsNull(Saleroom_Customer,0)-IsNull(PerValue_Customer,0)+IsNull(OpeningBalanceAdjust_Customer,0)) As Amount
- FROM CUSTOMER
- --WHERE SuspendDate_Customer is null
- WHERE ID_Customer = @HighCustomerID
- Group By ID_Customer
- ) a
- select @Amount = b.Amount
- From
- (
- SELECT (IsNull(@Amount1,0)+Sum(IsNull(OpeningToGetBalance_Customer,0)+IsNull(Saleroom_Customer,0)-IsNull(PerValue_Customer,0)+IsNull(OpeningBalanceAdjust_Customer,0))) As Amount
- FROM CUSTOMER
- -- WHERE SuspendDate_Customer is null
- WHERE CustomerID_Customer = @HighCustomerID
- And IsCustomersCustomer_Customer = 1
- Group By CustomerID_Customer
- )b
- End
- else
- Begin
- select @Amount = c.Amount
- from
- (
- select (IsNull(OpeningToGetBalance_Customer,0)+IsNull(Saleroom_Customer,0)-IsNull(PerValue_Customer,0)+IsNull(A.Amount,0)+IsNull(OpeningBalanceAdjust_Customer,0)) As Amount
- from customer
- left join (SELECT CustomerID_Customer,sum(IsNull(OpeningToGetBalance_Customer,0)+IsNull(Saleroom_Customer,0)-IsNull(PerValue_Customer,0)+IsNull(OpeningBalanceAdjust_Customer,0)) As Amount
- FROM CUSTOMER
- --WHERE SuspendDate_Customer is null
- WHERE IsCustomersCustomer_Customer = 1
- Group By CustomerID_Customer)A On A.CustomerID_Customer =Customer.ID_Customer
- Where ID_Customer = @CustomerID
- )c
- End
- 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(@Amount,0)) as ToGetBalance_Customer,Employee.Name_Employee,Employee.No_Employee,Employee.ID_Employee As LastPrincipal_Customer,IsCustomersCustomer_Customer
- FROM Customer
- 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_SaleBill
- 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 OR Value_BillType = 24 OR Value_BillType = 25 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>
- <SearchIndentBillWithNo CmdType="Text" CmdText="SELECT * FROM IndentBill WHERE IndentBill.No_IndentBill = @No_IndentBill">
- <Params>
- <Param name="@No_IndentBill" type="IndentBill.No_IndentBill" Index="0" />
- </Params>
- <Tables>
- <Table name="IndentBill" />
- </Tables>
- </SearchIndentBillWithNo>
- <SearchIndentBillOnNetProductWithNoID CmdType="Text" CmdText="declare @ID_IndentBillOnNet Uniqueidentifier
- Select @ID_IndentBillOnNet = ID_IndentBillOnNet
- From IndentBillOnNet
- Where No_IndentBillOnNet = @No_IndentBillOnNet
-
- Select Quantity_IndentBillOnNetProduct,Amount_SaleBill
- From IndentBillOnNetProduct
- Where ID_IndentBillOnNet = @ID_IndentBillOnNet
- And ID_Product = @ID_Product
- ">
- <Params>
- <Param name="@No_IndentBillOnNet" type="IndentBillOnNet.No_IndentBillOnNet" Index="0" />
- <Param name="@ID_Product" type="Product.ID_Product" Index="1" />
- </Params>
- <Tables>
- <Table name="IndentBillOnNetProductAmount" />
- </Tables>
- </SearchIndentBillOnNetProductWithNoID>
- <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>
- <SearchIndentBillProductWithNo CmdType="Text" CmdText=" SELECT IndentBillProduct.ID_Product, IndentBillProduct.Quantity_IndentBillProduct,
- IndentBillProduct.UnitPrice_IndentBillProduct, IndentBillProduct.Discount_IndentBillProduct, IndentBillProduct.OrderPrice_IndentBillProduct,
- Product.No_Product, Product.Name_Product, Product.Unit_Product, Product.SuspendDate_Product, Product.LowSalePrice_Product,IndentBill.TaxCurrency_IndentBill
- FROM IndentBillProduct
- INNER JOIN IndentBill ON IndentBill.ID_IndentBill = IndentBillProduct.ID_IndentBill
- INNER JOIN Product ON Product.ID_Product = IndentBillProduct.ID_Product
- WHERE IndentBill.No_IndentBill = @No_IndentBill AND IndentBillProduct.No_IndentBillProduct = @No_IndentBillProduct
- ">
- <Params>
- <Param name="@No_IndentBill" type="IndentBill.No_IndentBill" Index="0" />
- <Param name="@No_IndentBillProduct" type="IndentBillProduct.No_IndentBillProduct" Index="1" />
- </Params>
- <Tables>
- <Table name="IndentBillProduct" />
- </Tables>
- </SearchIndentBillProductWithNo>
- <SearchIndentBillOnNetProductWithNo CmdType="Text" CmdText="SELECT IndentBillOnNetProduct.ID_Product, IndentBillOnNetProduct.Quantity_IndentBillOnNetProduct,
- IndentBillOnNetProduct.UnitPrice_IndentBillOnNetProduct,IndentBillOnNetProduct.ID_IndentBillOnNetProduct,
- Product.No_Product, Product.Name_Product, Product.Unit_Product, Product.SuspendDate_Product, Product.LowSalePrice_Product,IndentBillOnNet.TaxCurrency_IndentBillOnNet
- FROM IndentBillOnNetProduct
- INNER JOIN IndentBillOnNet ON IndentBillOnNet.ID_IndentBillOnNet = IndentBillOnNetProduct.ID_IndentBillOnNet
- INNER JOIN Product ON Product.ID_Product = IndentBillOnNetProduct.ID_Product
- WHERE IndentBillOnNet.No_IndentBillOnNet = @No_IndentBillOnNet AND IndentBillOnNetProduct.No_IndentBillOnNetProduct = @No_IndentBillOnNetProduct
- ">
- <Params>
- <Param name="@No_IndentBillOnNet" type="IndentBillOnNet.No_IndentBillOnNet" Index="0" />
- <Param name="@No_IndentBillOnNetProduct" type="IndentBillOnNetProduct.No_IndentBillOnNetProduct" Index="1" />
- </Params>
- <Tables>
- <Table name="IndentBillOnNetProduct" />
- </Tables>
- </SearchIndentBillOnNetProductWithNo>
- <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>
- <SearchSaleBillFirst CmdType="Text" CmdText=" DECLARE @ID_SaleBill uniqueidentifier
- DECLARE @SaleBillNo nvarchar(64)
- SELECT TOP 1 @SaleBillNo = SaleBill.No_SaleBill
- FROM SaleBill
- Join Customer On Customer.ID_Customer=SaleBill.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_SaleBill=case @Special when 1 then Special_SaleBill else 0 End --added for Special
- and Special2_SaleBill=case @Special2 when 1 then Special2_SaleBill else 0 End
- --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 SaleBill.No_SaleBill
-
- SELECT SaleBill.*, 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_SaleBill
- FROM SaleBill
- LEFT JOIN Customer ON Customer.ID_Customer = SaleBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = SaleBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = SaleBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = SaleBill.LastModUser_SaleBill
- LEFT JOIN Location ON Location.ID_Location = SaleBill.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- WHERE SaleBill.No_SaleBill = @SaleBillNo
-
- SELECT @ID_SaleBill = SaleBill.ID_SaleBill
- FROM SaleBill
- WHERE SaleBill.No_SaleBill = @SaleBillNo
-
- SELECT SaleBillProduct.*, Product.No_Product
- ,Product.Name_Product,Product.Unit_Product
- ,Product.LowSalePrice_Product,BillType.Name_BillType
- ,(SaleBillProduct.Quantity_SaleBillProduct * SaleBillProduct.UnitPrice_SaleBillProduct) AS Amount_SaleBillProduct
- ,@SaleBillNo as No_SaleBill
- FROM SaleBillProduct
- LEFT JOIN Product ON Product.ID_Product = SaleBillProduct.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType = SaleBillProduct.Type_FromBill
- WHERE SaleBillProduct.ID_SaleBill = @ID_SaleBill ORDER BY CAST(SaleBillProduct.No_SaleBillProduct AS INT)
-
- SELECT BillComment.*
- FROM BillComment
- WHERE BillComment.ID_Bill = @ID_SaleBill
- order by BillComment.No_BillComment
-
- SELECT ReportComment.*,@SaleBillNo as No_SaleBill
- FROM ReportComment
- WHERE ReportComment.ID_Bill = @ID_SaleBill
- order by ReportComment.No_ReportComment
- ">
- <Params>
- <Param name="@Right" type="SaleBill.ID_Customer" Index="0" />
- <Param name="@Special" type="SaleBill.Special_SaleBill" Index="1" />
- <Param name="@Name_Employee" type="Employee.Name_Employee" Index="2" />
- <Param name="@Special2" type="SaleBill.Special_SaleBill" Index="3" />
- </Params>
- <Tables>
- <Table name="SaleBill" />
- <Table name="SaleBillProduct" />
- <Table name="BillComment" />
- <Table name="ReportComment" />
- </Tables>
- </SearchSaleBillFirst>
- <SearchSaleBillPrevious CmdType="Text" CmdText=" DECLARE @ID_SaleBill uniqueidentifier
- DECLARE @SaleBillNo nvarchar(64)
- SELECT TOP 1 @SaleBillNo = SaleBill.No_SaleBill FROM SaleBill
- Join Customer On Customer.ID_Customer=SaleBill.ID_Customer
- WHERE SaleBill.No_SaleBill < @No_SaleBill
- And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End --added for validating right
- and Special_SaleBill=case @Special when 1 then Special_SaleBill else 0 End --added for Special
- and Special2_SaleBill=case @Special2 when 1 then Special2_SaleBill else 0 end
- --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 SaleBill.No_SaleBill DESC
- SELECT SaleBill.*, 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_SaleBill
- FROM SaleBill
- LEFT JOIN Customer ON Customer.ID_Customer = SaleBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = SaleBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = SaleBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = SaleBill.LastModUser_SaleBill
- LEFT JOIN Location ON Location.ID_Location = SaleBill.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- WHERE SaleBill.No_SaleBill = @SaleBillNo
- SELECT @ID_SaleBill = SaleBill.ID_SaleBill FROM SaleBill WHERE SaleBill.No_SaleBill = @SaleBillNo
- SELECT SaleBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product,
- Product.LowSalePrice_Product, BillType.Name_BillType,
- (SaleBillProduct.Quantity_SaleBillProduct * SaleBillProduct.UnitPrice_SaleBillProduct) AS Amount_SaleBillProduct,@SaleBillNo as No_SaleBill
- FROM SaleBillProduct
- LEFT JOIN Product ON Product.ID_Product = SaleBillProduct.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType = SaleBillProduct.Type_FromBill
- WHERE SaleBillProduct.ID_SaleBill = @ID_SaleBill ORDER BY CAST(SaleBillProduct.No_SaleBillProduct AS INT)
- SELECT BillComment.* FROM BillComment WHERE BillComment.ID_Bill = @ID_SaleBill order by BillComment.No_BillComment
- SELECT ReportComment.*,@SaleBillNo as No_SaleBill FROM ReportComment WHERE ReportComment.ID_Bill = @ID_SaleBill order by ReportComment.No_ReportComment">
- <Params>
- <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" Index="0" />
- <Param name="@Right" type="SaleBill.ID_Customer" Index="1" />
- <Param name="@Special" type="SaleBill.Special_SaleBill" Index="2" />
- <Param name="@Name_Employee" type="Employee.Name_Employee" Index="3" />
- <Param name="@Special2" type="SaleBill.Special_SaleBill" Index="4" />
- </Params>
- <Tables>
- <Table name="SaleBill" />
- <Table name="SaleBillProduct" />
- <Table name="BillComment" />
- <Table name="ReportComment" />
- </Tables>
- </SearchSaleBillPrevious>
- <SearchSaleBillNext CmdType="Text" CmdText=" DECLARE @ID_SaleBill uniqueidentifier
- DECLARE @SaleBillNo nvarchar(64)
- SELECT TOP 1 @SaleBillNo = SaleBill.No_SaleBill FROM SaleBill
- Join Customer On Customer.ID_Customer=SaleBill.ID_Customer
- WHERE SaleBill.No_SaleBill > @No_SaleBill
- And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End --added for validating right
- and Special_SaleBill=case @Special when 1 then Special_SaleBill else 0 End --added for Special
- and Special2_SaleBill=case @Special2 when 1 then Special2_SaleBill else 0 end
- --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 SaleBill.No_SaleBill
- SELECT SaleBill.*, 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_SaleBill
- FROM SaleBill
- LEFT JOIN Customer ON Customer.ID_Customer = SaleBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = SaleBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = SaleBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = SaleBill.LastModUser_SaleBill
- LEFT JOIN Location ON Location.ID_Location = SaleBill.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- WHERE SaleBill.No_SaleBill = @SaleBillNo
- SELECT @ID_SaleBill = SaleBill.ID_SaleBill FROM SaleBill WHERE SaleBill.No_SaleBill = @SaleBillNo
- SELECT SaleBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product,
- Product.LowSalePrice_Product, BillType.Name_BillType,
- (SaleBillProduct.Quantity_SaleBillProduct * SaleBillProduct.UnitPrice_SaleBillProduct) AS Amount_SaleBillProduct,@SaleBillNo as No_SaleBill
- FROM SaleBillProduct
- LEFT JOIN Product ON Product.ID_Product = SaleBillProduct.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType = SaleBillProduct.Type_FromBill
- WHERE SaleBillProduct.ID_SaleBill = @ID_SaleBill ORDER BY CAST(SaleBillProduct.No_SaleBillProduct AS INT)
- SELECT BillComment.* FROM BillComment WHERE BillComment.ID_Bill = @ID_SaleBill order by BillComment.No_BillComment
- SELECT ReportComment.*,@SaleBillNo as No_SaleBill FROM ReportComment WHERE ReportComment.ID_Bill = @ID_SaleBill order by ReportComment.No_ReportComment">
- <Params>
- <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" Index="0" />
- <Param name="@Right" type="SaleBill.ID_Customer" Index="1" />
- <Param name="@Special" type="SaleBill.Special_SaleBill" Index="2" />
- <Param name="@Name_Employee" type="Employee.Name_Employee" Index="3" />
- <Param name="@Special2" type="SaleBill.Special_SaleBill" Index="4" />
- </Params>
- <Tables>
- <Table name="SaleBill" />
- <Table name="SaleBillProduct" />
- <Table name="BillComment" />
- <Table name="ReportComment" />
- </Tables>
- </SearchSaleBillNext>
- <SearchSaleBillLast CmdType="Text" CmdText=" DECLARE @ID_SaleBill uniqueidentifier
- DECLARE @SaleBillNo nvarchar(64)
- SELECT TOP 1 @SaleBillNo = SaleBill.No_SaleBill FROM SaleBill
- Join Customer On Customer.ID_Customer=SaleBill.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_SaleBill=case @Special when 1 then Special_SaleBill else 0 End --added for Special
- and Special2_SaleBill=case @Special2 when 1 then Special2_SaleBill else 0 end
- --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 SaleBill.No_SaleBill DESC
- SELECT SaleBill.*, 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_SaleBill
- FROM SaleBill LEFT JOIN Customer ON Customer.ID_Customer = SaleBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = SaleBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = SaleBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = SaleBill.LastModUser_SaleBill
- LEFT JOIN Location ON Location.ID_Location = SaleBill.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- WHERE SaleBill.No_SaleBill = @SaleBillNo
- SELECT @ID_SaleBill = SaleBill.ID_SaleBill FROM SaleBill WHERE SaleBill.No_SaleBill = @SaleBillNo
- SELECT SaleBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product,
- Product.LowSalePrice_Product, BillType.Name_BillType,
- (SaleBillProduct.Quantity_SaleBillProduct * SaleBillProduct.UnitPrice_SaleBillProduct) AS Amount_SaleBillProduct,@SaleBillNo as No_SaleBill
- FROM SaleBillProduct
- LEFT JOIN Product ON Product.ID_Product = SaleBillProduct.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType = SaleBillProduct.Type_FromBill
- WHERE SaleBillProduct.ID_SaleBill = @ID_SaleBill ORDER BY CAST(SaleBillProduct.No_SaleBillProduct AS INT)
- SELECT BillComment.* FROM BillComment WHERE BillComment.ID_Bill = @ID_SaleBill order by BillComment.No_BillComment
- SELECT ReportComment.*,@SaleBillNo as No_SaleBill FROM ReportComment WHERE ReportComment.ID_Bill = @ID_SaleBill order by ReportComment.No_ReportComment">
- <Params>
- <Param name="@Right" type="SaleBill.ID_Customer" Index="0" />
- <Param name="@Special" type="SaleBill.Special_SaleBill" Index="1" />
- <Param name="@Name_Employee" type="Employee.Name_Employee" Index="2" />
- <Param name="@Special2" type="SaleBill.Special_SaleBill" Index="3" />
- </Params>
- <Tables>
- <Table name="SaleBill" />
- <Table name="SaleBillProduct" />
- <Table name="BillComment" />
- <Table name="ReportComment" />
- </Tables>
- </SearchSaleBillLast>
- <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_SaleBill uniqueidentifier
- declare @flag int
- set @flag = 0
-
- if @SRemark1_FunctionSetting = 0
- begin
- select top 1 @ID_SaleBill = SaleBill.ID_SaleBill
- from SaleBill
- where ID_Customer = @ID_Customer
- order by SaleBill.Date_SaleBill desc
- if exists( select ReportComment.* from ReportComment where ReportComment.ID_Bill = @ID_SaleBill)
- begin
- select ReportComment.Comment_ReportComment from ReportComment where ReportComment.ID_Bill = @ID_SaleBill 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_SaleBill = SaleBill.ID_SaleBill
- from SaleBill
- where ID_Customer = @ID_Customer
- order by SaleBill.Date_SaleBill desc
- select ReportComment.Comment_ReportComment from ReportComment where ReportComment.ID_Bill = @ID_SaleBill 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="SaleBill.ID_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="TypeComment" />
- </Tables>
- </SearchTypeComment>
- <SearchRespiteForSaleBill CmdType="Text" CmdText="
- SELECT Name_TypeDef as Result FROM TypeDef WHERE Type_TypeDef=0
- ">
- <Tables>
- <Table name="RespiteForSaleBill" />
- </Tables>
- </SearchRespiteForSaleBill>
- <SearchOutDepot CmdType="Text" CmdText="
- SELECT SUM(SaleSourceBillProduct.Quantity_OutDepot) As Quantity_OutDepot, SUM(SaleSourceBillProduct.Quantity_SaleRtn) As Quantity_SaleRtn, SUM(SaleSourceBillProduct.Quantity_InDepot) As Quantity_InDepot
- FROM SaleSourceBillProduct INNER JOIN SaleBillProduct ON SaleBillProduct.ID_SaleSourceBillProduct = SaleSourceBillProduct.ID_SaleSourceBillProduct WHERE SaleBillProduct.ID_SaleBill = @ID_SaleBill
- ">
- <Params>
- <Param name="@ID_SaleBill" type="SaleBill.ID_SaleBill" Index="0" />
- </Params>
- <Tables>
- <Table name="OutDepot" />
- </Tables>
- </SearchOutDepot>
- <SearchStockSettle CmdType="Text" CmdText="
- Select * From StockSettleAccounts
- Where DateDiff(Day,@Date_SaleOutDepotBill,FromDate_StockSettleAccounts) <=0
- And DateDiff(Day,@Date_SaleOutDepotBill,EndDate_StockSettleAccounts) >=0
- And Status_StockSettleAccounts=0
- ">
- <Params>
- <Param name="@Date_SaleOutDepotBill" type="PurchaseInDepotBill.Date_SaleOutDepotBill" Index="0" />
- </Params>
- <Tables>
- <Table name="StockSettle" />
- </Tables>
- </SearchStockSettle>
- <SearchSaleBillWithNo1 CmdType="Text" CmdText=" DECLARE @ID_SaleBill uniqueidentifier
- SELECT SaleBill.*, 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_SaleBill,Customer.ID_Creator As CustomerCreator
- FROM SaleBill
- LEFT JOIN Customer ON Customer.ID_Customer = SaleBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = SaleBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = SaleBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = SaleBill.LastModUser_SaleBill
- LEFT JOIN Location ON Location.ID_Location = SaleBill.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- WHERE SaleBill.No_SaleBill = @No_SaleBill
- SELECT @ID_SaleBill = SaleBill.ID_SaleBill FROM SaleBill WHERE SaleBill.No_SaleBill = @No_SaleBill
-
- Select identity(int,1,1) as No_SaleBillProduct,ID_SaleBillProduct,ID_SaleBill,ID_SaleSourceBillProduct,Type_FromBill,No_FromBill,No_FromBillProduct,
- ID_Product,Quantity_SaleBillProduct,OrderPrice_SaleBillProduct,Discount_SaleBillProduct,UnitPrice_SaleBillProduct,Comment_SaleBillProduct Into #SaleBillProduct From SaleBillProduct
- Where ID_SaleBill = @ID_SaleBill
-
- SELECT (@Count+No_SaleBillProduct) as No_SaleBillProduct,ID_SaleBillProduct,ID_SaleBill,ID_SaleSourceBillProduct,Type_FromBill,No_FromBill,No_FromBillProduct,
- #SaleBillProduct.ID_Product,Quantity_SaleBillProduct,OrderPrice_SaleBillProduct,Discount_SaleBillProduct,UnitPrice_SaleBillProduct,Comment_SaleBillProduct, Product.No_Product, Product.Name_Product, Product.Unit_Product,
- Product.LowSalePrice_Product, BillType.Name_BillType,
- (#SaleBillProduct.Quantity_SaleBillProduct * #SaleBillProduct.UnitPrice_SaleBillProduct) AS Amount_SaleBillProduct ,@No_SaleBill as No_SaleBill
- FROM #SaleBillProduct
- LEFT JOIN Product ON Product.ID_Product = #SaleBillProduct.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType = #SaleBillProduct.Type_FromBill
- WHERE #SaleBillProduct.ID_SaleBill = @ID_SaleBill ORDER BY CAST(#SaleBillProduct.No_SaleBillProduct AS INT)
- Drop Table #SaleBillProduct
-
- SELECT BillComment.* FROM BillComment WHERE BillComment.ID_Bill = @ID_SaleBill order by BillComment.No_BillComment
- SELECT ReportComment.* FROM ReportComment WHERE ReportComment.ID_Bill = @ID_SaleBill order by ReportComment.No_ReportComment">
- <Params>
- <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" Index="0" />
- <Param name="@Count" type="SaleBillProduct.Type_FromBill" Index="1" />
- </Params>
- <Tables>
- <Table name="SaleBill" />
- <Table name="SaleBillProduct" />
- <Table name="BillComment" />
- <Table name="ReportComment" />
- </Tables>
- </SearchSaleBillWithNo1>
- <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>
- <AddIndentBillOnNetProduct CmdType="Text" CmdText="Declare @ID_IndentBillOnNet Uniqueidentifier
- Select @ID_IndentBillOnNet = ID_IndentBillOnNet
- From IndentBillOnNet
- Where No_IndentBillOnNet = @No_IndentBillOnNet
-
- Update IndentBillOnNetProduct
- Set Amount_SaleBill = Amount_SaleBill + @Quantity_SaleBillProduct
- Where ID_IndentBillOnNet = @ID_IndentBillOnNet
- And ID_Product = @ID_Product
-
- Select 1
- ">
- <Params>
- <Param name="@No_IndentBillOnNet" type="SaleBill.No_SaleBill" Index="0" />
- <Param name="@ID_Product" type="Product.ID_Product" Index="1" />
- <Param name="@Quantity_SaleBillProduct" type="SaleBillProduct.Quantity_SaleBillProduct" Index="2" />
- </Params>
- <Tables>
- <Table name="add" />
- </Tables>
- </AddIndentBillOnNetProduct>
- <ReduceIndentBillOnNetProduct CmdType="Text" CmdText="Declare @ID_IndentBillOnNet Uniqueidentifier
- Select @ID_IndentBillOnNet = ID_IndentBillOnNet
- From IndentBillOnNet
- Where No_IndentBillOnNet = @No_IndentBillOnNet
-
- Update IndentBillOnNetProduct
- Set Amount_SaleBill = Amount_SaleBill - @Quantity_SaleBillProduct
- Where ID_IndentBillOnNet = @ID_IndentBillOnNet
- And ID_Product = @ID_Product
-
- Select 0">
- <Params>
- <Param name="@No_IndentBillOnNet" type="SaleBill.No_SaleBill" Index="0" />
- <Param name="@ID_Product" type="Product.ID_Product" Index="1" />
- <Param name="@Quantity_SaleBillProduct" type="SaleBillProduct.Quantity_SaleBillProduct" Index="2" />
- </Params>
- <Tables>
- <Table name="Reduce" />
- </Tables>
- </ReduceIndentBillOnNetProduct>
- <SearchPrincipalByNo CmdType="Text" CmdText="Select top 1 ID_Employee From Employee where no_employee = @No_Employee">
- <Params>
- <Param name="@No_Employee" type="Employee.No_Employee" Index="0" />
- </Params>
- <Tables>
- <Table name="Principal1" />
- </Tables>
- </SearchPrincipalByNo>
- <UpdateCustomer CmdType="Text" CmdText="if (@IsAudit = '1')
- Begin
- Update Customer Set Saleroom_Customer = Saleroom_Customer + @Amount_SaleBill
- Where Customer.ID_Customer = @ID_Customer
- End
- if (@IsAudit = '0')
- Begin
- Update Customer Set Saleroom_Customer = Saleroom_Customer - @Amount_SaleBill
- Where Customer.ID_Customer = @ID_Customer
- End
- Select 1">
- <Params>
- <Param name="@ID_Customer" type="Customer.ID_Customer" Index="0" />
- <Param name="Amount_SaleBill" type="SaleBill.Amount_SaleBill" Index="1" />
- <Param name="IsAudit" type="SaleBill.No_SaleBill" Index="2" />
- </Params>
- <Tables>
- <Table name="Audit" />
- </Tables>
- </UpdateCustomer>
- <SearchCustomerPayLimitAll CmdType="Text" CmdText=" DECLARE @CustoemrNo nvarchar(64)
- ,@CustomerID Uniqueidentifier
- ,@HighCustomerID Uniqueidentifier
- ,@PayLimit decimal(14,2)
- ,@IsCustomer int
- select @CustomerID=ID_Customer,@HighCustomerID=CustomerID_Customer
- ,@IsCustomer =IsCustomersCustomer_Customer
- From Customer
- Where ID_Customer = @ID_Customer
-
- IF (@IsCustomer = 1)
- begin
- select @PayLimit=IsNull(a.PayLimit_Customer,0)
- from
- (
- SELECT ID_Customer,Convert(decimal(14,2),sum(IsNull(PayLimit_Customer,0))) As PayLimit_Customer
- FROM CUSTOMER
- WHERE SuspendDate_Customer is null
- and ID_Customer = @HighCustomerID
- Group By ID_Customer
- ) a
- SELECT (IsNull(@PayLimit,0)+Convert(decimal(14,2),sum(IsNull(PayLimit_Customer,0)))) As PayLimit_Customer
- FROM CUSTOMER
- WHERE SuspendDate_Customer is null
- and CustomerID_Customer = @HighCustomerID
- And IsCustomersCustomer_Customer = 1
- Group By CustomerID_Customer
- end
- else
- begin
- select customer.ID_Customer
- ,(Convert(decimal(14,2),IsNull(PayLimit_Customer,0)) + IsNull(A.LowPayLimit_Customer,0)) As PayLimit_Customer
- from customer
- left join (SELECT CustomerID_Customer,Convert(decimal(14,2),sum(IsNull(PayLimit_Customer,0))) As LowPayLimit_Customer
- FROM CUSTOMER
- WHERE SuspendDate_Customer is null
- and IsCustomersCustomer_Customer = 1
- Group By CustomerID_Customer)A On A.CustomerID_Customer =Customer.ID_Customer
- Where ID_Customer = @CustomerID
- end
- ">
- <Params>
- <Param name="@ID_Customer" type="Customer.ID_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="PayLimit" />
- </Tables>
- </SearchCustomerPayLimitAll>
- <SearchSaleInvoice CmdType="Text" CmdText="
-
- declare @CustomerID uniqueidentifier
- declare @TMPID uniqueidentifier
- select @CustomerID = ID_Customer from Customer where No_Customer = @No_Customer
- select @TMPID = CustomerID_Customer from Customer where ID_Customer = @CustomerID and (CustomerID_Customer is not null and CustomerID_Customer != '00000000-0000-0000-0000-000000000000')
- if @TMPID is not null
- select @CustomerID = @TMPID
- Select No_SaleInvoice,Amount_SaleInvoice-StrikedAmount_SaleInvoice as Amount_SaleInvoice
- From SaleInvoice
- Where ID_Customer = @CustomerID
- And ID_Assessor is not null
- And Amount_saleinvoice > StrikedAmount_SaleInvoice + DisCountAmount_SaleInvoice
- And PayDate_SaleInvoice < CONVERT(VARCHAR(100),@AssessDate_SaleBill,23)
- And Disable_SaleInvoice = 0
-
- --Declare @ID_Customer uniqueidentifier
- --Select @ID_Customer =ID_customer From Customer
- --Where No_Customer=@No_Customer
- --
- --Declare @Customer Table(ID_Customer Uniqueidentifier)
- --Insert Into @Customer Values(@ID_Customer)
- --Insert Into @Customer
- --Select ID_Customer
- --From Customer
- --Where CustomerID_Customer = @ID_Customer
- --
- --Select No_SaleInvoice,Amount_SaleInvoice-StrikedAmount_SaleInvoice as Amount_SaleInvoice
- --From SaleInvoice
- --Where ID_Customer in (Select ID_Customer From @Customer)
- --And ID_Assessor is not null
- --And Amount_saleinvoice > StrikedAmount_SaleInvoice + DisCountAmount_SaleInvoice
- --And PayDate_SaleInvoice < CONVERT(VARCHAR(100),@AssessDate_SaleBill,23)
- --And Disable_SaleInvoice = 0
-
- ">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- <Param name="@AssessDate_SaleBill" type="SaleBill.AssessDate_SaleBill" Index="1" />
- </Params>
- <Tables>
- <Table name="SearchSaleInvoice" />
- </Tables>
- </SearchSaleInvoice>
- <UpdateToGet CmdType="Text" CmdText=" update SaleBill set ToGet_SaleBill=@ToGet_SaleBill
- where No_SaleBill=@No_SaleBill
- Select 1
- ">
- <Params>
- <Param name="@ToGet_SaleBill" type="SaleBill.ToGet_SaleBill" />
- <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" />
- </Params>
- <Tables>
- <Table name="UpdateToGet" />
- </Tables>
- </UpdateToGet>
- <SearchToGet CmdType="Text" CmdText=" select ToGet_SaleBill from SaleBill where No_SaleBill=@No_SaleBill">
- <Params>
- <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" />
- </Params>
- <Tables>
- <Table name="SearchToGet" />
- </Tables>
- </SearchToGet>
- <UpdatentbToGet CmdType="Text" CmdText=" DECLARE @CustoemrNo nvarchar(64)
- ,@CustomerID Uniqueidentifier
- ,@HighCustomerID Uniqueidentifier
- ,@Amount decimal(14,6)
- ,@IsCustomer int
- select @CustomerID=ID_Customer,@HighCustomerID=CustomerID_Customer
- ,@IsCustomer =IsCustomersCustomer_Customer
- From Customer
- Where No_Customer = @No_Customer
-
- IF (@IsCustomer = 1)
- begin
- select @Amount=a.Amount
- from
- (
- SELECT ID_Customer,sum(IsNull(OpeningToGetBalance_Customer,0)+IsNull(Saleroom_Customer,0)-IsNull(PerValue_Customer,0)+IsNull(OpeningBalanceAdjust_Customer,0)) As Amount
- FROM CUSTOMER
- --WHERE SuspendDate_Customer is null
- where ID_Customer = @HighCustomerID
- Group By ID_Customer
- ) a
- SELECT (@Amount+Sum(IsNull(OpeningToGetBalance_Customer,0)+IsNull(Saleroom_Customer,0)-IsNull(PerValue_Customer,0)+IsNull(OpeningBalanceAdjust_Customer,0))) As Amount
- FROM CUSTOMER
- --WHERE SuspendDate_Customer is null
- WHERE CustomerID_Customer = @HighCustomerID
- And IsCustomersCustomer_Customer = 1
- Group By CustomerID_Customer
- end
- else
- begin
- select customer.ID_Customer
- ,(IsNull(OpeningToGetBalance_Customer,0)+IsNull(Saleroom_Customer,0)-IsNull(PerValue_Customer,0)+IsNull(A.Amount,0)+IsNull(OpeningBalanceAdjust_Customer,0)) As Amount
- from customer
- left join (SELECT CustomerID_Customer,sum(IsNull(OpeningToGetBalance_Customer,0)+IsNull(Saleroom_Customer,0)-IsNull(PerValue_Customer,0)+IsNull(OpeningBalanceAdjust_Customer,0)) As Amount
- FROM CUSTOMER
- --WHERE SuspendDate_Customer is null
- WHERE IsCustomersCustomer_Customer = 1
- Group By CustomerID_Customer)A On A.CustomerID_Customer =Customer.ID_Customer
- Where ID_Customer = @CustomerID
- end ">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="tbToGet" />
- </Tables>
- </UpdatentbToGet>
- <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>
- <SearchTime CmdType="Text" CmdText=" Select Convert(varchar,Date_SaleBill,23) as Date_SaleBill
- From SaleBill
- Where Convert(varchar,@Date_SaleBill,23) = Convert(varchar,getdate(),23)
- ">
- <Params>
- <Param name="@Date_SaleBill" type="SaleBill.Date_SaleBill" />
- </Params>
- <Tables>
- <Table name="Time" />
- </Tables>
- </SearchTime>
- <UpdatePrice CmdType ="Text" CmdText=" Select SaleBill.ID_SaleBill
- ,SUM(Case SaleBill.TaxCurrency_SaleBill When '外加' then UnitPrice_SaleBillProduct*Quantity_SaleBillProduct
- else UnitPrice_SaleBillProduct*Quantity_SaleBillProduct/1.17 end) As GoodsAmount_SaleBill
- ,SUM(Case SaleBill.TaxCurrency_SaleBill When '外加' then UnitPrice_SaleBillProduct*Quantity_SaleBillProduct*0.17
- else (UnitPrice_SaleBillProduct*Quantity_SaleBillProduct-UnitPrice_SaleBillProduct*Quantity_SaleBillProduct/1.17) end) As TaxAmount_SaleBill
- ,SUM(Case SaleBill.TaxCurrency_SaleBill When '外加' then UnitPrice_SaleBillProduct*Quantity_SaleBillProduct*1.17
- else (UnitPrice_SaleBillProduct*Quantity_SaleBillProduct) end) As Amount_SaleBill
- from SaleBillProduct
- left join SaleBill on SaleBill.ID_SaleBill = SaleBillProduct.ID_SaleBill
- group by SaleBill.ID_SaleBill
-
- update SaleBill set GoodsAmount_SaleBill =@GoodsAmount_SaleBill
- ,TaxAmount_SaleBill = @TaxAmount_SaleBill
- ,Amount_SaleBill = @Amount_SaleBill
- where No_SaleBill=@No_SaleBill
- ">
- <Params>
- <Param name="@GoodsAmount_SaleBill" type="SaleBill.GoodsAmount_SaleBill" />
- <Param name="@TaxAmount_SaleBill" type="SaleBill.TaxAmount_SaleBill" />
- <Param name="@Amount_SaleBill" type="SaleBill.Amount_SaleBill" />
- <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" />
- </Params>
- <Tables>
- <Table name="updatePrice" />
- </Tables>
- </UpdatePrice>
- </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;
- cbOutStatus.Enabled = false;
- ckSpecial.Enabled=false;
- ckSpecial1.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;
- btnDelelte.Enabled = false;
- #SaleBill.ID_Location = DBNull();
- #SaleBill.ToGet_SaleBill = 0;
- #SaleBill.Discount_SaleBill = 0;
- #SaleBill.TaxCurrency_SaleBill = "";
- #SaleBill.Currency_SaleBill = "";
- #SaleBill.AssessDate_SaleBill = DBNull();
- #SaleBill.LastModUser_SaleBill = DBNull();
- #SaleBill.LastModDate_SaleBill = DBNull();
- #SaleBill.NumSum = 0;
- #SaleBill.MoneySum = 0;
- #SaleBill.TaxSum = 0;
- #SaleBill.Amount_SaleBill = 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,"特价单","修改");
- ckSpecial1.Enabled=GetFieldRight(@Title,"特批单","修改");
- cbOutStatus.Enabled = true;
- 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;
- btnDelelte.Enabled = false;
- #SaleBill.ID_SaleBill = NewGuid();
- #SaleBill.ID_Location = DBNull();
- #SaleBill.ToGet_SaleBill = 0;
- #SaleBill.Discount_SaleBill = 100;
- #SaleBill.TaxCurrency_SaleBill = "外加";
- #SaleBill.Currency_SaleBill = @SysCurrency;
- #SaleBill.ID_Creator = GetLoginUserID();
- #SaleBill.Name_Creator = GetCurrentUser();
- #SaleBill.ID_Assessor = DBNull();
- #SaleBill.AssessDate_SaleBill = DBNull();
- #SaleBill.LastModUser_SaleBill = DBNull();
- #SaleBill.LastModDate_SaleBill = DBNull();
- #SaleBill.NumSum = 0;
- #SaleBill.MoneySum = 0;
- #SaleBill.TaxSum = 0;
- #SaleBill.Amount_SaleBill = 0;
- #SaleBill.ID_Location = GetCurrentDepotID();
- #SaleBill.Name_Location = GetCurrentDepot();
- #SaleBill.No_Location = GetCurrentDepotNo();
- #SaleBill.Date_SaleBill = 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("SaleBillProduct", "Discount_SaleBillProduct", #SaleBill.Discount_SaleBill);
- SetColumnDefaultValue("SaleBillProduct", "Quantity_SaleBillProduct", 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;
- ckSpecial.Enabled=false;
- ckSpecial1.Enabled=false;
- cbFax.Enabled = false;
- cbOutStatus.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(Search("SearchStockSettle",#SaleBill.Date_SaleBill))
- {
- if(Equals(#SaleBill.ID_Assessor, DBNull()))
- {
- if(#SaleBill.Disable_SaleBill==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;
- btnDelelte.Enabled = false;
- toolBar.EnableUnAssess = false;
- }
- else
- {
- toolBar.EnableModify = false;
- toolBar.EnableDelete = false;
- toolBar.EnableAudit = false;
- toolBar.EnableUnAudit = GetRight(@Title,"取消审核");
- btnDelelte.Enabled = GetRight(@Title,"取消审核")&&GetRight(@Title,"删除");
- if(#SaleBill.Assess_SaleBill == 0)
- {
- toolBar.EnableAssess = GetRight(@Title,"审核");
- toolBar.EnableUnAssess = false;
- }
- else
- {
- toolBar.EnableUnAssess = GetRight(@Title,"取消审核");
- toolBar.EnableAssess = false;
- }
- }
- }
- else
- {
- toolBar.EnablePrint=false;
- toolBar.EnableAudit=false;
- toolBar.EnableUnAudit=false;
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- btnDelelte.Enabled = false;
- }
- toolBar.EnablePrint = GetRight(@Title,"打印");
- toolBar.EnableExport = true;
- toolBar.EnableImport = false;
- UpdateForm(true, "");
- @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;
- ckSpecial.Enabled=GetFieldRight(@Title,"特价单","修改");
- ckSpecial1.Enabled=GetFieldRight(@Title,"特批单","修改");
- cbPrincipal.Enabled = true;
- cbLinkman.Enabled = true;
- cbTele.Enabled = true;
- cbFax.Enabled = true;
- cbOutStatus.Enabled = true;
- 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;
- btnDelelte.Enabled = false;
- #SaleBill.LastModUser_SaleBill = GetLoginUserID();
- #SaleBill.LastModUserName = GetCurrentUser();
- #SaleBill.LastModDate_SaleBill = DateTimeNow();
- @HaveAccessed = !Equals(#SaleBill.AssessDate_SaleBill,DBNull());
- if(@HaveAccessed)
- cbTaxCurrency.Enabled = false;
- else
- cbTaxCurrency.Enabled = true;
- dgProduct.SetColumnReadOnly(1, @HaveAccessed);
- <!--dgProduct.SetColumnReadOnly(2, !Equal(#SaleBill.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("SaleBillProduct", "Discount_SaleBillProduct", #SaleBill.Discount_SaleBill);
- SetColumnDefaultValue("SaleBillProduct", "Quantity_SaleBillProduct", 1);
- UpdateForm(true, "");
- @Status = 3;
- </Modify>
- <SubmitButtonClick>
- <![CDATA[
- @sellprice=0;
- if(!Search("SearchStockSettle",dtpDate.Value))
- {
- MessageBox("制单日期不在开帐区间内,提交失败!");
- return;
- }
- if (!Search("SearchCustomerWithNo", tbCustomerNo.CValue) || !Equals(#SaleBill.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("#SaleBillProduct") == 0)
- {
- MessageBox("请输入销售产品!",@Title);
- tbDetail.SelectedIndex = 1;
- dgProduct.Focus();
- return;
- }
- @Money=0;
- @Tax=0;
- @Total=0;
- switch (cbTaxCurrency.SelectedName)
- {
- case "外加":
- case "零税":
- case "免税":
- @Money = SumOfCol("#SaleBillProduct.Amount_SaleBillProduct");
- break;
- case "内含":
- @Total= SumOfCol("#SaleBillProduct.Amount_SaleBillProduct");
- SuspendLayout();
- for(@i=0;@i < RowCount("#SaleBillProduct");@i++)
- {
- SetPosition("#SaleBillProduct",@i);
- @Tax +=FormatNumber(#SaleBillProduct.Amount_SaleBillProduct * @CessOut / (1 + @CessOut), #SystemSetting.PriceDecimal_SystemSetting);
- }
- ResumeLayout();
- @Money = @Total - @Tax;
- break;
-
- }
- if(@Money!=ntbMoneySum.CValue)
- {
- MessageBox("发生操作错误,请联系上海韶光有限公司,电话54590333-675!",@Title);
- return;
- }
- UpdateForm(false, "");
- SuspendLayout();
- for (@i=0;@i<RowCount("#SaleBillProduct");@i=@i+1)
- {
- SetPosition("#SaleBillProduct", @i);
- if (#SaleBillProduct.Type_FromBill == 23 && #SaleBillProduct.No_FromBill != "" && Search("SearchFromBillWithNo",#SaleBillProduct.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"))
- {
- #SaleBillProduct.Name_BillType = "";
- #SaleBillProduct.Type_FromBill = 0;
- #SaleBillProduct.No_FromBill = "";
- #SaleBillProduct.No_FromBillProduct = "";
- }
- }
- }
- if (#SaleBillProduct.Type_FromBill == 24 && #SaleBillProduct.No_FromBill != "" && Search("SearchIndentBillWithNo",#SaleBillProduct.No_FromBill))
- {
- if (Equals(#IndentBill.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"))
- {
- #SaleBillProduct.Name_BillType = "";
- #SaleBillProduct.Type_FromBill = 0;
- #SaleBillProduct.No_FromBill = "";
- #SaleBillProduct.No_FromBillProduct = "";
- }
- }
- }
- if (#SaleBillProduct.Type_FromBill == 25 && #SaleBillProduct.No_FromBill != "" && Search("SearchIndentBillOnNetProductWithNoID",#SaleBillProduct.No_FromBill,#SaleBillProduct.ID_Product))
- {
- if (#SaleBillProduct.Quantity_SaleBillProduct > (#IndentBillOnNetProductAmount.Quantity_IndentBillOnNetProduct-#IndentBillOnNetProductAmount.Amount_SaleBill))
- {
- dgProduct.CurrentRowIndex = @i;
- tbDetail.SelectedIndex = 1;
- dgProduct.Focus();
- MessageBox("销货数量大于网上订货数量,提交失败!",@Title);
- ResumeLayout();
- return;
- }
- }
- if(Equals(#SaleBillProduct.No_Product,""))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- MessageBox("请填入产品编号!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if(Equals(#SaleBillProduct.ID_Product,GuidEmpty()))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该产品不存在!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if (#SaleBillProduct.Quantity_SaleBillProduct <= 0 || #SaleBillProduct.UnitPrice_SaleBillProduct <= 0 || #SaleBillProduct.Discount_SaleBillProduct < 0)
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- if(#SaleBillProduct.Quantity_SaleBillProduct <= 0)
- {
- MessageBox("数量不得小于0!",@Title);
- }
- else if(#SaleBillProduct.UnitPrice_SaleBillProduct <= 0)
- {
- MessageBox("单价不得小于0!",@Title);
- }
- else
- {
- MessageBox("折扣不得小于0!",@Title);
- }
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- Search("SearchLowSalePrice",#SaleBillProduct.ID_Product);
- if (ckSpecial.Checked == false)
- {
- if(cbTaxCurrency.SelectedName=="内含")
- {
- if (#SaleBillProduct.UnitPrice_SaleBillProduct/1.17 < #LowSalePrice.LowSalePrice_Product)
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- MessageBox("产品单价低于最低售价,提交失败!\r\n产品序号 : " + #SaleBillProduct.No_SaleBillProduct ,@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
- else
- {
- if (#SaleBillProduct.UnitPrice_SaleBillProduct < #LowSalePrice.LowSalePrice_Product)
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- MessageBox("产品单价低于最低售价,提交失败!\r\n产品序号 : " + #SaleBillProduct.No_SaleBillProduct,@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
- }
- @AvaQuantity = AvailableQty(#SaleBillProduct.ID_Product,#SaleBill.ID_Location);
- if (#SaleBillProduct.Quantity_SaleBillProduct > @AvaQuantity)
- {
- @strMessage = #SaleBillProduct.No_Product +" 目前可用数量为" + (string)@AvaQuantity + ",不能满足此次销货需求,继续提交吗!";
- @ClickResult = MessageBox(@strMessage,@Title,MB_OKCANCEL);
- if (@ClickResult == DialogResult("CANCEL"))
- {
- ResumeLayout();
- return;
- }
- }
- if (Equals(#SaleBillProduct.ID_SaleBillProduct,GuidEmpty()))
- #SaleBillProduct.ID_SaleBillProduct = NewGuid();
- #SaleBillProduct.ID_SaleBill =#SaleBill.ID_SaleBill;
- }
- for (@j=0;@j<RowCount("#BillComment");@j=@j+1)
- {
- SetPosition("#BillComment", @j);
- if (Equals(#BillComment.ID_BillComment,GuidEmpty()))
- #BillComment.ID_BillComment = NewGuid();
- #BillComment.ID_Bill = #SaleBill.ID_SaleBill;
- }
- for (@k=0;@k<RowCount("#ReportComment");@k=@k+1)
- {
- SetPosition("#ReportComment", @k);
- if (Equals(#ReportComment.ID_ReportComment,GuidEmpty()))
- #ReportComment.ID_ReportComment = NewGuid();
- #ReportComment.ID_Bill = #SaleBill.ID_SaleBill;
- }
- for(@r = 0;@r<RowCount("#SaleBillProduct");@r = @r+1)
- {
- SetPosition("#SaleBillProduct", @r);
- @sellprice=#SaleBillProduct.UnitPrice_SaleBillProduct;
- }
- @SumGoodsMoney=0;
- @SumTax=0;
- @SumTotal=0;
- for(@m = 0;@m<RowCount("#SaleBillProduct");@m = @m+1)
- {
- SetPosition("#SaleBillProduct", @m);
- @sellprice=#SaleBillProduct.UnitPrice_SaleBillProduct;
- if(#SaleBillProduct.OrderPrice_SaleBillProduct == 0)
- {
- #SaleBillProduct.Discount_SaleBillProduct = 100;
- }
- else
- {
- #SaleBillProduct.Discount_SaleBillProduct = @sellprice/#SaleBillProduct.OrderPrice_SaleBillProduct*100;
- }
- if(#SaleBill.TaxCurrency_SaleBill=="外加")
- {
- @SumGoodsMoney += FormatNumber(@sellprice*#SaleBillProduct.Quantity_SaleBillProduct,@PriceDecimal);
- @SumTax += FormatNumber(@sellprice*#SaleBillProduct.Quantity_SaleBillProduct*0.17,@PriceDecimal);
- @SumTotal += FormatNumber(@sellprice*#SaleBillProduct.Quantity_SaleBillProduct*1.17,@PriceDecimal);
- }
- else
- {
- if(#SaleBill.TaxCurrency_SaleBill=="内含")
- {
- @SumGoodsMoney+= FormatNumber(@sellprice*#SaleBillProduct.Quantity_SaleBillProduct/1.17,@PriceDecimal);
- @SumTax += FormatNumber((@sellprice*#SaleBillProduct.Quantity_SaleBillProduct)-(@sellprice*#SaleBillProduct.Quantity_SaleBillProduct/1.17),@PriceDecimal);
- }
- else
- {
- @SumGoodsMoney+= FormatNumber(@sellprice*#SaleBillProduct.Quantity_SaleBillProduct,@PriceDecimal);
- }
- @SumTotal +=FormatNumber(@sellprice*#SaleBillProduct.Quantity_SaleBillProduct,@PriceDecimal);
- }
- #SaleBillProduct.UnitPrice_SaleBillProduct=@sellprice;
- }
- #SaleBill.GoodsAmount_SaleBill = @SumGoodsMoney;
- #SaleBill.TaxAmount_SaleBill = @SumTax;
- #SaleBill.Amount_SaleBill = @SumTotal;
-
- ResumeLayout();
- UpdateForm(true, "");
- if(@Status == 1)
- {
- #SaleBill.CreateDate_SaleBill = DateTimeNow();
- #SaleBill.No_SaleBill = New("#SaleBill.No_SaleBill", dtpDate.CValue);
- }
- else if(@Status == 3)
- {
- #SaleBill.LastModDate_SaleBill = DateTimeNow();
- Update();
- }
- ChangeMode("View");
- ]]>
- </SubmitButtonClick>
- <CountSum>
- <![CDATA[
- if (RowCount("#SaleBillProduct") == 0)
- {
- #SaleBill.NumSum = 0;
- #SaleBill.GoodsAmount_SaleBill = 0;
- #SaleBill.TaxAmount_SaleBill = 0;
- #SaleBill.Amount_SaleBill = 0;
- }
- else
- {
- #SaleBill.NumSum = SumOfCol("#SaleBillProduct.Quantity_SaleBillProduct");
- switch (cbTaxCurrency.SelectedName)
- {
- case "外加":
- #SaleBill.GoodsAmount_SaleBill = SumOfCol("#SaleBillProduct.Amount_SaleBillProduct");
- #SaleBill.TaxAmount_SaleBill=0;
- SuspendLayout();
- for(@i=0;@i < RowCount("#SaleBillProduct");@i++)
- {
- SetPosition("#SaleBillProduct",@i);
-
-
- #SaleBill.TaxAmount_SaleBill += FormatNumber(#SaleBillProduct.Amount_SaleBillProduct * @CessOut,#SystemSetting.PriceDecimal_SystemSetting);
- }
- ResumeLayout();
- #SaleBill.Amount_SaleBill = FormatNumber(#SaleBill.GoodsAmount_SaleBill + #SaleBill.TaxAmount_SaleBill,#SystemSetting.PriceDecimal_SystemSetting);
- break;
- case "内含":
- #SaleBill.Amount_SaleBill = SumOfCol("#SaleBillProduct.Amount_SaleBillProduct");
-
- #SaleBill.TaxAmount_SaleBill = 0;
- SuspendLayout();
- for(@i=0;@i < RowCount("#SaleBillProduct");@i++)
- {
- SetPosition("#SaleBillProduct",@i);
-
- #SaleBill.TaxAmount_SaleBill +=FormatNumber(#SaleBillProduct.Amount_SaleBillProduct * @CessOut / (1 + @CessOut), #SystemSetting.PriceDecimal_SystemSetting);
-
- }
- ResumeLayout();
- #SaleBill.GoodsAmount_SaleBill = FormatNumber(#SaleBill.Amount_SaleBill - #SaleBill.TaxAmount_SaleBill,#SystemSetting.PriceDecimal_SystemSetting);
- break;
- case "零税":
- case "免税":
- #SaleBill.GoodsAmount_SaleBill = SumOfCol("#SaleBillProduct.Amount_SaleBillProduct");
- #SaleBill.TaxAmount_SaleBill = 0;
- #SaleBill.Amount_SaleBill = #SaleBill.GoodsAmount_SaleBill;
- break;
- }
- }
- UpdateForm(true, "ntbNumSum");
- UpdateForm(true, "ntbMoneySum");
- UpdateForm(true, "ntbTaxSum");
- UpdateForm(true, "ntbSum");
- ]]>
- </CountSum>
- <CountPrice>
- <![CDATA[
- if (RowCount("#SaleBillProduct") != 0)
- {
- switch (cbTaxCurrency.SelectedName)
- {
- case "内含":
- SuspendLayout();
- for(@j=0;@j<RowCount("#SaleBillProduct");@j=@j+1)
- {
- SetPosition("#SaleBillProduct", @j);
- if(Search("SearchProductWithNo",#SaleBillProduct.No_Product))
- {
- @Price=#Product.Price_Product;
- #SaleBillProduct.OrderPrice_SaleBillProduct=FormatNumber(@Price*(1 + @CessOut),@PriceDecimal);
- #SaleBillProduct.UnitPrice_SaleBillProduct = FormatNumber(#SaleBillProduct.OrderPrice_SaleBillProduct*#SaleBillProduct.Discount_SaleBillProduct/100,@PriceDecimal);
- }
- }
- ResumeLayout();
- break;
- case "外加":
- case "零税":
- case "免税":
- SuspendLayout();
- for(@j=0;@j<RowCount("#SaleBillProduct");@j=@j+1)
- {
- SetPosition("#SaleBillProduct", @j);
- if(Search("SearchProductWithNo",#SaleBillProduct.No_Product))
- {
- @Price=#Product.Price_Product;
- #SaleBillProduct.OrderPrice_SaleBillProduct=@Price;
- #SaleBillProduct.UnitPrice_SaleBillProduct =FormatNumber( #SaleBillProduct.OrderPrice_SaleBillProduct*#SaleBillProduct.Discount_SaleBillProduct/100,@PriceDecimal);
- }
- }
-
- ResumeLayout();
- break;
- }
- }
- ]]>
- </CountPrice>
- <ChangeDiscount>
- <![CDATA[
- if (RowCount("#SaleBillProduct") > 0)
- {
- SuspendLayout();
- for (@a=0;@a<RowCount("#SaleBillProduct");@a=@a+1)
- {
- SetPosition("#SaleBillProduct", @a);
- #SaleBillProduct.Discount_SaleBillProduct = #SaleBill.Discount_SaleBill;
- }
- ResumeLayout();
- }
- SetColumnDefaultValue("SaleBillProduct", "Discount_SaleBillProduct", #SaleBill.Discount_SaleBill);
- ]]>
- </ChangeDiscount>
- <AssessClick>
- Update();
- </AssessClick>
- <AuditLable>
- <![CDATA[
- if(!ckSpecial1.Checked)
- {
- SuspendLayout();
- Search("SearchCustomerPayLimitAll",#SaleBill.ID_Customer);
-
-
- Search("SearchCustomerWithNo", tbCustomerNo.CValue);
- @temptogetvalue= #Customer.ToGetBalance_Customer;
- Search("UpdateToGet",@temptogetvalue,tbNo.CValue);
- ntbToGet.CValue=@temptogetvalue;
-
- if ((ntbToGet.CValue + ntbSum.CValue) > #PayLimit.PayLimit_Customer)
- {
- MessageBox("本次销售已大于客户信用额度,审核失败!",@Title);
- ResumeLayout();
- return;
- }
- if(Search("SearchSaleInvoice",tbCustomerNo.CValue,DateTimeNow()))
- {
- string str = "";
- string tem = "";
- for( @o = 0 ; @o < RowCount("#SearchSaleInvoice") ; @o=@o+1)
- {
- SetPosition("#SearchSaleInvoice", @o);
- tem =#SearchSaleInvoice.Amount_SaleInvoice;
- str += #SearchSaleInvoice.No_SaleInvoice +","+"未付款金额:"+tem+"\n\n";
- }
- MessageBox("该客户有销项发票到期未付款,审核失败!\n\n "+str,@Title);
- ResumeLayout();
- return;
- }
- for (@i=0;@i<RowCount("#SaleBillProduct");@i=@i+1)
- {
- SetPosition("#SaleBillProduct", @i);
- if (#SaleBillProduct.Type_FromBill == 23 && #SaleBillProduct.No_FromBill != "" && Search("SearchFromBillWithNo",#SaleBillProduct.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;
- }
- }
- }
- if (#SaleBillProduct.Type_FromBill == 24 && #SaleBillProduct.No_FromBill != "" && Search("SearchIndentBillWithNo",#SaleBillProduct.No_FromBill))
- {
- if (Equals(#IndentBill.ID_Assessor,DBNull()))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- if (MessageBox("该来源单据未经审核,确定要审核吗?",@Title,MB_OKCANCEL) == DialogResult("CANCEL"))
- {
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
- }
- }
- ResumeLayout();
- }
- else
- {
- SuspendLayout();
- if(ckSpecial.Checked && ckSpecial1.Checked)
- ResumeLayout();
- }
- ]]>
- BeginAudit();
- #SaleBill.ID_Assessor = GetLoginUserID();
- #SaleBill.Name_Assessor = GetCurrentUser();
- #SaleBill.AssessDate_SaleBill = DateTimeNow();
- Audit();
- ChangeMode("View");
- EndAudit();
- </AuditLable>
- </Lables>
- </Form>
- </Forms>
|