using System; using System.Collections.Generic; using Ease.Core.Model; namespace HRM.BO { #region HistorySalaryMonthly /// /// 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. /// public class HistorySalaryMonthly : AuditTrailBase { #region Constructor public HistorySalaryMonthly() { _salaryMonth = DateTime.MinValue; _employeeNo = ""; _name = ""; _department = ""; _designation = ""; _location = ""; _costCenter = ""; _grade = ""; _isConfirm = ""; _payrollTypeID = 0; _details = new List(); } #endregion #region Properties #region SalaryMonth : DateTime private DateTime _salaryMonth; /// The last date of the salary month, the same way SalaryMonthly keeps it. public DateTime SalaryMonth { get { return _salaryMonth; } set { _salaryMonth = value; } } #endregion #region EmployeeNo : string private string _employeeNo; /// The sheet's "Employee ID" column — the employee number as text. 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; /// As uploaded, e.g. "Yes" / "No". 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 private List _details; /// One row per salary item (Basic Salary, House Rent, ...), in sheet column order. public List Details { get { return _details; } set { _details = value; } } #endregion #endregion } #endregion #region HistorySalaryMonthlyDetail /// One salary item of a row. 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; /// Basic Salary, House Rent, Convince, Total Gross, PF, Tax, Total Deduction, Net Pay. public string ItemName { get { return _itemName; } set { _itemName = value; } } #endregion #region ItemSide : string private string _itemSide; /// One of . public string ItemSide { get { return _itemSide; } set { _itemSide = value; } } #endregion #region Amount : double? private double? _amount; /// Null when the cell was left blank in the upload. public double? Amount { get { return _amount; } set { _amount = value; } } #endregion #region Sequence : int private int _sequence; /// The item's column order in the sheet, so items read back in the same order. public int Sequence { get { return _sequence; } set { _sequence = value; } } #endregion #endregion } /// The values of . 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 { /// Every employee's row of one salary month, each with its items. List Get(DateTime salaryMonth, int payrollTypeID); /// The Employee Nos that already have a row for the salary month. List GetEmployeeNos(DateTime salaryMonth, int payrollTypeID); /// /// EmployeeNo, Name, PayrollTypeID and Status of every employee — any payroll type, any /// status — whose Employee No is one of . /// List GetEmployeesByNo(List employeeNos); /// /// 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. /// int Save(List items, DateTime salaryMonth, int payrollTypeID, int userID); } #endregion }