protected void btnSave_Click(object sender, EventArgs e)
 {
     if (txtBookName.Text != String.Empty)
     {
         GlBook book = GlBookManager.getBook(txtBookName.Text);
         if (book != null)
         {
             //if (per.AllowEdit == "Y")
             //{
             book.BookDesc        = txtBookDesc.Text;
             book.BookStatus      = ddlBookStatus.SelectedValue;
             book.SeparatorType   = txtSeparatorType.Text;
             book.CompanyAddress1 = txtCompanyAddress1.Text;
             book.CompanyAddress2 = txtCompanyAddress2.Text;
             book.RetdEarnAcc     = txtRetdEarnAcc.Text;
             book.Phone           = txtPhone.Text;
             book.Fax             = txtFax.Text;
             book.Url             = txtUrl.Text;
             book.BankCode        = txtBankCode.Text;
             book.CashCode        = txtCashCode.Text;
             book.logo            = ImageLogo;
             GlBookManager.UpdateGlBook(book);
             ClientScript.RegisterStartupScript(this.GetType(), "ale", "alert('Record updated successfully!!');", true);
             //}
             //else
             //{
             //    ClientScript.RegisterStartupScript(this.GetType(), "ale", "alert('You have no permission to edit/update these data!!');", true);
             //}
         }
         else
         {
             if (per.AllowAdd == "Y")
             {
                 book                 = new GlBook();
                 book.BookName        = txtBookName.Text;
                 book.BookDesc        = txtBookDesc.Text;
                 book.BookStatus      = ddlBookStatus.SelectedValue;
                 book.SeparatorType   = txtSeparatorType.Text;
                 book.CompanyAddress1 = txtCompanyAddress1.Text;
                 book.CompanyAddress2 = txtCompanyAddress2.Text;
                 book.RetdEarnAcc     = txtRetdEarnAcc.Text;
                 book.Phone           = txtPhone.Text;
                 book.Fax             = txtFax.Text;
                 book.Url             = txtUrl.Text;
                 book.BankCode        = txtBankCode.Text;
                 book.CashCode        = txtCashCode.Text;
                 book.logo            = ImageLogo;
                 GlBookManager.CreateGlBook(book);
                 ClientScript.RegisterStartupScript(this.GetType(), "ale", "alert('Record created successfully!!');", true);
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "ale", "alert('You have no permission to add data in this form!!');", true);
             }
         }
     }
 }
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     if (per.AllowDelete == "Y")
     {
         if (txtBookName.Text != String.Empty)
         {
             GlBook book = GlBookManager.getBook(txtBookName.Text);
             if (book != null)
             {
                 GlBookManager.DeleteGlBook(book);
                 ClientScript.RegisterStartupScript(this.GetType(), "ale", "alert('Record deleted successfully!!');", true);
             }
         }
     }
     else
     {
         ClientScript.RegisterStartupScript(this.GetType(), "ale", "alert('You have no permission to delete these data!!');", true);
     }
 }
    protected void dgGlBook_SelectedIndexChanged(object sender, EventArgs e)
    {
        clearFields();
        GlBook book = GlBookManager.getBook(dgGlBook.SelectedRow.Cells[1].Text.ToString().Trim());

        if (book != null)
        {
            txtBookName.Text            = book.BookName;
            txtBookDesc.Text            = book.BookDesc;
            ddlBookStatus.SelectedValue = book.BookStatus;
            txtSeparatorType.Text       = book.SeparatorType;
            txtCompanyAddress1.Text     = book.CompanyAddress1;
            txtCompanyAddress2.Text     = book.CompanyAddress2;
            txtRetdEarnAcc.Text         = book.RetdEarnAcc;
            txtPhone.Text    = book.Phone;
            txtFax.Text      = book.Fax;
            txtUrl.Text      = book.Url;
            txtBankCode.Text = book.BankCode;
            txtCashCode.Text = book.CashCode;
            imgLogo.ImageUrl = "~/imgHandler.ashx?img='" + book.BookName + "'";
            ImageLogo        = (byte[])book.logo;
        }
    }
    private void CollectionReport()
    {
        DataTable dt = StudentManager.GetStudentAllCurrentStatus("", txtSearchBatch.Text, "", "");

        Response.Clear();
        Response.ContentType = "application/pdf";
        Response.AddHeader("content-disposition", "attachment; filename=studentpaymenthistory.pdf");
        Document document = new Document();

        document = new Document(PageSize.A4, 50f, 50f, 20f, 20f);

        MemoryStream ms     = new MemoryStream();
        PdfWriter    writer = PdfWriter.GetInstance(document, Response.OutputStream);
        pdfPage      page   = new pdfPage();

        writer.PageEvent = page;
        document.Open();

        byte[] logo = GlBookManager.GetGlLogo(Session["book"].ToString());
        iTextSharp.text.Image gif = iTextSharp.text.Image.GetInstance(logo);
        gif.Alignment = iTextSharp.text.Image.MIDDLE_ALIGN;
        gif.ScalePercent(35f);
        float[] titwidth = new float[2] {
            5, 200
        };

        PdfPCell  cell;
        PdfPTable dth = new PdfPTable(titwidth);

        dth.WidthPercentage = 100;
        cell = new PdfPCell(gif);
        cell.HorizontalAlignment = 1;
        cell.VerticalAlignment   = 1;
        cell.Rowspan             = 4;
        cell.BorderWidth         = 0f;
        dth.AddCell(cell);
        cell =
            new PdfPCell(new Phrase(Session["org"].ToString(), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 12, iTextSharp.text.Font.BOLD)));
        cell.HorizontalAlignment = 1;
        cell.VerticalAlignment   = 1;
        cell.BorderWidth         = 0f;
        //cell.FixedHeight = 20f;
        dth.AddCell(cell);
        cell = new PdfPCell(new Phrase(Session["add1"].ToString(), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL)));
        cell.HorizontalAlignment = 1;
        cell.VerticalAlignment   = 1;
        cell.BorderWidth         = 0f;
        //cell.FixedHeight = 20f;
        dth.AddCell(cell);
        cell = new PdfPCell(new Phrase(Session["add2"].ToString(), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL)));
        cell.HorizontalAlignment = 1;
        cell.VerticalAlignment   = 1;
        cell.BorderWidth         = 0f;
        //cell.FixedHeight = 20f;
        dth.AddCell(cell);
        cell = new PdfPCell(new Phrase("Report of Student Payment Collection From " + txtStartDate.Text + "-" + txtEndDate.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 11, iTextSharp.text.Font.BOLD)));
        cell.HorizontalAlignment = 1;
        cell.VerticalAlignment   = 1;
        cell.BorderWidth         = 0f;

        dth.AddCell(cell);
        document.Add(dth);
        //cell = new PdfPCell(dth);
        //cell.BorderWidth = 0f;
        //pdt.AddCell(cell);
        //LineSeparator line = new LineSeparator(0f, 100, null, Element.ALIGN_CENTER, -2);
        //cell = new PdfPCell(line);
        //pdt.AddCell(cell);
        //document.Add(line);
        PdfPTable dtempty = new PdfPTable(1);

        cell             = new PdfPCell(FormatHeaderPhrase(""));
        cell.BorderWidth = 0f;
        cell.FixedHeight = 15f;
        dtempty.AddCell(cell);
        document.Add(dtempty);
        PdfPTable pdtn = new PdfPTable(2);

        pdtn.WidthPercentage = 100;

        float[] width = new float[10] {
            4, 15, 25, 10, 8, 8, 8, 9, 8, 8
        };
        PdfPTable pdtc = new PdfPTable(width);

        pdtc.WidthPercentage = 100;
        cell = new PdfPCell(new Phrase("SL", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL)));
        cell.HorizontalAlignment = 1;
        cell.VerticalAlignment   = 1;
        pdtc.AddCell(cell);
        cell = new PdfPCell(new Phrase("Student Id", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL)));
        cell.HorizontalAlignment = 1;
        cell.VerticalAlignment   = 1;
        pdtc.AddCell(cell);
        cell = new PdfPCell(new Phrase("Name", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL)));
        cell.HorizontalAlignment = 1;
        cell.VerticalAlignment   = 1;
        pdtc.AddCell(cell);
        cell = new PdfPCell(new Phrase("Date", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL)));
        cell.HorizontalAlignment = 1;
        cell.VerticalAlignment   = 1;
        pdtc.AddCell(cell);
        cell = new PdfPCell(new Phrase("Batch", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL)));
        cell.HorizontalAlignment = 1;
        cell.VerticalAlignment   = 1;
        pdtc.AddCell(cell);
        cell = new PdfPCell(new Phrase("Pay Amount", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL)));
        cell.HorizontalAlignment = 1;
        cell.VerticalAlignment   = 1;
        pdtc.AddCell(cell);

        cell = new PdfPCell(new Phrase("Waiver", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL)));
        cell.HorizontalAlignment = 1;
        cell.VerticalAlignment   = 1;
        pdtc.AddCell(cell);

        cell = new PdfPCell(new Phrase("Discount", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL)));
        cell.HorizontalAlignment = 1;
        cell.VerticalAlignment   = 1;
        pdtc.AddCell(cell);

        cell = new PdfPCell(new Phrase("Acctual Paid Amount", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL)));
        cell.HorizontalAlignment = 1;
        cell.VerticalAlignment   = 1;
        pdtc.AddCell(cell);
        cell = new PdfPCell(new Phrase("Due Amount", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL)));
        cell.HorizontalAlignment = 1;
        cell.VerticalAlignment   = 1;
        pdtc.AddCell(cell);


        for (int i = 0; i < dt.Rows.Count; i++)
        {
            cell = new PdfPCell(new Phrase((i + 1).ToString(), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
            cell.HorizontalAlignment = 1;
            cell.VerticalAlignment   = 1;
            pdtc.AddCell(cell);
            cell = new PdfPCell(new Phrase(((DataRow)dt.Rows[i])["student_id"].ToString(), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
            cell.HorizontalAlignment = 1;
            cell.VerticalAlignment   = 1;
            pdtc.AddCell(cell);

            cell = new PdfPCell(new Phrase(((DataRow)dt.Rows[i])["f_name"].ToString(), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
            cell.HorizontalAlignment = 1;
            cell.VerticalAlignment   = 1;
            pdtc.AddCell(cell);
            cell = new PdfPCell(new Phrase(((DataRow)dt.Rows[i])["pay_date"].ToString(), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
            cell.HorizontalAlignment = 1;
            cell.VerticalAlignment   = 1;
            pdtc.AddCell(cell);
            cell = new PdfPCell(new Phrase(((DataRow)dt.Rows[i])["BatchNo"].ToString(), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
            cell.HorizontalAlignment = 1;
            cell.VerticalAlignment   = 1;
            pdtc.AddCell(cell);
            cell = new PdfPCell(new Phrase(((DataRow)dt.Rows[i])["PaidAmount"].ToString(), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
            cell.HorizontalAlignment = 2;
            cell.VerticalAlignment   = 1;
            pdtc.AddCell(cell);
            cell = new PdfPCell(new Phrase(((DataRow)dt.Rows[i])["Waiver"].ToString(), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
            cell.HorizontalAlignment = 2;
            cell.VerticalAlignment   = 1;
            pdtc.AddCell(cell);
            cell = new PdfPCell(new Phrase(((DataRow)dt.Rows[i])["Discount"].ToString(), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
            cell.HorizontalAlignment = 2;
            cell.VerticalAlignment   = 1;
            pdtc.AddCell(cell);
            cell = new PdfPCell(new Phrase(((DataRow)dt.Rows[i])["PayAmount"].ToString(), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
            cell.HorizontalAlignment = 2;
            cell.VerticalAlignment   = 1;
            pdtc.AddCell(cell);
            cell = new PdfPCell(new Phrase(((DataRow)dt.Rows[i])["DueAmount"].ToString(), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
            cell.HorizontalAlignment = 2;
            cell.VerticalAlignment   = 1;
            pdtc.AddCell(cell);
        }
        decimal tot  = decimal.Zero;
        decimal tot1 = decimal.Zero;
        decimal tot2 = decimal.Zero;
        decimal tot3 = decimal.Zero;
        decimal tot5 = decimal.Zero;

        foreach (DataRow dr in dt.Rows)
        {
            tot += decimal.Parse(dr["PaidAmount"].ToString());

            tot1 += decimal.Parse(dr["Waiver"].ToString());
            tot5 += decimal.Parse(dr["Discount"].ToString());
            tot2 += decimal.Parse(dr["PayAmount"].ToString());
            tot3 += decimal.Parse(dr["DueAmount"].ToString());
        }
        cell = new PdfPCell(new Phrase("Total", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD)));
        cell.HorizontalAlignment = 2;
        cell.VerticalAlignment   = 1;
        cell.Colspan             = 5;
        pdtc.AddCell(cell);
        cell = new PdfPCell(new Phrase(tot.ToString("N2"), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD)));
        cell.HorizontalAlignment = 2;
        cell.VerticalAlignment   = 1;
        pdtc.AddCell(cell);

        cell = new PdfPCell(new Phrase(tot1.ToString("N2"), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD)));
        cell.HorizontalAlignment = 2;
        cell.VerticalAlignment   = 1;
        pdtc.AddCell(cell);

        cell = new PdfPCell(new Phrase(tot5.ToString("N2"), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD)));
        cell.HorizontalAlignment = 2;
        cell.VerticalAlignment   = 1;
        pdtc.AddCell(cell);

        cell = new PdfPCell(new Phrase(tot2.ToString("N2"), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD)));
        cell.HorizontalAlignment = 2;
        cell.VerticalAlignment   = 1;
        pdtc.AddCell(cell);

        cell = new PdfPCell(new Phrase(tot3.ToString("N2"), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD)));
        cell.HorizontalAlignment = 2;
        cell.VerticalAlignment   = 1;
        pdtc.AddCell(cell);

        document.Add(pdtc);
        document.Close();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (Session["user"] == null)
        //{
        //    if (Session.SessionID != "" | Session.SessionID != null)
        //    {
        //        clsSession ses = clsSessionManager.getSession(Session.SessionID);
        //        if (ses != null)
        //        {
        //            Session["user"] = ses.UserId;
        //            Session["book"] = "AMB";
        //            string connectionString = DataManager.OraConnString();
        //            SqlDataReader dReader;
        //            SqlConnection conn = new SqlConnection();
        //            conn.ConnectionString = connectionString;
        //            SqlCommand cmd = new SqlCommand();
        //            cmd.Connection = conn;
        //            cmd.CommandType = CommandType.Text;
        //            cmd.CommandText = "Select user_grp,description from utl_userinfo where upper(user_name)=upper('" + Session["user"].ToString().ToUpper() + "') and status='A'";
        //            conn.Open();
        //            dReader = cmd.ExecuteReader();
        //            string wnot = "";
        //            if (dReader.HasRows == true)
        //            {
        //                while (dReader.Read())
        //                {
        //                    Session["userlevel"] = int.Parse(dReader["user_grp"].ToString());
        //                    wnot = "KHSC Mr. " + dReader["description"].ToString();
        //                }
        //                Session["wnote"] = wnot;

        //                cmd = new SqlCommand();
        //                cmd.Connection = conn;
        //                cmd.CommandType = CommandType.Text;
        //                cmd.CommandText = "Select book_desc,company_address1,company_address2,separator_type from gl_set_of_books where book_name='" + Session["book"].ToString() + "' ";
        //                if (dReader.IsClosed == false)
        //                {
        //                    dReader.Close();
        //                }
        //                dReader = cmd.ExecuteReader();
        //                if (dReader.HasRows == true)
        //                {
        //                    while (dReader.Read())
        //                    {
        //                        Session["septype"] = dReader["separator_type"].ToString();
        //                        Session["org"] = dReader["book_desc"].ToString();
        //                        Session["add1"] = dReader["company_address1"].ToString();
        //                        Session["add2"] = dReader["company_address2"].ToString();
        //                    }
        //                }
        //            }
        //            dReader.Close();
        //            conn.Close();
        //        }
        //    }
        //}
        //try
        //{
        //    //ClientScript.RegisterStartupScript(this.GetType(), "ale", "alert('" + Session.SessionID + "');", true);
        //    string pageName = DataManager.GetCurrentPageName();
        //    string modid = PermisManager.getModuleId(pageName);
        //    per = PermisManager.getUsrPermis(Session["user"].ToString().Trim().ToUpper(), modid);
        //    if (per != null & per.AllowView == "Y")
        //    {
        //        ((Label)Page.Master.FindControl("lblLogin")).Text = Session["wnote"].ToString();
        //        ((LinkButton)Page.Master.FindControl("lbLogout")).Visible = true;
        //    }
        //    else
        //    {
        //        Response.Redirect("Default.aspx?sid=sam");
        //    }
        //}
        //catch
        //{
        //    Response.Redirect("Default.aspx?sid=sam");
        //}
        if (!Page.IsPostBack)
        {
            string criteria = "";
            dgGlBook.DataSource = GlBookManager.GetGlBooks(criteria);
            dgGlBook.DataBind();
        }
    }
Exemple #6
0
    private void PrintMoneyRecieptNew()
    {
        try
        {
            Response.Clear();
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "attachment; filename='StudentPaymentReport'.pdf");
            Student std = StudentManager.getStd(lblSTDID.Text);
            //clsPaymentMst paymst = clsPaymentManager.getPaymentMst(txtPaymentId.Text);

            Document document = new Document();
            //float pwidth = (float)(25.7 / 2.54) * 72;
            //float pheight = (float)(22.7 / 2.54) * 72;
            float pwidth  = (float)(14 / 2.54) * 72;
            float pheight = (float)(20 / 2.54) * 72;
            document = new Document(new iTextSharp.text.Rectangle(pwidth, pheight));
            //document = new Document(PageSize.A4);
            //document = new Document(new Rectangle.A4.Rotate(), 90f, 90f, 35f, 20f);
            PdfWriter    writer = PdfWriter.GetInstance(document, Response.OutputStream);
            MemoryStream ms     = new MemoryStream();
            //pdfPage page1 = new pdfPage();
            // writer.PageEvent = page1;
            document.Open();
            string a = lblSTDID.Text.Trim();

            if (txtStudentId.Text != "")
            {
                byte[] logo = GlBookManager.GetGlLogo(Session["book"].ToString());
                iTextSharp.text.Image gif = iTextSharp.text.Image.GetInstance(logo);
                gif.Alignment = iTextSharp.text.Image.MIDDLE_ALIGN;
                gif.ScalePercent(25f);
                float[] titwidth = new float[2] {
                    5, 200
                };
                float[] swidth1 = new float[2] {
                    130, 70
                };
                float[] twidth = new float[3] {
                    100, 5, 100
                };
                float[] widFooter = new float[2] {
                    55, 45
                };

                if (std != null)
                {
                    for (int i = 1; i <= 2; i++)
                    {
                        PdfPCell  cell;
                        PdfPTable dth = new PdfPTable(titwidth);
                        dth.WidthPercentage = 100;
                        cell = new PdfPCell(gif);
                        cell.HorizontalAlignment = 1;
                        cell.VerticalAlignment   = 1;
                        cell.Rowspan             = 3;
                        cell.BorderWidth         = 0f;
                        dth.AddCell(cell);
                        cell = new PdfPCell(new Phrase(Session["org"].ToString(), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 12, iTextSharp.text.Font.BOLD)));
                        cell.HorizontalAlignment = 1;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        //cell.FixedHeight = 20f;
                        dth.AddCell(cell);
                        cell = new PdfPCell(new Phrase(Session["add1"].ToString(), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 1;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        //cell.FixedHeight = 20f;
                        dth.AddCell(cell);
                        //cell = new PdfPCell(new Phrase(Session["add2"].ToString(), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL)));
                        //cell.HorizontalAlignment = 1;
                        //cell.VerticalAlignment = 1;
                        //cell.BorderWidth = 0f;
                        ////cell.FixedHeight = 20f;
                        //dth.AddCell(cell);
                        cell = new PdfPCell(new Phrase("Student Payment Reciept", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 11, iTextSharp.text.Font.BOLD)));
                        cell.HorizontalAlignment = 1;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        cell.FixedHeight         = 20f;
                        dth.AddCell(cell);

                        cell = new PdfPCell(new Phrase("", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 11, iTextSharp.text.Font.BOLD)));
                        cell.HorizontalAlignment = 1;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        cell.FixedHeight         = 20f;
                        dth.AddCell(cell);
                        if (i == 2)
                        {
                            cell = new PdfPCell(new Phrase("Student Copy", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 11, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 1;
                            cell.VerticalAlignment   = 1;
                            cell.BorderWidth         = 0f;
                            cell.FixedHeight         = 20f;
                            dth.AddCell(cell);

                            cell = new PdfPCell(new Phrase("", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 11, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 1;
                            cell.VerticalAlignment   = 1;
                            cell.BorderWidth         = 0f;
                            cell.FixedHeight         = 20f;
                            dth.AddCell(cell);
                        }
                        else
                        {
                            cell = new PdfPCell(new Phrase("Office Copy", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 11, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 1;
                            cell.VerticalAlignment   = 1;
                            cell.BorderWidth         = 0f;
                            cell.FixedHeight         = 20f;
                            dth.AddCell(cell);

                            cell = new PdfPCell(new Phrase("", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 11, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 1;
                            cell.VerticalAlignment   = 1;
                            cell.BorderWidth         = 0f;
                            cell.FixedHeight         = 20f;
                            dth.AddCell(cell);
                        }
                        document.Add(dth);
                        LineSeparator line = new LineSeparator(0f, 100, null, Element.ALIGN_CENTER, -2);
                        document.Add(line);
                        PdfPTable dtempty = new PdfPTable(1);
                        cell             = new PdfPCell(FormatHeaderPhrase(""));
                        cell.BorderWidth = 0f;
                        cell.FixedHeight = 5f;
                        dtempty.AddCell(cell);
                        document.Add(dtempty);

                        float[] width = new float[7] {
                            20, 5, 25, 10, 20, 5, 35
                        };
                        PdfPTable dtm = new PdfPTable(width);
                        dtm.WidthPercentage = 100;

                        DataTable dt = StudentManager.GetStudentAllCurrentStatusss(txtStudentId.Text.Trim());
                        cell = new PdfPCell(new Phrase("MR No", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 3;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        cell.FixedHeight         = 15f;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase(":", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 3;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        cell.FixedHeight         = 15f;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase(dt.Rows[0]["ID"].ToString(), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 3;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        //cell.FixedHeight = 15f;
                        //cell.Colspan = 3;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase("", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 3;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        //cell.FixedHeight = 15f;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase("Date", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 3;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        cell.FixedHeight         = 15f;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase(":", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 3;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        //cell.FixedHeight = 15f;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase(txtChequeDate.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 3;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        //cell.FixedHeight = 15f;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase("Student ID", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 0;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        cell.FixedHeight         = 15f;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase(":", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 3;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        cell.FixedHeight         = 15f;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase(txtStudentId.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 7, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 0;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase("", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 3;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        //cell.FixedHeight = 15f;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase("Student Name", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 0;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        cell.FixedHeight         = 15f;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase(":", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 3;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        cell.FixedHeight         = 15f;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase(lblName.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 7, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 0;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase("Course Name", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 3;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        cell.FixedHeight         = 15f;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase(":", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 3;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        cell.FixedHeight         = 15f;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase(lblCourseName.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 3;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        cell.Colspan             = 5;
                        cell.FixedHeight         = 15f;
                        dtm.AddCell(cell);

                        cell = new PdfPCell(new Phrase("Batch No", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 3;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        cell.FixedHeight         = 15f;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase(":", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 3;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        cell.FixedHeight         = 15f;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase(lblBatch.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 3;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        cell.FixedHeight         = 15f;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase("", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 3;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        //cell.FixedHeight = 15f;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase("Year", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 3;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        cell.FixedHeight         = 15f;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase(":", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 3;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        cell.FixedHeight         = 15f;
                        dtm.AddCell(cell);
                        cell = new PdfPCell(new Phrase(lblYear.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL)));
                        cell.HorizontalAlignment = 3;
                        cell.VerticalAlignment   = 1;
                        cell.BorderWidth         = 0f;
                        cell.FixedHeight         = 15f;
                        dtm.AddCell(cell);

                        dtm.AddCell(cell);
                        document.Add(dtm);
                        document.Add(dtempty);

                        float[] swidth = new float[2] {
                            60, 20
                        };
                        PdfPTable pdtPay = new PdfPTable(swidth);
                        pdtPay.WidthPercentage = 100;

                        cell = new PdfPCell(new Phrase("Fee. Particulars", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                        cell.HorizontalAlignment = 3;
                        cell.VerticalAlignment   = 1;
                        //cell.BorderColor = BaseColor.LIGHT_GRAY;
                        pdtPay.AddCell(cell);

                        cell = new PdfPCell(new Phrase("Paid Amount", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                        cell.HorizontalAlignment = 2;
                        cell.VerticalAlignment   = 1;
                        //cell.BorderColor = BaseColor.LIGHT_GRAY;
                        pdtPay.AddCell(cell);
                        if (i == 2)
                        {
                            string PaidAmount = lblTotalPaid.Text;
                            string DueAmount  = txtCurrDue.Text;

                            cell = new PdfPCell(new Phrase("Total Amount", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase(txtTotalPayable.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            cell.Colspan             = 2;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);


                            cell = new PdfPCell(new Phrase("Discount Amount", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase(TotalDiscount.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            cell.Colspan             = 2;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase("Waiver Amount", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase(txtPrevWaiver.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            cell.Colspan             = 2;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase("Previous Paid", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase(txtPaidAmount.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            cell.Colspan             = 2;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase("Current Paid", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase(txtPayment.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            cell.Colspan             = 2;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase("Current Due", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase(txtCurrDue.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            cell.Colspan             = 2;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase(lblTotalPaid.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            cell.Colspan             = 2;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);
                            //cell = new PdfPCell(new Phrase("In word: " +lblTotalPaid.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.BOLD)));
                            decimal tott2 = Convert.ToDecimal(lblTotalPaid.Text);
                            cell = new PdfPCell(new Phrase("In word: " + DataManager.GetLiteralAmt(tott2.ToString()).Replace("  ", " "), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 3;
                            cell.VerticalAlignment   = 2;
                            cell.Border  = 0;
                            cell.Colspan = 2;
                            pdtPay.AddCell(cell);

                            document.Add(pdtPay);
                            document.Add(dtempty);

                            PdfPTable dtempty1 = new PdfPTable(1);
                            dtempty1.WidthPercentage = 100;
                            cell = new PdfPCell(FormatPhrase(""));
                            cell.VerticalAlignment   = 0;
                            cell.HorizontalAlignment = 0;
                            cell.BorderWidth         = 0f;
                            cell.FixedHeight         = 30f;
                            dtempty1.AddCell(cell);
                            document.Add(dtempty1);

                            float[]   widthsig = new float[] { 20, 20 };
                            PdfPTable pdtsig   = new PdfPTable(widthsig);
                            pdtsig.WidthPercentage = 100;
                            //cell = new PdfPCell(FormatPhrase("Student/Gurdian Signature"));
                            //cell.HorizontalAlignment = 1;
                            //cell.VerticalAlignment = 1;
                            //cell.Border = 1;
                            ////cell.FixedHeight = 18f;
                            ////cell.BorderColor = BaseColor.LIGHT_GRAY;
                            //pdtsig.AddCell(cell);
                            //cell = new PdfPCell(FormatPhrase(""));
                            //cell.HorizontalAlignment = 0;
                            //cell.VerticalAlignment = 1;
                            //cell.Border = 0;
                            ////cell.FixedHeight = 18f;
                            ////cell.BorderColor = BaseColor.LIGHT_GRAY;
                            //pdtsig.AddCell(cell);
                            //cell = new PdfPCell(FormatPhrase("HeadMaster Signature"));
                            //cell.HorizontalAlignment = 1;
                            //cell.VerticalAlignment = 1;
                            //cell.Border = 1;
                            //cell.FixedHeight = 18f;
                            ////cell.BorderColor = BaseColor.LIGHT_GRAY;
                            //pdtsig.AddCell(cell);
                            cell = new PdfPCell(FormatPhrase(""));
                            cell.HorizontalAlignment = 0;
                            cell.VerticalAlignment   = 1;
                            cell.Border = 0;
                            //cell.FixedHeight = 18f;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtsig.AddCell(cell);
                            cell = new PdfPCell(FormatPhrase("Accounts Officer"));
                            cell.HorizontalAlignment = 1;
                            cell.VerticalAlignment   = 1;
                            cell.Border = 1;
                            //cell.FixedHeight = 18f;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtsig.AddCell(cell);
                            document.Add(pdtsig);

                            document.NewPage();
                        }
                        else
                        {
                            string PaidAmount = lblTotalPaid.Text;
                            string DueAmount  = txtCurrDue.Text;

                            cell = new PdfPCell(new Phrase("Total Amount", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase(txtTotalPayable.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            cell.Colspan             = 2;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);


                            cell = new PdfPCell(new Phrase("Discount Amount", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase(TotalDiscount.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            cell.Colspan             = 2;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase("Waiver Amount", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase(txtPrevWaiver.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            cell.Colspan             = 2;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase("Previous Paid", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase(txtPaidAmount.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            cell.Colspan             = 2;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase("Current Paid", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase(txtPayment.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            cell.Colspan             = 2;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase("Current Due", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase(txtCurrDue.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            cell.Colspan             = 2;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);

                            cell = new PdfPCell(new Phrase(lblTotalPaid.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 2;
                            cell.VerticalAlignment   = 1;
                            cell.Colspan             = 2;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtPay.AddCell(cell);
                            //cell = new PdfPCell(new Phrase("In word: " + lblTotalPaid.Text, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.BOLD)));
                            decimal tott2 = Convert.ToDecimal(lblTotalPaid.Text);
                            cell = new PdfPCell(new Phrase("In word: " + DataManager.GetLiteralAmt(tott2.ToString()).Replace("  ", " "), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.BOLD)));
                            cell.HorizontalAlignment = 3;
                            cell.VerticalAlignment   = 2;
                            cell.Border  = 0;
                            cell.Colspan = 2;
                            pdtPay.AddCell(cell);

                            document.Add(pdtPay);
                            document.Add(dtempty);

                            PdfPTable dtempty1 = new PdfPTable(1);
                            dtempty1.WidthPercentage = 100;
                            cell = new PdfPCell(FormatPhrase(""));
                            cell.VerticalAlignment   = 0;
                            cell.HorizontalAlignment = 0;
                            cell.BorderWidth         = 0f;
                            cell.FixedHeight         = 30f;
                            dtempty1.AddCell(cell);
                            document.Add(dtempty1);

                            float[]   widthsig = new float[] { 20, 20 };
                            PdfPTable pdtsig   = new PdfPTable(widthsig);
                            pdtsig.WidthPercentage = 100;
                            //cell = new PdfPCell(FormatPhrase("Student/Gurdian Signature"));
                            //cell.HorizontalAlignment = 1;
                            //cell.VerticalAlignment = 1;
                            //cell.Border = 1;
                            ////cell.FixedHeight = 18f;
                            ////cell.BorderColor = BaseColor.LIGHT_GRAY;
                            //pdtsig.AddCell(cell);
                            //cell = new PdfPCell(FormatPhrase(""));
                            //cell.HorizontalAlignment = 0;
                            //cell.VerticalAlignment = 1;
                            //cell.Border = 0;
                            ////cell.FixedHeight = 18f;
                            ////cell.BorderColor = BaseColor.LIGHT_GRAY;
                            //pdtsig.AddCell(cell);
                            //cell = new PdfPCell(FormatPhrase("HeadMaster Signature"));
                            //cell.HorizontalAlignment = 1;
                            //cell.VerticalAlignment = 1;
                            //cell.Border = 1;
                            //cell.FixedHeight = 18f;
                            ////cell.BorderColor = BaseColor.LIGHT_GRAY;
                            //pdtsig.AddCell(cell);
                            cell = new PdfPCell(FormatPhrase(""));
                            cell.HorizontalAlignment = 0;
                            cell.VerticalAlignment   = 1;
                            cell.Border = 0;
                            //cell.FixedHeight = 18f;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtsig.AddCell(cell);
                            cell = new PdfPCell(FormatPhrase("Accounts Officer"));
                            cell.HorizontalAlignment = 1;
                            cell.VerticalAlignment   = 1;
                            cell.Border = 1;
                            //cell.FixedHeight = 18f;
                            //cell.BorderColor = BaseColor.LIGHT_GRAY;
                            pdtsig.AddCell(cell);
                            document.Add(pdtsig);

                            document.NewPage();
                        }
                    }
                }

                document.Close();
                Response.Flush();
                Response.End();
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "ale", "alert('Please select a Payment first!!');", true);
            }
        }
        catch (FormatException fex)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Warning", "alert('" + fex.Message + "');", true);
        }
        catch (Exception ex)
        {
            if (ex.Message.Contains("Database"))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Warning", "alert('Database Maintain Error. Contact to the Software Provider..!!');", true);
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Warning", "alert('There is some problem to do the task. Try again properly.!!');", true);
            }
        }
    }