2113 lines
102 KiB
C#
2113 lines
102 KiB
C#
using HRM.Report;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using HRM.BO;
|
|
using HRM.DA;
|
|
using System.Data;
|
|
using Newtonsoft.Json;
|
|
using System.IO;
|
|
using ClosedXML.Excel;
|
|
using PdfWriter = iText.Kernel.Pdf.PdfWriter;
|
|
using PdfDocument = iText.Kernel.Pdf.PdfDocument;
|
|
using PdfMerger = iText.Kernel.Utils.PdfMerger;
|
|
using PdfReader = iText.Kernel.Pdf.PdfReader;
|
|
|
|
namespace HRM.UI.Controllers.Report
|
|
{
|
|
[Route("api/Report")]
|
|
[ApiController]
|
|
[Authorize]
|
|
public class ReportController : ControllerBase
|
|
{
|
|
private readonly IEmployeeService _employeeService;
|
|
public ReportController(IEmployeeService employeeService)
|
|
{
|
|
this._employeeService = employeeService;
|
|
}
|
|
|
|
#region Employee
|
|
|
|
[HttpPost("getEmpBasicInfo")]
|
|
public ActionResult getEmpBasicInfo(dynamic data)
|
|
{
|
|
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
string sEmpID = (string)items["empIds"].ToObject<string>();
|
|
string empBasicInfo = string.Empty;
|
|
try
|
|
{
|
|
rptEmployee rptEmployee = new rptEmployee();
|
|
empBasicInfo = rptEmployee.GetEmpDetails(sEmpID);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok(empBasicInfo);
|
|
}
|
|
|
|
[HttpPost("getMonthlyKPI")]
|
|
public ActionResult getMonthlyKPI(dynamic data)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
string sEmpIDs = (string)items["empIds"].ToObject<string>();
|
|
DateTime fromDate = DateTime.Today;
|
|
DateTime toDate = DateTime.Today;
|
|
if (items["fromDate"] != null)
|
|
fromDate = (DateTime)items["fromDate"].ToObject<DateTime>();
|
|
if (items["toDate"] != null)
|
|
toDate = (DateTime)items["toDate"].ToObject<DateTime>();
|
|
|
|
byte[] bytes = null;
|
|
try
|
|
{
|
|
// eAttnType is never read below this call - DailyAttnProcessDA.GetMonthlyKPIDetail
|
|
// ignores it - and the client sends no attendance type, so None is passed.
|
|
bytes = new AttendanceReport().GetMonthlyKPI(EnumAttendanceType.None, fromDate, toDate,
|
|
sEmpIDs, "PDF", (int)currentUser.PayrollTypeID);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok(bytes);
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#region CommonReportData
|
|
|
|
[HttpPost("getCommonReportData")]
|
|
public ActionResult getCommonReportData(dynamic data)
|
|
{
|
|
// *** please talk to shamim, if you need to change this function code
|
|
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
EnumReportType reportid = (EnumReportType)items["reportid"].ToObject<int>();
|
|
int itemid = 0;
|
|
|
|
if (items["itemid"] != null)
|
|
itemid = (int)items["itemid"].ToObject<int>();
|
|
DateTime fromDate = DateTime.Today;
|
|
DateTime toDate = DateTime.Today;
|
|
string selectedReport = "";
|
|
string sEmpIDs = (string)items["empIds"].ToObject<string>();
|
|
if (items["selectedReport"] != null)
|
|
selectedReport = (string)items["selectedReport"].ToObject<string>();
|
|
string reportType = (string)items["reportType"].ToObject<string>();
|
|
if (items["fromDate"] != null)
|
|
fromDate = (DateTime)items["fromDate"].ToObject<DateTime>();
|
|
if (items["toDate"] != null)
|
|
toDate = (DateTime)items["toDate"].ToObject<DateTime>();
|
|
int bankId = 0;
|
|
if (items["bankId"] != null)
|
|
bankId = (int)items["bankId"].ToObject<int>();
|
|
string locationIds = string.Empty;
|
|
if (items["locationIds"] != null)
|
|
{
|
|
locationIds = (string)items["locationIds"].ToObject<string>();
|
|
}
|
|
|
|
int loanIssueId = 0;
|
|
|
|
if (items["loanIssueId"] != null)
|
|
{
|
|
loanIssueId = (int)items["loanIssueId"].ToObject<int>();
|
|
}
|
|
int locationId = 0;
|
|
if (items["locationId"] != null)
|
|
{
|
|
locationId = (int)items["locationId"].ToObject<int>();
|
|
}
|
|
// ****please talk to shamim, if you need to change this function code
|
|
|
|
// string empBasicInfo = string.Empty;
|
|
byte[] bytes = null;
|
|
int employeeId = currentUser.EmployeeID.GetValueOrDefault();
|
|
int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
|
|
DateTime nextPayProcessDate = currentUser.NextPayProcessDate.GetValueOrDefault();
|
|
bool isForESS = false;
|
|
try
|
|
{
|
|
switch (reportid)
|
|
{
|
|
case EnumReportType.None:
|
|
break;
|
|
case EnumReportType.DLP:
|
|
break;
|
|
case EnumReportType.Grade:
|
|
break;
|
|
case EnumReportType.GradeSegment:
|
|
break;
|
|
case EnumReportType.Designations:
|
|
break;
|
|
case EnumReportType.Categiries:
|
|
break;
|
|
case EnumReportType.Employees:
|
|
break;
|
|
case EnumReportType.EmployeePosting:
|
|
break;
|
|
case EnumReportType.EmployeeAllInfo:
|
|
break;
|
|
case EnumReportType.EmpCostCenter:
|
|
break;
|
|
case EnumReportType.BankGuarantee:
|
|
break;
|
|
case EnumReportType.EmpIndvidualDetail:
|
|
break;
|
|
case EnumReportType.EmpUpcomingInfo:
|
|
break;
|
|
case EnumReportType.EmpHistory:
|
|
break;
|
|
case EnumReportType.EmpRetirement:
|
|
break;
|
|
case EnumReportType.EmpService:
|
|
break;
|
|
case EnumReportType.EmpEnvelop:
|
|
break;
|
|
case EnumReportType.OTHour:
|
|
break;
|
|
case EnumReportType.OTPaySlip:
|
|
break;
|
|
case EnumReportType.OTBankAdvice:
|
|
break;
|
|
case EnumReportType.OTHourSheet:
|
|
bytes = new OTReport().OTMonthlySheet((int)currentUser.PayrollTypeID, fromDate, sEmpIDs, reportType);
|
|
break;
|
|
case EnumReportType.EmpServiceBook:
|
|
bytes = new rptEmployee().EmpServiceBook((int)currentUser.PayrollTypeID, sEmpIDs);
|
|
break;
|
|
case EnumReportType.OTMonthRange:
|
|
break;
|
|
case EnumReportType.OTBranch:
|
|
break;
|
|
case EnumReportType.OTDivision:
|
|
break;
|
|
case EnumReportType.OTCostCenter:
|
|
bytes = new OTReport().OTCostCenter((int)currentUser.PayrollTypeID, fromDate, sEmpIDs, reportType);
|
|
break;
|
|
case EnumReportType.OTBankDisbursement:
|
|
bytes = new OTReport().OTBankDisbursement((int)currentUser.PayrollTypeID, fromDate, sEmpIDs, reportType);
|
|
break;
|
|
case EnumReportType.BankAdvice:
|
|
rptBankAdvice rptBankAdvice = new rptBankAdvice();
|
|
bytes = rptBankAdvice.ShowNewBankDisbursmentReport((int)currentUser.PayrollTypeID, fromDate,
|
|
sEmpIDs, bankId, reportType);
|
|
break;
|
|
case EnumReportType.NewBankAdvice:
|
|
rptBankAdvice newRptBankAdvice = new rptBankAdvice();
|
|
bytes = newRptBankAdvice.ShowNewBankDisbursmentReport((int)currentUser.PayrollTypeID, fromDate,
|
|
sEmpIDs, bankId, reportType);
|
|
break;
|
|
case EnumReportType.BankAdviceWithRoutingNo:
|
|
rptBankAdviceWithRoutingNo rptBankAdviceWithRoutingNo = new rptBankAdviceWithRoutingNo();
|
|
bytes = rptBankAdviceWithRoutingNo.ShowBankDisbursmentReportWithRoutingNo((int)currentUser.PayrollTypeID, fromDate,
|
|
sEmpIDs, bankId, reportType);
|
|
break;
|
|
case EnumReportType.CashDisbursement:
|
|
break;
|
|
case EnumReportType.PayRegister:
|
|
break;
|
|
case EnumReportType.OverAllSummary:
|
|
bytes = new PaySlip().ReportOverAllSummary((int)currentUser.PayrollTypeID, sEmpIDs, fromDate, reportType);
|
|
break;
|
|
case EnumReportType.SalaryControl:
|
|
break;
|
|
case EnumReportType.PaySlip:
|
|
if (reportType == "EMAIL")
|
|
{
|
|
//bool isForESS = false;
|
|
//if (sEmpIDs.Length == 0)
|
|
//{
|
|
// isForESS = true;
|
|
// sEmpIDs = employeeId.ToString();
|
|
//}
|
|
//bytes = new PaySlip().PayslipMail((int)currentUser.PayrollTypeID, fromDate, sEmpIDs, isForESS);
|
|
}
|
|
else
|
|
{
|
|
|
|
if (sEmpIDs.Length == 0)
|
|
{
|
|
isForESS = true;
|
|
sEmpIDs = employeeId.ToString();
|
|
}
|
|
bytes = new PaySlip().ShowReportNew((int)currentUser.PayrollTypeID, fromDate, sEmpIDs, isForESS);
|
|
}
|
|
break;
|
|
case EnumReportType.Envelop:
|
|
break;
|
|
case EnumReportType.SalaryReconcil:
|
|
bytes = new rptSalarySheet().ShowSalaryReconNew(toDate, fromDate, sEmpIDs, (int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.SalaryReconcilSGS:
|
|
bytes = new rptSalarySheet().ShowSalaryReconSGS(fromDate, toDate, sEmpIDs, (int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.SalaryReconcilBerger:
|
|
bytes = new rptSalarySheet().ShowSalaryReconcilBerger(fromDate, toDate, sEmpIDs, (int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.SalaryReconcilBAT:
|
|
bytes = new rptSalarySheet().ShowSalaryReconNew(fromDate, toDate, sEmpIDs, (int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.SalaryReconcilItemWise:
|
|
break;
|
|
case EnumReportType.SalaryControl1Page:
|
|
break;
|
|
case EnumReportType.IndvSalaryComponent:
|
|
break;
|
|
case EnumReportType.ChangeNotes:
|
|
break;
|
|
case EnumReportType.ChangeNotesSummary:
|
|
break;
|
|
case EnumReportType.CCSalaryDetails:
|
|
bytes = new rptSalarySheet().ShowDetailSalarySheetByCC((int)currentUser.PayrollTypeID, fromDate, sEmpIDs, reportType);
|
|
break;
|
|
case EnumReportType.CCSalarySummary:
|
|
bytes = new rptSalarySheet().CCWiseSalarySummary((int)currentUser.PayrollTypeID, fromDate, sEmpIDs, reportType);
|
|
break;
|
|
case EnumReportType.CCSalarySheet:
|
|
break;
|
|
case EnumReportType.SalaryComparison:
|
|
break;
|
|
case EnumReportType.Memorandum:
|
|
break;
|
|
case EnumReportType.SalarySMS:
|
|
break;
|
|
case EnumReportType.SalarySheetSummary:
|
|
rptSalarySheet rptSalarySheet = new rptSalarySheet();
|
|
bool bfixedAmount = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "costcenter", "manadatoryinsalary");
|
|
bool fractioncostcenter = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "costcenter", "factionateinvolment");
|
|
if (bfixedAmount && !fractioncostcenter)
|
|
{
|
|
bytes = rptSalarySheet.ShowReport((int)currentUser.PayrollTypeID, fromDate,
|
|
(int)EnumReportType.SalarySheetSummary, sEmpIDs, reportType);
|
|
}
|
|
else
|
|
{
|
|
bytes = rptSalarySheet.ShowReportWithoutCostcenter((int)currentUser.PayrollTypeID, fromDate,
|
|
(int)EnumReportType.SalarySheetSummary, sEmpIDs, reportType, false);
|
|
}
|
|
break;
|
|
case EnumReportType.SalarySheetSummaryWithLWP:
|
|
rptSalarySheet rptSalarySheetLWP = new rptSalarySheet();
|
|
|
|
bytes = rptSalarySheetLWP.ShowReportWithoutCostcenter((int)currentUser.PayrollTypeID, fromDate,
|
|
(int)EnumReportType.SalarySheetSummary, sEmpIDs, reportType, true);
|
|
break;
|
|
case EnumReportType.ExtendedSalarySheet:
|
|
//bytes = new rptSalarySheet().ShowReportWithoutCostCenterOT((int)currentUser.PayrollTypeID, fromDate,
|
|
// (int)EnumReportType.SalarySheetSummary, sEmpIDs, reportType);
|
|
bytes = new rptSalarySheet().ShowExtendedSalarySheet((int)currentUser.PayrollTypeID, fromDate.LastDateOfMonth(),
|
|
(int)EnumReportType.SalarySheetSummary, sEmpIDs, reportType);
|
|
break;
|
|
case EnumReportType.SalarySheetArrear:
|
|
bytes = new rptSalarySheet().ShowreportForManagement(fromDate, sEmpIDs,
|
|
(int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.SalaryWithheldSheetSummary:
|
|
bytes = new rptSalarySheet().ShowreportForManagement(fromDate, sEmpIDs,
|
|
(int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.SalaryBankSummary:
|
|
break;
|
|
case EnumReportType.SalaryByMonthAndYear:
|
|
break;
|
|
case EnumReportType.SalarySheetForIDLC:
|
|
break;
|
|
case EnumReportType.SalarySheetWithOPIItems:
|
|
break;
|
|
case EnumReportType.SalarySheetForIDLCWithOPIItems:
|
|
break;
|
|
case EnumReportType.PayrollSummary:
|
|
break;
|
|
case EnumReportType.BranchWiseSalarySummary:
|
|
break;
|
|
case EnumReportType.CostCenterWiseSalaryDetails:
|
|
break;
|
|
case EnumReportType.DivisionWiseReport:
|
|
break;
|
|
case EnumReportType.DepartmentWiseReport:
|
|
break;
|
|
case EnumReportType.CTCDetail:
|
|
break;
|
|
case EnumReportType.CCReportToFinance:
|
|
break;
|
|
case EnumReportType.CostCenterWiseSummary:
|
|
break;
|
|
case EnumReportType.PreRequisite:
|
|
break;
|
|
case EnumReportType.CTCComparison:
|
|
break;
|
|
case EnumReportType.PromotionSalarySheetDetail:
|
|
break;
|
|
case EnumReportType.PromotionSalarySheetSummary:
|
|
break;
|
|
case EnumReportType.ChangeInLocation:
|
|
break;
|
|
case EnumReportType.JoiningReport:
|
|
break;
|
|
case EnumReportType.IncrementDetail:
|
|
break;
|
|
case EnumReportType.IncrementSummary:
|
|
break;
|
|
case EnumReportType.IncrementComparison:
|
|
break;
|
|
case EnumReportType.BranchWiseSalaryDetail:
|
|
break;
|
|
case EnumReportType.BranchWiseOPIDetails:
|
|
break;
|
|
case EnumReportType.BranchWiseDeductionDetails:
|
|
break;
|
|
case EnumReportType.CashAdviceReport:
|
|
break;
|
|
case EnumReportType.DivisionWiseSalary:
|
|
break;
|
|
case EnumReportType.CostCenterWise:
|
|
break;
|
|
case EnumReportType.SalarySheetExtended:
|
|
break;
|
|
case EnumReportType.CostInformation:
|
|
break;
|
|
case EnumReportType.SalarySheetBuyerWise:
|
|
break;
|
|
case EnumReportType.SalarySheetDeptWise:
|
|
break;
|
|
case EnumReportType.BanglaPayslip:
|
|
bytes = new rptEcho().ShowBanglaPaySlip((int)currentUser.PayrollTypeID, fromDate, sEmpIDs, (int)EnumReportType.BanglaPayslip, reportType, (EnumBankCash)itemid);
|
|
break;
|
|
case EnumReportType.BuyerWiseBanglaPayslip:
|
|
break;
|
|
case EnumReportType.SalaryStracture:
|
|
break;
|
|
case EnumReportType.SalaryReconciliationSummary:
|
|
bytes = new rptSalarySheet().SalaryReconciliationSummary(fromDate, toDate, sEmpIDs,
|
|
(int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.ItemWiseSalary:
|
|
List<PayrollComponentList> payrollComponentList = new List<PayrollComponentList>();
|
|
List<PayrollComponentList> payrollComponentListtemp = new List<PayrollComponentList>();
|
|
if (itemid > 0)
|
|
{
|
|
payrollComponentList = new PayrollComponentListService().ConstantItemsForSalary((int)currentUser.PayrollTypeID);
|
|
payrollComponentListtemp = payrollComponentList.Where(x => x.PKID == itemid).ToList();
|
|
}
|
|
bytes = new rptSalarySheet().ItemWiseSalary(GlobalFunctions.FirstDateOfMonth(fromDate), GlobalFunctions.LastDateOfMonth(toDate), payrollComponentListtemp, sEmpIDs,
|
|
(int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.ItemWiseSalaryDetails:
|
|
rptSalarySheet rptItemWiseSalarySheet = new rptSalarySheet();
|
|
bytes = rptItemWiseSalarySheet.ShowItemWiseSalaryDetails((int)currentUser.PayrollTypeID, fromDate, toDate,
|
|
(int)EnumReportType.SalarySheetSummary, sEmpIDs, reportType);
|
|
break;
|
|
case EnumReportType.SalaryreconciliationForAllitems:
|
|
break;
|
|
case EnumReportType.SalaryCertificate:
|
|
break;
|
|
case EnumReportType.EmployeesMasterData:
|
|
break;
|
|
case EnumReportType.StuffListWithoutSalary:
|
|
break;
|
|
case EnumReportType.StuffAccountWithoutSalary:
|
|
break;
|
|
case EnumReportType.SalaryComparisonNew:
|
|
break;
|
|
case EnumReportType.AuditReport:
|
|
break;
|
|
case EnumReportType.PFLedger:
|
|
break;
|
|
case EnumReportType.PFRegister:
|
|
break;
|
|
case EnumReportType.PFCertificate:
|
|
break;
|
|
case EnumReportType.PFYrlyRegister:
|
|
break;
|
|
case EnumReportType.PFTotalInvestment:
|
|
break;
|
|
case EnumReportType.ITAnnual:
|
|
break;
|
|
case EnumReportType.ITMonthly:
|
|
break;
|
|
case EnumReportType.ITRegister:
|
|
break;
|
|
case EnumReportType.ITIndividual:
|
|
break;
|
|
case EnumReportType.ITInvestment:
|
|
break;
|
|
case EnumReportType.ITPerquisite:
|
|
break;
|
|
case EnumReportType.ITReport108:
|
|
RptIncomeTax incomeTax = new RptIncomeTax();
|
|
bytes = incomeTax.GetDataReport108(itemid, sEmpIDs, currentUser.PayrollTypeID.GetValueOrDefault(),
|
|
currentUser.TaxParamID.GetValueOrDefault(),
|
|
nextPayProcessDate, reportType);
|
|
break;
|
|
case EnumReportType.ITReport177:
|
|
RptIncomeTax rptTaxes = new RptIncomeTax();
|
|
bytes = rptTaxes.GetDataReport177(sEmpIDs, currentUser.PayrollTypeID.GetValueOrDefault(), GlobalFunctions.LastDateOfMonth(fromDate), reportType);
|
|
break;
|
|
case EnumReportType.ITReport177Quaterly:
|
|
RptIncomeTax rptIncomeTax177Quar = new RptIncomeTax();
|
|
bytes = rptIncomeTax177Quar.GetDataReport177Quaterly(sEmpIDs, currentUser.PayrollTypeID.GetValueOrDefault(), itemid, reportType);
|
|
break;
|
|
case EnumReportType.ITReport177Yearly:
|
|
RptIncomeTax rptIncomeTax177 = new RptIncomeTax();
|
|
bytes = rptIncomeTax177.GetDataReport177Yearly(itemid, sEmpIDs, currentUser.PayrollTypeID.GetValueOrDefault(),
|
|
currentUser.TaxParamID.GetValueOrDefault(),
|
|
nextPayProcessDate, reportType);
|
|
break;
|
|
case EnumReportType.TAXReconciliation:
|
|
RptIncomeTax taxReconciliation = new RptIncomeTax();
|
|
bytes = taxReconciliation.GetDataReportTaxReconciliation(itemid, sEmpIDs, currentUser.PayrollTypeID.GetValueOrDefault(),
|
|
currentUser.TaxParamID.GetValueOrDefault(),
|
|
nextPayProcessDate, reportType);
|
|
break;
|
|
case EnumReportType.EmployeeTaxDetails:
|
|
break;
|
|
case EnumReportType.ITReportWithoutProjection:
|
|
break;
|
|
case EnumReportType.EmployeesTaxDeducted:
|
|
break;
|
|
case EnumReportType.ITReport108onPaidAmount:
|
|
break;
|
|
case EnumReportType.TaxInvestment:
|
|
break;
|
|
case EnumReportType.TaxChallan:
|
|
break;
|
|
case EnumReportType.BonusBankAdvice:
|
|
bytes = new rptBonus().BonusBankAdvice(itemid, fromDate, sEmpIDs,
|
|
(int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.BonusRegister:
|
|
bytes = new rptBonus().BonusRegister(itemid, fromDate, sEmpIDs,
|
|
(int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.PaySlipForBonus:
|
|
|
|
isForESS = false;
|
|
if (sEmpIDs.Length == 0)
|
|
{
|
|
isForESS = true;
|
|
sEmpIDs = employeeId.ToString();
|
|
}
|
|
//if (string.IsNullOrEmpty(sEmpIDs))
|
|
//{
|
|
// sEmpIDs = currentUser.EmployeeID.ToString();
|
|
//}
|
|
bytes = new rptBonus().BonusPaySlip(itemid, fromDate, sEmpIDs,
|
|
(int)currentUser.PayrollTypeID, reportType, isForESS);
|
|
break;
|
|
case EnumReportType.LoanIssue:
|
|
bytes = new LoanReport().MonthlyLoanReport(fromDate, (int)currentUser.PayrollTypeID, reportType, locationIds);
|
|
break;
|
|
case EnumReportType.LoanDue:
|
|
bytes = new LoanReport().LoanPaymentDue(fromDate, sEmpIDs, (int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.Loan:
|
|
bytes = new LoanReport().LatestIndividualLoanReport(itemid, sEmpIDs, (int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.OutPayslip:
|
|
break;
|
|
case EnumReportType.OutPayRegister:
|
|
break;
|
|
case EnumReportType.OutCashDisbursementRegister:
|
|
break;
|
|
case EnumReportType.OutPayBankAdvice:
|
|
break;
|
|
case EnumReportType.OutPaymentRegister:
|
|
break;
|
|
case EnumReportType.OutPayLedger:
|
|
break;
|
|
case EnumReportType.OutPayEmployeeCost:
|
|
break;
|
|
case EnumReportType.DetailOtherPayrollItem:
|
|
break;
|
|
case EnumReportType.DeductionReport:
|
|
break;
|
|
case EnumReportType.CostCenterWiseOPIDetails:
|
|
break;
|
|
case EnumReportType.OPIPayslip:
|
|
break;
|
|
case EnumReportType.IDLCOPIRegister:
|
|
break;
|
|
|
|
case EnumReportType.UnAuthorizedLeave:
|
|
break;
|
|
case EnumReportType.EmpWorkingHours:
|
|
break;
|
|
case EnumReportType.EmpITInvestment:
|
|
break;
|
|
case EnumReportType.MarketSurvey:
|
|
break;
|
|
case EnumReportType.URBProvision:
|
|
break;
|
|
case EnumReportType.Appraisal:
|
|
break;
|
|
case EnumReportType.URBRegister:
|
|
break;
|
|
case EnumReportType.URBDetail:
|
|
break;
|
|
case EnumReportType.PTCHistry:
|
|
break;
|
|
case EnumReportType.FinalSattlement:
|
|
break;
|
|
case EnumReportType.BankLetter:
|
|
break;
|
|
case EnumReportType.EmployeeHistory:
|
|
break;
|
|
case EnumReportType.PermissionList:
|
|
break;
|
|
case EnumReportType.ChangeHistry:
|
|
break;
|
|
case EnumReportType.PositionWiseSalary:
|
|
break;
|
|
case EnumReportType.Payscale:
|
|
break;
|
|
case EnumReportType.EmailPayslip:
|
|
break;
|
|
case EnumReportType.DailyAttendance:
|
|
break;
|
|
case EnumReportType.MonthlyAttendances:
|
|
break;
|
|
case EnumReportType.MonthlyLateAtten:
|
|
break;
|
|
case EnumReportType.FASSalaryAllocation:
|
|
break;
|
|
case EnumReportType.FASSWJV:
|
|
break;
|
|
case EnumReportType.PFrevenue:
|
|
break;
|
|
case EnumReportType.GL:
|
|
break;
|
|
case EnumReportType.DailyInOut:
|
|
break;
|
|
case EnumReportType.DailyAbsent:
|
|
break;
|
|
case EnumReportType.MonthlyAttendance:
|
|
break;
|
|
case EnumReportType.MonthlyDetailAttendance:
|
|
bytes = new rptEcho().GetMonthlyDetailAttendance(GlobalFunctions.FirstDateOfMonth(fromDate),
|
|
sEmpIDs, reportType, (int)currentUser.PayrollTypeID);
|
|
break;
|
|
case EnumReportType.AttendanceInformation:
|
|
break;
|
|
case EnumReportType.DailyInOutAndAbsent:
|
|
break;
|
|
case EnumReportType.SingleEmpJobCard:
|
|
bytes = new AttendanceReport().MonthlyJobCard(fromDate, toDate, sEmpIDs,
|
|
(int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.MultipleEmpJobCard:
|
|
bytes = new AttendanceReport().ShowDateRangeJobCardMultiple(fromDate, toDate, sEmpIDs,
|
|
(int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.AttendanceSummary:
|
|
|
|
bytes = new AttendanceReport().GetAttendanceSummary(fromDate,
|
|
sEmpIDs, reportType, (int)currentUser.PayrollTypeID);
|
|
break;
|
|
case EnumReportType.AttendanceSummaryWithInOut:
|
|
bytes = new AttendanceReport().GetMonthlyAttendanceReportNew(fromDate, toDate,
|
|
sEmpIDs, reportType, (int)currentUser.PayrollTypeID);
|
|
break;
|
|
case EnumReportType.DailyInOutForBuyer:
|
|
break;
|
|
case EnumReportType.DailyAbsentForBuyer:
|
|
break;
|
|
case EnumReportType.MonthlyAttendanceForBuyer:
|
|
break;
|
|
case EnumReportType.MonthlyDetailAttendanceForBuyer:
|
|
break;
|
|
case EnumReportType.JVReport:
|
|
break;
|
|
case EnumReportType.EmployeeWiseJVReport:
|
|
break;
|
|
case EnumReportType.CCWiseJVReport:
|
|
break;
|
|
case EnumReportType.JVSummaryReport:
|
|
break;
|
|
case EnumReportType.FinalSettlement:
|
|
break;
|
|
case EnumReportType.EmpLifeCycle:
|
|
break;
|
|
case EnumReportType.Workflow:
|
|
break;
|
|
case EnumReportType.EssTaxCard:
|
|
RptIncomeTax rptIncomeTax = new RptIncomeTax();
|
|
int taxParamId = currentUser.TaxParamID.GetValueOrDefault();
|
|
//bytes = rptIncomeTax.showTaxCardForMultiple(sEmpIDs, itemid, payrollTypeId, currentUser.TaxParamID.GetValueOrDefault(), "PDF");
|
|
if (!string.IsNullOrEmpty(sEmpIDs))
|
|
{
|
|
if (int.TryParse(sEmpIDs, out int result))
|
|
{
|
|
employeeId = result;
|
|
bytes = rptIncomeTax.ShowMultipleTaxCard(employeeId.ToString(), true, itemid, taxParamId, nextPayProcessDate, (int)currentUser.PayrollTypeID, reportType);
|
|
//bytes = rptIncomeTax.showTaxCard(employeeId, true, itemid, taxParamId, nextPayProcessDate, (int)currentUser.PayrollTypeID, reportType);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (employeeId > 0)
|
|
{
|
|
bytes = rptIncomeTax.showTaxCard(employeeId, true, itemid, taxParamId, nextPayProcessDate, (int)currentUser.PayrollTypeID, reportType);
|
|
}
|
|
}
|
|
break;
|
|
case EnumReportType.EssTaxCardC:
|
|
RptIncomeTax rptIncomeTaxC = new RptIncomeTax();
|
|
int taxParamIdC = currentUser.TaxParamID.GetValueOrDefault();
|
|
//bytes = rptIncomeTax.showTaxCardForMultiple(sEmpIDs, itemid, payrollTypeId, currentUser.TaxParamID.GetValueOrDefault(), "PDF");
|
|
if (!string.IsNullOrEmpty(sEmpIDs))
|
|
{
|
|
if (int.TryParse(sEmpIDs, out int result))
|
|
{
|
|
employeeId = result;
|
|
bytes = rptIncomeTaxC.ShowMultipleTaxCard(employeeId.ToString(), true, itemid, taxParamIdC, nextPayProcessDate, (int)currentUser.PayrollTypeID, reportType);
|
|
//bytes = rptIncomeTax.showTaxCard(employeeId, true, itemid, taxParamId, nextPayProcessDate, (int)currentUser.PayrollTypeID, reportType);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (employeeId > 0)
|
|
{
|
|
//bytes = rptIncomeTaxC.showTaxCard(employeeId, true, itemid, taxParamIdC, nextPayProcessDate, (int)currentUser.PayrollTypeID, reportType);
|
|
bytes = rptIncomeTaxC.ShowMultipleTaxCard(employeeId.ToString(), true, itemid, taxParamIdC, nextPayProcessDate, (int)currentUser.PayrollTypeID, reportType);
|
|
}
|
|
}
|
|
break;
|
|
case EnumReportType.CityBankTaxCard:
|
|
taxParamId = currentUser.TaxParamID.GetValueOrDefault();
|
|
if (!string.IsNullOrEmpty(sEmpIDs))
|
|
{
|
|
if (int.TryParse(sEmpIDs, out int result))
|
|
{
|
|
employeeId = result;
|
|
bytes = new RptIncomeTax().showTaxCardCityBank(employeeId, false, itemid, taxParamId, nextPayProcessDate, (int)currentUser.PayrollTypeID, reportType);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (employeeId > 0)
|
|
{
|
|
bytes = new RptIncomeTax().showTaxCardCityBank(employeeId, false, itemid, taxParamId, nextPayProcessDate, (int)currentUser.PayrollTypeID, reportType);
|
|
}
|
|
}
|
|
break;
|
|
case EnumReportType.MultipleTaxCard:
|
|
taxParamId = currentUser.TaxParamID.GetValueOrDefault();
|
|
bytes = new RptIncomeTax().ShowMultipleTaxCard(sEmpIDs, true, itemid, taxParamId, nextPayProcessDate, (int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.MultipleTaxCardMonthly:
|
|
taxParamId = currentUser.TaxParamID.GetValueOrDefault();
|
|
bytes = new RptIncomeTax().ShowMonthlyMultipleTaxCard(sEmpIDs, true, itemid, taxParamId, fromDate, (int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.MultipleEmpLeaveBalance:
|
|
MultipleEmpLeaveBalance multipleEmpLeaveBalance = new MultipleEmpLeaveBalance();
|
|
bytes = multipleEmpLeaveBalance.ShowMultipleEmpLeaveBalance(itemid, payrollTypeId, sEmpIDs, reportType);
|
|
break;
|
|
case EnumReportType.EmpLeaveLedger:
|
|
bytes = new EmpLeaveLedger().ShowReportNew(sEmpIDs, itemid, payrollTypeId, reportType);
|
|
break;
|
|
case EnumReportType.MultipleEmpLeaveLedger:
|
|
bytes = new EmpLeaveLedger().ShowReport(sEmpIDs, fromDate, toDate, itemid, payrollTypeId, reportType);
|
|
break;
|
|
case EnumReportType.CashRegister:
|
|
bytes = new rptSalarySheet().ShowCashRegisterReport(fromDate, sEmpIDs, payrollTypeId, reportType);
|
|
break;
|
|
case EnumReportType.TaxCertificate:
|
|
bool empwisechallan = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "incometax", "empwisechallan");
|
|
taxParamId = currentUser.TaxParamID.GetValueOrDefault();
|
|
if (empwisechallan)
|
|
{
|
|
bytes = new RptIncomeTax().ShowTaxCertificateEmpWiseChallan(sEmpIDs, itemid, payrollTypeId, currentUser.TaxParamID.GetValueOrDefault(), "PDF");
|
|
}
|
|
else
|
|
{
|
|
bytes = new RptIncomeTax().ShowTaxCertificate(sEmpIDs, itemid, payrollTypeId, currentUser.TaxParamID.GetValueOrDefault(), "PDF");
|
|
}
|
|
break;
|
|
case EnumReportType.HnMEmpLeaveLedger:
|
|
rptLeave rptLeave = new rptLeave();
|
|
bytes = rptLeave.ShowEmployeeWiseLeaveLedger(sEmpIDs, /*fromDate, toDate,*/ itemid, payrollTypeId, reportType);
|
|
break;
|
|
case EnumReportType.LeaveRegister:
|
|
rptLeave = new rptLeave();
|
|
if (string.IsNullOrEmpty(sEmpIDs))
|
|
{
|
|
throw new Exception("Select employee");
|
|
}
|
|
bytes = rptLeave.ShowLeaveRegister(sEmpIDs, itemid, bankId, payrollTypeId, reportType);
|
|
break;
|
|
case EnumReportType.LeaveEncashmentBankAdvice:
|
|
rptLeave = new rptLeave();
|
|
bytes = rptLeave.ShowLeaveEncashmentReports(sEmpIDs, itemid, selectedReport, payrollTypeId, reportType);
|
|
break;
|
|
case EnumReportType.CCWiseLeaveEncashmentReturn:
|
|
rptLeave = new rptLeave();
|
|
bytes = rptLeave.ShowCCWiseLeaveEncashmentReturn(itemid, payrollTypeId, reportType);
|
|
break;
|
|
case EnumReportType.DigitalServiceBook:
|
|
bytes = new rptDigitalServiceBook().DigitalServiceBook(currentUser.EmployeeID.HasValue ? currentUser.EmployeeID.Value : 0, (int)currentUser.PayrollTypeID, fromDate, sEmpIDs, reportType);
|
|
break;
|
|
case EnumReportType.SalaryAllocationReportEmployeeWise:
|
|
bytes = new rptJV().showJVSalaryDetailEmployeeWReport(1, GlobalFunctions.LastDateOfMonth(fromDate), null, payrollTypeId, reportType);
|
|
break;
|
|
case EnumReportType.SalaryAllocationReportCostCenterWise:
|
|
//if (locationIds.Length > 1)
|
|
//{
|
|
// throw new Exception("Select Single Locaion");
|
|
// Convert.ToInt32(locationIds);
|
|
//}
|
|
bytes = new rptJV().showJVLoactionWReport(1, GlobalFunctions.LastDateOfMonth(fromDate), null, payrollTypeId, reportType);
|
|
break;
|
|
case EnumReportType.SalaryAllocationSummaryReport:
|
|
bytes = new rptJV().showJVSummaryReport(1, GlobalFunctions.LastDateOfMonth(fromDate), locationId, payrollTypeId, reportType);
|
|
break;
|
|
case EnumReportType.PaySlipEcho:
|
|
if (reportType == "EMAIL")
|
|
{
|
|
//bool isForESS = false;
|
|
//if (sEmpIDs.Length == 0)
|
|
//{
|
|
// isForESS = true;
|
|
// sEmpIDs = employeeId.ToString();
|
|
//}
|
|
//bytes = new PaySlip().PayslipMail((int)currentUser.PayrollTypeID, fromDate, sEmpIDs, isForESS);
|
|
}
|
|
else
|
|
{
|
|
|
|
if (sEmpIDs.Length == 0)
|
|
{
|
|
isForESS = true;
|
|
sEmpIDs = employeeId.ToString();
|
|
}
|
|
bytes = new rptEcho().ShowPaySlipEcho((int)currentUser.PayrollTypeID, fromDate, sEmpIDs, isForESS);
|
|
}
|
|
break;
|
|
case EnumReportType.EchoSalarySheet:
|
|
bytes = new rptEcho().ShowSalarySheet((int)currentUser.PayrollTypeID, fromDate,
|
|
(int)EnumReportType.EchoSalarySheet, sEmpIDs, reportType);
|
|
break;
|
|
case EnumReportType.SalarySheetEcho:
|
|
break;
|
|
case EnumReportType.SalarySheetEchoNew:
|
|
bytes = new rptEcho().ShowSalarySheetEchoNew((int)currentUser.PayrollTypeID, fromDate,
|
|
(int)EnumReportType.EchoSalarySheet, sEmpIDs, reportType);
|
|
break;
|
|
case EnumReportType.BanglaPaySlipEcho:
|
|
bytes = new rptEcho().ShowBanglaPaySlip((int)currentUser.PayrollTypeID, fromDate, sEmpIDs, (int)EnumReportType.BanglaPayslip, reportType, (EnumBankCash)itemid);
|
|
break;
|
|
case EnumReportType.BankAdviceEcho:
|
|
bytes = new rptEcho().ShowBankAdviceReportEcho((int)currentUser.PayrollTypeID, fromDate,
|
|
sEmpIDs, bankId, reportType);
|
|
break;
|
|
case EnumReportType.CashAdviceEcho:
|
|
break;
|
|
case EnumReportType.ItemWiseSalaryEcho:
|
|
break;
|
|
case EnumReportType.OverallSummaryEcho:
|
|
break;
|
|
case EnumReportType.SalaryReconEcho:
|
|
break;
|
|
case EnumReportType.SalaryReconSummaryEcho:
|
|
break;
|
|
case EnumReportType.MultipleEmployeeJobCardEcho:
|
|
bytes = new rptEcho().ShowJobCardMultiple(fromDate, toDate, sEmpIDs, reportType, (int)currentUser.PayrollTypeID);
|
|
break;
|
|
case EnumReportType.DailyPresentEcho:
|
|
bytes = new rptEcho().ShowDailyPresent(fromDate, sEmpIDs, reportType, (int)currentUser.PayrollTypeID);
|
|
break;
|
|
case EnumReportType.DailyAbsentEcho:
|
|
bytes = new rptEcho().ShowDailyAbsent(fromDate, sEmpIDs, reportType, (int)currentUser.PayrollTypeID);
|
|
break;
|
|
case EnumReportType.OtBankDisbursementHnm:
|
|
bytes = new rptHnm().OTBankDisbursementHnm((int)currentUser.PayrollTypeID, fromDate, sEmpIDs, reportType);
|
|
break;
|
|
case EnumReportType.BonusRegisterHnm:
|
|
bytes = new rptHnm().BonusRegisterHNM(itemid, fromDate, sEmpIDs,
|
|
(int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.BankAdviceSalaryHnm:
|
|
bytes = new rptHnm().ShowNewBankDisbursmentReport((int)currentUser.PayrollTypeID, fromDate,
|
|
sEmpIDs, bankId, reportType);
|
|
break;
|
|
case EnumReportType.BonusBankAdviceHnm:
|
|
bytes = new rptHnm().BonusBankAdvice(itemid, fromDate, sEmpIDs,
|
|
(int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.OpiBankDisbursementHnm:
|
|
bytes = new rptHnm().OpiBankDisbursementHnm((int)currentUser.PayrollTypeID, fromDate,
|
|
sEmpIDs, bankId, reportType);
|
|
break;
|
|
case EnumReportType.OpiRegisterForTotalValue:
|
|
bytes = new rptHnm().OpiRegisterForTotalValue((int)currentUser.PayrollTypeID, fromDate, toDate,
|
|
sEmpIDs, itemid, reportType);
|
|
break;
|
|
case EnumReportType.AttendanceInformationEcho:
|
|
bytes = new rptEcho().GetEmpAttenInfo((int)currentUser.PayrollTypeID,
|
|
sEmpIDs, reportType);
|
|
break;
|
|
case EnumReportType.DailyInOutEcho:
|
|
bytes = new rptEcho().ShowDailyInOut(fromDate, sEmpIDs, reportType, (int)currentUser.PayrollTypeID);
|
|
break;
|
|
case EnumReportType.DailyAttnSummaryEcho:
|
|
bytes = new rptEcho().ShowDailyAttnSummary(fromDate, sEmpIDs, reportType, (int)currentUser.PayrollTypeID);
|
|
break;
|
|
case EnumReportType.InOutMissingEcho:
|
|
bytes = new rptEcho().ShowInOutMissing(fromDate, toDate, sEmpIDs, reportType, (int)currentUser.PayrollTypeID);
|
|
break;
|
|
case EnumReportType.MonthlyKpiEcho:
|
|
bytes = new rptEcho().ShowMonthlyKPI(fromDate, toDate, sEmpIDs, reportType, (int)currentUser.PayrollTypeID);
|
|
break;
|
|
case EnumReportType.EmployeeBasicInformationSGS:
|
|
bytes = new rptEmployee().GetEmpBasicInfo(sEmpIDs, (int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.EmployeeCurrentPostingDetailSGS:
|
|
bytes = new rptEmployee().GetEmpPostings(sEmpIDs, (int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.EmployeesCostAllocationDetailsSGS:
|
|
bytes = new rptEmployee().GetCostAllocationDetails(fromDate, sEmpIDs, (int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.EmployeesCostInformationDetailsSGS:
|
|
bytes = new rptEmployee().ShowCCInformation(fromDate, sEmpIDs, (int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.ShowItInvestmentSGS:
|
|
bytes = new RptIncomeTax().ShowITPfAndOtherDetails(reportType, sEmpIDs, (int)currentUser.PayrollTypeID, (int)currentUser.TaxParamID);
|
|
break;
|
|
case EnumReportType.CCSalaryDetailsSGS:
|
|
bytes = new rptSalarySheet().ShowDetailSalarySheetByCC((int)currentUser.PayrollTypeID, fromDate, sEmpIDs, reportType);
|
|
break;
|
|
case EnumReportType.CCSalarySummarySGS:
|
|
bytes = new rptSalarySheet().CCWiseSalarySummary((int)currentUser.PayrollTypeID, fromDate, sEmpIDs, reportType);
|
|
break;
|
|
case EnumReportType.EmployeeWiseCardInfoEcho:
|
|
bytes = new rptEmployee().EmployeeWiseCardInfo((int)currentUser.PayrollTypeID, sEmpIDs, reportType);
|
|
break;
|
|
case EnumReportType.SingleJobCardLiNFunf:
|
|
bytes = new AttendanceReport().ShowDateRangeJobCardSingleForLiFung(fromDate, sEmpIDs,
|
|
(int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.MultipleEmployeeJobCardLiNFunf:
|
|
bytes = new AttendanceReport().ShowDateRangeJobCardMultipleForLiFung(fromDate, sEmpIDs,
|
|
(int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
case EnumReportType.DailyPresentLiFung:
|
|
bytes = new AttendanceReport().DailyPresentForLiFung(fromDate,
|
|
sEmpIDs, reportType, (int)currentUser.PayrollTypeID);
|
|
break;
|
|
case EnumReportType.DailyAbsentLiFung:
|
|
bytes = new AttendanceReport().DailyAbsentForLiFung(fromDate,
|
|
sEmpIDs, reportType, (int)currentUser.PayrollTypeID);
|
|
break;
|
|
case EnumReportType.DailyOddLiFung:
|
|
bytes = new AttendanceReport().DailyOddForLiFung(fromDate,
|
|
sEmpIDs, reportType, (int)currentUser.PayrollTypeID);
|
|
break;
|
|
case EnumReportType.DailyAttnLiFung:
|
|
bytes = new AttendanceReport().DailyAttnForLiFung(fromDate,
|
|
sEmpIDs, reportType, (int)currentUser.PayrollTypeID);
|
|
break;
|
|
case EnumReportType.AttendanceSummaryLiFung:
|
|
bytes = new AttendanceReport().GetAttendanceSummaryForLiFung(fromDate,
|
|
sEmpIDs, reportType, (int)currentUser.PayrollTypeID);
|
|
break;
|
|
case EnumReportType.CostCenterWiseSalaryDetailsHNM:
|
|
bytes = new rptHnm().ShowSalarySheetReportByCC((int)currentUser.PayrollTypeID, fromDate, sEmpIDs, reportType, (int)EnumReportType.CostCenterWiseSalaryDetailsHNM);
|
|
break;
|
|
case EnumReportType.TaxPerquisite:
|
|
RptIncomeTax rptTax = new RptIncomeTax();
|
|
bytes = rptTax.ShowTaxPerquisite(fromDate, toDate, sEmpIDs, (int)currentUser.PayrollTypeID, reportType);
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
//fdata.CopyTo(ms);
|
|
//item.fileData = ms.ToArray();
|
|
//byte[] textAsBytes = ms.ToArray();
|
|
//this._hrEmployeeService.uplaodFile(item);
|
|
//string base64String = Convert.ToBase64String(bytes);
|
|
//Add default file name that can be used by client code for both MIME transfer and AJAX Blob.
|
|
return Ok(bytes);
|
|
// return Ok(File(bytes, "application/pdf"));
|
|
}
|
|
|
|
[HttpPost("getExceptionReport")]
|
|
public ActionResult GetExceptionReport(dynamic data)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
int itemId = (int)items["itemId"].ToObject<int>();
|
|
DateTime fromDate = (DateTime)items["fromDate"].ToObject<DateTime>();
|
|
string reportType = (string)items["reportType"].ToObject<string>();
|
|
DateTime toDate = (DateTime)items["toDate"].ToObject<DateTime>();
|
|
int subItemId = (int)items["subItemId"].ToObject<int>();
|
|
string subItemName = (string)items["subItemName"].ToObject<string>();
|
|
byte[] bytes = null;
|
|
int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
rptEmployee rptEmp = new rptEmployee();
|
|
DataSet resultDataSet = new DataSet();
|
|
|
|
try
|
|
{
|
|
switch (itemId)
|
|
{
|
|
case 1: // Employee Joining
|
|
DataTable ds = rptEmp.GetEmpJoining(fromDate, toDate, payrollTypeId);
|
|
bytes = reportProcessor.ShowForEmpJoiningExceptionReport(null, ds, fromDate.ToString("dd MMM yyyy") + " - " + toDate.ToString("dd MMM yyyy"), payrollTypeId, reportType);
|
|
break;
|
|
case 2: // Discontinue
|
|
DataTable oEmpHis = rptEmp.GetEmpHistories(fromDate, toDate, payrollTypeId);
|
|
bytes = reportProcessor.ShowForDiscontinueExceptionReport(null, oEmpHis, payrollTypeId, reportType);
|
|
break;
|
|
case 3: // Basic And Grade
|
|
DataTable basicGrade = rptEmp.GetEmpPromotion(fromDate, toDate, payrollTypeId);
|
|
//DataTable basicGrade = rptEmp.GetEmpBasicGrade(fromDate, toDate, payrollTypeId);
|
|
bytes = reportProcessor.ShowForBasicAndGradeReport(null, basicGrade, payrollTypeId, reportType);
|
|
break;
|
|
case 4: // Designation Change
|
|
DataTable designationChange = rptEmp.GetDesignationChange(fromDate, toDate, payrollTypeId);
|
|
bytes = reportProcessor.ShowForDesignationExceptionReport(null, designationChange, payrollTypeId, reportType);
|
|
break;
|
|
case 6: // Allowance
|
|
DataTable allowance = rptEmp.GetEmpAllowDeduct(fromDate, toDate, subItemId, subItemName + " Allowance", payrollTypeId);
|
|
bytes = reportProcessor.ShowForEmpAllowDeduct(null, allowance, fromDate, toDate, payrollTypeId, reportType);
|
|
break;
|
|
case 7: // Deduction
|
|
DataTable deduction = rptEmp.GetEmpAllowDeduct(fromDate, toDate, subItemId, subItemName + " Deduction", payrollTypeId);
|
|
bytes = reportProcessor.ShowForEmpAllowDeduct(null, deduction, fromDate, toDate, payrollTypeId, reportType);
|
|
break;
|
|
case 8: // Bank Advice
|
|
bytes = new rptEmployee().GetEmpBankHistory(fromDate, toDate, payrollTypeId, reportType);
|
|
//bytes = reportProcessor.ShowDlgForEmpBankHistory(null, bankAccount, fromDate, toDate, payrollTypeId, reportType);
|
|
break;
|
|
case 9: // Employee Continue From Discontinue
|
|
bytes = new rptEmployee().GetAllTransferDataForContinueFromDiscontinue(fromDate, toDate, payrollTypeId, reportType);
|
|
break;
|
|
case 10: // Employee Cost Center Allocation
|
|
bytes = new rptEmployee().ShowCCInformationByMonth(fromDate, toDate, payrollTypeId, reportType);
|
|
break;
|
|
case 11: //PF And Confirmation
|
|
bytes = new rptEmployee().PrepareDataForExceptionPFandConfirmation(fromDate, toDate, payrollTypeId, reportType);
|
|
break;
|
|
case 14: //Grevence
|
|
bytes = new rptEmployee().GetGrevenceData(fromDate, toDate, payrollTypeId, reportType);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok(bytes);
|
|
}
|
|
#endregion
|
|
|
|
#region Production Bonus Report
|
|
|
|
|
|
[HttpPost("getProductionBonusReport")]
|
|
public ActionResult getProductionBonusReport(dynamic data)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
int itemId = (int)items["itemId"].ToObject<int>();
|
|
DateTime salaryMonth = (DateTime)items["salaryMonth"].ToObject<DateTime>();
|
|
string reportType = (string)items["reportType"].ToObject<string>();
|
|
int designId = (int)items["designId"].ToObject<int>();
|
|
|
|
//int subItemId = (int)items["subItemId"].ToObject<int>();
|
|
//string subItemName = (string)items["subItemName"].ToObject<string>();
|
|
byte[] bytes = null;
|
|
int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
|
|
rptBonus rptBonus = new rptBonus();
|
|
|
|
try
|
|
{
|
|
switch (itemId)
|
|
{
|
|
case 1: // Monthly_Production_Bonus
|
|
bytes = rptBonus.MonthlyProdBonus(salaryMonth, payrollTypeId, reportType);
|
|
|
|
break;
|
|
case 2: // Employee and Design Wise
|
|
bytes = rptBonus.EmpDesignWiseProdBonus(salaryMonth, payrollTypeId, reportType);
|
|
break;
|
|
case 3: // Production Bonus Detail
|
|
bytes = rptBonus.ProdBonusDetail(designId, salaryMonth, payrollTypeId, reportType);
|
|
break;
|
|
case 4: // Design Wise Prod Bonus Attendance
|
|
bytes = rptBonus.DesignWiseProdBonusAttendance(designId, salaryMonth, payrollTypeId, reportType);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok(bytes);
|
|
}
|
|
#endregion Production Bonus Report
|
|
|
|
[HttpGet("getEstimatedConfirmation")]
|
|
public ActionResult GetEstimatedConfirmation()
|
|
{
|
|
DataSet ds = new DataSet();
|
|
try
|
|
{
|
|
ds = _employeeService.GetEstimatedConfirmationReport();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(ds);
|
|
}
|
|
[HttpGet("getEstimatedRetirement")]
|
|
public ActionResult GetEstimatedRetirement()
|
|
{
|
|
DataSet ds = new DataSet();
|
|
try
|
|
{
|
|
ds = _employeeService.GetEstimatedRetirementReport();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(ds);
|
|
}
|
|
|
|
[HttpGet("getListOfPromotion")]
|
|
public ActionResult GetListOfPromotion()
|
|
{
|
|
DataSet ds = new DataSet();
|
|
try
|
|
{
|
|
ds = _employeeService.GetListOfPromotion();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(ds);
|
|
}
|
|
[HttpGet("getListOfTransfer")]
|
|
public ActionResult GetListOfTransfer()
|
|
{
|
|
DataSet ds = new DataSet();
|
|
try
|
|
{
|
|
ds = _employeeService.GetListOfTransfer();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(ds);
|
|
}
|
|
[HttpGet("getJobSeparationList")]
|
|
public ActionResult GetJobSeparationList()
|
|
{
|
|
DataSet ds = new DataSet();
|
|
try
|
|
{
|
|
ds = _employeeService.GetJobSeparationList();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(ds);
|
|
}
|
|
[HttpGet("getConfirmedEmployeeList")]
|
|
public ActionResult GetConfirmedEmployeeList()
|
|
{
|
|
DataSet ds = new DataSet();
|
|
try
|
|
{
|
|
ds = _employeeService.GetConfirmedEmployeeList();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(ds);
|
|
}
|
|
|
|
[HttpPost("getFstranReportCalculation")]
|
|
public ActionResult GetFstranReportCalculation(dynamic data)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
int itemId = (int)items["tranId"].ToObject<int>();
|
|
byte[] bytes = null;
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
rptFSTran rptFstran = new rptFSTran();
|
|
try
|
|
{
|
|
|
|
bytes = rptFstran.ShowFSPaymentCalculationReport(itemId, (int)currentUser.PayrollTypeID);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok(bytes);
|
|
}
|
|
|
|
[HttpPost("getGratuityReportCalculation")]
|
|
public ActionResult GetGratuityReportCalculation(dynamic data)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
int itemId = (int)items["tranId"].ToObject<int>();
|
|
byte[] bytes = null;
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
rptFSTran rptFstran = new rptFSTran();
|
|
try
|
|
{
|
|
|
|
bytes = rptFstran.ShowGratuityPaymentCalculationReport(itemId, (int)currentUser.PayrollTypeID);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok(bytes);
|
|
}
|
|
|
|
[HttpPost("getEmpConfirmData")]
|
|
public ActionResult GetEmpConfirmData(dynamic data)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
DateTime confirmationDate = DateTime.Today;
|
|
if (items["confirmationDate"] != null)
|
|
confirmationDate = (DateTime)items["confirmationDate"].ToObject<DateTime>();
|
|
byte[] bytes = null;
|
|
rptEmployee rptEmployee = new rptEmployee();
|
|
try
|
|
{
|
|
|
|
bytes = rptEmployee.EmployeeConfirmationReport(confirmationDate, (int)currentUser.PayrollTypeID);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok(bytes);
|
|
}
|
|
|
|
#region Attendance
|
|
|
|
[HttpPost("getPaymentAdviceReportData")]
|
|
public ActionResult getPaymentAdviceReportData(dynamic data)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
int itemid = 0;
|
|
if (items["settlementAdviceId"] != null)
|
|
itemid = (int)items["settlementAdviceId"].ToObject<int>();
|
|
string reportType = (string)items["reportType"].ToObject<string>();
|
|
//string reportType = null;
|
|
int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
|
|
byte[] bytes = null;
|
|
try
|
|
{
|
|
bytes = new rptFSTran().ShowReport(itemid, reportType, payrollTypeId);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok(bytes);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region assetReport
|
|
[HttpPost("getAssetAcknowledgementReport")]
|
|
public ActionResult GetAssetAcknowledgementReport(dynamic data)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
int itemid = (int)items["itemid"].ToObject<int>();
|
|
int employeeid = (int)items["employeeid"].ToObject<int>();
|
|
byte[] bytes = null;
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
rptAssetSerial rptAssetSerial = new rptAssetSerial();
|
|
try
|
|
{
|
|
bytes = rptAssetSerial.GetAssetAcknowledgementdata(itemid, "PDF", (int)currentUser.PayrollTypeID, employeeid);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok(bytes);
|
|
}
|
|
#endregion
|
|
|
|
[HttpPost("exportCSVReportData")]
|
|
public ActionResult exportCSVReportData(dynamic data)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
EnumReportType reportid = (EnumReportType)items["reportid"].ToObject<int>();
|
|
int itemid = 0;
|
|
if (items["itemid"] != null)
|
|
itemid = (int)items["itemid"].ToObject<int>();
|
|
DateTime fromDate = DateTime.Today;
|
|
DateTime toDate = DateTime.Today;
|
|
string selectedReport = "";
|
|
string sEmpIDs = (string)items["empIds"].ToObject<string>();
|
|
if (items["selectedReport"] != null)
|
|
selectedReport = (string)items["selectedReport"].ToObject<string>();
|
|
string reportType = (string)items["reportType"].ToObject<string>();
|
|
if (items["fromDate"] != null)
|
|
fromDate = (DateTime)items["fromDate"].ToObject<DateTime>();
|
|
if (items["toDate"] != null)
|
|
toDate = (DateTime)items["toDate"].ToObject<DateTime>();
|
|
int bankId = 0;
|
|
if (items["bankId"] != null)
|
|
bankId = (int)items["bankId"].ToObject<int>();
|
|
string locationIds = string.Empty;
|
|
if (items["locationIds"] != null)
|
|
{
|
|
locationIds = (string)items["locationIds"].ToObject<string>();
|
|
}
|
|
|
|
int loanIssueId = 0;
|
|
|
|
if (items["loanIssueId"] != null)
|
|
{
|
|
loanIssueId = (int)items["loanIssueId"].ToObject<int>();
|
|
}
|
|
|
|
|
|
// string empBasicInfo = string.Empty;
|
|
byte[] bytes = null;
|
|
int employeeId = currentUser.EmployeeID.GetValueOrDefault();
|
|
int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
|
|
DateTime nextPayProcessDate = currentUser.NextPayProcessDate.GetValueOrDefault();
|
|
bool isForESS = false;
|
|
DataTable dt = null;
|
|
try
|
|
{
|
|
switch (reportid)
|
|
{
|
|
case EnumReportType.BankAdvice:
|
|
//rptBankAdvice rptBankAdvice = new rptBankAdvice();
|
|
//bytes = rptBankAdvice.ShowNewBankDisbursmentReport((int)currentUser.PayrollTypeID, fromDate,
|
|
// sEmpIDs, bankId, reportType);
|
|
if (sEmpIDs == "")
|
|
throw new Exception("Please Select Employee to Export");
|
|
DataTable oEmpBankAcc = new EmployeeBankAccountService().GetEmpBankAdvice2(GlobalFunctions.LastDateOfMonth(fromDate), sEmpIDs);
|
|
dt = oEmpBankAcc;
|
|
break;
|
|
case EnumReportType.BonusBankAdvice:
|
|
if (sEmpIDs == "")
|
|
throw new Exception("Please Select Employee to Export");
|
|
Bonus bonus = new BonusService().Get(itemid);
|
|
DataTable oBonusBankAdvice = (new BonusProcessService().GetBonusBankAdvice(bonus, GlobalFunctions.LastDateOfMonth(fromDate), sEmpIDs, payrollTypeId)).Tables[0];
|
|
dt = oBonusBankAdvice;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
//fdata.CopyTo(ms);
|
|
//item.fileData = ms.ToArray();
|
|
//byte[] textAsBytes = ms.ToArray();
|
|
//this._hrEmployeeService.uplaodFile(item);
|
|
//string base64String = Convert.ToBase64String(bytes);
|
|
//Add default file name that can be used by client code for both MIME transfer and AJAX Blob.
|
|
return Ok(dt);
|
|
// return Ok(File(bytes, "application/pdf"));
|
|
}
|
|
[HttpGet("GetLocationsByTier2")]
|
|
public ActionResult GetByTier(int employeeID)
|
|
{
|
|
try
|
|
{
|
|
List<Location> oLocations = new LocationService().GetByTier(2);
|
|
return Ok(oLocations);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
}
|
|
[HttpPost("getLeaveEncashmentData")]
|
|
public ActionResult getLeaveEncashmentData(dynamic data)
|
|
{
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
string reportType = (string)items["reportType"].ToObject<string>();
|
|
string sEmpIDs = (string)items["empIds"].ToObject<string>();
|
|
DateTime encashDate = (DateTime)items["encashDate"].ToObject<DateTime>();
|
|
byte[] bytes = null;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
try
|
|
{
|
|
bytes = new rptHnm().LeaveEncashmentSeparation(sEmpIDs, reportType, encashDate, (int)currentUser.PayrollTypeID);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
return Ok(bytes);
|
|
}
|
|
[HttpPost("getCCWisePFNewMemberWithAmount")]
|
|
public ActionResult getCCWisePFNewMemberWithAmount(dynamic data)
|
|
{
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
string reportType = (string)items["reportType"].ToObject<string>();
|
|
int locationId = (int)items["locationIds"].ToObject<int>();
|
|
DateTime pfMonth = (DateTime)items["pfMonth"].ToObject<DateTime>();
|
|
byte[] bytes = null;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
try
|
|
{
|
|
bytes = new rptHnm().CCWisePFNewMemberWithAmount(locationId, reportType, pfMonth, (int)currentUser.PayrollTypeID);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
return Ok(bytes);
|
|
}
|
|
[HttpPost("getEmployeeMaternityLeaveReport")]
|
|
public ActionResult getEmployeeMaternityLeaveReport(dynamic data)
|
|
{
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
int empId = (int)items["employeeID"].ToObject<int>();
|
|
string employeeShift = (string)items["employeeShift"].ToObject<string>();
|
|
string reportType = (string)items["reportType"].ToObject<string>();
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
// string empBasicInfo = string.Empty;
|
|
byte[] bytes = null;
|
|
try
|
|
{
|
|
bytes = new rptEmpMaternityReport().getEmployeeMaternityLeaveReport(empId, employeeShift, (int)currentUser.PayrollTypeID);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
return Ok(bytes);
|
|
|
|
}
|
|
|
|
[HttpPost("getLeaveApplication")]
|
|
public ActionResult getLeaveApplication(dynamic data)
|
|
{
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
int empId = (int)items["employeeID"].ToObject<int>();
|
|
//string reportType = (string)items["reportType"].ToObject<string>();
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
// string empBasicInfo = string.Empty;
|
|
int payrolltypeID = (int)currentUser.PayrollTypeID;
|
|
DateTime NextPayProcessDate = (DateTime)currentUser.NextPayProcessDate;
|
|
byte[] bytes = null;
|
|
try
|
|
{
|
|
bytes = new rptLeave().getLeaveApplication(empId, payrolltypeID, NextPayProcessDate);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
return Ok(bytes);
|
|
|
|
}
|
|
|
|
[HttpPost("getAppointmentLetter")]
|
|
public ActionResult getAppointmentLetter(dynamic data)
|
|
{
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
int empId = (int)items["employeeID"].ToObject<int>();
|
|
HREmployee employee = new HREmployeeService().Get(empId);
|
|
string report = (string)items["employeeType"].ToObject<string>();
|
|
bool isPhotoNeeded = false;
|
|
//string reportType = (string)items["reportType"].ToObject<string>();
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
// string empBasicInfo = string.Empty;
|
|
int payrolltypeID = (int)currentUser.PayrollTypeID;
|
|
DateTime NextPayProcessDate = (DateTime)currentUser.NextPayProcessDate;
|
|
byte[] bytes = null;
|
|
try
|
|
{
|
|
bytes = new rptEmployee().CollectDataForBanglaAppointment(employee, report, isPhotoNeeded);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
return Ok(bytes);
|
|
|
|
}
|
|
|
|
[HttpPost("getCostCenterWiseOpiData")]
|
|
public ActionResult getCostCenterWiseOpiData(dynamic data)
|
|
{
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
string reportType = (string)items["reportType"].ToObject<string>();
|
|
DateTime fromDate = (DateTime)items["fromDate"].ToObject<DateTime>();
|
|
int opiItemCode = (int)items["opiItemCode"].ToObject<int>();
|
|
byte[] bytes = null;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
try
|
|
{
|
|
bytes = new rptHnm().CostCenterWiseOpi(reportType, fromDate, opiItemCode, (int)currentUser.PayrollTypeID);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
return Ok(bytes);
|
|
}
|
|
[HttpPost("getCostCenterWiseBonusReportData")]
|
|
public ActionResult getCostCenterWiseBonusReportData(dynamic data)
|
|
{
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
string reportType = (string)items["reportType"].ToObject<string>();
|
|
DateTime fromDate = (DateTime)items["fromDate"].ToObject<DateTime>();
|
|
string bonusTypeName = (string)items["bonusTypeName"].ToObject<string>();
|
|
byte[] bytes = null;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
try
|
|
{
|
|
bytes = new rptHnm().CostCenterWiseBonusSummary(reportType, fromDate, bonusTypeName, (int)currentUser.PayrollTypeID);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
return Ok(bytes);
|
|
}
|
|
[HttpPost("getIdCardPrint")]
|
|
public ActionResult getIdCardPrint(dynamic data)
|
|
{
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
|
|
string reportType = (string)items["reportType"].ToObject<string>();
|
|
string sEmpIDs = (string)items["empIds"].ToObject<string>(); //comma seperated
|
|
int authorizedPerson = (int)items["selectedAuthorizePersonid"].ToObject<int>();
|
|
int reportCategory = (int)items["selectedReportTypeid"].ToObject<int>();
|
|
DateTime issueDate = (DateTime)items["issueDate"].ToObject<DateTime>();
|
|
string expireYear = (string)items["expireYear"].ToObject<string>();
|
|
|
|
byte[] bytes = null;
|
|
// CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
|
|
try
|
|
{
|
|
string RDLC = string.Empty;
|
|
if (reportCategory == 1)
|
|
{
|
|
RDLC = "IDCardPrint.rdlc";
|
|
bytes = new AttendanceReport().ShowEmpCardInfoPerPage(sEmpIDs, authorizedPerson, RDLC, true, expireYear, issueDate, reportCategory);//EmpSign and EmpPhoto Hardcoded as the data not available in database
|
|
}
|
|
else if (reportCategory == 2)
|
|
{
|
|
RDLC = "IDCardBothSidePrint.rdlc";
|
|
bytes = new AttendanceReport().ShowEmpCardInfoPerPage(sEmpIDs, authorizedPerson, RDLC, true, expireYear, issueDate, reportCategory);
|
|
}
|
|
else if (reportCategory == 3)
|
|
{
|
|
RDLC = "IDCardPrintBangla.rdlc";
|
|
bytes = new AttendanceReport().ShowEmpCardInfoPerPageBangla(sEmpIDs, authorizedPerson, RDLC, true, expireYear, issueDate);
|
|
}
|
|
else if (reportCategory == 4)
|
|
{
|
|
RDLC = "IDCardBothSidePrintBangla.rdlc";
|
|
bytes = new AttendanceReport().ShowEmpCardInfoPerPageBangla(sEmpIDs, authorizedPerson, RDLC, true, expireYear, issueDate);
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
return Ok(bytes);
|
|
}
|
|
[HttpPost("getUpComingConfirmationEmployee")]
|
|
public ActionResult getUpComingConfirmationEmployee(dynamic data)
|
|
{
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
string reportType = (string)items["reportType"].ToObject<string>();
|
|
int dayCount = (int)items["dayCount"].ToObject<int>();
|
|
DateTime fromDate = (DateTime)items["fromDate"].ToObject<DateTime>();
|
|
byte[] bytes = null;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
try
|
|
{
|
|
bytes = new rptEmployee().GetUpCommingEmpConfirmationForRekit(reportType, fromDate, dayCount, (int)currentUser.PayrollTypeID);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
return Ok(bytes);
|
|
}
|
|
[HttpPost("getOtMonthRange")]
|
|
public ActionResult getOtMonthRange(dynamic data)
|
|
{
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
string reportType = (string)items["reportType"].ToObject<string>();
|
|
DateTime fromDate = (DateTime)items["fromDate"].ToObject<DateTime>();
|
|
DateTime toDate = (DateTime)items["toDate"].ToObject<DateTime>();
|
|
byte[] bytes = null;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
try
|
|
{
|
|
bytes = new OTReport().OTMonthRange(reportType, fromDate, PayrollGlobalFunctions.PayrollLastDateOfMonth(toDate), (int)currentUser.PayrollTypeID);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
return Ok(bytes);
|
|
}
|
|
[HttpPost("getOtBranchWise")]
|
|
public ActionResult getOtBranchWise(dynamic data)
|
|
{
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
string reportType = (string)items["reportType"].ToObject<string>();
|
|
DateTime fromDate = (DateTime)items["fromDate"].ToObject<DateTime>();
|
|
byte[] bytes = null;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
try
|
|
{
|
|
bytes = new OTReport().OTBranchWise(reportType, fromDate, (int)currentUser.PayrollTypeID);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
return Ok(bytes);
|
|
}
|
|
[HttpPost("getOtDivisionWise")]
|
|
public ActionResult getOtDivisionWise(dynamic data)
|
|
{
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
string reportType = (string)items["reportType"].ToObject<string>();
|
|
DateTime fromYear = (DateTime)items["fromDate"].ToObject<DateTime>();
|
|
byte[] bytes = null;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
try
|
|
{
|
|
bytes = new OTReport().OTLocationWise(reportType, fromYear, (int)currentUser.PayrollTypeID);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
return Ok(bytes);
|
|
}
|
|
|
|
[HttpPost("getPRBCalculationSGS")]
|
|
public ActionResult getPRBCalculationSGS(dynamic data)
|
|
{
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
int empId = (int)items["employeeId"].ToObject<int>();
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
byte[] bytes = null;
|
|
try
|
|
{
|
|
DateTime prbYear = (DateTime)items["prbYear"].ToObject<DateTime>();
|
|
bytes = new rptBonus().PRBBonusCalculation(empId, prbYear);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
return Ok(bytes);
|
|
|
|
}
|
|
|
|
[HttpGet("getMaternityLeaveReport/{id}")]
|
|
public ActionResult getMaternityLeaveReport(int id)
|
|
{
|
|
//var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
//int empId = (int)items["employeeId"].ToObject<int>();
|
|
|
|
MaternityLeave maternityLeave = new MaternityLeaveService().Get(id);
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
byte[] bytes = null;
|
|
try
|
|
{
|
|
bytes = new rptLeave().GetMaternityLeaveReport(maternityLeave, (int)currentUser.PayrollTypeID);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
return Ok(bytes);
|
|
}
|
|
|
|
[HttpGet("showTaxCardMaternityLeave/{employeeId}")]
|
|
public ActionResult showTaxCardMaternityLeave(int employeeId)
|
|
{
|
|
//var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
//int employeeId = (int)items["employeeId"].ToObject<int>();
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
byte[] bytes = null;
|
|
try
|
|
{
|
|
bytes = new RptIncomeTax().showTaxCard(employeeId, true, currentUser.TaxParamID.GetValueOrDefault(), currentUser.TaxParamID.GetValueOrDefault(), currentUser.NextPayProcessDate.GetValueOrDefault(), (int)currentUser.PayrollTypeID, "PDF");
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
return Ok(bytes);
|
|
|
|
}
|
|
[HttpPost("getPFLedgerDataForReport")]
|
|
public ActionResult getPFLedgerDataForReport(dynamic data)
|
|
{
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
string reportType = (string)items["reportType"].ToObject<string>();
|
|
int sEmpID = (int)items["empID"].ToObject<int>();
|
|
DateTime fromDate = (DateTime)items["fromDate"].ToObject<DateTime>();
|
|
DateTime toDate = (DateTime)items["toDate"].ToObject<DateTime>();
|
|
byte[] bytes = null;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
try
|
|
{
|
|
bytes = new rptHnm().GetPFLedger(sEmpID, reportType, fromDate, toDate, (int)currentUser.PayrollTypeID);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
return Ok(bytes);
|
|
}
|
|
|
|
[HttpPost("getPFExceptionReport")]
|
|
public ActionResult getPFExceptionReport(dynamic data)
|
|
{
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
string reportType = (string)items["reportType"].ToObject<string>();
|
|
string sEmpID = (string)items["empIds"].ToObject<string>();
|
|
|
|
byte[] bytes = null;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
try
|
|
{
|
|
bytes = new rptHnm().getPFExceptionReport(sEmpID, reportType, (int)currentUser.PayrollTypeID);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
return Ok(bytes);
|
|
}
|
|
|
|
|
|
[HttpPost("getCandidateInterviewAssesment")]
|
|
public ActionResult getCandidateInterviewAssesment(dynamic data)
|
|
{
|
|
InterviewSession obs = null;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
int interviewSessionId = (int)items["interviewSessionId"].ToObject<int>();
|
|
int selectedRequisitionId = (int)items["selectedRequisitionId"].ToObject<int>();
|
|
byte[] bytes = null;
|
|
try
|
|
{
|
|
obs = new RecruitementProcessService().GetInterveiwSessionReport(interviewSessionId, selectedRequisitionId);
|
|
if (obs != null)
|
|
{
|
|
int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
|
|
rptCandidateInfo rptcInfo = new rptCandidateInfo();
|
|
bytes = rptcInfo.GetCandidatedata(obs, payrollTypeId, selectedRequisitionId);
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(bytes);
|
|
}
|
|
|
|
[HttpPost("getCCWiseSalarySummary")]
|
|
public ActionResult getCCWiseSalarySummary(dynamic data)
|
|
{
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
string reportType = (string)items["reportType"].ToObject<string>();
|
|
bool nonexpat = (bool)items["nonexpat"].ToObject<bool>();
|
|
DateTime salaryMonth = (DateTime)items["salaryMonth"].ToObject<DateTime>();
|
|
byte[] bytes = null;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
try
|
|
{
|
|
bytes = new rptHnm().CCWiseSalarySummary((int)currentUser.PayrollTypeID, reportType, nonexpat, salaryMonth);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
return Ok(bytes);
|
|
}
|
|
|
|
[HttpPost("getPMSReportData/{pmpYearID}/{pmsReportType}")]
|
|
public ActionResult getPMSReportData(int pmpYearID, int pmsReportType, List<SearchEmployee> emps)
|
|
{
|
|
DataSet ds = new DataSet();
|
|
string empIds = string.Empty;
|
|
try
|
|
{
|
|
if (!emps.Any())
|
|
empIds = string.Join(",", _employeeService.GetWithPayrollType(1).Select(e => e.ID));
|
|
else empIds = SearchEmployee.getEmpID(emps);
|
|
|
|
ds = new ObjectiveService().getPMSReportData(pmpYearID, pmsReportType, empIds);
|
|
//switch (pmsReportType)
|
|
//{
|
|
// case 1:
|
|
// break;
|
|
// case 2:
|
|
// break;
|
|
// default:
|
|
// break;
|
|
//}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok(ds.Tables[0]);
|
|
}
|
|
|
|
[HttpPost("getPMSReportDataByUserType")]
|
|
public ActionResult getPMSReportDataByUserType(dynamic data)
|
|
{
|
|
DataSet ds = new DataSet();
|
|
string empIds = string.Empty;
|
|
try
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
int pmpYearID = items["selectedPmsYearId"].ToObject<int>();
|
|
int pmsReportType = items["selectedreportType"].ToObject<int>();
|
|
string userType = (string)items["userType"].ToObject<string>();
|
|
empIds = (string)items["empIds"].ToObject<string>();
|
|
|
|
ds = new ObjectiveService().getPMSReportDataByUserType(pmpYearID, pmsReportType, userType, empIds, (int)currentUser?.EmployeeID);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok(ds.Tables[0]);
|
|
}
|
|
|
|
[HttpPost("getTrainingReports")]
|
|
public ActionResult getTrainingReports(dynamic data)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
int report = items["trainingReportType"].ToObject<int>();
|
|
//string sEmpIDs = (string)items["empIds"].ToObject<string>();
|
|
string reportType = (string)items["reportType"].ToObject<string>();
|
|
DateTime fromDate = DateTime.Today;
|
|
DateTime toDate = DateTime.Today;
|
|
if (items["fromDate"] != null)
|
|
fromDate = (DateTime)items["fromDate"].ToObject<DateTime>();
|
|
if (items["toDate"] != null)
|
|
toDate = (DateTime)items["toDate"].ToObject<DateTime>();
|
|
|
|
byte[] bytes = null;
|
|
try
|
|
{
|
|
//bytes = new rptTraining().ShowEmpTrainingInfo();
|
|
switch (report)
|
|
{
|
|
case 1:
|
|
//bytes = new rptTraining().ShowEmpTrainingInfo(sEmpIDs, currentUser.PayrollTypeID.GetValueOrDefault(), reportType);
|
|
bytes = new rptTraining().ShowEmpTrainingInfo(fromDate, toDate, currentUser.PayrollTypeID.GetValueOrDefault(), reportType);
|
|
break;
|
|
case 2:
|
|
bytes = new rptTraining().ShowUpcommingTraining(currentUser.PayrollTypeID.GetValueOrDefault(), reportType);
|
|
break;
|
|
case 3:
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
return Ok(bytes);
|
|
|
|
}
|
|
|
|
[HttpPost("getAttendanceReport/{reportType}")]
|
|
public ActionResult getAttendanceReport(List<dynamic> data, string reportType)
|
|
{
|
|
var json = JsonConvert.SerializeObject(data);
|
|
DataTable dataTable = (DataTable)JsonConvert.DeserializeObject(json, (typeof(DataTable)));
|
|
|
|
byte[] bytes = null;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
|
|
try
|
|
{
|
|
bytes = reportProcessor.getAttendanceReport(null, dataTable, payrollTypeId, reportType);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok(bytes);
|
|
}
|
|
|
|
[HttpPost("getScheduleGReport")]
|
|
public ActionResult GetScheduleGReport(List<dynamic> data)
|
|
{
|
|
var json = JsonConvert.SerializeObject(data);
|
|
DataTable dataTable = (DataTable)JsonConvert.DeserializeObject(json, (typeof(DataTable)));
|
|
int selectedParamId = Convert.ToInt32(dataTable.Rows[0]["selectedParamId"]);
|
|
|
|
byte[] bytes = null;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
|
|
RptIncomeTax rptIncomeTax = new RptIncomeTax();
|
|
TaxParameter tp = new TaxParameterService().Get(selectedParamId);
|
|
|
|
try
|
|
{
|
|
bytes = rptIncomeTax.showScheduleGReport(dataTable, payrollTypeId, tp);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok(bytes);
|
|
}
|
|
|
|
#region getLoanApplication
|
|
[HttpPost("getLoanApplication")]
|
|
public ActionResult getLoanApplication(dynamic data)
|
|
{
|
|
var oLoanApplication = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
int MemberID = (int)oLoanApplication["employeeid"].ToObject<int>();
|
|
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
|
|
byte[] bytes = null;
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
rptLoanApplication rptLoanApplication = new rptLoanApplication();
|
|
try
|
|
{
|
|
if (MemberID == 0)
|
|
{
|
|
bytes = rptLoanApplication.GetLoanApplicationdata(data, "PDF", currentUser.UserID, (int)currentUser.PayrollTypeID); //userID will be memberID
|
|
}
|
|
else
|
|
{
|
|
bytes = rptLoanApplication.GetLoanApplicationdata(data, "PDF", MemberID, (int)currentUser.PayrollTypeID);
|
|
}
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok(bytes);
|
|
}
|
|
#endregion
|
|
|
|
[HttpGet("showJVReport/{jvType}/{salaryDate}/{reportType}")]
|
|
public ActionResult showJVReport(int jvType, DateTime salaryDate, string reportType)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
int payrollTypeID = currentUser.PayrollTypeID.GetValueOrDefault();
|
|
byte[] bytes = null;
|
|
string title = "";
|
|
List<dynamic> data = new List<dynamic>();
|
|
try
|
|
{
|
|
bytes = new rptJV().showJVReport(jvType, GlobalFunctions.LastDateOfMonth(salaryDate), (int)currentUser.PayrollTypeID, reportType);
|
|
PayrollType payrollType = new PayrollTypeService().Get(payrollTypeID);
|
|
title = "JV Report_" + payrollType.CompanyName + "_" + salaryDate.ToString("MMMM_yyyy");
|
|
data.Add(bytes);
|
|
data.Add(title);
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
return Ok(data);
|
|
|
|
}
|
|
|
|
#region PMS / IDP reports
|
|
|
|
[HttpPost("getIDPReportData")]
|
|
public ActionResult getIDPReportData(dynamic data)
|
|
{
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
string reportType = (string)items["ReportType"].ToObject<string>();
|
|
int EmpID = (int)items["EmployeeID"].ToObject<int>();
|
|
int? pmpYearID = items["pmpYearID"] != null && !string.IsNullOrEmpty(items["pmpYearID"].ToString())
|
|
? items["pmpYearID"].ToObject<int>()
|
|
: (int?)null;
|
|
int ObjectiveSetID = (int)items["ObjectiveSetID"].ToObject<int>();
|
|
byte[] bytes = null;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
try
|
|
{
|
|
bytes = new global::Payroll.Report.rptPmp().getIDPReportData(EmpID, reportType, pmpYearID, (int)currentUser.PayrollTypeID, ObjectiveSetID);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
return Ok(bytes);
|
|
}
|
|
|
|
// Leadership Assessment is not part of this product, so the two leadership
|
|
// sheets Square merges in here are omitted; the remaining five are unchanged.
|
|
[HttpPost("getPmsAssessmentReport")]
|
|
public ActionResult getPmsAssessmentReport(dynamic data)
|
|
{
|
|
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
string reportType = (string)items["ReportType"].ToObject<string>();
|
|
int EmpID = (int)items["EmployeeID"].ToObject<int>();
|
|
int pmpYearID = (int)items["pmpYearID"].ToObject<int>();
|
|
ObjectiveSet oObjectiveSet = new ObjectiveSetService().GetObjectiveSetWithChild(EmpID, pmpYearID, false);
|
|
int ObjectiveSetID = oObjectiveSet.ID;
|
|
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
try
|
|
{
|
|
byte[] kpiReport = new global::Payroll.Report.rptPmp().getPmsKpiAssessmentReport(EmpID, pmpYearID, reportType, (int)currentUser.PayrollTypeID, "Evaluation");
|
|
byte[] assessmentReport = new global::Payroll.Report.rptPmp().getPmsAssessmentForm(EmpID, pmpYearID, reportType, (int)currentUser.PayrollTypeID);
|
|
byte[] developmentReport = new global::Payroll.Report.rptPmp().getPmsDevelopmentPlanReport(EmpID, reportType, pmpYearID, (int)currentUser.PayrollTypeID, ObjectiveSetID);
|
|
byte[] kpiSettingForm = new global::Payroll.Report.rptPmp().getPmsKpiAssessmentReport(EmpID, pmpYearID, reportType, (int)currentUser.PayrollTypeID, "Setting");
|
|
byte[] kpiSettingGuideline = new global::Payroll.Report.rptPmp().getPmsKpiSettingGuidelineReport(EmpID, pmpYearID, reportType, (int)currentUser.PayrollTypeID);
|
|
if (reportType == "PDF")
|
|
{
|
|
byte[] mergedPdf = MergePdfs(
|
|
kpiReport,
|
|
assessmentReport,
|
|
developmentReport,
|
|
kpiSettingForm,
|
|
kpiSettingGuideline
|
|
);
|
|
|
|
return Ok(Convert.ToBase64String(mergedPdf));
|
|
}
|
|
else
|
|
{
|
|
using var finalWorkbook = new XLWorkbook();
|
|
|
|
AddWorksheet(kpiReport, finalWorkbook, "KPI-Evaluation");
|
|
AddWorksheet(assessmentReport, finalWorkbook, "Assessment-Form");
|
|
AddWorksheet(developmentReport, finalWorkbook, "Development-Plan-Form");
|
|
AddWorksheet(kpiSettingForm, finalWorkbook, "KPI-2021");
|
|
AddWorksheet(kpiSettingGuideline, finalWorkbook, "KPI-Setting-Guideline");
|
|
|
|
using var stream = new MemoryStream();
|
|
finalWorkbook.SaveAs(stream);
|
|
|
|
return Ok(Convert.ToBase64String(stream.ToArray()));
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
}
|
|
|
|
private static void AddWorksheet(byte[] excelBytes, XLWorkbook destinationWorkbook, string worksheetName)
|
|
{
|
|
using var ms = new MemoryStream(excelBytes);
|
|
using var sourceWorkbook = new XLWorkbook(ms);
|
|
sourceWorkbook.Worksheet(1).CopyTo(destinationWorkbook, worksheetName);
|
|
}
|
|
|
|
private byte[] MergePdfs(params byte[][] pdfByteArrays)
|
|
{
|
|
using var outputStream = new MemoryStream();
|
|
|
|
using (var writer = new PdfWriter(outputStream))
|
|
using (var mergedDoc = new PdfDocument(writer))
|
|
{
|
|
var merger = new PdfMerger(mergedDoc);
|
|
|
|
foreach (var pdfBytes in pdfByteArrays)
|
|
{
|
|
if (pdfBytes == null || pdfBytes.Length == 0) continue;
|
|
|
|
using var inputStream = new MemoryStream(pdfBytes);
|
|
using var reader = new PdfReader(inputStream);
|
|
using var sourceDoc = new PdfDocument(reader);
|
|
|
|
merger.Merge(sourceDoc, 1, sourceDoc.GetNumberOfPages());
|
|
}
|
|
}
|
|
|
|
return outputStream.ToArray();
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|