2035 lines
95 KiB
C#
2035 lines
95 KiB
C#
|
|
using HRM.BO;
|
|||
|
|
using HRM.BO.Configuration;
|
|||
|
|
using Microsoft.AspNetCore.Http;
|
|||
|
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
|
using Microsoft.Extensions.Configuration;
|
|||
|
|
using Microsoft.Extensions.Options;
|
|||
|
|
using System;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using Ease.Core.DataAccess;
|
|||
|
|
using Microsoft.VisualBasic;
|
|||
|
|
using HRM.DA;
|
|||
|
|
using HRM.Report;
|
|||
|
|
using Microsoft.Reporting.NETCore;
|
|||
|
|
using HRM.DA.Fund;
|
|||
|
|
using System.Linq;
|
|||
|
|
|
|||
|
|
|
|||
|
|
namespace Fund.UI.Controllers.Ess_Fund
|
|||
|
|
{
|
|||
|
|
[Route("api/EssFund")]
|
|||
|
|
[ApiController]
|
|||
|
|
public class EssFundController : ControllerBase
|
|||
|
|
{
|
|||
|
|
private readonly IDepartmentService _departmentService;
|
|||
|
|
private readonly IDesignationService _designationService;
|
|||
|
|
private readonly IOptions<EmailSettings> _emailSettings;
|
|||
|
|
private readonly IEmployeeService _employeeService;
|
|||
|
|
private readonly IPFDepositFlowService _pFDepositFlowService;
|
|||
|
|
private readonly ILoanApplicationService _loanApplicationService;
|
|||
|
|
private readonly IFMLoanCategoryService _fMLoanCategoryService;
|
|||
|
|
private readonly IFMLoanScheduleService _loanScheduleService;
|
|||
|
|
private readonly IConfiguration _config;
|
|||
|
|
private readonly IMemberService _memberService;
|
|||
|
|
private readonly IMembersTransactionDetailsService _membersTransactionDetailsService;
|
|||
|
|
private readonly IOptions<FundEss> _fundEss;
|
|||
|
|
private readonly IFMLoanService _fmLoanService;
|
|||
|
|
private readonly IPFWithdrawalRequestService _pfWithdrawalRequestService;
|
|||
|
|
private readonly INewInvestmentService _newInvestmentService;
|
|||
|
|
private readonly ISalaryMonthlyService _salaryMonthlyService;
|
|||
|
|
private readonly IGFSettlementService _GFSettlementService;
|
|||
|
|
private readonly IWPPFSettlementService _wPPFSettlementService;
|
|||
|
|
public EssFundController(IDepartmentService departmentService,
|
|||
|
|
IDesignationService designationService,
|
|||
|
|
IOptions<EmailSettings> emailSettings,
|
|||
|
|
IEmployeeService employeeService,
|
|||
|
|
IPFDepositFlowService pFDepositFlowService,
|
|||
|
|
ILoanApplicationService loanApplicationService,
|
|||
|
|
IFMLoanScheduleService loanScheduleService,
|
|||
|
|
IConfiguration config,
|
|||
|
|
IMemberService memberService,
|
|||
|
|
IMembersTransactionDetailsService membersTransactionDetailsService,
|
|||
|
|
IOptions<FundEss> fundEss,
|
|||
|
|
IFMLoanService fmLoanService,
|
|||
|
|
IPFWithdrawalRequestService pFWithdrawalRequestService,
|
|||
|
|
INewInvestmentService newInvestmentService,
|
|||
|
|
ISalaryMonthlyService salaryMonthlyService,
|
|||
|
|
IFMLoanCategoryService loanCategoryService,
|
|||
|
|
IGFSettlementService gFSettlementService,
|
|||
|
|
IWPPFSettlementService wPPFSettlementService)
|
|||
|
|
{
|
|||
|
|
_departmentService = departmentService;
|
|||
|
|
_designationService = designationService;
|
|||
|
|
_emailSettings = emailSettings;
|
|||
|
|
_employeeService = employeeService;
|
|||
|
|
_pFDepositFlowService = pFDepositFlowService;
|
|||
|
|
_loanApplicationService = loanApplicationService;
|
|||
|
|
_loanScheduleService = loanScheduleService;
|
|||
|
|
_config = config;
|
|||
|
|
_memberService = memberService;
|
|||
|
|
_membersTransactionDetailsService = membersTransactionDetailsService;
|
|||
|
|
_fundEss = fundEss;
|
|||
|
|
_fmLoanService = fmLoanService;
|
|||
|
|
_pfWithdrawalRequestService = pFWithdrawalRequestService;
|
|||
|
|
_newInvestmentService = newInvestmentService;
|
|||
|
|
_salaryMonthlyService = salaryMonthlyService;
|
|||
|
|
_fMLoanCategoryService = loanCategoryService;
|
|||
|
|
_GFSettlementService = gFSettlementService;
|
|||
|
|
_wPPFSettlementService = wPPFSettlementService;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[HttpGet("getPFDepositFlow/{ID}")]
|
|||
|
|
public ActionResult getPFDepositFlow(int id)
|
|||
|
|
{
|
|||
|
|
PFDepositFlow item = new PFDepositFlow();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
item = _pFDepositFlowService.Get(id);
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
return Ok(item);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[HttpGet("getLoanApplication")]
|
|||
|
|
public ActionResult getLoanApplication()
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
LoanApplication item = new LoanApplication();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
item = _loanApplicationService.Get(0); //currentUser.MemberID
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(item);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Salary Monthly
|
|||
|
|
[HttpGet("getSalaryMonthlyByEmpId")]
|
|||
|
|
public ActionResult GetSalaryMonthlyByEmpId()
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
double empBasicSalary = 0.0;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
empBasicSalary = _employeeService.GetEmpBasicSalary((int)currentUser.EmployeeID);
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(empBasicSalary);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
[HttpGet("getLoanAppById/{LoanAppId}")]
|
|||
|
|
public ActionResult GetLoanAppById(int LoanAppId)
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
LoanApplication item = new LoanApplication();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
item = _loanApplicationService.GetLoanAppById(LoanAppId);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(item);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
[HttpGet("getLoansById/{LoanID}")]
|
|||
|
|
public ActionResult GetLoanById(int LoanID)
|
|||
|
|
{
|
|||
|
|
FMLoan loan = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
loan = _fmLoanService.Get(LoanID, true);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(loan);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
[HttpGet("getLoanAppEligibility")]
|
|||
|
|
public ActionResult GetLoanAppEligibility()
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
int unpaidPayDateCount = 0;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
unpaidPayDateCount = _fmLoanService.GetLoanAppEligibility(0); //currentUser.MemberID
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(unpaidPayDateCount);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
[HttpGet("getScheduleByLoanID/{LoanID}")]
|
|||
|
|
public ActionResult GetScheduleByLoanID(int LoanID)
|
|||
|
|
{
|
|||
|
|
DataTable oLoanScheduleDataTable = new DataTable();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
oLoanScheduleDataTable = _loanApplicationService.GetLoanScheduleByLoanID(LoanID);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(oLoanScheduleDataTable);
|
|||
|
|
}
|
|||
|
|
[HttpGet("getLoanByLoanApplication/{loanApplicationID}")]
|
|||
|
|
public ActionResult GetLoanByLoanApplication(int loanApplicationID)
|
|||
|
|
{
|
|||
|
|
FMLoan fMLoan = new FMLoan();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
fMLoan = _fmLoanService.GetLoanByLoanApplicationID(loanApplicationID);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(fMLoan);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[HttpGet("getLoanApps")]
|
|||
|
|
public ActionResult GetLoanApps()
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
DataTable oLoanAppsDataTable = new DataTable();
|
|||
|
|
DataTable oLoanScheduleDataTable = new DataTable();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
Member member = _memberService.Get(currentUser.LoginID, EnumFundType.Provident_Fund);
|
|||
|
|
oLoanAppsDataTable = _loanApplicationService.GetLoanApps(member.ID);
|
|||
|
|
oLoanAppsDataTable.Columns.Add("SettleStatusString", typeof(string));
|
|||
|
|
oLoanAppsDataTable.Columns.Add("loanApplicationCount", typeof(int));
|
|||
|
|
oLoanAppsDataTable.Columns.Add("DepositStatus", typeof(string));
|
|||
|
|
oLoanAppsDataTable.Columns.Add("isSettlementEnabled", typeof(bool));
|
|||
|
|
oLoanAppsDataTable.Columns.Add("viewSchedule", typeof(bool));
|
|||
|
|
|
|||
|
|
int pendingLoanCount = 0;
|
|||
|
|
foreach (DataRow row in oLoanAppsDataTable.Rows)
|
|||
|
|
{
|
|||
|
|
// row["loanStatus"] = (row["loanStatus"].ToString() == "loanapp") ? "On Approval" : "Approved and Issued";
|
|||
|
|
|
|||
|
|
//For LoanApplication table, type=1; for Loan table, type=2
|
|||
|
|
if ((Int32)row["loanType"] == 2)
|
|||
|
|
{
|
|||
|
|
row["viewSchedule"] = true;
|
|||
|
|
row["isSettlementEnabled"] = true;
|
|||
|
|
oLoanScheduleDataTable = _loanApplicationService.GetLoanScheduleByLoanID((int)row["loanAppID"]);
|
|||
|
|
|
|||
|
|
|
|||
|
|
int unpaidPayDateCount = 0;
|
|||
|
|
foreach (DataRow dr in oLoanScheduleDataTable.Rows)
|
|||
|
|
{
|
|||
|
|
if (dr["PayDate"] == DBNull.Value) //.ToString() == string.Empty
|
|||
|
|
{
|
|||
|
|
unpaidPayDateCount++;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
// row["loanStatus"] = (unpaidPayDateCount > 0) ? "Approved and Deposited" : "Loan Fully Paid";
|
|||
|
|
row["DepositStatus"] = "Yes";
|
|||
|
|
var x = row["loanStatus"].ToString();
|
|||
|
|
if (row["SettleStatus"] != DBNull.Value && row["SettleStatus"] != null)
|
|||
|
|
{
|
|||
|
|
short settleStatusValue = Convert.ToInt16(row["SettleStatus"]);
|
|||
|
|
string? statusString = Enum.GetName(typeof(EnumLoanSettleStatus), (EnumLoanSettleStatus)settleStatusValue);
|
|||
|
|
row["SettleStatusString"] = statusString != null ? statusString : DBNull.Value;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
row["SettleStatusString"] = Enum.GetName(typeof(EnumLoanSettleStatus), EnumLoanSettleStatus.None);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
row["viewSchedule"] = false;
|
|||
|
|
row["isSettlementEnabled"] = false;
|
|||
|
|
row["settleStatus"] = 0;
|
|||
|
|
//if (Convert.ToInt32(row["loanStatus"]) == 6)
|
|||
|
|
//{
|
|||
|
|
// row["loanStatus"] = "Approved";
|
|||
|
|
//}
|
|||
|
|
//else row["loanStatus"] = "On Approval";
|
|||
|
|
|
|||
|
|
// row["SettleStatusString"] = Enum.GetName(typeof(EnumLoanSettleStatus), EnumLoanSettleStatus.None);
|
|||
|
|
|
|||
|
|
// if (row["isRejected"] != DBNull.Value && (Int16)row["isRejected"] != 0)
|
|||
|
|
// {
|
|||
|
|
|
|||
|
|
// if (row["isHrApproved"] != DBNull.Value && row["isApproved"] != DBNull.Value && row["isSecondApproved"] != DBNull.Value)
|
|||
|
|
// {
|
|||
|
|
// row["loanStatus"] = "Rejected (Trustee-2)" ;
|
|||
|
|
// row["DepositStatus"] = "No";
|
|||
|
|
// }
|
|||
|
|
// else if (row["isHrApproved"] != DBNull.Value && row["isApproved"] != DBNull.Value && row["isSecondApproved"] == DBNull.Value )
|
|||
|
|
// {
|
|||
|
|
// row["loanStatus"] = "Rejected (Trustee-1) " ;
|
|||
|
|
// row["DepositStatus"] = "No";
|
|||
|
|
// }
|
|||
|
|
// else if (row["isHrApproved"] != DBNull.Value && row["isApproved"] == DBNull.Value && row["isSecondApproved"] != DBNull.Value)
|
|||
|
|
// {
|
|||
|
|
// row["loanStatus"] = "Rejected (Trustee-1)";
|
|||
|
|
// row["DepositStatus"] = "No";
|
|||
|
|
// }
|
|||
|
|
// else if (row["isHrApproved"] != DBNull.Value && row["isApproved"] == DBNull.Value && row["isSecondApproved"] == DBNull.Value)
|
|||
|
|
// {
|
|||
|
|
// row["loanStatus"] = "Rejected (HR Admin) " ;
|
|||
|
|
// row["DepositStatus"] = "No";
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// if (row["isHrApproved"] == DBNull.Value
|
|||
|
|
// && row["isApproved"] == DBNull.Value
|
|||
|
|
// && row["isSecondApproved"] == DBNull.Value)
|
|||
|
|
// {
|
|||
|
|
// row["loanStatus"] = "On Approval (HR)";
|
|||
|
|
// row["DepositStatus"] = "No";
|
|||
|
|
// }
|
|||
|
|
// else if (row["isHrApproved"] != DBNull.Value && row["isApproved"] == DBNull.Value && row["isSecondApproved"] == DBNull.Value)
|
|||
|
|
// {
|
|||
|
|
// row["loanStatus"] = "On Approval (Trustee-1)";
|
|||
|
|
// row["DepositStatus"] = "No";
|
|||
|
|
// }
|
|||
|
|
// else if ((row["isHrApproved"] != DBNull.Value && row["isApproved"] != DBNull.Value && row["isSecondApproved"] == DBNull.Value) ||
|
|||
|
|
// (row["isHrApproved"] != DBNull.Value && row["isApproved"] == DBNull.Value && row["isSecondApproved"] != DBNull.Value))
|
|||
|
|
// {
|
|||
|
|
// row["loanStatus"] = "On Approval (Trustee-2)";
|
|||
|
|
// row["DepositStatus"] = "No";
|
|||
|
|
// }
|
|||
|
|
// else if (row["isHrApproved"] != DBNull.Value && row["isApproved"] != DBNull.Value
|
|||
|
|
// && row["isSecondApproved"] != DBNull.Value && row["isDeposited"] == DBNull.Value)
|
|||
|
|
// {
|
|||
|
|
// row["loanStatus"] = "All Approved (Bank transaction pending)";
|
|||
|
|
// row["DepositStatus"] = "No";
|
|||
|
|
// }
|
|||
|
|
// else if (row["isHrApproved"] != DBNull.Value && row["isApproved"] != DBNull.Value
|
|||
|
|
// && row["isSecondApproved"] != DBNull.Value && row["isDeposited"] != DBNull.Value)
|
|||
|
|
// {
|
|||
|
|
// row["DepositStatus"] = "Yes";
|
|||
|
|
// if (Convert.ToDateTime(row["isDeposited"]).Day >= 11 && Convert.ToDateTime(row["isDeposited"]).Day <= 15)
|
|||
|
|
// {
|
|||
|
|
// row["loanStatus"] = "Bank transaction between 11th-15th";
|
|||
|
|
// }
|
|||
|
|
// else if (Convert.ToDateTime(row["isDeposited"]).Day >= 25 && Convert.ToDateTime(row["isDeposited"]).Day <= 30)
|
|||
|
|
// {
|
|||
|
|
// row["loanStatus"] = "Bank transaction between 25th-30th";
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// pendingLoanCount++;
|
|||
|
|
// }
|
|||
|
|
}
|
|||
|
|
row["loanApplicationCount"] = pendingLoanCount; //Used for enabling or disabling Loan Apply button by checking, if any Loan application is pending
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(oLoanAppsDataTable);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[HttpGet("GetPFWithdrawalList")]
|
|||
|
|
public ActionResult GetPFWithdrawalList()
|
|||
|
|
{
|
|||
|
|
Member oMember = new Member();
|
|||
|
|
List<PFWithdrawalRequest> pFWithdrawalRequest = new List<PFWithdrawalRequest>();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
oMember = _memberService.Get(currentUser.LoginID, EnumFundType.Provident_Fund);
|
|||
|
|
pFWithdrawalRequest = _pfWithdrawalRequestService.GetPFWithdrawalByMemberID(oMember.ID);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
return Ok(pFWithdrawalRequest);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
[HttpGet("getPFWithdrawalGrid/{memberId}")]
|
|||
|
|
public ActionResult GetPFWithdrawalGrid(int memberId)
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
Member omember = new Member();
|
|||
|
|
|
|||
|
|
if (memberId == -1)
|
|||
|
|
{
|
|||
|
|
omember = _memberService.Get(currentUser.LoginID, EnumFundType.Provident_Fund);
|
|||
|
|
//omember = _memberService.Get(omember.ID); //currentUser.MemberID
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
omember = _memberService.Get(memberId);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
DateTime memDate = (DateTime)omember.MembershipDate;
|
|||
|
|
TimeSpan timeDifference = (DateTime.Now - omember.DOJ);
|
|||
|
|
DateTime doj = omember.DOJ;
|
|||
|
|
//TimeSpan timeDifference = DateTime.Now - doj;
|
|||
|
|
|
|||
|
|
|
|||
|
|
int membershipDuration = (int)timeDifference.TotalDays;
|
|||
|
|
|
|||
|
|
List<string> staticDescriptions = new List<string>{"A. Audited Closing Balance",
|
|||
|
|
"B. Contribution During the Year",
|
|||
|
|
"C. PF Loan Outstanding Balance",
|
|||
|
|
"D. Total Amount",
|
|||
|
|
"E. Transfer to Lapses & forfeiture A/C",
|
|||
|
|
"F. Net Amount Payable"};
|
|||
|
|
double[] epfContributionArr = new double[6];
|
|||
|
|
double[] cpfContributionArr = new double[6];
|
|||
|
|
double[] total = new double[6];
|
|||
|
|
|
|||
|
|
DataRow odrInfo = null;
|
|||
|
|
DataTable oPFWithdrawalGrid = new DataTable();
|
|||
|
|
oPFWithdrawalGrid.Columns.Add("Description", typeof(string));
|
|||
|
|
oPFWithdrawalGrid.Columns.Add("epfContribution", typeof(string));
|
|||
|
|
oPFWithdrawalGrid.Columns.Add("cpfContribution", typeof(string));
|
|||
|
|
oPFWithdrawalGrid.Columns.Add("total", typeof(string));
|
|||
|
|
oPFWithdrawalGrid.Columns.Add("IsRequestPending", typeof(bool));
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
PFWithdrawalRequest pFWithdrawalRequest = new PFWithdrawalRequest();
|
|||
|
|
int pendingRequestCount = 0;
|
|||
|
|
pFWithdrawalRequest = _pfWithdrawalRequestService.GetByMemberID(omember.ID);
|
|||
|
|
pendingRequestCount = _pfWithdrawalRequestService.PFWithdrawalRequestCount(omember.ID);
|
|||
|
|
|
|||
|
|
epfContributionArr[0] = _membersTransactionDetailsService.GetDashboardMemberAuditedOwnBalance(omember.ID);
|
|||
|
|
cpfContributionArr[0] = _membersTransactionDetailsService.GetDashboardMemberAuditedOwnBalance(omember.ID);
|
|||
|
|
total[0] = epfContributionArr[0] + cpfContributionArr[0];
|
|||
|
|
|
|||
|
|
epfContributionArr[1] = _membersTransactionDetailsService.GetDashboardMemberUnAuditedOwnBalance(omember.ID);
|
|||
|
|
cpfContributionArr[1] = _membersTransactionDetailsService.GetDashboardMemberUnAuditedCompanyBalance(omember.ID);
|
|||
|
|
total[1] = epfContributionArr[1] + cpfContributionArr[1];
|
|||
|
|
|
|||
|
|
total[2] = _fmLoanService.GetLoanOustandingAmount(omember.ID);
|
|||
|
|
|
|||
|
|
for (int i = 0; i < 6; i++)
|
|||
|
|
{
|
|||
|
|
odrInfo = oPFWithdrawalGrid.NewRow();
|
|||
|
|
odrInfo["Description"] = staticDescriptions[i];
|
|||
|
|
if (i <= 1)
|
|||
|
|
{
|
|||
|
|
odrInfo["epfContribution"] = epfContributionArr[i].ToString("N2");
|
|||
|
|
odrInfo["cpfContribution"] = cpfContributionArr[i].ToString("N2");
|
|||
|
|
odrInfo["total"] = total[i].ToString("N2");
|
|||
|
|
if (pFWithdrawalRequest != null)
|
|||
|
|
{
|
|||
|
|
odrInfo["IsRequestPending"] = (pendingRequestCount > 0 || pFWithdrawalRequest.Status != EnumPFWithdrawalStatus.Confirmed) ? true : false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
odrInfo["epfContribution"] = " ";
|
|||
|
|
odrInfo["cpfContribution"] = " ";
|
|||
|
|
switch (i)
|
|||
|
|
{
|
|||
|
|
case 2:
|
|||
|
|
odrInfo["total"] = total[2].ToString("N2");
|
|||
|
|
break;
|
|||
|
|
case 3:
|
|||
|
|
total[3] = total[0] + total[1] - total[2];
|
|||
|
|
odrInfo["total"] = total[3].ToString("N2");
|
|||
|
|
break;
|
|||
|
|
case 4:
|
|||
|
|
total[4] = (membershipDuration < 365 * 2) ? cpfContributionArr[0] + cpfContributionArr[1] : 0;
|
|||
|
|
odrInfo["total"] = total[4].ToString("N2");
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
odrInfo["total"] = (total[3] - total[4]).ToString("N2");
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
oPFWithdrawalGrid.Rows.Add(odrInfo);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(oPFWithdrawalGrid);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
[HttpGet("getPFMemberWithdrawalFlowGridData/{requestMemberID}")]
|
|||
|
|
public ActionResult getPFMemberWithdrawalFlowGridData(int requestMemberID)
|
|||
|
|
{
|
|||
|
|
PFWithdrawalRequest pFWithdrawalRequest = new PFWithdrawalRequest();
|
|||
|
|
|
|||
|
|
pFWithdrawalRequest = _pfWithdrawalRequestService.GetByMemberID(requestMemberID);
|
|||
|
|
//Member LoanHr = _memberService.Get(_fundEss.Value.LoanHrUser);
|
|||
|
|
//Member Trustee = _memberService.Get(_fundEss.Value.LoanTrustee);
|
|||
|
|
//Member SecondTrustee = _memberService.Get(_fundEss.Value.LoanSecondTrustee);
|
|||
|
|
|
|||
|
|
List<string> staticDescriptions = new List<string>{"Withdraw Date",
|
|||
|
|
"Deduction Stop",
|
|||
|
|
"Admin Acknowledgement",
|
|||
|
|
"Trustee-1 Approval",
|
|||
|
|
"Trustee-2 Approval",
|
|||
|
|
"Bank Deposit"};
|
|||
|
|
|
|||
|
|
DataRow odrInfo = null;
|
|||
|
|
DataTable oPFWithdrawalFlowGrid = new DataTable();
|
|||
|
|
oPFWithdrawalFlowGrid.Columns.Add("description", typeof(string));
|
|||
|
|
oPFWithdrawalFlowGrid.Columns.Add("status", typeof(string));
|
|||
|
|
oPFWithdrawalFlowGrid.Columns.Add("acknowledgementDate", typeof(string));
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
for (int i = 0; i < 6; i++)
|
|||
|
|
{
|
|||
|
|
odrInfo = oPFWithdrawalFlowGrid.NewRow();
|
|||
|
|
odrInfo["Description"] = staticDescriptions[i];
|
|||
|
|
switch (i)
|
|||
|
|
{
|
|||
|
|
case 0:
|
|||
|
|
if (pFWithdrawalRequest != null)
|
|||
|
|
{
|
|||
|
|
odrInfo["status"] = "-";
|
|||
|
|
odrInfo["acknowledgementDate"] = pFWithdrawalRequest.DiscontinueDate.ToString();
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case 1:
|
|||
|
|
if (pFWithdrawalRequest != null)
|
|||
|
|
{
|
|||
|
|
odrInfo["status"] = "-";
|
|||
|
|
odrInfo["acknowledgementDate"] = pFWithdrawalRequest.DiscontinueDate.ToString();
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case 2:
|
|||
|
|
//odrInfo["status"] = (pFWithdrawalRequest.HRApproveDate != null && pFWithdrawalRequest.isRejected != true) ? "Yes" : "No";
|
|||
|
|
if (pFWithdrawalRequest != null)
|
|||
|
|
{
|
|||
|
|
if (pFWithdrawalRequest.HRApproveDate != null && pFWithdrawalRequest.isRejected != true)
|
|||
|
|
{
|
|||
|
|
odrInfo["status"] = "Yes";
|
|||
|
|
}
|
|||
|
|
else if (pFWithdrawalRequest.HRApproveDate != null && pFWithdrawalRequest.isRejected == true &&
|
|||
|
|
(pFWithdrawalRequest.TrusteesApproveDate != null || pFWithdrawalRequest.SecondTrusteesApproveDate != null))
|
|||
|
|
{
|
|||
|
|
odrInfo["status"] = "Yes";
|
|||
|
|
}
|
|||
|
|
else if (pFWithdrawalRequest.HRApproveDate != null && pFWithdrawalRequest.TrusteesApproveDate == null &&
|
|||
|
|
pFWithdrawalRequest.SecondTrusteesApproveDate == null && pFWithdrawalRequest.isRejected == true)
|
|||
|
|
{
|
|||
|
|
odrInfo["status"] = "Rejected";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
odrInfo["status"] = "No";
|
|||
|
|
}
|
|||
|
|
odrInfo["acknowledgementDate"] = pFWithdrawalRequest.HRApproveDate.ToString();
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case 3:
|
|||
|
|
//odrInfo["status"] = (pFWithdrawalRequest.TrusteesApproveDate != null && pFWithdrawalRequest.isRejected != true) ? "Yes" : "No";
|
|||
|
|
if (pFWithdrawalRequest != null)
|
|||
|
|
{
|
|||
|
|
if (pFWithdrawalRequest.TrusteesApproveDate != null && pFWithdrawalRequest.isRejected != true)
|
|||
|
|
{
|
|||
|
|
odrInfo["status"] = "Yes";
|
|||
|
|
}
|
|||
|
|
else if (pFWithdrawalRequest.TrusteesApproveDate != null && pFWithdrawalRequest.HRApproveDate != null &&
|
|||
|
|
pFWithdrawalRequest.SecondTrusteesApproveDate == null && pFWithdrawalRequest.isRejected == true)
|
|||
|
|
{
|
|||
|
|
odrInfo["status"] = "Rejected";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
odrInfo["status"] = "No";
|
|||
|
|
}
|
|||
|
|
odrInfo["acknowledgementDate"] = pFWithdrawalRequest.TrusteesApproveDate.ToString();
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case 4:
|
|||
|
|
//odrInfo["status"] = (pFWithdrawalRequest.SecondTrusteesApproveDate != null && pFWithdrawalRequest.isRejected != true) ? "Yes" : "No";
|
|||
|
|
if (pFWithdrawalRequest != null)
|
|||
|
|
{
|
|||
|
|
if (pFWithdrawalRequest.SecondTrusteesApproveDate != null && pFWithdrawalRequest.isRejected != true)
|
|||
|
|
{
|
|||
|
|
odrInfo["status"] = "Yes";
|
|||
|
|
}
|
|||
|
|
else if (pFWithdrawalRequest.SecondTrusteesApproveDate != null && pFWithdrawalRequest.HRApproveDate != null &&
|
|||
|
|
pFWithdrawalRequest.TrusteesApproveDate == null && pFWithdrawalRequest.isRejected == true)
|
|||
|
|
{
|
|||
|
|
odrInfo["status"] = "Rejected";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
odrInfo["status"] = "No";
|
|||
|
|
}
|
|||
|
|
odrInfo["acknowledgementDate"] = pFWithdrawalRequest.SecondTrusteesApproveDate.ToString();
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case 5:
|
|||
|
|
if (pFWithdrawalRequest != null)
|
|||
|
|
{
|
|||
|
|
odrInfo["status"] = (pFWithdrawalRequest.DepositDate != null) ? "Yes" : "No";
|
|||
|
|
odrInfo["acknowledgementDate"] = pFWithdrawalRequest.DepositDate.ToString(); ;
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
odrInfo["status"] = "Rejected";
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
oPFWithdrawalFlowGrid.Rows.Add(odrInfo);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(oPFWithdrawalFlowGrid);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//[HttpGet("getNewInvestment")]
|
|||
|
|
//public ActionResult GetNewInvestment()
|
|||
|
|
//{
|
|||
|
|
// CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
// NewInvestment oNewInvestment = new NewInvestment();
|
|||
|
|
|
|||
|
|
// try
|
|||
|
|
// {
|
|||
|
|
// oNewInvestment = _newInvestmentService.GetByMemberID(currentUser.MemberID);
|
|||
|
|
// }
|
|||
|
|
// catch (Exception ex)
|
|||
|
|
// {
|
|||
|
|
// return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// return Ok(oNewInvestment);
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
[HttpGet("getNewInvestmentById/{NewInvestmentId}")]
|
|||
|
|
public ActionResult GetNewInvestmentById(int NewInvestmentId)
|
|||
|
|
{
|
|||
|
|
NewInvestment item = new NewInvestment();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
item = _newInvestmentService.GetNewInvestmentById(NewInvestmentId);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(item);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
[HttpPost]
|
|||
|
|
[Route("saveLoanApplication")]
|
|||
|
|
public ActionResult saveLoanApplication(LoanApplication loanApplication)
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (loanApplication.LoanAttachments != null && loanApplication.LoanAttachments.Count > 0)
|
|||
|
|
{
|
|||
|
|
foreach (var tempItem in loanApplication.LoanAttachments)
|
|||
|
|
{
|
|||
|
|
if (tempItem != null)
|
|||
|
|
{
|
|||
|
|
if (tempItem.ID <= 0 && tempItem.FileDataString != null)
|
|||
|
|
{
|
|||
|
|
string[] items = tempItem.FileDataString.Split(new char[] { ',', ' ' }, StringSplitOptions.None);
|
|||
|
|
byte[] newBytes = Convert.FromBase64String(items[1]);
|
|||
|
|
tempItem.FileDataString = "";
|
|||
|
|
tempItem.FileData = newBytes;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Member omember = _memberService.Get(currentUser.LoginID, EnumFundType.Provident_Fund);
|
|||
|
|
//Member LoanHr = _memberService.Get(loanApplication.MemberID);
|
|||
|
|
//Member Trustee = _memberService.Get(loanApplication.MemberID);
|
|||
|
|
//Member SecondTrustee = _memberService.Get(loanApplication.MemberID);
|
|||
|
|
|
|||
|
|
loanApplication.ApplyDate = DateTime.Now;
|
|||
|
|
loanApplication.MemberID = omember.ID;
|
|||
|
|
//loanApplication.HRUserID = LoanHr.ID;
|
|||
|
|
//loanApplication.TrusteesID = Trustee.ID;
|
|||
|
|
//loanApplication.SecondTrusteesID = SecondTrustee.ID;
|
|||
|
|
// Member member = _memberService.Get(loanApplication.MemberID);
|
|||
|
|
loanApplication.Member = omember;
|
|||
|
|
loanApplication.EmployeeID = (int)currentUser.EmployeeID;
|
|||
|
|
loanApplication.CreatedDate = DateTime.Today;
|
|||
|
|
|
|||
|
|
_loanApplicationService.Save(loanApplication);
|
|||
|
|
|
|||
|
|
// EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
|
//send mail to hr
|
|||
|
|
//string temperr = _loanApplicationService.SendMailToTheApprovedLoanHR(loanApplication, emailSettings);
|
|||
|
|
//send mail to applicant
|
|||
|
|
//temperr = _loanApplicationService.SendMailToTheApplicant(loanApplication, emailSettings);
|
|||
|
|
|
|||
|
|
//if (temperr != string.Empty)
|
|||
|
|
//{
|
|||
|
|
// throw new Exception(temperr);
|
|||
|
|
//}
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(loanApplication);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[HttpPost]
|
|||
|
|
[Route("confirmPFWithdrawalRequestTerms")]
|
|||
|
|
public ActionResult ConfirmPFWithdrawalRequestTerms(PFWithdrawalRequest pFWithdrawalRequest)
|
|||
|
|
{
|
|||
|
|
int id = 0;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
Member member = new Member();
|
|||
|
|
member = _memberService.Get(currentUser.LoginID, EnumFundType.Provident_Fund);
|
|||
|
|
Member Hr = _memberService.Get(member.MemberID);
|
|||
|
|
|
|||
|
|
pFWithdrawalRequest.Status = EnumPFWithdrawalStatus.Confirmed;
|
|||
|
|
pFWithdrawalRequest.RequestEmployeeID = (int)currentUser.EmployeeID;
|
|||
|
|
pFWithdrawalRequest.RequestMemberID = member.ID; // currentUser.MemberID
|
|||
|
|
pFWithdrawalRequest.ConfirmDate = DateTime.Today;
|
|||
|
|
pFWithdrawalRequest.CreatedBy = (int)currentUser.EmployeeID;
|
|||
|
|
pFWithdrawalRequest.CreatedDate = DateTime.Today;
|
|||
|
|
|
|||
|
|
id = _pfWithdrawalRequestService.Save(pFWithdrawalRequest);
|
|||
|
|
|
|||
|
|
// EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
|
// string temperr = _pfWithdrawalRequestService.SendMailToPfMembershipWithdrawalHR(pFWithdrawalRequest, emailSettings, Hr.ID);
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(id);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
[HttpPost]
|
|||
|
|
[Route("savePFWithdrawalRequest")]
|
|||
|
|
public ActionResult SavePFWithdrawalRequest(PFWithdrawalRequest pFWithdrawalRequest)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
Member member = new Member();
|
|||
|
|
member = _memberService.Get(currentUser.LoginID, EnumFundType.Provident_Fund);
|
|||
|
|
|
|||
|
|
// pFWithdrawalRequest.ConnectionString = Ease.Core.Utility.Global.CipherFunctions.Decrypt("Cel.Admin", _fundEss.Value.MySqlCommandConnection);
|
|||
|
|
pFWithdrawalRequest.RequestEmployeeID = (int)currentUser.EmployeeID;
|
|||
|
|
pFWithdrawalRequest.RequestMemberID = member.ID; //currentUser.MemberID
|
|||
|
|
pFWithdrawalRequest.RequestDate = DateTime.Today;
|
|||
|
|
pFWithdrawalRequest.Status = EnumPFWithdrawalStatus.Submitted;
|
|||
|
|
pFWithdrawalRequest.StatusUpdateDate = null;
|
|||
|
|
pFWithdrawalRequest.CreatedBy = (int)currentUser.EmployeeID;
|
|||
|
|
pFWithdrawalRequest.CreatedDate = DateTime.Now;
|
|||
|
|
|
|||
|
|
if (pFWithdrawalRequest.PfWithdrawalRequestAttachment != null && pFWithdrawalRequest.isRejected != true)
|
|||
|
|
{
|
|||
|
|
if (pFWithdrawalRequest.PfWithdrawalRequestAttachment.FileDataString != null)
|
|||
|
|
{
|
|||
|
|
string[] items = pFWithdrawalRequest.PfWithdrawalRequestAttachment.FileDataString.Split(new char[] { ',', ' ' }, StringSplitOptions.None);
|
|||
|
|
byte[] newBytes = Convert.FromBase64String(items[1]);
|
|||
|
|
pFWithdrawalRequest.PfWithdrawalRequestAttachment.FileDataString = "";
|
|||
|
|
pFWithdrawalRequest.PfWithdrawalRequestAttachment.FileData = newBytes;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
_pfWithdrawalRequestService.Save(pFWithdrawalRequest);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(pFWithdrawalRequest);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
[HttpPost]
|
|||
|
|
[Route("updatePfDepositFlowApproved")]
|
|||
|
|
public ActionResult UpdatePfDepositFlowApproved(PFDepositFlow oPFDepositFlow)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
//Member Hr = _memberService.Get(oPFDepositFlow.);
|
|||
|
|
//oPFDepositFlow.ApprovedDate = DateTime.Now;
|
|||
|
|
//_pFDepositFlowService.UpdateApproved(oPFDepositFlow);
|
|||
|
|
|
|||
|
|
//EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
|
//string temperr = _pFDepositFlowService.SendMailToHr(emailSettings, Hr.ID);
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(oPFDepositFlow);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
[HttpPost]
|
|||
|
|
[Route("approveLoanApplication")]
|
|||
|
|
public ActionResult ApproveLoanApplication(WFMovementTran wfTran)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
wfTran.FromEmployeeID = (int)currentUser.EmployeeID;
|
|||
|
|
_loanApplicationService.ApproveLoanapplication(wfTran, currentUser);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
return Ok();
|
|||
|
|
}
|
|||
|
|
[HttpPost]
|
|||
|
|
[Route("pFWithdrawalRequest")]
|
|||
|
|
public ActionResult PFWithdrawalRequest(WFMovementTran wfTran)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
wfTran.FromEmployeeID = (int)currentUser.EmployeeID;
|
|||
|
|
_pfWithdrawalRequestService.ApprovePPFWithdrawalRequest(wfTran, currentUser);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
return Ok();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[HttpPost]
|
|||
|
|
[Route("rejectLoanApplication")]
|
|||
|
|
public ActionResult RejectLoanApplication(WFMovementTran wfTran)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
_loanApplicationService.LoanApplicationReject(wfTran);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
return Ok();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[HttpPost]
|
|||
|
|
[Route("rejectPFWithdrawalApplication")]
|
|||
|
|
public ActionResult RejectPFWithdrawalApplication(WFMovementTran wfTran)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
wfTran.FromEmployeeID = (int)currentUser.EmployeeID;
|
|||
|
|
_pfWithdrawalRequestService.PFWithdrawalApplicationReject(wfTran, currentUser);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
return Ok();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[HttpPost]
|
|||
|
|
[Route("updateLoanApproveByHr")]
|
|||
|
|
public ActionResult UpdateLoanApproveByHr(LoanApplication oLoanApplication)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
oLoanApplication.HRApproveDate = DateAndTime.Now;
|
|||
|
|
_loanApplicationService.UpdateLoanApproveByHr(oLoanApplication);
|
|||
|
|
|
|||
|
|
if (oLoanApplication.isRejected == false)
|
|||
|
|
{
|
|||
|
|
EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
|
string temperr = _loanApplicationService.SendMailToTrustees(oLoanApplication, emailSettings);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
|
string temperr = _loanApplicationService.SendMailToTheRejectedLoanApplicant(oLoanApplication, emailSettings);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(oLoanApplication);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
[HttpPost]
|
|||
|
|
[Route("updateLoanApproveByTrustees")]
|
|||
|
|
public ActionResult UpdateLoanApproveByTrustees(LoanApplication oLoanApplication)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
oLoanApplication.TrusteesApproveDate = DateAndTime.Now;
|
|||
|
|
_loanApplicationService.UpdateLoanApproveByTrustees(oLoanApplication);
|
|||
|
|
|
|||
|
|
//mail
|
|||
|
|
if (oLoanApplication.TrusteesApproveDate != null && oLoanApplication.SecondTrusteesApproveDate != null && oLoanApplication.isRejected == false)
|
|||
|
|
{
|
|||
|
|
EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
|
string temperr = _loanApplicationService.SendMailToTheApprovedLoanApplicant(oLoanApplication, emailSettings);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else if (oLoanApplication.TrusteesApproveDate != null && oLoanApplication.isRejected == true)
|
|||
|
|
{
|
|||
|
|
EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
|
string temperr = _loanApplicationService.SendRejectionMailOfEmployeeToSecondTrustee(oLoanApplication, emailSettings);
|
|||
|
|
|
|||
|
|
emailSettings = _emailSettings.Value;
|
|||
|
|
temperr = _loanApplicationService.SendMailToTheRejectedLoanApplicant(oLoanApplication, emailSettings);
|
|||
|
|
|
|||
|
|
emailSettings = _emailSettings.Value;
|
|||
|
|
temperr = new LoanApplicationService().SendMailOfTheRejectedLoanApplicantBySecondTrusteeToHR(oLoanApplication, emailSettings);
|
|||
|
|
}
|
|||
|
|
else if (oLoanApplication.SecondTrusteesApproveDate != null && oLoanApplication.isRejected == true)
|
|||
|
|
{
|
|||
|
|
EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
|
string temperr = _loanApplicationService.SendRejectionMailOfEmployeeToTrustee(oLoanApplication, emailSettings);
|
|||
|
|
|
|||
|
|
emailSettings = _emailSettings.Value;
|
|||
|
|
temperr = _loanApplicationService.SendMailToTheRejectedLoanApplicant(oLoanApplication, emailSettings);
|
|||
|
|
|
|||
|
|
emailSettings = _emailSettings.Value;
|
|||
|
|
temperr = new LoanApplicationService().SendMailOfTheRejectedLoanApplicantByFirstTrusteeToHR(oLoanApplication, emailSettings);
|
|||
|
|
}
|
|||
|
|
return Ok(oLoanApplication);
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
[HttpPost]
|
|||
|
|
[Route("updateLoanApproveBySecondTrustees")]
|
|||
|
|
public ActionResult UpdateLoanApproveBySecondTrustees(LoanApplication oLoanApplication)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
oLoanApplication.SecondTrusteesApproveDate = DateTime.Now;
|
|||
|
|
_loanApplicationService.UpdateLoanApproveBySecondTrustees(oLoanApplication);
|
|||
|
|
|
|||
|
|
//mail
|
|||
|
|
if (oLoanApplication.TrusteesApproveDate != null && oLoanApplication.SecondTrusteesApproveDate != null && oLoanApplication.isRejected == false)
|
|||
|
|
{
|
|||
|
|
EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
|
string temperr = _loanApplicationService.SendMailToTheApprovedLoanApplicant(oLoanApplication, emailSettings);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else if (oLoanApplication.TrusteesApproveDate != null && oLoanApplication.isRejected == true)
|
|||
|
|
{
|
|||
|
|
EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
|
string temperr = _loanApplicationService.SendRejectionMailOfEmployeeToSecondTrustee(oLoanApplication, emailSettings);
|
|||
|
|
|
|||
|
|
emailSettings = _emailSettings.Value;
|
|||
|
|
temperr = _loanApplicationService.SendMailToTheRejectedLoanApplicant(oLoanApplication, emailSettings);
|
|||
|
|
|
|||
|
|
emailSettings = _emailSettings.Value;
|
|||
|
|
temperr = new LoanApplicationService().SendMailOfTheRejectedLoanApplicantBySecondTrusteeToHR(oLoanApplication, emailSettings);
|
|||
|
|
}
|
|||
|
|
else if (oLoanApplication.SecondTrusteesApproveDate != null && oLoanApplication.isRejected == true)
|
|||
|
|
{
|
|||
|
|
EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
|
string temperr = _loanApplicationService.SendRejectionMailOfEmployeeToTrustee(oLoanApplication, emailSettings);
|
|||
|
|
|
|||
|
|
emailSettings = _emailSettings.Value;
|
|||
|
|
temperr = _loanApplicationService.SendMailToTheRejectedLoanApplicant(oLoanApplication, emailSettings);
|
|||
|
|
|
|||
|
|
emailSettings = _emailSettings.Value;
|
|||
|
|
temperr = new LoanApplicationService().SendMailOfTheRejectedLoanApplicantByFirstTrusteeToHR(oLoanApplication, emailSettings);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(oLoanApplication);
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[HttpPost]
|
|||
|
|
[Route("updatePfMembershipWithdrawalApproveByTrustees")]
|
|||
|
|
public ActionResult UpdatePfMembershipWithdrawalApproveByTrustees(PFWithdrawalRequest oPFWithdrawalRequest)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
//oPFWithdrawalRequest.TrusteesApproveDate = DateAndTime.Now;
|
|||
|
|
//if (oPFWithdrawalRequest.TrusteesApproveDate != null && oPFWithdrawalRequest.SecondTrusteesApproveDate != null && oPFWithdrawalRequest.isRejected == false)
|
|||
|
|
//{
|
|||
|
|
// oPFWithdrawalRequest.Status = EnumPFWithdrawalStatus.Approved;
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
//if (oPFWithdrawalRequest.isRejected == true)
|
|||
|
|
//{
|
|||
|
|
// oPFWithdrawalRequest.Status = EnumPFWithdrawalStatus.Rejected;
|
|||
|
|
//}
|
|||
|
|
//Member Hr = _memberService.Get(_fundEss.Value.LoanHrUser);
|
|||
|
|
|
|||
|
|
////mail
|
|||
|
|
//if (oPFWithdrawalRequest.TrusteesApproveDate != null && oPFWithdrawalRequest.SecondTrusteesApproveDate != null && oPFWithdrawalRequest.isRejected == false)
|
|||
|
|
//{
|
|||
|
|
// EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
|
// string temperr = _pfWithdrawalRequestService.SendMailToPfMembershipWithdrawalApplicant(oPFWithdrawalRequest, emailSettings);
|
|||
|
|
|
|||
|
|
//}
|
|||
|
|
//else if (oPFWithdrawalRequest.TrusteesApproveDate != null && oPFWithdrawalRequest.isRejected == true)
|
|||
|
|
//{
|
|||
|
|
// EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
|
// string temperr = new PFWithdrawalRequestService().SendRejectionMailOfEmployeeToSecondTrustee(oPFWithdrawalRequest, emailSettings);
|
|||
|
|
|
|||
|
|
// emailSettings = _emailSettings.Value;
|
|||
|
|
// temperr = new PFWithdrawalRequestService().SendMailToTheRejectedPFWithdrawalRequestApplicant(oPFWithdrawalRequest, emailSettings);
|
|||
|
|
|
|||
|
|
// emailSettings = _emailSettings.Value;
|
|||
|
|
|
|||
|
|
// temperr = new PFWithdrawalRequestService().SendMailOfTheRejectedPFWithdrawalBySecondTrusteeToHR(oPFWithdrawalRequest, Hr.EmpCode, emailSettings);
|
|||
|
|
//}
|
|||
|
|
//else if (oPFWithdrawalRequest.SecondTrusteesApproveDate != null && oPFWithdrawalRequest.isRejected == true)
|
|||
|
|
//{
|
|||
|
|
// EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
|
// string temperr = new PFWithdrawalRequestService().SendRejectionMailOfEmployeeToTrustee(oPFWithdrawalRequest, emailSettings);
|
|||
|
|
|
|||
|
|
// emailSettings = _emailSettings.Value;
|
|||
|
|
// temperr = new PFWithdrawalRequestService().SendMailToTheRejectedPFWithdrawalRequestApplicant(oPFWithdrawalRequest, emailSettings);
|
|||
|
|
|
|||
|
|
// emailSettings = _emailSettings.Value;
|
|||
|
|
// temperr = new PFWithdrawalRequestService().SendMailOfTheRejectedPFWithdrawalBySecondTrusteeToHR(oPFWithdrawalRequest, Hr.EmpCode, emailSettings);
|
|||
|
|
//}
|
|||
|
|
//_pfWithdrawalRequestService.UpdatePfMembershipWithdrawalApproveByTrustees(oPFWithdrawalRequest);
|
|||
|
|
return Ok(oPFWithdrawalRequest);
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
[HttpPost]
|
|||
|
|
[Route("updatePfMembershipWithdrawalApproveBySecondTrustees")]
|
|||
|
|
public ActionResult UpdatePfMembershipWithdrawalApproveBySecondTrustees(PFWithdrawalRequest oPFWithdrawalRequest)
|
|||
|
|
{
|
|||
|
|
//try
|
|||
|
|
//{
|
|||
|
|
// oPFWithdrawalRequest.SecondTrusteesApproveDate = DateTime.Now;
|
|||
|
|
// if (oPFWithdrawalRequest.TrusteesApproveDate != null && oPFWithdrawalRequest.SecondTrusteesApproveDate != null && oPFWithdrawalRequest.isRejected == false)
|
|||
|
|
// {
|
|||
|
|
// oPFWithdrawalRequest.Status = EnumPFWithdrawalStatus.Approved;
|
|||
|
|
// }
|
|||
|
|
// else if (oPFWithdrawalRequest.isRejected == true)
|
|||
|
|
// {
|
|||
|
|
// oPFWithdrawalRequest.Status = EnumPFWithdrawalStatus.Rejected;
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// _pfWithdrawalRequestService.UpdatePfMembershipWithdrawalApproveBySecondTrustees(oPFWithdrawalRequest);
|
|||
|
|
|
|||
|
|
// Member Hr = _memberService.Get(_fundEss.Value.LoanHrUser);
|
|||
|
|
// //mail
|
|||
|
|
// if (oPFWithdrawalRequest.TrusteesApproveDate != null && oPFWithdrawalRequest.SecondTrusteesApproveDate != null)
|
|||
|
|
// {
|
|||
|
|
// EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
|
// string temperr = _pfWithdrawalRequestService.SendMailToPfMembershipWithdrawalApplicant(oPFWithdrawalRequest, emailSettings);
|
|||
|
|
|
|||
|
|
// }
|
|||
|
|
// else if (oPFWithdrawalRequest.TrusteesApproveDate != null && oPFWithdrawalRequest.isRejected == true)
|
|||
|
|
// {
|
|||
|
|
// EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
|
// string temperr = new PFWithdrawalRequestService().SendRejectionMailOfEmployeeToSecondTrustee(oPFWithdrawalRequest, emailSettings);
|
|||
|
|
|
|||
|
|
// emailSettings = _emailSettings.Value;
|
|||
|
|
// temperr = new PFWithdrawalRequestService().SendMailToTheRejectedPFWithdrawalRequestApplicant(oPFWithdrawalRequest, emailSettings);
|
|||
|
|
|
|||
|
|
// emailSettings = _emailSettings.Value;
|
|||
|
|
// temperr = new PFWithdrawalRequestService().SendMailOfTheRejectedPFWithdrawalByFirstTrusteeToHR(oPFWithdrawalRequest, Hr.EmpCode, emailSettings);
|
|||
|
|
// }
|
|||
|
|
// else if (oPFWithdrawalRequest.SecondTrusteesApproveDate != null && oPFWithdrawalRequest.isRejected == true)
|
|||
|
|
// {
|
|||
|
|
// EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
|
// string temperr = new PFWithdrawalRequestService().SendRejectionMailOfEmployeeToTrustee(oPFWithdrawalRequest, emailSettings);
|
|||
|
|
|
|||
|
|
// emailSettings = _emailSettings.Value;
|
|||
|
|
// temperr = new PFWithdrawalRequestService().SendMailToTheRejectedPFWithdrawalRequestApplicant(oPFWithdrawalRequest, emailSettings);
|
|||
|
|
|
|||
|
|
// emailSettings = _emailSettings.Value;
|
|||
|
|
// temperr = new PFWithdrawalRequestService().SendMailOfTheRejectedPFWithdrawalByFirstTrusteeToHR(oPFWithdrawalRequest, Hr.EmpCode, emailSettings);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
|
|||
|
|
return Ok(oPFWithdrawalRequest);
|
|||
|
|
//}
|
|||
|
|
//catch (Exception e)
|
|||
|
|
//{
|
|||
|
|
// return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
//}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
[Route("getMemberLastAuditDate")]
|
|||
|
|
public ActionResult GetMemberLastAuditDate()
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
DateTime? lastAuditDate = null;
|
|||
|
|
//string AuditDate = string.Empty;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
Member oMember = new Member();
|
|||
|
|
oMember = _memberService.Get(currentUser.LoginID, EnumFundType.Provident_Fund);
|
|||
|
|
lastAuditDate = _membersTransactionDetailsService.GetMemberLastAuditDate(oMember.ID);
|
|||
|
|
return Ok(lastAuditDate);
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
[HttpGet]
|
|||
|
|
[Route("getDashboardData/{memberId}")]
|
|||
|
|
public ActionResult GetDashboardData(int memberId)
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
Member omember = new Member();
|
|||
|
|
PFWithdrawalRequest pFWithdrawalRequest = new PFWithdrawalRequest();
|
|||
|
|
|
|||
|
|
if (memberId == -1)
|
|||
|
|
{
|
|||
|
|
omember = _memberService.Get(currentUser.LoginID, EnumFundType.Provident_Fund);
|
|||
|
|
pFWithdrawalRequest = _pfWithdrawalRequestService.GetByMemberID(omember.ID);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
omember = _memberService.Get(memberId);
|
|||
|
|
pFWithdrawalRequest = _pfWithdrawalRequestService.GetByMemberID(omember.ID);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
DataRow odrInfo = null;
|
|||
|
|
|
|||
|
|
DataTable oDashboardData = new DataTable();
|
|||
|
|
oDashboardData.Columns.Add("EmpCode", typeof(string));
|
|||
|
|
oDashboardData.Columns.Add("Designation", typeof(string));
|
|||
|
|
oDashboardData.Columns.Add("Department", typeof(string));
|
|||
|
|
oDashboardData.Columns.Add("JoiningDate", typeof(string));
|
|||
|
|
oDashboardData.Columns.Add("WithdrawalDate", typeof(string));
|
|||
|
|
oDashboardData.Columns.Add("WithdrawalStatus", typeof(EnumPFWithdrawalStatus));
|
|||
|
|
oDashboardData.Columns.Add("MembershipDate", typeof(string));
|
|||
|
|
oDashboardData.Columns.Add("EMAILADDRESS", typeof(string));
|
|||
|
|
oDashboardData.Columns.Add("Name", typeof(string));
|
|||
|
|
oDashboardData.Columns.Add("DiscontinueDate", typeof(string));
|
|||
|
|
oDashboardData.Columns.Add("MOBILENO", typeof(string));
|
|||
|
|
oDashboardData.Columns.Add("AuditedOwnBalance", typeof(double)).DefaultValue = 0.0;
|
|||
|
|
oDashboardData.Columns.Add("AuditedCompanyBalance", typeof(double)).DefaultValue = 0.0;
|
|||
|
|
oDashboardData.Columns.Add("UnAuditedOwnBalance", typeof(double)).DefaultValue = 0.0;
|
|||
|
|
oDashboardData.Columns.Add("UnAuditedCompanyBalance", typeof(double)).DefaultValue = 0.0;
|
|||
|
|
oDashboardData.Columns.Add("memberid", typeof(int));
|
|||
|
|
oDashboardData.Columns.Add("fundtypeid", typeof(int));
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
DataTable oDashboardMember = new DataTable();
|
|||
|
|
oDashboardMember = _memberService.GetDashboardMember(omember.EmpCode);
|
|||
|
|
double auditedOwnBalance = 0, auditedCompanyBalance = 0, unAuditedOwnBalance = 0, unAuditedCompanyBalance = 0;
|
|||
|
|
|
|||
|
|
auditedOwnBalance = _membersTransactionDetailsService.GetDashboardMemberAuditedOwnBalance(omember.ID);
|
|||
|
|
auditedCompanyBalance = _membersTransactionDetailsService.GetDashboardMemberAuditedCompanyBalance(omember.ID);
|
|||
|
|
unAuditedOwnBalance = _membersTransactionDetailsService.GetDashboardMemberUnAuditedOwnBalance(omember.ID);
|
|||
|
|
unAuditedCompanyBalance = _membersTransactionDetailsService.GetDashboardMemberUnAuditedCompanyBalance(omember.ID);
|
|||
|
|
|
|||
|
|
if (oDashboardMember.Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
odrInfo = oDashboardData.NewRow();
|
|||
|
|
odrInfo["EmpCode"] = oDashboardMember.Rows[0]["EmpCode"].ToString();
|
|||
|
|
odrInfo["Name"] = oDashboardMember.Rows[0]["Name"].ToString();
|
|||
|
|
odrInfo["Designation"] = oDashboardMember.Rows[0]["Designation"].ToString();
|
|||
|
|
odrInfo["Department"] = oDashboardMember.Rows[0]["Department"].ToString();
|
|||
|
|
odrInfo["JoiningDate"] = oDashboardMember.Rows[0]["JoiningDate"].ToString();
|
|||
|
|
odrInfo["WithdrawalDate"] = (pFWithdrawalRequest != null && pFWithdrawalRequest.SettleDate != null) ? pFWithdrawalRequest.SettleDate : null;
|
|||
|
|
odrInfo["WithdrawalStatus"] = (pFWithdrawalRequest != null) ? pFWithdrawalRequest.Status : EnumPFWithdrawalStatus.None;
|
|||
|
|
odrInfo["MembershipDate"] = omember.MembershipDate;
|
|||
|
|
odrInfo["DiscontinueDate"] = oDashboardMember.Rows[0]["DiscontinueDate"].ToString();
|
|||
|
|
odrInfo["EMAILADDRESS"] = oDashboardMember.Rows[0]["EMAILADDRESS"].ToString();
|
|||
|
|
odrInfo["MOBILENO"] = oDashboardMember.Rows[0]["EMAILADDRESS"].ToString();
|
|||
|
|
odrInfo["AuditedOwnBalance"] = auditedOwnBalance;
|
|||
|
|
odrInfo["AuditedCompanyBalance"] = auditedCompanyBalance;
|
|||
|
|
odrInfo["UnAuditedOwnBalance"] = unAuditedOwnBalance;
|
|||
|
|
odrInfo["UnAuditedCompanyBalance"] = unAuditedCompanyBalance;
|
|||
|
|
odrInfo["memberid"] = omember.ID;
|
|||
|
|
odrInfo["fundtypeid"] = omember.FundTypeID;
|
|||
|
|
//odrInfo["Conn"] = Ease.Core.Utility.Global.CipherFunctions.Decrypt("Cel.Admin", _fundEss.Value.MySqlCommandConnection);//_fundEss.Value.MySqlCommandConnection;
|
|||
|
|
oDashboardData.Rows.Add(odrInfo);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
//return ex;
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
return Ok(oDashboardData);
|
|||
|
|
}
|
|||
|
|
[HttpGet]
|
|||
|
|
[Route("getDashboardDataNew")]
|
|||
|
|
public ActionResult GetDashboardDataNew()
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
Member omember = new Member();
|
|||
|
|
PFWithdrawalRequest pFWithdrawalRequest = new PFWithdrawalRequest();
|
|||
|
|
|
|||
|
|
omember = _memberService.Get(currentUser.LoginID, EnumFundType.Provident_Fund);
|
|||
|
|
pFWithdrawalRequest = _pfWithdrawalRequestService.GetByMemberID(omember.ID); //currentUser.MemberID
|
|||
|
|
|
|||
|
|
DataRow odrInfo = null;
|
|||
|
|
|
|||
|
|
DataTable oDashboardData = new DataTable();
|
|||
|
|
oDashboardData.Columns.Add("EmpCode", typeof(string));
|
|||
|
|
oDashboardData.Columns.Add("Designation", typeof(string));
|
|||
|
|
oDashboardData.Columns.Add("Department", typeof(string));
|
|||
|
|
oDashboardData.Columns.Add("JoiningDate", typeof(string));
|
|||
|
|
oDashboardData.Columns.Add("WithdrawalDate", typeof(string));
|
|||
|
|
oDashboardData.Columns.Add("WithdrawalStatus", typeof(EnumPFWithdrawalStatus));
|
|||
|
|
oDashboardData.Columns.Add("MembershipDate", typeof(string));
|
|||
|
|
oDashboardData.Columns.Add("EMAILADDRESS", typeof(string));
|
|||
|
|
oDashboardData.Columns.Add("Name", typeof(string));
|
|||
|
|
oDashboardData.Columns.Add("DiscontinueDate", typeof(string));
|
|||
|
|
oDashboardData.Columns.Add("MOBILENO", typeof(string));
|
|||
|
|
oDashboardData.Columns.Add("AuditedOwnBalance", typeof(double)).DefaultValue = 0.0;
|
|||
|
|
oDashboardData.Columns.Add("AuditedCompanyBalance", typeof(double)).DefaultValue = 0.0;
|
|||
|
|
oDashboardData.Columns.Add("UnAuditedOwnBalance", typeof(double)).DefaultValue = 0.0;
|
|||
|
|
oDashboardData.Columns.Add("UnAuditedCompanyBalance", typeof(double)).DefaultValue = 0.0;
|
|||
|
|
oDashboardData.Columns.Add("Conn", typeof(string));
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
DataTable oDashboardMember = new DataTable();
|
|||
|
|
oDashboardMember = _memberService.GetDashboardMember(omember.EmpCode);
|
|||
|
|
double auditedOwnBalance = 0, auditedCompanyBalance = 0, unAuditedOwnBalance = 0, unAuditedCompanyBalance = 0;
|
|||
|
|
|
|||
|
|
auditedOwnBalance = _membersTransactionDetailsService.GetDashboardMemberAuditedOwnBalance(omember.ID);
|
|||
|
|
auditedCompanyBalance = _membersTransactionDetailsService.GetDashboardMemberAuditedCompanyBalance(omember.ID);
|
|||
|
|
unAuditedOwnBalance = _membersTransactionDetailsService.GetDashboardMemberUnAuditedOwnBalance(omember.ID);
|
|||
|
|
unAuditedCompanyBalance = _membersTransactionDetailsService.GetDashboardMemberUnAuditedCompanyBalance(omember.ID);
|
|||
|
|
|
|||
|
|
if (oDashboardMember.Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
odrInfo = oDashboardData.NewRow();
|
|||
|
|
odrInfo["EmpCode"] = oDashboardMember.Rows[0]["EmpCode"].ToString();
|
|||
|
|
odrInfo["Name"] = oDashboardMember.Rows[0]["Name"].ToString();
|
|||
|
|
odrInfo["Designation"] = oDashboardMember.Rows[0]["Designation"].ToString();
|
|||
|
|
odrInfo["Department"] = oDashboardMember.Rows[0]["Department"].ToString();
|
|||
|
|
odrInfo["JoiningDate"] = oDashboardMember.Rows[0]["JoiningDate"].ToString();
|
|||
|
|
odrInfo["WithdrawalDate"] = (pFWithdrawalRequest != null && pFWithdrawalRequest.SettleDate != null) ? pFWithdrawalRequest.SettleDate : null;
|
|||
|
|
odrInfo["WithdrawalStatus"] = (pFWithdrawalRequest != null) ? pFWithdrawalRequest.Status : EnumPFWithdrawalStatus.None;
|
|||
|
|
odrInfo["MembershipDate"] = omember.MembershipDate;
|
|||
|
|
odrInfo["DiscontinueDate"] = oDashboardMember.Rows[0]["DiscontinueDate"].ToString();
|
|||
|
|
odrInfo["EMAILADDRESS"] = oDashboardMember.Rows[0]["EMAILADDRESS"].ToString();
|
|||
|
|
odrInfo["MOBILENO"] = oDashboardMember.Rows[0]["EMAILADDRESS"].ToString();
|
|||
|
|
odrInfo["AuditedOwnBalance"] = auditedOwnBalance;
|
|||
|
|
odrInfo["AuditedCompanyBalance"] = auditedCompanyBalance;
|
|||
|
|
odrInfo["UnAuditedOwnBalance"] = unAuditedOwnBalance;
|
|||
|
|
odrInfo["UnAuditedCompanyBalance"] = unAuditedCompanyBalance;
|
|||
|
|
//odrInfo["Conn"] = Ease.Core.Utility.Global.CipherFunctions.Decrypt("Cel.Admin", _fundEss.Value.MySqlCommandConnection);//_fundEss.Value.MySqlCommandConnection;
|
|||
|
|
oDashboardData.Rows.Add(odrInfo);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
//return ex;
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
return Ok(oDashboardData);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
[HttpPost("getMemberLedgerBalance")]
|
|||
|
|
public ActionResult GetMemberLedgerBalance(dynamic data)
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|||
|
|
Member member = _memberService.Get(currentUser.LoginID, EnumFundType.Provident_Fund);
|
|||
|
|
DateTime fromDate = item["fromDate"].ToObject<DateTime>();
|
|||
|
|
DateTime toDate = item["toDate"].ToObject<DateTime>();
|
|||
|
|
|
|||
|
|
DataTable oIndividualMemConDataTable = new DataTable();
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("EmployeeNo", typeof(string));
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("Name", typeof(string));
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("Status", typeof(string));
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("Designation", typeof(string));
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("MonthOfContribution", typeof(string));
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("EPFInterest", typeof(double)).DefaultValue = 0.0;
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("CPFInterest", typeof(double)).DefaultValue = 0.0;
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("EPFContribution", typeof(double)).DefaultValue = 0.0;
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("CPFContribution", typeof(double)).DefaultValue = 0.0;
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("OpeningBalance", typeof(double)).DefaultValue = 0.0;
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("Description", typeof(string));
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("Total", typeof(double));
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("NegativeFinalSettlementTotal", typeof(double));
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
DateTime tempTranDate = DateTime.MinValue;
|
|||
|
|
DataRow odr = null;
|
|||
|
|
DataRow odrInfo = null;
|
|||
|
|
double dOpeningBalance = 0.0;
|
|||
|
|
string searchCondition = string.Empty;
|
|||
|
|
|
|||
|
|
if (member != null)
|
|||
|
|
{
|
|||
|
|
searchCondition = SQLParser.MakeSQL(" and TranDate between %d and %d And FundTypeID = %n ", fromDate, toDate, member.FundTypeID);
|
|||
|
|
DataSet openingBal = _membersTransactionDetailsService.GetOpeningBalance(member.ID, member.FundTypeID, fromDate);
|
|||
|
|
if (openingBal.Tables.Count > 0 && openingBal.Tables[0].Rows.Count > 0 && openingBal.Tables[0].Rows[0]["OpeningBalance"] != DBNull.Value)
|
|||
|
|
{
|
|||
|
|
dOpeningBalance = Convert.ToDouble(openingBal.Tables[0].Rows[0]["OpeningBalance"]);
|
|||
|
|
}
|
|||
|
|
List<MembersTransactionDetail> memTranDetailColl = _membersTransactionDetailsService.GetMemberContribution(member.ID, searchCondition);
|
|||
|
|
List<MembersTransactionDetail> groupBydate = memTranDetailColl.GroupBy(x => x.TranDate.Date).Select(g => g.First()).OrderBy(x => x.TranDate).ToList();
|
|||
|
|
foreach (MembersTransactionDetail memTranDetail in memTranDetailColl)
|
|||
|
|
{
|
|||
|
|
if (memTranDetail.Amount != 0)
|
|||
|
|
{
|
|||
|
|
odr = oIndividualMemConDataTable.NewRow();
|
|||
|
|
|
|||
|
|
odr["MonthOfContribution"] = memTranDetail.TranDate.ToString("dd MMM, yyyy");
|
|||
|
|
EnumMemberTranType otrn = (EnumMemberTranType)memTranDetail.TranTypeID;
|
|||
|
|
odr["Description"] = (string)otrn.ToString().Replace("_", " ");
|
|||
|
|
|
|||
|
|
if (memTranDetail.TranTypeID == EnumMemberTranType.EPF_Interest || memTranDetail.TranTypeID == EnumMemberTranType.EPF_Interest_Opening)
|
|||
|
|
{
|
|||
|
|
odr["EPFInterest"] = memTranDetail.Amount;
|
|||
|
|
}
|
|||
|
|
else if (memTranDetail.TranTypeID == EnumMemberTranType.CPF_Interest || memTranDetail.TranTypeID == EnumMemberTranType.CPF_Interest_Opening)
|
|||
|
|
{
|
|||
|
|
odr["CPFInterest"] = memTranDetail.Amount;
|
|||
|
|
}
|
|||
|
|
else if (EnumMemberTranType.EPF == memTranDetail.TranTypeID || EnumMemberTranType.EFP_Opening == memTranDetail.TranTypeID)
|
|||
|
|
{
|
|||
|
|
odr["EPFContribution"] = memTranDetail.Amount;
|
|||
|
|
}
|
|||
|
|
else if (EnumMemberTranType.CPF == memTranDetail.TranTypeID || EnumMemberTranType.CPF_Opening == memTranDetail.TranTypeID)
|
|||
|
|
{
|
|||
|
|
odr["CPFContribution"] = memTranDetail.Amount;
|
|||
|
|
}
|
|||
|
|
odr["Total"] = memTranDetail.Amount;
|
|||
|
|
oIndividualMemConDataTable.Rows.Add(odr);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
odrInfo = oIndividualMemConDataTable.NewRow();
|
|||
|
|
odrInfo["EmployeeNo"] = member.EmpCode;
|
|||
|
|
odrInfo["Name"] = member.Name;
|
|||
|
|
odrInfo["Status"] = member.MemberStatus;
|
|||
|
|
odrInfo["Designation"] = member.CurrentDesig;
|
|||
|
|
odrInfo["OpeningBalance"] = dOpeningBalance;
|
|||
|
|
odrInfo["EPFContribution"] = DBNull.Value;
|
|||
|
|
odrInfo["CPFContribution"] = DBNull.Value;
|
|||
|
|
odrInfo["EPFInterest"] = DBNull.Value;
|
|||
|
|
odrInfo["CPFInterest"] = DBNull.Value;
|
|||
|
|
oIndividualMemConDataTable.Rows.Add(odrInfo);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
return Ok(oIndividualMemConDataTable);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
[HttpGet]
|
|||
|
|
[Route("getApproversForLoanApproval/{loanApplicationId}")]
|
|||
|
|
public ActionResult GetApproversForLoanApproval(int loanApplicationId)
|
|||
|
|
{
|
|||
|
|
LoanApplication loanApplication = new LoanApplicationService().GetLoanAppById(loanApplicationId);
|
|||
|
|
|
|||
|
|
Member LoanHr = _memberService.Get((int)loanApplication.HRUserID);
|
|||
|
|
Member Trustee = _memberService.Get((int)loanApplication.TrusteesID);
|
|||
|
|
Member SecondTrustee = _memberService.Get((int)loanApplication.SecondTrusteesID);
|
|||
|
|
|
|||
|
|
List<Member> _approvers = new List<Member>();
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
_approvers.Add(LoanHr);
|
|||
|
|
_approvers.Add(Trustee);
|
|||
|
|
_approvers.Add(SecondTrustee);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
return Ok(_approvers);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
[HttpGet]
|
|||
|
|
[Route("getApproversForPfDepositApproval")]
|
|||
|
|
public ActionResult GetApproversForPfDepositApproval()
|
|||
|
|
{
|
|||
|
|
//Member PFDepositCheckedBy = _memberService.Get(_fundEss.Value.PFDepositCheckedBy);
|
|||
|
|
//Member PFDepositApprovedBy = _memberService.Get(_fundEss.Value.PFDepositApprovedBy);
|
|||
|
|
|
|||
|
|
List<Member> _approvers = new List<Member>();
|
|||
|
|
|
|||
|
|
//try
|
|||
|
|
//{
|
|||
|
|
// _approvers.Add(PFDepositCheckedBy);
|
|||
|
|
// _approvers.Add(PFDepositApprovedBy);
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
//catch (Exception ex)
|
|||
|
|
//{
|
|||
|
|
// return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
//}
|
|||
|
|
return Ok(_approvers);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[HttpPost]
|
|||
|
|
[Route("SubmitLoanEarlySettlementRequest")]
|
|||
|
|
public ActionResult SubmitLoanEarlySettlementRequest(FMLoan oLoan)
|
|||
|
|
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
oLoan.EarlySettleRequestBy = oLoan.MemberID; //currentUser.MemberID // LoanSettlestatus { None =1, request, Checked, deposited, settled}
|
|||
|
|
oLoan.EarlySettleRequestDate = DateTime.Now;
|
|||
|
|
oLoan.ModifiedBy = currentUser.EmployeeID;
|
|||
|
|
oLoan.ModifiedDate = DateTime.Now;
|
|||
|
|
oLoan.SettleStatus = EnumLoanSettleStatus.Requested;
|
|||
|
|
new FMLoanService().SubmitLoanEarlySettlementRequest(oLoan);
|
|||
|
|
|
|||
|
|
//string temperr = _fmLoanService.SendMailToLoanEarlySettlementHR(oLoan, emailSettings, LoanHr.ID);
|
|||
|
|
//temperr = _fmLoanService.SendMailToLoanEarlySettleApplicant(oLoan, emailSettings);
|
|||
|
|
//if (temperr != string.Empty)
|
|||
|
|
//{
|
|||
|
|
// throw new Exception(temperr);
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
return Ok(oLoan);
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
[HttpPost]
|
|||
|
|
[Route("DepositLoanEarlySettlement")]
|
|||
|
|
public ActionResult DepositLoanEarlySettlement(FMLoan oLoan)
|
|||
|
|
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
oLoan.SettleStatus = EnumLoanSettleStatus.Deposited;
|
|||
|
|
oLoan.DepositDate = DateTime.Today;
|
|||
|
|
oLoan.DepositAmount = oLoan.TotalOutstanding;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (oLoan.LoanEarlySettlementAttachment != null)
|
|||
|
|
{
|
|||
|
|
if (oLoan.LoanEarlySettlementAttachment.FileDataString != null)
|
|||
|
|
{
|
|||
|
|
string[] items = oLoan.LoanEarlySettlementAttachment.FileDataString.Split(new char[] { ',', ' ' }, StringSplitOptions.None);
|
|||
|
|
if (items.Length > 1)
|
|||
|
|
{
|
|||
|
|
byte[] newBytes = Convert.FromBase64String(items[1].Trim());
|
|||
|
|
oLoan.LoanEarlySettlementAttachment.FileDataString = "";
|
|||
|
|
oLoan.LoanEarlySettlementAttachment.FileData = newBytes;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
oLoan.DepositDate = DateTime.Now;
|
|||
|
|
oLoan.ModifiedBy = currentUser.EmployeeID;
|
|||
|
|
oLoan.ModifiedDate = DateTime.Now;
|
|||
|
|
|
|||
|
|
_fmLoanService.DepositLoanEarlySettlement(oLoan);
|
|||
|
|
|
|||
|
|
return Ok(oLoan);
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
[HttpPost]
|
|||
|
|
[Route("DoLoanEarlySettlement")]
|
|||
|
|
public ActionResult DoLoanEarlySettlement(FMLoan oLoan)
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
Member member = new Member();
|
|||
|
|
member = _memberService.Get(oLoan.MemberID);
|
|||
|
|
EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
|
oLoan.SettleStatus = EnumLoanSettleStatus.Settled;
|
|||
|
|
oLoan.EarlySettleDate = DateTime.Today;
|
|||
|
|
oLoan.DepositAmount = oLoan.SettleAmount;
|
|||
|
|
|
|||
|
|
oLoan.Member = member;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
oLoan.DepositDate = DateTime.Now;
|
|||
|
|
oLoan.ModifiedBy = currentUser.UserID;
|
|||
|
|
oLoan.ModifiedDate = DateTime.Now;
|
|||
|
|
|
|||
|
|
_fmLoanService.DoLoanEarlySettlement(oLoan);
|
|||
|
|
|
|||
|
|
return Ok(oLoan);
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
[HttpPost]
|
|||
|
|
[Route("updateNewInvestment")]
|
|||
|
|
public ActionResult UpdateNewInvestment(NewInvestment oNewInvestment)
|
|||
|
|
{
|
|||
|
|
//CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
//try
|
|||
|
|
//{
|
|||
|
|
// Member Hr = _memberService.Get(_fundEss.Value.LoanHrUser);
|
|||
|
|
// _newInvestmentService.UpdateNewInvestmentApproval(oNewInvestment);
|
|||
|
|
|
|||
|
|
// if (oNewInvestment.ApproverOneDate != null && oNewInvestment.ApproverTwoDate != null)
|
|||
|
|
// {
|
|||
|
|
// EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
|
// string temperr = _newInvestmentService.SendMailToHr(emailSettings, Hr.ID);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
//}
|
|||
|
|
//catch (Exception e)
|
|||
|
|
//{
|
|||
|
|
// return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
//}
|
|||
|
|
return Ok(oNewInvestment);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
[HttpGet("getSelectedApproverForLoanApplication/{LoanApplicationID}")]
|
|||
|
|
public ActionResult GetSelectedApproverForLoanApplication(int LoanApplicationID)
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
|
|||
|
|
LoanApplication loanApplication = new LoanApplicationService().GetLoanAppById(LoanApplicationID);
|
|||
|
|
int id = (int)loanApplication.HRUserID;
|
|||
|
|
if (id < 0)
|
|||
|
|
{
|
|||
|
|
id = 0;
|
|||
|
|
}
|
|||
|
|
Member LoanHr = _memberService.Get(id); //(int)loanApplication.HRUserID
|
|||
|
|
Member Trustee = _memberService.Get((int)loanApplication.TrusteesID);
|
|||
|
|
Member SecondTrustee = _memberService.Get((int)loanApplication.SecondTrusteesID);
|
|||
|
|
|
|||
|
|
int selectedApprover = 0;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (0 == LoanHr.ID) //currentUser.MemberID
|
|||
|
|
{
|
|||
|
|
selectedApprover = 1;
|
|||
|
|
}
|
|||
|
|
else if (0 == Trustee.ID) //currentUser.MemberID
|
|||
|
|
{
|
|||
|
|
selectedApprover = 2;
|
|||
|
|
}
|
|||
|
|
else if (0 == SecondTrustee.ID) //currentUser.MemberID
|
|||
|
|
{
|
|||
|
|
selectedApprover = 3;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
selectedApprover = 0;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(selectedApprover);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[HttpGet("getSelectedApproverForPfMembershipWithdrawal")]
|
|||
|
|
public ActionResult GetSelectedApproverForPfMembershipWithdrawal()
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
//Member Trustee = _memberService.Get(_fundEss.Value.LoanTrustee);
|
|||
|
|
//Member SecondTrustee = _memberService.Get(_fundEss.Value.LoanSecondTrustee);
|
|||
|
|
|
|||
|
|
int selectedApprover = 0;
|
|||
|
|
//try
|
|||
|
|
//{
|
|||
|
|
// if (0 == Trustee.ID) //currentUser.MemberID
|
|||
|
|
// {
|
|||
|
|
// selectedApprover = 1;
|
|||
|
|
// }
|
|||
|
|
// else if (0 == SecondTrustee.ID) //currentUser.MemberID
|
|||
|
|
// {
|
|||
|
|
// selectedApprover = 2;
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// selectedApprover = 0;
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
//catch (Exception ex)
|
|||
|
|
//{
|
|||
|
|
// return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
return Ok(selectedApprover);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[HttpPost]
|
|||
|
|
[Route("getSelectedApproverForInvestment")]
|
|||
|
|
public ActionResult GetSelectedApproverForInvestment(NewInvestment newInvestment)
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
|
|||
|
|
int selectedApprover = 0;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (0 == newInvestment.ApproverOne) //currentUser.MemberID
|
|||
|
|
{
|
|||
|
|
selectedApprover = 1;
|
|||
|
|
}
|
|||
|
|
else if (0 == newInvestment.ApproverTwo) //currentUser.MemberID
|
|||
|
|
{
|
|||
|
|
selectedApprover = 2;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
selectedApprover = 0;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(selectedApprover);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//[HttpPost]
|
|||
|
|
//[Route("saveNewInvestment")]
|
|||
|
|
//public ActionResult SaveNewInvestment(NewInvestment newInvestment)
|
|||
|
|
//{
|
|||
|
|
// CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
|
|||
|
|
// try
|
|||
|
|
// {
|
|||
|
|
// newInvestment.
|
|||
|
|
|
|||
|
|
// _pfWithdrawalRequestService.Save(pFWithdrawalRequest);
|
|||
|
|
// }
|
|||
|
|
// catch (Exception e)
|
|||
|
|
// {
|
|||
|
|
// return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// return Ok(pFWithdrawalRequest);
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
[HttpGet("getPFWithdrawalRequest/{PFWithdrawalRequestID}")]
|
|||
|
|
public ActionResult getPFWithdrawalRequest(int PFWithdrawalRequestID)
|
|||
|
|
{
|
|||
|
|
PFWithdrawalRequest pFWithdrawalRequest = new PFWithdrawalRequest();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
pFWithdrawalRequest = _pfWithdrawalRequestService.Get(PFWithdrawalRequestID);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(pFWithdrawalRequest);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[HttpGet("getPFWithdrawalRequestByMemberID")]
|
|||
|
|
public ActionResult getPFWithdrawalRequestByMemberID()
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
Member member = new Member();
|
|||
|
|
member = _memberService.Get(currentUser.LoginID, EnumFundType.Provident_Fund);
|
|||
|
|
PFWithdrawalRequest pFWithdrawalRequest = new PFWithdrawalRequest();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
pFWithdrawalRequest = _pfWithdrawalRequestService.GetByMemberID(member.ID); //currentUser.MemberID
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(pFWithdrawalRequest);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[HttpPost]
|
|||
|
|
[Route("viewPfWithdrawalRequestAttachmentPDF")]
|
|||
|
|
public ActionResult viewPfWithdrawalRequestAttachmentPDF(PFWithdrawalRequest oPFWithdrawalRequest)
|
|||
|
|
{
|
|||
|
|
PfWithdrawalRequestAttachment oPfWithdrawalRequestAttachment = new PfWithdrawalRequestAttachment();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
oPfWithdrawalRequestAttachment = _pfWithdrawalRequestService.LoadPfWithdrawalRequestAttachment(oPFWithdrawalRequest);
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(oPfWithdrawalRequestAttachment);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[HttpPost]
|
|||
|
|
[Route("viewLoanAttachmentPDF")]
|
|||
|
|
public ActionResult viewLoanAttachmentPDF(PFWithdrawalRequest oPFWithdrawalRequest)
|
|||
|
|
{
|
|||
|
|
PfWithdrawalRequestAttachment oPfWithdrawalRequestAttachment = new PfWithdrawalRequestAttachment();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
oPfWithdrawalRequestAttachment = _pfWithdrawalRequestService.LoadPfWithdrawalRequestAttachment(oPFWithdrawalRequest);
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(oPfWithdrawalRequestAttachment);
|
|||
|
|
}
|
|||
|
|
[HttpGet("getSystemDate")]
|
|||
|
|
public ActionResult getSystemDate()
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
DateTime lastMonthEndDate = new DateTime();
|
|||
|
|
PFWithdrawalRequestService pFWithdrawalRequest = new PFWithdrawalRequestService();
|
|||
|
|
List<DateTime> dateTimeList = new List<DateTime>();
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
lastMonthEndDate = pFWithdrawalRequest.getSystemDate(0); //currentUser.MemberID
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
dateTimeList.Add(GlobalFunctions.FirstDateOfMonth(lastMonthEndDate.AddMonths(+1)));
|
|||
|
|
dateTimeList.Add(GlobalFunctions.LastDateOfMonth(lastMonthEndDate.AddMonths(+1)));
|
|||
|
|
|
|||
|
|
return Ok(dateTimeList);
|
|||
|
|
}
|
|||
|
|
[HttpPost("getMemberLedgerBalanceReport")]
|
|||
|
|
public ActionResult GetMemberLedgerBalanceReport(dynamic data)
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|||
|
|
Member member = _memberService.Get(currentUser.LoginID, EnumFundType.Provident_Fund);
|
|||
|
|
DateTime fromDate = item["fromDate"].ToObject<DateTime>();
|
|||
|
|
DateTime toDate = item["toDate"].ToObject<DateTime>();
|
|||
|
|
string reportType = item["reportType"].ToObject<string>();
|
|||
|
|
|
|||
|
|
DataTable oIndividualMemConDataTable = new DataTable();
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("EmployeeNo", typeof(string));
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("Name", typeof(string));
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("Status", typeof(string));
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("Designation", typeof(string));
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("MonthOfContribution", typeof(string));
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("EPFInterest", typeof(double)).DefaultValue = 0.0;
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("CPFInterest", typeof(double)).DefaultValue = 0.0;
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("EPFContribution", typeof(double)).DefaultValue = 0.0;
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("CPFContribution", typeof(double)).DefaultValue = 0.0;
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("OpeningBalance", typeof(double)).DefaultValue = 0.0;
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("Description", typeof(string));
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("Total", typeof(double));
|
|||
|
|
oIndividualMemConDataTable.Columns.Add("NegativeFinalSettlementTotal", typeof(double));
|
|||
|
|
|
|||
|
|
DateTime tempTranDate = DateTime.MinValue;
|
|||
|
|
DataRow odr = null;
|
|||
|
|
DataRow odrInfo = null;
|
|||
|
|
double dOpeningBalance = 0.0;
|
|||
|
|
string searchCondition = string.Empty;
|
|||
|
|
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (member != null)
|
|||
|
|
{
|
|||
|
|
searchCondition = SQLParser.MakeSQL(" and TranDate between %d and %d And FundTypeID = %n ", fromDate, toDate, member.FundTypeID);
|
|||
|
|
DataSet openingBal = _membersTransactionDetailsService.GetOpeningBalance(member.ID, member.FundTypeID, fromDate);
|
|||
|
|
if (openingBal.Tables.Count > 0 && openingBal.Tables[0].Rows.Count > 0 && openingBal.Tables[0].Rows[0]["OpeningBalance"] != DBNull.Value)
|
|||
|
|
{
|
|||
|
|
dOpeningBalance = Convert.ToDouble(openingBal.Tables[0].Rows[0]["OpeningBalance"]);
|
|||
|
|
}
|
|||
|
|
List<MembersTransactionDetail> memTranDetailColl = _membersTransactionDetailsService.GetMemberContribution(member.ID, searchCondition);
|
|||
|
|
List<MembersTransactionDetail> groupBydate = memTranDetailColl.GroupBy(x => x.TranDate.Date).Select(g => g.First()).OrderBy(x => x.TranDate).ToList();
|
|||
|
|
foreach (MembersTransactionDetail memTranDetail in memTranDetailColl)
|
|||
|
|
{
|
|||
|
|
if (memTranDetail.Amount != 0)
|
|||
|
|
{
|
|||
|
|
odr = oIndividualMemConDataTable.NewRow();
|
|||
|
|
|
|||
|
|
odr["MonthOfContribution"] = memTranDetail.TranDate.ToString("dd MMM, yyyy");
|
|||
|
|
EnumMemberTranType otrn = (EnumMemberTranType)memTranDetail.TranTypeID;
|
|||
|
|
odr["Description"] = (string)otrn.ToString().Replace("_", " ");
|
|||
|
|
|
|||
|
|
if (memTranDetail.TranTypeID == EnumMemberTranType.EPF_Interest || memTranDetail.TranTypeID == EnumMemberTranType.EPF_Interest_Opening)
|
|||
|
|
{
|
|||
|
|
odr["EPFInterest"] = memTranDetail.Amount;
|
|||
|
|
}
|
|||
|
|
else if (memTranDetail.TranTypeID == EnumMemberTranType.CPF_Interest || memTranDetail.TranTypeID == EnumMemberTranType.CPF_Interest_Opening)
|
|||
|
|
{
|
|||
|
|
odr["CPFInterest"] = memTranDetail.Amount;
|
|||
|
|
}
|
|||
|
|
else if (EnumMemberTranType.EPF == memTranDetail.TranTypeID || EnumMemberTranType.EFP_Opening == memTranDetail.TranTypeID)
|
|||
|
|
{
|
|||
|
|
odr["EPFContribution"] = memTranDetail.Amount;
|
|||
|
|
}
|
|||
|
|
else if (EnumMemberTranType.CPF == memTranDetail.TranTypeID || EnumMemberTranType.CPF_Opening == memTranDetail.TranTypeID)
|
|||
|
|
{
|
|||
|
|
odr["CPFContribution"] = memTranDetail.Amount;
|
|||
|
|
}
|
|||
|
|
odr["Total"] = memTranDetail.Amount;
|
|||
|
|
oIndividualMemConDataTable.Rows.Add(odr);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
odrInfo = oIndividualMemConDataTable.NewRow();
|
|||
|
|
odrInfo["EmployeeNo"] = member.EmpCode;
|
|||
|
|
odrInfo["Name"] = member.Name;
|
|||
|
|
odrInfo["Status"] = member.MemberStatus;
|
|||
|
|
odrInfo["Designation"] = member.CurrentDesig;
|
|||
|
|
odrInfo["OpeningBalance"] = dOpeningBalance;
|
|||
|
|
odrInfo["EPFContribution"] = DBNull.Value;
|
|||
|
|
odrInfo["CPFContribution"] = DBNull.Value;
|
|||
|
|
odrInfo["EPFInterest"] = DBNull.Value;
|
|||
|
|
odrInfo["CPFInterest"] = DBNull.Value;
|
|||
|
|
oIndividualMemConDataTable.Rows.Add(odrInfo);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
oIndividualMemConDataTable.TableName = "FundEssDataSet_MemberBalanceLedger";
|
|||
|
|
DataSet resultDataSet = new DataSet();
|
|||
|
|
resultDataSet.Tables.Add(oIndividualMemConDataTable);
|
|||
|
|
|
|||
|
|
string RDLCName = "HRM.Report.RDLC.rptIndividualMemberConForKCCL.rdlc";
|
|||
|
|
|
|||
|
|
List<ReportParameter> rParamList = new List<ReportParameter>();
|
|||
|
|
ReportParameter rParam = new ReportParameter("OpeningBalance", dOpeningBalance.ToString("#,##"));
|
|||
|
|
rParamList.Add(rParam);
|
|||
|
|
|
|||
|
|
rParam = new ReportParameter("EmployeeNO", member.EmpCode);
|
|||
|
|
rParamList.Add(rParam);
|
|||
|
|
|
|||
|
|
rParam = new ReportParameter("Name", member.Name);
|
|||
|
|
rParamList.Add(rParam);
|
|||
|
|
|
|||
|
|
rParam = new ReportParameter("fromDate", fromDate.ToString("dd MMM, yyyy"));
|
|||
|
|
rParamList.Add(rParam);
|
|||
|
|
|
|||
|
|
rParam = new ReportParameter("toDate", toDate.ToString("dd MMM, yyyy"));
|
|||
|
|
rParamList.Add(rParam);
|
|||
|
|
|
|||
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|||
|
|
byte[] bytes = null;
|
|||
|
|
bytes = reportProcessor.CommonFundReportView(null, RDLCName, resultDataSet, null, rParamList, true, member.FundTypeID, reportType);
|
|||
|
|
|
|||
|
|
return Ok(bytes);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[HttpPost("getLoanScheduleReport")]
|
|||
|
|
public ActionResult getLoanScheduleReport(dynamic data)
|
|||
|
|
{
|
|||
|
|
var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
int memberID = (int)item["memberID"].ToObject<int>();
|
|||
|
|
Member omember = _memberService.Get(memberID);
|
|||
|
|
int LoanId = (int)item["loanAppID"].ToObject<int>();
|
|||
|
|
byte[] bytes = null;
|
|||
|
|
|
|||
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|||
|
|
LoanApplicationService loanApplicationService = new LoanApplicationService();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
bytes = new LoanReport().getLoanScheduleReport(LoanId, omember);
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(bytes);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[HttpGet("getLoanCategoryByEmployeeFundTypeID/{memberCode}")]
|
|||
|
|
public ActionResult GetLoanCategoryByEmployeeFundTypeID(string memberCode)
|
|||
|
|
{
|
|||
|
|
Member member = new Member();
|
|||
|
|
List<FMLoanCategory> fMLoanCategory = new List<FMLoanCategory>();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
member = _memberService.Get(memberCode, EnumFundType.Provident_Fund);
|
|||
|
|
fMLoanCategory = _fMLoanCategoryService.GetByFundType(member.FundTypeID);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
|
}
|
|||
|
|
return Ok(fMLoanCategory);
|
|||
|
|
}
|
|||
|
|
[HttpGet("getGFStatement")]
|
|||
|
|
public ActionResult GetGFStatement()
|
|||
|
|
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
GFSettlement gFSettlement = new GFSettlement();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
Member omember = _memberService.Get(currentUser.LoginID, EnumFundType.Gratuity_Fund);
|
|||
|
|
if (omember != null)
|
|||
|
|
{
|
|||
|
|
if (omember.MemberStatus == EnumEmpStatus.Setteled)
|
|||
|
|
{
|
|||
|
|
gFSettlement = _GFSettlementService.GetByMemberID(omember.ID);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
throw new Exception("You are not yet settled with the Gratuity Fund.");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
throw new InvalidOperationException("You are not a Gratuity Fund member.");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
return Ok(gFSettlement);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
[HttpGet("getWPPFStatement")]
|
|||
|
|
public ActionResult getWPPFStatement()
|
|||
|
|
{
|
|||
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
List<WPPFSettlement> wPPFSettlement = new List<WPPFSettlement>();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
Member omember = _memberService.Get(currentUser.LoginID, EnumFundType.WPPF);
|
|||
|
|
if (omember != null)
|
|||
|
|
{
|
|||
|
|
wPPFSettlement = _wPPFSettlementService.GetByMemberID(omember.ID);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
throw new Exception("You are not a Workers' Profit Participation Fund member.");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
return Ok(wPPFSettlement);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[HttpGet("getWPPFStatementReport/{id}")]
|
|||
|
|
public ActionResult getWPPFStatementReport(int id)
|
|||
|
|
{
|
|||
|
|
string reportType = "PDF";
|
|||
|
|
byte[] bytes = null;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
bytes = new FundReports().ESSWPPFStatmentReport(id, reportType);
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Ok(bytes);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|