266 lines
7.7 KiB
C#
266 lines
7.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Ease.Core.Model;
|
|
|
|
namespace HRM.BO
|
|
{
|
|
#region HistorySalaryMonthly
|
|
|
|
/// <summary>
|
|
/// One employee's salary data for one salary month, exactly as it came from the
|
|
/// "Salary Master Data Bulk Upload" Excel sheet. This is a holding table of uploaded
|
|
/// salary data; it is NOT SalaryMonthly, and nothing in the salary process reads it.
|
|
///
|
|
/// Department, Designation, Location, CostCenter and Grade are kept as names, not IDs; the
|
|
/// upload only accepts names that exist in the payroll type's master data and saves them as
|
|
/// the system spells them. IsConfirm is "Yes", "No" or empty.
|
|
/// </summary>
|
|
public class HistorySalaryMonthly : AuditTrailBase
|
|
{
|
|
#region Constructor
|
|
|
|
public HistorySalaryMonthly()
|
|
{
|
|
_salaryMonth = DateTime.MinValue;
|
|
_employeeNo = "";
|
|
_name = "";
|
|
_department = "";
|
|
_designation = "";
|
|
_location = "";
|
|
_costCenter = "";
|
|
_grade = "";
|
|
_isConfirm = "";
|
|
_payrollTypeID = 0;
|
|
_details = new List<HistorySalaryMonthlyDetail>();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
#region SalaryMonth : DateTime
|
|
private DateTime _salaryMonth;
|
|
/// <summary>The last date of the salary month, the same way SalaryMonthly keeps it.</summary>
|
|
public DateTime SalaryMonth
|
|
{
|
|
get { return _salaryMonth; }
|
|
set { _salaryMonth = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region EmployeeNo : string
|
|
private string _employeeNo;
|
|
/// <summary>The sheet's "Employee ID" column — the employee number as text.</summary>
|
|
public string EmployeeNo
|
|
{
|
|
get { return _employeeNo; }
|
|
set { _employeeNo = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Name : string
|
|
private string _name;
|
|
public string Name
|
|
{
|
|
get { return _name; }
|
|
set { _name = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Department : string
|
|
private string _department;
|
|
public string Department
|
|
{
|
|
get { return _department; }
|
|
set { _department = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Designation : string
|
|
private string _designation;
|
|
public string Designation
|
|
{
|
|
get { return _designation; }
|
|
set { _designation = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Location : string
|
|
private string _location;
|
|
public string Location
|
|
{
|
|
get { return _location; }
|
|
set { _location = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region CostCenter : string
|
|
private string _costCenter;
|
|
public string CostCenter
|
|
{
|
|
get { return _costCenter; }
|
|
set { _costCenter = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Grade : string
|
|
private string _grade;
|
|
public string Grade
|
|
{
|
|
get { return _grade; }
|
|
set { _grade = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region IsConfirm : string
|
|
private string _isConfirm;
|
|
/// <summary>As uploaded, e.g. "Yes" / "No".</summary>
|
|
public string IsConfirm
|
|
{
|
|
get { return _isConfirm; }
|
|
set { _isConfirm = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region PayrollTypeID : ID
|
|
private int _payrollTypeID;
|
|
public int PayrollTypeID
|
|
{
|
|
get { return _payrollTypeID; }
|
|
set { _payrollTypeID = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Details : List<HistorySalaryMonthlyDetail>
|
|
private List<HistorySalaryMonthlyDetail> _details;
|
|
/// <summary>One row per salary item (Basic Salary, House Rent, ...), in sheet column order.</summary>
|
|
public List<HistorySalaryMonthlyDetail> Details
|
|
{
|
|
get { return _details; }
|
|
set { _details = value; }
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region HistorySalaryMonthlyDetail
|
|
|
|
/// <summary>One salary item of a <see cref="HistorySalaryMonthly"/> row.</summary>
|
|
public class HistorySalaryMonthlyDetail : ObjectTemplate
|
|
{
|
|
#region Constructor
|
|
|
|
public HistorySalaryMonthlyDetail()
|
|
{
|
|
_historySalaryMonthlyID = 0;
|
|
_employeeNo = "";
|
|
_itemName = "";
|
|
_itemSide = "";
|
|
_amount = null;
|
|
_sequence = 0;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
#region HistorySalaryMonthlyID : ID
|
|
private int _historySalaryMonthlyID;
|
|
public int HistorySalaryMonthlyID
|
|
{
|
|
get { return _historySalaryMonthlyID; }
|
|
set { _historySalaryMonthlyID = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region EmployeeNo : string
|
|
private string _employeeNo;
|
|
public string EmployeeNo
|
|
{
|
|
get { return _employeeNo; }
|
|
set { _employeeNo = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region ItemName : string
|
|
private string _itemName;
|
|
/// <summary>Basic Salary, House Rent, Convince, Total Gross, PF, Tax, Total Deduction, Net Pay.</summary>
|
|
public string ItemName
|
|
{
|
|
get { return _itemName; }
|
|
set { _itemName = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region ItemSide : string
|
|
private string _itemSide;
|
|
/// <summary>One of <see cref="HistorySalaryItemSide"/>.</summary>
|
|
public string ItemSide
|
|
{
|
|
get { return _itemSide; }
|
|
set { _itemSide = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Amount : double?
|
|
private double? _amount;
|
|
/// <summary>Null when the cell was left blank in the upload.</summary>
|
|
public double? Amount
|
|
{
|
|
get { return _amount; }
|
|
set { _amount = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Sequence : int
|
|
private int _sequence;
|
|
/// <summary>The item's column order in the sheet, so items read back in the same order.</summary>
|
|
public int Sequence
|
|
{
|
|
get { return _sequence; }
|
|
set { _sequence = value; }
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
}
|
|
|
|
/// <summary>The values of <see cref="HistorySalaryMonthlyDetail.ItemSide"/>.</summary>
|
|
public static class HistorySalaryItemSide
|
|
{
|
|
public const string Gross = "Gross";
|
|
public const string Deduction = "Deduction";
|
|
public const string Others = "Others";
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region IHistorySalaryMonthly Service
|
|
|
|
public interface IHistorySalaryMonthlyService
|
|
{
|
|
/// <summary>Every employee's row of one salary month, each with its items.</summary>
|
|
List<HistorySalaryMonthly> Get(DateTime salaryMonth, int payrollTypeID);
|
|
|
|
/// <summary>The Employee Nos that already have a row for the salary month.</summary>
|
|
List<string> GetEmployeeNos(DateTime salaryMonth, int payrollTypeID);
|
|
|
|
/// <summary>
|
|
/// EmployeeNo, Name, PayrollTypeID and Status of every employee — any payroll type, any
|
|
/// status — whose Employee No is one of <paramref name="employeeNos"/>.
|
|
/// </summary>
|
|
List<Employee> GetEmployeesByNo(List<string> employeeNos);
|
|
|
|
/// <summary>
|
|
/// Saves every row in ONE transaction — all or nothing. An employee who already has a row
|
|
/// for the salary month has it (and its items) replaced. Returns how many were replaced.
|
|
/// </summary>
|
|
int Save(List<HistorySalaryMonthly> items, DateTime salaryMonth, int payrollTypeID, int userID);
|
|
}
|
|
|
|
#endregion
|
|
}
|