EchoTex_Payroll/HRM.Report/Class/rptBankAdvice.cs

849 lines
39 KiB
C#
Raw Normal View History

2024-10-14 10:01:49 +06:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using Payroll.BO;
using Ease.CoreV35;
using Ease.Core.Model;
using Ease.Core.Utility;
using System.Windows.Forms;
using HRM.BO;
using HRM.DA;
using System.IO;
namespace HRM.Report
{
public class rptBankAdvice
{
DataSet resultDataSet = new DataSet();
public byte[] ShowBankDisbursmentReport(int payrollTypeId, DateTime SalaryMonth, string sEmpID, int BankId, string reportType)
{
DateTime salaryMonth = SalaryMonth.LastDateOfMonth();
int count = 1;
DataRow oDR = null;
Bank oBank = new BankService().Get(BankId);
DataSet oEmpBankAcc = new EmployeeBankAccountService().GetEmpBankAdvice(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID);
PayrollDataSet.dsCompany.BankAdviceDataTable bankAdvice = new PayrollDataSet.dsCompany.BankAdviceDataTable();
double nTotal = 0.0;
foreach (DataRow oDRow in oEmpBankAcc.Tables[0].Rows)
{
oDR = bankAdvice.NewRow();
oDR["EmpNo"] = oDRow["EMPLOYEENO"];
oDR["EmpName"] = oDRow["NAME"];
oDR["AccountNo"] = oDRow["ACCOUNTNO"];
oDR["Amount"] = Math.Round(Convert.ToDouble(oDRow["CHANGEDAMOUNT"]));
oDR["Email"] = oDRow["EMAILADDRESS"];
oDR["SalaryMonth"] = salaryMonth;
oDR["SLNo"] = count;
//if(oDRow["EMAILADDRESS"] != null)
//{
// oDR["Email"] = oDRow["EMAILADDRESS"];
//}
//oDR["CostCenter"] = oDRow["CostCenter"].ToString();
bankAdvice.Rows.Add(oDR);
nTotal += Convert.ToDouble(oDR["Amount"]);
count++;
}
// bankAdvice.TableName = "dsCompany_BankAdvice";
// resultDataSet.Tables.Add(bankAdvice);
//string RDLCName = "HRM.Report.RDLC.SalaryBankDisbursement.rdlc";
ReportProcessor reportProcessor = new ReportProcessor();
return reportProcessor.ShowDlgForBankDisbursment(null, bankAdvice, reportType, payrollTypeId);
//return reportProcessor.CommonReportView(null, RDLCName, resultDataSet, null, null, true, payrollTypeId, reportType);
}
public byte[] ShowNewBankDisbursmentReport(int payrollTypeId, DateTime SalaryMonth, string sEmpID, int BankId, string reportType)
{
DateTime salaryMonth = SalaryMonth.LastDateOfMonth();
int count = 1;
DataRow oDR = null;
Bank oBank = new BankService().Get(BankId);
DataSet oEmpBankAcc = new EmployeeBankAccountService().GetEmpBankAdvice(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID);
PayrollDataSet.dsCompany.BankAdviceDataTable bankAdvice = new PayrollDataSet.dsCompany.BankAdviceDataTable();
double nTotal = 0.0;
foreach (DataRow oDRow in oEmpBankAcc.Tables[0].Rows)
{
oDR = bankAdvice.NewRow();
oDR["EmpNo"] = oDRow["EMPLOYEENO"];
oDR["EmpName"] = oDRow["NAME"]; //Beneficiary Name(120)
oDR["AccountNo"] = oDRow["ACCOUNTNO"]; //Beneficiary Account Number
oDR["Amount"] = Math.Round(Convert.ToDouble(oDRow["CHANGEDAMOUNT"])); //Payment Amount
oDR["SalaryMonth"] = salaryMonth; //Reason(140)
oDR["PaymentDate"] = oDRow["PAYMENTDATE"]; //Payment Date(DD/MM/YYYY)
oDR["Email"] = oDRow["EMAILADDRESS"]; //Beneficiary Email ID(Optional)
oDR["SLNo"] = count;
//if(oDRow["EMAILADDRESS"] != null)
//{
// oDR["Email"] = oDRow["EMAILADDRESS"];
//}
//oDR["CostCenter"] = oDRow["CostCenter"].ToString();
bankAdvice.Rows.Add(oDR);
nTotal += Convert.ToDouble(oDR["Amount"]);
count++;
}
// bankAdvice.TableName = "dsCompany_BankAdvice";
// resultDataSet.Tables.Add(bankAdvice);
//string RDLCName = "HRM.Report.RDLC.SalaryBankDisbursement.rdlc";
ReportProcessor reportProcessor = new ReportProcessor();
string rdlcName = "BankAdvice.rdlc";
return reportProcessor.ShowDlgForNewBankDisbursment(null, bankAdvice, reportType, payrollTypeId, rdlcName, SalaryMonth);
//return reportProcessor.CommonReportView(null, RDLCName, resultDataSet, null, null, true, payrollTypeId, reportType);
}
}
}
//using System;
//using System.Collections.Generic;
//using System.ComponentModel;
//using System.Data;
//using System.Drawing;
//using System.Linq;
//using System.Text;
//using System.Windows.Forms;
//using Payroll.BO;
//using Ease.CoreV35;
//using Ease.CoreV35.Model;
//using Ease.CoreV35.Caching;
//using Ease.CoreV35.DataAccess;
//namespace Payroll.Report
//{
// public class rptBankAdvice
// {
// private ReportSetup _selectedParameter;
// public rptBankAdvice()
// {
// }
// public ReportSetup SelectedParameter
// {
// set
// {
// _selectedParameter = value;
// }
// }
// public void ShowReport()
// {
// if (Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer == 1)
// {
// fReportViewer form = new fReportViewer();
// DateTime salaryMonth = _selectedParameter.FromDate.Value;
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// int count = 1;
// DataRow oDR = null;
// Bank oBank;
// if (_selectedParameter.Banks.Count > 0)
// oBank = _selectedParameter.Banks[0];
// // else throw new ServiceException("please select a bank");
// DataSet oEmpBankAcc = EmployeeBankAccount.GetEmpBankAdvice(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID);
// PayrollDataSet.dsCompany.BankAdviceDataTable bankAdvice = new Payroll.Report.PayrollDataSet.dsCompany.BankAdviceDataTable();
// double nTotal = 0.0;
// foreach (DataRow oDRow in oEmpBankAcc.Tables[0].Rows)
// {
// oDR = bankAdvice.NewRow();
// oDR["EmpNo"] = oDRow["EMPLOYEENO"];
// oDR["EmpName"] = oDRow["NAME"];
// oDR["AccountNo"] = oDRow["ACCOUNTNO"];
// oDR["Amount"] = Math.Round(Convert.ToDouble(oDRow["CHANGEDAMOUNT"]));
// oDR["Email"] = oDRow["EMAILADDRESS"];
// oDR["SalaryMonth"] = salaryMonth;
// oDR["SLNo"] = count;
// //oDR["CostCenter"] = oDRow["CostCenter"].ToString();
// bankAdvice.Rows.Add(oDR);
// nTotal += Convert.ToDouble(oDR["Amount"]);
// count++;
// }
// form.ShowDlgForBankAdvice(_selectedParameter.ReportItem, bankAdvice);
// }
// else
// {
// ShowReportNmgt();
// }
// }
// public void ShowCashAdviceReport()
// {
// fReportViewer form = new fReportViewer();
// DateTime salaryMonth = _selectedParameter.FromDate.Value;
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// int count = 1;
// DataRow oDR = null;
// DataSet oEmpBankAcc = EmployeeBankAccount.GetEmpCashAdvice(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID);
// PayrollDataSet.dsCompany.BankAdviceDataTable bankAdvice = new Payroll.Report.PayrollDataSet.dsCompany.BankAdviceDataTable();
// double nTotal = 0.0;
// foreach (DataRow oDRow in oEmpBankAcc.Tables[0].Rows)
// {
// oDR = bankAdvice.NewRow();
// oDR["EmpNo"] = oDRow["EMPLOYEENO"];
// oDR["EmpName"] = oDRow["NAME"];
// oDR["Amount"] = Math.Round(Convert.ToDouble(oDRow["CHANGEDAMOUNT"]));
// oDR["Email"] = oDRow["EMAILADDRESS"];
// oDR["SalaryMonth"] = salaryMonth;
// oDR["SLNo"] = count;
// bankAdvice.Rows.Add(oDR);
// nTotal += Convert.ToDouble(oDR["Amount"]);
// count++;
// }
// form.ShowDlgForCashAdviceNew(_selectedParameter.ReportItem, bankAdvice);
// }
// public void ShowReportNmgt()
// {
// fReportViewer form = new fReportViewer();
// DateTime salaryMonth = _selectedParameter.FromDate.Value;
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// int count = 1;
// DataRow oDR = null;
// Bank oBank;
// if (_selectedParameter.Banks.Count > 0)
// oBank = _selectedParameter.Banks[0];
// // else throw new ServiceException("Please select a bank");
// DataSet oEmpBankAcc = EmployeeBankAccount.GetEmpBankAdvice(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID);
// PayrollDataSet.dsCompany.BankAdviceNmgtDataTable bankAdvice = new Payroll.Report.PayrollDataSet.dsCompany.BankAdviceNmgtDataTable();
// double nTotal = 0.0;
// foreach (DataRow oDRow in oEmpBankAcc.Tables[0].Rows)
// {
// oDR = bankAdvice.NewRow();
// oDR["EmpNo"] = oDRow["EMPLOYEENO"];
// oDR["EmpName"] = oDRow["NAME"];
// oDR["AccountNo"] = oDRow["ACCOUNTNO"];
// oDR["Amount"] = Math.Round(Convert.ToDouble(oDRow["CHANGEDAMOUNT"]));
// oDR["PaymentDate"] = oDRow["PAYMENTDATE"] == DBNull.Value ? "" : Convert.ToDateTime(oDRow["PAYMENTDATE"]).ToString("dd MMM yyyy");
// // oDR["Bank"] = oBank.Name;
// oDR["Bank"] = oDRow["Bank"];
// oDR["Branch"] = oDRow["Branch"];
// oDR["BankRouting"] = oDRow["BranchCode"];
// oDR["CustomerRef"] = oDRow["EMPLOYEENO"] + DateTime.Today.ToString("ddMMyyyy");
// oDR["CompanysBankAcc"] = string.Empty;
// oDR["SalaryMonth"] = salaryMonth;
// oDR["SLNo"] = count;
// bankAdvice.Rows.Add(oDR);
// nTotal += Convert.ToDouble(oDR["Amount"]);
// count++;
// }
// form.ShowDlgForBankAdviceNmgt(_selectedParameter.ReportItem, bankAdvice, salaryMonth.ToString(" MMM yyyy"), Ease.CoreV35.Utility.Global.NumericFunctions.TakaWords(nTotal));
// }
// public byte[] BankAdviceSalaryReportInByte(ReportSetup selectedParameter)
// {
// fReportViewer form = new fReportViewer();
// DateTime salaryMonth = selectedParameter.FromDate.Value;
// string sEmpID = selectedParameter.ReportItem.INSQL;
// int count = 1;
// DataRow oDR = null;
// Bank oBank;
// if (selectedParameter.Banks.Count > 0)
// oBank = selectedParameter.Banks[0];
// else throw new ServiceException("please select a bank");
// DataSet oEmpBankAcc = EmployeeBankAccount.GetEmpBankAdvice(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID);
// PayrollDataSet.dsCompany.BankAdviceDataTable bankAdvice = new Payroll.Report.PayrollDataSet.dsCompany.BankAdviceDataTable();
// double nTotal = 0.0;
// foreach (DataRow oDRow in oEmpBankAcc.Tables[0].Rows)
// {
// oDR = bankAdvice.NewRow();
// oDR["EmpNo"] = oDRow["EMPLOYEENO"];
// oDR["EmpName"] = oDRow["NAME"];
// oDR["AccountNo"] = oDRow["ACCOUNTNO"];
// oDR["Amount"] = Math.Round(Convert.ToDouble(oDRow["CHANGEDAMOUNT"]));
// oDR["Email"] = oDRow["EMAILADDRESS"];
// oDR["SalaryMonth"] = salaryMonth;
// oDR["SLNo"] = count;
// //oDR["CostCenter"] = oDRow["CostCenter"].ToString();
// bankAdvice.Rows.Add(oDR);
// nTotal += Convert.ToDouble(oDR["Amount"]);
// count++;
// }
// return form.BankAdviceSalaryReportInByte(selectedParameter.ReportItem, bankAdvice);
// }
// public void ShowReportOPI()
// {
// fReportViewer form = new fReportViewer();
// DateTime salaryMonth = _selectedParameter.FromDate.Value;
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// int count = 1;
// DataRow oDR = null;
// Bank oBank;
// if (_selectedParameter.Banks.Count > 0)
// oBank = _selectedParameter.Banks[0];
// else throw new ServiceException("please select a bank");
// DataSet oEmpBankAcc = EmployeeBankAccount.GetOPIEmpBankAdvice(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID, oBank.ID.Integer);
// DataSet oEmpExpenseAmount = new DataSet();
// PayrollDataSet.PayrollDataSet.BankAdviceDataTable bankAdvice = new Payroll.Report.PayrollDataSet.PayrollDataSet.BankAdviceDataTable();
// PayrollDataSet.PayrollDataSet.BankAdviceLetterDataTable bankAdviceLetter = new Payroll.Report.PayrollDataSet.PayrollDataSet.BankAdviceLetterDataTable();
// double nTotal = 0.0;
// foreach (DataRow oDRow in oEmpBankAcc.Tables[0].Rows)
// {
// oDR = bankAdvice.NewRow();
// oDR["EmpNo"] = oDRow["EMPLOYEENO"];
// oDR["EmpName"] = oDRow["NAME"];
// oDR["AccountNo"] = oDRow["ACCOUNTNO"];
// oDR["Amount"] = oDRow["Amount"];
// oDR["SLNo"] = count;
// bankAdvice.Rows.Add(oDR);
// count++;
// }
// form.ShowDlgForOPIBankAdvice(_selectedParameter.ReportItem, bankAdvice);
// }
// public void ShowReportHNMOPI()
// {
// fReportViewer form = new fReportViewer();
// DateTime salaryMonth = _selectedParameter.FromDate.Value;
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// int count = 1;
// DataRow oDR = null;
// Bank oBank;
// //else throw new ServiceException("please select a division");
// if (_selectedParameter.Banks.Count > 0)
// oBank = _selectedParameter.Banks[0];
// else throw new ServiceException("please select a bank");
// DataSet oEmpBankAcc = EmployeeBankAccount.GetHNMOPIEmpBankAdvice(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID);
// DataSet oEmpExpenseAmount = new DataSet();
// PayrollDataSet.PayrollDataSet.BankAdviceHNMDataTable bankAdvice = new Payroll.Report.PayrollDataSet.PayrollDataSet.BankAdviceHNMDataTable();
// PayrollDataSet.PayrollDataSet.BankAdviceLetterDataTable bankAdviceLetter = new Payroll.Report.PayrollDataSet.PayrollDataSet.BankAdviceLetterDataTable();
// double nTotal = 0.0;
// foreach (DataRow oDRow in oEmpBankAcc.Tables[0].Rows)
// {
// //DataRow[] oEmpExpAmount = oEmpExpenseAmount.Tables[0].Select("EmployeeNo='" + oDRow["EMPLOYEENO"].ToString() + "'");
// oDR = bankAdvice.NewRow();
// oDR["EmpNo"] = oDRow["EMPLOYEENO"];
// oDR["EmpName"] = oDRow["NAME"];
// oDR["AccountNo"] = oDRow["ACCOUNTNO"];
// oDR["Amount"] = Math.Round(Convert.ToDouble(oDRow["Amount"]));
// oDR["CostCenter"] = oDRow["CostCenter"];
// ////}
// //oDR["Email"] = oDRow["EMAILADDRESS"];
// //oDR["SalaryMonth"] = salaryMonth;
// oDR["SLNo"] = count;
// bankAdvice.Rows.Add(oDR);
// //nTotal += Convert.ToDouble(oDR["Amount"]);
// count++;
// }
// //string sRefNo = "Reference No." +
// // Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate.Year.ToString() + "/" +
// // Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate.ToString("MMM") + "/" +
// // oBank.Code + "/" + oDivision.Name;
// //string sDateTaka = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate.ToString("MMMM, yyyy") +
// // " of total BDT " + Payroll.BO.GlobalFunctions.TakaFormat(nTotal) + " (" + Ease.CoreV35.Utility.Global.NumericFunctions.TakaWords(nTotal) + ")";
// ////string sAccount = oBank.Code=="400"?"01-6174914-03":"171.120.119";
// //string sAccount = oBank.AccountNo;
// //string sTaka = "BDT " + Payroll.BO.GlobalFunctions.TakaFormat(nTotal) + " (" + Ease.CoreV35.Utility.Global.NumericFunctions.TakaWords(nTotal) + ")";
// //bankAdviceLetter.Rows.Add(sRefNo, sDateTaka, sAccount, oDivision.Name, DateTime.Today.ToString("dd MMM yyyy"), oBank.Name, Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate.ToString("MMMM, yyyy"), sTaka);
// //return bankAdvice;
// form.ShowDlgForHNMOPIBankAdvice(_selectedParameter.ReportItem, bankAdvice);
// }
// public void OPIBankDisbursement()
// {
// fReportViewer form = new fReportViewer();
// DateTime salaryMonth = _selectedParameter.FromDate.Value;
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// int count = 1;
// DataRow oDR = null;
// Bank oBank;
// //else throw new ServiceException("please select a division");
// if (_selectedParameter.Banks.Count > 0)
// oBank = _selectedParameter.Banks[0];
// else throw new ServiceException("please select a bank");
// DataSet oEmpBankAcc = EmployeeBankAccount.GetHNMOPIEmpBankAdvice(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID);
// DataSet oEmpExpenseAmount = new DataSet();
// PayrollDataSet.PayrollDataSet.BankAdviceHNMDataTable bankAdvice = new Payroll.Report.PayrollDataSet.PayrollDataSet.BankAdviceHNMDataTable();
// PayrollDataSet.PayrollDataSet.BankAdviceLetterDataTable bankAdviceLetter = new Payroll.Report.PayrollDataSet.PayrollDataSet.BankAdviceLetterDataTable();
// double nTotal = 0.0;
// foreach (DataRow oDRow in oEmpBankAcc.Tables[0].Rows)
// {
// //DataRow[] oEmpExpAmount = oEmpExpenseAmount.Tables[0].Select("EmployeeNo='" + oDRow["EMPLOYEENO"].ToString() + "'");
// oDR = bankAdvice.NewRow();
// oDR["EmpNo"] = oDRow["EMPLOYEENO"];
// oDR["EmpName"] = oDRow["NAME"];
// oDR["AccountNo"] = oDRow["ACCOUNTNO"];
// oDR["Amount"] = Math.Round(Convert.ToDouble(oDRow["Amount"]));
// oDR["CostCenter"] = oDRow["CostCenter"];
// ////}
// //oDR["Email"] = oDRow["EMAILADDRESS"];
// //oDR["SalaryMonth"] = salaryMonth;
// oDR["SLNo"] = count;
// bankAdvice.Rows.Add(oDR);
// //nTotal += Convert.ToDouble(oDR["Amount"]);
// count++;
// }
// //string sRefNo = "Reference No." +
// // Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate.Year.ToString() + "/" +
// // Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate.ToString("MMM") + "/" +
// // oBank.Code + "/" + oDivision.Name;
// //string sDateTaka = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate.ToString("MMMM, yyyy") +
// // " of total BDT " + Payroll.BO.GlobalFunctions.TakaFormat(nTotal) + " (" + Ease.CoreV35.Utility.Global.NumericFunctions.TakaWords(nTotal) + ")";
// ////string sAccount = oBank.Code=="400"?"01-6174914-03":"171.120.119";
// //string sAccount = oBank.AccountNo;
// //string sTaka = "BDT " + Payroll.BO.GlobalFunctions.TakaFormat(nTotal) + " (" + Ease.CoreV35.Utility.Global.NumericFunctions.TakaWords(nTotal) + ")";
// //bankAdviceLetter.Rows.Add(sRefNo, sDateTaka, sAccount, oDivision.Name, DateTime.Today.ToString("dd MMM yyyy"), oBank.Name, Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate.ToString("MMMM, yyyy"), sTaka);
// //return bankAdvice;
// form.OPIBankDisbursement(_selectedParameter.ReportItem, bankAdvice);
// }
// internal void ShowBankAdvice(DateTime salaryMonth, Bank obank)
// {
// fReportViewer form = new fReportViewer();
// int count = 1;
// string sRefNo = string.Empty;
// string sSub = string.Empty;
// DataRow oDR = null;
// try
// {
// DataSet oEmpBankAcc = EmployeeBankAccount.GetEmpBankAdvice(GlobalFunctions.LastDateOfMonth(salaryMonth), obank.ID.Integer);
// PayrollDataSet.dsCompany.BankAdviceDataTable bankAdvice = new Payroll.Report.PayrollDataSet.dsCompany.BankAdviceDataTable();
// PayrollDataSet.dsCompany.BankAdviceLetterDataTable bankAdviceLetter = new Payroll.Report.PayrollDataSet.dsCompany.BankAdviceLetterDataTable();
// PayrollDataSet.dsCompany.BankAdviceParametersDataTable bankAdviceParameter = new Payroll.Report.PayrollDataSet.dsCompany.BankAdviceParametersDataTable();
// double nTotal = 0.0;
// foreach (DataRow oDRow in oEmpBankAcc.Tables[0].Rows)
// {
// oDR = bankAdvice.NewRow();
// oDR["EmpNo"] = oDRow["EMPLOYEENO"];
// oDR["EmpName"] = oDRow["NAME"];
// oDR["AccountNo"] = oDRow["ACCOUNTNO"];
// oDR["Amount"] = GlobalFunctions.Round(Convert.ToDouble(oDRow["CHANGEDAMOUNT"].ToString()));
// oDR["SalaryMonth"] = salaryMonth;
// oDR["Maintenance"] = "A";
// oDR["Currency"] = "BDT";
// oDR["Method"] = "T";
// oDR["Cheque"] = "";
// oDR["DeNomination"] = "";
// oDR["Bank"] = obank.Name;
// oDR["Branch"] = oDRow["Branch"].ToString();
// oDR["Remarks"] = "Salary of " + salaryMonth.ToString("MMMM, yyyy");
// oDR["SenderAccNo"] = obank.Accountingformat;
// oDR["BankRouting"] = oDRow["Code"].ToString();
// oDR["AccType"] = "Savings Account";
// oDR["SLNo"] = count;
// bankAdvice.Rows.Add(oDR);
// nTotal += Convert.ToDouble(oDR["Amount"]);
// count++;
// }
// sSub = "Subject: Transfer of Salary for the month of ";
// if (obank.ID.Integer == 2)
// {
// sRefNo = "Our Ref : " + obank.Name + " / DIS - P-69/" + salaryMonth.ToString("yy");
// }
// else if (obank.ID.Integer == 3)
// {
// sRefNo = "Our Ref : " + obank.Name + " / DIS - P-";
// }
// else if (obank.ID.Integer == 4)
// {
// sRefNo = "Our Ref : " + obank.Name + " / DIS -P-";
// }
// else if (obank.ID.Integer == 5)
// {
// sRefNo = "Our Ref : " + obank.Name + " / DIS - P-";
// }
// else if (obank.ID.Integer == 1)
// {
// sRefNo = "Ref.: HSBC / DIS -P-50/" + salaryMonth.ToString("yyyy") + " (Current Account # " + obank.Accountingformat + ")";
// oDR = bankAdviceParameter.NewRow();
// oDR["OrderingCustomer"] = "Eskayef Bangladesh Limited";
// oDR["DAccountID"] = "";
// oDR["DAccountNo"] = obank.Accountingformat;
// oDR["Date"] = salaryMonth.ToString("m/dd/yyyy");
// oDR["MapTable"] = "";
// oDR["Field"] = "";
// oDR["PaymentReference"] = "";
// oDR["TransactionAmount"] = GlobalFunctions.Round(nTotal);
// oDR["PayeesAccNo"] = "";
// oDR["AccName"] = obank.Name;
// oDR["PayRef1"] = count.ToString();
// oDR["PayRef2"] = "";
// oDR["PayRef3"] = "";
// oDR["PayRef4"] = "";
// bankAdviceParameter.Rows.Add(oDR);
// sSub = "Subject : Disbursement of Employees Salary for the month of ";
// }
// string sAmount = NumWordsWrapper(Payroll.BO.GlobalFunctions.Round(nTotal));
// string sDateTaka = "BDT. " + sAmount;
// string sAccount = obank.Accountingformat;
// double dAmount = Payroll.BO.GlobalFunctions.Round(nTotal);
// string sTaka = "BDT " + dAmount.ToString("###,##") + "/-(BDT. " + sAmount + ")";
// if (oEmpBankAcc.Tables[0].Rows.Count > 0)
// {
// bankAdviceLetter.Rows.Add(sRefNo, sDateTaka, sAccount, oEmpBankAcc.Tables[0].Rows[0]["Branch"].ToString(), DateTime.Today.ToString("dd MMM yyyy"), obank.Name, Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate.ToString("MMMM, yyyy"), sTaka);
// }
// else
// {
// bankAdviceLetter.Rows.Add(sRefNo, sDateTaka, sAccount, "", DateTime.Today.ToString("dd MMM yyyy"), obank.Name, Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate.ToString("MMMM, yyyy"), sTaka);
// }
// //if (obank.ID.Integer != 6 && obank.ID.Integer != 7)
// //{
// form.ShowDlgForBankAdvice(salaryMonth, bankAdvice, bankAdviceLetter, bankAdviceParameter, obank, sSub);
// //}
// //else
// //{
// //}
// }
// catch (Exception ex)
// {
// throw new ServiceException(ex.Message);
// }
// }
// internal void ShowOPIBankAdvice(DateTime salaryMonth, Bank obank)
// {
// fReportViewer form = new fReportViewer();
// int count = 1;
// string sRefNo = string.Empty;
// string sSub = string.Empty;
// DataRow oDR = null;
// try
// {
// DataSet oEmpBankAcc = EmployeeBankAccount.GetEmpOPIBankAdvice(GlobalFunctions.LastDateOfMonth(salaryMonth), obank.ID.Integer);
// PayrollDataSet.dsCompany.BankAdviceDataTable bankAdvice = new Payroll.Report.PayrollDataSet.dsCompany.BankAdviceDataTable();
// PayrollDataSet.dsCompany.BankAdviceLetterDataTable bankAdviceLetter = new Payroll.Report.PayrollDataSet.dsCompany.BankAdviceLetterDataTable();
// PayrollDataSet.dsCompany.BankAdviceParametersDataTable bankAdviceParameter = new Payroll.Report.PayrollDataSet.dsCompany.BankAdviceParametersDataTable();
// double nTotal = 0.0;
// foreach (DataRow oDRow in oEmpBankAcc.Tables[0].Rows)
// {
// oDR = bankAdvice.NewRow();
// oDR["EmpNo"] = oDRow["EMPLOYEENO"];
// oDR["EmpName"] = oDRow["NAME"];
// oDR["AccountNo"] = oDRow["ACCOUNTNO"];
// oDR["Amount"] = GlobalFunctions.Round(Convert.ToDouble(oDRow["CHANGEDAMOUNT"].ToString()));
// oDR["SalaryMonth"] = salaryMonth;
// oDR["Maintenance"] = "A";
// oDR["Currency"] = "BDT";
// oDR["Method"] = "T";
// oDR["Cheque"] = "";
// oDR["DeNomination"] = "";
// oDR["Bank"] = obank.Name;
// oDR["Branch"] = oDRow["Branch"].ToString();
// oDR["Remarks"] = "Salary of " + salaryMonth.ToString("MMMM, yyyy");
// oDR["SenderAccNo"] = obank.Accountingformat;
// oDR["BankRouting"] = oDRow["Code"].ToString();
// oDR["AccType"] = "Savings Account";
// oDR["SLNo"] = count;
// bankAdvice.Rows.Add(oDR);
// nTotal += Convert.ToDouble(oDR["Amount"]);
// count++;
// }
// sSub = "Subject: Transfer of OPI for the month of ";
// if (obank.ID.Integer == 2)
// {
// sRefNo = "Our Ref : " + obank.Name + " / DIS - P-69/" + salaryMonth.ToString("yy");
// }
// else if (obank.ID.Integer == 3)
// {
// sRefNo = "Our Ref : " + obank.Name + " / DIS - P-";
// }
// else if (obank.ID.Integer == 4)
// {
// sRefNo = "Our Ref : " + obank.Name + " / DIS -P-";
// }
// else if (obank.ID.Integer == 5)
// {
// sRefNo = "Our Ref : " + obank.Name + " / DIS - P-";
// }
// else if (obank.ID.Integer == 1)
// {
// sRefNo = "Ref.: HSBC / DIS -P-50/" + salaryMonth.ToString("yyyy") + " (Current Account # " + obank.Accountingformat + ")";
// oDR = bankAdviceParameter.NewRow();
// oDR["OrderingCustomer"] = "Eskayef Bangladesh Limited";
// oDR["DAccountID"] = "";
// oDR["DAccountNo"] = obank.Accountingformat;
// oDR["Date"] = salaryMonth.ToString("m/dd/yyyy");
// oDR["MapTable"] = "";
// oDR["Field"] = "";
// oDR["PaymentReference"] = "";
// oDR["TransactionAmount"] = GlobalFunctions.Round(nTotal);
// oDR["PayeesAccNo"] = "";
// oDR["AccName"] = obank.Name;
// oDR["PayRef1"] = count.ToString();
// oDR["PayRef2"] = "";
// oDR["PayRef3"] = "";
// oDR["PayRef4"] = "";
// bankAdviceParameter.Rows.Add(oDR);
// sSub = "Subject : Disbursement of Employees OPI for the month of ";
// }
// string sAmount = NumWordsWrapper(Payroll.BO.GlobalFunctions.Round(nTotal));
// string sDateTaka = "BDT. " + sAmount;
// string sAccount = obank.Accountingformat;
// double dAmount = Payroll.BO.GlobalFunctions.Round(nTotal);
// string sTaka = "BDT " + dAmount.ToString("###,##") + "/-(BDT. " + sAmount + ")";
// if (oEmpBankAcc.Tables[0].Rows.Count > 0)
// {
// bankAdviceLetter.Rows.Add(sRefNo, sDateTaka, sAccount, oEmpBankAcc.Tables[0].Rows[0]["Branch"].ToString(), DateTime.Today.ToString("dd MMM yyyy"), obank.Name, Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate.ToString("MMMM, yyyy"), sTaka);
// }
// else
// {
// bankAdviceLetter.Rows.Add(sRefNo, sDateTaka, sAccount, "", DateTime.Today.ToString("dd MMM yyyy"), obank.Name, Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate.ToString("MMMM, yyyy"), sTaka);
// }
// //if (obank.ID.Integer != 6 && obank.ID.Integer != 7)
// //{
// form.ShowDlgForBankAdvice(salaryMonth, bankAdvice, bankAdviceLetter, bankAdviceParameter, obank, sSub);
// //}
// //else
// //{
// //}
// }
// catch (Exception ex)
// {
// throw new ServiceException(ex.Message);
// }
// }
// public static String NumWordsWrapper(double value)
// {
// string words = "";
// double intPart;
// double decPart = 0;
// if (value == 0)
// return "zero";
// try
// {
// string[] splitter = value.ToString().Split('.');
// intPart = double.Parse(splitter[0]);
// if (splitter.Length > 1)
// {
// decPart = double.Parse(splitter[1]);
// }
// }
// catch
// {
// intPart = value;
// }
// words = NumWords(Convert.ToInt32(intPart));
// if (decPart > 0)
// {
// if (words != "")
// words += " and ";
// int counter = decPart.ToString().Length;
// switch (counter)
// {
// case 1: words += NumWords(Convert.ToInt32(decPart)) + ""; break;// tenths
// case 2: words += NumWords(Convert.ToInt32(decPart)) + ""; break;// hundredths
// case 3: words += NumWords(Convert.ToInt32(decPart)) + ""; break;// thousandths
// case 4: words += NumWords(Convert.ToInt32(decPart)) + ""; break;// ten-thousandths
// case 5: words += NumWords(Convert.ToInt32(decPart)) + ""; break;// hundred-thousandths
// case 6: words += NumWords(Convert.ToInt32(decPart)) + ""; break;// millionths
// case 7: words += NumWords(Convert.ToInt32(decPart)) + ""; break;// ten-millionths
// }
// }
// return words + " Taka Only";
// }
// private static string NumWords(int Num)
// {
// #region Old Code
// //string[] numbersArr = new string[] { "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" };
// //string[] tensArr = new string[] { "twenty", "thirty", "fourty", "fifty", "sixty", "seventy", "eighty", "ninty" };
// //string[] suffixesArr = new string[] { "thousand", "million", "billion", "trillion", "quadrillion", "quintillion", "sextillion", "septillion", "octillion", "nonillion", "decillion", "undecillion", "duodecillion", "tredecillion", "Quattuordecillion", "Quindecillion", "Sexdecillion", "Septdecillion", "Octodecillion", "Novemdecillion", "Vigintillion" };
// //string words = "";
// //bool tens = false;
// //if (n < 0)
// //{
// // words += "negative ";
// // n *= -1;
// //}
// //int power = (suffixesArr.Length + 1) * 3;
// //while (power > 3)
// //{
// // double pow = Math.Pow(10, power);
// // if (n > pow)
// // {
// // if (n % Math.Pow(10, power) > 0)
// // {
// // words += NumWords(Math.Floor(n / pow)) + " " + suffixesArr[(power / 3) - 1] + " and ";
// // }
// // else if (n % pow > 0)
// // {
// // words += NumWords(Math.Floor(n / pow)) + " " + suffixesArr[(power / 3) - 1];
// // }
// // n %= pow;
// // }
// // power -= 3;
// //}
// //if (n >= 1000)
// //{
// // if (n % 1000 > 0) words += NumWords(Math.Floor(n / 1000)) + " thousand and ";
// // else words += NumWords(Math.Floor(n / 1000)) + " thousand";
// // n %= 1000;
// //}
// //if (0 <= n && n <= 999)
// //{
// // if ((int)n / 100 > 0)
// // {
// // words += NumWords(Math.Floor(n / 100)) + " hundred";
// // n %= 100;
// // }
// // if ((int)n / 10 > 1)
// // {
// // if (words != "")
// // words += " ";
// // words += tensArr[(int)n / 10 - 2];
// // tens = true;
// // n %= 10;
// // }
// // if (n < 20)
// // {
// // if (words != "" && tens == false)
// // words += " ";
// // words += (tens ? "-" + numbersArr[(int)n - 1] : numbersArr[(int)n - 1]);
// // n -= Math.Floor(n);
// // }
// //}
// //return words;
// #endregion
// string[] Below20 = { "", "One ", "Two ", "Three ", "Four ",
// "Five ", "Six " , "Seven ", "Eight ", "Nine ", "Ten ", "Eleven ",
// "Twelve " , "Thirteen ", "Fourteen ","Fifteen ",
// "Sixteen " , "Seventeen ","Eighteen " , "Nineteen " };
// string[] Below100 = { "", "", "Twenty ", "Thirty ",
// "Forty ", "Fifty ", "Sixty ", "Seventy ", "Eighty ", "Ninety " };
// string InWords = "";
// if (Num >= 1 && Num < 20)
// InWords += Below20[Num];
// if (Num >= 20 && Num <= 99)
// InWords += Below100[Num / 10] + Below20[Num % 10];
// if (Num >= 100 && Num <= 999)
// InWords += NumWords(Num / 100) + " Hundred " + NumWords(Num % 100);
// if (Num >= 1000 && Num <= 99999)
// InWords += NumWords(Num / 1000) + " Thousand " + NumWords(Num % 1000);
// if (Num >= 100000 && Num <= 9999999)
// InWords += NumWords(Num / 100000) + " Lac " + NumWords(Num % 100000);
// if (Num >= 10000000)
// InWords += NumWords(Num / 10000000) + " Crore " + NumWords(Num % 10000000);
// return InWords;
// }
// public void ShowBankDisbursmentReport()
// {
// fReportViewer form = new fReportViewer();
// DateTime salaryMonth = _selectedParameter.FromDate.Value;
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// int count = 1;
// DataRow oDR = null;
// Bank oBank;
// if (_selectedParameter.Banks.Count > 0)
// oBank = _selectedParameter.Banks[0];
// else throw new ServiceException("please select a bank");
// DataSet oEmpBankAcc = EmployeeBankAccount.GetEmpBankAdvice(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID);
// PayrollDataSet.dsCompany.BankAdviceDataTable bankAdvice = new Payroll.Report.PayrollDataSet.dsCompany.BankAdviceDataTable();
// double nTotal = 0.0;
// foreach (DataRow oDRow in oEmpBankAcc.Tables[0].Rows)
// {
// oDR = bankAdvice.NewRow();
// oDR["EmpNo"] = oDRow["EMPLOYEENO"];
// oDR["EmpName"] = oDRow["NAME"];
// oDR["AccountNo"] = oDRow["ACCOUNTNO"];
// oDR["Amount"] = Math.Round(Convert.ToDouble(oDRow["CHANGEDAMOUNT"]));
// oDR["Email"] = oDRow["EMAILADDRESS"];
// oDR["SalaryMonth"] = salaryMonth;
// oDR["SLNo"] = count;
// oDR["CostCenter"] = oDRow["CostCenter"].ToString();
// bankAdvice.Rows.Add(oDR);
// nTotal += Convert.ToDouble(oDR["Amount"]);
// count++;
// }
// form.ShowDlgForBankDisbursment(_selectedParameter.ReportItem, bankAdvice);
// }
// }
//}