Example #1
0
        void btnSelect_Click(object sender, EventArgs e)
        {
            string values = string.Empty;

            string values1 = string.Empty;

            //criteria = String.Format("AND [EReceiptsDate] >='{0}' AND [EReceiptsDate]<= '{1}' ", string.Format("{0:MM/dd/yyyy 00:00:00}", dtpfrm.Value), string.Format("{0:MM/dd/yyyy 23:59:59}", dtpTo.Value));

            if (cboAgencyTest.EditValue == null || cboAgencyTest.EditValue.ToString() != "")
            {
                object[] lol = cboAgencyTest.EditValue.ToString().Split(',');

                int i = 0;

                foreach (object obj in lol)
                {
                    values += string.Format("{0}", obj.ToString().Trim());

                    if (i + 1 < lol.Count())
                    {
                        values += ",";
                    }
                    ++i;
                }

                //criteria += String.Format(" AND AgencyCode in ({0})", values);
            }

            if (cboRevenueEdt.EditValue == null || cboRevenueEdt.EditValue.ToString() != "")
            {
                object[] lol = cboRevenueEdt.EditValue.ToString().Split(',');

                int i = 0;

                foreach (object obj in lol)
                {
                    values1 += string.Format("{0}", obj.ToString().Trim());

                    if (i + 1 < lol.Count())
                    {
                        values1 += ",";
                    }
                    ++i;
                }

                //criteria += String.Format(" AND RevenueCode in ({0})", values1);
            }

            try
            {
                SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);

                using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                {
                    connect.Open();

                    _command = new SqlCommand("doReprintMainfest", connect)
                    {
                        CommandType = CommandType.StoredProcedure
                    };
                    _command.Parameters.Add(new SqlParameter("@AgencyCode", SqlDbType.VarChar)).Value  = values.ToString();
                    _command.Parameters.Add(new SqlParameter("@StartDate", SqlDbType.VarChar)).Value   = string.Format("{0:yyyy/MM/dd 00:00:00}", dtpfrm.Value);
                    _command.Parameters.Add(new SqlParameter("@enddate", SqlDbType.VarChar)).Value     = string.Format("{0:yyyy/MM/dd 23:59:59}", dtpTo.Value);
                    _command.Parameters.Add(new SqlParameter("@RevenueCode", SqlDbType.VarChar)).Value = values1.ToString();

                    _command.CommandTimeout = 0;
                    using (System.Data.DataSet ds = new System.Data.DataSet())
                    {
                        ds.Clear();

                        adp = new SqlDataAdapter(_command);
                        adp.Fill(ds, "CollectionReportTable");
                        //Dts = ds.Tables[0];
                        connect.Close();

                        //dtResult = ds;

                        if (ds.Tables[0].Rows[0]["returnCode"].ToString() == "00")
                        {
                            if (ds.Tables[1] != null && ds.Tables[1].Rows.Count > 0)//Unreceipted manifest
                            {
                                //dbCrDebit = ds.Tables[5];
                                //using (System.Data.DataSet dds = new System.Data.DataSet("DsCollectionReport"))
                                //{
                                //    using (SqlDataAdapter ada = new SqlDataAdapter(query, Logic.ConnectionString))
                                //    {
                                //ada.Fill(dds, "CollectionReportTable");
                                XRepManifest repManifest = new XRepManifest {
                                    DataSource = ds.Tables[1], DataAdapter = adp, DataMember = "CollectionReportTable", RequestParameters = false
                                };
                                repManifest.xrLabel10.Text = Program.UserID;
                                //OGUN STATE GOVERNMENTre
                                repManifest.logoPath      = Logic.logopth;
                                repManifest.xrLabel9.Text = string.Format("{0} STATE GOVERNMENT", Program.StateName.ToUpper());
                                repManifest.ShowPreviewDialog();
                                //    }
                                //}
                            }
                            else
                            {
                                Common.setMessageBox("No Record Found!!!!!!", "Agency Mainfest", 2);
                                return;
                            }
                        }
                        else
                        {
                            Tripous.Sys.ErrorBox(String.Format("{0}{1}", ds.Tables[0].Rows[0]["returnCode"].ToString(), ds.Tables[0].Rows[0]["returnMessage"].ToString()));

                            return;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Tripous.Sys.ErrorBox(String.Format("{0}{1}", ex.StackTrace, ex.Message));
                return;
            }
            finally
            {
                SplashScreenManager.CloseForm(false);
            }
        }
Example #2
0
        void btnPrint_Click(object sender, EventArgs e)
        {
            XRepManifest repManifest = new XRepManifest();

            repManifest.ShowPreviewDialog();
        }
Example #3
0
        void Bttn_Click(object sender, EventArgs e)
        {
            if (sender == btnSelect)
            {
                //if (checkedComboBoxEdit1.EditValue.ToString() == null || checkedComboBoxEdit1.EditValue.ToString() == "")
                //{
                //    Common.setEmptyField("Printed Batches ", Program.ApplicationName);
                //    checkedComboBoxEdit1.Focus(); return;
                //}
                if (string.IsNullOrEmpty(txtSearch.Text.ToString()))
                {
                    Common.setMessageBox("Receipt Number", Program.ApplicationName, 3); return;
                }
                else
                {
                    try
                    {
                        SQL = String.Format("SELECT BatchNumber FROM Receipt.tblCollectionReceipt where EReceipts ='{0}'", txtSearch.Text.Trim());;

                        BatchNumber = (new Logic()).ExecuteScalar(SQL);
                    }
                    catch (Exception ex)
                    {
                        Tripous.Sys.ErrorBox(String.Format("Search Receipt for Mainfest with EReceipts number...{0}{1}", ex.Message, ex.StackTrace));
                        return;
                    }


                    if (!string.IsNullOrEmpty(BatchNumber))
                    {
                        var vquery = 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] ,
                                                                                  [PayerAddress] ,
                                          [User] ,
                                         [RevenueCode] ,
                                         [Description] ,
                                         [ChequeBankCode] ,
                                         [ChequeBankName] ,
                                         [AgencyName] ,
                                         [AgencyCode] ,
                                         [BankCode] ,
                                         [BankName] ,
                                         [BranchCode] ,
                                         [BranchName] ,                                      
                                         [ZoneCode] ,
                                         [ZoneName] ,
                                         [Username] ,
                                         [AmountWords] ,
                                         Collection.tblCollectionReport.[EReceipts] ,
                                         Collection.tblCollectionReport.[EReceiptsDate] ,
                                         [GeneratedBy] ,
                                         Receipt.tblCollectionReceipt.[UploadStatus] ,
                                         [PrintedBY] ,
                                         [ControlNumber] ,
                                         [BatchNumber] ,
                                         Collection.tblCollectionReport.[StationCode] ,(SELECT TOP 1 StationName FROM Receipt.tblStation WHERE StationCode=StationCode) AS  [StationName],IsPrintedDate AS ReceiptDate FROM Collection.tblCollectionReport  INNER JOIN Receipt.tblCollectionReceipt ON Collection.tblCollectionReport.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber  WHERE Receipt.tblCollectionReceipt.BatchNumber in ('{0}') ORDER BY Collection.tblCollectionReport.AgencyCode , Collection.tblCollectionReport.RevenueCode, Collection.tblCollectionReport.EReceipts", BatchNumber);

                        try
                        {
                            using (System.Data.DataSet dds = new System.Data.DataSet("DsCollectionReport"))
                            {
                                using (SqlDataAdapter ada = new SqlDataAdapter(vquery, Logic.ConnectionString))
                                {
                                    ada.Fill(dds, "CollectionReportTable");
                                    XRepManifest repManifest = new XRepManifest
                                    {
                                        DataSource        = dds,
                                        DataAdapter       = ada,
                                        DataMember        = "CollectionReportTable",
                                        RequestParameters = false
                                    };
                                    repManifest.xrLabel10.Text = Program.UserID;
                                    repManifest.logoPath       = Logic.logopth;
                                    repManifest.xrLabel12.Text = "MANIFEST OF PRINTED RECEIPTS";
                                    repManifest.xrLabel9.Text  = string.Format("{0} STATE GOVERNMENT",
                                                                               Program.StateName.ToUpper());
                                    repManifest.ShowPreviewDialog();
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Tripous.Sys.ErrorBox(String.Format("Calling Report with Batch number...., {0}{1}", ex.Message, ex.StackTrace));
                            return;
                        }
                    }
                    else
                    {
                        Common.setMessageBox("Receipt Number does not Exist !", Program.ApplicationName, 3);
                    }
                }
            }
        }
Example #4
0
        private void BtnUpdate_Click(object sender, EventArgs e)
        {
            if (ds.Tables[0].Rows[0]["ManifestID"] == DBNull.Value)
            {
                Common.setMessageBox(" Manifest Not created yet !", Program.ApplicationName, 1);
                return;
            }
            else
            {
                try
                {
                    SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);

                    using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                    {
                        connect.Open();
                        _command = new SqlCommand("ApplyManifest", connect)
                        {
                            CommandType = CommandType.StoredProcedure
                        };
                        //_command.Parameters.Add(new SqlParameter("@userid", SqlDbType.VarChar)).Value =
                        //    Program.UserID;
                        _command.Parameters.Add(new SqlParameter("@tblCollectionReport_Manifest",
                                                                 SqlDbType.Structured)).Value = ds.Tables[0];
                        _command.CommandTimeout = 0;
                        System.Data.DataSet response = new System.Data.DataSet();

                        //adp = new SqlDataAdapter(_command);
                        //adp.Fill(response);

                        ada = new SqlDataAdapter(_command);

                        ada.Fill(response);

                        connect.Close();

                        if (response.Tables[0].Rows[0]["returnCode"].ToString() == "00")
                        {
                            using (System.Data.DataSet dds = new System.Data.DataSet("DsCollectionReport"))
                            {
                                //using (SqlDataAdapter ada = new SqlDataAdapter(query, Logic.ConnectionString))
                                //{
                                //ada.Fill(dds, "CollectionReportTable");
                                XRepManifest repManifest = new XRepManifest
                                {
                                    DataSource        = response.Tables[1],
                                    DataAdapter       = ada,
                                    DataMember        = "CollectionReportTable",
                                    RequestParameters = false
                                };
                                repManifest.xrLabel10.Text = Program.UserID;
                                repManifest.logoPath       = Logic.logopth;
                                repManifest.xrLabel9.Text  = string.Format("{0} STATE GOVERNMENT",
                                                                           Program.StateName.ToUpper());
                                repManifest.ShowPreviewDialog();
                                //}
                            }
                        }
                        else
                        {
                        }
                    }
                }
                catch (Exception ex)
                {
                    Tripous.Sys.ErrorBox(ex.Message + ex.StackTrace.ToString());
                    return;
                }
                finally
                {
                    SplashScreenManager.CloseForm(false);
                }
            }
        }
Example #5
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);
            }
        }