Example #1
0
        void bttnUpdate_Click(object sender, EventArgs e)
        {
            if (radioGroup3.EditValue == null)
            {
                Common.setMessageBox("Selection Type not Selected....!", Program.ApplicationName, 2);
                return;
            }
            else
            {
                string qury = string.Empty;
                System.Data.DataSet response = new System.Data.DataSet();

                XRepGlobalManifest Global  = new XRepGlobalManifest();
                XRepGlobalManifest Global2 = new XRepGlobalManifest();
                XtraRepPayment     payment = new XtraRepPayment();
                XtraRepPayment     Reprint = new XtraRepPayment();
                //XtraRepPayment Reversal = new XtraRepPayment();
                XtraRepReversal Reversal = new XtraRepReversal();

                if (radioGroup3.EditValue.ToString() == "0")
                {
                    if (cboStation.SelectedIndex == -1)
                    {
                        qury = "0000";
                    }
                    try
                    {
                        using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                        {
                            connect.Open();
                            _command = new SqlCommand("doGlobalManifest", connect)
                            {
                                CommandType = CommandType.StoredProcedure
                            };
                            _command.Parameters.Add(new SqlParameter("@start", SqlDbType.DateTime)).Value      = string.Format("{0:yyyy-MM-dd 00:00:00}", DTPDateselect.Value.Date);
                            _command.Parameters.Add(new SqlParameter("@end", SqlDbType.DateTime)).Value        = string.Format("{0:yyyy-MM-dd 23:59:59}", DTPDateselect.Value.Date);
                            _command.Parameters.Add(new SqlParameter("@Stationcode", SqlDbType.VarChar)).Value =
                                qury;
                            _command.Parameters.Add(new SqlParameter("@Type", SqlDbType.Int)).Value =
                                radioGroup3.EditValue;
                            _command.CommandTimeout = 0;
                            adp = new SqlDataAdapter(_command);
                            adp.Fill(response, "CollectionReportTable");

                            connect.Close();

                            if (response.Tables[0].Rows[0]["returnCode"].ToString() == "00")
                            {
                                if (response.Tables[1] != null && response.Tables[1].Rows.Count > 0)//Main Manifesthfhhf
                                {
                                    Global.DataSource     = response.Tables[1];
                                    Global.DataAdapter    = adp;
                                    Global.DataMember     = "CollectionReportTable";
                                    Global.xrLabel12.Text = "GLOBAL RECEIPT MANIFEST";
                                    Global.xrLabel9.Text  = string.Format("{0} State Government ", Program.StateName.ToUpper());
                                    Global.logoPath       = Logic.logopth;
                                    Global.CreateDocument();

                                    if (response.Tables[2] != null && response.Tables[2].Rows.Count > 0)//unreceipted receipt Manifest
                                    {
                                        Global2.DataSource     = response.Tables[2];
                                        Global2.DataAdapter    = adp;
                                        Global2.DataMember     = "CollectionReportTable";
                                        Global2.xrLabel12.Text = "GLOBAL UNRECEIPTED MANIFEST";
                                        Global2.xrLabel9.Text  = string.Format("{0} State Government ", Program.StateName.ToUpper());
                                        Global2.CreateDocument();
                                    }

                                    if (response.Tables[3] != null && response.Tables[3].Rows.Count > 0)//Reprinted Receipts
                                    {
                                        var listresult = (from DataRow row in response.Tables[3].Rows
                                                          select new DataSet.Main
                                        {
                                            PaymentRefNumber = row["PaymentRefNumber"] as string,
                                            Receipt = row["EReceipts"] as string,
                                            ApprovalDate = Convert.ToDateTime(row["ApprovalDate"]),
                                            OldValue = row["OldRecord"] as string,
                                            ApprovalBy = row["ApprovalBy"] as string,
                                            NewValue = row["NewRecord"] as string,
                                            Description = row["Description"] as string,
                                            Type = row["Type"] as string,
                                            Amount = Convert.ToDecimal(row["Amount"])
                                        }).ToList();
                                        //XtraRepPayment payment = new XtraRepPayment();

                                        Reprint.xrLabel10.Text = "Reprinted Receipts";
                                        Reprint.xrLabel2.Text  = string.Format("{0} STATE GOVERNMENT",
                                                                               Program.StateName.ToUpper());
                                        Reprint.DataSource = listresult;

                                        Reprint.CreateDocument();
                                    }

                                    if (response.Tables[4] != null && response.Tables[4].Rows.Count > 0)//Amendement Receipt
                                    {
                                        var listresult = (from DataRow row in response.Tables[4].Rows
                                                          select new DataSet.Main
                                        {
                                            PaymentRefNumber = row["PaymentRefNumber"] as string,
                                            PayerName = row["PayerName"] as string,
                                            Receipt = row["EReceipts"] as string,
                                            ApprovalDate = Convert.ToDateTime(row["ApprovalDate"]),
                                            OldValue = row["OldRecord"] as string,
                                            ApprovalBy = row["ApprovalBy"] as string,
                                            NewValue = row["NewRecord"] as string,
                                            Description = row["Description"] as string,
                                            Type = row["Type"] as string,
                                            Amount = Convert.ToDecimal(row["Amount"])
                                        }).ToList();
                                        //XtraRepPayment payment = new XtraRepPayment();
                                        payment.xrLabel10.Text = "Amended Receipts";
                                        payment.xrLabel2.Text  = string.Format("{0} STATE GOVERNMENT",
                                                                               Program.StateName.ToUpper());
                                        payment.DataSource = listresult;

                                        payment.CreateDocument();
                                    }

                                    if (response.Tables[5] != null && response.Tables[5].Rows.Count > 0)//Reversal receipt
                                    {
                                        var listresult = (from DataRow row in response.Tables[5].Rows
                                                          select new DataSet.Reversal
                                        {
                                            PaymentRefNumber = row["PaymentRefNumber"] as string,
                                            Amount = Convert.ToDecimal(row["Amount"]),
                                            Receipt = row["EReceipts"] as string,
                                            Type = row["Type"] as string,
                                            Description = row["Description"] as string,
                                            PayerName = row["PayerName"] as string,
                                            PaymentDate = Convert.ToDateTime(row["PaymentDate"]),
                                            AgencyName = row["AgencyName"] as string,
                                            User = row["User"] as string,
                                            Bankname = row["Bankname"] as string,
                                            DepositSlipNumber = row["DepositSlipNumber"] as string
                                        }
                                                          );

                                        Reversal.xrLabel10.Text = "Reversal"; Reversal.xrLabel24.Text = Program.UserID;
                                        Reversal.xrLabel9.Text  = string.Format("{0} STATE GOVERNMENT",
                                                                                Program.StateName.ToUpper());
                                        Reversal.DataSource = listresult;

                                        Reversal.CreateDocument();
                                    }

                                    if (response.Tables[5] != null && response.Tables[5].Rows.Count > 0)//Unreceipted manifest
                                    {
                                        Global.Pages.AddRange(Reversal.Pages);
                                    }
                                    if (response.Tables[4] != null && response.Tables[4].Rows.Count > 0)
                                    {
                                        Global.Pages.AddRange(payment.Pages);
                                    }
                                    if (response.Tables[3] != null && response.Tables[3].Rows.Count > 0)
                                    {
                                        Global.Pages.AddRange(Reprint.Pages);
                                    }
                                    if (response.Tables[2] != null && response.Tables[2].Rows.Count > 0)
                                    {
                                        Global.Pages.AddRange(Global2.Pages);
                                    }

                                    // Reset all page numbers in the resulting document.
                                    Global.PrintingSystem.ContinuousPageNumbering = true;

                                    // Show the Print Preview form.
                                    Global.ShowPreviewDialog();
                                }
                                else
                                {
                                    Common.setMessageBox("No Record Found for selected Period", "TCO Report", 2); return;
                                }
                            }
                            else
                            {
                                Common.setMessageBox("No Record Found for selected Period", "TCO Report", 2); return;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Tripous.Sys.ErrorBox(ex.Message); return;
                    }
                }
                else
                {
                    if (cboStation.SelectedIndex < -1)
                    {
                        Common.setEmptyField("Station Name", Program.ApplicationName);
                        return;
                    }
                    else
                    {
                        try
                        {
                            using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                            {
                                connect.Open();
                                _command = new SqlCommand("doGlobalManifest", connect)
                                {
                                    CommandType = CommandType.StoredProcedure
                                };
                                _command.Parameters.Add(new SqlParameter("@start", SqlDbType.DateTime)).Value =
                                    string.Format("{0:yyyy-MM-dd 00:00:00}", DTPDateselect.Value.Date);
                                _command.Parameters.Add(new SqlParameter("@end", SqlDbType.DateTime)).Value        = string.Format("{0:yyyy-MM-dd 23:59:59}", DTPDateselect.Value.Date);
                                _command.Parameters.Add(new SqlParameter("@Stationcode", SqlDbType.VarChar)).Value =
                                    cboStation.SelectedValue.ToString();
                                _command.Parameters.Add(new SqlParameter("@Type", SqlDbType.Int)).Value =
                                    radioGroup3.EditValue;
                                _command.CommandTimeout = 0;
                                adp = new SqlDataAdapter(_command);
                                adp.Fill(response, "CollectionReportTable");

                                connect.Close();
                                if (response.Tables[0].Rows[0]["returnCode"].ToString() == "00")
                                {
                                    if (response.Tables[1] != null && response.Tables[1].Rows.Count > 0)//Main Manifest
                                    {
                                        //Report.XRepGlobalManifest Global = new Collection.Report.XRepGlobalManifest
                                        //{
                                        Global.DataSource     = response.Tables[1];
                                        Global.DataAdapter    = adp;
                                        Global.DataMember     = "CollectionReportTable";
                                        Global.xrLabel12.Text = "GLOBAL RECEIPT MANIFEST";
                                        //};
                                        Global.xrLabel9.Text = string.Format("{0} State Government ", Program.StateName.ToUpper());
                                        Global.logoPath      = Logic.logopth;
                                        Global.ShowPreviewDialog();
                                    }

                                    if (response.Tables[2] != null && response.Tables[2].Rows.Count > 0)//unreceipted receipt Manifest
                                    {
                                        Global2.DataSource     = response.Tables[2];
                                        Global2.DataAdapter    = adp;
                                        Global2.DataMember     = "CollectionReportTable";
                                        Global2.xrLabel12.Text = "GLOBAL UNRECEIPTED MANIFEST";
                                        Global2.xrLabel9.Text  = string.Format("{0} State Government ", Program.StateName.ToUpper());
                                        Global2.CreateDocument();
                                    }

                                    if (response.Tables[3] != null && response.Tables[3].Rows.Count > 0)//Reprinted Receipts
                                    {
                                        var listresult = (from DataRow row in response.Tables[3].Rows
                                                          select new DataSet.Main
                                        {
                                            PaymentRefNumber = row["PaymentRefNumber"] as string,
                                            Receipt = row["EReceipts"] as string,
                                            ApprovalDate = Convert.ToDateTime(row["ApprovalDate"]),
                                            OldValue = row["OldRecord"] as string,
                                            ApprovalBy = row["ApprovalBy"] as string,
                                            NewValue = row["NewRecord"] as string,
                                            Description = row["Description"] as string,
                                            Type = row["Type"] as string,
                                            Amount = Convert.ToDecimal(row["Amount"])
                                        }).ToList();
                                        //XtraRepPayment payment = new XtraRepPayment();

                                        Reprint.xrLabel10.Text = "Reprinted Receipts";
                                        Reprint.xrLabel2.Text  = string.Format("{0} STATE GOVERNMENT",
                                                                               Program.StateName.ToUpper());
                                        Reprint.DataSource = listresult;

                                        Reprint.CreateDocument();
                                    }

                                    if (response.Tables[4] != null && response.Tables[4].Rows.Count > 0)//Amendement Receipt
                                    {
                                        var listresult = (from DataRow row in response.Tables[4].Rows
                                                          select new DataSet.Main
                                        {
                                            PaymentRefNumber = row["PaymentRefNumber"] as string,
                                            PayerName = row["PayerName"] as string,
                                            Receipt = row["EReceipts"] as string,
                                            ApprovalDate = Convert.ToDateTime(row["ApprovalDate"]),
                                            OldValue = row["OldRecord"] as string,
                                            ApprovalBy = row["ApprovalBy"] as string,
                                            NewValue = row["NewRecord"] as string,
                                            Description = row["Description"] as string,
                                            Type = row["Type"] as string,
                                            Amount = Convert.ToDecimal(row["Amount"])
                                        }).ToList();
                                        //XtraRepPayment payment = new XtraRepPayment();
                                        payment.xrLabel10.Text = "Amended Receipts";
                                        payment.xrLabel2.Text  = string.Format("{0} STATE GOVERNMENT",
                                                                               Program.StateName.ToUpper());
                                        payment.DataSource = listresult;

                                        payment.CreateDocument();
                                    }

                                    if (response.Tables[5] != null && response.Tables[5].Rows.Count > 0)//Reversal receipt
                                    {
                                        //var listresult = (from DataRow row in response.Tables[4].Rows
                                        //                  select new DataSet.Main
                                        //                  {
                                        //                      PaymentRefNumber = row["PaymentRefNumber"] as string,
                                        //                      Receipt = row["EReceipts"] as string,
                                        //                      ApprovalDate = Convert.ToDateTime(row["ApprovalDate"]),
                                        //                      OldValue = row["OldRecord"] as string,
                                        //                      ApprovalBy = row["ApprovalBy"] as string,
                                        //                      NewValue = row["NewRecord"] as string,
                                        //                      Description = row["Description"] as string,
                                        //                      Type = row["Type"] as string,
                                        //                      Amount = Convert.ToDecimal(row["Amount"])


                                        //                  }).ToList();
                                        //XtraRepPayment payment = new XtraRepPayment();

                                        var listresult = (from DataRow row in response.Tables[5].Rows
                                                          select new DataSet.Reversal
                                        {
                                            PaymentRefNumber = row["PaymentRefNumber"] as string,
                                            Amount = Convert.ToDecimal(row["Amount"]),
                                            Receipt = row["EReceipts"] as string,
                                            Type = row["Type"] as string,
                                            Description = row["Description"] as string,
                                            PayerName = row["PayerName"] as string,
                                            PaymentDate = Convert.ToDateTime(row["PaymentDate"]),
                                            AgencyName = row["AgencyName"] as string,
                                            User = row["User"] as string,
                                            Bankname = row["Bankname"] as string,
                                            DepositSlipNumber = row["DepositSlipNumber"] as string
                                        }
                                                          );


                                        Reversal.xrLabel10.Text = "Reversal"; Reversal.xrLabel24.Text = Program.UserID;
                                        Reversal.xrLabel9.Text  = string.Format("{0} STATE GOVERNMENT",
                                                                                Program.StateName.ToUpper());
                                        Reversal.DataSource = listresult;

                                        Reversal.CreateDocument();
                                    }
                                }

                                if (response.Tables[5] != null && response.Tables[5].Rows.Count > 0)//Unreceipted manifest
                                {
                                    Global.Pages.AddRange(Reversal.Pages);
                                }
                                if (response.Tables[4] != null && response.Tables[4].Rows.Count > 0)
                                {
                                    Global.Pages.AddRange(payment.Pages);
                                }
                                if (response.Tables[3] != null && response.Tables[3].Rows.Count > 0)
                                {
                                    Global.Pages.AddRange(Reprint.Pages);
                                }
                                if (response.Tables[2] != null && response.Tables[2].Rows.Count > 0)
                                {
                                    Global.Pages.AddRange(Global2.Pages);
                                }

                                // Reset all page numbers in the resulting document.
                                Global.PrintingSystem.ContinuousPageNumbering = true;
                                Global.logoPath = Logic.logopth;
                                // Show the Print Preview form.
                                Global.ShowPreviewDialog();
                            }
                        }
                        catch (Exception ex)
                        {
                            Tripous.Sys.ErrorBox(ex.Message); return;
                        }
                    }
                    //}
                }
                #region
                //if (radioGroup3.EditValue.ToString() == "0")
                //{
                //    qury = string.Format("SELECT  [ID] ,[Provider] , [Channel] ,Collection.tblCollectionReport.[PaymentRefNumber] ,[DepositSlipNumber] , CONVERT(VARCHAR,CONVERT(DATE,[PaymentDate]),103) AS PaymentDate,[PayerID] , UPPER([PayerName]) AS [PayerName],[Amount] ,[PaymentMethod] , [ChequeNumber] ,[ChequeValueDate] ,[ChequeStatus] , [DateChequeReturned] ,[TelephoneNumber] , [ReceiptNo] , [ReceiptDate] , [PayerAddress] ,  [User] ,[RevenueCode] ,[Description] , [ChequeBankCode] , [ChequeBankName] , [AgencyName] ,  [AgencyCode] , [BankCode] , [BankName] , [BranchCode] ,[BranchName] , [ZoneCode] , [ZoneName] , [Username] ,  [AmountWords] , Collection.tblCollectionReport.[EReceipts] ,Collection.tblCollectionReport.[EReceiptsDate] ,[GeneratedBy] ,Collection.tblCollectionReport.[StationCode] ,(SELECT TOP 1 StationName from Receipt.tblStation WHERE tblStation.StationCode = Collection.tblCollectionReport.StationCode) AS StationName FROM Collection.tblCollectionReport WHERE Collection.tblCollectionReport.EReceipts IS NOT NULL AND (Collection.tblCollectionReport.[EReceiptsDate] BETWEEN '{0} 00:00:00' AND '{0} 23:59:59')  ORDER BY Collection.tblCollectionReport.AgencyCode,Collection.tblCollectionReport.StationCode  ,Collection.tblCollectionReport.RevenueCode,Collection.tblCollectionReport.EReceipts", DTPDateselect.Value.Date.ToString("MM/dd/yyyy"));
                //}

                //if (radioGroup3.EditValue.ToString() == "1")
                //{
                //    if (cboStation.SelectedIndex < -1)
                //    {
                //        Common.setEmptyField("Station Name", Program.ApplicationName);
                //        return;
                //    }
                //    else
                //    {
                //        qury = string.Format(" SELECT  [ID] ,[Provider] , [Channel] ,Collection.tblCollectionReport.[PaymentRefNumber] ,[DepositSlipNumber] , CONVERT(VARCHAR,CONVERT(DATE,[PaymentDate]),103) AS PaymentDate,[PayerID] , UPPER([PayerName]) AS [PayerName],[Amount] ,[PaymentMethod] , [ChequeNumber] ,[ChequeValueDate] ,[ChequeStatus] , [DateChequeReturned] ,[TelephoneNumber] , [ReceiptNo] , [ReceiptDate] , [PayerAddress] ,  [User] ,[RevenueCode] ,[Description] , [ChequeBankCode] , [ChequeBankName] , [AgencyName] ,  [AgencyCode] , [BankCode] , [BankName] , [BranchCode] ,[BranchName] , [ZoneCode] , [ZoneName] , [Username] ,  [AmountWords] , Collection.tblCollectionReport.[EReceipts] ,Collection.tblCollectionReport.[EReceiptsDate] ,[GeneratedBy] ,Collection.tblCollectionReport.[StationCode] ,(SELECT TOP 1 StationName from Receipt.tblStation WHERE tblStation.StationCode = Collection.tblCollectionReport.StationCode) AS StationName FROM Collection.tblCollectionReport WHERE Collection.tblCollectionReport.EReceipts IS NOT NULL AND (Collection.tblCollectionReport.[EReceiptsDate] BETWEEN '{0} 00:00:00' AND '{0} 23:59:59') AND Collection.tblCollectionReport.StationCode='{1}' ORDER BY Collection.tblCollectionReport.AgencyCode,Collection.tblCollectionReport.StationCode  ,Collection.tblCollectionReport.RevenueCode,Collection.tblCollectionReport.EReceipts", DTPDateselect.Value.Date.ToString("MM/dd/yyyy"), cboStation.SelectedValue);
                //    }

                //}

                #endregion

                #region olds2

                //if (response.Tables[0].Rows[0]["returnCode"].ToString() == "00")
                //{

                //    if (response.Tables[1] != null && response.Tables[1].Rows.Count > 0)//Main Manifest
                //    {
                //        using (System.Data.DataSet dds = new System.Data.DataSet("DsCollectionReport"))
                //        {
                //            SqlDataAdapter ada = new SqlDataAdapter();
                //            //using (SqlDataAdapter ada = new SqlDataAdapter(qury, Logic.ConnectionString))
                //            //{
                //            ada.Fill(dds, "CollectionReportTable");
                //            //Report.XRepGlobalManifest Global = new Collection.Report.XRepGlobalManifest { DataSource = dds, DataAdapter = ada, DataMember = "CollectionReportTable", RequestParameters = true };
                //            Report.XRepGlobalManifest Global = new Collection.Report.XRepGlobalManifest { DataSource = response.Tables[1], DataAdapter = ada, DataMember = "CollectionReportTable" };
                //            Global.xrLabel9.Text = string.Format("{0} State Government ", Program.StateName.ToUpper());
                //            //Global.paramStartDate.Value = "EReceiptsDate";
                //            //Global.paramEndDate.Value = "EReceiptsDate";
                //            // Global.paramEndDate.Visible = false;
                //            Global.ShowPreviewDialog();
                //            //}
                //        }
                //    }
                //}
                #endregion
            }
        }
Example #2
0
        private void BttnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);


                System.Data.DataSet response = new System.Data.DataSet();

                using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                {
                    connect.Open();
                    _command = new SqlCommand("doTCOReportManifest", connect)
                    {
                        CommandType = CommandType.StoredProcedure
                    };
                    _command.Parameters.Add(new SqlParameter("@start", SqlDbType.DateTime)).Value   = string.Format("{0:yyyy-MM-dd 00:00:00}", DTPDateselect.Value.Date);
                    _command.Parameters.Add(new SqlParameter("@enddate", SqlDbType.DateTime)).Value = string.Format("{0:yyyy-MM-dd 23:59:59}", DTPDateselect.Value.Date);

                    adp = new SqlDataAdapter(_command);

                    adp.Fill(response, "CollectionReportTable");

                    connect.Close();

                    if (response.Tables[0].Rows[0]["returnCode"].ToString() == "00")
                    {
                        XRepManifest    repManifest = new XRepManifest();
                        XtraRepPayment  payment = new XtraRepPayment(); XtraRepPayment Reprint = new XtraRepPayment();
                        XtraRepReversal Reversal = new XtraRepReversal();
                        XRepManifest    UnReceipt = new XRepManifest(); XtraRepUnreceipted Unreceipted = new XtraRepUnreceipted();

                        if (response.Tables[1] != null && response.Tables[1].Rows.Count > 0)//Main Manifest
                        {
                            repManifest.DataSource  = response.Tables[1];
                            repManifest.DataAdapter = adp;

                            repManifest.DataMember        = "CollectionReportTable";
                            repManifest.RequestParameters = false;
                            //};
                            repManifest.xrLabel10.Text = Program.UserID;
                            repManifest.xrLabel9.Text  = string.Format("{0} STATE GOVERNMENT",
                                                                       Program.StateName.ToUpper());
                            //repManifest.ShowPreviewDialog();
                            repManifest.CreateDocument();

                            if (response.Tables[2] != null && response.Tables[2].Rows.Count > 0)//unreceipted receipt Manifest
                            {
                                //UnReceipt.DataSource = response.Tables[2];
                                //UnReceipt.DataAdapter = adp;
                                //UnReceipt.DataMember = "CollectionReportTable";
                                //UnReceipt.RequestParameters = false;
                                //UnReceipt.xrLabel10.Text = Program.UserID;
                                //UnReceipt.xrLabel12.Text = "MANIFEST OF UNRECEIPTED ";
                                //UnReceipt.xrLabel9.Text = string.Format("{0} STATE GOVERNMENT",
                                //    Program.StateName.ToUpper());

                                //UnReceipt.CreateDocument();

                                Unreceipted.DataSource        = response.Tables[2];
                                Unreceipted.DataAdapter       = adp;
                                Unreceipted.DataMember        = "CollectionReportTable";
                                Unreceipted.RequestParameters = false;
                                Unreceipted.xrLabel10.Text    = Program.UserID;
                                Unreceipted.xrLabel2.Text     = "(BANK BRANCH)";
                                Unreceipted.xrLabel12.Text    = "MANIFEST OF UNRECEIPTED PAYMENT";
                                Unreceipted.xrLabel9.Text     = string.Format("{0} STATE GOVERNMENT",
                                                                              Program.StateName.ToUpper());
                                //Unreceipted.ShowPreviewDialog();
                                //return;
                                Unreceipted.CreateDocument();
                            }
                            if (checkEdit1.Checked)                                                  ///payment
                            {
                                if (response.Tables[3] != null && response.Tables[3].Rows.Count > 0) //Payment Change Manifest
                                {
                                    var listresult = (from DataRow row in response.Tables[3].Rows
                                                      select new DataSet.Main
                                    {
                                        PaymentRefNumber = row["PaymentRefNumber"] as string,
                                        PayerName = row["PayerName"] as string,
                                        Receipt = row["EReceipts"] as string,
                                        ApprovalDate = Convert.ToDateTime(row["ApprovalDate"]),
                                        OldValue = row["OldRecord"] as string,
                                        ApprovalBy = row["ApprovalBy"] as string,
                                        NewValue = row["NewRecord"] as string,
                                        Description = row["Description"] as string,
                                        Type = row["Type"] as string,
                                        Amount = Convert.ToDecimal(row["Amount"])
                                    }).ToList();
                                    //XtraRepPayment payment = new XtraRepPayment();
                                    payment.xrLabel10.Text = "Amended Receipts"; payment.xrLabel24.Text = Program.UserID;
                                    payment.xrLabel2.Text  = string.Format("{0} STATE GOVERNMENT",
                                                                           Program.StateName.ToUpper());
                                    payment.DataSource = listresult;

                                    payment.CreateDocument();
                                }
                            }
                            if (checkEdit2.Checked)                                                  //Reprint
                            {
                                if (response.Tables[4] != null && response.Tables[4].Rows.Count > 0) //Reprint Manifest
                                {
                                    var listresult = (from DataRow row in response.Tables[4].Rows
                                                      select new DataSet.Main
                                    {
                                        PaymentRefNumber = row["PaymentRefNumber"] as string,
                                        Receipt = row["EReceipts"] as string,
                                        ApprovalDate = Convert.ToDateTime(row["ApprovalDate"]),
                                        OldValue = row["OldRecord"] as string,
                                        ApprovalBy = row["ApprovalBy"] as string,
                                        NewValue = row["NewRecord"] as string,
                                        Description = row["Description"] as string,
                                        Type = row["Type"] as string,
                                        Amount = Convert.ToDecimal(row["Amount"])
                                    }).ToList();
                                    //XtraRepPayment payment = new XtraRepPayment();

                                    Reprint.xrLabel10.Text = "Reprinted Receipts";
                                    Reprint.xrLabel24.Text = Program.UserID;
                                    Reprint.xrLabel2.Text  = string.Format("{0} STATE GOVERNMENT",
                                                                           Program.StateName.ToUpper());
                                    Reprint.DataSource = listresult;

                                    Reprint.CreateDocument();
                                }
                            }
                            if (checkEdit3.Checked)                                                  //Reseveral
                            {
                                if (response.Tables[5] != null && response.Tables[5].Rows.Count > 0) //Reversal receipt Manifest
                                {
                                    var listresult = (from DataRow row in response.Tables[5].Rows
                                                      select new DataSet.Reversal
                                    {
                                        PaymentRefNumber = row["PaymentRefNumber"] as string,
                                        Amount = Convert.ToDecimal(row["Amount"]),
                                        Receipt = row["EReceipts"] as string,
                                        Type = row["Type"] as string,
                                        Description = row["Description"] as string,
                                        PayerName = row["PayerName"] as string,
                                        PaymentDate = Convert.ToDateTime(row["PaymentDate"]),
                                        AgencyName = row["AgencyName"] as string,
                                        User = row["User"] as string,
                                        Bankname = row["Bankname"] as string,
                                        DepositSlipNumber = row["DepositSlipNumber"] as string
                                    }
                                                      );

                                    Reversal.xrLabel10.Text = "Reversal";
                                    Reversal.xrLabel24.Text = Program.UserID;
                                    Reversal.xrLabel9.Text  = string.Format("{0} STATE GOVERNMENT", Program.StateName.ToUpper());
                                    Reversal.DataSource     = listresult;

                                    Reversal.CreateDocument();
                                }
                            }

                            if (response.Tables[2] != null && response.Tables[2].Rows.Count > 0)
                            {
                                repManifest.Pages.AddRange(Unreceipted.Pages);
                            }

                            if (checkEdit1.Checked)///payment
                            {
                                if (response.Tables[3] != null && response.Tables[3].Rows.Count > 0)
                                {
                                    repManifest.Pages.AddRange(payment.Pages);
                                }
                            }
                            if (checkEdit2.Checked)//Reprint
                            {
                                if (response.Tables[4] != null && response.Tables[4].Rows.Count > 0)
                                {
                                    repManifest.Pages.AddRange(Reprint.Pages);
                                }
                            }
                            if (checkEdit3.Checked)                                                  //Reseveral
                            {
                                if (response.Tables[5] != null && response.Tables[5].Rows.Count > 0) //Unreceipted manifest
                                {
                                    repManifest.Pages.AddRange(Reversal.Pages);
                                }
                            }


                            // Reset all page numbers in the resulting document.
                            repManifest.PrintingSystem.ContinuousPageNumbering = true;

                            // Show the Print Preview form.
                            repManifest.ShowPreviewDialog();
                        }
                        else
                        {
                            Common.setMessageBox("No Record Found for selected Period", "TCO Report", 2); return;
                        }
                    }
                    else
                    {
                        Tripous.Sys.ErrorBox(response.Tables[0].Rows[0]["returnMessage"].ToString());
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                Tripous.Sys.ErrorBox(ex.Message); return;
            }
            finally
            {
                SplashScreenManager.CloseForm(false);
            }
        }