EchoTex_Payroll/HRM.UI/Controllers/Report/ReportController.cs

1693 lines
81 KiB
C#
Raw Permalink Normal View History

2024-10-14 10:01:49 +06:00
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 System.Threading.Tasks;
using HRM.BO;
using System.Net.Http.Headers;
using HRM.DA;
using System.Data;
using Microsoft.Reporting.NETCore;
using AutoMapper.Configuration.Conventions;
using Org.BouncyCastle.Ocsp;
using Microsoft.ReportingServices.Interfaces;
using static iTextSharp.text.pdf.AcroFields;
using Ubiety.Dns.Core.Common;
using NPOI.SS.Formula.Functions;
using HRM.BO.Report;
using HRM.Report.PayrollDataSet;
using Newtonsoft.Json;
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);
}
#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.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");
if (bfixedAmount)
{
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);
}
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.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.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();
if (sEmpIDs.Length > 0)
{
employeeId = Convert.ToInt32(sEmpIDs);
}
bytes = rptIncomeTax.showTaxCard(employeeId, true, 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.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:
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;
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("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");
DataTable oBonusBankAdvice = (new BonusProcessService().GetBonusBankAdvice(itemid, 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>();
byte[] bytes = null;
try
{
obs = new RecruitementProcessService().GetInterveiwSessionReport(interviewSessionId);
int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
rptCandidateInfo rptcInfo = new rptCandidateInfo();
bytes = rptcInfo.GetCandidatedata(obs, payrollTypeId);
}
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();
try
{
ds = new ObjectiveService().getPMSReportData(pmpYearID, pmsReportType, SearchEmployee.getEmpID(emps));
//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("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);
}
}
}