コード例 #1
0
ファイル: FrmPending.cs プロジェクト: leofemmy/TSS_Ogun
        void ProcessDataTable(DataTable Dt)
        {
            if (Dt != null && Dt.Rows.Count > 0)
            {
                foreach (DataRow item in Dt.Rows)
                {
                    if (item == null)
                    {
                        continue;
                    }
                    //decimal amount = decimal.Parse(item["Amount"].ToString());
                    try
                    {
                        item["AmountWords"] = amounttowords.convertToWords(item["Amount"].ToString(), item["prefix"].ToString(), item["Surfix"].ToString());

                        if (item["PayerID"].ToString().Length > 14)
                        {
                            item["PayerID"] = "None Yet Please approach the BIR for your Unique Payer ID.";
                        }
                        else
                        {
                            item["PayerID"] = item["PayerID"].ToString();
                            item["PayerID"] = string.Format("Your Payer ID which is <<{0}>> must be quoted in all transaction", item["PayerID"]);
                        }

                        item["ZoneCode"]    = item["StationCode"].ToString();
                        item["ZoneName"]    = item["StationName"].ToString();
                        item["Description"] = item["Description"].ToString();
                        //item["URL"] = string.Format(@"Payment for {0} {1} << Paid at {2} - {3} , Deposit Slip Number {4} by {5}  >> ", item["Description"], item["RevenueCode"], item["BankName"], item["BranchName"], item["DepositSlipNumber"], item["PaymentMethod"]);

                        item["URL"] = string.Format("Paid at {0} , {1}  Deposit Slip Number {2} in respect of {3} <{4}> By {5}", item["BankName"], item["BranchName"], item["DepositSlipNumber"], item["Description"], item["RevenueCode"], item["PaymentMethod"]);

                        item["User"] = Program.UserID.ToUpper();

                        item["Username"] = string.Format(@"</Printed at {0} Zonal Office  by {1} on {2}/>", item["StationName"], user, DateTime.Today.ToString("dd-MMM-yyyy"));

                        item["PaymentDate"] = Convert.ToDateTime(item["PaymentDate"]).ToString("dd-MMM-yyyy");
                    }
                    catch
                    {
                    }
                }
            }
        }
コード例 #2
0
 void ProcessDataTable(DataTable Dt)
 {
     if (Dt != null && Dt.Rows.Count > 0)
     {
         foreach (DataRow item in Dt.Rows)
         {
             if (item == null)
             {
                 continue;
             }
             //decimal amount = decimal.Parse(item["Amount"].ToString());
             try
             {
                 item["AmountWords"] = amounttowords.convertToWords(item["Amount"].ToString(), item["prefix"].ToString(), item["Surfix"].ToString());
                 string stateCode = Program.stateCode;
                 if (!item["PayerID"].ToString().StartsWith(stateCode))
                 //if (item["PayerID"].ToString().Length > 14)
                 {
                     item["PayerID"] = "Please approach the BIR for your unique Payer ID.";
                 }
                 else
                 {
                     item["PayerID"] = item["PayerID"].ToString();
                 }
                 item["Description"] = item["Description"].ToString();
                 item["URL"]         = string.Format(@"Payment for {0} {1} << Paid at {2} - {3} , Deposit Slip Number {4} by {5}  >> ", item["Description"], item["RevenueCode"], item["BankName"], item["BranchName"], item["DepositSlipNumber"], item["PaymentMethod"]);
                 item["User"]        = Program.UserID.ToUpper();
                 item["Username"]    = string.Format(@"</Printed at {0} Zonal Office  by {1} on {2}/>", item["StationName"], Program.UserID, DateTime.Today.ToString("dd-MMM-yyyy"));
                 item["PaymentDate"] = Convert.ToDateTime(item["PaymentDate"]).ToString("dd-MMM-yyyy");
             }
             catch
             {
             }
         }
     }
 }
