예제 #1
0
        void bttnUpdate_Click(object sender, EventArgs e)
        {
            if (selection.SelectedCount < 1)
            {
                Common.setMessageBox("Please, select record to Map", Program.ApplicationName, 3);
            }
            else if (cboStation.SelectedIndex < 0)
            {
                Common.setMessageBox("Please, select Station to Map", Program.ApplicationName, 3);
            }
            else
            {
                //return;
                using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
                {
                    SqlTransaction transaction;
                    SqlCommand     sqlCommand1;

                    db.Open();

                    transaction = db.BeginTransaction();

                    try
                    {
                        for (int i = 0; i < selection.SelectedCount; i++)
                        {
                            //using (var ds = new System.Data.DataSet())
                            //{//select record
                            //BranchCode,BankShortCode

                            string lol  = ((selection.GetSelectedRow(i) as DataRowView)["BranchCode"].ToString());
                            string lol2 = ((selection.GetSelectedRow(i) as DataRowView)["BankShortCode"].ToString());

                            string query = String.Format("INSERT INTO [tblStationMap]([StationCode],[StationName],[RevenueOfficeCode],[RevenueOfficeName]) VALUES ('{0}','{1}','{2}','{3}')", cboStation.SelectedValue.ToString(), cboStation.Text, lol, lol2);


                            sqlCommand1 = new SqlCommand(query, db, transaction);
                            sqlCommand1.ExecuteNonQuery();
                        }


                        //call report for Print
                        transaction.Commit();
                        //ReceiptCall();
                    }
                    catch (SqlException sqlError)
                    {
                        transaction.Rollback();
                    }
                    db.Close();

                    setReload();

                    cboStation.SelectedIndex = -1;

                    Common.setMessageBox("Record has been successfully added", Program.ApplicationName, 1);
                    selection.ClearSelection();
                }
            }
        }
예제 #2
0
        private void SbnDisapprove_Click(object sender, EventArgs e)
        {
            string value = string.Empty;

            if (DialogResults.InputBox(@"Comments for Disapproving ", "Ministry Disapproval", ref value) == DialogResult.OK)
            {
                if (!string.IsNullOrWhiteSpace(value))
                {
                    for (int i = 0; i < selection.SelectedCount; i++)
                    {
                        tableTrans.Rows.Add(new object[] { (selection.GetSelectedRow(i) as DataRowView)["Period"], (selection.GetSelectedRow(i) as DataRowView)["Narriation"], Convert.ToInt32((selection.GetSelectedRow(i) as DataRowView)["BankAccountID"]), Convert.ToInt32((selection.GetSelectedRow(i) as DataRowView)["SummaryID"]), Convert.ToInt32((selection.GetSelectedRow(i) as DataRowView)["FinancialperiodID"]), (selection.GetSelectedRow(i) as DataRowView)["AgencyCode"], (selection.GetSelectedRow(i) as DataRowView)["RevenueCode"],
                                                           (selection.GetSelectedRow(i) as DataRowView)["Description"], (selection.GetSelectedRow(i) as DataRowView)["AgencyName"], Convert.ToDecimal((selection.GetSelectedRow(i) as DataRowView)["Amount"]) });
                    }

                    using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                    {
                        connect.Open();
                        _command = new SqlCommand("Reconciliation.DisapprovalMinistrySummary", connect)
                        {
                            CommandType = CommandType.StoredProcedure
                        };

                        _command.Parameters.Add(new SqlParameter("@pTransactiondb", SqlDbType.Structured)).Value = tableTrans;
                        _command.Parameters.Add(new SqlParameter("@Userid", SqlDbType.VarChar)).Value            = Program.UserID;
                        _command.Parameters.Add(new SqlParameter("@comment", SqlDbType.VarChar)).Value           = value;
                        _command.CommandTimeout = 0;

                        using (System.Data.DataSet ds = new System.Data.DataSet())
                        {
                            ds.Clear();
                            adp = new SqlDataAdapter(_command);
                            adp.Fill(ds);
                            connect.Close();

                            if (ds.Tables[0].Rows[0]["returnCode"].ToString() != "00")
                            {
                                Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);

                                return;
                            }
                            else
                            {
                                Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);

                                //FrmReportPosting report = new FrmReportPosting(ds.Tables[1], ds.Tables[2]);
                                //using (FrmReportPosting frmreport = new FrmReportPosting(ds))
                            }
                        }
                    }
                }
                else
                {
                    Common.setMessageBox("Disapproval Comment is Empty", "Ministry Disapproval", 3);

                    return;
                }
                setReload();
            }
        }
