123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589 |
- <?xml version="1.0" encoding="utf-8" ?>
- <Forms>
- <Form Name="FrmReceivableStrike">
- <Client>
- <Events>
- <Load>
- <![CDATA[
- @Title = "应收帐款冲帐";
- @ErrorDetail="";
- GetSchema();
- Search("SearchReceiver");
- Search("SearchSystemSetting");
-
- Search("SearchFromBillInInvoice","p");
-
- @SysCurrency=#SystemSetting.SysCurrency_SystemSetting;
-
- ChangeMode("Search");
-
- dgReceiveMoney.NoMember = "No_ReceivablesStrikeMethod";
- dgBill.NoMember = "No_ReceivablesStrikeBills";
- ]]>
- </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="dtDate" DataSource="ReceivablesStrike.Date_ReceivablesStrike"></IKDateTimePicker>
- <IKTextButton name="tbNo" DataSource="ReceivablesStrike.No_ReceivablesStrike">
- <Events>
- <Enter>
- <![CDATA[
- if (tbNo.ReadOnly == false)
- {
- if (tbNo.CValue != StringEmpty())
- {
- UpdateForm(false, "");
- if (Search("SearchReceivablesStrikeWithNo", tbNo.CValue))
- {
- ChangeMode("View",#ReceivablesStrike.ID_Assessor);
- }
- else
- {
- MessageBox("该应收帐款冲帐单据不存在!", @Title);
- return;
- }
- }
- else
- {
- MessageBox("请输入应收帐款冲帐单号!", @Title);
- return;
- }
- }
- ]]>
- <Lable name="CountSum" />
- </Enter>
- <Click>
- ShowSearchBox("BillSearch","NODEPOT", "tbNo", tbNo.CValue);
- </Click>
- </Events>
- </IKTextButton>
- <IKCheckBox name="cbPrev" DataSource="ReceivablesStrike.Prev_ReceivablesStrike">
- <Events>
- <CheckedChanged>
- <![CDATA[
- if (cbPrev.Checked)
- {
- if(RowCount("#ReceivablesStrikeBills")>0)
- {
- Empty("#ReceivablesStrikeBills");
- SuspendLayout();
- for (@i =0;@i<RowCount("#ReceivablesStrikeMethod");@i++)
- {
- SetPosition("#ReceivablesStrikeMethod", @i);
- if(#ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod > 0)
- #ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod=0.00;
- }
- ResumeLayout();
- }
-
- btnSearchByInvoice.Enabled = false;
- btnAutoStrike.Enabled = false;
- btnSearch.Enabled = false;
- }
- else
- {
- btnSearchByInvoice.Enabled = false;
- btnAutoStrike.Enabled = true;
- btnSearch.Enabled = true;
- }
- ]]>
- <Lable name="CountSum" />
- </CheckedChanged>
- </Events>
- </IKCheckBox>
- <IKTextButton name="tbCustomerNo" DataSource="ReceivablesStrike.No_Customer">
- <Events>
- <Enter>
- <![CDATA[
- if (tbCustomerNo.ReadOnly == false)
- {
- UpdateForm(false, "");
- if(tbCustomerNo.CValue!=StringEmpty())
- {
- if (!Search("SearchCustomerWithNo", #ReceivablesStrike.No_Customer))
- {
- MessageBox("该客户不存在!", @Title);
- @temp = ShowSearchBox("CustomerSearch", "INFOMATION", tbCustomerNo.CValue);
- if (@temp != "")
- {
- tbCustomerNo.CValue = @temp;
- ActiveControlEvent("tbCustomerNo", "Enter");
- return;
- }
- }
- else
- {
- if (Search("SearchCustomersCustomer",tbCustomerNo.CValue))
- {
- MessageBox("该客户为 "+ #CustomersCustomer.No_Customer +" 的客户,不能填单!");
- tbCustomerNo.Text = "";
- return;
- }
-
- if(!Equals(#Customer.SuspendDate_Customer,DBNull()))
- {
- MessageBox("该客户已停用!",@Title);
- }
- #ReceivablesStrike.ID_Customer = #Customer.ID_Customer;
- #ReceivablesStrike.ShortName_Customer = #Customer.ShortName_Customer;
- #ReceivablesStrike.GetCurrency_ReceivablesStrike = #Customer.PayLimitCurrency;
- #ReceivablesStrike.PrePayBalance_Customer = #Customer.PrePayBalance_Customer;
- if(Search("SearchPreGet",tbCustomerNo.CValue))
- {
- Empty("#ReceivablesStrikeMethod");
- MergeTable("#ReceivablesStrikeMethod1","#ReceivablesStrikeMethod");
- }
- if(Search("SearchLastBalace",tbCustomerNo.CValue))
- {
- ntbOpeningToGetBalance.CValue = #Balance.Balance;
- }
- }
- }
- else
- {
- MessageBox("请输入客户编号!",@Title);
- #ReceivablesStrike.ID_Customer = GuidEmpty();
- #ReceivablesStrike.ShortName_Customer = "";
- #ReceivablesStrike.PrePayBalance_Customer = 0;
- #ReceivablesStrike.GetCurrency_ReceivablesStrike = "";
- tbCustomerNo.Focus();
- }
- UpdateForm(true, "");
- }
- ]]>
- </Enter>
- <Click>
- <![CDATA[
- if (tbCustomerNo.ReadOnly == false)
- {
- @temp = ShowSearchBox("CustomerSearch", "INFOMATION", tbCustomerNo.CValue);
- if ( @temp == "" )
- return;
- tbCustomerNo.CValue = @temp;
- ActiveControlEvent("tbCustomerNo", "Enter");
- }
- ]]>
- </Click>
- </Events>
- </IKTextButton>
- <IKTextBox name="txtCustomerName" DataSource="ReceivablesStrike.ShortName_Customer"></IKTextBox>
- <IKComboBoxEx name="cbGetCurrency" DisplaySource="ReceivablesStrike.GetCurrency_ReceivablesStrike" DataSource="ReceivablesStrike"></IKComboBoxEx>
- <IKComboBoxEx name="cbBillCurrency" DisplaySource="ReceivablesStrike.BillCurrency_ReceivablesStrike" DataSource="ReceivablesStrike"></IKComboBoxEx>
- <IKNumericTextBox name="txtRate" DataSource="ReceivablesStrike.Rate_ReceivablesStrike"></IKNumericTextBox>
- <IKComboBoxEx name="cbReceiver" ValueSource="ReceivablesStrike.ID_Receiver" DisplaySource="ReceivablesStrike.Name_Employee" NoSource="ReceivablesStrike.No_Receiver" DataSource="Receiver" DisplayMember="Name_Employee" NoMember="No_Employee" ValueMember="ID_Employee">
- <Events>
- <Reload>
- UpdateForm(false, "cbReceiver");
- Search("SearchReceiver");
- UpdateForm(true, "cbReceiver");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKTextBox name="txtMaker" DataSource="ReceivablesStrike.Name_Creator"></IKTextBox>
- <IKTextBox name="txtAssessor" DataSource="ReceivablesStrike.Name_Assessor"></IKTextBox>
- <IKTextBox name="dtAssessDate" DataSource="ReceivablesStrike.AssessDate_ReceivablesStrike"></IKTextBox>
- <IKTextBox name="txtLastModUser" DataSource="ReceivablesStrike.Name_LastModUser"></IKTextBox>
- <IKTextBox name="dtLastModDate" DataSource="ReceivablesStrike.LastModDate_ReceivablesStrike"></IKTextBox>
- <IKTextBox name="txtComment" DataSource="ReceivablesStrike.Comment_ReceivablesStrike"></IKTextBox>
- <IKComboBoxEx name="cbPayment" DisplaySource="ReceivablesStrike.Payment_ReceivablesStrike" DataSource="Method" DisplayMember="Result">
- <Events>
- <Reload>
- UpdateForm(false, "cbPayment");
- Search("SearchReceivablesStrikeMethod");
- UpdateForm(true, "cbPayment");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKTextBox name="txtMoney" DataSource="ReceivablesStrike.Money_ReceivablesStrike"></IKTextBox>
- <IKButton name="btnSearchByInvoice">
- <Events>
- <Click>
- <![CDATA[
- @DateStart = DBNull();
- @DateEnd = DBNull();
- if (dtStart.Checked)
- {
- @DateStart = dtStart.CValue;
- }
- if (dtEnd.Checked)
- {
- @DateEnd = dtEnd.CValue;
- }
- ShowSearchBox("", "STRIKEIMPORT", "销项发票", "#ReceivablesStrikeBills", @DateStart, @DateEnd);
- if (RowCount("#ReceivablesStrikeBills") > 0)
- {
- for (@i=0; @i<RowCount("#ReceivablesStrikeBills"); @i=@i+1)
- {
- dgBill.CurrentRowIndex = @i;
- }
- dgBill.CurrentRowIndex = 0;
- }
- ]]>
- </Click>
- </Events>
- </IKButton>
- <IKButton name="btnSearch">
- <Events>
- <Click>
- <![CDATA[
- @DateStart = DBNull();
- @DateEnd = DBNull();
- if (dtStart.Checked)
- {
- @DateStart = dtStart.CValue;
- }
- if (dtEnd.Checked)
- {
- @DateEnd = dtEnd.CValue;
- }
- if (Search("SearchSaleInvoice",@DateStart,@DateEnd,tbCustomerNo.CValue))
- {
- Empty("#ReceivablesStrikeBills");
- MergeTable("#ReceivablesStrikeBill1","#ReceivablesStrikeBills");
- }
- ]]>
- </Click>
- </Events>
- </IKButton>
- <IKButton name="btnOK">
- <Events>
- <Click>
- <![CDATA[
-
- if (tbCustomerNo.CValue == "" || !Search("SearchCustomerWithNo", #ReceivablesStrike.No_Customer))
- {
- MessageBox("请输入有效的客户,回车以示确认!",@Title);
- tbCustomerNo.Focus();
- return;
- }
- if(!cbReceiver.CheckSelectedItem())
- {
- MessageBox("请输入有效的收款人!",@Title);
- cbReceiver.Focus();
- return;
- }
- if(txtMoney.CValue<= 0)
- {
- MessageBox("收款金额必须大于0 !",@Title);
- txtMoney.Focus();
- return;
- }
- if(!cbPayment.CheckSelectedItem())
- {
- MessageBox("请输入有效的收款方式",@Title);
- cbPayment.Focus();
- return;
- }
-
- Search("SearchPreGetHead");
- if(Search("SearchIsHavePreGet"))
- {
- if(#PreGet.No_PreGet ==0)
- {
-
- Search("CreateNewPreGet2",dtDate.CValue
- ,#ReceivablesStrike.ID_Customer
- ,#ReceivablesStrike.GetCurrency_ReceivablesStrike
- ,#ReceivablesStrike.BillCurrency_ReceivablesStrike
- ,#ReceivablesStrike.Rate_ReceivablesStrike
- ,cbPayment.SelectedName
- ,txtMoney.CValue
- ,cbReceiver.SelectedName
- ,#ReceivablesStrike.ID_Creator
- ,dtDate.CValue
- ,#ReceivablesStrike.LastModUser_ReceivablesStrike
- ,#ReceivablesStrike.LastModDate_ReceivablesStrike
- ,#ReceivablesStrike.ID_Creator
- ,dtDate.CValue
- ,txtComment.CValue
- ,#PreGetHead.Value1_CodeGenerate
- ,dtDate.CValue);
- }
- else
- {
- Search("CreateNewPreGet",dtDate.CValue
- ,#ReceivablesStrike.ID_Customer
- ,#ReceivablesStrike.GetCurrency_ReceivablesStrike
- ,#ReceivablesStrike.BillCurrency_ReceivablesStrike
- ,#ReceivablesStrike.Rate_ReceivablesStrike
- ,cbPayment.SelectedName
- ,txtMoney.CValue
- ,cbReceiver.SelectedName
- ,#ReceivablesStrike.ID_Creator
- ,dtDate.CValue
- ,#ReceivablesStrike.LastModUser_ReceivablesStrike
- ,#ReceivablesStrike.LastModDate_ReceivablesStrike
- ,#ReceivablesStrike.ID_Creator
- ,dtDate.CValue
- ,txtComment.CValue
- ,#PreGetHead.Value1_CodeGenerate
- ,dtDate.CValue);
- }
- }
-
-
- Search("UpdateAmount",tbCustomerNo.CValue,txtMoney.CValue);
- Search("UpdatePrePayBalance",tbCustomerNo.CValue,txtMoney.CValue);
- if(Search("SearchPreGet",tbCustomerNo.CValue))
- {
- Empty("#ReceivablesStrikeMethod");
- MergeTable("#ReceivablesStrikeMethod1","#ReceivablesStrikeMethod");
- }
-
- btnOK.Enabled = false;
- txtComment.CValue = "";
- ]]>
- </Click>
- </Events>
- </IKButton>
- <IKButton name="btnVerify">
- <Events>
- <Click>
- <Lable name="Verify" />
- MessageBox("校验已通过!",@Title);
- </Click>
- </Events>
- </IKButton>
- <IKButton name="btnAutoStrike">
- <Events>
- <Click>
- <![CDATA[
-
- @SumMoney = 0;
- @SumMoneyPerGet = 0;
- @SumStrike = 0;
- @SumAmount = 0;
- SuspendLayout();
- for (@a=0;@a<RowCount("#ReceivablesStrikeBills");@a++)
- {
- SetPosition("#ReceivablesStrikeBills", @a);
- #ReceivablesStrikeBills.Strike_ReceivablesStrikeBills = 0;
- }
- for (@b=0;@b<RowCount("#ReceivablesStrikeMethod");@b++)
- {
- SetPosition("#ReceivablesStrikeMethod", @b);
- #ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod = 0;
- }
- for (@i =0;@i<RowCount("#ReceivablesStrikeMethod");@i++)
- {
- SetPosition("#ReceivablesStrikeMethod", @i);
- @SumMoney += #ReceivablesStrikeMethod.LeaveAmount_ReceivablesStrikeMethod;
- }
- for (@l =0;@l<RowCount("#ReceivablesStrikeBills");@l++)
- {
- SetPosition("#ReceivablesStrikeBills", @l);
- @SumMoneyPerGet += #ReceivablesStrikeBills.ToGetAmount_ReceivablesStrikeBills;
- }
- if (@SumMoney > @SumMoneyPerGet)
- {
- @SumStrike = @SumMoneyPerGet;
- }
- else
- {
- @SumStrike = @SumMoney;
- }
-
-
- for (@j=0;@j<RowCount("#ReceivablesStrikeBills");@j++)
- {
- SetPosition("#ReceivablesStrikeBills", @j);
- if (@SumStrike > 0)
- {
- if (@SumStrike >= #ReceivablesStrikeBills.ToGetAmount_ReceivablesStrikeBills)
- {
- #ReceivablesStrikeBills.Strike_ReceivablesStrikeBills = #ReceivablesStrikeBills.ToGetAmount_ReceivablesStrikeBills;
- }
- else
- {
- #ReceivablesStrikeBills.Strike_ReceivablesStrikeBills = @SumStrike;
- }
-
- @SumStrike = @SumStrike - #ReceivablesStrikeBills.Strike_ReceivablesStrikeBills;
- }
- }
-
- if (@SumMoney > @SumMoneyPerGet)
- {
- @SumStrike = @SumMoneyPerGet;
- }
- else
- {
- @SumStrike = @SumMoney;
- }
-
- for (@k=0;@k<RowCount("#ReceivablesStrikeMethod");@k++)
- {
- SetPosition("#ReceivablesStrikeMethod", @k);
- if (@SumStrike > 0)
- {
- if (@SumStrike > #ReceivablesStrikeMethod.LeaveAmount_ReceivablesStrikeMethod)
- {
- #ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod = #ReceivablesStrikeMethod.LeaveAmount_ReceivablesStrikeMethod;
- }
- else
- {
- #ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod = @SumStrike;
- }
-
- @SumStrike = @SumStrike - #ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod;
- }
- }
- ResumeLayout();
- ]]>
- <Lable name="CountSum" />
- </Click>
- </Events>
- </IKButton>
- <IKDataGridEx name="dgReceiveMoney" DataSource="ReceivablesStrikeMethod" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="ReceivablesStrikeMethod.No_ReceivablesStrikeMethod" />
- <DataColumn Index="1" DataSource="ReceivablesStrikeMethod.No_PreGet"/>
- <DataColumn Index="2" DataSource="ReceivablesStrikeMethod.LeaveAmount_ReceivablesStrikeMethod" />
- <DataColumn Index="3" DataSource="ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod" />
- <DataColumn Index="4" DataSource="ReceivablesStrikeMethod.Comment_PreGet" />
- </IKDataGridEx>
- <IKDataGridEx name="dgBill" DataSource="ReceivablesStrikeBills" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="ReceivablesStrikeBills.No_ReceivablesStrikeBills" />
- <DataColumn Index="1" DataSource="ReceivablesStrikeBills.No_SaleInvoice" />
- <DataColumn Index="2" DataSource="ReceivablesStrikeBills.No_Invoice" />
- <DataColumn Index="3" DataSource="ReceivablesStrikeBills.PayDate_ReceivablesStrikeBills" />
- <DataColumn Index="4" DataSource="ReceivablesStrikeBills.Amount_FromBill" />
- <DataColumn Index="5" DataSource="ReceivablesStrikeBills.ToGetAmount_ReceivablesStrikeBills" />
- <DataColumn Index="6" DataSource="ReceivablesStrikeBills.Strike_ReceivablesStrikeBills" />
- <DataColumn Index="7" DataSource="ReceivablesStrikeBills.Discount_ReceivablesStrikeBills" />
- <DataColumn Index="8" DataSource="ReceivablesStrikeBills.StrikedAmount_ReceivablesStrikeBills" />
- </IKDataGridEx>
- <IKFormToolBar name="toolBar">
- <Events>
- <ClickFirst>
- if (Search("SearchReceivablesStrikeFirst", tbNo.CValue))
- {
- ChangeMode("View",#ReceivablesStrike.ID_Assessor);
- <Lable name="CountSum" />
- }
- </ClickFirst>
- <ClickPrev>
- if (Search("SearchReceivablesStrikePrevious", tbNo.CValue))
- {
- ChangeMode("View",#ReceivablesStrike.ID_Assessor);
- <Lable name="CountSum" />
- }
- </ClickPrev>
- <ClickNext>
- if (Search("SearchReceivablesStrikeNext", tbNo.CValue))
- {
- ChangeMode("View",#ReceivablesStrike.ID_Assessor);
- <Lable name="CountSum" />
- }
- </ClickNext>
- <ClickLast>
- if (Search("SearchReceivablesStrikeLast", tbNo.CValue))
- {
- ChangeMode("View",#ReceivablesStrike.ID_Assessor);
- <Lable name="CountSum" />
- }
- </ClickLast>
- <ClickEmpty>
- ChangeMode("Search");
- </ClickEmpty>
- <ClickNew>
- <![CDATA[
- @NextNo = GetNextAutoNumber(true);
- if (!Equals(@NextNo, ""))
- {
- ChangeMode("New");
- #ReceivablesStrike.No_ReceivablesStrike = @NextNo;
- UpdateForm(true, "tbNo");
- }
- ]]>
- </ClickNew>
- <ClickSubmit>
- <!--<Lable name="Verify" />-->
- <Lable name="SubmitButtonClick" />
- </ClickSubmit>
- <ClickModify>
- ChangeMode("Modify");
- <Lable name="CountSum" />
- </ClickModify>
- <ClickDelete>
- <![CDATA[
- Delete();
- ChangeMode("Search");
- ]]>
- </ClickDelete>
- <ClickPrint>
- PrintReport();
- </ClickPrint>
- <ClickAudit>
- <![CDATA[
- BeginAudit();
- if (tbCustomerNo.CValue == "" || !Search("SearchCustomerWithNo", #ReceivablesStrike.No_Customer))
- {
- MessageBox("请输入有效的客户,回车以示确认!",@Title);
- tbCustomerNo.Focus();
- return;
- }
- else
- {
- SuspendLayout();
- for (@V=0;@V<RowCount("#ReceivablesStrikeMethod");@V++)
- {
- SetPosition("#ReceivablesStrikeMethod", @V);
- if (Search("SearchNoAssessorPreGet",tbCustomerNo.CValue))
- {
- MessageBox("有未审核的收款单号,请重新填单!");
- tbCustomerNo.Text = "";
- return;
- }
- if(Search("SearchISDelete",tbCustomerNo.CValue,#ReceivablesStrikeMethod.No_PreGet))
- {
- if(#ISDelete.No_PreGet==0)
- {
- MessageBox("有不存在的收款单号,请重新填单!");
- tbCustomerNo.Text = "";
- return;
- }
- }
- }
- ResumeLayout();
- }
- #ReceivablesStrike.ID_Assessor = GetLoginUserID();
- #ReceivablesStrike.Name_Assessor = GetCurrentUser();
- #ReceivablesStrike.AssessDate_ReceivablesStrike = DateTimeNow();
- if (cbPrev.Checked)
- {
- @sumMethod = 0;
- @sumBills = 0;
- @sumPrePayValue = 0;
- @SumMoneyPerGet =0;
- @SumMoney = 0;
- @SumStrike = 0;
- if(Search("SearchCustomerWithNo", #ReceivablesStrike.No_Customer))
- {
- SuspendLayout();
- for (@a=0;@a<RowCount("#ReceivablesStrikeBills");@a++)
- {
- SetPosition("#ReceivablesStrikeBills", @a);
- #ReceivablesStrikeBills.Strike_ReceivablesStrikeBills = 0;
- }
- for (@b=0;@b<RowCount("#ReceivablesStrikeMethod");@b++)
- {
- SetPosition("#ReceivablesStrikeMethod", @b);
-
- #ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod = 0;
-
- }
- for (@i =0;@i<RowCount("#ReceivablesStrikeMethod");@i++)
- {
- SetPosition("#ReceivablesStrikeMethod", @i);
- @SumMoney += #ReceivablesStrikeMethod.LeaveAmount_ReceivablesStrikeMethod;
- }
-
- @SumMoneyPerGet += #Customer.OpeningToGetBalance_Customer;
- for (@l =0;@l<RowCount("#ReceivablesStrikeBills");@l++)
- {
- SetPosition("#ReceivablesStrikeBills", @l);
-
- @SumMoneyPerGet += #ReceivablesStrikeBills.ToGetAmount_ReceivablesStrikeBills;
- }
- if (@SumMoney > @SumMoneyPerGet)
- {
- @SumStrike = @SumMoneyPerGet;
- }
- else
- {
- @SumStrike = @SumMoney;
- }
- for (@j=0;@j<RowCount("#ReceivablesStrikeBills");@j++)
- {
- SetPosition("#ReceivablesStrikeBills", @j);
- @SumMoneyPerGet += #ReceivablesStrikeBills.ToGetAmount_ReceivablesStrikeBills;
- if (@SumStrike > 0)
- {
- if (@SumStrike >= #ReceivablesStrikeBills.ToGetAmount_ReceivablesStrikeBills)
- {
- #ReceivablesStrikeBills.Strike_ReceivablesStrikeBills = #ReceivablesStrikeBills.ToGetAmount_ReceivablesStrikeBills;
- }
- else
- {
- #ReceivablesStrikeBills.Strike_ReceivablesStrikeBills = @SumStrike;
- }
- @SumStrike = @SumStrike - #ReceivablesStrikeBills.Strike_ReceivablesStrikeBills;
- }
- }
- if (@SumMoney > @SumMoneyPerGet)
- {
- @SumStrike = @SumMoneyPerGet;
- }
- else
- {
- @SumStrike = @SumMoney;
- }
-
- for (@k=0;@k<RowCount("#ReceivablesStrikeMethod");@k++)
- {
- SetPosition("#ReceivablesStrikeMethod", @k);
- if (@SumStrike > 0)
- {
- if (@SumStrike > #ReceivablesStrikeMethod.LeaveAmount_ReceivablesStrikeMethod)
- {
- #ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod = #ReceivablesStrikeMethod.LeaveAmount_ReceivablesStrikeMethod;
- }
- else
- {
- #ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod = @SumStrike;
- }
- @SumStrike = @SumStrike - #ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod;
- }
- }
- for (@g=0; @g<RowCount("#ReceivablesStrikeMethod"); @g=@g+1)
- {
- SetPosition("#ReceivablesStrikeMethod", @g);
- @sumPrePayValue += #ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod;
- }
- ResumeLayout();
- }
- if(Search("SearchOpenging",tbCustomerNo.CValue))
- {
- if(#Customer.PrePayValue_Customer == #Customer.OpeningToGetBalance_Customer)
- {
- MessageBox("期初应收帐款已全部冲完,审核失败!",@Title);
- return;
- }
- else
- {
- Search("UpdatePrePayValue",#ReceivablesStrike.No_Customer,@sumPrePayValue);
- }
- if(Search("SearchLastBalace",tbCustomerNo.CValue))
- {
- ntbOpeningToGetBalance.CValue = #Balance.Balance;
- }
- }
- }
-
- Audit();
- ChangeMode("View",#ReceivablesStrike.ID_Assessor);
- EndAudit();
- ]]>
- <Lable name="CountSum" />
- </ClickAudit>
- <ClickUnAudit>
- <![CDATA[
- @sumPrePayValue = 0;
- BeginUnAudit();
- #ReceivablesStrike.ID_Assessor = DBNull();
- #ReceivablesStrike.Name_Assessor = "";
- if (cbPrev.Checked)
- {
- SuspendLayout();
- for (@g=0; @g<RowCount("#ReceivablesStrikeMethod"); @g=@g+1)
- {
- SetPosition("#ReceivablesStrikeMethod", @g);
- @sumPrePayValue += #ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod;
- }
- ResumeLayout();
- if(Search("SearchOpenging",tbCustomerNo.CValue))
- {
- Search("ClearPrePayValue",tbCustomerNo.CValue,@sumPrePayValue);
- }
- }
- UnAudit();
- ChangeMode("View",#ReceivablesStrike.ID_Assessor);
- EndUnAudit();
- ]]>
- <Lable name="CountSum" />
- </ClickUnAudit>
- <ClickImport>
- ;
- </ClickImport>
- <ClickExport>
- ;
- </ClickExport>
- <ClickClose>
- ;
- </ClickClose>
- <ClickExpand>
- if (toolBar.ExpandForm==true)
- {
- pnRight.Visible=true;<!--PanelRight is not existed-->
- }
- else
- {
- pnRight.Visible=false;
- }
- </ClickExpand>
- </Events>
- </IKFormToolBar>
- </Controls>
- <Tables>
- <Table name="ReceivablesStrikeBills">
- <Events>
- <ColumnsChanged>
- <No_SaleInvoice>
- <Lable name="GetFromBill" />
- </No_SaleInvoice>
- <Discount_ReceivablesStrikeBills>
- #ReceivablesStrikeBills.ToGetAmount_ReceivablesStrikeBills=#ReceivablesStrikeBills.Amount_FromBill-#ReceivablesStrikeBills.StrikedAmount_ReceivablesStrikeBills-#ReceivablesStrikeBills.Discount_ReceivablesStrikeBills;
- <Lable name="CountSum" />
- </Discount_ReceivablesStrikeBills>
- </ColumnsChanged>
- <RowDeleted>
- <Lable name="CountSum" />
- </RowDeleted>
- </Events>
- </Table>
- </Tables>
- <LockInfomation LockID="ID_ReceivablesStrike" LockNO="No_ReceivablesStrike" LockSearchFunction="SearchReceivablesStrikeWithNo" LockAudit="ID_Assessor"/>
- <LogInfomation LogNO="#ReceivablesStrike.No_ReceivablesStrike" RecordFormField="客户编号:#ReceivablesStrike.No_Customer" RecordDataGridField="#ReceivablesStrikeBills.No_SaleInvoice,#ReceivablesStrikeBills.Strike_ReceivablesStrikeBills,#ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod"/>
- <ChildForms>
- <ChildForm name="BillSearch" DataSource="ReceivablesStrike" SearchFunction="SearchAllBill" SearchFunctionByNo="SearchReceivablesStrikeWithNo">
- <DataColumn Index="0" MappingName="#ReceivablesStrike.No_ReceivablesStrike" HeaderText="应收帐款冲帐单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="1" MappingName="#ReceivablesStrike.Date_ReceivablesStrike" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="2" MappingName="#ReceivablesStrike.ShortName_Customer" HeaderText="客户简称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="CustomerSearch" DataSource="Customer" SearchFunction="SearchAllCustomer" SearchFunctionByNo="" MappingName="客户">
- <DataColumn Index="0" MappingName="#Customer.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="1" MappingName="#Customer.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="2" MappingName="#Customer.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="3" MappingName="#Customer.Level_Customer" HeaderText="客户等级" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="4" MappingName="#Customer.IsGeneric_Customer" HeaderText="一般客户" Width="75" ColumnType="IKDataGridBoolColumn"/>
- </ChildForm>
- </ChildForms>
- </Client>
- <Server>
- <Tables>
- <Table name="ReceivablesStrike" Type="Parent">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 ReceivablesStrike.*
- ,Customer.No_Customer
- ,Customer.ShortName_Customer
- ,Customer.PrePayBalance_Customer
- ,Employee.No_Employee AS No_Receiver
- ,Employee.Name_Employee
- ,a.Name_User AS Name_Creator
- ,b.Name_User AS Name_Assessor
- ,c.Name_User AS Name_LastModUser
- ,CONVERT(decimal(18,6), 0) AS SumSale
- ,CONVERT(decimal(18,6), 0) AS SumRtn
- ,CONVERT(decimal(18,6), 0) AS SumReceive
- ,Convert(decimal(18,6), 0) As Earlybalance_ReceivablesStrike
- FROM ReceivablesStrike
-
- LEFT JOIN Customer ON Customer.ID_Customer = ReceivablesStrike.ID_Customer
- LEFT JOIN Employee ON Employee.ID_Employee = ReceivablesStrike.ID_Receiver
- LEFT JOIN AppUser a ON a.ID_User = ReceivablesStrike.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = ReceivablesStrike.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = ReceivablesStrike.LastModUser_ReceivablesStrike
- " />
- <New CmdType="Text" CmdText="INSERT INTO ReceivablesStrike(ID_ReceivablesStrike
- ,No_ReceivablesStrike
- ,Date_ReceivablesStrike
- ,ID_Customer
- ,GetCurrency_ReceivablesStrike
- ,BillCurrency_ReceivablesStrike
- ,Rate_ReceivablesStrike
- ,ID_Receiver
- ,ID_Creator
- ,Comment_ReceivablesStrike
- ,CreateDate_ReceivablesStrike
- ,Prev_ReceivablesStrike
- ,Money_ReceivablesStrike
- ,Payment_ReceivablesStrike)
-
- VALUES (@ID_ReceivablesStrike
- ,@No_ReceivablesStrike
- ,@Date_ReceivablesStrike
- ,@ID_Customer
- ,@GetCurrency_ReceivablesStrike
- ,@BillCurrency_ReceivablesStrike
- ,@Rate_ReceivablesStrike
- ,@ID_Receiver
- ,@ID_Creator
- ,@Comment_ReceivablesStrike
- ,@CreateDate_ReceivablesStrike
- ,@Prev_ReceivablesStrike
- ,@Money_ReceivablesStrike
- ,@Payment_ReceivablesStrike)">
- <Params>
- <Param name="@ID_ReceivablesStrike" type="ReceivablesStrike.ID_ReceivablesStrike" sourceColumn="ID_ReceivablesStrike" />
- <Param name="@No_ReceivablesStrike" type="ReceivablesStrike.No_ReceivablesStrike" sourceColumn="No_ReceivablesStrike" />
- <Param name="@Date_ReceivablesStrike" type="ReceivablesStrike.Date_ReceivablesStrike" sourceColumn="Date_ReceivablesStrike" />
- <Param name="@ID_Customer" type="ReceivablesStrike.ID_Customer" sourceColumn="ID_Customer" />
- <Param name="@GetCurrency_ReceivablesStrike" type="ReceivablesStrike.GetCurrency_ReceivablesStrike" sourceColumn="GetCurrency_ReceivablesStrike" />
- <Param name="@BillCurrency_ReceivablesStrike" type="ReceivablesStrike.BillCurrency_ReceivablesStrike" sourceColumn="BillCurrency_ReceivablesStrike" />
- <Param name="@Rate_ReceivablesStrike" type="ReceivablesStrike.Rate_ReceivablesStrike" sourceColumn="Rate_ReceivablesStrike" />
- <Param name="@ID_Receiver" type="ReceivablesStrike.ID_Receiver" sourceColumn="ID_Receiver" />
- <Param name="@ID_Creator" type="ReceivablesStrike.ID_Creator" sourceColumn="ID_Creator" />
- <Param name="@Comment_ReceivablesStrike" type="ReceivablesStrike.Comment_ReceivablesStrike" sourceColumn="Comment_ReceivablesStrike" />
- <Param name="@CreateDate_ReceivablesStrike" type="ReceivablesStrike.CreateDate_ReceivablesStrike" sourceColumn="CreateDate_ReceivablesStrike" />
- <Param name="@Prev_ReceivablesStrike" type="ReceivablesStrike.Prev_ReceivablesStrike" sourceColumn="Prev_ReceivablesStrike" />
- <Param name="@Money_ReceivablesStrike" type="ReceivablesStrike.Money_ReceivablesStrike" sourceColumn="Money_ReceivablesStrike" />
- <Param name="@Payment_ReceivablesStrike" type="ReceivablesStrike.Payment_ReceivablesStrike" sourceColumn="Payment_ReceivablesStrike" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText=" UPDATE ReceivablesStrike
- SET Date_ReceivablesStrike = @Date_ReceivablesStrike
- ,ID_Customer = @ID_Customer
- ,GetCurrency_ReceivablesStrike = @GetCurrency_ReceivablesStrike
- ,BillCurrency_ReceivablesStrike = @BillCurrency_ReceivablesStrike
- ,Rate_ReceivablesStrike = @Rate_ReceivablesStrike
- ,ID_Receiver = @ID_Receiver
- ,Comment_ReceivablesStrike = @Comment_ReceivablesStrike
- ,LastModUser_ReceivablesStrike = @LastModUser_ReceivablesStrike
- ,LastModDate_ReceivablesStrike = @LastModDate_ReceivablesStrike
- ,Prev_ReceivablesStrike = @Prev_ReceivablesStrike
- ,Money_ReceivablesStrike = @Money_ReceivablesStrike
- ,Payment_ReceivablesStrike = @Payment_ReceivablesStrike
- WHERE ID_ReceivablesStrike = @ID_ReceivablesStrike">
- <Params>
- <Param name="@ID_ReceivablesStrike" type="ReceivablesStrike.ID_ReceivablesStrike" sourceColumn="ID_ReceivablesStrike" />
- <Param name="@Date_ReceivablesStrike" type="ReceivablesStrike.Date_ReceivablesStrike" sourceColumn="Date_ReceivablesStrike" />
- <Param name="@ID_Customer" type="ReceivablesStrike.ID_Customer" sourceColumn="ID_Customer" />
- <Param name="@GetCurrency_ReceivablesStrike" type="ReceivablesStrike.GetCurrency_ReceivablesStrike" sourceColumn="GetCurrency_ReceivablesStrike" />
- <Param name="@BillCurrency_ReceivablesStrike" type="ReceivablesStrike.BillCurrency_ReceivablesStrike" sourceColumn="BillCurrency_ReceivablesStrike" />
- <Param name="@Rate_ReceivablesStrike" type="ReceivablesStrike.Rate_ReceivablesStrike" sourceColumn="Rate_ReceivablesStrike" />
- <Param name="@ID_Receiver" type="ReceivablesStrike.ID_Receiver" sourceColumn="ID_Receiver" />
- <Param name="@Comment_ReceivablesStrike" type="ReceivablesStrike.Comment_ReceivablesStrike" sourceColumn="Comment_ReceivablesStrike" />
- <Param name="@LastModUser_ReceivablesStrike" type="ReceivablesStrike.LastModUser_ReceivablesStrike" sourceColumn="LastModUser_ReceivablesStrike" />
- <Param name="@LastModDate_ReceivablesStrike" type="ReceivablesStrike.LastModDate_ReceivablesStrike" sourceColumn="LastModDate_ReceivablesStrike" />
- <Param name="@Prev_ReceivablesStrike" type="ReceivablesStrike.Prev_ReceivablesStrike" sourceColumn="Prev_ReceivablesStrike" />
- <Param name="@Money_ReceivablesStrike" type="ReceivablesStrike.Money_ReceivablesStrike" sourceColumn="Money_ReceivablesStrike" />
- <Param name="@Payment_ReceivablesStrike" type="ReceivablesStrike.Payment_ReceivablesStrike" sourceColumn="Payment_ReceivablesStrike" />
- </Params>
- </Update>
- <Audit CmdType="Text" CmdText=" Declare @No_SaleInvoice nvarchar(64)
- Declare @Strike_ReceivablesStrikeBills decimal(18,6)
- Declare @Discount_ReceivablesStrikeBills decimal(18,6)
- Declare @Type_ReceivablesStrikeMethod nvarchar(64)
- Declare @Amount_ReceivablesStrikeMethod decimal(18,6)
- Declare @ID_Assessor_SaleInvoice uniqueidentifier
- Declare @Disable_SaleInvoice bit
- Declare @Amount_SaleInvoice decimal(18,6)
- Declare @StrikedAmount_SaleInvoice decimal(18,6)
- Declare @error nvarchar(256)
- DECLARE @StrikePrePay decimal(18,6)
- DECLARE @StrikeAll decimal(18,6)
- declare @ID_PreGet uniqueidentifier
-
- SELECT @StrikePrePay = isnull(SUM(IsNull(ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod,0)),0)
- FROM ReceivablesStrikeMethod
- WHERE ReceivablesStrikeMethod.ID_ReceivablesStrike = @ID_ReceivablesStrike
- AND ReceivablesStrikeMethod.Type_ReceivablesStrikeMethod = '冲减预收款'
-
- SELECT @StrikeAll = isnull(SUM(IsNull(ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod,0)),0)
- FROM ReceivablesStrikeMethod
- WHERE ReceivablesStrikeMethod.ID_ReceivablesStrike = @ID_ReceivablesStrike
-
- IF (@ID_Assessor IS NOT NULL)
- BEGIN
- IF ((SELECT PrePayBalance_Customer FROM Customer
- WHERE ID_Customer = @ID_Customer) < @StrikePrePay)
- BEGIN
- SET @error = N'该客户的预收帐款余额小于此次冲账所使用的金额,审核失败!'
- RAISERROR(@error,16,1)
- RETURN
- END
- END
- else
- BEGIN
- SET @StrikePrePay = - @StrikePrePay
- SET @StrikeAll = - @StrikeAll
- END
- IF (@Prev_ReceivablesStrike = 0)
- BEGIN
- DECLARE CUR
- CURSOR FOR
- SELECT ReceivablesStrikeBills.No_SaleInvoice
- ,Strike_ReceivablesStrikeBills
- ,Discount_ReceivablesStrikeBills
- ,SaleInvoice.ID_Assessor
- ,SaleInvoice.Disable_SaleInvoice
- ,SaleInvoice.Amount_SaleInvoice
- ,SaleInvoice.StrikedAmount_SaleInvoice
- FROM ReceivablesStrikeBills
-
- Left Join SaleInvoice On SaleInvoice.No_SaleInvoice=ReceivablesStrikeBills.No_SaleInvoice
- WHERE ID_ReceivablesStrike = @ID_ReceivablesStrike
-
- OPEN CUR
- FETCH NEXT FROM CUR INTO @No_SaleInvoice
- ,@Strike_ReceivablesStrikeBills
- ,@Discount_ReceivablesStrikeBills
- ,@ID_Assessor_SaleInvoice
- ,@Disable_SaleInvoice
- ,@Amount_SaleInvoice
- ,@StrikedAmount_SaleInvoice
- WHILE @@FETCH_STATUS = 0
- BEGIN
- IF (@ID_Assessor IS NULL)
- BEGIN
- set @Strike_ReceivablesStrikeBills = -@Strike_ReceivablesStrikeBills
- set @Discount_ReceivablesStrikeBills = -@Discount_ReceivablesStrikeBills
- set @Money_ReceivablesStrike = -@Money_ReceivablesStrike
- END
-
- IF (@ID_Assessor IS NOT NULL)
- BEGIN
- IF(@ID_Assessor_SaleInvoice IS NULL)
- BEGIN
- SET @error = N'编号为' + @No_SaleInvoice + '的销项发票尚未经过审核,审核失败!'
- RAISERROR(@error,16,1)
- RETURN
- END
- IF(@Disable_SaleInvoice=1)
- BEGIN
- SET @error = N'编号为' + @No_SaleInvoice+ '的发票已作废,审核失败!'
- RAISERROR(@error,16,1)
- RETURN
- END
-
- IF (((@Strike_ReceivablesStrikeBills + @Discount_ReceivablesStrikeBills) > ( @Amount_SaleInvoice-@StrikedAmount_SaleInvoice) And @Amount_SaleInvoice > 0)
- Or ((@Strike_ReceivablesStrikeBills + @Discount_ReceivablesStrikeBills) < ( @Amount_SaleInvoice-@StrikedAmount_SaleInvoice) And @Amount_SaleInvoice < 0) )
- BEGIN
- SET @error = N'编号为' + @No_SaleInvoice + '的发票未冲减金额小于本次冲帐和本次折让的和,审核失败!'
- RAISERROR(@error,16,1)
- RETURN
- END
-
- END
- Update SaleInvoice
- Set StrikedAmount_SaleInvoice=(StrikedAmount_SaleInvoice+@Strike_ReceivablesStrikeBills + @Discount_ReceivablesStrikeBills)
- Where No_SaleInvoice=@No_SaleInvoice
- FETCH NEXT FROM CUR INTO @No_SaleInvoice
- ,@Strike_ReceivablesStrikeBills
- ,@Discount_ReceivablesStrikeBills
- ,@ID_Assessor_SaleInvoice
- ,@Disable_SaleInvoice
- ,@Amount_SaleInvoice
- ,@StrikedAmount_SaleInvoice
- END
- CLOSE CUR
- DEALLOCATE CUR
- END
-
- DECLARE CUR_PreGet
- CURSOR FOR
- SELECT ID_PreGet,Amount_ReceivablesStrikeMethod
- FROM ReceivablesStrikeMethod
- WHERE ID_ReceivablesStrike = @ID_ReceivablesStrike
- OPEN CUR_PreGet
- FETCH NEXT FROM CUR_PreGet INTO @ID_PreGet,@Amount_ReceivablesStrikeMethod
- WHILE @@FETCH_STATUS = 0
- BEGIN
- IF (@ID_Assessor IS NOT NULL)
- BEGIN
- Update PreGet Set Balance_PreGet=Balance_PreGet+@Amount_ReceivablesStrikeMethod
- Where ID_PreGet=@ID_PreGet
- END
- IF (@ID_Assessor IS NULL)
- BEGIN
- Update PreGet Set Balance_PreGet=Balance_PreGet-@Amount_ReceivablesStrikeMethod
- Where ID_PreGet=@ID_PreGet
- END
- FETCH NEXT FROM CUR_PreGet INTO @ID_PreGet,@Amount_ReceivablesStrikeMethod
- END
- CLOSE CUR_PreGet
- DEALLOCATE CUR_PreGet
-
- UPDATE Customer SET PrePayBalance_Customer = (PrePayBalance_Customer - @StrikeAll)
- ,ToGetBalance_Customer = (ToGetBalance_Customer - @StrikeAll)
- WHERE ID_Customer = @ID_Customer
-
- UPDATE ReceivablesStrike SET ID_Assessor = @ID_Assessor
- ,AssessDate_ReceivablesStrike = @AssessDate_ReceivablesStrike
- WHERE ID_ReceivablesStrike = @ID_ReceivablesStrike
-
- ">
- <Params>
- <Param name="@ID_ReceivablesStrike" type="ReceivablesStrike.ID_ReceivablesStrike" sourceColumn="ID_ReceivablesStrike" />
- <Param name="@ID_Customer" type="ReceivablesStrike.ID_Customer" sourceColumn="ID_Customer" />
- <Param name="@ID_Assessor" type="ReceivablesStrike.ID_Assessor" sourceColumn="ID_Assessor" />
- <Param name="@AssessDate_ReceivablesStrike" type="ReceivablesStrike.AssessDate_ReceivablesStrike" sourceColumn="AssessDate_ReceivablesStrike" />
- <Param name="@Prev_ReceivablesStrike" type="ReceivablesStrike.Prev_ReceivablesStrike" sourceColumn="Prev_ReceivablesStrike" />
- <Param name="@Money_ReceivablesStrike" type="ReceivablesStrike.Money_ReceivablesStrike" sourceColumn="Money_ReceivablesStrike" />
- </Params>
- </Audit>
- <Delete CmdType="Text" CmdText=" DELETE ReceivablesStrikeMethod
- WHERE ReceivablesStrikeMethod.ID_ReceivablesStrike = @ID_ReceivablesStrike
-
- DELETE ReceivablesStrikeBills
- WHERE ReceivablesStrikeBills.ID_ReceivablesStrike = @ID_ReceivablesStrike
-
- DELETE ReceivablesStrike
- WHERE ReceivablesStrike.ID_ReceivablesStrike = @ID_ReceivablesStrike">
- <Params>
- <Param name="@ID_ReceivablesStrike" type="ReceivablesStrike.ID_ReceivablesStrike" sourceColumn="ID_ReceivablesStrike" />
- </Params>
- </Delete>
- <FKErrorReport ErrorMessage="该单据已被其他单据引用,删除失败!" />
- <UNIQUEErrorReport ErrorMessage="该应收帐款冲帐单号已存在,提交失败!" />
- </Table>
- <Table name="ReceivablesStrikeMethod" Type="Child">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 ReceivablesStrikeMethod.*
- ,Convert(decimal(18,6),0) As LeaveAmount_ReceivablesStrikeMethod
- ,Convert(Nvarchar(64),'') As No_PreGet
- ,Convert(Nvarchar(64),'') As Comment_PreGet
- FROM ReceivablesStrikeMethod" />
- <New CmdType="Text" CmdText="INSERT INTO ReceivablesStrikeMethod (ID_ReceivablesStrikeMethod
- ,No_ReceivablesStrikeMethod
- ,ID_ReceivablesStrike
- ,Type_ReceivablesStrikeMethod
- ,Amount_ReceivablesStrikeMethod
- ,Comment_ReceivablesStrikeMethod
- ,ID_PreGet)
-
- VALUES (@ID_ReceivablesStrikeMethod
- ,@No_ReceivablesStrikeMethod
- ,@ID_ReceivablesStrike
- ,@Type_ReceivablesStrikeMethod
- ,@Amount_ReceivablesStrikeMethod
- ,@Comment_ReceivablesStrikeMethod
- ,@ID_PreGet)
- ">
- <Params>
- <Param name="@ID_ReceivablesStrikeMethod" type="ReceivablesStrikeMethod.ID_ReceivablesStrikeMethod" sourceColumn="ID_ReceivablesStrikeMethod" />
- <Param name="@No_ReceivablesStrikeMethod" type="ReceivablesStrikeMethod.No_ReceivablesStrikeMethod" sourceColumn="No_ReceivablesStrikeMethod" />
- <Param name="@ID_ReceivablesStrike" type="ReceivablesStrikeMethod.ID_ReceivablesStrike" sourceColumn="ID_ReceivablesStrike" />
- <Param name="@Type_ReceivablesStrikeMethod" type="ReceivablesStrikeMethod.Type_ReceivablesStrikeMethod" sourceColumn="Type_ReceivablesStrikeMethod" />
- <Param name="@Amount_ReceivablesStrikeMethod" type="ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod" sourceColumn="Amount_ReceivablesStrikeMethod" />
- <Param name="@Comment_ReceivablesStrikeMethod" type="ReceivablesStrikeMethod.Comment_ReceivablesStrikeMethod" sourceColumn="Comment_ReceivablesStrikeMethod" />
- <Param name="@ID_PreGet" type="ReceivablesStrikeMethod.ID_PreGet" sourceColumn="ID_PreGet" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText=" UPDATE ReceivablesStrikeMethod
- SET Type_ReceivablesStrikeMethod = @Type_ReceivablesStrikeMethod
- ,Amount_ReceivablesStrikeMethod = @Amount_ReceivablesStrikeMethod
- ,Comment_ReceivablesStrikeMethod = @Comment_ReceivablesStrikeMethod
- ,ID_PreGet = @ID_PreGet
- WHERE ID_ReceivablesStrikeMethod = @ID_ReceivablesStrikeMethod
- ">
- <Params>
- <Param name="@ID_ReceivablesStrikeMethod" type="ReceivablesStrikeMethod.ID_ReceivablesStrikeMethod" sourceColumn="ID_ReceivablesStrikeMethod" />
- <Param name="@Type_ReceivablesStrikeMethod" type="ReceivablesStrikeMethod.Type_ReceivablesStrikeMethod" sourceColumn="Type_ReceivablesStrikeMethod" />
- <Param name="@Amount_ReceivablesStrikeMethod" type="ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod" sourceColumn="Amount_ReceivablesStrikeMethod" />
- <Param name="@Comment_ReceivablesStrikeMethod" type="ReceivablesStrikeMethod.Comment_ReceivablesStrikeMethod" sourceColumn="Comment_ReceivablesStrikeMethod" />
- <Param name="@ID_PreGet" type="ReceivablesStrikeMethod.ID_PreGet" sourceColumn="ID_PreGet" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText=" DELETE ReceivablesStrikeMethod
- WHERE ID_ReceivablesStrikeMethod = @ID_ReceivablesStrikeMethod
- ">
- <Params>
- <Param name="@ID_ReceivablesStrikeMethod" type="ReceivablesStrikeMethod.ID_ReceivablesStrikeMethod" sourceColumn="ID_ReceivablesStrikeMethod" />
- </Params>
- </Delete>
- </Table>
- <Table name="ReceivablesStrikeBills" Type="Child">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 ReceivablesStrikeBills.*
- FROM ReceivablesStrikeBills
- " />
- <New CmdType="Text" CmdText=" INSERT INTO ReceivablesStrikeBills (ID_ReceivablesStrikeBills
- ,No_ReceivablesStrikeBills
- ,ID_ReceivablesStrike,No_SaleInvoice
- ,No_Invoice
- ,PayDate_ReceivablesStrikeBills
- ,Amount_FromBill
- ,ToGetAmount_ReceivablesStrikeBills
- ,Strike_ReceivablesStrikeBills
- ,Discount_ReceivablesStrikeBills
- ,StrikedAmount_ReceivablesStrikeBills )
-
- VALUES (@ID_ReceivablesStrikeBills
- ,@No_ReceivablesStrikeBills
- ,@ID_ReceivablesStrike
- ,@No_SaleInvoice
- ,@No_Invoice
- ,@PayDate_ReceivablesStrikeBills
- ,@Amount_FromBill
- ,@ToGetAmount_ReceivablesStrikeBills
- ,@Strike_ReceivablesStrikeBills
- ,@Discount_ReceivablesStrikeBills
- ,@StrikedAmount_ReceivablesStrikeBills )
- ">
- <Params>
- <Param name="@ID_ReceivablesStrikeBills" type="ReceivablesStrikeBills.ID_ReceivablesStrikeBills" sourceColumn="ID_ReceivablesStrikeBills" />
- <Param name="@No_ReceivablesStrikeBills" type="ReceivablesStrikeBills.No_ReceivablesStrikeBills" sourceColumn="No_ReceivablesStrikeBills" />
- <Param name="@ID_ReceivablesStrike" type="ReceivablesStrikeBills.ID_ReceivablesStrike" sourceColumn="ID_ReceivablesStrike" />
- <Param name="@No_SaleInvoice" type="ReceivablesStrikeBills.No_SaleInvoice" sourceColumn="No_SaleInvoice" />
- <Param name="@No_Invoice" type="ReceivablesStrikeBills.No_Invoice" sourceColumn="No_Invoice" />
- <Param name="@PayDate_ReceivablesStrikeBills" type="ReceivablesStrikeBills.PayDate_ReceivablesStrikeBills" sourceColumn="PayDate_ReceivablesStrikeBills" />
- <Param name="@Amount_FromBill" type="ReceivablesStrikeBills.Amount_FromBill" sourceColumn="Amount_FromBill" />
- <Param name="@ToGetAmount_ReceivablesStrikeBills" type="ReceivablesStrikeBills.ToGetAmount_ReceivablesStrikeBills" sourceColumn="ToGetAmount_ReceivablesStrikeBills" />
- <Param name="@Strike_ReceivablesStrikeBills" type="ReceivablesStrikeBills.Strike_ReceivablesStrikeBills" sourceColumn="Strike_ReceivablesStrikeBills" />
- <Param name="@Discount_ReceivablesStrikeBills" type="ReceivablesStrikeBills.Discount_ReceivablesStrikeBills" sourceColumn="Discount_ReceivablesStrikeBills" />
- <Param name="@StrikedAmount_ReceivablesStrikeBills" type="ReceivablesStrikeBills.StrikedAmount_ReceivablesStrikeBills" sourceColumn="StrikedAmount_ReceivablesStrikeBills" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText=" UPDATE ReceivablesStrikeBills
- SET No_ReceivablesStrikeBills = @No_ReceivablesStrikeBills
- ,No_SaleInvoice = @No_SaleInvoice
- ,No_Invoice = @No_Invoice
- ,PayDate_ReceivablesStrikeBills = @PayDate_ReceivablesStrikeBills
- ,Amount_FromBill = @Amount_FromBill
- ,ToGetAmount_ReceivablesStrikeBills = @ToGetAmount_ReceivablesStrikeBills
- ,Strike_ReceivablesStrikeBills = @Strike_ReceivablesStrikeBills
- ,Discount_ReceivablesStrikeBills = @Discount_ReceivablesStrikeBills
- ,StrikedAmount_ReceivablesStrikeBills =@StrikedAmount_ReceivablesStrikeBills
- WHERE ID_ReceivablesStrikeBills = @ID_ReceivablesStrikeBills
- ">
- <Params>
- <Param name="@ID_ReceivablesStrikeBills" type="ReceivablesStrikeBills.ID_ReceivablesStrikeBills" sourceColumn="ID_ReceivablesStrikeBills" />
- <Param name="@No_ReceivablesStrikeBills" type="ReceivablesStrikeBills.No_ReceivablesStrikeBills" sourceColumn="No_ReceivablesStrikeBills" />
- <Param name="@ID_ReceivablesStrike" type="ReceivablesStrikeBills.ID_ReceivablesStrike" sourceColumn="ID_ReceivablesStrike" />
- <Param name="@No_SaleInvoice" type="ReceivablesStrikeBills.No_SaleInvoice" sourceColumn="No_SaleInvoice" />
- <Param name="@No_Invoice" type="ReceivablesStrikeBills.No_Invoice" sourceColumn="No_Invoice" />
- <Param name="@PayDate_ReceivablesStrikeBills" type="ReceivablesStrikeBills.PayDate_ReceivablesStrikeBills" sourceColumn="PayDate_ReceivablesStrikeBills" />
- <Param name="@Amount_FromBill" type="ReceivablesStrikeBills.Amount_FromBill" sourceColumn="Amount_FromBill" />
- <Param name="@ToGetAmount_ReceivablesStrikeBills" type="ReceivablesStrikeBills.ToGetAmount_ReceivablesStrikeBills" sourceColumn="ToGetAmount_ReceivablesStrikeBills" />
- <Param name="@Strike_ReceivablesStrikeBills" type="ReceivablesStrikeBills.Strike_ReceivablesStrikeBills" sourceColumn="Strike_ReceivablesStrikeBills" />
- <Param name="@Discount_ReceivablesStrikeBills" type="ReceivablesStrikeBills.Discount_ReceivablesStrikeBills" sourceColumn="Discount_ReceivablesStrikeBills" />
- <Param name="@StrikedAmount_ReceivablesStrikeBills" type="ReceivablesStrikeBills.StrikedAmount_ReceivablesStrikeBills" sourceColumn="StrikedAmount_ReceivablesStrikeBills" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText=" DELETE ReceivablesStrikeBills
- WHERE ID_ReceivablesStrikeBills = @ID_ReceivablesStrikeBills
- ">
- <Params>
- <Param name="@ID_ReceivablesStrikeBills" type="ReceivablesStrikeBills.ID_ReceivablesStrikeBills" sourceColumn="ID_ReceivablesStrikeBills" />
- </Params>
- </Delete>
- </Table>
- </Tables>
- <Search>
- <SearchAllCustomer CmdType="Text" CmdText="SELECT Customer.No_Customer
- ,Customer.ShortName_Customer
- ,Customer.Type_Customer
- ,Customer.Level_Customer
- ,Customer.IsGeneric_Customer
- FROM Customer
- ">
- <Tables>
- <Table name="AllCustomer" />
- </Tables>
- </SearchAllCustomer>
- <SearchAllBill CmdType="Text" CmdText=" SELECT ReceivablesStrike.*
- ,Customer.No_Customer
- ,Customer.ShortName_Customer
- ,Customer.PrePayBalance_Customer
- ,Employee.No_Employee AS No_Receiver
- ,a.Name_User AS Name_Creator
- ,b.Name_User AS Name_Assessor
- ,c.Name_User AS Name_LastModUser
- ,CONVERT(decimal(18,6), 0) AS SumSale
- ,CONVERT(decimal(18,6), 0) AS SumRtn
- ,CONVERT(decimal(18,6), 0) AS SumReceive
- FROM ReceivablesStrike
-
- LEFT JOIN Customer ON Customer.ID_Customer = ReceivablesStrike.ID_Customer
- LEFT JOIN Employee ON Employee.ID_Employee = ReceivablesStrike.ID_Receiver
- LEFT JOIN AppUser a ON a.ID_User = ReceivablesStrike.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = ReceivablesStrike.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = ReceivablesStrike.LastModUser_ReceivablesStrike ">
- <Tables>
- <Table name="AllBill" />
- </Tables>
- </SearchAllBill>
- <SearchReceivablesStrikeWithNo CmdType="Text" CmdText=" DECLARE @ID_ReceivablesStrike uniqueidentifier
- SELECT @ID_ReceivablesStrike = ReceivablesStrike.ID_ReceivablesStrike
- FROM ReceivablesStrike
- WHERE ReceivablesStrike.No_ReceivablesStrike = @No_ReceivablesStrike
-
- SELECT ReceivablesStrike.*
- ,Customer.No_Customer
- ,Customer.ShortName_Customer
- ,Customer.PrePayBalance_Customer
- ,Employee.No_Employee AS No_Receiver
- ,Employee.Name_Employee
- ,a.Name_User AS Name_Creator
- ,b.Name_User AS Name_Assessor
- ,c.Name_User AS Name_LastModUser
- ,CONVERT(decimal(18,6), 0) AS SumSale
- ,CONVERT(decimal(18,6), 0) AS SumRtn
- ,CONVERT(decimal(18,6), 0) AS SumReceive
- FROM ReceivablesStrike
-
- LEFT JOIN Customer ON Customer.ID_Customer = ReceivablesStrike.ID_Customer
- LEFT JOIN Employee ON Employee.ID_Employee = ReceivablesStrike.ID_Receiver
- LEFT JOIN AppUser a ON a.ID_User = ReceivablesStrike.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = ReceivablesStrike.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = ReceivablesStrike.LastModUser_ReceivablesStrike
- WHERE ReceivablesStrike.ID_ReceivablesStrike = @ID_ReceivablesStrike
-
- SELECT PreGet.*
- ,A.*
- ,(IsNull(Amount_PreGet,0)) As LeaveAmount_ReceivablesStrikeMethod
- FROM
- (
- SELECT ID_ReceivablesStrike
- ,ID_PreGet
- ,No_ReceivablesStrikeMethod
- ,ID_ReceivablesStrikeMethod
- ,Sum(Amount_ReceivablesStrikeMethod) As Amount_ReceivablesStrikeMethod
- FROM ReceivablesStrikeMethod
- Group By ID_ReceivablesStrike,ID_PreGet,No_ReceivablesStrikeMethod,ID_ReceivablesStrikeMethod
- ) A
- Left Join PreGet On PreGet.ID_PreGet = A.ID_PreGet
- WHERE A.ID_ReceivablesStrike = @ID_ReceivablesStrike
- --AND IsNull(Amount_ReceivablesStrikeMethod,0) > 0
- ORDER BY A.No_ReceivablesStrikeMethod
-
- SELECT ReceivablesStrikeBills.* From ReceivablesStrikeBills
- WHERE ReceivablesStrikeBills.ID_ReceivablesStrike = @ID_ReceivablesStrike
- --AND isnull(Strike_ReceivablesStrikeBills,0) > 0
- ORDER BY ReceivablesStrikeBills.No_ReceivablesStrikeBills
- ">
- <Params>
- <Param name="@No_ReceivablesStrike" type="ReceivablesStrike.No_ReceivablesStrike" Index="0" />
- </Params>
- <Tables>
- <Table name="ReceivablesStrike" />
- <Table name="ReceivablesStrikeMethod" />
- <Table name="ReceivablesStrikeBills" />
- </Tables>
- </SearchReceivablesStrikeWithNo>
- <SearchCustomerWithNo CmdType="Text" CmdText=" SELECT ID_Customer
- ,No_Customer
- ,ShortName_Customer
- ,Name_Customer
- ,RegistedAddress_Customer
- ,Country_Customer
- ,PostalCode_Customer
- ,Type_Customer
- ,IsGeneric_Customer
- ,PayLimitCurrency
- ,PayLimit_Customer
- ,GetMethod_Customer
- ,CreateDate_Customer
- ,ID_Creator
- ,SendAddr_Customer
- ,Comment_Customer
- ,Industry_Customer
- ,Zone_Customer
- ,Source_Customer
- ,Level_Customer
- ,Bank_Customer
- ,Account_Customer
- ,RevenueRegisterNo_Customer
- ,LastDiscount_Customer
- ,SuspendDate_Customer
- ,ToGetBalance_Customer
- ,PrePayBalance_Customer
- ,(isnull(OpeningToGetBalance_Customer,0)-isnull(PrePayValue_Customer,0)) as OpeningToGetBalance_Customer
- ,OpeningPrePayBalance_Customer
- ,LastTax_Customer
- ,LastModDate_Customer
- ,LastModUser_Customer
- ,DunDate_Customer, LastPrincipal_Customer
- ,LowDiscount_Customer, IsCustomersCustomer_Customer
- ,BeginDate_Customer, Saleroom_Customer, PerValue_Customer
- ,CustomerID_Customer, ID_RegionalLeader, Note_Customer
- ,PrePayValue_Customer
- FROM Customer
- WHERE Customer.No_Customer = @No_Customer
- ">
- <Params>
- <Param name="@No_Customer" type="ReceivablesStrike.No_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="Customer" />
- </Tables>
- </SearchCustomerWithNo>
- <SearchReceiver CmdType="Text" CmdText=" SELECT Employee.No_Employee
- ,Employee.ID_Employee
- ,Employee.Name_Employee
- FROM Employee
- WHERE Employee.SuspendDate_Employee IS NULL
- ">
- <Tables>
- <Table name="Receiver" />
- </Tables>
- </SearchReceiver>
- <SearchReceivablesStrikeMethod CmdType="Text" CmdText="SELECT '现金' AS Result
- UNION
- SELECT '刷卡' AS Result
- UNION
- SELECT '支票' AS Result
- UNION
- SELECT '冲减预付款' AS Result
- UNION
- SELECT '抵帐' AS Result
- UNION
- SELECT '转帐' AS Result
- UNION
- SELECT '银行汇票' AS Result
- UNION
- SELECT '银行承兑汇票' AS Result">
- <Tables>
- <Table name="Method" />
- </Tables>
- </SearchReceivablesStrikeMethod>
- <SearchBillType CmdType="Text" CmdText=" SELECT * FROM BillType
- WHERE Value_BillType = 21 OR Value_BillType = 22
- OR Value_BillType=0
- ORDER BY Value_BillType
- ">
- <Tables>
- <Table name="BillType" />
- </Tables>
- </SearchBillType>
- <SearchFromBillInInvoice CmdType="Text" CmdText=" Select SaleInvoice.No_Invoice
- ,Amount_SaleInvoice
- ,PayDate_SaleInvoice
- ,StrikedAmount_SaleInvoice
- ,ID_Assessor
- ,Disable_SaleInvoice
- ,ID_Customer
- From SaleInvoice
- Where No_SaleInvoice=@No_SaleInvoice
- ">
- <Params>
- <Param name="@No_SaleInvoice" type="ReceivablesStrikeBills.No_SaleInvoice" Index="0" />
- </Params>
- <Tables>
- <Table name="FromBill" />
- </Tables>
- </SearchFromBillInInvoice>
- <SearchReceivablesStrikeFirst CmdType="Text" CmdText=" DECLARE @ID_ReceivablesStrike uniqueidentifier
-
- SELECT TOP 1 @ID_ReceivablesStrike = ReceivablesStrike.ID_ReceivablesStrike
- FROM ReceivablesStrike
- ORDER BY ReceivablesStrike.No_ReceivablesStrike
-
- SELECT ReceivablesStrike.*
- ,Customer.No_Customer
- ,Customer.ShortName_Customer
- ,Customer.PrePayBalance_Customer
- ,Employee.No_Employee AS No_Receiver
- ,Employee.Name_Employee
- ,a.Name_User AS Name_Creator
- ,b.Name_User AS Name_Assessor
- ,c.Name_User AS Name_LastModUser
- ,CONVERT(decimal(18,6), 0) AS SumSale
- ,CONVERT(decimal(18,6), 0) AS SumRtn
- ,CONVERT(decimal(18,6), 0) AS SumReceive
- FROM ReceivablesStrike
-
- LEFT JOIN Customer ON Customer.ID_Customer = ReceivablesStrike.ID_Customer
- LEFT JOIN Employee ON Employee.ID_Employee = ReceivablesStrike.ID_Receiver
- LEFT JOIN AppUser a ON a.ID_User = ReceivablesStrike.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = ReceivablesStrike.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = ReceivablesStrike.LastModUser_ReceivablesStrike
- WHERE ReceivablesStrike.ID_ReceivablesStrike = @ID_ReceivablesStrike
-
- SELECT PreGet.*
- ,A.*
- ,(IsNull(Amount_PreGet,0)) As LeaveAmount_ReceivablesStrikeMethod
- FROM
- (
- SELECT ID_ReceivablesStrike
- ,ID_PreGet
- ,No_ReceivablesStrikeMethod
- ,ID_ReceivablesStrikeMethod
- ,Sum(Amount_ReceivablesStrikeMethod) As Amount_ReceivablesStrikeMethod
- FROM ReceivablesStrikeMethod
- Group By ID_ReceivablesStrike,ID_PreGet,No_ReceivablesStrikeMethod,ID_ReceivablesStrikeMethod
- ) A
- Left Join PreGet On PreGet.ID_PreGet = A.ID_PreGet
- WHERE A.ID_ReceivablesStrike = @ID_ReceivablesStrike
- --AND IsNull(Amount_ReceivablesStrikeMethod,0) > 0
- ORDER BY A.No_ReceivablesStrikeMethod
-
- SELECT ReceivablesStrikeBills.* From ReceivablesStrikeBills
- WHERE ReceivablesStrikeBills.ID_ReceivablesStrike = @ID_ReceivablesStrike
- --AND isnull(Strike_ReceivablesStrikeBills,0) > 0
- ORDER BY ReceivablesStrikeBills.No_ReceivablesStrikeBills
- ">
- <Tables>
- <Table name="ReceivablesStrike" />
- <Table name="ReceivablesStrikeMethod" />
- <Table name="ReceivablesStrikeBills" />
- </Tables>
- </SearchReceivablesStrikeFirst>
- <SearchReceivablesStrikePrevious CmdType="Text" CmdText=" DECLARE @ID_ReceivablesStrike uniqueidentifier
-
- SELECT TOP 1 @ID_ReceivablesStrike = ReceivablesStrike.ID_ReceivablesStrike
- FROM ReceivablesStrike
- WHERE ReceivablesStrike.No_ReceivablesStrike < @No_ReceivablesStrike ORDER BY ReceivablesStrike.No_ReceivablesStrike DESC
-
- SELECT ReceivablesStrike.*
- ,Customer.No_Customer
- ,Customer.ShortName_Customer
- ,Customer.PrePayBalance_Customer
- ,Employee.No_Employee AS No_Receiver
- ,Employee.Name_Employee
- ,a.Name_User AS Name_Creator
- ,b.Name_User AS Name_Assessor
- ,c.Name_User AS Name_LastModUser
- ,CONVERT(decimal(18,6), 0) AS SumSale
- ,CONVERT(decimal(18,6), 0) AS SumRtn
- ,CONVERT(decimal(18,6), 0) AS SumReceive
- FROM ReceivablesStrike
-
- LEFT JOIN Customer ON Customer.ID_Customer = ReceivablesStrike.ID_Customer
- LEFT JOIN Employee ON Employee.ID_Employee = ReceivablesStrike.ID_Receiver
- LEFT JOIN AppUser a ON a.ID_User = ReceivablesStrike.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = ReceivablesStrike.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = ReceivablesStrike.LastModUser_ReceivablesStrike
- WHERE ReceivablesStrike.ID_ReceivablesStrike = @ID_ReceivablesStrike
-
- SELECT PreGet.*
- ,A.*
- ,(IsNull(Amount_PreGet,0)) As LeaveAmount_ReceivablesStrikeMethod
- FROM
- (
- SELECT ID_ReceivablesStrike
- ,ID_PreGet
- ,No_ReceivablesStrikeMethod
- ,ID_ReceivablesStrikeMethod
- ,Sum(Amount_ReceivablesStrikeMethod) As Amount_ReceivablesStrikeMethod
- FROM ReceivablesStrikeMethod
- Group By ID_ReceivablesStrike,ID_PreGet,No_ReceivablesStrikeMethod,ID_ReceivablesStrikeMethod
- ) A
- Left Join PreGet On PreGet.ID_PreGet = A.ID_PreGet
- WHERE A.ID_ReceivablesStrike = @ID_ReceivablesStrike
- --AND IsNull(Amount_ReceivablesStrikeMethod,0) > 0
- ORDER BY A.No_ReceivablesStrikeMethod
-
- SELECT ReceivablesStrikeBills.* From ReceivablesStrikeBills
- WHERE ReceivablesStrikeBills.ID_ReceivablesStrike = @ID_ReceivablesStrike
- --AND isnull(Strike_ReceivablesStrikeBills,0) > 0
- ORDER BY ReceivablesStrikeBills.No_ReceivablesStrikeBills
- ">
- <Params>
- <Param name="@No_ReceivablesStrike" type="ReceivablesStrike.No_ReceivablesStrike" Index="0" />
- </Params>
- <Tables>
- <Table name="ReceivablesStrike" />
- <Table name="ReceivablesStrikeMethod" />
- <Table name="ReceivablesStrikeBills" />
- </Tables>
- </SearchReceivablesStrikePrevious>
- <SearchReceivablesStrikeNext CmdType="Text" CmdText=" DECLARE @ID_ReceivablesStrike uniqueidentifier
-
- SELECT TOP 1 @ID_ReceivablesStrike = ReceivablesStrike.ID_ReceivablesStrike
- FROM ReceivablesStrike
- WHERE ReceivablesStrike.No_ReceivablesStrike > @No_ReceivablesStrike
- ORDER BY ReceivablesStrike.No_ReceivablesStrike
-
- SELECT ReceivablesStrike.*
- ,Customer.No_Customer
- ,Customer.ShortName_Customer
- ,Customer.PrePayBalance_Customer
- ,Employee.No_Employee AS No_Receiver
- ,Employee.Name_Employee
- ,a.Name_User AS Name_Creator
- ,b.Name_User AS Name_Assessor
- ,c.Name_User AS Name_LastModUser
- ,CONVERT(decimal(18,6), 0) AS SumSale
- ,CONVERT(decimal(18,6), 0) AS SumRtn
- ,CONVERT(decimal(18,6), 0) AS SumReceive
- FROM ReceivablesStrike
-
- LEFT JOIN Customer ON Customer.ID_Customer = ReceivablesStrike.ID_Customer
- LEFT JOIN Employee ON Employee.ID_Employee = ReceivablesStrike.ID_Receiver
- LEFT JOIN AppUser a ON a.ID_User = ReceivablesStrike.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = ReceivablesStrike.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = ReceivablesStrike.LastModUser_ReceivablesStrike
- WHERE ReceivablesStrike.ID_ReceivablesStrike = @ID_ReceivablesStrike
-
- SELECT PreGet.*
- ,A.*
- ,(IsNull(Amount_PreGet,0)) As LeaveAmount_ReceivablesStrikeMethod
- FROM
- (
- SELECT ID_ReceivablesStrike
- ,ID_PreGet
- ,No_ReceivablesStrikeMethod
- ,ID_ReceivablesStrikeMethod
- ,Sum(Amount_ReceivablesStrikeMethod) As Amount_ReceivablesStrikeMethod
- FROM ReceivablesStrikeMethod
- Group By ID_ReceivablesStrike,ID_PreGet,No_ReceivablesStrikeMethod,ID_ReceivablesStrikeMethod
- ) A
- Left Join PreGet On PreGet.ID_PreGet = A.ID_PreGet
- WHERE A.ID_ReceivablesStrike = @ID_ReceivablesStrike
- --AND IsNull(Amount_ReceivablesStrikeMethod,0) > 0
- ORDER BY A.No_ReceivablesStrikeMethod
-
- SELECT ReceivablesStrikeBills.* From ReceivablesStrikeBills
- WHERE ReceivablesStrikeBills.ID_ReceivablesStrike = @ID_ReceivablesStrike
- --AND isnull(Strike_ReceivablesStrikeBills,0) > 0
- ORDER BY ReceivablesStrikeBills.No_ReceivablesStrikeBills
- ">
- <Params>
- <Param name="@No_ReceivablesStrike" type="ReceivablesStrike.No_ReceivablesStrike" Index="0" />
- </Params>
- <Tables>
- <Table name="ReceivablesStrike" />
- <Table name="ReceivablesStrikeMethod" />
- <Table name="ReceivablesStrikeBills" />
- </Tables>
- </SearchReceivablesStrikeNext>
- <SearchReceivablesStrikeLast CmdType="Text" CmdText=" DECLARE @ID_ReceivablesStrike uniqueidentifier
-
- SELECT TOP 1 @ID_ReceivablesStrike = ReceivablesStrike.ID_ReceivablesStrike
- FROM ReceivablesStrike
- ORDER BY ReceivablesStrike.No_ReceivablesStrike DESC
-
- SELECT ReceivablesStrike.*
- ,Customer.No_Customer
- ,Customer.ShortName_Customer
- ,Customer.PrePayBalance_Customer
- ,Employee.No_Employee AS No_Receiver
- ,Employee.Name_Employee
- ,a.Name_User AS Name_Creator
- ,b.Name_User AS Name_Assessor
- ,c.Name_User AS Name_LastModUser
- ,CONVERT(decimal(18,6), 0) AS SumSale
- ,CONVERT(decimal(18,6), 0) AS SumRtn
- ,CONVERT(decimal(18,6), 0) AS SumReceive
- FROM ReceivablesStrike
-
- LEFT JOIN Customer ON Customer.ID_Customer = ReceivablesStrike.ID_Customer
- LEFT JOIN Employee ON Employee.ID_Employee = ReceivablesStrike.ID_Receiver
- LEFT JOIN AppUser a ON a.ID_User = ReceivablesStrike.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = ReceivablesStrike.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = ReceivablesStrike.LastModUser_ReceivablesStrike
- WHERE ReceivablesStrike.ID_ReceivablesStrike = @ID_ReceivablesStrike
-
- SELECT PreGet.*
- ,A.*
- ,(IsNull(Amount_PreGet,0)) As LeaveAmount_ReceivablesStrikeMethod
- FROM
- (
- SELECT ID_ReceivablesStrike
- ,ID_PreGet
- ,No_ReceivablesStrikeMethod
- ,ID_ReceivablesStrikeMethod
- ,Sum(Amount_ReceivablesStrikeMethod) As Amount_ReceivablesStrikeMethod
- FROM ReceivablesStrikeMethod
- Group By ID_ReceivablesStrike,ID_PreGet,No_ReceivablesStrikeMethod,ID_ReceivablesStrikeMethod
- ) A
- Left Join PreGet On PreGet.ID_PreGet = A.ID_PreGet
- WHERE A.ID_ReceivablesStrike = @ID_ReceivablesStrike
- --AND IsNull(Amount_ReceivablesStrikeMethod,0) > 0
- ORDER BY A.No_ReceivablesStrikeMethod
-
- SELECT ReceivablesStrikeBills.* From ReceivablesStrikeBills
- WHERE ReceivablesStrikeBills.ID_ReceivablesStrike = @ID_ReceivablesStrike
- --AND isnull(Strike_ReceivablesStrikeBills,0) > 0
- ORDER BY ReceivablesStrikeBills.No_ReceivablesStrikeBills
- ">
- <Tables>
- <Table name="ReceivablesStrike" />
- <Table name="ReceivablesStrikeMethod" />
- <Table name="ReceivablesStrikeBills" />
- </Tables>
- </SearchReceivablesStrikeLast>
- <SearchSystemSetting CmdType="Text" CmdText="SELECT SysCurrency_SystemSetting From SystemSetting">
- <Tables>
- <Table name="SystemSetting"/>
- </Tables>
- </SearchSystemSetting>
- <SearchPreGet CmdType="Text" CmdText=" Declare @ID_Customer Uniqueidentifier
- Select @ID_Customer = ID_Customer
- From Customer
- Where No_Customer = @No_Customer
- select IDENTITY(int,1,1) as No_ReceivablesStrikeMethod,* into #t from
- (
- Select PreGet.ID_PreGet
- ,No_PreGet
- ,(IsNull(Amount_PreGet,0)-IsNull(Balance_PreGet,0)) As LeaveAmount_ReceivablesStrikeMethod
- ,Convert(Decimal(18,6),0) As Amount_ReceivablesStrikeMethod
- ,Comment_PreGet
- From PreGet
- Where PreGet.ID_Assessor Is Not Null
- And ID_Customer = @ID_Customer
- And (IsNull(Amount_PreGet,0)-IsNull(Balance_PreGet,0)) > 0
- )a
- order by No_PreGet
- select Convert(nvarchar(64),No_ReceivablesStrikeMethod) as No_ReceivablesStrikeMethod
- ,ID_PreGet
- ,No_PreGet
- ,LeaveAmount_ReceivablesStrikeMethod
- ,Amount_ReceivablesStrikeMethod
- ,Comment_PreGet
- from #t
- order by No_ReceivablesStrikeMethod
- drop table #t
- ">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="ReceivablesStrikeMethod1"/>
- </Tables>
- </SearchPreGet>
-
- <SearchIsHavePreGet CmdType="Text" CmdText=" Select Count(*) As No_PreGet From PreGet
- ">
- <Tables>
- <Table name="PreGet"/>
- </Tables>
- </SearchIsHavePreGet>
- <SearchSaleInvoice CmdType="Text" CmdText=" Declare @ID_Customer Uniqueidentifier
- Select @ID_Customer = ID_Customer
- From Customer
- Where No_Customer = @No_Customer
-
- select Identity(INT,1,1) As No_ReceivablesStrikeBills
- ,* into #temptable
- From
- (Select No_SaleInvoice
- ,No_Invoice
- ,PayDate_SaleInvoice As PayDate_ReceivablesStrikeBills
- ,Amount_SaleInvoice As Amount_FromBill
- ,(IsNull(Amount_SaleInvoice,0) - IsNull(StrikedAmount_SaleInvoice,0)) As ToGetAmount_ReceivablesStrikeBills
- ,0 As Strike_ReceivablesStrikeBills
- ,IsNull(DiscountAmount_SaleInvoice,0) As Discount_ReceivablesStrikeBills
- ,IsNull(StrikedAmount_SaleInvoice,0) As StrikedAmount_ReceivablesStrikeBills
- ,InvoiceDate_SaleInvoice
- From SaleInvoice
- Where ID_Assessor Is Not Null
- And Disable_SaleInvoice = 0
- And (IsNull(Amount_SaleInvoice,0) - IsNull(StrikedAmount_SaleInvoice,0))>0
- And ID_Customer = @ID_Customer
- And InvoiceDate_SaleInvoice Between isnull(DateAdd(day,DateDiff(day,0,@DateStart),0),InvoiceDate_SaleInvoice)
- AND Isnull(DateAdd(day,DateDiff(day,0,@DateEnd),1),InvoiceDate_SaleInvoice)
- ) A
- Order By InvoiceDate_SaleInvoice,No_SaleInvoice
- Select Convert(nvarchar(64),No_ReceivablesStrikeBills) As No_ReceivablesStrikeBills
- ,No_SaleInvoice
- ,No_Invoice
- ,PayDate_ReceivablesStrikeBills
- ,Amount_FromBill
- ,ToGetAmount_ReceivablesStrikeBills
- ,Strike_ReceivablesStrikeBills
- ,Discount_ReceivablesStrikeBills
- ,StrikedAmount_ReceivablesStrikeBills
- From #temptable
- Drop Table #temptable
- ">
- <Params>
- <Param name="@DateStart" type="Customer.BeginDate_Customer" Index="0" />
- <Param name="@DateEnd" type="Customer.BeginDate_Customer" Index="1" />
- <Param name="@No_Customer" type="Customer.No_Customer" Index="2" />
- </Params>
- <Tables>
- <Table name="ReceivablesStrikeBill1"/>
- </Tables>
- </SearchSaleInvoice>
- <CreateNewPreGet CmdType="Text" CmdText =" DECLARE @BillNo Nvarchar(64)
- Select Top 1 @BillNo= No_PreGet
- From PreGet
- Where Convert(nvarchar(10),Date_PreGet,120) = Convert(nvarchar(10),@GetDate,120)
- Order By No_PreGet DESC
- Select @BillNo = @Head +Right(convert(char(8),@GetDate,112),6)+ isnull(substring(convert(nvarchar(max),Convert(decimal(28,0),substring(@BillNo,len(@Head)+1,len(@BillNo) - len(@Head)))+1),len(convert(nvarchar(max) ,Convert(decimal(28,0),substring( @BillNo , len(@Head) + 1 , len(@BillNo) - len(@Head)))+1)) - 3 , 4 ),'0001')
- DECLARE @PreGetID Uniqueidentifier
- SELECT @PreGetID = newid()
-
- DECLARE @VoucherNo_PreGet nvarchar(64)
- SELECT @VoucherNo_PreGet = ''
-
- DECLARE @VoucherDate_PreGet Datetime
- SELECT @VoucherDate_PreGet = Convert(Datetime,getDate(),120)
-
- DECLARE @Balance_PreGet decimal(18,6)
- SELECT @Balance_PreGet = PrePayBalance_Customer From Customer
-
-
- DECLARE @ID_Receiver Uniqueidentifier
- SELECT @ID_Receiver = ID_Employee from Employee
- Where Name_Employee = @Name_Employee
-
- INSERT INTO PreGet(ID_PreGet
- ,No_PreGet
- ,Date_PreGet
- ,ID_Customer
- ,GetCurrency_PreGet
- ,Currency_PreGet
- ,Rate_PreGet
- ,Method_PreGet
- ,Amount_PreGet
- ,VoucherNo_PreGet
- ,VoucherDate_PreGet
- ,ID_Receiver
- ,Balance_PreGet
- ,ID_Creator
- ,CreateDate_PreGet
- ,LastModUser_PreGet
- ,LastModDate_PreGet
- ,ID_Assessor
- ,AssessDate_PreGet
- ,Comment_PreGet)
-
- VALUES(@PreGetID
- ,@BillNo
- ,@Date_PreGet
- ,@ID_Customer
- ,@GetCurrency_PreGet
- ,@Currency_PreGet
- ,@Rate_PreGet
- ,@Method_PreGet
- ,@Amount_PreGet
- ,@VoucherNo_PreGet
- ,@VoucherDate_PreGet
- ,@ID_Receiver
- ,@Balance_PreGet
- ,@ID_Creator
- ,@CreateDate_PreGet
- ,@LastModUser_PreGet
- ,@LastModDate_PreGet
- ,@ID_Assessor
- ,@AssessDate_PreGet
- ,@Comment_PreGet)
-
- select @PreGetID
- ">
- <Params>
- <Param name="@Date_PreGet" type="PreGet.Date_PreGet" Index="0" />
- <Param name="@ID_Customer" type="PreGet.ID_Customer" Index="1" />
- <Param name="@GetCurrency_PreGet" type="PreGet.GetCurrency_PreGet" Index="2" />
- <Param name="@Currency_PreGet" type="PreGet.Currency_PreGet" Index="3" />
- <Param name="@Rate_PreGet" type="PreGet.Rate_PreGet" Index="4" />
- <Param name="@Method_PreGet" type="PreGet.Method_PreGet" Index="5" />
- <Param name="@Amount_PreGet" type="PreGet.Amount_PreGet" Index="6" />
- <Param name="@Name_Employee" type="PreGet.Comment_PreGet" Index="7" />
- <Param name="@ID_Creator" type="PreGet.ID_Creator" Index="8" />
- <Param name="@CreateDate_PreGet" type="PreGet.CreateDate_PreGet" Index="9" />
- <Param name="@LastModUser_PreGet" type="PreGet.LastModUser_PreGet" Index="10" />
- <Param name="@LastModDate_PreGet" type="PreGet.LastModDate_PreGet" Index="11" />
- <Param name="@ID_Assessor" type="PreGet.ID_Assessor" Index="12" />
- <Param name="@AssessDate_PreGet" type="PreGet.AssessDate_PreGet" Index="13" />
- <Param name="@Comment_PreGet" type="PreGet.Comment_PreGet" Index="14" />
- <Param name="@Head" type="PreGet.Value1_CodeGenerate" Index="15" />
- <Param name="@GetDate" type="PreGet.Date_PreGet" Index="16" />
- </Params>
- <Tables>
- <Table name="NewPreGet"/>
- </Tables>
- </CreateNewPreGet>
-
- <CreateNewPreGet2 CmdType="Text" CmdText =" DECLARE @BillNo Nvarchar(64)
- Select @BillNo = @Head+Right(convert(char( 8 ),@GetDate,112),6)+right('0000'+convert(varchar,1),4)
-
-
- DECLARE @PreGetID Uniqueidentifier
- SELECT @PreGetID = newid()
-
- DECLARE @VoucherNo_PreGet nvarchar(64)
- SELECT @VoucherNo_PreGet = ''
-
- DECLARE @VoucherDate_PreGet Datetime
- SELECT @VoucherDate_PreGet = Convert(Datetime,getDate(),120)
-
- DECLARE @Balance_PreGet decimal(18,6)
- SELECT @Balance_PreGet = PrePayBalance_Customer From Customer
-
-
- DECLARE @ID_Receiver Uniqueidentifier
- SELECT @ID_Receiver = ID_Employee from Employee
- Where Name_Employee = @Name_Employee
-
- INSERT INTO PreGet(ID_PreGet
- ,No_PreGet
- ,Date_PreGet
- ,ID_Customer
- ,GetCurrency_PreGet
- ,Currency_PreGet
- ,Rate_PreGet
- ,Method_PreGet
- ,Amount_PreGet
- ,VoucherNo_PreGet
- ,VoucherDate_PreGet
- ,ID_Receiver
- ,Balance_PreGet
- ,ID_Creator
- ,CreateDate_PreGet
- ,LastModUser_PreGet
- ,LastModDate_PreGet
- ,ID_Assessor
- ,AssessDate_PreGet
- ,Comment_PreGet)
-
- VALUES(@PreGetID
- ,@BillNo
- ,@Date_PreGet
- ,@ID_Customer
- ,@GetCurrency_PreGet
- ,@Currency_PreGet
- ,@Rate_PreGet
- ,@Method_PreGet
- ,@Amount_PreGet
- ,@VoucherNo_PreGet
- ,@VoucherDate_PreGet
- ,@ID_Receiver
- ,@Balance_PreGet
- ,@ID_Creator
- ,@CreateDate_PreGet
- ,@LastModUser_PreGet
- ,@LastModDate_PreGet
- ,@ID_Assessor
- ,@AssessDate_PreGet
- ,@Comment_PreGet)
-
- select @PreGetID
- ">
- <Params>
- <Param name="@Date_PreGet" type="PreGet.Date_PreGet" Index="0" />
- <Param name="@ID_Customer" type="PreGet.ID_Customer" Index="1" />
- <Param name="@GetCurrency_PreGet" type="PreGet.GetCurrency_PreGet" Index="2" />
- <Param name="@Currency_PreGet" type="PreGet.Currency_PreGet" Index="3" />
- <Param name="@Rate_PreGet" type="PreGet.Rate_PreGet" Index="4" />
- <Param name="@Method_PreGet" type="PreGet.Method_PreGet" Index="5" />
- <Param name="@Amount_PreGet" type="PreGet.Amount_PreGet" Index="6" />
- <Param name="@Name_Employee" type="PreGet.Comment_PreGet" Index="7" />
- <Param name="@ID_Creator" type="PreGet.ID_Creator" Index="8" />
- <Param name="@CreateDate_PreGet" type="PreGet.CreateDate_PreGet" Index="9" />
- <Param name="@LastModUser_PreGet" type="PreGet.LastModUser_PreGet" Index="10" />
- <Param name="@LastModDate_PreGet" type="PreGet.LastModDate_PreGet" Index="11" />
- <Param name="@ID_Assessor" type="PreGet.ID_Assessor" Index="12" />
- <Param name="@AssessDate_PreGet" type="PreGet.AssessDate_PreGet" Index="13" />
- <Param name="@Comment_PreGet" type="PreGet.Comment_PreGet" Index="14" />
- <Param name="@Head" type="PreGet.Value1_CodeGenerate" Index="15" />
- <Param name="@GetDate" type="PreGet.Date_PreGet" Index="16" />
- </Params>
- <Tables>
- <Table name="NewPreGet2"/>
- </Tables>
- </CreateNewPreGet2>
- <SearchPreGetHead CmdType="Text" CmdText="Select * From CodeGenerate Where FuncCode_CodeGenerate = 'FrmPreGet'">
- <Tables>
- <Table name="PreGetHead"/>
- </Tables>
- </SearchPreGetHead>
- <SearchCustomersCustomer CmdType="Text" CmdText=" Select *
- From Customer
- Where ID_Customer = ( Select CustomerID_Customer
- From Customer
- Where No_Customer = @No_Customer
- And IsCustomersCustomer_Customer = 1)">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="CustomersCustomer"/>
- </Tables>
- </SearchCustomersCustomer>
- <SearchNoAssessorPreGet CmdType="Text" CmdText=" Declare @ID_Customer Uniqueidentifier
- Select @ID_Customer = ID_Customer
- From Customer
- Where No_Customer = @No_Customer
- Select No_PreGet From PreGet
- where ID_Customer = @ID_Customer
- And PreGet.ID_Assessor is null
- ">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="NoAssessorPreGet"/>
- </Tables>
- </SearchNoAssessorPreGet>
- <SearchISDelete CmdType="Text" CmdText=" Declare @ID_Customer Uniqueidentifier
- Select @ID_Customer = ID_Customer
- From Customer
- Where No_Customer = @No_Customer
- Select Count(1) AS No_PreGet From PreGet
- Where No_PreGet = @No_PreGet
- And ID_Customer = @ID_Customer
- ">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- <Param name="@No_PreGet" type="Customer.No_Customer" Index="1" />
- </Params>
- <Tables>
- <Table name="ISDelete"/>
- </Tables>
- </SearchISDelete>
- <SearchOpenging CmdType="Text" CmdText=" Select *
- From Customer
- Where No_Customer = @No_Customer
- ">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="Customer"/>
- </Tables>
- </SearchOpenging>
- <SearchLastBalace CmdType="Text" CmdText=" Select (openingToGetBalance_Customer-PrePayValue_Customer) As Balance
- From Customer
- where No_Customer = @No_Customer
- ">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="Balance"/>
- </Tables>
- </SearchLastBalace>
-
- <UpdateAmount CmdType="Text" CmdText=" Update Customer
- Set PerValue_Customer = IsNull(PerValue_Customer,0) + @Amount_PreGet
- Where No_Customer = @No_Customer
-
- Select 1
- ">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- <Param name="@Amount_PreGet" type="PreGet.Amount_PreGet" Index="1" />
- </Params>
- <Tables>
- <Table name="UpdateAmount"/>
- </Tables>
- </UpdateAmount>
- <UpdatePrePayBalance CmdType="Text" CmdText=" UPDATE Customer
- SET PrePayBalance_Customer= IsNull(PrePayBalance_Customer,0) +@Amount_PreGet
- WHERE No_Customer=@No_Customer
-
- Select 1
- ">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- <Param name="@Amount_PreGet" type="PreGet.Amount_PreGet" Index="1" />
- </Params>
- <Tables>
- <Table name="UpdatePrePayBalance"/>
- </Tables>
- </UpdatePrePayBalance>
-
- <UpdatePrePayValue CmdType="Text" CmdText=" Update Customer
- Set PrePayValue_Customer = isnull(PrePayValue_Customer,0) + isnull(@Amount_ReceivablesStrikeMethod,0)
- Where No_Customer = @No_Customer
-
- Select 1
- ">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- <Param name="@Amount_ReceivablesStrikeMethod" type="ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod" Index="1" />
- </Params>
- <Tables>
- <Table name="UpdatePrePayValue"/>
- </Tables>
- </UpdatePrePayValue>
- <ClearPrePayValue CmdType="Text" CmdText=" Update Customer
- Set PrePayValue_Customer = isnull(PrePayValue_Customer,0) - isnull(@Amount_ReceivablesStrikeMethod,0)
- Where No_Customer = @No_Customer
-
- Select 1">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- <Param name="@Amount_ReceivablesStrikeMethod" type="ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod" Index="1" />
- </Params>
- <Tables>
- <Table name="ClearPrePayValue"/>
- </Tables>
- </ClearPrePayValue>
- </Search>
- </Server>
- <Lables>
- <Search>
- Empty();
- NewInstance();
- dtDate.Enabled = false;
- tbNo.ReadOnly = false;
- tbCustomerNo.ReadOnly = true;
- cbReceiver.Enabled = false;
- txtComment.ReadOnly = true;
- dgReceiveMoney.ReadOnly = true;
- txtSum.CValue = 0.00;
- ntbOpeningToGetBalance.CValue = 0.00;
- dtStart.Enabled = false;
- dtEnd.Enabled = false;
- dgBill.ReadOnly = true;
- toolBar.EnableNew = GetRight(@Title,"新增");
- toolBar.EnableSubmit = false;
- toolBar.EnableModify = false;
- toolBar.EnableDelete = false;
- toolBar.EnableAudit = false;
- toolBar.EnableUnAudit = false;
- toolBar.EnablePrint = false;
- cbPrev.Enabled = false;
- cbPayment.Enabled =false;
- txtMoney.ReadOnly = true;
- btnOK.Enabled = false;
- btnSearchByInvoice.Enabled = false;
- btnAutoStrike.Enabled = false;
- btnVerify.Enabled = false;
- #ReceivablesStrike.GetCurrency_ReceivablesStrike = "";
- #ReceivablesStrike.BillCurrency_ReceivablesStrike = "";
- #ReceivablesStrike.Rate_ReceivablesStrike = 0;
- #ReceivablesStrike.AssessDate_ReceivablesStrike = DBNull();
- #ReceivablesStrike.LastModDate_ReceivablesStrike = DBNull();
- UpdateForm(true, "");
- tbNo.Focus();
- @Status = 0;
- </Search>
- <New>
- Empty();
- NewInstance();
- dtDate.Enabled = true;
- tbNo.ReadOnly = true;
- tbCustomerNo.ReadOnly = false;
- cbReceiver.Enabled = true;
- txtComment.ReadOnly = false;
- dgReceiveMoney.ReadOnly = true;
- dgBill.ReadOnly = false;
- txtSum.CValue = 0.00;
- ntbOpeningToGetBalance = 0.00;
- dtStart.Enabled = true;
- dtEnd.Enabled = true;
- toolBar.EnableNew = false;
- toolBar.EnableSubmit = GetRight(@Title,"新增");
- toolBar.EnableModify = false;
- toolBar.EnableDelete = false;
- toolBar.EnableAudit = false;
- toolBar.EnableUnAudit = false;
- toolBar.EnablePrint = false;
- cbPrev.Enabled = true;
- cbPayment.Enabled = true;
- txtMoney.ReadOnly = false;
- btnOK.Enabled = true;
- btnSearchByInvoice.Enabled = true;
- btnAutoStrike.Enabled = true;
- btnVerify.Enabled = true;
- dgReceiveMoney.AllowNew(false);
- dgReceiveMoney.AllowDelete(false);
- dgReceiveMoney.SetColumnReadOnly(1, false);
- dgReceiveMoney.RowHeaderCheck = false;
- dgBill.AllowNew(true);
- dgBill.AllowDelete(true);
- dgBill.SetColumnReadOnly(1, false);
- dgBill.RowHeaderCheck = true;
- #ReceivablesStrike.ID_ReceivablesStrike = NewGuid();
- #ReceivablesStrike.ID_Creator = GetLoginUserID();
- #ReceivablesStrike.Name_Creator = GetCurrentUser();
- #ReceivablesStrike.ID_Assessor = DBNull();
- #ReceivablesStrike.AssessDate_ReceivablesStrike = DBNull();
- #ReceivablesStrike.LastModUser_ReceivablesStrike = DBNull();
- #ReceivablesStrike.LastModDate_ReceivablesStrike = DBNull();
- #ReceivablesStrike.GetCurrency_ReceivablesStrike = @SysCurrency;
- #ReceivablesStrike.BillCurrency_ReceivablesStrike = @SysCurrency;
- #ReceivablesStrike.Rate_ReceivablesStrike = 1;
- SetColumnDefaultValue("ReceivablesStrikeBills", "PayDate_ReceivablesStrikeBills", DBNull());
- UpdateForm(true, "");
- @Status = 1;
- </New>
- <View>
- dtDate.Enabled = false;
- tbNo.ReadOnly = true;
- tbCustomerNo.ReadOnly = true;
- cbReceiver.Enabled = false;
- txtComment.ReadOnly = true;
- dgReceiveMoney.ReadOnly = true;
- dgBill.ReadOnly = true;
- dtStart.Enabled = false;
- dtEnd.Enabled = false;
- toolBar.EnableNew = GetRight(@Title,"新增");
- toolBar.EnableSubmit = false;
- if (Equals(#ReceivablesStrike.ID_Assessor, DBNull()))
- {
- toolBar.EnableModify = GetRight(@Title,"修改");
- toolBar.EnableDelete = GetRight(@Title,"删除");
- toolBar.EnableAudit = GetRight(@Title,"审核");
- toolBar.EnableUnAudit = false;
- }
- else
- {
- toolBar.EnableModify = false;
- toolBar.EnableDelete = false;
- toolBar.EnableAudit = false;
- toolBar.EnableUnAudit = GetRight(@Title,"取消审核");
- }
- toolBar.EnablePrint = GetRight(@Title,"打印");
- cbPrev.Enabled = false;
- cbPayment.Enabled = false;
- txtMoney.ReadOnly = true;
- btnOK.Enabled = false;
- btnSearchByInvoice.Enabled = false;
- btnAutoStrike.Enabled = false;
- btnVerify.Enabled = false;
- UpdateForm(true, "");
- @Status = 2;
- </View>
- <Modify>
- dtDate.Enabled = false;
- tbNo.ReadOnly = true;
- tbCustomerNo.ReadOnly = true;
- cbReceiver.Enabled = true;
- txtComment.ReadOnly = false;
- dgReceiveMoney.ReadOnly = true;
- dgBill.ReadOnly = false;
- dtStart.Enabled = true;
- dtEnd.Enabled = true;
- toolBar.EnableNew = false;
- toolBar.EnableSubmit = GetRight(@Title,"修改");
- toolBar.EnableModify = false;
- toolBar.EnableDelete = false;
- toolBar.EnableAudit = false;
- toolBar.EnableUnAudit = false;
- toolBar.EnablePrint = false;
- @NotAssess = Equals(#ReceivablesStrike.AssessDate_ReceivablesStrike, DBNull());
- cbPrev.Enabled = @NotAssess;
- cbPayment.Enabled = true;
- txtMoney.ReadOnly = false;
- btnOK.Enabled = false;
- if (cbPrev.Checked)
- {
- btnSearchByInvoice.Enabled = false;
- btnAutoStrike.Enabled = false;
- }
- else
- {
- btnSearchByInvoice.Enabled = @NotAssess;
- btnAutoStrike.Enabled = true;
- }
- btnVerify.Enabled = true;
- dgReceiveMoney.AllowNew(false);
- dgReceiveMoney.AllowDelete(false);
- dgReceiveMoney.SetColumnReadOnly(1, false);
- dgReceiveMoney.RowHeaderCheck = false;
- dgBill.AllowNew(@NotAssess);
- dgBill.AllowDelete(@NotAssess);
- dgBill.SetColumnReadOnly(1, !@NotAssess);
- dgBill.RowHeaderCheck = @NotAssess;
- #ReceivablesStrike.LastModUser_ReceivablesStrike = GetLoginUserID();
- #ReceivablesStrike.Name_LastModUser = GetCurrentUser();
- #ReceivablesStrike.LastModDate_ReceivablesStrike = DateTimeNow();
- SetColumnDefaultValue("ReceivablesStrikeBills", "PayDate_ReceivablesStrikeBills", DBNull());
- UpdateForm(true, "");
- @Status = 3;
- </Modify>
- <SubmitButtonClick>
- <![CDATA[
- @sumMethod = 0;
- @sumBills = 0;
- @sumPrePayValue = 0;
- @SumMoneyPerGet =0;
- @SumMoney = 0;
- @SumStrike = 0;
- if (tbCustomerNo.CValue == "" || !Search("SearchCustomerWithNo", #ReceivablesStrike.No_Customer))
- {
- MessageBox("请输入有效的客户,回车以示确认!",@Title);
- tbCustomerNo.Focus();
- return;
- }
- else
- {
- SuspendLayout();
- for (@V=0;@V<RowCount("#ReceivablesStrikeMethod");@V++)
- {
- SetPosition("#ReceivablesStrikeMethod", @V);
- if (Search("SearchNoAssessorPreGet",tbCustomerNo.CValue))
- {
- MessageBox("有未审核的收款单号,请重新填单!");
- tbCustomerNo.Text = "";
- return;
- }
- if(Search("SearchISDelete",tbCustomerNo.CValue,#ReceivablesStrikeMethod.No_PreGet))
- {
- if(#ISDelete.No_PreGet==0)
- {
- MessageBox("有不存在的收款单号,请重新填单!");
- tbCustomerNo.Text = "";
- return;
- }
- }
- }
- ResumeLayout();
- }
- if (!cbReceiver.CheckSelectedItem())
- {
- MessageBox("请选择有效的收款人!",@Title);
- cbReceiver.Focus();
- return;
- }
- if (#ReceivablesStrike.PrePayBalance_Customer < SumOfCol("#ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod", "Type_ReceivablesStrikeMethod = '冲减预收款'", false))
- {
- MessageBox("该客户的预收帐款余额不得小于此次冲账所使用的金额!",@Title);
- dgReceiveMoney.Focus();
- tbDetail.SelectedIndex = 0;
- return;
- }
- if (cbPrev.Checked)
- {
- if(Search("SearchCustomerWithNo", #ReceivablesStrike.No_Customer))
- {
- SuspendLayout();
- for (@a=0;@a<RowCount("#ReceivablesStrikeBills");@a++)
- {
- SetPosition("#ReceivablesStrikeBills", @a);
- #ReceivablesStrikeBills.Strike_ReceivablesStrikeBills = 0;
- }
- for (@b=0;@b<RowCount("#ReceivablesStrikeMethod");@b++)
- {
- SetPosition("#ReceivablesStrikeMethod", @b);
-
- #ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod = 0;
-
- }
- for (@i =0;@i<RowCount("#ReceivablesStrikeMethod");@i++)
- {
- SetPosition("#ReceivablesStrikeMethod", @i);
- @SumMoney += #ReceivablesStrikeMethod.LeaveAmount_ReceivablesStrikeMethod;
- }
-
- @SumMoneyPerGet += #Customer.OpeningToGetBalance_Customer;
- for (@l =0;@l<RowCount("#ReceivablesStrikeBills");@l++)
- {
- SetPosition("#ReceivablesStrikeBills", @l);
-
- @SumMoneyPerGet += #ReceivablesStrikeBills.ToGetAmount_ReceivablesStrikeBills;
- }
- if (@SumMoney > @SumMoneyPerGet)
- {
- @SumStrike = @SumMoneyPerGet;
- }
- else
- {
- @SumStrike = @SumMoney;
- }
- for (@j=0;@j<RowCount("#ReceivablesStrikeBills");@j++)
- {
- SetPosition("#ReceivablesStrikeBills", @j);
- @SumMoneyPerGet += #ReceivablesStrikeBills.ToGetAmount_ReceivablesStrikeBills;
- if (@SumStrike > 0)
- {
- if (@SumStrike >= #ReceivablesStrikeBills.ToGetAmount_ReceivablesStrikeBills)
- {
- #ReceivablesStrikeBills.Strike_ReceivablesStrikeBills = #ReceivablesStrikeBills.ToGetAmount_ReceivablesStrikeBills;
- }
- else
- {
- #ReceivablesStrikeBills.Strike_ReceivablesStrikeBills = @SumStrike;
- }
- @SumStrike = @SumStrike - #ReceivablesStrikeBills.Strike_ReceivablesStrikeBills;
- }
- }
- if (@SumMoney > @SumMoneyPerGet)
- {
- @SumStrike = @SumMoneyPerGet;
- }
- else
- {
- @SumStrike = @SumMoney;
- }
-
- for (@k=0;@k<RowCount("#ReceivablesStrikeMethod");@k++)
- {
- SetPosition("#ReceivablesStrikeMethod", @k);
- if (@SumStrike > 0)
- {
- if (@SumStrike > #ReceivablesStrikeMethod.LeaveAmount_ReceivablesStrikeMethod)
- {
- #ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod = #ReceivablesStrikeMethod.LeaveAmount_ReceivablesStrikeMethod;
- }
- else
- {
- #ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod = @SumStrike;
- }
- @SumStrike = @SumStrike - #ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod;
- }
- }
-
- ResumeLayout();
- }
- }
-
- SuspendLayout();
- for (@i=0; @i<RowCount("#ReceivablesStrikeMethod"); @i=@i+1)
- {
- SetPosition("#ReceivablesStrikeMethod", @i);
- @sumMethod += #ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod;
- if (Equals(#ReceivablesStrikeMethod.ID_ReceivablesStrikeMethod,GuidEmpty()))
- #ReceivablesStrikeMethod.ID_ReceivablesStrikeMethod = NewGuid();
- #ReceivablesStrikeMethod.ID_ReceivablesStrike = #ReceivablesStrike.ID_ReceivablesStrike;
- }
- for (@i=0; @i<RowCount("#ReceivablesStrikeBills"); @i=@i+1)
- {
- SetPosition("#ReceivablesStrikeBills", @i);
- @sumBills += #ReceivablesStrikeBills.Strike_ReceivablesStrikeBills;
- if (Equals(#ReceivablesStrikeBills.ID_ReceivablesStrikeBills,GuidEmpty()))
- #ReceivablesStrikeBills.ID_ReceivablesStrikeBills = NewGuid();
- #ReceivablesStrikeBills.ID_ReceivablesStrike = #ReceivablesStrike.ID_ReceivablesStrike;
- }
- ResumeLayout();
- UpdateForm(false, "");
- SuspendLayout();
- for (@g=0; @g<RowCount("#ReceivablesStrikeMethod"); @g=@g+1)
- {
- SetPosition("#ReceivablesStrikeMethod", @g);
- @sumPrePayValue += #ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod;
- }
- ResumeLayout();
- if (cbPrev.Checked)
- {
- if(Search("SearchOpenging",tbCustomerNo.CValue))
- {
- if(#Customer.PrePayValue_Customer == #Customer.OpeningToGetBalance_Customer)
- {
- MessageBox("期初应收帐款已全部冲完,提交失败!",@Title);
- return;
- }
- }
- }
-
- if (@Status == 1)
- {
- #ReceivablesStrike.CreateDate_ReceivablesStrike = DateTimeNow();
- #ReceivablesStrike.No_ReceivablesStrike = New("#ReceivablesStrike.No_ReceivablesStrike", dtDate.CValue);
- }
- else if (@Status == 3)
- {
- #ReceivablesStrike.LastModDate_ReceivablesStrike = DateTimeNow();
- Update();
- }
- ChangeMode("View",#ReceivablesStrike.ID_Assessor);
- ]]>
- </SubmitButtonClick>
- <GetFromBill>
- <![CDATA[
- if(Search("SearchFromBillInInvoice",#ReceivablesStrikeBills.No_SaleInvoice))
- {
- if(Equals(#FromBill.ID_Assessor,DBNull()))
- {
- MessageBox("该销项发票未经审核!",@Title);
- return;
- }
- else if(#FromBill.Disable_SaleInvoice == true)
- {
- MessageBox("该销项发票已作废!",@Title);
- return;
- }
- else if(#FromBill.Amount_SaleInvoice == #FromBill.StrikedAmount_SaleInvoice)
- {
- MessageBox("该销项发票金额已全部冲减完毕!",@Title);
- return;
- }
-
- #ReceivablesStrikeBills.No_Invoice=#FromBill.No_Invoice;
- #ReceivablesStrikeBills.PayDate_ReceivablesStrikeBills=#FromBill.PayDate_SaleInvoice;
- #ReceivablesStrikeBills.Amount_FromBill=#FromBill.Amount_SaleInvoice;
- #ReceivablesStrikeBills.StrikedAmount_ReceivablesStrikeBills=#FromBill.StrikedAmount_SaleInvoice;
- #ReceivablesStrikeBills.ToGetAmount_ReceivablesStrikeBills=#FromBill.Amount_SaleInvoice-#FromBill.StrikedAmount_SaleInvoice;
-
- }
- else
- {
- MessageBox("该销项发票不存在!",@Title);
- return;
- }
- ]]>
- </GetFromBill>
- <CountSum>
- <![CDATA[
- txtSum.CValue=SumOfCol("#ReceivablesStrikeBills.Strike_ReceivablesStrikeBills");
- ]]>
- </CountSum>
- <Verify>
- <![CDATA[
- UpdateForm(false, "");
- if (!Search("SearchCustomerWithNo", tbCustomerNo.CValue) || !Equals(#ReceivablesStrike.ID_Customer,#Customer.ID_Customer))
- {
- MessageBox("请输入有效的客户编号,并按回车确认!",@Title);
- tbCustomerNo.Focus();
- return;
- }
- if(!cbReceiver.CheckSelectedItem())
- {
- MessageBox("请选择有效的收款人!",@Title);
- cbReceiver.Focus();
- tbDetail.SelectedIndex = 0;
- return;
- }
- if (RowCount("#ReceivablesStrikeMethod") == 0)
- {
- MessageBox("收款方式及收款金额列表不能为空!",@Title);
- tbDetail.SelectedIndex = 0;
- dgReceiveMoney.Focus();
- return;
- }
- if (!cbPrev.Checked && RowCount("#ReceivablesStrikeBills") == 0)
- {
- MessageBox("冲帐单据列表不能为空!",@Title);
- tbDetail.SelectedIndex = 1;
- dgBill.Focus();
- return;
- }
- SuspendLayout();
- for (@i=0; @i<RowCount("#ReceivablesStrikeMethod"); @i=@i+1)
- {
- SetPosition("#ReceivablesStrikeMethod", @i);
- if (#ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod < 0)
- {
- MessageBox("收款金额不得小于0!",@Title);
- tbDetail.SelectedIndex = 0;
- dgReceiveMoney.Focus();
- ResumeLayout();
- dgReceiveMoney.CurrentRowIndex = @i;
- return;
- }
- }
- @AllStrikeAmount = SumOfCol("#ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod");
- if (@AllStrikeAmount == 0)
- {
- MessageBox("本次入帐金额不得为0!",@Title);
- dgReceiveMoney.Focus();
- ResumeLayout();
- tbDetail.SelectedIndex = 0;
- return;
- }
- for (@i=0; @i<RowCount("#ReceivablesStrikeBills"); @i=@i+1)
- {
- SetPosition("#ReceivablesStrikeBills", @i);
- if (Equals(#ReceivablesStrike.Prev_ReceivablesStrike, false))
- {
- if (Equals(#ReceivablesStrikeBills.No_SaleInvoice, ""))
- {
- MessageBox("请填入销项发票单号!",@Title);
- dgBill.Focus();
- ResumeLayout();
- tbDetail.SelectedIndex = 1;
- dgBill.CurrentRowIndex = @i;
- return;
- }
- if(Search("SearchFromBillInInvoice",#ReceivablesStrikeBills.No_SaleInvoice))
- {
- if(Equals(#FromBill.ID_Assessor,DBNull()))
- {
- MessageBox("该销项发票未经审核!",@Title);
- dgBill.Focus();
- ResumeLayout();
- tbDetail.SelectedIndex = 1;
- dgBill.CurrentRowIndex = @i;
- return;
- }
- else if(#FromBill.Disable_SaleInvoice==1)
- {
- MessageBox("该销项发票已作废!",@Title);
- dgBill.Focus();
- ResumeLayout();
- tbDetail.SelectedIndex = 1;
- dgBill.CurrentRowIndex = @i;
- return;
- }
- else if(#FromBill.Amount_SaleInvoice == #FromBill.StrikedAmount_SaleInvoice)
- {
- MessageBox("该销项发票金额已全部冲减完毕!",@Title);
- dgBill.Focus();
- ResumeLayout();
- tbDetail.SelectedIndex = 1;
- dgBill.CurrentRowIndex = @i;
- return;
- }
- else if(!Equals(#FromBill.ID_Customer,#ReceivablesStrike.ID_Customer))
- {
- MessageBox("该销项发票的客户与本单据的客户不一致!",@Title);
- dgBill.Focus();
- ResumeLayout();
- tbDetail.SelectedIndex = 1;
- dgBill.CurrentRowIndex = @i;
- return;
- }
- }
- else
- {
- MessageBox("该销项发票不存在!",@Title);
- dgBill.Focus();
- ResumeLayout();
- tbDetail.SelectedIndex = 1;
- dgBill.CurrentRowIndex = @i;
- return;
- }
- }
- if (#ReceivablesStrikeBills.Discount_ReceivablesStrikeBills * #ReceivablesStrikeBills.Amount_FromBill < 0)
- {
- MessageBox("本次折让金额错误!",@Title);
- dgBill.Focus();
- ResumeLayout();
- tbDetail.SelectedIndex = 1;
- dgBill.CurrentRowIndex = @i;
- return;
- }
- if (#ReceivablesStrikeBills.Strike_ReceivablesStrikeBills*#ReceivablesStrikeBills.Amount_FromBill < 0)
- {
- MessageBox("本次冲帐金额错误!",@Title);
- dgBill.Focus();
- ResumeLayout();
- tbDetail.SelectedIndex = 1;
- dgBill.CurrentRowIndex = @i;
- return;
- }
-
- if ((#ReceivablesStrikeBills.ToGetAmount_ReceivablesStrikeBills - #ReceivablesStrikeBills.Strike_ReceivablesStrikeBills )*#ReceivablesStrikeBills.ToGetAmount_ReceivablesStrikeBills < 0)
- {
- MessageBox("本次冲帐不得大于本次应收!",@Title);
- dgBill.Focus();
- ResumeLayout();
- tbDetail.SelectedIndex = 1;
- dgBill.CurrentRowIndex = @i;
- return;
- }
- }
- ResumeLayout();
- if (SumOfCol("#ReceivablesStrikeMethod.Amount_ReceivablesStrikeMethod")!=SumOfCol("#ReceivablesStrikeBills.Strike_ReceivablesStrikeBills"))
- {
- MessageBox("本次冲帐金额和入帐金额不相等!",@Title);
- dgBill.Focus();
- tbDetail.SelectedIndex = 1;
- return;
- }
- ]]>
- </Verify>
- </Lables>
- </Form>
- </Forms>
|