コード例 #3
0
        void ProcessDataTable(DataTable Dt)
        {
            if (Dt != null && Dt.Rows.Count > 0)
            {
                Dt.Columns.Add("URL", typeof(string));
                Dt.AcceptChanges();

                foreach (DataRow item in Dt.Rows)
                {
                    //if (item == null) continue;
                    //decimal amount = decimal.Parse(item["Amount"].ToString());
                    //try
                    //{
                    //    item["AmountWords"] = amounttowords.convertToWords(item["Amount"].ToString());

                    //    if (item["PayerID"].ToString().Length > 14)
                    //    {
                    //        item["PayerID"] = "Please approach the BIR for your unique Payer ID.";
                    //    }
                    //    else
                    //    {
                    //        item["PayerID"] = item["PayerID"].ToString();
                    //    }

                    //    item["URL"] = string.Format(@"Payment for {0} {1} << Paid at {2} - {3} , Deposit Slip Number {4} by {5}  >> ", item["Description"], item["RevenueCode"], item["BankName"], item["BranchName"], item["DepositSlipNumber"], item["PaymentMethod"]);

                    //    item["User"] = Program.UserID.ToUpper();

                    //    item["Username"] = string.Format(@"<< Reprint of  receipt with control number {0}  at {1} printing station >>", item["ControlNumber"], item["StationName"]);

                    //    strreprint = string.Format(" Reprint of {0} Receipt", item["ControlNumber"]);

                    //    item["PaymentDate"] = Convert.ToDateTime(item["PaymentDate"]).ToString("dd-MMM-yyyy");
                    //}
                    //catch
                    //{

                    //}
                    if (item == null)
                    {
                        continue;
                    }
                    //decimal amount = decimal.Parse(item["Amount"].ToString());
                    try
                    {
                        item["AmountWords"] = amounttowords.convertToWords(item["Amount"].ToString(), item["prefix"].ToString(), item["Surfix"].ToString());
                        string stateCode = Program.stateCode;
                        if (!item["PayerID"].ToString().StartsWith(stateCode))
                        //if (item["PayerID"].ToString().Length > 14)
                        {
                            item["PayerID"] = "Approach the BIR for your Tax Identification Number.";
                        }
                        else
                        {
                            item["PayerID"] = item["PayerID"].ToString();
                            item["PayerID"] = string.Format("Your Payer ID which is <<{0}>> must be quoted in all transaction", item["PayerID"]);
                        }

                        item["ZoneCode"]    = item["StationCode"].ToString();
                        item["ZoneName"]    = item["StationName"].ToString();
                        item["Description"] = item["Description"].ToString();
                        //item["URL"] = string.Format(@"Payment for {0} {1} << Paid at {2} - {3} , Deposit Slip Number {4} by {5}  >> ", item["Description"], item["RevenueCode"], item["BankName"], item["BranchName"], item["DepositSlipNumber"], item["PaymentMethod"]);



                        switch (Program.intCode)
                        {
                        case 13:    //Akwa Ibom state
                            item["URL"] = string.Format("Paid at {0} , {1}  Deposit Slip Number {2} in respect of {3} By {4}", item["BankName"], item["BranchName"], item["DepositSlipNumber"], item["Description"], item["PaymentMethod"]);
                            //item["AgencyCode"] = string.Format("{0}/{1}", item["AgencyCode"], item["RevenueCode"]);
                            item["AgencyCode"] = string.Format("{0}", item["RevenueCode"]);
                            break;

                        case 20:    //detla state
                            item["URL"] = string.Format("Payment for [{0}/{1}] paid at [{2}/{3}], Slip Number [{4}] by [{5}]", item["Description"], item["RevenueCode"], item["BankName"], item["BranchName"], item["DepositSlipNumber"], item["PaymentMethod"]);
                            break;


                        case 37:    //ogun state
                            item["URL"] = string.Format("Paid at {0} , {1}  Deposit Slip Number {2} in respect of {3} <{4}> By {5}", item["BankName"], item["BranchName"], item["DepositSlipNumber"], item["Description"], item["RevenueCode"], item["PaymentMethod"]);
                            break;

                        case 40:    //oyo state
                            item["URL"] = string.Format("Paid at {0} , {1}  Deposit Slip Number {2} in respect of {3} <{4}> By {5}", item["BankName"], item["BranchName"], item["DepositSlipNumber"], item["Description"], item["RevenueCode"], item["PaymentMethod"]);
                            break;

                        case 32:    //kogi state
                            item["URL"] = string.Format("Paid at {0} , {1}  Deposit Slip Number {2} in respect of {3} <{4}> By {5}", item["BankName"], item["BranchName"], item["DepositSlipNumber"], item["Description"], item["RevenueCode"], item["PaymentMethod"]);
                            break;

                        default:
                            break;
                        }

                        item["User"] = Program.UserID.ToUpper();

                        item["Username"] = string.Format(@"</Reprint of Receipt with control number {0} of {1}, Printed at {2} Zonal Office  by {3} on {4}/>", item["ControlNumber"], Convert.ToDateTime(item["ControlNumberDate"]).ToString("dd-MMM-yyyy"), item["StationName"], Program.UserID.ToUpper(), DateTime.Today.ToString("dd-MMM-yyyy"));

                        item["PaymentDate"] = Convert.ToDateTime(item["PaymentDate"]).ToString("dd-MMM-yyyy");
                    }
                    catch
                    {
                    }
                }
            }
        }
コード例 #4
0
ファイル: FrmReceipts.cs プロジェクト: leofemmy/TSS_Ogun
        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();
                }
            }
        }