using System; using System.Collections.Generic; using System.Data; using System.Linq; using Ease.Core.Model; using HRM.BO; using HRM.DA; using Microsoft.Reporting.NETCore; namespace HRM.Report { public class rptJV { DateTime _dEffectDate; //public byte[] ShowMultipleTaxCard(string sEmpIDs, bool ITStatus, int nTaxParamID, int systemTaxParamID, DateTime nextPayProcessDate, int payrollTypeID, string reportType) public byte[] showJVLoactionWReport(int JVTypeID, DateTime dEffectDate, int? nLocID, int payrollTypeID, string reportType) { ReportProcessor reportProcessor = new ReportProcessor(); string RDLCName = null; DataSet ds = new DataSet(); DataTable dt = this.JVLoactionWReport(JVTypeID, dEffectDate, nLocID, payrollTypeID); dt.TableName = "PayrollDataSet_JVLoactionWReport"; ds.Tables.Add(dt); //DataSet dsSub = new DataSet(); //bool otherInvestment = false; //SystemInformation systemInformation = new SystemInformationService().Get(); //if (systemInformation.name == "SGS Bangladesh Limited") // otherInvestment = true; List _parameters = new List(); //ReportParameter parameter = new ReportParameter("AssesmentYear", _taxParameter.AssessmentYear); //_parameters.Add(parameter); //parameter = new ReportParameter("FiscalYear", _taxParameter.FiscalYear); //_parameters.Add(parameter); //parameter = new ReportParameter("OtherInvestment", otherInvestment.ToString()); //_parameters.Add(parameter); RDLCName = "JVLoactionWReport.rdlc"; return reportProcessor.CommonReportViewForReports(null, ds, null, RDLCName, _parameters, true, payrollTypeID, reportType); //return reportProcessor.CommonReportView(null, RDLCName, ds, dsSub, _parameters, true, payrollTypeID, reportType); } public DataTable JVLoactionWReport(int JVTypeID, DateTime dEffectDate, int? nLocID, int payrolltypeId) { _dEffectDate = dEffectDate; DataRow dr = null; PayrollDataSet.PayrollDataSet.JVLoactionWReportDataTable dTJVInfo = new PayrollDataSet.PayrollDataSet.JVLoactionWReportDataTable(); //JVSetup osetp = new JVSetupService(); DateTime maxdate = new JVSetupService().GetMaxDate(_dEffectDate, payrolltypeId); List oJVSetups = new List(); oJVSetups = new JVSetupService().GetByJVTypeAndEffectDate(JVTypeID, maxdate); //bool earnedBasic = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "pf", "earnedbasic"); //int earnedBasic = new SystemConfigarationService().GetconfigIntValue(EnumConfigurationType.Logic, "Location", "tier"); //int nLocationTire = ConfigurationManager.GetIntValue("Location", "tier", EnumConfigurationType.Logic); int nLocationTire = new SystemConfigarationService().GetconfigIntValue(EnumConfigurationType.Logic, "Location", "tier"); List oLocations = new List(); oLocations = new LocationService().GetByTier(2); // get the last tier data and last tier is defined in Logic configuration file //int nCCTire = ConfigurationManager.GetIntValue("costcenter", "tier", EnumConfigurationType.Logic); int nCCTire = new SystemConfigarationService().GetconfigIntValue(EnumConfigurationType.Logic, "costcenter", "tier"); List oCostCenters = new List(); oCostCenters = new CostcenterService().GetByTire(nCCTire, payrolltypeId); // get the last tier data and last tier is defined in Logic configuration file List salaries = new SalaryMonthlyService().Get(GlobalFunctions.LastDateOfMonth(dEffectDate), payrolltypeId); //List employees = new EmployeeService().GetAllEmps(payrolltypeId); List employees = new EmployeeService().GetWithDiscontinue(payrolltypeId); string sEmpID = ""; foreach (SalaryMonthly sm in salaries) { sm.Employee = employees.Find(x => x.ID == sm.EmployeeID); sm.CostCentersInvolments = new SalaryMonthlyService().GetForCC(sm.ID); if (sEmpID == "") sEmpID += sm.Employee.ID.ToString(); //sEmpID += sm.EmployeeID.ToString(); else sEmpID += "," + sm.Employee.ID.ToString(); } DataSet oSalarySheets = null; oSalarySheets = new SalaryMonthlyService().GetSGSSalarySheet(GlobalFunctions.LastDateOfMonth(dEffectDate), sEmpID); PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new PayrollDataSet.PayrollDataSet.SalarySheetDataTable(); DataRow oDR = null; foreach (DataRow source in oSalarySheets.Tables[0].Rows) { if ((Convert.ToInt32(source["ItemID"]) == -101 && Convert.ToInt32(source["ItemCode"]) == -101) || (Convert.ToInt32(source["ItemID"]) == 2 && Convert.ToInt32(source["ItemCode"]) == -113) || (Convert.ToInt32(source["ItemID"]) == 1 && Convert.ToInt32(source["ItemCode"]) == -113) || (Convert.ToInt32(source["ItemID"]) == 10 && Convert.ToInt32(source["ItemCode"]) == -113)) { SalaryMonthly osalary = null; if (nLocID == null) osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString()); else osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString() && x.LocationID == nLocID); if (osalary != null) { foreach (SalaryEmpCostCenter ecc in osalary.CostCentersInvolments) { if (ecc.Percentage == 0) continue; oDR = dTJVInfo.NewRow(); this.CopySS(oDR, source, osalary, oLocations, oCostCenters, ecc.Percentage, ecc.CostCenterID, _dEffectDate); dTJVInfo.Rows.Add(oDR); } } } } foreach (DataRow source in oSalarySheets.Tables[1].Rows) { SalaryMonthly osalary = null; if (nLocID == null) osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString()); else osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString() && x.LocationID == nLocID); if (osalary != null) { foreach (SalaryEmpCostCenter ecc in osalary.CostCentersInvolments) { if (ecc.Percentage == 0) continue; oDR = dTJVInfo.NewRow(); this.CopySS(oDR, source, osalary, oLocations, oCostCenters, ecc.Percentage, ecc.CostCenterID, _dEffectDate); dTJVInfo.Rows.Add(oDR); } } } foreach (DataRow source in oSalarySheets.Tables[0].Rows) { if ((Convert.ToInt32(source["ItemID"]) == -101 && Convert.ToInt32(source["ItemCode"]) == -101) || (Convert.ToInt32(source["ItemID"]) == 2 && Convert.ToInt32(source["ItemCode"]) == -113) || (Convert.ToInt32(source["ItemID"]) == 1 && Convert.ToInt32(source["ItemCode"]) == -113) || (Convert.ToInt32(source["ItemID"]) == 10 && Convert.ToInt32(source["ItemCode"]) == -113)) { continue; } else { SalaryMonthly osalary = null; if (nLocID == null) osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString()); else osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString() && x.LocationID == nLocID); if (osalary != null) { foreach (SalaryEmpCostCenter ecc in osalary.CostCentersInvolments) { if (ecc.Percentage == 0) continue; oDR = dTJVInfo.NewRow(); this.CopySS(oDR, source, osalary, oLocations, oCostCenters, ecc.Percentage, ecc.CostCenterID, _dEffectDate); dTJVInfo.Rows.Add(oDR); } } } } foreach (DataRow source in oSalarySheets.Tables[2].Rows) { SalaryMonthly osalary = null; if (nLocID == null) osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString()); else osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString() && x.LocationID == nLocID); if (osalary != null) { foreach (SalaryEmpCostCenter ecc in osalary.CostCentersInvolments) { if (ecc.Percentage == 0) continue; oDR = dTJVInfo.NewRow(); this.CopySS(oDR, source, osalary, oLocations, oCostCenters, ecc.Percentage, ecc.CostCenterID, _dEffectDate); dTJVInfo.Rows.Add(oDR); } } } foreach (DataRow source in oSalarySheets.Tables[3].Rows) { SalaryMonthly osalary = null; if (nLocID == null) osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString()); else osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString() && x.LocationID == nLocID); if (osalary != null) { foreach (SalaryEmpCostCenter ecc in osalary.CostCentersInvolments) { if (ecc.Percentage == 0) continue; oDR = dTJVInfo.NewRow(); this.CopySS(oDR, source, osalary, oLocations, oCostCenters, ecc.Percentage, ecc.CostCenterID, _dEffectDate); dTJVInfo.Rows.Add(oDR); } } } foreach (DataRow source in oSalarySheets.Tables[4].Rows) { SalaryMonthly osalary = null; if (nLocID == null) osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString()); else osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString() && x.LocationID == nLocID); if (osalary != null) { foreach (SalaryEmpCostCenter ecc in osalary.CostCentersInvolments) { if (ecc.Percentage == 0) continue; oDR = dTJVInfo.NewRow(); this.CopySS(oDR, source, osalary, oLocations, oCostCenters, ecc.Percentage, ecc.CostCenterID, _dEffectDate); dTJVInfo.Rows.Add(oDR); } } } foreach (DataRow source in oSalarySheets.Tables[5].Rows) { SalaryMonthly osalary = null; if (nLocID == null) osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString()); else osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString() && x.LocationID == nLocID); if (osalary != null) { foreach (SalaryEmpCostCenter ecc in osalary.CostCentersInvolments) { if (ecc.Percentage == 0) continue; oDR = dTJVInfo.NewRow(); this.CopySS(oDR, source, osalary, oLocations, oCostCenters, ecc.Percentage, ecc.CostCenterID, _dEffectDate); dTJVInfo.Rows.Add(oDR); } } } foreach (DataRow source in oSalarySheets.Tables[6].Rows) { SalaryMonthly osalary = null; if (nLocID == null) osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString()); else osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString() && x.LocationID == nLocID); if (osalary != null) { foreach (SalaryEmpCostCenter ecc in osalary.CostCentersInvolments) { if (ecc.Percentage == 0) continue; oDR = dTJVInfo.NewRow(); this.CopySS(oDR, source, osalary, oLocations, oCostCenters, ecc.Percentage, ecc.CostCenterID, _dEffectDate); dTJVInfo.Rows.Add(oDR); } } } foreach (DataRow source in oSalarySheets.Tables[7].Rows) { SalaryMonthly osalary = null; if (nLocID == null) osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString()); else osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString() && x.LocationID == nLocID); if (osalary != null) { foreach (SalaryEmpCostCenter ecc in osalary.CostCentersInvolments) { if (ecc.Percentage == 0) continue; oDR = dTJVInfo.NewRow(); this.CopySS(oDR, source, osalary, oLocations, oCostCenters, ecc.Percentage, ecc.CostCenterID, _dEffectDate); dTJVInfo.Rows.Add(oDR); } } } //foreach(Location oLocation in oLocations) //{ // foreach(Costcenter oCC in oCostCenters) // { // foreach (JVSetup osetup in oJVSetups) // { // foreach (SalaryMonthly osalary in salaries) // { // if (osalary.LocationID == oLocation.ID) // { // double percent = SalaryEmpCostCenter.InvolvedPercent(osalary.CostCentersInvolments, oCC.ID); // if (percent == 0) continue; // dr = dTJVInfo.NewRow(); // dr["Location"] = oLocation.Name; // dr["CostCenter"] = oCC.Name; // dr["EmpNo"] = osalary.Employee.EmployeeNo; // dr["Name"] = osalary.Employee.Name; // dr["Description"] = osetup.Description; // dr["Amount"] = osetup.GetAmount(osalary) * percent/100; // dr["JVMonth"] = dEffectDate; // dTJVInfo.Rows.Add(dr); // } // } // } // } //} DataView dv = dTJVInfo.DefaultView; //dv.Sort = "Tier,CostCenterCode,Description"; DataTable sortedDT = dv.ToTable(); return sortedDT; } private void CopySS(DataRow source, DataRow destination, SalaryMonthly osalary, List oLocations, List oCostCenters, double nPercentage, int nCCID, DateTime dEffectDate) { Location loc = oLocations.Find(x => x.ID == osalary.LocationID); double nAmount = Convert.ToDouble(destination["Amount"]); source["Location"] = loc == null ? "" : loc.Name; Costcenter cc = oCostCenters.Find(x => x.ID == nCCID); string costCenter = string.Empty; if (cc != null) { costCenter = cc.Code + "-" + cc.Name; source["CostCenter"] = costCenter; } else { source["CostCenter"] = costCenter; } source["CostCenterCode"] = cc == null ? "" : cc.Code.Trim(); //source["CostCenter"] = cc == null ? "" : cc.Name; source["EmpNo"] = destination["EMPLOYEENO"]; source["Name"] = destination["Name"]; source["Description"] = destination["Description"]; source["Amount"] = nAmount * nPercentage / 100; source["JVMonth"] = dEffectDate; } public byte[] showJVSummaryReport(int JVTypeID, DateTime dEffectDate, int? nLocID, int payrollTypeID, string reportType) { ReportProcessor reportProcessor = new ReportProcessor(); string RDLCName = null; DataSet ds = new DataSet(); DataTable dt = this.JVLoactionWReport(JVTypeID, dEffectDate, nLocID, payrollTypeID); dt.TableName = "PayrollDataSet_JVSummaryReport"; ds.Tables.Add(dt); List _parameters = null; RDLCName = "JVSummaryReport.rdlc"; return reportProcessor.CommonReportViewForReports(null, ds, null, RDLCName, _parameters, true, payrollTypeID, reportType); //return reportProcessor.CommonReportView(null, RDLCName, ds, dsSub, _parameters, true, payrollTypeID, reportType); } //public DataTable JVLoactionWReport(int JVTypeID, DateTime dEffectDate, int nLocID, int payrolltypeId) //{ // _dEffectDate = dEffectDate; // DataRow dr = null; // PayrollDataSet.PayrollDataSet.JVLoactionWReportDataTable dTJVInfo = new PayrollDataSet.PayrollDataSet.JVLoactionWReportDataTable(); // DateTime maxdate = new JVSetupService().GetMaxDate(_dEffectDate, payrolltypeId); // JVSetup osetp = new JVSetup(); // List oJVSetups = new List(); // oJVSetups = new JVSetupService().GetByJVTypeAndEffectDate(JVTypeID, maxdate); // int nLocationTire = ConfigurationManager.GetIntValue("Location", "tier", EnumConfigurationType.Logic); // List oLocations = new List(); // oLocations = new LocationService().GetByTier(2); // get the last tier data and last tier is defined in Logic configuration file // int nCCTire = ConfigurationManager.GetIntValue("costcenter", "tier", EnumConfigurationType.Logic); // List oCostCenters = new List(); // oCostCenters = new CostcenterService().GetByTire(nCCTire, payrolltypeId); // get the last tier data and last tier is defined in Logic configuration file // List salaries = new SalaryMonthlyService().Get(GlobalFunctions.LastDateOfMonth(dEffectDate), payrolltypeId); // string sEmpID = ""; // foreach (SalaryMonthly sm in salaries) // { // if (sEmpID == "") // sEmpID += sm.Employee.ID.ToString(); // else // sEmpID += "," + sm.Employee.ID.ToString(); // } // DataSet oSalarySheets = null; // oSalarySheets = new SalaryMonthlyService().GetSGSSalarySheet(GlobalFunctions.LastDateOfMonth(dEffectDate), sEmpID); // PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new PayrollDataSet.PayrollDataSet.SalarySheetDataTable(); // DataRow oDR = null; // foreach (DataRow source in oSalarySheets.Tables[0].Rows) // { // SalaryMonthly osalary = null; // if (nLocID == null) // osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString()); // else // osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString() && x.LocationID == nLocID); // if (osalary != null) // { // foreach (SalaryEmpCostCenter ecc in osalary.CostCentersInvolments) // { // if (ecc.Percentage == 0) continue; // oDR = dTJVInfo.NewRow(); // this.CopySS(oDR, source, osalary, oLocations, oCostCenters, ecc.Percentage, ecc.CostCenterID, _dEffectDate); // dTJVInfo.Rows.Add(oDR); // } // } // } // foreach (DataRow source in oSalarySheets.Tables[1].Rows) // { // SalaryMonthly osalary = null; // if (nLocID == null) // osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString()); // else // osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString() && x.LocationID == nLocID); // if (osalary != null) // { // foreach (SalaryEmpCostCenter ecc in osalary.CostCentersInvolments) // { // if (ecc.Percentage == 0) continue; // oDR = dTJVInfo.NewRow(); // this.CopySS(oDR, source, osalary, oLocations, oCostCenters, ecc.Percentage, ecc.CostCenterID, _dEffectDate); // dTJVInfo.Rows.Add(oDR); // } // } // } // foreach (DataRow source in oSalarySheets.Tables[2].Rows) // { // SalaryMonthly osalary = null; // if (nLocID == null) // osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString()); // else // osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString() && x.LocationID == nLocID); // if (osalary != null) // { // foreach (SalaryEmpCostCenter ecc in osalary.CostCentersInvolments) // { // if (ecc.Percentage == 0) continue; // oDR = dTJVInfo.NewRow(); // this.CopySS(oDR, source, osalary, oLocations, oCostCenters, ecc.Percentage, ecc.CostCenterID, _dEffectDate); // dTJVInfo.Rows.Add(oDR); // } // } // } // foreach (DataRow source in oSalarySheets.Tables[3].Rows) // { // SalaryMonthly osalary = null; // if (nLocID == null) // osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString()); // else // osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString() && x.LocationID == nLocID); // if (osalary != null) // { // foreach (SalaryEmpCostCenter ecc in osalary.CostCentersInvolments) // { // if (ecc.Percentage == 0) continue; // oDR = dTJVInfo.NewRow(); // this.CopySS(oDR, source, osalary, oLocations, oCostCenters, ecc.Percentage, ecc.CostCenterID, _dEffectDate); // dTJVInfo.Rows.Add(oDR); // } // } // } // foreach (DataRow source in oSalarySheets.Tables[4].Rows) // { // SalaryMonthly osalary = null; // if (nLocID == null) // osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString()); // else // osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString() && x.LocationID == nLocID); // if (osalary != null) // { // foreach (SalaryEmpCostCenter ecc in osalary.CostCentersInvolments) // { // if (ecc.Percentage == 0) continue; // oDR = dTJVInfo.NewRow(); // this.CopySS(oDR, source, osalary, oLocations, oCostCenters, ecc.Percentage, ecc.CostCenterID, _dEffectDate); // dTJVInfo.Rows.Add(oDR); // } // } // } // foreach (DataRow source in oSalarySheets.Tables[5].Rows) // { // SalaryMonthly osalary = null; // if (nLocID == null) // osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString()); // else // osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString() && x.LocationID == nLocID); // if (osalary != null) // { // foreach (SalaryEmpCostCenter ecc in osalary.CostCentersInvolments) // { // if (ecc.Percentage == 0) continue; // oDR = dTJVInfo.NewRow(); // this.CopySS(oDR, source, osalary, oLocations, oCostCenters, ecc.Percentage, ecc.CostCenterID, _dEffectDate); // dTJVInfo.Rows.Add(oDR); // } // } // } // foreach (DataRow source in oSalarySheets.Tables[6].Rows) // { // SalaryMonthly osalary = null; // if (nLocID == null) // osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString()); // else // osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString() && x.LocationID == nLocID); // if (osalary != null) // { // foreach (SalaryEmpCostCenter ecc in osalary.CostCentersInvolments) // { // if (ecc.Percentage == 0) continue; // oDR = dTJVInfo.NewRow(); // this.CopySS(oDR, source, osalary, oLocations, oCostCenters, ecc.Percentage, ecc.CostCenterID, _dEffectDate); // dTJVInfo.Rows.Add(oDR); // } // } // } // foreach (DataRow source in oSalarySheets.Tables[7].Rows) // { // SalaryMonthly osalary = null; // if (nLocID == null) // osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString()); // else // osalary = salaries.Find(x => x.Employee.EmployeeNo == source["EMPLOYEENO"].ToString() && x.LocationID == nLocID); // if (osalary != null) // { // foreach (SalaryEmpCostCenter ecc in osalary.CostCentersInvolments) // { // if (ecc.Percentage == 0) continue; // oDR = dTJVInfo.NewRow(); // this.CopySS(oDR, source, osalary, oLocations, oCostCenters, ecc.Percentage, ecc.CostCenterID, _dEffectDate); // dTJVInfo.Rows.Add(oDR); // } // } // } // //foreach(Location oLocation in oLocations) // //{ // // foreach(Costcenter oCC in oCostCenters) // // { // // foreach (JVSetup osetup in oJVSetups) // // { // // foreach (SalaryMonthly osalary in salaries) // // { // // if (osalary.LocationID == oLocation.ID) // // { // // double percent = SalaryEmpCostCenter.InvolvedPercent(osalary.CostCentersInvolments, oCC.ID); // // if (percent == 0) continue; // // dr = dTJVInfo.NewRow(); // // dr["Location"] = oLocation.Name; // // dr["CostCenter"] = oCC.Name; // // dr["EmpNo"] = osalary.Employee.EmployeeNo; // // dr["Name"] = osalary.Employee.Name; // // dr["Description"] = osetup.Description; // // dr["Amount"] = osetup.GetAmount(osalary) * percent/100; // // dr["JVMonth"] = dEffectDate; // // dTJVInfo.Rows.Add(dr); // // } // // } // // } // // } // //} // DataView dv = dTJVInfo.DefaultView; // dv.Sort = "Tier,CostCenterCode,Description"; // DataTable sortedDT = dv.ToTable(); // return sortedDT; //} public byte[] showJVSalaryDetailEmployeeWReport(int JVTypeID, DateTime dEffectDate, int? nLocID, int payrollTypeID, string reportType) { ReportProcessor reportProcessor = new ReportProcessor(); string RDLCName = null; DataSet ds = new DataSet(); DataTable dt = this.JVSalaryDetail(JVTypeID, dEffectDate, payrollTypeID); dt.TableName = "PayrollDataSet_JVSalaryDetail"; ds.Tables.Add(dt); List _parameters = null; RDLCName = "JVSalaryDetail.rdlc"; return reportProcessor.CommonReportViewForReports(null, ds, null, RDLCName, _parameters, true, payrollTypeID, reportType); //return reportProcessor.CommonReportView(null, RDLCName, ds, dsSub, _parameters, true, payrollTypeID, reportType); } public DataTable JVSalaryDetail(int JVTypeID, DateTime dEffectDate, int payrolltypeId) { int count = 1; _dEffectDate = dEffectDate; DataRow dr = null; PayrollDataSet.PayrollDataSet.JVSalaryDetailDataTable dTJVSDetail = new PayrollDataSet.PayrollDataSet.JVSalaryDetailDataTable(); JVSetup osetp = new JVSetup(); DateTime maxdate = new JVSetupService().GetMaxDate(_dEffectDate, payrolltypeId); List oJVSetups = new List(); oJVSetups = new JVSetupService().GetByJVTypeAndEffectDate(JVTypeID, maxdate); //int nLocationTire = ConfigurationManager.GetIntValue("Location", "tier", EnumConfigurationType.Logic); int nLocationTire = new SystemConfigarationService().GetconfigIntValue(EnumConfigurationType.Logic, "Location", "tier"); List oLocations = new List(); oLocations = new LocationService().GetByTier(2); // get the last tier data and last tier is defined in Logic configuration file //int nCCTire = new SystemConfigarationService().GetconfigIntValue(EnumConfigurationType.Logic, "costcenter", "tier"); int nCCTire = new SystemConfigarationService().GetconfigIntValue(EnumConfigurationType.Logic, "costcenter", "tier"); List oCostCenters = new List(); oCostCenters = new CostcenterService().GetByTire(nCCTire, payrolltypeId); // get the last tier data and last tier is defined in Logic configuration file List salaries = new SalaryMonthlyService().Get(GlobalFunctions.LastDateOfMonth(dEffectDate), payrolltypeId); List oJVSetupDetail = new JVSetupDetailService().Get(); foreach (SalaryMonthly item in salaries) { item.Employee = new EmployeeService().Get(item.EmployeeID); foreach (JVSetup osetup in oJVSetups) { //List oJVSetupDetail = new JVSetupDetailService().GetByJVSetup(osetup.ID); JVSetupDetail itemDetail = oJVSetupDetail.Find(x=> x.JVSetupID == osetup.ID); dr = dTJVSDetail.NewRow(); dr["SLNo"] = count; dr["EmpNo"] = item.Employee.EmployeeNo; dr["Name"] = item.Employee.Name; dr["Description"] = osetup.Description; //dr["Amount"] = new JVSetupService().GetAmount(item, oJVSetupDetail); dr["Amount"] = this.GetAmount(item, itemDetail); dr["JVMonth"] = dEffectDate; dTJVSDetail.Rows.Add(dr); } count++; } return dTJVSDetail; } public double GetAmount(SalaryMonthly salary, JVSetupDetail oItem) { double nAmount = 0; //foreach (JVSetupDetail oItem in JVSetupDetails) //{ switch (oItem.JVItemType) { case enumPayrollComponentType.Basic_salary: nAmount = nAmount + new SalaryMonthlyService().GetGrossAmount(EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary, salary.Details); break; case enumPayrollComponentType.Allowance: nAmount = nAmount + new SalaryMonthlyService().GetGrossAmount(EnumSalaryItemCode.Allowance, oItem.ItemID, salary.Details); break; case enumPayrollComponentType.Deduction: nAmount = nAmount + new SalaryMonthlyService().GetDeductAmount(EnumSalaryItemCode.Deduction, oItem.ItemID, salary.Details); break; case enumPayrollComponentType.Over_Time: nAmount = nAmount + new SalaryMonthlyService().GetGrossAmount(EnumSalaryItemCode.Over_Time_Amount, oItem.ItemID, salary.Details); break; case enumPayrollComponentType.Bonus: nAmount = nAmount + new SalaryMonthlyService().GetGrossAmount(EnumSalaryItemCode.Bonus, oItem.ItemID, salary.Details); break; case enumPayrollComponentType.Loan: nAmount = nAmount + this.GetAmountValue(EnumSalaryGroup.Deductions, EnumSalaryItemCode.Loan_Monthly_Installment, oItem.ItemID, salary.Details); break; case enumPayrollComponentType.PF: nAmount = nAmount + this.GetAmountValue(EnumSalaryGroup.Deductions, EnumSalaryItemCode.PF_Contribution, (int)EnumSalaryItemCode.PF_Contribution, salary.Details); break; case enumPayrollComponentType.Gratuity: //nAmount = nAmount + new SalaryMonthlyService().GetAmount(EnumSalaryGroup.Deductions, EnumSalaryItemCode., oItem.ItemID); break; case enumPayrollComponentType.IncomeTax: nAmount = nAmount + this.GetAmountValue(EnumSalaryGroup.Deductions, EnumSalaryItemCode.Inc_Tax_Deduction, (int)EnumSalaryItemCode.Inc_Tax_Deduction, salary.Details); break; case enumPayrollComponentType.Net_pay: if (salary.BranchID != null && oItem.ItemID == salary.BranchID) nAmount = nAmount + this.GetAmountValue(EnumSalaryGroup.OtherItem, EnumSalaryItemCode.Net_Payable, (int)EnumSalaryItemCode.Net_Payable, salary.Details); break; case enumPayrollComponentType.OPI: nAmount = nAmount + this.GetAmountValue(EnumSalaryGroup.OtherItem, EnumSalaryItemCode.OPI, oItem.ItemID, salary.Details); break; case enumPayrollComponentType.Final_settlement: break; default: break; } //} return nAmount; } public double GetAmountValue(EnumSalaryGroup groupcode, EnumSalaryItemCode itemCode, int itemId, List Details) { double amount = 0; foreach (SalaryMonthlyDetail item in Details) { if (item.ItemCode == itemCode && item.itemGroupCode == groupcode && item.ItemID == itemId) amount = amount + item.ChangedAmount; } return amount; } #region Old //DateTime _dEffectDate; //private ReportSetup _selectedParameter; //public ReportSetup SelectedParameter //{ // set // { // _selectedParameter = value; // } //} //public rptJV() //{ //} //public DataTable JVSalaryDetail(ID JVTypeID, DateTime dEffectDate) //{ // int count = 1; // _dEffectDate = dEffectDate; // DataRow dr = null; // PayrollDataSet.PayrollDataSet.JVSalaryDetailDataTable dTJVSDetail = new Payroll.Report.PayrollDataSet.PayrollDataSet.JVSalaryDetailDataTable(); // JVSetup osetp = new JVSetup(); // DateTime maxdate = osetp.GetMaxDate(_dEffectDate); // List oJVSetups = new List(); // oJVSetups = JVSetup.GetByJVTypeAndEffectDate(JVTypeID, maxdate); // int nLocationTire = ConfigurationManager.GetIntValue("Location", "tier", EnumConfigurationType.Logic); // List oLocations = new List(); // oLocations = Location.GetByTier(2); // get the last tier data and last tier is defined in Logic configuration file // int nCCTire = ConfigurationManager.GetIntValue("costcenter", "tier", EnumConfigurationType.Logic); // List oCostCenters = new List(); // oCostCenters = Costcenter.GetByTire(nCCTire); // get the last tier data and last tier is defined in Logic configuration file // List salaries = SalaryMonthly.Get(GlobalFunctions.LastDateOfMonth(dEffectDate)); // foreach (SalaryMonthly item in salaries) // { // foreach (JVSetup osetup in oJVSetups) // { // dr = dTJVSDetail.NewRow(); // dr["SLNo"] = count; // dr["EmpNo"] = item.Employee.EmployeeNo; // dr["Name"] = item.Employee.Name; // dr["Description"] = osetup.Description; // dr["Amount"] = osetup.GetAmount(item); // dr["JVMonth"] = dEffectDate; // dTJVSDetail.Rows.Add(dr); // } // count++; // } // return dTJVSDetail; //} //public DataSet MemorandumSalaryDetail(ID JVTypeID, DateTime dEffectDate, int nEmpID) //{ // DataSet oDS = new DataSet(); // _dEffectDate = dEffectDate; // DataRow drDebit = null; // DataRow drCredit = null; // PayrollDataSet.PayrollDataSet.MemoDebitDataTable dTMemoDebit = new Payroll.Report.PayrollDataSet.PayrollDataSet.MemoDebitDataTable(); // PayrollDataSet.PayrollDataSet.MemoCreditDataTable dTMemoCredit = new Payroll.Report.PayrollDataSet.PayrollDataSet.MemoCreditDataTable(); // string sEmpID = Convert.ToString(nEmpID); // JVSetup osetp = new JVSetup(); // DateTime maxdate = osetp.GetMaxDate(_dEffectDate); // List oJVSetups = new List(); // oJVSetups = JVSetup.GetByJVTypeAndEffectDate(JVTypeID, maxdate); // //sEmpID, // List salaries = SalaryMonthly.Get(GlobalFunctions.LastDateOfMonth(dEffectDate)); // string sFGLCode = ""; // double dFAmount = 0.0; // List oJVSetupDebits = new List(); // List oJVSetupCredits = new List(); // foreach (JVSetup oJVItem in oJVSetups) // { // if (oJVItem.Side == (int)EnumTranSide.Debit) // { // oJVSetupDebits.Add(oJVItem); // } // else if (oJVItem.Side == (int)EnumTranSide.Credit) // { // oJVSetupCredits.Add(oJVItem); // } // } // double ItemDebitHeadAmount = 0.0; // foreach (JVSetup oJVDebit in oJVSetupDebits) // { // ItemDebitHeadAmount = 0.0; // if (oJVDebit.ID == 1) // { // sFGLCode = oJVDebit.GLCode; // } // drDebit = dTMemoDebit.NewRow(); // drDebit["DDescription"] = oJVDebit.Description; // drDebit["DAccount"] = oJVDebit.GLCode; // drDebit["FGLDes"] = sFGLCode; // foreach (SalaryMonthly oSM in salaries) // { // //if (oJVDebit.ID == 1) // // dFAmount = oJVDebit.GetAmount(oSM); // ItemDebitHeadAmount += oJVDebit.GetAmount(oSM, oJVDebit.JVSetupDetails); // } // if (oJVDebit.ID == 1) // drDebit["FGLAmount"] = Convert.ToString(ItemDebitHeadAmount); // drDebit["DAmount"] = ItemDebitHeadAmount; // dTMemoDebit.Rows.Add(drDebit); // } // double ItemCreditHeadAmount = 0.0; // foreach (JVSetup oJVCredit in oJVSetupCredits) // { // ItemCreditHeadAmount = 0.0; // drCredit = dTMemoCredit.NewRow(); // //drCredit = dTMemoCredit.NewRow(); // drCredit["CDescription"] = oJVCredit.Description; // drCredit["CAccount"] = oJVCredit.GLCode; // foreach (SalaryMonthly oSM in salaries) // { // ItemCreditHeadAmount += oJVCredit.GetAmount(oSM, oJVCredit.JVSetupDetails); // } // drCredit["CAmount"] = ItemCreditHeadAmount; // dTMemoCredit.Rows.Add(drCredit); // } // //foreach (SalaryMonthly item in salaries) // //{ // // foreach (JVSetup osetup in oJVSetups) // // { // // if(osetup.ID==1) // // { // // sFGLCode = osetup.GLCode; // // dFAmount = osetup.GetAmount(item); // // } // // if(osetup.Side==(int)EnumTranSide.Debit) // // { // // drDebit = dTMemoDebit.NewRow(); // // drDebit["DDescription"] = osetup.Description; // // drDebit["DAccount"] = osetup.GLCode; // // drDebit["DAmount"] = osetup.GetAmount(item); // // drDebit["FGLDes"] = sFGLCode; // // drDebit["FGLAmount"] = Convert.ToString(dFAmount); // // dTMemoDebit.Rows.Add(drDebit); // // } // // else if (osetup.Side == (int)EnumTranSide.Credit) // // { // // drCredit = dTMemoCredit.NewRow(); // // drCredit["CDescription"] = osetup.Description; // // drCredit["CAccount"] = osetup.GLCode; // // drCredit["CAmount"] = osetup.GetAmount(item); // // dTMemoCredit.Rows.Add(drCredit); // // } // // } // // count++; // //} // DolarRate oDRate = new DolarRate(); // oDRate = oDRate.Get(GlobalFunctions.LastDateOfMonth(_dEffectDate)); // if (oDRate != null) // { // drDebit = dTMemoDebit.NewRow(); // drDebit["DDescription"] = oDRate.DDescription; // drDebit["DAccount"] = oDRate.DAccountNo; // drDebit["DAmount"] = (oDRate.Amount * oDRate.Rate); // dTMemoDebit.Rows.Add(drDebit); // drCredit = dTMemoCredit.NewRow(); // drCredit["CDescription"] = oDRate.DDescription; // drCredit["CAccount"] = oDRate.DAccountNo; // drCredit["CAmount"] = (oDRate.Amount * oDRate.Rate); // dTMemoCredit.Rows.Add(drCredit); // } // dTMemoDebit.TableName = "PayrollDataSet_MemoDebit"; // dTMemoCredit.TableName = "PayrollDataSet_MemoCredit"; // oDS.Tables.Add(dTMemoDebit); // oDS.Tables.Add(dTMemoCredit); // return oDS; //} //public DataTable JVReport(ID JVTypeID, DateTime dEffectDate) //{ // _dEffectDate = dEffectDate; // DataRow dr = null; // double nAmount = 0.0; // PayrollDataSet.PayrollDataSet.JVReportDataTable dTJVInfo = new Payroll.Report.PayrollDataSet.PayrollDataSet.JVReportDataTable(); // JVSetup osetp = new JVSetup(); // DateTime maxdate = osetp.GetMaxDate(_dEffectDate); // List oJVSetups = new List(); // oJVSetups = JVSetup.GetByJVTypeAndEffectDate(JVTypeID, maxdate); // List oJVSetupDetails = new List(); // int nLocationTire = ConfigurationManager.GetIntValue("Location", "tier", EnumConfigurationType.Logic); // List oLocations = new List(); // oLocations = Location.GetByTier(2); // get the last tier data and last tier is defined in Logic configuration file // int nCCTire = ConfigurationManager.GetIntValue("costcenter", "tier", EnumConfigurationType.Logic); // List oCostCenters = new List(); // oCostCenters = Costcenter.GetByTire(nCCTire); // get the last tier data and last tier is defined in Logic configuration file // List salaries = SalaryMonthly.Get(dEffectDate); // foreach (JVSetup oJVSetup in oJVSetups) // { // foreach (Costcenter oCC in oCostCenters) // { // foreach (Location oLocation in oLocations) // { // nAmount = 0.0; // nAmount = GetSalaries(oLocation.ID, oCC.ID, salaries, oJVSetup); // if (nAmount == 0) continue; // oJVSetupDetails = JVSetupDetail.GetByJVSetup(oJVSetup.ID); // dr = dTJVInfo.NewRow(); // dr["GLCode"] = oJVSetup.GLCode; // dr["GLDescription"] = oJVSetup.Description; // dr["JType"] = "GJ"; // dr["JSource"] = "MA"; // dr["Reference"] = "110001"; // dr["JVDate"] = dEffectDate.ToString("dd MMM yyyy"); // if (oJVSetup.Side == (int)EnumTranSide.Debit) // { // dr["JVTranType"] = "D"; // } // else if (oJVSetup.Side == (int)EnumTranSide.Credit) // { // dr["JVTranType"] = "C"; // } // dr["Amount"] = GlobalFunctions.Round(nAmount); // dr["Period"] = dEffectDate.ToString("dd MMM yyyy"); // if (oCC.Parent.Code == "106X") // { // dr["T5"] = oCC.Code; // } // else // { // dr["T5"] = "XX"; // } // dr["CostCenter"] = oCC.Parent.Code; // dr["Location"] = oLocation.Code; // dTJVInfo.Rows.Add(dr); // } // } // } // return dTJVInfo; //} //public DataTable JVLoactionWReport(ID JVTypeID, DateTime dEffectDate) //{ // _dEffectDate = dEffectDate; // DataRow dr = null; // //PayrollDataSet.PayrollDataSet.JVLoactionWReportDataTable dTJVInfo = new Payroll.Report.PayrollDataSet.PayrollDataSet.JVLoactionWReportDataTable(); // PayrollDataSet.PayrollDataSet.JVReportDataTable dTJVInfo = new Payroll.Report.PayrollDataSet.PayrollDataSet.JVReportDataTable(); // JVSetup osetp = new JVSetup(); // DateTime maxdate = osetp.GetMaxDate(_dEffectDate); // List oJVSetups = new List(); // oJVSetups = JVSetup.GetByJVTypeAndEffectDate(JVTypeID, maxdate); // int nLocationTire = ConfigurationManager.GetIntValue("Location", "tier", EnumConfigurationType.Logic); // List oLocations = new List(); // oLocations = Location.GetByTier(1); // get the last tier data and last tier is defined in Logic configuration file // int nCCTire = ConfigurationManager.GetIntValue("costcenter", "tier", EnumConfigurationType.Logic); // List oCostCenters = new List(); // // oCostCenters = Costcenter.GetByTire(nCCTire); // get the last tier data and last tier is defined in Logic configuration file // oCostCenters = Costcenter.Get(); // List bonusprocesss = new List(); // List salaries = new List(); // List opidetails = new List(); // List opis = new List(); // OPIProcessDetail opidetail = null; // if (JVTypeID == 2) // { // // bonusprocesss = BonusProcess.GetBonusDetails(GlobalFunctions.LastDateOfMonth(dEffectDate)); // } // else if (JVTypeID == 1) // { // salaries = SalaryMonthly.Get(GlobalFunctions.LastDateOfMonth(dEffectDate)); // opidetails = OPIProcess.GetProcessDetails(GlobalFunctions.LastDateOfMonth(dEffectDate)); // opis = OPIProcess.GetOPiProcessItems(GlobalFunctions.LastDateOfMonth(dEffectDate)); // } // List epmCostCenters = EmployeeCostCenter.Get(); // string preCCCode = ""; // ID preOsetupID = null; // string spPreCCCode = ""; // ID SpPreOsetupID = null; // double nAmount = 0.0; // string ccc = ""; // Costcenter cc = null; // Costcenter cc2 = null; // List SalaryOfMonth = null; // List oEmps = Employee.Get(); // Employee oEmp = null; // foreach (JVSetup osetup in oJVSetups) // { // if (osetup.ShowCC) //CC wise Sum ? // { // foreach (Costcenter oCC in oCostCenters) // { // cc2 = null; // ccc = ""; // cc = oCostCenters.FirstOrDefault(o => o.ID == oCC.ParentID); // if (cc != null) // { // cc2 = (oCostCenters.FirstOrDefault(x => x.ID == cc.ParentID)); // } // if (cc2 != null) // { // ccc = cc2.Code; // } // foreach (SalaryMonthly osalary in salaries) // { // oEmp = null; // if (osetup.EMPLOYEETYPE == EnumJVEmpType.Expat || osetup.EMPLOYEETYPE == EnumJVEmpType.Local) // { // oEmp = oEmps.FirstOrDefault(o => o.ID == osalary.EmployeeID); // } // if ((osetup.EMPLOYEETYPE == EnumJVEmpType.Expat && oEmp != null && oEmp.ForeignExPat) || (osetup.EMPLOYEETYPE == EnumJVEmpType.Local && oEmp != null && !oEmp.ForeignExPat) || osetup.EMPLOYEETYPE == EnumJVEmpType.RegardLess) // { // SalaryOfMonth = new List(); // SalaryOfMonth.Add(osalary); // if (preCCCode != oCC.Code) // { // if (dr != null && nAmount != 0) // { // dTJVInfo.Rows.Add(dr); // } // dr = null; // nAmount = 0.0; // preOsetupID = osetup.ID; // preCCCode = oCC.Code; // dr = dTJVInfo.NewRow(); // //dr["Location"] = oLocation.Name; // if (3 < ccc.Length) // ccc = ccc.Substring(ccc.Length - 3); // if (ccc == "WBS") // { // dr["WBS"] = oCC.Code; // } // else // { // dr["CostCenter"] = oCC.Code; // } // dr["JVDate"] = dEffectDate; // } // nAmount = nAmount + GetSalaries(null, oCC.ID, SalaryOfMonth, osetup); // //if (nAmount == 0) continue; // dr["GLDescription"] = osetup.Description + " " + dEffectDate.ToString("MM-yyyy"); // dr["GLCode"] = osetup.GLCode; // dr["JVTranType"] = osetup.SideCode; // dr["Amount"] = nAmount; // } // } // foreach (OPIProcessDetailItem opi in opis) // { // oEmp = null; // if (osetup.EMPLOYEETYPE == EnumJVEmpType.Expat || osetup.EMPLOYEETYPE == EnumJVEmpType.Local) // { // opidetail = opidetails.FirstOrDefault(o => o.ID == opi.OPIProcessDetailID); // if (opidetail != null) // oEmp = oEmps.FirstOrDefault(o => o.ID == opidetail.EmployeeID); // } // if ((osetup.EMPLOYEETYPE == EnumJVEmpType.Expat && oEmp != null && oEmp.ForeignExPat) || (osetup.EMPLOYEETYPE == EnumJVEmpType.Local && oEmp != null && !oEmp.ForeignExPat) || osetup.EMPLOYEETYPE == EnumJVEmpType.RegardLess) // { // if (osetup.JVSetupCC.Any(o => o.CCID == oCC.ID)) // { // if (spPreCCCode != oCC.Code || osetup.ID != SpPreOsetupID) // { // if (dr != null && nAmount != 0) // { // dTJVInfo.Rows.Add(dr); // } // dr = null; // nAmount = 0.0; // SpPreOsetupID = osetup.ID; // spPreCCCode = oCC.Code; // dr = dTJVInfo.NewRow(); // //dr["Location"] = oLocation.Name; // if (3 < ccc.Length) // ccc = ccc.Substring(ccc.Length - 3); // if (ccc == "WBS") // { // dr["WBS"] = oCC.Code; // } // else // { // dr["CostCenter"] = oCC.Code; // } // dr["JVDate"] = dEffectDate; // } // nAmount = nAmount + GetOPIs(null, oCC.ID, opidetails, opi, epmCostCenters, osetup); // //if (nAmount == 0) continue; // dr["GLDescription"] = osetup.Description + " " + dEffectDate.ToString("MM-yyyy"); // dr["GLCode"] = osetup.GLCode; // dr["JVTranType"] = osetup.SideCode; // dr["Amount"] = nAmount; // } // } // } // foreach (BonusProcess.BonusProcessDetail bpro in bonusprocesss) // { // oEmp = null; // if (osetup.EMPLOYEETYPE == EnumJVEmpType.Expat || osetup.EMPLOYEETYPE == EnumJVEmpType.Local) // { // oEmp = oEmps.FirstOrDefault(o => o.ID == bpro.EmployeeID); // } // if ((osetup.EMPLOYEETYPE == EnumJVEmpType.Expat && oEmp != null && oEmp.ForeignExPat) || (osetup.EMPLOYEETYPE == EnumJVEmpType.Local && oEmp != null && !oEmp.ForeignExPat) || osetup.EMPLOYEETYPE == EnumJVEmpType.RegardLess) // { // if (osetup.JVSetupCC.Any(o => o.CCID == oCC.ID)) // { // if (spPreCCCode != oCC.Code || osetup.ID != SpPreOsetupID) // { // if (dr != null && nAmount != 0) // { // dTJVInfo.Rows.Add(dr); // } // dr = null; // nAmount = 0.0; // SpPreOsetupID = osetup.ID; // spPreCCCode = oCC.Code; // dr = dTJVInfo.NewRow(); // //dr["Location"] = oLocation.Name; // if (3 < ccc.Length) // ccc = ccc.Substring(ccc.Length - 3); // if (ccc == "WBS") // { // dr["WBS"] = oCC.Code; // } // else // { // dr["CostCenter"] = oCC.Code; // } // dr["JVDate"] = dEffectDate; // } // nAmount = nAmount + GetBonuses(null, oCC.ID, bpro, epmCostCenters); // //if (nAmount == 0) continue; // dr["GLDescription"] = osetup.Description + " " + dEffectDate.ToString("MM-yyyy"); // dr["GLCode"] = osetup.GLCode; // dr["JVTranType"] = osetup.SideCode; // dr["Amount"] = nAmount; // } // } // } // } // } // else if (osetup.BookToCC) //IsSpecificCost ? // { // foreach (Costcenter oCC in oCostCenters) // { // cc2 = null; // ccc = ""; // cc = oCostCenters.FirstOrDefault(o => o.ID == oCC.ParentID); // if (cc != null) // { // cc2 = (oCostCenters.FirstOrDefault(x => x.ID == cc.ParentID)); // } // if (cc2 != null) // { // ccc = cc2.Code; // } // foreach (SalaryMonthly osalary in salaries) // { // oEmp = null; // if (osetup.EMPLOYEETYPE == EnumJVEmpType.Expat || osetup.EMPLOYEETYPE == EnumJVEmpType.Local) // { // oEmp = oEmps.FirstOrDefault(o => o.ID == osalary.EmployeeID); // } // if ((osetup.EMPLOYEETYPE == EnumJVEmpType.Expat && oEmp != null && oEmp.ForeignExPat) || (osetup.EMPLOYEETYPE == EnumJVEmpType.Local && oEmp != null && !oEmp.ForeignExPat) || osetup.EMPLOYEETYPE == EnumJVEmpType.RegardLess) // { // SalaryOfMonth = new List(); // SalaryOfMonth.Add(osalary); // if (osetup.JVSetupCC.Any(o => o.CCID == oCC.ID)) // { // if (spPreCCCode != oCC.Code || osetup.ID != SpPreOsetupID) // { // if (dr != null && nAmount != 0) // { // dTJVInfo.Rows.Add(dr); // } // dr = null; // nAmount = 0.0; // SpPreOsetupID = osetup.ID; // spPreCCCode = oCC.Code; // dr = dTJVInfo.NewRow(); // //dr["Location"] = oLocation.Name; // if (3 < ccc.Length) // ccc = ccc.Substring(ccc.Length - 3); // if (ccc == "WBS") // { // dr["WBS"] = oCC.Code; // } // else // { // dr["CostCenter"] = oCC.Code; // } // dr["JVDate"] = dEffectDate; // } // nAmount = nAmount + GetSalaries(null, oCC.ID, SalaryOfMonth, osetup); // //if (nAmount == 0) continue; // dr["GLDescription"] = osetup.Description + " " + dEffectDate.ToString("MM-yyyy"); // dr["GLCode"] = osetup.GLCode; // dr["JVTranType"] = osetup.SideCode; // dr["Amount"] = nAmount; // } // } // } // foreach (OPIProcessDetailItem opi in opis) // { // oEmp = null; // if (osetup.EMPLOYEETYPE == EnumJVEmpType.Expat || osetup.EMPLOYEETYPE == EnumJVEmpType.Local) // { // opidetail = opidetails.FirstOrDefault(o => o.ID == opi.OPIProcessDetailID); // if (opidetail != null) // oEmp = oEmps.FirstOrDefault(o => o.ID == opidetail.EmployeeID); // } // if ((osetup.EMPLOYEETYPE == EnumJVEmpType.Expat && oEmp != null && oEmp.ForeignExPat) || (osetup.EMPLOYEETYPE == EnumJVEmpType.Local && oEmp != null && !oEmp.ForeignExPat) || osetup.EMPLOYEETYPE == EnumJVEmpType.RegardLess) // { // if (osetup.JVSetupCC.Any(o => o.CCID == oCC.ID)) // { // if (spPreCCCode != oCC.Code || osetup.ID != SpPreOsetupID) // { // if (dr != null && nAmount != 0) // { // dTJVInfo.Rows.Add(dr); // } // dr = null; // nAmount = 0.0; // SpPreOsetupID = osetup.ID; // spPreCCCode = oCC.Code; // dr = dTJVInfo.NewRow(); // //dr["Location"] = oLocation.Name; // if (3 < ccc.Length) // ccc = ccc.Substring(ccc.Length - 3); // if (ccc == "WBS") // { // dr["WBS"] = oCC.Code; // } // else // { // dr["CostCenter"] = oCC.Code; // } // dr["JVDate"] = dEffectDate; // } // nAmount = nAmount + GetOPIs(null, oCC.ID, opidetails, opi, epmCostCenters, osetup); // //if (nAmount == 0) continue; // dr["GLDescription"] = osetup.Description + " " + dEffectDate.ToString("MM-yyyy"); // dr["GLCode"] = osetup.GLCode; // dr["JVTranType"] = osetup.SideCode; // dr["Amount"] = nAmount; // } // } // } // foreach (BonusProcess.BonusProcessDetail bpro in bonusprocesss) // { // oEmp = null; // if (osetup.EMPLOYEETYPE == EnumJVEmpType.Expat || osetup.EMPLOYEETYPE == EnumJVEmpType.Local) // { // oEmp = oEmps.FirstOrDefault(o => o.ID == bpro.EmployeeID); // } // if ((osetup.EMPLOYEETYPE == EnumJVEmpType.Expat && oEmp != null && oEmp.ForeignExPat) || (osetup.EMPLOYEETYPE == EnumJVEmpType.Local && oEmp != null && !oEmp.ForeignExPat) || osetup.EMPLOYEETYPE == EnumJVEmpType.RegardLess) // { // if (osetup.JVSetupCC.Any(o => o.CCID == oCC.ID)) // { // if (spPreCCCode != oCC.Code || osetup.ID != SpPreOsetupID) // { // if (dr != null && nAmount != 0) // { // dTJVInfo.Rows.Add(dr); // } // dr = null; // nAmount = 0.0; // SpPreOsetupID = osetup.ID; // spPreCCCode = oCC.Code; // dr = dTJVInfo.NewRow(); // //dr["Location"] = oLocation.Name; // if (3 < ccc.Length) // ccc = ccc.Substring(ccc.Length - 3); // if (ccc == "WBS") // { // dr["WBS"] = oCC.Code; // } // else // { // dr["CostCenter"] = oCC.Code; // } // dr["JVDate"] = dEffectDate; // } // nAmount = nAmount + GetBonuses(null, oCC.ID, bpro, epmCostCenters); // //if (nAmount == 0) continue; // dr["GLDescription"] = osetup.Description + " " + dEffectDate.ToString("MM-yyyy"); // dr["GLCode"] = osetup.GLCode; // dr["JVTranType"] = osetup.SideCode; // dr["Amount"] = nAmount; // } // } // } // } // } // else // { // //double percent = SalaryEmpCostCenter.InvolvedPercent(osalary.CostCentersInvolments, oCC.ID); // //if (percent == 0) continue; // nAmount = 0.0; // foreach (SalaryMonthly osalary in salaries) // { // oEmp = null; // if (osetup.EMPLOYEETYPE == EnumJVEmpType.Expat || osetup.EMPLOYEETYPE == EnumJVEmpType.Local) // { // oEmp = oEmps.FirstOrDefault(o => o.ID == osalary.EmployeeID); // } // if ((osetup.EMPLOYEETYPE == EnumJVEmpType.Expat && oEmp != null && oEmp.ForeignExPat) || (osetup.EMPLOYEETYPE == EnumJVEmpType.Local && oEmp != null && !oEmp.ForeignExPat) || osetup.EMPLOYEETYPE == EnumJVEmpType.RegardLess) // { // nAmount = nAmount + osetup.GetAmount(osalary); // } // }//GetSalaries(null, oCC.ID, SalaryOfMonth, osetup); // foreach (OPIProcessDetailItem opi in opis) // { // foreach (JVSetupDetail item in osetup.JVSetupDetails) // { // if (item.JVItemType == enumPayrollComponentType.OPI && item.ItemID == opi.OPIItemID) // { // // List salaries = new List(); // //double Percent = 0; // // OPIProcessDetail // //OPIProcessDetail opidetail = opidetails.FirstOrDefault(o => o.ID == opi.OPIProcessDetailID); // //EmployeeCostCenter empC = epmCostCenters.FirstOrDefault(o => o.EmployeeID == opidetail.EmployeeID && o.CostCenterID == CrgID); // //Percent = empC != null ? empC.Percentage : 0; // //if (Percent != 0) // oEmp = null; // if (osetup.EMPLOYEETYPE == EnumJVEmpType.Expat || osetup.EMPLOYEETYPE == EnumJVEmpType.Local) // { // opidetail = opidetails.FirstOrDefault(o => o.ID == opi.OPIProcessDetailID); // if (opidetail != null) // oEmp = oEmps.FirstOrDefault(o => o.ID == opidetail.EmployeeID); // } // if ((osetup.EMPLOYEETYPE == EnumJVEmpType.Expat && oEmp != null && oEmp.ForeignExPat) || (osetup.EMPLOYEETYPE == EnumJVEmpType.Local && oEmp != null && !oEmp.ForeignExPat) || osetup.EMPLOYEETYPE == EnumJVEmpType.RegardLess) // { // nAmount = nAmount + (opi.ChangeNetAmount);// * Percent / 100; // //nAmount = nAmount + oPIProcessDetailItem.OPIProcessDetailItems.Sum(o => o.ChangeNetAmount) * Percent / 100; // } // } // } // } // foreach (BonusProcess.BonusProcessDetail bpro in bonusprocesss) // { // oEmp = null; // if (osetup.EMPLOYEETYPE == EnumJVEmpType.Expat || osetup.EMPLOYEETYPE == EnumJVEmpType.Local) // { // oEmp = oEmps.FirstOrDefault(o => o.ID == bpro.EmployeeID); // } // if ((osetup.EMPLOYEETYPE == EnumJVEmpType.Expat && oEmp != null && oEmp.ForeignExPat) || (osetup.EMPLOYEETYPE == EnumJVEmpType.Local && oEmp != null && !oEmp.ForeignExPat) || osetup.EMPLOYEETYPE == EnumJVEmpType.RegardLess) // { // nAmount = nAmount + bpro.BonusAmount; // } // } // if (nAmount == 0) continue; // dr = dTJVInfo.NewRow(); // // dr["Location"] = oLocation.Name; // //if (ccc == "WBS") // //{ // // dr["WBS"] = oCC.Code; // //} // //else // //{ // // dr["CostCenter"] = oCC.Code; // //} // dr["Reference"] = "BDC00L"; // //dr["EmpNo"] = osalary.Employee.EmployeeNo; // //dr["Name"] = osalary.Employee.Name; // dr["GLDescription"] = osetup.Description + " " + dEffectDate.ToString("MM-yyyy"); // dr["Amount"] = nAmount;//osetup.GetAmount(osalary) * percent / 100; // dr["JVDate"] = dEffectDate; // dr["GLCode"] = osetup.GLCode; // dr["JVTranType"] = osetup.SideCode; // dTJVInfo.Rows.Add(dr); // dr = null; // } // if (osetup.ShowCC && dr != null && nAmount != 0) // { // dTJVInfo.Rows.Add(dr); // } // if (osetup.BookToCC && dr != null && nAmount != 0) // { // dTJVInfo.Rows.Add(dr); // } // dr = null; // } // return dTJVInfo; //} //public DataTable JVSummaryReport(ID JVTypeID, DateTime dEffectDate) //{ // _dEffectDate = dEffectDate; // DataRow dr = null; // PayrollDataSet.PayrollDataSet.JVSummaryReportDataTable dTJVInfo = new Payroll.Report.PayrollDataSet.PayrollDataSet.JVSummaryReportDataTable(); // List oJVSetups = new List(); // oJVSetups = JVSetup.GetByJVType(JVTypeID); // int nLocationTire = ConfigurationManager.GetIntValue("Location", "tier", EnumConfigurationType.Logic); // List oLocations = new List(); // oLocations = Location.GetByTier(2); // get the last tier data and last tier is defined in Logic configuration file // int nCCTire = ConfigurationManager.GetIntValue("costcenter", "tier", EnumConfigurationType.Logic); // List oCostCenters = new List(); // oCostCenters = Costcenter.GetByTire(nCCTire); // get the last tier data and last tier is defined in Logic configuration file // List salaries = SalaryMonthly.Get(GlobalFunctions.LastDateOfMonth(dEffectDate)); // foreach (Costcenter oCC in oCostCenters) // { // foreach (Location oLocation in oLocations) // { // foreach (JVSetup osetup in oJVSetups) // { // double amount = GetSalaries(oLocation.ID, oCC.ID, salaries, osetup); // if (amount == 0) continue; // dr = dTJVInfo.NewRow(); // dr["Location"] = oLocation.Name; // dr["CostCenter"] = oCC.Name; // dr["Description"] = osetup.Description; // dr["Amount"] = amount;// GetSalaries(oLocation.ID, oCC.ID, salaries, osetup); // dr["JVMonth"] = dEffectDate; // dTJVInfo.Rows.Add(dr); // } // } // } // return dTJVInfo; //} //public double GetBonuses(ID LocationID, ID CrgID, BonusProcess.BonusProcessDetail oBProcessDetail, List epmCostCenters) //{ // List salaries = new List(); // double nAmount = 0; // double Percent = 0; // // OPIProcessDetail // EmployeeCostCenter empC = epmCostCenters.FirstOrDefault(o => o.EmployeeID == oBProcessDetail.EmployeeID && o.CostCenterID == CrgID); // Percent = empC != null ? empC.Percentage : 0; // if (Percent == 0) return nAmount; // nAmount = nAmount + oBProcessDetail.BonusAmount * Percent / 100; // return nAmount; //} //public double GetOPIs(ID LocationID, ID CrgID, List opidetails, OPIProcessDetailItem oPIProcessDetailItem, List epmCostCenters, JVSetup oSetup) //{ // double nAmount = 0; // foreach (JVSetupDetail item in oSetup.JVSetupDetails) // { // if (item.ItemID == oPIProcessDetailItem.OPIItemID) // { // List salaries = new List(); // double Percent = 0; // // OPIProcessDetail // OPIProcessDetail opidetail = opidetails.FirstOrDefault(o => o.ID == oPIProcessDetailItem.OPIProcessDetailID); // if (opidetail != null) // { // EmployeeCostCenter empC = epmCostCenters.FirstOrDefault(o => o.EmployeeID == opidetail.EmployeeID && o.CostCenterID == CrgID); // Percent = empC != null ? empC.Percentage : 0; // if (Percent == 0) return nAmount; // nAmount = nAmount + (oPIProcessDetailItem.ChangeNetAmount) * Percent / 100; // } // //nAmount = nAmount + oPIProcessDetailItem.OPIProcessDetailItems.Sum(o => o.ChangeNetAmount) * Percent / 100; // } // } // return nAmount; //} //public double GetSalaries(ID LocationID, ID CrgID, List SalaryOfMonth, JVSetup oJvSetup) //{ // List salaries = new List(); // double nAmount = 0; // double Percent = 0; // foreach (SalaryMonthly item in SalaryOfMonth) // { // //if (item.LocationID == LocationID) // //{ // Percent = SalaryEmpCostCenter.InvolvedPercent(item.CostCentersInvolments, CrgID); // if (Percent == 0) continue; // nAmount = nAmount + oJvSetup.GetAmount(item) * Percent / 100; // //} // } // return nAmount; //} //public int GetEmp(ID LocationID, ID CrgID, List SalaryOfMonth, JVSetup oJvSetup) //{ // List salaries = new List(); // double Percent; // foreach (SalaryMonthly item in SalaryOfMonth) // { // if (item.LocationID == LocationID) // { // Percent = SalaryEmpCostCenter.InvolvedPercent(item.CostCentersInvolments, CrgID); // if (Percent > 0) return item.EmployeeID; // } // } // return 0; //} //public static string WriteToTxtFile(string sStringToWrite, string sFilePath, string sFileName) //{ // string sSuccess = string.Empty; // try // { // DirectoryInfo oFileDirectory = new DirectoryInfo(sFilePath); // if (!oFileDirectory.Exists) // { // oFileDirectory.Create(); // } // StreamWriter oSWriter = new StreamWriter(sFilePath + "/" + sFileName + ".txt", false); // oSWriter.WriteLine(sStringToWrite); // sSuccess = "You can find a file named - " + sFileName + " at " + sFilePath; // oSWriter.Flush(); // oSWriter.Close(); // } // catch (Exception ex) // { // throw new ServiceException(ex.Message); // } // return sSuccess; //} #endregion } }