86 lines
4.0 KiB
C#
86 lines
4.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using HRM.BO;
|
|
using HRM.DA;
|
|
using Microsoft.Reporting.NETCore;
|
|
|
|
namespace HRM.Report
|
|
{
|
|
/// <summary>
|
|
/// LFA Bank Advice (EnumReportType.LFABankAdvice, /payroll-lfa/lfa-bank-advice): the employees of one
|
|
/// approved LFA payment batch with their bank account and LFA amount, rendered with LFABankAdvice.rdlc.
|
|
/// </summary>
|
|
public class rptLFABankAdvice
|
|
{
|
|
private const string RdlcName = "HRM.Report.RDLC.LFABankAdvice.rdlc";
|
|
private const string DataSetName = "dsLFABankAdvice";
|
|
|
|
public byte[] ShowLFABankAdvice(int lfaPaymentID, string sEmpIDs, int bankID, int payrollTypeId, string reportType)
|
|
{
|
|
if (lfaPaymentID <= 0)
|
|
throw new Exception("Select an LFA payment batch.");
|
|
|
|
DataSet oSource = new LFAPaymentService().GetBankAdvice(lfaPaymentID, sEmpIDs, bankID, payrollTypeId);
|
|
if (oSource == null || oSource.Tables.Count == 0 || oSource.Tables[0].Rows.Count == 0)
|
|
throw new Exception("No employee of the selected batch has an LFA amount to pay for this selection.");
|
|
|
|
DataTable bankAdvice = new DataTable(DataSetName);
|
|
bankAdvice.Columns.Add("SLNo", typeof(int));
|
|
bankAdvice.Columns.Add("EmpNo", typeof(string));
|
|
bankAdvice.Columns.Add("EmpName", typeof(string));
|
|
bankAdvice.Columns.Add("Designation", typeof(string));
|
|
bankAdvice.Columns.Add("Department", typeof(string));
|
|
bankAdvice.Columns.Add("CostCenter", typeof(string));
|
|
bankAdvice.Columns.Add("AccountNo", typeof(string));
|
|
bankAdvice.Columns.Add("Bank", typeof(string));
|
|
bankAdvice.Columns.Add("Branch", typeof(string));
|
|
bankAdvice.Columns.Add("RoutingNo", typeof(string));
|
|
bankAdvice.Columns.Add("Email", typeof(string));
|
|
bankAdvice.Columns.Add("Amount", typeof(double));
|
|
|
|
string batchNumber = string.Empty;
|
|
DateTime paymentDate = DateTime.Today;
|
|
DateTime lfaYear = DateTime.Today;
|
|
int count = 1;
|
|
foreach (DataRow oDRow in oSource.Tables[0].Rows)
|
|
{
|
|
DataRow oDR = bankAdvice.NewRow();
|
|
oDR["SLNo"] = count;
|
|
oDR["EmpNo"] = Convert.ToString(oDRow["EMPLOYEENO"]);
|
|
oDR["EmpName"] = Convert.ToString(oDRow["NAME"]);
|
|
oDR["Designation"] = Convert.ToString(oDRow["DesignationName"]);
|
|
oDR["Department"] = Convert.ToString(oDRow["DepartmentName"]);
|
|
oDR["CostCenter"] = Convert.ToString(oDRow["CostCenter"]);
|
|
oDR["AccountNo"] = Convert.ToString(oDRow["AccountNo"]);
|
|
oDR["Bank"] = Convert.ToString(oDRow["BankName"]);
|
|
oDR["Branch"] = Convert.ToString(oDRow["BranchName"]);
|
|
oDR["RoutingNo"] = Convert.ToString(oDRow["RoutingNo"]);
|
|
oDR["Email"] = Convert.ToString(oDRow["EMAILADDRESS"]);
|
|
oDR["Amount"] = Math.Round(Convert.ToDouble(oDRow["Amount"]));
|
|
bankAdvice.Rows.Add(oDR);
|
|
|
|
if (count == 1)
|
|
{
|
|
batchNumber = Convert.ToString(oDRow["BatchNumber"]);
|
|
paymentDate = Convert.ToDateTime(oDRow["PaymentDate"]);
|
|
lfaYear = Convert.ToDateTime(oDRow["LFAYear"]);
|
|
}
|
|
count++;
|
|
}
|
|
|
|
DataSet dSet = new DataSet();
|
|
dSet.Tables.Add(bankAdvice);
|
|
|
|
List<ReportParameter> parameters = new List<ReportParameter>
|
|
{
|
|
new ReportParameter("BatchNumber", batchNumber),
|
|
new ReportParameter("PaymentDate", paymentDate.ToString("dd MMM yyyy")),
|
|
new ReportParameter("LFAYear", lfaYear.Year.ToString())
|
|
};
|
|
|
|
return new ReportProcessor().CommonReportView(null, RdlcName, dSet, null, parameters, true, payrollTypeId, reportType);
|
|
}
|
|
}
|
|
}
|