public void OnGet() { Allowances = DicValuesRepo.Where(x => x.ValueType.ValueTypeFor == ValueTypeModules.AllowanceType).ToList(); List <Payrun_Dto> payruns = ObjectMapper.Map <List <Payrun>, List <Payrun_Dto> >(PayrunAppService.Repository.WithDetails().ToList()); ViewData["Payruns_DS"] = JsonSerializer.Serialize(payruns); List <dynamic> payrunSummaryDynamicDS = new List <dynamic>(); for (int i = 0; i < payruns.Count; i++) { dynamic payrunSummaryDDSRow = new ExpandoObject(); payrunSummaryDDSRow.id = payruns[i].Id; List <PayrunDetail_Dto> payrunDetails = payruns[i].PayrunDetails.ToList(); payrunSummaryDDSRow.totalEmployees = payrunDetails.Count; payrunSummaryDDSRow.getBasicSalaries = payrunDetails.Sum(x => x.BasicSalary); foreach (PayrunAllowanceSummary_Dto allowanceSummary in payrunDetails[0].PayrunAllowancesSummaries) { DictionaryValue_Dto allowance = allowanceSummary.AllowanceType; string camelCaseName = allowance.Value; camelCaseName = camelCaseName.Replace(" ", ""); camelCaseName = char.ToLowerInvariant(camelCaseName[0]) + camelCaseName.Substring(1); DynamicHelper.AddProperty(payrunSummaryDDSRow, $"{camelCaseName}_Value", payrunDetails.Sum(x => x.PayrunAllowancesSummaries.Sum(x1 => x1.Value))); } payrunSummaryDDSRow.gosiValue = payrunDetails.Sum(x => x.GOSIAmount); payrunSummaryDDSRow.loansValue = payrunDetails.Sum(x => x.Loan); payrunSummaryDDSRow.leavesValue = payrunDetails.Sum(x => x.Leaves); payrunSummaryDDSRow.grossDeductions = payrunDetails.Sum(x => x.GrossDeductions); payrunSummaryDynamicDS.Add(payrunSummaryDDSRow); } SecondaryDetailsGrid = new Grid() { DataSource = payrunSummaryDynamicDS, QueryCellInfo = "QueryCellInfo", QueryString = "id", EditSettings = new Syncfusion.EJ2.Grids.GridEditSettings() { }, AllowExcelExport = true, //AllowGrouping = true, AllowPdfExport = true, HierarchyPrintMode = HierarchyGridPrintMode.All, AllowSelection = true, AllowFiltering = false, AllowSorting = true, AllowMultiSorting = true, AllowResizing = true, GridLines = GridLine.Both, SearchSettings = new GridSearchSettings() { }, //Toolbar = new List<object>() { "ExcelExport", "CsvExport", "Print", "Search",new { text = "Copy", tooltipText = "Copy", prefixIcon = "e-copy", id = "copy" }, new { text = "Copy With Header", tooltipText = "Copy With Header", prefixIcon = "e-copy", id = "copyHeader" } }, Columns = GetSecondaryGridColumns() }; }
public IActionResult OnGet() { EOSBAllowances = DicValuesRepo.Where(x => x.ValueType.ValueTypeFor == ValueTypeModules.AllowanceType && x.Dimension_1_Value.ToUpper() == "TRUE").ToList(); payrun = ObjectMapper.Map <Payrun, Payrun_Dto>(PayrunAppService.Repository.WithDetails().SingleOrDefault(x => x.Id == payrunId)); Payrun_Dto payrunLast = ObjectMapper.Map <Payrun, Payrun_Dto>(PayrunAppService.Repository.WithDetails().SingleOrDefault(x => x.Month == payrun.Month - 1 && x.Year == payrun.Year)); if (payrun != null) { List <PayrunDetail_Dto> payrunDetails = payrun.PayrunDetails.ToList(); List <dynamic> dynamicDS = new List <dynamic>(); for (int i = 0; i < payrunDetails.Count; i++) { PayrunDetail_Dto curDetail = payrunDetails[i]; if (curDetail.Employee.IndemnityType == null || curDetail.Employee.IndemnityType.Value != "Eligible") { continue; } PayrunDetailIndemnity_Dto employeeIndemnity = null; if (curDetail.Indemnity != null) { employeeIndemnity = curDetail.Indemnity; } else { employeeIndemnity = curDetail.GetIndemnity(); } PayrunDetail_Dto curDetailLast = payrunLast == null ? null : payrunLast.PayrunDetails.FirstOrDefault(x => x.EmployeeId == curDetail.EmployeeId); PayrunDetailIndemnity_Dto employeeIndemnityLast = curDetailLast != null?curDetailLast.GetIndemnity() : null; if (employeeIndemnityLast != null) { employeeIndemnity.LastMonthEOSB = employeeIndemnityLast.TotalEOSB; employeeIndemnity.Difference = employeeIndemnity.LastMonthEOSB - employeeIndemnity.TotalEOSB; } dynamic indemnityDSRow = new ExpandoObject(); indemnityDSRow.payrunId = payrunId; indemnityDSRow.sNo = i + 1; indemnityDSRow.Id = employeeIndemnity.Id; indemnityDSRow.EmployeeId = employeeIndemnity.EmployeeId; indemnityDSRow.getEmpRefCode = employeeIndemnity.Employee.GetReferenceId; indemnityDSRow.getEmpName = employeeIndemnity.Employee.Name; indemnityDSRow.getEmpDepartment = employeeIndemnity.Employee.Department.Name; indemnityDSRow.getEmpDOJ = employeeIndemnity.Employee.JoiningDate; indemnityDSRow.BasicSalary = "" + employeeIndemnity.BasicSalary.ToString("N2"); foreach (PayrunAllowanceSummary_Dto eosbAllowance in employeeIndemnity.PayrunEOSBAllowancesSummaries) { DynamicHelper.AddProperty(indemnityDSRow, $"{eosbAllowance.AllowanceType.Value}_Value", "" + eosbAllowance.Value.ToString("N2")); } indemnityDSRow.GrossSalary = "" + employeeIndemnity.GrossSalary.ToString("N2"); indemnityDSRow.TotalEmploymentDays = employeeIndemnity.TotalEmploymentDays; indemnityDSRow.TotalPre5EmploymentDays = employeeIndemnity.TotalPre5EmploymentDays; indemnityDSRow.TotalPost5EmploymentDays = employeeIndemnity.TotalPost5EmploymentDays; indemnityDSRow.TotalEOSB = "" + employeeIndemnity.TotalEOSB.ToString("N2"); indemnityDSRow.LastMonthEOSB = "" + employeeIndemnity.LastMonthEOSB.ToString("N2"); indemnityDSRow.ActuarialEvaluation = "" + employeeIndemnity.ActuarialEvaluation.ToString("N2"); indemnityDSRow.Difference = "" + employeeIndemnity.Difference.ToString("N2"); indemnityDSRow.PayrunDetailId = curDetail.Id; indemnityDSRow.month = curDetail.Month; indemnityDSRow.year = curDetail.Year; dynamicDS.Add(indemnityDSRow); } //JsonResult eosbDSJson = new JsonResult(dynamicDS); _dynamicDS = new ExpandoObject(); _dynamicDS.EOSBDS = JsonSerializer.Serialize(dynamicDS); _dynamicDS.month = payrun.Month; _dynamicDS.year = payrun.Year; _dynamicDS.isPosted = payrun.IsIndemnityPosted; } return(Page()); }
public IActionResult OnGet() { SIAllowances = DicValuesRepo.Where(x => x.ValueType.ValueTypeFor == ValueTypeModules.AllowanceType && x.Dimension_2_Value.ToUpper() == "TRUE").ToList(); payrun = ObjectMapper.Map <Payrun, Payrun_Dto>(PayrunAppService.Repository.WithDetails().SingleOrDefault(x => x.Id == payrunId)); SIContributionCategories = ObjectMapper.Map <List <SIContributionCategory>, List <SIContributionCategory_Dto> >(SocialInsuranceAppService.Repository.WithDetails().First().ContributionCategories.ToList()); if (payrun != null) { List <PayrunDetail_Dto> payrunDetails = payrun.PayrunDetails.ToList(); List <dynamic> dynamicDS = new List <dynamic>(); for (int i = 0; i < payrunDetails.Count; i++) { PayrunDetail_Dto curDetail = payrunDetails[i]; if (curDetail.Employee.SIType == null || curDetail.Employee.SIType.Value != "Eligible") { continue; } SocialInsuranceReport_Dto employeeSIReport = GetSIReport(curDetail); dynamic siDSRow = new ExpandoObject(); siDSRow.payrunId = employeeSIReport.PayrunId; siDSRow.sNo = i + 1; siDSRow.getEmpName = employeeSIReport.Employee.Name; siDSRow.getEmpIdentityNumber = employeeSIReport.EmpID; siDSRow.getEmpNationality = employeeSIReport.Employee.Nationality.Value; siDSRow.getEmpSIID = employeeSIReport.EmpSIId; siDSRow.getBasicSalary = "" + employeeSIReport.BasicSalary.ToString("N2"); foreach (PayrunAllowanceSummary_Dto siAllowance in employeeSIReport.PayrunSIAllowancesSummaries) { DynamicHelper.AddProperty(siDSRow, $"{siAllowance.AllowanceType.Value}_Value", "" + siAllowance.Value.ToString("N2")); } double totalSISalary = employeeSIReport.TotalSISalary; siDSRow.getEmpTotalSalaryForSI = "" + totalSISalary.ToString("N2"); List <(string title, double value)> Contributions = new List <(string title, double value)>(); foreach (SIContributionCategory_Dto SIC in SIContributionCategories) { foreach (SIContribution_Dto SICC in SIC.SIContributions) { double SICCCV = SICC.IsPercentage ? totalSISalary * (SICC.Value / 100) : SICC.Value; int contribIndex = Contributions.FindIndex(x => x.title == SICC.Title); if (contribIndex != -1) { Contributions[contribIndex] = (SICC.Title, Contributions[contribIndex].value + SICCCV); } else { Contributions.Add((SICC.Title, SICCCV)); } DynamicHelper.AddProperty(siDSRow, $"{SIC.Title}_{SICC.Title}_Value", $"{SICCCV.ToString("N2")}"); } } foreach ((string title, double value)SICC in Contributions) { List <SIContribution_Dto> sIContributions = SIContributionCategories.SelectMany(x => x.SIContributions).ToList(); DynamicHelper.AddProperty(siDSRow, $"Overall_{SICC.title}_Value", $"{SICC.value.ToString("N2")}"); } siDSRow.month = curDetail.Month; siDSRow.year = curDetail.Year; dynamicDS.Add(siDSRow); } //JsonResult eosbDSJson = new JsonResult(dynamicDS); _dynamicDS = new ExpandoObject(); _dynamicDS.SIDS = JsonSerializer.Serialize(dynamicDS); _dynamicDS.month = payrun.Month; _dynamicDS.year = payrun.Year; _dynamicDS.isPosted = payrun.IsSIPosted; } return(Page()); }