private void Page_Load(object sender, System.EventArgs e) { if (Session["UserID"] == null) { Response.Redirect("../../close_win.aspx"); } baseUtil.keepAlive(this); if (Request["hd"] != null) { hdHideBack.Value = "1"; } Session.Remove("DuplicateInvoice_CN"); btnGeneratePDF.Visible = false; invoiceID = 0; if (Request.QueryString["InvoiceID"] != null) { invoiceID = System.Convert.ToInt32(Request.QueryString["InvoiceID"]); ViewState["INID"] = invoiceID.ToString(); ViewState["AInvoiceID"] = invoiceID; hdHideBack.Value = "1"; try { Session["StrVATAmt_CN"] = null; } catch { } } if (invoiceID == 0) { if (Session["InvoiceID"] != null) { invoiceID = (int)Session["InvoiceID"]; } } #region CODE FOR SHOWING ASSOCIATEINVOICE NO. ON WEBFORMS AND PDF if (Session["CreditNoteInvoiceNo"] != null) { lblInvoiceNo.Text = Convert.ToString(Session["CreditNoteInvoiceNo"]); } else if (ViewState["AInvoiceID"] != null) { lblInvoiceNo.Text = objInvoice.GetAssociatedInvoiceNo(Convert.ToInt32(ViewState["AInvoiceID"])); } #endregion if (invoiceID == 0) { //prepare invoice head recordset from XML if (System.IO.File.Exists(Session["XMLInvoiceHeadFile_CN"].ToString())) { DataSet ds = new DataSet(); ds.ReadXmlSchema(Session["XSDInvoiceHeadFile_CN"].ToString()); ds.ReadXml(Session["XMLInvoiceHeadFile_CN"].ToString()); rsInvoiceHead = new RecordSet(ds); } //prepare invoice detail recordset from XML if (System.IO.File.Exists(Session["XSDInvoiceDetailFile_CN"].ToString())) { DataSet ds = new DataSet(); ds.ReadXmlSchema(Session["XSDInvoiceDetailFile_CN"].ToString()); ds.ReadXml(Session["XMLInvoiceDetailFile_CN"].ToString()); rsInvoiceDetail = new RecordSet(ds); } if (!IsPostBack) { PopulateData(); } } else { PopulateData(invoiceID); } }
private void rptInvoice_DataInitialize(object sender, System.EventArgs eArgs) { RecordSet rsSupplier = Company.GetCompanyData(System.Convert.ToInt32(rsInvoiceHeader["SupplierCompanyID"])); RecordSet rsBuyer = Company.GetCompanyData(System.Convert.ToInt32(rsInvoiceHeader["BuyerCompanyID"])); Fields.Add("SupplierComapany"); Fields.Add("BuyerComapany"); Fields.Add("New_InvoiceName"); Fields.Add("CreditNoteID"); Fields.Add("InvoiceNo"); //Fields.Add("BranchID") ; Fields.Add("PaymentDueDate"); Fields.Add("DiscountPercent"); Fields.Add("CustomerAccNo"); Fields.Add("InvoiceDate"); Fields.Add("PaymentTerm"); Fields.Add("NetTotal"); Fields.Add("H_VATAmt"); Fields.Add("H_TotalAmt"); Fields.Add("InvoiceAddress"); Fields.Add("DeliveryAddress"); Fields.Add("SupplierAddress"); Fields.Add("SellerVATNo"); Fields.Add("New_InvoiceContact"); Fields.Add("New_OverallDiscountPercent"); Fields.Add("New_SettlementDays1"); Fields.Add("New_SettlementDays2"); Fields.Add("New_SettlementPercent2"); // Fields.Add("New_PaymentDate"); Fields.Add("New_PaymentMethod"); Fields.Add("New_DiscountGiven"); //invoice detail fields Fields.Add("PurOrderNo"); Fields.Add("PurOrderLineNo"); Fields.Add("PurOrderDate"); Fields.Add("PurInfo"); Fields.Add("Quantity"); Fields.Add("Description"); Fields.Add("UOM"); Fields.Add("VATRate"); Fields.Add("Discount"); Fields.Add("Rate"); Fields.Add("BuyersProdCode"); Fields.Add("SuppliersProdCode"); Fields.Add("New_DespatchNoteNumber"); Fields.Add("New_DespatchDate"); Fields.Add("New_DiscountPercent2"); Fields.Add("New_NettValue"); Fields.Add("VATAmt"); Fields.Add("TotalAmt"); Fields.Add("New_Type"); Fields.Add("New_Definable1"); Fields["CreditNoteID"].Value = rsInvoiceHeader["CreditNoteID"]; Fields["InvoiceNo"].Value = rsInvoiceHeader["InvoiceNo"]; //Fields["BranchID"].Value = rsInvoiceHeader["BranchID"] ; Fields["PaymentDueDate"].Value = rsInvoiceHeader["PaymentDueDate"]; Fields["DiscountPercent"].Value = rsInvoiceHeader["DiscountPercent"]; Fields["New_SettlementPercent2"].Value = rsInvoiceHeader["New_SettlementPercent2"]; Fields["CustomerAccNo"].Value = rsInvoiceHeader["CustomerAccNo"]; Fields["New_InvoiceContact"].Value = rsInvoiceHeader["New_InvoiceContact"]; Fields["New_OverallDiscountPercent"].Value = rsInvoiceHeader["New_OverallDiscountPercent"]; Fields["New_SettlementDays1"].Value = rsInvoiceHeader["New_SettlementDays1"]; Fields["New_SettlementDays2"].Value = rsInvoiceHeader["New_SettlementDays2"]; Fields["InvoiceDate"].Value = rsInvoiceHeader["InvoiceDate"]; Fields["PaymentTerm"].Value = rsInvoiceHeader["PaymentTerm"]; Fields["NetTotal"].Value = rsInvoiceHeader["NetTotal"]; Fields["H_VATAmt"].Value = rsInvoiceHeader["VATAmt"]; Fields["H_TotalAmt"].Value = rsInvoiceHeader["TotalAmt"]; Fields["SupplierComapany"].Value = rsSupplier["CompanyName"]; Fields["BuyerComapany"].Value = rsBuyer["CompanyName"]; rsSupplier = null; rsBuyer = null; Fields["New_InvoiceName"].Value = rsInvoiceHeader["New_InvoiceName"]; JKS.Invoice objInvoice = new JKS.Invoice(); Invoice_CN objInvoice_CN = new Invoice_CN(); if (rsInvoiceHeader["CurrencyTypeID"] != DBNull.Value) { TextBox9.Text = objInvoice.GetCurrencyCode(Convert.ToInt32(rsInvoiceHeader["CurrencyTypeID"])); } Double dGBPEquivalentAmount = 0; dGBPEquivalentAmount = objInvoice_CN.GetGBPEquivalentAmount(Convert.ToInt32(rsInvoiceHeader["CreditNoteID"])); if (dGBPEquivalentAmount > 0) { lblGBPEquivalentAmount.Visible = true; tblGBPEquivalentAmount.Text = dGBPEquivalentAmount.ToString(); } if (rsInvoiceHeader["CreditNoteID"] != DBNull.Value) { txtAssociatedInvoiceNo.Text = objInvoice_CN.GetAssociatedInvoiceNo(Convert.ToInt32(rsInvoiceHeader["CreditNoteID"])); } string s = GetAddressLine(rsInvoiceHeader["DeliveryAddress1"].ToString()); s += GetAddressLine(rsInvoiceHeader["DeliveryAddress2"].ToString()); s += GetAddressLine(rsInvoiceHeader["DeliveryAddress3"].ToString()); s += GetAddressLine(rsInvoiceHeader["DeliveryAddress4"].ToString()); s += GetAddressLine(rsInvoiceHeader["DeliveryAddress5"].ToString()); s += GetAddressLine(rsInvoiceHeader["DeliveryCountry"].ToString()); s += GetAddressLine(rsInvoiceHeader["DeliveryZIP"].ToString()); Fields["DeliveryAddress"].Value = s; s = GetAddressLine(rsInvoiceHeader["InvoiceAddress1"].ToString()); s += GetAddressLine(rsInvoiceHeader["InvoiceAddress2"].ToString()); s += GetAddressLine(rsInvoiceHeader["InvoiceAddress3"].ToString()); s += GetAddressLine(rsInvoiceHeader["InvoiceAddress4"].ToString()); s += GetAddressLine(rsInvoiceHeader["InvoiceAddress5"].ToString()); s += GetAddressLine(rsInvoiceHeader["InvoiceCountry"].ToString()); s += GetAddressLine(rsInvoiceHeader["InvoiceZIP"].ToString()); Fields["InvoiceAddress"].Value = s; s = GetAddressLine(rsInvoiceHeader["SupplierAddress1"].ToString()); s += GetAddressLine(rsInvoiceHeader["SupplierAddress2"].ToString()); s += GetAddressLine(rsInvoiceHeader["SupplierAddress3"].ToString()); s += GetAddressLine(rsInvoiceHeader["SupplierAddress4"].ToString()); s += GetAddressLine(rsInvoiceHeader["SupplierAddress5"].ToString()); s += GetAddressLine(rsInvoiceHeader["SupplierCountry"].ToString()); s += GetAddressLine(rsInvoiceHeader["SupplierZIP"].ToString()); Fields["SupplierAddress"].Value = s; Fields["SellerVATNo"].Value = rsInvoiceHeader["SellerVATNo"]; }