; ; ShowSearchBox("BillSearch","HAVEDEPOT", "tbNo",tbNo.CValue); UpdateForm(false, "cbLocation"); Search("SearchLocation"); UpdateForm(true, "cbLocation"); UpdateForm(false, "cbPrincipal"); Search("SearchPrincipal"); UpdateForm(true, "cbPrincipal"); UpdateForm(false, "cbReason"); Search("SearchReason"); UpdateForm(true, "cbReason"); UpdateForm(false, "cbComment"); Search("SearchComment"); UpdateForm(true, "cbComment"); if(MessageBox("确定作废当前单据吗?",@Title,MB_YESNO)==DialogResult("YES")) { if(Search("SearchInDepot",#SaleRtnBill.ID_SaleRtnBill)) { if(#InDepot.Quantity_InDepot > 0) { MessageBox("该单据已有相应的销售退货入库记录,作废失败!",@Title); return; } } BeginUnAudit(); #SaleRtnBill.ID_Assessor = DBNull(); #SaleRtnBill.Name_Assessor = ""; #SaleRtnBill.Disable_SaleRtnBill=true; UnAudit(false); ChangeMode("View"); EndUnAudit(); Search("UpdateCustomer",#SaleRtnBill.ID_Customer,#SaleRtnBill.Amount_SaleRtnBill,"1"); } @SetFlag=1; ShowSearchBox("ProductSearch","INFOMATION",#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct); @SetFlag=0; Search("SearchBillType"); SetDataGridColumnDataSource(9,"dgProduct"); if(Search("SearchSaleRtnBillFirst",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID())) { ChangeMode("View"); } if(Search("SearchSaleRtnBillPrevious", tbNo.CValue,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID())) { ChangeMode("View"); } if(Search("SearchSaleRtnBillNext", tbNo.CValue,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID())) { ChangeMode("View"); } if(Search("SearchSaleRtnBillLast",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID())) { ChangeMode("View"); } ChangeMode("Search"); if(!Equals(@No=GetNextAutoNumber(true),"")) { ChangeMode("New"); tbNo.CValue=#SaleRtnBill.No_SaleRtnBill=@No; cbTaxCurrency.SelectedName="外加"; } ChangeMode("Modify"); ShowPrintBox("BillSearch",#SaleRtnBill.No_SaleRtnBill,#SaleRtnBill.No_SaleRtnBill); Delete(); ChangeMode("Search"); #SaleRtnBill.Assess_SaleRtnBill = 1; toolBar.EnableAssess = false; toolBar.EnableUnAssess = GetRight(@Title,"取消审核"); #SaleRtnBill.Assess_SaleRtnBill = 0; toolBar.EnableAssess = GetRight(@Title,"审核"); toolBar.EnableUnAssess = false; if(toolBar.MenuItemText=="库存异动作业") { if(Search("SearchContr")) { ExportBillProductStart("#ModifyDepotBillProduct.Type_FromBill",22,"#ModifyDepotBillProduct.SourceBillName_ModifyDepotBillProduct","销售退货单","#ModifyDepotBillProduct.No_FromBill",#SaleRtnBill.No_SaleRtnBill,"#ModifyDepotBill.ModifyDepotBill_ModifyDepotBill","销退入库","#ModifyDepotBill.ChangedDepot_ModifyDepotBill",#SaleRtnBill.Name_Location); ExportBillProduct("dgProduct","#SaleRtnBillProduct","#ModifyDepotBillProduct.No_FromBillProduct","#SaleRtnBillProduct.No_SaleRtnBillProduct"); } else { ExportBillProductStart("#ModifyDepotBillProduct.Comment_ModifyDepotBillProduct","销售退货单:"+#SaleRtnBill.No_SaleRtnBill,"#ModifyDepotBill.ModifyDepotBill_ModifyDepotBill","销退入库","#ModifyDepotBill.ChangedDepot_ModifyDepotBill",#SaleRtnBill.Name_Location); ExportBillProduct("dgProduct","#SaleRtnBillProduct","#ModifyDepotBillProduct.ProductNo_FromBillProduct","#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct"); } } #SaleRtnBillProduct.Cash_SaleRtnBillProduct=FormatNumber(#SaleRtnBillProduct.Quantity_SaleRtnBillProduct*#SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct, #SystemSetting.PriceDecimal_SystemSetting); #SaleRtnBillProduct.Cash_SaleRtnBillProduct=FormatNumber(#SaleRtnBillProduct.Quantity_SaleRtnBillProduct*#SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct, #SystemSetting.PriceDecimal_SystemSetting); #SaleRtnBillProduct.Cash_SaleRtnBillProduct=FormatNumber(#SaleRtnBillProduct.Quantity_SaleRtnBillProduct*#SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct, #SystemSetting.PriceDecimal_SystemSetting); if(@SetFlag==0) { return; } if( Equals(#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct,StringEmpty()) || !Search("SearchProductWithNo",#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct)) { if(!Equals(#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct,StringEmpty())) MessageBox("该产品不存在!",@Title); #SaleRtnBillProduct.ID_Product = GuidEmpty(); #SaleRtnBillProduct.ProductName_SaleRtnBillProduct = ""; #SaleRtnBillProduct.ProductUnit_SaleRtnBillProduct = ""; @temp = ShowSearchBox("InputSearchProduct","INFOMATION",#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct); if(@temp != "") { ResumeColumnEvent("#SaleRtnBillProduct.ProductNo_SaleRtnBillProduct"); #SaleRtnBillProduct.ProductNo_SaleRtnBillProduct = @temp; ClearColumnEvent(); } } else { if(!Equals(#Product.SuspendDate_Product,DBNull())) MessageBox("该产品已停用!",@Title); #SaleRtnBillProduct.ID_Product=#Product.ID_Product; #SaleRtnBillProduct.ProductName_SaleRtnBillProduct=#Product.Name_Product; #SaleRtnBillProduct.ProductUnit_SaleRtnBillProduct=#Product.Unit_Product; #SaleRtnBillProduct.Cost_Product=#Product.Cost_Product; } #SaleRtnBillProduct.Quantity_SaleRtnBillProduct = FormatNumber(#SaleRtnBillProduct.Quantity_SaleRtnBillProduct, #SystemSetting.QuantityDecimal_SystemSetting); #SaleRtnBillProduct.Cash_SaleRtnBillProduct=FormatNumber(#SaleRtnBillProduct.Quantity_SaleRtnBillProduct*#SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct,#SystemSetting.PriceDecimal_SystemSetting); #SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct = FormatNumber(#SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct, #SystemSetting.UnitPriceDecimal_SystemSetting); #SaleRtnBillProduct.Cash_SaleRtnBillProduct=FormatNumber(#SaleRtnBillProduct.Quantity_SaleRtnBillProduct*#SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
if(GetRight("客户基本资料","全权查看")) { FormatString(""); } else { FormatString(" Customer.ID_Creator='{0}' ",GetLoginUserID()); } if(GetRight("客户基本资料","全权查看")) { FormatString(""); } else { FormatString(" Disable_SaleRtnBill=0 and Customer.ID_Creator='{0}' ",GetLoginUserID()); }
Empty(); NewInstance(); @ImportClicked = 0; dtpDate.Enabled=false; tbNo.ReadOnly=false; ckPrevBill.Enabled=false; tbCustomerNo.ReadOnly=true; cbTaxCurrency.Enabled=false; cbCurrency.Enabled=false; cbLocation.Enabled=false; cbPrincipal.Enabled=false; cbReason.Enabled=false; cbComment.Enabled=false; ikTextBox1.ReadOnly=true; dgProduct.ReadOnly=true; toolBar.EnableSubmit=false; toolBar.EnableModify=false; toolBar.EnableDelete=false; toolBar.EnableAudit=false; toolBar.EnableUnAudit=false; toolBar.EnableNew=GetRight(@Title,"新增"); toolBar.EnablePrint=false; toolBar.EnableExport = false; toolBar.EnableImport = false; toolBar.EnableAssess = false; toolBar.EnableUnAssess = false; btnDelete.Enabled = false; #SaleRtnBill.ID_Assessor=DBNull(); #SaleRtnBill.AssessDate_SaleRtnBill=DBNull(); #SaleRtnBill.LastModUser_SaleRtnBill=DBNull(); #SaleRtnBill.LastModDate_SaleRtnBill=DBNull(); UpdateForm(true, ""); tbNo.Focus(); @Status=0; Empty(); NewInstance(); @ImportClicked = 0; tbNo.ReadOnly=true; dtpDate.Enabled=true; ckPrevBill.Enabled=true; tbCustomerNo.ReadOnly=false; cbTaxCurrency.Enabled=true; cbCurrency.Enabled=false; cbLocation.Enabled=true; cbPrincipal.Enabled=true; cbReason.Enabled=true; cbComment.Enabled=true; ikTextBox1.ReadOnly=false; dgProduct.ReadOnly=false; dgProduct.SetColumnReadOnly(8, false); dgProduct.SetColumnReadOnly(9, false); dgProduct.SetColumnReadOnly(1, false); dgProduct.RowHeaderCheck=true; dgProduct.AllowNew(true); dgProduct.AllowDelete(true); toolBar.EnableSubmit=GetRight(@Title,"新增"); toolBar.EnableModify=false; toolBar.EnableDelete=false; toolBar.EnableAudit=false; toolBar.EnableUnAudit=false; toolBar.EnableNew=false; toolBar.EnablePrint=false; toolBar.EnableExport = false; toolBar.EnableImport = true; toolBar.EnableAssess = false; toolBar.EnableUnAssess = false; btnDelete.Enabled = false; #SaleRtnBill.ID_SaleRtnBill=NewGuid(); #SaleRtnBill.ID_Assessor=DBNull(); #SaleRtnBill.AssessDate_SaleRtnBill=DBNull(); #SaleRtnBill.LastModUser_SaleRtnBill=DBNull(); #SaleRtnBill.LastModDate_SaleRtnBill=DBNull(); #SaleRtnBill.ID_Creator=GetLoginUserID(); #SaleRtnBill.Name_Creator=GetCurrentUser(); #SaleRtnBill.Date_SaleRtnBill=DateTimeNow(); #SaleRtnBill.Currency_SaleRtnBill=@SysCurrency; #SaleRtnBill.ID_Location=GetCurrentDepotID(); #SaleRtnBill.Name_Location=GetCurrentDepot(); #SaleRtnBill.No_Location=GetCurrentDepotNo(); #SaleRtnBill.Date_SaleRtnBill=GetCurrentTime(); SetColumnDefaultValue("SaleRtnBillProduct", "Quantity_SaleRtnBillProduct", 1); UpdateForm(true, ""); dtpDate.Focus(); @Status=1; @ImportClicked = 0; dtpDate.Enabled=false; tbNo.ReadOnly=false; ckPrevBill.Enabled=false; tbCustomerNo.ReadOnly=true; cbTaxCurrency.Enabled=false; cbCurrency.Enabled=false; cbLocation.Enabled=false; cbPrincipal.Enabled=false; cbReason.Enabled=false; cbComment.Enabled=false; ikTextBox1.ReadOnly=true; dgProduct.ReadOnly=true; toolBar.EnableSubmit=false; toolBar.EnableNew=GetRight(@Title,"新增"); if(Search("SearchStockSettle",#SaleRtnBill.Date_SaleRtnBill)) { if(Equals(#SaleRtnBill.ID_Assessor, DBNull())) { if(#SaleRtnBill.Disable_SaleRtnBill==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; toolBar.EnableAssess = false; btnDelete.Enabled = false; toolBar.EnableUnAssess = false; } else { toolBar.EnableAudit=false; toolBar.EnableUnAudit=GetRight(@Title,"取消审核"); toolBar.EnableModify=false; toolBar.EnableDelete=false; btnDelete.Enabled = GetRight(@Title,"取消审核")&&GetRight(@Title,"删除"); if(#SaleRtnBill.Assess_SaleRtnBill == 0) { toolBar.EnableAssess = GetRight(@Title,"审核"); toolBar.EnableUnAssess = false; } else { toolBar.EnableUnAssess = GetRight(@Title,"取消审核"); toolBar.EnableAssess = false; } } } else { toolBar.EnablePrint=false; toolBar.EnableAudit=false; toolBar.EnableUnAudit=false; toolBar.EnableModify=false; toolBar.EnableDelete=false; btnDelete.Enabled = false; } toolBar.EnablePrint=GetRight(@Title,"打印"); toolBar.EnableExport = true; toolBar.EnableImport = false; UpdateForm(true, ""); @Status=2; UpdateForm(false, ""); @ImportClicked = 0; dtpDate.Enabled=false; ckPrevBill.Enabled=false; tbCustomerNo.ReadOnly=false; tbNo.ReadOnly=true; cbCurrency.Enabled=false; cbLocation.Enabled=true; cbPrincipal.Enabled=true; cbReason.Enabled=true; cbComment.Enabled=true; ikTextBox1.ReadOnly=false; dgProduct.ReadOnly=false; @HaveAccessed = !Equals(#SaleRtnBill.AssessDate_SaleRtnBill,DBNull()); dgProduct.SetColumnReadOnly(9, @HaveAccessed); dgProduct.SetColumnReadOnly(10, @HaveAccessed); dgProduct.SetColumnReadOnly(11, @HaveAccessed); dgProduct.SetColumnReadOnly(1, @HaveAccessed); dgProduct.AllowNew(!@HaveAccessed); dgProduct.AllowDelete(!@HaveAccessed); dgProduct.RowHeaderCheck=!@HaveAccessed; toolBar.EnableSubmit=GetRight(@Title,"修改"); toolBar.EnableModify=false; toolBar.EnableDelete=false; toolBar.EnableAudit=false; toolBar.EnableUnAudit=false; toolBar.EnableNew=false; toolBar.EnablePrint=false; toolBar.EnableExport = false; toolBar.EnableImport = false; toolBar.EnableAssess = false; toolBar.EnableUnAssess = false; btnDelete.Enabled = false; #SaleRtnBill.LastModUser_SaleRtnBill=GetLoginUserID(); #SaleRtnBill.LastModUserName_SaleRtnBill=GetCurrentUser(); #SaleRtnBill.LastModDate_SaleRtnBill=DateTimeNow(); SetColumnDefaultValue("SaleRtnBillProduct", "Quantity_SaleRtnBillProduct", 1); @HaveAccessed = !Equals(#SaleRtnBill.AssessDate_SaleRtnBill,DBNull()); if(@HaveAccessed) cbTaxCurrency.Enabled = false; else cbTaxCurrency.Enabled = true; UpdateForm(true, ""); tbNo.Focus(); @Status=3; Update();