protected void Page_Load(object sender, EventArgs e)
 {
     msg.Text = "";
     if (!IsPostBack)
     {
         LoadTax();
         txtPreparedBy.Text = Request.Cookies["Name"].Value.ToString();
         hdPreparedBy.Value = Request.Cookies["User"].Value.ToString();
         clsPurchaseOrder obj = new clsPurchaseOrder();
         obj.Op = 9;
         DataTable dt = obj.PurchaseOrderMaster(obj).Tables[0];
         if (dt.Rows.Count == 0)
         {
             txtRefNo.Text = "TKECP/P&E/LOI-001";
         }
         else
         {
             int x = Convert.ToInt32(dt.Rows[0][0].ToString().Substring(14));
             txtRefNo.Text = "TKECP/P&E/LOI-" + (x + 1).ToString();
         }
         MapData();
         LoadSites();
         LoadSiteMachines();
         LoadPOTo();
     }
 }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        clsPurchaseOrder obj = new clsPurchaseOrder();

        //ID, PORefNo, PODate, IndentRefNo, QuotationNo, QuotationDate, Subject, PreparedBy, CheckedBy, CompanySign, TotalAmount, TaxName,
        //TaxPercentage, DiscountPercentage, NetPayable,Status
        obj.SiteID        = Convert.ToInt32(ddlSite.SelectedValue);
        obj.SiteMachineID = Convert.ToInt32(ddlMachine.SelectedValue);
        obj.PORefNo       = txtRefNo.Text;
        obj.PODate        = txtPODate.Text;
        obj.IndentRefNo   = txtIndentRef.Text;
        obj.QuotationNo   = txtQuotationNo.Text;
        obj.QuotationDate = txtQuotationDate.Text;
        obj.Subject       = txtSubject.Text;
        obj.PreparedBy    = Convert.ToInt32(hdPreparedBy.Value);
        obj.CheckedBy     = Convert.ToInt32(hdCheckedBy.Value);
        obj.CompanySign   = "";
        try { obj.TotalAmount = Convert.ToDouble(txtTotalAmount.Text); }
        catch { }
        string Tax = ddlTax.SelectedValue.ToString();

        obj.CGST = Convert.ToDouble(Tax.Substring(0, Tax.IndexOf(":")));
        Tax      = Tax.Substring(Tax.IndexOf(":") + 1);
        obj.SGST = Convert.ToDouble(Tax.Substring(0, Tax.IndexOf(":")));
        Tax      = Tax.Substring(Tax.IndexOf(":") + 1);
        obj.IGST = Convert.ToDouble(Tax);
        if (chkIGST.Checked == true)
        {
            obj.CGST = 0;
            obj.SGST = 0;
        }
        else
        {
            obj.IGST = 0;
        }
        obj.DiscountPercentage = Convert.ToDouble(txtDiscount.Text);
        try { obj.NetPayable = Convert.ToDouble(txtPayable.Text); }
        catch { }
        obj.Status = Convert.ToInt32(ddlStatus.SelectedValue);
        try { obj.POTo = Convert.ToInt32(ddlPOTo.SelectedValue); }
        catch { }
        try { obj.POFile = UploadPhoto(file); }
        catch { }
        obj.Op = 1;
        obj.PurchaseOrderMaster(obj);
        obj.Op = 8;
        DataTable dt = obj.PurchaseOrderMaster(obj).Tables[0];

        SavePOItems(Convert.ToInt32(dt.Rows[0][0]));
        ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('Saved');", true);
        Response.Redirect("PurchaseOrder.aspx");
    }
    void LoadPurchaseOrder()
    {
        clsPurchaseOrder obj = new clsPurchaseOrder();

        obj.Op = 3;
        obj.ID = Convert.ToInt32(Request.QueryString["ID"]);
        DataTable dt = obj.PurchaseOrderMaster(obj).Tables[0];

        lblRefNo.Text       = dt.Rows[0]["PORefNo"].ToString();
        lblPODate.Text      = Convert.ToDateTime(dt.Rows[0]["PODate"]).ToShortDateString();
        lblIndentRefNo.Text = dt.Rows[0]["IndentRefNo"].ToString();
        lblNetPayable.Text  = dt.Rows[0]["NetPayable"].ToString();
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         clsPurchaseOrder obj = new clsPurchaseOrder();
         obj.Op = 2;
         DataTable dt = obj.PurchaseOrderMaster(obj).Tables[0];
         grdPO.DataSource = dt;
         grdPO.DataBind();
         if (grdPO.Rows.Count > 0)
         {
             lblError.Text = "";
         }
         else
         {
             lblError.Text = "No Records Found";
         }
     }
 }
Exemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         clsPurchaseOrder obj = new clsPurchaseOrder();
         obj.Op     = 10;
         obj.SiteID = Convert.ToInt32(Request.Cookies["SiteID"].Value);
         DataTable dt = obj.PurchaseOrderMaster(obj).Tables[0];
         grdPO.DataSource = dt;
         grdPO.DataBind();
         if (grdPO.Rows.Count > 0)
         {
             lblError.Text = "";
         }
         else
         {
             lblError.Text = "No Records Found";
         }
     }
 }
Exemplo n.º 6
0
    protected void grdPO_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        clsPurchaseOrder obj = new clsPurchaseOrder();

        obj.ID = Convert.ToInt32(grdPO.DataKeys[e.RowIndex].Value);
        obj.Op = 3;
        DataTable dt = obj.PurchaseOrderMaster(obj).Tables[0];

        if (dt.Rows[0]["POFile"].ToString() != "")
        {
            Response.ContentType = "Application/pdf";
            Response.AppendHeader("Content-Disposition", "attachment; filename=" + dt.Rows[0]["POFile"].ToString());
            Response.TransmitFile(MapPath("~/" + dt.Rows[0]["POFile"].ToString()));
            Response.End();
        }
        else
        {
            Response.Redirect("POTerms.aspx?ID=" + grdPO.DataKeys[e.RowIndex].Value.ToString());
        }
    }
