; ; ShowSearchBox("BillSearch","HAVEDEPOT", "tbNo",tbNo.CValue); UpdateForm(false, "cbDepot"); Search("SearchChangedDepot"); UpdateForm(true, "cbDepot"); UpdateForm(false, "cbType"); Search("SearchType"); UpdateForm(true, "cbType"); UpdateForm(false, "cbProposer"); Search("SearchProposer"); UpdateForm(true, "cbProposer"); BeginUnAudit(); #ModifyDepotBill.ID_Assessor = DBNull(); #ModifyDepotBill.Assessor_ModifyDepotBill = ""; #ModifyDepotBill.Disable_ModifyDepotBill=true; UnAudit(false); ChangeMode("View"); EndUnAudit(); Search("SearchSourceBillName"); SetDataGridColumnDataSource(1,"dgProduct"); @SetFlag=1; ShowSearchBox("ProductSearch","INFOMATION",#ModifyDepotBillProduct.ProductNo_FromBillProduct); @SetFlag=0; @SetFlag=1; @LocationNo = ShowSearchBox("LocationSearch","INFOMATION",#ModifyDepotBillProduct.No_Location); if(@LocationNo != "") #ModifyDepotBillProduct.No_Location = @LocationNo; @SetFlag=0; if(Search("SearchModifyDepotBillFirst", tbNo.CValue)) { ChangeMode("View"); } if(Search("SearchModifyDepotBillPrevious", tbNo.CValue)) { ChangeMode("View"); } if(Search("SearchModifyDepotBillNext", tbNo.CValue)) { ChangeMode("View"); } if(Search("SearchModifyDepotBillLast", tbNo.CValue)) { ChangeMode("View"); } ChangeMode("New"); ChangeMode("Search"); ChangeMode("Modify"); Delete(); ChangeMode("Search"); ShowPrintBox("BillSearch",#ModifyDepotBill.No_ModifyDepotBill,#ModifyDepotBill.No_ModifyDepotBill,GetFieldRight(@Title,"成本及总价","查看")); ; ; ; if(toolBar.ExpandForm==true) { pnRight.Visible=true; } else { pnRight.Visible=false; } ; 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; } }
Search("SearchType"); cbType.Text = #ModifyDepotBill.ModifyDepotBill_ModifyDepotBill; Search("SearchChangedDepot"); cbDepot.Text = #ModifyDepotBill.ChangedDepot_ModifyDepotBill;
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; 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; #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; 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; 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; =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"); ]]> 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