protected void txtAmount_TextChanged(object sender, EventArgs e)
    {
        lblTotalAvailable.Text = "0";
        decimal CurrentReceiptAmount = txtAmount.Text != "" ? Convert.ToDecimal(txtAmount.Text) : 0;

        lblTotalAvailable.Text = _objBOUtiltiy.FormatTwoDecimal((Convert.ToDecimal(lblPrvClientOpenAmount.Text) + CurrentReceiptAmount).ToString());

        lblReceiptOpenAmount.Text = (Convert.ToDecimal(lblTotalAvailable.Text) - Convert.ToDecimal(lblAllocatedAmount.Text)).ToString();
    }
    protected void txtAmount_TextChanged(object sender, EventArgs e)
    {
        lblTotalAvailable.Text = "0";
        decimal CurrentReceiptAmount = txtAmount.Text != "" ? Convert.ToDecimal(txtAmount.Text) : 0;

        lblTotalAvailable.Text = _objBOUtiltiy.FormatTwoDecimal((Convert.ToDecimal(lblPrvClientOpenAmount.Text) + CurrentReceiptAmount).ToString());

        lblReceiptOpenAmount.Text = (Convert.ToDecimal(lblTotalAvailable.Text) - Convert.ToDecimal(lblAllocatedAmount.Text)).ToString();

        if (txtAmount.Text != "" || txtAmount.Text != null)
        {
            ddlAccountNo_SelectedIndexChanged(null, null);
            ChkAllocate_CheckedChanged(null, null);
        }
    }
示例#3
0
    private void UnBankedReciptsCount()
    {
        decimal?  sum = 0.0M;
        DataTable dt  = (DataTable)ViewState["RightGridTotalRecords"];

        if (dt != null)
        {
            sum = dt.AsEnumerable().Sum(row => row.Field <decimal>("AllocatedAmount"));
            unBankAmount.InnerText = _objBOUtiltiy.FormatTwoDecimal(sum.ToString());
            unBankCount.InnerText  = dt.Rows.Count.ToString();
        }
        else
        {
            unBankAmount.InnerText = _objBOUtiltiy.FormatTwoDecimal(sum.ToString());
            unBankCount.InnerText  = "0";
        }
    }
示例#4
0
    private void IncomeReport()
    {
        try
        {
            StringBuilder htmlTable = new StringBuilder();
            int           Income = 0; int Expenses = 0;
            decimal       TotalIncome   = 0;
            decimal       TotalExpenses = 0;
            decimal       NetIncome     = 0;
            decimal       IncomeTax     = 0;
            decimal       IncAfterTax   = 0;

            decimal endofperiod    = 0;
            decimal getTotalincome = 0;
            decimal getTotalExpe   = 0;

            int comapnyId = 0;

            if (!string.IsNullOrEmpty(Session["UserCompanyId"].ToString()))
            {
                comapnyId = Convert.ToInt32(Session["UserCompanyId"].ToString());
            }



            DataSet objds = objBaReport.GetIncomeLevelData(comapnyId);



            htmlTable.Append("<table style='height:50%;width:100%'>");

            if (objds.Tables[1].Rows.Count > 0)
            {
                foreach (DataRow dtlRow in objds.Tables[1].Rows)
                {
                    if (getTotalincome == 0)
                    {
                        foreach (DataRow dtlRrow in objds.Tables[1].Rows)
                        {
                            TotalIncome = Convert.ToDecimal(dtlRrow["Amount"].ToString()) + TotalIncome;
                        }

                        getTotalincome = 1;
                    }

                    if (Income == 0)
                    {
                        htmlTable.Append("<tr style='background-color:#f5f5f5;'>");
                        htmlTable.Append("<td colspan='6' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Income</td>");
                        htmlTable.Append("<td style='border: 1px ridge black; font-weight:bold;padding:1px;text-align:right;color:blue;'>" + _BOUtilities.FormatTwoDecimal(TotalIncome.ToString()) + "</td>");
                        htmlTable.Append("</tr>");
                    }


                    if (TotalIncome != 0)
                    {
                        /*Put a for loop here and repeat the below code*/

                        htmlTable.Append("<tr>");
                        htmlTable.Append("<td colspan='6' style='border: 1px ridge black; font-weight:bold;padding:0px;width:80%'>" + dtlRow["MainAccount"] + "</td>");
                        htmlTable.Append("<td style='border: 1px ridge black; font-weight:bold;padding:1px;text-align:right;'>" + _BOUtilities.FormatTwoDecimal(dtlRow["Amount"].ToString()) + "</td>");



                        Income = 1;
                    }
                }
            }
            else
            {
                htmlTable.Append("<tr style='background-color:#f5f5f5;'>");
                htmlTable.Append("<td colspan='6' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Income</td>");
                htmlTable.Append("<td style='border: 1px ridge black; font-weight:bold;padding:1px;text-align:right;color:blue;'>" + _BOUtilities.FormatTwoDecimal(TotalIncome.ToString()) + "</td>");
                htmlTable.Append("</tr>");
            }
            if (objds.Tables[2].Rows.Count > 0)
            {
                foreach (DataRow dtlRow in objds.Tables[2].Rows)
                {
                    if (getTotalExpe == 0)
                    {
                        foreach (DataRow dtlRrow in objds.Tables[2].Rows)
                        {
                            TotalExpenses = Convert.ToDecimal(dtlRrow["Amount"].ToString()) + TotalExpenses;
                        }
                        getTotalExpe = 1;
                    }



                    if (Expenses == 0)
                    {
                        htmlTable.Append("<tr style='background-color:#f5f5f5;'>");
                        htmlTable.Append("<td colspan='6' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Expenses</td>");
                        htmlTable.Append("<td style='border: 1px ridge black; font-weight:bold;padding:1px;text-align:right;color:blue;'>" + _BOUtilities.FormatTwoDecimal(TotalExpenses.ToString()) + "</td>");
                        htmlTable.Append("</tr>");
                    }

                    htmlTable.Append("<tr >");
                    htmlTable.Append("<td colspan='6' style='border: 1px ridge black; font-weight:bold;padding:1px;width:80%'>" + dtlRow["MainAcName"] + "</td>");
                    htmlTable.Append("<td style='border: 1px ridge black; font-weight:bold;padding:1px;text-align:right'>" + _BOUtilities.FormatTwoDecimal(dtlRow["Amount"].ToString()) + "</td>");



                    Expenses = 1;
                }
            }
            else
            {
                htmlTable.Append("<tr style='background-color:#f5f5f5;'>");
                htmlTable.Append("<td colspan='6' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Expenses</td>");
                htmlTable.Append("<td style='border: 1px ridge black; font-weight:bold;padding:1px;text-align:right;color:blue;'>" + _BOUtilities.FormatTwoDecimal(TotalExpenses.ToString()) + "</td>");
                htmlTable.Append("</tr>");
            }

            int     getTotalSusepenseamount = 0;
            decimal TotalSusAmount          = 0;

            if (objds.Tables[4].Rows.Count > 0)
            {
                foreach (DataRow dtlRow in objds.Tables[4].Rows)
                {
                    if (getTotalSusepenseamount == 0)
                    {
                        foreach (DataRow dtlRrow in objds.Tables[4].Rows)
                        {
                            TotalSusAmount = Convert.ToDecimal(dtlRrow["Amount"].ToString()) + TotalSusAmount;
                        }
                        getTotalSusepenseamount = 1;
                    }



                    //if (Expenses == 0)
                    //{
                    htmlTable.Append("<tr style='background-color:#f5f5f5;'>");
                    htmlTable.Append("<td colspan='6' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Others</td>");
                    htmlTable.Append("<td style='border: 1px ridge black; font-weight:bold;padding:1px;text-align:right;color:blue;'>" + _BOUtilities.FormatTwoDecimal(TotalSusAmount.ToString()) + "</td>");
                    htmlTable.Append("</tr>");
                    // }

                    htmlTable.Append("<tr >");
                    htmlTable.Append("<td colspan='6' style='border: 1px ridge black; font-weight:bold;padding:1px;width:80%'>" + dtlRow["MainAcName"] + "</td>");
                    htmlTable.Append("<td style='border: 1px ridge black; font-weight:bold;padding:1px;text-align:right'>" + _BOUtilities.FormatTwoDecimal(dtlRow["Amount"].ToString()) + "</td>");



                    //  Expenses = 1;
                }
            }



            NetIncome = TotalIncome - TotalExpenses;


            bool NetIncpositive = NetIncome >= 0;
            bool NetInnegative  = NetIncome <= 0;

            IncAfterTax = NetIncome - IncomeTax;

            bool positive = IncAfterTax >= 0;
            bool negative = IncAfterTax <= 0;



            IncAfterTax = Math.Abs(IncAfterTax);



            htmlTable.Append("<tr>");
            htmlTable.Append("<td colspan='6' style='border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Net income before tax for the period</td>");
            if (NetIncpositive == true)
            {
                htmlTable.Append("<td style='border: 1px ridge black; font-weight:bold;padding:1px;text-align:right;color:blue;'>" + _BOUtilities.FormatTwoDecimal(NetIncome.ToString()) + "</td>");
            }
            else
            {
                htmlTable.Append("<td style='border: 1px ridge black; font-weight:bold;padding:1px;text-align:right'>(" + _BOUtilities.FormatTwoDecimal(Math.Abs(NetIncome).ToString()) + ")</td>");
            }
            htmlTable.Append("</tr>");

            //htmlTable.Append("<tr>");
            //htmlTable.Append("<td colspan='6' style='border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Income tax</td>");
            //htmlTable.Append("<td style='border: 1px ridge black; font-weight:bold;padding:1px;text-align:right'>" + _BOUtilities.FormateNumberWithComma(IncomeTax) + "</td>");
            //htmlTable.Append("</tr>");

            int     incomedata       = 0;
            decimal TotalIncomeTaxes = 0;
            int     incomes          = 0;

            if (objds.Tables[3].Rows.Count > 0)
            {
                foreach (DataRow dtlRow in objds.Tables[3].Rows)
                {
                    if (incomedata == 0)
                    {
                        foreach (DataRow dtlRrow in objds.Tables[3].Rows)
                        {
                            TotalIncomeTaxes = Convert.ToDecimal(dtlRrow["Amount"].ToString()) + TotalIncomeTaxes;
                        }
                        incomedata = 1;
                    }



                    if (incomes == 0)
                    {
                        htmlTable.Append("<tr style='background-color:#f5f5f5;'>");
                        htmlTable.Append("<td colspan='6' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Income tax</td>");
                        htmlTable.Append("<td style='border: 1px ridge black; font-weight:bold;padding:1px;text-align:right;color:blue;'>" + _BOUtilities.FormatTwoDecimal(TotalIncomeTaxes.ToString()) + "</td>");
                        htmlTable.Append("</tr>");
                    }

                    htmlTable.Append("<tr >");
                    htmlTable.Append("<td colspan='6' style='border: 1px ridge black; font-weight:bold;padding:1px;width:80%'>" + dtlRow["MainAcName"] + "</td>");
                    htmlTable.Append("<td style='border: 1px ridge black; font-weight:bold;padding:1px;text-align:right'>" + _BOUtilities.FormatTwoDecimal(dtlRow["Amount"].ToString()) + "</td>");



                    incomes = 1;
                }
            }

            decimal Nettincomeloss = NetIncome - TotalIncomeTaxes;

            bool Nettincomelosspostive  = Nettincomeloss >= 0;
            bool Nettincomelossnegative = Nettincomeloss <= 0;


            decimal Nettincomelossafter = Math.Abs(Nettincomeloss);

            htmlTable.Append("<tr>");
            htmlTable.Append("<td colspan='6' style='border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Nett income (loss) after tax</td>");

            if (positive == true)
            {
                htmlTable.Append("<td style='border: 1px ridge black; font-weight:bold;padding:1px;text-align:right;color:blue;'>" + _BOUtilities.FormatTwoDecimal(Nettincomelossafter.ToString()) + "</td>");
            }
            else
            {
                htmlTable.Append("<td style='border: 1px ridge black; font-weight:bold;padding:1px;text-align:right'>(" + _BOUtilities.FormatTwoDecimal(Nettincomelossafter.ToString()) + ") </td>");
            }
            htmlTable.Append("</tr>");

            endofperiod = Nettincomeloss;

            bool endofperiodpostive  = endofperiod >= 0;
            bool endofperiodnegative = endofperiod <= 0;

            endofperiod = Math.Abs(endofperiod);

            //htmlTable.Append("<tr>");
            //htmlTable.Append("<td colspan='6' style='border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Retained income at begin of period</td>");
            //htmlTable.Append("<td style='border: 1px ridge black; font-weight:bold;padding:1px;text-align:right'>" + _BOUtilities.FormateNumberWithComma(beginperiod) + "</td>");
            //htmlTable.Append("</tr>");



            htmlTable.Append("<tr>");
            htmlTable.Append("<td colspan='6' style='border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Retained income at end of period</td>");

            if (endofperiodpostive == true)
            {
                htmlTable.Append("<td style='border: 1px ridge black; font-weight:bold;padding:1px;text-align:right;color:blue;'>" + _BOUtilities.FormatTwoDecimal(endofperiod.ToString()) + "</td>");
            }
            else
            {
                htmlTable.Append("<td style='border: 1px ridge black; font-weight:bold;padding:1px;text-align:right'>(" + _BOUtilities.FormatTwoDecimal(endofperiod.ToString()) + ")</td>");
            }
            htmlTable.Append("</tr>");



            // htmlTable.AppendLine("</table>");



            htmlTable.AppendLine("</table>");
            ltrlctrl1.Text = htmlTable.ToString();
        }
        catch (Exception ex)
        {
            ExceptionLogging.SendExcepToDB(ex);
        }
    }
