protected void btnSave_Click(object sender, EventArgs e)
 {
     if (hdApprovedBy.Value != "" && hdIndentor.Value != "")
     {
         clsIndent obj = new clsIndent();
         obj.Op            = 1;
         obj.OrderFrom     = 1;
         obj.OrderFromID   = Convert.ToInt32(Request.Cookies["SiteID"].Value);
         obj.SiteMachineID = Convert.ToInt32(ddlIMachine.SelectedValue);
         obj.UserID        = Convert.ToInt32(Request.Cookies["User"].Value);
         obj.RefNo         = txtReferenceNo.Text;
         try { obj.ProjectNo = ddlProject.SelectedItem.Text; }
         catch { }
         try { obj.JobNo = ddlJob.SelectedItem.Text; }
         catch { }
         obj.IndentDate = txtIndentDate.Text;
         obj.Indentor   = Convert.ToInt32(hdIndentor.Value);
         obj.ApprovedBy = Convert.ToInt32(hdApprovedBy.Value);
         obj.Status     = 1;
         obj.IndentMaster(obj);
         obj.Op = 6;
         DataTable dt    = obj.IndentMaster(obj).Tables[0];
         int       MaxID = Convert.ToInt16(dt.Rows[0][0]);
         AddTempItemsToIndent(MaxID);
         SaveIssueList(MaxID);
         ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('Saved');", true);
         Response.Redirect("Indent.aspx");
     }
 }
    protected void btnApprove_Click(object sender, EventArgs e)
    {
        clsIndent obj = new clsIndent();

        obj.Op         = 10;
        obj.ID         = Convert.ToInt32(Request.QueryString["ID"]);
        obj.Status     = 1;
        obj.ApprovedBy = Convert.ToInt32(hdApprovedBy.Value);
        obj.IndentMaster(obj);
        obj.Op = 4;
        DataTable      dt   = obj.IndentMaster(obj).Tables[0];
        clsIndentItems obII = new clsIndentItems();

        obII.IndentID = Convert.ToInt32(Request.QueryString["ID"]);
        obII.Op       = 3;
        DataTable dtItems = obII.IndentItemMaster(obII).Tables[0];

        if (dtItems.Rows.Count > 0)
        {
            /*Add To Issue*/
            clsSitePartIssue obSPI = new clsSitePartIssue();
            obSPI.SiteID        = Convert.ToInt32(dt.Rows[0]["SiteID"]);
            obSPI.SiteMachineID = Convert.ToInt32(dt.Rows[0]["SiteMachineID"]);
            obSPI.IndentRef     = dt.Rows[0]["RefNo"].ToString();
            obSPI.Op            = 1;
            /*Stock Management Entry*/
            clsSiteProductParts obSPP = new clsSiteProductParts();
            obSPP.SiteID          = Convert.ToInt32(dt.Rows[0]["SiteID"]);
            obSPP.SiteMachineID   = Convert.ToInt32(dt.Rows[0]["SiteMachineID"]);
            obSPP.BillRef         = dt.Rows[0]["RefNo"].ToString();
            obSPP.Remarks         = "Issued Against Indent";
            obSPP.Op              = 1;
            obSPP.TransactionType = 2;
            foreach (DataRow dr in dtItems.Rows)
            {
                obSPI.PartID   = Convert.ToInt32(dr["PartID"]);
                obSPI.PartNo   = dr["PartNo"].ToString();
                obSPI.PartName = dr["PartName"].ToString();
                obSPI.Price    = Convert.ToDouble(dr["Price"]);
                if (Convert.ToInt32(dr["Quantity"]) > Convert.ToInt32(dr["CurrentStock"]))
                {
                    obSPI.Quantity = Convert.ToInt32(dr["CurrentStock"]);
                    obSPP.Quantity = Convert.ToInt32(dr["CurrentStock"]);
                }
                else
                {
                    obSPI.Quantity = Convert.ToInt32(dr["Quantity"]);
                    obSPP.Quantity = Convert.ToInt32(dr["Quantity"]);
                }
                obSPI.SitePartIssue(obSPI);
                obSPP.PartID = Convert.ToInt32(dr["PartID"]);
                try { obSPP.Rate = Convert.ToDouble(dr["Price"]); }
                catch { }
                obSPP.Total = obSPP.Rate * obSPP.Quantity;
                obSPP.SiteProductParts(obSPP);
            }
        }
        LoadOrder();
    }
    void SaveIssueList(int IndentID)
    {
        clsIndent obj = new clsIndent();

        obj.ID = IndentID;
        obj.Op = 4;
        DataTable      dt   = obj.IndentMaster(obj).Tables[0];
        clsIndentItems obII = new clsIndentItems();

        obII.IndentID = IndentID;
        obII.Op       = 3;
        DataTable dtItems = obII.IndentItemMaster(obII).Tables[0];

        if (dtItems.Rows.Count > 0)
        {
            /*Add To Issue*/
            clsSitePartIssue obSPI = new clsSitePartIssue();
            obSPI.SiteID        = Convert.ToInt32(dt.Rows[0]["SiteID"]);
            obSPI.SiteMachineID = Convert.ToInt32(dt.Rows[0]["SiteMachineID"]);
            obSPI.IndentRef     = dt.Rows[0]["RefNo"].ToString();
            obSPI.Op            = 1;
            /*Stock Management Entry*/
            clsSiteProductParts obSPP = new clsSiteProductParts();
            obSPP.SiteID          = Convert.ToInt32(dt.Rows[0]["SiteID"]);
            obSPP.SiteMachineID   = Convert.ToInt32(dt.Rows[0]["SiteMachineID"]);
            obSPP.BillRef         = dt.Rows[0]["RefNo"].ToString();
            obSPP.Remarks         = "Issued Against Indent";
            obSPP.Op              = 1;
            obSPP.TransactionType = 2;
            foreach (DataRow dr in dtItems.Rows)
            {
                try
                {
                    obSPI.PartID   = Convert.ToInt32(dr["PartID"]);
                    obSPI.PartNo   = dr["PartNo"].ToString();
                    obSPI.PartName = dr["PartName"].ToString();
                    obSPI.Price    = Convert.ToDouble(dr["Price"]);
                    if (Convert.ToInt32(dr["Quantity"]) > Convert.ToInt32(dr["CurrentStock"]))
                    {
                        obSPI.Quantity = Convert.ToInt32(dr["CurrentStock"]);
                        obSPP.Quantity = Convert.ToInt32(dr["CurrentStock"]);
                    }
                    else
                    {
                        obSPI.Quantity = Convert.ToInt32(dr["Quantity"]);
                        obSPP.Quantity = Convert.ToInt32(dr["Quantity"]);
                    }
                    obSPI.SitePartIssue(obSPI);
                    obSPP.PartID = Convert.ToInt32(dr["PartID"]);
                    try { obSPP.Rate = Convert.ToDouble(dr["Price"]); }
                    catch { }
                    obSPP.Total = obSPP.Rate * obSPP.Quantity;
                    obSPP.SiteProductParts(obSPP);
                }
                catch
                {
                }
            }
        }
    }
    protected void grdIndentRef_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        txtIndentRef.Text = grdIndentRef.Rows[e.RowIndex].Cells[0].Text;
        clsIndent objIndent = new clsIndent();

        objIndent.Op    = 7;
        objIndent.RefNo = txtIndentRef.Text.Trim();
        DataTable dtIndent = objIndent.IndentMaster(objIndent).Tables[0];

        if (dtIndent.Rows.Count > 0)
        {
            hdSiteID.Value = dtIndent.Rows[0]["OrderFromID"].ToString();
            ddlSite.Text   = dtIndent.Rows[0]["OrderFromID"].ToString();
        }
        else
        {
        }
        clsIndentItems obj = new clsIndentItems();

        obj.IndentID = Convert.ToInt32(grdIndentRef.DataKeys[e.RowIndex].Value);
        obj.Op       = 2;
        DataTable dt = obj.IndentItemMaster(obj).Tables[0];

        grdIndentItems.DataSource = dt;
        grdIndentItems.DataBind();
        grdIndentRef.Visible = false;
        LoadSiteMachines();
    }
    void LoadData()
    {
        clsIndent obj = new clsIndent();

        if (ddlSites.SelectedIndex == 0)
        {
            obj.Op = 3;
        }
        else
        {
            obj.Op          = 11;
            obj.OrderFrom   = 1;
            obj.OrderFromID = Convert.ToInt32(ddlSites.SelectedValue);
        }
        DataTable dt = obj.IndentMaster(obj).Tables[0];

        if (dt.Rows.Count == 0)
        {
            dt.Rows.Add(dt.NewRow());
            dt.Rows[0][4] = "No rows found";
        }
        grdIndent.DataSource = dt;
        grdIndent.DataBind();
        if (grdIndent.Rows.Count > 0)
        {
            lblError.Text = "";
        }
        else
        {
            lblError.Text = "No Records Found";
        }
    }
    public void GetIndentBySiteID(int SiteID)
    {
        clsIndent obj = new clsIndent();

        obj.OrderFromID = SiteID;
        obj.Op          = 11;
        DataTable dt = obj.IndentMaster(obj).Tables[0];

        Context.Response.Write(JsonConvert.SerializeObject(dt));
    }
    public void getLastIndentID(int UserID)
    {
        clsIndent obj = new clsIndent();

        obj.Op     = 6;
        obj.UserID = UserID;
        DataTable dt = obj.IndentMaster(obj).Tables[0];

        Context.Response.Write(JsonConvert.SerializeObject(dt));
    }
    protected void lnkEditItems_Click(object sender, EventArgs e)
    {
        LinkButton  lnkEditItems = sender as LinkButton;
        GridViewRow dr           = lnkEditItems.NamingContainer as GridViewRow;
        HiddenField hdID         = dr.FindControl("hdID") as HiddenField;
        clsIndent   obj          = new clsIndent();

        obj.ID = Convert.ToInt32(grdIndent.DataKeys[dr.RowIndex].Value);
        obj.Op = 4;
        DataTable dt = obj.IndentMaster(obj).Tables[0];

        Response.Redirect("EditIndentItems.aspx?IndentID=" + dt.Rows[0]["ID"] + "&SiteMachineID=" + dt.Rows[0]["SiteMachineID"] + "&Status=" + dt.Rows[0]["Status"] + "&SiteID=" + dt.Rows[0]["OrderFromID"]);
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        clsIndent obj = new clsIndent();

        obj.Op          = 1;
        obj.OrderFrom   = 1;
        obj.OrderFromID = Convert.ToInt32(Request.Cookies["SiteID"].Value);
        obj.UserID      = Convert.ToInt32(Request.Cookies["User"].Value);
        obj.RefNo       = lblRef.Text;
        obj.ProjectNo   = ddlProject.SelectedItem.Text;
        obj.JobNo       = ddlJob.SelectedItem.Text;
        obj.IndentDate  = txtDate.Text;
        obj.Indentor    = Convert.ToInt32(Request.Cookies["User"].Value);
        obj.ApprovedBy  = 0;
        obj.Status      = 0;
        obj.IndentMaster(obj);
        obj.Op = 6;
        DataTable dt    = obj.IndentMaster(obj).Tables[0];
        int       MaxID = Convert.ToInt16(dt.Rows[0][0]);

        AddTempItemsToIndent(MaxID);
        ClearTemp();
        Response.Redirect("Indent.aspx");
    }
