566 lines
27 KiB
C#
566 lines
27 KiB
C#
|
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.Model;
|
|||
|
|
|||
|
namespace Payroll.Report
|
|||
|
{
|
|||
|
public class LoanReport
|
|||
|
{
|
|||
|
private ReportSetup _selectedParameter;
|
|||
|
private LoanIssue _LoanIssue = null;
|
|||
|
private LoanParameter _LoanParameter = null;
|
|||
|
ReportItem _item = null;
|
|||
|
DataSet dSet = null;
|
|||
|
string RDLC = string.Empty;
|
|||
|
|
|||
|
public ReportSetup SelectedParameter
|
|||
|
{
|
|||
|
set
|
|||
|
{
|
|||
|
_selectedParameter = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public LoanReport()
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
public DataTable GetLoanPaymentDue(DateTime dFromDate,DateTime dToDate)
|
|||
|
{
|
|||
|
|
|||
|
DataRow oDR = null;
|
|||
|
DataSet oLaonPayments = null;
|
|||
|
oLaonPayments = LoanSchedule.GetLoanPaymentDue(dFromDate, dToDate);
|
|||
|
PayrollDataSet.PayrollDataSet.LaonPaymentDueDataTable dTable = new Payroll.Report.PayrollDataSet.PayrollDataSet.LaonPaymentDueDataTable();
|
|||
|
foreach (DataRow oDRow in oLaonPayments.Tables[0].Rows)
|
|||
|
{
|
|||
|
oDR = dTable.NewRow();
|
|||
|
oDR["EmpNo"] = oDRow["EmployeeNo"];
|
|||
|
oDR["EmpName"] = oDRow["Name"];
|
|||
|
oDR["Loan"] = oDRow["Description"];
|
|||
|
oDR["LoanAmount"] = oDRow["LoanAmount"];
|
|||
|
oDR["InstalmentAmount"] = oDRow["InstallmentPrincipal"];
|
|||
|
oDR["InstallInterest"] = oDRow["InstallmentInterest"];
|
|||
|
oDR["TotalAmount"] = Convert.ToDouble(oDRow["InstallmentPrincipal"]) + Convert.ToDouble(oDRow["InstallmentInterest"]);
|
|||
|
oDR["Balance"] = oDRow["ClosingBalance"];
|
|||
|
dTable.Rows.Add(oDR);
|
|||
|
}
|
|||
|
|
|||
|
return dTable;
|
|||
|
}
|
|||
|
public DataTable GetLaonIssue(LoanIssue oLoanIssue)
|
|||
|
{
|
|||
|
DataRow oDR = null;
|
|||
|
PayrollDataSet.PayrollDataSet.LoanIssueDataTable dTable = new Payroll.Report.PayrollDataSet.PayrollDataSet.LoanIssueDataTable();
|
|||
|
#region Old Code
|
|||
|
|
|||
|
|
|||
|
//foreach(LoanSchedule oLSchedule in oLoanIssue.Schedules)
|
|||
|
//{
|
|||
|
// oDR = dTable.NewRow();
|
|||
|
// oDR["Month"] = oLSchedule.DueInstallmentDate.ToString("MMMM-yyyy");
|
|||
|
// oDR["OpeningBalance"] = GlobalFunctions.Round(Convert.ToDouble(oLSchedule.OpeningBalance));
|
|||
|
// oDR["Interest"] = GlobalFunctions.Round(Convert.ToDouble(oLSchedule.InstallmentInterest));
|
|||
|
// oDR["Installment"] =GlobalFunctions.Round(Convert.ToDouble(oLSchedule.Installment));
|
|||
|
// oDR["ClosingBalance"] =GlobalFunctions.Round(Convert.ToDouble(oLSchedule.ClosingBalance));
|
|||
|
// oDR["Principal"] = GlobalFunctions.Round(Convert.ToDouble(oLSchedule.InstallmentPrincipal));
|
|||
|
// if (oLSchedule.PaymentDate != null) //oLSchedule.PaymentDate != DateTime.MinValue
|
|||
|
// {
|
|||
|
// oDR["Status"] = "Paid";
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// oDR["Status"] = "Not Paid";
|
|||
|
// }
|
|||
|
// dTable.Rows.Add(oDR);
|
|||
|
//}
|
|||
|
#endregion
|
|||
|
foreach (LoanSchedule oLSchedule in oLoanIssue.Schedules)
|
|||
|
{
|
|||
|
oDR = dTable.NewRow();
|
|||
|
oDR["Month"] = oLSchedule.DueInstallmentDate.ToString("25-MMM-yyyy");
|
|||
|
if(oLSchedule.OpeningBalance<0)
|
|||
|
oDR["Balance"] = Convert.ToDouble(0.0);
|
|||
|
else
|
|||
|
oDR["Balance"] = Convert.ToDouble(oLSchedule.OpeningBalance);
|
|||
|
|
|||
|
oDR["Interest1"] = GlobalFunctions.Round(Convert.ToDouble(oLSchedule.ActualInterest));
|
|||
|
oDR["Interest2"] = GlobalFunctions.Round(Convert.ToDouble(oLSchedule.InstallmentInterest));
|
|||
|
oDR["Days"] = oLSchedule.Days;
|
|||
|
oDR["Installment"] = GlobalFunctions.Round(Convert.ToDouble(oLSchedule.Installment));
|
|||
|
if (oLSchedule.ClosingBalance<0)
|
|||
|
oDR["ClosingBalance"] = GlobalFunctions.Round(Convert.ToDouble(0.0));
|
|||
|
else
|
|||
|
oDR["ClosingBalance"] = GlobalFunctions.Round(Convert.ToDouble(oLSchedule.ClosingBalance));
|
|||
|
|
|||
|
oDR["Principal"] = GlobalFunctions.Round(Convert.ToDouble(oLSchedule.InstallmentPrincipal));
|
|||
|
|
|||
|
oDR["Deduct"] = Convert.ToDouble(oLSchedule.InstallmentPrincipal+oLSchedule.InstallmentInterest);
|
|||
|
if (oLSchedule.PaymentDate != null) //oLSchedule.PaymentDate != DateTime.MinValue
|
|||
|
{
|
|||
|
oDR["Status"] = " Paid";
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oDR["Status"] = " Not Paid";
|
|||
|
}
|
|||
|
dTable.Rows.Add(oDR);
|
|||
|
}
|
|||
|
return dTable;
|
|||
|
}
|
|||
|
|
|||
|
//public DataTable GetSharedLaonIssue(LoanIssue oLoanIssue)
|
|||
|
//{
|
|||
|
// DataRow oDR = null;
|
|||
|
// double dCmpPercent = 0;
|
|||
|
// double dCmpPayment = 0;
|
|||
|
// PayrollDataSet.PayrollDataSet.SharedLoanIssueDataTable dTable = new Payroll.Report.PayrollDataSet.PayrollDataSet.SharedLoanIssueDataTable();
|
|||
|
// foreach (LoanSchedule oLSchedule in oLoanIssue.Schedules)
|
|||
|
// {
|
|||
|
// oDR = dTable.NewRow();
|
|||
|
// oDR["InstallmentNo"] = oLSchedule.ScheduleNo;
|
|||
|
// oDR["Month"] = oLSchedule.DueInstallmentDate.ToString("MMMM-yyyy");
|
|||
|
// oDR["OpeningBalance"] = GlobalFunctions.Round(Convert.ToDouble(oLSchedule.OpeningBalance));
|
|||
|
// oDR["Interest"] = GlobalFunctions.Round(Convert.ToDouble(oLSchedule.InstallmentInterest));
|
|||
|
// oDR["Installment"] = GlobalFunctions.Round(Convert.ToDouble(oLSchedule.Installment));
|
|||
|
// oDR["ClosingBalance"] = GlobalFunctions.Round(Convert.ToDouble(oLSchedule.ClosingBalance));
|
|||
|
// oDR["Principal"] = GlobalFunctions.Round(Convert.ToDouble(oLSchedule.InstallmentPrincipal));
|
|||
|
// if (oLSchedule.PaymentDate != null) //oLSchedule.PaymentDate != DateTime.MinValue
|
|||
|
// {
|
|||
|
// oDR["Status"] = "Paid";
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// oDR["Status"] = "Not Paid";
|
|||
|
// }
|
|||
|
// dCmpPercent = GetCmpPercntFromParameter(oLSchedule.ScheduleNo);
|
|||
|
// dCmpPayment = (oLoanIssue.LoanAmount*(dCmpPercent/100.00));
|
|||
|
// oDR["CmpPercent"] = GlobalFunctions.Round(dCmpPercent);
|
|||
|
// oDR["CmpPayment"] = GlobalFunctions.Round(dCmpPayment);
|
|||
|
// oDR["OutStanding"] = GlobalFunctions.Round(oLSchedule.ClosingBalance - dCmpPayment);
|
|||
|
// dTable.Rows.Add(oDR);
|
|||
|
// }
|
|||
|
// return dTable;
|
|||
|
//}
|
|||
|
|
|||
|
//private double GetCmpPercntFromParameter(int monthNo)
|
|||
|
//{
|
|||
|
// double dCmpPercent = 0.0;
|
|||
|
// foreach (LoanParameterCmpDetail obj in _LoanParameter.LoanParameterCmpDetails)
|
|||
|
// {
|
|||
|
// if (monthNo < obj.SheduleMonthNo)
|
|||
|
// break;
|
|||
|
|
|||
|
// dCmpPercent = obj.BearPercent;
|
|||
|
|
|||
|
// }
|
|||
|
// if (monthNo >= _LoanParameter.MaxInstallmentMonth)
|
|||
|
// {
|
|||
|
// dCmpPercent = _LoanParameter.CmpSharePercent;
|
|||
|
// }
|
|||
|
|
|||
|
// return dCmpPercent;
|
|||
|
//}
|
|||
|
|
|||
|
public void LoanPaymentDue()
|
|||
|
{
|
|||
|
Loan oLoan = null;
|
|||
|
DataRow oDR = null;
|
|||
|
fReportViewer form = new fReportViewer();
|
|||
|
DateTime dSalaryMonth = _selectedParameter.FromDate.Value;
|
|||
|
string sEmpID = _selectedParameter.ReportItem.INSQL;
|
|||
|
ObjectsTemplate<LoanIssue> loanIssues = LoanIssue.GetByDueInstallmentDate(GlobalFunctions.LastDateOfMonth(dSalaryMonth));
|
|||
|
ObjectsTemplate<Loan> Loans=Loan.Get(EnumStatus.Regardless);
|
|||
|
PayrollDataSet.PayrollDataSet.LaonPaymentDueDataTable dTable = new Payroll.Report.PayrollDataSet.PayrollDataSet.LaonPaymentDueDataTable();
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (LoanIssue oLoanIssue in loanIssues)
|
|||
|
{
|
|||
|
if (_selectedParameter.IsEmployeeExist(oLoanIssue.EmployeeID) == false) continue;
|
|||
|
ObjectsTemplate<LoanSchedule> oschedules = oLoanIssue.MonthlySchedules(GlobalFunctions.LastDateOfMonth(dSalaryMonth));
|
|||
|
foreach (LoanSchedule oLSchedule in oschedules)
|
|||
|
{
|
|||
|
oLoan = Loans.GetItem(oLoanIssue.LoanID);
|
|||
|
if(oLoan!=null)
|
|||
|
{
|
|||
|
if (oLSchedule.ScheduleNo == 1)
|
|||
|
{
|
|||
|
oDR = dTable.NewRow();
|
|||
|
oDR["EmpNo"] = oLoanIssue.Employee.EmployeeNo;
|
|||
|
oDR["EmpName"] = oLoanIssue.Employee.Name;
|
|||
|
oDR["Loan"] = oLoan.Name;
|
|||
|
oDR["LoanNo"] = oLoanIssue.LoanNo;
|
|||
|
oDR["LoanAmount"] = oLoanIssue.LoanAmount;
|
|||
|
oDR["OpeningBalance"] = oLSchedule.OpeningBalance;
|
|||
|
oDR["InstalmentAmount"] = oLSchedule.InstallmentPrincipal;
|
|||
|
oDR["InstallInterest"] = oLSchedule.InstallmentInterest;
|
|||
|
|
|||
|
dTable.Rows.Add(oDR);
|
|||
|
}
|
|||
|
else if (oLoanIssue.NoOfInstallments == oLSchedule.ScheduleNo)
|
|||
|
{
|
|||
|
oDR = dTable.NewRow();
|
|||
|
oDR["EmpNo"] = oLoanIssue.Employee.EmployeeNo;
|
|||
|
oDR["EmpName"] = oLoanIssue.Employee.Name;
|
|||
|
oDR["Loan"] = oLoan.Name;
|
|||
|
oDR["LoanNo"] = oLoanIssue.LoanNo;
|
|||
|
oDR["LoanAmount"] = oLoanIssue.LoanAmount;
|
|||
|
oDR["OpeningBalance"] = oLSchedule.OpeningBalance;
|
|||
|
oDR["InstalmentAmount"] = oLSchedule.InstallmentPrincipal;
|
|||
|
oDR["InstallInterest"] = oLSchedule.InstallmentInterest;
|
|||
|
|
|||
|
dTable.Rows.Add(oDR);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oDR = dTable.NewRow();
|
|||
|
oDR["EmpNo"] = oLoanIssue.Employee.EmployeeNo;
|
|||
|
oDR["EmpName"] = oLoanIssue.Employee.Name;
|
|||
|
oDR["Loan"] = oLoan.Name;
|
|||
|
oDR["LoanNo"] = oLoanIssue.LoanNo;
|
|||
|
oDR["LoanAmount"] = oLoanIssue.LoanAmount;
|
|||
|
oDR["OpeningBalance"] = oLSchedule.OpeningBalance;
|
|||
|
oDR["InstalmentAmount"] = oLSchedule.InstallmentPrincipal;
|
|||
|
oDR["InstallInterest"] = oLSchedule.InstallmentInterest;
|
|||
|
|
|||
|
dTable.Rows.Add(oDR);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch(Exception ex)
|
|||
|
{
|
|||
|
throw new Exception(ex.Message);
|
|||
|
}
|
|||
|
string LoanMonth = dSalaryMonth.ToString("MMM yyyy");
|
|||
|
form.ShowDlgForLoanPaymentDue(_selectedParameter.ReportItem, dTable, LoanMonth);
|
|||
|
}
|
|||
|
|
|||
|
public void LoanPaymentDueNew()
|
|||
|
{
|
|||
|
Loan oLoan = null;
|
|||
|
DataRow oDR = null;
|
|||
|
fReportViewer form = new fReportViewer();
|
|||
|
DateTime dSalaryMonth = _selectedParameter.FromDate.Value;
|
|||
|
string sEmpID = _selectedParameter.ReportItem.INSQL;
|
|||
|
ObjectsTemplate<LoanIssue> loanIssues = LoanIssue.GetByDueInstallmentDate(GlobalFunctions.LastDateOfMonth(dSalaryMonth), sEmpID);
|
|||
|
ObjectsTemplate<Loan> Loans = Loan.Get(EnumStatus.Regardless);
|
|||
|
PayrollDataSet.PayrollDataSet.LaonPaymentDueDataTable dTable = new Payroll.Report.PayrollDataSet.PayrollDataSet.LaonPaymentDueDataTable();
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (LoanIssue oLoanIssue in loanIssues)
|
|||
|
{
|
|||
|
if (_selectedParameter.IsEmployeeExist(oLoanIssue.EmployeeID) == false) continue;
|
|||
|
ObjectsTemplate<LoanSchedule> oschedules = oLoanIssue.MonthlySchedules(GlobalFunctions.LastDateOfMonth(dSalaryMonth));
|
|||
|
foreach (LoanSchedule oLSchedule in oschedules)
|
|||
|
{
|
|||
|
oLoan = Loans.GetItem(oLoanIssue.LoanID);
|
|||
|
if (oLoan != null)
|
|||
|
{
|
|||
|
if (oLSchedule.ScheduleNo == 1)
|
|||
|
{
|
|||
|
oDR = dTable.NewRow();
|
|||
|
oDR["EmpNo"] = oLoanIssue.Employee.EmployeeNo;
|
|||
|
oDR["EmpName"] = oLoanIssue.Employee.Name;
|
|||
|
oDR["Loan"] = oLoan.Name;
|
|||
|
oDR["LoanNo"] = oLoanIssue.LoanNo;
|
|||
|
oDR["LoanAmount"] = oLoanIssue.LoanAmount;
|
|||
|
oDR["OpeningBalance"] = oLSchedule.OpeningBalance;
|
|||
|
oDR["InstalmentAmount"] = oLSchedule.InstallmentPrincipal;
|
|||
|
oDR["InstallInterest"] = oLSchedule.InstallmentInterest;
|
|||
|
|
|||
|
dTable.Rows.Add(oDR);
|
|||
|
}
|
|||
|
else if (oLoanIssue.NoOfInstallments == oLSchedule.ScheduleNo)
|
|||
|
{
|
|||
|
oDR = dTable.NewRow();
|
|||
|
oDR["EmpNo"] = oLoanIssue.Employee.EmployeeNo;
|
|||
|
oDR["EmpName"] = oLoanIssue.Employee.Name;
|
|||
|
oDR["Loan"] = oLoan.Name;
|
|||
|
oDR["LoanNo"] = oLoanIssue.LoanNo;
|
|||
|
oDR["LoanAmount"] = oLoanIssue.LoanAmount;
|
|||
|
oDR["OpeningBalance"] = oLSchedule.OpeningBalance;
|
|||
|
oDR["InstalmentAmount"] = oLSchedule.InstallmentPrincipal;
|
|||
|
oDR["InstallInterest"] = oLSchedule.InstallmentInterest;
|
|||
|
|
|||
|
dTable.Rows.Add(oDR);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oDR = dTable.NewRow();
|
|||
|
oDR["EmpNo"] = oLoanIssue.Employee.EmployeeNo;
|
|||
|
oDR["EmpName"] = oLoanIssue.Employee.Name;
|
|||
|
oDR["Loan"] = oLoan.Name;
|
|||
|
oDR["LoanNo"] = oLoanIssue.LoanNo;
|
|||
|
oDR["LoanAmount"] = oLoanIssue.LoanAmount;
|
|||
|
oDR["OpeningBalance"] = oLSchedule.OpeningBalance;
|
|||
|
oDR["InstalmentAmount"] = oLSchedule.InstallmentPrincipal;
|
|||
|
oDR["InstallInterest"] = oLSchedule.InstallmentInterest;
|
|||
|
|
|||
|
dTable.Rows.Add(oDR);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new Exception(ex.Message);
|
|||
|
}
|
|||
|
string LoanMonth = dSalaryMonth.ToString("MMM yyyy");
|
|||
|
form.ShowDlgForLoanPaymentDue(_selectedParameter.ReportItem, dTable, LoanMonth);
|
|||
|
}
|
|||
|
|
|||
|
public void IndivisualLoanReport()
|
|||
|
{
|
|||
|
int count = 1;
|
|||
|
Loan oLoan = null;
|
|||
|
DataRow oDR = null;
|
|||
|
fReportViewer form = new fReportViewer();
|
|||
|
DateTime dSalaryMonth = _selectedParameter.FromDate.Value;
|
|||
|
string empID = _selectedParameter.ReportItem.INSQL;
|
|||
|
//ObjectsTemplate<LoanIssue> loanIssues = LoanIssue.Get(GlobalFunctions.LastDateOfMonth(dSalaryMonth));
|
|||
|
ObjectsTemplate<LoanIssue> loanIssues = LoanIssue.Get(empID);
|
|||
|
ObjectsTemplate<Loan> Loans = Loan.Get(EnumStatus.Regardless);
|
|||
|
PayrollDataSet.PayrollDataSet.IndividualLoanReportDataTable dTable = new Payroll.Report.PayrollDataSet.PayrollDataSet.IndividualLoanReportDataTable();
|
|||
|
|
|||
|
foreach (LoanIssue oLoanIssue in loanIssues)
|
|||
|
{
|
|||
|
if (_selectedParameter.IsEmployeeExist(oLoanIssue.EmployeeID) == false) continue;
|
|||
|
ObjectsTemplate<LoanSchedule> oschedules = LoanSchedule.GetByIssueID(oLoanIssue.ID);
|
|||
|
foreach (LoanSchedule oLSchedule in oschedules)
|
|||
|
{
|
|||
|
oLoan = Loans.GetItem(oLoanIssue.LoanID);
|
|||
|
if (oLoan != null)
|
|||
|
{
|
|||
|
oDR = dTable.NewRow();
|
|||
|
oDR["SLNo"] = count;
|
|||
|
oDR["EmployeeID"] = oLoanIssue.Employee.EmployeeNo;
|
|||
|
oDR["EmpName"] = oLoanIssue.Employee.Name;
|
|||
|
oDR["LoanType"] = oLoan.Name;
|
|||
|
oDR["LoanNo"] = oLoanIssue.LoanNo;
|
|||
|
oDR["LoanAmount"] = oLoanIssue.LoanAmount;
|
|||
|
oDR["InterestRate"] = oLoanIssue.InterestRate;
|
|||
|
oDR["ScheduleInstallments"] = oLoanIssue.NoOfInstallments;
|
|||
|
//oDR["DisburseFrom"] = oLoanIssue.IssueDate;
|
|||
|
oDR["OpeningBalance"] = oLSchedule.OpeningBalance;
|
|||
|
oDR["PrincipleBalance"] = oLSchedule.InstallmentPrincipal;
|
|||
|
oDR["InstallmentAmount"] = oLSchedule.Installment;
|
|||
|
oDR["Interest"] = oLSchedule.InstallmentInterest;
|
|||
|
// oDR["TotalAmount"] = oLSchedule.Installment + oLSchedule.InstallmentInterest;
|
|||
|
oDR["ClosingBalance"] = oLSchedule.ClosingBalance;
|
|||
|
oDR["InstallmentsDue"] = oLoanIssue.NoOfInstallments - oLSchedule.ScheduleNo;
|
|||
|
oDR["Month"] = dSalaryMonth;
|
|||
|
dTable.Rows.Add(oDR);
|
|||
|
count++;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
form.ShowDlgForIndivisualLoanReport(_selectedParameter.ReportItem, dTable);
|
|||
|
}
|
|||
|
|
|||
|
public void individualLoanReportByLoan(ID empId, string loanNo)
|
|||
|
{
|
|||
|
Loan oLoan = null;
|
|||
|
DataRow oDR = null;
|
|||
|
int count = 1;
|
|||
|
fReportViewer form = new fReportViewer();
|
|||
|
ObjectsTemplate<LoanIssue> loanIssues = new ObjectsTemplate<LoanIssue>();
|
|||
|
ObjectsTemplate<LoanIssue> tloanIssues;
|
|||
|
tloanIssues = LoanIssue.Get();
|
|||
|
foreach (LoanIssue oLoanIssue in tloanIssues)
|
|||
|
{
|
|||
|
if ((oLoanIssue.EmployeeID == empId) && (oLoanIssue.LoanNo == loanNo))
|
|||
|
{
|
|||
|
loanIssues.Add(oLoanIssue);
|
|||
|
}
|
|||
|
}
|
|||
|
ObjectsTemplate<Loan> Loans = Loan.Get(EnumStatus.Regardless);
|
|||
|
PayrollDataSet.PayrollDataSet.IndividualLoanReportDataTable dTable = new Payroll.Report.PayrollDataSet.PayrollDataSet.IndividualLoanReportDataTable();
|
|||
|
|
|||
|
foreach (LoanIssue oLoanIssue in loanIssues)
|
|||
|
{
|
|||
|
ObjectsTemplate<LoanSchedule> oschedules = LoanSchedule.GetByIssueID(oLoanIssue.ID);
|
|||
|
foreach (LoanSchedule oLSchedule in oschedules)
|
|||
|
{
|
|||
|
oLoan = Loans.GetItem(oLoanIssue.LoanID);
|
|||
|
if (oLoan != null)
|
|||
|
{
|
|||
|
oDR = dTable.NewRow();
|
|||
|
oDR["SLNo"] = count;
|
|||
|
oDR["EmployeeID"] = oLoanIssue.Employee.EmployeeNo;
|
|||
|
oDR["EmpName"] = oLoanIssue.Employee.Name;
|
|||
|
oDR["LoanType"] = oLoan.Name;
|
|||
|
oDR["LoanNo"] = oLoanIssue.LoanNo;
|
|||
|
oDR["LoanAmount"] = oLoanIssue.LoanAmount;
|
|||
|
oDR["InterestRate"] = oLoanIssue.InterestRate;
|
|||
|
oDR["ScheduleInstallments"] = oLoanIssue.NoOfInstallments;
|
|||
|
//oDR["DisburseFrom"] = oLoanIssue.IssueDate;
|
|||
|
oDR["OpeningBalance"] = oLSchedule.OpeningBalance;
|
|||
|
oDR["PrincipleBalance"] = oLSchedule.InstallmentPrincipal;
|
|||
|
oDR["InstallmentAmount"] = oLSchedule.Installment;
|
|||
|
oDR["Interest"] = oLSchedule.InstallmentInterest;
|
|||
|
// oDR["TotalAmount"] = oLSchedule.Installment + oLSchedule.InstallmentInterest;
|
|||
|
oDR["ClosingBalance"] = oLSchedule.ClosingBalance;
|
|||
|
oDR["InstallmentsDue"] = oLoanIssue.NoOfInstallments - oLSchedule.ScheduleNo;
|
|||
|
oDR["Month"] = oLoanIssue.IssueDate;
|
|||
|
dTable.Rows.Add(oDR);
|
|||
|
count++;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
//form.ShowDlgForindividualLoanReportByLoan;
|
|||
|
form.ShowDlgForindividualLoanReportByLoan(dTable);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public void LatestIndividualLoanReport(LoanIssue oLoanIssues, Employee oEmp, string sLoanName)
|
|||
|
{
|
|||
|
_LoanIssue = oLoanIssues;
|
|||
|
ObjectsTemplate<EmployeeCostCenter> oEmpCCs = EmployeeCostCenter.GetByEmpID(oEmp.ID);
|
|||
|
|
|||
|
if (_LoanIssue != null && _LoanIssue.Schedules.Count > 0)
|
|||
|
{
|
|||
|
DataTable oDTable = null;
|
|||
|
dSet = new DataSet();
|
|||
|
LoanReport oLoanReport = new LoanReport();
|
|||
|
oDTable = oLoanReport.GetLaonIssue(_LoanIssue);
|
|||
|
fReportViewer form = new fReportViewer();
|
|||
|
_item = ReportItem.GetByReportType(Convert.ToInt32(EnumReportType.LoanIssue));
|
|||
|
oDTable.TableName = "PayrollDataSet_LoanIssue";
|
|||
|
RDLC = "Payroll.Report.RDLC.LoanIssue.rdlc";
|
|||
|
dSet.Tables.Add(oDTable);
|
|||
|
double LoanAmount;
|
|||
|
double InterestRate;
|
|||
|
int noOfInstallment;
|
|||
|
string LoanName;
|
|||
|
string sDesignation;
|
|||
|
string sRC = "";
|
|||
|
string sDepartment;
|
|||
|
string sLocation;
|
|||
|
DateTime IssueDate;
|
|||
|
DateTime dFromDate;
|
|||
|
DateTime dToDate;
|
|||
|
InterestRate = _LoanIssue.InterestRate;
|
|||
|
IssueDate = _LoanIssue.IssueDate != DateTime.MinValue ? _LoanIssue.IssueDate : DateTime.Now;
|
|||
|
LoanAmount = _LoanIssue.LoanAmount;
|
|||
|
noOfInstallment = _LoanIssue.NoOfInstallments;
|
|||
|
LoanName = sLoanName;
|
|||
|
dFromDate = _LoanIssue.Schedules[0].DueInstallmentDate;
|
|||
|
dToDate = _LoanIssue.Schedules[_LoanIssue.Schedules.Count - 1].DueInstallmentDate;
|
|||
|
if (oEmp.Designation != null)
|
|||
|
sDesignation = oEmp.DescriptionText;
|
|||
|
else
|
|||
|
sDesignation = "";
|
|||
|
if (oEmp.Department != null)
|
|||
|
sDepartment = oEmp.Department.Name;
|
|||
|
else
|
|||
|
sDepartment = "";
|
|||
|
if (oEmp.Location != null)
|
|||
|
sLocation = oEmp.Location.Name;
|
|||
|
else
|
|||
|
sLocation = "";
|
|||
|
|
|||
|
foreach (EmployeeCostCenter oEmpCC in oEmpCCs)
|
|||
|
{
|
|||
|
if (sRC == string.Empty)
|
|||
|
{
|
|||
|
sRC = oEmpCC.Costcenter.Name;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
sRC = "," + oEmpCC.Costcenter.Name;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
form.ShowDlgForLoanIssue(_item, dSet, RDLC, oEmp.Name, oEmp.EmployeeNo, LoanAmount, InterestRate, noOfInstallment, dFromDate, dToDate, LoanName, _LoanIssue.IssueDate);
|
|||
|
// form.ShowDlgForNovartisLoanIssue(_item, dSet, RDLC, oEmp.Name, oEmp.EmployeeNo, LoanAmount, InterestRate, noOfInstallment, dFromDate, dToDate, LoanName, sDesignation, sRC, sDepartment, sLocation);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
//public void IndividualSharedLoanReport(LoanIssue oLoanIssues, Employee oEmp, string sLoanName, LoanParameter oloanParameter)
|
|||
|
//{
|
|||
|
// _LoanIssue = oLoanIssues;
|
|||
|
// _LoanParameter = oloanParameter;
|
|||
|
// ObjectsTemplate<EmployeeCostCenter> oEmpCCs = EmployeeCostCenter.GetByEmpID(oEmp.ID);
|
|||
|
|
|||
|
// if (_LoanIssue != null && _LoanIssue.Schedules.Count > 0)
|
|||
|
// {
|
|||
|
// DataTable oDTable = null;
|
|||
|
// dSet = new DataSet();
|
|||
|
// oDTable = GetSharedLaonIssue(oLoanIssues);
|
|||
|
// fReportViewer form = new fReportViewer();
|
|||
|
// _item = ReportItem.GetByReportType(Convert.ToInt32(EnumReportType.LoanIssue));
|
|||
|
// oDTable.TableName = "PayrollDataSet_SharedLoanIssue";
|
|||
|
// RDLC = "Payroll.Report.RDLC.LoanSharedIssue.rdlc";
|
|||
|
// dSet.Tables.Add(oDTable);
|
|||
|
// double LoanAmount;
|
|||
|
// double InterestRate;
|
|||
|
// double MaxCmpPayPercent;//new
|
|||
|
// double ResiduePercent;//new
|
|||
|
// double PMTValue;//new
|
|||
|
// int noOfInstallment;
|
|||
|
// string LoanName;
|
|||
|
// string sDesignation;
|
|||
|
// string sRC = "";
|
|||
|
// string sDepartment;
|
|||
|
// string sLocation;
|
|||
|
// DateTime IssueDate;
|
|||
|
// DateTime dFromDate;
|
|||
|
// DateTime dToDate;
|
|||
|
// InterestRate = _LoanIssue.InterestRate;
|
|||
|
// IssueDate = _LoanIssue.IssueDate != DateTime.MinValue ? _LoanIssue.IssueDate : DateTime.Now;
|
|||
|
// LoanAmount = _LoanIssue.LoanAmount;
|
|||
|
// MaxCmpPayPercent = _LoanParameter.CmpSharePercent;
|
|||
|
// ResiduePercent = _LoanParameter.CmpShareIntPercent;
|
|||
|
// PMTValue = _LoanIssue.Schedules[0].InstallmentPrincipal;
|
|||
|
// noOfInstallment = _LoanIssue.NoOfInstallments;
|
|||
|
// LoanName = sLoanName;
|
|||
|
// dFromDate = _LoanIssue.Schedules[0].DueInstallmentDate;
|
|||
|
// dToDate = _LoanIssue.Schedules[_LoanIssue.Schedules.Count - 1].DueInstallmentDate;
|
|||
|
// if (oEmp.Designation != null)
|
|||
|
// sDesignation = oEmp.Designation.Name;
|
|||
|
// else
|
|||
|
// sDesignation = "";
|
|||
|
// if (oEmp.Department != null)
|
|||
|
// sDepartment = oEmp.Department.Name;
|
|||
|
// else
|
|||
|
// sDepartment = "";
|
|||
|
// if (oEmp.Location != null)
|
|||
|
// sLocation = oEmp.Location.Name;
|
|||
|
// else
|
|||
|
// sLocation = "";
|
|||
|
|
|||
|
// foreach (EmployeeCostCenter oEmpCC in oEmpCCs)
|
|||
|
// {
|
|||
|
// if (sRC == string.Empty)
|
|||
|
// {
|
|||
|
// sRC = oEmpCC.Costcenter.Name;
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// sRC = "," + oEmpCC.Costcenter.Name;
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
// form.ShowDlgForSharedLoanIssue(_item, dSet, RDLC, oEmp.Name, oEmp.EmployeeNo, LoanAmount, InterestRate, noOfInstallment, dFromDate, dToDate, LoanName, _LoanIssue.Schedules[0].LoanIssue.IssueDate,MaxCmpPayPercent,ResiduePercent,PMTValue);
|
|||
|
// // form.ShowDlgForNovartisLoanIssue(_item, dSet, RDLC, oEmp.Name, oEmp.EmployeeNo, LoanAmount, InterestRate, noOfInstallment, dFromDate, dToDate, LoanName, sDesignation, sRC, sDepartment, sLocation);
|
|||
|
// }
|
|||
|
//}
|
|||
|
|
|||
|
}
|
|||
|
}
|