150 lines
5.2 KiB
C#
150 lines
5.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace HRM.BO
|
|
{
|
|
#region Template layout
|
|
|
|
/// <summary>
|
|
/// The LFA payment upload sheet. The downloadable workbook is generated from this and an uploaded
|
|
/// one is read against it.
|
|
/// </summary>
|
|
public static class LFAPaymentUploadTemplate
|
|
{
|
|
public const string SheetName = "LFA Payment";
|
|
public const string FileName = "LFA-Payment-Template.xlsx";
|
|
public const string ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
public const int MaxUploadMegabytes = 10;
|
|
public const int MaxRows = 20000;
|
|
|
|
public const int HeadingRow = 1;
|
|
public const int FirstDataRow = 2;
|
|
|
|
/// <summary>How many rows of the template are formatted as text.</summary>
|
|
public const int FormattedDataRows = 1000;
|
|
|
|
public const int EmployeeNoColumn = 1;
|
|
public const int NameColumn = 2;
|
|
|
|
public const int MaxRemarksLength = 500;
|
|
|
|
/// <summary>Employee ID is the Employee No. Name only helps whoever fills the file; it is not checked.</summary>
|
|
public static readonly string[] Headings = { "Employee ID", "Name" };
|
|
public static readonly double[] Widths = { 18, 40 };
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Upload and process data
|
|
|
|
/// <summary>One uploaded row: what the user gives. Every amount is worked out by the server.</summary>
|
|
public class LFAPaymentInput
|
|
{
|
|
public int RowNo { get; set; }
|
|
public string EmployeeNo { get; set; }
|
|
}
|
|
|
|
/// <summary>The page's payment information and rows, to calculate or to process.</summary>
|
|
public class LFAPaymentRequest
|
|
{
|
|
public DateTime? PaymentDate { get; set; }
|
|
public string Remarks { get; set; }
|
|
public List<LFAPaymentInput> Rows { get; set; }
|
|
|
|
/// <summary>The total the page shows; processing stops when the calculation no longer gives it.</summary>
|
|
public double ExpectedTotal { get; set; }
|
|
}
|
|
|
|
/// <summary>One calculated row, as the New LFA Payment grid shows it.</summary>
|
|
public class LFAPaymentRow : LFAPaymentInput
|
|
{
|
|
public int EmployeeID { get; set; }
|
|
public string Name { get; set; }
|
|
public string GradeName { get; set; }
|
|
public string DesignationName { get; set; }
|
|
public string DivisionName { get; set; }
|
|
public string DepartmentName { get; set; }
|
|
public DateTime JoiningDate { get; set; }
|
|
public DateTime? ConfirmationDate { get; set; }
|
|
/// <summary>Joining Date to Payment Date, e.g. "2 Years 9 Months 27 Days".</summary>
|
|
public string ServiceLength { get; set; }
|
|
public double JoiningBasic { get; set; }
|
|
public double? LastDecBasic { get; set; }
|
|
public double BasicSalary { get; set; }
|
|
public double Amount { get; set; }
|
|
public DateTime PaymentDate { get; set; }
|
|
}
|
|
|
|
/// <summary>Why a row (or, with RowNo 0, the file) cannot be paid.</summary>
|
|
public class LFAPaymentIssue
|
|
{
|
|
public int RowNo { get; set; }
|
|
public string EmployeeNo { get; set; }
|
|
public string EmployeeName { get; set; }
|
|
public string Message { get; set; }
|
|
}
|
|
|
|
public class LFAPaymentReadResult
|
|
{
|
|
public LFAPaymentReadResult()
|
|
{
|
|
Rows = new List<LFAPaymentRow>();
|
|
Issues = new List<LFAPaymentIssue>();
|
|
}
|
|
|
|
public DateTime SalaryMonth { get; set; }
|
|
|
|
/// <summary>The rows that can be paid.</summary>
|
|
public List<LFAPaymentRow> Rows { get; set; }
|
|
|
|
/// <summary>Every problem of every other row.</summary>
|
|
public List<LFAPaymentIssue> Issues { get; set; }
|
|
|
|
public void AddIssue(int rowNo, string employeeNo, string employeeName, string message)
|
|
{
|
|
Issues.Add(new LFAPaymentIssue
|
|
{
|
|
RowNo = rowNo,
|
|
EmployeeNo = employeeNo,
|
|
EmployeeName = employeeName,
|
|
Message = message
|
|
});
|
|
}
|
|
}
|
|
|
|
public class LFAPaymentProcessResult
|
|
{
|
|
public bool Saved { get; set; }
|
|
public string Message { get; set; }
|
|
public string BatchNumber { get; set; }
|
|
|
|
/// <summary>Set when nothing was saved because the rows no longer pass.</summary>
|
|
public LFAPaymentReadResult Validation { get; set; }
|
|
}
|
|
|
|
/// <summary>The current salary month of the payroll type and the next batch number.</summary>
|
|
public class LFAPaymentInfo
|
|
{
|
|
public int PayrollTypeID { get; set; }
|
|
public DateTime SalaryMonth { get; set; }
|
|
public string NextBatchNumber { get; set; }
|
|
}
|
|
|
|
/// <summary>One row of the Payment History tab.</summary>
|
|
public class LFAPaymentHistory
|
|
{
|
|
public int LFAPaymentDetailID { get; set; }
|
|
public string BatchNumber { get; set; }
|
|
public DateTime PaymentDate { get; set; }
|
|
public string EmployeeNo { get; set; }
|
|
public string Name { get; set; }
|
|
public string DesignationName { get; set; }
|
|
public string DepartmentName { get; set; }
|
|
public DateTime JoiningDate { get; set; }
|
|
public double BasicSalary { get; set; }
|
|
public double Amount { get; set; }
|
|
}
|
|
|
|
#endregion
|
|
}
|