public ActionResult DashboardofLeaveReport(int?BranchId, int?Year, int?EmployeeId) { BranchId = BranchId == 0 ? BRANCHID : BranchId; EmployeeId = EmployeeId == 0 ? null : EmployeeId; LeaveReportVm vm = new LeaveReportVm(); using (var dbCntx = new HrDataContext()) { vm.dtAvailed = EMPLOYEELEAVESUMMARYYTD(BranchId, Year, 0); vm.dtBalance = EMPLOYEELEAVESUMMARYYTD(BranchId, Year, 1); vm.consReport = LEAVEREPORTYTD(BranchId, Year, EmployeeId); } //vm.dtAvailed.Columns.Add("ANNUAL LEAVE1"); //vm.dtAvailed.Columns.Add("MATERNITY LEAVE1"); //vm.dtAvailed.Columns.Add("MEDICAL LEAVE1"); for (int i = 1; i < vm.dtBalance.Columns.Count; i++) { vm.dtAvailed.Columns.Add("BALANCE " + vm.dtBalance.Columns[i]); for (int j = 0; j < vm.dtAvailed.Rows.Count; j++) { vm.dtAvailed.Rows[j]["BALANCE " + vm.dtBalance.Columns[i]] = vm.dtBalance.Rows[j][vm.dtBalance.Columns[i]]; } } vm.BranchID = BranchId; vm.Year = Year; vm.EmployeeID = EmployeeId; ViewData["RoleCode"] = ROLECODE.ToUpper(); return(View(vm)); }
public ActionResult DashboardofSalaryReport(int?BranchId, int?Year, byte?Month, int?EmployeeId) { BranchId = BranchId == 0 ? BRANCHID : BranchId; Month = Month == 0 ? null : Month; EmployeeId = EmployeeId == 0 ? null : EmployeeId; SalaryReportVm vm = new SalaryReportVm(); using (var dbcntx = new HrDataContext()) { vm.dt = SALARYCOMPONENTEMPLOYEEYTD(BranchId, Year, Convert.ToInt32(Month), EmployeeId); } vm.BranchID = BranchId; vm.Year = Year; vm.Month = Month; vm.EmployeeID = EmployeeId; ViewData["BranchId"] = BranchId; ViewData["RoleCode"] = ROLECODE.ToUpper(); if (vm.dt != null && vm.dt.Columns.Count > 0) { DataRow totalsRow = vm.dt.NewRow(); totalsRow["EMPLOYEE NAME"] = "TOTAL"; for (int j = 1; j < vm.dt.Columns.Count; j++) { DataColumn col = vm.dt.Columns[j]; decimal colTotal = 0; for (int i = 0; i < col.Table.Rows.Count; i++) { DataRow row = col.Table.Rows[i]; if (row[col] == null || row[col].ToString() == "") { row[col] = "0.00"; } colTotal += Convert.ToDecimal(row[col]); } totalsRow[col.ColumnName] = colTotal; } vm.dt.Rows.Add(totalsRow); } return(View(vm)); }
public ActionResult DashboardofSalaryData(int?BranchId, int?Year, byte?Month, int?EmployeeId) { BranchId = BranchId == 0 ? BRANCHID : BranchId; Month = Month == 0 ? null : Month; EmployeeId = EmployeeId == 0 ? null : EmployeeId; ClaimsReportVm vm = new ClaimsReportVm(); vm.TravelClaimReport = new List <USP_TRAVELCLAIMREPORT_Result>(); vm.TravelClaimReportYTD = new List <USP_TRAVELCLAIMREPORTYTD_Result>(); using (var dbCntx = new HrDataContext()) { vm.TravelClaimReport = dbCntx.USP_TRAVELCLAIMREPORT(BranchId, Year, Month, EmployeeId).ToList(); vm.TravelClaimReportYTD = dbCntx.USP_TRAVELCLAIMREPORTYTD(BranchId, Year, EmployeeId).ToList(); vm.dt = TRAVELCLAIMEMPLOYEEYTD(BranchId, Year, Month, EmployeeId); } vm.BranchID = BranchId; vm.Year = Year; vm.Month = Month; vm.EmployeeID = EmployeeId; ViewData["RoleCode"] = ROLECODE.ToUpper(); foreach (var item in vm.TravelClaimReport) { if (item.ClaimCategory == "TAXILOCAL") { item.ClaimCategory = "TAXI LOCAL"; } else if (item.ClaimCategory == "TAXIOVERSEAS") { item.ClaimCategory = "TAXI OVERSEAS"; } else if (item.ClaimCategory == "FOODBILLSLOCAL") { item.ClaimCategory = "FOOD BILLS LOCAL"; } else if (item.ClaimCategory == "FOODBILLSOVERSEAS") { item.ClaimCategory = "FOOD BILLS OVERSEAS"; } else if (item.ClaimCategory == "OTHEREXPENSES") { item.ClaimCategory = "OTHER EXPENSES"; } } if (vm.dt != null && vm.dt.Columns.Count > 0) { DataRow totalsRow = vm.dt.NewRow(); totalsRow["EMPLOYEE NAME"] = "TOTAL"; for (int j = 1; j < vm.dt.Columns.Count; j++) { DataColumn col = vm.dt.Columns[j]; decimal colTotal = 0; for (int i = 0; i < col.Table.Rows.Count; i++) { DataRow row = col.Table.Rows[i]; if (row[col] == null || row[col].ToString() == "") { row[col] = "0.00"; } colTotal += Convert.ToDecimal(row[col]); } //col.Table.Rows[j]. = Color.Red; totalsRow[col.ColumnName] = colTotal; if (col.ColumnName == "TAXILOCAL") { vm.dt.Columns[j].ColumnName = "TAXI LOCAL"; } if (col.ColumnName == "TAXIOVERSEAS") { vm.dt.Columns[j].ColumnName = "TAXI OVERSEAS"; } if (col.ColumnName == "FOODBILLSLOCAL") { vm.dt.Columns[j].ColumnName = "FOOD BILLS LOCAL"; } if (col.ColumnName == "FOODBILLSOVERSEAS") { vm.dt.Columns[j].ColumnName = "FOOD BILLS OVERSEAS"; } if (col.ColumnName == "OTHEREXPENSES") { vm.dt.Columns[j].ColumnName = "OTHER EXPENSES"; } } vm.dt.Rows.Add(totalsRow); } return(View(vm)); }
public ActionResult DashboardofSalaryComponents(int?BranchId, int?Year, byte?Month, int?EmployeeId) { BranchId = BranchId == 0 ? BRANCHID : BranchId; Month = Month == 0 ? null : Month; EmployeeId = EmployeeId == 0 ? null : EmployeeId; SalaryComponantReportVm vm = new SalaryComponantReportVm(); vm.SalaryComponantReport = new List <Salarycomponentreport>(); vm.SalaryComponantReportYTD = new List <Salarycomponentreportytd>(); using (var dbCntx = new HrDataContext()) { List <Salarycomponentreportytd> salarycomponentreportytd = new List <Salarycomponentreportytd>(); List <Salarycomponentreport> salarycomponentreport = new List <Salarycomponentreport>(); if (BranchId == -1 || BranchId == null) { var countryList = SelectListItemHelper.ActiveCountryList(); foreach (var item in countryList) { var list = dbCntx.USP_SALARYCOMPONENTREPORTYTD(Convert.ToInt32(item.Value), Year, EmployeeId).ToList(); if (list.Sum(x => x.TotalSalary) > 0) { foreach (var info in list) { Salarycomponentreportytd countryItem = new Salarycomponentreportytd(); countryItem.BranchID = Convert.ToInt32(item.Value); countryItem.BranchName = item.Text; countryItem.YTDMonth = info.YTDMonth; countryItem.TotalSalary = info.TotalSalary; salarycomponentreportytd.Add(countryItem); } } var SalaryComponantReport = dbCntx.USP_SALARYCOMPONENTREPORT(Convert.ToInt32(item.Value), Year, Month, EmployeeId).ToList(); foreach (var info in SalaryComponantReport) { Salarycomponentreport countryItem = new Salarycomponentreport(); countryItem.BranchID = Convert.ToInt32(item.Value); countryItem.BranchName = item.Text; countryItem.ComponentName = info.ComponentName; countryItem.Amount = info.Amount; salarycomponentreport.Add(countryItem); } } vm.SalaryComponantReportYTD = salarycomponentreportytd; vm.SalaryComponantReport = salarycomponentreport.ToList(); } else { var SalaryComponantReport = dbCntx.USP_SALARYCOMPONENTREPORT(BranchId, Year, Month, EmployeeId).ToList(); foreach (var info in SalaryComponantReport) { Salarycomponentreport countryItem = new Salarycomponentreport(); countryItem.BranchID = BranchId.Value; countryItem.ComponentName = info.ComponentName; countryItem.Amount = info.Amount; salarycomponentreport.Add(countryItem); } vm.SalaryComponantReport = salarycomponentreport.ToList(); var list = dbCntx.USP_SALARYCOMPONENTREPORTYTD(BranchId, Year, EmployeeId).ToList(); foreach (var info in list) { Salarycomponentreportytd countryItem = new Salarycomponentreportytd(); countryItem.BranchID = BranchId.Value; countryItem.YTDMonth = info.YTDMonth; countryItem.TotalSalary = info.TotalSalary; salarycomponentreportytd.Add(countryItem); } vm.SalaryComponantReportYTD = salarycomponentreportytd.ToList(); vm.dt = SALARYCOMPONENTEMPLOYEEYTD(BranchId, Year, Convert.ToInt32(Month), EmployeeId); } } vm.BranchID = BranchId == null ? -1 : BranchId; vm.Year = Year; vm.Month = Month; vm.EmployeeID = EmployeeId; ViewData["RoleCode"] = ROLECODE.ToUpper(); if (vm.dt != null && vm.dt.Columns.Count > 0) { DataRow totalsRow = vm.dt.NewRow(); totalsRow["EMPLOYEE NAME"] = "TOTAL"; for (int j = 1; j < vm.dt.Columns.Count; j++) { DataColumn col = vm.dt.Columns[j]; decimal colTotal = 0; for (int i = 0; i < col.Table.Rows.Count; i++) { DataRow row = col.Table.Rows[i]; if (row[col] == null || row[col].ToString() == "") { row[col] = "0.00"; } colTotal += Convert.ToDecimal(row[col]); } //col.Table.Rows[j]. = Color.Red; totalsRow[col.ColumnName] = colTotal; } vm.dt.Rows.Add(totalsRow); } return(View(vm)); }