2218 lines
		
	
	
		
			75 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
		
		
			
		
	
	
			2218 lines
		
	
	
		
			75 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| 
								 | 
							
								using Microsoft.AspNetCore.Http;
							 | 
						|||
| 
								 | 
							
								using Microsoft.AspNetCore.Mvc;
							 | 
						|||
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using System.Data;
							 | 
						|||
| 
								 | 
							
								using System.Collections.Generic;
							 | 
						|||
| 
								 | 
							
								using System.IO;
							 | 
						|||
| 
								 | 
							
								using System.Linq;
							 | 
						|||
| 
								 | 
							
								using HRM.BO;
							 | 
						|||
| 
								 | 
							
								//using Microsoft.AspNetCore.Razor.Language.Intermediate;
							 | 
						|||
| 
								 | 
							
								using Microsoft.AspNetCore.Authorization;
							 | 
						|||
| 
								 | 
							
								using DataSet = System.Data.DataSet;
							 | 
						|||
| 
								 | 
							
								using HRM.DA;
							 | 
						|||
| 
								 | 
							
								using IConfiguration = Microsoft.Extensions.Configuration.IConfiguration;
							 | 
						|||
| 
								 | 
							
								using HRM.BO.Configuration;
							 | 
						|||
| 
								 | 
							
								using Microsoft.Extensions.Options;
							 | 
						|||
| 
								 | 
							
								using Microsoft.Extensions.Configuration;
							 | 
						|||
| 
								 | 
							
								using HRM.DA.Service.Tax;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace HRM.UI.Controllers.Payroll
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    [Route("api/Tax")]
							 | 
						|||
| 
								 | 
							
								    [ApiController]
							 | 
						|||
| 
								 | 
							
								    [Authorize]
							 | 
						|||
| 
								 | 
							
								    public class IncomeTaxController : ControllerBase
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        private readonly IAdvanceIncomeTaxService _advanceIncomeTaxService;
							 | 
						|||
| 
								 | 
							
								        private readonly IEmployeeTaxInvestmentService _employeeTaxInvestmentService;
							 | 
						|||
| 
								 | 
							
								        private readonly IIncomeTaxService _incomeTaxService;
							 | 
						|||
| 
								 | 
							
								        private readonly IITEmpHeadService _itEmpHeadService;
							 | 
						|||
| 
								 | 
							
								        private readonly IMinTaxExceptionService _minTaxExceptionService;
							 | 
						|||
| 
								 | 
							
								        private readonly ITaxAdjustmentService _taxAdjustmentService;
							 | 
						|||
| 
								 | 
							
								        private readonly ITaxChallanService _taxChallanService;
							 | 
						|||
| 
								 | 
							
								        private readonly ITaxHeadAssignmentService _taxHeadAssignmentService;
							 | 
						|||
| 
								 | 
							
								        private readonly ITaxInvestmentService _taxInvestmentService;
							 | 
						|||
| 
								 | 
							
								        private readonly ITaxMergeMasterService _taxMergeMasterService;
							 | 
						|||
| 
								 | 
							
								        private readonly ITaxParameterService _taxParameterService;
							 | 
						|||
| 
								 | 
							
								        private readonly ITaxReturnService _taxReturnService;
							 | 
						|||
| 
								 | 
							
								        private readonly IEmpTaxAitService _empTaxAitService;
							 | 
						|||
| 
								 | 
							
								        private readonly IPayrollTypeService _payrollTypeService;
							 | 
						|||
| 
								 | 
							
								        private readonly IConfiguration _config;
							 | 
						|||
| 
								 | 
							
								        private readonly IOptions<EmailSettings> _emailSettings;
							 | 
						|||
| 
								 | 
							
								        private readonly IEmployeeService _employeeService;
							 | 
						|||
| 
								 | 
							
								        private readonly IEmployeeTaxExcecptionService _employeeExceptionService;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        public IncomeTaxController(IAdvanceIncomeTaxService advanceIncomeTaxService,
							 | 
						|||
| 
								 | 
							
								            IEmployeeTaxInvestmentService employeeTaxInvestmentService,
							 | 
						|||
| 
								 | 
							
								            IIncomeTaxService incomeTaxService,
							 | 
						|||
| 
								 | 
							
								            IITEmpHeadService itEmpHeadService,
							 | 
						|||
| 
								 | 
							
								            IMinTaxExceptionService minTaxExceptionService,
							 | 
						|||
| 
								 | 
							
								            ITaxAdjustmentService taxAdjustmentService,
							 | 
						|||
| 
								 | 
							
								            ITaxChallanService taxChallanService,
							 | 
						|||
| 
								 | 
							
								            ITaxHeadAssignmentService taxHeadAssignmentService,
							 | 
						|||
| 
								 | 
							
								            ITaxInvestmentService taxInvestmentService,
							 | 
						|||
| 
								 | 
							
								            ITaxMergeMasterService taxMergeMasterService,
							 | 
						|||
| 
								 | 
							
								            ITaxParameterService taxParameterService,
							 | 
						|||
| 
								 | 
							
								            ITaxReturnService taxReturnService,
							 | 
						|||
| 
								 | 
							
								            IEmpTaxAitService empTaxAitService,
							 | 
						|||
| 
								 | 
							
								            IPayrollTypeService payrollTypeService, IConfiguration config, IOptions<EmailSettings> emailSettings, IEmployeeService employeeService, IEmployeeTaxExcecptionService employeeExceptionService)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            this._advanceIncomeTaxService = advanceIncomeTaxService;
							 | 
						|||
| 
								 | 
							
								            this._employeeTaxInvestmentService = employeeTaxInvestmentService;
							 | 
						|||
| 
								 | 
							
								            this._incomeTaxService = incomeTaxService;
							 | 
						|||
| 
								 | 
							
								            this._itEmpHeadService = itEmpHeadService;
							 | 
						|||
| 
								 | 
							
								            this._minTaxExceptionService = minTaxExceptionService;
							 | 
						|||
| 
								 | 
							
								            this._taxAdjustmentService = taxAdjustmentService;
							 | 
						|||
| 
								 | 
							
								            this._taxChallanService = taxChallanService;
							 | 
						|||
| 
								 | 
							
								            this._taxHeadAssignmentService = taxHeadAssignmentService;
							 | 
						|||
| 
								 | 
							
								            this._taxInvestmentService = taxInvestmentService;
							 | 
						|||
| 
								 | 
							
								            this._taxMergeMasterService = taxMergeMasterService;
							 | 
						|||
| 
								 | 
							
								            this._taxParameterService = taxParameterService;
							 | 
						|||
| 
								 | 
							
								            this._taxReturnService = taxReturnService;
							 | 
						|||
| 
								 | 
							
								            this._empTaxAitService = empTaxAitService;
							 | 
						|||
| 
								 | 
							
								            _payrollTypeService = payrollTypeService;
							 | 
						|||