예제 #10
0
    protected void txtEIndent_TextChanged(object sender, EventArgs e)
    {
        clsIndent obj = new clsIndent();

        obj.Op    = 7;
        obj.RefNo = txtEIndent.Text.Trim();
        DataTable dt = obj.IndentMaster(obj).Tables[0];

        if (dt.Rows.Count > 0)
        {
            hdEIndentID.Value = dt.Rows[0]["ID"].ToString();
            txtEIndent.Text   = txtEIndent.Text.Trim();
        }
        else
        {
            hdEIndentID.Value = "0";
        }
    }
    void LoadIndents()
    {
        clsIndent obj = new clsIndent();

        obj.Op = 3;
        DataTable dt = obj.IndentMaster(obj).Tables[0];

        grdIndent.DataSource = dt;
        grdIndent.DataBind();
        if (grdIndent.Rows.Count > 0)
        {
            lblError.Text = "";
        }
        else
        {
            lblError.Text = "No Records Found";
        }
    }
    public void GetIndentDetail(int IndentID)
    {
        clsIndent obj = new clsIndent();

        obj.ID = IndentID;
        obj.Op = 4;
        DataTable      dtIndent = obj.IndentMaster(obj).Tables[0];
        clsIndentItems obj1     = new clsIndentItems();

        obj1.IndentID = IndentID;
        obj1.Op       = 2;
        DataTable dtIndentItem = obj1.IndentItemMaster(obj1).Tables[0];

        DataTable[] dt = new DataTable[2];
        dt[0] = dtIndent;
        dt[1] = dtIndentItem;
        Context.Response.Write(JsonConvert.SerializeObject(dt));
    }
    void LoadIndents()
    {
        clsIndent obj = new clsIndent();

        obj.Op          = 11;
        obj.OrderFromID = Convert.ToInt32(Request.Cookies["SiteID"].Value);
        DataTable dt = obj.IndentMaster(obj).Tables[0];

        grdIndent.DataSource = dt;
        grdIndent.DataBind();
        if (grdIndent.Rows.Count > 0)
        {
            lblError.Text = "";
        }
        else
        {
            lblError.Text = "No Records Found";
        }
    }
    public void SaveIndent(int UserID, int OrderFrom, int OrderFromID, string RefNo, string ProjectNo, string JobNo, string IndentDate, int Indentor, int ApprovedBy, int Status, int SiteMachineID)
    {
        clsIndent obj = new clsIndent();

        obj.UserID        = UserID;
        obj.OrderFrom     = OrderFrom;
        obj.OrderFromID   = OrderFromID;
        obj.RefNo         = RefNo;
        obj.ProjectNo     = ProjectNo;
        obj.JobNo         = JobNo;
        obj.IndentDate    = IndentDate;
        obj.Indentor      = Indentor;
        obj.ApprovedBy    = ApprovedBy;
        obj.Status        = Status;
        obj.SiteMachineID = SiteMachineID;
        obj.Op            = 1;
        obj.IndentMaster(obj);
        Context.Response.Write(JsonConvert.SerializeObject("Saved"));
    }
    protected void txtIndentRef_TextChanged(object sender, EventArgs e)
    {
        clsIndent obj = new clsIndent();

        obj.Op    = 7;
        obj.RefNo = txtIndentRef.Text.Trim();
        DataTable dt = obj.IndentMaster(obj).Tables[0];

        grdIndentRef.DataSource = dt;
        grdIndentRef.DataBind();
        grdIndentRef.Visible = true;
        if (dt.Rows.Count > 0)
        {
            hdSiteID.Value = dt.Rows[0]["OrderFromID"].ToString();
            ddlSite.Text   = dt.Rows[0]["OrderFromID"].ToString();
        }
        else
        {
        }
        LoadSiteMachines();
    }
