382 lines
17 KiB
C#
382 lines
17 KiB
C#
//using System;
|
|
//using System.Collections.Generic;
|
|
//using System.Linq;
|
|
//using System.Text;
|
|
//using System.Windows.Forms;
|
|
//using Payroll.BO;
|
|
//using Ease.CoreV35.Model;
|
|
//using System.ComponentModel;
|
|
//using System.Data;
|
|
//using System.Drawing;
|
|
|
|
//namespace Payroll.Report
|
|
//{
|
|
// public class rptGratuity
|
|
// {
|
|
// DataSet dSet = new DataSet();
|
|
// private ReportSetup _selectedParameter;
|
|
// private ObjectsTemplate<ESBDefinition> _oESBDefinitions = null;
|
|
// ObjectsTemplate<Employee> oEmployees = null;
|
|
// string tempEmpID = string.Empty;
|
|
// int count = 1;
|
|
// DateTime dtFirst = DateTime.MinValue;
|
|
// double openingBalance = 0.0;
|
|
|
|
// public rptGratuity()
|
|
// {
|
|
|
|
// }
|
|
// public ReportSetup SelectedParameter
|
|
// {
|
|
// set
|
|
// {
|
|
// _selectedParameter = value;
|
|
// }
|
|
// }
|
|
|
|
// public void ShowAllDataForTheEmployees(ObjectsTemplate<Employee> _Employees, DateTime dateTime)
|
|
// {
|
|
// ESBDefinition oESBDefinition = null;
|
|
// fReportViewer form = new fReportViewer();
|
|
// PayrollDataSet.PayrollDataSet.GratuityProvisionDataTable dTEmpGratuity = new Payroll.Report.PayrollDataSet.PayrollDataSet.GratuityProvisionDataTable();
|
|
// DataRow oDR = null;
|
|
// string EmpiD = string.Empty;
|
|
// int count = 1;
|
|
// int rowCount = 0;
|
|
// double nRetirementAge = 0.0;
|
|
// int serviceYear = 0;
|
|
// int serviceMonth = 0;
|
|
// int serviceDay = 0;
|
|
// string Month = Convert.ToString(dateTime.ToString("MMM yyyy"));
|
|
// double nServiceYear = 0.0;
|
|
// double nNoOfPeyable = 0.0;
|
|
// foreach (Employee oemp in _Employees)
|
|
// {
|
|
// if (EmpiD == "" || count == _Employees.Count)
|
|
// {
|
|
// EmpiD = oemp.ID.ToString();
|
|
// }
|
|
|
|
// else if (count < _Employees.Count)
|
|
// {
|
|
// EmpiD = EmpiD + "," + oemp.ID.ToString();
|
|
// count++;
|
|
// }
|
|
// }
|
|
// string sEmpID = EmpiD;
|
|
// DateTime GratuityMonth = GlobalFunctions.LastDateOfMonth(dateTime);
|
|
// ObjectsTemplate<Designation> oDesignations = Designation.Get(EnumStatus.Active);
|
|
// ObjectsTemplate<EmployeeRetirement> oRetirements = EmployeeRetirement.Get();
|
|
|
|
// //dTEmpGratuity = ESBProvision.GetEmpProvision(sEmpID, GratuityMonth);
|
|
// try
|
|
// {
|
|
// ObjectsTemplate<ESBProvision> oProvisions = ESBProvision.GetProvision(sEmpID, GratuityMonth);
|
|
// if (oProvisions != null && oProvisions.Count > 0)
|
|
// {
|
|
// foreach (ESBProvision provision in oProvisions)
|
|
// {
|
|
// Employee oEmp = _Employees.Find(delegate(Employee emp) { return emp.ID == provision.EmployeeID; });
|
|
// oEmp = Employee.Get(provision.EmployeeID);
|
|
// oDR = dTEmpGratuity.NewRow();
|
|
// rowCount++;
|
|
// oDR["SL"] = rowCount;
|
|
// oDR["EmpNo"] = oEmp.EmployeeNo;
|
|
// oDR["EmpName"] = oEmp.Name;
|
|
// Designation oDesig = oDesignations.Find(delegate(Designation desig) { return desig.ID == oEmp.DesignationID; });
|
|
// oDR["Designation"] = oDesig.Name;
|
|
// oDR["DateOfBirth"] = oEmp.BirthDate.ToString("dd MMM yyyy");
|
|
// oDR["JoiningDate"] = oEmp.JoiningDate.ToString("dd MMM yyyy");
|
|
// oDR["Basic"] = oEmp.BasicSalary;
|
|
// EmployeeRetirement retire = oRetirements.Find(delegate(EmployeeRetirement ret) { return ret.employeeID == oEmp.ID; });
|
|
// nRetirementAge = EmployeeRetirement.GetById(oEmp.ID);
|
|
// oDR["RetirementAge"] = nRetirementAge;
|
|
// nServiceYear = oEmp.ServiceYears(Ease.CoreV35.Utility.Global.DateFunctions.LastDateOfYear(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate));
|
|
// DateDifferenceInYearsMonthDays dts = DateDifferenceInYearsMonthDays.CompareDates(oEmp.JoiningDate, Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|
// oDR["ServiceLength"] = dts.Years + " Year(s) " + dts.Months + " Month(s) " + dts.Days + " Day(s)";
|
|
// _oESBDefinitions = ESBDefinition.Get();
|
|
// oESBDefinition = ESBDefinition.Get(_oESBDefinitions, oEmp);
|
|
// nNoOfPeyable = ESBSlab.GetCalcualateNo(nServiceYear, oESBDefinition);
|
|
// oDR["NoOfBasicPayable"] = GlobalFunctions.Round(nNoOfPeyable * nServiceYear);
|
|
// oDR["GrPeyableProvision"] = provision.Provision;
|
|
|
|
// dTEmpGratuity.Rows.Add(oDR);
|
|
// }
|
|
// }
|
|
// }
|
|
// catch (Exception Ex)
|
|
// {
|
|
// throw new Exception(Ex.Message);
|
|
// }
|
|
// if (dTEmpGratuity.Rows.Count > 0)
|
|
// {
|
|
// form.ShowEmpGratuityProvision(dTEmpGratuity, Month);
|
|
// }
|
|
// else
|
|
// {
|
|
// MessageBox.Show("No Data Found!!!");
|
|
// }
|
|
// }
|
|
|
|
// public struct DateDifferenceInYearsMonthDays
|
|
// {
|
|
// private readonly int years;
|
|
// private readonly int months;
|
|
// private readonly int days;
|
|
// private readonly int hours;
|
|
// private readonly int minutes;
|
|
// private readonly int seconds;
|
|
// private readonly int milliseconds;
|
|
|
|
// public DateDifferenceInYearsMonthDays(int years, int months, int days, int hours, int minutes, int seconds, int milliseconds)
|
|
// {
|
|
// this.years = years;
|
|
// this.months = months;
|
|
// this.days = days;
|
|
// this.hours = hours;
|
|
// this.minutes = minutes;
|
|
// this.seconds = seconds;
|
|
// this.milliseconds = milliseconds;
|
|
// }
|
|
|
|
// public int Years { get { return years; } }
|
|
// public int Months { get { return months; } }
|
|
// public int Days { get { return days; } }
|
|
// public int Hours { get { return hours; } }
|
|
// public int Minutes { get { return minutes; } }
|
|
// public int Seconds { get { return seconds; } }
|
|
// public int Milliseconds { get { return milliseconds; } }
|
|
|
|
// enum Phase { Years, Months, Days, Done }
|
|
|
|
// public static DateDifferenceInYearsMonthDays CompareDates(DateTime date1, DateTime date2)
|
|
// {
|
|
|
|
// if (date2 < date1)
|
|
// {
|
|
// DateTime sub = date1;
|
|
// date1 = date2;
|
|
// date2 = sub;
|
|
// }
|
|
|
|
// DateTime current = date2;
|
|
// int years = 0;
|
|
// int months = 0;
|
|
// int days = 0;
|
|
|
|
// Phase phase = Phase.Years;
|
|
// DateDifferenceInYearsMonthDays span = new DateDifferenceInYearsMonthDays();
|
|
|
|
// while (phase != Phase.Done)
|
|
// {
|
|
// switch (phase)
|
|
// {
|
|
// case Phase.Years:
|
|
// if (current.Year == 1 || current.AddYears(-1) < date1)
|
|
// {
|
|
// phase = Phase.Months;
|
|
// }
|
|
// else
|
|
// {
|
|
// current = current.AddYears(-1);
|
|
// years++;
|
|
// }
|
|
// break;
|
|
// case Phase.Months:
|
|
// if (current.AddMonths(-1) < date1)
|
|
// {
|
|
// phase = Phase.Days;
|
|
// }
|
|
// else
|
|
// {
|
|
// current = current.AddMonths(-1);
|
|
// months++;
|
|
// }
|
|
// break;
|
|
// case Phase.Days:
|
|
// if (current.AddDays(-1) < date1)
|
|
// {
|
|
// days++;
|
|
// TimeSpan timespan = current - date1;
|
|
// span = new DateDifferenceInYearsMonthDays(years, months, days, timespan.Hours, timespan.Minutes, timespan.Seconds, timespan.Milliseconds);
|
|
// phase = Phase.Done;
|
|
// }
|
|
// else
|
|
// {
|
|
// current = current.AddDays(-1);
|
|
// days++;
|
|
// }
|
|
// break;
|
|
// }
|
|
// }
|
|
|
|
// return span;
|
|
// }
|
|
// }
|
|
|
|
// public void ShowAllGRLedgerData(ID employeeID, string Name, string EmployeeNo, DateTime Firstdate, DateTime Lastdate)
|
|
// {
|
|
// fReportViewer form = new fReportViewer();
|
|
// //DateTime OpeningMonth = GlobalFunctions.LastDateOfMonth(Firstdate.AddMonths(-1));
|
|
// //DateTime openingDate = GlobalFunctions.LastDateOfMonth(OpeningMonth);
|
|
// string DateRange = Convert.ToString(Firstdate.ToString("MMM yyyy ")) + " To " + Convert.ToString(Lastdate.ToString("MMM yyyy"));
|
|
// string OpeningDate = Convert.ToString(Firstdate.ToString("MMM yyyy "));
|
|
// string Employee = Name + "(" + EmployeeNo + ")";
|
|
// PayrollDataSet.PayrollDataSet.GratuityLedgerDataTable oGratuityLedger = new Payroll.Report.PayrollDataSet.PayrollDataSet.GratuityLedgerDataTable();
|
|
// DataRow oDR = null;
|
|
// double openingBalance = 0.0;
|
|
// int rowCount = 0;
|
|
|
|
// DateTime dtFirst = GlobalFunctions.LastDateOfMonth(Firstdate);
|
|
// DateTime dtLast = GlobalFunctions.LastDateOfMonth(Lastdate);
|
|
// oDR = oGratuityLedger.NewRow();
|
|
// openingBalance = ESBProvision.GetOpeningBalance(employeeID.Integer, dtFirst);
|
|
// oDR["OpeningBalance"] = GlobalFunctions.Round(openingBalance);
|
|
// ObjectsTemplate<ESBProvision> oProvisions = ESBProvision.GetProvision(employeeID.Integer, dtFirst, dtLast);
|
|
// if (oProvisions != null && oProvisions.Count > 0)
|
|
// {
|
|
// foreach (ESBProvision opro in oProvisions)
|
|
// {
|
|
// oDR["Description"] = opro.ProcessMonthDate.ToString("MMM-yy");
|
|
// oDR["Amount"] = GlobalFunctions.Round(Convert.ToDouble(opro.Provision));
|
|
// }
|
|
// }
|
|
// oGratuityLedger.Rows.Add(oDR);
|
|
// if (oGratuityLedger.Rows.Count > 0)
|
|
// {
|
|
// form.ShowGratuityLedgerData(oGratuityLedger, DateRange, OpeningDate, Employee);
|
|
// }
|
|
// else
|
|
// {
|
|
// MessageBox.Show("No Data Found!!!");
|
|
// }
|
|
// }
|
|
|
|
// public void ShowAllGRRegisterData(DateTime firstdate, DateTime lastdate)
|
|
// {
|
|
// fReportViewer form = new fReportViewer();
|
|
// oEmployees = Employee.Get();
|
|
|
|
// PayrollDataSet.PayrollDataSet.GratuityRegisterDataTable registryDataTable = new Payroll.Report.PayrollDataSet.PayrollDataSet.GratuityRegisterDataTable();
|
|
// DataRow oDR = null;
|
|
|
|
// int rowCount = 0;
|
|
// string sEmpNo = string.Empty;
|
|
|
|
// DateTime dtFirstDate = GlobalFunctions.LastDateOfMonth(firstdate);
|
|
// DateTime dtLast = GlobalFunctions.LastDateOfMonth(lastdate);
|
|
// string FirstDate = dtFirstDate.ToString("MMM yyyy");
|
|
// string LastDate = dtLast.ToString("MMM yyyy");
|
|
// dtFirst = dtFirstDate;
|
|
// ObjectsTemplate<ESBProvision> oProvisions = ESBProvision.GetProvision(dtFirstDate, dtLast);
|
|
// if (oProvisions != null && oProvisions.Count > 0)
|
|
// {
|
|
// foreach (ESBProvision opro in oProvisions)
|
|
// {
|
|
// oDR = registryDataTable.NewRow();
|
|
// this.Copy(oDR, opro);
|
|
// registryDataTable.Rows.Add(oDR);
|
|
// }
|
|
// }
|
|
// if (registryDataTable.Rows.Count > 0)
|
|
// {
|
|
// form.ShowGRRegistryData(registryDataTable, FirstDate, LastDate);
|
|
// }
|
|
// else
|
|
// {
|
|
// MessageBox.Show("No Data Found!!!");
|
|
// }
|
|
// }
|
|
|
|
// private void Copy(DataRow oDR, ESBProvision opro)
|
|
// {
|
|
// if (tempEmpID == string.Empty)
|
|
// {
|
|
// tempEmpID = Convert.ToString(opro.EmployeeID.ToString());
|
|
// // oDR["SL"] = count;
|
|
// // count++;
|
|
// }
|
|
// if (tempEmpID != Convert.ToString(opro.EmployeeID.ToString()))
|
|
// {
|
|
// tempEmpID = Convert.ToString(opro.EmployeeID.ToString());
|
|
// // oDR["SL"] = count;
|
|
// // count++;
|
|
// }
|
|
|
|
// Employee oEmp = oEmployees.Find(delegate(Employee emp) { return emp.ID == opro.EmployeeID; });
|
|
// oDR["EmpNo"] = oEmp.EmployeeNo;
|
|
// oDR["EmpName"] = oEmp.Name;
|
|
// openingBalance = ESBProvision.GetOpeningBalance(opro.EmployeeID.Integer, dtFirst);
|
|
// oDR["OpeningBalance"] = GlobalFunctions.Round(Convert.ToDouble(openingBalance));
|
|
// oDR["Description"] = opro.ProcessMonthDate.ToString("MMM yy");
|
|
// oDR["Amount"] = GlobalFunctions.Round(Convert.ToDouble(opro.Provision));
|
|
// }
|
|
|
|
// public void ShowAllDataForTheEmployeesBalance(ObjectsTemplate<Employee> _Employees, DateTime dateTime)
|
|
// {
|
|
// ESBDefinition oESBDefinition = null;
|
|
// fReportViewer form = new fReportViewer();
|
|
// PayrollDataSet.PayrollDataSet.GratuityProvisionDataTable dTEmpGratuity = new Payroll.Report.PayrollDataSet.PayrollDataSet.GratuityProvisionDataTable();
|
|
// DataRow oDR = null;
|
|
// string EmpiD = string.Empty;
|
|
// int count = 1;
|
|
// int rowCount = 0;
|
|
// double nRetirementAge = 0.0;
|
|
// int serviceYear = 0;
|
|
// int serviceMonth = 0;
|
|
// int serviceDay = 0;
|
|
// string Month = Convert.ToString(dateTime.ToString("MMM yyyy"));
|
|
// double nServiceYear = 0.0;
|
|
// double nNoOfPeyable = 0.0;
|
|
|
|
// DateTime BalanceMonth = GlobalFunctions.LastDateOfMonth(dateTime);
|
|
// ObjectsTemplate<Designation> oDesignations = Designation.Get(EnumStatus.Active);
|
|
// ObjectsTemplate<EmployeeRetirement> oRetirements = EmployeeRetirement.Get();
|
|
|
|
// try
|
|
// {
|
|
// foreach (Employee oEmp in _Employees)
|
|
// {
|
|
// oDR = dTEmpGratuity.NewRow();
|
|
// rowCount++;
|
|
// oDR["SL"] = rowCount;
|
|
// oDR["EmpNo"] = oEmp.EmployeeNo;
|
|
// oDR["EmpName"] = oEmp.Name;
|
|
// Designation oDesig = oDesignations.Find(delegate(Designation desig) { return desig.ID == oEmp.DesignationID; });
|
|
// oDR["Designation"] = oDesig.Name;
|
|
// oDR["DateOfBirth"] = oEmp.BirthDate.ToString("dd MMM yyyy");
|
|
// oDR["JoiningDate"] = oEmp.JoiningDate.ToString("dd MMM yyyy");
|
|
// oDR["Basic"] = oEmp.BasicSalary;
|
|
// EmployeeRetirement retire = oRetirements.Find(delegate(EmployeeRetirement ret) { return ret.employeeID == oEmp.ID; });
|
|
// nRetirementAge = EmployeeRetirement.GetById(oEmp.ID);
|
|
// oDR["RetirementAge"] = nRetirementAge;
|
|
// nServiceYear = oEmp.ServiceYears(dateTime);
|
|
// DateDifferenceInYearsMonthDays dts = DateDifferenceInYearsMonthDays.CompareDates(oEmp.JoiningDate, dateTime);
|
|
// oDR["ServiceLength"] = dts.Years + " Year(s) " + dts.Months + " Month(s) " + dts.Days + " Day(s)";
|
|
// _oESBDefinitions = ESBDefinition.Get();
|
|
// oESBDefinition = ESBDefinition.Get(_oESBDefinitions, oEmp);
|
|
// nNoOfPeyable = ESBSlab.GetCalcualateNo(nServiceYear, oESBDefinition);
|
|
// oDR["NoOfBasicPayable"] = GlobalFunctions.Round(nNoOfPeyable * nServiceYear);
|
|
// oDR["GrPeyableProvision"] = GlobalFunctions.Round((nNoOfPeyable * nServiceYear) * oEmp.BasicSalary);
|
|
|
|
// dTEmpGratuity.Rows.Add(oDR);
|
|
// }
|
|
// }
|
|
// catch (Exception Ex)
|
|
// {
|
|
// throw new Exception(Ex.Message);
|
|
// }
|
|
// if (dTEmpGratuity.Rows.Count > 0)
|
|
// {
|
|
// form.ShowEmpGratuityBalance(dTEmpGratuity, Month);
|
|
// }
|
|
// else
|
|
// {
|
|
// MessageBox.Show("No Data Found!!!");
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
|