Exemple #1
0
        public void PublishPDFIndividualLedger(DateTime?FromDate, DateTime?ToDate, int id, string method)
        {
            string pageTitle = "Loan Ledger";

            float[]  size         = new float[] { 3, 2, 3, 3, 3, 3 };
            string[] tableHeaders = new String[] { "Entry No.", "Date", "Loan ID", "Collection", "Installment", "Balance" };
            PDF      myPDF        = new PDF(pageTitle, size, tableHeaders);



            string FDate = FromDate?.ToString("yyyyMMdd");
            string TDate = ToDate?.ToString("yyyyMMdd");

            Connection conn = new Connection();

            conn.OpenConection();
            string        query  = "SELECT * FROM [LoanCollection] WHERE LoanCollection_Method = '" + method + "' AND LoanCollection_Loan = " + id + " AND CAST(LoanCollection_Date AS date) BETWEEN '" + FDate + "' and '" + TDate + "'";
            SqlDataReader reader = conn.DataReader(query);

            while (reader.Read())
            {
                myPDF.AddToTable(reader["LoanCollection_Id"].ToString());
                DateTime OnlyDate = (DateTime)reader["LoanCollection_Date"];
                myPDF.AddToTable(OnlyDate.ToString("dd-MM-yyyy"));
                myPDF.AddToTable(reader["LoanCollection_Loan"].ToString());
                myPDF.AddToTable(reader["LoanCollection_Collection"].ToString());
                myPDF.AddToTable(reader["LoanCollection_Installment"].ToString());
                myPDF.AddToTable(reader["LoanCollection_Balance"].ToString());
            }

            conn.CloseConnection();

            Connection conn1 = new Connection();

            conn1.OpenConection();
            string        firstquery = "Select m.MemberName From LoanDetails l Left Join Member m ON l.LoanDetails_Account=m.MemberId where l.LoanDetails_Id = " + id;
            SqlDataReader reader1    = conn1.DataReader(firstquery);
            string        name       = "";

            while (reader1.Read())
            {
                name = "Name : " + reader1["MemberName"].ToString();
            }

            myPDF.AddParagraph("Name : " + name);
            conn1.CloseConnection();

            myPDF.Done();
        }