Files
2026-03-17 09:53:09 -05:00

38 lines
1.1 KiB
C#

using System;
using LCU.Library.Internal.IncentiveApiModels.Common;
namespace LCU.Library.Internal.IncentiveApiModels.Entities
{
public class DepartmentLineItem : Auditable
{
public DepartmentLineItem()
{
PayoutPercentage = 0;
PayoutTotal = 0;
}
public DepartmentLineItem(int departmentId, string departmentName, DateTime payoutMonth) : this()
{
DepartmentId = departmentId;
DepartmentName = departmentName;
PayoutMonth = payoutMonth;
}
public int Id { get; set; }
public int DepartmentId { get; set; }
public string DepartmentName { get; set; }
public decimal PayoutTotal { get; set; }
public decimal PayoutPercentage { get; private set; }
public DateTime PayoutMonth { get; set; }
public void Apply(PayoutLineItem payoutLineItem)
{
PayoutTotal += payoutLineItem.PayoutTotal;
}
public void CalculatePercentage(decimal total)
{
PayoutPercentage = total == 0 ? 0 : Math.Round(PayoutTotal / total * 100, 2);
}
}
}