示例#5
0
    //protected void btnPrint_Click(object sender, EventArgs e)
    //{
    //    //StringWriter sw = new StringWriter();
    //    //HtmlTextWriter hw = new HtmlTextWriter(sw);
    //    //StringBuilder sb = new StringBuilder();
    //    //sb.Append("<script type = 'text/javascript'>");
    //    //sb.Append("window.onload = new function(){");
    //    //sb.Append("var divToPrint=document.getElementById('print');");
    //    //sb.Append("var printWin = window.open('', '', 'left=0");
    //    //sb.Append(",top=0,width=800,height=600,status=0');");

    //    //sb.Append("printWin.document.write(divToPrint.outerHTML);");
    //    //sb.Append("printWin.document.close();");
    //    //sb.Append("printWin.focus();");
    //    //sb.Append("printWin.print();}");
    //    //sb.Append("</script>");
    //    //ClientScript.RegisterStartupScript(this.GetType(), "GridPrint", sb.ToString());
    //}


    protected void txtAmount_TextChanged(object sender, EventArgs e)
    {
        try
        {
            if (Convert.ToDecimal(lblSuppOpenAmt.Text) == Convert.ToDecimal(txtAmount.Text))
            {
                lblTotalAvailable.Text    = "0.00";
                lblReceiptOpenAmount.Text = "0.00";
                lblAllocatedAmount.Text   = "0.00";
                lblTotalAvailable.Text    = "0.00";

                lblAllocated.Text = "Allocated(" + 0 + ")";
                //   chkSelect.Checked = false;

                decimal CurrentReceiptAmount = lblSuppOpenAmt.Text != "" ? Convert.ToDecimal(lblSuppOpenAmt.Text) : 0;
                lblTotalAvailable.Text = _objBOUtiltiy.FormatTwoDecimal(CurrentReceiptAmount.ToString());

                lblReceiptOpenAmount.Text = _objBOUtiltiy.FormatTwoDecimal((Convert.ToDecimal(lblTotalAvailable.Text) - Convert.ToDecimal(lblAllocatedAmount.Text)).ToString().ToString());

                if (ddlAccountNo.SelectedValue != "0")
                {
                    ddlAccountNo_SelectedIndexChanged(null, null);
                }



                foreach (GridViewRow row in gvCustomers.Rows)
                {
                    if (row.RowType == DataControlRowType.DataRow)
                    {
                        TextBox txtThisEntry = row.FindControl("txtThisEntry") as TextBox;

                        txtThisEntry.Text = txtAmount.Text;


                        lblTotalAvailable.Text = txtThisEntry.Text;


                        decimal InvoiceOpenAmount = 0;
                        decimal ThisEntryAmount   = 0;

                        if (txtThisEntry.Text != "" && txtThisEntry.Text != "0" && txtThisEntry.Text != "0.00")
                        {
                            ThisEntryAmount   = Convert.ToDecimal(txtThisEntry.Text);
                            InvoiceOpenAmount = Convert.ToDecimal(row.Cells[4].Text);
                            row.Cells[7].Text = _objBOUtiltiy.FormatTwoDecimal((InvoiceOpenAmount - ThisEntryAmount).ToString());
                        }
                    }
                }


                // ddlAccType_SelectedIndexChanged(null, null);

                //int Id = Convert.ToInt32(ddlAccType.SelectedValue.ToString());
                //string name = ddlAccType.SelectedItem.Text;

                //DataSet objDsInvLst = _objBALTransactions.PaymentTransaction_GetDataBycategory(Id, name);
                //if (objDsInvLst.Tables[0].Rows.Count > 0)
                //{
                //    decimal  paiedAmount = Convert.ToDecimal(objDsInvLst.Tables[1].Rows[0]["SupplPaiedAmount"].ToString());

                //}
            }
            else
            {
                foreach (GridViewRow row in gvCustomers.Rows)
                {
                    if (row.RowType == DataControlRowType.DataRow)
                    {
                        TextBox txtThisEntry = row.FindControl("txtThisEntry") as TextBox;

                        txtThisEntry.Text      = "";
                        lblTotalAvailable.Text = txtThisEntry.Text;
                    }
                }

                ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(),
                                                        "Msg", "alert('Please Allocate Current Amount');", true);
            }
        }
        catch (Exception ex)
        {
            ExceptionLogging.SendExcepToDB(ex);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Session["loginId"] == null)
            {
                Response.Redirect("../SalesLogin.aspx");
                return;
            }
            strCurrencyCode = _objBOUtiltiy.Currencycode();
            if (!IsPostBack)
            {
                string strInvocieId = "0";;

                if (!string.IsNullOrEmpty(Request.QueryString["FileNo"]))
                {
                    strInvocieId = Request.QueryString["FileNo"];
                }

                string strMessage = UKZNCreateInvoice(strInvocieId);
                if (strMessage != "Success")
                {
                    lblMsg.Text = _objBOUtiltiy.ShowMessage("danger", "Info ", strMessage);
                    return;
                }
                DataSet      objDs    = _objBAinvoice.GetInvoiceDetails(strInvocieId);
                StreamReader reader   = new StreamReader(Server.MapPath("~/HtmlTemps/InvoicePdf.html"));
                string       readFile = reader.ReadToEnd();
                reader.Close();

                StringBuilder sbMainrow = new StringBuilder();

                int Flight = 0;
                int Land   = 0;
                int car    = 0;


                if (objDs.Tables.Count > 0)
                {
                    #region Company Deatils
                    if (objDs.Tables[5].Rows.Count > 0)
                    {
                        string strimgLogo = _objBOUtiltiy.LogoUrl(objDs.Tables[5].Rows[0]["communicationlogo"].ToString());
                        readFile = readFile.Replace("{CompanyName}", objDs.Tables[5].Rows[0]["CompanyName"].ToString());
                        readFile = readFile.Replace("{address}", objDs.Tables[5].Rows[0]["CompanyAddress"].ToString());
                        readFile = readFile.Replace("{Image}", "<img   src='" + strimgLogo + "'></img>");
                        readFile = readFile.Replace("{Image3}", " ");

                        readFile = readFile.Replace("{Invoice_No}", objDs.Tables[5].Rows[0]["FileNo"].ToString());
                        readFile = readFile.Replace("{Date}", DateTime.Now.ToString("D"));
                        readFile = readFile.Replace("{Consultant}", objDs.Tables[5].Rows[0]["UserName"].ToString());
                        readFile = readFile.Replace("{Client1}", objDs.Tables[5].Rows[0]["TravellerFullName"].ToString());
                        readFile = readFile.Replace("{Client}", objDs.Tables[5].Rows[0]["TravellerFullName"].ToString());
                        readFile = readFile.Replace("{Currency}", strCurrencyCode);
                        readFile = readFile.Replace("{ClientAddress}", objDs.Tables[5].Rows[0]["TravellerAddress"].ToString() != "" ? objDs.Tables[5].Rows[0]["TravellerAddress"].ToString() : "Durban");
                    }
                    else
                    {
                        readFile = readFile.Replace("{CompanyName}", " ");
                        readFile = readFile.Replace("{address}", " ");
                        readFile = readFile.Replace("{Country}", " ");
                        readFile = readFile.Replace("{State}", " ");
                        readFile = readFile.Replace("{City}", " ");
                        readFile = readFile.Replace("{Image}", " ");
                        readFile = readFile.Replace("{Image3}", " ");
                        readFile = readFile.Replace("{ClientAddress}", "");
                    }

                    #endregion

                    decimal LandClientTotal          = 0;
                    decimal CarLandClientTotal       = 0;
                    decimal FlihgtClientTotal        = 0;
                    decimal ServiceFeeClientTotal    = 0;
                    decimal GeneralChargeClienttotal = 0;
                    decimal FlightServiceFeeTotal    = 0;
                    decimal HotelServiceFeeTotal     = 0;


                    decimal FlightExclAmt        = 0;
                    decimal LandExclAmt          = 0;
                    decimal CarLandExclAmt       = 0;
                    decimal ServiceFeeExclAmt    = 0;
                    decimal GeneralChargeExclAmt = 0;

                    decimal FlightVat        = 0;
                    decimal LandVat          = 0;
                    decimal CarLandVat       = 0;
                    decimal ServiceFeeVat    = 0;
                    decimal GeneralChargeVat = 0;
                    decimal AirportTaxes     = 0;

                    #region AirTicket
                    if (objDs.Tables[0].Rows.Count > 0)
                    {
                        foreach (DataRow dtlRow in objDs.Tables[0].Rows)
                        {
                            decimal FlightServiceFee = 0;
                            if (Flight == 0)
                            {
                                if (objDs.Tables[1].Rows.Count > 0)
                                {
                                    FlightServiceFee      = Convert.ToDecimal(objDs.Tables[1].Rows[0]["ChargeServiceFee"]);
                                    FlightServiceFeeTotal = FlightServiceFeeTotal + FlightServiceFee;
                                }

                                sbMainrow.Append("<tr>");
                                sbMainrow.Append("<td colspan='7' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Air Tickets</td>");
                                sbMainrow.Append("</tr>");

                                sbMainrow.Append("<tr>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Prn</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Ticket No</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Passenger/Dep Date/Route/Class</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Excl Amt</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'> Airport Taxes</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>VAT</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Incl Amt</td>");
                                sbMainrow.Append("</tr>");
                            }
                            FlihgtClientTotal = FlihgtClientTotal + Convert.ToDecimal(dtlRow["TotalPrice"]);

                            string strFlightExclAmt = "0.00";
                            if (Convert.ToDecimal(dtlRow["EquivalentBasePrice"]) != 0)
                            {
                                strFlightExclAmt = (Convert.ToDecimal(dtlRow["EquivalentBasePrice"]) + FlightServiceFee).ToString();
                                FlightExclAmt    = FlightExclAmt + Convert.ToDecimal(strFlightExclAmt);
                            }
                            else
                            {
                                FlightExclAmt    = FlightExclAmt + Convert.ToDecimal(dtlRow["BasePrice"]) + FlightServiceFee;
                                strFlightExclAmt = (Convert.ToDecimal(dtlRow["BasePrice"]) + FlightServiceFee).ToString();
                            }
                            FlightVat    = FlightVat + 0;// Vat
                            AirportTaxes = AirportTaxes + Convert.ToDecimal(dtlRow["Taxes"]);
                            string TotalPrice = (Convert.ToDecimal(dtlRow["TotalPrice"]) + FlightServiceFee).ToString();
                            sbMainrow.Append("<tr>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["ProviderLocatorCode"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["TicketNumber"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'/>" + dtlRow["FirstName"] + " " + dtlRow["Concats"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + strFlightExclAmt + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["Taxes"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>0</td>");// Var Fee
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + TotalPrice + "</td>");
                            sbMainrow.Append("</tr>");
                            Flight = 1;
                        }
                        sbMainrow.Append("<tr>");
                        sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>Air Tickets Total</td>");
                        sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right;'></td>");
                        sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right;'>" + (FlightExclAmt) + "</td>");
                        sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right;'>" + AirportTaxes + "</td>");
                        sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right;'>0</td>");
                        sbMainrow.Append("<td  style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + (FlihgtClientTotal + FlightServiceFeeTotal) + "</td></tr>");
                    }
                    #endregion AirTicket

                    #region LandArrangement
                    if (objDs.Tables[2].Rows.Count > 0)
                    {
                        decimal LandDtlTotal = 0;
                        foreach (DataRow dtlRow in objDs.Tables[2].Rows)
                        {
                            decimal HotelServiceFee = 0;
                            if (Land == 0)
                            {
                                if (objDs.Tables[1].Rows.Count > 0)
                                {
                                    HotelServiceFee      = Convert.ToDecimal(objDs.Tables[3].Rows[0]["ChargeServiceFee"]);
                                    HotelServiceFeeTotal = HotelServiceFeeTotal + HotelServiceFee;
                                }
                                sbMainrow.Append("<tr>");
                                sbMainrow.Append("<td colspan='7' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Land Arrangement</td>");
                                sbMainrow.Append("</tr>");


                                sbMainrow.Append("<tr>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Type</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Ser RefNo</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Details</td>");
                                sbMainrow.Append("<td   style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Excl Amt</td>");
                                sbMainrow.Append("<td   style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Taxes</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>VAT</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Incl Amt</td>");
                                sbMainrow.Append("</tr>");
                            }
                            LandClientTotal = LandClientTotal + Convert.ToDecimal(dtlRow["TotalPrice"]);
                            LandExclAmt     = LandExclAmt + Convert.ToDecimal(dtlRow["TotalPrice"]);
                            LandVat         = LandVat + 0;
                            LandDtlTotal    = Convert.ToDecimal(dtlRow["TotalPrice"]) + HotelServiceFee;

                            sbMainrow.Append("<tr>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["SupplierReference"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["BookingRefNo"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["Details"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + LandDtlTotal + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>0</td>");  // Hotel Taxes
                            sbMainrow.Append("<td  style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>0</td>"); // Vat
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + LandDtlTotal + "</td>");
                            sbMainrow.Append("</tr>");
                            Land = 1;
                        }
                        sbMainrow.Append("<tr>");
                        sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>Land Total</td>");
                        sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        sbMainrow.Append("<td  style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right;'>" + LandExclAmt + "</td>");
                        sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;;text-align:right'>0</td>");
                        sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right;'>0</td>");
                        sbMainrow.Append("<td  style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right;'>" + (LandClientTotal + HotelServiceFeeTotal) + "</td></tr>");
                    }
                    #endregion LandArrangement


                    #region CarLandArrangement
                    if (objDs.Tables[6].Rows.Count > 0)
                    {
                        decimal CarLandDtlTotal = 0;
                        foreach (DataRow dtlRow in objDs.Tables[6].Rows)
                        {
                            if (car == 0)
                            {
                                sbMainrow.Append("<tr>");
                                sbMainrow.Append("<td colspan='7' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Car Arrangement</td>");
                                sbMainrow.Append("</tr>");


                                sbMainrow.Append("<tr>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Type</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Ser RefNo</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Details</td>");
                                sbMainrow.Append("<td   style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Excl Amt</td>");
                                sbMainrow.Append("<td   style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Taxes</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>VAT</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Incl Amt</td>");
                                sbMainrow.Append("</tr>");
                            }
                            CarLandClientTotal = CarLandClientTotal + Convert.ToDecimal(dtlRow["TotalPrice"]);
                            CarLandExclAmt     = CarLandExclAmt + Convert.ToDecimal(dtlRow["TotalPrice"]);
                            CarLandVat         = CarLandVat + 0;
                            CarLandDtlTotal    = Convert.ToDecimal(dtlRow["TotalPrice"]) + 0;

                            sbMainrow.Append("<tr>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["CarModel"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["FileNo"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'> Class " + dtlRow["Class"] + "Doors " + dtlRow["CarDoors"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + CarLandDtlTotal + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>0</td>");  // Hotel Taxes
                            sbMainrow.Append("<td  style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>0</td>"); // Vat
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + CarLandDtlTotal + "</td>");
                            sbMainrow.Append("</tr>");
                            car = 1;
                        }
                        sbMainrow.Append("<tr>");
                        sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>Land Total</td>");
                        sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        sbMainrow.Append("<td  style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right;'>" + CarLandExclAmt + "</td>");
                        sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;;text-align:right'>0</td>");
                        sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right;'>0</td>");
                        sbMainrow.Append("<td  style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right;'>" + (CarLandClientTotal + 0) + "</td></tr>");
                    }
                    #endregion LandArrangement

                    //#region ServiceFee
                    //if (objDs.Tables[4].Rows.Count > 0)
                    //{
                    //    sbMainrow.Append("<tr>");
                    //    sbMainrow.Append("<td colspan='7' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Service Fee</td>");
                    //    sbMainrow.Append("</tr>");

                    //    sbMainrow.Append("<tr>");
                    //    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Type</td>");
                    //    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>SourceRef</td>");
                    //    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Details</td>");
                    //    sbMainrow.Append("<td    style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Excl Amt</td>");
                    //    sbMainrow.Append("<td    style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Taxes</td>");
                    //    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>VAT</td>");
                    //    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Incl Amt</td>");
                    //    sbMainrow.Append("</tr>");

                    //    foreach (DataRow dtlRow in objDs.Tables[4].Rows)
                    //    {



                    //        string Clienttotal = string.IsNullOrEmpty(dtlRow["ChargeServiceFee"].ToString().Trim()) ? ".00" : dtlRow["ChargeServiceFee"].ToString().Trim();

                    //        string ExcluAmount = string.IsNullOrEmpty(dtlRow["ServiceFee"].ToString().Trim()) ? ".00" : dtlRow["ServiceFee"].ToString().Trim();

                    //        string VatAmount = string.IsNullOrEmpty(dtlRow["VatFee"].ToString().Trim()) ? ".00" : dtlRow["VatFee"].ToString().Trim();


                    //        ServiceFeeClientTotal = ServiceFeeClientTotal + Convert.ToDecimal(Clienttotal);
                    //        ServiceFeeExclAmt = ServiceFeeExclAmt + Convert.ToDecimal(ExcluAmount);
                    //        ServiceFeeVat = ServiceFeeVat + Convert.ToDecimal(VatAmount);

                    //        sbMainrow.Append("<tr>");
                    //        sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>Service fee on sales</td>");
                    //        sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["FileNo"] + "</td>");
                    //        sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>Service Fee On Sales</td>");// Service Fee
                    //        sbMainrow.Append("<td  style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["ServiceFee"] + "</td>");
                    //        sbMainrow.Append("<td  style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>0</td>");
                    //        sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["VatFee"] + "</td>");
                    //        sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["ChargeServiceFee"] + "</td>");
                    //        sbMainrow.Append("</tr>");


                    //    }


                    //    sbMainrow.Append("<tr>");
                    //    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>Service Fee Total</td>");
                    //    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    //    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    //    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right;'>" + ServiceFeeExclAmt + "</td>");
                    //    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right;'>0</td>");
                    //    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right;'>" + ServiceFeeVat + "</td>");
                    //    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + ServiceFeeClientTotal + "</td></tr>");

                    //}
                    //#endregion Service

                    decimal TotalInvExclAmt = FlightExclAmt + LandExclAmt + CarLandExclAmt + ServiceFeeExclAmt + GeneralChargeExclAmt;
                    decimal TotalVat        = FlightVat + LandVat + CarLandVat + ServiceFeeVat + GeneralChargeVat;
                    decimal TotalInclAmount = FlihgtClientTotal + CarLandClientTotal + FlightServiceFeeTotal + LandClientTotal + ServiceFeeClientTotal + GeneralChargeClienttotal;

                    TotalInclAmount = Convert.ToDecimal(_objBOUtiltiy.FormatTwoDecimal(TotalInclAmount.ToString()));
                    // Invocie Total desing

                    //sbMainrow.Append("<tr>");
                    //sbMainrow.Append("<td colspan='7'><br/></td>");
                    //sbMainrow.Append("</tr>");


                    sbMainrow.Append("<tr>");
                    sbMainrow.Append("<td colspan='7' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'><br/></td>");
                    sbMainrow.Append("</tr>");

                    sbMainrow.Append("<tr>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;color:blue;'>Invoice Total</td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + TotalInvExclAmt + "</td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + AirportTaxes + "</td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + TotalVat + "</td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + TotalInclAmount + "</td></tr>");
                    // Balance From you desing
                    sbMainrow.Append("<tr>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;color:blue;'>Total Due</td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    sbMainrow.Append("<td  style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + TotalInclAmount + "</td></tr>");
                }
                readFile = readFile.Replace("{MainRows}", sbMainrow.ToString());


                string StrContent = readFile;



                string strFileName     = "Invoice_" + " " + strInvocieId;
                string strFileSavePath = Server.MapPath("../PdfDocuments/Invoices/" + strFileName + ".pdf");

                GenerateHTML_TO_PDF(StrContent, true, strFileSavePath, true);
            }
        }
        catch (Exception ex)
        {
            lblMsg.Text = _objBOUtiltiy.ShowMessage("danger", "Danger", ex.Message);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (Session["UserCompanyId"] == null)
        //{
        //    string script = string.Format("alert('Your session has expired');window.location ='InvoiceList.aspx';");
        //    ScriptManager.RegisterClientScriptBlock(Page, typeof(System.Web.UI.Page), "redirect", script, true);
        //    //Response.Redirect("Login.aspx");
        //}
        // else
        // {
        try
        {
            if (!IsPostBack)
            {
                int    PFinvid        = 0;
                int    PFcompanyId    = 0;
                var    qs             = "0";
                string PFTempuniqCode = "";

                if (!string.IsNullOrEmpty(Session["UserCompanyId"].ToString()))
                {
                    PFcompanyId = Convert.ToInt32(Session["UserCompanyId"].ToString());
                }

                if (!string.IsNullOrEmpty(Request.QueryString["id"]))
                {
                    string getId = Convert.ToString(Request.QueryString["id"]);
                    qs      = _objBOUtiltiy.Decrypts(HttpUtility.UrlDecode(getId), true);
                    PFinvid = Convert.ToInt32(qs);
                }


                DataSet objds = objBALPFInvoice.GetPFServiceFeeMergeValue(PFinvid, PFTempuniqCode);


                DataSet objDs = objBALPFInvoice.GetPFPdfDetails(PFinvid, PFcompanyId);

                StreamReader reader   = new StreamReader(Server.MapPath("~/HtmlTemps/PFPdfInvoice.html"));
                string       readFile = reader.ReadToEnd();
                reader.Close();

                StringBuilder sbMainrow         = new StringBuilder();
                StringBuilder sbLandrow         = new StringBuilder();
                int           PFComapanyAddress = 0;
                int           PFDocuHeader      = 0;
                int           PFFlight          = 0;
                int           PFLand            = 0;
                int           PFLandOnly        = 0;

                int PFSF           = 0;
                int PFGC           = 0;
                int PFPrintStyleId = 0;

                if (objDs.Tables.Count > 0)
                {
                    #region Company Deatils
                    if (objDs.Tables[5].Rows.Count > 0)
                    {
                        foreach (DataRow dtlRow in objDs.Tables[5].Rows)
                        {
                            if (PFComapanyAddress == 0)
                            {
                                readFile = readFile.Replace("{CompanyName}", dtlRow["CompanyName"].ToString());
                                readFile = readFile.Replace("{address}", dtlRow["CompanyAddress"].ToString());
                                readFile = readFile.Replace("{Country}", dtlRow["CountryName"].ToString() + " .");
                                readFile = readFile.Replace("{State}", dtlRow["StateName"].ToString() + " ,");
                                readFile = readFile.Replace("{City}", dtlRow["CityName"].ToString() + " ,");
                                readFile = readFile.Replace("{currency}", dtlRow["currency"].ToString() + " ");
                                string strImagPath = Server.MapPath("../images/" + dtlRow["comapnylogo"].ToString());
                                readFile = readFile.Replace("{Image}", "<img style='height:40px;width:250px;'  src='" + "http://flv.swdtcpl.com/Logos/" + dtlRow["comapnylogo"].ToString() + "'></img>");
                                //readFile = readFile.Replace("{Image3}", "<img style='height:50px;width:70px;margin-left:100px;'  src='" + "http://demofin.swdtcpl.com/img/" + dtlRow["comapnylogo"].ToString() + "'></img>");

                                //string strUrl = _objBOUtiltiy.LogoUrl();
                                //readFile = readFile.Replace("{Image}", "<img   src='" + strUrl + "Logos/" + dtlRow["comapnylogo"].ToString() + "'></img>");
                                //readFile = readFile.Replace("{Image3}", "<img style='height:50px;width:70px;margin-left:100px;'  src='" + strUrl + "Logos/" + dtlRow["comapnylogo"].ToString() + "'></img>");
                            }
                            PFComapanyAddress = 1;
                        }
                    }
                    if (objDs.Tables[5].Rows.Count == 0)
                    {
                        readFile = readFile.Replace("{CompanyName}", " ");
                        readFile = readFile.Replace("{address}", " ");
                        readFile = readFile.Replace("{Country}", " ");
                        readFile = readFile.Replace("{State}", " ");
                        readFile = readFile.Replace("{City}", " ");
                        readFile = readFile.Replace("{Image}", " ");
                        readFile = readFile.Replace("{Image3}", " ");
                    }

                    if (objDs.Tables[0].Rows.Count > 0)
                    {
                        foreach (DataRow dtlRow in objDs.Tables[0].Rows)
                        {
                            if (PFDocuHeader == 0)
                            {
                                PFPrintStyleId = Convert.ToInt32(dtlRow["PrintStyleId"].ToString());
                                readFile       = readFile.Replace("{Invoice_No}", dtlRow["PFInvId"].ToString());
                                readFile       = readFile.Replace("{Date}", dtlRow["InvDate"].ToString());
                                readFile       = readFile.Replace("{Consultant}", dtlRow["ConsultantName"].ToString());
                                readFile       = readFile.Replace("{Client1}", dtlRow["ClientName"].ToString());
                                readFile       = readFile.Replace("{Client}", dtlRow["ClientName"].ToString());
                                readFile       = readFile.Replace("{OrderNo}", dtlRow["PFInvOrder"].ToString());
                            }
                            PFDocuHeader = 1;
                        }
                    }
                    if (objDs.Tables[0].Rows.Count == 0)
                    {
                        readFile = readFile.Replace("{Document_No}", "123456546256");
                        readFile = readFile.Replace("{Date}", " ");
                        readFile = readFile.Replace("{Consultant}", " ");
                        readFile = readFile.Replace("{Client}", " ");
                        readFile = readFile.Replace("{OrderNo}", " ");
                    }

                    #endregion

                    decimal PFLandClientTotal          = 0;
                    decimal PFFlihgtClientTotal        = 0;
                    decimal PFServiceFeeClientTotal    = 0;
                    decimal PFGeneralChargeClienttotal = 0;


                    decimal PFSepLandClientTotal = 0;
                    decimal PFSepLandExclAmt     = 0;
                    decimal PFSepLandVat         = 0;

                    decimal PFFlightExclAmt        = 0;
                    decimal PFLandExclAmt          = 0;
                    decimal PFServiceFeeExclAmt    = 0;
                    decimal PFGeneralChargeExclAmt = 0;

                    decimal PFFlightVat        = 0;
                    decimal PFLandVat          = 0;
                    decimal PFServiceFeeVat    = 0;
                    decimal PFGeneralChargeVat = 0;
                    decimal PFAirportTaxes     = 0;



                    #region LandArrangement
                    if (objDs.Tables[2].Rows.Count > 0)
                    {
                        foreach (DataRow dtlRow in objDs.Tables[2].Rows)
                        {
                            if (PFPrintStyleId == 0)
                            {
                                if (PFLandOnly == 0)
                                {
                                    sbLandrow.Append("<h3 class='text-center'><strong>Land Invoice Summary</strong></h3>");

                                    sbLandrow.Append("<tr>");
                                    sbLandrow.Append("<td colspan='7' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Land Arrangement</td>");
                                    sbLandrow.Append("</tr>");


                                    sbLandrow.Append("<tr>");
                                    sbLandrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Type</td>");
                                    sbLandrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Ser RefNo</td>");
                                    sbLandrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Details</td>");
                                    sbLandrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Excl Amt</td>");
                                    sbLandrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Taxes</td>");
                                    sbLandrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>VAT</td>");

                                    sbLandrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Incl Amt</td>");
                                    sbLandrow.Append("</tr>");
                                }
                            }


                            PFSepLandClientTotal = PFSepLandClientTotal + Convert.ToDecimal(string.IsNullOrEmpty(dtlRow["ClientTotal"].ToString().Trim()) ? ".00" : dtlRow["ClientTotal"].ToString().Trim());
                            PFSepLandExclAmt     = PFSepLandExclAmt + Convert.ToDecimal(string.IsNullOrEmpty(dtlRow["Excl Amt"].ToString().Trim()) ? ".00" : dtlRow["Excl Amt"].ToString().Trim());
                            PFSepLandVat         = PFSepLandVat + Convert.ToDecimal(string.IsNullOrEmpty(dtlRow["VAT"].ToString().Trim()) ? ".00" : dtlRow["VAT"].ToString().Trim());



                            //LandClientTotal = LandClientTotal + LandClientTotal;
                            //LandExclAmt = LandExclAmt + LandExclAmt;
                            //LandVat = LandVat + LandVat;


                            if (PFPrintStyleId == 0)
                            {
                                sbLandrow.Append("<tr>");
                                sbLandrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["LandArrId"] + "</td>");
                                sbLandrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["BookRefNo"] + "</td>");
                                sbLandrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["Details"] + "</td>");
                                sbLandrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["Excl Amt"] + "</td>");
                                sbLandrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>0.00</td>");
                                sbLandrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["VAT"] + "</td>");

                                sbLandrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["ClientTotal"] + "</td>");
                                sbLandrow.Append("</tr>");
                                PFLandOnly = 1;
                            }
                        }
                        //sbMainrow.Append("<tr>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>Land Total</td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td  style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + LandClientTotal + "</td></tr>");
                        if (PFPrintStyleId == 0)
                        {
                            sbLandrow.Append("<tr>");
                            sbLandrow.Append("<td colspan='6' style='border: 1px ridge black; font-weight:bold;padding:3px;'>Land Total</td>");
                            sbLandrow.Append("<td colspan='7' style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + PFSepLandClientTotal + "</td></tr>");
                        }
                    }


                    readFile = readFile.Replace("{LandData}", sbLandrow.ToString());

                    #endregion LandArrangement


                    #region AirTicket
                    if (objDs.Tables[1].Rows.Count > 0)
                    {
                        foreach (DataRow dtlRow in objDs.Tables[1].Rows)
                        {
                            if (PFPrintStyleId == 0)
                            {
                                if (PFFlight == 0)
                                {
                                    sbMainrow.Append("<tr>");
                                    sbMainrow.Append("<td colspan='7' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Air Tickets</td>");
                                    sbMainrow.Append("</tr>");


                                    sbMainrow.Append("<tr>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Prn</td>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Ticket No</td>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Passenger/Route/Dep Date</td>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Excl Amt</td>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Airport Taxes</td>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>VAT</td>");

                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Incl Amt</td>");
                                    sbMainrow.Append("</tr>");
                                }
                            }
                            PFFlihgtClientTotal = PFFlihgtClientTotal + Convert.ToDecimal(dtlRow["AirClientTotal"]);
                            PFFlightExclAmt     = PFFlightExclAmt + Convert.ToDecimal(dtlRow["AirExclusiveFare"]);
                            PFFlightVat         = PFFlightVat + Convert.ToDecimal(dtlRow["AirVatonFare"]);
                            PFAirportTaxes      = PFAirportTaxes + Convert.ToDecimal(dtlRow["AirPortTaxes"]);

                            if (PFPrintStyleId == 0)
                            {
                                sbMainrow.Append("<tr>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["AirPnr"] + "</td>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["AirTicketNo"] + "</td>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'/>" + dtlRow["Details"] + "</td>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["AirExclusiveFare"] + "</td>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["AirPortTaxes"] + "</td>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["AirVatonFare"] + "</td>");

                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["AirClientTotal"] + "</td>");
                                sbMainrow.Append("</tr>");
                                PFFlight = 1;
                            }
                        }
                        //sbMainrow.Append("<tr>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>Airport Taxes</td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + AirportTaxes + "</td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>0.00</td>");
                        //sbMainrow.Append("<td colspan='7' style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + AirportTaxes + "</td></tr>");

                        //  sbMainrow.Append("<tr>");
                        //  sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>Air Tickets Total(Inclu Airport Taxes)</td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //   sbMainrow.Append("<td colspan='7' style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + FlihgtClientTotal + "</td></tr>");
                        if (PFPrintStyleId == 0)
                        {
                            sbMainrow.Append("<tr>");
                            sbMainrow.Append("<td colspan='6' style='border: 1px ridge black; font-weight:bold;padding:3px;'>Air Tickets Total(Inclu Airport Taxes)</td>");
                            sbMainrow.Append("<td colspan='7' style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + PFFlihgtClientTotal + "</td></tr>");
                            //sbMainrow.Append("</tr>");
                        }
                    }
                    #endregion AirTicket

                    #region LandArrangement
                    if (objDs.Tables[2].Rows.Count > 0)
                    {
                        foreach (DataRow dtlRow in objDs.Tables[2].Rows)
                        {
                            if (PFPrintStyleId == 0)
                            {
                                if (PFLand == 0)
                                {
                                    sbMainrow.Append("<tr>");
                                    sbMainrow.Append("<td colspan='7' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Land Arrangement</td>");
                                    sbMainrow.Append("</tr>");


                                    sbMainrow.Append("<tr>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Type</td>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Ser RefNo</td>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Details</td>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Excl Amt</td>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Taxes</td>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>VAT</td>");

                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Incl Amt</td>");
                                    sbMainrow.Append("</tr>");
                                }
                            }


                            PFLandClientTotal = PFLandClientTotal + Convert.ToDecimal(string.IsNullOrEmpty(dtlRow["ClientTotal"].ToString().Trim()) ? ".00" : dtlRow["ClientTotal"].ToString().Trim());
                            PFLandExclAmt     = PFLandExclAmt + Convert.ToDecimal(string.IsNullOrEmpty(dtlRow["Excl Amt"].ToString().Trim()) ? ".00" : dtlRow["Excl Amt"].ToString().Trim());
                            PFLandVat         = PFLandVat + Convert.ToDecimal(string.IsNullOrEmpty(dtlRow["VAT"].ToString().Trim()) ? ".00" : dtlRow["VAT"].ToString().Trim());



                            //LandClientTotal = LandClientTotal + LandClientTotal;
                            //LandExclAmt = LandExclAmt + LandExclAmt;
                            //LandVat = LandVat + LandVat;


                            if (PFPrintStyleId == 0)
                            {
                                sbMainrow.Append("<tr>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["LandArrId"] + "</td>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["BookRefNo"] + "</td>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["Details"] + "</td>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["Excl Amt"] + "</td>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>0.00</td>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["VAT"] + "</td>");

                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["ClientTotal"] + "</td>");
                                sbMainrow.Append("</tr>");
                                PFLand = 1;
                            }
                        }
                        //sbMainrow.Append("<tr>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>Land Total</td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td  style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + LandClientTotal + "</td></tr>");
                        if (PFPrintStyleId == 0)
                        {
                            sbMainrow.Append("<tr>");
                            sbMainrow.Append("<td colspan='6' style='border: 1px ridge black; font-weight:bold;padding:3px;'>Land Total</td>");
                            sbMainrow.Append("<td colspan='7' style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + PFLandClientTotal + "</td></tr>");
                        }
                    }

                    #endregion LandArrangement

                    #region ServiceFee

                    string merge = "";

                    if (objDs.Tables[3].Rows.Count > 0)
                    {
                        foreach (DataRow dtlRow in objDs.Tables[3].Rows)
                        {
                            merge = dtlRow["MergeC"].ToString();

                            if (dtlRow["MergeC"].ToString() == "0")
                            {
                                if (PFSF == 0)
                                {
                                    if (PFPrintStyleId == 0)
                                    {
                                        sbMainrow.Append("<tr>");
                                        sbMainrow.Append("<td colspan='7' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Service Fee</td>");
                                        sbMainrow.Append("</tr>");


                                        sbMainrow.Append("<tr>");
                                        sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Type</td>");
                                        sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>SourceRef</td>");
                                        sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Details</td>");
                                        sbMainrow.Append("<td colspan='2' style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;text-align:center'>Excl Amt</td>");
                                        //sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Taxes</td>");

                                        sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>VAT</td>");
                                        sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Incl Amt</td>");
                                        sbMainrow.Append("</tr>");
                                    }
                                }
                                string Clienttotal = string.IsNullOrEmpty(dtlRow["ClientTotal"].ToString().Trim()) ? ".00" : dtlRow["ClientTotal"].ToString().Trim();

                                string ExcluAmount = string.IsNullOrEmpty(dtlRow["ExcluAmount"].ToString().Trim()) ? ".00" : dtlRow["ExcluAmount"].ToString().Trim();

                                string VatAmount = string.IsNullOrEmpty(dtlRow["VatAmount"].ToString().Trim()) ? ".00" : dtlRow["VatAmount"].ToString().Trim();


                                PFServiceFeeClientTotal = PFServiceFeeClientTotal + Convert.ToDecimal(Clienttotal);
                                PFServiceFeeExclAmt     = PFServiceFeeExclAmt + Convert.ToDecimal(ExcluAmount);
                                PFServiceFeeVat         = PFServiceFeeVat + Convert.ToDecimal(VatAmount);
                                if (PFPrintStyleId == 0)
                                {
                                    sbMainrow.Append("<tr>");
                                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["Typ"] + "</td>");
                                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["TktNumber"] + "</td>");
                                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["Details"] + "</td>");
                                    sbMainrow.Append("<td colspan='2' style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["ExcluAmount"] + "</td>");
                                    //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>0.00</td>");
                                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["VatAmount"] + "</td>");

                                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["ClientTotal"] + "</td>");
                                    sbMainrow.Append("</tr>");
                                    PFSF = 1;
                                }
                            }
                        }
                        //  if (merge == "0")
                        //   {
                        //sbMainrow.Append("<tr>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>Service Fee Total</td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + ServiceFeeClientTotal + "</td></tr>");

                        if (PFPrintStyleId == 0)
                        {
                            sbMainrow.Append("<tr>");
                            sbMainrow.Append("<td colspan='6' style='border: 1px ridge black; font-weight:bold;padding:3px;'>Service Fee Total</td>");
                            if (PFServiceFeeClientTotal == 0)
                            {
                                sbMainrow.Append("<td colspan='7' style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'> 0.00 </td></tr>");
                            }
                            else
                            {
                                sbMainrow.Append("<td colspan='7' style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + PFServiceFeeClientTotal + "</td></tr>");
                            }
                        }
                        //  }
                    }


                    #endregion Service

                    #region GeneralCharge
                    if (objDs.Tables[4].Rows.Count > 0)
                    {
                        foreach (DataRow dtlRow in objDs.Tables[4].Rows)
                        {
                            if (PFPrintStyleId == 0)
                            {
                                if (PFGC == 0)
                                {
                                    sbMainrow.Append("<tr>");
                                    sbMainrow.Append("<td colspan='7' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>General Charge</td>");
                                    sbMainrow.Append("</tr>");


                                    sbMainrow.Append("<tr>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Type</td>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Ser RefNo</td>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Details</td>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Excl Amt</td>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Taxes</td>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>VAT</td>");

                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Incl Amt</td>");
                                    sbMainrow.Append("</tr>");
                                }
                            }
                            PFGeneralChargeClienttotal = PFGeneralChargeClienttotal + Convert.ToDecimal(dtlRow["ClientTot"]);
                            PFGeneralChargeExclAmt     = PFGeneralChargeExclAmt + Convert.ToDecimal(dtlRow["ExcluAmt"]);
                            PFGeneralChargeVat         = PFGeneralChargeVat + Convert.ToDecimal(dtlRow["VatAmount"]);

                            if (PFPrintStyleId == 0)
                            {
                                sbMainrow.Append("<tr>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["Type"] + "</td>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["Ref"] + "</td>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["Details"] + "</td>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["ExcluAmt"] + "</td>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>0.00</td>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["VatAmount"] + "</td>");

                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["ClientTot"] + "</td>");
                                sbMainrow.Append("</tr>");
                                PFGC = 1;
                            }
                        }
                        //sbMainrow.Append("<tr>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>General Charge Total</td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + GeneralChargeClienttotal + "</td></tr>");
                        if (PFPrintStyleId == 0)
                        {
                            sbMainrow.Append("<tr>");
                            sbMainrow.Append("<td colspan='6' style='border: 1px ridge black; font-weight:bold;padding:3px;'>General Charge Total</td>");
                            sbMainrow.Append("<td colspan='7' style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + PFGeneralChargeClienttotal + "</td></tr>");
                        }
                    }
                    #endregion GeneralCharge


                    decimal TotalInvExclAmt = PFFlightExclAmt + PFLandExclAmt + PFServiceFeeExclAmt + PFGeneralChargeExclAmt;
                    decimal TotalVat        = PFFlightVat + PFLandVat + PFServiceFeeVat + PFGeneralChargeVat;
                    decimal TotalInclAmount = PFFlihgtClientTotal + PFLandClientTotal + PFServiceFeeClientTotal + PFGeneralChargeClienttotal;

                    TotalInclAmount = Convert.ToDecimal(_objBOUtiltiy.FormatTwoDecimal(TotalInclAmount.ToString()));
                    // Invocie Total desing

                    //sbMainrow.Append("<tr>");
                    //sbMainrow.Append("<td colspan='7'><br/></td>");
                    //sbMainrow.Append("</tr>");


                    sbMainrow.Append("<tr>");
                    sbMainrow.Append("<td colspan='7' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;text-align:center'>Summary<br/></td>");
                    sbMainrow.Append("</tr>");

                    sbMainrow.Append("<tr>");
                    sbMainrow.Append("<td colspan='3' style='border: 1px ridge black; font-weight:bold;padding:3px;color:blue;'>Invoice Total</td>");
                    //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + TotalInvExclAmt + "</td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + PFAirportTaxes + "</td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + TotalVat + "</td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + TotalInclAmount + "</td></tr>");
                    // Balance From you desing
                    sbMainrow.Append("<tr>");
                    sbMainrow.Append("<td colspan='6'  style='border: 1px ridge black; font-weight:bold;padding:3px;color:blue;'>Total Due</td>");
                    //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + TotalInclAmount + "</td></tr>");
                }

                readFile = readFile.Replace("{MainRows}", sbMainrow.ToString());


                string StrContent = readFile;

                //GenerateHTML_TO_PDF(StrContent, true, "", false);

                string strFileName     = "PFInvoice" + " " + PFinvid;
                string strFileSavePath = Server.MapPath("../PdfDocuments/" + strFileName + ".pdf");

                GenerateHTML_TO_PDF(StrContent, true, strFileSavePath, true);
            }
        }
        catch (Exception ex)
        {
            lblMsg.Text = _objBOUtiltiy.ShowMessage("danger", "Danger", ex.Message);
            ExceptionLogging.SendExcepToDB(ex);
        }
        // }
    }