예제 #3
0
        void strProcess()
        {
            gridControl1.DataSource = string.Empty;

            //clear dt2 tabale
            dt2.Clear();


            for (int i = 0; i < selection.SelectedCount; i++)
            {
                dt2.Rows.Add(new object[] { (string)(selection.GetSelectedRow(i) as DataRowView)["PaymentRefNumber"], (string)(selection.GetSelectedRow(i) as DataRowView)["PaymentDate"], Convert.ToDouble((selection.GetSelectedRow(i) as DataRowView)["Amount"]) });
            }

            DataTable dtChange = getChanges(dt, dt2);

            if (dtChange != null)
            {
                gridControl1.DataSource            = dtChange.DefaultView;
                gridView1.OptionsBehavior.Editable = false;
                gridView1.Columns["Amount"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Numeric;
                gridView1.Columns["Amount"].DisplayFormat.FormatString = "n2";

                gridView1.Columns["PaymentRefNumber"].Visible = false;
                gridView1.BestFitColumns();

                gridView1.Columns["Amount"].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
                gridView1.Columns["Amount"].SummaryItem.FieldName     = "Amount";
                gridView1.Columns["Amount"].SummaryItem.DisplayFormat = "Total Amount = {0:n}";

                gridView1.OptionsView.ShowFooter = true;
            }
        }
예제 #4
0
파일: Form1.cs 프로젝트: leofemmy/TSS_Ogun
        private void SpbAdd_Click(object sender, EventArgs e)
        {
            if (selection.SelectedCount == 0)
            {
                Common.setMessageBox("No Selection Made to Merge", Program.ApplicationName, 3);
                return;
            }
            else
            {
                for (int i = 0; i < selection.SelectedCount; i++)
                {
                    temTable.Rows.Add(new object[] { String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["UTIN"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["OrganizationName"]) });
                }

                if (temTable != null && temTable.Rows.Count > 0)
                {
                    gridControl2.DataSource = temTable;

                    gridView2.Columns["UTIN"].OptionsColumn.AllowEdit = false;

                    gridView2.Columns["OrganizationName"].OptionsColumn.AllowEdit = false;

                    gridView2.BestFitColumns();

                    selection.ClearSelection();
                }

                //_Helper = new GridRadioGroupColumnHelper(gridView2);
            }
        }
예제 #5
0
        string GetPayRef()
        {
            string values = string.Empty;

            lblSelect.Text = string.Empty;

            int j = 0;

            using (WaitDialogForm form = new WaitDialogForm("Application Working...,Please Wait...", "Processing Your Request"))
            {
                for (int i = 0; i < selection.SelectedCount; i++)
                {
                    //string lol = ((selection.GetSelectedRow(i) as DataRowView)["PaymentRefNumber"].ToString());

                    values += String.Format("'{0}'", (selection.GetSelectedRow(i) as DataRowView)["PaymentRefNumber"]);
                    if (j + 1 < selection.SelectedCount)
                    {
                        values += ",";
                    }
                    ++j;

                    //insert record into tblreceipt for processing
                    using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
                    {
                        SqlTransaction transaction;

                        db.Open();

                        transaction = db.BeginTransaction();

                        try
                        {
                            string querys =
                                String.Format(
                                    "INSERT INTO [tblReceipt]([PaymentRefNumber],[ReceiptNo],[DateSent],[SentBy],[AgencyCode] ,[AgencyName],[RevenueCode],[Description],[DepositSlipNumber],[PaymentDate],[PayerID],[PayerName],[Amount],GeneratedBy,[BankName],[BranchName],StationCode) VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}');", String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["PaymentRefNumber"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["EReceipts"]), DateTime.Now, Program.UserID, String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["AgencyCode"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["AgencyName"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["RevenueCode"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["Description"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["DepositSlipNumber"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["PaymentDate"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["PayerID"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["PayerName"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["Amount"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["GeneratedBy"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["BankName"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["BranchName"]), Program.stationCode);

                            using (SqlCommand sqlCommand2 = new SqlCommand(querys, db, transaction))
                            {
                                sqlCommand2.ExecuteNonQuery();
                            }

                            transaction.Commit();
                        }
                        catch (Exception ex)
                        {
                            Tripous.Sys.ErrorBox(ex);
                            transaction.Rollback();
                            //return;
                        }
                        db.Close();
                    }
                }
            }



            return(values);
        }
예제 #6
0
        void GetPayRef()
        {
            string values = string.Empty;

            lblSelect.Text = string.Empty;

            int j = 0;

            temTable.Clear();

            for (int i = 0; i < selection.SelectedCount; i++)
            {
                temTable.Rows.Add(new object[] { String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["Payment Ref. Number"]), Program.UserID });
            }

            using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
            {
                connect.Open();
                _command = new SqlCommand("ArmsReceiptsMoved", connect)
                {
                    CommandType = CommandType.StoredProcedure
                };

                _command.Parameters.Add(new SqlParameter("@pTransaction", SqlDbType.Structured)).Value = temTable;

                _command.CommandTimeout = 0;

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

                response.Clear();

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

                connect.Close();

                if (String.Compare(response.Tables[0].Rows[0]["returnCode"].ToString(), "00", false) == 0)
                {
                    Common.setMessageBox(response.Tables[0].Rows[0]["returnmessage"].ToString(), Program.ApplicationName, 1);

                    if (response.Tables[1] != null || response.Tables[1].Rows.Count > 0)
                    {
                        using (FrmArmsDisplay display = new FrmArmsDisplay(response, true)
                        {
                            FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
                        })
                        {
                            display.ShowDialog();
                        }
                    }
                }
                else
                {
                    Common.setMessageBox(response.Tables[0].Rows[0]["returnmessage"].ToString(), Program.ApplicationName, 1);
                    return;
                }
            }
        }
예제 #7
0
        void EnableClick()
        {
            _dtb.Columns.Add("UserID", typeof(string));//give the datatable a structure, in this case, it has only two columns
            _dtb.Columns.Add("LoginStatusListID", typeof(Int64));

            for (int i = 0; i < selection.SelectedCount; i++)
            {
                string lol = ((selection.GetSelectedRow(i) as DataRowView)["UserListID"].ToString());

                object[] data = { lol, 1 };//2 means disable and 1 means enable
                //Dtt.Rows.Add(new object[] { filename, image });

                //_dtb.Rows.Add(new object[] { lol, 1 });//2 means disable and 1 means enable
                _dtb.Rows.Add(data);
            }
            retval = EasyServices.DoEnableDisables(_dtb, 4);

            _ds = (DataSet)retval;
        }
        //show selected
        private void button1_Click(object sender, System.EventArgs e)
        {
            string s = "";

            for (int i = 0; i < selection.SelectedCount; i++)
            {
                s += (selection.GetSelectedRow(i) as NameValue).Name + "\n";
            }
            MessageBox.Show(s, "Selected count: " + selection.SelectedCount.ToString());
        }
예제 #9
0
        private void btnNormalize_Click(object sender, EventArgs e)
        {
            string agentid = string.Empty;

            agentid = this.cboTaxAgent.SelectedValue.ToString();

            for (int i = 0; i < selection.SelectedCount; i++)
            {
                string lol = ((selection.GetSelectedRow(i) as DataRowView)["Payment Ref. Number"].ToString());
                //MessageBox.Show(lol);
                query = String.Format("UPDATE tblCollectionReport SET [Payer ID]='{0}' Where [Payment Ref. Number]='{1}'", agentid, lol);

                retval = extMethods.getQuery("INSERT", query);
            }
        }
예제 #10
0
        void btnUpdate_Click(object sender, EventArgs e)
        {
            temTable.Clear();

            //tableTrans.Rows.Add(new object[] { txtDateds.Text, ElemDescr, 0, txtDepositAmt.Text });
            for (int i = 0; i < selection.SelectedCount; i++)
            {
                //temTable.Rows.Add(new object[] { String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["BSID"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["DefinitionID"]) });

                temTable.Rows.Add(new object[] { String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["BSID"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["Description"]) });
            }

            try
            {
                using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                {
                    connect.Open();
                    _command = new SqlCommand("doSwepTransaction", connect)
                    {
                        CommandType = CommandType.StoredProcedure
                    };
                    _command.Parameters.Add(new SqlParameter("@pTransactiondb", SqlDbType.Structured)).Value = temTable;


                    using (System.Data.DataSet ds = new System.Data.DataSet())
                    {
                        ds.Clear();
                        adp = new SqlDataAdapter(_command);
                        adp.Fill(ds);
                        //Dts = ds.Tables[0];
                        connect.Close();

                        if (ds.Tables[0].Rows[0]["returnCode"].ToString() != "00")
                        {
                            Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 3);
                        }
                        else
                        {
                            Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 1);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Tripous.Sys.ErrorBox(String.Format("{0}{1}Allocating", ex.StackTrace, ex.Message)); return;
            }
        }
예제 #11
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            if (this.check.SelectedCount > 0)
            {
                for (int i = 0; i < check.SelectedCount; i++)
                {
                    this.resultList.Add((Role)check.GetSelectedRow(i));
                }

                this.DialogResult = DialogResult.OK;
            }
            else
            {
                //MessageBox.Show("PLEASE SELECT LABEL TO PRINT", "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                XtraMessageBox.Show(this, "PLEASE SELECT ROLE", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
            }
        }
예제 #12
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            if (this.check.SelectedCount > 0)
            {
                if (this._PRODUCT_LIST == null)
                {
                    this._PRODUCT_LIST = new List <Product>();
                }

                for (int i = 0; i < check.SelectedCount; i++)
                {
                    this._PRODUCT_LIST.Add((Product)check.GetSelectedRow(i));
                }

                this.DialogResult = DialogResult.OK;
            }
            else
            {
                XtraMessageBox.Show(this, "PLEASE SELECT PRODUCT", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
            }
        }
예제 #13
0
        void btnUpdate_Click(object sender, EventArgs e)
        {
            if (selection.SelectedCount == 0)
            {
                Common.setMessageBox("No Selection Made for Printing of Receipts", Program.ApplicationName, 3);
                return;
            }
            else if (selection2.SelectedCount == 0)
            {
                Common.setMessageBox("No Selection Made for Printing of Receipts", Program.ApplicationName, 3);
                return;
            }
            else if (selection.SelectedCount != selection.SelectedCount)
            {
                Common.setMessageBox("Number of Delist Transaction Record not equall", Program.ApplicationName, 3);
                return;
            }
            else
            {
                for (int i = 0; i < selection.SelectedCount; i++)
                {
                    for (int j = 0; j < selection2.SelectedCount; j++)
                    {
                        string _values  = String.Format("'{0}'", (selection.GetSelectedRow(i) as DataRowView)["Amount"]);
                        string _values2 = string.Format("'{0}'", (selection2.GetSelectedRow(j) as DataRowView)["Amount"]);

                        if (_values.CompareTo(_values2) == 0)
                        {
                            ///add code here for true
                            temTable.Rows.Add(new object[] { j, String.Format("{0}", (selection2.GetSelectedRow(j) as DataRowView)["PaymentRefNumber"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["PaymentRefNumber"]), Program.UserID });
                        }
                        else
                        {
                            Common.setMessageBox("Selected Amount Not Equall", Program.ApplicationName, 3);
                            return;
                        }
                    }
                }

                if (temTable != null && temTable.Rows.Count > 0)
                {
                    dataSet = new DataSet("table");

                    dataSet.Tables.Add(temTable);

                    switch (Program.intCode)
                    {
                    case 13:    //Akwa Ibom state
                        using (var receiptAka = new CentralAkwa.CollectionManager())
                        {
                            dts = receiptAka.DelistUpdate(dataSet);
                        }

                        using (var tempState = new StateAkwa.CollectionManager())
                        {
                            dts2 = tempState.DelistUpdate(dataSet);
                        }
                        break;

                    case 20:    //Delta state
                        using (var tempCentral = new CentralDetla.CollectionManager())
                        {
                            dts = tempCentral.DelistUpdate(dataSet);
                        }
                        using (var tempState = new StateDelta.CollectionManager())
                        {
                            dts2 = tempState.DelistUpdate(dataSet);
                        }
                        break;

                    case 32:    //kogi state
                    //using (var receiptservic = new Kogireceiptservice.ReceiptService())
                    //{
                    //    dataSet = receiptservic.DownloadDataCentral(Program.stateCode);
                    //}
                    //break;

                    case 37:    //ogun state
                        using (var receiptsserv = new Centralogun.CollectionManager())
                        {
                            dts = receiptsserv.DelistUpdate(dataSet);
                        }

                        using (var tempState = new StateOgun.CollectionManager())
                        {
                            dts2 = tempState.DelistUpdate(dataSet);
                        }
                        break;

                    case 40:    //oyo state

                        using (var receiptsServices = new Centraloyo.CollectionManager())
                        {
                            dts = receiptsServices.DelistUpdate(dataSet);
                        }

                        using (var tempState = new StateOyo.CollectionManager())
                        {
                            dts2 = tempState.DelistUpdate(dataSet);
                        }
                        break;

                    default:
                        break;
                    }
                }
                //get return
                //dataSet2.Tables[0].Rows[0]["returnCode"].ToString() == "-1"
                if (dts.Tables[0].Rows[0]["returnCode"].ToString() == "00" && dts2.Tables[0].Rows[0]["returnCode"].ToString() == "00")
                {
                    //insert record local after delist from online

                    using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                    {
                        //gridControl1.DataSource = null;
                        connect.Open();

                        _command = new SqlCommand("InsertDelist", connect)
                        {
                            CommandType = CommandType.StoredProcedure
                        };
                        _command.Parameters.Add(new SqlParameter("@DelistTemp", SqlDbType.Structured)).Value = temTable;
                        _command.CommandTimeout = 0;

                        using (System.Data.DataSet ds = new System.Data.DataSet())
                        {
                            adp = new SqlDataAdapter(_command);
                            adp.Fill(ds, "ViewUnsweptTransaction");
                            //Dts = ds.Tables[0];
                            connect.Close();

                            if (ds.Tables[0].Rows[0]["returnCode"].ToString() == "00")
                            {
                                Common.setMessageBox(string.Format("{0}", dts.Tables[0].Rows[0]["returnMessage"]), Program.ApplicationName, 1);
                                gridControl1.DataSource = null;
                                gridControl2.DataSource = null;
                            }
                            else
                            {
                                Tripous.Sys.ErrorBox(String.Format("{0}{1}", ds.Tables[0].Rows[0]["returnCode"].ToString(), ds.Tables[0].Rows[0]["returnMessage"].ToString()));

                                return;
                            }
                        }
                    }
                }
                else
                {
                    Common.setMessageBox(string.Format("{0}...Error Occur During Delist Transaction", dts.Tables[0].Rows[0]["returnMessage"]), Program.ApplicationName, 3);
                    return;
                }
            }
        }
예제 #14
0
        void btnPrint_Click(object sender, EventArgs e)
        {
            PrintType = "Original";

            if (Program.stateCode == "20")
            {
                Url = "www.deltabir.com";
            }
            else if (Program.stateCode == "13")
            {
                Url = "www.Akwaibomrevenue.com";
            }
            else if (Program.stateCode == "37")
            {
                Url = "www.ogunbir.com";
            }
            else if (Program.stateCode == "40")
            {
                Url = "www.oyobir.com";
            }
            if (selection.SelectedCount == 0)
            {
                Common.setMessageBox("Please Check Records to Print", Program.ApplicationName, 1);
                return;
            }
            else
            {
                EmptyBankReceipts();

                using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
                {
                    SqlTransaction transaction;

                    db.Open();

                    transaction = db.BeginTransaction();

                    try
                    {
                        for (int i = 0; i < selection.SelectedCount; i++)
                        {
                            using (var ds = new System.Data.DataSet())
                            {//select record
                                string lol = ((selection.GetSelectedRow(i) as DataRowView)["PaymentRefNumber"].ToString());

                                query = String.Format("SELECT [PaymentRefNumber],[DepositSlipNumber],[PaymentDate],[PayerID],[PayerName] ,[RevenueCode] ,[Description] ,[Amount] ,[PaymentMethod] ,[AgencyName] ,	[BankName] ,[BranchName] ,[EReceipts] ,[PayerAddress],StationName,ZoneName FROM dbo.tblCollectionReport WHERE ([PaymentDate] >= '{0}' AND [PaymentDate] <= '{1}') and EReceipts IS NOT NULL AND [PaymentRefNumber]= '{2}'", dtpfrom.Value.Date.ToString("yyyy-MM-dd"), dtpTo.Value.Date.ToString("yyyy-MM-dd"), lol);

                                using (SqlDataAdapter ada = new SqlDataAdapter(query, Logic.ConnectionString))
                                {
                                    ada.Fill(ds, "table");
                                }

                                Dt = ds.Tables[0];
                            }

                            //insert record into bankreceipt table

                            foreach (DataRow item in Dt.Rows)
                            {
                                if (item["PayerID"].ToString().Length > 14)
                                {
                                    payerid = "Please approach the BIR for your unique Payer ID.";
                                }
                                else
                                {
                                    payerid = item["PayerID"].ToString();
                                }

                                amount = amounttowords.convertToWords(item["Amount"].ToString());
                                //if (item.Rows[0]["PlateCode"].length)
                                //payerid
                                //amount
                                //try
                                //{
                                string desc = Regex.Replace(item["Description"].ToString(), @"[']", "");

                                string query2 = String.Format("INSERT INTO [BankReceipts]([PaymenRefNumber],[DepositSlipNumber],[PaymentDate],[PayerID],[PayerName] ,[RevenueCode] ,[Description] ,[Amount] ,[PaymentMethod] ,[AgencyName] ,[BankName] ,[BranchName] ,[ReceiptNumber] ,[PayerAddress],[PrintType],[URL],[AmountWords],[Users],StationName,TaxOffice) VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}', '{14}','{15}','{16}','{17}' ,'{18}','{19}')", item["PaymentRefNumber"].ToString(), item["DepositSlipNumber"].ToString(), item["PaymentDate"].ToString(), payerid, item["PayerName"].ToString(), item["RevenueCode"].ToString(), desc, item["Amount"].ToString(), item["PaymentMethod"].ToString(), item["AgencyName"].ToString(), item["BankName"].ToString(), item["BranchName"].ToString(), item["EReceipts"].ToString(), item["PayerAddress"].ToString(), PrintType, Url, amount, user, item["StationName"].ToString(), item["ZoneName"].ToString());


                                using (SqlCommand sqlCommand1 = new SqlCommand(query2, db, transaction))
                                {
                                    sqlCommand1.ExecuteNonQuery();
                                }

                                //}
                                //catch (Exception ex)
                                //{
                                //    Common.setMessageBox(ex.StackTrace.ToString(), Program.ApplicationName, 3);
                                //    return;
                                //}
                            }
                        }
                        transaction.Commit();

                        //call report for Print

                        ReceiptCall();

                        btnMain.Enabled  = true;
                        btnPrint.Enabled = false;
                    }
                    catch (SqlException sqlError)
                    {
                        transaction.Rollback();
                    }
                    db.Close();
                }
            }
        }
예제 #15
0
        void Processwork()
        {
            if (string.IsNullOrEmpty(selection.SelectedCount.ToString()) || selection.SelectedCount == 0)
            {
                Common.setMessageBox("No Record selected", "Receipt Reprint Approval", 1); return;
            }
            string str = string.Format("Do you really want to Approve this ({0}) number(s) of Reclassified Transaction", selection.SelectedCount);

            DialogResult results = MessageBox.Show(str, Program.ApplicationName, MessageBoxButtons.YesNo);

            if (results == DialogResult.Yes)
            {
                for (int i = 0; i < selection.SelectedCount; i++)
                {
                    //tableTrans.Rows.Add(new object[] { (selection.GetSelectedRow(i) as DataRowView)["ID"], (selection.GetSelectedRow(i) as DataRowView)["BSID"], (selection.GetSelectedRow(i) as DataRowView)["TransID"] });

                    switch (Program.intCode)
                    {
                    //case 13://Akwa Ibom state
                    //    using (var receiptAka = new AkwaIbomReceiptServices.ReceiptService())
                    //    {
                    //        dsreturn = receiptAka.LogReceiptsReprintRequest(String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["EReceipts"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["PaymentRefNumber"]), null, Program.UserID, String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["Comment"]), "NONE", null, null, null, null, null, null, Program.stationCode);
                    //    }
                    //    break;
                    case 20:    //Delta state
                        using (var receiptDelta = new DeltaBir.ReceiptService())
                        {
                            dsreturn = receiptDelta.LogReceiptsReprintRequest(String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["EReceipts"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["PaymentRefNumber"]), null, Program.UserID, String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["Comment"]), "NONE", null, null, null, null, null, null, Program.stationCode);
                        }
                        break;

                    case 32:    //kogi state
                        break;

                    case 37:    //ogun state
                    //using (var receiptsserv = new ReceiptService())
                    //{
                    //    dsreturn = receiptsserv.LogReceiptsReprintRequest(String.Format("{0}", row["EReceipts"]), String.Format("{0}", row["PaymentRefNumber"]), null, Program.UserID, txtReason.Text, "NONE", null, null, null, null, null, null, Program.stationCode);
                    //}
                    //break;
                    case 40:    //oyo state
                    //using (var receiptsServices = new OyoReceiptServices.ReceiptService())
                    //{
                    //    dsreturn = receiptsServices.LogReceiptsReprintRequest(String.Format("{0}", row["EReceipts"]), String.Format("{0}", row["PaymentRefNumber"]), null, Program.UserID, txtReason.Text, "NONE", null, null, null, null, null, null, Program.stationCode);
                    //}
                    //break;

                    default:
                        break;
                    }
                    if (dsreturn.Tables[0].Rows[0]["returnCode"].ToString() == "-1")
                    {
                        Common.setMessageBox(dsreturn.Tables[0].Rows[0]["returnmessage"].ToString(), Program.ApplicationName, 1);
                        return;
                    }
                    else
                    {
                        using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
                        {
                            SqlTransaction transaction;

                            db.Open();

                            transaction = db.BeginTransaction();
                            try
                            {
                                string query1 = String.Format("UPDATE Receipt.tblReprintedReceipts SET FirstApprovalStatus = '{0}',FirstApprovalBy = '{1}', FirstApprovalDate = '{2}' WHERE PaymentRefNumber IN('{3}')", 1, Program.UserName, string.Format("{0:yyyy/MM/dd hh:mm:ss}", DateTime.Now), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["PaymentRefNumber"]));

                                using (SqlCommand sqlCommand = new SqlCommand(query1, db, transaction))
                                {
                                    sqlCommand.ExecuteNonQuery();
                                }
                            }
                            catch (Exception ex)
                            {
                                transaction.Rollback();
                                Tripous.Sys.ErrorBox(ex);
                                return;
                            }
                            transaction.Commit();

                            db.Close();
                        }
                    }
                }
                ///
                Common.setMessageBox("Request Sent for Approval,Please Click on Get Approval Record, if your Admin has approve the record....", Program.ApplicationName, 1);
                return;
            }
            else
            {
                return;
            }
        }
예제 #16
0
        private void SbnDisapprove_Click(object sender, EventArgs e)
        {
            string value = string.Empty;

            if (DialogResults.InputBox(@"Comments for Disapproving ", "Reclassification", ref value) == DialogResult.OK)
            {
                //value = String.Format("{0:N2}", Convert.ToDecimal(value));

                if (!string.IsNullOrWhiteSpace(value))
                {
                    if (string.IsNullOrEmpty(selection.SelectedCount.ToString()) || selection.SelectedCount == 0)
                    {
                        Common.setMessageBox("No Record selected", "Reclassification", 1); return;
                    }
                    else
                    {
                        for (int i = 0; i < selection.SelectedCount; i++)
                        {
                            tableTrans.Rows.Add(new object[] { (selection.GetSelectedRow(i) as DataRowView)["ID"], (selection.GetSelectedRow(i) as DataRowView)["BSID"], (selection.GetSelectedRow(i) as DataRowView)["TransID"] });
                        }

                        using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                        {
                            connect.Open();
                            _command = new SqlCommand("doReclassifiedRequestDisapproved", connect)
                            {
                                CommandType = CommandType.StoredProcedure
                            };
                            _command.Parameters.Add(new SqlParameter("@pTransaction", SqlDbType.Structured)).Value = tableTrans;
                            _command.Parameters.Add(new SqlParameter("@userid", SqlDbType.VarChar)).Value          = Program.UserID;
                            _command.Parameters.Add(new SqlParameter("@comment", SqlDbType.VarChar)).Value         = value;

                            using (System.Data.DataSet ds = new System.Data.DataSet())
                            {
                                ds.Clear();
                                adp = new SqlDataAdapter(_command);
                                adp.Fill(ds);
                                connect.Close();

                                if (ds.Tables[0].Rows[0]["returnCode"].ToString() == "00")
                                {
                                    Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);
                                    setReload();
                                    return;
                                }
                                else
                                {
                                    Tripous.Sys.ErrorBox(String.Format("{0}", ds.Tables[0].Rows[0]["returnMessage"].ToString()));
                                    return;
                                }
                            }
                        }
                    }
                }
                else
                {
                    Common.setMessageBox("Disapproval Comment is Empty", "Reclassification", 3);

                    return;
                }
            }
        }
예제 #17
0
        void bttnUpdate_Click(object sender, EventArgs e)
        {
            //tblPrintingRevenueCode
            if (selection.SelectedCount < 1)
            {
                Common.setMessageBox("Please, select revenue code ", Program.ApplicationName, 3); return;
            }
            else
            {
                //delete record from the database table

                using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
                {
                    SqlTransaction transaction;

                    SqlCommand sqlCommand1;

                    db.Open();

                    transaction = db.BeginTransaction();

                    try
                    {
                        sqlCommand1 = new SqlCommand("DELETE FROM tblPrintingRevenueCode", db, transaction);
                        sqlCommand1.ExecuteNonQuery();

                        transaction.Commit();
                    }
                    catch (Exception ex)
                    {
                        transaction.Rollback();
                        Tripous.Sys.ErrorBox(ex);
                        return;
                    }
                    db.Close();
                }

                //insert new record into the database
                using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
                {
                    SqlTransaction transaction;
                    SqlCommand     sqlCommand1;

                    db.Open();

                    transaction = db.BeginTransaction();

                    for (int i = 0; i < selection.SelectedCount; i++)
                    {
                        string lol   = ((selection.GetSelectedRow(i) as DataRowView)["RevenueCode"].ToString());
                        string query = String.Format("INSERT INTO [tblPrintingRevenueCode]([RevenueCode]) VALUES ('{0}')", lol);

                        sqlCommand1 = new SqlCommand(query, db, transaction);
                        sqlCommand1.ExecuteNonQuery();
                    }

                    transaction.Commit();
                }
                Common.setMessageBox(" Transaction Completed Successfully ", Program.ApplicationName, 1);
            }
        }
예제 #18
0
        void bttnUpdate_Click(object sender, EventArgs e)
        {
            if (selection.SelectedCount > 1)
            {
                Common.setMessageBox("Only Revenue Temp can be Set up", "Default Revenue Set up", 1);
                return;
            }
            else
            {
                if (!boolIsUpdate)
                {
                    for (int i = 0; i < selection.SelectedCount; i++)
                    {
                        string values = string.Empty;
                        values += String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["RevenueCode"]);

                        string query = string.Format("INSERT INTO [Reconciliation].[tblRevenueTemp]([RevenueCode]) VALUES ('{0}');", values);

                        using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
                        {
                            SqlTransaction transaction;

                            db.Open();

                            transaction = db.BeginTransaction();

                            try
                            {
                                using (SqlCommand sqlCommand1 = new SqlCommand(query, db, transaction))
                                {
                                    sqlCommand1.ExecuteNonQuery();
                                }

                                transaction.Commit();
                            }
                            catch (SqlException sqlError)
                            {
                                transaction.Rollback(); Tripous.Sys.ErrorBox(sqlError);
                                return;
                            }
                            db.Close();
                        }
                    }
                    return;
                }
                for (int i = 0; i < selection.SelectedCount; i++)
                {
                    string values = string.Empty;
                    values += String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["RevenueCode"]);

                    using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
                    {
                        SqlTransaction transaction;

                        db.Open();

                        transaction = db.BeginTransaction();

                        try
                        {
                            string dry = String.Format(String.Format("UPDATE [Reconciliation].[tblRevenueTemp] SET [RevenueCode]='{{0}}' where  RevenueCode ='{0}'", ID), values);

                            using (SqlCommand sqlCommand1 = new SqlCommand(dry, db, transaction))
                            {
                                sqlCommand1.ExecuteNonQuery();
                            }

                            transaction.Commit();
                        }
                        catch (SqlException sqlError)
                        {
                            transaction.Rollback(); Tripous.Sys.ErrorBox(sqlError);
                            return;
                        }
                        db.Close();
                    }
                }
                Common.setMessageBox("Record Update Successfully", Program.ApplicationName, 1);
                return;
            }
        }
예제 #19
0
        void GetPayRef()
        {
            //string values = string.Empty;

            lblSelect.Text = string.Empty;

            int j = 0;


            for (int i = 0; i < selection.SelectedCount; i++)
            {
                values += String.Format("'{0}'", (selection.GetSelectedRow(i) as DataRowView)["PaymentRefNumber"]);
                if (j + 1 < selection.SelectedCount)
                {
                    values += ",";
                }
                ++j;

                temTable.Rows.Add(new object[] { String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["PaymentRefNumber"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["EReceipts"]), Program.UserID });
            }

            //new line here

            using (System.Data.DataSet dds = new System.Data.DataSet("DsCollectionReport"))
            {
                SqlDataAdapter ada;

                using (WaitDialogForm form = new WaitDialogForm())
                {
                    string strFormat = null; string query = string.Empty;


                    switch (Program.intCode)
                    {
                    case 20:    //detla state
                        query = string.Format("SELECT [ID] , [Provider] , [Channel] ,Collection.tblCollectionReport.[PaymentRefNumber] , [DepositSlipNumber] , CONVERT(VARCHAR,CONVERT(DATE,[PaymentDate])) AS PaymentDate,[PayerID] , UPPER([PayerName]) AS [PayerName], [Amount] ,[PaymentMethod] ,[ChequeNumber] ,[ChequeValueDate] ,[ChequeStatus] ,[DateChequeReturned] ,[TelephoneNumber] ,[ReceiptNo] as [EReceipts],Collection.tblCollectionReport.ReceiptDate ,UPPER([PayerAddress]) as [PayerAddress] ,[User] ,[RevenueCode] ,[Description] , [ChequeBankCode] ,[ChequeBankName] ,[AgencyName] ,[AgencyCode] ,[BankCode] ,[BankName] ,[BranchCode] ,[BranchName] ,[ZoneCode] ,[ZoneName] ,[Username] ,[AmountWords] ,Collection.tblCollectionReport.[EReceiptsDate] ,[GeneratedBy] ,Collection.tblCollectionReport.[StationCode] ,(SELECT TOP 1 StationName FROM Receipt.tblStation  WHERE tblStation.StationCode = Collection.tblCollectionReport.[StationCode]) AS StationName,ControlNumber,ControlNumberBy,ControlNumberDate,IsPrintedDate,PrintedBY from Collection.tblCollectionReport INNER JOIN Receipt.tblCollectionReceipt ON Receipt.tblCollectionReceipt.PaymentRefNumber = Collection.tblCollectionReport.PaymentRefNumber INNER JOIN Receipt.tblReceiptoption ON Receipt.tblReceiptoption.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE Collection.tblCollectionReport.PaymentRefNumber IN ({0}) AND  Receipt.tblReceiptoption.IsPrinted=1 AND Receipt.tblReceiptoption.OptionVal={1}  ORDER BY Collection.tblCollectionReport.AgencyName ,Collection.tblCollectionReport.Description,Collection.tblCollectionReport.EReceipts", values, (ival - 1));
                        break;

                    default:
                        query = string.Format("SELECT [ID] , [Provider] , [Channel] ,Collection.tblCollectionReport.[PaymentRefNumber] , [DepositSlipNumber] , CONVERT(VARCHAR,CONVERT(DATE,[PaymentDate])) AS PaymentDate,[PayerID] , UPPER([PayerName]) AS [PayerName], [Amount] ,[PaymentMethod] ,[ChequeNumber] ,[ChequeValueDate] ,[ChequeStatus] ,[DateChequeReturned] ,[TelephoneNumber] ,[ReceiptNo] ,Collection.tblCollectionReport.ReceiptDate ,UPPER([PayerAddress]) as [PayerAddress] ,[User] ,[RevenueCode] ,tblCollectionReport.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,ControlNumber,ControlNumberBy,ControlNumberDate,IsPrintedDate,PrintedBY, Symbol , Surfix , tblCurrency.Description AS prefix from Collection.tblCollectionReport JOIN Reconciliation.tblCurrency ON tblCurrency.CurrencyCode = tblCollectionReport.CurrencyCode                                INNER JOIN Receipt.tblCollectionReceipt ON Receipt.tblCollectionReceipt.PaymentRefNumber = Collection.tblCollectionReport.PaymentRefNumber INNER JOIN Receipt.tblReceiptoption ON Receipt.tblReceiptoption.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE Collection.tblCollectionReport.PaymentRefNumber IN ({0}) AND  Receipt.tblReceiptoption.IsPrinted=1 AND Receipt.tblReceiptoption.OptionVal={1}  ORDER BY Collection.tblCollectionReport.AgencyName ,Collection.tblCollectionReport.Description,Collection.tblCollectionReport.EReceipts", values, (ival - 1));
                        break;
                    }


                    DataTable Dt = dds.Tables.Add("CollectionReportTable");
                    ada = new SqlDataAdapter(query, Logic.ConnectionString);
                    ada.Fill(dds, "CollectionReportTable");
                    Logic.ProcessDataTable(Dt);;
                    //strCollectionReportID = strFormat;
                }

                switch (Program.intCode)
                {
                case 13:    //Akwa Ibom state
                    XtraRepReceiptAkwa akwa = new XtraRepReceiptAkwa {
                        DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable"
                    };
                    akwa.ShowPreviewDialog();
                    break;

                case 20:    //detla state
                    XtraRepReceiptDelta delta = new XtraRepReceiptDelta {
                        DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable"
                    };
                    delta.xrLabel19.Visible = true;
                    //delta.xrLabel13.Visible = true;
                    delta.logoPath = Logic.singaturepth;
                    delta.ShowPreviewDialog();
                    break;

                case 37:    //ogun state
                    XRepReceipt recportRec = new XRepReceipt {
                        DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable"
                    };
                    recportRec.logoPath = Logic.singaturepth;
                    recportRec.ShowPreviewDialog();
                    break;

                case 40:    //oyo state
                    XRepReceiptoyo recportRecs = new XRepReceiptoyo {
                        DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable"
                    };
                    recportRecs.ShowPreviewDialog();
                    break;

                default:

                    break;
                }
            }


            DialogResult result = MessageBox.Show(" Is Receipt Printing Successful ?", Program.ApplicationName, MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                try
                {
                    SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);

                    bttnMain.Visible = true; label1.Visible = true;
                    bttnMain.Enabled = true;

                    using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                    {
                        connect.Open();
                        _command = new SqlCommand("doReceiptOptionother", connect)
                        {
                            CommandType = CommandType.StoredProcedure
                        };
                        _command.Parameters.Add(new SqlParameter("@userid", SqlDbType.VarChar)).Value =
                            Program.UserID;
                        _command.Parameters.Add(new SqlParameter("@Receop", SqlDbType.VarChar)).Value =
                            ival;
                        _command.Parameters.Add(new SqlParameter("@tempTable",
                                                                 SqlDbType.Structured)).Value = temTable;

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

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

                        connect.Close();
                        if (response.Tables[0].Rows[0]["returnCode"].ToString() != "00")
                        {
                            Tripous.Sys.ErrorBox(response.Tables[0].Rows[0]["returnMessage"].ToString()); return;
                        }
                        else
                        {
                            Common.setMessageBox("Receipt Printed Successfully", Program.ApplicationName, 1);
                            //selection.ClearSelection();
                            this.Close();
                            return;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Tripous.Sys.ErrorBox(ex); return;
                }
                finally
                {
                    SplashScreenManager.CloseForm(false);
                }
                //using (FrmMainFest frmMainFest = new FrmMainFest(strCollectionReportID, values, criteria2, false) { IDList = strCollectionReportID })
                //{
                //    frmMainFest.ShowDialog();
                //}
            }
            else
            {
                return;
            }



            #region old

            //using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
            //{
            //    connect.Open();
            //    _command = new SqlCommand("InserttblReceipt", connect) { CommandType = CommandType.StoredProcedure };
            //    _command.Parameters.Add(new SqlParameter("@tblCollectionReport_Temp", SqlDbType.Structured)).Value = temTable;
            //    _command.Parameters.Add(new SqlParameter("@type", SqlDbType.VarChar)).Value = "New";
            //    _command.Parameters.Add(new SqlParameter("@userid", SqlDbType.VarChar)).Value = Program.UserID;
            //    System.Data.DataSet response = new System.Data.DataSet();
            //    response.Clear();
            //    adp = new SqlDataAdapter(_command);
            //    adp.Fill(response);

            //    connect.Close();
            //    if (String.Compare(response.Tables[0].Rows[0]["returnCode"].ToString(), "00", false) == 0)
            //    {
            //        //do something load the report page
            //        using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
            //        {
            //            SqlTransaction transaction;

            //            db.Open();

            //            transaction = db.BeginTransaction();

            //            try
            //            {
            //                using (System.Data.DataSet dds = new System.Data.DataSet("DsCollectionReport"))
            //                {
            //                    SqlDataAdapter ada;

            //                    using (WaitDialogForm form = new WaitDialogForm())
            //                    {
            //                        string strFormat = null;

            //                        string query = string.Format("SELECT [ID] , [Provider] , [Channel] ,Collection.tblCollectionReport.[PaymentRefNumber] , [DepositSlipNumber] , CONVERT(VARCHAR,CONVERT(DATE,[PaymentDate])) AS PaymentDate,[PayerID] , UPPER([PayerName]) AS [PayerName], [Amount] ,[PaymentMethod] ,[ChequeNumber] ,[ChequeValueDate] ,[ChequeStatus] ,[DateChequeReturned] ,[TelephoneNumber] ,[ReceiptNo] ,[ReceiptDate] ,UPPER([PayerAddress]) as [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,ControlNumber from Collection.tblCollectionReport INNER JOIN Receipt.tblCollectionReceipt ON Receipt.tblCollectionReceipt.PaymentRefNumber = Collection.tblCollectionReport.PaymentRefNumber WHERE PaymentRefNumber IN ({0})  ORDER BY Collection.tblCollectionReport.AgencyName ,Collection.tblCollectionReport.Description,Collection.tblCollectionReport.EReceipts", values);

            //                        DataTable Dt = dds.Tables.Add("CollectionReportTable");
            //                        ada = new SqlDataAdapter(query, Logic.ConnectionString);
            //                        ada.Fill(dds, "CollectionReportTable");
            //                        Logic.ProcessDataTable(Dt);;
            //                        //strCollectionReportID = strFormat;
            //                    }


            //                    //XRepReceipt recportRec = new XRepReceipt { DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable" };

            //                    //recportRec.ShowPreviewDialog();

            //                    ////selection.ClearSelection();
            //                    //dds.Clear();

            //                    switch (Program.intCode)
            //                    {
            //                        case 13://Akwa Ibom state
            //                            XtraRepReceiptAkwa akwa = new XtraRepReceiptAkwa { DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable" };
            //                            akwa.ShowPreviewDialog();
            //                            break;

            //                        case 20://detla state
            //                            XtraRepReceiptDelta delta = new XtraRepReceiptDelta { DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable" };
            //                            delta.ShowPreviewDialog();
            //                            break;

            //                        case 37://ogun state
            //                            XRepReceipt recportRec = new XRepReceipt { DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable" };

            //                            recportRec.ShowPreviewDialog();
            //                            break;

            //                        case 40://oyo state
            //                            XRepReceiptoyo recportRecs = new XRepReceiptoyo { DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable" };
            //                            recportRecs.ShowPreviewDialog();
            //                            break;

            //                        //case 32://kogi state

            //                        //    XRepReceiptkogi recportRecko = new XRepReceiptkogi { DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable" };
            //                        //    recportRecko.ShowPreviewDialog();

            //                        //    break;

            //                        default:

            //                            break;
            //                    }
            //                }

            //                //dds.Clear();
            //                DialogResult result = MessageBox.Show(" Is Receipt Printing Successful ?", Program.ApplicationName, MessageBoxButtons.YesNo);

            //                if (result == DialogResult.Yes)
            //                {
            //                    try
            //                    {
            //                        SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);

            //                        //update the collection table by seting the isprinted to true
            //                        using (SqlConnection dbs = new SqlConnection(Logic.ConnectionString))
            //                        {
            //                            SqlTransaction transactions;

            //                            dbs.Open();

            //                            //transaction = db.BeginTransaction();

            //                            transactions = dbs.BeginTransaction();

            //                            try
            //                            {
            //                                string query1 = String.Format("UPDATE tblCollectionReport SET isPrinted=1,IsPrintedDate= '{0:MM/dd/yyyy HH:mm:ss tt}',PrintedBY='{1}' ,StationCode='{2}' WHERE PaymentRefNumber IN ({3})", DateTime.Now, Program.UserID, Program.stationCode, values);

            //                                //string query1 = String.Format("UPDATE Receipt.tblCollectionReceipt SET isPrinted=1,IsPrintedDate= '{0:MM/dd/yyyy HH:mm:ss tt}',PrintedBY='{1}',StationCode='{2}' WHERE PaymentRefNumber IN (SELECT PaymentRefNumber FROM Receipt.tblReceipt WHERE SentBy='{1}')", DateTime.Now, Program.UserID, Program.stationCode);

            //                                using (SqlCommand sqlCommand = new SqlCommand(query1, db, transaction))
            //                                {
            //                                    sqlCommand.ExecuteNonQuery();
            //                                }

            //                            }
            //                            catch (Exception ex)
            //                            {
            //                                transaction.Rollback();
            //                                Tripous.Sys.ErrorBox(ex);
            //                                return;
            //                            }
            //                            transaction.Commit();

            //                            db.Close();
            //                        }
            //                        bttnMain.Visible = true; label1.Visible = true;
            //                        bttnMain.Enabled = true;
            //                    }
            //                    finally
            //                    {
            //                        SplashScreenManager.CloseForm(false);
            //                    }
            //                    //using (FrmMainFest frmMainFest = new FrmMainFest(strCollectionReportID, values, criteria2, false) { IDList = strCollectionReportID })
            //                    //{
            //                    //    frmMainFest.ShowDialog();
            //                    //}
            //                }
            //                else
            //                    return;

            //            }
            //            catch (SqlException sqlError)
            //            {
            //                //transaction.Rollback();

            //                Tripous.Sys.ErrorBox(sqlError);
            //            }
            //            catch (Exception ex)
            //            {
            //                Tripous.Sys.ErrorBox(ex);
            //            }
            //            db.Close();
            //        }

            //    }
            //    else
            //    {
            //        if (String.Compare(response.Tables[0].Rows[0]["returnCode"].ToString(), "-1", false) == 0)
            //        {
            //            using (Frmcontrol frmcontrol = new Frmcontrol())
            //            {
            //                frmcontrol.gridControl1.DataSource = response.Tables[1];
            //                frmcontrol.gridView1.BestFitColumns();
            //                frmcontrol.label1.Text = "Payment Ref. Number Receipt printing in Process";
            //                frmcontrol.Text = "Payment Ref. Number Receipt printing in Process";
            //                frmcontrol.ShowDialog();
            //            }

            //            DialogResult result = MessageBox.Show("Do you wish to continue to Print the Receipts?", Program.ApplicationName, MessageBoxButtons.YesNo);

            //            if (result == DialogResult.Yes)
            //            {

            //                using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
            //                {
            //                    SqlTransaction transaction;

            //                    db.Open();

            //                    transaction = db.BeginTransaction();

            //                    try
            //                    {
            //                        using (System.Data.DataSet dds = new System.Data.DataSet("DsCollectionReport"))
            //                        {
            //                            SqlDataAdapter ada;

            //                            using (WaitDialogForm form = new WaitDialogForm())
            //                            {
            //                                string strFormat = null;

            //                                string query = string.Format("SELECT [ID] , [Provider] , [Channel] ,[PaymentRefNumber] , [DepositSlipNumber] , CONVERT(VARCHAR,CONVERT(DATE,[PaymentDate])) AS PaymentDate,[PayerID] , UPPER([PayerName]) AS [PayerName], [Amount] ,[PaymentMethod] ,[ChequeNumber] ,[ChequeValueDate] ,[ChequeStatus] ,[DateChequeReturned] ,[TelephoneNumber] ,[ReceiptNo] ,[ReceiptDate] ,UPPER([PayerAddress]) as [PayerAddress] ,[User] ,[RevenueCode] ,[Description] , [ChequeBankCode] ,[ChequeBankName] ,[AgencyName] ,[AgencyCode] ,[BankCode] ,[BankName] ,[BranchCode] ,[BranchName] ,[ZoneCode] ,[ZoneName] ,[Username] ,[AmountWords] ,[EReceipts] ,[EReceiptsDate] ,[GeneratedBy] ,[StationCode] ,(SELECT TOP 1 StationName FROM Receipt.tblStation  WHERE tblStation.StationCode = Collection.tblCollectionReport.[StationCode]) AS StationName from Collection.tblCollectionReport WHERE PaymentRefNumber IN ({0}) ORDER BY Collection.tblCollectionReport.AgencyName ,Collection.tblCollectionReport.Description,Collection.tblCollectionReport.EReceipts", values);

            //                                DataTable Dt = dds.Tables.Add("CollectionReportTable");
            //                                ada = new SqlDataAdapter(query, Logic.ConnectionString);
            //                                ada.Fill(dds, "CollectionReportTable");
            //                                Logic.ProcessDataTable(Dt);;
            //                                //strCollectionReportID = strFormat;
            //                            }


            //                            //XRepReceipt recportRec = new XRepReceipt { DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable" };

            //                            //recportRec.ShowPreviewDialog();

            //                            switch (Program.intCode)
            //                            {
            //                                case 13://Akwa Ibom state
            //                                    XtraRepReceiptAkwa akwa = new XtraRepReceiptAkwa { DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable" };
            //                                    akwa.ShowPreviewDialog();
            //                                    break;

            //                                case 20://detla state
            //                                    XtraRepReceiptDelta delta = new XtraRepReceiptDelta { DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable" };
            //                                    delta.ShowPreviewDialog();
            //                                    break;

            //                                case 37://ogun state
            //                                    XRepReceipt recportRec = new XRepReceipt { DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable" };

            //                                    recportRec.ShowPreviewDialog();
            //                                    break;

            //                                case 40://oyo state
            //                                    XRepReceiptoyo recportRecs = new XRepReceiptoyo { DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable" };
            //                                    recportRecs.ShowPreviewDialog();
            //                                    break;

            //                                //case 32://kogi state

            //                                //    XRepReceiptkogi recportRecko = new XRepReceiptkogi { DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable" };
            //                                //    recportRecko.ShowPreviewDialog();

            //                                //    break;

            //                                default:
            //                                    break;
            //                            }
            //                            //selection.ClearSelection();
            //                            dds.Clear();
            //                        }

            //                        DialogResult results = MessageBox.Show(" Is Receipt Printing Successful ?", Program.ApplicationName, MessageBoxButtons.YesNo);

            //                        if (results == DialogResult.Yes)
            //                        {
            //                            try
            //                            {
            //                                SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);

            //                                //update the collection table by seting the isprinted to true
            //                                using (SqlConnection dbs = new SqlConnection(Logic.ConnectionString))
            //                                {
            //                                    SqlTransaction transactions;

            //                                    dbs.Open();

            //                                    //transaction = db.BeginTransaction();

            //                                    transactions = dbs.BeginTransaction();

            //                                    try
            //                                    {
            //                                        string query1 = String.Format("UPDATE Receipt.tblCollectionReceipt SET isPrinted=1,IsPrintedDate= '{0:MM/dd/yyyy HH:mm:ss tt}',PrintedBY='{1}' ,StationCode='{2}' WHERE PaymentRefNumber IN ({3})", DateTime.Now, Program.UserID, Program.stationCode, values);

            //                                        //string query1 = String.Format("UPDATE Receipt.tblCollectionReceipt SET isPrinted=1,IsPrintedDate= '{0:MM/dd/yyyy HH:mm:ss tt}',PrintedBY='{1}',StationCode='{2}' WHERE PaymentRefNumber IN (SELECT PaymentRefNumber FROM Receipt.tblReceipt WHERE SentBy='{1}')", DateTime.Now, Program.UserID, Program.stationCode);

            //                                        using (SqlCommand sqlCommand = new SqlCommand(query1, db, transaction))
            //                                        {
            //                                            sqlCommand.ExecuteNonQuery();
            //                                        }

            //                                    }
            //                                    catch (Exception ex)
            //                                    {
            //                                        transaction.Rollback();
            //                                        Tripous.Sys.ErrorBox(ex);
            //                                        return;
            //                                    }
            //                                    transaction.Commit();

            //                                    db.Close();
            //                                }
            //                                bttnMain.Visible = true; label1.Visible = true;
            //                                bttnMain.Enabled = true;
            //                            }
            //                            finally
            //                            {
            //                                SplashScreenManager.CloseForm(false);
            //                            }

            //                            //using (FrmMainFest frmMainFest = new FrmMainFest(strCollectionReportID, values, criteria2, false) { IDList = strCollectionReportID })
            //                            //{
            //                            //    this.Close();
            //                            //    frmMainFest.ShowDialog();
            //                            //}


            //                        }
            //                        else
            //                            return;

            //                    }
            //                    catch (SqlException sqlError)
            //                    {
            //                        //transaction.Rollback();

            //                        Tripous.Sys.ErrorBox(sqlError);
            //                    }
            //                    catch (Exception ex)
            //                    {
            //                        Tripous.Sys.ErrorBox(ex);
            //                    }
            //                    db.Close();
            //                }

            //            }
            //            else
            //                return;

            //        }
            //        else
            //        {
            //            Common.setMessageBox(response.Tables[0].Rows[0]["returnMessage"].ToString(), "", 2);
            //            return;
            //        }



            //    }
            //}
            #endregion
        }
예제 #20
0
        void btnAllocate_Click(object sender, EventArgs e)
        {
            if (gridView1.SelectedRowsCount == 0)
            {
                Common.setMessageBox("Select Record to Close", "Close Period", 1); return;
            }
            else
            {
                //Common.setMessageBox("Sorry TransactionPosting Suspend for now!", "Close Period", 1);
                //return;
                try
                {
                    SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);

                    tableTrans.Clear();

                    if (string.IsNullOrEmpty(selection.SelectedCount.ToString()))
                    {
                        return;
                    }

                    for (int i = 0; i < selection.SelectedCount; i++)
                    {
                        bool chkUpdate = (bool)(selection.GetSelectedRow(i) as DataRowView)["IsApproved"];
                        //BankAccountID,PostingRequestID
                        if (chkUpdate)
                        {
                            tableTrans.Rows.Add(new object[] { (selection.GetSelectedRow(i) as DataRowView)["BankShortCode"], (selection.GetSelectedRow(i) as DataRowView)["FinancialperiodID"], (selection.GetSelectedRow(i) as DataRowView)["StartDate"], (selection.GetSelectedRow(i) as DataRowView)["EndDate"], (selection.GetSelectedRow(i) as DataRowView)["BankAccountID"], (selection.GetSelectedRow(i) as DataRowView)["PostingRequestID"], (selection.GetSelectedRow(i) as DataRowView)["ReconID"] });
                        }
                    }


                    if (tableTrans.Rows.Count <= 0)
                    {
                        Common.setMessageBox("No approved record is selected", "Close Period", 3);
                        return;
                    }

                    selection.ClearSelection();

                    using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                    {
                        connect.Open();
                        _command = new SqlCommand("PostingTransactionApprove", connect)
                        {
                            CommandType = CommandType.StoredProcedure
                        };

                        _command.Parameters.Add(new SqlParameter("@pTransactiondb", SqlDbType.Structured)).Value = tableTrans;
                        _command.Parameters.Add(new SqlParameter("@Userid", SqlDbType.VarChar)).Value            = Program.UserID;
                        _command.CommandTimeout = 0;
                        //_command.Parameters.Add(new SqlParameter("@enddate", SqlDbType.VarChar)).Value = string.Format("{0:yyyy/MM/dd}", dtpEnd.Value);
                        //_command.Parameters.Add(new SqlParameter("@pType", SqlDbType.Bit)).Value = boolIsUpdate2;
                        //_command.Parameters.Add(new SqlParameter("@Batchcode", SqlDbType.Char)).Value = label22.Text;
                        //@Years
                        using (System.Data.DataSet ds = new System.Data.DataSet())
                        {
                            ds.Clear();
                            adp = new SqlDataAdapter(_command);
                            adp.Fill(ds);
                            connect.Close();

                            //&& ds.Tables[0].Rows[0]["returnCode"].ToString() != "01"
                            if (ds.Tables[0].Rows[0]["returnCode"].ToString() != "00" && ds.Tables[0].Rows[0]["returnCode"].ToString() != "01")
                            {
                                if (ds.Tables[0].Rows[0]["returnCode"].ToString() == "-1")
                                {
                                    Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);

                                    return;
                                }
                                if (ds.Tables[0].Rows[0]["returnCode"].ToString() == "-2")
                                {
                                    Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);

                                    using (FrmReportPosting frmreport = new FrmReportPosting(ds))
                                    {
                                        frmreport.ShowDialog();
                                    }
                                    FrmRequest_Load(null, null);

                                    //return;
                                }
                            }
                            else
                            {
                                Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);

                                if (ds.Tables.Count > 1)
                                {                                 //FrmReportPosting report = new FrmReportPosting(ds.Tables[1], ds.Tables[2]);
                                    using (FrmReportPosting frmreport = new FrmReportPosting(ds))
                                    {
                                        frmreport.ShowDialog();
                                    }
                                }
                                FrmRequest_Load(null, null);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Tripous.Sys.ErrorBox(ex.Message); return;
                }
                finally
                {
                    SplashScreenManager.CloseForm(false);
                }
            }
        }
예제 #21
0
        void Processwork()
        {
            System.Data.DataSet dataSet = new System.Data.DataSet();

            dts = new System.Data.DataSet();

            dts.Clear(); tableTrans.Clear();


            if (string.IsNullOrEmpty(selection.SelectedCount.ToString()) || selection.SelectedCount == 0)
            {
                Common.setMessageBox("No Record selected", "Arms Payments", 1); return;
            }
            else
            {
                string str = string.Format("Do you really want to Approve this ({0}) number(s) of Arms Payments", selection.SelectedCount);

                DialogResult results = MessageBox.Show(str, Program.ApplicationName, MessageBoxButtons.YesNo);

                if (results == DialogResult.Yes)
                {
                    for (int i = 0; i < selection.SelectedCount; i++)
                    {
                        tableTrans.Rows.Add(new object[] { (selection.GetSelectedRow(i) as DataRowView)["PaymentRefNumber"], Program.UserID, });
                    }
                }

                try
                {
                    using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                    {
                        connect.Open();
                        _command = new SqlCommand("ArmsApproval", connect)
                        {
                            CommandType = CommandType.StoredProcedure
                        };
                        _command.Parameters.Add(new SqlParameter("@pTransaction", SqlDbType.Structured)).Value = tableTrans;
                        //_command.Parameters.Add(new SqlParameter("@userid", SqlDbType.VarChar)).Value = Program.UserID;
                        _command.CommandTimeout = 0;
                        using (System.Data.DataSet ds = new System.Data.DataSet())
                        {
                            ds.Clear();
                            adp = new SqlDataAdapter(_command);
                            adp.Fill(ds);
                            connect.Close();

                            if (ds.Tables[0].Rows[0]["returnCode"].ToString() == "00")
                            {
                                Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);

                                doSending(ds);
                                ////using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                                ////{
                                //if (ds.Tables[0].Columns.Contains("Narration")) ds.Tables[0].Columns.Remove("Narration");

                                //connect.Open();
                                //_command = new SqlCommand("ReclassifiedTransactionLogRequest", connect) { CommandType = CommandType.StoredProcedure };
                                //_command.Parameters.Add(new SqlParameter("@pTransaction", SqlDbType.Structured)).Value = ds.Tables[0];
                                //_command.Parameters.Add(new SqlParameter("@userid", SqlDbType.VarChar)).Value = Program.UserID;

                                //using (System.Data.DataSet ds1 = new System.Data.DataSet())
                                //{
                                //    ds1.Clear();
                                //    adp = new SqlDataAdapter(_command);
                                //    adp.Fill(ds1);
                                //    connect.Close();

                                //    if (ds1.Tables[0].Rows[0]["returnCode"].ToString() != "00")
                                //    {
                                //        Common.setMessageBox(ds1.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);
                                //        return;
                                //    }
                                //    else
                                //    {
                                //        Common.setMessageBox(ds1.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);
                                //        setReload();
                                //        return;
                                //    }

                                //}
                                ////}
                            }
                            else
                            {
                                Tripous.Sys.ErrorBox(String.Format("{0}", dts.Tables[0].Rows[0]["returnMessage"].ToString()));
                                return;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Tripous.Sys.ErrorBox(String.Format("{0}{1}", ex.Message, ex.StackTrace)); return;
                }
            }
        }
예제 #22
0
        void GetPayRef()
        {
            string values = string.Empty;

            lblSelect.Text = string.Empty;

            int j = 0;

            temTable.Clear();

            for (int i = 0; i < selection.SelectedCount; i++)
            {
                temTable.Rows.Add(new object[] { String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["EReceipts"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["PaymentRefNumber"]), Program.UserID });

                values += String.Format("'{0}'", (selection.GetSelectedRow(i) as DataRowView)["PaymentRefNumber"]);

                if (j + 1 < selection.SelectedCount)
                {
                    values += ",";
                }
                ++j;
            }

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

                if (!isReprint)
                {
                    //using (WaitDialogForm form = new WaitDialogForm("Application Working...,Please Wait...", "Processing Your Request"))
                    //{

                    using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                    {
                        connect.Open();
                        _command = new SqlCommand("InserttblReceipt", connect)
                        {
                            CommandType = CommandType.StoredProcedure
                        };
                        _command.Parameters.Add(new SqlParameter("@tblCollectionReport_Temp", SqlDbType.Structured)).Value = temTable;
                        _command.Parameters.Add(new SqlParameter("@type", SqlDbType.VarChar)).Value   = "Edit";
                        _command.Parameters.Add(new SqlParameter("@userid", SqlDbType.VarChar)).Value = Program.UserID;
                        System.Data.DataSet response = new System.Data.DataSet();
                        response.Clear();
                        adp = new SqlDataAdapter(_command);
                        adp.Fill(response);

                        connect.Close();
                        if (String.Compare(response.Tables[0].Rows[0]["returnCode"].ToString(), "00", false) == 0)
                        {
                            //do something load the report page
                            using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
                            {
                                SqlTransaction transaction;

                                db.Open();

                                transaction = db.BeginTransaction();

                                try
                                {
                                    using (System.Data.DataSet dds = new System.Data.DataSet("DsCollectionReport"))
                                    {
                                        SqlDataAdapter ada;

                                        string strFormat = null;

                                        query = string.Format("SELECT  [ID] , [Provider] , [Channel] , tblCollectionReport.PaymentRefNumber , [DepositSlipNumber] ,CONVERT(VARCHAR, CONVERT(DATE, [PaymentDate])) AS PaymentDate , [PayerID] , UPPER([PayerName]) AS [PayerName] , [Amount] , [PaymentMethod] ,[ChequeNumber] , [ChequeValueDate] , [ChequeStatus] ,[DateChequeReturned] ,[TelephoneNumber] ,  [ReceiptNo] , [ReceiptDate] , UPPER([PayerAddress]) AS [PayerAddress] ,[User] ,   [RevenueCode] , tblCollectionReport.Description , [ChequeBankCode] ,[ChequeBankName] ,   [AgencyName] , [AgencyCode] , [BankCode] , [BankName] , [BranchCode] ,[BranchName] , [ZoneCode] , [ZoneName] ,  [Username] ,[AmountWords] , [EReceipts] , [EReceiptsDate] ,[GeneratedBy] ,[StationCode] ,ControlNumber ,ControlNumberDate , ( SELECT TOP 1 StationName  FROM  Receipt.tblStation  WHERE     tblStation.StationCode = Collection.tblCollectionReport.[StationCode]) AS StationName, Symbol , Surfix , tblCurrency.Description AS prefix FROM    Collection.tblCollectionReport LEFT JOIN Receipt.tblReprintedReceipts ON tblCollectionReport.PaymentRefNumber = tblReprintedReceipts.PaymentRefNumber inner JOIN Reconciliation.tblCurrency ON tblCurrency.CurrencyCode = tblCollectionReport.CurrencyCode WHERE  tblCollectionReport.PaymentRefNumber IN ({0})  ORDER BY Collection.tblCollectionReport.StationCode , Collection.tblCollectionReport.AgencyCode ,Collection.tblCollectionReport.RevenueCode,Collection.tblCollectionReport.EReceipts", values);

                                        DataTable Dt = dds.Tables.Add("CollectionReportTable");
                                        ada = new SqlDataAdapter(query, Logic.ConnectionString);
                                        ada.Fill(dds, "CollectionReportTable");
                                        Logic.ProcessDataTable(Dt);;
                                        //strCollectionReportID = strFormat;



                                        //XRepReceipt recportRec = new XRepReceipt { DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable" };

                                        //recportRec.ShowPreviewDialog();

                                        switch (Program.intCode)
                                        {
                                        case 13:    //Akwa Ibom state
                                            XtraRepReceiptAkwa akwa = new XtraRepReceiptAkwa {
                                                DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable"
                                            };
                                            akwa.ShowPreviewDialog();
                                            break;

                                        case 20:    //detla state
                                            XtraRepReceiptDelta delta = new XtraRepReceiptDelta {
                                                DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable"
                                            };
                                            //delta.PrintingSystem.StartPrint += PrintingSystem_StartPrint;
                                            //if (Program.stateCode == "20")
                                            //{
                                            //    if (Convert.ToInt32(radioGroup1.EditValue) != 1)
                                            //    {
                                            //        delta.xrLabel19.Visible = true;
                                            //        //delta.xrLabel13.Visible = true;
                                            //    }

                                            //}
                                            //delta.Watermark.Text = "DUPLICATE";
                                            ////delta.Watermark.TextDirection = DirectionMode.Clockwise;
                                            //delta.Watermark.Font = new Font(delta.Watermark.Font.FontFamily, 40);
                                            //delta.Watermark.ForeColor = Color.DodgerBlue;
                                            //delta.Watermark.TextTransparency = 150;
                                            //delta.Watermark.ShowBehind = false;

                                            delta.logoPath  = Logic.singaturepth;
                                            delta.Imagepath = Logic.logopth;
                                            //report.Watermark.Text = "DUPLICATE";
                                            delta.xrLabel3.Visible = true;
                                            //delta.Imagepath = Logic.;
                                            delta.Watermark.Text = "DUPLICATE";
                                            delta.ShowPreviewDialog();
                                            //delta.Print();
                                            break;

                                        case 37:    //ogun state
                                            XRepReceipt recportRec = new XRepReceipt {
                                                DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable"
                                            };
                                            //recportRec.logoPath = Logic.singaturepth;
                                            recportRec.logoPath = Logic.singaturepth;
                                            recportRec.ShowPreviewDialog();
                                            break;

                                        case 40:    //oyo state
                                            XRepReceiptoyo recportRecs = new XRepReceiptoyo {
                                                DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable"
                                            };
                                            recportRecs.ShowPreviewDialog();
                                            break;

                                        //case 32://kogi state

                                        //    XRepReceiptkogi recportRecko = new XRepReceiptkogi { DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable" };
                                        //    recportRecko.ShowPreviewDialog();

                                        //    break;

                                        default:
                                            break;
                                        }

                                        //selection.ClearSelection(); dds.Clear();
                                    }
                                }
                                catch (SqlException sqlError)
                                {
                                    //transaction.Rollback();

                                    Tripous.Sys.ErrorBox(sqlError);
                                }
                                catch (Exception ex)
                                {
                                    Tripous.Sys.ErrorBox(ex);
                                }
                                db.Close();
                            }
                        }
                        else
                        {
                            if (String.Compare(response.Tables[0].Rows[0]["returnCode"].ToString(), "-1", false) == 0)
                            {
                                using (Frmcontrol frmcontrol = new Frmcontrol())
                                {
                                    frmcontrol.gridControl1.DataSource = response.Tables[1];
                                    frmcontrol.gridView1.BestFitColumns();
                                    frmcontrol.label1.Text = "Payment Ref. Number Already been used";
                                    frmcontrol.Text        = "Payment Ref. Number Already been used";
                                    frmcontrol.ShowDialog();
                                }
                            }
                            else
                            {
                                Common.setMessageBox(response.Tables[0].Rows[0]["returnMessage"].ToString(), "", 2);
                                return;
                            }
                        }
                    }
                }
                else
                {
                    using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
                    {
                        SqlTransaction transaction;

                        db.Open();

                        transaction = db.BeginTransaction();

                        using (System.Data.DataSet dds = new System.Data.DataSet("DsCollectionReport"))
                        {
                            SqlDataAdapter ada;

                            using (WaitDialogForm form = new WaitDialogForm())
                            {
                                string strFormat = null;

                                query = string.Format("SELECT  [ID] , [Provider] , [Channel] , tblCollectionReport.PaymentRefNumber , [DepositSlipNumber] ,CONVERT(VARCHAR, CONVERT(DATE, [PaymentDate])) AS PaymentDate , [PayerID] , UPPER([PayerName]) AS [PayerName] , [Amount] , [PaymentMethod] ,[ChequeNumber] , [ChequeValueDate] , [ChequeStatus] ,[DateChequeReturned] ,[TelephoneNumber] ,  [ReceiptNo] , [ReceiptDate] , UPPER([PayerAddress]) AS [PayerAddress] ,[User] ,   [RevenueCode] , tblCollectionReport.Description , [ChequeBankCode] ,[ChequeBankName] ,   [AgencyName] , [AgencyCode] , [BankCode] , [BankName] , [BranchCode] ,[BranchName] , [ZoneCode] , [ZoneName] ,  [Username] ,[AmountWords] , [EReceipts] , [EReceiptsDate] ,[GeneratedBy] ,[StationCode] ,ControlNumber ,ControlNumberDate , ( SELECT TOP 1 StationName  FROM  Receipt.tblStation  WHERE     tblStation.StationCode = Collection.tblCollectionReport.[StationCode]) AS StationName, Symbol , Surfix , tblCurrency.Description AS prefix FROM    Collection.tblCollectionReport INNER JOIN Reconciliation.tblCurrency ON tblCurrency.CurrencyCode = tblCollectionReport.CurrencyCode LEFT JOIN Receipt.tblReprintedReceipts ON tblCollectionReport.PaymentRefNumber = tblReprintedReceipts.PaymentRefNumber WHERE  tblCollectionReport.PaymentRefNumber IN ({0}) ORDER BY Collection.tblCollectionReport.EReceipts", values);

                                DataTable Dt = dds.Tables.Add("CollectionReportTable");
                                ada = new SqlDataAdapter(query, Logic.ConnectionString);
                                ada.Fill(dds, "CollectionReportTable");
                                Logic.ProcessDataTable(Dt);;
                                //strCollectionReportID = strFormat;
                            }


                            //XRepReceipt recportRec = new XRepReceipt { DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable" };

                            //recportRec.ShowPreviewDialog();

                            //selection.ClearSelection(); dds.Clear();
                            switch (Program.intCode)
                            {
                            case 13:    //Akwa Ibom state
                                XtraRepReceiptAkwa akwa = new XtraRepReceiptAkwa {
                                    DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable"
                                };
                                akwa.ShowPreviewDialog();
                                break;

                            case 37:    //ogun state
                                XRepReceipt recportRec = new XRepReceipt {
                                    DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable"
                                };
                                recportRec.logoPath = Logic.singaturepth;
                                recportRec.ShowPreviewDialog();
                                break;

                            case 20:    //detla state
                                XtraRepReceiptDelta delta = new XtraRepReceiptDelta {
                                    DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable"
                                };
                                //delta.PrintingSystem.StartPrint += PrintingSystem_StartPrint;
                                //if (Program.stateCode == "20")
                                //{
                                //    if (Convert.ToInt32(radioGroup1.EditValue) != 1)
                                //    {
                                //        delta.xrLabel19.Visible = true;
                                //        //delta.xrLabel13.Visible = true;
                                //    }

                                //}
                                //delta.Watermark.Text = "DUPLICATE";
                                ////delta.Watermark.TextDirection = DirectionMode.Clockwise;
                                //delta.Watermark.Font = new Font(delta.Watermark.Font.FontFamily, 40);
                                //delta.Watermark.ForeColor = Color.DodgerBlue;
                                //delta.Watermark.TextTransparency = 150;
                                //delta.Watermark.ShowBehind = false;

                                delta.logoPath  = Logic.singaturepth;
                                delta.Imagepath = Logic.logopth;
                                //report.Watermark.Text = "DUPLICATE";
                                delta.xrLabel3.Visible = true; delta.logoPath = Logic.singaturepth;
                                delta.Watermark.Text   = "DUPLICATE";
                                delta.ShowPreviewDialog();
                                //delta.Print();
                                break;

                            case 40:    //oyo state
                                XRepReceiptoyo recportRecs = new XRepReceiptoyo {
                                    DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable"
                                };
                                recportRecs.ShowPreviewDialog();
                                break;

                            //case 32://kogi state

                            //    XRepReceiptkogi recportRecko = new XRepReceiptkogi { DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable" };
                            //    recportRecko.ShowPreviewDialog();

                            //    break;

                            default:
                                break;
                            }
                        }
                    }
                }
            }
            finally
            {
                SplashScreenManager.CloseForm(false);
            }

            //return values;
        }
예제 #23
0
        void bttnUpdate_Click(object sender, EventArgs e)
        {
            //if (selection.SelectedCount < 1)
            //{
            //    Common.setMessageBox("Please, select Revenue Code ", Program.ApplicationName, 3); return;
            //}
            //else
            //{
            //DELETE record from table by agancycode
            using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
            {
                SqlTransaction transaction;

                SqlCommand sqlCommand1;

                db.Open();

                transaction = db.BeginTransaction();

                string querys = String.Format("DELETE FROM Receipt.tblRevenueReceiptException WHERE AgencyCode='{0}'", cboAgency.SelectedValue);

                sqlCommand1 = new SqlCommand(querys, db, transaction);
                sqlCommand1.ExecuteNonQuery();


                try
                {
                    transaction.Commit();
                    db.Close();
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    Tripous.Sys.ErrorBox(ex);
                    return;
                }
            }
            //insert new record into the database
            using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
            {
                SqlTransaction transaction;

                SqlCommand sqlCommand1;

                db.Open();

                transaction = db.BeginTransaction();

                for (int i = 0; i < selection.SelectedCount; i++)
                {
                    string lol = ((selection.GetSelectedRow(i) as DataRowView)["RevenueCode"].ToString());

                    string query = String.Format("INSERT INTO Receipt.tblRevenueReceiptException ( RevenueCode,AgencyCode ) VALUES ('{0}','{1}')", lol, cboAgency.SelectedValue);

                    sqlCommand1 = new SqlCommand(query, db, transaction); sqlCommand1.ExecuteNonQuery();
                }

                transaction.Commit();
            }
            Common.setMessageBox(" Transaction Completed Successfully ", Program.ApplicationName, 1);
            //}
        }
예제 #24
0
        void bttnUpdate_Click(object sender, EventArgs e)
        {
            if (selection.SelectedCount < 1)
            {
                Common.setMessageBox("Please, select revenue code  to Map", Program.ApplicationName, 3); return;
            }
            else if (cboStation.SelectedIndex < 0)
            {
                Common.setMessageBox("Please, select Station to Map", Program.ApplicationName, 3); cboStation.Focus(); return;
            }
            else if (cboCentre.SelectedIndex < 0)
            {
                Common.setMessageBox("Please, select Printing Centre to Map", Program.ApplicationName, 3); cboCentre.Focus(); return;
            }
            else
            {
                if (!boolIsUpdate)
                {
                    using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
                    {
                        SqlTransaction transaction;
                        SqlCommand     sqlCommand1;

                        db.Open();

                        transaction = db.BeginTransaction();

                        try
                        {
                            for (int i = 0; i < selection.SelectedCount; i++)
                            {
                                if ((Int32)this.radioGroup1.EditValue == 1)//Revenue Code
                                {
                                    lol = ((selection.GetSelectedRow(i) as DataRowView)["RevenueCode"].ToString());
                                }
                                else if ((Int32)this.radioGroup1.EditValue == 2)//Bank Branch
                                {
                                    lol = ((selection.GetSelectedRow(i) as DataRowView)["BranchCode"].ToString());
                                }


                                string query = String.Format("INSERT INTO [tblPrintingCenterMap]([CentreCode],[CentreName],[StationName],[StationCode],[RevenueCode]) VALUES ('{0}','{1}','{2}','{3}','{4}')", cboCentre.SelectedValue.ToString(), cboCentre.Text.Trim(), cboStation.Text, cboStation.SelectedValue.ToString(), lol);


                                sqlCommand1 = new SqlCommand(query, db, transaction);
                                sqlCommand1.ExecuteNonQuery();
                            }


                            //call report for Print
                            transaction.Commit();
                            //ReceiptCall();
                        }
                        catch (SqlException sqlError)
                        {
                            transaction.Rollback();
                            Tripous.Sys.ErrorBox(sqlError);
                            return;
                        }
                        db.Close();
                    }
                }
                else
                {
                    using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
                    {
                        SqlTransaction transaction;

                        SqlCommand sqlCommand1;

                        db.Open();

                        transaction = db.BeginTransaction();

                        try
                        {
                            string query = String.Format("DELETE FROM tblPrintingCenterMap where CentreCode ='{0}' and StationCode ='{1}'", ID, stationcode);

                            sqlCommand1 = new SqlCommand(query, db, transaction);
                            sqlCommand1.ExecuteNonQuery();

                            transaction.Commit();
                        }
                        catch (Exception ex)
                        {
                            transaction.Rollback();
                            Tripous.Sys.ErrorBox(ex);
                            return;
                        }
                        db.Close();
                    }
                    using (SqlConnection dbs = new SqlConnection(Logic.ConnectionString))
                    {
                        SqlTransaction transactions;
                        SqlCommand     sqlCommand2;

                        dbs.Open();

                        transactions = dbs.BeginTransaction();

                        try
                        {
                            for (int i = 0; i < selection.SelectedCount; i++)
                            {
                                if ((Int32)this.radioGroup1.EditValue == 1)    //Revenue Code
                                {
                                    lol = ((selection.GetSelectedRow(i) as DataRowView)["RevenueCode"].ToString());
                                }
                                else if ((Int32)this.radioGroup1.EditValue == 2)    //Bank Branch
                                {
                                    lol = ((selection.GetSelectedRow(i) as DataRowView)["BranchCode"].ToString());
                                }
                                string query = String.Format("INSERT INTO [tblPrintingCenterMap]([CentreCode],[CentreName],[StationName],[StationCode],[RevenueCode]) VALUES ('{0}','{1}','{2}','{3}','{4}')", cboCentre.SelectedValue.ToString(), cboCentre.Text.Trim(), cboStation.Text, cboStation.SelectedValue.ToString(), lol);


                                sqlCommand2 = new SqlCommand(query, dbs, transactions);
                                sqlCommand2.ExecuteNonQuery();
                            }


                            //call report for Print
                            transactions.Commit();
                            //ReceiptCall();
                        }
                        catch (SqlException sqlError)
                        {
                            transactions.Rollback();
                            Tripous.Sys.ErrorBox(sqlError);
                            return;
                        }
                        dbs.Close();
                    }
                }
            }


            setReload1();
            setReload(querys);

            cboStation.SelectedIndex = -1;

            cboCentre.SelectedValue = -1;

            Common.setMessageBox(" Transaction Completed Successfully ", Program.ApplicationName, 1);
            selection.ClearSelection();
        }
예제 #25
0
        void bttnUpdate_Click(object sender, EventArgs e)
        {
            if (selection.SelectedCount == 0)
            {
                Common.setMessageBox("Please Select Revenue Code to Map with Tax Payer Type", Program.ApplicationName, 1);
                return;
            }
            else
            {
                if (!boolIsUpdate)
                {
                    using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
                    {
                        SqlTransaction transaction;

                        db.Open();

                        transaction = db.BeginTransaction();

                        try
                        {
                            for (int i = 0; i < selection.SelectedCount; i++)
                            {
                                using (var ds = new System.Data.DataSet())
                                {//select record
                                    //get the selected value from the  gridview
                                    string lol = ((selection.GetSelectedRow(i) as DataRowView)["RevenueCode"].ToString());

                                    //insert the selected record into the table
                                    string query = String.Format("INSERT INTO [tblRevenueCodeTaxPayerTypeRelation]([TaxPayerTypeCode],[RevenueCode],ModifyBy) VALUES ('{0}','{1}','{2}')", cboStation.SelectedValue, lol, Program.UserID);

                                    using (SqlCommand sqlCommand1 = new SqlCommand(query, db, transaction))
                                    {
                                        sqlCommand1.ExecuteNonQuery();
                                    }
                                }
                            }

                            transaction.Commit();
                        }
                        catch (Exception ex)
                        {
                            transaction.Rollback();
                            Tripous.Sys.ErrorBox(ex); return;
                        }

                        db.Close(); selection.ClearSelection(); setReload(); cboStation.SelectedIndex = -1;
                    }
                }
                else
                {
                    //delete exiting records
                    using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
                    {
                        SqlTransaction transaction;

                        SqlCommand sqlCommand1;

                        db.Open();

                        transaction = db.BeginTransaction();

                        try
                        {
                            string query = String.Format("DELETE FROM tblRevenueCodeTaxPayerTypeRelation where TaxPayerTypeCode ='{0}' ", ID);

                            sqlCommand1 = new SqlCommand(query, db, transaction);
                            sqlCommand1.ExecuteNonQuery();

                            transaction.Commit();
                        }
                        catch (Exception ex)
                        {
                            transaction.Rollback();
                            Tripous.Sys.ErrorBox(ex);
                            return;
                        }
                        db.Close();
                    }

                    //insert new records after modification
                    using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
                    {
                        SqlTransaction transaction;

                        db.Open();

                        transaction = db.BeginTransaction();

                        try
                        {
                            for (int i = 0; i < selection.SelectedCount; i++)
                            {
                                using (var ds = new System.Data.DataSet())
                                {//select record
                                    //get the selected value from the  gridview
                                    string lol = ((selection.GetSelectedRow(i) as DataRowView)["RevenueCode"].ToString());

                                    //insert the selected record into the table
                                    using (SqlCommand sqlCommand1 = new SqlCommand((string)String.Format("INSERT INTO [tblRevenueCodeTaxPayerTypeRelation]([TaxPayerTypeCode],[RevenueCode],ModifyBy) VALUES ('{0}','{1}','{2}')", cboStation.SelectedValue, lol, Program.UserID), db, transaction))
                                    {
                                        sqlCommand1.ExecuteNonQuery();
                                    }
                                }
                            }

                            transaction.Commit();
                        }
                        catch (Exception ex)
                        {
                            transaction.Rollback();
                            Tripous.Sys.ErrorBox(ex);
                            return;
                        }

                        db.Close(); selection.ClearSelection(); cboStation.SelectedIndex = -1;
                    }
                }

                Common.setMessageBox("Record has been successfully Mapped", Program.ApplicationName, 1);

                tsbReload.PerformClick();
            }
        }
예제 #26
0
        void bttnUpdate_Click(object sender, EventArgs e)
        {
            using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
            {
                SqlTransaction transaction;

                db.Open();

                transaction = db.BeginTransaction();

                try
                {
                    for (int i = 0; i < selection.SelectedCount; i++)
                    {
                        using (var ds = new System.Data.DataSet())
                        {//select record
                            string lol  = ((selection.GetSelectedRow(i) as DataRowView)["OfficeCode"].ToString());
                            string lol2 = ((selection.GetSelectedRow(i) as DataRowView)["OfficeName"].ToString());

                            string query = String.Format("INSERT INTO [tblStationMap]([StationCode],[StationName],[RevenueOfficeCode],[RevenueOfficeName]) VALUES ('{0}','{1}','{2}','{3}')", cboStation.SelectedValue, cboStation.Text.ToString(), lol, lol2);


                            using (SqlCommand sqlCommand1 = new SqlCommand(query, db, transaction))
                            {
                                sqlCommand1.ExecuteNonQuery();
                            }

                            query = String.Format("SELECT StationCode,StationName FROM tblCollectionReport WHERE [ZoneCode] = '{0}'", lol);

                            using (SqlDataAdapter ada = new SqlDataAdapter(query, Logic.ConnectionString))
                            {
                                ada.Fill(ds, "table");
                            }

                            Dt = ds.Tables[0];

                            foreach (DataRow item in Dt.Rows)
                            {
                                if (item["StationCode"].ToString() == "0" && item["StationName"].ToString() == "Not Yet Mapped")
                                {
                                    using (SqlCommand sqlCommand = new SqlCommand(String.Format(String.Format("UPDATE [tblCollectionReport] SET [StationCode]='{{0}}',[StationName]='{{1}}' where  [ZoneCode] ='{0}' and [StationCode]='0' and StationName='Not Yet Mapped' ", lol), lol, lol2), db, transaction))
                                    {
                                        sqlCommand.ExecuteNonQuery();
                                    }
                                }
                            }

                            //get the station code and name base on the check revenue office
                        }
                    }


                    //call report for Print
                    transaction.Commit();
                    //ReceiptCall();
                }
                catch (SqlException sqlError)
                {
                    transaction.Rollback();
                }
                db.Close();

                setReload();

                cboStation.SelectedIndex = -1;

                Common.setMessageBox("Record has been successfully added", Program.ApplicationName, 1);
            }
        }
예제 #27
0
        void btnPrint_Click(object sender, EventArgs e)
        {
            values = string.Empty;

            lblSelect.Text = string.Empty;

            int j = 0;

            if (selection.SelectedCount == 0)
            {
                Common.setMessageBox("No Selection Made for Printing of Receipts", Program.ApplicationName, 3);
                return;
            }
            else
            {
                temTable.Clear();

                for (int i = 0; i < selection.SelectedCount; i++)
                {
                    temTable.Rows.Add(new object[] { String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["EReceipts"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["PaymentRefNumber"]), Program.UserID });

                    values += String.Format("'{0}'", (selection.GetSelectedRow(i) as DataRowView)["PaymentRefNumber"]);

                    if (j + 1 < selection.SelectedCount)
                    {
                        values += ",";
                    }
                    ++j;
                }

                using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                {
                    connect.Open();
                    _command = new SqlCommand("InserttblReceipt", connect)
                    {
                        CommandType = CommandType.StoredProcedure
                    };
                    _command.Parameters.Add(new SqlParameter("@tblCollectionReport_Temp", SqlDbType.Structured)).Value = temTable;
                    _command.Parameters.Add(new SqlParameter("@type", SqlDbType.VarChar)).Value   = "New";
                    _command.Parameters.Add(new SqlParameter("@userid", SqlDbType.VarChar)).Value = Program.UserID;
                    System.Data.DataSet response = new System.Data.DataSet();
                    response.Clear();
                    adp = new SqlDataAdapter(_command);
                    adp.Fill(response);

                    connect.Close();
                    if (String.Compare(response.Tables[0].Rows[0]["returnCode"].ToString(), "00", false) == 0)
                    {
                        //do something load the report page
                        using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
                        {
                            SqlTransaction transaction;

                            db.Open();

                            transaction = db.BeginTransaction();

                            try
                            {
                                using (System.Data.DataSet dds = new System.Data.DataSet("DsCollectionReport"))
                                {
                                    SqlDataAdapter ada;

                                    using (WaitDialogForm form = new WaitDialogForm())
                                    {
                                        string strFormat = null;

                                        query = string.Format("SELECT [ID] , [Provider] , [Channel] ,[PaymentRefNumber] , [DepositSlipNumber] , CONVERT(VARCHAR,CONVERT(DATETime,[PaymentDate])) AS PaymentDate,[PayerID] , UPPER([PayerName]) AS [PayerName], [Amount] ,[PaymentMethod] ,[ChequeNumber] ,[ChequeValueDate] ,[ChequeStatus] ,[DateChequeReturned] ,[TelephoneNumber] ,[ReceiptNo] ,[ReceiptDate] ,UPPER([PayerAddress]) as [PayerAddress] ,[User] ,[RevenueCode] , tblCollectionReport.Description , [ChequeBankCode] ,[ChequeBankName] ,[AgencyName] ,[AgencyCode] ,[BankCode] ,[BankName] ,[BranchCode] ,[BranchName] ,[ZoneCode] ,[ZoneName] ,[Username] ,[AmountWords] ,[EReceipts] ,[EReceiptsDate] ,[GeneratedBy] ,[StationCode] ,(SELECT StationName FROM Receipt.tblStation  WHERE tblStation.StationCode = Collection.tblCollectionReport.[StationCode]) AS StationName, Symbol , Surfix , tblCurrency.Description AS prefix from Collection.tblCollectionReport  JOIN Reconciliation.tblCurrency ON tblCurrency.CurrencyCode = tblCollectionReport.CurrencyCode WHERE PaymentRefNumber IN ({0})  ORDER BY Collection.tblCollectionReport.StationCode , Collection.tblCollectionReport.AgencyCode ,Collection.tblCollectionReport.RevenueCode,Collection.tblCollectionReport.EReceipts", values);

                                        DataTable Dt = dds.Tables.Add("CollectionReportTable");
                                        ada = new SqlDataAdapter(query, Logic.ConnectionString);
                                        ada.Fill(dds, "CollectionReportTable");
                                        Logic.ProcessDataTable(Dt);;
                                        //strCollectionReportID = strFormat;
                                    }


                                    //XRepReceipt recportRec = new XRepReceipt { DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable" };

                                    //recportRec.ShowPreviewDialog();

                                    //selection.ClearSelection(); dds.Clear();

                                    switch (Program.intCode)
                                    {
                                    case 13:    //Akwa Ibom state
                                        XtraRepReceiptAkwa akwa = new XtraRepReceiptAkwa {
                                            DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable"
                                        };

                                        akwa.ShowPreviewDialog();

                                        break;

                                    case 20:    //detla state

                                        XtraRepReceiptDelta delta = new XtraRepReceiptDelta {
                                            DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable"
                                        };
                                        //XRepReceipto/*yo delta = new XRepReceiptoyo { DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable" };*/
                                        ////delta.PrintingSystem.StartPrint += PrintingSystem_StartPrint;
                                        delta.logoPath = Logic.singaturepth;
                                        delta.ShowPreviewDialog();
                                        break;

                                    case 37:    //ogun state
                                        XRepReceipt recportRec = new XRepReceipt {
                                            DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable"
                                        }; recportRec.logoPath = Logic.singaturepth;
                                        recportRec.ShowPreviewDialog();
                                        break;

                                    case 40:    //oyo state
                                        XRepReceiptoyo recportRecs = new XRepReceiptoyo {
                                            DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable"
                                        };
                                        recportRecs.ShowPreviewDialog();
                                        break;

                                    //case 32://kogi state

                                    //    XRepReceiptkogi recportRecko = new XRepReceiptkogi { DataSource = dds.Tables[0] /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable" };
                                    //    recportRecko.ShowPreviewDialog();

                                    //    break;

                                    default:
                                        break;
                                    }
                                }
                            }
                            catch (SqlException sqlError)
                            {
                                //transaction.Rollback();

                                Tripous.Sys.ErrorBox(sqlError);
                            }
                            catch (Exception ex)
                            {
                                Tripous.Sys.ErrorBox(ex);
                            }
                            db.Close();
                        }
                        //    //ask if the print was sucessfull
                        DialogResult result = MessageBox.Show(" Is Receipt Printing Successful ?", Program.ApplicationName, MessageBoxButtons.YesNo);
                        if (result == DialogResult.Yes)
                        {
                            try
                            {
                                SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);

                                //update the collection table by seting the isprinted to true
                                using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
                                {
                                    SqlTransaction transaction;

                                    db.Open();

                                    transaction = db.BeginTransaction();
                                    try
                                    {
                                        string query1 = String.Format("UPDATE Receipt.tblCollectionReceipt SET isPrinted=1,IsPrintedDate= '{0:MM/dd/yyyy HH:mm:ss tt}',PrintedBY='{1}',StationCode='{2}' WHERE PaymentRefNumber IN ({3})", DateTime.Now, Program.UserID, Program.stationCode, values);

                                        using (SqlCommand sqlCommand = new SqlCommand(query1, db, transaction))
                                        {
                                            sqlCommand.ExecuteNonQuery();
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        transaction.Rollback();
                                        Tripous.Sys.ErrorBox(ex);
                                        return;
                                    }
                                    transaction.Commit();

                                    db.Close();
                                }
                            }
                            finally
                            {
                                SplashScreenManager.CloseForm(false);
                            }
                        }
                        else
                        {
                            try
                            {
                                SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);

                                using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
                                {
                                    SqlTransaction transaction;

                                    db.Open();

                                    transaction = db.BeginTransaction();
                                    try
                                    {
                                        string query1 = String.Format("DELETE FROM Receipt.tblCollectionReceipt WHERE PaymentRefNumber IN (SELECT PaymentRefNumber FROM Receipt.tblReceipt WHERE PaymentRefNumber in ({0})", values);

                                        using (SqlCommand sqlCommand = new SqlCommand(query1, db, transaction))
                                        {
                                            sqlCommand.ExecuteNonQuery();
                                        }

                                        string query = String.Format("DELETE  FROM Receipt.tblReceipt where PaymentRefNumber in ({0})", values);

                                        using (SqlCommand sqlCommand1 = new SqlCommand(query, db, transaction))
                                        {
                                            sqlCommand1.ExecuteNonQuery();
                                        }

                                        transaction.Commit();
                                    }
                                    catch (Exception ex)
                                    {
                                        transaction.Rollback();
                                        Tripous.Sys.ErrorBox(ex);
                                        return;
                                    }


                                    db.Close();
                                }
                            }
                            finally
                            {
                                SplashScreenManager.CloseForm(false);
                            }
                            return;
                        }
                    }
                    else
                    {
                        if (String.Compare(response.Tables[0].Rows[0]["returnCode"].ToString(), "-1", false) == 0)
                        {
                            Common.setMessageBox(response.Tables[0].Rows[0]["returnMessage"].ToString(), "", 2);
                            //return;

                            if (response.Tables[0].Rows[0]["returnMessage"].ToString() != "Payment Ref. Number Already Exist")
                            {
                                //using (Frmcontrol frmcontrol = new Frmcontrol())
                                //{
                                //    frmcontrol.gridControl1.DataSource = response.Tables[1];
                                //    frmcontrol.gridView1.BestFitColumns();
                                //    frmcontrol.label1.Text = "Payment Ref. Number Already been used";
                                //    frmcontrol.Text = "Payment Ref. Number Already been used";
                                //    frmcontrol.ShowDialog();
                                //}
                                return;
                            }
                            else
                            {
                                using (Frmcontrol frmcontrol = new Frmcontrol())
                                {
                                    frmcontrol.gridControl1.DataSource = response.Tables[1];
                                    frmcontrol.gridView1.BestFitColumns();
                                    frmcontrol.label1.Text = "Payment Ref. Number Already been used";
                                    frmcontrol.Text        = "Payment Ref. Number Already been used";
                                    frmcontrol.ShowDialog();
                                }
                            }
                        }
                        else
                        {
                            Common.setMessageBox(response.Tables[0].Rows[0]["returnMessage"].ToString(), "", 2);
                            return;
                        }
                    }
                }
            }
        }
예제 #28
0
        private void BttnUpdate_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtName.Text.Trim().ToString()) || txtName.Text == null)
            {
                Common.setEmptyField("Profile Name", "Profile Setup");
                return;
            }
            else
            {
                temTableAgcy.Clear(); temTable.Clear();

                if (selection.SelectedCount == 0)
                {
                    Common.setMessageBox("Bank Branch", "Profile Setup", 2); return;
                }
                else
                {
                    for (int i = 0; i < selection.SelectedCount; i++)
                    {
                        temTable.Rows.Add(new object[] { String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["BankShortCode"]), String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["BranchCode"]) });
                    }
                }

                if (selectiongrid.SelectedCount == 0)
                {
                    Common.setMessageBox("Revenue Description", "Profile Setup", 2); return;
                }
                else
                {
                    for (int i = 0; i < selectiongrid.SelectedCount; i++)
                    {
                        temTableAgcy.Rows.Add(new object[] { String.Format("{0}", (selectiongrid.GetSelectedRow(i) as DataRowView)["AgencyCode"]), String.Format("{0}", (selectiongrid.GetSelectedRow(i) as DataRowView)["RevenueCode"]) });
                    }
                }

                using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                {
                    connect.Open();
                    _command = new SqlCommand("doProfileCriteria", connect)
                    {
                        CommandType = CommandType.StoredProcedure
                    };
                    _command.Parameters.Add(new SqlParameter("@profilename", SqlDbType.VarChar)).Value     = txtName.Text.Trim();
                    _command.Parameters.Add(new SqlParameter("@pAgencyTable", SqlDbType.Structured)).Value = temTableAgcy;
                    _command.Parameters.Add(new SqlParameter("@pBankTable", SqlDbType.Structured)).Value   = temTable;
                    _command.Parameters.Add(new SqlParameter("@type", SqlDbType.Bit)).Value       = boolIsUpdate;
                    _command.Parameters.Add(new SqlParameter("@userid", SqlDbType.VarChar)).Value = Program.UserID;
                    _command.Parameters.Add(new SqlParameter("@ids", SqlDbType.Int)).Value        = ID;
                    _command.CommandTimeout = 0;
                    System.Data.DataSet response = new System.Data.DataSet();
                    response.Clear();
                    adp = new SqlDataAdapter(_command);
                    adp.Fill(response);

                    connect.Close();

                    if (String.Compare(response.Tables[0].Rows[0]["returnCode"].ToString(), "00", false) == 0)
                    {
                        Common.setMessageBox(response.Tables[0].Rows[0]["returnMessage"].ToString(), "", 2);

                        setClear(); setReload(); tsbReload.PerformClick();

                        return;
                    }
                    else
                    {
                        Common.setMessageBox(response.Tables[0].Rows[0]["returnMessage"].ToString(), "", 2);

                        setClear(); setReload(); tsbReload.PerformClick();

                        return;
                    }
                }
            }
        }
예제 #29
0
        private void SbnDisapprove_Click(object sender, EventArgs e)
        {
            string value = string.Empty;

            if (DialogResults.InputBox(@"Comments for Disapproving ", "Reclassification", ref value) == DialogResult.OK)
            {
                //value = String.Format("{0:N2}", Convert.ToDecimal(value));

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

                if (!string.IsNullOrWhiteSpace(value))
                {
                    if (string.IsNullOrEmpty(selection.SelectedCount.ToString()) || selection.SelectedCount == 0)
                    {
                        Common.setMessageBox("No Record selected", "Reclassification", 1); return;
                    }
                    else
                    {
                        for (int i = 0; i < selection.SelectedCount; i++)
                        {
                            tableTrans.Rows.Add(new object[] { (selection.GetSelectedRow(i) as DataRowView)["MergeTinID"], (selection.GetSelectedRow(i) as DataRowView)["UTIN"], (selection.GetSelectedRow(i) as DataRowView)["IsprimaryTin"] });
                        }

                        if (tableTrans.Columns.Contains("ID"))
                        {
                            tableTrans.Columns.Remove("ID");
                        }

                        using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                        {
                            connect.Open();
                            _command = new SqlCommand("TaxAgentMergeTinDisapproved", connect)
                            {
                                CommandType = CommandType.StoredProcedure
                            };
                            _command.Parameters.Add(new SqlParameter("@pTransaction", SqlDbType.Structured)).Value = tableTrans;
                            _command.Parameters.Add(new SqlParameter("@user", SqlDbType.VarChar)).Value            = Program.UserID;
                            _command.CommandTimeout = 0;

                            using (System.Data.DataSet dts = new System.Data.DataSet())
                            {
                                dts.Clear();
                                adp = new SqlDataAdapter(_command);
                                adp.Fill(dts);
                                connect.Close();

                                if (dts.Tables[0].Rows[0]["returnCode"].ToString() != "00")
                                {
                                    Common.setMessageBox(dts.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);
                                    return;
                                }
                                else
                                {
                                    Common.setMessageBox(dts.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);
                                    return;
                                }
                            }
                        }
                    }
                }
                SplashScreenManager.CloseForm(false);
            }
        }