Exemplo n.º 7
0
 /*
  * Op=1 Insert Data
  * Op=2 Read All Data
  * Op=3 Read Data By ID
  * Op=4 Change Status
  * Op=5 Search By Quotation Date
  * Op=6 Search By Purchase Order Date
  * Op=7 Search By Status
  * Op=8 Read Max ID by Prepared by
  */
 //ID, PORefNo, PODate, IndentRefNo, QuotationNo, QuotationDate, Subject, PreparedBy, CheckedBy, CompanySign, TotalAmount, TaxName,
 //TaxPercentage, DiscountPercentage, NetPayable,Status
 public DataSet PurchaseOrderMaster(clsPurchaseOrder obj)
 {
     try
     {
         connect();
         SqlParameter[] param = new SqlParameter[22];
         param[0]  = new SqlParameter("@ID", obj._ID);
         param[1]  = new SqlParameter("@SiteID", obj._SiteID);
         param[2]  = new SqlParameter("@SiteMachineID", obj._SiteMachineID);
         param[3]  = new SqlParameter("@PORefNo", obj._PORefNo);
         param[4]  = new SqlParameter("@PODate", obj._PODate);
         param[5]  = new SqlParameter("@IndentRefNo", obj._IndentRefNo);
         param[6]  = new SqlParameter("@QuotationNo", obj._QuotationNo);
         param[7]  = new SqlParameter("@QuotationDate", obj._QuotationDate);
         param[8]  = new SqlParameter("@Subject", obj._Subject);
         param[9]  = new SqlParameter("@PreparedBy", obj._PreparedBy);
         param[10] = new SqlParameter("@CheckedBy", obj._CheckedBy);
         param[11] = new SqlParameter("@CompanySign", obj._CompanySign);
         param[12] = new SqlParameter("@TotalAmount", obj._TotalAmount);
         param[13] = new SqlParameter("@CGST", obj._CGST);
         param[14] = new SqlParameter("@SGST", obj._SGST);
         param[15] = new SqlParameter("@IGST", obj._IGST);
         param[16] = new SqlParameter("@DiscountPercentage", obj._DiscountPercentage);
         param[17] = new SqlParameter("@NetPayable", obj._NetPayable);
         param[18] = new SqlParameter("@Status", obj._Status);
         param[19] = new SqlParameter("@POTo", obj._POTo);
         param[20] = new SqlParameter("@POFile", obj._POFile);
         param[21] = new SqlParameter("@Op", obj._Op);
         DataSet ds = SqlHelper.ExecuteDataset(co, "procPurchaseOrderMaster", param);
         return(ds);
     }
     catch
     {
         return(null);
     }
     finally
     {
         co.Close();
     }
 }
    void LoadOrder()
    {
        clsIndent        obIndent   = new clsIndent();
        clsCustomer      obCustomer = new clsCustomer();
        clsSite          obSite     = new clsSite();
        clsPurchaseOrder obPO       = new clsPurchaseOrder();
        clsPOParticulars obPOP      = new clsPOParticulars();
        clsPOTerms       obPOT      = new clsPOTerms();
        clsUser          obU        = new clsUser();
        clsCompany       obC        = new clsCompany();
        clsSiteMachines  obSM       = new clsSiteMachines();
        DataTable        dtCustomer;

        //Company Detail
        obC.Op = 3;
        DataTable dtCompany = obC.CompanyMster(obC).Tables[0];

        //Purchase Order Detail
        obPO.Op = 3;
        obPO.ID = Convert.ToInt32(Request.QueryString["ID"]);
        DataTable dtPO = obPO.PurchaseOrderMaster(obPO).Tables[0];

        //Indent detail
        obIndent.RefNo = dtPO.Rows[0]["IndentRefNo"].ToString();
        obIndent.Op    = 8;
        DataTable dtIndent = obIndent.IndentMaster(obIndent).Tables[0];

        //Purchase Order Particulars
        obPOP.POID = Convert.ToInt32(Request.QueryString["ID"]);
        obPOP.Op   = 2;
        DataTable dtPOItems = obPOP.POParticularsMaster(obPOP).Tables[0];

        //Purchase Order terms
        obPOT.POID = Convert.ToInt32(Request.QueryString["ID"]);
        obPOT.Op   = 3;
        DataTable dtPOTerms = obPOT.POTermsMaster(obPOT).Tables[0];

        //User Detail
        obU.Op = 5;
        obU.ID = Convert.ToInt32(dtPO.Rows[0]["PreparedBy"]);
        DataTable dtPreparedBy = obU.UserMaster(obU).Tables[0];

        obU.ID = Convert.ToInt32(dtPO.Rows[0]["CheckedBy"]);
        DataTable dtCheckedBy = obU.UserMaster(obU).Tables[0];

        //Site Detail
        obSite.Op  = 5;
        obSite.ID  = Convert.ToInt32(dtPO.Rows[0]["SiteID"]);
        dtCustomer = obSite.SiteMaster(obSite).Tables[0];

        //Machine Detail
        obSM.Op = 5;
        obSM.ID = Convert.ToInt32(dtPO.Rows[0]["SiteMachineID"]);
        DataTable dtSM = obSM.SiteMachines(obSM).Tables[0];
        //Machine Detail
        LiteralControl lc = new LiteralControl();

        lc.Text = "";
        lc.Text = lc.Text + "<div class='col-lg-12'>";
        lc.Text = lc.Text + "<div class='col-lg-9'>";
        lc.Text = lc.Text + "<h3>" + dtCompany.Rows[0]["Name"] + "<br>" + dtCompany.Rows[0]["Address"].ToString().Replace("\n", "<br>") + "</h3>";
        lc.Text = lc.Text + "<h4>TIN:" + dtCompany.Rows[0]["Tin"] + "<br>CST:" + dtCompany.Rows[0]["Cst"] + "</h4>";
        lc.Text = lc.Text + "</div>";
        lc.Text = lc.Text + "<div class='col-lg-3'>";

        lc.Text = lc.Text + "<img src='../" + dtCompany.Rows[0]["Logo"] + "' height='150' width='150' />";

        lc.Text = lc.Text + "</div>";
        lc.Text = lc.Text + "</div>";
        lc.Text = lc.Text + "<div class='col-lg-12'>";
        lc.Text = lc.Text + "<center><h4><b>Purchase Order</b></h4></center>";
        lc.Text = lc.Text + "</div>";
        lc.Text = lc.Text + "<div class='col-lg-12'>";
        lc.Text = lc.Text + "<div class='col-lg-9'>";
        lc.Text = lc.Text + "PO Ref No: " + dtPO.Rows[0]["PORefNo"] + "<br />";
        lc.Text = lc.Text + "To,<br />";
        lc.Text = lc.Text + dtCustomer.Rows[0]["Name"] + "<br>";
        lc.Text = lc.Text + dtCustomer.Rows[0]["Location"] + "<br>";
        lc.Text = lc.Text + dtCustomer.Rows[0]["Address"].ToString().Replace("\n", "<br>") + "<br>";
        if (dtCustomer.Rows[0]["PhoneNo"].ToString() != "")
        {
            lc.Text = lc.Text + "Phone No:" + dtCustomer.Rows[0]["PhoneNo"] + "<br>";
        }
        if (dtCustomer.Rows[0]["Email"].ToString() != "")
        {
            lc.Text = lc.Text + "Email ID:" + dtCustomer.Rows[0]["Email"] + "<br>";
        }

        lc.Text = lc.Text + "</div>";
        lc.Text = lc.Text + "<div class='col-lg-3'>";
        lc.Text = lc.Text + "Date:" + Convert.ToDateTime(dtPO.Rows[0]["PODate"]).ToShortDateString();
        lc.Text = lc.Text + "</div>";
        lc.Text = lc.Text + "</div>";
        lc.Text = lc.Text + "<div class='col-lg-12'>";
        lc.Text = lc.Text + "<div class='col-lg-4'>Machine: " + dtSM.Rows[0]["Machine"] + "</div>";
        lc.Text = lc.Text + "<div class='col-lg-4'>Log No: " + dtSM.Rows[0]["SerialNo"] + "</div>";
        lc.Text = lc.Text + "<div class='col-lg-4'>Registration No: " + dtSM.Rows[0]["RegistrationNo"] + "</div>";
        lc.Text = lc.Text + "</div>";
        lc.Text = lc.Text + "<div class='col-lg-12'>";
        lc.Text = lc.Text + "<table width='95%' align='center' border='1'><tr><td>";
        lc.Text = lc.Text + "Quotation No:" + dtPO.Rows[0]["QuotationNo"] + "<br />";
        lc.Text = lc.Text + "Date:" + Convert.ToDateTime(dtPO.Rows[0]["QuotationDate"]).ToShortDateString();
        lc.Text = lc.Text + "</td>";
        lc.Text = lc.Text + "<td>";
        if (dtIndent.Rows.Count > 0)
        {
            lc.Text = lc.Text + "Indent Date:" + Convert.ToDateTime(dtIndent.Rows[0]["IndentDate"]).ToShortDateString();
        }
        lc.Text = lc.Text + "</td>";
        lc.Text = lc.Text + "</tr></table>";
        lc.Text = lc.Text + "<div class='col-lg-12'>";
        lc.Text = lc.Text + "<div class='col-lg-12'>";
        lc.Text = lc.Text + "Subject:" + dtPO.Rows[0]["Subject"];
        lc.Text = lc.Text + "</div>";
        lc.Text = lc.Text + "<div class='col-lg-12'>";
        lc.Text = lc.Text + txtMessage.Text.Replace("\n", "<br>");
        lc.Text = lc.Text + "</div>";
        lc.Text = lc.Text + "</div>";
        lc.Text = lc.Text + "<div class='col-lg-12' style='min-height:300'>";
        //Items//
        lc.Text = lc.Text + "<table width='98%' border='1' align='center'>";
        lc.Text = lc.Text + "<tr><td>Serial No</td><td>Part No</td><td>Item</td><td>Current Stock</td><td>Quantity</td><td>UOM</td><td>Remarks</td><td>Rate</td><td>Tax</td><td>Amount</td></tr>";
        int i = 0;

        foreach (DataRow drItems in dtPOItems.Rows)
        {
            i++;
            lc.Text = lc.Text + "<tr>";
            lc.Text = lc.Text + "<td>" + i.ToString() + "</td>";
            lc.Text = lc.Text + "<td>" + drItems["PartNo"] + "</td>";
            lc.Text = lc.Text + "<td>" + drItems["Item"].ToString().Replace("\n", "<br>") + "</td>";
            lc.Text = lc.Text + "<td>" + drItems["CurrentStock"] + "</td>";
            lc.Text = lc.Text + "<td>" + drItems["Qty"] + "</td>";
            lc.Text = lc.Text + "<td>" + drItems["UGM"] + "</td>";
            lc.Text = lc.Text + "<td>" + drItems["Remark"] + "</td>";
            lc.Text = lc.Text + "<td>" + drItems["Rate"] + "</td>";
            lc.Text = lc.Text + "<td>" + drItems["Tax"] + " %</td>";
            lc.Text = lc.Text + "<td width='75' align='right'>" + drItems["Amount"] + "</td>";
            lc.Text = lc.Text + "</tr>";
        }
        lc.Text = lc.Text + "</table>";
        lc.Text = lc.Text + "<table width='98%' align='center'>";
        lc.Text = lc.Text + "<tr><td colspan='9' align='right'>Total Amount</td><td width='50'></td><td width='75' align='right'>" + dtPO.Rows[0]["TotalAmount"] + "</td></tr>";
        lc.Text = lc.Text + "<tr><td colspan='9' align='right'>" + dtPO.Rows[0]["TaxName"] + "</td><td></td><td align='right'>" + (Convert.ToDouble(dtPO.Rows[0]["TotalAmount"]) * Convert.ToDouble(dtPO.Rows[0]["TaxPercentage"]) / 100).ToString() + "</td></tr>";
        lc.Text = lc.Text + "<tr><td colspan='9' align='right'>Discount " + dtPO.Rows[0]["DiscountPercentage"] + "%</td><td></td><td align='right'>" + (Convert.ToDouble(dtPO.Rows[0]["TotalAmount"]) * Convert.ToDouble(dtPO.Rows[0]["DiscountPercentage"]) / 100).ToString() + "</td></tr>";
        lc.Text = lc.Text + "<tr><td colspan='9' align='right'>Net Payable</td><td></td><td align='right'>" + dtPO.Rows[0]["NetPayable"] + "</td></tr>";
        lc.Text = lc.Text + "</table>";
        //Items
        lc.Text = lc.Text + "</div>";
        lc.Text = lc.Text + "<div class='col-lg-12'><h4><i>Terms & Conditions:</i></h4><br>";
        //Terms
        lc.Text = lc.Text + "<table width='98%' border='1' align='center'>";
        foreach (DataRow drTerms in dtPOTerms.Rows)
        {
            lc.Text = lc.Text + "<tr><td>" + drTerms["Heading"] + "</td><td>" + drTerms["Detail"] + "</td></tr>";
        }
        lc.Text = lc.Text + "</table>";
        //Terms
        lc.Text = lc.Text + "</div>";
        lc.Text = lc.Text + "<div class='col-lg-12'><br><br>";
        lc.Text = lc.Text + "</div>";
        lc.Text = lc.Text + "<div class='col-lg-12'>";
        lc.Text = lc.Text + "<table width='98%' border='1' align='center'>";
        lc.Text = lc.Text + "<tr height='100'><td width='25%'>";


        lc.Text = lc.Text + "<img src='../" + dtPreparedBy.Rows[0]["Signature"] + "' height='50' width='120'/>";

        lc.Text = lc.Text + "<br>Prepared By</td>";
        lc.Text = lc.Text + "<td width='25%'>";

        lc.Text = lc.Text + "<img src='../" + dtCheckedBy.Rows[0]["Signature"] + "' height='50' width='120'/>";

        lc.Text = lc.Text + "<br>Checked By</td>";
        lc.Text = lc.Text + "<td width='48%'><center>Authorized Signatory<br /><br /><br />" + dtCompany.Rows[0]["Name"] + "</center></td></tr></table>";
        lc.Text = lc.Text + "</div>";
        Label lb = new Label();

        lb.Text = lc.ToString();
        pnlDetail.Controls.Add(lc);
    }
    void LoadOrderForPDF()
    {
        clsIndent        obIndent   = new clsIndent();
        clsCustomer      obCustomer = new clsCustomer();
        clsSite          obSite     = new clsSite();
        clsPurchaseOrder obPO       = new clsPurchaseOrder();
        clsPOParticulars obPOP      = new clsPOParticulars();
        clsPOTerms       obPOT      = new clsPOTerms();
        clsUser          obU        = new clsUser();
        clsCompany       obC        = new clsCompany();
        clsSiteMachines  obSM       = new clsSiteMachines();
        DataTable        dtCustomer;

        //Company Detail
        obC.Op = 3;
        DataTable dtCompany = obC.CompanyMster(obC).Tables[0];

        //Purchase Order Detail
        obPO.Op = 3;
        obPO.ID = Convert.ToInt32(Request.QueryString["ID"]);
        DataTable dtPO = obPO.PurchaseOrderMaster(obPO).Tables[0];

        //Indent detail
        obIndent.RefNo = dtPO.Rows[0]["IndentRefNo"].ToString();
        obIndent.Op    = 8;
        DataTable dtIndent = obIndent.IndentMaster(obIndent).Tables[0];

        //Purchase Order Particulars
        obPOP.POID = Convert.ToInt32(Request.QueryString["ID"]);
        obPOP.Op   = 2;
        DataTable dtPOItems = obPOP.POParticularsMaster(obPOP).Tables[0];

        //Purchase Order terms
        obPOT.POID = Convert.ToInt32(Request.QueryString["ID"]);
        obPOT.Op   = 3;
        DataTable dtPOTerms = obPOT.POTermsMaster(obPOT).Tables[0];

        //User Detail
        obU.Op = 5;
        obU.ID = Convert.ToInt32(dtPO.Rows[0]["PreparedBy"]);
        DataTable dtPreparedBy = obU.UserMaster(obU).Tables[0];

        obU.ID = Convert.ToInt32(dtPO.Rows[0]["CheckedBy"]);
        DataTable dtCheckedBy = obU.UserMaster(obU).Tables[0];

        //Site Detail
        obSite.Op  = 5;
        obSite.ID  = Convert.ToInt32(dtPO.Rows[0]["SiteID"]);
        dtCustomer = obSite.SiteMaster(obSite).Tables[0];

        //Machine Detail
        obSM.Op = 5;
        obSM.ID = Convert.ToInt32(dtPO.Rows[0]["SiteMachineID"]);
        DataTable dtSM = obSM.SiteMachines(obSM).Tables[0];
        //Machine Detail
        //Purchase Order To detail//
        clsCustomer ObPOTo = new clsCustomer();

        ObPOTo.Op = 4;
        ObPOTo.ID = Convert.ToInt32(dtPO.Rows[0]["POTo"]);
        DataTable dtPOTo = ObPOTo.CustomerMaster(ObPOTo).Tables[0];
        //Purchase order to detail//
        LiteralControl lc = new LiteralControl();

        lc.Text = "<div style='width:100%; margin:50 padding:50;'>";
        lc.Text = lc.Text + "<table width='100%' style='font-size:8'>";
        lc.Text = lc.Text + "<tr><td align='left' colspan='9'>";
        lc.Text = lc.Text + "<h5>" + dtCompany.Rows[0]["Name"] + "<br>" + dtCompany.Rows[0]["Address"].ToString().Replace("\n", "<br>") + "</h5>";
        lc.Text = lc.Text + "<h6>TIN:" + dtCompany.Rows[0]["Tin"] + "<br>CST:" + dtCompany.Rows[0]["Cst"] + "</h6>";
        lc.Text = lc.Text + "</td>";
        lc.Text = lc.Text + "<td align='right' colspan='3'>";
        try
        {
            lc.Text = lc.Text + "<img src='" + MapPath("~/" + dtCompany.Rows[0]["Logo"]) + "' height='100' width='100' />";
        }
        catch
        {
            lc.Text = lc.Text + "<img src='" + MapPath("~/" + dtCompany.Rows[0]["Logo"]) + "' height='100' width='100' />";
        }
        lc.Text = lc.Text + "</td></tr>";

        lc.Text = lc.Text + "<tr><td align='center' colspan='12'><h5><b>Purchase Order</b></h5></td></tr>";

        lc.Text = lc.Text + "<tr><td align='left' colspan='6'>";
        lc.Text = lc.Text + "PO Ref No: " + dtPO.Rows[0]["PORefNo"] + "<br />";
        lc.Text = lc.Text + "To,<br />";
        lc.Text = lc.Text + dtCustomer.Rows[0]["Name"] + "<br>";
        lc.Text = lc.Text + dtCustomer.Rows[0]["Location"] + "<br>";
        lc.Text = lc.Text + dtCustomer.Rows[0]["Address"].ToString().Replace("\n", "<br>") + "<br>";
        if (dtCustomer.Rows[0]["PhoneNo"].ToString() != "")
        {
            lc.Text = lc.Text + "Phone No:" + dtCustomer.Rows[0]["PhoneNo"] + "<br>";
        }
        if (dtCustomer.Rows[0]["Email"].ToString() != "")
        {
            lc.Text = lc.Text + "Email ID:" + dtCustomer.Rows[0]["Email"] + "<br>";
        }
        if (dtPOTo.Rows.Count > 0)
        {
            lc.Text = lc.Text + "<b>Purchase Order To,</b><br>";
            lc.Text = lc.Text + dtPOTo.Rows[0]["Name"].ToString() + "<br>";
            lc.Text = lc.Text + "Phone No:" + dtPOTo.Rows[0]["Phone"].ToString() + "<br>";
            lc.Text = lc.Text + dtPOTo.Rows[0]["Address"].ToString().Replace("\n", "<br>");
        }

        lc.Text = lc.Text + "</td>";
        lc.Text = lc.Text + "<td align='right' colspan='6'>";
        lc.Text = lc.Text + "Date:" + Convert.ToDateTime(dtPO.Rows[0]["PODate"]).ToShortDateString();
        lc.Text = lc.Text + "</td></tr>";
        lc.Text = lc.Text + "<tr><td colspan='12'><br></td></tr>";
        lc.Text = lc.Text + "<tr><td colspan='4'>Machine: " + dtSM.Rows[0]["Machine"] + "</td><td colspan='4'>Log No: " + dtSM.Rows[0]["SerialNo"] + "</td><td colspan='4'>Registration No: " + dtSM.Rows[0]["RegistrationNo"] + "</td></tr>";
        lc.Text = lc.Text + "<tr><td colspan='12'>";
        lc.Text = lc.Text + "<table width='100%' align='center' border='1'><tr align='left'><td colspan='6'>";
        lc.Text = lc.Text + "Quotation No:" + dtPO.Rows[0]["QuotationNo"] + "<br />";
        lc.Text = lc.Text + "Date:" + Convert.ToDateTime(dtPO.Rows[0]["QuotationDate"]).ToShortDateString();
        lc.Text = lc.Text + "</td>";
        lc.Text = lc.Text + "<td colspan='6'>";
        if (dtIndent.Rows.Count > 0)
        {
            lc.Text = lc.Text + "Indent Date:" + Convert.ToDateTime(dtIndent.Rows[0]["IndentDate"]).ToShortDateString();
        }
        lc.Text = lc.Text + "</td>";
        lc.Text = lc.Text + "</tr></table></td></tr>";

        lc.Text = lc.Text + "<tr><td align='left' colspan='12'>Subject:" + dtPO.Rows[0]["Subject"] + "</td></tr>";

        lc.Text = lc.Text + "<tr><td align='left' colspan='12'>";
        lc.Text = lc.Text + txtMessage.Text.Replace("\n", "<br>");
        lc.Text = lc.Text + "</td></tr>";
        lc.Text = lc.Text + "</table>";
        /*TEST*/
        lc.Text = lc.Text + "<table width='100%' style='font-size:8' border='1'>";
        lc.Text = lc.Text + "<tr align='left'><td>SL</td><td>Part No</td><td colspan='2'>Item</td><td>Stock</td><td>Qty</td><td>UOM</td><td>Rate</td><td>Tax</td><td>Amount</td><td colspan='2'>Remarks</td></tr>";
        int i = 0;

        foreach (DataRow drItems in dtPOItems.Rows)
        {
            i++;
            lc.Text = lc.Text + "<tr align='left'><td>" + i.ToString() + "</td>";
            lc.Text = lc.Text + "<td>" + drItems["PartNo"] + "</td>";
            lc.Text = lc.Text + "<td colspan='2'>" + drItems["Item"] + "</td>";
            lc.Text = lc.Text + "<td>" + drItems["CurrentStock"] + "</td>";
            lc.Text = lc.Text + "<td>" + drItems["Qty"] + "</td>";
            lc.Text = lc.Text + "<td>" + drItems["UGM"] + "</td>";
            lc.Text = lc.Text + "<td>" + drItems["Rate"] + "</td>";
            lc.Text = lc.Text + "<td>" + drItems["Tax"] + "</td>";
            lc.Text = lc.Text + "<td>" + drItems["Amount"] + "</td>";
            lc.Text = lc.Text + "<td colspan='2'>" + drItems["Remark"] + "</td></tr>";
        }
        lc.Text = lc.Text + "</table>";
        lc.Text = lc.Text + "<table width='100%' style='font-size:8'>";

        lc.Text = lc.Text + "</table>";
        lc.Text = lc.Text + "<table width='100%' style='font-size:8'>";
        lc.Text = lc.Text + "<tr><td colspan='12'><h6>Summery</h6></td></tr>";
        lc.Text = lc.Text + "<tr><td colspan='8' align='right'>Total Amount</td><td></td><td align='right' colspan='3'>" + dtPO.Rows[0]["TotalAmount"] + "/- INR</td></tr>";
        lc.Text = lc.Text + "<tr><td colspan='8' align='right'>" + dtPO.Rows[0]["TaxName"] + "</td><td></td><td align='right' colspan='3'>" + (Convert.ToDouble(dtPO.Rows[0]["TotalAmount"]) * Convert.ToDouble(dtPO.Rows[0]["TaxPercentage"]) / 100).ToString() + "/- INR</td></tr>";
        lc.Text = lc.Text + "<tr><td colspan='8' align='right'>Discount " + dtPO.Rows[0]["DiscountPercentage"] + "%</td><td></td><td align='right' colspan='3'>" + (Convert.ToDouble(dtPO.Rows[0]["TotalAmount"]) * Convert.ToDouble(dtPO.Rows[0]["DiscountPercentage"]) / 100).ToString() + "/-INR</td></tr>";
        lc.Text = lc.Text + "<tr><td colspan='8' align='right'>Net Payable</td><td></td><td align='right' colspan='3'>" + dtPO.Rows[0]["NetPayable"] + "/-INR</td></tr>";
        lc.Text = lc.Text + "</table>";
        /*TEST*/
        lc.Text = lc.Text + "<table width='100%' style='font-size:8' border='1'>";

        //----------------
        lc.Text = lc.Text + "<tr><td colspan='12' align='left'><h6><i>Terms & Conditions:</i></h6></td></tr>";
        //Terms
        lc.Text = lc.Text + "</table>";
        lc.Text = lc.Text + "<table width='100%' style='font-size:8' border='1'>";
        foreach (DataRow drTerms in dtPOTerms.Rows)
        {
            lc.Text = lc.Text + "<tr align='left'><td colspan='3'>" + drTerms["Heading"] + "</td><td colspan='9'>" + drTerms["Detail"] + "</td></tr>";
        }
        lc.Text = lc.Text + "</table>";

        //Terms
        lc.Text = lc.Text + "<table width='100%' style='font-size:8'>";
        lc.Text = lc.Text + "<tr><td colspan='12' align='center'><br><br></td></tr>";
        lc.Text = lc.Text + "<tr height='100'><td colspan='4'>";

        if (dtPreparedBy.Rows[0]["Signature"].ToString().Trim() != "")
        {
            lc.Text = lc.Text + "<img src='" + MapPath("~/" + dtPreparedBy.Rows[0]["Signature"]) + "' height='50' width='120'/>";
        }
        lc.Text = lc.Text + "<br>Prepared By</td>";
        lc.Text = lc.Text + "<td colspan='4' align='center'>";
        if (dtCheckedBy.Rows[0]["Signature"].ToString().Trim() != "")
        {
            lc.Text = lc.Text + "<img src='" + MapPath("~/" + dtCheckedBy.Rows[0]["Signature"]) + "' height='50' width='120'/>";
        }

        lc.Text = lc.Text + "<br>Checked By</td>";
        lc.Text = lc.Text + "<td colspan='4' align='right'>Authorized Signatory<br /><br /><br />" + dtCompany.Rows[0]["Name"] + "</td></tr>";
        lc.Text = lc.Text + "</table>";
        lc.Text = lc.Text + "</div>";
        Label lb = new Label();

        lb.Text = lc.ToString();
        pnlDetail.Controls.Add(lc);
    }