示例#8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                string TempuniqCode = " ";
                int    mergeId = 0; int invid = 0;

                int comapnyId = Convert.ToInt32(Session["UserCompanyId"].ToString());
                if (!string.IsNullOrEmpty(Request.QueryString["TempuniqCode"]))
                {
                    TempuniqCode = Request.QueryString["TempuniqCode"];
                }

                // mergeId = Convert.ToInt32(objBALInvoice.GetServiceFeeMergeValue(invid, TempuniqCode));

                DataSet objDs = objBALInvoice.DraftPdfDetails(TempuniqCode, comapnyId);

                StreamReader reader   = new StreamReader(Server.MapPath("~/HtmlTemps/NewDraftPdfInvoice.html"));
                string       readFile = reader.ReadToEnd();
                reader.Close();

                StringBuilder sbMainrow       = new StringBuilder();
                StringBuilder sbMainrow1      = new StringBuilder();
                int           ComapanyAddress = 0;
                // int DocuHeader = 0;
                int Flight = 0;
                int Land   = 0;
                int SF     = 0;
                int GC     = 0;


                if (objDs.Tables.Count > 0)
                {
                    #region Company Deatils
                    if (objDs.Tables[0].Rows.Count > 0)
                    {
                        foreach (DataRow dtlRow in objDs.Tables[0].Rows)
                        {
                            if (ComapanyAddress == 0)
                            {
                                readFile = readFile.Replace("{CompanyName}", dtlRow["CompanyName"].ToString());
                                readFile = readFile.Replace("{address}", dtlRow["CompanyAddress"].ToString());
                                readFile = readFile.Replace("{Country}", dtlRow["CountryName"].ToString() + " .");
                                readFile = readFile.Replace("{State}", dtlRow["StateName"].ToString() + " ,");
                                readFile = readFile.Replace("{City}", dtlRow["CityName"].ToString() + " ,");
                                //string strImagPath = Server.MapPath("../Logos/" + dtlRow["comapnylogo"].ToString());
                                readFile = readFile.Replace("{Image}", "<img style='height:40px;width:250px;'  src='" + "http://flv.swdtcpl.com/Logos/" + dtlRow["comapnylogo"].ToString() + "'></img>");

                                ////readFile = readFile.Replace("{Image3}", "<img style='height:50px;width:70px;margin-left:100px;'  src='" + "http://demofin.swdtcpl.com/img/" + dtlRow["comapnylogo"].ToString() + "'></img>");

                                string strUrl = _objBOUtiltiy.LogoUrl();
                                //readFile = readFile.Replace("{Image}", "<img   src='" + strUrl + "Logos/" + dtlRow["comapnylogo"].ToString() + "'></img>");
                                readFile = readFile.Replace("{Image3}", "<img style='height:100px;width:500px;margin-left:100px;'  src='" + strUrl + "Logos/" + dtlRow["comapnylogo"].ToString() + "'></img>");
                            }
                            ComapanyAddress = 1;
                        }
                    }
                    if (objDs.Tables[0].Rows.Count == 0)
                    {
                        readFile = readFile.Replace("{CompanyName}", " ");
                        readFile = readFile.Replace("{address}", " ");
                        readFile = readFile.Replace("{Country}", " ");
                        readFile = readFile.Replace("{State}", " ");
                        readFile = readFile.Replace("{City}", " ");
                        readFile = readFile.Replace("{Image}", " ");
                        readFile = readFile.Replace("{Image3}", " ");
                    }


                    #endregion

                    decimal LandClientTotal          = 0;
                    decimal FlihgtClientTotal        = 0;
                    decimal ServiceFeeClientTotal    = 0;
                    decimal GeneralChargeClienttotal = 0;


                    decimal FlightExclAmt        = 0;
                    decimal LandExclAmt          = 0;
                    decimal ServiceFeeExclAmt    = 0;
                    decimal GeneralChargeExclAmt = 0;

                    decimal FlightVat        = 0;
                    decimal LandVat          = 0;
                    decimal ServiceFeeVat    = 0;
                    decimal GeneralChargeVat = 0;
                    decimal AirportTaxes     = 0;

                    #region AirTicket
                    if (objDs.Tables[1].Rows.Count > 0)
                    {
                        foreach (DataRow dtlRow in objDs.Tables[1].Rows)
                        {
                            if (Flight == 0)
                            {
                                sbMainrow.Append("<tr>");
                                sbMainrow.Append("<td colspan='7' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Air Tickets</td>");
                                sbMainrow.Append("</tr>");


                                sbMainrow.Append("<tr>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Prn</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Ticket No</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Passenger/Route/Dep Date</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Excl Amt</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Airport Taxes</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>VAT</td>");

                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Incl Amt</td>");
                                sbMainrow.Append("</tr>");
                            }
                            FlihgtClientTotal = FlihgtClientTotal + Convert.ToDecimal(dtlRow["AirClientTotal"]);
                            FlightExclAmt     = FlightExclAmt + Convert.ToDecimal(dtlRow["AirExclusiveFare"]);
                            FlightVat         = FlightVat + Convert.ToDecimal(dtlRow["AirVatonFare"]);
                            AirportTaxes      = AirportTaxes + Convert.ToDecimal(dtlRow["AirPortTaxes"]);

                            sbMainrow.Append("<tr>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["SupAccountCode"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["AirTicketNo"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'/>" + dtlRow["Details"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["AirExclusiveFare"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["AirPortTaxes"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["AirVatonFare"] + "</td>");

                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["AirClientTotal"] + "</td>");
                            sbMainrow.Append("</tr>");
                            Flight = 1;
                        }
                        //sbMainrow.Append("<tr>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>Airport Taxes</td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + AirportTaxes + "</td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>0.00</td>");
                        //sbMainrow.Append("<td colspan='7' style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + AirportTaxes + "</td></tr>");

                        //  sbMainrow.Append("<tr>");
                        //  sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>Air Tickets Total(Inclu Airport Taxes)</td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //   sbMainrow.Append("<td colspan='7' style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + FlihgtClientTotal + "</td></tr>");

                        sbMainrow.Append("<tr>");
                        sbMainrow.Append("<td colspan='6' style='border: 1px ridge black; font-weight:bold;padding:3px;'>Air Tickets Total(Inclu Airport Taxes)</td>");
                        sbMainrow.Append("<td colspan='7' style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + FlihgtClientTotal + "</td></tr>");
                        //sbMainrow.Append("</tr>");
                    }
                    #endregion AirTicket

                    #region LandArrangement
                    if (objDs.Tables[2].Rows.Count > 0)
                    {
                        foreach (DataRow dtlRow in objDs.Tables[2].Rows)
                        {
                            if (Land == 0)
                            {
                                sbMainrow.Append("<tr>");
                                sbMainrow.Append("<td colspan='7' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Land Arrangement</td>");
                                sbMainrow.Append("</tr>");


                                sbMainrow.Append("<tr>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Type</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Ser RefNo</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Details</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Excl Amt</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Taxes</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>VAT</td>");

                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Incl Amt</td>");
                                sbMainrow.Append("</tr>");
                            }


                            LandClientTotal = LandClientTotal + Convert.ToDecimal(string.IsNullOrEmpty(dtlRow["ClientTotal"].ToString().Trim()) ? ".00" : dtlRow["ClientTotal"].ToString().Trim());
                            LandExclAmt     = LandExclAmt + Convert.ToDecimal(string.IsNullOrEmpty(dtlRow["Excl Amt"].ToString().Trim()) ? ".00" : dtlRow["Excl Amt"].ToString().Trim());
                            LandVat         = LandVat + Convert.ToDecimal(string.IsNullOrEmpty(dtlRow["VAT"].ToString().Trim()) ? ".00" : dtlRow["VAT"].ToString().Trim());



                            //LandClientTotal = LandClientTotal + LandClientTotal;
                            //LandExclAmt = LandExclAmt + LandExclAmt;
                            //LandVat = LandVat + LandVat;

                            sbMainrow.Append("<tr>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["LSupAccountCode"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["BookRefNo"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["Details"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["Excl Amt"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>0.00</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["VAT"] + "</td>");

                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["ClientTotal"] + "</td>");
                            sbMainrow.Append("</tr>");
                            Land = 1;
                        }
                        //sbMainrow.Append("<tr>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>Land Total</td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td  style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + LandClientTotal + "</td></tr>");


                        sbMainrow.Append("<tr>");
                        sbMainrow.Append("<td colspan='6' style='border: 1px ridge black; font-weight:bold;padding:3px;'>Land Total</td>");
                        sbMainrow.Append("<td colspan='7' style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + LandClientTotal + "</td></tr>");
                    }
                    #endregion LandArrangement

                    #region ServiceFee

                    string merge = "";

                    if (objDs.Tables[3].Rows.Count > 0)
                    {
                        foreach (DataRow dtlRow in objDs.Tables[3].Rows)
                        {
                            merge = dtlRow["MergeC"].ToString();

                            if (dtlRow["MergeC"].ToString() == "0")
                            {
                                if (SF == 0)
                                {
                                    sbMainrow.Append("<tr>");
                                    sbMainrow.Append("<td colspan='7' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>Service Fee</td>");
                                    sbMainrow.Append("</tr>");


                                    sbMainrow.Append("<tr>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Type</td>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>SourceRef</td>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Details</td>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Excl Amt</td>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Taxes</td>");

                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>VAT</td>");
                                    sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Incl Amt</td>");
                                    sbMainrow.Append("</tr>");
                                }

                                string Clienttotal = string.IsNullOrEmpty(dtlRow["ClientTotal"].ToString().Trim()) ? ".00" : dtlRow["ClientTotal"].ToString().Trim();

                                string ExcluAmount = string.IsNullOrEmpty(dtlRow["ExcluAmount"].ToString().Trim()) ? ".00" : dtlRow["ExcluAmount"].ToString().Trim();

                                string VatAmount = string.IsNullOrEmpty(dtlRow["VatAmount"].ToString().Trim()) ? ".00" : dtlRow["VatAmount"].ToString().Trim();


                                ServiceFeeClientTotal = ServiceFeeClientTotal + Convert.ToDecimal(Clienttotal);
                                ServiceFeeExclAmt     = ServiceFeeExclAmt + Convert.ToDecimal(ExcluAmount);
                                ServiceFeeVat         = ServiceFeeVat + Convert.ToDecimal(VatAmount);

                                sbMainrow.Append("<tr>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["Typ"] + "</td>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["SourceRef"] + "</td>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["Details"] + "</td>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["ExcluAmount"] + "</td>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>0.00</td>");
                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["VatAmount"] + "</td>");

                                sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["ClientTotal"] + "</td>");
                                sbMainrow.Append("</tr>");
                                SF = 1;
                            }
                        }
                        if (ServiceFeeClientTotal != 0)
                        {
                            sbMainrow.Append("<tr>");
                            sbMainrow.Append("<td colspan='6' style='border: 1px ridge black; font-weight:bold;padding:3px;'>Service Fee Total</td>");
                            if (ServiceFeeClientTotal == 0)
                            {
                                sbMainrow.Append("<td colspan='7' style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'> 0.00 </td></tr>");
                            }
                            else
                            {
                                sbMainrow.Append("<td colspan='7' style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + ServiceFeeClientTotal + "</td></tr>");
                            }
                        }
                        //  }
                    }


                    #endregion Service

                    #region GeneralCharge
                    if (objDs.Tables[4].Rows.Count > 0)
                    {
                        foreach (DataRow dtlRow in objDs.Tables[4].Rows)
                        {
                            if (GC == 0)
                            {
                                sbMainrow.Append("<tr>");
                                sbMainrow.Append("<td colspan='7' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'>General Charge</td>");
                                sbMainrow.Append("</tr>");


                                sbMainrow.Append("<tr>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Type</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Ser RefNo</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Details</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Excl Amt</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Taxes</td>");
                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>VAT</td>");

                                sbMainrow.Append("<td style='font-weight:bold;border: 1px ridge black;padding: 5px;background-color: white;border-bottom: 1px ridge black;border-radius:5px;'>Incl Amt</td>");
                                sbMainrow.Append("</tr>");
                            }
                            GeneralChargeClienttotal = GeneralChargeClienttotal + Convert.ToDecimal(dtlRow["ClientTot"]);
                            GeneralChargeExclAmt     = GeneralChargeExclAmt + Convert.ToDecimal(dtlRow["ExcluAmt"]);
                            GeneralChargeVat         = GeneralChargeVat + Convert.ToDecimal(dtlRow["VatAmount"]);

                            sbMainrow.Append("<tr>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["Type"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["Ref"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>" + dtlRow["Details"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["ExcluAmt"] + "</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>0.00</td>");
                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["VatAmount"] + "</td>");

                            sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + dtlRow["ClientTot"] + "</td>");
                            sbMainrow.Append("</tr>");
                            GC = 1;
                        }
                        //sbMainrow.Append("<tr>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'>General Charge Total</td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                        //sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + GeneralChargeClienttotal + "</td></tr>");


                        sbMainrow.Append("<tr>");
                        sbMainrow.Append("<td colspan='6' style='border: 1px ridge black; font-weight:bold;padding:3px;'>General Charge Total</td>");
                        sbMainrow.Append("<td colspan='7' style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + GeneralChargeClienttotal + "</td></tr>");
                    }
                    #endregion GeneralCharge


                    decimal TotalInvExclAmt = FlightExclAmt + LandExclAmt + ServiceFeeExclAmt + GeneralChargeExclAmt;
                    decimal TotalVat        = FlightVat + LandVat + ServiceFeeVat + GeneralChargeVat;
                    decimal TotalInclAmount = FlihgtClientTotal + LandClientTotal + ServiceFeeClientTotal + GeneralChargeClienttotal;

                    TotalInclAmount = Convert.ToDecimal(_objBOUtiltiy.FormatTwoDecimal(TotalInclAmount.ToString()));
                    // Invocie Total desing

                    //sbMainrow.Append("<tr>");
                    //sbMainrow.Append("<td colspan='7'><br/></td>");
                    //sbMainrow.Append("</tr>");


                    sbMainrow.Append("<tr>");
                    sbMainrow.Append("<td colspan='7' style='background-color:#f5f5f5;border: 1px ridge black;font-weight:bold;padding:3px;color:blue;'><br/></td>");
                    sbMainrow.Append("</tr>");

                    sbMainrow.Append("<tr>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;color:blue;'>Invoice Total</td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + TotalInvExclAmt + "</td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + AirportTaxes + "</td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + TotalVat + "</td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + TotalInclAmount + "</td></tr>");
                    // Balance From you desing
                    sbMainrow.Append("<tr>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;color:blue;'>Total Due</td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;'></td>");
                    sbMainrow.Append("<td style='border: 1px ridge black; font-weight:bold;padding:3px;text-align:right'>" + TotalInclAmount + "</td></tr>");
                }

                readFile = readFile.Replace("{MainRows}", sbMainrow.ToString());

                readFile = readFile.Replace("{LandArr}", sbMainrow1.ToString());

                string StrContent = readFile;

                GenerateHTML_TO_PDF(StrContent, true, "", false);
            }
        }
        catch (Exception ex)
        {
            ExceptionLogging.SendExcepToDB(ex);
        }
    }
    protected void txtAmount_TextChanged(object sender, EventArgs e)
    {
        lblTotalAvailable.Text    = "0.00";
        lblReceiptOpenAmount.Text = "0.00";
        lblAllocatedAmount.Text   = "0.00";
        lblTotalAvailable.Text    = "0.00";

        lblAllocated.Text = "Allocated(" + 0 + ")";
        chkSelect.Checked = false;

        decimal CurrentReceiptAmount = txtAmount.Text != "" ? Convert.ToDecimal(txtAmount.Text) : 0;

        lblTotalAvailable.Text = _objBOUtiltiy.FormatTwoDecimal((Convert.ToDecimal(lblPrvClientOpenAmount.Text) + CurrentReceiptAmount).ToString());

        lblReceiptOpenAmount.Text = (Convert.ToDecimal(lblTotalAvailable.Text) - Convert.ToDecimal(lblAllocatedAmount.Text)).ToString();
        // ddlAccType_SelectedIndexChanged(null, null);

        //int Id = Convert.ToInt32(ddlAccType.SelectedValue.ToString());
        //string name = ddlAccType.SelectedItem.Text;

        //DataSet objDsInvLst = _objBALTransactions.PaymentTransaction_GetDataBycategory(Id, name);
        //if (objDsInvLst.Tables[0].Rows.Count > 0)
        //{
        //    decimal  paiedAmount = Convert.ToDecimal(objDsInvLst.Tables[1].Rows[0]["SupplPaiedAmount"].ToString());

        //}
    }
