EchoTex_Payroll/HRM.Report/Class/rptLoanApplication.cs

65 lines
2.6 KiB
C#
Raw Permalink Normal View History

2024-10-14 10:01:49 +06:00
using HRM.BO;
using HRM.DA;
using HRM.DA.Fund;
using HRM.Report.FundEssDataSet;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HRM.Report
{
public class rptLoanApplication
{
public byte[] GetLoanApplicationdata(dynamic data, string reportType, int payrollTypeId)
{
DataRow dRow = null;
DataSet loanApplicationData = null;
DataSet resultDataSet = new DataSet();
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
int employeeId = (int)items["employeeid"].ToObject<int>();
loanApplicationData = new LoanApplicationService().GetLoanApplicationData(employeeId);
Employee employee = new EmployeeService().Get(employeeId);
int MemberID = 0;
FundEssDataSet.FundEssDataSet.LoanApplicationDataTable dTloanApplicationDataTable = new FundEssDataSet.FundEssDataSet.LoanApplicationDataTable();
foreach (DataRow oDRow in loanApplicationData.Tables[0].Rows)
{
dRow = dTloanApplicationDataTable.NewRow();
dRow["LoanAppNo"] = oDRow["LOANAPPNO"];
MemberID = Convert.ToInt32(oDRow["MEMBERID"]);
Member member = new MemberService().Get(MemberID);
dRow["Member"] = "[" + member.EmpCode + "] " + member.Name;
dRow["EmpDept"] = employee.Department;
dRow["EmployeeCode"] = employee.EmployeeNo;
dRow["EmployeeName"] = employee.Name;
dRow["LoanAmount"] = items["LoanAmount"];
dRow["NoOfInstallment"] = items["NoOfInstallments"];
dRow["InstallmentAmount"] = items["InstallmentAmount"];
dRow["LoanAmountInWords"] = items["LoanAmountInWords"];
dRow["Principal"] = oDRow["PRINCIPAL"].ToString();
dRow["Interest"] = oDRow["INTEREST"];
//dRow["Interest"] = oDRow["INTEREST"].ToString();
dRow["Purpose"] = items["PurposeID"];
dTloanApplicationDataTable.Rows.Add(dRow);
}
dTloanApplicationDataTable.TableName = "FundEssDataSet_LoanApplication";
resultDataSet.Tables.Add(dTloanApplicationDataTable);
string RDLCName = "HRM.Report.RDLC.LoanApplication.rdlc";
ReportProcessor reportProcessor = new ReportProcessor();
return reportProcessor.CommonReportView(null, RDLCName, resultDataSet, null, null, true, 1, reportType);
//return null;
}
}
}