EchoTex_Payroll/HRM.BO/Tax/EmployeeTaxInvestment.cs
2024-10-14 10:01:49 +06:00

112 lines
3.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ease.Core;
using Ease.Core.Model;
using System.Data;
using Microsoft.AspNetCore.Components.Web;
namespace HRM.BO
{
#region EmployeeTaxInvestment
public class EmployeeTaxInvestment : BasicBaseObject
{
#region Constructor
public EmployeeTaxInvestment()
{
EmployeeID = 0;
Amount = 0;
TaxparameterId = 0;
TypeID = 0;
}
#endregion
#region Properties
public int EmployeeID { get; set; }
public double Amount { get; set; }
public int TaxparameterId { get; set; }
public int TypeID { get; set; }
public EnumTaxInvestment EntryFrom { get; set; }
public EnumTaxInvestmentStatus submitStatus { get; set; }
public FileAttachment TaxFileAttacment { get; set; }
public TaxAttachment TaxAttachment { get; set; }
public string rejectReason { get; set; }
public string EmployeeNo { get; set; } // view purpose
public string EmployeeName { get; set; } // view purpose
//#region Service Factory IEmployeeTaxInvestmentService : IEmployeeTaxInvestmentService
//internal static IEmployeeTaxInvestmentService Service
//{
// get { return Services.Factory.CreateService<IEmployeeTaxInvestmentService>(typeof(IEmployeeTaxInvestmentService)); }
//}
//#endregion
public static double GetAmount(int empid, List<EmployeeTaxInvestment> list, List<TaxInvestment> ttype)
{
double amount = 0;
foreach (var item in ttype)
{
var typeITems = list.FindAll(x => x.EmployeeID == empid && x.TypeID == item.ID && x.submitStatus == EnumTaxInvestmentStatus.Approve);
if(typeITems != null && typeITems.Count != 0)
{
double tempAmount = typeITems.Sum(x => x.Amount);
if (item.MaxLimit > 100)
{
if (item.MaxLimit < tempAmount)
tempAmount = item.MaxLimit;
amount += tempAmount;
}
else if( item.MaxLimit <= 100 && item.MaxLimit >0)
{
tempAmount = tempAmount* item.MaxLimit /100;
amount += tempAmount;
}
else amount = amount + tempAmount;
}
}
return amount;
}
#endregion
}
#endregion
#region IEmployeeTaxInvestment Service
public interface IEmployeeTaxInvestmentService
{
EmployeeTaxInvestment Get(int id);
List<EmployeeTaxInvestment> Get();
List<EmployeeTaxInvestment> GetAllUsersInfo();
List<EmployeeTaxInvestment> GetSingleEmpsInfo(int id, int taxparamid);
double GetAmount(int TaxParamID, int emloyeeID);
int Save(EmployeeTaxInvestment item);
void AdminSave(List<EmployeeTaxInvestment> empTaxInvests);
void Approve(List<EmployeeTaxInvestment> empTaxInvests);
void Reject(List<EmployeeTaxInvestment> empTaxInvests);
DataTable getSummaryView(int taxparamid);
TaxAttachment GetFile(int referenceId, EnumTaxAttachment type);
void Delete(int id);
}
#endregion
}