1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <Forms>
- <Form Name="FrmPurchaseInDepotBill">
- <Client>
- <Events>
- <Load>
- <![CDATA[
- @SetFlag=1;
- @SetFlag1=1;
- @Title="采购入库单";
- GetSchema();
- ChangeMode("Search");
- Search("SearchProcess");
- Search("SearchLocation");
- Search("SearchOneLocation","p");
-
- Search("SearchPurchaseOrderBillProduct","p","p");
- Search("SearchProduct","p");
- Search("SearchLocationByNo","p");
-
- @StockAndInDepot = #Process.StockAndInDepot_SystemSetting;
- dgProduct.NoMember="No_PurchaseInDepotBillProduct";
- Search("SearchBillType");
- ]]>
- </Load>
- <Closing>
- ;<!--TODO-->
- </Closing>
- <Closed>
- ;<!--TODO-->
- </Closed>
- </Events>
- <Mode>
- <Search>
- <Lable name="Search" />
- </Search>
- <New>
- <Lable name="New" />
- </New>
- <View>
- <Lable name="View" />
- </View>
- <Modify>
- <Lable name="Modify" />
- </Modify>
- </Mode>
- <Controls>
- <IKTextButton name="tbNo" DataSource="PurchaseInDepotBill.No_PurchaseInDepotBill">
- <Events>
- <Enter>
- <![CDATA[
- if(tbNo.ReadOnly == false)
- {
- if(tbNo.CValue != StringEmpty())
- {
- UpdateForm(false, "");
- if(Search("SearchPurchaseInDepotBillWithNo", tbNo.CValue))
- {
- ChangeMode("View");
-
- }
- else
- {
- MessageBox("该采购入库单号不存在!",@Title);
- }
- }
- else
- {
- MessageBox("请输入采购入库单号!", @Title);
-
- }
- }
- ]]>
- </Enter>
- <Click>
- ShowSearchBox("BillSearch","HAVEDEPOT", "tbNo",tbNo.CValue);
- </Click>
- </Events>
- </IKTextButton>
- <IKDataTimePicker name="timeMake" DataSource="PurchaseInDepotBill.Date_PurchaseInDepotBill" />
- <IKTextButton name="tbNoSupplier" DataSource="PurchaseInDepotBill.No_Supplier" >
- <Events>
- <Enter>
- UpdateForm(false,"");
- if(tbNoSupplier.CValue!=StringEmpty())
- {
- if(!Search("SearchSupplier",tbNoSupplier.CValue))
- {
- MessageBox("该供应商不存在!",@Title);
- @temp = ShowSearchBox("SupplierSearch","INFOMATION",tbNoSupplier.CValue);
- if(@temp != "")
- {
- tbNoSupplier.CValue = @temp;
- ActiveControlEvent("tbNoSupplier", "Enter");
- }
- }
- else
- {
- if (!Equals(#Supplier.SuspendDate_Supplier,DBNull()))
- {
- MessageBox("该供应商已停用!",@Title);
- }
- #PurchaseInDepotBill.ID_Supplier=#Supplier.ID_Supplier;
- #PurchaseInDepotBill.ShortName_Supplier=#Supplier.ShortName_Supplier;
- }
- }
- else
- {
- MessageBox("请输入供应商编号!",@Title);
- #PurchaseInDepotBill.ID_Supplier=GuidEmpty();
- #PurchaseInDepotBill.ShortName_Supplier="";
- tbNoSupplier.Focus();
- }
- UpdateForm(true,"");
- </Enter>
- <Click>
- <![CDATA[
- if (tbNoSupplier.ReadOnly == false)
- {
- @temp = ShowSearchBox("SupplierSearch","INFOMATION",tbNoSupplier.CValue);
- if( @temp == "" )
- return;
- tbNoSupplier.CValue = @temp;
- ActiveControlEvent("tbNoSupplier", "Enter");
- }
- ]]>
- </Click>
- </Events>
- </IKTextButton>
- <IKTextBox name="txtShortName" DataSource="PurchaseInDepotBill.EncasementNo_PurchaseInDepotBill">
- <Events>
- <Enter>
- <![CDATA[
- if(txtShortName.CValue!=StringEmpty())
- {
- if(Search("SearchByEncasementNo",txtShortName.CValue))
- {
- if(!Equals(#OnShipProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!");
- }
- MergeTable("#OnShipProduct","#PurchaseInDepotBillProduct");
-
- SuspendLayout();
- for(@i=0;@i<RowCount("#PurchaseInDepotBillProduct");@i=@i+1)
- {
- SetPosition("#PurchaseInDepotBillProduct",@i);
- #PurchaseInDepotBillProduct.No_PurchaseInDepotBillProduct = @i + 1;
- }
- ResumeLayout();
- dgProduct.RowHeaderCheck=true;
- }
- else
- {
-
- MessageBox("您输入的装箱单号不存在!",@Title);
- txtShortName.Focus();
- }
- }
- else
- {
- MessageBox("请输入装箱单号!");
- txtShortName.Focus();
- }
- ]]>
- </Enter>
- </Events>
- </IKTextBox>
- <IKTextBox name="txtSupplierShortName" DataSource="PurchaseInDepotBill.ShortName_Supplier"/>
-
-
- <IKComboBoxEx name="cbProposer" ValueSource="PurchaseInDepotBill.ID_QA" DisplaySource="PurchaseInDepotBill.Name_Principal" NoSource="PurchaseInDepotBill.No_Principal" DataSource="Principal" DisplayMember="Name_Principal" NoMember="No_Principal" ValueMember="ID_Employee">
- <Events>
- <Reload>
- UpdateForm(false, "cbProposer");
- Search("SearchPrincipal");
- UpdateForm(true, "cbProposer");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKComboBoxEx name="cbLocation" DisplaySource="PurchaseInDepotBill.Name_Location" NoSource="PurchaseInDepotBill.No_Location"
- ValueSource="PurchaseInDepotBill.ID_Location" DataSource="Location" DisplayMember="Name_Location"
- NoMember="No_Location" ValueMember="ID_Location">
- <Events>
- <Reload>
- UpdateForm(false, "cbLocation");
- Search("SearchLocation");
- UpdateForm(true, "cbLocation");
- </Reload>
- <!-- <SelectedIndexChanged>
- if (RowCount("#PurchaseInDepotBillProduct") > 0)
- {
- SuspendLayout();
- for (@i=0;@i < RowCount("#PurchaseInDepotBillProduct");@i=@i+1)
- {
- SetPosition("#PurchaseInDepotBillProduct", @i);
- #PurchaseInDepotBillProduct.Name_Location ="";
- #PurchaseInDepotBillProduct.ID_Location=GuidEmpty();
- }
- ResumeLayout();
- }
- </SelectedIndexChanged>-->
- </Events>
- </IKComboBoxEx>
- <IKTextBox name="txtComment" DataSource="PurchaseInDepotBill.Comment_PurchaseInDepotBill" />
- <IKTextBox name="txtMaker" DataSource="PurchaseInDepotBill.Creator" />
- <IKTextBox name="txtAssessor" DataSource="PurchaseInDepotBill.Assessor" />
- <IKDateTimeText name="dtAssessDate" DataSource="PurchaseInDepotBill.AssessDate_PurchaseInDepotBill" />
- <IKTextBox name="txtlastModUser" DataSource="PurchaseInDepotBill.LastModUser" />
- <IKDateTimeText name="dtLastModDate" DataSource="PurchaseInDepotBill.LastModDate_PurchaseInDepotBill" />
- <IKDataGridEx name="dgProduct" DataSource="PurchaseInDepotBillProduct" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="PurchaseInDepotBillProduct.No_PurchaseInDepotBillProduct" />
- <DataColumn Index="1" DataSource="PurchaseInDepotBillProduct.Name_BillType" >
- <IKDataGridComboBoxColumn DisplaySourceEx="PurchaseInDepotBillProduct.Name_BillType" ValueSourceEx="PurchaseInDepotBillProduct.Type_FromBill" DataSourceEx="BillType" DisplayMemberEx="Name_BillType" ValueMemberEx="Value_BillType">
- <Events>
- <Reload>
- Search("SearchBillType");
- SetDataGridColumnDataSource(1,"dgProduct");
- </Reload>
- </Events>
- </IKDataGridComboBoxColumn>
- </DataColumn>
- <DataColumn Index="2" DataSource="PurchaseInDepotBillProduct.No_FromBill" />
- <DataColumn Index="3" DataSource="PurchaseInDepotBillProduct.No_FromBillProduct" />
- <DataColumn Index="4" DataSource="PurchaseInDepotBillProduct.RefNo_PurchaseInDepotBill" />
- <DataColumn Index="5" DataSource="PurchaseInDepotBillProduct.No_Product" >
- <IKDataGridTextButtonColumn>
- <Events>
- <Click>
- @SetFlag=1;
- ShowSearchBox("ProductSearch","INFOMATION",#PurchaseInDepotBillProduct.No_Product);
- </Click>
- <SetFlagBeforeClick>
- @SetFlag=0;
- </SetFlagBeforeClick>
- </Events>
- </IKDataGridTextButtonColumn>
- </DataColumn>
- <DataColumn Index="6" DataSource="PurchaseInDepotBillProduct.Name_Product" />
- <DataColumn Index="7" DataSource="PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct" />
- <DataColumn Index="8" DataSource="PurchaseInDepotBillProduct.Unit_Product" />
- <DataColumn Index="9" DataSource="PurchaseInDepotBillProduct.No_Location" >
- <IKDataGridTextButtonColumn>
- <Events>
- <Click>
- @SetFlag1=1;
- @LocationNo = ShowSearchBox("LocationSearch","INFOMATION",#PurchaseInDepotBillProduct.No_Location);
- if(@LocationNo != "")
- #PurchaseInDepotBillProduct.No_Location = @LocationNo;
- </Click>
- <SetFlagBeforeClick>
- @SetFlag1=0;
- </SetFlagBeforeClick>
- </Events>
- </IKDataGridTextButtonColumn>
- </DataColumn>
- <DataColumn Index="10" DataSource="PurchaseInDepotBillProduct.Name_Location" />
- <DataColumn Index="11" DataSource="PurchaseInDepotBillProduct.Comment_PurchaseInDepotBillProduct" />
- </IKDataGridEx>
- <IKFormToolBar name="toolBar">
- <Events>
- <ClickFirst>
- if(Search("SearchPurchaseInDepotBillFirst"))
- {
- ChangeMode("View");
- }
- </ClickFirst>
- <ClickPrev>
- if(Search("SearchPurchaseInDepotBillPrev", tbNo.CValue))
- {
- ChangeMode("View");
- }
- </ClickPrev>
- <ClickNext>
- if(Search("SearchPurchaseInDepotBillNext",tbNo.CValue))
- {
- ChangeMode("View");
- }
- </ClickNext>
- <ClickLast>
- if(Search("SearchPurchaseInDepotBillLast"))
- {
- ChangeMode("View");
- }
- </ClickLast>
- <ClickNew>
- <![CDATA[
- @NextNo = GetNextAutoNumber(true);
- if (!Equals(@NextNo, ""))
- {
- ChangeMode("New");
- #PurchaseInDepotBill.No_PurchaseInDepotBill= @NextNo;
- UpdateForm(true, "tbNo");
- }
- ]]>
- </ClickNew>
- <ClickEmpty>
- ChangeMode("Search");
- </ClickEmpty>
- <ClickSubmit>
- <Lable name="SubmitButtonClick" />
- </ClickSubmit>
- <ClickModify>
- ChangeMode("Modify");
- txtNumSum.CValue=SumOfCol("#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct");
- </ClickModify>
- <ClickDelete>
- Delete(); ChangeMode("Search");
- </ClickDelete>
- <ClickPrint>
- ShowPrintBox("BillSearch",#PurchaseInDepotBill.No_PurchaseInDepotBill,#PurchaseInDepotBill.No_PurchaseInDepotBill);
- </ClickPrint>
- <ClickAudit>
- <![CDATA[
- @tag = 0;
- SuspendLayout();
- for (@i=0;@i<RowCount("#PurchaseInDepotBillProduct");@i=@i+1)
- {
- SetPosition("#PurchaseInDepotBillProduct", @i);
- if(Search("SearchExistsProduct",#PurchaseInDepotBillProduct.No_Location,#PurchaseInDepotBillProduct.No_Product))
- {
- dgProduct.CurrentRowIndex = @i;
- dgProduct.Focus();
- MessageBox("该库位已被其他产品占用,审核失败!",@Title);
- ResumeLayout(); return;
- }
- Register_Set("1",#PurchaseInDepotBillProduct.No_Location);
- Register_Set("2",#PurchaseInDepotBillProduct.No_Product);
- for(@j=@i+1;@j<=RowCount("#PurchaseInDepotBillProduct")-1;@j=@j+1)
- {
- SetPosition("#PurchaseInDepotBillProduct",@j);
- if(Equals(Register_Get("1"),#PurchaseInDepotBillProduct.No_Location) && !Equals(Register_Get("2"),#PurchaseInDepotBillProduct.No_Product))
- {
- @tag = @tag + 1;
- }
- }
- Register_Remove("1");
- Register_Remove("2");
- if(@tag > 0)
- {
- dgProduct.Focus();
- MessageBox("该单据存在相同库位,审核失败!",@Title);
- ResumeLayout();return;
- }
- }
- ResumeLayout();
-
- if(@StockAndInDepot==false)
- {
- SuspendLayout();
- for (@i=0;@i<RowCount("#PurchaseInDepotBillProduct");@i=@i+1)
- {
- SetPosition("#PurchaseInDepotBillProduct", @i);
- if(#PurchaseInDepotBillProduct.Type_FromBill!=0&&#PurchaseInDepotBillProduct.No_FromBill!=StringEmpty()&&Search("SearchPurchaseOrderBill",#PurchaseInDepotBillProduct.No_FromBill))
- {
- if(Equals(#PurchaseOrderBill.ID_Assessor,DBNull()))
- {
- dgProduct.CurrentRowIndex = @i;
- @DialogResult=MessageBox("来源单据未经审核,确定要审核么?",@Title,MB_OKCANCEL);
- if(@DialogResult == DialogResult("CANCEL"))
- {
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
- }
- }
- ResumeLayout();
- }
- BeginAudit();
- #PurchaseInDepotBill.ID_Assessor=GetLoginUserID();
- #PurchaseInDepotBill.Assessor=GetCurrentUser();
- #PurchaseInDepotBill.AssessDate_PurchaseInDepotBill=DateTimeNow();
- Audit();
- ChangeMode("View");
- EndAudit();
- txtNumSum.CValue=SumOfCol("#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct");
- ]]>
- </ClickAudit>
- <ClickUnAudit>
- if(#PurchaseInDepotBill.CostVerify_PurchaseInDepotBill == true)
- {
- @DialogResult=MessageBox("该单据已经成本核算,确定要取消审核吗?",@Title,MB_OKCANCEL);
- if(@DialogResult == DialogResult("CANCEL"))
- return;
- }
- BeginUnAudit();
- #PurchaseInDepotBill.ID_Assessor=DBNull();
- #PurchaseInDepotBill.Assessor=DBNull();
- #PurchaseInDepotBill.AssessDate_PurchaseInDepotBill=DateTimeNow();
- UnAudit();
- ChangeMode("View");
- EndUnAudit();
- txtNumSum.CValue=SumOfCol("#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct");
- </ClickUnAudit>
- <ClickImport>
- ;
- </ClickImport>
- <ClickExport>
- ;
- </ClickExport>
- <ClickClose>
- ;
- </ClickClose>
- <ClickExpand>
- ;
- </ClickExpand>
- <ClickImportItem>
- <![CDATA[
- if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="采购订单")
- {
- if(Search("SearchContr"))
- {
- ShowSearchBox("ImportPurchaseOrderBillControl","BILLCONVERT","#PurchaseInDepotBillProduct.Type_FromBill",41,"#PurchaseInDepotBillProduct.Name_BillType","采购订单");
- }
- else
- {
- ShowSearchBox("ImportPurchaseOrderBillUnControl","BILLCONVERT");
- }
- }
- ]]>
- <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
- </ClickImportItem>
- <ClickExportItem>
- ;<!--初始化目标数据-->
- <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
- </ClickExportItem>
- </Events>
- </IKFormToolBar>
- </Controls>
- <Tables>
- <Table name="PurchaseInDepotBillProduct">
- <Events>
- <ColumnsChanged>
- <Name_BillType>
- <![CDATA[
- if(#PurchaseInDepotBillProduct.Name_BillType!=StringEmpty()&&#PurchaseInDepotBillProduct.No_FromBill!=StringEmpty()&&#PurchaseInDepotBillProduct.No_FromBillProduct!=StringEmpty())
- {
- if(Search("SearchPurchaseOrderBillProduct",#PurchaseInDepotBillProduct.No_FromBill,#PurchaseInDepotBillProduct.No_FromBillProduct))
- {
- if(!Equals(#PurchaseOrderBillProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!");
- }
-
- #PurchaseInDepotBillProduct.ID_Product=#PurchaseOrderBillProduct.ID_Product;
- #PurchaseInDepotBillProduct.Name_Product=#PurchaseOrderBillProduct.Name_Product;
- #PurchaseInDepotBillProduct.Unit_Product=#PurchaseOrderBillProduct.Unit_Product;
- #PurchaseInDepotBillProduct.No_Product=#PurchaseOrderBillProduct.No_Product;
- #PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct=#PurchaseOrderBillProduct.Quantity;
- #PurchaseInDepotBillProduct.RefNo_PurchaseInDepotBill=#PurchaseOrderBillProduct.RefNo_PurchaseOrderBill;
- txtNumSum.CValue=SumOfCol("#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct");
- if( Search("SearchOneLocation",#PurchaseOrderBillProduct.No_Product))
- {
- #PurchaseInDepotBillProduct.No_Location = #OneLocation.No_Location;
- #PurchaseInDepotBillProduct.Name_Location = #OneLocation.Name_Location;
- #PurchaseInDepotBillProduct.ID_Location = #OneLocation.ID_Location;
- }
- }
- }
- ]]>
- </Name_BillType>
- <No_FromBill>
- <![CDATA[
- if(#PurchaseInDepotBillProduct.Name_BillType!=StringEmpty()&&#PurchaseInDepotBillProduct.No_FromBill!=StringEmpty()&&#PurchaseInDepotBillProduct.No_FromBillProduct!=StringEmpty())
- {
- if(Search("SearchPurchaseOrderBillProduct",#PurchaseInDepotBillProduct.No_FromBill,#PurchaseInDepotBillProduct.No_FromBillProduct))
- {
- if(!Equals(#PurchaseOrderBillProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!");
- }
-
- #PurchaseInDepotBillProduct.ID_Product=#PurchaseOrderBillProduct.ID_Product;
- #PurchaseInDepotBillProduct.Name_Product=#PurchaseOrderBillProduct.Name_Product;
- #PurchaseInDepotBillProduct.Unit_Product=#PurchaseOrderBillProduct.Unit_Product;
- #PurchaseInDepotBillProduct.No_Product=#PurchaseOrderBillProduct.No_Product;
- #PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct=#PurchaseOrderBillProduct.Quantity;
- #PurchaseInDepotBillProduct.RefNo_PurchaseInDepotBill=#PurchaseOrderBillProduct.RefNo_PurchaseOrderBill;
- txtNumSum.CValue=SumOfCol("#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct");
- if( Search("SearchOneLocation",#PurchaseOrderBillProduct.No_Product))
- {
- #PurchaseInDepotBillProduct.No_Location = #OneLocation.No_Location;
- #PurchaseInDepotBillProduct.Name_Location = #OneLocation.Name_Location;
- #PurchaseInDepotBillProduct.ID_Location = #OneLocation.ID_Location;
- }
- }
- }
- ]]>
- </No_FromBill>
- <No_FromBillProduct>
- <![CDATA[
- if(#PurchaseInDepotBillProduct.Name_BillType!=StringEmpty()&&#PurchaseInDepotBillProduct.No_FromBill!=StringEmpty()&&#PurchaseInDepotBillProduct.No_FromBillProduct!=StringEmpty())
- {
- if(Search("SearchPurchaseOrderBillProduct",#PurchaseInDepotBillProduct.No_FromBill,#PurchaseInDepotBillProduct.No_FromBillProduct))
- {
- if(!Equals(#PurchaseOrderBillProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!");
- }
-
- #PurchaseInDepotBillProduct.ID_Product=#PurchaseOrderBillProduct.ID_Product;
- #PurchaseInDepotBillProduct.Name_Product=#PurchaseOrderBillProduct.Name_Product;
- #PurchaseInDepotBillProduct.Unit_Product=#PurchaseOrderBillProduct.Unit_Product;
- #PurchaseInDepotBillProduct.No_Product=#PurchaseOrderBillProduct.No_Product;
- #PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct=#PurchaseOrderBillProduct.Quantity;
- #PurchaseInDepotBillProduct.RefNo_PurchaseInDepotBill=#PurchaseOrderBillProduct.RefNo_PurchaseOrderBill;
- txtNumSum.CValue=SumOfCol("#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct");
- if( Search("SearchOneLocation",#PurchaseOrderBillProduct.No_Product))
- {
- #PurchaseInDepotBillProduct.No_Location = #OneLocation.No_Location;
- #PurchaseInDepotBillProduct.Name_Location = #OneLocation.Name_Location;
- #PurchaseInDepotBillProduct.ID_Location = #OneLocation.ID_Location;
- }
- }
- }
- ]]>
- </No_FromBillProduct>
- <No_Product>
- if(@SetFlag==0)
- {
- return;
- }
- if(#PurchaseInDepotBillProduct.No_Product!=StringEmpty())
- {
- if(!Search("SearchProduct",#PurchaseInDepotBillProduct.No_Product))
- {
- MessageBox("不存在此产品编号",@Title);
- #PurchaseInDepotBillProduct.ID_Product=GuidEmpty();
- #PurchaseInDepotBillProduct.Name_Product=StringEmpty();
- #PurchaseInDepotBillProduct.Unit_Product=StringEmpty();
- @temp = ShowSearchBox("InputSearchProduct","INFOMATION",#PurchaseInDepotBillProduct.No_Product);
- if(@temp != "")
- {
- ResumeColumnEvent("#PurchaseInDepotBillProduct.No_Product");
- #PurchaseInDepotBillProduct.No_Product = @temp;
- ClearColumnEvent();
- }
- }
- else
- {
- if(!Equals(#Product.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!");
- }
- #PurchaseInDepotBillProduct.ID_Product=#Product.ID_Product;
- #PurchaseInDepotBillProduct.Name_Product=#Product.Name_Product;
- #PurchaseInDepotBillProduct.Unit_Product=#Product.Unit_Product;
- if(Search("SearchOneLocation",#PurchaseInDepotBillProduct.No_Product))
- {
- #PurchaseInDepotBillProduct.No_Location = #OneLocation.No_Location;
- #PurchaseInDepotBillProduct.Name_Location = #OneLocation.Name_Location;
- #PurchaseInDepotBillProduct.ID_Location = #OneLocation.ID_Location;
- }
- }
- }else{
- #PurchaseInDepotBillProduct.ID_Product=GuidEmpty();
- #PurchaseInDepotBillProduct.Name_Product=StringEmpty();
- #PurchaseInDepotBillProduct.Unit_Product=StringEmpty();
- }
- </No_Product>
- <No_Location>
- if(@SetFlag1==0)
- {
- return;
- }
- if(#PurchaseInDepotBillProduct.No_Location != StringEmpty())
- {
- if(!Search("SearchLocationByNo",#PurchaseInDepotBillProduct.No_Location))
- {
- MessageBox("不存在此库位编号",@Title);
- #PurchaseInDepotBillProduct.ID_Location=GuidEmpty();
- #PurchaseInDepotBillProduct.Name_Location=StringEmpty();
- }
- else
- {
- #PurchaseInDepotBillProduct.ID_Location=#Location.ID_Location;
- #PurchaseInDepotBillProduct.Name_Location=#Location.Name_Location;
- }
- }
- </No_Location>
- <Quantity_PurchaseInDepotBillProduct>
- txtNumSum.CValue=SumOfCol("#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct");
- </Quantity_PurchaseInDepotBillProduct>
- </ColumnsChanged>
- <RowDeleted>
- txtNumSum.CValue=SumOfCol("#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct");
- </RowDeleted>
- </Events>
- </Table>
- </Tables>
- <LockInfomation LockID="ID_PurchaseInDepotBill" LockNO="No_PurchaseInDepotBill" LockSearchFunction="SearchPurchaseInDepotBillWithNo" LockAudit="ID_Assessor"/>
- <ChildForms>
- <ChildForm name="BillSearch" DataSource="PurchaseInDepotBill" SearchFunction="SearchAllBill" SearchFunctionByNo="SearchPurchaseInDepotBillWithNo">
- <DataColumn Index="0" MappingName="#PurchaseInDepotBill.No_PurchaseInDepotBill" HeaderText="采购入库单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="1" MappingName="#PurchaseInDepotBill.Date_PurchaseInDepotBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="2" MappingName="#PurchaseInDepotBill.No_Supplier" HeaderText="供应商编号" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="3" MappingName="#PurchaseInDepotBill.ShortName_Supplier" HeaderText="供应商简称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="4" MappingName="#PurchaseInDepotBill.EncasementNo_PurchaseInDepotBill" HeaderText="装箱单号" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="5" MappingName="#PurchaseInDepotBill.Comment_PurchaseInDepotBill" HeaderText="备注" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="SupplierSearch" DataSource="Supplier" SearchFunction="SearchAllSupplier" SearchFunctionByNo="" MappingName="供应商">
- <DataColumn Index="0" MappingName="#Supplier.No_Supplier" HeaderText="供应商编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="1" MappingName="#Supplier.ShortName_Supplier" HeaderText="供应商简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品" ReturnDataSource="PurchaseInDepotBillProduct" ShowCheckBox="true">
- <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn" ReturnMappingName="#PurchaseInDepotBillProduct.No_Product" />
- <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="2" MappingName="#Product.Type_Product" HeaderText="产品类型" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="3" MappingName="#Product.Price_Product" HeaderText="标准售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
- <DataColumn Index="4" MappingName="#Product.LowSalePrice_Product" HeaderText="最低售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
- <DataColumn Index="5" MappingName="#Product.SafetyQty_Product" HeaderText="安全存量" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="LocationSearch" DataSource="Location" SearchFunction="SearchAllLocation" SearchFunctionByNo="" MappingName="库位" ReturnDataSource="PurchaseInDepotBillProduct" ShowCheckBox="false">
- <DataColumn Index="0" MappingName="#Location.No_Location" HeaderText="库位编号" Width="120" ColumnType="IKDataGridTextBoxColumn" ReturnMappingName="#PurchaseInDepotBillProduct.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="ImportPurchaseOrderBillControl" >
- <DataGridIndex DataSource="PurchaseOrderBill" SearchFunction="SearchAllPurchaseOrderBill" SearchFunctionByNo="" MappingName="" ReturnDataSource="PurchaseInDepotBillProduct">
- <DataColumn Index="0" MappingName="#PurchaseOrderBill.No_PurchaseOrderBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseInDepotBillProduct.No_FromBill"/>
- <DataColumn Index="1" MappingName="#PurchaseOrderBill.Date_PurchaseOrderBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="2" MappingName="#PurchaseOrderBill.No_Supplier" HeaderText="供应商编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseInDepotBill.No_Supplier"/>
- <DataColumn Index="3" MappingName="#PurchaseOrderBill.ShortName_Customer" HeaderText="供应商简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="4" MappingName="#PurchaseOrderBill.State_PurchaseOrderBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="5" MappingName="#PurchaseOrderBill.Name_Location" HeaderText="到货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseInDepotBill.Name_Location"/>
- </DataGridIndex>
- <DataGridIndex DataSource="PurchaseOrderBillProduct" SearchFunction="SearchAllPurchaseOrderBillProduct" SearchFunctionByNo="" MappingName="">
- <DataColumn Index="0" MappingName="#PurchaseOrderBillProduct.No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="1" MappingName="#PurchaseOrderBillProduct.No_PurchaseOrderBillProduct" HeaderText="产品序号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseInDepotBillProduct.No_FromBillProduct"/>
- <DataColumn Index="2" MappingName="#PurchaseOrderBillProduct.Name_Product" HeaderText="产品名称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="3" MappingName="#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct" HeaderText="数量" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
- <DataColumn Index="4" MappingName="#PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct" HeaderText="单价" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
- </DataGridIndex>
- </ChildForm>
- <ChildForm name="ImportPurchaseOrderBillUnControl" >
- <DataGridIndex DataSource="PurchaseOrderBill" SearchFunction="SearchAllPurchaseOrderBill" SearchFunctionByNo="" MappingName="" ReturnDataSource="PurchaseInDepotBillProduct">
- <DataColumn Index="0" MappingName="#PurchaseOrderBill.No_PurchaseOrderBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseInDepotBillProduct.Comment_PurchaseInDepotBillProduct"/>
- <DataColumn Index="1" MappingName="#PurchaseOrderBill.Date_PurchaseOrderBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="2" MappingName="#PurchaseOrderBill.No_Supplier" HeaderText="供应商编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseInDepotBill.No_Supplier"/>
- <DataColumn Index="3" MappingName="#PurchaseOrderBill.ShortName_Customer" HeaderText="供应商简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="4" MappingName="#PurchaseOrderBill.State_PurchaseOrderBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="5" MappingName="#PurchaseOrderBill.Name_Location" HeaderText="到货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseInDepotBill.Name_Location"/>
- </DataGridIndex>
- <DataGridIndex DataSource="PurchaseOrderBillProduct" SearchFunction="SearchAllPurchaseOrderBillProduct" SearchFunctionByNo="" MappingName="">
- <DataColumn Index="0" MappingName="#PurchaseOrderBillProduct.No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseInDepotBillProduct.No_Product"/>
- <DataColumn Index="1" MappingName="#PurchaseOrderBillProduct.No_PurchaseOrderBillProduct" HeaderText="产品序号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="2" MappingName="#PurchaseOrderBillProduct.Name_Product" HeaderText="产品名称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="3" MappingName="#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct" HeaderText="数量" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
- <DataColumn Index="4" MappingName="#PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct" HeaderText="单价" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
- </DataGridIndex>
- </ChildForm>
- </ChildForms>
- <ImportedInfo>
- UpdateForm(true, "tbNoSupplier");
- tbNoSupplier.Focus();
- Search("SearchLocation");
- cbLocation.Text = #PurchaseInDepotBill.Name_Location;
- ActiveControlEvent("tbNoSupplier", "Enter");
- </ImportedInfo>
- </Client>
- <Server>
- <Tables>
- <Table name="PurchaseInDepotBill" Type="Parent">
- <GetSchema CmdType="Text" CmdText="SELECT Top 0 PurchaseInDepotBill.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Location.Name_Location,Location.No_Location,Employee.No_Employee As No_Principal,Employee.Name_Employee As Name_Principal,Supplier.No_Supplier,Supplier.ShortName_Supplier
- FROM PurchaseInDepotBill
- LEFT JOIN AppUser a ON PurchaseInDepotBill.ID_Creator=a.ID_User
- LEFT JOIN AppUser b ON PurchaseInDepotBill.ID_Assessor=b.ID_User
- LEFT JOIN AppUser c ON PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=c.ID_User
- LEFT JOIN Location ON PurchaseInDepotBill.ID_Location=Location.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee=PurchaseInDepotBill.ID_QA
- LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseInDepotBill.ID_Supplier" />
- <New CmdType="Text" CmdText="
- INSERT INTO PurchaseInDepotBill(ID_PurchaseInDepotBill,Date_PurchaseInDepotBill,No_PurchaseInDepotBill,
- EncasementNo_PurchaseInDepotBill,ID_Location,ID_QA,ID_Creator,ID_Assessor,AssessDate_PurchaseInDepotBill,Comment_PurchaseInDepotBill,
- CreateDate_PurchaseInDepotBill,LastModUser_PurchaseInDepotBill,LastModDate_PurchaseInDepotBill,ID_Supplier)
- VALUES(@ID_PurchaseInDepotBill,@Date_PurchaseInDepotBill,@No_PurchaseInDepotBill,
- @EncasementNo_PurchaseInDepotBill,@ID_Location,@ID_QA,@ID_Creator,@ID_Assessor,@AssessDate_PurchaseInDepotBill,@Comment_PurchaseInDepotBill,
- @CreateDate_PurchaseInDepotBill,@LastModUser_PurchaseInDepotBill,@LastModDate_PurchaseInDepotBill,@ID_Supplier)
- ">
- <Params>
- <Param name="@ID_PurchaseInDepotBill" type="PurchaseInDepotBill.ID_PurchaseInDepotBill" sourceColumn="ID_PurchaseInDepotBill" />
- <Param name="@Date_PurchaseInDepotBill" type="PurchaseInDepotBill.Date_PurchaseInDepotBill" sourceColumn="Date_PurchaseInDepotBill" />
- <Param name="@No_PurchaseInDepotBill" type="PurchaseInDepotBill.No_PurchaseInDepotBill" sourceColumn="No_PurchaseInDepotBill" />
- <Param name="@EncasementNo_PurchaseInDepotBill" type="PurchaseInDepotBill.EncasementNo_PurchaseInDepotBill" sourceColumn="EncasementNo_PurchaseInDepotBill" />
- <Param name="@ID_Location" type="PurchaseInDepotBill.ID_Location" sourceColumn="ID_Location" />
- <Param name="@ID_QA" type="PurchaseInDepotBill.ID_QA" sourceColumn="ID_QA" />
- <Param name="@ID_Creator" type="PurchaseInDepotBill.ID_Creator" sourceColumn="ID_Creator" />
- <Param name="@ID_Assessor" type="PurchaseInDepotBill.ID_Assessor" sourceColumn="ID_Assessor" />
- <Param name="@AssessDate_PurchaseInDepotBill" type="PurchaseInDepotBill.AssessDate_PurchaseInDepotBill" sourceColumn="AssessDate_PurchaseInDepotBill" />
- <Param name="@Comment_PurchaseInDepotBill" type="PurchaseInDepotBill.Comment_PurchaseInDepotBill" sourceColumn="Comment_PurchaseInDepotBill" />
- <Param name="@CreateDate_PurchaseInDepotBill" type="PurchaseInDepotBill.CreateDate_PurchaseInDepotBill" sourceColumn="CreateDate_PurchaseInDepotBill" />
- <Param name="@LastModDate_PurchaseInDepotBill" type="PurchaseInDepotBill.LastModDate_PurchaseInDepotBill" sourceColumn="LastModDate_PurchaseInDepotBill" />
- <Param name="@LastModUser_PurchaseInDepotBill" type="PurchaseInDepotBill.LastModUser_PurchaseInDepotBill" sourceColumn="LastModUser_PurchaseInDepotBill" />
- <Param name="@ID_Supplier" type="PurchaseInDepotBill.ID_Supplier" sourceColumn="ID_Supplier" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText="Update PurchaseInDepotBill SET ID_Location=@ID_Location, ID_QA=@ID_QA,EncasementNo_PurchaseInDepotBill=@EncasementNo_PurchaseInDepotBill, Comment_PurchaseInDepotBill=@Comment_PurchaseInDepotBill, LastModUser_PurchaseInDepotBill=@LastModUser_PurchaseInDepotBill,
- LastModDate_PurchaseInDepotBill=@LastModDate_PurchaseInDepotBill,ID_Supplier=@ID_Supplier WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill">
- <Params>
- <Param name="@ID_Location" type="PurchaseInDepotBill.ID_Location" sourceColumn="ID_Location" />
- <Param name="@ID_QA" type="PurchaseInDepotBill.ID_QA" sourceColumn="ID_QA" />
- <Param name="@Comment_PurchaseInDepotBill" type="PurchaseInDepotBill.Comment_PurchaseInDepotBill" sourceColumn="Comment_PurchaseInDepotBill" />
- <Param name="@LastModUser_PurchaseInDepotBill" type="PurchaseInDepotBill.LastModUser_PurchaseInDepotBill" sourceColumn="LastModUser_PurchaseInDepotBill" />
- <Param name="@LastModDate_PurchaseInDepotBill" type="PurchaseInDepotBill.LastModDate_PurchaseInDepotBill" sourceColumn="LastModDate_PurchaseInDepotBill" />
- <Param name="@ID_PurchaseInDepotBill" type="PurchaseInDepotBill.ID_PurchaseInDepotBill" sourceColumn="ID_PurchaseInDepotBill" />
- <Param name="@ID_Supplier" type="PurchaseInDepotBill.ID_Supplier" sourceColumn="ID_Supplier" />
- <Param name="@EncasementNo_PurchaseInDepotBill" type="PurchaseInDepotBill.EncasementNo_PurchaseInDepotBill" sourceColumn="EncasementNo_PurchaseInDepotBill" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText="DELETE FROM PurchaseInDepotBillProduct WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
- DELETE FROM PurchaseInDepotBill WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill">
- <Params>
- <Param name="@ID_PurchaseInDepotBill" type="PurchaseInDepotBill.ID_PurchaseInDepotBill"
- sourceColumn="ID_PurchaseInDepotBill" />
- </Params>
- </Delete>
- <Audit CmdType="Text" CmdText=" DECLARE @StockAndInDepot bit
- DECLARE @ChildLocation uniqueidentifier
- DECLARE @ChildSupplier uniqueidentifier
- DECLARE @Quantity_PurchaseInDepotBillProduct decimal(14,4)
- DECLARE @ID_Product uniqueidentifier
- DECLARE @ID_OnShip uniqueidentifier
- DECLARE @ID_PurchaseSourceBillProduct uniqueidentifier
- DECLARE @ID_PurchaseInDepotBillProduct uniqueidentifier
- DECLARE @No_PurchaseInDepotBillProduct nvarchar(64)
- DECLARE @Info nvarchar(100)
- DECLARE @Quantity_OnShipProduct decimal(14,4)
- DECLARE @AssessPurchaseOrderBill uniqueidentifier
-
- SELECT @StockAndInDepot=StockAndInDepot_SystemSetting FROM SystemSetting
- If(@StockAndInDepot=1 AND @ID_Assessor IS NOT NULL)
- BEGIN
- SELECT @ID_OnShip=ID_OnShip FROM OnShip WHERE EncasementNo_OnShip=@EncasementNo_PurchaseInDepotBill
- IF(@ID_OnShip IS NOT NULL)
- BEGIN
- DECLARE cur_p cursor FOR SELECT OnShipProduct.ID_PurchaseSourceBillProduct,OnShipProduct.Quantity_OnShipProduct
- FROM OnShipProduct LEFT JOIN OnShip ON OnShip.ID_OnShip=OnShipProduct.ID_OnShip WHERE EncasementNo_OnShip=@EncasementNo_PurchaseInDepotBill
- OPEN cur_p
- FETCH Next FROM cur_p INTO @ID_PurchaseSourceBillProduct,@Quantity_OnShipProduct
- WHILE @@fetch_status=0
- BEGIN
- UPDATE PurchaseSourceBillProduct SET Quantity_OnShip=Quantity_OnShip-@Quantity_OnShipProduct
- WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct
- FETCH Next FROM cur_p Into @ID_PurchaseSourceBillProduct,@Quantity_OnShipProduct
- END
- DELETE FROM OnShipProduct WHERE ID_OnShip=@ID_OnShip
- DELETE FROM OnShip WHERE EncasementNo_OnShip=@EncasementNo_PurchaseInDepotBill
- END
- END
-
- DECLARE cur CURSOR FOR SELECT PurchaseInDepotBillProduct.ID_Location,Quantity_PurchaseInDepotBillProduct,PurchaseInDepotBillProduct.ID_Product,PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct,No_PurchaseInDepotBillProduct,PurchaseOrderBill.ID_Assessor,PurchaseInDepotBillProduct.ID_PurchaseInDepotBillProduct,PurchaseOrderBill.ID_Supplier
- FROM PurchaseInDepotBillProduct
- LEFT JOIN PurchaseOrderBill ON PurchaseOrderBill.No_PurchaseOrderBill=PurchaseInDepotBillProduct.No_FromBill
- LEFT JOIN PurchaseOrderBillProduct ON PurchaseOrderBill.ID_PurchaseOrderBill=PurchaseOrderBillProduct.ID_PurchaseOrderBill And PurchaseOrderBillProduct.No_PurchaseOrderBillProduct=PurchaseInDepotBillProduct.No_FromBillProduct
- WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
- Order By No_PurchaseInDepotBillProduct
- OPEN cur
- FETCH Next FROM cur INTO @ChildLocation,@Quantity_PurchaseInDepotBillProduct,@ID_Product,@ID_PurchaseSourceBillProduct,@No_PurchaseInDepotBillProduct,@AssessPurchaseOrderBill,@ID_PurchaseInDepotBillProduct,@ChildSupplier
- WHILE @@fetch_status=0
- BEGIN
- IF(@ID_Assessor IS NOT NULL)
- BEGIN
- IF(@StockAndInDepot=1)
- BEGIN
- IF(@ChildSupplier Is Null)
- BEGIN
- SET @Info=N'产品序号为'+@No_PurchaseInDepotBillProduct+N'的来源单据不存在,审核失败!'
- RAISERROR(@Info,16,1)
- RETURN
- END
- IF(@AssessPurchaseOrderBill Is Null)
- BEGIN
- SET @Info=N'产品序号为'+@No_PurchaseInDepotBillProduct+N'的来源单据尚未经过审核,审核失败!'
- RAISERROR(@Info,16,1)
- RETURN
- END
- IF(@ChildSupplier!=@ID_Supplier)
- BEGIN
- SET @Info=N'产品序号为'+@No_PurchaseInDepotBillProduct+N'的来源单据的供应商与本单据的供应商不一致,审核失败!'
- RAISERROR(@Info,16,1)
- RETURN
- END
- If(@Quantity_PurchaseInDepotBillProduct > (SELECT (Quantity_Order-Quantity_InDepot-Quantity_OnShip-Quantity_EndCase)
- FROM PurchaseSourceBillProduct WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct))
- BEGIN
- SET @Info='序号为'+@No_PurchaseInDepotBillProduct+'的产品入库数量超过可入库数量(=采购数量-已入库数量-在途数量-强制结案数量),审核失败!请于关联单据处查询。'
- RAISERROR(@Info,16,1)
- RETURN
- END
- ELSE
- BEGIN
- UPDATE PurchaseSourceBillProduct SET Quantity_InDepot=Quantity_InDepot+@Quantity_PurchaseInDepotBillProduct
- WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct
- UPDATE PurchaseInDepotBillProduct SET ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct WHERE ID_PurchaseInDepotBillProduct=@ID_PurchaseInDepotBillProduct
- END
- END
- IF(EXISTS(SELECT * FROM ProductStocks WHERE ID_Product=@ID_Product AND ID_Location=@ChildLocation))
- UPDATE ProductStocks SET StockQty_ProductStocks=StockQty_ProductStocks+@Quantity_PurchaseInDepotBillProduct
- WHERE ID_Product=@ID_Product AND ID_Location=@ChildLocation
- ELSE
- INSERT INTO ProductStocks(ID_ProductStocks,ID_Location,ID_Product,StockQty_ProductStocks) VALUES(newID(),@ChildLocation,@ID_Product,@Quantity_PurchaseInDepotBillProduct)
- IF(EXISTS(SELECT * FROM ProductStocks WHERE ID_Product=@ID_Product And ID_Location=@ID_Location))
- UPDATE ProductStocks Set AvailableQty_ProductStocks=AvailableQty_ProductStocks+@Quantity_PurchaseInDepotBillProduct
- WHERE ID_Product=@ID_Product AND ID_Location=@ID_Location
- ELSE
- INSERT INTO ProductStocks(ID_ProductStocks,ID_Location,ID_Product,AvailableQty_ProductStocks) VALUES(newID(),@ID_Location,@ID_Product,@Quantity_PurchaseInDepotBillProduct)
- END
- ELSE
- BEGIN
- IF(@StockAndInDepot=1)
- UPDATE PurchaseSourceBillProduct SET Quantity_InDepot=Quantity_InDepot-@Quantity_PurchaseInDepotBillProduct
- WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct
- IF((SELECT StockQty_ProductStocks FROM ProductStocks WHERE ID_Product=@ID_Product AND ID_Location=@ChildLocation ) < @Quantity_PurchaseInDepotBillProduct)
- BEGIN
- SET @Info='序号为'+@No_PurchaseInDepotBillProduct+'的产品库存数量不足,取消审核失败!。'
- RAISERROR(@Info,16,1)
- RETURN
- END
- UPDATE ProductStocks SET StockQty_ProductStocks=StockQty_ProductStocks-@Quantity_PurchaseInDepotBillProduct
- WHERE ID_Product=@ID_Product And ID_Location=@ChildLocation
- UPDATE ProductStocks SET AvailableQty_ProductStocks=AvailableQty_ProductStocks-@Quantity_PurchaseInDepotBillProduct
- WHERE ID_Product=@ID_Product AND ID_Location=@ID_Location
- END
- FETCH Next FROM cur INTO @ChildLocation,@Quantity_PurchaseInDepotBillProduct,@ID_Product,@ID_PurchaseSourceBillProduct,@No_PurchaseInDepotBillProduct,@AssessPurchaseOrderBill,@ID_PurchaseInDepotBillProduct,@ChildSupplier
- END
- DEALLOCATE cur
- UPDATE PurchaseInDepotBill SET ID_Assessor=@ID_Assessor,AssessDate_PurchaseInDepotBill=@AssessDate_PurchaseInDepotBill
- WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
- ">
- <Params>
- <Param name="@ID_PurchaseInDepotBill" type="PurchaseInDepotBill.ID_PurchaseInDepotBill" sourceColumn="ID_PurchaseInDepotBill" />
- <Param name="@ID_Location" type="PurchaseInDepotBill.ID_Location" sourceColumn="ID_Location" />
- <Param name="@ID_Assessor" type="PurchaseInDepotBill.ID_Assessor" sourceColumn="ID_Assessor" />
- <Param name="@AssessDate_PurchaseInDepotBill" type="PurchaseInDepotBill.AssessDate_PurchaseInDepotBill" sourceColumn="AssessDate_PurchaseInDepotBill" />
- <Param name="@EncasementNo_PurchaseInDepotBill" type="PurchaseInDepotBill.EncasementNo_PurchaseInDepotBill" sourceColumn="EncasementNo_PurchaseInDepotBill" />
- <Param name="@ID_Supplier" type="PurchaseInDepotBill.ID_Supplier" sourceColumn="ID_Supplier" />
- </Params>
- </Audit>
- <FKErrorReport ErrorMessage="该单据已被其他单据引用,删除失败!" />
- <UNIQUEErrorReport ErrorMessage="采购入库单号已存在,提交失败!" />
- </Table>
- <Table name="PurchaseInDepotBillProduct" Type="Child">
- <GetSchema CmdType="Text" CmdText="
- SELECT Top 0 PurchaseInDepotBillProduct.*,'' as No_PurchaseInDepotBill,Product.No_Product,Name_Product,Product.Unit_Product,Location.Name_Location,Location.ID_Location,Location.No_Location, BillType.Name_BillType
- FROM PurchaseInDepotBillProduct
- LEFT JOIN Location ON Location.ID_Location=PurchaseInDepotBillProduct.ID_Location
- LEFT JOIN Product ON PurchaseInDepotBillProduct.ID_Product=Product.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType=PurchaseInDepotBillProduct.Type_FromBill
- " />
- <New CmdType="Text" CmdText=" INSERT INTO PurchaseInDepotBillProduct(ID_PurchaseInDepotBillProduct,No_PurchaseInDepotBillProduct,ID_PurchaseInDepotBill,Type_FromBill,
- No_FromBill,ID_PurchaseSourceBillProduct,No_FromBillProduct,RefNo_PurchaseInDepotBill,ID_Product,ID_Location,Quantity_PurchaseInDepotBillProduct, Comment_PurchaseInDepotBillProduct)
- VALUES(@ID_PurchaseInDepotBillProduct,@No_PurchaseInDepotBillProduct,@ID_PurchaseInDepotBill,@Type_FromBill,@No_FromBill,@ID_PurchaseSourceBillProduct,@No_FromBillProduct,@RefNo_PurchaseInDepotBill,@ID_Product,@ID_Location,@Quantity_PurchaseInDepotBillProduct, @Comment_PurchaseInDepotBillProduct)">
- <Params>
- <Param name="@ID_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.ID_PurchaseInDepotBillProduct" sourceColumn="ID_PurchaseInDepotBillProduct" />
- <Param name="@No_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.No_PurchaseInDepotBillProduct" sourceColumn="No_PurchaseInDepotBillProduct" />
- <Param name="@ID_PurchaseInDepotBill" type="PurchaseInDepotBillProduct.ID_PurchaseInDepotBill" sourceColumn="ID_PurchaseInDepotBill" />
- <Param name="@Type_FromBill" type="PurchaseInDepotBillProduct.Type_FromBill" sourceColumn="Type_FromBill" />
- <Param name="@No_FromBill" type="PurchaseInDepotBillProduct.No_FromBill" sourceColumn="No_FromBill" />
- <Param name="@RefNo_PurchaseInDepotBill" type="PurchaseInDepotBillProduct.RefNo_PurchaseInDepotBill" sourceColumn="RefNo_PurchaseInDepotBill" />
- <Param name="@ID_Product" type="PurchaseInDepotBillProduct.ID_Product" sourceColumn="ID_Product" />
- <Param name="@ID_Location" type="PurchaseInDepotBillProduct.ID_Location" sourceColumn="ID_Location" />
- <Param name="@Quantity_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct" sourceColumn="Quantity_PurchaseInDepotBillProduct" />
- <Param name="@Comment_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.Comment_PurchaseInDepotBillProduct" sourceColumn="Comment_PurchaseInDepotBillProduct" />
- <Param name="@ID_PurchaseSourceBillProduct" type="PurchaseInDepotBillProduct.ID_PurchaseSourceBillProduct" sourceColumn="ID_PurchaseSourceBillProduct" />
- <Param name="@No_FromBillProduct" type="PurchaseInDepotBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText="
- DECLARE @StockAndInDepot bit
- DECLARE @Info nvarchar(256)
- DECLARE @AssessDate datetime
- Select @AssessDate=AssessDate_PurchaseInDepotBill From PurchaseInDepotBill Where ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
- SELECT @StockAndInDepot=StockAndInDepot_SystemSetting FROM SystemSetting
- IF(@StockAndInDepot=1)
- BEGIN
- IF(@AssessDate IS NOT NULL AND @Quantity_PurchaseInDepotBillProduct >(SELECT (Quantity_Order-Quantity_InDepot-Quantity_OnShip-Quantity_EndCase)
- FROM PurchaseSourceBillProduct WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct))
- BEGIN
- SET @Info='序号为'+@No_PurchaseInDepotBillProduct+'的产品入库数量超过可入库数量,提交失败!请于关联单据处查询。'
- RAISERROR(@Info,16,1)
- RETURN
- END
- END
- UPDATE PurchaseInDepotBillProduct SET No_PurchaseInDepotBillProduct=@No_PurchaseInDepotBillProduct, ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill,
- Type_FromBill=@Type_FromBill,No_FromBill=@No_FromBill,RefNo_PurchaseInDepotBill=@RefNo_PurchaseInDepotBill,ID_Product=@ID_Product,
- ID_Location=@ID_Location,Quantity_PurchaseInDepotBillProduct=@Quantity_PurchaseInDepotBillProduct,Comment_PurchaseInDepotBillProduct=@Comment_PurchaseInDepotBillProduct,
- ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct,No_FromBillProduct=@No_FromBillProduct WHERE ID_PurchaseInDepotBillProduct=@ID_PurchaseInDepotBillProduct">
- <Params>
- <Param name="@ID_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.ID_PurchaseInDepotBillProduct" sourceColumn="ID_PurchaseInDepotBillProduct" />
- <Param name="@No_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.No_PurchaseInDepotBillProduct" sourceColumn="No_PurchaseInDepotBillProduct" />
- <Param name="@ID_PurchaseInDepotBill" type="PurchaseInDepotBillProduct.ID_PurchaseInDepotBill" sourceColumn="ID_PurchaseInDepotBill" />
- <Param name="@Type_FromBill" type="PurchaseInDepotBillProduct.Type_FromBill" sourceColumn="Type_FromBill" />
- <Param name="@No_FromBill" type="PurchaseInDepotBillProduct.No_FromBill" sourceColumn="No_FromBill" />
- <Param name="@RefNo_PurchaseInDepotBill" type="PurchaseInDepotBillProduct.RefNo_PurchaseInDepotBill" sourceColumn="RefNo_PurchaseInDepotBill" />
- <Param name="@ID_Product" type="PurchaseInDepotBillProduct.ID_Product" sourceColumn="ID_Product" />
- <Param name="@ID_Location" type="PurchaseInDepotBillProduct.ID_Location" sourceColumn="ID_Location" />
- <Param name="@Quantity_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct" sourceColumn="Quantity_PurchaseInDepotBillProduct" />
- <Param name="@Comment_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.Comment_PurchaseInDepotBillProduct" sourceColumn="Comment_PurchaseInDepotBillProduct" />
- <Param name="@ID_PurchaseSourceBillProduct" type="PurchaseInDepotBillProduct.ID_PurchaseSourceBillProduct" sourceColumn="ID_PurchaseSourceBillProduct" />
- <Param name="@No_FromBillProduct" type="PurchaseInDepotBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText="Delete FROM PurchaseInDepotBillProduct WHERE ID_PurchaseInDepotBillProduct=@ID_PurchaseInDepotBillProduct">
- <Params>
- <Param name="@ID_PurchaseInDepotBillProduct" type="PurchaseInDepotBillProduct.ID_PurchaseInDepotBillProduct"
- sourceColumn="ID_PurchaseInDepotBillProduct" />
- </Params>
- </Delete>
- </Table>
- </Tables>
- <Search>
- <SearchAllBill CmdType="Text" CmdText=" SELECT PurchaseInDepotBill.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Location.Name_Location,Location.No_Location,Employee.No_Employee As No_Principal,Employee.Name_Employee As Name_Principal
- ,No_Supplier,ShortName_Supplier
- FROM PurchaseInDepotBill
- LEFT JOIN AppUser a ON PurchaseInDepotBill.ID_Creator=a.ID_User
- LEFT JOIN AppUser b ON PurchaseInDepotBill.ID_Assessor=b.ID_User
- LEFT JOIN AppUser c ON PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=c.ID_User
- LEFT JOIN Location ON PurchaseInDepotBill.ID_Location=Location.ID_Location
- LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseInDepotBill.ID_Supplier
- LEFT JOIN Employee ON Employee.ID_Employee=PurchaseInDepotBill.ID_QA">
- <Tables>
- <Table name="AllBill" />
- </Tables>
- </SearchAllBill>
- <SearchAllSupplier CmdType="Text" CmdText="SELECT Supplier.No_Supplier,Supplier.ShortName_Supplier FROM Supplier ">
- <Tables>
- <Table name="AllSupplier" />
- </Tables>
- </SearchAllSupplier>
- <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>
- <SearchAllLocation CmdType="Text" CmdText="SELECT No_Location,Name_Location FROM Location ">
- <Tables>
- <Table name="Location" />
- </Tables>
- </SearchAllLocation>
- <SearchContr CmdType="Text" CmdText=" SELECT SystemSetting.StockAndInDepot_SystemSetting FROM SystemSetting WHERE SystemSetting.StockAndInDepot_SystemSetting = 1">
- <Tables>
- <Table name="SystemOutIn" />
- </Tables>
- </SearchContr>
- <SearchPurchaseInDepotBillWithNo CmdType="Text" CmdText="SELECT PurchaseInDepotBill.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Location.Name_Location,Location.No_Location,Employee.No_Employee As No_Principal,Employee.Name_Employee As Name_Principal,Supplier.No_Supplier,Supplier.ShortName_Supplier
- FROM PurchaseInDepotBill
- LEFT JOIN AppUser a ON PurchaseInDepotBill.ID_Creator=a.ID_User
- LEFT JOIN AppUser b ON PurchaseInDepotBill.ID_Assessor=b.ID_User
- LEFT JOIN AppUser c ON PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=c.ID_User
- LEFT JOIN Location ON PurchaseInDepotBill.ID_Location=Location.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee=PurchaseInDepotBill.ID_QA
- LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseInDepotBill.ID_Supplier
- WHERE No_PurchaseInDepotBill=@No_PurchaseInDepotBill
-
- SELECT PurchaseInDepotBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,Location.Name_Location,Location.ID_Location,Location.No_Location,BillType.Name_BillType,@No_PurchaseInDepotBill as No_PurchaseInDepotBill
- FROM PurchaseInDepotBillProduct
- LEFT JOIN Product ON PurchaseInDepotBillProduct.ID_Product=Product.ID_Product
- LEFT JOIN PurchaseInDepotBill ON PurchaseInDepotBillProduct.ID_PurchaseInDepotBill=PurchaseInDepotBill.ID_PurchaseInDepotBill
- LEFT JOIN Location ON Location.ID_Location=PurchaseInDepotBillProduct.ID_Location
- LEFT JOIN BillType ON BillType.Value_BillType=PurchaseInDepotBillProduct.Type_FromBill
- WHERE No_PurchaseInDepotBill=@No_PurchaseInDepotBill
- ORDER BY CAST(No_PurchaseInDepotBillProduct AS INT)
- ">
- <Params>
- <Param name="@No_PurchaseInDepotBill" type="PurchaseInDepotBill.No_PurchaseInDepotBill" Index="0" />
- </Params>
- <Tables>
- <Table name="PurchaseInDepotBill" />
- <Table name="PurchaseInDepotBillProduct" />
- </Tables>
- </SearchPurchaseInDepotBillWithNo>
- <SearchPrincipal CmdType="Text" CmdText="
- SELECT Employee.ID_Employee,Employee.No_Employee AS No_Principal, Employee.Name_Employee AS Name_Principal
- FROM Employee
- ORDER BY No_Employee
- ">
- <Tables>
- <Table name="Principal" />
- </Tables>
- </SearchPrincipal>
- <SearchLocation CmdType="Text" CmdText="SELECT Name_Location,ID_Location,No_Location FROM Location WHERE SubjectionID_Location Is Null">
- <Tables>
- <Table name="Location" />
- </Tables>
- </SearchLocation>
- <SearchByEncasementNo CmdType="Text" CmdText="Select * From (
- SELECT Name_BillType='采购订单',Type_FromBill=41,OnShipProduct.No_FromBill,OnShipProduct.ID_PurchaseSourceBillProduct,OnShipProduct.No_FromBillProduct,OnShipProduct.ID_Product,OnShipProduct.Quantity_OnShipProduct As Quantity_PurchaseInDepotBillProduct,Product.No_Product,Name_Product,Product.Unit_Product,Product.SuspendDate_Product
- ,IsNull(lc.No_Location,'') As No_Location,IsNull(lc.Name_Location,'') As Name_Location,lc.ID_Location
- FROM OnShipProduct LEFT JOIN OnShip ON OnShip.ID_OnShip=OnShipProduct.ID_OnShip
- LEFT JOIN Product ON Product.ID_Product=OnShipProduct.ID_Product
- Left Join (SELECT Location.ID_Location,No_Location,Name_Location,ID_Product FROM ProductStocks
- LEFT JOIN Location ON ProductStocks.ID_Location = Location.ID_Location
- WHERE SubjectionID_Location is not Null) lc On lc.ID_Product = OnShipProduct.ID_Product
- WHERE EncasementNo_OnShip=@EncasementNo_OnShip) al
- Where Not Exists (Select 1 From (
- SELECT Name_BillType='采购订单',Type_FromBill=41,OnShipProduct.No_FromBill,OnShipProduct.ID_PurchaseSourceBillProduct,OnShipProduct.No_FromBillProduct,OnShipProduct.ID_Product,OnShipProduct.Quantity_OnShipProduct As Quantity_PurchaseInDepotBillProduct,Product.No_Product,Name_Product,Product.Unit_Product,Product.SuspendDate_Product
- ,IsNull(lc.No_Location,'') As No_Location,IsNull(lc.Name_Location,'') As Name_Location
- FROM OnShipProduct LEFT JOIN OnShip ON OnShip.ID_OnShip=OnShipProduct.ID_OnShip
- LEFT JOIN Product ON Product.ID_Product=OnShipProduct.ID_Product
- Left Join (SELECT Location.ID_Location,No_Location,Name_Location,ID_Product FROM ProductStocks
- LEFT JOIN Location ON ProductStocks.ID_Location = Location.ID_Location
- WHERE SubjectionID_Location is not Null) lc On lc.ID_Product = OnShipProduct.ID_Product
- WHERE EncasementNo_OnShip=@EncasementNo_OnShip) bl Where bl.ID_Product = al.ID_Product And bl.No_Location > al.No_Location)
- Order By No_FromBillProduct">
- <Params>
- <Param name="@EncasementNo_OnShip" type="OnShip.EncasementNo_OnShip" sourceColumn="EncasementNo_OnShip" />
- </Params>
- <Tables>
- <Table name="OnShipProduct" />
- </Tables>
- </SearchByEncasementNo>
- <SearchChildLocation CmdType="Text" CmdText="
-
- SELECT Name_Location,ID_Location FROM Location
- WHERE ID_Warehouse=@ID_Warehouse And LowestLevel_Location=1
- ">
- <Params>
- <Param name="@ID_Warehouse" type="Location.ID_Warehouse" Index="0" />
- </Params>
- <Tables>
- <Table name="ChildLocations" />
- </Tables>
- </SearchChildLocation>
- <SearchLocationRelationShips CmdType="Text" CmdText="SELECT * FROM Location WHERE ID_Location=@ID_Location and ID_Warehouse=@ID_Warehouse And LowestLevel_Location=1 ">
- <Params>
- <Param name="@ID_Location" type="Location.ID_Location" Index="0" />
- <Param name="@ID_Warehouse" type="Location.ID_Warehouse" Index="1" />
- </Params>
- <Tables>
- <Table name="SLR" />
- </Tables>
- </SearchLocationRelationShips>
- <SearchProduct CmdType="Text" CmdText="
- SELECT ID_Product,Name_Product,Unit_Product,SuspendDate_Product
- FROM Product
- WHERE No_Product=@No_Product
- ">
- <Params>
- <Param name="@No_Product" type="Product.No_Product" Index="0" />
- </Params>
- <Tables>
- <Table name="Product" />
- </Tables>
- </SearchProduct>
- <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>
- <SearchSupplier CmdType="Text" CmdText="
- SELECT ID_Supplier,ShortName_Supplier,SuspendDate_Supplier FROM Supplier
- WHERE No_Supplier=@No_Supplier
- ">
- <Params>
- <Param name="@No_Supplier" type="Supplier.No_Supplier" Index="0"/>
- </Params>
- <Tables>
- <Table name="Supplier"/>
- </Tables>
- </SearchSupplier>
- <SearchStockSettle CmdType="Text" CmdText="
- Select * From StockSettleAccounts
- Where DateDiff(Day,@Date_PurchaseInDepotBill,FromDate_StockSettleAccounts) <=0
- And DateDiff(Day,@Date_PurchaseInDepotBill,EndDate_StockSettleAccounts) >=0
- And Status_StockSettleAccounts=0
- ">
- <Params>
- <Param name="@Date_PurchaseInDepotBill" type="PurchaseInDepotBill.Date_PurchaseInDepotBill" Index="0"/>
- </Params>
- <Tables>
- <Table name="StockSettle"/>
- </Tables>
- </SearchStockSettle>
- <SearchPurchaseOrderBill CmdType="Text" CmdText="
- SELECT ID_Assessor,ID_Supplier FROM PurchaseOrderBill
- WHERE No_PurchaseOrderBill=@No_PurchaseOrderBill
- ">
- <Params>
- <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0" />
- </Params>
- <Tables>
- <Table name="PurchaseOrderBill" />
- </Tables>
- </SearchPurchaseOrderBill>
- <SearchPurchaseOrderBillProduct CmdType="Text" CmdText="
- SELECT PurchaseOrderBillProduct.* ,Name_Product,Product.No_Product,Product.Unit_Product,Product.SuspendDate_Product,Quantity=IsNull((Quantity_Order-Quantity_InDepot),PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct)
- ,PurchaseOrderBill.RefNo_PurchaseOrderBill
- FROM PurchaseOrderBillProduct
- LEFT JOIN Product ON PurchaseOrderBillProduct.ID_Product=Product.ID_Product
- LEFT JOIN PurchaseOrderBill ON PurchaseOrderBill.ID_PurchaseOrderBill=PurchaseOrderBillProduct.ID_PurchaseOrderBill
- LEFT JOIN PurchaseSourceBillProduct ON PurchaseSourceBillProduct.ID_PurchaseSourceBillProduct=PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct
- WHERE No_PurchaseOrderBill=@No_PurchaseOrderBill and No_PurchaseOrderBillProduct=@No_PurchaseOrderBillProduct
- ">
- <Params>
- <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0" />
- <Param name="@No_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.No_PurchaseOrderBillProduct"
- Index="1" />
- </Params>
- <Tables>
- <Table name="PurchaseOrderBillProduct" />
- </Tables>
- </SearchPurchaseOrderBillProduct>
- <SearchBillType CmdType="Text" CmdText="SELECT * FROM BillType WHERE Value_BillType =41 OR Value_BillType = 0 ORDER BY Value_BillType
- ">
- <Tables>
- <Table name="BillType"/>
- </Tables>
- </SearchBillType>
- <SearchProcess CmdType="Text" CmdText="SELECT StockAndInDepot_SystemSetting FROM SystemSetting">
- <Tables>
- <Table name="Process"/>
- </Tables>
- </SearchProcess>
- <SearchPurchaseInDepotBillFirst CmdType="Text" CmdText="DECLARE @ID_PurchaseInDepotBill uniqueidentifier
- DECLARE @No_PurchaseInDepotBill nvarchar(64)
- SELECT Top 1 @ID_PurchaseInDepotBill=ID_PurchaseInDepotBill FROM PurchaseInDepotBill ORDER BY No_PurchaseInDepotBill
- SELECT Top 1 @No_PurchaseInDepotBill=No_PurchaseInDepotBill FROM PurchaseInDepotBill ORDER BY No_PurchaseInDepotBill
-
- SELECT PurchaseInDepotBill.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Location.Name_Location,Location.No_Location,Employee.No_Employee As No_Principal,Employee.Name_Employee As Name_Principal,Supplier.No_Supplier,Supplier.ShortName_Supplier
- FROM PurchaseInDepotBill
- LEFT JOIN AppUser a ON PurchaseInDepotBill.ID_Creator=a.ID_User
- LEFT JOIN AppUser b ON PurchaseInDepotBill.ID_Assessor=b.ID_User
- LEFT JOIN AppUser c ON PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=c.ID_User
- LEFT JOIN Location ON PurchaseInDepotBill.ID_Location=Location.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee=PurchaseInDepotBill.ID_QA
- LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseInDepotBill.ID_Supplier
- WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
-
- SELECT PurchaseInDepotBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,Location.Name_Location,Location.ID_Location,Location.No_Location,BillType.Name_BillType,@No_PurchaseInDepotBill as No_PurchaseInDepotBill
- FROM PurchaseInDepotBillProduct
- LEFT JOIN Location ON Location.ID_Location=PurchaseInDepotBillProduct.ID_Location
- LEFT JOIN Product ON PurchaseInDepotBillProduct.ID_Product=Product.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType=PurchaseInDepotBillProduct.Type_FromBill
- WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
- ORDER BY CAST(No_PurchaseInDepotBillProduct AS INT)
- ">
- <Tables>
- <Table name="PurchaseInDepotBill" />
- <Table name="PurchaseInDepotBillProduct" />
- </Tables>
- </SearchPurchaseInDepotBillFirst>
- <SearchPurchaseInDepotBillPrev CmdType="Text" CmdText=" DECLARE @ID_PurchaseInDepotBill uniqueidentifier
- DECLARE @No_PurchaseInDepot nvarchar(64)
- SELECT Top 1 @ID_PurchaseInDepotBill=ID_PurchaseInDepotBill FROM PurchaseInDepotBill
- WHERE No_PurchaseInDepotBill < @No_PurchaseInDepotBill
- ORDER BY No_PurchaseInDepotBill Desc
- SELECT Top 1 @No_PurchaseInDepot=No_PurchaseInDepotBill FROM PurchaseInDepotBill
- WHERE No_PurchaseInDepotBill < @No_PurchaseInDepotBill
- ORDER BY No_PurchaseInDepotBill Desc
-
- SELECT Top 1 PurchaseInDepotBill.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Location.Name_Location,Location.No_Location,Employee.No_Employee As No_Principal,Employee.Name_Employee As Name_Principal,Supplier.No_Supplier,Supplier.ShortName_Supplier
- FROM PurchaseInDepotBill
- LEFT JOIN AppUser a ON PurchaseInDepotBill.ID_Creator=a.ID_User
- LEFT JOIN AppUser b ON PurchaseInDepotBill.ID_Assessor=b.ID_User
- LEFT JOIN AppUser c ON PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=c.ID_User
- LEFT JOIN Location ON PurchaseInDepotBill.ID_Location=Location.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee=PurchaseInDepotBill.ID_QA
- LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseInDepotBill.ID_Supplier
- WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
-
- SELECT PurchaseInDepotBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,Location.Name_Location,Location.ID_Location,Location.No_Location,BillType.Name_BillType,@No_PurchaseInDepot as No_PurchaseInDepotBill
- FROM PurchaseInDepotBillProduct
- LEFT JOIN Location ON Location.ID_Location=PurchaseInDepotBillProduct.ID_Location
- LEFT JOIN BillType ON BillType.Value_BillType=PurchaseInDepotBillProduct.Type_FromBill
- LEFT JOIN Product ON PurchaseInDepotBillProduct.ID_Product=Product.ID_Product
- WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
- ORDER BY CAST(No_PurchaseInDepotBillProduct AS INT)
- ">
- <Params>
- <Param name="@No_PurchaseInDepotBill" type="PurchaseInDepotBill.No_PurchaseInDepotBill" Index="0" />
- </Params>
- <Tables>
- <Table name="PurchaseInDepotBill" />
- <Table name="PurchaseInDepotBillProduct" />
- </Tables>
- </SearchPurchaseInDepotBillPrev>
- <SearchPurchaseInDepotBillNext CmdType="Text" CmdText="
- DECLARE @ID_PurchaseInDepotBill uniqueidentifier
- DECLARE @No_PurchaseInDepot nvarchar(64)
- SELECT Top 1 @ID_PurchaseInDepotBill=ID_PurchaseInDepotBill FROM PurchaseInDepotBill
- WHERE No_PurchaseInDepotBill > @No_PurchaseInDepotBill
- ORDER BY No_PurchaseInDepotBill
- SELECT @No_PurchaseInDepot=No_PurchaseInDepotBill FROM PurchaseInDepotBill where ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
-
- SELECT Top 1 PurchaseInDepotBill.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Location.Name_Location,Location.No_Location,Employee.No_Employee As No_Principal,Employee.Name_Employee As Name_Principal,Supplier.No_Supplier,Supplier.ShortName_Supplier
- FROM PurchaseInDepotBill
- LEFT JOIN AppUser a ON PurchaseInDepotBill.ID_Creator=a.ID_User
- LEFT JOIN AppUser b ON PurchaseInDepotBill.ID_Assessor=b.ID_User
- LEFT JOIN AppUser c ON PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=c.ID_User
- LEFT JOIN Location ON PurchaseInDepotBill.ID_Location=Location.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee=PurchaseInDepotBill.ID_QA
- LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseInDepotBill.ID_Supplier
- WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
-
- SELECT PurchaseInDepotBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,Name_Location,Location.ID_Location,Location.No_Location,BillType.Name_BillType,@No_PurchaseInDepot as No_PurchaseInDepotBill
- FROM PurchaseInDepotBillProduct
- LEFT JOIN Location ON Location.ID_Location=PurchaseInDepotBillProduct.ID_Location
- LEFT JOIN Product ON PurchaseInDepotBillProduct.ID_Product=Product.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType=PurchaseInDepotBillProduct.Type_FromBill
- WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
- ORDER BY CAST(No_PurchaseInDepotBillProduct AS INT)
- ">
- <Params>
- <Param name="@No_PurchaseInDepotBill" type="PurchaseInDepotBill.No_PurchaseInDepotBill" Index="0" />
- </Params>
- <Tables>
- <Table name="PurchaseInDepotBill" />
- <Table name="PurchaseInDepotBillProduct" />
- </Tables>
- </SearchPurchaseInDepotBillNext>
- <SearchPurchaseInDepotBillLast CmdType="Text" CmdText="
- declare @ID_PurchaseInDepotBill uniqueidentifier
- DECLARE @No_PurchaseInDepot nvarchar(64)
- SELECT Top 1 @ID_PurchaseInDepotBill=ID_PurchaseInDepotBill FROM PurchaseInDepotBill ORDER BY No_PurchaseInDepotBill Desc
- SELECT Top 1 @No_PurchaseInDepot=No_PurchaseInDepotBill FROM PurchaseInDepotBill ORDER BY No_PurchaseInDepotBill Desc
-
- SELECT PurchaseInDepotBill.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Location.Name_Location,Location.No_Location,Employee.No_Employee As No_Principal,Employee.Name_Employee As Name_Principal,Supplier.No_Supplier,Supplier.ShortName_Supplier
- FROM PurchaseInDepotBill
- LEFT JOIN AppUser a ON PurchaseInDepotBill.ID_Creator=a.ID_User
- LEFT JOIN AppUser b ON PurchaseInDepotBill.ID_Assessor=b.ID_User
- LEFT JOIN AppUser c ON PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=c.ID_User
- LEFT JOIN Location ON PurchaseInDepotBill.ID_Location=Location.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee=PurchaseInDepotBill.ID_QA
- LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseInDepotBill.ID_Supplier
- WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
-
- SELECT PurchaseInDepotBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,Name_Location,Location.ID_Location,Location.No_Location,BillType.Name_BillType,@No_PurchaseInDepot as No_PurchaseInDepotBill
- FROM PurchaseInDepotBillProduct
- LEFT JOIN Location ON Location.ID_Location=PurchaseInDepotBillProduct.ID_Location
- LEFT JOIN Product ON PurchaseInDepotBillProduct.ID_Product=Product.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType=PurchaseInDepotBillProduct.Type_FromBill
- WHERE ID_PurchaseInDepotBill=@ID_PurchaseInDepotBill
- ORDER BY CAST(No_PurchaseInDepotBillProduct AS INT)
- ">
- <Tables>
- <Table name="PurchaseInDepotBill" />
- <Table name="PurchaseInDepotBillProduct" />
- </Tables>
- </SearchPurchaseInDepotBillLast>
- <SearchAllPurchaseOrderBill CmdType="Text" CmdText="Select PurchaseOrderBill.ID_PurchaseOrderBill,PurchaseOrderBill.No_PurchaseOrderBill,PurchaseOrderBill.Date_PurchaseOrderBill,Supplier.No_Supplier,Supplier.ShortName_Supplier, No_Employee, ID_Employee, Name_Employee, Case When PurchaseOrderBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_PurchaseOrderBill,Location.Name_Location From PurchaseOrderBill
- Inner Join Supplier On PurchaseOrderBill.ID_Supplier = Supplier.ID_Supplier
- Inner Join Location On Location.ID_Location = PurchaseOrderBill.ID_Location
- Inner Join Employee On PurchaseOrderBill.ID_Principal = Employee.ID_Employee" >
- <Tables>
- <Table name="AllSaleOutDepotBill" />
- </Tables>
- </SearchAllPurchaseOrderBill>
- <SearchAllPurchaseOrderBillProduct CmdType="Text" CmdText="Select Product.No_Product,PurchaseOrderBillProduct.No_PurchaseOrderBillProduct,Product.Name_Product,PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct,PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct From PurchaseOrderBillProduct
- Inner Join Product On Product.ID_Product = PurchaseOrderBillProduct.ID_Product
- Inner Join PurchaseOrderBill On PurchaseOrderBill.ID_PurchaseOrderBill = PurchaseOrderBillProduct.ID_PurchaseOrderBill" >
- <Tables>
- <Table name="AllSaleOutDepotBillProduct" />
- </Tables>
- </SearchAllPurchaseOrderBillProduct>
- <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">
- <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>
- </Search>
- </Server>
- <Lables>
- <Search>
- Empty();
- NewInstance();
- tbNo.ReadOnly=false;
- timeMake.Enabled=false;
- tbNoSupplier.ReadOnly=true;
- txtShortName.ReadOnly=true;
- cbProposer.Enabled=false;
- cbLocation.Enabled=false;
- dgProduct.ReadOnly=true;
- txtComment.ReadOnly=true;
- txtNumSum.CValue=0.00;
- ikLabel3.CValue="(未核算成本)";
- #PurchaseInDepotBill.Creator=DBNull();
- #PurchaseInDepotBill.ID_Creator=DBNull();
- #PurchaseInDepotBill.Assessor=DBNull();
- #PurchaseInDepotBill.ID_Assessor=DBNull();
- #PurchaseInDepotBill.AssessDate_PurchaseInDepotBill=DBNull();
- #PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=DBNull();
- #PurchaseInDepotBill.LastModUser=DBNull();
- #PurchaseInDepotBill.LastModDate_PurchaseInDepotBill=DBNull();
- toolBar.EnableSubmit=false;
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- toolBar.EnableAudit=false;
- toolBar.EnableUnAudit=false;
- toolBar.EnableNew=GetRight(@Title,"新增");
- toolBar.EnablePrint=false;
- toolBar.EnableImport = false;
- UpdateForm(true,"");
- @Status=0;
- </Search>
- <New>
- Empty();
- NewInstance();
- tbNo.ReadOnly=true;
- timeMake.Enabled=true;
- timeMake.Focus();
- cbProposer.Enabled=true;
- cbLocation.Enabled=true;
- dgProduct.ReadOnly=false;
- tbNoSupplier.ReadOnly=false;
- txtShortName.ReadOnly=false;
- txtComment.ReadOnly=false;
- txtNumSum.CValue=0.00;
- ikLabel3.CValue="(未核算成本)";
- #PurchaseInDepotBill.ID_PurchaseInDepotBill=NewGuid();
- #PurchaseInDepotBill.Creator=GetCurrentUser();
- #PurchaseInDepotBill.ID_Creator=GetLoginUserID();
- #PurchaseInDepotBill.Assessor=DBNull();
- #PurchaseInDepotBill.ID_Assessor=DBNull();
- #PurchaseInDepotBill.AssessDate_PurchaseInDepotBill=DBNull();
- #PurchaseInDepotBill.LastModUser=DBNull();
- #PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=DBNull();
- #PurchaseInDepotBill.LastModDate_PurchaseInDepotBill=DBNull();
- #PurchaseInDepotBill.ID_Location=GetCurrentDepotID();
- #PurchaseInDepotBill.Name_Location=GetCurrentDepot();
- #PurchaseInDepotBill.No_Location=GetCurrentDepotNo();
- #PurchaseInDepotBill.Date_PurchaseInDepotBill=GetCurrentTime();
- toolBar.EnableSubmit=GetRight(@Title,"新增");
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- toolBar.EnableAudit=false;
- toolBar.EnableUnAudit=false;
- toolBar.EnableNew=false;
- toolBar.EnablePrint=false;
- toolBar.EnableImport = true;
- dgProduct.SetColumnReadOnly(1, false);
- dgProduct.SetColumnReadOnly(2, false);
- dgProduct.SetColumnReadOnly(3, false);
- dgProduct.SetColumnReadOnly(5, false);
- dgProduct.RowHeaderCheck=true;
- dgProduct.AllowNew(true);
- dgProduct.AllowDelete(true);
- UpdateForm(true,"");
- SetColumnDefaultValue("PurchaseInDepotBillProduct", "Quantity_PurchaseInDepotBillProduct",1 );
- @Status=1;
- </New>
- <View>
- tbNo.ReadOnly=false;
- timeMake.Enabled=false;
- cbLocation.Enabled=false;
- cbProposer.Enabled=false;
- dgProduct.ReadOnly=true;
- tbNoSupplier.ReadOnly=true;
- txtShortName.ReadOnly=true;
- txtComment.ReadOnly=true;
- txtNumSum.CValue=SumOfCol("#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct");
- toolBar.EnableSubmit=false;
- toolBar.EnableNew=GetRight(@Title,"新增");
- toolBar.EnableImport= false;
- if(Search("SearchStockSettle",#PurchaseInDepotBill.Date_PurchaseInDepotBill))
- {
- toolBar.EnablePrint=GetRight(@Title,"打印");
- if(Equals(#PurchaseInDepotBill.ID_Assessor, DBNull()))
- {
- toolBar.EnableAudit=GetRight(@Title,"审核");
- toolBar.EnableUnAudit=false;
- toolBar.EnableModify=GetRight(@Title,"修改");
- toolBar.EnableDelete=GetRight(@Title,"删除");
- }
- else
- {
- toolBar.EnableAudit=false;
- toolBar.EnableUnAudit=GetRight(@Title,"取消审核");
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- }
- }
- else
- {
- toolBar.EnablePrint=false;
- toolBar.EnableAudit=false;
- toolBar.EnableUnAudit=false;
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- }
-
- if(#purchaseInDepotBill.CostVerify_PurchaseInDepotBill==true)
- ikLabel3.CValue="(已核算成本)";
- else
- ikLabel3.CValue="(未核算成本)";
- UpdateForm(true, "");
- @Status=2;
- </View>
- <Modify>
- tbNo.ReadOnly=true;
- timeMake.Enabled=false;
- cbLocation.Enabled=true;
- cbProposer.Enabled=true;
- dgProduct.ReadOnly=false;
- tbNoSupplier.ReadOnly=false;
- txtShortName.ReadOnly=false;
- txtComment.ReadOnly=false;
- toolBar.EnableSubmit=GetRight(@Title,"修改");
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- toolBar.EnableAudit=false;
- toolBar.EnableUnAudit=false;
- toolBar.EnableNew=false;
- toolBar.EnablePrint=false;
- toolBar.EnableImport = false;
- #PurchaseInDepotBill.LastModUser=GetCurrentUser();
- #PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=GetLoginUserID();
- #PurchaseInDepotBill.LastModDate_PurchaseInDepotBill=GetCurrentTime();
- @HaveAccessed = !Equals(#PurchaseInDepotBill.AssessDate_PurchaseInDepotBill,DBNull());
- dgProduct.SetColumnReadOnly(1, @HaveAccessed);
- dgProduct.SetColumnReadOnly(2, @HaveAccessed);
- dgProduct.SetColumnReadOnly(3, @HaveAccessed);
- dgProduct.SetColumnReadOnly(5, @HaveAccessed);
- dgProduct.AllowNew(!@HaveAccessed);
- dgProduct.AllowDelete(!@HaveAccessed);
- dgProduct.RowHeaderCheck=!@HaveAccessed;
- UpdateForm(true, "");
- SetColumnDefaultValue("PurchaseInDepotBillProduct", "Quantity_PurchaseInDepotBillProduct",1 );
-
- @Status=3;
- </Modify>
- <SubmitButtonClick>
- <![CDATA[
- @tag = 0;
- if(!Search("SearchStockSettle",timeMake.Value))
- {
- MessageBox("制单日期不在开帐区间内,提交失败!");
- return;
- }
- if(!Search("SearchSupplier",tbNoSupplier.CValue)|| !Equals(#PurchaseInDepotBill.ID_Supplier,#Supplier.ID_Supplier))
- {
- MessageBox("请输入有效的供应商,回车以示确认!",@Title);
- tbNoSupplier.Focus();
- return;
- }
- if(txtShortName.CValue==StringEmpty())
- {
- MessageBox("请输入装箱单号!",@Title);
- txtShortName.Focus();
- return;
- }
- if(!cbLocation.CheckSelectedItem())
- {
- MessageBox("请选择有效的入货仓库!",@Title);
- cbLocation.Focus();
- return;
- }
- if(!cbProposer.CheckSelectedItem())
- {
- MessageBox("请选择有效的质检人!",@Title);
- cbProposer.Focus();
- return;
- }
- if(RowCount("#PurchaseInDepotBillProduct")==0)
- {
- MessageBox("请输入采购入库产品!",@Title);
- dgProduct.Focus();
- return;
- }
- UpdateForm(false, "");
- SuspendLayout();
- for(@i=0;@i<RowCount("#PurchaseInDepotBillProduct");@i=@i+1)
- {
- SetPosition("#PurchaseInDepotBillProduct",@i);
- if(@StockAndInDepot==true)
- {
- if(#PurchaseInDepotBillProduct.Type_FromBill==0)
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("请选择来源单据!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if(#PurchaseInDepotBillProduct.No_FromBill==StringEmpty())
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("请输入来源单据单号!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- else
- {
- Search("SearchPurchaseOrderBill",#PurchaseInDepotBillProduct.No_FromBill);
- if(!Equals(#PurchaseInDepotBill.ID_Supplier,#PurchaseOrderBill.ID_Supplier))
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该来源单据的供应商与本次采购入库单的供应商不一致!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
- if(#PurchaseInDepotBillProduct.No_FromBillProduct==StringEmpty())
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("请输入来源单据产品序号!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if(!Search("SearchPurchaseOrderBillProduct",#PurchaseInDepotBillProduct.No_FromBill,#PurchaseInDepotBillProduct.No_FromBillProduct))
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该来源信息有误,请确认!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- else
- {
- if(#PurchaseOrderBillProduct.No_Product!=#PurchaseInDepotBillProduct.No_Product)
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该来源单据中指定的产品与后改写的产品不匹配!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
- if(Search("SearchPurchaseOrderBill",#PurchaseInDepotBillProduct.No_FromBill))
- {
- if(Equals(#PurchaseOrderBill.ID_Assessor,DBNull()))
- {
-
- dgProduct.CurrentRowIndex = @i;
- if(MessageBox("该来源单据未经审核,确定要提交吗?",@Title,MB_OKCANCEL)==DialogResult("CANCEL"))
- {
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
- }
- }
- else
- {
- if(#PurchaseInDepotBillProduct.Type_FromBill!=0&&#PurchaseInDepotBillProduct.No_FromBill!=StringEmpty()&&Search("SearchPurchaseOrderBill",#PurchaseInDepotBillProduct.No_FromBill))
- {
- if(Equals(#PurchaseOrderBill.ID_Assessor,DBNull()))
- {
-
- dgProduct.CurrentRowIndex = @i;
- @DialogResult=MessageBox("该来源单据未经审核,确定要保留来源单据资料吗?",@Title,MB_YESNOCANCEL);
- if(@DialogResult==DialogResult("NO"))
- {
- #PurchaseInDepotBillProduct.Type_FromBill = 0;
- #PurchaseInDepotBillProduct.Name_BillType="";
- #PurchaseInDepotBillProduct.No_FromBill = "";
- #PurchaseInDepotBillProduct.No_FromBillProduct = "";
- }
- if(@DialogResult==DialogResult("CANCEL"))
- {
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
- }
- if(#PurchaseInDepotBillProduct.No_Product==StringEmpty())
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("请输入产品编号!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if(!Search("SearchProduct",#PurchaseInDepotBillProduct.No_Product))
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("产品中无此产品编号,请重新填写!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
- if(#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct<=0)
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("数量不得小于等于0!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if(Equals(#PurchaseInDepotBillProduct.ID_Location,GuidEmpty()) || Equals(#PurchaseInDepotBillProduct.ID_Location,DBNull()))
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("请输入有效的入库库位!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- else
- {
- if(!Search("SearchLocationRelationShips",#PurchaseInDepotBillProduct.ID_Location,#PurchaseInDepotBill.ID_Location))
- {
- dgProduct.CurrentRowIndex = @i;
- MessageBox("该库位不属于所选仓库,请重新选择!",@Title);
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
-
- if(Search("SearchExistsProduct",#PurchaseInDepotBillProduct.No_Location,#PurchaseInDepotBillProduct.No_Product))
- {
- dgProduct.CurrentRowIndex = @i;
- dgProduct.Focus();
- @DialogResult=MessageBox("该库位已被其他产品占用,确定要提交吗?",@Title,MB_OKCANCEL);
- if(@DialogResult == DialogResult("CANCEL"))
- {
- ResumeLayout(); return;
- }
- }
-
- if(Equals(#PurchaseInDepotBillProduct.ID_PurchaseInDepotBillProduct,GuidEmpty()))
- {
- #PurchaseInDepotBillProduct.ID_PurchaseInDepotBillProduct=NewGuid();
- }
- #PurchaseInDepotBillProduct.ID_PurchaseInDepotBill=#PurchaseInDepotBill.ID_PurchaseInDepotBill;
-
- Register_Set("1",#PurchaseInDepotBillProduct.No_Location);
- Register_Set("2",#PurchaseInDepotBillProduct.No_Product);
- for(@j=@i+1;@j<=RowCount("#PurchaseInDepotBillProduct")-1;@j=@j+1)
- {
- SetPosition("#PurchaseInDepotBillProduct",@j);
- if(Equals(Register_Get("1"),#PurchaseInDepotBillProduct.No_Location) && !Equals(Register_Get("2"),#PurchaseInDepotBillProduct.No_Product))
- {
- @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)
- {
- #PurchaseInDepotBill.CreateDate_PurchaseInDepotBill=GetCurrentTime();
- #PurchaseInDepotBill.No_PurchaseInDepotBill = New("#PurchaseInDepotBill.No_PurchaseInDepotBill", timeMake.CValue);
- }
- else if(@Status==3)
- {
- #PurchaseInDepotBill.LastModUser=GetCurrentUser();
- #PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=GetLoginUserID();
- #PurchaseInDepotBill.LastModDate_PurchaseInDepotBill=GetCurrentTime();
- Update();
- }
- ChangeMode("View");
- ]]>
- </SubmitButtonClick>
- </Lables>
- </Form>
- </Forms>
|