예제 #16
0
    protected void txtIndent_TextChange(object sender, EventArgs e)
    {
        TextBox   txtIndent = sender as TextBox;
        clsIndent obj       = new clsIndent();

        obj.Op    = 7;
        obj.RefNo = txtIndent.Text.Trim();
        DataTable   dt         = obj.IndentMaster(obj).Tables[0];
        GridViewRow dr         = txtIndent.NamingContainer as GridViewRow;
        HiddenField hdIndentID = dr.FindControl("hdIndentID") as HiddenField;

        if (dt.Rows.Count > 0)
        {
            hdIndentID.Value = dt.Rows[0]["ID"].ToString();
            txtIndent.Text   = txtIndent.Text.Trim();
        }
        else
        {
            hdIndentID.Value = "0";
        }
    }
    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);
    }
    void LoadOrder()
    {
        clsIndent      obIndent      = new clsIndent();
        clsCustomer    obCustomer    = new clsCustomer();
        clsSite        obSite        = new clsSite();
        clsIndentItems obIndentItems = new clsIndentItems();
        clsUser        obU           = new clsUser();
        clsCompany     obC           = new clsCompany();
        DataTable      dtCustomer;

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

        //Indent detail
        obIndent.ID = Convert.ToInt32(Request.QueryString["ID"]);
        obIndent.Op = 4;
        DataTable dtIndent = obIndent.IndentMaster(obIndent).Tables[0];

        //User Detail
        obU.Op = 5;
        obU.ID = Convert.ToInt32(dtIndent.Rows[0]["Indentor"]);
        DataTable dtIndentor = obU.UserMaster(obU).Tables[0];

        obU.ID = Convert.ToInt32(dtIndent.Rows[0]["ApprovedBy"]);
        DataTable dtApprovedBy = obU.UserMaster(obU).Tables[0];

        //Customer Detail
        if (Convert.ToInt32(dtIndent.Rows[0]["OrderFrom"]) == 1)
        {
            //Site Detail
            obSite.Op  = 5;
            obSite.ID  = Convert.ToInt32(dtIndent.Rows[0]["OrderFromID"]);
            dtCustomer = obSite.SiteMaster(obSite).Tables[0];
        }
        else
        {
            //Customer Detail
            obCustomer.ID = Convert.ToInt32(dtIndent.Rows[0]["OrderFromID"]);
            obCustomer.Op = 4;
            dtCustomer    = obCustomer.CustomerMaster(obCustomer).Tables[0];
        }
        //Indent Items
        obIndentItems.IndentID = Convert.ToInt32(Request.QueryString["ID"]);
        obIndentItems.Op       = 2;
        DataTable      dtIndentItems = obIndentItems.IndentItemMaster(obIndentItems).Tables[0];
        LiteralControl lc            = new LiteralControl();

        lc.Text = "";
        lc.Text = lc.Text + "<div class='row'>";
        lc.Text = lc.Text + "<div class='col-lg-12'><center><h3>" + dtCompany.Rows[0]["Name"] + "</h3></center></div>";
        lc.Text = lc.Text + "<div class='col-lg-12'><center>Project Name: " + dtIndent.Rows[0]["ProjectNo"] + "</center></div>";
        lc.Text = lc.Text + "<div class='col-lg-12'><center>Job No: " + dtIndent.Rows[0]["JobNo"] + "</center></div>";
        lc.Text = lc.Text + "<div class='col-lg-12'><center><h3><u>INDENT FORM</u></h3></center></div>";
        lc.Text = lc.Text + "<div class='col-lg-9'>Ref No:" + dtIndent.Rows[0]["RefNo"] + "</div>";
        lc.Text = lc.Text + "<div class='col-lg-3'>Date:" + Convert.ToDateTime(dtIndent.Rows[0]["IndentDate"]).ToShortDateString() + "</div>";
        lc.Text = lc.Text + "<div class='col-lg-12' style='height:50px'></div>";

        lc.Text = lc.Text + "<div class='col-lg-12' style='height:500px'>";
        //Items//
        lc.Text = lc.Text + "<table width='100%' border='1' align='center'>";
        lc.Text = lc.Text + "<tr><td>Serial No</td><td>Part No</td><td>Particular Description</td><td>Current Stock</td><td>Quantity</td><td>Remarks</td></tr>";
        int i = 0;

        foreach (DataRow drItems in dtIndentItems.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["Particular"].ToString().Replace("\n", "<br>") + "</td>";
            lc.Text = lc.Text + "<td>" + drItems["CurrentStock"] + "</td>";
            lc.Text = lc.Text + "<td>" + drItems["Quantity"] + "</td>";
            lc.Text = lc.Text + "<td>" + drItems["Remarks"] + "</td>";
            lc.Text = lc.Text + "</tr>";
        }
        lc.Text = lc.Text + "</table>";

        //Items
        lc.Text = lc.Text + "</div>";

        lc.Text = lc.Text + "<div class='col-lg-12'>";
        lc.Text = lc.Text + "<table width='100%' border='1' align='center'>";
        lc.Text = lc.Text + "<tr height='100' align='center'><td>";


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

        lc.Text = lc.Text + "<br>Indentor: " + dtIndentor.Rows[0]["Name"] + "</td>";
        lc.Text = lc.Text + "<td>";
        if (dtApprovedBy.Rows.Count > 0)
        {
            lc.Text = lc.Text + "<img src='../" + dtApprovedBy.Rows[0]["Signature"] + "' height='50' width='120'/>";

            lc.Text = lc.Text + "<br>Approved By: " + dtApprovedBy.Rows[0]["Name"];
        }
        lc.Text = lc.Text + "</td></tr></table>";
        lc.Text = lc.Text + "</div>";
        lc.Text = lc.Text + "</div>";
        Label lb = new Label();

        lb.Text = lc.ToString();
        pnlDetail.Controls.Add(lc);
        if (dtApprovedBy.Rows.Count == 0)
        {
            pnlApprove.Visible = true;
        }
        else
        {
            pnlApprove.Visible = false;
        }
    }
    void LoadOrderForPDF()
    {
        clsIndent      obIndent      = new clsIndent();
        clsCustomer    obCustomer    = new clsCustomer();
        clsSite        obSite        = new clsSite();
        clsIndentItems obIndentItems = new clsIndentItems();
        clsUser        obU           = new clsUser();
        clsCompany     obC           = new clsCompany();
        DataTable      dtCustomer;

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

        //Indent detail
        obIndent.ID = Convert.ToInt32(Request.QueryString["ID"]);
        obIndent.Op = 4;
        DataTable dtIndent = obIndent.IndentMaster(obIndent).Tables[0];

        //User Detail
        obU.Op = 5;
        obU.ID = Convert.ToInt32(dtIndent.Rows[0]["Indentor"]);
        DataTable dtIndentor = obU.UserMaster(obU).Tables[0];

        obU.ID = Convert.ToInt32(dtIndent.Rows[0]["ApprovedBy"]);
        DataTable dtApprovedBy = obU.UserMaster(obU).Tables[0];

        //Customer Detail
        if (Convert.ToInt32(dtIndent.Rows[0]["OrderFrom"]) == 1)
        {
            //Site Detail
            obSite.Op  = 5;
            obSite.ID  = Convert.ToInt32(dtIndent.Rows[0]["OrderFromID"]);
            dtCustomer = obSite.SiteMaster(obSite).Tables[0];
        }
        else
        {
            //Customer Detail
            obCustomer.ID = Convert.ToInt32(dtIndent.Rows[0]["OrderFromID"]);
            obCustomer.Op = 4;
            dtCustomer    = obCustomer.CustomerMaster(obCustomer).Tables[0];
        }
        //Indent Items
        obIndentItems.IndentID = Convert.ToInt32(Request.QueryString["ID"]);
        obIndentItems.Op       = 2;
        DataTable      dtIndentItems = obIndentItems.IndentItemMaster(obIndentItems).Tables[0];
        LiteralControl lc            = new LiteralControl();

        lc.Text = "";
        lc.Text = lc.Text + "<table width='100%'>";
        lc.Text = lc.Text + "<tr><td colspan='12' align='center'><h3>" + dtCompany.Rows[0]["Name"] + "</h3></td></tr>";
        lc.Text = lc.Text + "<tr><td colspan='12' align='center'>Project Name: " + dtIndent.Rows[0]["ProjectNo"] + "</h3></td></tr>";
        lc.Text = lc.Text + "<tr><td colspan='12' align='center'>Job No: " + dtIndent.Rows[0]["JobNo"] + "</h3></td></tr>";
        lc.Text = lc.Text + "<tr><td colspan='12' align='center'><h3><u>INDENT FORM</u></h3></td></tr>";
        lc.Text = lc.Text + "<tr><td colspan='9' align='left'>Ref No:" + dtIndent.Rows[0]["RefNo"] + "</td>";
        lc.Text = lc.Text + "<td colspan='3' align='right'>Date:" + Convert.ToDateTime(dtIndent.Rows[0]["IndentDate"]).ToShortDateString() + "</td></tr>";
        lc.Text = lc.Text + "<tr><td colspan='12' style='height:50'></td></tr>";

        lc.Text = lc.Text + "<tr><td colspan='12'>";
        //Items//
        lc.Text = lc.Text + "<table width='100%' border='1' align='center'>";
        lc.Text = lc.Text + "<tr><td colspan='1' align='center'>Serial No</td><td colspan='2' align='left'>Part No</td><td colspan='4' align='left'>Particular Description</td><td colspan='1' align='center'>Current Stock</td><td colspan='1' align='center'>Quantity</td><td colspan='3' align='left'>Remarks</td></tr>";
        int i = 0;

        foreach (DataRow drItems in dtIndentItems.Rows)
        {
            i++;
            lc.Text = lc.Text + "<tr>";
            lc.Text = lc.Text + "<td colspan='1' align='center'>" + i.ToString() + "</td>";
            lc.Text = lc.Text + "<td colspan='2' align='left'>" + drItems["PartNo"] + "</td>";
            lc.Text = lc.Text + "<td colspan='4' align='left'>" + drItems["Particular"].ToString().Replace("\n", "<br>") + "</td>";
            lc.Text = lc.Text + "<td colspan='1' align='center'>" + drItems["CurrentStock"] + "</td>";
            lc.Text = lc.Text + "<td colspan='1' align='center'>" + drItems["Quantity"] + "</td>";
            lc.Text = lc.Text + "<td colspan='3' align='left'>" + drItems["Remarks"] + "</td>";
            lc.Text = lc.Text + "</tr>";
        }
        if (i < 20)
        {
            i = 20 - i;
            while (i > 0)
            {
                lc.Text = lc.Text + "<tr border='0'><td colspan='12' border='0'><br></td></tr>";
                i--;
            }
        }
        lc.Text = lc.Text + "</table>";

        //Items
        lc.Text = lc.Text + "</td></tr>";

        lc.Text = lc.Text + "<tr><td colspan='12'>";
        lc.Text = lc.Text + "<table width='100%' border='1' align='center'>";
        lc.Text = lc.Text + "<tr height='100'><td align='center'>";

        try
        {
            if (dtIndentor.Rows[0]["Signature"].ToString().Trim() != "")
            {
                lc.Text = lc.Text + "<img src='" + MapPath("~/" + dtIndentor.Rows[0]["Signature"]) + "' height='50' width='120'/>";
            }

            lc.Text = lc.Text + "<br>Indentor: " + dtIndentor.Rows[0]["Name"] + "</td>";
        }
        catch
        {
        }
        lc.Text = lc.Text + "<td align='center'>";
        if (dtApprovedBy.Rows.Count > 0)
        {
            try
            {
                if (dtApprovedBy.Rows[0]["Signature"].ToString().Trim() != "")
                {
                    lc.Text = lc.Text + "<img src='" + MapPath("~/" + dtApprovedBy.Rows[0]["Signature"]) + "' height='50' width='120'/>";
                }
                lc.Text = lc.Text + "<br>Approved By: " + dtApprovedBy.Rows[0]["Name"];
            }
            catch
            {
            }
        }
        lc.Text = lc.Text + "</td></tr></table>";
        lc.Text = lc.Text + "</td></tr>";
        lc.Text = lc.Text + "</table>";
        Label lb = new Label();

        lb.Text = lc.ToString();
        pnlDetail.Controls.Add(lc);
    }
    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);
    }