CEL_Payroll/Payroll.Report/Class/rptPF.cs

299 lines
12 KiB
C#
Raw Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Payroll.BO;
using Ease.CoreV35;
using Ease.CoreV35.Model;
using Microsoft.Reporting.WinForms;
namespace Payroll.Report
{
public class rptPF
{
private ReportSetup _selectedParameter;
private DateTime _SalaryMonth;
string tempEmpID = string.Empty;
int count = 1;
private int TotalEmp = 0;
DataSet _currentSMonthly = null;
DataSet _prvSMonthly = null;
double balance = 0.00;
public ReportSetup SelectedParameter
{
set
{
_selectedParameter = value;
}
}
public rptPF()
{
}
internal void GetPFLedger(string sEmpID, DateTime FromDate, DateTime toDate, string sEmpName,string sEmpNo)
{
fReportViewer form = new fReportViewer();
DataRow oDR = null;
DataSet oPFLedger = null;
double opening = 0.00;
oPFLedger = MiscellaneousDataset.GetPFLedger(sEmpID, FromDate, toDate);
PayrollDataSet.PayrollDataSet.PFLedgerDataTable dTPFLedger = new Payroll.Report.PayrollDataSet.PayrollDataSet.PFLedgerDataTable();
foreach (DataRow source in oPFLedger.Tables[0].Rows)
{
oDR = dTPFLedger.NewRow();
oDR["Description"] = source["Description"];
oDR["OpeningBalance"] = source["PFAmount"];
opening = Convert.ToDouble(oDR["OpeningBalance"]);
balance = Convert.ToDouble(oDR["OpeningBalance"]) + Convert.ToDouble(oDR["OpeningBalance"]);
oDR["TotalBalance"] = balance;
source["PFAmount"] = source["PFAmount"];
source["CPFAmount"] = source["CPFAmount"];
dTPFLedger.Rows.Add(oDR);
}
foreach (DataRow source in oPFLedger.Tables[1].Rows)
{
oDR = dTPFLedger.NewRow();
this.CopyInd(oDR, source);
dTPFLedger.Rows.Add(oDR);
}
dTPFLedger.Rows.RemoveAt(0);
form.ShowPFLedger(dTPFLedger, sEmpID, FromDate, toDate, sEmpName, sEmpNo, opening);
}
public void CopyInd(DataRow source, DataRow destination)
{
DateTime date = Convert.ToDateTime(destination["Description"]);
source["Description"] = date.ToString("MMMM,yyyy");
source["PFAmount"] = destination["PFAmount"];
source["CPFAmount"] = destination["CPFAmount"];
balance = balance + Convert.ToDouble(source["PFAmount"])+ Convert.ToDouble(source["CPFAmount"]);
source["TotalBalance"] = balance;
}
internal void PrepareProvidentFundReport(DateTime dateTime, string sUnitID)
{
fReportViewer form = new fReportViewer();
DataRow oDR = null;
DataSet dsPF = null;
dsPF = MiscellaneousDataset.GetEmployeesPF(dateTime, sUnitID);
PayrollDataSet.dsCompany.DTProvidentFundDataTable dtProvident = new Payroll.Report.PayrollDataSet.dsCompany.DTProvidentFundDataTable();
if(dsPF.Tables.Count > 0)
{
foreach (DataRow orow in dsPF.Tables[0].Rows)
{
oDR = dtProvident.NewRow();
oDR["Unit"] = orow["Unit"].ToString();
oDR["Department"] = orow["Department"].ToString();
oDR["CompanyContri"] = Convert.ToDouble(orow["CPF"].ToString());
oDR["EmpContri"] = Convert.ToDouble(orow["EPF"].ToString());
oDR["PFLoan"] = Convert.ToDouble(orow["PFLoan"].ToString());
oDR["LoanInterest"] = Convert.ToDouble(orow["PFLoanInterest"].ToString());
dtProvident.Rows.Add(oDR);
}
if(dtProvident.Rows.Count > 0)
{
form.ShowPFTransactionReport(dtProvident,dateTime);
}
}
}
internal void MonthlyPFReport(DateTime dateTime)
{
fReportViewer form = new fReportViewer();
DataRow oDR = null;
DataSet dsPF = null;
dsPF = MiscellaneousDataset.GetEmployeesPF(dateTime);
PayrollDataSet.dsCompany.DTMonthlyPFDataTable dtMonthlyPF = new Payroll.Report.PayrollDataSet.dsCompany.DTMonthlyPFDataTable();
if(dsPF.Tables.Count > 0)
{
foreach (DataRow orr in dsPF.Tables[0].Rows)
{
oDR = dtMonthlyPF.NewRow();
oDR["EmployeeNo"] = orr["EmployeeNo"].ToString();
oDR["Name"] = orr["Name"].ToString();
DateTime dtJoin = Convert.ToDateTime(orr["JOININGDATE"].ToString());
oDR["Doj"] = dtJoin.ToString("dd MMM yyyy");
oDR["Designation"] = orr["Designation"].ToString();
oDR["Department"] = orr["Department"].ToString();
oDR["CostCenter"] = orr["CostCenter"].ToString();
oDR["TotalGross"] = Convert.ToDouble(orr["TotalGross"].ToString());
oDR["CPF"] = Convert.ToDouble(orr["CPF"].ToString());
oDR["EPF"] = Convert.ToDouble(orr["EPF"].ToString());
if (Convert.ToDouble(orr["EPF"].ToString()) == 0 && Convert.ToDouble(orr["CPF"].ToString()) == 0)
{
continue;
}
dtMonthlyPF.Rows.Add(oDR);
}
if (dtMonthlyPF.Rows.Count > 0)
{
form.ShowMonthlyPFReport(dateTime, dtMonthlyPF);
}
}
}
internal void NewMonthlyPFReport(DateTime dtFirstdate, DateTime dtLastdate)
{
fReportViewer form = new fReportViewer();
DataRow oDR = null;
DataSet dsPF = null;
dsPF = MiscellaneousDataset.GetEmployeesPF(dtFirstdate, dtLastdate);
PayrollDataSet.dsCompany.DTMonthlyPFDataTable dtMonthlyPF = new Payroll.Report.PayrollDataSet.dsCompany.DTMonthlyPFDataTable();
if (dsPF.Tables.Count > 0)
{
foreach (DataRow orr in dsPF.Tables[0].Rows)
{
oDR = dtMonthlyPF.NewRow();
oDR["EmployeeNo"] = orr["EmployeeNo"].ToString();
oDR["Name"] = orr["Name"].ToString();
DateTime dtJoin = Convert.ToDateTime(orr["JOININGDATE"].ToString());
oDR["Doj"] = dtJoin.ToString("dd MMM yyyy");
oDR["Designation"] = orr["Designation"].ToString();
oDR["Department"] = orr["Department"].ToString();
oDR["CostCenter"] = orr["CostCenter"].ToString();
oDR["TotalGross"] = Convert.ToDouble(orr["TotalGross"].ToString());
oDR["CPF"] = Convert.ToDouble(orr["CPF"].ToString());
oDR["EPF"] = Convert.ToDouble(orr["EPF"].ToString());
dtMonthlyPF.Rows.Add(oDR);
}
if (dtMonthlyPF.Rows.Count > 0)
{
form.ShowMonthlyPFReport(dtFirstdate, dtMonthlyPF);
}
}
}
public void PrepareDataForExceptionPFEmployee(DateTime fromdate, DateTime todate)
{
fReportViewer form = new fReportViewer();
DataRow oDR = null;
DataSet dsPF = null;
dsPF = MiscellaneousDataset.GetExceptionEmployeesPF(fromdate, todate);
PayrollDataSet.dsCompany.PFExceptionDataTable dtExceptionPF = new Payroll.Report.PayrollDataSet.dsCompany.PFExceptionDataTable();
if (dsPF.Tables.Count > 0)
{
foreach (DataRow orr in dsPF.Tables[0].Rows)
{
oDR = dtExceptionPF.NewRow();
oDR["Name"] = orr["Name"].ToString();
oDR["EmpNo"] = orr["EmployeeNo"].ToString();
oDR["Country"] = orr["Country"].ToString();
oDR["Designation"] = orr["Designation"].ToString();
oDR["Department"] = orr["Department"].ToString();
oDR["CostCenter"] = orr["CostCenter"].ToString();
oDR["PFAmount"] = Convert.ToDouble(orr["PFAmount"].ToString());
dtExceptionPF.Rows.Add(oDR);
}
// if (dtExceptionPF.Rows.Count > 0)
{
form.ShowExceptionPFReport(fromdate, dtExceptionPF);
}
}
}
public void PrepareDataForExceptionPFandConfirmation(DateTime fromdate, DateTime todate)
{
fReportViewer form = new fReportViewer();
DataRow oDR = null;
DataSet dsPF = null;
dsPF = MiscellaneousDataset.GetEmployeesPFNew(fromdate, todate);
PayrollDataSet.dsCompany.NewPFDataTable dtMonthlyPF = new Payroll.Report.PayrollDataSet.dsCompany.NewPFDataTable();
if (dsPF.Tables.Count > 0)
{
foreach (DataRow orr in dsPF.Tables[0].Rows)
{
oDR = dtMonthlyPF.NewRow();
oDR["EmpName"] = orr["Name"].ToString();
oDR["EmpNo"] = orr["EmployeeNo"].ToString();
DateTime dtJoin = Convert.ToDateTime(orr["JOININGDATE"].ToString());
oDR["JoiningDate"] = dtJoin.ToString("dd MMM yyyy");
DateTime dob = Convert.ToDateTime((orr["BirthDate"]).ToString());
oDR["DoB"] = dob.ToString("dd MMM yyyy");
oDR["Designation"] = orr["Designation"].ToString();
oDR["Department"] = orr["Department"].ToString();
oDR["GrossSalary"] = Convert.ToDouble(orr["GrossSalary"].ToString());
oDR["CPF"] = Convert.ToDouble(orr["CPF"].ToString());
oDR["EPF"] = Convert.ToDouble(orr["EPF"].ToString());
dtMonthlyPF.Rows.Add(oDR);
}
//if (dtMonthlyPF.Rows.Count > 0)
{
form.ShowExceptionPFConfirmationReport(fromdate, todate, dtMonthlyPF);
}
}
}
public void PrepareDataForExceptionSalaryRevision(DateTime fromdate, DateTime todate)
{
fReportViewer form = new fReportViewer();
DataRow oDR = null;
DataSet dsSR = null;
dsSR = MiscellaneousDataset.GetMonthlySalaryRevision(fromdate, todate);
PayrollDataSet.dsCompany.MonthlySalaryRevisionDataTable dtMonthlySalaryRevision = new Payroll.Report.PayrollDataSet.dsCompany.MonthlySalaryRevisionDataTable();
if (dsSR.Tables.Count > 0)
{
foreach (DataRow orr in dsSR.Tables[0].Rows)
{
oDR = dtMonthlySalaryRevision.NewRow();
oDR["EmpName"] = orr["Name"].ToString();
oDR["EmpNo"] = orr["EMPLOYEENO"].ToString();
DateTime dtJoin = Convert.ToDateTime(orr["JOININGDATE"].ToString());
oDR["JoiningDate"] = dtJoin.ToString("dd MMM yyyy");
oDR["Designation"] = orr["Designation"].ToString();
oDR["Department"] = orr["Department"].ToString();
oDR["PreviousSalary"] = Convert.ToDouble(orr["Prev"].ToString());
oDR["RevisedSalary"] = Convert.ToDouble(orr["Present"].ToString());
dtMonthlySalaryRevision.Rows.Add(oDR);
}
//if (dtMonthlySalaryRevision.Rows.Count > 0)
{
form.ShowExceptionSalaryRevisionReport(fromdate, todate, dtMonthlySalaryRevision);
}
}
}
}
}