| 
								 | 
							
								            this._config = config;
							 | 
						|||
| 
								 | 
							
								            this._emailSettings = emailSettings;
							 | 
						|||
| 
								 | 
							
								            this._employeeService = employeeService;
							 | 
						|||
| 
								 | 
							
								            this._employeeExceptionService = employeeExceptionService;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getAdvanceIncomeTaxById/{id}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetAdvanceIncomeTaxById(int id)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            AdvanceIncomeTax incomeTax = new AdvanceIncomeTax();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                incomeTax = _advanceIncomeTaxService.Get(id);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(incomeTax);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getAllAdvanceIncomeTax")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetAllAdvanceIncomeTax()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<AdvanceIncomeTax> incomeTaxs = new List<AdvanceIncomeTax>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                incomeTaxs = _advanceIncomeTaxService.Get();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(incomeTaxs);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("saveAdvanceIncomeTax")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult SaveAdvanceIncomeTax(AdvanceIncomeTax advanceIncomeTax)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _advanceIncomeTaxService.Save(advanceIncomeTax);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(advanceIncomeTax);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("deleteAdvanceIncomeTax")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult DeleteAdvanceIncomeTax(int id)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _advanceIncomeTaxService.Delete(id);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        // EmployeeTaxInvestment
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getEmployeeTaxInvestmentById/{id}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetEmployeeTaxInvestmentById(int id)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            EmployeeTaxInvestment employeeTaxInvestment = new EmployeeTaxInvestment();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                employeeTaxInvestment = _employeeTaxInvestmentService.Get(id);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(employeeTaxInvestment);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getAllEmployeeTaxInvestment")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetAllEmployeeTaxInvestment()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<EmployeeTaxInvestment> employeeTaxInvestments = new List<EmployeeTaxInvestment>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                employeeTaxInvestments = _employeeTaxInvestmentService.Get();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(employeeTaxInvestments);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getAllUsersInfo")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetAllUsersInfo()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<EmployeeTaxInvestment> employeeTaxInvestments = null;
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                employeeTaxInvestments = _employeeTaxInvestmentService.GetAllUsersInfo();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(employeeTaxInvestments);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getAmount/{taxParamId}/{employeeId}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetAmount(int taxParamId, int employeeId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            Double result;
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                result = _employeeTaxInvestmentService.GetAmount(taxParamId, employeeId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(result);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getSingleEmpsInfo/{empid}/{taxparamid}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetSingleEmpsInfo(int empid, int taxparamid)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<EmployeeTaxInvestment> employeeTaxInvestments = new List<EmployeeTaxInvestment>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                employeeTaxInvestments = _employeeTaxInvestmentService.GetSingleEmpsInfo(empid, taxparamid);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(employeeTaxInvestments);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("saveEmployeeTaxInvestment")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult SaveEmployeeTaxInvestment(EmployeeTaxInvestment taxInvestment)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            int id = 0;
							 | 
						|||
| 
								 | 
							
								            string connectionString = _config.GetSection("dbSettings").GetSection("SqlCommandConnection").Value;
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (taxInvestment.TaxAttachment != null)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    if (taxInvestment.TaxAttachment.ID <= 0 && taxInvestment.TaxAttachment.PreviousFileTobase64 != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        string[] items = taxInvestment.TaxAttachment.PreviousFileTobase64.Split(new char[] { ',', ' ' }, StringSplitOptions.None);
							 | 
						|||
| 
								 | 
							
								                        byte[] newBytes = Convert.FromBase64String(items[1]);
							 | 
						|||
| 
								 | 
							
								                        taxInvestment.TaxAttachment.FileAsByteArray = newBytes;
							 | 
						|||
| 
								 | 
							
								                        taxInvestment.TaxAttachment.ConnectionString = connectionString;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                id = _employeeTaxInvestmentService.Save(taxInvestment);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(id);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        //[HttpPost]
							 | 
						|||
| 
								 | 
							
								        //[Route("saveEmployeeTaxInvestmentList")]
							 | 
						|||
| 
								 | 
							
								        //public ActionResult SaveEmployeeTaxInvestmentList(List<EmployeeTaxInvestment> employeeTaxInvestments)
							 | 
						|||
| 
								 | 
							
								        //{
							 | 
						|||
| 
								 | 
							
								        //	try
							 | 
						|||
| 
								 | 
							
								        //	{
							 | 
						|||
| 
								 | 
							
								        //		_employeeTaxInvestmentService.Save(employeeTaxInvestments);
							 | 
						|||
| 
								 | 
							
								        //	}
							 | 
						|||
| 
								 | 
							
								        //	catch (Exception e)
							 | 
						|||
| 
								 | 
							
								        //	{
							 | 
						|||
| 
								 | 
							
								        //		return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								        //	}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        //	return Ok();
							 | 
						|||
| 
								 | 
							
								        //}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("deleteEmployeeTaxInvestment")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult DeleteEmployeeTaxInvestment(EmployeeTaxInvestment item)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _employeeTaxInvestmentService.Delete(item.ID);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        // IncomeTax
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getPrvYearTax/{taxParameterId}/{groupCode}/{itemId}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetPrvYearTax(int taxParameterId, EnumIncomeTaxItemGroup groupCode, int itemId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<IncomeTax> incomeTaxes = new List<IncomeTax>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                incomeTaxes = _incomeTaxService.GetPrvYear(taxParameterId, groupCode, itemId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(incomeTaxes);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getPrvYearTaxByPayrollId/{taxParameterId}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetPrvYearTaxByPayrollId(int taxParameterId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
							 | 
						|||
| 
								 | 
							
								            List<IncomeTax> incomeTaxes = new List<IncomeTax>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                incomeTaxes = _incomeTaxService.GetPrvYear(taxParameterId, payrollTypeId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(incomeTaxes);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxByEmployeeIdAndDataForm/{employeeId}/{dataFrom}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxByEmployeeIdAndDataForm(int employeeId, int dataFrom)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<IncomeTax> incomeTaxes = new List<IncomeTax>();
							 | 
						|||
| 
								 | 
							
								            EnumIncomeTaxDataFrom frm = (EnumIncomeTaxDataFrom)dataFrom;
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                incomeTaxes = _incomeTaxService.Get(employeeId, frm);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(incomeTaxes);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxByDataFormAndPayrollTypeId/{dataFrom}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxByDataFormAndPayrollTypeId(EnumIncomeTaxDataFrom dataForm)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
							 | 
						|||
| 
								 | 
							
								            List<IncomeTax> incomeTaxes = new List<IncomeTax>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                incomeTaxes = _incomeTaxService.Get(dataForm, payrollTypeId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(incomeTaxes);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxByDataFormAndEmpIdsAndPayrollTypeId/{dataFrom}/{empIds}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxByDataFormAndEmpIdsAndPayrollTypeId(EnumIncomeTaxDataFrom dataForm, string empIds)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
							 | 
						|||
| 
								 | 
							
								            List<IncomeTax> incomeTaxes = new List<IncomeTax>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                incomeTaxes = _incomeTaxService.Get(dataForm, empIds, payrollTypeId, null);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(incomeTaxes);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxByDataFormAndEmpIdAndTaxParamId/{dataFrom}/{empId}/{taxParamId}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxByDataFormAndEmpIdAndTaxParamId(int dataFrom, int empId,
							 | 
						|||
| 
								 | 
							
								            int taxParamId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<IncomeTax> incomeTaxes = new List<IncomeTax>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								                if (currentUser.TaxParamID != taxParamId)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    dataFrom = 1;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                incomeTaxes = _incomeTaxService.Get((EnumIncomeTaxDataFrom)dataFrom, empId, taxParamId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(incomeTaxes);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTax/{dataFrom}/{empId}/{groupCode}/{itemId}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTax(EnumIncomeTaxDataFrom dataForm, int empId, EnumIncomeTaxItemGroup groupCode,
							 | 
						|||
| 
								 | 
							
								            int itemId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            IncomeTax incomeTax = new IncomeTax();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                incomeTax = _incomeTaxService.Get(dataForm, empId, groupCode, itemId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(incomeTax);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxByYear/{taxParamId}/{dataFrom}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxByYear(int taxParamId, EnumIncomeTaxDataFrom dataForm)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
							 | 
						|||
| 
								 | 
							
								            List<IncomeTax> incomeTaxes = new List<IncomeTax>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                incomeTaxes = _incomeTaxService.GetByYear(taxParamId, dataForm, payrollTypeId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(incomeTaxes);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("updateOt")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult UpdateOt(List<OTProcess> otProcess)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _incomeTaxService.UpdateOT(otProcess);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("saveIncomeTax")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult SaveIncomeTaxTemp(IncomeTax incomeTax)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            int id = 0;
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                id = _incomeTaxService.Save(incomeTax, incomeTax.DataTo);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(id);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("doYearEndReProcessTax")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult DoYearEndReProcessTax(TaxParameter oparam)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _incomeTaxService.DoYearEndReProcess(oparam.ID, payrollTypeId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        //[HttpPost]
							 | 
						|||
| 
								 | 
							
								        //[Route("doTaxYearEnd")]
							 | 
						|||
| 
								 | 
							
								        //public ActionResult DoTaxYearEnd(List<IncomeTax> incomeTaxes)
							 | 
						|||
| 
								 | 
							
								        //{
							 | 
						|||
| 
								 | 
							
								        //    CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								        //    int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
							 | 
						|||
| 
								 | 
							
								        //    try
							 | 
						|||
| 
								 | 
							
								        //    {
							 | 
						|||
| 
								 | 
							
								        //        _incomeTaxService.DoTaxYearEnd(incomeTaxes, payrollTypeId);
							 | 
						|||
| 
								 | 
							
								        //    }
							 | 
						|||
| 
								 | 
							
								        //    catch (Exception e)
							 | 
						|||
| 
								 | 
							
								        //    {
							 | 
						|||
| 
								 | 
							
								        //        return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								        //    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        //    return Ok();
							 | 
						|||
| 
								 | 
							
								        //}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("DoTaxYearEnd")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult DoTaxYearEnd(dynamic item)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _incomeTaxService.DoTaxYearEnd((int)currentUser.PayrollTypeID);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("TaxRecalculate")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult TaxRecalculate(dynamic recalData)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(recalData));
							 | 
						|||
| 
								 | 
							
								            int index = 0;
							 | 
						|||
| 
								 | 
							
								            List<SearchEmployee> searhemp = new List<SearchEmployee>();
							 | 
						|||
| 
								 | 
							
								            string empid = "";
							 | 
						|||
| 
								 | 
							
								            int taxparamid = 0;
							 | 
						|||
| 
								 | 
							
								            EnumIncomeTaxDataFrom dataFrom = EnumIncomeTaxDataFrom.ProcessTempData;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            foreach (var item in items)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (index == 0)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    taxparamid = (int)item["taxParamID"].ToObject<int>();
							 | 
						|||
| 
								 | 
							
								                    dataFrom = (EnumIncomeTaxDataFrom)item["taxParamID"].ToObject<int>();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                empid = empid + (string)item["empid"].ToObject<string>() + ",";
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            if (empid.Length > 0)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                empid = empid.Substring(0, empid.Length - 1);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            List<IncomeTax> taxItems = new List<IncomeTax>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                List<Employee> employees = new EmployeeService().GetByEmpIDs(empid, (int)currentUser.PayrollTypeID);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                taxItems = new TaxCalculator().TaxReconsiliation((int)currentUser.PayrollTypeID, employees, taxparamid,
							 | 
						|||
| 
								 | 
							
								                            dataFrom);
							 | 
						|||
| 
								 | 
							
								                this._incomeTaxService.Save(taxItems, dataFrom);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(true);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("saveTaxList")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult SaveTaxList(List<IncomeTax> incomeTaxes, EnumIncomeTaxDataFrom saveTo)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _incomeTaxService.Save(incomeTaxes, saveTo);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("deleteTax")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult DeleteTax(IncomeTax item)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _incomeTaxService.Delete(item.EmployeeID, item.DataTo, item.ItemGroup, item.ItemID);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("deleteYearlyDataTax")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult DeleteYearlyDataTax(int taxParamID, EnumIncomeTaxDataFrom deleteFrom, int empId,
							 | 
						|||
| 
								 | 
							
								            EnumIncomeTaxItemGroup itemGroup, int itemId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _incomeTaxService.DeleteYearlyData(taxParamID, deleteFrom, empId, itemGroup, itemId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("doTaxTempReProcessTax")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult DoTaxTempReProcessTax(List<IncomeTax> incomeTaxes, int taxParameterId,
							 | 
						|||
| 
								 | 
							
								            EnumIncomeTaxDataFrom saveTo)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _incomeTaxService.DoTaxTempReProcess(incomeTaxes, taxParameterId, saveTo, payrollTypeId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet]
							 | 
						|||
| 
								 | 
							
								        [Route("hasTaxDataInSalaryTemp/{employeeID}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult HasDataInTempTax(int employeeId, int TaxParamID)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            bool status = false;
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                status = _incomeTaxService.hasTaxDataInSalaryTemp(employeeId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(status);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet]
							 | 
						|||
| 
								 | 
							
								        [Route("getcurrentYeardataSource/{employeeID}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult getcurrentYeardataSource(int employeeId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            EnumIncomeTaxDataFrom status = EnumIncomeTaxDataFrom.ProcessTempData;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                status = _incomeTaxService.currentYeardataSource(employeeId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(status);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("TaxCalculationbySalary")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult TaxCalculationbySalary(SalaryMonthly salaries)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<IncomeTax> incomeTaxes = new List<IncomeTax>();
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                //     TaxParameter otaxParam = new ITaxParameterService(). 
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                incomeTaxes = _incomeTaxService.calculateTaxFromSalary(salaries);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(incomeTaxes);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        // ITEmpHead
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getITEmpHead/{id}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetITEmpHead(int id)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            ITEmpHead itEmpHead = new ITEmpHead();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                itEmpHead = _itEmpHeadService.Get(id);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(itEmpHead);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getITEmpHeadWithTaxParam/{taxParamId}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetITEmpHeadWithTaxParam(int taxParamId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<ITEmpHead> itEmpHeads = new List<ITEmpHead>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                itEmpHeads = _itEmpHeadService.GetWithTaxParam(taxParamId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(itEmpHeads);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("saveITEmpHead")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult SaveITEmpHead(ITEmpHead itEmpHead)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser ouser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            if (itEmpHead.IsNew)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                itEmpHead.CreatedBy = ouser.UserID;
							 | 
						|||
| 
								 | 
							
								                itEmpHead.CreatedDate = DateTime.Today;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                itEmpHead.ModifiedBy = ouser.UserID;
							 | 
						|||
| 
								 | 
							
								                itEmpHead.ModifiedDate = DateTime.Today;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _itEmpHeadService.Save(itEmpHead);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("saveITEmpHead2")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult SaveITEmpHead2(ITEmpHead itEmpHead)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _itEmpHeadService.Save2(itEmpHead);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("deleteITEmpHead")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult DeleteITEmpHead(ITEmpHead itEmpHead)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _itEmpHeadService.Delete(itEmpHead);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        // MinTaxException
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getAllMinTaxException")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetAllMinTaxException()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<MinTaxException> minTaxExceptions = new List<MinTaxException>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                minTaxExceptions = _minTaxExceptionService.Get();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(minTaxExceptions);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getMinTaxExceptionByEmpId/{empId}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetMinTaxExceptionByEmpId(int empId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            MinTaxException minTaxException = new MinTaxException();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                minTaxException = _minTaxExceptionService.Get(empId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(minTaxException);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("saveMinTaxException")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult SaveMinTaxException(List<MinTaxException> minTaxExceptions)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _minTaxExceptionService.Save(minTaxExceptions);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("deleteMinTaxException")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult DeleteMinTaxException(int id)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _minTaxExceptionService.Delete(id);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        // TaxAdjustment
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxAdjustment/{id}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxAdjustment(int id)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            TaxAdjustment taxAdjustment = new TaxAdjustment();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxAdjustment = _taxAdjustmentService.Get(id);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxAdjustment);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getAllTaxAdjustment")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetAllTaxAdjustment()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<TaxAdjustment> taxAdjustments = new List<TaxAdjustment>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxAdjustments = _taxAdjustmentService.Get();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxAdjustments);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getAllTaxAdjustmentByEnumStatus/{status}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetAllTaxAdjustmentByEnumStatus(EnumStatus status)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<TaxAdjustment> taxAdjustments = new List<TaxAdjustment>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxAdjustments = _taxAdjustmentService.Get(status);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxAdjustments);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("saveTaxAdjustment")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult SaveTaxAdjustment(TaxAdjustment taxAdjustment)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _taxAdjustmentService.Save(taxAdjustment);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxAdjustment);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("deleteTaxAdjustment")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult DeleteTaxAdjustment(int id)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _taxAdjustmentService.Delete(id);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        // TaxChallan
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxChallanById/{id}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxChallanById(int id)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            TaxChallan taxChallan = new TaxChallan();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxChallan = _taxChallanService.Get(id);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxChallan);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getAllTaxChallan")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetAllTaxChallan()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<TaxChallan> taxChallans = new List<TaxChallan>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxChallans = _taxChallanService.Get();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxChallans);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getByTaxParamId/{taxParamId}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetByTaxParamId(int taxParamId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<TaxChallan> taxChallans = new List<TaxChallan>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxChallans = _taxChallanService.GetByTaxParamId(taxParamId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxChallans);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxChallanByEmpIdAndTaxParamId/{empId}/{taxParamId}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxChallanByEmpIdAndTaxParamId(int empId, int taxParamId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<TaxChallan> taxChallans = new List<TaxChallan>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxChallans = _taxChallanService.Get(empId, taxParamId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxChallans);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("saveTaxChallan")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult SaveTaxChallan(TaxChallan taxChallan)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _taxChallanService.Save(taxChallan);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxChallan);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("deleteTaxChallan")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult DeleteTaxChallanById(TaxChallan item)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _taxChallanService.Delete(item.ID);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("deleteAllByTaxParamId")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult DeleteAllByTaxParamId(int taxParamId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _taxChallanService.DeleteAllByTaxparamID(taxParamId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        // TaxHeadAssignment
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxHeadAssignmentById/{id}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxHeadAssignmentById(int id)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            TaxHeadAssignment taxHeadAssignment = new TaxHeadAssignment();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxHeadAssignment = _taxHeadAssignmentService.Get(id);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxHeadAssignment);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getAllTaxHeadAssignment")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetAllTaxHeadAssignment()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<TaxHeadAssignment> taxHeadAssignments = new List<TaxHeadAssignment>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxHeadAssignments = _taxHeadAssignmentService.Get();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxHeadAssignments);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("saveTaxHeadAssignment")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult SaveTaxHeadAssignment(TaxHeadAssignment taxHeadAssignment)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _taxHeadAssignmentService.Save(taxHeadAssignment);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("deleteTaxHeadAssignment")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult DeleteTaxHeadAssignment(int id)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _taxHeadAssignmentService.Delete(id);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        // TaxInvestment
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxInvestmentById/{id}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxInvestmentById(int id)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            TaxInvestment taxInvestment = new TaxInvestment();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxInvestment = _taxInvestmentService.Get(id);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxInvestment);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxInvestmentByStatus/{status}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxInvestmentByStatus(EnumStatus status)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<TaxInvestment> taxInvestments = new List<TaxInvestment>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxInvestments = _taxInvestmentService.Get(status);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxInvestments);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getInfoForAdmin/{taxParamId}/{entryFrom}/{taxEffect}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult getInfoForAdmin(int taxParamId, int entryFrom, int taxEffect)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            DataTable dt = null;
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                dt = _taxInvestmentService.GetInfoForAdmin(taxParamId, entryFrom, taxEffect);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(dt);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        //need to work
							 | 
						|||
| 
								 | 
							
								        //[HttpGet("getInvestmentDetailAdmin/{taxParamId}")]
							 | 
						|||
| 
								 | 
							
								        //public ActionResult getInvestmentDetailAdmin(int taxParamId)
							 | 
						|||
| 
								 | 
							
								        //{
							 | 
						|||
| 
								 | 
							
								        //    DataTable dt = null;
							 | 
						|||
| 
								 | 
							
								        //    try
							 | 
						|||
| 
								 | 
							
								        //    {
							 | 
						|||
| 
								 | 
							
								        //        dt = _taxInvestmentService.GetInvestmentDetailAdmin(taxParamId);
							 | 
						|||
| 
								 | 
							
								        //    }
							 | 
						|||
| 
								 | 
							
								        //    catch (Exception e)
							 | 
						|||
| 
								 | 
							
								        //    {
							 | 
						|||
| 
								 | 
							
								        //        return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								        //    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        //    return Ok(dt);
							 | 
						|||
| 
								 | 
							
								        //}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getInvestmentDetailAdmin/{taxParamId}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult getInvestmentDetailAdmin(int taxParamId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            DataTable dataTable = new DataTable();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								                List<EmployeeTaxInvestment> emptaxInv = new EmployeeTaxInvestmentService().GetEmpByTaxparam(taxParamId);
							 | 
						|||
| 
								 | 
							
								                List<TaxInvestment> taxInvs = new TaxInvestmentService().Get(EnumStatus.Active);
							 | 
						|||
| 
								 | 
							
								                List<IncomeTax> incomeTaxItems = new IncomeTaxService().Get(EnumIncomeTaxDataFrom.ProcessTempData, (int)currentUser.PayrollTypeID);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                List<IncomeTax> investmentAllowedItems = incomeTaxItems.Where(x => x.ItemGroup == EnumIncomeTaxItemGroup.Investment_Allowed).ToList();
							 | 
						|||
| 
								 | 
							
								                List<IncomeTax> pfInvestmentItems = incomeTaxItems.Where(x => x.ItemGroup == EnumIncomeTaxItemGroup.Company_Contri_PF).ToList();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                dataTable.Columns.Add("Employee-ID");
							 | 
						|||
| 
								 | 
							
								                dataTable.Columns.Add("Employee-Name");
							 | 
						|||
| 
								 | 
							
								                foreach (TaxInvestment item in taxInvs)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    dataTable.Columns.Add(item.Name);
							 | 
						|||
| 
								 | 
							
								                    dataTable.Columns.Add(item.Name + "-Limit");
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                dataTable.Columns.Add("Total-Invest");
							 | 
						|||
| 
								 | 
							
								                dataTable.Columns.Add("Total-Invest-Consider");
							 | 
						|||
| 
								 | 
							
								                dataTable.Columns.Add("Investment-Allowed");
							 | 
						|||
| 
								 | 
							
								                dataTable.Columns.Add("PF-Investment");
							 | 
						|||
| 
								 | 
							
								                dataTable.Columns.Add("Other-Investment");
							 | 
						|||
| 
								 | 
							
								                dataTable.Columns.Add("Investment-To-Do");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                List<EmployeeTaxInvestment> items = emptaxInv.GroupBy(u => u.EmployeeID).Select(g => g.First()).ToList();
							 | 
						|||
| 
								 | 
							
								                //var employeeIds = items.Select(emp => emp.EmployeeID).ToList();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                foreach (var item in items)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    DataRow row = dataTable.Rows.Add();
							 | 
						|||
| 
								 | 
							
								                    var empItems = emptaxInv.FindAll(x => x.EmployeeID == item.EmployeeID);
							 | 
						|||
| 
								 | 
							
								                    row["Employee-ID"] = empItems[0].EmployeeNo;
							 | 
						|||
| 
								 | 
							
								                    row["Employee-Name"] = empItems[0].EmployeeName;
							 | 
						|||
| 
								 | 
							
								                    double investSum = 0;
							 | 
						|||
| 
								 | 
							
								                    double investConsiderSum = 0;
							 | 
						|||
| 
								 | 
							
								                    double investmentAllowedTotal = 0;
							 | 
						|||
| 
								 | 
							
								                    double pfInvestmentTotal = 0;
							 | 
						|||
| 
								 | 
							
								                    double investmentToDo = 0;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    foreach (var inv in taxInvs)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        var empItem = empItems.FindAll(x => x.TypeID == inv.ID && x.submitStatus == EnumTaxInvestmentStatus.Approve);
							 | 
						|||
| 
								 | 
							
								                        if (empItem.Count != 0)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            row[inv.Name] = empItem.Sum(x => x.Amount);
							 | 
						|||
| 
								 | 
							
								                            investSum = investSum + (int)empItem.Sum(x => x.Amount);
							 | 
						|||
| 
								 | 
							
								                            double limitAMount = EmployeeTaxInvestment.GetAmount(item.EmployeeID, empItem, taxInvs);
							 | 
						|||
| 
								 | 
							
								                            row[inv.Name + "-Limit"] = limitAMount;
							 | 
						|||
| 
								 | 
							
								                            investConsiderSum = investConsiderSum + limitAMount;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    row["Total-Invest"] = investSum;
							 | 
						|||
| 
								 | 
							
								                    row["Total-Invest-Consider"] = investConsiderSum;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    if (investmentAllowedItems.Where(x => x.EmployeeID == item.EmployeeID).ToList().Count > 0)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        investmentAllowedTotal = investmentAllowedItems.FirstOrDefault(x => x.EmployeeID == item.EmployeeID).TotalAmount;
							 | 
						|||
| 
								 | 
							
								                        investmentAllowedTotal = GlobalFunctions.Round(investmentAllowedTotal, 2);
							 | 
						|||
| 
								 | 
							
								                        row["Investment-Allowed"] = investmentAllowedTotal.ToString("0.00");
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    if (pfInvestmentItems.Where(x => x.EmployeeID == item.EmployeeID).ToList().Count > 0)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        pfInvestmentTotal = 2 * (pfInvestmentItems.FirstOrDefault(x => x.EmployeeID == item.EmployeeID).TotalAmount);
							 | 
						|||
| 
								 | 
							
								                        pfInvestmentTotal = GlobalFunctions.Round(pfInvestmentTotal, 2);
							 | 
						|||
| 
								 | 
							
								                        row["PF-Investment"] = pfInvestmentTotal.ToString("0.00");
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    row["Other-Investment"] = GlobalFunctions.Round((investmentAllowedTotal - pfInvestmentTotal));
							 | 
						|||
| 
								 | 
							
								                    investmentToDo = GlobalFunctions.Round((investmentAllowedTotal - pfInvestmentTotal) - investConsiderSum);
							 | 
						|||
| 
								 | 
							
								                    row["Investment-To-Do"] = investmentToDo > 0 ? investmentToDo : 0;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                //dt = _taxInvestmentService.GetInvestmentDetailAdmin(taxParamId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(dataTable);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getSummaryview/{taxParamId}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult getSummaryview(int taxParamId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            DataTable dt = null;
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                dt = _employeeTaxInvestmentService.getSummaryView(taxParamId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(dt);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("saveTaxInvestment")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult SaveTaxInvestment(TaxInvestment taxInvestment)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _taxInvestmentService.Save(taxInvestment);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("deleteTaxInvestment")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult DeleteTaxInvestment(dynamic data)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
							 | 
						|||
| 
								 | 
							
								            int id = item["id"].ToObject<int>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _taxInvestmentService.Delete(id);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("ApproveEmployeeTaxInvestment")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult ApproveEmployeeTaxInvestment(List<EmployeeTaxInvestment> items)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            foreach (var item in items)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                item.ModifiedBy = currentUser.UserID;
							 | 
						|||
| 
								 | 
							
								                item.ModifiedDate = DateTime.Today;
							 | 
						|||
| 
								 | 
							
								                item.submitStatus = EnumTaxInvestmentStatus.Approve;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _employeeTaxInvestmentService.Approve(items);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("RejectEmployeeTaxInvestment")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult RejectEmployeeTaxInvestment(List<EmployeeTaxInvestment> items)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            foreach (var item in items)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                item.ModifiedBy = currentUser.UserID;
							 | 
						|||
| 
								 | 
							
								                item.ModifiedDate = DateTime.Today;
							 | 
						|||
| 
								 | 
							
								                item.submitStatus = EnumTaxInvestmentStatus.Reject;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _employeeTaxInvestmentService.Reject(items);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        // TaxMergeMaster
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxMergeMasterById/{id}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxMergeMasterById(int id)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
							 | 
						|||
| 
								 | 
							
								            TaxMergeMaster taxMergeMaster = new TaxMergeMaster();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxMergeMaster = _taxMergeMasterService.Get(id, payrollTypeId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxMergeMaster);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxMergeMaster/{taxMergeType}/{itemID}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxMergeMaster(EnumTaxMergeType taxMergeType, int itemID)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
							 | 
						|||
| 
								 | 
							
								            TaxMergeMaster taxMergeMaster = new TaxMergeMaster();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxMergeMaster = _taxMergeMasterService.Get(payrollTypeId, (int)currentUser.TaxParamID, taxMergeType, itemID);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxMergeMaster);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxMergeMasterByTaxParameterId/{taxParameterId}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxMergeMasterByTaxParameterId(int taxParameterId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
							 | 
						|||
| 
								 | 
							
								            List<TaxMergeMaster> taxMergeMasters = new List<TaxMergeMaster>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxMergeMasters = _taxMergeMasterService.GetbyTaxParameter(taxParameterId, payrollTypeId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxMergeMasters);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("saveTaxMergeMaster")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult SaveTaxMergeMaster(TaxMergeMaster taxMergeMaster)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser ouser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            int mergeID = 0;
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxMergeMaster.PayrollTypeID = (int)ouser.PayrollTypeID;
							 | 
						|||
| 
								 | 
							
								                if (taxMergeMaster.IsNew == true)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    taxMergeMaster.CreatedBy = ouser.UserID;
							 | 
						|||
| 
								 | 
							
								                    taxMergeMaster.CreatedDate = DateTime.Today;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    taxMergeMaster.ModifiedBy = ouser.UserID;
							 | 
						|||
| 
								 | 
							
								                    taxMergeMaster.ModifiedDate = DateTime.Today;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                mergeID = _taxMergeMasterService.Save(taxMergeMaster);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(mergeID);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("deleteTaxMergeMaster")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult DeleteTaxMergeMaster(TaxMergeMaster taxMergeMaster)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _taxMergeMasterService.Delete(taxMergeMaster.ID);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        // TaxParameter
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxParameter/{id}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxParameter(int id)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            TaxParameter taxParameter = new TaxParameter();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxParameter = _taxParameterService.Get(id);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxParameter);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getCurrentTaxParameter")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetCurrentTaxParameter()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            int taxParamId = currentUser.TaxParamID.GetValueOrDefault();
							 | 
						|||
| 
								 | 
							
								            TaxParameter taxParameter = new TaxParameter();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxParameter = _taxParameterService.Get(taxParamId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxParameter);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getPreviousTaxParameter")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetPreviousTaxParameter()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            int taxParamId = currentUser.TaxParamID.GetValueOrDefault();
							 | 
						|||
| 
								 | 
							
								            TaxParameter taxParameter = new TaxParameter();
							 | 
						|||
| 
								 | 
							
								            TaxParameter prevTaxParameter = new TaxParameter();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxParameter = _taxParameterService.Get(taxParamId);
							 | 
						|||
| 
								 | 
							
								                string fiscalYear = $"{taxParameter.FiscalyearDatefrom.Year - 1}-{taxParameter.FiscalyearDatefrom.Year}";
							 | 
						|||
| 
								 | 
							
								                prevTaxParameter = _taxParameterService.GetByFiscalYear(fiscalYear);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(prevTaxParameter);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxParameterByAssessmentYear/{assessmentYear}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxParameterByAssessmentYear(string assessmentYear)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            TaxParameter taxParameter = new TaxParameter();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxParameter = _taxParameterService.Get(assessmentYear);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxParameter);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getAllTaxParameter")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetAllTaxParameter()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            List<TaxParameter> taxParameters = new List<TaxParameter>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxParameters = _taxParameterService.GetbyPayrolltype(payrollTypeId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxParameters);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTexAdjustmentParameter")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult getTexAdjustmentParameter()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            List<TaxAdjustment> taxParameters = new List<TaxAdjustment>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxParameters = _taxAdjustmentService.Get();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxParameters);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getAllTaxParameterForCurrentYear/{isForCurrentYear}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetAllTaxParameterForCurrentYear(bool isForCurrentYear)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
							 | 
						|||
| 
								 | 
							
								            List<TaxParameter> taxParameters = new List<TaxParameter>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxParameters = _taxParameterService.Get(isForCurrentYear, payrollTypeId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxParameters);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxSlabsByTaxParameterIdAndTaxType/{taxParameterId}/{taxType}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxSlabsByTaxParameterIdAndTaxType(int taxParameterId, EnumTaxSlabType taxType)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<TaxParameterSlab> taxParameterSlabs = new List<TaxParameterSlab>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxParameterSlabs = _taxParameterService.GetTaxSlabs(taxParameterId, taxType);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxParameterSlabs);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxSlabsByTaxParameterId/{taxParameterId}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxSlabsByTaxParameterId(int taxParameterId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<TaxParameterSlab> taxParameterSlabs = new List<TaxParameterSlab>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxParameterSlabs = _taxParameterService.GetSlabsByParamID(taxParameterId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(taxParameterSlabs);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("saveTaxParameter")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult SaveTaxParameter(TaxParameter otaxParameter)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                otaxParameter.PayrollTypeID = payrollTypeId;
							 | 
						|||
| 
								 | 
							
								                if (otaxParameter.IsNew == true)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    otaxParameter.CreatedBy = currentUser.UserID;
							 | 
						|||
| 
								 | 
							
								                    otaxParameter.CreatedDate = DateTime.Today;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    otaxParameter.ModifiedBy = currentUser.UserID;
							 | 
						|||
| 
								 | 
							
								                    otaxParameter.ModifiedDate = DateTime.Today;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                _taxParameterService.Save(otaxParameter, payrollTypeId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("SetCurrentYearTax")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult SetCurrentYearTax(TaxParameter otaxParameter)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                _taxParameterService.SetCurrentYearTax(otaxParameter.ID, payrollTypeId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("deleteTaxParameter")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult DeleteTaxParameter(int id)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _taxParameterService.Delete(id, payrollTypeId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("saveTaxReturn")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult SaveTaxReturn(TaxReturn item)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            int id = 0;
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                id = _taxReturnService.Save(item);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(id);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxReturnByTaxParamId/{taxParamId}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxReturnByTaxParamId(int taxParamId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            DataSet ds = new DataSet();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ds = _taxReturnService.GetByTaxParamId(taxParamId);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(ds.Tables[0]);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxReturnByEmpIdTaxParamId/{empId}/{taxParamId}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxReturnByEmpIdTaxParamId(int empId, int taxParamId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            TaxReturn item = new TaxReturn();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                item = _taxReturnService.Get(empId, taxParamId);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(item);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxFile/{empId}/{referenceId}/{type}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxFile(int empId, int referenceId, EnumTaxAttachmentType type)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            TaxReturnAttachment attachment = new TaxReturnAttachment();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                attachment = _taxReturnService.GetFile(empId, referenceId, type);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(attachment);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost("uploadTaxFile")]
							 | 
						|||
| 
								 | 
							
								        [AllowAnonymous]
							 | 
						|||
| 
								 | 
							
								        public ActionResult UploadEmpFile()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            TaxReturnAttachment item = new TaxReturnAttachment();
							 | 
						|||
| 
								 | 
							
								            string base64String = "";
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                var fdata = Request.Form.Files["empFile"];
							 | 
						|||
| 
								 | 
							
								                //Upload Image
							 | 
						|||
| 
								 | 
							
								                item.EmployeeID = Convert.ToInt32(Request.Form["empId"]);
							 | 
						|||
| 
								 | 
							
								                item.ReferenceID = Convert.ToInt32(Request.Form["referenceId"]);
							 | 
						|||
| 
								 | 
							
								                item.FileType = (EnumTaxAttachmentType)Convert.ToInt32(Request.Form["fileType"]);
							 | 
						|||
| 
								 | 
							
								                using (var ms = new MemoryStream())
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    fdata.CopyTo(ms);
							 | 
						|||
| 
								 | 
							
								                    item.FileData = ms.ToArray();
							 | 
						|||
| 
								 | 
							
								                    item.FileName = item.FileType.ToString() + $"-{item.ReferenceID}{Path.GetExtension(fdata.FileName)}";
							 | 
						|||
| 
								 | 
							
								                    byte[] textAsBytes = ms.ToArray();
							 | 
						|||
| 
								 | 
							
								                    this._taxReturnService.UploadFile(item);
							 | 
						|||
| 
								 | 
							
								                    base64String = Convert.ToBase64String(textAsBytes);
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception ex)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(base64String);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost("SaveTaxInvestment")]
							 | 
						|||
| 
								 | 
							
								        [AllowAnonymous]
							 | 
						|||
| 
								 | 
							
								        public ActionResult SaveTaxInvestment(EmployeeTaxInvestment item)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            string connectionString = _config.GetSection("dbSettings").GetSection("SqlCommandConnection").Value;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            string base64String = "";
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                if (item.TaxAttachment != null)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    if (item.TaxAttachment.ID <= 0 && item.TaxAttachment.PreviousFileTobase64 != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        string[] items = item.TaxAttachment.PreviousFileTobase64.Split(new char[] { ',', ' ' }, StringSplitOptions.None);
							 | 
						|||
| 
								 | 
							
								                        byte[] newBytes = Convert.FromBase64String(items[1]);
							 | 
						|||
| 
								 | 
							
								                        item.TaxAttachment.FileAsByteArray = newBytes;
							 | 
						|||
| 
								 | 
							
								                        //item.TaxAttachment.FileType = (EnumTaxAttachment)Convert.ToInt32(EnumTaxAttachment.Investment);
							 | 
						|||
| 
								 | 
							
								                        //TaxAttachmentDA.Insert(item.TaxAttachment, connectionString);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception ex)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(base64String);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        // EmpTaxAit
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxAitById/{id}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxAitById(int id)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            EmpTaxAit item = new EmpTaxAit();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                item = _empTaxAitService.Get(id);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(item);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxAitAll")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxAitAll()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<EmpTaxAit> items = new List<EmpTaxAit>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                items = _empTaxAitService.GetAll();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(items);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxAitByEmpId/{empId}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxAitByEmpId(int empId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<EmpTaxAit> items = new List<EmpTaxAit>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                items = _empTaxAitService.GetByEmpId(empId);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(items);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxAitByEffectForAdmin/{taxParamId}/{entryFrom}/{taxEffect}/{taxEffectB}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult getTaxAitByEffectForAdmin(int taxParamId, int entryFrom, int taxEffect, EnumTaxAITInvestment taxEffectB)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<EmpTaxAit> items = new List<EmpTaxAit>();
							 | 
						|||
| 
								 | 
							
								            EmpTaxAitService service = new EmpTaxAitService();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                items = service.GetByTaxParamIdEffectForAdmin(taxParamId, entryFrom, taxEffectB);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            return Ok(items);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxAitForAdmin/{taxParamId}/{entryFrom}/{taxEffect}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxAitForAdmin(int taxParamId, int entryFrom, int taxEffect)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<EmpTaxAit> items = new List<EmpTaxAit>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                items = _empTaxAitService.GetByTaxParamIdForAdmin(taxParamId, entryFrom, taxEffect);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(items);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxAitByTaxParamIdAndEmpId/{taxParamId}/{empId}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxAitByTaxParamIdAndEmpId(int taxParamId, int empId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<EmpTaxAit> items = new List<EmpTaxAit>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                items = _empTaxAitService.GetByTaxParamIdAndEmpId(taxParamId, empId);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(items);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost("saveTaxAit")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult SaveTaxAit(EmpTaxAit item)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            string connectionString = _config.GetSection("dbSettings").GetSection("SqlCommandConnection").Value;
							 | 
						|||
| 
								 | 
							
								            int id;
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            bool isNew = item.IsNew;
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (item.IsNew == true)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    item.CreatedBy = currentUser.UserID;
							 | 
						|||
| 
								 | 
							
								                    item.CreatedDate = DateTime.Today;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    if (item.AitAttachment != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        if (item.AitAttachment.ID <= 0 && item.AitAttachment.PreviousFileTobase64 != null)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            string[] items = item.AitAttachment.PreviousFileTobase64.Split(new char[] { ',', ' ' }, StringSplitOptions.None);
							 | 
						|||
| 
								 | 
							
								                            byte[] newBytes = Convert.FromBase64String(items[1]);
							 | 
						|||
| 
								 | 
							
								                            item.AitAttachment.FileAsByteArray = newBytes;
							 | 
						|||
| 
								 | 
							
								                            item.AitAttachment.ConnectionString = connectionString;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    item.ModifiedBy = currentUser.UserID;
							 | 
						|||
| 
								 | 
							
								                    item.ModifiedDate = DateTime.Today;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    if (item.TaxEffectDone == EnumTaxAITInvestment.Reject)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        item.ActionDate = DateTime.Now;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                id = _empTaxAitService.Save(item);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                if (id != 0 && isNew == false)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    Employee emp = new Employee();
							 | 
						|||
| 
								 | 
							
								                    EmployeeService employeeService = new EmployeeService();
							 | 
						|||
| 
								 | 
							
								                    emp = employeeService.Get(item.EmployeeId);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    string email = emp.EmailAddress;
							 | 
						|||
| 
								 | 
							
								                    string name = emp.Name;
							 | 
						|||
| 
								 | 
							
								                    string status = null;
							 | 
						|||
| 
								 | 
							
								                    if (item.TaxEffectDone == EnumTaxAITInvestment.Approve)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        status = "Approve";
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    else
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        status = "Reject";
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    if (emp.EmailAddress != "")
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json");
							 | 
						|||
| 
								 | 
							
								                        IConfiguration Configuration = builder.Build();
							 | 
						|||
| 
								 | 
							
								                        string LiveLink = Configuration.GetSection("AppSettings")["LiveLink"];
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                        EmailSettings emailSettings = _emailSettings.Value;
							 | 
						|||
| 
								 | 
							
								                        MailSender mailSender = new MailSender();
							 | 
						|||
| 
								 | 
							
								                        mailSender.AddTo(emp.EmailAddress);
							 | 
						|||
| 
								 | 
							
								                        mailSender.Subject = "Advance Income Tax Admin Approval";
							 | 
						|||
| 
								 | 
							
								                        mailSender.Body = $@"<p>Dear {name},</p>
							 | 
						|||
| 
								 | 
							
								                                        <p>Your Advance Income Tax has been {status}.</p>
							 | 
						|||
| 
								 | 
							
								                                        <p>Please click on this link: {LiveLink} to access Luminous Self-service for details.</p>
							 | 
						|||
| 
								 | 
							
								                                        <p>Thank you.</p>";
							 | 
						|||
| 
								 | 
							
								                        mailSender.ThreadSendMail(emailSettings);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(id);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getAllEmployeeTaxParameter")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult getAllEmployeeTaxParameter()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<Employee> employees = new List<Employee>();
							 | 
						|||
| 
								 | 
							
								            EmployeeService empService = new EmployeeService();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                //	employees = empService.GetEmpTaxAit();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(employees);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost("deleteTaxAit")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult DeleteTaxAit(EmpTaxAit item)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _empTaxAitService.Delete(item.ID);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("getAitAttachment")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult getAitAttachment(dynamic data)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
							 | 
						|||
| 
								 | 
							
								            int employeeID = item["employeeID"].ToObject<int>();
							 | 
						|||
| 
								 | 
							
								            EnumTaxAttachment fileType = (EnumTaxAttachment)item["fileType"];
							 | 
						|||
| 
								 | 
							
								            List<AitAttachment> taxAttachments = new List<AitAttachment>();
							 | 
						|||
| 
								 | 
							
								            EmpTaxAitService service = new EmpTaxAitService();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxAttachments = service.GetTaxAttachment(employeeID, fileType);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception ex)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            return Ok(taxAttachments);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("getAitAttachmentBYID")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult getAitAttachmentBYID(dynamic data)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
							 | 
						|||
| 
								 | 
							
								            int ID = item["ID"].ToObject<int>();
							 | 
						|||
| 
								 | 
							
								            int employeeID = item["employeeID"].ToObject<int>();
							 | 
						|||
| 
								 | 
							
								            EnumTaxAttachment fileType = (EnumTaxAttachment)item["fileType"];
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            AitAttachment taxAttachments = new AitAttachment();
							 | 
						|||
| 
								 | 
							
								            EmpTaxAitService service = new EmpTaxAitService();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                taxAttachments = service.GetTaxAttachmentByID(ID, employeeID, fileType);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception ex)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            return Ok(taxAttachments);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        [HttpGet("calculateRebate")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult CalculateRebate()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
							 | 
						|||
| 
								 | 
							
								            int employeeId = currentUser.EmployeeID.GetValueOrDefault();
							 | 
						|||
| 
								 | 
							
								            var ans = new Object();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                PayrollType payrollType = _payrollTypeService.Get((int)currentUser.PayrollTypeID);
							 | 
						|||
| 
								 | 
							
								                ans = _taxInvestmentService.CalculateRebateTax(employeeId, (int)payrollType.TaxParamID);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(ans);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getTaxAttachment/{referenceId}/{type}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetTaxAttachment(int referenceId, EnumTaxAttachment type)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            TaxAttachment attachment = new TaxAttachment();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                attachment = _employeeTaxInvestmentService.GetFile(referenceId, type);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(attachment);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("getEmployeeData")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult getEmployeeData()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<Employee> EmployeeInfoes = new List<Employee>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                EmployeeInfoes = _employeeService.GetAllEmps();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(EmployeeInfoes);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("GetEmployeeDataUsingExceptionType/{ExceptionType}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetEmployeeDataUsingExceptionType(string ExceptionType)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<EmployeeTaxException> dt = new List<EmployeeTaxException>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                dt = _employeeExceptionService.GetEmployeeDataUsingExceptionType(ExceptionType);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(dt);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("GetEmployeeDataUsingPersonType/{ExceptionType}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetEmployeeDataUsingPersonType(int ExceptionType)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<EmployeeTaxException> dt = new List<EmployeeTaxException>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                dt = _employeeExceptionService.GetEmployeeDataUsingPersonType(ExceptionType);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(dt);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpGet("GetEmployeeDataUsingTaxCircle/{TaxCircleType}")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult GetEmployeeDataUsingTaxCircle(int TaxCircleType)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<EmployeeTaxException> dt = new List<EmployeeTaxException>();
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                dt = _employeeExceptionService.GetEmployeeDataUsingTaxCircle(TaxCircleType);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok(dt);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("UpdateEmployeeByPersonType")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult UpdateEmployeeByPersonType(List<EmployeeTaxException> EmployeeInfo)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _employeeExceptionService.UpdateEmployeeByPersonType(EmployeeInfo);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        [HttpPost]
							 | 
						|||
| 
								 | 
							
								        [Route("UpdateEmployeeByTaxCircle")]
							 | 
						|||
| 
								 | 
							
								        public ActionResult UpdateEmployeeByTaxCircle(List<EmployeeTaxException> EmployeeInfo)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                _employeeExceptionService.UpdateEmployeeByTaxCircle(EmployeeInfo);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return Ok();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |