Beispiel #1
0
        public void PopulateData()
        {
            int iCurrencyTypeID = 0;

            Invoice.Invoice objInvoice = new Invoice.Invoice();
            Company         objCompany = new Company();

            grdInvoiceDetails.DataSource = rsInvoiceDetail.ParentTable;
            grdInvoiceDetails.DataBind();

            if (rsInvoiceHead["InvoiceNo"] != DBNull.Value)
            {
                strInvoiceNo = rsInvoiceHead["InvoiceNo"].ToString().Trim();
            }

            if (rsInvoiceHead["InvoiceDate"] != DBNull.Value)
            {
                strInvoiceDate = Convert.ToDateTime(rsInvoiceHead["InvoiceDate"]).ToString("dd/MM/yyyy");
            }

            if (rsInvoiceHead["SellerVATNo"] != DBNull.Value)
            {
                strSellerVatRegNo = rsInvoiceHead["SellerVATNo"].ToString().Trim();
            }

            if (rsInvoiceHead["New_TaxCountryNumber"] != DBNull.Value)
            {
                strCountryTaxNo = rsInvoiceHead["New_TaxCountryNumber"].ToString().Trim();
            }

            strTradersReference = objCompany.GetTradersReference(Convert.ToInt32(rsInvoiceHead["SupplierCompanyID"]));

            if (rsInvoiceHead["CurrencyTypeID"] != DBNull.Value)
            {
                iCurrencyTypeID = Convert.ToInt32(rsInvoiceHead["CurrencyTypeID"]);
                strCurrency     = objInvoice.GetCurrencyName(Convert.ToInt32(rsInvoiceHead["CurrencyTypeID"]));
            }

            #region Manipulating VAT IN GBP amount
            if (Session["StrVATAmt_CN"] != null)
            {
                if (Utility.IsNumeric(Session["StrVATAmt_CN"].ToString().Trim()))
                {
                    strVatInGBP = Convert.ToString(Math.Round(Convert.ToDouble(Session["StrVATAmt_CN"].ToString().Trim()), 2));
                }
            }
            else
            {
                Invoice.Invoice oInvoice             = new Invoice.Invoice();
                Double          dGBPEquivalentAmount = 0;
                dGBPEquivalentAmount = oInvoice.GetGBPEquivalentAmount(invoiceID);

                if (dGBPEquivalentAmount != 0)
                {
                    strVatInGBP = dGBPEquivalentAmount.ToString();
                    if (Utility.IsNumeric(strVatInGBP))
                    {
                        strVatInGBP = Convert.ToString(Math.Round(Convert.ToDouble(strVatInGBP), 2));
                    }
                }
                oInvoice = null;
            }
            #endregion
        }