1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224 |
- <?xml version="1.0" encoding="utf-8" ?>
- <Forms>
- <Form Name="FrmInventoryChangeBill">
- <Client>
- <Events>
- <Load>
- <![CDATA[
- @SetFlag=1;
- @SetFlag1=1;
- @Title="库存异动作业";
- GetSchema();
- Search("SearchType");
- Search("SearchChangedDepot");
- Search("SearchCurrency");
- Search("SearchOneLocation","p");
-
- Search("SearchFromProduct",4,"p","p");
- Search("SearchProductWithNo","p");
- Search("SearchLocationByNo","p");
-
-
- @SysCurrency=#Currency.SysCurrency_SystemSetting;
- dgProduct.ColumnVisibleByColumnName("UnitPrice_ModifyDepotBillProduct",true);
- dgProduct.ColumnVisibleByColumnName("ProductMoney_FromBillProduct",true);
- lbSum.Visible = GetFieldRight(@Title,"成本及总价","查看");
- ntbAmount.Visible = GetFieldRight(@Title,"成本及总价","查看");
- ChangeMode("Search");
- dgProduct.NoMember="No_ModifyDepotBillProduct";
- Search("SearchSourceBillName");
- ]]>
- </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="timeChange" DataSource="ModifyDepotBill.Date_ModifyDepotBill" />
- <IKTextButton name="tbNo" DataSource="ModifyDepotBill.No_ModifyDepotBill">
- <Events>
- <Enter>
- <![CDATA[
- if(tbNo.ReadOnly == false)
- {
- if(tbNo.CValue != StringEmpty())
- {
- UpdateForm(false, "");
- if(Search("SearchModifyDepotBillWithNo", tbNo.CValue))
- ChangeMode("View");
- else
- MessageBox("该单据不存在!",@Title);
- }
- else
- MessageBox("请输入编号",@Title);
- }
- ]]>
- </Enter>
- <Click>
- ShowSearchBox("BillSearch","HAVEDEPOT", "tbNo",tbNo.CValue);
- </Click>
- </Events>
- </IKTextButton>
- <!--ChangedDepot_ModifyDepotBill is New Field By Sql -->
- <IKComboBoxEx name="cbDepot" DisplaySource="ModifyDepotBill.ChangedDepot_ModifyDepotBill" NoSource="ModifyDepotBill.ChangedDepotNo_ModifyDepotBill"
- ValueSource="ModifyDepotBill.ID_Location" DataSource="ChangeDepot" DisplayMember="Name_location"
- NoMember="No_Location" ValueMember="ID_Location">
- <Events>
- <Reload>
- UpdateForm(false, "cbDepot");
- Search("SearchChangedDepot");
- UpdateForm(true, "cbDepot");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <!--ModifyDepotBill_ModifyDepotBill is New Field By Sql -->
- <IKComboBoxEx name="cbType" DisplaySource="ModifyDepotBill.ModifyDepotBill_ModifyDepotBill" ValueSource="ModifyDepotBill.Style_ModifyDepotBill"
- DataSource="ModifyTypeSettings" DisplayMember="ModName_ModifyTypeSettings" ValueMember="ID_ModifyTypeSettings">
- <Events>
- <Reload>
- UpdateForm(false, "cbType");
- Search("SearchType");
- UpdateForm(true, "cbType");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKTextBox name="txtSource" DataSource="ModifyDepotBill.Source_ModifyDepotBill" />
- <IKComboBoxEx name="cbCurrency" DisplaySource="ModifyDepotBill.Currency_ModifyDepotBill" DataSource="ModifyDepotBill" />
- <!--Proposer_ModifyDepotBill is New Field By Sql -->
- <IKComboBoxEx name="cbProposer" DisplaySource="ModifyDepotBill.Proposer_ModifyDepotBill" NoSource="ModifyDepotBill.ProposerNo_ModifyDepotBill"
- ValueSource="ModifyDepotBill.ID_Proposer" DataSource="Proposer" DisplayMember="Name_Employee"
- NoMember="No_Employee" ValueMember="ID_Employee">
- <Events>
- <Reload>
- UpdateForm(false, "cbProposer");
- Search("SearchProposer");
- UpdateForm(true, "cbProposer");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <!--Maker_ModifyDepotBill is New Field By Sql -->
- <IKTextBox name="txtMaker" DataSource="ModifyDepotBill.Maker_ModifyDepotBill" />
- <!--Assessor_ModifyDepotBill is New Field By Sql -->
- <IKTextBox name="txtAudi" DataSource="ModifyDepotBill.Assessor_ModifyDepotBill" />
- <IKDateTimeText name="dttAudiDate" DataSource="ModifyDepotBill.AssessDate_ModifyDepotBill" />
- <!--lastmoduser_ModifyDepotBill is New Field By Sql -->
- <IKTextBox name="txtlastmoduser" DataSource="ModifyDepotBill.lastModflyuser_ModifyDepotBill" />
- <IKDateTimeText name="dttlastmoddate" DataSource="ModifyDepotBill.LastModDate_ModifyDepotBill" />
- <IKTextBox name="txtComment" DataSource="ModifyDepotBill.Comment_ModifyDepotBill" />
-
- <IKButton name="btnDelete">
- <Events>
- <Click>
- BeginUnAudit();
- #ModifyDepotBill.ID_Assessor = DBNull();
- #ModifyDepotBill.Assessor_ModifyDepotBill = "";
- #ModifyDepotBill.Disable_ModifyDepotBill=true;
- UnAudit(false);
- ChangeMode("View");
- EndUnAudit();
- <Lable name="CountSum" />
- </Click>
- </Events>
- </IKButton>
-
- <IKDataGridEx name="dgProduct" DataSource="ModifyDepotBillProduct" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="ModifyDepotBillProduct.No_ModifyDepotBillProduct" />
- <DataColumn Index="1" DataSource="ModifyDepotBillProduct.SourceBillName_ModifyDepotBillProduct"> <!--SourceBillName_ModifyDepotBillProduct is New Field By Sql -->
- <IKDataGridComboBoxColumn DisplaySourceEx="ModifyDepotBillProduct.SourceBillName_ModifyDepotBillProduct" ValueSourceEx="ModifyDepotBillProduct.Type_FromBill"
- DataSourceEx="BillType" DisplayMemberEx="Name_BillType" ValueMemberEx="Value_BillType">
- <Events>
- <Reload>
- Search("SearchSourceBillName");
- SetDataGridColumnDataSource(1,"dgProduct");
- </Reload>
- </Events>
- </IKDataGridComboBoxColumn>
- </DataColumn>
- <DataColumn Index="2" DataSource="ModifyDepotBillProduct.No_FromBill" />
- <DataColumn Index="3" DataSource="ModifyDepotBillProduct.No_FromBillProduct" />
- <DataColumn Index="4" DataSource="ModifyDepotBillProduct.ProductNo_FromBillProduct">
- <IKDataGridTextButtonColumn>
- <Events>
- <Click>
- @SetFlag=1;
- ShowSearchBox("ProductSearch","INFOMATION",#ModifyDepotBillProduct.ProductNo_FromBillProduct);
- </Click>
- <SetFlagBeforeClick>
- @SetFlag=0;
- </SetFlagBeforeClick>
- </Events>
- </IKDataGridTextButtonColumn>
- </DataColumn> <!--ProductNo_FromBillProduct is New Field By Sql -->
- <DataColumn Index="5" DataSource="ModifyDepotBillProduct.ProductName_FromBillProduct" /> <!--ProductName_FromBillProduct is New Field By Sql -->
- <DataColumn Index="6" DataSource="ModifyDepotBillProduct.Quantity_ModifyDepotBillProduct" />
- <DataColumn Index="7" DataSource="ModifyDepotBillProduct.ProductUnit_FromBillProduct" /> <!--ProductUnit_FromBillProduct is New Field By Sql -->
- <DataColumn Index="8" DataSource="ModifyDepotBillProduct.UnitPrice_ModifyDepotBillProduct" />
- <DataColumn Index="9" DataSource="ModifyDepotBillProduct.ProductMoney_FromBillProduct" /> <!--ProductMoney_FromBillProduct is New Field By Sql -->
- <DataColumn Index="10" DataSource="ModifyDepotBillProduct.No_Location">
- <IKDataGridTextButtonColumn>
- <Events>
- <Click>
- @SetFlag=1;
- @LocationNo = ShowSearchBox("LocationSearch","INFOMATION",#ModifyDepotBillProduct.No_Location);
- if(@LocationNo != "")
- #ModifyDepotBillProduct.No_Location = @LocationNo;
- </Click>
- <SetFlagBeforeClick>
- @SetFlag=0;
- </SetFlagBeforeClick>
- </Events>
- </IKDataGridTextButtonColumn>
- </DataColumn>
- <DataColumn Index="11" DataSource="ModifyDepotBillProduct.Name_Location" />
- <DataColumn Index="12" DataSource="ModifyDepotBillProduct.Comment_ModifyDepotBillProduct" />
- </IKDataGridEx>
- <!--Sum_ModifyDepotBill is New Field By Sql -->
- <IKTextBox name="ntbSum" DataSource="ModifyDepotBill.Sum_ModifyDepotBill" />
- <IKTextBox name="ntbAmount" DataSource="ModifyDepotBill.Amount_ModifyDepotBill" />
- <IKFormToolBar name="toolBar">
- <Events>
- <ClickFirst>
- if(Search("SearchModifyDepotBillFirst", tbNo.CValue))
- {
- ChangeMode("View");
- }
- </ClickFirst>
- <ClickPrev>
- if(Search("SearchModifyDepotBillPrevious", tbNo.CValue))
- {
- ChangeMode("View");
- }
- </ClickPrev>
- <ClickNext>
- if(Search("SearchModifyDepotBillNext", tbNo.CValue))
- {
- ChangeMode("View");
- }
- </ClickNext>
- <ClickLast>
- if(Search("SearchModifyDepotBillLast", tbNo.CValue))
- {
- ChangeMode("View");
- }
- </ClickLast>
- <ClickNew>
- ChangeMode("New");
- </ClickNew>
- <ClickEmpty>
- ChangeMode("Search");
- </ClickEmpty>
- <ClickSubmit>
- <Lable name="SubmitButtonClick" />
- </ClickSubmit>
- <ClickModify>
- ChangeMode("Modify");
- </ClickModify>
- <ClickDelete>
- Delete(); ChangeMode("Search");
- </ClickDelete>
- <ClickPrint>
- ShowPrintBox("BillSearch",#ModifyDepotBill.No_ModifyDepotBill,#ModifyDepotBill.No_ModifyDepotBill,GetFieldRight(@Title,"成本及总价","查看"));
- </ClickPrint>
- <ClickAudit>
- <Lable name="AuditButtonClick" />
- </ClickAudit>
- <ClickUnAudit>
- <Lable name="UnAuditButtonClick" />
- </ClickUnAudit>
- <ClickImport>
- ;
- </ClickImport>
- <ClickExport>
- ;
- </ClickExport>
- <ClickClose>
- ;
- </ClickClose>
- <ClickExpand>
- if(toolBar.ExpandForm==true)
- {
- pnRight.Visible=true;<!--PanelRight is not existed-->
- }
- else
- {
- pnRight.Visible=false;
- }
- </ClickExpand>
- <ClickImportItem>
- <![CDATA[
- if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="销售退货单")
- {
- if(Search("SearchContr"))
- {
- if(ShowSearchBox("ImportSaleRtnBillControl","BILLCONVERT","#ModifyDepotBillProduct.Type_FromBill",22,"#ModifyDepotBillProduct.SourceBillName_ModifyDepotBillProduct","销售退货单"))
- {
- Search("SearchType");
- cbType.Text = "销退入库";
- }
- }
- else
- {
- if(ShowSearchBox("ImportSaleRtnBillUnControl","BILLCONVERT"))
- {
- Search("SearchType");
- cbType.Text = "销退入库";
- }
- }
- }
- else if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="盘库作业")
- {
- if(cbType.Text=="盘盈"||cbType.Text=="盘亏")
- {
- if(cbType.Text=="盘盈")
- ShowSearchBox("ImportStocktakingBillControl1","BILLCONVERT","#ModifyDepotBillProduct.Type_FromBill",4,"#ModifyDepotBillProduct.SourceBillName_ModifyDepotBillProduct","盘库单");
- else
- ShowSearchBox("ImportStocktakingBillControl2","BILLCONVERT","#ModifyDepotBillProduct.Type_FromBill",4,"#ModifyDepotBillProduct.SourceBillName_ModifyDepotBillProduct","盘库单");
- }
- else
- {
- MessageBox("请选择合理的库存异动类型!",@Title);
- return;
- }
-
- }
- else if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="本单据")
- {
- @importing=true;
- ShowSearchBox("BillSearch","INFOMATIONCOPYHAVEDEPOT","SearchModifyDepotBillWithNo",false,"#ModifyDepotBill.ID_ModifyDepotBill","#ModifyDepotBill.No_ModifyDepotBill","#ModifyDepotBill.Date_ModifyDepotBill","#ModifyDepotBill.ID_Assessor","#ModifyDepotBill.Assessor_ModifyDepotBill","#ModifyDepotBill.LastModUser_ModifyDepotBill","#ModifyDepotBill.Maker_ModifyDepotBill","#ModifyDepotBill.ID_Creator","#ModifyDepotBillProduct.ID_ModifyDepotBillProduct");
- @importing=false;
- }
- ]]>
- <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
- </ClickImportItem>
- <ClickExportItem>
- ;
- <!--初始化目标数据-->
- <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
- </ClickExportItem>
- </Events>
- </IKFormToolBar>
- </Controls>
- <Tables>
- <Table name="ModifyDepotBillProduct">
- <Events>
- <RowDeleted>
- <![CDATA[
- #ModifyDepotBill.Sum_ModifyDepotBill = SumOfCol("#ModifyDepotBillProduct.Quantity_ModifyDepotBillProduct");
- #ModifyDepotBill.Amount_ModifyDepotBill = SumOfCol("#ModifyDepotBillProduct.ProductMoney_FromBillProduct");
- UpdateForm(true, "ntbSum");
- UpdateForm(true, "ntbAmount");
- ]]>
- </RowDeleted>
- <ColumnsChanged>
- <SourceBillName_ModifyDepotBillProduct>
- <![CDATA[
- if(!Equals(#ModifyDepotBillProduct.No_FromBill,"")&&!Equals(#ModifyDepotBillProduct.No_FromBill,DBNull())&&!Equals(#ModifyDepotBillProduct.No_FromBillProduct,"")&&!Equals(#ModifyDepotBillProduct.No_FromBillProduct,DBNull()))
- {
- if(#ModifyDepotBillProduct.SourceBillName_ModifyDepotBillProduct == "销售退货单")
- #ModifyDepotBillProduct.Type_FromBill = 22;
- if(!Equals(#ModifyDepotBillProduct.Type_FromBill,0)&&!Equals(#ModifyDepotBillProduct.Type_FromBill,DBNull()))
- {
- if(Search("SearchFromProduct",#ModifyDepotBillProduct.Type_FromBill,#ModifyDepotBillProduct.No_FromBill,#ModifyDepotBillProduct.No_FromBillProduct))
- {
-
- #ModifyDepotBillProduct.ProductNo_FromBillProduct=#FromProduct.No_Product;
- #ModifyDepotBillProduct.ProductName_FromBillProduct=#FromProduct.Name_Product;
- #ModifyDepotBillProduct.ProductUnit_FromBillProduct=#FromProduct.Unit_Product;
- #ModifyDepotBillProduct.ID_Product=#FromProduct.ID_Product;
- #ModifyDepotBillProduct.Quantity_ModifyDepotBillProduct=#FromProduct.Quantity_FromBillProduct;
- #ModifyDepotBillProduct.UnitPrice_ModifyDepotBillProduct=#FromProduct.UnitPrice_FromBillProduct;
- if(Equals(#ModifyDepotBillProduct.Type_FromBill,21))
- #ModifyDepotBillProduct.Comment_ModifyDepotBillProduct="";
- else
- #ModifyDepotBillProduct.Comment_ModifyDepotBillProduct=#FromProduct.Comment_FromBillProduct;
- #ModifyDepotBillProduct.ProductMoney_FromBillProduct=#FromProduct.ProductMoney_FromBillProduct;
- #ModifyDepotBill.Sum_ModifyDepotBill = SumOfCol("#ModifyDepotBillProduct.Quantity_ModifyDepotBillProduct");
- #ModifyDepotBill.Amount_ModifyDepotBill = SumOfCol("#ModifyDepotBillProduct.ProductMoney_FromBillProduct");
- if( Search("SearchOneLocation",#FromProduct.No_Product))
- {
- #ModifyDepotBillProduct.No_Location = #OneLocation.No_Location;
- #ModifyDepotBillProduct.Name_Location = #OneLocation.Name_Location;
- #ModifyDepotBillProduct.ID_Location = #OneLocation.ID_Location;
- }
- UpdateForm(true, "ntbSum");
- UpdateForm(true, "ntbAmount");
- }
- }
- }
- ]]>
- </SourceBillName_ModifyDepotBillProduct>
- <No_FromBill>
- <![CDATA[
- if(!Equals(#ModifyDepotBillProduct.No_FromBill,"")&&!Equals(#ModifyDepotBillProduct.No_FromBill,DBNull())&&!Equals(#ModifyDepotBillProduct.No_FromBillProduct,"")&&!Equals(#ModifyDepotBillProduct.No_FromBillProduct,DBNull()))
- {
- if(#ModifyDepotBillProduct.SourceBillName_ModifyDepotBillProduct == "销售退货单")
- #ModifyDepotBillProduct.Type_FromBill = 22;
- if(!Equals(#ModifyDepotBillProduct.Type_FromBill,0)&&!Equals(#ModifyDepotBillProduct.Type_FromBill,DBNull()))
- {
- if(Search("SearchFromProduct",#ModifyDepotBillProduct.Type_FromBill,#ModifyDepotBillProduct.No_FromBill,#ModifyDepotBillProduct.No_FromBillProduct))
- {
-
- #ModifyDepotBillProduct.ProductNo_FromBillProduct=#FromProduct.No_Product;
- #ModifyDepotBillProduct.ProductName_FromBillProduct=#FromProduct.Name_Product;
- #ModifyDepotBillProduct.ProductUnit_FromBillProduct=#FromProduct.Unit_Product;
- #ModifyDepotBillProduct.ID_Product=#FromProduct.ID_Product;
- #ModifyDepotBillProduct.Quantity_ModifyDepotBillProduct=#FromProduct.Quantity_FromBillProduct;
- #ModifyDepotBillProduct.UnitPrice_ModifyDepotBillProduct=#FromProduct.UnitPrice_FromBillProduct;
- if(Equals(#ModifyDepotBillProduct.Type_FromBill,21))
- #ModifyDepotBillProduct.Comment_ModifyDepotBillProduct="";
- else
- #ModifyDepotBillProduct.Comment_ModifyDepotBillProduct=#FromProduct.Comment_FromBillProduct;
- #ModifyDepotBillProduct.ProductMoney_FromBillProduct=#FromProduct.ProductMoney_FromBillProduct;
- #ModifyDepotBill.Sum_ModifyDepotBill = SumOfCol("#ModifyDepotBillProduct.Quantity_ModifyDepotBillProduct");
- #ModifyDepotBill.Amount_ModifyDepotBill = SumOfCol("#ModifyDepotBillProduct.ProductMoney_FromBillProduct");
- if(Search("SearchOneLocation",#FromProduct.No_Product))
- {
- #ModifyDepotBillProduct.Name_Location = #OneLocation.Name_Location;
- #ModifyDepotBillProduct.No_Location = #OneLocation.No_Location;
- #ModifyDepotBillProduct.ID_Location = #OneLocation.ID_Location;
- }
- UpdateForm(true, "ntbSum");
- UpdateForm(true, "ntbAmount");
- }
- }
- }
- ]]>
- </No_FromBill>
- <No_FromBillProduct>
- <![CDATA[
- if(!Equals(#ModifyDepotBillProduct.No_FromBill,"")&&!Equals(#ModifyDepotBillProduct.No_FromBill,DBNull())&&!Equals(#ModifyDepotBillProduct.No_FromBillProduct,"")&&!Equals(#ModifyDepotBillProduct.No_FromBillProduct,DBNull()))
- {
- if(#ModifyDepotBillProduct.SourceBillName_ModifyDepotBillProduct == "销售退货单")
- #ModifyDepotBillProduct.Type_FromBill = 22;
- if(!Equals(#ModifyDepotBillProduct.Type_FromBill,0)&&!Equals(#ModifyDepotBillProduct.Type_FromBill,DBNull()))
- {
- if(Search("SearchFromProduct",#ModifyDepotBillProduct.Type_FromBill,#ModifyDepotBillProduct.No_FromBill,#ModifyDepotBillProduct.No_FromBillProduct))
- {
-
- #ModifyDepotBillProduct.ProductNo_FromBillProduct=#FromProduct.No_Product;
- #ModifyDepotBillProduct.ProductName_FromBillProduct=#FromProduct.Name_Product;
- #ModifyDepotBillProduct.ProductUnit_FromBillProduct=#FromProduct.Unit_Product;
- #ModifyDepotBillProduct.ID_Product=#FromProduct.ID_Product;
- #ModifyDepotBillProduct.Quantity_ModifyDepotBillProduct=#FromProduct.Quantity_FromBillProduct;
- #ModifyDepotBillProduct.UnitPrice_ModifyDepotBillProduct=#FromProduct.UnitPrice_FromBillProduct;
- if(Equals(#ModifyDepotBillProduct.Type_FromBill,21))
- #ModifyDepotBillProduct.Comment_ModifyDepotBillProduct="";
- else
- #ModifyDepotBillProduct.Comment_ModifyDepotBillProduct=#FromProduct.Comment_FromBillProduct;
- #ModifyDepotBillProduct.ProductMoney_FromBillProduct=#FromProduct.ProductMoney_FromBillProduct;
- #ModifyDepotBill.Sum_ModifyDepotBill = SumOfCol("#ModifyDepotBillProduct.Quantity_ModifyDepotBillProduct");
- #ModifyDepotBill.Amount_ModifyDepotBill = SumOfCol("#ModifyDepotBillProduct.ProductMoney_FromBillProduct");
- if( Search("SearchOneLocation",#FromProduct.No_Product))
- {
- #ModifyDepotBillProduct.No_Location = #OneLocation.No_Location;
- #ModifyDepotBillProduct.Name_Location = #OneLocation.Name_Location;
- #ModifyDepotBillProduct.ID_Location = #OneLocation.ID_Location;
- }
- UpdateForm(true, "ntbSum");
- UpdateForm(true, "ntbAmount");
- }
- }
- }
- ]]>
- </No_FromBillProduct>
- <ProductNo_FromBillProduct>
- <![CDATA[
- if(@SetFlag==0)
- {
- return;
- }
- if (!Search("SearchProductWithNo",#ModifyDepotBillProduct.ProductNo_FromBillProduct))
- {
- #ModifyDepotBillProduct.ID_Product = DBNull();
- #ModifyDepotBillProduct.ProductName_FromBillProduct = "";
- #ModifyDepotBillProduct.ProductUnit_FromBillProduct = 0;
- #ModifyDepotBillProduct.UnitPrice_ModifyDepotBillProduct = 0;
- #ModifyDepotBillProduct.Quantity_ModifyDepotBillProduct = 0;
- MessageBox("该产品不存在!",@Title);
- @temp = ShowSearchBox("InPutSearchProduct","INFOMATION",#ModifyDepotBillProduct.ProductNo_FromBillProduct);
- if(@temp != "")
- {
- ResumeColumnEvent("#ModifyDepotBillProduct.ProductNo_FromBillProduct");
- #ModifyDepotBillProduct.ProductNo_FromBillProduct = @temp;
- ClearColumnEvent();
- }
- return;
- }
- else
- {
- if(!Equals(#Product.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
-
- #ModifyDepotBillProduct.ID_Product = #Product.ID_Product;
- #ModifyDepotBillProduct.ProductName_FromBillProduct = #Product.Name_Product;
- #ModifyDepotBillProduct.ProductUnit_FromBillProduct = #Product.Unit_Product;
- #ModifyDepotBillProduct.UnitPrice_ModifyDepotBillProduct = #Product.Cost_Product;
- #ModifyDepotBillProduct.ProductMoney_FromBillProduct = #ModifyDepotBillProduct.Quantity_ModifyDepotBillProduct * #ModifyDepotBillProduct.UnitPrice_ModifyDepotBillProduct;
- if( Search("SearchOneLocation",#ModifyDepotBillProduct.ProductNo_FromBillProduct))
- {
- #ModifyDepotBillProduct.No_Location = #OneLocation.No_Location;
- #ModifyDepotBillProduct.Name_Location = #OneLocation.Name_Location;
- #ModifyDepotBillProduct.ID_Location = #OneLocation.ID_Location;
- }
- }
- ]]>
- </ProductNo_FromBillProduct>
- <No_Location>
- if(@SetFlag1==0)
- {
- return;
- }
- if(#ModifyDepotBillProduct.No_Location != StringEmpty())
- {
- if(!Search("SearchLocationByNo",#ModifyDepotBillProduct.No_Location))
- {
- MessageBox("不存在此库位编号",@Title);
- #ModifyDepotBillProduct.ID_Location=GuidEmpty();
- #ModifyDepotBillProduct.Name_Location=StringEmpty();
- }
- else
- {
- #ModifyDepotBillProduct.ID_Location=#Location.ID_Location;
- #ModifyDepotBillProduct.Name_Location=#Location.Name_Location;
- }
- }
- </No_Location>
- <Quantity_ModifyDepotBillProduct>
- <![CDATA[
- #ModifyDepotBillProduct.ProductMoney_FromBillProduct = #ModifyDepotBillProduct.Quantity_ModifyDepotBillProduct * #ModifyDepotBillProduct.UnitPrice_ModifyDepotBillProduct;
- #ModifyDepotBill.Sum_ModifyDepotBill = SumOfCol("#ModifyDepotBillProduct.Quantity_ModifyDepotBillProduct");
- #ModifyDepotBill.Amount_ModifyDepotBill = SumOfCol("#ModifyDepotBillProduct.ProductMoney_FromBillProduct");
- UpdateForm(true, "ntbSum");
- UpdateForm(true, "ntbAmount");
- ]]>
- <Lable name="CountSum" />
- </Quantity_ModifyDepotBillProduct>
- <UnitPrice_ModifyDepotBillProduct>
- <![CDATA[
- #ModifyDepotBillProduct.ProductMoney_FromBillProduct = #ModifyDepotBillProduct.Quantity_ModifyDepotBillProduct * #ModifyDepotBillProduct.UnitPrice_ModifyDepotBillProduct;
- #ModifyDepotBill.Sum_ModifyDepotBill = SumOfCol("#ModifyDepotBillProduct.Quantity_ModifyDepotBillProduct");
- #ModifyDepotBill.Amount_ModifyDepotBill = SumOfCol("#ModifyDepotBillProduct.ProductMoney_FromBillProduct");
- UpdateForm(true, "ntbSum");
- UpdateForm(true, "ntbAmount");
- ]]>
- <Lable name="CountSum" />
- </UnitPrice_ModifyDepotBillProduct>
- </ColumnsChanged>
- </Events>
- </Table>
- </Tables>
- <LockInfomation LockID="ID_ModifyDepotBill" LockNO="No_ModifyDepotBill" LockSearchFunction="SearchModifyDepotBillWithNo"
- LockAudit="ID_Assessor" />
- <LogInfomation LogNO="#ModifyDepotBill.No_ModifyDepotBill" RecordFormField="" RecordDataGridField="#ModifyDepotBillProduct.ProductNo_FromBillProduct,#ModifyDepotBillProduct.No_FromBill,#ModifyDepotBillProduct.Quantity_ModifyDepotBillProduct,#ModifyDepotBillProduct.ProductMoney_FromBillProduct" />
- <ChildForms>
- <ChildForm name="BillSearch" DataSource="M" SearchFunction="SearchAllBill" SearchFunctionByNo="SearchModifyDepotBillWithNo">
- <DataColumn Index="0" MappingName="#M.No_ModifyDepotBill" HeaderText="库存异动作业单号" Width="90" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="1" MappingName="#M.Date_ModifyDepotBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="2" MappingName="#M.ModifyDepotBill_ModifyDepotBill" HeaderText="异动类型" Width="90" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="3" MappingName="#M.Proposer_ModifyDepotBill" HeaderText="异动申请人" Width="90"
- ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="4" MappingName="#M.Source_ModifyDepotBill" HeaderText="异动来源" Width="90" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="5" MappingName="#M.Comment_ModifyDepotBill" HeaderText="备注" Width="90" ColumnType="IKDataGridTextBoxColumn" />
- </ChildForm>
- <ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo=""
- MappingName="产品" ReturnDataSource="ModifyDepotBillProduct" ShowCheckBox="true">
- <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn"
- ReturnMappingName="#ModifyDepotBillProduct.ProductNo_FromBillProduct" />
- <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="2" MappingName="#Product.Type_Product" HeaderText="产品类型" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="3" MappingName="#Product.Price_Product" HeaderText="标准售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
- <DataColumn Index="4" MappingName="#Product.LowSalePrice_Product" HeaderText="最低售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
- <DataColumn Index="5" MappingName="#Product.SafetyQty_Product" HeaderText="安全存量" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="LocationSearch" DataSource="Location" SearchFunction="SearchAllLocation" SearchFunctionByNo="" MappingName="库位" ReturnDataSource="ModifyDepotBillProduct" ShowCheckBox="false">
- <DataColumn Index="0" MappingName="#Location.No_Location" HeaderText="库位编号" Width="120" ColumnType="IKDataGridTextBoxColumn" ReturnMappingName="#ModifyDepotBillProduct.No_Location" />
- <DataColumn Index="1" MappingName="#Location.Name_Location" HeaderText="库位名称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="InPutSearchProduct" DataSource="Product" SearchFunction="SearchAllProduct"
- SearchFunctionByNo="" MappingName="产品">
- <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="2" MappingName="#Product.Type_Product" HeaderText="产品类型" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="3" MappingName="#Product.Price_Product" HeaderText="标准售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
- <DataColumn Index="4" MappingName="#Product.LowSalePrice_Product" HeaderText="最低售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
- <DataColumn Index="5" MappingName="#Product.SafetyQty_Product" HeaderText="安全存量" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="ImportSaleRtnBillControl">
- <DataGridIndex DataSource="SaleRtnBill" SearchFunction="SearchAllSaleRtnBill" SearchFunctionByNo=""
- MappingName="" ReturnDataSource="ModifyDepotBillProduct">
- <DataColumn Index="0" MappingName="#SaleRtnBill.No_SaleRtnBill" HeaderText="单据编号" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#ModifyDepotBillProduct.No_FromBill" />
- <DataColumn Index="1" MappingName="#SaleRtnBill.Date_SaleRtnBill" HeaderText="制单日期" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="2" MappingName="#SaleRtnBill.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"
- ReturnPath="parent" />
- <DataColumn Index="3" MappingName="#SaleRtnBill.ShortName_Customer" HeaderText="客户简称" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="4" MappingName="#SaleRtnBill.State_SaleRtnBill" HeaderText="单据状态" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="5" MappingName="#SaleRtnBill.Name_Location" HeaderText="入库仓库" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#ModifyDepotBill.ChangedDepot_ModifyDepotBill" />
- </DataGridIndex>
- <DataGridIndex DataSource="SaleRtnBillProduct" SearchFunction="SearchAllSaleRtnBillProduct" SearchFunctionByNo=""
- MappingName="">
- <DataColumn Index="0" MappingName="#SaleRtnBillProduct.No_Product" HeaderText="产品编号" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="1" MappingName="#SaleRtnBillProduct.No_SaleRtnBillProduct" HeaderText="产品序号"
- Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#ModifyDepotBillProduct.No_FromBillProduct" />
- <DataColumn Index="2" MappingName="#SaleRtnBillProduct.Name_Product" HeaderText="产品名称" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="3" MappingName="#SaleRtnBillProduct.Quantity_SaleRtnBillProduct" HeaderText="数量"
- Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2" />
- <DataColumn Index="4" MappingName="#SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct" HeaderText="单价"
- Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2" />
- </DataGridIndex>
- </ChildForm>
- <ChildForm name="ImportSaleRtnBillUnControl">
- <DataGridIndex DataSource="SaleRtnBill" SearchFunction="SearchAllSaleRtnBill" SearchFunctionByNo=""
- MappingName="" ReturnDataSource="ModifyDepotBillProduct">
- <DataColumn Index="0" MappingName="#SaleRtnBill.No_SaleRtnBill" HeaderText="单据编号" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#ModifyDepotBillProduct.Comment_ModifyDepotBillProduct" />
- <DataColumn Index="1" MappingName="#SaleRtnBill.Date_SaleRtnBill" HeaderText="制单日期" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="2" MappingName="#SaleRtnBill.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"
- ReturnPath="parent" />
- <DataColumn Index="3" MappingName="#SaleRtnBill.ShortName_Customer" HeaderText="客户简称" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="4" MappingName="#SaleRtnBill.State_SaleRtnBill" HeaderText="单据状态" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="5" MappingName="#SaleRtnBill.Name_Location" HeaderText="入库仓库" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#ModifyDepotBill.ChangedDepot_ModifyDepotBill" />
- </DataGridIndex>
- <DataGridIndex DataSource="SaleRtnBillProduct" SearchFunction="SearchAllSaleRtnBillProduct" SearchFunctionByNo=""
- MappingName="">
- <DataColumn Index="0" MappingName="#SaleRtnBillProduct.No_Product" HeaderText="产品编号" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#ModifyDepotBillProduct.ProductNo_FromBillProduct" />
- <DataColumn Index="1" MappingName="#SaleRtnBillProduct.No_SaleRtnBillProduct" HeaderText="产品序号"
- Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="2" MappingName="#SaleRtnBillProduct.Name_Product" HeaderText="产品名称" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="3" MappingName="#SaleRtnBillProduct.Quantity_SaleRtnBillProduct" HeaderText="数量"
- Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2" />
- <DataColumn Index="4" MappingName="#SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct" HeaderText="单价"
- Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2" />
- </DataGridIndex>
- </ChildForm>
- <!--<ChildForm name="ImportStocktakingBillControl">
- <DataGridIndex DataSource="StocktakingBill" SearchFunction="SearchAllStocktakingBill" SearchFunctionByNo=""
- MappingName="" ReturnDataSource="ModifyDepotBillProduct">
- <DataColumn Index="0" MappingName="#StocktakingBill.No_StocktakingBill" HeaderText="单据编号" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#ModifyDepotBillProduct.No_FromBill" />
- <DataColumn Index="1" MappingName="#StocktakingBill.Date_StocktakingBill" HeaderText="制单日期"
- Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="2" MappingName="#StocktakingBill.State_StocktakingBill" HeaderText="单据状态"
- Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="5" MappingName="#StocktakingBill.Name_Location" HeaderText="盘点仓库" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#ModifyDepotBill.ChangedDepot_ModifyDepotBill" />
- </DataGridIndex>
- <DataGridIndex DataSource="StocktakingBillProduct" SearchFunction="SearchAllStocktakingBillProduct"
- SearchFunctionByNo="" MappingName="">
- <DataColumn Index="0" MappingName="#StocktakingBillProduct.No_Product" HeaderText="产品编号" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="1" MappingName="#StocktakingBillProduct.No_StocktakingBillProduct" HeaderText="产品序号"
- Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#ModifyDepotBillProduct.No_FromBillProduct" />
- <DataColumn Index="2" MappingName="#StocktakingBillProduct.Name_Product" HeaderText="产品名称" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="3" MappingName="#StocktakingBillProduct.Quantity_StocktakingBillProduct"
- HeaderText="数量" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2" />
- <DataColumn Index="4" MappingName="#StocktakingBillProduct.UnitPrice_StocktakingBillProduct"
- HeaderText="单价" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2" />
- </DataGridIndex>
- </ChildForm>-->
- <ChildForm name="ImportStocktakingBillControl1">
- <DataGridIndex DataSource="StocktakingBill" SearchFunction="SearchAllStocktakingBill1" SearchFunctionByNo=""
- MappingName="" ReturnDataSource="ModifyDepotBillProduct">
- <DataColumn Index="0" MappingName="#StocktakingBill.No_StocktakingBill" HeaderText="单据编号" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#ModifyDepotBillProduct.No_FromBill" />
- <DataColumn Index="1" MappingName="#StocktakingBill.Date_StocktakingBill" HeaderText="制单日期"
- Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="2" MappingName="#StocktakingBill.State_StocktakingBill" HeaderText="单据状态"
- Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="5" MappingName="#StocktakingBill.Name_Location" HeaderText="盘点仓库" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#ModifyDepotBill.ChangedDepot_ModifyDepotBill" />
- </DataGridIndex>
- <DataGridIndex DataSource="StocktakingBillProduct" SearchFunction="SearchAllStocktakingBillProduct1"
- SearchFunctionByNo="" MappingName="">
- <DataColumn Index="0" MappingName="#StocktakingBillProduct.No_Product" HeaderText="产品编号" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="1" MappingName="#StocktakingBillProduct.No_StocktakingBillProduct" HeaderText="产品序号"
- Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#ModifyDepotBillProduct.No_FromBillProduct" />
- <DataColumn Index="2" MappingName="#StocktakingBillProduct.Name_Product" HeaderText="产品名称" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="3" MappingName="#StocktakingBillProduct.Quantity_StocktakingBillProduct"
- HeaderText="数量" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2" />
- <DataColumn Index="4" MappingName="#StocktakingBillProduct.UnitPrice_StocktakingBillProduct"
- HeaderText="单价" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2" />
- </DataGridIndex>
- </ChildForm>
-
- <ChildForm name="ImportStocktakingBillControl2">
- <DataGridIndex DataSource="StocktakingBill" SearchFunction="SearchAllStocktakingBill2" SearchFunctionByNo=""
- MappingName="" ReturnDataSource="ModifyDepotBillProduct">
- <DataColumn Index="0" MappingName="#StocktakingBill.No_StocktakingBill" HeaderText="单据编号" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#ModifyDepotBillProduct.No_FromBill" />
- <DataColumn Index="1" MappingName="#StocktakingBill.Date_StocktakingBill" HeaderText="制单日期"
- Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="2" MappingName="#StocktakingBill.State_StocktakingBill" HeaderText="单据状态"
- Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="5" MappingName="#StocktakingBill.Name_Location" HeaderText="盘点仓库" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#ModifyDepotBill.ChangedDepot_ModifyDepotBill" />
- </DataGridIndex>
- <DataGridIndex DataSource="StocktakingBillProduct" SearchFunction="SearchAllStocktakingBillProduct2"
- SearchFunctionByNo="" MappingName="">
- <DataColumn Index="0" MappingName="#StocktakingBillProduct.No_Product" HeaderText="产品编号" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="1" MappingName="#StocktakingBillProduct.No_StocktakingBillProduct" HeaderText="产品序号"
- Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#ModifyDepotBillProduct.No_FromBillProduct" />
- <DataColumn Index="2" MappingName="#StocktakingBillProduct.Name_Product" HeaderText="产品名称" Width="90"
- ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" />
- <DataColumn Index="3" MappingName="#StocktakingBillProduct.Quantity_StocktakingBillProduct"
- HeaderText="数量" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2" />
- <DataColumn Index="4" MappingName="#StocktakingBillProduct.UnitPrice_StocktakingBillProduct"
- HeaderText="单价" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2" />
- </DataGridIndex>
- </ChildForm>
- </ChildForms>
- <ImportedInfo>
- Search("SearchType");
- cbType.Text = #ModifyDepotBill.ModifyDepotBill_ModifyDepotBill;
- Search("SearchChangedDepot");
- cbDepot.Text = #ModifyDepotBill.ChangedDepot_ModifyDepotBill;
- </ImportedInfo>
- </Client>
- <Server>
- <Tables>
- <Table name="ModifyDepotBill" Type="Parent">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 M.*,
- L.Name_Location AS ChangedDepot_ModifyDepotBill,
- L.No_Location AS ChangedDepotNo_ModifyDepotBill,
- MD.ModName_ModifyTypeSettings AS ModifyDepotBill_ModifyDepotBill,
- E.Name_Employee AS Proposer_ModifyDepotBill,
- E.No_Employee AS ProposerNo_ModifyDepotBill,
- A.Name_User AS Maker_ModifyDepotBill,
- A1.Name_User AS Assessor_ModifyDepotBill,
- A2.Name_User AS lastModflyuser_ModifyDepotBill,
- convert(decimal(18,2),0.00) AS Sum_ModifyDepotBill,
- convert(decimal(18,2),0.00) AS Amount_ModifyDepotBill
- FROM ModifyDepotBill M
- INNER JOIN LOCATION L ON M.ID_Location = L.ID_Location
- LEFT JOIN ModifyTypeSettings MD ON MD.ID_ModifyTypeSettings = M.Style_ModifyDepotBill
- INNER JOIN Employee E ON E.ID_Employee = M.ID_Proposer
- INNER JOIN AppUser A ON A.ID_User = M.ID_Creator
- LEFT JOIN AppUser A1 ON A1.ID_User = M.ID_Assessor
- LEFT JOIN AppUser A2 ON A2.ID_User = M.LastModUser_ModifyDepotBill" />
- <New CmdType="Text" CmdText="INSERT INTO ModifyDepotBill
- (ID_ModifyDepotBill, No_ModifyDepotBill, Date_ModifyDepotBill, ID_Location, Style_ModifyDepotBill, Currency_ModifyDepotBill, Source_ModifyDepotBill, ID_Proposer, ID_Creator, ID_Assessor, AssessDate_ModifyDepotBill, Comment_ModifyDepotBill, CreateDate_ModifyDepotBill, LastModUser_ModifyDepotBill, LastModDate_ModifyDepotBill, Amount_ModifyDepotBill)
- VALUES
- (@ID_ModifyDepotBill, @No_ModifyDepotBill, @Date_ModifyDepotBill, @ID_Location, @Style_ModifyDepotBill, @Currency_ModifyDepotBill, @Source_ModifyDepotBill, @ID_Proposer, @ID_Creator, @ID_Assessor, @AssessDate_ModifyDepotBill, @Comment_ModifyDepotBill, @CreateDate_ModifyDepotBill, @LastModUser_ModifyDepotBill, @LastModDate_ModifyDepotBill, @Amount_ModifyDepotBill)">
- <Params>
- <Param name="@ID_ModifyDepotBill" type="ModifyDepotBill.ID_ModifyDepotBill" sourceColumn="ID_ModifyDepotBill" />
- <Param name="@No_ModifyDepotBill" type="ModifyDepotBill.No_ModifyDepotBill" sourceColumn="No_ModifyDepotBill" />
- <Param name="@Date_ModifyDepotBill" type="ModifyDepotBill.Date_ModifyDepotBill" sourceColumn="Date_ModifyDepotBill" />
- <Param name="@ID_Location" type="ModifyDepotBill.ID_Location" sourceColumn="ID_Location" />
- <Param name="@Style_ModifyDepotBill" type="ModifyDepotBill.Style_ModifyDepotBill" sourceColumn="Style_ModifyDepotBill" />
- <Param name="@Currency_ModifyDepotBill" type="ModifyDepotBill.Currency_ModifyDepotBill"
- sourceColumn="Currency_ModifyDepotBill" />
- <Param name="@Source_ModifyDepotBill" type="ModifyDepotBill.Source_ModifyDepotBill" sourceColumn="Source_ModifyDepotBill" />
- <Param name="@ID_Proposer" type="ModifyDepotBill.ID_Proposer" sourceColumn="ID_Proposer" />
- <Param name="@ID_Creator" type="ModifyDepotBill.ID_Creator" sourceColumn="ID_Creator" />
- <Param name="@ID_Assessor" type="ModifyDepotBill.ID_Assessor" sourceColumn="ID_Assessor" />
- <Param name="@AssessDate_ModifyDepotBill" type="ModifyDepotBill.AssessDate_ModifyDepotBill"
- sourceColumn="AssessDate_ModifyDepotBill" />
- <Param name="@Comment_ModifyDepotBill" type="ModifyDepotBill.Comment_ModifyDepotBill" sourceColumn="Comment_ModifyDepotBill" />
- <Param name="@CreateDate_ModifyDepotBill" type="ModifyDepotBill.CreateDate_ModifyDepotBill"
- sourceColumn="CreateDate_ModifyDepotBill" />
- <Param name="@LastModUser_ModifyDepotBill" type="ModifyDepotBill.LastModUser_ModifyDepotBill"
- sourceColumn="LastModUser_ModifyDepotBill" />
- <Param name="@LastModDate_ModifyDepotBill" type="ModifyDepotBill.LastModDate_ModifyDepotBill"
- sourceColumn="LastModDate_ModifyDepotBill" />
- <Param name="@Amount_ModifyDepotBill" type="ModifyDepotBill.Amount_ModifyDepotBill" sourceColumn="Amount_ModifyDepotBill" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText="UPDATE ModifyDepotBill SET
- No_ModifyDepotBill = @No_ModifyDepotBill,
- Date_ModifyDepotBill = @Date_ModifyDepotBill,
- ID_Location = @ID_Location,
- Style_ModifyDepotBill = @Style_ModifyDepotBill,
- Currency_ModifyDepotBill = @Currency_ModifyDepotBill,
- Source_ModifyDepotBill = @Source_ModifyDepotBill,
- ID_Proposer = @ID_Proposer,
- ID_Creator = @ID_Creator,
- ID_Assessor = @ID_Assessor,
- AssessDate_ModifyDepotBill = @AssessDate_ModifyDepotBill,
- Comment_ModifyDepotBill = @Comment_ModifyDepotBill,
- CreateDate_ModifyDepotBill = @CreateDate_ModifyDepotBill,
- LastModUser_ModifyDepotBill = @LastModUser_ModifyDepotBill,
- LastModDate_ModifyDepotBill = @LastModDate_ModifyDepotBill,
- Amount_ModifyDepotBill = @Amount_ModifyDepotBill
- WHERE ID_ModifyDepotBill = @ID_ModifyDepotBill">
- <Params>
- <Param name="@ID_ModifyDepotBill" type="ModifyDepotBill.ID_ModifyDepotBill" sourceColumn="ID_ModifyDepotBill" />
- <Param name="@No_ModifyDepotBill" type="ModifyDepotBill.No_ModifyDepotBill" sourceColumn="No_ModifyDepotBill" />
- <Param name="@Date_ModifyDepotBill" type="ModifyDepotBill.Date_ModifyDepotBill" sourceColumn="Date_ModifyDepotBill" />
- <Param name="@ID_Location" type="ModifyDepotBill.ID_Location" sourceColumn="ID_Location" />
- <Param name="@Style_ModifyDepotBill" type="ModifyDepotBill.Style_ModifyDepotBill" sourceColumn="Style_ModifyDepotBill" />
- <Param name="@Currency_ModifyDepotBill" type="ModifyDepotBill.Currency_ModifyDepotBill"
- sourceColumn="Currency_ModifyDepotBill" />
- <Param name="@Source_ModifyDepotBill" type="ModifyDepotBill.Source_ModifyDepotBill" sourceColumn="Source_ModifyDepotBill" />
- <Param name="@ID_Proposer" type="ModifyDepotBill.ID_Proposer" sourceColumn="ID_Proposer" />
- <Param name="@ID_Creator" type="ModifyDepotBill.ID_Creator" sourceColumn="ID_Creator" />
- <Param name="@ID_Assessor" type="ModifyDepotBill.ID_Assessor" sourceColumn="ID_Assessor" />
- <Param name="@AssessDate_ModifyDepotBill" type="ModifyDepotBill.AssessDate_ModifyDepotBill"
- sourceColumn="AssessDate_ModifyDepotBill" />
- <Param name="@Comment_ModifyDepotBill" type="ModifyDepotBill.Comment_ModifyDepotBill" sourceColumn="Comment_ModifyDepotBill" />
- <Param name="@CreateDate_ModifyDepotBill" type="ModifyDepotBill.CreateDate_ModifyDepotBill"
- sourceColumn="CreateDate_ModifyDepotBill" />
- <Param name="@LastModUser_ModifyDepotBill" type="ModifyDepotBill.LastModUser_ModifyDepotBill"
- sourceColumn="LastModUser_ModifyDepotBill" />
- <Param name="@LastModDate_ModifyDepotBill" type="ModifyDepotBill.LastModDate_ModifyDepotBill"
- sourceColumn="LastModDate_ModifyDepotBill" />
- <Param name="@Amount_ModifyDepotBill" type="ModifyDepotBill.Amount_ModifyDepotBill" sourceColumn="Amount_ModifyDepotBill" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText="DELETE ModifyDepotBillProduct WHERE ID_ModifyDepotBill = @ID_ModifyDepotBill
- DELETE ModifyDepotBill WHERE ID_ModifyDepotBill = @ID_ModifyDepotBill">
- <Params>
- <Param name="@ID_ModifyDepotBill" type="ModifyDepotBill.ID_ModifyDepotBill" sourceColumn="ID_ModifyDepotBill" />
- </Params>
- </Delete>
- <Audit CmdType="Text" CmdText=" --DECLARE PARAS
- DECLARE @Style_ModifyDepotBill NVARCHAR(64) --input parameters异动类型
- DECLARE @Type_ModifyTypeSettings BIT --出入库类型
- DECLARE @Stock_ModifyTypeSettings BIT --影响财务库存
- DECLARE @Cost_ModifyTypeSettings BIT --影响成本
- DECLARE @SaleBackAndInDepot_SystemSetting BIT --强制流程:销售退货单与退货入库单
- --BELONG TABLE ModifyDepotBillProduct
- DECLARE @ID_ModifyDepotBillProduct uniqueidentifier
- DECLARE @ID_Product uniqueidentifier
- DECLARE @ID_Location uniqueidentifier
- DECLARE @No_FromBill NVARCHAR(64)
- DECLARE @No_FromBillProduct NVARCHAR(64)
- DECLARE @Type_FromBill INT
- DECLARE @Quantity_ModifyDepotBillProduct decimal(14,4)
- DECLARE @UnitPrice_ModifyDepotBillProduct decimal(18,6)
- DECLARE @IFAUDIT uniqueidentifier
- DECLARE @ID_Warehouse uniqueidentifier
- DECLARE @No_ModifyDepotBillProduct NVARCHAR(64)
- --BELONG TABLE ProductStocks
- DECLARE @LASTStockQty_ProductStocks decimal(14,4)
- --TEMP VAR
- DECLARE @Error NVARCHAR(1000)
- DECLARE @Quantity_Temp decimal(14,4)
- DECLARE @Quantity_InDepot decimal(14,4)
- DECLARE @BAUDIT INT
- DECLARE @IDAUDIT UNIQUEIDENTIFIER
- SET @IDAUDIT='00000000-0000-0000-0000-000000000000'
- DECLARE @ID_SaleSourceBillProduct uniqueidentifier
- --initialize input parameters
- --SET @Style_ModifyDepotBill = '销退入库'
- --initialize ModifyTypeSettings
- SELECT @Type_ModifyTypeSettings = Type_ModifyTypeSettings,
- @Stock_ModifyTypeSettings = Stock_ModifyTypeSettings,
- @Cost_ModifyTypeSettings = Cost_ModifyTypeSettings,
- @Style_ModifyDepotBill = ModName_ModifyTypeSettings
- FROM ModifyTypeSettings
- WHERE ID_ModifyTypeSettings = @StyleID_ModifyDepotBill
- SELECT @IFAUDIT = ID_Assessor FROM ModifyDepotBill WHERE ID_ModifyDepotBill = @ID_ModifyDepotBill
- --Start here
-
- IF @Style_ModifyDepotBill = '销退入库'
- SELECT TOP 1 @SaleBackAndInDepot_SystemSetting=SaleBackAndInDepot_SystemSetting FROM SystemSetting
- IF @IFAUDIT IS NULL AND @Type_ModifyTypeSettings = 0--OUT DEPOT
- BEGIN
- DECLARE CUR CURSOR FOR SELECT MDBP.ID_ModifyDepotBillProduct,MDBP.Quantity_ModifyDepotBillProduct,MDBP.ID_Product,MDBP.ID_Location,MDBP.No_ModifyDepotBillProduct FROM ModifyDepotBillProduct MDBP
- INNER JOIN ModifyDepotBill MDB ON MDBP.ID_ModifyDepotBill = MDB.ID_ModifyDepotBill WHERE MDB.ID_ModifyDepotBill = @ID_ModifyDepotBill
- OPEN CUR
- FETCH NEXT FROM CUR INTO @ID_ModifyDepotBillProduct,@Quantity_ModifyDepotBillProduct,@ID_Product,@ID_Location,@No_ModifyDepotBillProduct
- WHILE @@FETCH_STATUS = 0
- BEGIN
-
- IF @Stock_ModifyTypeSettings = 1--影响财务库存
- BEGIN
- if not exists(Select * From ProductStocks WHERE ID_Location = @ID_Location AND ID_Product = @ID_Product)
- BEGIN
- Set @Error=N'序号为 '+ @No_ModifyDepotBillProduct + N' 的产品在该库位没有相应的库存,不能通过审核'
- RAISERROR(@Error,18,1)
- CLOSE CUR
- DEALLOCATE CUR
- RETURN
- END
- SELECT @ID_Warehouse=ID_Warehouse FROM Location WHERE ID_Location = @ID_Location
- UPDATE ProductStocks SET AvailableQty_ProductStocks = AvailableQty_ProductStocks - @Quantity_ModifyDepotBillProduct
- WHERE ID_Location = @ID_Warehouse AND ID_Product = @ID_Product
- UPDATE ProductStocks SET StockQty_ProductStocks = StockQty_ProductStocks-@Quantity_ModifyDepotBillProduct
- WHERE ID_Location = @ID_Location AND ID_Product = @ID_Product
-
- SELECT @LASTStockQty_ProductStocks = StockQty_ProductStocks FROM ProductStocks
- WHERE ID_Location = @ID_Location AND ID_Product = @ID_Product
- IF @LASTStockQty_ProductStocks < 0
- BEGIN
- Set @Error=N'序号为 '+ @No_ModifyDepotBillProduct + N' 的产品在该库位的库存不足,不能通过审核'
- RAISERROR(@Error,18,1)
- CLOSE CUR
- DEALLOCATE CUR
- RETURN
- END
- END
- UPDATE ModifyDepotBillProduct SET ID_SaleSourceBillProduct = NULL WHERE ModifyDepotBillProduct.ID_ModifyDepotBillProduct = @ID_ModifyDepotBillProduct
- FETCH NEXT FROM CUR INTO @ID_ModifyDepotBillProduct,@Quantity_ModifyDepotBillProduct,@ID_Product,@ID_Location,@No_ModifyDepotBillProduct
- END
- CLOSE CUR
- DEALLOCATE CUR
- END
- ELSE IF @IFAUDIT IS NULL AND @Type_ModifyTypeSettings = 1
- BEGIN
- DECLARE CUR CURSOR FOR SELECT MDBP.ID_ModifyDepotBillProduct,MDBP.Quantity_ModifyDepotBillProduct,MDBP.ID_Product,MDBP.ID_Location,MDBP.UnitPrice_ModifyDepotBillProduct,MDBP.No_FromBill,MDBP.No_FromBillProduct,MDBP.Type_FromBill,MDBP.No_ModifyDepotBillProduct FROM ModifyDepotBillProduct MDBP
- INNER JOIN ModifyDepotBill MDB ON MDBP.ID_ModifyDepotBill = MDB.ID_ModifyDepotBill WHERE MDB.ID_ModifyDepotBill = @ID_ModifyDepotBill
- OPEN CUR
- FETCH NEXT FROM CUR INTO @ID_ModifyDepotBillProduct,@Quantity_ModifyDepotBillProduct,@ID_Product,@ID_Location,@UnitPrice_ModifyDepotBillProduct,@No_FromBill,@No_FromBillProduct,@Type_FromBill,@No_ModifyDepotBillProduct
- WHILE @@FETCH_STATUS = 0
- BEGIN
-
- IF @Stock_ModifyTypeSettings = 1 --影响财务库存
- BEGIN
- IF EXISTS(SELECT * FROM ProductStocks INNER JOIN Location ON Location.ID_Warehouse=ProductStocks.ID_Location WHERE Location.ID_Location = @ID_Location AND ProductStocks.ID_Product = @ID_Product)
- BEGIN
- SELECT @ID_Warehouse=ID_Warehouse FROM Location WHERE ID_Location = @ID_Location
- UPDATE ProductStocks SET AvailableQty_ProductStocks = AvailableQty_ProductStocks + @Quantity_ModifyDepotBillProduct
- WHERE ID_Location = @ID_Warehouse AND ID_Product = @ID_Product
- END
- ELSE
- BEGIN
- SELECT @ID_Warehouse=ID_Warehouse FROM Location WHERE ID_Location = @ID_Location
- INSERT INTO ProductStocks(ID_ProductStocks, ID_Location, ID_Product,AvailableQty_ProductStocks, StockQty_ProductStocks)
- VALUES(NEWID(),@ID_Warehouse,@ID_Product,@Quantity_ModifyDepotBillProduct,0)
- END
- IF EXISTS(SELECT * FROM ProductStocks WHERE ID_Location = @ID_Location AND ID_Product = @ID_Product)
- BEGIN
- UPDATE ProductStocks SET StockQty_ProductStocks = StockQty_ProductStocks + @Quantity_ModifyDepotBillProduct
- WHERE ID_Location = @ID_Location AND ID_Product = @ID_Product
- END
- ELSE
- INSERT INTO ProductStocks(ID_ProductStocks, ID_Location, ID_Product,AvailableQty_ProductStocks, StockQty_ProductStocks)
- VALUES(NEWID(),@ID_Location,@ID_Product,0,@Quantity_ModifyDepotBillProduct)
- END
- IF @Cost_ModifyTypeSettings = 1 --影响成本核算
- UPDATE Product SET Cost_Product = @UnitPrice_ModifyDepotBillProduct WHERE ID_Product = @ID_Product
- IF @Style_ModifyDepotBill = '销退入库' AND @SaleBackAndInDepot_SystemSetting = 1
- BEGIN
- IF EXISTS(SELECT * FROM BillType WHERE Value_BillType = @Type_FromBill AND Name_BillType = '销售退货单')
- BEGIN
- SELECT @IDAUDIT=SaleRtnBill.ID_ASSESSOR FROM SaleRtnBill
- WHERE No_SaleRtnBill=@No_FromBill
- IF @IDAUDIT IS NOT NULL AND @IDAUDIT='00000000-0000-0000-0000-000000000000'
- SET @BAUDIT = -1
- ELSE IF @IDAUDIT IS NOT NULL AND @IDAUDIT!='00000000-0000-0000-0000-000000000000'
- SET @BAUDIT = 1
- ELSE SET @BAUDIT = 0
- IF @BAUDIT=1
- BEGIN
- SELECT @ID_SaleSourceBillProduct=SaleRtnBillProduct.ID_SaleSourceBillProduct FROM SaleRtnBillProduct
- INNER JOIN SaleRtnBill ON SaleRtnBill.ID_SaleRtnBill = SaleRtnBillProduct.ID_SaleRtnBill
- WHERE SaleRtnBillProduct.No_SaleRtnBillProduct=@No_FromBillProduct AND SaleRtnBill.No_SaleRtnBill = @No_FromBill
- IF @ID_SaleSourceBillProduct IS NULL
- BEGIN
- RAISERROR(N'来源单据产品被删除,请重新填写单据!',18,1)
- CLOSE CUR
- DEALLOCATE CUR
- RETURN
- END
- UPDATE ModifyDepotBillProduct SET ID_SaleSourceBillProduct=@ID_SaleSourceBillProduct
- WHERE ID_ModifyDepotBillProduct=@ID_ModifyDepotBillProduct
- SELECT @Quantity_InDepot=Quantity_InDepot--,@Quantity_Temp=Quantity_SaleRtn-Quantity_InDepot
- FROM SaleSourceBillProduct
- WHERE ID_SaleSourceBillProduct = @ID_SaleSourceBillProduct
- Select @Quantity_Temp=Quantity_SaleRtnBillProduct-InQuantity_SaleRtnBillProduct
- From SaleRtnBillProduct Join SaleRtnBill On SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
- Where No_SaleRtnBill=@No_FromBill AND No_SaleRtnBillProduct=@No_FromBillProduct
- IF @Quantity_Temp < @Quantity_ModifyDepotBillProduct
- BEGIN
- SET @Error = N'序号为'+@No_ModifyDepotBillProduct+N'的产品累计入库数量大于相应的销退数量,审核失败!请于关联单据处查询!'
- RAISERROR(@Error,18,1)
- CLOSE CUR
- DEALLOCATE CUR
- RETURN
- END
- ELSE
- BEGIN
- UPDATE SaleSourceBillProduct SET Quantity_InDepot=@Quantity_InDepot+@Quantity_ModifyDepotBillProduct
- WHERE ID_SaleSourceBillProduct = @ID_SaleSourceBillProduct
- Update SaleRtnBillProduct Set InQuantity_SaleRtnBillProduct=IsNull(InQuantity_SaleRtnBillProduct,0)+@Quantity_ModifyDepotBillProduct
- Where ID_SaleRtnBill=(Select ID_SaleRtnBill From SaleRtnBill Where No_SaleRtnBill=@No_FromBill) And No_SaleRtnBillProduct=@No_FromBillProduct
- END
- END
- ELSE
- BEGIN
- RAISERROR(N'来源单据尚未经过审核,不能对本单据进行审核!',18,1)
- CLOSE CUR
- DEALLOCATE CUR
- RETURN
- END
- END
- ELSE
- BEGIN
- RAISERROR(N'来源单据不是销售退货单,不能对本单据进行审核!',18,1)
- CLOSE CUR
- DEALLOCATE CUR
- RETURN
- END
- END
- FETCH NEXT FROM CUR INTO @ID_ModifyDepotBillProduct,@Quantity_ModifyDepotBillProduct,@ID_Product,@ID_Location,@UnitPrice_ModifyDepotBillProduct,@No_FromBill,@No_FromBillProduct,@Type_FromBill,@No_ModifyDepotBillProduct
- END
- CLOSE CUR
- DEALLOCATE CUR
- END
- ELSE IF @IFAUDIT IS NOT NULL AND @Type_ModifyTypeSettings = 1
- BEGIN
- DECLARE CUR CURSOR FOR SELECT MDBP.ID_ModifyDepotBillProduct,MDBP.Quantity_ModifyDepotBillProduct,MDBP.ID_Product,MDBP.ID_Location,MDBP.UnitPrice_ModifyDepotBillProduct,MDBP.No_FromBill,MDBP.No_FromBillProduct,MDBP.Type_FromBill FROM ModifyDepotBillProduct MDBP
- INNER JOIN ModifyDepotBill MDB ON MDBP.ID_ModifyDepotBill = MDB.ID_ModifyDepotBill WHERE MDB.ID_ModifyDepotBill = @ID_ModifyDepotBill
- OPEN CUR
- FETCH NEXT FROM CUR INTO @ID_ModifyDepotBillProduct,@Quantity_ModifyDepotBillProduct,@ID_Product,@ID_Location,@UnitPrice_ModifyDepotBillProduct,@No_FromBill,@No_FromBillProduct,@Type_FromBill
- WHILE @@FETCH_STATUS = 0
- BEGIN
- IF @Stock_ModifyTypeSettings = 1 --影响财务库存
- BEGIN
- SELECT @ID_Warehouse=ID_Warehouse FROM Location WHERE ID_Location = @ID_Location
- UPDATE ProductStocks SET AvailableQty_ProductStocks = AvailableQty_ProductStocks - @Quantity_ModifyDepotBillProduct
- WHERE ID_Location = @ID_Warehouse AND ID_Product = @ID_Product
- UPDATE ProductStocks SET StockQty_ProductStocks = StockQty_ProductStocks-@Quantity_ModifyDepotBillProduct
- WHERE ID_Location = @ID_Location AND ID_Product = @ID_Product
-
- SELECT @LASTStockQty_ProductStocks = StockQty_ProductStocks FROM ProductStocks
- WHERE ID_Location = @ID_Location AND ID_Product = @ID_Product
- IF @LASTStockQty_ProductStocks < 0
- BEGIN
- RAISERROR(N'实际库存不能小于零!',18,1)
- CLOSE CUR
- DEALLOCATE CUR
- RETURN
- END
- END
- IF @Style_ModifyDepotBill ='销退入库' AND @SaleBackAndInDepot_SystemSetting = 1--控管
- BEGIN
- SELECT @ID_SaleSourceBillProduct=SaleRtnBillProduct.ID_SaleSourceBillProduct FROM SaleRtnBillProduct
- INNER JOIN SaleRtnBill ON SaleRtnBill.ID_SaleRtnBill = SaleRtnBillProduct.ID_SaleRtnBill
- WHERE SaleRtnBillProduct.No_SaleRtnBillProduct=@No_FromBillProduct AND SaleRtnBill.No_SaleRtnBill = @No_FromBill
-
- UPDATE SaleSourceBillProduct SET Quantity_InDepot=Quantity_InDepot-@Quantity_ModifyDepotBillProduct
- WHERE ID_SaleSourceBillProduct = @ID_SaleSourceBillProduct
- Update SaleRtnBillProduct Set InQuantity_SaleRtnBillProduct=IsNull(InQuantity_SaleRtnBillProduct,0)-@Quantity_ModifyDepotBillProduct
- Where ID_SaleRtnBill=(Select ID_SaleRtnBill From SaleRtnBill Where No_SaleRtnBill=@No_FromBill) And No_SaleRtnBillProduct=@No_FromBillProduct
- END
- FETCH NEXT FROM CUR INTO @ID_ModifyDepotBillProduct,@Quantity_ModifyDepotBillProduct,@ID_Product,@ID_Location,@UnitPrice_ModifyDepotBillProduct,@No_FromBill,@No_FromBillProduct,@Type_FromBill
- END
- END
- ELSE IF @IFAUDIT IS NOT NULL AND @Type_ModifyTypeSettings = 0
- BEGIN
- DECLARE CUR CURSOR FOR SELECT MDBP.ID_ModifyDepotBillProduct,MDBP.Quantity_ModifyDepotBillProduct,MDBP.ID_Product,MDBP.ID_Location,MDBP.UnitPrice_ModifyDepotBillProduct,MDBP.No_FromBill,MDBP.Type_FromBill FROM ModifyDepotBillProduct MDBP
- INNER JOIN ModifyDepotBill MDB ON MDBP.ID_ModifyDepotBill = MDB.ID_ModifyDepotBill WHERE MDB.ID_ModifyDepotBill = @ID_ModifyDepotBill
- OPEN CUR
- FETCH NEXT FROM CUR INTO @ID_ModifyDepotBillProduct,@Quantity_ModifyDepotBillProduct,@ID_Product,@ID_Location,@UnitPrice_ModifyDepotBillProduct,@No_FromBill,@Type_FromBill
- WHILE @@FETCH_STATUS = 0
- BEGIN
- IF @Stock_ModifyTypeSettings = 1 --影响财务库存
- BEGIN
- SELECT @ID_Warehouse=ID_Warehouse FROM Location WHERE ID_Location = @ID_Location
- UPDATE ProductStocks SET AvailableQty_ProductStocks = AvailableQty_ProductStocks + @Quantity_ModifyDepotBillProduct
- WHERE ID_Location = @ID_Warehouse AND ID_Product = @ID_Product
- UPDATE ProductStocks SET StockQty_ProductStocks = StockQty_ProductStocks+@Quantity_ModifyDepotBillProduct
- WHERE ID_Location = @ID_Location AND ID_Product = @ID_Product
- END
- FETCH NEXT FROM CUR INTO @ID_ModifyDepotBillProduct,@Quantity_ModifyDepotBillProduct,@ID_Product,@ID_Location,@UnitPrice_ModifyDepotBillProduct,@No_FromBill,@Type_FromBill
- END
- END
- --更新审核人日期。
- UPDATE ModifyDepotBill SET ID_Assessor = @ID_Assessor,
- AssessDate_ModifyDepotBill = @AssessDate_ModifyDepotBill,
- Disable_ModifyDepotBill=@Disable_ModifyDepotBill
- WHERE ID_ModifyDepotBill = @ID_ModifyDepotBill">
- <Params>
- <Param name="@StyleID_ModifyDepotBill" type="ModifyDepotBill.Style_ModifyDepotBill" sourceColumn="Style_ModifyDepotBill" />
- <Param name="@ID_ModifyDepotBill" type="ModifyDepotBill.ID_ModifyDepotBill" sourceColumn="ID_ModifyDepotBill" />
- <Param name="@ID_Assessor" type="ModifyDepotBill.ID_Assessor" sourceColumn="ID_Assessor" />
- <Param name="@AssessDate_ModifyDepotBill" type="ModifyDepotBill.AssessDate_ModifyDepotBill"
- sourceColumn="AssessDate_ModifyDepotBill" />
- <Param name="@Disable_ModifyDepotBill" type="ModifyDepotBill.Disable_ModifyDepotBill" sourceColumn="Disable_ModifyDepotBill" />
- </Params>
- </Audit>
- <FKErrorReport ErrorMessage="该单据已被其他单据引用,删除失败!"/>
- <UNIQUEErrorReport ErrorMessage="库存异动作业单号已存在,提交失败!"/>
- </Table>
- <Table name="ModifyDepotBillProduct" Type="Child">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(uniqueidentifier,'00000000-0000-0000-0000-000000000000') AS Style_ModifyDepotBill,CONVERT(nvarchar(64),'') AS No_ModifyDepotBill,CONVERT(nvarchar(64),'') AS SourceBillName_ModifyDepotBillProduct, CONVERT(decimal(18,6), 0) AS ProductMoney_FromBillProduct, M.*,P.No_Product AS ProductNo_FromBillProduct,P.Name_Product AS ProductName_FromBillProduct,P.Unit_Product AS ProductUnit_FromBillProduct,L.Name_Location, L.No_Location, L.ID_Location FROM ModifyDepotBillProduct M
- INNER JOIN Product P ON P.ID_Product = M.ID_Product
- INNER JOIN Location L ON L.ID_Location = M.ID_Location" />
- <New CmdType="Text" CmdText="INSERT INTO ModifyDepotBillProduct
- (ID_ModifyDepotBillProduct, No_ModifyDepotBillProduct, ID_ModifyDepotBill, ID_SaleSourceBillProduct, Type_FromBill, No_FromBill, No_FromBillProduct, ID_Product, ID_Location, Quantity_ModifyDepotBillProduct, UnitPrice_ModifyDepotBillProduct, Comment_ModifyDepotBillProduct)
- VALUES
- (@ID_ModifyDepotBillProduct, @No_ModifyDepotBillProduct, @ID_ModifyDepotBill, @ID_SaleSourceBillProduct, @Type_FromBill, @No_FromBill, @No_FromBillProduct, @ID_Product, @ID_Location, @Quantity_ModifyDepotBillProduct, @UnitPrice_ModifyDepotBillProduct, @Comment_ModifyDepotBillProduct)">
- <Params>
- <Param name="@ID_ModifyDepotBillProduct" type="ModifyDepotBillProduct.ID_ModifyDepotBillProduct"
- sourceColumn="ID_ModifyDepotBillProduct" />
- <Param name="@No_ModifyDepotBillProduct" type="ModifyDepotBillProduct.No_ModifyDepotBillProduct"
- sourceColumn="No_ModifyDepotBillProduct" />
- <Param name="@ID_ModifyDepotBill" type="ModifyDepotBillProduct.ID_ModifyDepotBill" sourceColumn="ID_ModifyDepotBill" />
- <Param name="@ID_SaleSourceBillProduct" type="ModifyDepotBillProduct.ID_SaleSourceBillProduct"
- sourceColumn="ID_SaleSourceBillProduct" />
- <Param name="@Type_FromBill" type="ModifyDepotBillProduct.Type_FromBill" sourceColumn="Type_FromBill" />
- <Param name="@No_FromBill" type="ModifyDepotBillProduct.No_FromBill" sourceColumn="No_FromBill" />
- <Param name="@No_FromBillProduct" type="ModifyDepotBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
- <Param name="@ID_Product" type="ModifyDepotBillProduct.ID_Product" sourceColumn="ID_Product" />
- <Param name="@ID_Location" type="ModifyDepotBillProduct.ID_Location" sourceColumn="ID_Location" />
- <Param name="@Quantity_ModifyDepotBillProduct" type="ModifyDepotBillProduct.Quantity_ModifyDepotBillProduct"
- sourceColumn="Quantity_ModifyDepotBillProduct" />
- <Param name="@UnitPrice_ModifyDepotBillProduct" type="ModifyDepotBillProduct.UnitPrice_ModifyDepotBillProduct"
- sourceColumn="UnitPrice_ModifyDepotBillProduct" />
- <Param name="@Comment_ModifyDepotBillProduct" type="ModifyDepotBillProduct.Comment_ModifyDepotBillProduct"
- sourceColumn="Comment_ModifyDepotBillProduct" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText="DECLARE @Error NVARCHAR(64)
- DECLARE @AUDITDATE DATETIME
- DECLARE @QUANTITY decimal(14,4)
- DECLARE @StyleName_ModifyDepotBill NVARCHAR(64)
- SELECT @StyleName_ModifyDepotBill = ModName_ModifyTypeSettings
- FROM ModifyTypeSettings
- WHERE ID_ModifyTypeSettings = @Style_ModifyDepotBill
- SELECT @AUDITDATE = AssessDate_ModifyDepotBill FROM ModifyDepotBill
- WHERE ID_ModifyDepotBill = @ID_ModifyDepotBill
- IF @StyleName_ModifyDepotBill = '销退入库'
- BEGIN
- IF @AUDITDATE IS NOT NULL
- BEGIN
- Select @QUANTITY=Quantity_SaleRtnBillProduct-InQuantity_SaleRtnBillProduct
- From SaleRtnBillProduct Join SaleRtnBill On SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
- Where No_SaleRtnBill=@No_FromBill AND No_SaleRtnBillProduct=@No_FromBillProduct
- IF @QUANTITY < @Quantity_ModifyDepotBillProduct
- BEGIN
- SET @Error = N'序号为'+@No_ModifyDepotBillProduct+N'的产品的退货数量小于相应入库数量,提交失败!请于关联单据处查询!'
- RAISERROR(@Error,18,1)
- CLOSE CUR
- DEALLOCATE CUR
- RETURN
- END
- END
- END
-
- UPDATE ModifyDepotBillProduct
- SET No_ModifyDepotBillProduct = @No_ModifyDepotBillProduct,
- ID_ModifyDepotBill = @ID_ModifyDepotBill,
- ID_SaleSourceBillProduct = @ID_SaleSourceBillProduct,
- Type_FromBill = @Type_FromBill,
- No_FromBill = @No_FromBill,
- No_FromBillProduct = @No_FromBillProduct,
- ID_Product = @ID_Product,
- ID_Location = @ID_Location,
- Quantity_ModifyDepotBillProduct = @Quantity_ModifyDepotBillProduct,
- UnitPrice_ModifyDepotBillProduct = @UnitPrice_ModifyDepotBillProduct,
- Comment_ModifyDepotBillProduct = @Comment_ModifyDepotBillProduct
- WHERE ID_ModifyDepotBillProduct = @ID_ModifyDepotBillProduct">
- <Params>
- <Param name="@ID_ModifyDepotBillProduct" type="ModifyDepotBillProduct.ID_ModifyDepotBillProduct"
- sourceColumn="ID_ModifyDepotBillProduct" />
- <Param name="@No_ModifyDepotBillProduct" type="ModifyDepotBillProduct.No_ModifyDepotBillProduct"
- sourceColumn="No_ModifyDepotBillProduct" />
- <Param name="@ID_ModifyDepotBill" type="ModifyDepotBillProduct.ID_ModifyDepotBill" sourceColumn="ID_ModifyDepotBill" />
- <Param name="@ID_SaleSourceBillProduct" type="ModifyDepotBillProduct.ID_SaleSourceBillProduct"
- sourceColumn="ID_SaleSourceBillProduct" />
- <Param name="@Type_FromBill" type="ModifyDepotBillProduct.Type_FromBill" sourceColumn="Type_FromBill" />
- <Param name="@No_FromBill" type="ModifyDepotBillProduct.No_FromBill" sourceColumn="No_FromBill" />
- <Param name="@No_FromBillProduct" type="ModifyDepotBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
- <Param name="@ID_Product" type="ModifyDepotBillProduct.ID_Product" sourceColumn="ID_Product" />
- <Param name="@ID_Location" type="ModifyDepotBillProduct.ID_Location" sourceColumn="ID_Location" />
- <Param name="@Quantity_ModifyDepotBillProduct" type="ModifyDepotBillProduct.Quantity_ModifyDepotBillProduct"
- sourceColumn="Quantity_ModifyDepotBillProduct" />
- <Param name="@UnitPrice_ModifyDepotBillProduct" type="ModifyDepotBillProduct.UnitPrice_ModifyDepotBillProduct"
- sourceColumn="UnitPrice_ModifyDepotBillProduct" />
- <Param name="@Comment_ModifyDepotBillProduct" type="ModifyDepotBillProduct.Comment_ModifyDepotBillProduct"
- sourceColumn="Comment_ModifyDepotBillProduct" />
- <Param name="@Style_ModifyDepotBill" type="ModifyDepotBill.Style_ModifyDepotBill" sourceColumn="Style_ModifyDepotBill" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText="DELETE ModifyDepotBillProduct WHERE ModifyDepotBillProduct.ID_ModifyDepotBillProduct = @ID_ModifyDepotBillProduct">
- <Params>
- <Param name="@ID_ModifyDepotBillProduct" type="ModifyDepotBillProduct.ID_ModifyDepotBillProduct"
- sourceColumn="ID_ModifyDepotBillProduct" />
- </Params>
- </Delete>
- </Table>
- </Tables>
- <Search>
- <SearchAllBill CmdType="Text" CmdText=" SELECT M.*,
- L.Name_Location AS ChangedDepot_ModifyDepotBill,
- L.No_Location AS ChangedDepotNo_ModifyDepotBill,
- MD.ModName_ModifyTypeSettings AS ModifyDepotBill_ModifyDepotBill,
- E.Name_Employee AS Proposer_ModifyDepotBill,
- E.No_Employee AS ProposerNo_ModifyDepotBill,
- A.Name_User AS Maker_ModifyDepotBill,
- A1.Name_User AS Assessor_ModifyDepotBill,
- A2.Name_User AS lastModflyuser_ModifyDepotBill,
- convert(decimal(18,2),0.00) AS Sum_ModifyDepotBill,
- convert(decimal(18,2),0.00) AS Amount_ModifyDepotBill
- FROM ModifyDepotBill M
- INNER JOIN LOCATION L ON M.ID_Location = L.ID_Location
- LEFT JOIN ModifyTypeSettings MD ON MD.ID_ModifyTypeSettings = M.Style_ModifyDepotBill
- INNER JOIN Employee E ON E.ID_Employee = M.ID_Proposer
- INNER JOIN AppUser A ON A.ID_User = M.ID_Creator
- LEFT JOIN AppUser A1 ON A1.ID_User = M.ID_Assessor
- LEFT JOIN AppUser A2 ON A2.ID_User = M.LastModUser_ModifyDepotBill">
- <Tables>
- <Table name="AllBill" />
- </Tables>
- </SearchAllBill>
- <SearchAllProduct CmdType="Text" CmdText="SELECT Product.No_Product,Product.Name_Product ,Type_Product, Price_Product, LowSalePrice_Product, SafetyQty_Product FROM Product ">
- <Tables>
- <Table name="AllProduct" />
- </Tables>
- </SearchAllProduct>
- <SearchContr CmdType="Text" CmdText=" SELECT SystemSetting.SaleBackAndInDepot_SystemSetting FROM SystemSetting WHERE SystemSetting.SaleBackAndInDepot_SystemSetting = 1">
- <Tables>
- <Table name="SystemSaleAndOutDepot" />
- </Tables>
- </SearchContr>
- <SearchLocationByNo CmdType="Text" CmdText="
- SELECT ID_Location, Name_Location FROM Location WHERE No_Location=@No_Location
- ">
- <Params>
- <Param name="@No_Location" type="Location.No_Location" Index="0" />
- </Params>
- <Tables>
- <Table name="Location" />
- </Tables>
- </SearchLocationByNo>
- <SearchModifyDepotBillWithNo CmdType="Text" CmdText=" DECLARE @ID UNIQUEIDENTIFIER
- DECLARE @Quantity DECIMAL(18,2)
- SELECT @ID = ModifyDepotBill.ID_ModifyDepotBill FROM ModifyDepotBill WHERE ModifyDepotBill.No_ModifyDepotBill = @No_ModifyDepotBill
- SELECT @Quantity=SUM(Quantity_ModifyDepotBillProduct) FROM ModifyDepotBillProduct WHERE ID_ModifyDepotBill = @ID
- SELECT M.*,
- L.Name_Location AS ChangedDepot_ModifyDepotBill,
- L.No_Location AS ChangedDepotNo_ModifyDepotBill,
- MD.ModName_ModifyTypeSettings AS ModifyDepotBill_ModifyDepotBill,
- E.Name_Employee AS Proposer_ModifyDepotBill,
- E.No_Employee AS ProposerNo_ModifyDepotBill,
- A.Name_User AS Maker_ModifyDepotBill,
- A1.Name_User AS Assessor_ModifyDepotBill,
- A2.Name_User AS lastModflyuser_ModifyDepotBill,
- @Quantity AS Sum_ModifyDepotBill
- FROM ModifyDepotBill M
- INNER JOIN LOCATION L ON M.ID_Location = L.ID_Location
- LEFT JOIN ModifyTypeSettings MD ON MD.ID_ModifyTypeSettings = M.Style_ModifyDepotBill
- INNER JOIN Employee E ON E.ID_Employee = M.ID_Proposer
- INNER JOIN AppUser A ON A.ID_User = M.ID_Creator
- LEFT JOIN AppUser A1 ON A1.ID_User = M.ID_Assessor
- LEFT JOIN AppUser A2 ON A2.ID_User = M.LastModUser_ModifyDepotBill
- WHERE M.No_ModifyDepotBill = @No_ModifyDepotBill
- SELECT MS.Name_BillType AS SourceBillName_ModifyDepotBillProduct,
- MP.UnitPrice_ModifyDepotBillProduct*MP.Quantity_ModifyDepotBillProduct AS ProductMoney_FromBillProduct,
- MP.*,@No_ModifyDepotBill as No_ModifyDepotBill,
- P.No_Product AS ProductNo_FromBillProduct,
- P.Name_Product AS ProductName_FromBillProduct,
- P.Unit_Product AS ProductUnit_FromBillProduct,
- L.Name_Location, L.No_Location, L.ID_Location
- FROM ModifyDepotBillProduct MP
- INNER JOIN Product P ON P.ID_Product = MP.ID_Product
- INNER JOIN Location L ON L.ID_Location = MP.ID_Location
- LEFT JOIN BillType MS ON MS.Value_BillType = MP.Type_FromBill
- WHERE MP.ID_ModifyDepotBill = @ID
- Order By CAST(MP.No_ModifyDepotBillProduct AS INT)
- ">
- <Params>
- <Param name="@No_ModifyDepotBill" type="ModifyDepotBill.No_ModifyDepotBill" Index="0" />
- </Params>
- <Tables>
- <Table name="ModifyDepotBill" />
- <Table name="ModifyDepotBillProduct" />
- </Tables>
- </SearchModifyDepotBillWithNo>
- <SearchModifyDepotBillPrevious CmdType="Text" CmdText=" DECLARE @ID UNIQUEIDENTIFIER
- DECLARE @Quantity DECIMAL(18,2)
- DECLARE @NextNo nvarchar(64)
- SET @NextNo = @No_ModifyDepotBill
- SELECT TOP 1 @NextNo = ModifyDepotBill.No_ModifyDepotBill FROM ModifyDepotBill WHERE ModifyDepotBill.No_ModifyDepotBill < @No_ModifyDepotBill ORDER BY ModifyDepotBill.No_ModifyDepotBill DESC
- SELECT @ID = ModifyDepotBill.ID_ModifyDepotBill FROM ModifyDepotBill WHERE ModifyDepotBill.No_ModifyDepotBill = @NextNo
- SELECT @Quantity=SUM(Quantity_ModifyDepotBillProduct) FROM ModifyDepotBillProduct WHERE ID_ModifyDepotBill = @ID
- SELECT M.*,
- L.Name_Location AS ChangedDepot_ModifyDepotBill,
- L.No_Location AS ChangedDepotNo_ModifyDepotBill,
- MD.ModName_ModifyTypeSettings AS ModifyDepotBill_ModifyDepotBill,
- E.Name_Employee AS Proposer_ModifyDepotBill,
- E.No_Employee AS ProposerNo_ModifyDepotBill,
- A.Name_User AS Maker_ModifyDepotBill,
- A1.Name_User AS Assessor_ModifyDepotBill,
- A2.Name_User AS lastModflyuser_ModifyDepotBill,
- @Quantity AS Sum_ModifyDepotBill
- FROM ModifyDepotBill M
- INNER JOIN LOCATION L ON M.ID_Location = L.ID_Location
- LEFT JOIN ModifyTypeSettings MD ON MD.ID_ModifyTypeSettings = M.Style_ModifyDepotBill
- INNER JOIN Employee E ON E.ID_Employee = M.ID_Proposer
- INNER JOIN AppUser A ON A.ID_User = M.ID_Creator
- LEFT JOIN AppUser A1 ON A1.ID_User = M.ID_Assessor
- LEFT JOIN AppUser A2 ON A2.ID_User = M.LastModUser_ModifyDepotBill
- WHERE M.No_ModifyDepotBill = @NextNo
- SELECT MS.Name_BillType AS SourceBillName_ModifyDepotBillProduct,
- MP.UnitPrice_ModifyDepotBillProduct*MP.Quantity_ModifyDepotBillProduct AS ProductMoney_FromBillProduct,
- MP.*,@NextNo as No_ModifyDepotBill,
- P.No_Product AS ProductNo_FromBillProduct,
- P.Name_Product AS ProductName_FromBillProduct,
- P.Unit_Product AS ProductUnit_FromBillProduct,
- L.Name_Location, L.No_Location, L.ID_Location
- FROM ModifyDepotBillProduct MP
- INNER JOIN Product P ON P.ID_Product = MP.ID_Product
- INNER JOIN Location L ON L.ID_Location = MP.ID_Location
- LEFT JOIN BillType MS ON MS.Value_BillType = MP.Type_FromBill
- WHERE MP.ID_ModifyDepotBill = @ID
- Order By CAST(MP.No_ModifyDepotBillProduct AS INT)
- ">
- <Params>
- <Param name="@No_ModifyDepotBill" type="ModifyDepotBill.No_ModifyDepotBill" Index="0" />
- </Params>
- <Tables>
- <Table name="ModifyDepotBill" />
- <Table name="ModifyDepotBillProduct" />
- </Tables>
- </SearchModifyDepotBillPrevious>
- <SearchModifyDepotBillNext CmdType="Text" CmdText=" DECLARE @ID UNIQUEIDENTIFIER
- DECLARE @Quantity DECIMAL(18,2)
- DECLARE @NextNo nvarchar(64)
- SET @NextNo = @No_ModifyDepotBill
- SELECT TOP 1 @NextNo = ModifyDepotBill.No_ModifyDepotBill FROM ModifyDepotBill WHERE ModifyDepotBill.No_ModifyDepotBill > @No_ModifyDepotBill ORDER BY ModifyDepotBill.No_ModifyDepotBill
- SELECT @ID = ModifyDepotBill.ID_ModifyDepotBill FROM ModifyDepotBill WHERE ModifyDepotBill.No_ModifyDepotBill = @NextNo
- SELECT @Quantity=SUM(Quantity_ModifyDepotBillProduct) FROM ModifyDepotBillProduct WHERE ID_ModifyDepotBill = @ID
- SELECT M.*,
- L.Name_Location AS ChangedDepot_ModifyDepotBill,
- L.No_Location AS ChangedDepotNo_ModifyDepotBill,
- MD.ModName_ModifyTypeSettings AS ModifyDepotBill_ModifyDepotBill,
- E.Name_Employee AS Proposer_ModifyDepotBill,
- E.No_Employee AS ProposerNo_ModifyDepotBill,
- A.Name_User AS Maker_ModifyDepotBill,
- A1.Name_User AS Assessor_ModifyDepotBill,
- A2.Name_User AS lastModflyuser_ModifyDepotBill,
- @Quantity AS Sum_ModifyDepotBill
- FROM ModifyDepotBill M
- INNER JOIN LOCATION L ON M.ID_Location = L.ID_Location
- LEFT JOIN ModifyTypeSettings MD ON MD.ID_ModifyTypeSettings = M.Style_ModifyDepotBill
- INNER JOIN Employee E ON E.ID_Employee = M.ID_Proposer
- INNER JOIN AppUser A ON A.ID_User = M.ID_Creator
- LEFT JOIN AppUser A1 ON A1.ID_User = M.ID_Assessor
- LEFT JOIN AppUser A2 ON A2.ID_User = M.LastModUser_ModifyDepotBill
- WHERE M.No_ModifyDepotBill = @NextNo
- SELECT MS.Name_BillType AS SourceBillName_ModifyDepotBillProduct,
- MP.UnitPrice_ModifyDepotBillProduct*MP.Quantity_ModifyDepotBillProduct AS ProductMoney_FromBillProduct,
- MP.*,@NextNo as No_ModifyDepotBill,
- P.No_Product AS ProductNo_FromBillProduct,
- P.Name_Product AS ProductName_FromBillProduct,
- P.Unit_Product AS ProductUnit_FromBillProduct,
- L.Name_Location, L.No_Location, L.ID_Location
- FROM ModifyDepotBillProduct MP
- INNER JOIN Product P ON P.ID_Product = MP.ID_Product
- INNER JOIN Location L ON L.ID_Location = MP.ID_Location
- LEFT JOIN BillType MS ON MS.Value_BillType = MP.Type_FromBill
- WHERE MP.ID_ModifyDepotBill = @ID
- Order By CAST(MP.No_ModifyDepotBillProduct AS INT)
- ">
- <Params>
- <Param name="@No_ModifyDepotBill" type="ModifyDepotBill.No_ModifyDepotBill" Index="0" />
- </Params>
- <Tables>
- <Table name="ModifyDepotBill" />
- <Table name="ModifyDepotBillProduct" />
- </Tables>
- </SearchModifyDepotBillNext>
- <SearchModifyDepotBillLast CmdType="Text" CmdText=" DECLARE @ID UNIQUEIDENTIFIER
- DECLARE @Quantity DECIMAL(18,2)
- DECLARE @NextNo nvarchar(64)
- SET @NextNo = @No_ModifyDepotBill
- SELECT TOP 1 @NextNo = ModifyDepotBill.No_ModifyDepotBill FROM ModifyDepotBill ORDER BY ModifyDepotBill.No_ModifyDepotBill DESC
- SELECT @ID = ModifyDepotBill.ID_ModifyDepotBill FROM ModifyDepotBill WHERE ModifyDepotBill.No_ModifyDepotBill = @NextNo
- SELECT @Quantity=SUM(Quantity_ModifyDepotBillProduct) FROM ModifyDepotBillProduct WHERE ID_ModifyDepotBill = @ID
- SELECT M.*,
- L.Name_Location AS ChangedDepot_ModifyDepotBill,
- L.No_Location AS ChangedDepotNo_ModifyDepotBill,
- MD.ModName_ModifyTypeSettings AS ModifyDepotBill_ModifyDepotBill,
- E.Name_Employee AS Proposer_ModifyDepotBill,
- E.No_Employee AS ProposerNo_ModifyDepotBill,
- A.Name_User AS Maker_ModifyDepotBill,
- A1.Name_User AS Assessor_ModifyDepotBill,
- A2.Name_User AS lastModflyuser_ModifyDepotBill,
- @Quantity AS Sum_ModifyDepotBill
- FROM ModifyDepotBill M
- INNER JOIN LOCATION L ON M.ID_Location = L.ID_Location
- LEFT JOIN ModifyTypeSettings MD ON MD.ID_ModifyTypeSettings = M.Style_ModifyDepotBill
- INNER JOIN Employee E ON E.ID_Employee = M.ID_Proposer
- INNER JOIN AppUser A ON A.ID_User = M.ID_Creator
- LEFT JOIN AppUser A1 ON A1.ID_User = M.ID_Assessor
- LEFT JOIN AppUser A2 ON A2.ID_User = M.LastModUser_ModifyDepotBill
- WHERE M.No_ModifyDepotBill = @NextNo
- SELECT MS.Name_BillType AS SourceBillName_ModifyDepotBillProduct,
- MP.UnitPrice_ModifyDepotBillProduct*MP.Quantity_ModifyDepotBillProduct AS ProductMoney_FromBillProduct,
- MP.*,@NextNo as No_ModifyDepotBill,
- P.No_Product AS ProductNo_FromBillProduct,
- P.Name_Product AS ProductName_FromBillProduct,
- P.Unit_Product AS ProductUnit_FromBillProduct,
- L.Name_Location, L.No_Location, L.ID_Location
- FROM ModifyDepotBillProduct MP
- INNER JOIN Product P ON P.ID_Product = MP.ID_Product
- INNER JOIN Location L ON L.ID_Location = MP.ID_Location
- LEFT JOIN BillType MS ON MS.Value_BillType = MP.Type_FromBill
- WHERE MP.ID_ModifyDepotBill = @ID
- Order By CAST(MP.No_ModifyDepotBillProduct AS INT)
- ">
- <Params>
- <Param name="@No_ModifyDepotBill" type="ModifyDepotBill.No_ModifyDepotBill" Index="0" />
- </Params>
- <Tables>
- <Table name="ModifyDepotBill" />
- <Table name="ModifyDepotBillProduct" />
- </Tables>
- </SearchModifyDepotBillLast>
- <SearchModifyDepotBillFirst CmdType="Text" CmdText=" DECLARE @ID UNIQUEIDENTIFIER
- DECLARE @Quantity DECIMAL(18,2)
- DECLARE @NextNo nvarchar(64)
- SET @NextNo = @No_ModifyDepotBill
- SELECT TOP 1 @NextNo = ModifyDepotBill.No_ModifyDepotBill FROM ModifyDepotBill ORDER BY ModifyDepotBill.No_ModifyDepotBill
- SELECT @ID = ModifyDepotBill.ID_ModifyDepotBill FROM ModifyDepotBill WHERE ModifyDepotBill.No_ModifyDepotBill = @NextNo
- SELECT @Quantity=SUM(Quantity_ModifyDepotBillProduct) FROM ModifyDepotBillProduct WHERE ID_ModifyDepotBill = @ID
- SELECT M.*,
- L.Name_Location AS ChangedDepot_ModifyDepotBill,
- L.No_Location AS ChangedDepotNo_ModifyDepotBill,
- MD.ModName_ModifyTypeSettings AS ModifyDepotBill_ModifyDepotBill,
- E.Name_Employee AS Proposer_ModifyDepotBill,
- E.No_Employee AS ProposerNo_ModifyDepotBill,
- A.Name_User AS Maker_ModifyDepotBill,
- A1.Name_User AS Assessor_ModifyDepotBill,
- A2.Name_User AS lastModflyuser_ModifyDepotBill,
- @Quantity AS Sum_ModifyDepotBill
- FROM ModifyDepotBill M
- INNER JOIN LOCATION L ON M.ID_Location = L.ID_Location
- LEFT JOIN ModifyTypeSettings MD ON MD.ID_ModifyTypeSettings = M.Style_ModifyDepotBill
- INNER JOIN Employee E ON E.ID_Employee = M.ID_Proposer
- INNER JOIN AppUser A ON A.ID_User = M.ID_Creator
- LEFT JOIN AppUser A1 ON A1.ID_User = M.ID_Assessor
- LEFT JOIN AppUser A2 ON A2.ID_User = M.LastModUser_ModifyDepotBill
- WHERE M.No_ModifyDepotBill = @NextNo
- SELECT MS.Name_BillType AS SourceBillName_ModifyDepotBillProduct,
- MP.UnitPrice_ModifyDepotBillProduct*MP.Quantity_ModifyDepotBillProduct AS ProductMoney_FromBillProduct,
- MP.*,@NextNo as No_ModifyDepotBill,
- P.No_Product AS ProductNo_FromBillProduct,
- P.Name_Product AS ProductName_FromBillProduct,
- P.Unit_Product AS ProductUnit_FromBillProduct,
- L.Name_Location
- FROM ModifyDepotBillProduct MP
- INNER JOIN Product P ON P.ID_Product = MP.ID_Product
- INNER JOIN Location L ON L.ID_Location = MP.ID_Location
- LEFT JOIN BillType MS ON MS.Value_BillType = MP.Type_FromBill
- WHERE MP.ID_ModifyDepotBill = @ID
- Order By CAST(MP.No_ModifyDepotBillProduct AS INT)
- ">
- <Params>
- <Param name="@No_ModifyDepotBill" type="ModifyDepotBill.No_ModifyDepotBill" Index="0" />
- </Params>
- <Tables>
- <Table name="ModifyDepotBill" />
- <Table name="ModifyDepotBillProduct" />
- </Tables>
- </SearchModifyDepotBillFirst>
- <SearchChangedDepot CmdType="Text" CmdText="SELECT * FROM Location WHERE Level_Location = 0">
- <Tables>
- <Table name="ChangeDepot" />
- </Tables>
- </SearchChangedDepot>
- <SearchType CmdType="Text" CmdText="SELECT * FROM ModifyTypeSettings">
- <Tables>
- <Table name="ModifyTypeSettings" />
- </Tables>
- </SearchType>
- <SearchCurrency CmdType="Text" CmdText="SELECT SysCurrency_SystemSetting From SystemSetting">
- <Tables>
- <Table name="Currency" />
- </Tables>
- </SearchCurrency>
- <SearchProposer CmdType="Text" CmdText="SELECT * FROM Employee WHERE SuspendDate_Employee is null">
- <Tables>
- <Table name="Proposer" />
- </Tables>
- </SearchProposer>
- <SearchProductWithNo CmdType="Text" CmdText="SELECT * FROM Product WHERE Product.No_Product = @No_Product">
- <Params>
- <Param name="@No_Product" type="Product.No_Product" Index="0" />
- </Params>
- <Tables>
- <Table name="Product" />
- </Tables>
- </SearchProductWithNo>
- <SearchSourceBillName CmdType="Text" CmdText="SELECT * FROM BillType WHERE Value_BillType = 21 OR Value_BillType = 22 OR Value_BillType = 4 OR Value_BillType = 41 OR Value_BillType = 0 ORDER BY Value_BillType">
- <Tables>
- <Table name="BillType" />
- </Tables>
- </SearchSourceBillName>
- <SearchLocation CmdType="Text" CmdText="DECLARE @LEVE INT
- DECLARE @ID_WAREHOUSE UNIQUEIDENTIFIER
- SELECT TOP 1 @LEVE = LocationLevel_SystemSetting FROM SystemSetting
- SELECT @ID_WAREHOUSE = ID_Location FROM Location WHERE Name_Location = @Name_Location
- SELECT * FROM Location WHERE Level_Location = @LEVE AND ID_Warehouse = @ID_WAREHOUSE">
- <Params>
- <Param name="@Name_Location" type="Location.Name_Location" Index="0" />
- </Params>
- <Tables>
- <Table name="Location" />
- </Tables>
- </SearchLocation>
- <SearchAllLocation CmdType="Text" CmdText="SELECT No_Location,Name_Location FROM Location ">
- <Tables>
- <Table name="Location" />
- </Tables>
- </SearchAllLocation>
- <SearchSaleBackAndInDepot CmdType="Text" CmdText="SELECT TOP 1 SaleBackAndInDepot_SystemSetting FROM SystemSetting">
- <Tables>
- <Table name="SystemSetting" />
- </Tables>
- </SearchSaleBackAndInDepot>
- <SearchAuditOrNot CmdType="Text" CmdText=" DECLARE @SQL NVARCHAR(1000)
- DECLARE @TABLENAME NVARCHAR(64)
- SELECT @TABLENAME=Type_BillType FROM BillType WHERE Value_BillType = @Type_Bill
- IF @TABLENAME IS NULL OR @TABLENAME = ''
- BEGIN
- SELECT 0 AS RESULT
- RETURN
- END
- SET @SQL=N'DECLARE @IDAUDIT UNIQUEIDENTIFIER SET @IDAUDIT='+NCHAR(39)+N'00000000-0000-0000-0000-000000000000'+NCHAR(39)
- SET @SQL=@SQL+N' SELECT @IDAUDIT='+@TABLENAME+N'.ID_ASSESSOR FROM ' + @TABLENAME
- SET @SQL=@SQL+N' WHERE No_'+@TABLENAME+N'=@VNo_SaleRtnBill'
- SET @SQL=@SQL+N' IF @IDAUDIT IS NOT NULL AND @IDAUDIT='+NCHAR(39)+N'00000000-0000-0000-0000-000000000000'+NCHAR(39)
- SET @SQL=@SQL+N' SELECT 0 AS RESULT '
- SET @SQL=@SQL+N' ELSE IF @IDAUDIT IS NOT NULL AND @IDAUDIT!='+NCHAR(39)+N'00000000-0000-0000-0000-000000000000'+NCHAR(39)
- SET @SQL=@SQL+N' SELECT 1 AS RESULT '
- SET @SQL=@SQL+N' ELSE SELECT TOP 0 0 AS RESULT'
- EXECUTE sp_executesql @SQL,N'@VNo_SaleRtnBill NVARCHAR(64)',@No_Bill">
- <Params>
- <Param name="@Type_Bill" type="BillType.Value_BillType" Index="0" />
- <Param name="@No_Bill" type="SaleBill.No_SaleBill" Index="1" />
- </Params>
- <Tables>
- <Table name="AuditOrNot" />
- </Tables>
- </SearchAuditOrNot>
- <SearchFromProduct CmdType="Text" CmdText=" DECLARE @SQL NVARCHAR(1000)
- DECLARE @TABLENAME NVARCHAR(64)
- SELECT @TABLENAME=Type_BillType FROM BillType WHERE Value_BillType = @Type_FromBill
- SET @SQL=N'SELECT A.ID_'+@TABLENAME+N' AS ID_FromBill,'
-
- If @Type_FromBill = 4
- Begin
- SET @SQL=@SQL+N'ABS(A.Quantity_'+@TABLENAME+N'Product - StockQty_'+@TABLENAME+N'Product) AS Quantity_FromBillProduct,'
- End
- Else
- Begin
- If @Type_FromBill = 22
- SET @SQL=@SQL+N'ABS(A.Quantity_'+@TABLENAME+N'Product-A.InQuantity_'+@TABLENAME+N'Product) AS Quantity_FromBillProduct,'
- Else
- SET @SQL=@SQL+N'ABS(A.Quantity_'+@TABLENAME+N'Product) AS Quantity_FromBillProduct,'
- If @Type_FromBill = 22
- Begin
- SET @SQL=@SQL+N'Customer.ShortName_Customer as Comment_FromBillProduct,'
- End
- End
- SET @SQL=@SQL+N'A.UnitPrice_'+@TABLENAME+N'Product AS UnitPrice_FromBillProduct,'
- SET @SQL=@SQL+N'A.Comment_'+@TABLENAME+N'Product AS Comment_FromBillProduct,'
- SET @SQL=@SQL+N'A.Quantity_'+@TABLENAME+N'Product*A.UnitPrice_'+@TABLENAME+N'Product AS ProductMoney_FromBillProduct,'
- SET @SQL=@SQL+N'Product.ID_Product,Product.No_Product,Product.Name_Product,Product.Unit_Product FROM ' + @TABLENAME +N'Product A'
- SET @SQL=@SQL+N' INNER JOIN '+@TABLENAME+N' ON '+@TABLENAME+N'.ID_'+@TABLENAME+N' = A.ID_'+@TABLENAME
- SET @SQL=@SQL+N' INNER JOIN Product ON Product.ID_Product = A.ID_Product'
- If @Type_FromBill = 22
- Begin
- SET @SQL=@SQL+N' INNER JOIN Customer ON Customer.ID_Customer ='+@TABLENAME+N'.ID_Customer'
- End
- SET @SQL=@SQL+N' WHERE '+@TABLENAME+N'.No_'+@TABLENAME+N'=@VNO'
- SET @SQL=@SQL+N' AND A.No_'+@TABLENAME+N'Product='+CHAR(39)+@No_FromBillProduct+CHAR(39)
- EXECUTE sp_executesql @SQL,N'@VNO NVARCHAR(64)',@No_FromBill">
- <Params>
- <Param name="@Type_FromBill" type="ModifyDepotBillProduct.Type_FromBill" Index="0" />
- <Param name="@No_FromBill" type="ModifyDepotBillProduct.No_FromBill" Index="1" />
- <Param name="@No_FromBillProduct" type="ModifyDepotBillProduct.No_FromBillProduct" Index="2" />
- </Params>
- <Tables>
- <Table name="FromProduct" />
- </Tables>
- </SearchFromProduct>
- <SearchAllSaleRtnBill CmdType="Text" CmdText="Select SaleRtnBill.ID_SaleRtnBill,SaleRtnBill.No_SaleRtnBill,SaleRtnBill.Date_SaleRtnBill,Customer.No_Customer,Customer.ShortName_Customer,Case When SaleRtnBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_SaleRtnBill,Location.Name_Location From SaleRtnBill
- Inner Join Customer On SaleRtnBill.ID_Customer = Customer.ID_Customer
- Inner Join Location On Location.ID_Location = SaleRtnBill.ID_Location">
- <Tables>
- <Table name="AllSaleRtnBill" />
- </Tables>
- </SearchAllSaleRtnBill>
- <SearchAllSaleRtnBillProduct CmdType="Text" CmdText="Select Product.No_Product,SaleRtnBillProduct.No_SaleRtnBillProduct,Product.Name_Product,SaleRtnBillProduct.Quantity_SaleRtnBillProduct,SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct From SaleRtnBillProduct
- Inner Join Product On Product.ID_Product = SaleRtnBillProduct.ID_Product
- Inner Join SaleRtnBill On SaleRtnBill.ID_SaleRtnBill = SaleRtnBillProduct.ID_SaleRtnBill">
- <Tables>
- <Table name="AllSaleRtnBillProduct" />
- </Tables>
- </SearchAllSaleRtnBillProduct>
- <!--<SearchAllStocktakingBill CmdType="Text" CmdText="Select StocktakingBill.ID_StocktakingBill,StocktakingBill.No_StocktakingBill,StocktakingBill.Date_StocktakingBill,Case When StocktakingBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_StocktakingBill,Location.Name_Location From StocktakingBill
- Inner Join Location On Location.ID_Location = StocktakingBill.ID_Location">
- <Tables>
- <Table name="AllStocktakingBill" />
- </Tables>
- </SearchAllStocktakingBill>
- <SearchAllStocktakingBillProduct CmdType="Text" CmdText="Select Product.No_Product,StocktakingBillProduct.No_StocktakingBillProduct,Product.Name_Product,StocktakingBillProduct.Quantity_StocktakingBillProduct,StocktakingBillProduct.UnitPrice_StocktakingBillProduct From StocktakingBillProduct
- Inner Join Product On Product.ID_Product = StocktakingBillProduct.ID_Product
- Inner Join StocktakingBill On StocktakingBill.ID_StocktakingBill = StocktakingBillProduct.ID_StocktakingBill">
- <Tables>
- <Table name="AllStocktakingBillProduct" />
- </Tables>
- </SearchAllStocktakingBillProduct>-->
- <SearchAllStocktakingBill1 CmdType="Text" CmdText="Select StocktakingBill.ID_StocktakingBill,StocktakingBill.No_StocktakingBill,StocktakingBill.Date_StocktakingBill,Case When StocktakingBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_StocktakingBill,Location.Name_Location From StocktakingBill
- Inner Join Location On Location.ID_Location = StocktakingBill.ID_Location
- Where Exists
- (Select * From StocktakingBillProduct Where (Quantity_StocktakingBillProduct-StockQty_StocktakingBillProduct) > 0
- And StocktakingBillProduct.ID_StocktakingBill=StocktakingBill.ID_StocktakingBill )
- ">
- <Tables>
- <Table name="AllStocktakingBill" />
- </Tables>
- </SearchAllStocktakingBill1>
- <SearchAllStocktakingBillProduct1 CmdType="Text" CmdText="Select Product.No_Product,StocktakingBillProduct.No_StocktakingBillProduct,Product.Name_Product,StocktakingBillProduct.Quantity_StocktakingBillProduct,StocktakingBillProduct.UnitPrice_StocktakingBillProduct From StocktakingBillProduct
- Inner Join Product On Product.ID_Product = StocktakingBillProduct.ID_Product
- Inner Join StocktakingBill On StocktakingBill.ID_StocktakingBill = StocktakingBillProduct.ID_StocktakingBill
- Where (Quantity_StocktakingBillProduct-StockQty_StocktakingBillProduct) > 0
- ">
- <Tables>
- <Table name="AllStocktakingBillProduct" />
- </Tables>
- </SearchAllStocktakingBillProduct1>
-
- <SearchAllStocktakingBill2 CmdType="Text" CmdText="Select StocktakingBill.ID_StocktakingBill,StocktakingBill.No_StocktakingBill,StocktakingBill.Date_StocktakingBill,Case When StocktakingBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_StocktakingBill,Location.Name_Location From StocktakingBill
- Inner Join Location On Location.ID_Location = StocktakingBill.ID_Location
- Where Exists
- (Select * From StocktakingBillProduct Where (Quantity_StocktakingBillProduct-StockQty_StocktakingBillProduct) < 0
- And StocktakingBillProduct.ID_StocktakingBill=StocktakingBill.ID_StocktakingBill )
- ">
- <Tables>
- <Table name="AllStocktakingBill" />
- </Tables>
- </SearchAllStocktakingBill2>
- <SearchAllStocktakingBillProduct2 CmdType="Text" CmdText="Select Product.No_Product,StocktakingBillProduct.No_StocktakingBillProduct,Product.Name_Product,StocktakingBillProduct.Quantity_StocktakingBillProduct,StocktakingBillProduct.UnitPrice_StocktakingBillProduct From StocktakingBillProduct
- Inner Join Product On Product.ID_Product = StocktakingBillProduct.ID_Product
- Inner Join StocktakingBill On StocktakingBill.ID_StocktakingBill = StocktakingBillProduct.ID_StocktakingBill
- Where (Quantity_StocktakingBillProduct-StockQty_StocktakingBillProduct) < 0
- ">
- <Tables>
- <Table name="AllStocktakingBillProduct" />
- </Tables>
- </SearchAllStocktakingBillProduct2>
- <SearchStockSettle CmdType="Text" CmdText="
- Select * From StockSettleAccounts
- Where DateDiff(Day,@Date_ModifyDepotBill,FromDate_StockSettleAccounts) <=0
- And DateDiff(Day,@Date_ModifyDepotBill,EndDate_StockSettleAccounts) >=0
- And Status_StockSettleAccounts=0
- ">
- <Params>
- <Param name="@Date_ModifyDepotBill" type="PurchaseInDepotBill.Date_ModifyDepotBill" Index="0" />
- </Params>
- <Tables>
- <Table name="StockSettle" />
- </Tables>
- </SearchStockSettle>
- <!--<SearchOneLocation CmdType="" CmdText="Select Top 1 B.ID_Location,B.No_Location,B.Name_Location From Location B
- inner join Location C on B.ID_Warehouse = C.ID_Location
- Left Join ProductStocks On ProductStocks.ID_Location = B.ID_Location
- Left Join Product On Product.ID_Product = ProductStocks.ID_Product
- Where C.Name_Location = '公司仓库' And B.LowestLevel_Location =1 And No_Product= @No_Product
- Order By B.No_Location">
- <Params>
- <Param name="@No_Product" type="Product.No_Product" Index="0" />
- </Params>
- <Tables>
- <Table name="OneLocation" />
- </Tables>
- </SearchOneLocation>-->
- <SearchOneLocation CmdType="" CmdText="SELECT Top 1 Location.ID_Location,No_Location,Name_Location FROM ProductStocks
- LEFT JOIN Location ON ProductStocks.ID_Location = Location.ID_Location
- Left Join Product On Product.ID_Product = ProductStocks.ID_Product
- WHERE No_Product = @No_Product AND SubjectionID_Location is not Null
- And Mark_ProductStocks = 1">
- <Params>
- <Param name="@No_Product" type="Product.No_Product" Index="0" />
- </Params>
- <Tables>
- <Table name="OneLocation" />
- </Tables>
- </SearchOneLocation>
- <SearchExistsProduct CmdType="" CmdText="SELECT * FROM ProductStocks
- LEFT JOIN Location ON ProductStocks.ID_Location = Location.ID_Location
- Left Join Product On Product.ID_Product = ProductStocks.ID_Product
- WHERE SubjectionID_Location is not Null
- And No_Location = @No_Location And No_Product Not In (@No_Product)
- And Mark_ProductStocks = 1">
- <Params>
- <Param name="@No_Location" type="Location.No_Location" Index="0" />
- <Param name="@No_Product" type="Product.No_Product" Index="1" />
- </Params>
- <Tables>
- <Table name="ExistsProduct" />
- </Tables>
- </SearchExistsProduct>
- <SearchSourceBill CmdType="" CmdText="Select ModName_ModifyTypeSettings As ModName from dbo.ModifyDepotBill
- Left Join ModifyTypeSettings On ModifyTypeSettings.ID_ModifyTypeSettings = ModifyDepotBill.Style_ModifyDepotBill
- Where No_ModifyDepotBill = @No_ModifyDepotBill">
- <Params>
- <Param name="@No_ModifyDepotBill" type="ModifyDepotBill.No_ModifyDepotBill" Index="0" />
- </Params>
- <Tables>
- <Table name="ModName" />
- </Tables>
- </SearchSourceBill>
- </Search>
- </Server>
- <Lables>
- <Search>
- Empty();
- NewInstance();
- timeChange.Enabled=false;
- tbNo.ReadOnly=false;
- cbDepot.Enabled=false;
- cbType.Enabled=false;
- txtSource.ReadOnly=true;
- cbCurrency.Enabled=false;
- cbProposer.Enabled=false;
- txtComment.ReadOnly=true;
- dgProduct.ReadOnly=true;
- toolBar.EnableNew = GetRight(@Title,"新增");
- toolBar.EnableSubmit = false;
- toolBar.EnableModify = false;
- toolBar.EnableDelete = false;
- toolBar.EnableAudit = false;
- toolBar.EnableUnAudit = false;
- toolBar.EnablePrint = false;
- toolBar.EnableImport = false;
- btnDelete.Enabled =false;
- cbCurrency.Text="";
- #ModifyDepotBill.Currency_ModifyDepotBill=DBNull();
- #ModifyDepotBill.ID_Creator=DBNull();
- #ModifyDepotBill.ID_Assessor=DBNull();
- #ModifyDepotBill.AssessDate_ModifyDepotBill=DBNull();
- #ModifyDepotBill.LastModUser_ModifyDepotBill=DBNull();
- #ModifyDepotBill.LastModDate_ModifyDepotBill=DBNull();
- UpdateForm(true, "");
- tbNo.Focus();
- @Status=0;
- </Search>
- <New>
- Empty();
- NewInstance();
- timeChange.Enabled=true;
- tbNo.ReadOnly=true;
- cbDepot.Enabled=true;
- cbType.Enabled=true;
- txtSource.ReadOnly=false;
- cbProposer.Enabled=true;
- txtComment.ReadOnly=false;
- dgProduct.ReadOnly=false;
- toolBar.EnableNew = false;
- toolBar.EnableSubmit = GetRight(@Title,"新增");
- toolBar.EnableModify = false;
- toolBar.EnableDelete = false;
- toolBar.EnableAudit = false;
- toolBar.EnableUnAudit = false;
- toolBar.EnablePrint = false;
- toolBar.EnableImport = true;
- btnDelete.Enabled = false;
- cbCurrency.Text=@SysCurrency;
- <!--#ModifyDepotBillProduct.ID_Location = #ModifyDepotBill.ID_Location;-->
- #ModifyDepotBill.ID_ModifyDepotBill = NewGuid();
- #ModifyDepotBill.Currency_ModifyDepotBill=@SysCurrency;
- #ModifyDepotBill.Maker_ModifyDepotBill=GetCurrentUser();
- #ModifyDepotBill.ID_Creator=GetLoginUserID();
- #ModifyDepotBill.No_ModifyDepotBill=GetNextAutoNumber(true);
- #ModifyDepotBill.ID_Assessor=DBNull();
- #ModifyDepotBill.AssessDate_ModifyDepotBill=DBNull();
- #ModifyDepotBill.LastModUser_ModifyDepotBill=DBNull();
- #ModifyDepotBill.LastModDate_ModifyDepotBill=DBNull();
- #ModifyDepotBill.ID_Location=GetCurrentDepotID();
- #ModifyDepotBill.ChangedDepot_ModifyDepotBill=GetCurrentDepot();
- #ModifyDepotBill.ChangedDepotNo_ModifyDepotBill=GetCurrentDepotNo();
- #ModifyDepotBill.Date_ModifyDepotBill=GetCurrentTime();
- dgProduct.SetColumnReadOnly(1, false);
- dgProduct.SetColumnReadOnly(2, false);
- dgProduct.SetColumnReadOnly(3, false);
- dgProduct.SetColumnReadOnly(4, false);
- dgProduct.RowHeaderCheck=true;
- dgProduct.AllowNew(true);
- dgProduct.AllowDelete(true);
- UpdateForm(true, "");
- SetColumnDefaultValue("ModifyDepotBillProduct", "Quantity_ModifyDepotBillProduct",1 );
- @Status=1;
- </New>
- <View>
- timeChange.Enabled=false;
- tbNo.ReadOnly=false;
- cbDepot.Enabled=false;
- cbType.Enabled=false;
- txtSource.ReadOnly=true;
- cbProposer.Enabled=false;
- txtComment.ReadOnly=true;
- dgProduct.ReadOnly=true;
- toolBar.EnableNew = GetRight(@Title,"新增");
- toolBar.EnableSubmit = false;
- if(Search("SearchStockSettle",#ModifyDepotBill.Date_ModifyDepotBill))
- {
- if(Equals(#ModifyDepotBill.ID_Assessor, DBNull()))
- {
- if(#ModifyDepotBill.Disable_ModifyDepotBill==false)
- {
- toolBar.EnableAudit=GetRight(@Title,"审核");
- toolBar.EnableModify=GetRight(@Title,"修改");
- toolBar.EnableDelete=GetRight(@Title,"删除");
- }
- else
- {
- toolBar.EnableAudit = false;
- toolBar.EnableModify = false;
- toolBar.EnableDelete = false;
- }
- toolBar.EnableUnAudit = false;
- btnDelete.Enabled = false;
- }
- else
- {
- toolBar.EnableAudit=false;
- toolBar.EnableUnAudit=GetRight(@Title,"取消审核");
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- btnDelete.Enabled = GetRight(@Title,"取消审核")&&GetRight(@Title,"删除");
- }
- toolBar.EnablePrint =GetRight(@Title,"打印");
- }
- else
- {
- toolBar.EnablePrint=false;
- toolBar.EnableAudit=false;
- toolBar.EnableUnAudit=false;
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- btnDelete.Enabled = false;
- }
- toolBar.EnableImport = false;
- UpdateForm(true, "");
- @Status=2;
- </View>
- <Modify>
- timeChange.Enabled=false;
- tbNo.ReadOnly=true;
- cbDepot.Enabled=true;
- cbType.Enabled=true;
- txtSource.ReadOnly=false;
- cbProposer.Enabled=true;
- txtComment.ReadOnly=false;
- dgProduct.ReadOnly=false;
- toolBar.EnableNew = false;
- toolBar.EnableSubmit = GetRight(@Title,"修改");
- toolBar.EnableModify = false;
- toolBar.EnableDelete = false;
- toolBar.EnableAudit = false;
- toolBar.EnableUnAudit = false;
- toolBar.EnablePrint = false;
- toolBar.EnableImport = false;
- btnDelete.Enabled = false;
- #ModifyDepotBill.LastModUser_ModifyDepotBill=GetLoginUserID();
- #ModifyDepotBill.lastModflyuser_ModifyDepotBill=GetCurrentUser();
- #ModifyDepotBill.LastModDate_ModifyDepotBill=DateTimeNow();
- @HaveAccessed = !Equals(#ModifyDepotBill.AssessDate_ModifyDepotBill,DBNull());
- dgProduct.SetColumnReadOnly(1, @HaveAccessed);
- dgProduct.SetColumnReadOnly(2, @HaveAccessed);
- dgProduct.SetColumnReadOnly(3, @HaveAccessed);
- dgProduct.SetColumnReadOnly(4, @HaveAccessed);
- dgProduct.AllowNew(!@HaveAccessed);
- dgProduct.AllowDelete(!@HaveAccessed);
- dgProduct.RowHeaderCheck=!@HaveAccessed;
- SetColumnDefaultValue("ModifyDepotBillProduct", "Quantity_ModifyDepotBillProduct",1 );
- UpdateForm(true, "");
- @Status=3;
- </Modify>
- <SubmitButtonClick>
- <![CDATA[
- @tag = 0;
- Search("SearchLocation",cbDepot.SelectedName);
- Search("SearchType");
- UpdateForm(false, "");
- if(!Search("SearchStockSettle",timeChange.Value))
- {
- MessageBox("制单日期不在开帐区间内,提交失败!");
- return;
- }
- if (!cbDepot.CheckSelectedItem())
- {
- MessageBox("请选择有效的异动仓库!",@Title);
- cbDepot.Focus();
- return;
- }
- if (!cbType.CheckSelectedItem())
- {
- MessageBox("请选择有效的异动类型!",@Title);
- cbType.Focus();
- return;
- }
- if (!cbProposer.CheckSelectedItem())
- {
- MessageBox("请选择有效的异动申请人!",@Title);
- cbProposer.Focus();
- return;
- }
- if(RowCount("#ModifyDepotBillProduct")==0)
- {
- MessageBox("请输入异动产品!",@Title);
- dgProduct.Focus();
- return;
- }
- if(Equals(cbType.SelectedName,"借入归还"))
- {
- if(Search("SearchSourceBill",#ModifyDepotBill.Source_ModifyDepotBill))
- {
- if(!Equals(#ModName.ModName,"借入"))
- {
- MessageBox("请在异动来源中填入原“借入”单号!",@Title);
- txtSource.Focus();
- return;
- }
- }
- else
- {
- MessageBox("请在异动来源中填入原“借入”单号!",@Title);
- txtSource.Focus();
- return;
- }
- }
- if(Equals(cbType.SelectedName,"借出归还"))
- {
- if(Search("SearchSourceBill",#ModifyDepotBill.Source_ModifyDepotBill))
- {
- if(!Equals(#ModName.ModName,"借出"))
- {
- MessageBox("请在异动来源中填入原“借出”单号!",@Title);
- txtSource.Focus();
- return;
- }
- }
- else
- {
- MessageBox("请在异动来源中填入原“借出”单号!",@Title);
- txtSource.Focus();
- return;
- }
- }
- @Outer=0;
- SuspendLayout();
- for(@i=RowCount("#ModifyDepotBillProduct")-1;@i>=0;@i=@i-1)
- {
- SetPosition("#ModifyDepotBillProduct", @i);
- #ModifyDepotBillProduct.Style_ModifyDepotBill = #ModifyDepotBill.Style_ModifyDepotBill;
- dgProduct.CurrentRowIndex = @i;
- if(Equals(#ModifyDepotBillProduct.ID_ModifyDepotBillProduct,GuidEmpty()))
- {
- #ModifyDepotBillProduct.ID_ModifyDepotBillProduct = NewGuid();
- }
- #ModifyDepotBillProduct.ID_ModifyDepotBill = #ModifyDepotBill.ID_ModifyDepotBill;
- if(Equals(#ModifyDepotBillProduct.ID_Product,GuidEmpty())||Equals(#ModifyDepotBillProduct.ID_Product,DBNull())||Equals(#ModifyDepotBillProduct.ProductNo_FromBillProduct,""))
- {
- MessageBox("请输入有效产品编号!",@Title);
- ResumeLayout();
- dgProduct.Focus();
- return;
- }
- if(Equals(#ModifyDepotBillProduct.ID_Location,GuidEmpty())||Equals(#ModifyDepotBillProduct.ID_Location,DBNull())||Equals(#ModifyDepotBillProduct.Name_Location,""))
- {
- MessageBox("请填写有效的异动库位!",@Title);
- ResumeLayout();
- dgProduct.Focus();
- return;
- }
- for(@inner=0;@inner < RowCount("#Location"); @inner++)
- {
- SetPosition("#Location", @inner);
- if(Equals(#Location.ID_Location,#ModifyDepotBillProduct.ID_Location))
- @Outer=1;
- }
- if(@Outer==0)
- {
- MessageBox("该库位不属于所选仓库,请重新选择!",@Title);
- ResumeLayout();
- return;
- }
- if(Equals(cbType.SelectedName,"销退入库"))
- {
- Search("SearchSaleBackAndInDepot");
- if(Equals(#SystemSetting.SaleBackAndInDepot_SystemSetting,true))
- {
- if(!Equals(#ModifyDepotBillProduct.Type_FromBill,0)&&Search("SearchFromProduct",#ModifyDepotBillProduct.Type_FromBill,#ModifyDepotBillProduct.No_FromBill,#ModifyDepotBillProduct.No_FromBillProduct))
- {
- if(!Equals(#ModifyDepotBillProduct.ID_Product,#FromProduct.ID_Product))
- {
- MessageBox("该来源单据产品与输入的产品不匹配!",@Title);
- ResumeLayout();
- dgProduct.Focus();
- return;
- }
- }
- else
- {
- MessageBox("该来源单据产品不存在!",@Title);
- ResumeLayout();
- dgProduct.Focus();
- return;
- }
- if(!Search("SearchAuditOrNot",#ModifyDepotBillProduct.Type_FromBill,#ModifyDepotBillProduct.No_FromBill))
- {
- @DialogResult=MessageBox("该来源单尚未经过审核,确定要保留来源单据资料吗?",@Title,MB_OKCANCEL);
- if(@DialogResult==DialogResult("CANCEL"))
- {
- ResumeLayout();
- dgProduct.Focus();
- return;
- }
- }
- }
- else
- {
- if(!Search("SearchAuditOrNot",#ModifyDepotBillProduct.Type_FromBill,#ModifyDepotBillProduct.No_FromBill))
- {
- @DialogResult=MessageBox("该来源单尚未经过审核,确定要保留来源单据资料吗?",@Title,MB_YESNOCANCEL);
- if(@DialogResult==DialogResult("NO"))
- {
- #ModifyDepotBillProduct.Type_FromBill=0;
- #ModifyDepotBillProduct.No_FromBill="";
- #ModifyDepotBillProduct.No_FromBillProduct="";
- #ModifyDepotBillProduct.SourceBillName_ModifyDepotBillProduct="";
- }
- else if(@DialogResult==DialogResult("CANCEL"))
- {
- ResumeLayout();
- return;
- }
- }
- }
- }
- else
- {
- if(!Search("SearchAuditOrNot",#ModifyDepotBillProduct.Type_FromBill,#ModifyDepotBillProduct.No_FromBill))
- {
- @DialogResult=MessageBox("该来源单尚未经过审核,确定要保留来源单据资料吗?",@Title,MB_YESNOCANCEL);
- if(@DialogResult==DialogResult("NO"))
- {
- #ModifyDepotBillProduct.Type_FromBill=0;
- #ModifyDepotBillProduct.No_FromBill="";
- #ModifyDepotBillProduct.No_FromBillProduct="";
- #ModifyDepotBillProduct.SourceBillName_ModifyDepotBillProduct="";
- }
- else if(@DialogResult==DialogResult("CANCEL"))
- {
- ResumeLayout();
- return;
- }
- }
- }
-
- if(Equals(cbType.SelectedName,"盘盈") || Equals(cbType.SelectedName,"销退入库") || Equals(cbType.SelectedName,"借入") || Equals(cbType.SelectedName,"借出归还") || Equals(cbType.SelectedName,"调整增加"))
- {
- if(Search("SearchExistsProduct",#ModifyDepotBillProduct.No_Location,#ModifyDepotBillProduct.ProductNo_FromBillProduct))
- {
- dgProduct.CurrentRowIndex = @i;
- dgProduct.Focus();
- @DialogResult=MessageBox("该库位已被其他产品占用,确定要提交吗?",@Title,MB_OKCANCEL);
- if(@DialogResult == DialogResult("CANCEL"))
- {
- ResumeLayout(); return;
- }
- }
- Register_Set("1",#ModifyDepotBillProduct.No_Location);
- Register_Set("2",#ModifyDepotBillProduct.ProductNo_FromBillProduct);
- for(@j=@i+1;@j<=RowCount("#ModifyDepotBillProduct")-1;@j=@j+1)
- {
- SetPosition("#ModifyDepotBillProduct",@j);
- if(Equals(Register_Get("1"),#ModifyDepotBillProduct.No_Location) && !Equals(Register_Get("2"),#ModifyDepotBillProduct.ProductNo_FromBillProduct))
- {
- @tag = @tag + 1;
- }
- }
- Register_Remove("1");
- Register_Remove("2");
- if(@tag > 0)
- {
- dgProduct.Focus();
- @DialogResult=MessageBox("该单据中存在相同库位,确定要提交吗?",@Title,MB_OKCANCEL);
- if(@DialogResult == DialogResult("CANCEL"))
- {
- ResumeLayout();return;
- }
- }
- }
- }
- ResumeLayout();
- if(@Status==1)
- {
- #ModifyDepotBill.No_ModifyDepotBill = New("#ModifyDepotBill.No_ModifyDepotBill",timeChange.CValue);
- }
- else if(@Status == 3)
- {
- Update();
- }
- ChangeMode("View");
- ]]>
- </SubmitButtonClick>
- <AuditButtonClick>
- <![CDATA[
- BeginAudit();
- @tag = 0;
- if(Equals(cbType.SelectedName,"借入归还"))
- {
- if(Search("SearchSourceBill",#ModifyDepotBill.Source_ModifyDepotBill))
- {
- if(!Equals(#ModName.ModName,"借入"))
- {
- MessageBox("请在异动来源中填入原“借入”单号!",@Title);
- txtSource.Focus();
- return;
- }
- }
- else
- {
- MessageBox("请在异动来源中填入原“借入”单号!",@Title);
- txtSource.Focus();
- return;
- }
- }
- if(Equals(cbType.SelectedName,"借出归还"))
- {
- if(Search("SearchSourceBill",#ModifyDepotBill.Source_ModifyDepotBill))
- {
- if(!Equals(#ModName.ModName,"借出"))
- {
- MessageBox("请在异动来源中填入原“借出”单号!",@Title);
- txtSource.Focus();
- return;
- }
- }
- else
- {
- MessageBox("请在异动来源中填入原“借出”单号!",@Title);
- txtSource.Focus();
- return;
- }
- }
-
- if(Equals(cbType.SelectedName,"盘盈") || Equals(cbType.SelectedName,"销退入库") || Equals(cbType.SelectedName,"借入") || Equals(cbType.SelectedName,"借出归还") || Equals(cbType.SelectedName,"调整增加"))
- {
- SuspendLayout();
- for (@i=0;@i<RowCount("#ModifyDepotBillProduct");@i=@i+1)
- {
- if(Search("SearchExistsProduct",#ModifyDepotBillProduct.No_Location,#ModifyDepotBillProduct.ProductNo_FromBillProduct))
- {
- dgProduct.CurrentRowIndex = @i;
- dgProduct.Focus();
- MessageBox("该库位已被其他产品占用,审核失败!",@Title);
- EndAudit();
- ResumeLayout(); return;
- }
- Register_Set("1",#ModifyDepotBillProduct.No_Location);
- Register_Set("2",#ModifyDepotBillProduct.ProductNo_FromBillProduct);
- for(@j=@i+1;@j<=RowCount("#ModifyDepotBillProduct")-1;@j=@j+1)
- {
- SetPosition("#ModifyDepotBillProduct",@j);
- if(Equals(Register_Get("1"),#ModifyDepotBillProduct.No_Location) && !Equals(Register_Get("2"),#ModifyDepotBillProduct.ProductNo_FromBillProduct))
- {
- @tag = @tag + 1;
- }
- }
- Register_Remove("1");
- Register_Remove("2");
- if(@tag > 0)
- {
- dgProduct.Focus();
- MessageBox("该单据存在相同库位,审核失败!",@Title);
- EndAudit();
- ResumeLayout(); return;
- }
- }
- ResumeLayout();
- }
- #ModifyDepotBill.ID_Assessor = GetLoginUserID();
- #ModifyDepotBill.Assessor_ModifyDepotBill = GetCurrentUser();
- #ModifyDepotBill.AssessDate_ModifyDepotBill = DateTimeNow();
- if(Equals(cbType.SelectedName,"销退入库"))
- {
- Search("SearchSaleBackAndInDepot");
- if(Equals(#SystemSetting.SaleBackAndInDepot_SystemSetting,true))
- {
- Audit();
- EndAudit();
- ChangeMode("View");
- return;
- }
- }
- SuspendLayout();
- for (@i=0;@i<RowCount("#ModifyDepotBillProduct");@i=@i+1)
- {
- SetPosition("#ModifyDepotBillProduct", @i);
- if(!Search("SearchAuditOrNot",#ModifyDepotBillProduct.Type_FromBill,#ModifyDepotBillProduct.No_FromBill))
- {
- dgProduct.CurrentRowIndex = @i;
- @DialogResult=MessageBox("该来源单据未经审核,确定要审核吗?",@Title,MB_OKCANCEL);
- if(@DialogResult==DialogResult("CANCEL"))
- {
- ResumeLayout();
- EndAudit();
- return;
- }
- }
- }
- ResumeLayout();
- Audit();
- EndAudit();
- ChangeMode("View");
- ]]>
- </AuditButtonClick>
- <UnAuditButtonClick>
- <![CDATA[
- BeginUnAudit();
- #ModifyDepotBill.ID_Assessor = DBNull();
- #ModifyDepotBill.Assessor_ModifyDepotBill = "";
- UnAudit();
- EndAudit();
- ChangeMode("View");
- ]]>
- </UnAuditButtonClick>
- </Lables>
- </Form>
- </Forms>
|