示例#10
0
    private void GetAirSuppliers(int SupplierId)
    {
        try
        {
            DataSet objds = objAirSupplier.GetAirSuppliers(SupplierId);
            if (objds.Tables[0].Rows.Count > 0)
            {
                hf_SupplierId.Value           = objds.Tables[0].Rows[0]["SupplierId"].ToString();
                txtAccountCode.Text           = objds.Tables[0].Rows[0]["SupAccountCode"].ToString();
                txtSupplierName.Text          = objds.Tables[0].Rows[0]["SupplierName"].ToString();
                dropStatus.SelectedIndex      = dropStatus.Items.IndexOf(dropStatus.Items.FindByValue(objds.Tables[0].Rows[0]["IsActive"].ToString()));
                dropServiceType.SelectedIndex = dropServiceType.Items.IndexOf(dropServiceType.Items.FindByValue(objds.Tables[0].Rows[0]["ServiceType"].ToString()));
                dropCountry.SelectedIndex     = dropCountry.Items.IndexOf(dropCountry.Items.FindByValue(objds.Tables[0].Rows[0]["Country"].ToString()));
                Get_State_Country();
                dropState.SelectedIndex = dropState.Items.IndexOf(dropState.Items.FindByValue(objds.Tables[0].Rows[0]["StateId"].ToString()));
                Get_City_State();
                dropCity.SelectedIndex       = dropCity.Items.IndexOf(dropCity.Items.FindByValue(objds.Tables[0].Rows[0]["City"].ToString()));
                dropDivision.SelectedIndex   = dropDivision.Items.IndexOf(dropDivision.Items.FindByValue(objds.Tables[0].Rows[0]["Division"].ToString()));
                dropConsultant.SelectedIndex = dropConsultant.Items.IndexOf(dropConsultant.Items.FindByValue(objds.Tables[0].Rows[0]["Consultant"].ToString()));
                txtTelephoneNo.Text          = objds.Tables[0].Rows[0]["Telephone"].ToString();
                txtFax.Text             = objds.Tables[0].Rows[0]["Fax"].ToString();
                txtCellNo.Text          = objds.Tables[0].Rows[0]["CellNo"].ToString();
                txtContact.Text         = objds.Tables[0].Rows[0]["ContactNo"].ToString();
                txtEmail.Text           = objds.Tables[0].Rows[0]["Email"].ToString();
                txtWeb.Text             = objds.Tables[0].Rows[0]["Web"].ToString();
                txtPhysicalAddress.Text = objds.Tables[0].Rows[0]["PhysicalAddress"].ToString();
                txtPostalAddress.Text   = objds.Tables[0].Rows[0]["PostalAddress"].ToString();


                if (Convert.ToInt32(objds.Tables[0].Rows[0]["NoVatNo"].ToString()) == 1)
                {
                    chkVATNO.Checked    = Convert.ToBoolean(objds.Tables[0].Rows[0]["NoVatNo"]);
                    txtVATRegNo.Enabled = false;
                }
                else
                {
                    txtVATRegNo.Text = objds.Tables[0].Rows[0]["VatRegNo"].ToString().Trim();
                }

                txtExtAcc.Text    = objds.Tables[0].Rows[0]["ExtAcc"].ToString();
                txtAlphaCode.Text = objds.Tables[0].Rows[0]["QuickTravelCode"].ToString();

                dropBank.SelectedIndex        = dropBank.Items.IndexOf(dropBank.Items.FindByValue(objds.Tables[0].Rows[0]["Bank"].ToString()));
                txtBranchCode.Text            = objds.Tables[0].Rows[0]["BranchCode"].ToString();
                txtBranchName.Text            = objds.Tables[0].Rows[0]["BranchName"].ToString();
                txtAccountNo.Text             = objds.Tables[0].Rows[0]["AccountNo"].ToString();
                dropAccountType.SelectedIndex = dropAccountType.Items.IndexOf(dropAccountType.Items.FindByValue(objds.Tables[0].Rows[0]["AccountType"].ToString()));
                txtAccHolder.Text             = objds.Tables[0].Rows[0]["AccHolder"].ToString();

                txtGiAccountSUb.Text          = objds.Tables[0].Rows[0]["QuickGIAccount"].ToString();
                txtLedgerAccount.Text         = objds.Tables[0].Rows[0]["LedgerAccount"].ToString();
                dropCommiMethod.SelectedIndex = dropCommiMethod.Items.IndexOf(dropCommiMethod.Items.FindByValue(objds.Tables[0].Rows[0]["CommissMethod"].ToString()));

                if (Convert.ToInt32(objds.Tables[0].Rows[0]["ZeroCommission"].ToString()) == 1)
                {
                    ChkZeroComm.Checked = Convert.ToBoolean(objds.Tables[0].Rows[0]["ZeroCommission"]);
                    txtCommPerc.Enabled = false;
                }
                else
                {
                    txtCommPerc.Text = _BOUtility.FormatTwoDecimal(objds.Tables[0].Rows[0]["CommPercentage"].ToString().Trim());
                }

                dropPaymentMethod.SelectedIndex = dropPaymentMethod.Items.IndexOf(dropPaymentMethod.Items.FindByValue(objds.Tables[0].Rows[0]["PaymentMethod"].ToString()));

                if (Convert.ToInt32(objds.Tables[0].Rows[0]["ClientTaxInvoice"].ToString()) == 1)
                {
                    chkClientInvoice.Checked = Convert.ToBoolean(objds.Tables[0].Rows[0]["ClientTaxInvoice"]);
                    dropTreatInvType.Enabled = false;
                }
                else
                {
                    dropTreatInvType.SelectedIndex = dropPaymentMethod.Items.IndexOf(dropPaymentMethod.Items.FindByValue(objds.Tables[0].Rows[0]["ClientInvoiceType"].ToString()));
                }

                chkPrinTaxInvoice.Checked = Convert.ToBoolean(objds.Tables[0].Rows[0]["PrinciTaxInvoice"]);
                chkAlphaTicket.Checked    = Convert.ToBoolean(objds.Tables[0].Rows[0]["IgnDupInvoiceNo"]);

                dropAllocItemType.SelectedIndex = dropAllocItemType.Items.IndexOf(dropAllocItemType.Items.FindByValue(objds.Tables[0].Rows[0]["AllocItemType"].ToString()));

                chkEconomy.Checked    = Convert.ToBoolean(objds.Tables[0].Rows[0]["EconomyClass"]);
                chkBusiness.Checked   = Convert.ToBoolean(objds.Tables[0].Rows[0]["BusinessClass"]);
                ChkFirstClass.Checked = Convert.ToBoolean(objds.Tables[0].Rows[0]["FirstClass"]);

                txtNotes.Text = objds.Tables[0].Rows[0]["Notes"].ToString();
                dropNoteType.SelectedIndex = dropCommiMethod.Items.IndexOf(dropCommiMethod.Items.FindByValue(objds.Tables[0].Rows[0]["NoteType"].ToString()));
            }
        }
        catch (Exception ex)
        {
            lblMsg.Text = _BOUtility.ShowMessage("danger", "Danger", ex.Message);
            ExceptionLogging.SendExcepToDB(ex);
        }
    }