; ; if(tbNo.ReadOnly == false) { if(tbNo.CValue != StringEmpty()) { UpdateForm(false, ""); if(Search("SearchPurchaseInvoiceWithNo", tbNo.CValue)) { ChangeMode("View",#PurchaseInvoice.ID_Assessor); if(#PurchaseInvoice.Disable_PurchaseInvoice==true) ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)"; } else { MessageBox("该进项发票不存在!",@Title); } } else { MessageBox("请输入进项发票单号!", @Title); } } ShowSearchBox("BillSearch","NODEPOT", "tbNo", tbNo.CValue); if(RowCount("#PurchaseInvoiceProduct") > 0) { SuspendLayout(); for(@j=0;@j < RowCount("#PurchaseInvoiceProduct");@j++) { SetPosition("#PurchaseInvoiceProduct",@j); } ResumeLayout(); } #PurchaseInvoice.Type_PurchaseInvoice=cbType.SelectedIndex; if(Equals(btnModify.Text,"修改")) { txtInvoiceNo.ReadOnly=false; btnModify.Text="保存"; } else { if(Equals(txtInvoiceNo.CValue,"")) { MessageBox("请填入发票编号!",@Title); txtInvoiceNo.Focus(); } else { if(Search("SearchInvoiceNo",txtInvoiceNo.CValue,#PurchaseInvoice.No_PurchaseInvoice)) { MessageBox("此发票号码已存在,请重新填入发票编号!",@Title); txtInvoiceNo.Focus(); return; } else { #PurchaseInvoice.LastModUser=GetCurrentUser(); #PurchaseInvoice.LastModUser_PurchaseInvoice=GetLoginUserID(); #PurchaseInvoice.LastModDate_PurchaseInvoice=GetCurrentTime(); UpdateForm(false,""); #PurchaseInvoice.Type_PurchaseInvoice=cbType.SelectedIndex; Update(); txtInvoiceNo.ReadOnly=true; btnModify.Text="修改"; } } } UpdateForm(false,""); if(tbSupplierNo.CValue!=StringEmpty()) { if(!Search("SearchSupplier",tbSupplierNo.CValue)) { MessageBox("该供应商不存在!",@Title); @temp = ShowSearchBox("SupplierSearch","INFOMATION",tbSupplierNo.CValue); if(@temp != "") { tbSupplierNo.CValue = @temp; ActiveControlEvent("tbSupplierNo", "Enter"); } } else { if(!Equals(#Supplier.SuspendDate_Supplier,DBNull())) { MessageBox("该供应商已暂停!",@Title); } #PurchaseInvoice.ID_Supplier=#Supplier.ID_Supplier; #PurchaseInvoice.ShortName_Supplier=#Supplier.ShortName_Supplier; } } else { MessageBox("请输入供应商编号!",@Title); #PurchaseInvoice.ID_Supplier=GuidEmpty(); #PurchaseInvoice.ShortName_Supplier=""; tbSupplierNo.Focus(); } UpdateForm(true,""); Search("SearchBillType"); SetDataGridColumnDataSource(0,"dgProduct"); ShowSearchBox("ProductSearch","INFOMATION",#PurchaseInvoiceProduct.No_Product); if(Search("SearchPurchaseInvoiceFirst")) { ChangeMode("View",#PurchaseInvoice.ID_Assessor); if(#PurchaseInvoice.Disable_PurchaseInvoice==true) ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)"; } if(Search("SearchPurchaseInvoicePrevious", tbNo.CValue)) { ChangeMode("View",#PurchaseInvoice.ID_Assessor); if(#PurchaseInvoice.Disable_PurchaseInvoice==true) ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)"; } if(Search("SearchPurchaseInvoiceNext",tbNo.CValue)) { ChangeMode("View",#PurchaseInvoice.ID_Assessor); if(#PurchaseInvoice.Disable_PurchaseInvoice==true) ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)"; } if(Search("SearchPurchaseInvoiceLast")) { ChangeMode("View",#PurchaseInvoice.ID_Assessor); if(#PurchaseInvoice.Disable_PurchaseInvoice==true) ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)"; } ChangeMode("Search"); ChangeMode("Modify"); Delete(); ChangeMode("Search"); BeginBlank(); #PurchaseInvoice.Disable_PurchaseInvoice=true; Blank(); EndBlank(); ChangeMode("View",#PurchaseInvoice.ID_Assessor); if(#PurchaseInvoice.Disable_PurchaseInvoice==true) ikGradualLabel1.Text=ikGradualLabel1.Text+"(已作废)"; ShowPrintBox("BillSearch",#PurchaseInvoice.No_PurchaseInvoice,#PurchaseInvoice.No_PurchaseInvoice); BeginAudit(); #PurchaseInvoice.ID_Assessor=GetLoginUserID(); #PurchaseInvoice.Assessor=GetCurrentUser(); #PurchaseInvoice.AssessDate_PurchaseInvoice=DateTimeNow(); Audit(); ChangeMode("View",#PurchaseInvoice.ID_Assessor); EndAudit(); BeginUnAudit(); #PurchaseInvoice.ID_Assessor=DBNull(); #PurchaseInvoice.Assessor=DBNull(); #PurchaseInvoice.AssessDate_PurchaseInvoice=DataTimeNow(); UnAudit(); ChangeMode("View",#PurchaseInvoice.ID_Assessor); EndUnAudit(); ; ; ; if(Equals(#PurchaseInvoiceProduct.No_Product,"") || !Search("SearchProduct",#PurchaseInvoiceProduct.No_Product)) { if(!Equals(#PurchaseInvoiceProduct.No_Product,"")) MessageBox("该产品不存在!",@Title); #PurchaseInvoiceProduct.ID_Product=GuidEmpty(); #PurchaseInvoiceProduct.Name_Product=""; #PurchaseInvoiceProduct.Unit_Product=""; #PurchaseInvoiceProduct.UnitPrice_PurchaseInvoiceProduct=0.00; #PurchaseInvoiceProduct.InvoiceName_Product=""; @temp = ShowSearchBox("InputSearchProduct","INFOMATION",#PurchaseInvoiceProduct.No_Product); if(@temp != "") { ResumeColumnEvent("#PurchaseInvoiceProduct.No_Product"); #PurchaseInvoiceProduct.No_Product = @temp; ClearColumnEvent(); } } else { #PurchaseInvoiceProduct.ID_Product=#Product.ID_Product; #PurchaseInvoiceProduct.Name_Product=#Product.Name_Product; #PurchaseInvoiceProduct.Unit_Product=#Product.Unit_Product; #PurchaseInvoiceProduct.UnitPrice_PurchaseInvoiceProduct=#Product.Price_Product; #PurchaseInvoiceProduct.InvoiceName_Product=#Product.InvoiceName_Product; }
UpdateForm(true, "tbSupplierNo"); ActiveControlEvent("tbSupplierNo", "Enter");
Empty(); NewInstance(); tbNo.ReadOnly=false; dtDate.Enabled=false; cbType.Enabled=false; dtInvoiceDate.Enabled=false; txtInvoiceNo.ReadOnly=true; tbSupplierNo.ReadOnly=true; dtPayDate.Enabled=false; txtComment.ReadOnly=true; dgProduct.ReadOnly=true; txtMoneySum.CValue=0.00; txtTaxSum.CValue=0.00; txtSum.CValue=0.00; ckIncludeTax.Enabled=false; btnModify.Enabled=false; tbNo.Focus(); #PurchaseInvoice.Creator=DBNull(); #PurchaseInvoice.ID_Creator=DBNull(); #PurchaseInvoice.Assessor=DBNull(); #PurchaseInvoice.ID_Assessor=DBNull(); #PurchaseInvoice.AssessDate_PurchaseInvoice=DBNull(); #PurchaseInvoice.LastModUser_PurchaseInvoice=DBNull(); #PurchaseInvoice.LastModUser=DBNull(); #PurchaseInvoice.LastModDate_PurchaseInvoice=DBNull(); toolBar.EnableSubmit=false; toolBar.EnableModify=false; toolBar.EnableDelete=false; toolBar.EnableAudit=false; toolBar.EnableNew=GetRight(@Title,"新增"); toolBar.EnableImport = false; toolBar.EnablePrint=false; toolBar.EnableBlank=false; UpdateForm(true,""); tbNo.Focus(); cbType.Text=""; @Status=0; Empty(); NewInstance(); tbNo.ReadOnly=true; dtDate.Enabled=true; cbType.Enabled=true; ckIncludeTax.Enabled=true; dtInvoiceDate.Enabled=true; txtInvoiceNo.ReadOnly=false; tbSupplierNo.ReadOnly=false; dtPayDate.Enabled=true; txtComment.ReadOnly=false; dgProduct.ReadOnly=false; btnModify.Enabled=false; txtMoneySum.CValue=0.00; txtTaxSum.CValue=0.00; txtSum.CValue=0.00; dtDate.Focus(); #PurchaseInvoice.TypeName="增值税发票"; #PurchaseInvoice.ID_PurchaseInvoice=NewGuid(); #PurchaseInvoice.Creator=GetCurrentUser(); #PurchaseInvoice.ID_Creator=GetLoginUserID(); #PurchaseInvoice.Assessor=DBNull(); #PurchaseInvoice.ID_Assessor=DBNull(); #PurchaseInvoice.AssessDate_PurchaseInvoice=DBNull(); #PurchaseInvoice.LastModUser_PurchaseInvoice=DBNull(); #PurchaseInvoice.LastModUser=DBNull(); #PurchaseInvoice.LastModDate_PurchaseInvoice=DBNull(); toolBar.EnableSubmit=GetRight(@Title,"新增"); toolBar.EnableModify=false; toolBar.EnableDelete=false; toolBar.EnableAudit=false; toolBar.EnableNew=false; toolBar.EnablePrint=false; toolBar.EnableBlank=false; toolBar.EnableImport = true; UpdateForm(true,""); @Status=1; tbNo.ReadOnly=true; dtDate.Enabled=false; cbType.Enabled=false; ckIncludeTax.Enabled=false; dtInvoiceDate.Enabled=false; txtInvoiceNo.ReadOnly=true; tbSupplierNo.ReadOnly=true; txtComment.ReadOnly=true; dtPayDate.Enabled=false; dgProduct.ReadOnly=true; if(!Equals(#PurchaseInvoice.ID_Assessor,DBNull())&&#PurchaseInvoice.Disable_PurchaseInvoice==false) btnModify.Enabled=true; else btnModify.Enabled=false; toolBar.EnableSubmit=false; toolBar.EnableNew=GetRight(@Title,"新增"); if(Equals(#PurchaseInvoice.ID_Assessor, DBNull())) { toolBar.EnableAudit=GetRight(@Title,"审核"); toolBar.EnableModify=GetRight(@Title,"修改"); toolBar.EnableDelete=GetRight(@Title,"删除"); toolBar.EnableBlank=false; } else { toolBar.EnableAudit=false; toolBar.EnableModify=false; toolBar.EnableDelete=false; if(#PurchaseInvoice.Disable_PurchaseInvoice==false) toolBar.EnableBlank=GetRight(@Title,"审核"); else toolBar.EnableBlank=false; } toolBar.EnablePrint=GetRight(@Title,"打印"); toolBar.EnableImport = false; UpdateForm(true, ""); @Status=2; tbNo.ReadOnly=true; dtDate.Enabled=false; cbType.Enabled=true; ckIncludeTax.Enabled=true; dtInvoiceDate.Enabled=true; txtInvoiceNo.ReadOnly=false; tbSupplierNo.ReadOnly=false; dtPayDate.Enabled=true; txtComment.ReadOnly=false; btnModify.Enabled=false; dgProduct.ReadOnly=false; #PurchaseInvoice.LastModUser=GetCurrentUser(); #PurchaseInvoice.LastModUser_PurchaseInvoice=GetLoginUserID(); #PurchaseInvoice.LastModDate_PurchaseInvoice=GetCurrentTime(); toolBar.EnableSubmit=GetRight(@Title,"修改"); toolBar.EnableModify=false; toolBar.EnableDelete=false; toolBar.EnableAudit=false; toolBar.EnableNew=false; toolBar.EnablePrint=false; toolBar.EnableBlank=false; toolBar.EnableImport = true; UpdateForm(true, ""); @Status=3; if (!Equals(#PurchaseInvoiceProduct.Name_BillType,"")&&!Equals(#PurchaseInvoiceProduct.No_FromBill,"")&& !Equals(#PurchaseInvoiceProduct.No_FromBillProduct,"")) { if(Equals(#PurchaseInvoiceProduct.Name_BillType,"采购订单")&&Search("SearchPurchaseOrderBillProduct",#PurchaseInvoiceProduct.No_FromBill,#PurchaseInvoiceProduct.No_FromBillProduct)) { #PurchaseInvoiceProduct.ID_Product=#PurchaseOrderBillProduct.ID_Product; #PurchaseInvoiceProduct.No_Product=#PurchaseOrderBillProduct.No_Product; #PurchaseInvoiceProduct.Name_Product=#PurchaseOrderBillProduct.Name_Product; #PurchaseInvoiceProduct.Unit_Product=#PurchaseOrderBillProduct.Unit_Product; #PurchaseInvoiceProduct.Quantity_PurchaseInvoiceProduct=#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct; #PurchaseInvoiceProduct.UnitPrice_PurchaseInvoiceProduct=#PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct; #PurchaseInvoiceProduct.InvoiceName_Product=#PurchaseOrderBillProduct.InvoiceName_Product; #PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct=FormatNumber(#PurchaseInvoiceProduct.Quantity_PurchaseInvoiceProduct*#PurchaseInvoiceProduct.UnitPrice_PurchaseInvoiceProduct,@PriceDecimal); if(ckIncludeTax.Checked) { #PurchaseInvoiceProduct.TaxAmount_PurchaseInvoiceProduct=FormatNumber(#PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct*#PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct/(1+#PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct),@PriceDecimal); } else { #PurchaseInvoiceProduct.TaxAmount_PurchaseInvoiceProduct=FormatNumber(#PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct*#PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct,@PriceDecimal); } } if(Equals(#PurchaseInvoiceProduct.Name_BillType,"采购入库单")&&Search("SearchPurchaseInDepotBillProduct",#PurchaseInvoiceProduct.No_FromBill,#PurchaseInvoiceProduct.No_FromBillProduct)) { #PurchaseInvoiceProduct.ID_Product=#PurchaseInDepotBillProduct.ID_Product; #PurchaseInvoiceProduct.No_Product=#PurchaseInDepotBillProduct.No_Product; #PurchaseInvoiceProduct.Name_Product=#PurchaseInDepotBillProduct.Name_Product; #PurchaseInvoiceProduct.Unit_Product=#PurchaseInDepotBillProduct.Unit_Product; #PurchaseInvoiceProduct.Quantity_PurchaseInvoiceProduct=#PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct; #PurchaseInvoiceProduct.InvoiceName_Product=#PurchaseInDepotBillProduct.InvoiceName_Product; #PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct=FormatNumber(#PurchaseInvoiceProduct.Quantity_PurchaseInvoiceProduct*#PurchaseInvoiceProduct.UnitPrice_PurchaseInvoiceProduct,@PriceDecimal); if(ckIncludeTax.Checked) { #PurchaseInvoiceProduct.TaxAmount_PurchaseInvoiceProduct=FormatNumber(#PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct*#PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct/(1+#PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct),@PriceDecimal); } else { #PurchaseInvoiceProduct.TaxAmount_PurchaseInvoiceProduct=FormatNumber(#PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct*#PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct,@PriceDecimal); } } } #PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct=FormatNumber(#PurchaseInvoiceProduct.Quantity_PurchaseInvoiceProduct*#PurchaseInvoiceProduct.UnitPrice_PurchaseInvoiceProduct,@PriceDecimal); if(ckIncludeTax.Checked) { #PurchaseInvoiceProduct.TaxAmount_PurchaseInvoiceProduct=FormatNumber(#PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct*#PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct/(1+#PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct),@PriceDecimal); } else { #PurchaseInvoiceProduct.TaxAmount_PurchaseInvoiceProduct=FormatNumber(#PurchaseInvoiceProduct.Amount_PurchaseInvoiceProduct*#PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct,@PriceDecimal); }