Compare commits

...

20 Commits

Author SHA1 Message Date
8eef998cc4 Merge pull request 'correction' (#7) from Dev_Brac_Shamim into Brac_devqc
Reviewed-on: http://103.197.204.162:3025/CelHRTeam/HRM-10/pulls/7
2026-12-01 15:17:06 +06:00
88421887ff Merge pull request 'dev_Chapal' (#6) from dev_Chapal into Brac_devqc
Reviewed-on: http://103.197.204.162:3025/CelHRTeam/HRM-10/pulls/6
2026-12-01 15:16:37 +06:00
c494aa2261 correction 2026-12-01 15:15:44 +06:00
cf66e78d35 label2 2026-12-01 14:50:17 +06:00
aa6281a85c Merge pull request 'correction' (#5) from Dev_Brac_Shamim into Brac_devqc
Reviewed-on: http://103.197.204.162:3025/CelHRTeam/HRM-10/pulls/5
2026-12-01 14:20:48 +06:00
d0fbb344a2 correction 2026-12-01 14:18:18 +06:00
5ab15e9b34 Include bonus option in date range wise salary 2026-12-01 10:30:12 +06:00
Mohaimen Hasan
8753631af0 Done 2026-11-30 14:39:12 +06:00
Mohaimen Hasan
c8c032f86c ProgressBarDone 2026-11-30 14:32:23 +06:00
Mohaimen Hasan
5ecdda0a0f Merge branch 'Brac_Master' into Brac_Master_Mohaimen 2026-11-30 13:40:53 +06:00
Mohaimen Hasan
b32478268c Salary Process real-time progress (SignalR) 2026-11-30 13:35:21 +06:00
01e548fc23 Date range wise Salary sheet 2026-11-30 12:37:50 +06:00
b0602c2ee0 Merge pull request 'salary on balancing' (#3) from Brac_Master_Ashek into Brac_Master
Reviewed-on: http://103.197.204.162:3025/CelHRTeam/HRM-10/pulls/3
2026-11-30 12:33:50 +06:00
Mohaimen Hasan
46ab998ab7 New Dashboard 2026-11-30 11:04:25 +06:00
Mohaimen Hasan
16f6a635fd Category Wise Salary Process 2026-11-29 18:51:10 +06:00
Mohaimen Hasan
f3ff0cd16a Bonus Process by Religion Done 2026-11-29 18:15:43 +06:00
Mohaimen Hasan
46de19578e Bonus Process Religion SHow 2026-11-29 17:52:14 +06:00
Mohaimen Hasan
79dd1108ee Bonus Religion 2026-11-29 17:30:48 +06:00
Mohaimen Hasan
ffcc0777dc Component Upload 2026-11-29 13:53:28 +06:00
Mohaimen Hasan
c57a9306c2 Component Upload (Setup, uploader page, report) 2026-11-29 12:39:13 +06:00
157 changed files with 14264 additions and 540 deletions

View File

@ -0,0 +1,69 @@
/*
AllowanceTypeToAllowanceDeduction_DB_Changes.sql
Moves the Allowance Type (EnumAllowanceType: 0 Non_Gross, 1 HouseRent, 2 Medical, 3 Conveynce, 4 Utilities_Other)
from the parameter (ADPARAMETERBASIC.allowanceType) to the allowance head
(AllowanceDeduction.AllowanceType).
Run this BEFORE deploying the matching code: the new code writes AllowanceDeduction.AllowanceType
and no longer writes ADPARAMETERBASIC.allowanceType.
Run order (inside this script): 1 add column -> 2 copy existing values -> 3 drop old column.
Step 2 must run before step 3, or the values are lost.
Every step is guarded, so the script is safe to run more than once.
*/
SET NOCOUNT ON;
GO
/* 1. Add AllowanceDeduction.AllowanceType */
IF COL_LENGTH('dbo.AllowanceDeduction', 'AllowanceType') IS NULL
BEGIN
ALTER TABLE dbo.AllowanceDeduction
ADD AllowanceType INT NOT NULL
CONSTRAINT DF_AllowanceDeduction_AllowanceType DEFAULT (0);
PRINT 'Added AllowanceDeduction.AllowanceType';
END
GO
/* 2. Copy the values already set on the parameters onto their allowance head.
An allowance with several parameters takes the highest non-zero value. */
IF COL_LENGTH('dbo.ADPARAMETERBASIC', 'allowanceType') IS NOT NULL
BEGIN
EXEC sp_executesql N'
UPDATE AD
SET AD.AllowanceType = X.AllowanceType
FROM dbo.AllowanceDeduction AD
JOIN (SELECT AllowDeductID, MAX(ISNULL(allowanceType, 0)) AS AllowanceType
FROM dbo.ADPARAMETERBASIC
GROUP BY AllowDeductID) X
ON X.AllowDeductID = AD.ALLOWDEDUCTID
WHERE AD.AllowanceType = 0
AND X.AllowanceType <> 0;';
PRINT 'Copied ADPARAMETERBASIC.allowanceType to AllowanceDeduction.AllowanceType';
END
GO
/* 3. Drop ADPARAMETERBASIC.allowanceType (its default constraint first, if any) */
IF COL_LENGTH('dbo.ADPARAMETERBASIC', 'allowanceType') IS NOT NULL
BEGIN
DECLARE @df SYSNAME, @sql NVARCHAR(MAX);
SELECT @df = dc.name
FROM sys.default_constraints dc
JOIN sys.columns c
ON c.object_id = dc.parent_object_id
AND c.column_id = dc.parent_column_id
WHERE dc.parent_object_id = OBJECT_ID('dbo.ADPARAMETERBASIC')
AND c.name = 'allowanceType';
IF @df IS NOT NULL
BEGIN
SET @sql = N'ALTER TABLE dbo.ADPARAMETERBASIC DROP CONSTRAINT ' + QUOTENAME(@df) + N';';
EXEC sp_executesql @sql;
END
ALTER TABLE dbo.ADPARAMETERBASIC DROP COLUMN allowanceType;
PRINT 'Dropped ADPARAMETERBASIC.allowanceType';
END
GO

View File

@ -436,6 +436,40 @@ Two things to know before building on it:
effectively unused. The per-recipient rows are accurate throughout — it is the header that lags.
The UI compensates with a spinner, not with real numbers.
### Cross-cutting: real-time (SignalR) and background jobs
One SignalR hub serves the whole app: `AppHub` at **`/api/hubs/app`** (`HRM.UI/Realtime/`, wired by
`services.AddRealtime(...)` + `endpoints.MapRealtime()` in `Startup`). Never add a second hub; tell features apart
by topic and group.
- **Auth** is the normal JWT: the hub is `[Authorize]` and the `JWToken` cookie is read by Startup's
`OnMessageReceived`, so the browser sends nothing extra (no token in the URL). It sits under `/api` so the dev
proxy (`proxy.json`, `"ws": true`) and IIS treat it like any API call. Production IIS should have the
**WebSocket Protocol** feature on (without it SignalR falls back to SSE/long polling and still works).
- **Groups are server-chosen** (`RealtimeGroups`): a connection joins its payroll type's group on connect and a
job's group only through `SubscribeJob`, which checks the caller. Clients never name a group.
- **Sending**: inject `IRealtimePublisher` (`ToUserAsync`, `ToPayrollTypeAsync`, `ToAllAsync`), never
`IHubContext`. Messages arrive in Angular through `RealtimeService.on(topic)`. The client methods are
`IAppClient.JobProgress` and `IAppClient.Event(topic, payload)`; prefer a new topic over a new method.
The hub uses the Newtonsoft protocol, so a BO serialises exactly as in the REST API.
- **Long work with live progress**: `IJobRunner.Start(new JobRequest { Key, Title, OwnerUserId, PayrollTypeId,
Audience, Work = progress => ... })` returns a `JobSnapshot` (`runId`) at once; the work runs on a hosted
service (Channel queue, `Realtime:MaxConcurrentJobs`), one job per `Key` at a time (a second start returns the
running one). The work reports through **`IJobProgress`** (`HRM.BO/BackgroundJob`), which is what HRM.DA
services take as a parameter — HRM.DA never references SignalR. Throttling, ETA and sequence numbers are done
by the runner. Copy everything the work needs from `CurrentUser` before starting: there is no HttpContext later.
- **Angular**: `RealtimeService` (`_services/realtime/`) is the single, lazy connection (auto-reconnect, closes on
logout, reconnects on a new token). `watchJob(runId)` follows a job and survives reloads, reconnects and a
missing connection (it re-reads `GET api/jobs/{runId}` / polls). `<app-job-progress [runId]>` from
`RealtimeSharedModule` is the reusable progress UI.
- Job state is **in memory** (`Realtime:FinishedJobRetentionMinutes`): a restart loses it, and more than one
server would need a Redis backplane plus a database job store. Settings: the optional `Realtime` section
(`RealtimeSettings`). Client package `@microsoft/signalr` is pinned to the server's major (10.0.x).
- Worked example: Salary Process — `SalaryController` `SalaryProcess-start` / `SalaryProcess-active`,
`SalaryProcessService.SalaryProcess(..., IJobProgress)` and `SalaryProcessProgress`, which maps
`SalaryCalculator`'s existing `ProgressStatus` events (13 phases, one step per employee) to a real percentage.
The old synchronous `SalaryProcess` endpoint is unchanged.
### Cross-cutting: approval workflow
Most "apply → approve" features (leave, attendance regularization, claims, requisitions) route through

View File

@ -194,8 +194,6 @@ namespace HRM.BO
public bool IsTaxProjection { get; set; }
public bool IsDependsOnAttendance { get; set; }
public bool ISDEPENDSONSPECIALHOUR { get; set; }
public EnumAllowanceType AllowanceType { get; set; }
public bool IsOnBalancing { get; set; }
public bool IsDependsOnOTHour { get; set; }
public bool IsWithException { get; set; }

View File

@ -16,6 +16,7 @@ namespace HRM.BO
Name = string.Empty;
NameInBangla = string.Empty;
AllowOrDeductType = EnumAllowOrDeduct.Allowance;
AllowanceType = EnumAllowanceType.Non_Gross;
_status = EnumStatus.Active;
}
@ -27,6 +28,7 @@ namespace HRM.BO
public string Name { get; set; }
public string NameInBangla { get; set; }
public EnumAllowOrDeduct AllowOrDeductType { get; set; }
public EnumAllowanceType AllowanceType { get; set; }
public int payrolltypeid { get; set; }
//#region Property Error List: DataUpload

View File

@ -1,43 +1,137 @@
using System.Collections.Generic;
using Ease.Core.Model;
using System;
using System.Collections.Generic;
using System.Data;
namespace HRM.BO
{
public class ComponentUploadSetup : BasicBaseObject
{
#region Constructor
public ComponentUploadSetup()
{
EmployeeID = 0;
ItemID = 0;
Description = string.Empty;
_isDamageManagement = false;
}
#endregion
#region Properties
public int EmployeeID { get; set; }
public EnumComponentType ComponentType { get; set; }
public int ItemID { get; set; }
public string Description { get; set; }
#region EmployeeID
private int _employeeID;
public int EmployeeID
{
get { return _employeeID; }
set { _employeeID = value; }
}
#endregion
#region EmployeeName
private string _employeeName;
public string EmployeeName
{
get { return _employeeName; }
set { _employeeName = value; }
}
#endregion
#region ApproverID
private int _approverID;
public int ApproverID
{
get { return _approverID; }
set { _approverID = value; }
}
#endregion
#region ApproverName
private string _approverName;
public string ApproverName
{
get { return _approverName; }
set { _approverName = value; }
}
#endregion
#region ComponentType
private EnumComponentType _componentType;
public EnumComponentType ComponentType
{
get { return _componentType; }
set { _componentType = value; }
}
#endregion
#region ItemID
private int _itemID;
public int ItemID
{
get { return _itemID; }
set { _itemID = value; }
}
#endregion
#region Description
private string _description;
public string Description
{
get { return _description; }
set { _description = value; }
}
#endregion
#region IsDamageManagement
private bool _isDamageManagement;
public bool IsDamageManagement
{
get { return _isDamageManagement; }
set { _isDamageManagement = value; }
}
#endregion
#region DamageManagementDescription
private string _damageManagementDescription;
public string DamageManagementDescription
{
get { return _damageManagementDescription; }
set { _damageManagementDescription = value; }
}
#endregion
#region ComponentTypeName
private string _componentTypeName;
public string ComponentTypeName
{
get { return _componentTypeName; }
set { _componentTypeName = value; }
}
#endregion
#endregion
//#region Service Factory
//internal static IComponentUploadSetupService Service
//{
// get { return Services.Factory.CreateService<IComponentUploadSetupService>(typeof(IComponentUploadSetupService)); }
//}
//#endregion
#region Service Factory
internal static IComponentUploadSetupService Service
{
get { return Services.Factory.CreateService<IComponentUploadSetupService>(typeof(IComponentUploadSetupService)); }
}
#endregion
}
public interface IComponentUploadSetupService
{
List<ComponentUploadSetup> Get();
DataTable GetUploadedComponent(DateTime uploadMonth);
List<ComponentUploadSetup> Get(int empId);
int Save(ComponentUploadSetup componentSetup);
List<ComponentUploadSetup> GetByApproverID(int apprvrID);
DataTable GetUploadedComponentReportData(DateTime fromDate, DateTime toDate);
DataTable GetUploadedComponentEmpReportData(DateTime uploadMonth, int componentId, string empIds);
void Save(List<ComponentUploadSetup> componentSetups);
void Delete(int id);
bool IsExist(int empId, EnumComponentType ComponentType, int itemId);
void DeleteSingleComponent(ComponentUploadSetup oComponentUploadSetup);
DataTable GetUploadedComponentEmpReportData(DateTime salaryMonth, string empIds);
List<ComponentUploadSetup> LoadComponentType(int payrollTypeID);
bool IsExist(int empId, int apprvrId, EnumComponentType componentType, int itemId);
bool HasApproverSetup(int approverId);
bool HasUploaderSetup(int employeeId);
}
}

View File

@ -0,0 +1,247 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HRM.BO
{
public class UploadedComponent : BasicBaseObject
{
#region Constructor
public UploadedComponent() { }
#endregion
#region Properties
#region IsDamageManagement
private bool _isDamageManagement;
public bool IsDamageManagement
{
get { return _isDamageManagement; }
set { _isDamageManagement = value; }
}
#endregion
#region SalaryMonth
private DateTime _salaryMonth;
public DateTime SalaryMonth
{
get { return _salaryMonth; }
set { _salaryMonth = value; }
}
#endregion
#region UploadedBy
private int _uploadedBy;
public int UploadedBy
{
get { return _uploadedBy; }
set { _uploadedBy = value; }
}
#endregion
#region UploadedDate
private DateTime _uploadedDate;
public DateTime UploadedDate
{
get { return _uploadedDate; }
set { _uploadedDate = value; }
}
#endregion
#region ItemID
private int _approvedBy;
public int? ApprovedBy
{
get { return _approvedBy; }
set { _approvedBy = (int)value; }
}
#endregion
#region ApprovedDate
private DateTime _approvedDate;
public DateTime ApprovedDate
{
get { return _approvedDate; }
set { _approvedDate = value; }
}
#endregion
private int _componentID;
#region ComponentID
public int ComponentID
{
get { return _componentID; }
set { _componentID = value; }
}
#endregion
#region ComponentType
private EnumComponentType _componentType;
public EnumComponentType ComponentType
{
get { return _componentType; }
set { _componentType = value; }
}
#endregion
#region UploadedComponentEmps
private List<UploadedComponentEmp> _uploadedComponentEmps;
public List<UploadedComponentEmp> UploadedComponentEmps
{
get
{
//if (this.ID > 0 && _uploadedComponentEmps == null)
//{
// _uploadedComponentEmps = UploadedComponent.Service.GetUploadedComponentEmp(this.ID);
//}
return _uploadedComponentEmps;
}
set
{
_uploadedComponentEmps = value;
}
}
#endregion
#endregion
}
#region UploadedComponentEmp
[Serializable]
public class UploadedComponentEmp : BasicBaseObject
{
#region ctr
public UploadedComponentEmp() { }
#endregion
#region Properties
#region UploadedComponentID
private int _uploadedComponentID;
public int UploadedComponentID
{
get { return _uploadedComponentID; }
set { _uploadedComponentID = value; }
}
#endregion
#region EmployeeID
private int _employeeID;
public int EmployeeID
{
get { return _employeeID; }
set { _employeeID = value; }
}
#endregion
#region Amount
private double _amount;
public double Amount
{
get { return _amount; }
set { _amount = value; }
}
#endregion
#region Reason
private string _reason;
public string Reason
{
get { return _reason; }
set { _reason = value; }
}
#endregion
#region TotalAmount
private double _totalAmount;
public double TotalAmount
{
get { return _totalAmount; }
set { _totalAmount = value; }
}
#endregion
#region DeductionMonth
private DateTime _deductionMonth;
public DateTime DeductionMonth
{
get { return _deductionMonth; }
set { _deductionMonth = value; }
}
#endregion
#region DeductionAmount
private double _deductionAmount;
public double DeductionAmount
{
get { return _deductionAmount; }
set { _deductionAmount = value; }
}
#endregion
#region Remarks
private string _remarks;
public string Remarks
{
get { return _remarks; }
set { _remarks = value; }
}
#endregion
#region No of installment
private int _nOfInstallment;
public int NoOfInstallment
{
get { return _nOfInstallment; }
set { _nOfInstallment = value; }
}
#endregion
#endregion
}
#endregion
public interface IUploadedComponentService
{
void Save(UploadedComponent component);
void SaveWithADParameter(UploadedComponent component, DateTime salaryMonth);
List<UploadedComponent> Get(DateTime fromDate, DateTime toDate);
List<UploadedComponentEmp> GetUploadedComponentEmp(int iD);
List<UploadedComponent> Get(int componentId, int uploaderID, DateTime salaryMonth);
List<UploadedComponent> Get(int uploaderID, DateTime salaryMonth);
DataTable GetByID(int uploadedComponentID);
DataTable GetByIDandUploaderID(int uploadedComponentID, int uploaderId);
void Delete(int uploadedComponentID);
void DeleteUploadedComponentEmp(int uploadedComponentID);
UploadedComponent GetExistingComponent(int uploaderID, int componentID, EnumComponentType componentType, DateTime salaryMonth);
List<UploadedComponent> GetByApprover(int approverID, DateTime salaryMonth);
List<UploadedComponent> GetByApprover(int approverID);
DataTable GetByUploaderDT(int employeeID);
}
}

View File

@ -0,0 +1,79 @@
using System;
using System.Threading;
namespace HRM.BO
{
/// <summary>
/// How a long-running piece of work (salary process, bulk upload, ...) tells the outside world how far it got.
///
/// It lives in HRM.BO on purpose: HRM.DA services take it as a plain parameter and never know who listens.
/// HRM.UI implements it (background job runner + SignalR), so HRM.DA keeps no reference to ASP.NET or SignalR.
/// Every member is safe to call as often as you like - the implementation throttles what it actually sends.
/// A null IJobProgress means "nobody is listening": callers must check for null (or use TryReport below).
/// </summary>
public interface IJobProgress
{
/// <summary>Set when the application is shutting down or the job was cancelled. Work may check it between steps.</summary>
CancellationToken CancellationToken { get; }
/// <summary>
/// Reports where the work is.
/// </summary>
/// <param name="percent">0 - 100 of the whole job. Values out of range are clamped; it never goes backwards.</param>
/// <param name="stage">Short name of the current stage, e.g. "Calculating Income Tax". Null keeps the previous one.</param>
/// <param name="detail">Optional extra line, e.g. an employee name. Null clears it.</param>
/// <param name="current">Optional items done in the current stage (shown as current / total).</param>
/// <param name="total">Optional items in the current stage.</param>
void Report(double percent, string stage = null, string detail = null, int? current = null, int? total = null);
}
public static class JobProgressExtensions
{
/// <summary>
/// Null-safe AND exception-safe Report. Business code (salary process, uploads, ...) must report through this:
/// progress only watches the work, so a fault in reporting must never be able to stop or change the work.
/// </summary>
public static void TryReport(this IJobProgress progress, double percent, string stage = null, string detail = null,
int? current = null, int? total = null)
{
if (progress == null)
return;
try
{
progress.Report(percent, stage, detail, current, total);
}
catch
{
// progress is best-effort; the work goes on regardless
}
}
}
/// <summary>
/// Maps a sub-task's own 0 - 100 onto a slice [from, to] of an outer job's bar. Lets a service report its
/// own progress (e.g. the salary save, 0 - 100) without knowing which part of the whole job it is.
/// </summary>
public sealed class JobProgressScope : IJobProgress
{
private readonly IJobProgress _outer;
private readonly double _from;
private readonly double _to;
public JobProgressScope(IJobProgress outer, double from, double to)
{
_outer = outer;
_from = Math.Max(0, Math.Min(100, from));
_to = Math.Max(_from, Math.Min(100, to));
}
public CancellationToken CancellationToken => _outer != null ? _outer.CancellationToken : CancellationToken.None;
public void Report(double percent, string stage = null, string detail = null, int? current = null, int? total = null)
{
if (_outer == null)
return;
double p = Math.Max(0, Math.Min(100, percent));
_outer.Report(_from + (_to - _from) * p / 100.0, stage, detail, current, total);
}
}
}

View File

@ -72,6 +72,17 @@ namespace HRM.BO
#endregion
#region ReligionIDs / ReligionNames : string (BonusReligion, not Bonus columns)
// Comma-separated ReligionIDs of this bonus (table BonusReligion).
// null = not loaded: Save leaves the BonusReligion rows untouched.
public string ReligionIDs { get; set; }
// Comma-separated religion names, for display only.
public string ReligionNames { get; set; }
#endregion
//#region Service Factory IBonusService : IBonusService
@ -199,6 +210,8 @@ namespace HRM.BO
List<Bonus> GetAllBonus(int payrollTypeID, EnumStatus status, string code, string name);
DataSet GetCCWiseBonusSummary(DateTime bMonthDate, string bonus);
DataSet GetCCWiseBonus(DateTime bMonthDate, string bonus);
List<Religion> GetReligions(int bonusID);
List<int> GetReligionEmployeeIDs(int bonusID, int payrollTypeID);
}
#endregion

View File

@ -922,6 +922,7 @@ namespace HRM.BO
public interface IBonusProcessService
{
DataTable GetBonusItemsForESSBonusPayslip(int EmployeeID);
DataSet GetEmpBonusDateRange(DateTime fromSalaryMonth, DateTime toSalaryMonth, string sEmpID);
BonusProcess CalculateBonus(int payrolltypeid, List<Employee> employees, int bonusid, DateTime dBasicMonth,
DateTime dPayDate, DateTime dCuttOfDate, double CurrProcess, bool IsDisburseWithSalary, bool IsTaxProcess);
List<BonusProcess.BonusProcessDetail> CalculateBonusTax(List<BonusProcess.BonusProcessDetail> bonusDetails,

View File

@ -1963,10 +1963,11 @@ namespace HRM.BO
public enum EnumAllowanceType
{
None = 0,
Non_Gross = 0,
HouseRent = 1,
Medical = 2,
Conveynce = 3
Conveynce = 3,
Utilities_Other=4
}
@ -2181,6 +2182,7 @@ namespace HRM.BO
OverAllSummary = 39,
SalaryControl = 40,
PaySlip = 41,
DateRangeWiseSalarySheet = 4101,
Envelop = 42,
SalaryReconcil = 43,
SalaryReconcilItemWise = 143,
@ -2448,6 +2450,7 @@ namespace HRM.BO
TAXReconciliation = 1006,
BasePay = 1008,
ITReport177Quaterly = 1010,
ComponentUploadReport = 1021,
LFABankAdvice = 1201
}
@ -2564,6 +2567,7 @@ namespace HRM.BO
Objective = 62,
SecondLineManagerObjectiveRating = 63,
CVUpload = 64,
EssComponentUpload = 66,
EmployeeLineManagerUpload = 200,
CoordinatorUpload = 201,
TaxAdjustmentDataUpload = 203,

View File

@ -2074,6 +2074,7 @@ namespace HRM.BO
DataSet GetEmpPaySlipGrossForOthers(DateTime dSalaryMonthDate, string sEmpID);
DataSet GetEmpPaySlipDeductForOthers(DateTime dSalaryMonthDate, string sEmpID);
DataSet GetEmpPaySlipDateRangeMonthWise(DateTime fromSalaryMonth, DateTime toSalaryMonth, string sEmpID);
DataSet GetEmpPaySlipDeductForCitiOthers(DateTime dSalaryMonthDate, string sEmpID);
DataSet GetEmpPaySlipDeductForLR(DateTime dSalaryMonthDate, string sEmpID);

View File

@ -462,6 +462,9 @@ namespace HRM.BO
bool GetBySMonth(DateTime sMonth, int payrollTypeID);
List<SalaryProcessStatus> SalaryProcess(SalaryProcess item, List<Employee> employees);
/// <summary>Same as SalaryProcess, reporting real progress to <paramref name="progress"/> (null = none).</summary>
List<SalaryProcessStatus> SalaryProcess(SalaryProcess item, List<Employee> employees, IJobProgress progress);
List<int> GetCategoryEmployeeIDs(int categoryID, int payrollTypeID, DateTime salaryMonth);
int Save(SalaryProcess item);
void Delete(int id);

View File

@ -89,28 +89,38 @@ namespace HRM.BO
public EnumIncomeTaxItemGroup ItemGroup { get; set; }
public EnumIncomeTaxSide Side { get; set; }
//#region Service Factory IIncomeTaxService : IIncomeTaxService
//#region Service Factory IIncomeTaxService : IIncomeTaxService
//internal static IIncomeTaxService Service
//{
// get { return Services.Factory.CreateService<IIncomeTaxService>(typeof(IIncomeTaxService)); }
//}
//internal static IIncomeTaxService Service
//{
// get { return Services.Factory.CreateService<IIncomeTaxService>(typeof(IIncomeTaxService)); }
//}
//#endregion
//#endregion
#endregion
public string getEmpID(List<IncomeTax> items)
#endregion
//public string getEmpID(List<IncomeTax> items)
//{
// string str = "";
// items.ForEach(x =>
// {
// if (x != null)
// str = str + x.EmployeeID + ",";
// });
// if (str.Length > 0) str = str.Substring(0, str.Length - 1);
// return str;
//}
// Comma-separated employee IDs of the rows, for "employeeID IN (...)".
// Each employee once: income-tax data has many rows per employee, and building the string by
// repeated concatenation made Bonus Approve take minutes on a large payroll.
public string getEmpID(List<IncomeTax> items)
{
string str = "";
items.ForEach(x =>
{
if (x != null)
str = str + x.EmployeeID + ",";
});
if (str.Length > 0) str = str.Substring(0, str.Length - 1);
return str;
return string.Join(",", items.Where(x => x != null).Select(x => x.EmployeeID).Distinct());
}

View File

@ -22,15 +22,15 @@ namespace HRM.DA
{
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
tc.ExecuteNonQuery(
"INSERT INTO ADPARAMETERBASIC(ADParameterID, allowDeductID, isForConfirmOnly, flatAmount, percentOfBasic, percentOfGross, GFFlatAmount, GFPercentOfBasic, GFPercentOfGross, minAmount, maxAmount, isCurrentlyActive, TAXABLEPERCENTAGE, ISTAXABLE, ISTaxProjection, IsDependsOnAttendance, IsDependsOnOTHour,ISDEPENDSONSPECIALHOUR, IsWithException, Periodicity, ALLOWORDEDUCT, GENDER, CreatedBy, CreationDate, PAYROLLTYPEID, LASTACTIVATIONDATE,ENTITLETYPE,PercentOfEarnedBasic,IsFractionateApplicable, TaxProjection,allowanceType,isBalancing)" +
" VALUES(%n, %n, %b, %n, %n, %n, %n, %n, %n, %n, %n, %b, %n, %b, %b, %b, %b, %n, %b, %n, %n, %n, %n, %d, %n, %D, %n, %n, %n,%n,%n,%b)",
"INSERT INTO ADPARAMETERBASIC(ADParameterID, allowDeductID, isForConfirmOnly, flatAmount, percentOfBasic, percentOfGross, GFFlatAmount, GFPercentOfBasic, GFPercentOfGross, minAmount, maxAmount, isCurrentlyActive, TAXABLEPERCENTAGE, ISTAXABLE, ISTaxProjection, IsDependsOnAttendance, IsDependsOnOTHour,ISDEPENDSONSPECIALHOUR, IsWithException, Periodicity, ALLOWORDEDUCT, GENDER, CreatedBy, CreationDate, PAYROLLTYPEID, LASTACTIVATIONDATE,ENTITLETYPE,PercentOfEarnedBasic,IsFractionateApplicable, TaxProjection,isBalancing)" +
" VALUES(%n, %n, %b, %n, %n, %n, %n, %n, %n, %n, %n, %b, %n, %b, %b, %b, %b, %n, %b, %n, %n, %n, %n, %d, %n, %D, %n, %n, %n,%n,%b)",
item.ID, item.AllowDeductID, item.IsForConfirmOnly, item.FlatAmount, item.PercentOfBasic,
item.PercentOfGross, item.GFFlatAmount, item.GFPercentOfBasic, item.GFPercentOfGross, item.MinAmount,
item.MaxAmount, item.IsCurrentlyActive, item.TaxablePercentage, item.IsTaxable, item.IsTaxProjection,
item.IsDependsOnAttendance, item.IsDependsOnOTHour, item.ISDEPENDSONSPECIALHOUR, item.IsWithException,
item.Periodicity, item.AllowOrDeductType, item.Gender, item.CreatedBy, item.CreatedDate,
item.PayrollTypeID, DateTime.Now, item.EntitleType, item.PercentOfEarnedBasic,
item.IsFractionateApplicable, 0,item.AllowanceType,item.IsOnBalancing);
item.IsFractionateApplicable, 0, item.IsOnBalancing);
}
internal static void Insert(TransactionContext tc, ADParameter.ADParameterGrade item)
@ -57,13 +57,13 @@ namespace HRM.DA
internal static void Update(TransactionContext tc, ADParameter item)
{
tc.ExecuteNonQuery(
"UPDATE ADPARAMETERBASIC SET allowDeductID=%n, IsForConfirmOnly=%b, FlatAmount=%n, PercentOfBasic=%n, PercentOfGross=%n, GFFlatAmount=%n, GFPercentOfBasic=%n, GFPercentOfGross=%n, MinAmount=%n, MaxAmount=%n, IsCurrentlyActive=%b, TaxablePercentage=%n, IsTaxable=%b, IsTaxProjection=%b, IsDependsOnAttendance=%b, IsDependsOnOTHour=%b, IsWithException=%b, Periodicity=%n, ALLOWORDEDUCT=%n, Gender=%n, ModifiedBy=%n, ModifiedDate=%d, ENTITLETYPE=%n, PercentOfEarnedBasic=%n, IsFractionateApplicable=%n,allowanceType=%n,isBalancing=%b" +
"UPDATE ADPARAMETERBASIC SET allowDeductID=%n, IsForConfirmOnly=%b, FlatAmount=%n, PercentOfBasic=%n, PercentOfGross=%n, GFFlatAmount=%n, GFPercentOfBasic=%n, GFPercentOfGross=%n, MinAmount=%n, MaxAmount=%n, IsCurrentlyActive=%b, TaxablePercentage=%n, IsTaxable=%b, IsTaxProjection=%b, IsDependsOnAttendance=%b, IsDependsOnOTHour=%b, IsWithException=%b, Periodicity=%n, ALLOWORDEDUCT=%n, Gender=%n, ModifiedBy=%n, ModifiedDate=%d, ENTITLETYPE=%n, PercentOfEarnedBasic=%n, IsFractionateApplicable=%n,isBalancing=%b" +
" WHERE ADParameterID=%n", item.AllowDeductID, item.IsForConfirmOnly, item.FlatAmount,
item.PercentOfBasic, item.PercentOfGross, item.GFFlatAmount, item.GFPercentOfBasic,
item.GFPercentOfGross, item.MinAmount, item.MaxAmount, item.IsCurrentlyActive, item.TaxablePercentage,
item.IsTaxable, item.IsTaxProjection, item.IsDependsOnAttendance, item.IsDependsOnOTHour,
item.IsWithException, item.Periodicity, item.AllowOrDeductType, item.Gender, item.ModifiedBy,
item.ModifiedDate, item.EntitleType, item.PercentOfEarnedBasic, item.IsFractionateApplicable, item.AllowanceType, item.IsOnBalancing, item.ID);
item.ModifiedDate, item.EntitleType, item.PercentOfEarnedBasic, item.IsFractionateApplicable, item.IsOnBalancing, item.ID);
}
#endregion

View File

@ -20,9 +20,9 @@ namespace HRM.DA
internal static void Insert(TransactionContext tc, AllowanceDeduction item)
{
tc.ExecuteNonQuery(
"INSERT INTO AllowanceDeduction(ALLOWDEDUCTID, code, name, allowOrDeduct, CreatedBy, CreationDate, SequenceNo, Status, payrolltypeid, nameinbangla)" +
" VALUES(%n, %s, %s, %n, %n, %d, %n, %n, %n, %u)", item.ID, item.Code, item.Name, item.AllowOrDeductType,
item.CreatedBy, item.CreatedDate, item.Sequence, item.Status , item.payrolltypeid, item.NameInBangla);
"INSERT INTO AllowanceDeduction(ALLOWDEDUCTID, code, name, allowOrDeduct, CreatedBy, CreationDate, SequenceNo, Status, payrolltypeid, nameinbangla, AllowanceType)" +
" VALUES(%n, %s, %s, %n, %n, %d, %n, %n, %n, %u, %n)", item.ID, item.Code, item.Name, item.AllowOrDeductType,
item.CreatedBy, item.CreatedDate, item.Sequence, item.Status , item.payrolltypeid, item.NameInBangla, item.AllowanceType);
}
#endregion
@ -33,8 +33,8 @@ namespace HRM.DA
{
tc.ExecuteNonQuery(
"UPDATE AllowanceDeduction SET code=%s, name=%s, allowOrDeduct=%n, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n" +
" , payrolltypeid=%n, nameinbangla=%u WHERE ALLOWDEDUCTID=%n", item.Code, item.Name, item.AllowOrDeductType, item.ModifiedBy,
item.ModifiedDate, item.Sequence, item.Status, item.payrolltypeid, item.NameInBangla, item.ID);
" , payrolltypeid=%n, nameinbangla=%u, AllowanceType=%n WHERE ALLOWDEDUCTID=%n", item.Code, item.Name, item.AllowOrDeductType, item.ModifiedBy,
item.ModifiedDate, item.Sequence, item.Status, item.payrolltypeid, item.NameInBangla, item.AllowanceType, item.ID);
}
#endregion

View File

@ -8,72 +8,126 @@ namespace HRM.DA
{
public class ComponentUploadSetupDA
{
#region Constructor
public ComponentUploadSetupDA()
{
}
#region Constructor
public ComponentUploadSetupDA() { }
#endregion
#region Insert function
#region Insert function
public static void Insert(TransactionContext tc, ComponentUploadSetup oItem)
{
tc.ExecuteNonQuery(
"INSERT INTO ComponentUploadSetup(ComponentUploadSetupID, EmployeeID, ComponentType, ItemID, Description)" +
" VALUES(%n, %n, %n,%n, %s)", oItem.ID, oItem.EmployeeID, (EnumComponentType)oItem.ComponentType,
oItem.ItemID, oItem.Description);
tc.ExecuteNonQuery("INSERT INTO ComponentUploadSetup(ComponentUploadSetupID, EmployeeID, ApproverID, ComponentType, ItemID, Description,IsDamageManagement)" +
" VALUES(%n, %n, %n, %n,%n, %s, %b)", oItem.ID, oItem.EmployeeID, oItem.ApproverID, (EnumComponentType)oItem.ComponentType, oItem.ItemID, oItem.Description, oItem.IsDamageManagement);
}
#endregion
#region Update function
#region Update function
public static void Update(TransactionContext tc, ComponentUploadSetup oItem)
{
tc.ExecuteNonQuery(
"UPDATE ComponentUploadSetup SET EmployeeID=%n, ComponentType=%n,ItemID=%n, Description=%s" +
" WHERE ComponentUploadSetupID=%n", oItem.EmployeeID, (EnumComponentType)oItem.ComponentType,
oItem.ItemID, oItem.Description, oItem.ID);
tc.ExecuteNonQuery("UPDATE ComponentUploadSetup SET EmployeeID=%n, ApproverID = %n, ComponentType=%n,ItemID=%n, Description=%s" +
" WHERE ComponentUploadSetupID=%n", oItem.EmployeeID, oItem.ApproverID, (EnumComponentType)oItem.ComponentType, oItem.ItemID, oItem.Description, oItem.ID);
}
#endregion
#region Get function
public static DataSet GetUploadedComponent(TransactionContext tc, DateTime uploadMonth)
{
return tc.ExecuteDataSet(@"Select Distinct A.Name ComponentName, UC.ComponentId From ALLOWANCEDEDUCTION A
Join UploadedComponent UC On UC.ComponentId = A.AllowDeductId Where UC.SalaryMonth = %d", GlobalFunctions.LastDateOfMonth(uploadMonth));
}
public static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM ComponentUploadSetup ORDER BY EmployeeID");
}
public static IDataReader Get(TransactionContext tc, int empid)
{
return tc.ExecuteReader("SELECT * FROM ComponentUploadSetup WHERE EmployeeID=%n", empid);
//return tc.ExecuteReader("SELECT DISTinct EmployeeID, PropductSerial= STUFF((SELECT ', ' + DESCRIPTION From ComponentUploadSetup WHERE employeeid = c.EmployeeID FOR XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)'), 1, 1, '') From ComponentUploadSetup c where c.employeeid =%n", empid);
}
public static IDataReader GetByEmpIDandItemID(TransactionContext tc, int empid, int itemID)
{
return tc.ExecuteReader("SELECT * FROM ComponentUploadSetup WHERE EmployeeID=%n and ItemID=%n Order by COMPONENTUPLOADSETUPID desc", empid, itemID);
//return tc.ExecuteReader("SELECT DISTinct EmployeeID, PropductSerial= STUFF((SELECT ', ' + DESCRIPTION From ComponentUploadSetup WHERE employeeid = c.EmployeeID FOR XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)'), 1, 1, '') From ComponentUploadSetup c where c.employeeid =%n", empid);
}
public static IDataReader GetByApproverID(TransactionContext tc, int apprvrID)
{
return tc.ExecuteReader("SELECT CUS.*, UCE.UploadedComponentID FROM ComponentUploadSetup AS CUS RIGHT JOIN UploadedComponent UCE ON UCE.UploadedBy = CUS.EMPLOYEEID WHERE CUS.ApproverID=%n", apprvrID);
}
public static DataSet GetUploadedComponentReportData(TransactionContext tc, DateTime fromDate, DateTime toDate)
{
string sql = SQLParser.MakeSQL(@"SELECT UE.EmployeeNo UploaderNo, UE.Name UploaderName, CONVERT(VARCHAR, U.UploadedDate, 106) UploadDate, A.Name ComponentName,
UA.EmployeeNo ApproverNo, UA.Name ApproverName, CONVERT(VARCHAR, U.ApprovedDate, 106) ApproveDate
FROM UploadedComponent U
LEFT JOIN Employee UE ON UE.EmployeeId = U.UploadedBy
LEFT JOIN Employee UA ON UA.EmployeeId = U.ApprovedBy
LEFT JOIN ALLOWANCEDEDUCTION A ON A.AllowDeductId = U.ComponentId
WHERE U.UploadedDate BETWEEN %d AND %d", fromDate, toDate);
return tc.ExecuteDataSet(sql);
}
public static DataSet GetUploadedComponentEmpReportData(TransactionContext tc, DateTime salaryMonth, int componentId, string empIds)
{
string sql = SQLParser.MakeSQL(@"SELECT UCE.UploadedComponentEmpId, UE.EmployeeNo UploadedEmpNo, UE.Name UploadedEmpName, UCE.Amount, CONVERT(VARCHAR, UCE.CreatedDate, 106) UploadedDate, A.Name ComponentName
FROM UploadedComponentEmp UCE
LEFT JOIN Employee UE ON UE.EmployeeId = UCE.EmployeeId
LEFT JOIN UploadedComponent UC ON UC.UploadedComponentId = UCE.UploadedComponentId
LEFT JOIN ALLOWANCEDEDUCTION A ON A.AllowDeductId = UC.ComponentId
WHERE UCE.EmployeeId In (%q) And UC.ComponentId = %n And UC.SalaryMonth = %d", empIds, componentId, GlobalFunctions.LastDateOfMonth(salaryMonth));
return tc.ExecuteDataSet(sql);
}
public static DataSet GetUploadedComponentEmpReportData(TransactionContext tc, DateTime salaryMonth, string empIds)
{
string sql = SQLParser.MakeSQL(@"SELECT UCE.UploadedComponentEmpId, UE.EmployeeNo UploadedEmpNo, UE.Name UploadedEmpName, UCE.Amount, CONVERT(VARCHAR, UCE.CreatedDate, 106) UploadedDate, A.Name ComponentName
FROM UploadedComponentEmp UCE
LEFT JOIN Employee UE ON UE.EmployeeId = UCE.EmployeeId
LEFT JOIN UploadedComponent UC ON UC.UploadedComponentId = UCE.UploadedComponentId
LEFT JOIN ALLOWANCEDEDUCTION A ON A.AllowDeductId = UC.ComponentId
WHERE UCE.EmployeeId In (%q) And UC.SalaryMonth = %d", empIds, GlobalFunctions.LastDateOfMonth(salaryMonth));
return tc.ExecuteDataSet(sql);
}
#endregion
#region Delete function
#region Delete function
public static void Delete(TransactionContext tc, int id)
{
tc.ExecuteNonQuery("DELETE FROM ComponentUploadSetup WHERE ComponentUploadSetupID=%n", id);
}
public static bool IsExist(TransactionContext tc, int empId, EnumComponentType ComponentType, int itemId)
public static void DeleteSingleComponent(TransactionContext tc, int empId, int apprvrId, EnumComponentType ComponentType, int itemId)
{
bool Exist = false;
Object obj =
tc.ExecuteScalar(
"Select COUNT (*) FROM ComponentUploadSetup WHERE EmployeeID=%n AND COMPONENTTYPE=%n AND ItemID=%n",
empId, ComponentType, itemId);
Exist = Convert.ToInt32(obj) > 0 ? true : false;
return Exist;
tc.ExecuteNonQuery("DELETE FROM ComponentUploadSetup WHERE EmployeeID=%n AND ApproverID = %n AND COMPONENTTYPE=%n AND ItemID=%n", empId, apprvrId, ComponentType, itemId);
}
public static bool IsExist(TransactionContext tc, int empId, int apprvrId, EnumComponentType ComponentType, int itemId)
{
object obj = tc.ExecuteScalar("Select COUNT (*) FROM ComponentUploadSetup WHERE EmployeeID=%n AND ApproverID = %n AND COMPONENTTYPE=%n AND ItemID=%n", empId, apprvrId, ComponentType, itemId);
return Convert.ToInt32(obj) > 0;
}
// True when the employee is set as the approver of at least one component upload setup.
public static bool HasApproverSetup(TransactionContext tc, int approverId)
{
object obj = tc.ExecuteScalar("Select COUNT(*) FROM ComponentUploadSetup WHERE ApproverID=%n", approverId);
return Convert.ToInt32(obj) > 0;
}
// True when the employee has at least one component upload setup (i.e. can upload components).
public static bool HasUploaderSetup(TransactionContext tc, int employeeId)
{
object obj = tc.ExecuteScalar("Select COUNT(*) FROM ComponentUploadSetup WHERE EmployeeID=%n", employeeId);
return Convert.ToInt32(obj) > 0;
}
public static void DeleteExisting(TransactionContext tc, ComponentUploadSetup oItem)
{
tc.ExecuteNonQuery(
"DELETE FROM ComponentUploadSetup WHERE EmployeeID=%n AND ApproverID=%n",
oItem.EmployeeID, oItem.ApproverID);
}
#endregion
}
}

View File

@ -0,0 +1,142 @@
using Ease.Core.DataAccess;
using HRM.BO;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HRM.DA
{
internal class UploadedComponentDA
{
#region Insert function
internal static void Insert(TransactionContext tc, UploadedComponent item)
{
tc.ExecuteNonQuery("INSERT INTO UploadedComponent(UploadedComponentID, SalaryMonth, ComponentID, ComponentType, UploadedBy, UploadedDate, IsDamageManagement)" +
" VALUES(%n, %d, %n, %n, %n, %D, %b)", item.ID, item.SalaryMonth, item.ComponentID, (int)(EnumComponentType)item.ComponentType, item.UploadedBy, item.UploadedDate, DataReader.GetNullValue(item.IsDamageManagement));
}
internal static void InsertUploadedComponentEmp(TransactionContext tc, UploadedComponentEmp item)
{
tc.ExecuteNonQuery("INSERT INTO UploadedComponentEmp(UploadedComponentEmpID, UploadedComponentID, EmployeeID, Amount, CreatedDate, Reason, TotalAmount, DeductionMonth, DeductionAmount, Remarks)" +
" VALUES(%n, %n, %n, %n, %d, %s, %n, %d, %n, %s)", item.ID, item.UploadedComponentID, item.EmployeeID, item.Amount, item.CreatedDate, DataReader.GetNullValue(item.Reason), DataReader.GetNullValue(item.TotalAmount), DataReader.GetNullValue(item.DeductionMonth), DataReader.GetNullValue(item.DeductionAmount), DataReader.GetNullValue(item.Remarks));
}
#endregion
#region Get Function
public static IDataReader Get(TransactionContext tc, DateTime fromDate, DateTime toDate)
{
return tc.ExecuteReader("SELECT * FROM UploadedComponent Where UploadedDate Between %d And %d ORDER BY UploadedDate Desc", fromDate, toDate);
}
internal static DataSet GetByID(TransactionContext tc, int uploadedComponentID)
{
string sql = SQLParser.MakeSQL(@"Select UC.*, UCE.EmployeeID, UCE.Amount from UploadedComponent As UC
Join UploadedComponentEmp As UCE On UCE.UploadedComponentID = UC.UploadedComponentID
Where UC.UploadedComponentID = %n
Order By UC.UploadedDate", uploadedComponentID);
return tc.ExecuteDataSet(sql);
}
internal static DataSet GetByID_DT(TransactionContext tc, int uploadedComponentID)
{
string sql = SQLParser.MakeSQL(@"
SELECT E.EmployeeNo, E.Name, UCE.Amount
FROM UploadedComponent As UC
JOIN UploadedComponentEmp As UCE ON UCE.UploadedComponentID = UC.UploadedComponentID
JOIN Employee As E ON E.EmployeeID = UCE.EmployeeID
WHERE UC.UploadedComponentID = %n
ORDER BY UC.UploadedDate", uploadedComponentID);
return tc.ExecuteDataSet(sql);
}
internal static DataSet GetByIDandUploaderID_DT(TransactionContext tc, int uploadedComponentID, int uploaderID)
{
string sql = SQLParser.MakeSQL(@"
SELECT E.EmployeeNo, E.Name, UCE.Amount
FROM UploadedComponent As UC
JOIN UploadedComponentEmp As UCE ON UCE.UploadedComponentID = UC.UploadedComponentID
JOIN Employee As E ON E.EmployeeID = UCE.EmployeeID
WHERE UC.UploadedComponentID = %n AND UC.UploadedBy = %n
ORDER BY UC.UploadedDate", uploadedComponentID, uploaderID);
return tc.ExecuteDataSet(sql);
}
internal static IDataReader GetUploadedComponentEmp(TransactionContext tc, int componentID)
{
return tc.ExecuteReader("SELECT * FROM UploadedComponentEmp WHERE UploadedComponentID=%n", componentID);
}
internal static IDataReader Get(TransactionContext tc, int componentID, int uploaderID, DateTime salaryMonth)
{
return tc.ExecuteReader("SELECT * FROM UploadedComponent WHERE UploadedBy=%n AND SalaryMonth = %d AND ComponentId=%n", uploaderID, GlobalExtensions.LastDateOfMonth(salaryMonth), componentID);
}
internal static IDataReader Get(TransactionContext tc, int uploaderID, DateTime salaryMonth)
{
return tc.ExecuteReader("SELECT * FROM UploadedComponent WHERE UploadedBy=%n AND SalaryMonth = %d", uploaderID, GlobalExtensions.LastDateOfMonth(salaryMonth));
}
internal static IDataReader GetByApprover(TransactionContext tc, int approverID, DateTime salaryMonth)
{
return tc.ExecuteReader("SELECT UCE.* FROM UploadedComponent UCE WHERE EXISTS " +
"(SELECT 1 FROM ComponentUploadSetup CUS WHERE CUS.EMPLOYEEID = UCE.UploadedBy AND CUS.ApproverID =%n AND UCE.SalaryMonth =%d);",
approverID, GlobalExtensions.LastDateOfMonth(salaryMonth));
}
internal static IDataReader GetByApprover(TransactionContext tc, int approverID)
{
return tc.ExecuteReader("SELECT UCE.* FROM UploadedComponent UCE WHERE EXISTS " +
"(SELECT 1 FROM ComponentUploadSetup CUS WHERE CUS.EMPLOYEEID = UCE.UploadedBy AND CUS.ApproverID =%n);",
approverID);
}
internal static DataSet GetByUploaderDT(TransactionContext tc, int empID)
{
string sql = SQLParser.MakeSQL(@"
Select uc.*, e.EmployeeNo, e.Name, comp.DESCRIPTION from UploadedComponent uc
inner join COMPONENTUPLOADSETUP comp ON comp.ITEMID = uc.ComponentID
AND comp.COMPONENTTYPE = uc.ComponentType
AND comp.EMPLOYEEID = uc.UploadedBy
left join Employee e on comp.APPROVERID = e.EMPLOYEEID
where uc.UploadedBy = %n order by uc.SalaryMonth desc ", empID);
return tc.ExecuteDataSet(sql);
}
#endregion
#region Update Function
internal static void Update(TransactionContext tc, UploadedComponent item)
{
tc.ExecuteNonQuery("UPDATE UploadedComponent SET SalaryMonth=%d, ComponentID=%n, ComponentType=%n, ApprovedBy=%n, ApprovedDate=%d" +
" WHERE UploadedComponentID=%n", item.SalaryMonth, item.ComponentID, (int)(EnumComponentType)item.ComponentType, item.ApprovedBy, item.ApprovedDate, item.ID);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, int uploadedComponentID)
{
tc.ExecuteNonQuery("DELETE FROM UploadedComponent WHERE UploadedComponentID=%n", uploadedComponentID);
}
internal static void DeleteUploadedComponentEmp(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM UploadedComponentEmp WHERE UploadedComponentID=%n", nID);
}
#endregion
#region IsExist
public static IDataReader GetExistingComponent(TransactionContext tc, int uploaderID, int componentID, EnumComponentType componentType, DateTime salaryMonth)
{
return tc.ExecuteReader("SELECT * FROM UploadedComponent WHERE UploadedBy=%n AND ComponentID=%n AND ComponentType=%n AND SalaryMonth=%d", uploaderID, componentID, (int)componentType, GlobalExtensions.LastDateOfMonth(salaryMonth));
}
#endregion
#region ADParameter of the grade
/// <summary>The allowance/deduction parameter that covers the grade (GP's ADParameterDA.GetADParamByGradeAndAD).</summary>
internal static IDataReader GetADParamByGradeAndAD(TransactionContext tc, int gradeID, int allowDedID)
{
return tc.ExecuteReader(@"SELECT A.* FROM ADPARAMETERBASIC A, ADPARAMETERGRADE AG WHERE A.ADPARAMETERID=AG.ADPARAMETERID
AND AG.GRADEID=%n AND A.ALLOWDEDUCTID=%n", gradeID, allowDedID);
}
#endregion
}
}

View File

@ -121,6 +121,45 @@ namespace HRM.DA
#endregion
#region BonusReligion
internal static void InsertReligion(TransactionContext tc, int bonusReligionID, int bonusID, int religionID)
{
tc.ExecuteNonQuery("INSERT INTO BonusReligion(BonusReligionID, BonusID, ReligionID) VALUES(%n, %n, %n)",
bonusReligionID, bonusID, religionID);
}
internal static void DeleteReligions(TransactionContext tc, int bonusID)
{
tc.ExecuteNonQuery("DELETE FROM BonusReligion WHERE BonusID=%n", bonusID);
}
internal static IDataReader GetReligions(TransactionContext tc, int bonusID)
{
return tc.ExecuteReader(
"SELECT br.BonusID, br.ReligionID, r.Name FROM BonusReligion br INNER JOIN Religion r ON r.ReligionID = br.ReligionID" +
" WHERE br.BonusID=%n ORDER BY r.SequenceNo, r.Name", bonusID);
}
// Live employees of the payroll type whose religion is one of the bonus's religions
internal static IDataReader GetReligionEmployeeIDs(TransactionContext tc, int bonusID, int payrollTypeID)
{
return tc.ExecuteReader(
"SELECT e.EmployeeID FROM Employee e WHERE e.Status=%n AND e.PayrollTypeID=%n" +
" AND e.ReligionID IN (SELECT br.ReligionID FROM BonusReligion br WHERE br.BonusID=%n) ORDER BY e.EmployeeNo",
(int)EnumEmployeeStatus.Live, payrollTypeID, bonusID);
}
internal static IDataReader GetReligionsByPayrollType(TransactionContext tc, int payrollTypeID)
{
return tc.ExecuteReader(
"SELECT br.BonusID, br.ReligionID, r.Name FROM BonusReligion br INNER JOIN Religion r ON r.ReligionID = br.ReligionID" +
" INNER JOIN Bonus b ON b.BonusID = br.BonusID WHERE b.PayrollTypeID=%n ORDER BY br.BonusID, r.SequenceNo, r.Name",
payrollTypeID);
}
#endregion
#region CC Wise Bonus Summary
internal static DataSet GetCCWiseBonusSummary(TransactionContext tc, DateTime bMonthDate, string bonus)
{

View File

@ -430,6 +430,31 @@ AND BP.PayrollTypeID=%n", emps, FromDate, ToDate, payrollTypeID);
//{
// return tc.ExecuteReader("SELECT * FROM BonusEmpCostCenter WHERE BonusProcessID=%n", nID);
//}
// Date Range Wise Salary Sheet (Include Bonus): every bonus of the employees whose bonus month OR
// disburse date falls between the first day of fromSalaryMonth and the end of toSalaryMonth.
// A bonus disbursed with salary (ISDISBURSEWITHSALARY = 1) is left out: it is already a salary item
// (SalaryMonthlyDetail, ItemCode -107), so taking it again would count it twice.
// Amount / tax are ChangeBonusAmount / ChangeTaxAmount, the figures the bonus register shows.
internal static DataSet GetEmpBonusDateRange(TransactionContext tc, DateTime fromSalaryMonth, DateTime toSalaryMonth, string sEmpID)
{
DateTime fromDate = new DateTime(fromSalaryMonth.Year, fromSalaryMonth.Month, 1);
DateTime toDateExclusive = new DateTime(toSalaryMonth.Year, toSalaryMonth.Month, 1).AddMonths(1);
string sql = SQLParser.MakeSQL(@"SELECT E.EMPLOYEENO, E.NAME Name, G.DESCRIPTION GName, D.DESCRIPTION Department, E.JOININGDATE,
BPD.BasicSalary, BP.BonusProcessID, BP.BonusID, B.NAME BonusName, BP.BonusMonth, BP.DisburseDate,
BPD.ChangeBonusAmount, BPD.ChangeTaxAmount
FROM BONUSPROCESS BP
inner join BONUSPROCESSDETAIL BPD on BPD.BonusProcessID = BP.BonusProcessID
inner join BONUS B on B.BONUSID = BP.BONUSID
inner join EMPLOYEE E on E.EMPLOYEEID = BPD.EmployeeID
left outer join GRADES G on G.GRADEID = E.GRADEID
left outer join DEPARTMENT D on D.DEPARTMENTID = E.DEPARTMENTID
WHERE BPD.EmployeeID IN(%q) AND ISNULL(BP.ISDISBURSEWITHSALARY, 0) = 0
AND ((BP.BonusMonth >= %d AND BP.BonusMonth < %d))
ORDER BY E.EMPLOYEENO, BP.BonusMonth, BP.BonusID",
sEmpID, fromDate, toDateExclusive);
return tc.ExecuteDataSet(sql);
}
internal static DataSet GetBonusRegister(TransactionContext tc, int BonusID, DateTime dBonusMonth,
string sEmpID, int payrolltypeid)
{
@ -716,7 +741,9 @@ AND BP.PayrollTypeID=%n", emps, FromDate, ToDate, payrollTypeID);
internal static DataTable GetUnApprovedBonuses(TransactionContext tc, DateTime dMonthDate, int payrollTypeID)
{
return tc.ExecuteDataTable("SELECT *, b.name, (SELECT Count(*) FROM bonusProcessDetail bdetail WHERE bdetail.bonusProcessid = bp.bonusProcessid) Count, " +
"(CASE WHEN EXISTS (SELECT 1 FROM SalaryApprovalAttachment saa WHERE saa.ReferenceID = bp.bonusProcessid) THEN 1 ELSE 0 END) IsAttachment " +
"(CASE WHEN EXISTS (SELECT 1 FROM SalaryApprovalAttachment saa WHERE saa.ReferenceID = bp.bonusProcessid) THEN 1 ELSE 0 END) IsAttachment, " +
"(SELECT STRING_AGG(r.Name, ', ') WITHIN GROUP (ORDER BY r.SequenceNo, r.Name) FROM BonusReligion br " +
"INNER JOIN Religion r ON r.ReligionID = br.ReligionID WHERE br.BonusID = bp.bonusid) ReligionNames " +
"FROM bonusProcess bp, bonus b WHERE b.bonusid = bp.bonusid AND bp.IsApprove = %b AND bp.BonusMonth = %d AND bp.PayrollTypeID = %n",
false, dMonthDate, payrollTypeID);
}

View File

@ -713,6 +713,40 @@ namespace HRM.DA
return oSMonthlys;
}
#region Date Range Wise Salary Sheet
// Date Range Wise Salary Sheet: one row per salary item per employee per salary month in the range
// (gross 1, unauthorized leave 2, deduction 3, arrear 8 and the net payable 5/-132), with the
// employee's grade / basic of THAT month. PaySlip.ShowReportDateRange turns it into the salary sheet matrix.
// LEFT JOIN so that a salary month without any of those items still gets its row.
internal static DataSet GetEmpPaySlipDateRangeMonthWise(TransactionContext tc, DateTime fromSalaryMonth, DateTime toSalaryMonth, string sEmpID)
{
DataSet oSMonthlys = new DataSet();
try
{
string sql = SQLParser.MakeSQL(@"SELECT E.EMPLOYEENO, E.NAME Name, G.DESCRIPTION GName, D.DESCRIPTION Department, E.JOININGDATE,
S.SalaryMonth, S.THISMONTHBASIC ActualBasic,
SD.ITEMGROUP, SD.ItemCode, SD.ItemID, SD.DESCRIPTION Description, SD.Position, SD.CHANGEDAMOUNT
FROM SALARYMONTHLY S
inner join EMPLOYEE E on S.EMPLOYEEID = E.EMPLOYEEID
inner join GRADES G on S.GRADEID = G.GRADEID
inner join DEPARTMENT D on S.DEPARTMENTID = D.DEPARTMENTID
left outer join SALARYMONTHLYDETAIL SD on S.SALARYMONTHLYID = SD.SALARYMONTHLYID
AND (SD.ITEMGROUP IN (1,2,3,8) OR (SD.ITEMGROUP = 5 AND SD.ItemCode = -132))
WHERE S.SalaryMonth BETWEEN %d AND %d AND S.EmployeeID IN(%q)
ORDER BY E.EMPLOYEENO, S.SalaryMonth, SD.Position", fromSalaryMonth, toSalaryMonth, sEmpID);
oSMonthlys = tc.ExecuteDataSet(sql);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
return oSMonthlys;
}
#endregion
internal static DataSet GetGrossDeduction(TransactionContext tc, int empID, DateTime salaryMonth)
{
DataSet rootDataset = new DataSet();

View File

@ -21,6 +21,20 @@ namespace HRM.DA
#endregion
#region Category employees (Salary Process screen, no employee selected)
// Live employees of the payroll type in the category whose salary of the month is not processed yet
internal static IDataReader GetCategoryEmployeeIDs(TransactionContext tc, int categoryID, int payrollTypeID, DateTime salaryMonth)
{
return tc.ExecuteReader(
"SELECT e.EmployeeID FROM Employee e WHERE e.Status=%n AND e.PayrollTypeID=%n AND e.CategoryID=%n" +
" AND NOT EXISTS (SELECT 1 FROM SalaryMonthly sm WHERE sm.EmployeeID = e.EmployeeID AND sm.SalaryMonth=%d AND sm.PayrollTypeID=%n)" +
" ORDER BY e.EmployeeNo",
(int)EnumEmployeeStatus.Live, payrollTypeID, categoryID, salaryMonth, payrollTypeID);
}
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, SalaryProcess item)

View File

@ -51,7 +51,6 @@ namespace HRM.DA
oADParameter.ModifiedBy = oReader.GetInt32("ModifiedBy", 0);
oADParameter.ModifiedDate = oReader.GetDateTime("ModifiedDate");
oADParameter.EntitleType = (EnumEntitleType)oReader.GetInt32("EntitleType").Value;
oADParameter.AllowanceType = (EnumAllowanceType)oReader.GetInt32("allowanceType").Value;
oADParameter.IsOnBalancing = oReader.GetBoolean("isBalancing").Value;
this.SetObjectState(oADParameter, Ease.Core.ObjectState.Saved);
}

View File

@ -21,6 +21,7 @@ namespace HRM.DA
oAllowanceDeduction.Name = oReader.GetString("name");
oAllowanceDeduction.NameInBangla = oReader.GetString("nameinbangla", true, null);
oAllowanceDeduction.AllowOrDeductType = (EnumAllowOrDeduct)oReader.GetInt32("allowOrDeduct").Value;
oAllowanceDeduction.AllowanceType = (EnumAllowanceType)oReader.GetInt32("AllowanceType", 0);
oAllowanceDeduction.Sequence = oReader.GetInt32("SequenceNo").Value;
oAllowanceDeduction.Status = (EnumStatus)oReader.GetInt32("Status").Value;
//oAllowanceDeduction.Periodicity = (EnumPeriodicity)oReader.GetInt32("Periodicity").Value;

View File

@ -4,6 +4,7 @@ using Ease.Core.DataAccess;
using System.Collections.Generic;
using Ease.Core.Utility;
using HRM.BO;
using System.Data;
namespace HRM.DA
{
@ -11,26 +12,31 @@ namespace HRM.DA
{
#region Private functions and declaration
public ComponentUploadSetupService()
{
}
public ComponentUploadSetupService() { }
private void MapObject(ComponentUploadSetup componentSetup, DataReader oReader)
{
base.SetObjectID(componentSetup, oReader.GetInt32("ComponentUploadSetupID").Value);
componentSetup.EmployeeID = oReader.GetInt32("EmployeeID").Value;
componentSetup.ItemID = oReader.GetInt32("ItemID", 0);
componentSetup.ComponentType = (EnumComponentType)oReader.GetInt32("ComponentType");
componentSetup.Description = oReader.GetString("Description");
base.SetObjectID(componentSetup, oReader.GetInt32("ComponentUploadSetupID", true, 0));
componentSetup.EmployeeID = oReader.GetInt32("EmployeeID", true, 0);
componentSetup.ApproverID = oReader.GetInt32("ApproverID", true, 0);
componentSetup.ItemID = oReader.GetInt32("ItemID", true, 0);
componentSetup.ComponentType = (EnumComponentType)oReader.GetInt32("ComponentType", true, 0);
componentSetup.Description = oReader.GetString("Description", true, null);
componentSetup.IsDamageManagement = oReader.GetBoolean("IsDamageManagement", true, false);
this.SetObjectState(componentSetup, Ease.Core.ObjectState.Saved);
}
protected override T CreateObject<T>(DataReader oReader)
{
ComponentUploadSetup componentSetup = new ComponentUploadSetup();
MapObject(componentSetup, oReader);
return componentSetup as T;
}
private ComponentUploadSetup CreateObject(DataReader oReader)
{
ComponentUploadSetup componentSetup = new ComponentUploadSetup();
MapObject(componentSetup, oReader);
return componentSetup;
}
#endregion
@ -39,7 +45,6 @@ namespace HRM.DA
public List<ComponentUploadSetup> Get()
{
List<ComponentUploadSetup> componentSetups = new List<ComponentUploadSetup>();
TransactionContext tc = null;
try
{
@ -52,24 +57,45 @@ namespace HRM.DA
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return componentSetups;
}
public DataTable GetUploadedComponent(DateTime uploadMonth)
{
DataTable dtUploadedComponent = new DataTable();
List <ComponentUploadSetup> componentSetups = new List<ComponentUploadSetup>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataSet ds = ComponentUploadSetupDA.GetUploadedComponent(tc, uploadMonth);
dtUploadedComponent = (ds != null && (ds.Tables != null && ds.Tables.Count > 0)) ? ds.Tables[0] : new DataTable();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return dtUploadedComponent;
}
public List<ComponentUploadSetup> Get(int empid)
{
List<ComponentUploadSetup> componentSetups = new List<ComponentUploadSetup>();
TransactionContext tc = null;
try
{
@ -82,50 +108,168 @@ namespace HRM.DA
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return componentSetups;
}
public int Save(ComponentUploadSetup componentSetup)
public List<ComponentUploadSetup> GetByEmpIDandItemID(int empId, int itemId)
{
List<ComponentUploadSetup> componentSetups = new List<ComponentUploadSetup>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr = new DataReader(ComponentUploadSetupDA.GetByEmpIDandItemID(tc, empId, itemId));
componentSetups = this.CreateObjects<ComponentUploadSetup>(dr);
dr.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return componentSetups;
}
public List<ComponentUploadSetup> GetByApproverID(int apprvrID)
{
List<ComponentUploadSetup> componentSetups = new List<ComponentUploadSetup>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr = new DataReader(ComponentUploadSetupDA.GetByApproverID(tc, apprvrID));
componentSetups = this.CreateObjects<ComponentUploadSetup>(dr);
dr.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return componentSetups;
}
public DataTable GetUploadedComponentReportData(DateTime fromDate, DateTime toDate)
{
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataSet ds = ComponentUploadSetupDA.GetUploadedComponentReportData(tc, fromDate, toDate);
tc.End();
if (ds != null && ds.Tables.Count > 0)
return ds.Tables[0].Copy();
return new DataTable();
}
catch (Exception e)
{
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
}
}
public DataTable GetUploadedComponentEmpReportData(DateTime salaryMonth, int componentId, string empIds)
{
DataTable dtComponentSetups = new DataTable();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataSet ds = ComponentUploadSetupDA.GetUploadedComponentEmpReportData(tc, salaryMonth, componentId, empIds);
dtComponentSetups = (ds != null && (ds.Tables != null && ds.Tables.Count > 0)) ? ds.Tables[0] : new DataTable();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return dtComponentSetups;
}
public DataTable GetUploadedComponentEmpReportData(DateTime salaryMonth, string empIds)
{
DataTable dtComponentSetups = new DataTable();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataSet ds = ComponentUploadSetupDA.GetUploadedComponentEmpReportData(tc, salaryMonth, empIds);
dtComponentSetups = (ds != null && (ds.Tables != null && ds.Tables.Count > 0)) ? ds.Tables[0] : new DataTable();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return dtComponentSetups;
}
public void Save(List<ComponentUploadSetup> componentSetups)
{
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
if (componentSetup.IsNew)
int id;
foreach (ComponentUploadSetup componentSetup in componentSetups)
{
int id = tc.GenerateID("ComponentUploadSetup", "ComponentUploadSetupID");
base.SetObjectID(componentSetup, (id));
ComponentUploadSetupDA.Insert(tc, componentSetup);
if (componentSetup.IsNew)
{
id = tc.GenerateID("ComponentUploadSetup", "ComponentUploadSetupID");
base.SetObjectID(componentSetup, id);
ComponentUploadSetupDA.Insert(tc, componentSetup);
}
else
{
ComponentUploadSetupDA.Update(tc, componentSetup);
}
}
else
{
ComponentUploadSetupDA.Update(tc, componentSetup);
}
tc.End();
return componentSetup.ID;
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new Exception("Failed to Component Upload Setup. Because " + e.Message, e);
#endregion
}
}
public void Delete(int id)
@ -140,45 +284,183 @@ namespace HRM.DA
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
}
public bool IsExist(int empId, EnumComponentType ComponentType, int itemId)
public void DeleteSingleComponent(ComponentUploadSetup oComponentUploadSetup)
{
bool Exist = false;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
Exist = ComponentUploadSetupDA.IsExist(tc, empId, ComponentType, itemId);
tc = TransactionContext.Begin(true);
ComponentUploadSetupDA.DeleteSingleComponent(tc, oComponentUploadSetup.EmployeeID, oComponentUploadSetup.ApproverID, oComponentUploadSetup.ComponentType, oComponentUploadSetup.ItemID);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return Exist;
}
public bool IsExist(int empId, int apprvrId, EnumComponentType componentType, int itemId)
{
bool exist = false;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
exist = ComponentUploadSetupDA.IsExist(tc, empId, apprvrId, componentType, itemId);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return exist;
}
/// <summary>The employee is the approver of at least one component upload setup.</summary>
public bool HasApproverSetup(int approverId)
{
bool exist = false;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
exist = ComponentUploadSetupDA.HasApproverSetup(tc, approverId);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return exist;
}
/// <summary>The employee has at least one component upload setup (may upload components).</summary>
public bool HasUploaderSetup(int employeeId)
{
bool exist = false;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
exist = ComponentUploadSetupDA.HasUploaderSetup(tc, employeeId);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return exist;
}
public List<ComponentUploadSetup> LoadComponentType(int payrollTypeID)
{
List<ComponentUploadSetup> oComponentUploadSetups = new List<ComponentUploadSetup>();
ComponentUploadSetup oallance = null;
ComponentUploadSetup odeduction = null;
ComponentUploadSetup oterm = null;
ComponentUploadSetup obonus = null;
ComponentUploadSetup oloan = null;
ComponentUploadSetup opiItem = null;
ComponentUploadSetup opf = null;
List<AllowanceDeduction> allowances = new AllowanceDeductionService().GetAllowance(EnumStatus.Regardless, payrollTypeID);
foreach (AllowanceDeduction item in allowances)
{
oallance = new ComponentUploadSetup();
oallance.ComponentType = EnumComponentType.Allowance;
oallance.Description = item.Name;
oallance.ItemID = item.ID;
oComponentUploadSetups.Add(oallance);
}
List<AllowanceDeduction> deductions = new AllowanceDeductionService().GetDeduction(EnumStatus.Regardless, payrollTypeID);
foreach (AllowanceDeduction item in deductions)
{
odeduction = new ComponentUploadSetup();
odeduction.ComponentType = EnumComponentType.Deduction;
odeduction.Description = item.Name;
odeduction.ItemID = item.ID;
oComponentUploadSetups.Add(odeduction);
}
List<Term> terms = new TermService().Get(EnumStatus.Regardless, payrollTypeID);
foreach (Term item in terms)
{
oterm = new ComponentUploadSetup();
oterm.ComponentType = EnumComponentType.OverTime;
oterm.Description = item.Name;
oterm.ItemID = item.ID;
oComponentUploadSetups.Add(oterm);
}
List<Bonus> bonuss = new BonusService().Get(EnumStatus.Regardless, payrollTypeID);
foreach (Bonus item in bonuss)
{
obonus = new ComponentUploadSetup();
obonus.ComponentType = EnumComponentType.Bonus;
obonus.Description = item.Name;
obonus.ItemID = item.ID;
oComponentUploadSetups.Add(obonus);
}
List<Loan> loans = new LoanService().Get(EnumStatus.Regardless);
foreach (Loan item in loans)
{
oloan = new ComponentUploadSetup();
oloan.ComponentType = EnumComponentType.Loan;
oloan.Description = item.Name;
oloan.ItemID = item.ID;
oComponentUploadSetups.Add(oloan);
}
List<OpiItem> opiItems = new OpiItemService().Get(EnumStatus.Regardless, payrollTypeID);
foreach (OpiItem item in opiItems)
{
opiItem = new ComponentUploadSetup();
opiItem.ComponentType = EnumComponentType.OPI;
opiItem.Description = item.Name;
opiItem.ItemID = item.ID;
oComponentUploadSetups.Add(opiItem);
}
opf = new ComponentUploadSetup();
opf.ComponentType = EnumComponentType.PF;
opf.Description = "PF";
opf.ItemID = (int)EnumComponentType.PF;
oComponentUploadSetups.Add(opf);
return oComponentUploadSetups;
}
#endregion
}
}

View File

@ -0,0 +1,568 @@
using Ease.Core.DataAccess;
using Ease.Core.Model;
using Ease.Core.Utility;
using HRM.BO;
using Microsoft.AspNetCore.Http.HttpResults;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HRM.DA
{
public class UploadedComponentService : ServiceTemplate, IUploadedComponentService
{
#region Sevice Head
private void MapUploadedComponentObject(UploadedComponent component, DataReader oReader)
{
base.SetObjectID(component, oReader.GetInt32("UploadedComponentID", true, 0));
component.SalaryMonth = oReader.GetDateTime("SalaryMonth", true, DateTime.MinValue);
component.ComponentID = oReader.GetInt32("ComponentID", true, 0);
component.ComponentType = (EnumComponentType)oReader.GetInt32("ComponentType", true, 0);
component.UploadedBy = oReader.GetInt32("UploadedBy", true, 0);
component.UploadedDate = oReader.GetDateTime("UploadedDate", true, DateTime.MinValue);
component.ApprovedBy = oReader.GetInt32("ApprovedBy", true, 0);
component.ApprovedDate = oReader.GetDateTime("ApprovedDate", true, DateTime.MinValue);
component.IsDamageManagement = oReader.GetBoolean("IsDamageManagement", true, false);
this.SetObjectState(component, Ease.Core.ObjectState.Saved);
}
private void MapUploadedComponentEmpObject(UploadedComponentEmp componentEmp, DataReader oReader)
{
base.SetObjectID(componentEmp, oReader.GetInt32("UploadedComponentEmpID", true, 0));
componentEmp.UploadedComponentID = oReader.GetInt32("UploadedComponentID", true, 0);
componentEmp.EmployeeID = oReader.GetInt32("EmployeeID", true, 0);
componentEmp.Amount = oReader.GetDouble("Amount", true, 0);
componentEmp.Reason = oReader.GetString("Reason", true, string.Empty);
componentEmp.TotalAmount = oReader.GetDouble("TotalAmount", true, 0);
componentEmp.DeductionMonth = oReader.GetDateTime("DeductionMonth", true, DateTime.MinValue);
componentEmp.DeductionAmount = oReader.GetDouble("DeductionAmount", true, 0);
componentEmp.Remarks = oReader.GetString("Remarks", true, string.Empty);
componentEmp.CreatedDate = oReader.GetDateTime("CreatedDate", true, DateTime.MinValue);
componentEmp.ModifiedDate = oReader.GetDateTime("ModifiedDate", true, DateTime.MinValue);
this.SetObjectState(componentEmp, Ease.Core.ObjectState.Saved);
}
protected override T CreateObject<T>(DataReader oReader)
{
UploadedComponent component = new UploadedComponent();
MapUploadedComponentObject(component, oReader);
return component as T;
}
private UploadedComponent CreateObject(DataReader oReader)
{
UploadedComponent component = new UploadedComponent();
MapUploadedComponentObject(component, oReader);
return component;
}
private List<UploadedComponentEmp> CreateChilds(DataReader oReader)
{
List<UploadedComponentEmp> components = new List<UploadedComponentEmp>();
UploadedComponentEmp component;
while (oReader.Read())
{
component = new UploadedComponentEmp();
component = CreateChild(oReader);
components.Add(component);
}
return components;
}
private UploadedComponentEmp CreateChild(DataReader oReader)
{
UploadedComponentEmp component = new UploadedComponentEmp();
MapUploadedComponentEmpObject(component, oReader);
return component;
}
#endregion
#region Service implementation
public void Save(UploadedComponent component)
{
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
if (component.IsNew)
{
int uploadedComponentID;
int uploadedComponentEmpID;
uploadedComponentID = tc.GenerateID("UploadedComponent", "UploadedComponentID");
base.SetObjectID(component, uploadedComponentID);
UploadedComponentDA.Insert(tc, component);
foreach (UploadedComponentEmp item in component.UploadedComponentEmps)
{
uploadedComponentEmpID = tc.GenerateID("UploadedComponentEmp", "UploadedComponentEmpID");
base.SetObjectID(item, uploadedComponentEmpID);
item.CreatedDate = DateTime.Today;
item.UploadedComponentID = component.ID;
UploadedComponentDA.InsertUploadedComponentEmp(tc, item);
}
}
else
{
UploadedComponentDA.Update(tc, component);
}
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
}
public void SaveTC(UploadedComponent component, TransactionContext tc)
{
try
{
if (component.IsNew)
{
int uploadedComponentID;
int uploadedComponentEmpID;
uploadedComponentID = tc.GenerateID("UploadedComponent", "UploadedComponentID");
base.SetObjectID(component, uploadedComponentID);
UploadedComponentDA.Insert(tc, component);
foreach (UploadedComponentEmp item in component.UploadedComponentEmps)
{
uploadedComponentEmpID = tc.GenerateID("UploadedComponentEmp", "UploadedComponentEmpID");
base.SetObjectID(item, uploadedComponentEmpID);
item.CreatedDate = DateTime.Today;
item.UploadedComponentID = component.ID;
UploadedComponentDA.InsertUploadedComponentEmp(tc, item);
}
}
else
{
UploadedComponentDA.Update(tc, component);
}
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
}
/// <summary>The ADParameter of the allowance/deduction that covers the grade; 0 when there is none.</summary>
private static int GetADParameterID(int gradeID, int allowDeductID)
{
int id = 0;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr = new DataReader(UploadedComponentDA.GetADParamByGradeAndAD(tc, gradeID, allowDeductID));
if (dr.Read())
id = dr.GetInt32("ADPARAMETERID", true, 0);
dr.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return id;
}
public void SaveWithADParameter(UploadedComponent component, DateTime salaryMonth)
{
TransactionContext tc = null;
try
{
List<Employee> employees = new EmployeeService().GetAllLive();
List<ADParameterEmployee> _aDParameterEmployees = new List<ADParameterEmployee>();
ADParameterEmployee aDParameterEmployee = null;
foreach (UploadedComponentEmp item in component.UploadedComponentEmps)
{
aDParameterEmployee = new ADParameterEmployee();
int empGradeID = (int)employees.Where(e => e.ID == item.EmployeeID).Select(g => g.GradeID).First();
aDParameterEmployee.ADParameterID = GetADParameterID(empGradeID, component.ComponentID);
aDParameterEmployee.Periodicity = EnumPeriodicity.Monthly;
aDParameterEmployee.FormDate = GlobalFunctions.FirstDateOfMonth(salaryMonth);
aDParameterEmployee.TillDate = GlobalFunctions.LastDateOfMonth(salaryMonth);
aDParameterEmployee.MonthlyAmount = item.Amount;
aDParameterEmployee.Arreartype = EnumArrearType.NotPresent;
aDParameterEmployee.EmployeeID = item.EmployeeID;
aDParameterEmployee.AllowDeductID = component.ComponentID;
aDParameterEmployee.CreatedBy = (int)component.ApprovedBy;
aDParameterEmployee.CreatedDate = DateTime.Today;
// approving the upload is the approval of these individual amounts
aDParameterEmployee.ApprovalStatus = EnumAuthStatus.Approved;
_aDParameterEmployees.Add(aDParameterEmployee);
}
if (component.UploadedComponentEmps.Count == _aDParameterEmployees.Count)
{
tc = TransactionContext.Begin(true);
this.SaveTC(component, tc);
foreach (ADParameterEmployee item in _aDParameterEmployees)
{
base.SetObjectID(item, tc.GenerateID("ADParameterEmployee", "ADPARAMETEREMPID"));
ADParameterEmployeeDA.Insert(tc, item);
}
tc.End();
}
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
}
public List<UploadedComponent> Get(DateTime fromDate, DateTime toDate)
{
List<UploadedComponent> uploadedComponents = new List<UploadedComponent>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr = new DataReader(UploadedComponentDA.Get(tc, fromDate, toDate));
uploadedComponents = this.CreateObjects<UploadedComponent>(dr);
dr.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return uploadedComponents;
}
public DataTable GetByID(int uploadedComponentID)
{
DataTable dtUploadedComponent = new DataTable();
List <UploadedComponent> uploadedComponents = new List<UploadedComponent>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataSet ds = UploadedComponentDA.GetByID_DT(tc, uploadedComponentID);
dtUploadedComponent = (ds != null) && (ds.Tables != null && ds.Tables.Count > 0) ? ds.Tables[0] : new DataTable();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return dtUploadedComponent;
}
public DataTable GetByIDandUploaderID(int uploadedComponentID, int uploaderId)
{
DataTable dtUploadedComponent = new DataTable();
List<UploadedComponent> uploadedComponents = new List<UploadedComponent>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataSet ds = UploadedComponentDA.GetByIDandUploaderID_DT(tc, uploadedComponentID, uploaderId);
dtUploadedComponent = (ds != null) && (ds.Tables != null && ds.Tables.Count > 0) ? ds.Tables[0] : new DataTable();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return dtUploadedComponent;
}
public List<UploadedComponent> Get(int componentID, int uploaderID, DateTime salaryMonth)
{
List<UploadedComponent> components = new List<UploadedComponent>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader oreader = new DataReader(UploadedComponentDA.Get(tc, componentID, uploaderID, salaryMonth));
components = this.CreateObjects<UploadedComponent>(oreader);
oreader.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return components;
}
public List<UploadedComponent> Get(int uploaderID, DateTime salaryMonth)
{
List<UploadedComponent> components = new List<UploadedComponent>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader oreader = new DataReader(UploadedComponentDA.Get(tc, uploaderID, salaryMonth));
components = this.CreateObjects<UploadedComponent>(oreader);
oreader.Close();
tc.End();
if (components.Any())
{
foreach (UploadedComponent uc in components)
{
if (uc.UploadedComponentEmps == null)
uc.UploadedComponentEmps = GetUploadedComponentEmp(uc.ID);
}
}
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return components;
}
public List<UploadedComponent> GetByApprover(int approverID, DateTime salaryMonth)
{
List<UploadedComponent> components = new List<UploadedComponent>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader oreader = new DataReader(UploadedComponentDA.GetByApprover(tc, approverID, salaryMonth));
components = this.CreateObjects<UploadedComponent>(oreader);
oreader.Close();
tc.End();
if (components.Any())
{
foreach (UploadedComponent uc in components)
{
if (uc.UploadedComponentEmps == null)
uc.UploadedComponentEmps = GetUploadedComponentEmp(uc.ID);
}
}
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return components;
}
public List<UploadedComponent> GetByApprover(int approverID)
{
List<UploadedComponent> components = new List<UploadedComponent>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader oreader = new DataReader(UploadedComponentDA.GetByApprover(tc, approverID));
components = this.CreateObjects<UploadedComponent>(oreader);
oreader.Close();
tc.End();
if (components.Any())
{
foreach (UploadedComponent uc in components)
{
if (uc.UploadedComponentEmps == null)
uc.UploadedComponentEmps = GetUploadedComponentEmp(uc.ID);
}
}
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return components;
}
public DataTable GetByUploaderDT(int empID)
{
DataTable dtUploadedComponent = new DataTable();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataSet ds = UploadedComponentDA.GetByUploaderDT(tc, empID);
dtUploadedComponent = (ds != null) && (ds.Tables != null && ds.Tables.Count > 0) ? ds.Tables[0] : new DataTable();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return dtUploadedComponent;
}
public List<UploadedComponentEmp> GetUploadedComponentEmp(int componentID)
{
List<UploadedComponentEmp> componentEmps = new List<UploadedComponentEmp>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr = new DataReader(UploadedComponentDA.GetUploadedComponentEmp(tc, componentID));
componentEmps = this.CreateChilds(dr);
dr.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return componentEmps;
}
public UploadedComponent GetExistingComponent(int uploaderID, int componentID, EnumComponentType componentType, DateTime salaryMonth)
{
UploadedComponent componentSetup = new UploadedComponent();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr = new DataReader(UploadedComponentDA.GetExistingComponent(tc, uploaderID, componentID, componentType, salaryMonth));
if (dr.Read())
{
componentSetup = this.CreateObject(dr);
dr.Close();
}
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return componentSetup;
}
public void Delete(int uploadedComponentID)
{
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
UploadedComponentDA.DeleteUploadedComponentEmp(tc, uploadedComponentID);
UploadedComponentDA.Delete(tc, uploadedComponentID);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
}
public void DeleteUploadedComponentEmp(int uploadedComponentID)
{
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
UploadedComponentDA.DeleteUploadedComponentEmp(tc, uploadedComponentID);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
}
#endregion
}
}

View File

@ -716,6 +716,32 @@ namespace HRM.DA
// return bonusProcessAdjustItems;
//}
public DataSet GetEmpBonusDateRange(DateTime fromSalaryMonth, DateTime toSalaryMonth, string sEmpID)
{
DataSet oBonuses = new DataSet();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
oBonuses = BonusProcessDA.GetEmpBonusDateRange(tc, fromSalaryMonth, toSalaryMonth, sEmpID);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return oBonuses;
}
public DataSet GetBonusRegister(int bonusID, DateTime dBonusMonth, string sEmpID, int payrolltypeid)
{
DataSet oBonusRegisters = new DataSet();
@ -921,11 +947,24 @@ namespace HRM.DA
throw new ServiceException("Nothing to process.");
if (request.BonusID <= 0)
throw new ServiceException("Please select a bonus.");
if (request.EmployeeIDs == null || request.EmployeeIDs.Count == 0)
throw new ServiceException("Please select employee for the proces");
if (request.CurrProcess <= 0)
throw new ServiceException("Currently Process For Basic must be greater than zero.");
// No employee selected: a bonus with Religion(s) set (Bonus master) is processed for every Live
// employee of the current payroll type with one of those religions; without a Religion the
// employees must be selected, as before.
bool byReligion = false;
if (request.EmployeeIDs == null || request.EmployeeIDs.Count == 0)
{
BonusService bonusService = new BonusService();
if (bonusService.GetReligions(request.BonusID).Count == 0)
throw new ServiceException("Please select employee for the process");
request.EmployeeIDs = bonusService.GetReligionEmployeeIDs(request.BonusID, payrolltypeid);
if (request.EmployeeIDs.Count == 0)
throw new ServiceException("Employee not found of this bonus's religion(s).");
byReligion = true;
}
PayrollType payrollType = new PayrollTypeService().Get(payrolltypeid);
if (payrollType == null)
throw new ServiceException("Payroll type not found.");
@ -947,7 +986,9 @@ namespace HRM.DA
else empIDs.Add(id);
}
if (empIDs.Count == 0)
throw new ServiceException("The selected bonus is already processed for all the selected employees.");
throw new ServiceException(byReligion
? "The selected bonus is already processed for all the employees of its religion(s)."
: "The selected bonus is already processed for all the selected employees.");
List<Employee> employees = new EmployeeService().GetByEmpIDList(empIDs, payrolltypeid);
if (employees.Count == 0)

View File

@ -51,6 +51,76 @@ namespace HRM.DA
return oBonus;
}
#region BonusReligion
// Replaces the bonus's BonusReligion rows with oBonus.ReligionIDs ("1,3"; "" = none).
private void SaveReligions(TransactionContext tc, Bonus oBonus)
{
BonusDA.DeleteReligions(tc, oBonus.ID);
List<int> religionIDs = new List<int>();
foreach (string part in oBonus.ReligionIDs.Split(','))
{
int religionID;
if (int.TryParse(part.Trim(), out religionID) && religionID > 0 && !religionIDs.Contains(religionID))
religionIDs.Add(religionID);
}
foreach (int religionID in religionIDs)
{
int id = tc.GenerateID("BonusReligion", "BonusReligionID");
BonusDA.InsertReligion(tc, id, oBonus.ID, religionID);
}
FillReligions(tc, oBonus);
}
private void FillReligions(TransactionContext tc, Bonus oBonus)
{
List<string> ids = new List<string>();
List<string> names = new List<string>();
DataReader dr = new DataReader(BonusDA.GetReligions(tc, oBonus.ID));
while (dr.Read())
{
ids.Add(dr.GetInt32("ReligionID").Value.ToString());
names.Add(dr.GetString("Name"));
}
dr.Close();
oBonus.ReligionIDs = string.Join(",", ids);
oBonus.ReligionNames = string.Join(", ", names);
}
private void FillReligions(TransactionContext tc, List<Bonus> bonuses, int payrollTypeID)
{
if (bonuses == null || bonuses.Count == 0)
return;
Dictionary<int, List<string>> ids = new Dictionary<int, List<string>>();
Dictionary<int, List<string>> names = new Dictionary<int, List<string>>();
DataReader dr = new DataReader(BonusDA.GetReligionsByPayrollType(tc, payrollTypeID));
while (dr.Read())
{
int bonusID = dr.GetInt32("BonusID").Value;
if (!ids.ContainsKey(bonusID))
{
ids.Add(bonusID, new List<string>());
names.Add(bonusID, new List<string>());
}
ids[bonusID].Add(dr.GetInt32("ReligionID").Value.ToString());
names[bonusID].Add(dr.GetString("Name"));
}
dr.Close();
foreach (Bonus oBonus in bonuses)
{
oBonus.ReligionIDs = ids.ContainsKey(oBonus.ID) ? string.Join(",", ids[oBonus.ID]) : string.Empty;
oBonus.ReligionNames = names.ContainsKey(oBonus.ID) ? string.Join(", ", names[oBonus.ID]) : string.Empty;
}
}
#endregion
#region Service implementation
public Bonus Get(int id)
@ -68,6 +138,8 @@ namespace HRM.DA
}
oreader.Close();
if (!oBonus.IsNew)
FillReligions(tc, oBonus);
tc.End();
}
catch (Exception e)
@ -97,6 +169,8 @@ namespace HRM.DA
}
oreader.Close();
if (!oBonus.IsNew)
FillReligions(tc, oBonus);
}
catch (Exception e)
{
@ -125,6 +199,7 @@ namespace HRM.DA
DataReader dr = new DataReader(BonusDA.Get(tc, status, payrollTypeID));
bonuss = this.CreateObjects<Bonus>(dr);
dr.Close();
FillReligions(tc, bonuss, payrollTypeID);
tc.End();
}
@ -224,6 +299,9 @@ namespace HRM.DA
BonusDA.Update(tc, oBonus);
}
if (oBonus.ReligionIDs != null)
SaveReligions(tc, oBonus);
tc.End();
return oBonus.ID;
}
@ -246,6 +324,7 @@ namespace HRM.DA
try
{
tc = TransactionContext.Begin(true);
BonusDA.DeleteReligions(tc, id);
BonusDA.Delete(tc, id);
tc.End();
}
@ -292,6 +371,65 @@ namespace HRM.DA
return bonus;
}
// The religions set on this bonus (BonusReligion), as ID + Name.
public List<Religion> GetReligions(int bonusID)
{
List<Religion> religions = new List<Religion>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr = new DataReader(BonusDA.GetReligions(tc, bonusID));
while (dr.Read())
{
Religion oReligion = new Religion();
base.SetObjectID(oReligion, dr.GetInt32("ReligionID").Value);
oReligion.Name = dr.GetString("Name");
religions.Add(oReligion);
}
dr.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return religions;
}
// Live employees of the payroll type whose religion is set on the bonus (BonusReligion)
public List<int> GetReligionEmployeeIDs(int bonusID, int payrollTypeID)
{
List<int> employeeIDs = new List<int>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr = new DataReader(BonusDA.GetReligionEmployeeIDs(tc, bonusID, payrollTypeID));
while (dr.Read())
{
employeeIDs.Add(dr.GetInt32("EmployeeID").Value);
}
dr.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return employeeIDs;
}
public DataSet GetCCWiseBonusSummary(DateTime bMonthDate, string bonus)
{
DataSet obonus = new DataSet();

View File

@ -3209,6 +3209,17 @@ namespace HRM.DA
return item;
}
#region EssComponentUpload
public DataUploadColumnDefinition EssComponentUpload()
{
DataUploadColumnDefinition item = new DataUploadColumnDefinition();
item.SheetName = "ComponentUpload";
item.Add("Employee No", "String", "YES");
item.Add("Amount", "Double", "YES");
return item;
}
#endregion
#region Coordinator Upload
public DataUploadColumnDefinition CoOrdinatorInfo()
{
@ -4202,6 +4213,10 @@ namespace HRM.DA
item = this.LineManagerInfo();
item.FormText = "Upload Employee Line Manager Information";
break;
case (int)EnumRegularDataUpload.EssComponentUpload:
item = this.EssComponentUpload();
item.FormText = "Upload Component";
break;
case (int)EnumRegularDataUpload.LeaveBalance:
item = this.LeaveBalanceColumnNames();

View File

@ -526,6 +526,9 @@ namespace HRM.DA
case (int)EnumRegularDataUpload.MemberVoluntaryOpeningBalanceUpload:
this.ImportMemberVoluntaryOpeningBalance(oColumnDefination);
break;
case (int)EnumRegularDataUpload.EssComponentUpload:
this.ImportEssComponentUpload(oColumnDefination, GlobalFunctions.LastDateOfMonth(selecteDate));
break;
default:
this.ImportException(uploadId, oColumnDefination);
break;
@ -7289,6 +7292,95 @@ namespace HRM.DA
}
#endregion
#region Import EssComponentUpload
/// <summary>
/// ESS Upload Component: saves one UploadedComponent (with its employees) for the salary month and mails
/// the approver of the uploader's ComponentUploadSetup. The uploader is the logged-in employee: the
/// controller passes the UserID, so the EmployeeID is read from that user.
/// </summary>
public void ImportEssComponentUpload(DataUploadColumnDefinition _columnDefinition, DateTime salaryMonth)
{
List<Employee> oemployees = new EmployeeService().GetAllEmps();
Employee oemployee = null;
int nRow = 0;
User uploaderUser = new UserService().Get(this._userID);
if (uploaderUser == null || uploaderUser.EmployeeID == null || uploaderUser.EmployeeID <= 0)
throw new ServiceException("Only an employee login can upload a component.");
UploadedComponent uploadedComponent = new UploadedComponent();
uploadedComponent.ComponentID = (int)_columnDefinition.SelectedItemOneID;
uploadedComponent.ComponentType = (EnumComponentType)_columnDefinition.SelectedItemTwoID;
uploadedComponent.SalaryMonth = salaryMonth;
uploadedComponent.UploadedBy = (int)uploaderUser.EmployeeID;
uploadedComponent.UploadedDate = DateTime.Today;
List<UploadedComponentEmp> uploadedEmps = new List<UploadedComponentEmp>();
try
{
foreach (DataRow dr in _uplodedData.Rows)
{
nRow = nRow + 1;
oemployee = oemployees.Find(delegate (Employee emp) { return emp.EmployeeNo == dr["Employee No"].ToString(); });
if (oemployee == null)
{
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No", nRow, $"[{dr["Employee No"]}] Employee not found"));
continue;
}
if (Convert.ToDouble(dr["Amount"]) <= 0)
{
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Amount", nRow, $"[{dr["Amount"]}] Amount cannot be less than 0"));
continue;
}
uploadedEmps.Add(new UploadedComponentEmp
{
EmployeeID = oemployee.ID,
Amount = Convert.ToDouble(dr["Amount"]),
});
}
if (_errorOrSuccessList.Count == 0)
{
uploadedComponent.UploadedComponentEmps = uploadedEmps;
new UploadedComponentService().Save(uploadedComponent);
List<ComponentUploadSetup> comps = new ComponentUploadSetupService().GetByEmpIDandItemID(uploadedComponent.UploadedBy, uploadedComponent.ComponentID);
if (comps != null && comps.Count > 0)
{
Employee approver = new EmployeeService().Get(comps[0].ApproverID);
Employee uploader = new EmployeeService().Get(uploadedComponent.UploadedBy);
// the upload is saved; a missing approver address only skips the mail
if (approver != null && !string.IsNullOrEmpty(approver.EmailAddress))
{
var builder = new Microsoft.Extensions.Configuration.ConfigurationBuilder();
Microsoft.Extensions.Configuration.FileConfigurationExtensions.SetBasePath(builder, Directory.GetCurrentDirectory());
Microsoft.Extensions.Configuration.JsonConfigurationExtensions.AddJsonFile(builder, "appsettings.json");
HRM.BO.Configuration.EmailSettings emailSettings = new HRM.BO.Configuration.EmailSettings();
Microsoft.Extensions.Configuration.IConfiguration Configuration = builder.Build();
Microsoft.Extensions.Configuration.ConfigurationBinder.Bind(Configuration.GetSection("EmailSettings"), emailSettings);
MailSender mailSender = new MailSender();
mailSender.AddTo(approver.EmailAddress);
mailSender.Subject = "Approval Needed For Uploaded Component: " + comps[0].Description;
mailSender.Body = $@"<p>Dear {approver.Name},</p>
<p>Component: {comps[0].Description}, has been uploaded by {uploader?.Name} on {DateTime.Now.ToString("dd MMM yyyy hh:mm tt")}.</p>
<p>Your Approval is required.</p>
<p>Thanks</p>";
mailSender.ThreadSendMail(emailSettings);
}
}
}
}
catch (Exception ex)
{
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
}
}
#endregion
#endregion
protected override T CreateObject<T>(Ease.Core.DataAccess.DataReader dr)

View File

@ -489,6 +489,7 @@ namespace HRM.DA
List<EmployeeGradeSalary> arrearItems = new EmployeeGradeSalaryService().GetArrearItems(this.PayrollTypeID);
foreach (SalaryMonthly salary in _salaryMonthlys)
{
UpdateProgressStatus(EnumProcessStatus.PerformStep); // progress signal only (2nd loop of this phase); changes nothing
arrearAmount = 0;
salary.ArrearGradeSalaries = arrearItems.FindAll(x => x.EmployeeID == salary.EmployeeID);
foreach (EmployeeGradeSalary arrearItem in salary.ArrearGradeSalaries)
@ -703,6 +704,9 @@ namespace HRM.DA
double arrgrossamount = 0, arrrcvgross = 0;
foreach (SalaryMonthly sMonthly in _salaryMonthlys)
{
if (sMonthly.Details.Any(x => x.IsOnBalancing == true) == false) continue;
grossamount = 0; rcvgross = 0; nProjectAmount = 0;
arrgrossamount = 0; arrrcvgross = 0;
foreach (EmployeeGradeSalary item in sMonthly.GradeSalaries)
@ -936,7 +940,8 @@ namespace HRM.DA
ADParameter adParam = _adParameters.Find(x => x.ID == emp.ADParameterID);
if (adParam != null)
{
emp.AllowanceType=adParam.AllowanceType;
emp.AllowanceType = _allowdeducitons.FirstOrDefault(x => x.ID == adParam.AllowDeductID)?.AllowanceType
?? EnumAllowanceType.Utilities_Other;
emp.IsOnBalancing=adParam.IsOnBalancing;
}
@ -968,8 +973,8 @@ namespace HRM.DA
item.AllowDeduct = _allowdeducitons.FirstOrDefault(x => x.ID == item.AllowDeductID);
amount = 0;
ADParameter parameter = _adParameters.FirstOrDefault(x => x.ID == item.ADParameterID);
parameter.AllowanceDeduction = _allowdeducitons.FirstOrDefault(x => x.ID == item.AllowDeductID);
if (parameter == null) continue;
parameter.AllowanceDeduction = _allowdeducitons.FirstOrDefault(x => x.ID == item.AllowDeductID);
amount = new ADParameterService().GetIndividualAmount(salary.Employee, _processMonth, item,
salary.Employee.GrossSalary,
@ -1016,9 +1021,10 @@ namespace HRM.DA
if (detail != null)
{
if (parameter.AllowanceType == EnumAllowanceType.HouseRent ||
parameter.AllowanceType == EnumAllowanceType.Medical ||
parameter.AllowanceType == EnumAllowanceType.Conveynce)
EnumAllowanceType allowanceType = parameter.AllowanceDeduction?.AllowanceType ?? EnumAllowanceType.Non_Gross;
if (allowanceType == EnumAllowanceType.HouseRent ||
allowanceType == EnumAllowanceType.Medical ||
allowanceType == EnumAllowanceType.Conveynce)
{
if (groupCode != EnumSalaryGroup.Arrear)
@ -1060,9 +1066,10 @@ namespace HRM.DA
amount = new ADParameterService().GetGradeDefinedAmount(salary.Employee, empGradeSalary.BasicSalary, empGradeSalary.GrossSalary, empGradeSalary, parameter);
if ((parameter.AllowanceType == EnumAllowanceType.HouseRent && gCode == EnumSalaryGroup.Gross) ||
(parameter.AllowanceType == EnumAllowanceType.Medical && gCode == EnumSalaryGroup.Gross) ||
(parameter.AllowanceType == EnumAllowanceType.Conveynce && gCode == EnumSalaryGroup.Gross))
EnumAllowanceType allowanceType = parameter.AllowanceDeduction.AllowanceType;
if ((allowanceType == EnumAllowanceType.HouseRent && gCode == EnumSalaryGroup.Gross) ||
(allowanceType == EnumAllowanceType.Medical && gCode == EnumSalaryGroup.Gross) ||
(allowanceType == EnumAllowanceType.Conveynce && gCode == EnumSalaryGroup.Gross))
{
double nAmt = new ADParameterService().GetGradeDefinedAmountForMonth(salary.Employee, salary.ThisMonthBasic, salary.ThisMonthGross, empGradeSalary, parameter, 1);
salary.ActualPassegeFreeAmount += nAmt;
@ -1102,7 +1109,7 @@ namespace HRM.DA
if (detail != null)
detail.Position = parameter.AllowanceDeduction.Sequence + 1;
detail.AllowanceType = parameter.AllowanceType;
detail.AllowanceType = parameter.AllowanceDeduction.AllowanceType;
detail.IsOnBalancing= parameter.IsOnBalancing;

View File

@ -655,6 +655,31 @@ namespace HRM.DA
return oSalaryMonthlys;
}
public DataSet GetEmpPaySlipDateRangeMonthWise(DateTime fromSalaryMonth, DateTime toSalaryMonth, string sEmpID)
{
DataSet oSalaryMonthlys = new DataSet();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
oSalaryMonthlys = SalaryMonthlyDA.GetEmpPaySlipDateRangeMonthWise(tc, fromSalaryMonth, toSalaryMonth, sEmpID);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return oSalaryMonthlys;
}
public DataSet GetEmpPaySlipDeductForCitiOthers(DateTime dateTime, string sEmpID)
{
DataSet oSalaryMonthlys = new DataSet();
@ -2658,6 +2683,15 @@ namespace HRM.DA
// }
//}
public void Save(SalaryProcess process, List<SalaryMonthly> items)
{
this.Save(process, items, null);
}
/// <summary>
/// Same save as Save(process, items); only reports how far it got to <paramref name="progress"/> (null = nobody listens,
/// which is exactly the original behaviour). Reporting never changes or stops the save (TryReport swallows faults).
/// </summary>
public void Save(SalaryProcess process, List<SalaryMonthly> items, IJobProgress progress)
{
TransactionContext tc = null;
try
@ -2683,8 +2717,9 @@ namespace HRM.DA
{
x.SalaryProcessID = processId;
});
this.SaveBulk(tc, items);
this.SaveBulk(tc, items, progress != null ? new JobProgressScope(progress, 0, 95) : null);
}
progress.TryReport(95, "Committing salary data");
tc.End();
}
catch (Exception e)
@ -2702,11 +2737,51 @@ namespace HRM.DA
public void SaveBulk(TransactionContext tc, List<SalaryMonthly> items)
{
this.SaveBulk(tc, items, null);
}
/// <summary>
/// Progress (0 - 100) at the start of each of SaveBulk's four blocks, weighted by the rows each block writes
/// (salary rows, detail rows, tax rows, cost-center rows). Only reads counts; never throws (falls back to even steps).
/// </summary>
private static double[] SaveBulkProgressSteps(List<SalaryMonthly> items, IJobProgress progress)
{
double[] even = { 0, 25, 50, 75 };
if (progress == null)
return even;
try
{
double master = items.Count;
double details = items.Sum(x => x.Details != null ? x.Details.Count : 0);
double taxes = items.Sum(x => x.Incometaxes != null ? x.Incometaxes.Count : 0);
double costs = items.Sum(x => x.CostCentersInvolments != null ? x.CostCentersInvolments.Count : 0);
double all = master + details + taxes + costs;
if (all <= 0)
return even;
return new[]
{
0,
100 * master / all,
100 * (master + details) / all,
100 * (master + details + taxes) / all
};
}
catch
{
return even;
}
}
/// <summary>Same bulk save; reports 0 - 100 of its four blocks (weighted by row count) to <paramref name="progress"/>.</summary>
public void SaveBulk(TransactionContext tc, List<SalaryMonthly> items, IJobProgress progress)
{
try
{
if (items.Count > 0)
{
double[] saveSteps = SaveBulkProgressSteps(items, progress);
progress.TryReport(saveSteps[0], "Saving salary records", null, 0, items.Count);
int salaryPKID = tc.GenerateID("SalaryMonthly", "SalaryMonthlyID");
DataTable attnProcessEntryTable = new DataTable("SalaryMonthly");
attnProcessEntryTable.Columns.Add(new DataColumn("SALARYMONTHLYID", typeof(int)));
@ -2845,6 +2920,7 @@ namespace HRM.DA
bulkCopy.DestinationTableName = "SALARYMONTHLY";
bulkCopy.WriteToServer(attnProcessEntryTable);
progress.TryReport(saveSteps[1], "Saving salary details");
}
@ -2902,6 +2978,7 @@ namespace HRM.DA
bulkCopy.DestinationTableName = "SALARYMONTHLYDETAIL";
bulkCopy.WriteToServer(detailtable);
progress.TryReport(saveSteps[2], "Saving income tax data");
}
@ -2970,6 +3047,7 @@ namespace HRM.DA
bulkCopy.DestinationTableName = "SALARYTEMPIT";
bulkCopy.WriteToServer(tax);
progress.TryReport(saveSteps[3], "Saving cost-center data");
}
@ -3005,6 +3083,7 @@ namespace HRM.DA
bulkCopy.DestinationTableName = "SALARYEMPCOSTCENTER";
bulkCopy.WriteToServer(cost);
progress.TryReport(100, "Saving cost-center data");
}
}

View File

@ -0,0 +1,287 @@
using HRM.BO;
using System;
using System.Collections.Concurrent;
using System.Diagnostics;
namespace HRM.DA
{
/// <summary>
/// Real progress of the salary process for an IJobProgress listener. It only WATCHES the process: it reads the
/// events SalaryCalculator raises and never touches a salary, an employee or a query. Every entry point is wrapped
/// in try/catch, so a fault here can never stop or change the calculation.
///
/// The run is split into stages, in the exact order they happen:
/// Validating -> Preparing calculation (SalaryCalculator ctor, approval check, Process() set-up + Initialize)
/// -> the calculation phases up to leave days -> Salary exception -> Net income -> Saving.
/// A calculation phase starts with the ProgressStatus Start event (its first statement in SalaryCalculator) and
/// moves one step per PerformStep (one per employee / salary row; Basic salary has two such loops).
/// "Salary exception" has no events of its own: it is recognised by the status message Process() already sends.
///
/// How much of the bar each stage gets is LEARNED: every successful run measures how long each stage really took
/// (per payroll type, in memory), and the next run splits the bar in those proportions - so the bar moves at an even
/// pace and the ETA is real. The first run (and the first after an app restart) uses default proportions.
/// 0 - 1 % is "Loading employees", reported by the caller before this class exists.
/// </summary>
internal sealed class SalaryProcessProgress
{
private const double StartPercent = 1; // 0 - 1 %: loading employees (caller)
private const double MinStageShare = 0.004; // a learned stage never gets less than 0.4 % of the bar
// Calculation phases, in the order of the Start events in SalaryCalculator.Process.
private static readonly string[] PhaseNames =
{
"Collecting employee information",
"Calculating basic salary",
"Calculating benefits and deductions",
"Calculating overtime",
"Calculating bonus",
"Calculating unauthorized leave deduction",
"Calculating PF & CPF",
"Calculating on-balance salary",
"Calculating income tax",
"Preparing cost-center data",
"Calculating loan installments",
"Calculating attendance days",
"Calculating leave days",
"Calculating net income"
};
// Loops (of one step per salary row) a phase runs; Basic salary also loops for arrears. On-balance raises
// no steps (it only gets its Start), so its slice fills when the next phase starts.
private static readonly int[] PhaseLoops = { 1, 2, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 };
// Stages = Validating, Preparing, every phase but the last, Salary exception, the last phase (net income), Saving.
// Salary exception runs between leave days and net income and has no Start event of its own.
private static readonly int LastPhase = PhaseNames.Length - 1; // net income
private const int StageValidating = 0;
private const int StagePreparing = 1;
private const int StageFirstPhase = 2; // phase p (< LastPhase) -> stage 2 + p
private static readonly int StageSalaryException = StageFirstPhase + LastPhase;
private static readonly int StageNetIncome = StageSalaryException + 1;
private static readonly int StageSaving = StageNetIncome + 1;
private static readonly int StageCount = StageSaving + 1;
private static readonly double[] DefaultWeights = BuildDefaultWeights();
// Measured seconds per stage of the last successful run, per payroll type, with that run's employee count.
// Fixed set-up costs weigh differently in a 5-employee run than in a 5,000-employee one, so a measurement is
// only reused for a run of a similar size, and only runs of a meaningful size are learned from.
private static readonly ConcurrentDictionary<int, LearnedRun> LearnedRuns = new ConcurrentDictionary<int, LearnedRun>();
private const int MinEmployeesToLearn = 20;
private const double MaxSizeRatio = 4;
private sealed class LearnedRun
{
public int EmployeeCount;
public double[] Seconds;
}
private const string EmployeeMessagePrefix = "Collecting information for the employee";
private const string SalaryExceptionMessage = "Salary Exception";
private readonly IJobProgress _progress;
private readonly int _payrollTypeId;
private readonly int _employeeCount;
private readonly double[] _stageStart; // percent where each stage begins
private readonly double[] _stageShare; // percent each stage spans
private readonly double[] _secondsSpent;
private readonly Stopwatch _clock = Stopwatch.StartNew();
private int _stage = -1;
private double _stageEnteredAt;
private int _phase = -1;
private int _step;
private string _detail;
public SalaryProcessProgress(IJobProgress progress, int payrollTypeId, int employeeCount)
{
_progress = progress;
_payrollTypeId = payrollTypeId;
_employeeCount = Math.Max(1, employeeCount);
_secondsSpent = new double[StageCount];
double[] weights = WeightsFor(payrollTypeId, _employeeCount);
double total = 0;
foreach (double w in weights) total += w;
_stageStart = new double[StageCount];
_stageShare = new double[StageCount];
double at = StartPercent;
for (int i = 0; i < StageCount; i++)
{
_stageShare[i] = (100 - StartPercent) * weights[i] / total;
_stageStart[i] = at;
at += _stageShare[i];
}
}
public void Validating()
{
Safe(() => Enter(StageValidating, "Validating salary data"));
}
/// <summary>From here until the first calculation phase starts: calculator set-up, approval check, Initialize.</summary>
public void Preparing()
{
Safe(() => Enter(StagePreparing, "Preparing calculation"));
}
public void Attach(SalaryCalculator calculator)
{
calculator.ProgressStatus += OnProgressStatus;
calculator.ProcessStatus += OnProcessStatus;
}
/// <summary>The save reports its own 0 - 100 through this; it lands in the Saving slice of the bar.</summary>
public IJobProgress Saving()
{
Safe(() => Enter(StageSaving, "Saving salary data"));
return new JobProgressScope(_progress, _stageStart[StageSaving], _stageStart[StageSaving] + _stageShare[StageSaving]);
}
/// <summary>The run finished successfully: remember how long each stage took, for the next run's proportions.</summary>
public void Completed()
{
Safe(() =>
{
CloseStage();
double[] measured = (double[])_secondsSpent.Clone();
double sum = 0;
foreach (double s in measured) sum += s;
if (sum > 0 && _employeeCount >= MinEmployeesToLearn)
LearnedRuns[_payrollTypeId] = new LearnedRun { EmployeeCount = _employeeCount, Seconds = measured };
});
}
private void OnProcessStatus(string message)
{
Safe(() =>
{
if (string.IsNullOrEmpty(message))
{
_detail = null;
return;
}
string text = message.Trim();
if (text.StartsWith(EmployeeMessagePrefix, StringComparison.OrdinalIgnoreCase))
{
_detail = text.Substring(EmployeeMessagePrefix.Length).Trim();
}
else if (text.IndexOf(SalaryExceptionMessage, StringComparison.OrdinalIgnoreCase) >= 0)
{
// Sent by Process() just before SalaryExceptionCalculation, i.e. after leave days, before net income.
Enter(StageSalaryException, "Calculating salary exception");
}
else
{
_detail = null;
}
});
}
private void OnProgressStatus(EnumProcessStatus status)
{
Safe(() =>
{
if (status == EnumProcessStatus.Start)
{
_phase++;
_step = 0;
_detail = null;
int phase = Math.Min(_phase, PhaseNames.Length - 1);
Enter(StageOf(phase), PhaseNames[phase]);
}
else if (status == EnumProcessStatus.PerformStep)
{
_step++;
PublishPhase();
}
// End needs nothing: the next Start / stage moves the bar on.
});
}
private void PublishPhase()
{
if (_phase < 0)
return;
int phase = Math.Min(_phase, PhaseNames.Length - 1);
if (PhaseLoops[phase] == 0)
return; // a phase without steps stays at its start until the next stage
int stage = StageOf(phase);
int expected = _employeeCount * PhaseLoops[phase];
double inside = Math.Min((double)_step / expected, 0.999);
int shown = Math.Min(_step, expected);
// A two-loop phase counts each employee twice; show employees, not loop steps.
int employeesDone = PhaseLoops[phase] > 1 ? Math.Min(_employeeCount, (int)Math.Ceiling((double)shown / PhaseLoops[phase])) : shown;
_progress.Report(_stageStart[stage] + _stageShare[stage] * inside, PhaseNames[phase], _detail, employeesDone, _employeeCount);
}
private static int StageOf(int phase)
{
return phase < LastPhase ? StageFirstPhase + phase : StageNetIncome;
}
private void Enter(int stage, string name)
{
if (stage == _stage)
return;
CloseStage();
_stage = stage;
_stageEnteredAt = _clock.Elapsed.TotalSeconds;
_progress.Report(_stageStart[stage], name, null, null, null);
}
private void CloseStage()
{
if (_stage < 0)
return;
double now = _clock.Elapsed.TotalSeconds;
_secondsSpent[_stage] += Math.Max(0, now - _stageEnteredAt);
_stageEnteredAt = now;
}
private static double[] WeightsFor(int payrollTypeId, int employeeCount)
{
if (!LearnedRuns.TryGetValue(payrollTypeId, out LearnedRun run) || run?.Seconds == null || run.Seconds.Length != StageCount)
return DefaultWeights;
double ratio = (double)Math.Max(employeeCount, 1) / Math.Max(run.EmployeeCount, 1);
if (ratio > MaxSizeRatio || ratio < 1 / MaxSizeRatio)
return DefaultWeights;
double[] seconds = run.Seconds;
double total = 0;
foreach (double s in seconds) total += s;
if (total <= 0)
return DefaultWeights;
double[] weights = new double[StageCount];
for (int i = 0; i < StageCount; i++)
weights[i] = Math.Max(seconds[i] / total, MinStageShare);
return weights;
}
private static double[] BuildDefaultWeights()
{
// Used until a run has been measured: small set-up stages, equal calculation phases, a tenth for saving.
double[] w = new double[StageCount];
w[StageValidating] = 2;
w[StagePreparing] = 3;
for (int p = 0; p < LastPhase; p++) w[StageFirstPhase + p] = 6.5;
w[StageSalaryException] = 0.5;
w[StageNetIncome] = 6.5;
w[StageSaving] = 10;
return w;
}
private static void Safe(Action action)
{
try
{
action();
}
catch
{
// progress only watches the salary process; it must never be able to break it
}
}
}
}

View File

@ -339,16 +339,62 @@ namespace HRM.DA
}
return errorList;
}
// Salary Process screen, no employee selected but a Category: the Live employees of the payroll type in
// that category whose salary of the month is not processed yet (the employee picker leaves those out too)
public List<int> GetCategoryEmployeeIDs(int categoryID, int payrollTypeID, DateTime salaryMonth)
{
List<int> employeeIDs = new List<int>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr = new DataReader(SalaryProcessDA.GetCategoryEmployeeIDs(tc, categoryID, payrollTypeID, salaryMonth));
while (dr.Read())
{
employeeIDs.Add(dr.GetInt32("EmployeeID").Value);
}
dr.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return employeeIDs;
}
public List<SalaryProcessStatus> SalaryProcess(SalaryProcess item, List<Employee> employees)
{
return this.SalaryProcess(item, employees, null);
}
/// <summary>
/// The salary process, reporting real progress to <paramref name="progress"/> (null = nobody listens, which is
/// exactly the original behaviour). Only listeners are added; the calculation and the save are untouched.
/// </summary>
public List<SalaryProcessStatus> SalaryProcess(SalaryProcess item, List<Employee> employees, IJobProgress progress)
{
try
{
// Progress only watches (see SalaryProcessProgress); with progress == null none of these lines do anything.
SalaryProcessProgress tracker = progress != null
? new SalaryProcessProgress(progress, item.PayrollTypeID, employees != null ? employees.Count : 0)
: null;
if (tracker != null) tracker.Validating();
bool IsFinantialAprovalRequired = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "finantialaproval", "finantialaprovalrequired");
string msg = String.Empty;
var items = this.SalaryValidation(item, employees);
if (items.Count != 0) return items;
if (tracker != null) tracker.Preparing();
SalaryCalculator calculator = new SalaryCalculator();
if (tracker != null) tracker.Attach(calculator);
if (IsFinantialAprovalRequired)
{
List<SalaryProcessStatus> salaryProcessStatusList = new List<SalaryProcessStatus>();
@ -361,7 +407,11 @@ namespace HRM.DA
calculator.Process(employees, item.SalaryMonth, item.PayrollTypeID, item.EuroRate);
if (calculator.ErrorList.Count == 0)
new SalaryMonthlyService().Save(item, calculator.SalaryMonthlies);
{
IJobProgress saveProgress = tracker != null ? tracker.Saving() : null;
new SalaryMonthlyService().Save(item, calculator.SalaryMonthlies, saveProgress);
if (tracker != null) tracker.Completed();
}
//salaryProcessStatusList.ForEach(item => calculator.ErrorList.Add(item));
return calculator.ErrorList;
}

View File

@ -5,6 +5,7 @@ using HRM.BO;
using Ease.Core.Utility;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using Ease.Core;
using Payroll.Service;
using Microsoft.Data.SqlClient;
@ -1372,9 +1373,11 @@ namespace HRM.DA
{
pscFreeIime = item;
}
if (param.AllowanceType ==EnumAllowanceType.HouseRent ||
param.AllowanceType == EnumAllowanceType.Medical ||
param.AllowanceType == EnumAllowanceType.Conveynce)
EnumAllowanceType allowanceType = taxCalculator.AllowanceDeductions
.FirstOrDefault(x => x.ID == param.AllowDeductID)?.AllowanceType ?? EnumAllowanceType.Non_Gross;
if (allowanceType == EnumAllowanceType.HouseRent ||
allowanceType == EnumAllowanceType.Medical ||
allowanceType == EnumAllowanceType.Conveynce)
{
ADParameter adParam = new ADParameterService().GetApplicableParameter(oEmp, salaries.GradeID,

View File

@ -675,11 +675,73 @@ namespace HRM.DA
#endregion
}
if (ouser.UserType == EnumUserType.Employee)
ApplyComponentUploadMenuRestrictions(menus, ouser.EmployeeID ?? 0);
SortMenuTree(menus);
ApplyMenuStyles(menus);
return menus;
}
#region Component Upload menus (self-service)
/// <summary>ESS Upload Component page (shown only to an uploader of a ComponentUploadSetup).</summary>
public const string ComponentUploaderLink = "ess/component-uploader";
/// <summary>ESS Component Approval page (shown only to an approver of a ComponentUploadSetup).</summary>
public const string ComponentApprovalLink = "ess/component-approval";
/// <summary>
/// As GP: the Upload Component and Component Approval menus need more than the role permission; the
/// employee must also be an uploader / approver in ComponentUploadSetup. The menus are found by their
/// link, not by their key, so each client's Menu XML may number them as it likes. A head left with no
/// child (and no link of its own) is removed as well. Never breaks the menu loading.
/// </summary>
private void ApplyComponentUploadMenuRestrictions(List<WebMenuHead> menus, int employeeId)
{
try
{
bool hasUploadMenu = menus.Any(h => IsLink(h.routerLink, ComponentUploaderLink)
|| (h.items != null && h.items.Any(g => IsLink(g.routerLink, ComponentUploaderLink))));
bool hasApprovalMenu = menus.Any(h => IsLink(h.routerLink, ComponentApprovalLink)
|| (h.items != null && h.items.Any(g => IsLink(g.routerLink, ComponentApprovalLink))));
if (!hasUploadMenu && !hasApprovalMenu)
return;
List<string> hidden = new List<string>();
if (hasUploadMenu && !(employeeId > 0 && new ComponentUploadSetupService().HasUploaderSetup(employeeId)))
hidden.Add(ComponentUploaderLink);
if (hasApprovalMenu && !(employeeId > 0 && new ComponentUploadSetupService().HasApproverSetup(employeeId)))
hidden.Add(ComponentApprovalLink);
if (hidden.Count == 0)
return;
foreach (WebMenuHead head in menus.ToList())
{
if (hidden.Any(l => IsLink(head.routerLink, l)))
{
menus.Remove(head);
continue;
}
if (head.items == null) continue;
int removed = head.items.RemoveAll(g => hidden.Any(l => IsLink(g.routerLink, l)));
if (removed > 0 && head.items.Count == 0 && string.IsNullOrWhiteSpace(head.routerLink))
menus.Remove(head);
}
}
catch (Exception e)
{
ExceptionLog.Write(e);
}
}
private static bool IsLink(string routerLink, string link)
{
return !string.IsNullOrWhiteSpace(routerLink)
&& string.Equals(routerLink.Trim().Trim('/'), link, StringComparison.OrdinalIgnoreCase);
}
#endregion
// Icons come entirely from RolePermission.Icon (sourced from the uploaded Menu.xml's
// menuIcon attribute, see SystemConfigarationDA.UpdateRolePermission) and were already
// applied when each node was created above; a node with no DB icon simply keeps the

View File

@ -716,6 +716,259 @@ namespace HRM.Report
return reportProcessor.ShowDlgForNewPaySlip(null, basicInfo,oFDST, payrollTypeID);
}
#region Date Range Wise Salary Sheet
/// <summary>
/// Date Range Wise Salary Sheet (report 4101): a salary-sheet style matrix of every salary month of each
/// employee between fromMonth and toMonth - one row per employee per salary month, one column per
/// salary head (the columns come from the data, they are not fixed), then Total Gross, the
/// deduction heads, Total Deduction and Net Pay, with a grand total at the bottom.
/// With includeBonus, every bonus whose bonus month or disburse date falls in the range is added
/// too: one column per bonus and a Bonus Tax column next to Income Tax (see BonusProcessDA.GetEmpBonusDateRange).
/// Rendered from the embedded RDLC DateRangeWiseSalarySheet.rdlc, the way the salary sheet (report 54) is.
/// </summary>
public byte[] ShowReportDateRange(int payrollTypeID, DateTime fromMonth, DateTime toMonth, string sEmpID, string reportType, bool includeBonus)
{
DateTime fromSalaryMonth = GlobalFunctions.LastDateOfMonth(fromMonth);
DateTime toSalaryMonth = GlobalFunctions.LastDateOfMonth(toMonth);
if (fromSalaryMonth > toSalaryMonth)
{
throw new Exception("From month can not be greater than To month.");
}
DataTable oItems = new SalaryMonthlyService().GetEmpPaySlipDateRangeMonthWise(fromSalaryMonth, toSalaryMonth, sEmpID).Tables[0];
DataTable oBonuses = includeBonus
? new BonusProcessService().GetEmpBonusDateRange(fromSalaryMonth, toSalaryMonth, sEmpID).Tables[0]
: null;
if (oItems.Rows.Count <= 0 && (oBonuses == null || oBonuses.Rows.Count <= 0))
{
return null;
}
DataTable dtSalarySheet = this.GetDateRangeSalarySheetTable(oItems, oBonuses, fromSalaryMonth, toSalaryMonth);
dtSalarySheet.TableName = "DateRangeSalarySheet";
DataSet resultDataSet = new DataSet();
resultDataSet.Tables.Add(dtSalarySheet);
string salarySheetPeriod = fromSalaryMonth.Year == toSalaryMonth.Year && fromSalaryMonth.Month == toSalaryMonth.Month
? "Salary Sheet for the month of " + toSalaryMonth.ToString("MMMM yyyy")
: "Salary Sheet for the period of " + fromSalaryMonth.ToString("MMMM yyyy") + " to " + toSalaryMonth.ToString("MMMM yyyy");
List<ReportParameter> extraParams = new List<ReportParameter>();
extraParams.Add(new ReportParameter("SalarySheetPeriod", salarySheetPeriod));
ReportProcessor reportProcessor = new ReportProcessor();
return reportProcessor.CommonReportView(null, "HRM.Report.RDLC.DateRangeWiseSalarySheet.rdlc", resultDataSet, null, extraParams, true, payrollTypeID, reportType);
}
/// <summary>
/// Turns the item rows of GetEmpPaySlipDateRangeMonthWise (and, when given, the bonus rows of
/// GetEmpBonusDateRange) into the matrix rows: for every employee and month, one row per column
/// (0 where that month has no such head). Salary columns are keyed by ItemGroup|ItemCode|ItemID,
/// not by description, because an arrear and an unauthorized-leave row carry the same description
/// as the gross head ("Basic"); bonus columns are keyed by BonusID.
/// Total Gross = gross + arrear - unauthorized leave + bonus; Total Deduction = deductions + bonus tax;
/// Net Pay = the processed Net Payable (5 / -132) + bonus - bonus tax.
/// A bonus goes on the row of its bonus month when that month is in the range, otherwise on the row
/// of its disburse month.
/// </summary>
private DataTable GetDateRangeSalarySheetTable(DataTable oItems, DataTable oBonuses, DateTime fromSalaryMonth, DateTime toSalaryMonth)
{
int grossGroup = (int)EnumSalaryGroup.Gross;
int unauthGroup = (int)EnumSalaryGroup.UnauthLeave;
int deductGroup = (int)EnumSalaryGroup.Deductions;
int arrearGroup = (int)EnumSalaryGroup.Arrear;
const string unauthKey = "UNAUTHLEAVE", totalGrossKey = "TOTALGROSS", totalDeductionKey = "TOTALDEDUCTION", netPayKey = "NETPAY";
const string bonusKeyPrefix = "BONUS|", bonusTaxKey = "BONUSTAX";
DataTable dt = new DataTable();
dt.Columns.Add("EmpNo", typeof(string));
dt.Columns.Add("EmpName", typeof(string));
dt.Columns.Add("Grade", typeof(string));
dt.Columns.Add("Department", typeof(string));
dt.Columns.Add("SalaryMonth", typeof(DateTime));
dt.Columns.Add("JoiningDate", typeof(DateTime));
dt.Columns.Add("ActualBasic", typeof(double));
dt.Columns.Add("ColumnKey", typeof(string));
dt.Columns.Add("ColumnName", typeof(string));
dt.Columns.Add("ColumnSequence", typeof(int));
dt.Columns.Add("Amount", typeof(double));
List<DataRow> itemRows = oItems.AsEnumerable().Where(r => r["ITEMGROUP"] != DBNull.Value).ToList();
// every head that has a non-zero amount somewhere in the range; the description of the latest month
var heads = itemRows
.GroupBy(r => new { Group = Convert.ToInt32(r["ITEMGROUP"]), Code = Convert.ToInt32(r["ItemCode"]), ID = Convert.ToInt32(r["ItemID"]) })
.Select(g => new
{
g.Key.Group,
g.Key.Code,
g.Key.ID,
Key = g.Key.Group + "|" + g.Key.Code + "|" + g.Key.ID,
Description = Convert.ToString(g.OrderBy(r => Convert.ToDateTime(r["SalaryMonth"])).Last()["Description"]),
Position = g.Min(r => r["Position"] == DBNull.Value ? int.MaxValue : Convert.ToInt32(r["Position"])),
HasAmount = g.Any(r => Convert.ToDouble(r["CHANGEDAMOUNT"]) != 0)
})
.Where(h => h.HasAmount)
.ToList();
// bonus rows with the salary month (row) each one belongs to
DateTime fromDate = new DateTime(fromSalaryMonth.Year, fromSalaryMonth.Month, 1);
var bonuses = (oBonuses == null ? new List<DataRow>() : oBonuses.AsEnumerable().ToList())
.Select(r =>
{
DateTime bonusMonth = Convert.ToDateTime(r["BonusMonth"]);
bool bonusMonthInRange = bonusMonth >= fromDate && bonusMonth <= toSalaryMonth.AddDays(1).AddTicks(-1);
return new
{
Row = r,
EmpNo = Convert.ToString(r["EMPLOYEENO"]),
Month = GlobalFunctions.LastDateOfMonth(bonusMonthInRange ? bonusMonth : Convert.ToDateTime(r["DisburseDate"])),
Key = bonusKeyPrefix + Convert.ToInt32(r["BonusID"]),
Name = Convert.ToString(r["BonusName"]),
Amount = r["ChangeBonusAmount"] == DBNull.Value ? 0 : Convert.ToDouble(r["ChangeBonusAmount"]),
Tax = r["ChangeTaxAmount"] == DBNull.Value ? 0 : Convert.ToDouble(r["ChangeTaxAmount"])
};
})
.Where(b => b.Amount != 0 || b.Tax != 0)
.ToList();
#region Column order
List<KeyValuePair<string, string>> columns = new List<KeyValuePair<string, string>>();
// earnings: Basic first, then the salary position; each head's arrear right after it
foreach (var head in heads.Where(h => h.Group == grossGroup)
.OrderBy(h => h.Code == (int)EnumSalaryItemCode.Basic_Salary ? 0 : 1)
.ThenBy(h => h.Position).ThenBy(h => h.Description))
{
columns.Add(new KeyValuePair<string, string>(head.Key, head.Description));
var arrear = heads.FirstOrDefault(h => h.Group == arrearGroup && h.Code == head.Code && h.ID == head.ID);
if (arrear != null)
columns.Add(new KeyValuePair<string, string>(arrear.Key, GetArrearColumnName(arrear.Description)));
}
// an arrear whose head is not paid in the range
foreach (var arrear in heads.Where(h => h.Group == arrearGroup && !columns.Any(c => c.Key == h.Key))
.OrderBy(h => h.Position).ThenBy(h => h.Description))
{
columns.Add(new KeyValuePair<string, string>(arrear.Key, GetArrearColumnName(arrear.Description)));
}
// one column per bonus, in the order they were paid
foreach (var bonus in bonuses.GroupBy(b => b.Key).OrderBy(g => g.Min(b => b.Month)).ThenBy(g => g.Key))
{
columns.Add(new KeyValuePair<string, string>(bonus.Key, bonus.OrderBy(b => b.Month).Last().Name));
}
if (heads.Any(h => h.Group == unauthGroup))
columns.Add(new KeyValuePair<string, string>(unauthKey, "Unauthorized Leave"));
columns.Add(new KeyValuePair<string, string>(totalGrossKey, "Total Gross"));
// deductions: Income Tax (then Bonus Tax), PF, then the salary position
bool bonusTaxAdded = bonuses.Count == 0;
foreach (var head in heads.Where(h => h.Group == deductGroup)
.OrderBy(h => h.Code == (int)EnumSalaryItemCode.Inc_Tax_Deduction ? 0 : h.Code == (int)EnumSalaryItemCode.PF_Contribution ? 1 : 2)
.ThenBy(h => h.Position).ThenBy(h => h.Description))
{
if (!bonusTaxAdded && head.Code != (int)EnumSalaryItemCode.Inc_Tax_Deduction)
{
columns.Add(new KeyValuePair<string, string>(bonusTaxKey, "Bonus Tax"));
bonusTaxAdded = true;
}
columns.Add(new KeyValuePair<string, string>(head.Key, head.Description));
}
if (!bonusTaxAdded)
columns.Add(new KeyValuePair<string, string>(bonusTaxKey, "Bonus Tax"));
columns.Add(new KeyValuePair<string, string>(totalDeductionKey, "Total Deduction"));
columns.Add(new KeyValuePair<string, string>(netPayKey, "Net Pay"));
#endregion
var salaryMonths = oItems.AsEnumerable()
.GroupBy(r => new { EmpNo = Convert.ToString(r["EMPLOYEENO"]), Month = Convert.ToDateTime(r["SalaryMonth"]) })
.ToDictionary(g => g.Key, g => g.ToList());
// a bonus can fall in a month with no salary: that month still gets its row
var rowKeys = salaryMonths.Keys
.Union(bonuses.Select(b => new { b.EmpNo, b.Month }))
.ToList();
foreach (var rowKey in rowKeys)
{
List<DataRow> salaryRows = salaryMonths.ContainsKey(rowKey) ? salaryMonths[rowKey] : new List<DataRow>();
var monthBonuses = bonuses.Where(b => b.EmpNo == rowKey.EmpNo && b.Month == rowKey.Month).ToList();
// employee information: this month's salary row, else the employee's latest salary row in the
// range, else the bonus row (employee master)
DataRow info = salaryRows.FirstOrDefault()
?? oItems.AsEnumerable().Where(r => Convert.ToString(r["EMPLOYEENO"]) == rowKey.EmpNo)
.OrderBy(r => Convert.ToDateTime(r["SalaryMonth"])).LastOrDefault()
?? monthBonuses.First().Row;
double actualBasic = salaryRows.Count > 0
? (salaryRows[0]["ActualBasic"] == DBNull.Value ? 0 : Convert.ToDouble(salaryRows[0]["ActualBasic"]))
: (monthBonuses[0].Row["BasicSalary"] == DBNull.Value ? 0 : Convert.ToDouble(monthBonuses[0].Row["BasicSalary"]));
Dictionary<string, double> amounts = new Dictionary<string, double>();
double totalGross = 0, totalDeduction = 0, unauthLeave = 0;
double? netPay = null;
foreach (DataRow r in salaryRows.Where(r => r["ITEMGROUP"] != DBNull.Value))
{
int group = Convert.ToInt32(r["ITEMGROUP"]);
int code = Convert.ToInt32(r["ItemCode"]);
string key = group + "|" + code + "|" + Convert.ToInt32(r["ItemID"]);
double amount = Convert.ToDouble(r["CHANGEDAMOUNT"]);
if (group == grossGroup || group == arrearGroup)
totalGross += amount;
else if (group == unauthGroup)
{
totalGross -= amount;
unauthLeave -= amount;
}
else if (group == deductGroup)
totalDeduction += amount;
else if (group == (int)EnumSalaryGroup.OtherItem && code == (int)EnumSalaryItemCode.Net_Payable)
netPay = (netPay ?? 0) + amount;
if (group != unauthGroup)
amounts[key] = (amounts.ContainsKey(key) ? amounts[key] : 0) + amount;
}
double salaryNetPay = netPay ?? (totalGross - totalDeduction);
double bonusAmount = 0, bonusTax = 0;
foreach (var bonus in monthBonuses)
{
amounts[bonus.Key] = (amounts.ContainsKey(bonus.Key) ? amounts[bonus.Key] : 0) + bonus.Amount;
bonusAmount += bonus.Amount;
bonusTax += bonus.Tax;
}
amounts[unauthKey] = unauthLeave;
amounts[bonusTaxKey] = bonusTax;
amounts[totalGrossKey] = totalGross + bonusAmount;
amounts[totalDeductionKey] = totalDeduction + bonusTax;
amounts[netPayKey] = salaryNetPay + bonusAmount - bonusTax;
for (int i = 0; i < columns.Count; i++)
{
DataRow oRow = dt.NewRow();
oRow["EmpNo"] = rowKey.EmpNo;
oRow["EmpName"] = info["Name"];
oRow["Grade"] = info["GName"];
oRow["Department"] = info["Department"];
oRow["SalaryMonth"] = rowKey.Month;
oRow["JoiningDate"] = info["JOININGDATE"];
oRow["ActualBasic"] = actualBasic;
oRow["ColumnKey"] = columns[i].Key;
oRow["ColumnName"] = columns[i].Value;
oRow["ColumnSequence"] = i + 1;
oRow["Amount"] = amounts.ContainsKey(columns[i].Key) ? amounts[columns[i].Key] : 0;
dt.Rows.Add(oRow);
}
}
return dt;
}
private string GetArrearColumnName(string description)
{
return description.IndexOf("arrear", StringComparison.OrdinalIgnoreCase) >= 0 ? description : description + " Arrear";
}
#endregion
public void PayslipMail(int payrollTypeID, DateTime SalaryMonth, string sEmpID, bool isForESS, EmailSettings emailSettings)
{
DataSet oFDST = new DataSet();

View File

@ -0,0 +1,54 @@
using System;
using System.Data;
using System.Linq;
using Ease.Core.Utility;
using HRM.BO;
using HRM.DA;
namespace HRM.Report
{
/// <summary>
/// Component Upload Report (EnumReportType.ComponentUploadReport, /reports/component-upload-report), as GP's
/// rptEmployee.ShowUploadedComponentReport / ShowUploadedComponentReportEmployee. The RDLCs are read from the
/// RDLC folder (HRM.UI/RDLC), as GP renders them, through ReportProcessor.CommonReportViewer.
/// </summary>
public class rptComponentUpload
{
/// <summary>Uploaded Components tab: every upload of the upload date range.</summary>
public byte[] ShowUploadedComponentReport(DateTime fromdate, DateTime todate, int payrollTypeId, string reportType)
{
DataTable dtUploadedComponents = new ComponentUploadSetupService().GetUploadedComponentReportData(fromdate, todate).Copy();
dtUploadedComponents.TableName = "dsCompany_dtUploadedComponent";
DataSet resultDataSet = new DataSet();
resultDataSet.Tables.Add(dtUploadedComponents);
return new ReportProcessor().CommonReportViewer(null, "UploadedComponent.rdlc", resultDataSet, null, payrollTypeId, reportType);
}
/// <summary>
/// Monthly Uploaded Components tab: the uploaded rows of the selected employees for the salary month,
/// of one component (itemId) or of every component (itemId 0).
/// </summary>
public byte[] ShowUploadedComponentReportEmployee(string empIds, int itemId, DateTime fromdate, int payrollTypeId, string reportType)
{
// the IDs go into the SQL as %q, so only digits pass
string ids = string.Join(",", (empIds ?? string.Empty)
.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
.Select(x => int.TryParse(x.Trim(), out int id) ? id : 0)
.Where(id => id > 0)
.Distinct());
if (ids == string.Empty)
throw new Exception("Please select employee.");
DateTime uploadMonth = GlobalFunctions.LastDateOfMonth(fromdate);
DataTable dtUploadedComponents = itemId != 0
? new ComponentUploadSetupService().GetUploadedComponentEmpReportData(uploadMonth, itemId, ids).Copy()
: new ComponentUploadSetupService().GetUploadedComponentEmpReportData(uploadMonth, ids).Copy();
dtUploadedComponents.TableName = "dsCompany_dtUploadedComponentEmp";
DataSet resultDataSet = new DataSet();
resultDataSet.Tables.Add(dtUploadedComponents);
return new ReportProcessor().CommonReportViewer(null, "UploadedComponentEmp.rdlc", resultDataSet, null, payrollTypeId, reportType);
}
}
}

View File

@ -315,6 +315,7 @@
<None Remove="RDLC\SalaryRegister.rdlc" />
<None Remove="RDLC\SalarySheetEchoTex.rdlc" />
<None Remove="RDLC\SalarySheetWithoutCostcenter.rdlc" />
<None Remove="RDLC\DateRangeWiseSalarySheet.rdlc" />
<None Remove="RDLC\SettlementAdviceSheet.rdlc" />
<None Remove="RDLC\SettlementAdviceSheetNew.rdlc" />
<None Remove="RDLC\ShowITPfAndOtherDetails.rdlc" />
@ -646,6 +647,7 @@
<EmbeddedResource Include="RDLC\SalaryRegister.rdlc" />
<EmbeddedResource Include="RDLC\SalarySheetEchoTex.rdlc" />
<EmbeddedResource Include="RDLC\SalarySheetWithoutCostcenter.rdlc" />
<EmbeddedResource Include="RDLC\DateRangeWiseSalarySheet.rdlc" />
<EmbeddedResource Include="RDLC\SettlementAdviceSheet.rdlc" />
<EmbeddedResource Include="RDLC\SettlementAdviceSheetNew.rdlc" />
<EmbeddedResource Include="RDLC\ShowITPfAndOtherDetails.rdlc" />

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,7 @@
"@auth0/angular-jwt": "^5.2.0",
"@azure/msal-angular": "^6.2.5",
"@azure/msal-browser": "^5.27.0",
"@microsoft/signalr": "10.0.11",
"@progress/kendo-angular-buttons": "25.3.0",
"@progress/kendo-angular-charts": "25.3.0",
"@progress/kendo-angular-common": "25.3.0",
@ -3370,6 +3371,40 @@
"win32"
]
},
"node_modules/@microsoft/signalr": {
"version": "10.0.11",
"resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-10.0.11.tgz",
"integrity": "sha512-FulOJ2EEtKvLQcswe/U7v8pzyXyk7Jua5xgWJPPwyQU/2Z9ORvKcVjyO75VvLsem+CJ1ORRexJ+7Bz1FCei2aw==",
"license": "MIT",
"dependencies": {
"abort-controller": "^3.0.0",
"eventsource": "^2.0.2",
"fetch-cookie": "^2.0.3",
"node-fetch": "^2.6.7",
"ws": "^7.5.10"
}
},
"node_modules/@microsoft/signalr/node_modules/ws": {
"version": "7.5.14",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.14.tgz",
"integrity": "sha512-u9Oi2nQ8SZnTUAf6spLLKF5TyqoG3Nbbrd4ai6Sjo4P24bycDewhQqtNMIg4bFpnpH/TD4qk4IuAVhT0HIIqug==",
"license": "MIT",
"engines": {
"node": ">=8.3.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": "^5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
},
"node_modules/@modelcontextprotocol/core": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/core/-/core-2.3.1.tgz",
@ -3625,9 +3660,6 @@
"arm64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@ -3645,9 +3677,6 @@
"arm64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@ -3665,9 +3694,6 @@
"ppc64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@ -3685,9 +3711,6 @@
"riscv64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@ -3705,9 +3728,6 @@
"s390x"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@ -3725,9 +3745,6 @@
"x64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@ -3745,9 +3762,6 @@
"x64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@ -4004,9 +4018,6 @@
"cpu": [
"arm64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@ -4023,9 +4034,6 @@
"cpu": [
"arm64"
],
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@ -4042,9 +4050,6 @@
"cpu": [
"ppc64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@ -4061,9 +4066,6 @@
"cpu": [
"riscv64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@ -4080,9 +4082,6 @@
"cpu": [
"riscv64"
],
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@ -4099,9 +4098,6 @@
"cpu": [
"s390x"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@ -4118,9 +4114,6 @@
"cpu": [
"x64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@ -4137,9 +4130,6 @@
"cpu": [
"x64"
],
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@ -4399,9 +4389,6 @@
"arm"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@ -4423,9 +4410,6 @@
"arm"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@ -4447,9 +4431,6 @@
"arm64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@ -4471,9 +4452,6 @@
"arm64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@ -4495,9 +4473,6 @@
"x64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@ -4519,9 +4494,6 @@
"x64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@ -5878,9 +5850,6 @@
"arm64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@ -5898,9 +5867,6 @@
"arm64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@ -5918,9 +5884,6 @@
"ppc64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@ -5938,9 +5901,6 @@
"s390x"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@ -5958,9 +5918,6 @@
"x64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@ -5978,9 +5935,6 @@
"x64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@ -6273,6 +6227,18 @@
"vite": "^6.0.0 || ^7.0.0 || ^8.0.0"
}
},
"node_modules/abort-controller": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
"license": "MIT",
"dependencies": {
"event-target-shim": "^5.0.0"
},
"engines": {
"node": ">=6.5"
}
},
"node_modules/acorn": {
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.19.0.tgz",
@ -8702,6 +8668,15 @@
"node": ">=0.10.0"
}
},
"node_modules/event-target-shim": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/eventemitter3": {
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
@ -8709,6 +8684,15 @@
"dev": true,
"license": "MIT"
},
"node_modules/eventsource": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz",
"integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==",
"license": "MIT",
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/exceljs": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/exceljs/-/exceljs-4.4.0.tgz",
@ -8886,6 +8870,16 @@
}
}
},
"node_modules/fetch-cookie": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-2.2.0.tgz",
"integrity": "sha512-h9AgfjURuCgA2+2ISl8GbavpUdR+WGAM2McW/ovn4tVccegp8ZqCKWSBR8uRdM8dDNlx5WdKRWxBYUwteLDCNQ==",
"license": "Unlicense",
"dependencies": {
"set-cookie-parser": "^2.4.8",
"tough-cookie": "^4.0.0"
}
},
"node_modules/file-entry-cache": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz",
@ -11221,9 +11215,6 @@
"arm64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MPL-2.0",
"optional": true,
"os": [
@ -11245,9 +11236,6 @@
"arm64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MPL-2.0",
"optional": true,
"os": [
@ -11269,9 +11257,6 @@
"x64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MPL-2.0",
"optional": true,
"os": [
@ -11293,9 +11278,6 @@
"x64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MPL-2.0",
"optional": true,
"os": [
@ -11965,6 +11947,26 @@
"semver": "bin/semver.js"
}
},
"node_modules/node-fetch": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
"license": "MIT",
"dependencies": {
"whatwg-url": "^5.0.0"
},
"engines": {
"node": "4.x || >=6.0.0"
},
"peerDependencies": {
"encoding": "^0.1.0"
},
"peerDependenciesMeta": {
"encoding": {
"optional": true
}
}
},
"node_modules/node-gyp-build-optional-packages": {
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.2.2.tgz",
@ -12728,6 +12730,27 @@
}
}
},
"node_modules/psl": {
"version": "1.15.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.15.0.tgz",
"integrity": "sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==",
"license": "MIT",
"dependencies": {
"punycode": "^2.3.1"
},
"funding": {
"url": "https://github.com/sponsors/lupomontero"
}
},
"node_modules/psl/node_modules/punycode": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/pump": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz",
@ -12756,6 +12779,12 @@
"node": ">=0.9"
}
},
"node_modules/querystringify": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
"integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==",
"license": "MIT"
},
"node_modules/queue-microtask": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
@ -12994,7 +13023,6 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==",
"dev": true,
"license": "MIT"
},
"node_modules/resolve": {
@ -13481,7 +13509,6 @@
"arm"
],
"dev": true,
"libc": "glibc",
"license": "MIT",
"optional": true,
"os": [
@ -13499,7 +13526,6 @@
"arm64"
],
"dev": true,
"libc": "glibc",
"license": "MIT",
"optional": true,
"os": [
@ -13517,7 +13543,6 @@
"arm"
],
"dev": true,
"libc": "musl",
"license": "MIT",
"optional": true,
"os": [
@ -13535,7 +13560,6 @@
"arm64"
],
"dev": true,
"libc": "musl",
"license": "MIT",
"optional": true,
"os": [
@ -13553,7 +13577,6 @@
"riscv64"
],
"dev": true,
"libc": "musl",
"license": "MIT",
"optional": true,
"os": [
@ -13571,7 +13594,6 @@
"x64"
],
"dev": true,
"libc": "musl",
"license": "MIT",
"optional": true,
"os": [
@ -13589,7 +13611,6 @@
"riscv64"
],
"dev": true,
"libc": "glibc",
"license": "MIT",
"optional": true,
"os": [
@ -13607,7 +13628,6 @@
"x64"
],
"dev": true,
"libc": "glibc",
"license": "MIT",
"optional": true,
"os": [
@ -13708,6 +13728,12 @@
"node": ">=10"
}
},
"node_modules/set-cookie-parser": {
"version": "2.7.3",
"resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.3.tgz",
"integrity": "sha512-irZHtTqurLna57KQG/s+fzOwv/J6XSH4cs8M/vsrY3uCaQ3S6+QJguAH0WdN47SXlk82voMZ4naWMQf8fdEoIg==",
"license": "MIT"
},
"node_modules/set-function-length": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
@ -14405,6 +14431,45 @@
"node": ">=0.6"
}
},
"node_modules/tough-cookie": {
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.4.tgz",
"integrity": "sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==",
"license": "BSD-3-Clause",
"dependencies": {
"psl": "^1.1.33",
"punycode": "^2.1.1",
"universalify": "^0.2.0",
"url-parse": "^1.5.3"
},
"engines": {
"node": ">=6"
}
},
"node_modules/tough-cookie/node_modules/punycode": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/tough-cookie/node_modules/universalify": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz",
"integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==",
"license": "MIT",
"engines": {
"node": ">= 4.0.0"
}
},
"node_modules/tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
"license": "MIT"
},
"node_modules/traverse": {
"version": "0.3.10",
"resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.10.tgz",
@ -14780,6 +14845,16 @@
"node": ">=6"
}
},
"node_modules/url-parse": {
"version": "1.5.10",
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
"integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==",
"license": "MIT",
"dependencies": {
"querystringify": "^2.1.1",
"requires-port": "^1.0.0"
}
},
"node_modules/util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
@ -14945,6 +15020,22 @@
"license": "MIT",
"optional": true
},
"node_modules/webidl-conversions": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
"license": "BSD-2-Clause"
},
"node_modules/whatwg-url": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
"license": "MIT",
"dependencies": {
"tr46": "~0.0.3",
"webidl-conversions": "^3.0.0"
}
},
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",

View File

@ -22,6 +22,7 @@
"@auth0/angular-jwt": "^5.2.0",
"@azure/msal-angular": "^6.2.5",
"@azure/msal-browser": "^5.27.0",
"@microsoft/signalr": "10.0.11",
"@progress/kendo-angular-buttons": "25.3.0",
"@progress/kendo-angular-charts": "25.3.0",
"@progress/kendo-angular-common": "25.3.0",

View File

@ -3,6 +3,7 @@
"target": "https://localhost:44374",
"secure": false,
"changeOrigin": true,
"ws": true,
"logLevel": "debug"
}
}

View File

@ -1 +1 @@
{"version":3,"file":"allow-deduct.js","sourceRoot":"","sources":["allow-deduct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAE/C,MAAM,OAAO,kBAAmB,SAAQ,UAAU;IAC9C;QACI,KAAK,EAAE,CAAC;IACZ,CAAC;CAIJ"}
{"version":3,"file":"allow-deduct.js","sourceRoot":"","sources":["allow-deduct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAG/C,MAAM,OAAO,kBAAmB,SAAQ,UAAU;IAC9C;QACI,KAAK,EAAE,CAAC;IACZ,CAAC;CAKJ"}

View File

@ -1,4 +1,5 @@
import {BaseObject} from '../Basic/baseObject';
import { EnumAllowanceType } from '../enums';
export class AllowanceDeduction extends BaseObject {
constructor() {
@ -7,4 +8,5 @@ export class AllowanceDeduction extends BaseObject {
code: string;
name: string;
payrollTypeID: string;
allowanceType: EnumAllowanceType
}

View File

@ -1 +1 @@
{"version":3,"file":"UserAccessType.js","sourceRoot":"","sources":["UserAccessType.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,OAAO,cAAe,SAAQ,UAAU;IAG1C;QAEI,KAAK,EAAE,CAAC;QAKL,gBAAW,GAAW,EAAE,CAAC;QAJ5B,IAAI,CAAC,gBAAgB,GAAG,cAAc,CAAC,QAAQ,CAAC;IACpD,CAAC;CAOJ"}
{"version":3,"file":"UserAccessType.js","sourceRoot":"","sources":["UserAccessType.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,OAAO,cAAe,SAAQ,UAAU;IAG1C;QAEI,KAAK,EAAE,CAAC;QAKL,gBAAW,GAAW,EAAE,CAAC;QAJ5B,IAAI,CAAC,gBAAgB,GAAG,cAAc,CAAC,QAAQ,CAAC;IACpD,CAAC;CAUJ"}

View File

@ -21,4 +21,31 @@ export class UserRole extends BaseObject {
});
}
}
// ---------- Maker-checker (Authentication > User Role Permission) ----------
/** What a role request asks for (EnumUserRoleRequestType on the server). */
export var EnumUserRoleRequestType;
(function (EnumUserRoleRequestType) {
EnumUserRoleRequestType[EnumUserRoleRequestType["Add"] = 1] = "Add";
EnumUserRoleRequestType[EnumUserRoleRequestType["Remove"] = 2] = "Remove";
})(EnumUserRoleRequestType || (EnumUserRoleRequestType = {}));
/** Whose roles: an Admin user (userID) or a Self Service employee (employeeID + payrollTypeID). */
export class UserRoleSubject {
}
/** Maker's request: the roles (of the subject's role type) the person should have. */
export class UserRoleChangeRequest extends UserRoleSubject {
constructor() {
super(...arguments);
this.roleIDs = [];
}
}
/** One UserRole row waiting for approval (Status 2 = give, 3 = take away); id is the UserRoleID. */
export class UserRoleRequest {
}
/** A person's roles of one role type, as the page shows them. */
export class UserRoleState {
constructor() {
this.liveRoleIDs = [];
this.pending = [];
}
}
//# sourceMappingURL=UserRole.js.map

View File

@ -1 +1 @@
{"version":3,"file":"UserRole.js","sourceRoot":"","sources":["UserRole.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAK/C,MAAM,OAAO,QAAS,SAAQ,UAAU;IACpC;QACI,KAAK,EAAE,CAAC;QAsBZ,UAAK,GAAa,IAAI,CAAC;QACvB,gBAAW,GAAY,EAAE,CAAC;QAtBtB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IACpB,CAAC;IAuBD,YAAY,CAAC,KAAa,EAAE,QAAoB;QAC5C,IAAI,OAAmB,CAAC;QACxB,IAAI,GAAG,GAAG,EAAE,CAAC;QACb,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACd,GAAG,GAAG,EAAE,CAAC;YACT,IAAI,SAAS,GAAe,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC;YACnE,IAAI,SAAU,GAAG,SAAS,EAAE,CAAC;gBACzB,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;oBAClB,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,YAAY,CAAC;gBAE/B,CAAC,CAAC,CAAC;YACP,CAAC;YACD,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC;QACtB,CA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AAoG;AACpG,MAAM,OAAO,eAAe;CAgB3B;AAED,iEAAiE;AACjE,MAAM,OAAO,aAAa;IAA1B;QAWI,gBAAW,GAAa,EAAE,CAAC;QAC3B,YAAO,GAAsB,EAAE,CAAC;IACpC,CAAC;CAAA"}

View File

@ -0,0 +1,39 @@
import { BaseObject } from '../Basic/baseObject';
/** One successful login (dbo.UserLoginInfo), as returned by api/Authentication/getUserAuditTrail. */
export class UserLogInInfo extends BaseObject {
constructor() {
super();
this.userID = 0;
this.loginTime = undefined;
this.logoutTime = undefined;
this.logoutType = undefined;
this.pcNumber = '';
this.ipAddress = '';
this.deviceId = '';
this.loginID = '';
this.userName = '';
}
}
/** One failed login (dbo.BadLoginAttemptInfo), as returned by api/Authentication/getBadLoginAuditTrail. */
export class BadLoginAttemptInfo extends BaseObject {
constructor() {
super();
this.userID = 0;
this.attemptTime = undefined;
this.pcNumber = '';
this.ipAddress = '';
this.deviceId = '';
this.loginID = '';
this.userName = '';
}
}
/** Which change history the System Audit Log page asks for (HRM.BO EnumSystemAuditHistory). */
export var EnumSystemAuditHistory;
(function (EnumSystemAuditHistory) {
EnumSystemAuditHistory[EnumSystemAuditHistory["Role"] = 1] = "Role";
EnumSystemAuditHistory[EnumSystemAuditHistory["RolePermission"] = 2] = "RolePermission";
EnumSystemAuditHistory[EnumSystemAuditHistory["User"] = 3] = "User";
EnumSystemAuditHistory[EnumSystemAuditHistory["UserRole"] = 4] = "UserRole";
EnumSystemAuditHistory[EnumSystemAuditHistory["UserAccessType"] = 5] = "UserAccessType";
})(EnumSystemAuditHistory || (EnumSystemAuditHistory = {}));
//# sourceMappingURL=auditTrail.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"auditTrail.js","sourceRoot":"","sources":["auditTrail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,qGAAqG;AACrG,MAAM,OAAO,aAAc,SAAQ,UAAU;IAWzC;QACI,KAAK,EAAE,CA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,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC;IAC1C,CAAC;CAoBJ"}
{"version":3,"file":"user.js","sourceRoot":"","sources":["user.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD,MAAM,OAAO,IAAK,SAAQ,UAAU;IAEhC;QACI,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC;IAC1C,CAAC;CAqBJ"}

View File

@ -1 +1 @@
{"version":3,"file":"empLifeCycle.js","sourceRoot":"","sources":["empLifeCycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,kBAAkB,EAAuB,MAAM,UAAU,CAAC;AAGlF,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAG/C,MAAM,OAAO,YAAa,SAAQ,UAAU;IAuCxC;QACI,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,YAAY,GAAG,IAA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AAI,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,kBAAkB,CAAC,IAAI,CAAC;QAC9C,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,sBAAsB,GAAG,KAAK,CAAC;QACpC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;QAClC,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;QAChC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,YAAY,GAAG,IAAI,IAAI,EAAE,CAAC;QAC/B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC,mBAAmB,CAAC;IAC7D,CAAC;CACJ"}

View File

@ -28,6 +28,7 @@ export class Employee {
this.statusName = '';
this.isShownInTaxSheet = false;
this.pfMemberType = EnumPFMembershipType.NotYetLive;
this.pfPercentage = 0;
this.branchID = null;
this.accountNo = '';
this.outPayBranchID = null;

View File

@ -1 +1 @@
{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K,GAAG,IAAI,CAAC,YAAY,CAAC;QAE9B,OAAO,GAAG,CAAC;IACf,CAAC;IAED,eAAe,CAAC,SAA6B;QAEzC,IAAI,GAAG,GAAW,MAAM,CAAC;QACzB,QAAQ,SAAS,EAAE,CAAC;YAChB,KAAK,kBAAkB,CAAC,IAAI;gBACxB,GAAG,GAAG,MAAM,CAAC;gBACb,MAAM;YACV,KAAK,kBAAkB,CAAC,OAAO,CAAC;YAChC,mCAAmC;YACnC,KAAK,kBAAkB,CAAC,EAAE,CAAC;YAC3B,KAAK,kBAAkB,CAAC,YAAY;gBAChC,GAAG,GAAG,cAAc,CAAC;gBACrB,MAAM;YACV,QAAQ;QACZ,CAAC;QAED,OAAO,GAAG,CAAC;IACf,CAAC;CACJ"}

View File

@ -1,12 +1,14 @@
import {EnumAllowOrDeduct} from '../enums';
import {EnumAllowOrDeduct, EnumAllowanceType} from '../enums';
import {BaseObject} from '../Basic/baseObject';
export class AllowanceDeduction extends BaseObject {
constructor() {
super();
this.allowanceType = EnumAllowanceType.Non_Gross;
}
code: string;
name: string;
allowOrDeductType: EnumAllowOrDeduct;
allowanceType: EnumAllowanceType;
}

View File

@ -0,0 +1,13 @@
import { BaseObject } from "../../Basic/baseObject";
export class ComponentUploadSetup extends BaseObject {
constructor() {
super();
// this.employeeID = 0;
// this.approverID = 0;
// this.componentType = EnumComponentType.Allowance;
// this.itemID = 0;
// this.description = '';
this.isDamageManagement = false;
}
}
//# sourceMappingURL=ComponentUploadSetup.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ComponentUploadSetup.js","sourceRoot":"","sources":["ComponentUploadSetup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGpD,MAAM,OAAO,oBAAqB,SAAQ,UAAU;IAYlD;QACE,KAAK,EAAE,CAAC;QACR,uBAAuB;QACvB,uBAAuB;QACvB,oDAAoD;QACpD,mBAAmB;QACnB,yBAAyB;QACzB,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;IAClC,CAAC;CACF"}

View File

@ -0,0 +1,25 @@
import { BaseObject } from "../../Basic/baseObject";
import { EnumComponentType } from "../../enums";
export class ComponentUploadSetup extends BaseObject {
employeeID: number;
approverID: number;
employeeName: string;
approverName: string;
componentType: EnumComponentType;
itemID: number;
description: string;
isDamageManagement: boolean;
componentTypeName: string;
damageManagementDescription: string;
constructor() {
super();
// this.employeeID = 0;
// this.approverID = 0;
// this.componentType = EnumComponentType.Allowance;
// this.itemID = 0;
// this.description = '';
this.isDamageManagement = false;
}
}

View File

@ -0,0 +1,5 @@
import { BaseObject } from "../../Basic/baseObject";
export class UploadedComponent extends BaseObject {
}
;
//# sourceMappingURL=UploadedComponent.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"UploadedComponent.js","sourceRoot":"","sources":["UploadedComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIpD,MAAM,OAAO,iBAAkB,SAAQ,UAAU;CAUhD;AAAA,CAAC"}

View File

@ -0,0 +1,15 @@
import { BaseObject } from "../../Basic/baseObject";
import { EnumComponentType } from "../../enums";
import { UploadedComponentEmp } from "./UploadedComponentEmp";
export class UploadedComponent extends BaseObject {
isDamageManagement: boolean;
salaryMonth: Date;
uploadedBy: number;
uploadedDate: Date;
approvedBy: number;
approvedDate: Date;
componentID: number;
componentType!: EnumComponentType;
uploadedComponentEmps: UploadedComponentEmp[];
};

View File

@ -0,0 +1,4 @@
import { BaseObject } from "../../Basic/baseObject";
export class UploadedComponentEmp extends BaseObject {
}
//# sourceMappingURL=UploadedComponentEmp.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"UploadedComponentEmp.js","sourceRoot":"","sources":["UploadedComponentEmp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,MAAM,OAAO,oBAAqB,SAAQ,UAAU;CAUnD"}

View File

@ -0,0 +1,13 @@
import { BaseObject } from "../../Basic/baseObject";
export class UploadedComponentEmp extends BaseObject {
uploadedComponentID: number;
employeeID: number;
amount: number;
reason: string;
totalAmount: number;
deductionMonth: Date;
deductionAmount: number;
remarks: string;
noOfInstallment: number;
}

View File

@ -40,6 +40,7 @@ export class ADParameter extends BaseObject {
this.gradeNames = '';
this.adParameterEmployees = [];
this.calculatedAmount = 0;
this.isOnBalancing = false;
}
CalculateAmount(asparam, employeeid, basicSalary, grossSalary) {
//console.log(asparam);

View File

@ -1 +1 @@
{"version":3,"file":"adparameter.js","sourceRoot":"","sources":["adparameter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,aAAa,EAAiB,eAAe,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACzJ,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAIjD,MAAM,OAAO,WAAY,SAAQ,UAAU;IAEvC;QAEI,KAAK,EAAE,CAAC;QAiEhB,gEAAgE;QAC5D,cAAS,GAAyB,EAAE,CAAC;QACrC,kBAAa,GAAwB,EAAE,CAAC;QACxC,sBAAiB,GAAqB,EAAE,CAAC;QAEzC,yBAAoB,GAAwB,EAAE,CAAC;QApE3C,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,gBAAgB,GAAC,KAAK,CAAC;QAC5B,IAAI,CAAC,uBAAuB,GAAC,KAAK,CAAC;QACnC,IAAI,CAAC,UAAU,GAAC,CAAC,CAAC;QAClB,IAAI,CAAC,cAAc,GAAC,CAAC,CAAC;QACtB,IAAI,CAAC,oBAAoB,GAAC,CAAC,CAAC;QAC5B,IAAI,CAAC,cAAc,GAAC,CAAC,CAAC;QACtB,IAAI,CAAC,YAAY,GAAC,CAAC,CAAC;QACpB,IAAI,CAAC,gBAAgB,GAAC,CAAC,CAAC;QACxB,IAAI,CAAC,gBAAgB,GAAC,CAAC,CAAC;QACxB,IA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AAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC;QAC5C,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,aAAa,CAAC,mBAAmB,CAAC;QACnD,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,YAAY,GAAG,IAAI,IAAI,EAAE,CAAC;QAC/B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC,mBAAmB,CAAC;QACzD,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACtB,CAAC;CAoCJ"}

View File

@ -1,4 +1,4 @@
import { EnumPeriodicity, EnumAllowOrDeduct, EnumArrearType, EnumADEmpType, EnumValueType, EnumEntitleType, EnumGender, EnumAuthStatus, EnumAllowanceType } from "../enums";
import { EnumPeriodicity, EnumAllowOrDeduct, EnumArrearType, EnumADEmpType, EnumValueType, EnumEntitleType, EnumGender, EnumAuthStatus } from "../enums";
import { BaseObject } from '../Basic/baseObject';
import { AllowanceDeduction } from '../../_models/HRBasic/allowanceDeduction';
import { SearchEmployee } from '../../_models/Employee/searchEmployee';
@ -42,7 +42,6 @@ export class ADParameter extends BaseObject
this.gradeNames='';
this.adParameterEmployees = [];
this.calculatedAmount = 0;
this.allowanceType=EnumAllowanceType.None;
this.isOnBalancing = false;
}
allowDeductID: number;
@ -73,7 +72,6 @@ export class ADParameter extends BaseObject
entitleType: EnumEntitleType;
allowOrDeductType: EnumAllowOrDeduct;
gender: EnumGender;
allowanceType: EnumAllowanceType;
isOnBalancing: boolean;
// public AllowanceDeduction AllowanceDeduction { get; set; }

View File

@ -1 +1 @@
{"version":3,"file":"bonusProcess.js","sourceRoot":"","sources":["bonusProcess.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAIjD,MAAM,OAAO,YAAa,SAAQ,UAAU;IACxC;QACI,KAAK,EAAE,CAAC;IACZ,CAAC;CAoBJ;AAED,MAAM,OAAO,kBAAkB;IAA/B;QAiBI,wBAAmB,GAAyB,EAAE,CAAC;QAE/C,kBAAa,GAAc,EAAE,CAAC;QAC9B,0DAA0D;IAC9D,CAAC;CAAA"}
{"version":3,"file":"bonusProcess.js","sourceRoot":"","sources":["bonusProcess.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAIjD,MAAM,OAAO,YAAa,SAAQ,UAAU;IACxC;QACI,KAAK,EAAE,CAAC;IACZ,CAAC;CAoBJ;AAED,MAAM,OAAO,kBAAkB;IAA/B;QAmBI,wBAAmB,GAAyB,EAAE,CAAC;QAE/C,kBAAa,GAAc,EAAE,CAAC;QAC9B,0DAA0D;IAC9D,CAAC;CAAA"}

View File

@ -1432,6 +1432,14 @@ export var EnumEntitleType;
EnumEntitleType[EnumEntitleType["Grade"] = 1] = "Grade";
EnumEntitleType[EnumEntitleType["Individual"] = 2] = "Individual";
})(EnumEntitleType || (EnumEntitleType = {}));
export var EnumAllowanceType;
(function (EnumAllowanceType) {
EnumAllowanceType[EnumAllowanceType["Non_Gross"] = 0] = "Non_Gross";
EnumAllowanceType[EnumAllowanceType["HouseRent"] = 1] = "HouseRent";
EnumAllowanceType[EnumAllowanceType["Medical"] = 2] = "Medical";
EnumAllowanceType[EnumAllowanceType["Conveynce"] = 3] = "Conveynce";
EnumAllowanceType[EnumAllowanceType["Utilities_Other"] = 4] = "Utilities_Other";
})(EnumAllowanceType || (EnumAllowanceType = {}));
export var EnumOpiAvgPayType;
(function (EnumOpiAvgPayType) {
EnumOpiAvgPayType[EnumOpiAvgPayType["NONE"] = 0] = "NONE";
@ -1781,6 +1789,8 @@ export var EnumReportType;
EnumReportType[EnumReportType["DailyAbsentLiFung"] = 609] = "DailyAbsentLiFung";
EnumReportType[EnumReportType["DailyOddLiFung"] = 610] = "DailyOddLiFung";
EnumReportType[EnumReportType["DailyAttnLiFung"] = 611] = "DailyAttnLiFung";
EnumReportType[EnumReportType["ComponentUploadReport"] = 1021] = "ComponentUploadReport";
EnumReportType[EnumReportType["LFABankAdvice"] = 1201] = "LFABankAdvice";
})(EnumReportType || (EnumReportType = {}));
export var EnumItemType;
(function (EnumItemType) {
@ -1921,6 +1931,7 @@ export var EnumRegularDataUpload;
EnumRegularDataUpload[EnumRegularDataUpload["Objective"] = 62] = "Objective";
EnumRegularDataUpload[EnumRegularDataUpload["CVUpload"] = 64] = "CVUpload";
EnumRegularDataUpload[EnumRegularDataUpload["SecondLineManagerObjectiveRating"] = 63] = "SecondLineManagerObjectiveRating";
EnumRegularDataUpload[EnumRegularDataUpload["EssComponentUpload"] = 66] = "EssComponentUpload";
EnumRegularDataUpload[EnumRegularDataUpload["PFMemberUpload"] = 501] = "PFMemberUpload";
EnumRegularDataUpload[EnumRegularDataUpload["MemberLoanScheduleInfoUpload"] = 502] = "MemberLoanScheduleInfoUpload";
EnumRegularDataUpload[EnumRegularDataUpload["MemberLoanOpeningDataUpload"] = 503] = "MemberLoanOpeningDataUpload";

File diff suppressed because one or more lines are too long

View File

@ -1429,10 +1429,11 @@ export enum EnumEntitleType {
export enum EnumAllowanceType
{
None = 0,
Non_Gross = 0,
HouseRent = 1,
Medical = 2,
Conveynce = 3
Conveynce = 3,
Utilities_Other = 4
}
export enum EnumOpiAvgPayType {
@ -1605,6 +1606,7 @@ export enum EnumReportType {
OverAllSummary = 39,
SalaryControl = 40,
PaySlip = 41,
DateRangeWiseSalarySheet = 4101,
Envelop = 42,
SalaryReconcil = 43,
SalaryReconcilItemWise = 143,
@ -1807,6 +1809,7 @@ export enum EnumReportType {
DailyAbsentLiFung = 609,
DailyOddLiFung = 610,
DailyAttnLiFung = 611,
ComponentUploadReport = 1021,
LFABankAdvice = 1201,
}
@ -1950,6 +1953,7 @@ export enum EnumRegularDataUpload {
Objective = 62,
CVUpload = 64,
SecondLineManagerObjectiveRating = 63,
EssComponentUpload = 66,
PFMemberUpload = 501,
MemberLoanScheduleInfoUpload=502,
MemberLoanOpeningDataUpload=503,

View File

@ -0,0 +1,38 @@
/** Same numbers as HRM.UI/Realtime/Jobs/JobSnapshot.cs (JobStatus). */
export enum JobStatus {
Queued = 1,
Running = 2,
Succeeded = 3,
Failed = 4
}
/** A background job as the server reports it (HRM.UI/Realtime/Jobs/JobSnapshot.cs). */
export interface JobSnapshot {
runId: string;
key: string;
title: string;
status: JobStatus;
/** 0 - 100, never goes backwards. */
percent: number;
stage: string | null;
detail: string | null;
current: number | null;
total: number | null;
queuedAt: string;
startedAt: string | null;
finishedAt: string | null;
elapsedSeconds: number;
/** Estimated seconds left; null until there is enough to measure. */
etaSeconds: number | null;
/** Grows with every change; an older message than the one shown is ignored. */
sequence: number;
/** What the job returned (when Succeeded). Its shape belongs to the job. */
result: any;
/** Why it failed (when Failed). */
error: string | null;
isFinished: boolean;
}
export function isJobFinished(job: JobSnapshot | null | undefined): boolean {
return !!job && (job.status === JobStatus.Succeeded || job.status === JobStatus.Failed);
}

View File

@ -19,7 +19,10 @@ import { Bank } from '../../_models/Basic/bank';
import { Branch } from '../../_models/Basic/branch';
import { CostCenter } from '../../_models/Basic/costcenter';
import { Loan } from '../../_models/Payroll/Loan/loan';
import { EnumAllowOrDeduct, EnumStatus } from '../../_models/enums';
import { EnumAllowOrDeduct, EnumComponentType, EnumStatus } from '../../_models/enums';
import { ComponentUploadSetup } from 'src/app/_models/Payroll/ComponentUploadSetup/ComponentUploadSetup';
import { UploadedComponent } from 'src/app/_models/Payroll/ComponentUploadSetup/UploadedComponent';
import { Employee } from 'src/app/_models/Employee/employee';
import { ProcessItem } from '../../_models/Basic/processItem';
import { Relation } from '../../_models/HRBasic/relation';
import { EmpRelative } from '../../_models/HREmployee/empRelative';
@ -137,6 +140,11 @@ export class BasicService {
'/' + nname);
}
// the religions set on a bonus (Bonus master screen)
getBonusReligions(bonusID: number): Observable<Religion[]> {
return this.apiService.httpGet<Religion[]>('/HRBasic/getBonusReligions/' + bonusID);
}
getBonusByID(id: number) {
return this.apiService.httpGet(this.apiService.base_url + '/getBonusByID' + '/' + id);
}
@ -507,4 +515,75 @@ export class BasicService {
GetOtherTalents(): any {
return this.apiService.httpGet<Achievement[]>('/HRBasic/GetOtherTalents');
}
//Component Upload Setup
getComponentUploadSetups(): any {
return this.apiService.httpGet<ComponentUploadSetup[]>('/HRBasic/getComponentUploadSetups');
}
getAllComponentUploadSetups(): any {
return this.apiService.httpGet<ComponentUploadSetup[]>('/HRBasic/getAllComponentUploadSetups');
}
getComponentUploadSetupsByEmpId(id: number): any {
return this.apiService.httpGet<ComponentUploadSetup[]>('/HRBasic/getComponentUploadSetupsByEmpId/' + id);
}
saveComponentUploadSetups(param: ComponentUploadSetup[]) {
return this.apiService.httpPost<any>('/HRBasic/saveComponentUploadSetups', param);
}
deleteComponentSetup(param: ComponentUploadSetup) {
return this.apiService.httpPost('/HRBasic/deleteComponentSetup', param);
}
deleteSingleComponent(param: ComponentUploadSetup) {
return this.apiService.httpPost('/HRBasic/deleteSingleComponent', param);
}
getEmpComponentUploadSetups(): any {
return this.apiService.httpGet<ComponentUploadSetup[]>('/HRBasic/getEmpComponentUploadSetups');
}
getExistingUploadedComponent(id: number, type: EnumComponentType){
return this.apiService.httpGet<any>('/HRBasic/getExistingUploadedComponent'+ '/' + id + '/' + type);
}
getComponentSetupEmployees(){
return this.apiService.httpGet<Employee[]>('/HRBasic/getComponentSetupEmployees');
}
// getComponentSetupForEmployee(id: number){
// return this.apiService.httpGet<any>('/HRBasic/getComponentSetupForEmployee'+ '/' + id);
// }
getUploadedComponentSetupForEmployee(empId: number, componentId: number, componentType: EnumComponentType, description: string){
return this.apiService.httpGet<any>('/HRBasic/getUploadedComponentSetupForEmployee'+ '/' + empId + '/' + componentId + '/' + componentType + '/' + description);
}
getUploadedComponentsMonthwise(params: any) {
return this.apiService.httpPost('/HRBasic/getUploadedComponentsMonthwise', params);
}
checkComponentUploadValidity(){
return this.apiService.httpGet<any>('/HRBasic/checkComponentUploadValidity');
}
getComponentUploadDeadline(){
return this.apiService.httpGet<any>('/HRBasic/getComponentUploadDeadline');
}
loadUploadedComponentData(component: UploadedComponent, description: string){
return this.apiService.httpGet<any>('/HRBasic/loadUploadedComponentData'+ '/' + component + '/' + description);
}
getApproverComponentUploadDT(){
return this.apiService.httpGet<any>('/HRBasic/getApproverComponentUploadDT');
}
getUploaderComponentUploadDT(){
return this.apiService.httpGet<any>('/HRBasic/getUploaderComponentUploadDT');
}
approveComponentUpload(param: UploadedComponent) {
return this.apiService.httpPost<any>('/HRBasic/approveComponentUpload', param);
}
approveComponentUploadByKey(empId: number, componentId: number, componentType: number) {
return this.apiService.httpPost<any>('/HRBasic/approveComponentUploadByKey/' + empId + '/' + componentId + '/' + componentType, {});
}
rejectComponentUploadByKey(empId: number, componentId: number, componentType: number) {
return this.apiService.httpPost<any>('/HRBasic/rejectComponentUploadByKey/' + empId + '/' + componentId + '/' + componentType, {});
}
viewUploadedComponentForApprover(id: number){
return this.apiService.httpGet<any>('/HRBasic/viewUploadedComponentForApprover/' + id);
}
viewUploadedComponent(id: number){
return this.apiService.httpGet<any>('/HRBasic/viewUploadedComponent'+ '/' + id);
}
deleteUploadComponent(id: any) {
return this.apiService.httpPost('/HRBasic/deleteUploadComponent', id);
}
}

View File

@ -20,6 +20,9 @@ export class EssService {
getAllPUR() {
return this.apiService.httpGet<ProfileUpdateRequest[]>('/Ess/getAllPUR');
}
getUserProfile() {
return this.apiService.httpGet<any>('/Ess/getUserProfile');
}
savePUR(param: any) {
return this.apiService.httpPost<any>('/Ess/savePUR', param);
}

View File

@ -5,6 +5,7 @@ import {EnumIncomeTaxDataFrom, EnumSalaryGroup, EnumSalaryItemCode} from '../../
import {SalaryEmpCostCenter} from '../../_models/Payroll/salaryEmpCostCenter';
import {SalaryMonthlyDetail} from '../../_models/Payroll/salaryMonthlyDetail';
import {SalaryApprovalAttachment, SalaryProcess, SalaryProcessStatus, SalaryProcessSummaryItem} from '../../_models/Payroll/salaryProcess';
import { JobSnapshot } from '../../_models/realtime/job-snapshot';
import { SearchEmployee } from '../../_models/Employee/searchEmployee';
import { PayrollComponentList } from '../../_models/Attendance/PayrollComponentList';
import { HttpEvent } from '@angular/common/http';
@ -207,9 +208,22 @@ export class SalaryService {
return this.apiService.httpPost<SalaryProcessStatus[]>('/salary/salaryValidation', params);
}
// Salary Process screen: employees of a category (payroll type wise, Live, salary not processed yet)
getCategoryEmployeeIDsForSalary(categoryID: number) {
return this.apiService.httpGet<number[]>('/salary/getCategoryEmployeeIDsForSalary/' + categoryID);
}
salaryProcess(params: any) {
return this.apiService.httpPost<SalaryProcessStatus[]>('/salary/SalaryProcess', params);
}
/** Same request as salaryProcess; runs as a background job and answers the job (follow it with RealtimeService.watchJob). */
salaryProcessStart(params: any) {
return this.apiService.httpPost<JobSnapshot>('/salary/SalaryProcess-start', params);
}
/** The salary process running now in the login's payroll type, or null. */
salaryProcessActive() {
return this.apiService.httpGet<JobSnapshot>('/salary/SalaryProcess-active');
}
salaryProcessApprove(params: any) {
return this.apiService.httpPost(this.apiService.base_url + '/salaryProcessApprove', params);
}

View File

@ -0,0 +1,307 @@
import { Injectable, NgZone, OnDestroy } from '@angular/core';
import {
HubConnection,
HubConnectionBuilder,
HubConnectionState,
IRetryPolicy,
LogLevel,
RetryContext
} from '@microsoft/signalr';
import { BehaviorSubject, Observable, Subject, Subscription, filter, map } from 'rxjs';
import { environment } from 'src/environments/environment';
import { ApiService } from '../../app.api.service';
import { AuthService } from '../auth/auth.service';
import { JobSnapshot, isJobFinished } from '../../_models/realtime/job-snapshot';
export type RealtimeConnectionState = 'disconnected' | 'connecting' | 'connected' | 'reconnecting';
/** A message pushed with IAppClient.Event on the server. */
export interface RealtimeEvent<T = any> {
topic: string;
payload: T;
}
/**
* Retries quickly at first, then every 30 s for as long as the user is signed in.
* Gives up (null) once there is no token any more - a signed-out tab must not keep knocking.
*/
class SignedInRetryPolicy implements IRetryPolicy {
private static readonly steps = [0, 2000, 5000, 10000, 20000];
nextRetryDelayInMilliseconds(context: RetryContext): number | null {
if (!ApiService.AuthenticationToken && !localStorage.getItem('token')) {
return null;
}
const steps = SignedInRetryPolicy.steps;
return context.previousRetryCount < steps.length ? steps[context.previousRetryCount] : 30000;
}
}
/**
* The app's ONE SignalR connection (hub HRM.UI/Realtime/AppHub.cs at /api/hubs/app), shared by every feature.
*
* - Lazy: nothing connects until a feature asks (watchJob / on), so screens that never use it pay nothing.
* - Auth is the HttpOnly JWToken cookie the API already uses (same origin, sent automatically). No token in the URL.
* - Reconnects by itself; a new sign-in / payroll-type switch (new token) opens a fresh connection.
* - Signs out with the user (AuthService.logout$).
*
* Features use:
* watchJob(runId) - live progress of a background job (HRM.UI/Realtime/Jobs), with HTTP catch-up and fallback.
* on(topic) - any other server push (IRealtimePublisher.ToUserAsync / ToPayrollTypeAsync / ToAllAsync).
*/
@Injectable({ providedIn: 'root' })
export class RealtimeService implements OnDestroy {
private static readonly HUB_PATH = '/hubs/app';
/** While connected, a job with no message for this long is re-read over HTTP (a lost message can never freeze the bar). */
private static readonly SILENCE_CHECK_MS = 15000;
/** Polling interval when no connection can be made at all. */
private static readonly POLL_MS = 2000;
private connection: HubConnection | null = null;
private connectedToken: string | null = null;
private startPromise: Promise<boolean> | null = null;
private readonly stateSubject = new BehaviorSubject<RealtimeConnectionState>('disconnected');
private readonly jobProgress$ = new Subject<JobSnapshot>();
private readonly events$ = new Subject<RealtimeEvent>();
/** A (re)connection was made: joined groups are gone and must be joined again. */
private readonly resubscribe$ = new Subject<void>();
private readonly subscriptions = new Subscription();
/** Current connection state, e.g. for a small "live" indicator. */
readonly state$: Observable<RealtimeConnectionState> = this.stateSubject.asObservable();
constructor(private zone: NgZone, private apiService: ApiService, authService: AuthService) {
this.subscriptions.add(authService.logout$.subscribe(() => this.stop()));
}
ngOnDestroy(): void {
this.subscriptions.unsubscribe();
this.stop();
}
get isConnected(): boolean {
return this.connection?.state === HubConnectionState.Connected;
}
/**
* Makes sure the connection is up with the current sign-in. Resolves true when connected, false when it could not
* connect (callers then fall back to HTTP). Never rejects.
*/
connect(): Promise<boolean> {
const token = ApiService.AuthenticationToken || localStorage.getItem('token');
if (!token) {
return Promise.resolve(false);
}
// Signed in again or switched payroll type: the old connection carries the old claims.
if (this.connection && this.connectedToken !== token) {
this.dropConnection();
}
if (this.connection) {
if (this.connection.state === HubConnectionState.Connected) {
return Promise.resolve(true);
}
if (this.startPromise) {
return this.startPromise;
}
if (this.connection.state === HubConnectionState.Reconnecting) {
return Promise.resolve(false);
}
} else {
this.connection = this.buildConnection();
this.connectedToken = token;
}
const connection = this.connection;
this.setState('connecting');
const startPromise: Promise<boolean> = connection.start()
.then(() => {
if (this.connection !== connection) {
return false; // signed out / replaced while starting
}
this.setState('connected');
this.zone.run(() => this.resubscribe$.next());
return true;
})
.catch((err) => {
if (!environment.production) {
console.warn('[realtime] could not connect, HTTP fallback is used', err);
}
if (this.connection === connection) {
this.setState('disconnected');
}
return false;
})
.finally(() => {
if (this.startPromise === startPromise) {
this.startPromise = null;
}
});
this.startPromise = startPromise;
return startPromise;
}
/** Closes the connection (sign-out). Watchers keep working over HTTP until they finish. */
stop(): void {
this.dropConnection();
}
/**
* Server pushes of one topic (sent with IRealtimePublisher.ToUserAsync / ToPayrollTypeAsync / ToAllAsync).
* Subscribing connects if needed.
*/
on<T = any>(topic: string): Observable<T> {
return new Observable<T>((subscriber) => {
this.connect();
const sub = this.events$
.pipe(filter((e) => e.topic === topic), map((e) => e.payload as T))
.subscribe(subscriber);
return () => sub.unsubscribe();
});
}
/**
* Live state of a background job, from its current state to its end (the observable completes when the job
* has Succeeded or Failed). Works the same after a page reload, in a second tab and on a flaky network:
* it joins the job over SignalR, re-joins after every reconnect, re-reads over HTTP when the push goes quiet,
* and polls over HTTP if no connection can be made at all. Out-of-date messages are dropped by sequence.
*/
watchJob(runId: string): Observable<JobSnapshot> {
return new Observable<JobSnapshot>((subscriber) => {
let last: JobSnapshot | null = null;
let lastMessageAt = Date.now();
let closed = false;
let pollTimer: any = null;
let fetching = false;
const emit = (job: JobSnapshot | null | undefined) => {
if (closed || !job || job.runId !== runId) {
return;
}
lastMessageAt = Date.now();
if (last && job.sequence <= last.sequence) {
return;
}
last = job;
subscriber.next(job);
if (isJobFinished(job)) {
finish();
subscriber.complete();
}
};
const fetchOnce = () => {
if (closed || fetching) {
return;
}
fetching = true;
this.apiService.httpGet<JobSnapshot>('/jobs/' + encodeURIComponent(runId)).subscribe({
next: (job) => {
fetching = false;
emit(job);
},
error: (err) => {
fetching = false;
if (err?.status === 404 || err?.status === 403) {
finish();
subscriber.error(new Error(typeof err?.error === 'string' ? err.error : 'The job could not be found.'));
}
// other errors (network blip): the next tick tries again
}
});
};
const joinOverHub = () => {
if (closed || !this.connection || !this.isConnected) {
return;
}
this.connection.invoke<JobSnapshot>('SubscribeJob', runId)
.then((job) => this.zone.run(() => emit(job)))
.catch(() => this.zone.run(() => fetchOnce()));
};
// One timer does both jobs: polling when there is no connection, a silence check when there is.
const tick = () => {
if (closed) {
return;
}
if (!this.isConnected || Date.now() - lastMessageAt >= RealtimeService.SILENCE_CHECK_MS) {
fetchOnce();
}
};
const subs = new Subscription();
subs.add(this.jobProgress$.pipe(filter((j) => j.runId === runId)).subscribe((j) => emit(j)));
subs.add(this.resubscribe$.subscribe(() => joinOverHub()));
const finish = () => {
if (closed) {
return;
}
closed = true;
subs.unsubscribe();
if (pollTimer) {
clearInterval(pollTimer);
pollTimer = null;
}
if (this.connection && this.isConnected) {
this.connection.invoke('UnsubscribeJob', runId).catch(() => { /* connection going away */ });
}
};
pollTimer = setInterval(tick, RealtimeService.POLL_MS);
this.connect().then((ok) => {
if (ok) {
joinOverHub(); // connect() may already have emitted resubscribe$ - a second join is harmless
} else {
fetchOnce();
}
});
return () => finish();
});
}
private buildConnection(): HubConnection {
const connection = new HubConnectionBuilder()
.withUrl(ApiService.BASE_URL + RealtimeService.HUB_PATH, { withCredentials: true })
.withAutomaticReconnect(new SignedInRetryPolicy())
.configureLogging(environment.production ? LogLevel.Warning : LogLevel.Information)
.build();
// Server -> browser methods: the names of HRM.UI/Realtime/IAppClient.cs.
connection.on('JobProgress', (job: JobSnapshot) => this.zone.run(() => this.jobProgress$.next(job)));
connection.on('Event', (topic: string, payload: any) => this.zone.run(() => this.events$.next({ topic, payload })));
connection.onreconnecting(() => this.setState('reconnecting'));
connection.onreconnected(() => {
this.setState('connected');
this.zone.run(() => this.resubscribe$.next());
});
connection.onclose(() => {
if (this.connection === connection) {
this.setState('disconnected');
}
});
return connection;
}
private dropConnection(): void {
const connection = this.connection;
this.connection = null;
this.connectedToken = null;
this.startPromise = null;
this.setState('disconnected');
if (connection) {
connection.stop().catch(() => { /* already closed */ });
}
}
private setState(state: RealtimeConnectionState): void {
if (this.stateSubject.value !== state) {
this.zone.run(() => this.stateSubject.next(state));
}
}
}

View File

@ -0,0 +1,342 @@
<app-loading-panel></app-loading-panel>
@if (apiService.isSelService === true) {
<div>
<app-background-canvas></app-background-canvas>
</div>
}
<div class="up-page" [ngClass]="{'customGrid': apiService.isSelService === true}">
<!-- ── Profile Hero ── -->
<div class="up-hero">
<div class="up-hero-left">
<img class="up-photo" [src]="empPhoto" alt="Profile photo" (error)="onOwnPhotoError()" />
<div class="up-hero-info">
<div class="up-hero-name-row">
<span class="up-hero-name">{{empName}}</span>
<span class="up-hero-status-badge">{{empStatus}}</span>
</div>
<span class="up-hero-designation">{{empDesignation}} · {{empDepartment}}</span>
<span class="up-hero-location">
<svg width="13" height="13" viewBox="0 0 13 13" fill="none">
<path d="M6.5 1.5a3.5 3.5 0 013.5 3.5c0 2.5-3.5 7-3.5 7S3 7.5 3 5a3.5 3.5 0 013.5-3.5z"
stroke="#9CA3AF" stroke-width="1.2"/>
<circle cx="6.5" cy="5" r="1.3" stroke="#9CA3AF" stroke-width="1.2"/>
</svg>
{{empLocation}}
</span>
</div>
</div>
<div class="up-hero-right">
<button class="up-global-eye-btn" [class.up-global-eye-active]="showAllAmounts" (click)="toggleAllAmounts($event)" title="Toggle sensitive data">
<svg *ngIf="!showAllAmounts" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"></path>
<line x1="1" y1="1" x2="23" y2="23"></line>
</svg>
<svg *ngIf="showAllAmounts" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>
<circle cx="12" cy="12" r="3"></circle>
</svg>
</button>
<!-- Switch User Button — only when switchUserId is set (same as Payroll Home) -->
<button class="ph-btn-download" *ngIf="switchUserId" (click)="switchUser()">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M16 3l4 4-4 4"/>
<path d="M20 7H4"/>
<path d="M8 21l-4-4 4-4"/>
<path d="M4 17h16"/>
</svg>
Switch
</button>
<button class="up-btn-edit">
<svg width="15" height="15" viewBox="0 0 15 15" fill="none">
<path d="M10.5 1.5l3 3-8.5 8.5L2 13.5l.5-3 8-9z"
stroke="#045AEA" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
Edit Profile
</button>
</div>
</div>
<!-- ── Personal Information ── -->
<div class="up-section">
<div class="up-section-header">
<div class="up-section-title-row">
<div class="up-section-icon-wrap">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none">
<circle cx="9" cy="6" r="3" stroke="#045AEA" stroke-width="1.5"/>
<path d="M3 16c0-3.314 2.686-6 6-6s6 2.686 6 6"
stroke="#045AEA" stroke-width="1.5" stroke-linecap="round"/>
</svg>
</div>
<span class="up-section-title">Personal Information</span>
</div>
<span class="up-view-all">
View All
<svg width="14" height="14" viewBox="0 0 14 14" fill="none">
<path d="M3 7h8M7.5 3.5 11 7l-3.5 3.5"
stroke="#045AEA" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</span>
</div>
<div class="up-fields-grid up-grid-4">
<div class="up-field">
<span class="up-field-label">Employee ID</span>
<span class="up-field-value">{{employeeId}}</span>
</div>
<div class="up-field">
<span class="up-field-label">Full Name</span>
<span class="up-field-value">{{fullName}}</span>
</div>
<div class="up-field">
<span class="up-field-label">Date of Birth</span>
<span class="up-field-value">
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" style="flex-shrink:0">
<rect x="1" y="2.5" width="12" height="10" rx="1.5" stroke="#9CA3AF" stroke-width="1.2"/>
<path d="M4 1v3M10 1v3" stroke="#9CA3AF" stroke-width="1.2" stroke-linecap="round"/>
<path d="M1 6h12" stroke="#9CA3AF" stroke-width="1.2"/>
</svg>
{{dateOfBirth}}
</span>
</div>
<div class="up-field">
<span class="up-field-label">Gender</span>
<span class="up-field-value">{{gender}}</span>
</div>
<div class="up-field">
<span class="up-field-label">Status</span>
<span class="up-field-value">
<span class="up-active-badge">{{statusLabel}}</span>
</span>
</div>
<div class="up-field" style="display:none">
<span class="up-field-label">National ID</span>
<span class="up-field-value">
{{(showAllAmounts || showNationalId) ? nationalIdFull : nationalIdMasked}}
<svg class="up-eye" (click)="toggleNationalId($event)" width="16" height="16" viewBox="0 0 18 18" fill="none">
<path d="M1.5 9s3-6 7.5-6 7.5 6 7.5 6-3 6-7.5 6S1.5 9 1.5 9z"
stroke="#9CA3AF" stroke-width="1.3" stroke-linecap="round"/>
<circle cx="9" cy="9" r="2.25" stroke="#9CA3AF" stroke-width="1.3"/>
<path *ngIf="showNationalId" d="M2.5 15.5L15.5 2.5"
stroke="#9CA3AF" stroke-width="1.3" stroke-linecap="round"/>
</svg>
</span>
</div>
<div class="up-field">
<span class="up-field-label">TIN</span>
<span class="up-field-value">
{{(showAllAmounts || showTin) ? tinFull : tinMasked}}
<svg class="up-eye" (click)="toggleTin($event)" width="16" height="16" viewBox="0 0 18 18" fill="none">
<path d="M1.5 9s3-6 7.5-6 7.5 6 7.5 6-3 6-7.5 6S1.5 9 1.5 9z"
stroke="#9CA3AF" stroke-width="1.3" stroke-linecap="round"/>
<circle cx="9" cy="9" r="2.25" stroke="#9CA3AF" stroke-width="1.3"/>
<path *ngIf="showTin" d="M2.5 15.5L15.5 2.5"
stroke="#9CA3AF" stroke-width="1.3" stroke-linecap="round"/>
</svg>
</span>
</div>
</div>
</div>
<!-- ── Employment Details ── -->
<div class="up-section">
<div class="up-section-header">
<div class="up-section-title-row">
<div class="up-section-icon-wrap">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none">
<rect x="2" y="6" width="14" height="10" rx="2" stroke="#045AEA" stroke-width="1.5"/>
<path d="M6 6V4a2 2 0 012-2h2a2 2 0 012 2v2" stroke="#045AEA" stroke-width="1.5"/>
<path d="M2 10h14" stroke="#045AEA" stroke-width="1.5"/>
</svg>
</div>
<span class="up-section-title">Employment Details</span>
</div>
<span class="up-view-all">
View All
<svg width="14" height="14" viewBox="0 0 14 14" fill="none">
<path d="M3 7h8M7.5 3.5 11 7l-3.5 3.5"
stroke="#045AEA" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</span>
</div>
<div class="up-fields-grid up-grid-4">
<div class="up-field">
<span class="up-field-label">Division</span>
<span class="up-field-value">{{division}}</span>
</div>
<div class="up-field">
<span class="up-field-label">Department</span>
<span class="up-field-value">{{department}}</span>
</div>
<div class="up-field">
<span class="up-field-label">Designation</span>
<span class="up-field-value">{{designation}}</span>
</div>
<div class="up-field">
<span class="up-field-label">Grade</span>
<span class="up-field-value">
<span class="up-grade-badge">{{grade}}</span>
</span>
</div>
<div class="up-field">
<span class="up-field-label">Joining Date</span>
<span class="up-field-value">
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" style="flex-shrink:0">
<rect x="1" y="2.5" width="12" height="10" rx="1.5" stroke="#9CA3AF" stroke-width="1.2"/>
<path d="M4 1v3M10 1v3" stroke="#9CA3AF" stroke-width="1.2" stroke-linecap="round"/>
<path d="M1 6h12" stroke="#9CA3AF" stroke-width="1.2"/>
</svg>
{{joiningDate}}
</span>
</div>
<div class="up-field">
<span class="up-field-label">Years of Service</span>
<span class="up-field-value">{{yearsOfService}}</span>
</div>
<!-- <div class="up-field">
<span class="up-field-label">Manager</span>
<span class="up-field-value">{{manager}}</span>
</div> -->
<div class="up-field">
<span class="up-field-label">Location</span>
<span class="up-field-value">{{workLocation}}</span>
</div>
</div>
</div>
<!-- ── Contact Information ── -->
<div class="up-section">
<div class="up-section-header">
<div class="up-section-title-row">
<div class="up-section-icon-wrap">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none">
<path d="M3.5 3h3.5l1.5 3.5-1.5 1a8 8 0 003.5 3.5l1-1.5 3.5 1.5v3.5a1 1 0 01-1 1A13 13 0 012.5 4a1 1 0 011-1z"
stroke="#045AEA" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</div>
<span class="up-section-title">Contact Information</span>
</div>
<span class="up-view-all">
View All
<svg width="14" height="14" viewBox="0 0 14 14" fill="none">
<path d="M3 7h8M7.5 3.5 11 7l-3.5 3.5"
stroke="#045AEA" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</span>
</div>
<div class="up-fields-grid up-grid-2">
<div class="up-field">
<span class="up-field-label">Work Email</span>
<span class="up-field-value">
{{workEmail}}
<svg class="up-copy-btn" (click)="copy(workEmail)" width="14" height="14" viewBox="0 0 14 14" fill="none">
<rect x="4.5" y="4.5" width="8" height="8" rx="1.5" stroke="#9CA3AF" stroke-width="1.2"/>
<path d="M9.5 4.5V3A1.5 1.5 0 008 1.5H3A1.5 1.5 0 001.5 3v5A1.5 1.5 0 003 9.5h1.5"
stroke="#9CA3AF" stroke-width="1.2"/>
</svg>
</span>
</div>
<div class="up-field" style="display: none;">
<span class="up-field-label">Personal Email</span>
<span class="up-field-value">
{{personalEmail}}
<svg class="up-copy-btn" (click)="copy(personalEmail)" width="14" height="14" viewBox="0 0 14 14" fill="none">
<rect x="4.5" y="4.5" width="8" height="8" rx="1.5" stroke="#9CA3AF" stroke-width="1.2"/>
<path d="M9.5 4.5V3A1.5 1.5 0 008 1.5H3A1.5 1.5 0 001.5 3v5A1.5 1.5 0 003 9.5h1.5"
stroke="#9CA3AF" stroke-width="1.2"/>
</svg>
</span>
</div>
<div class="up-field">
<span class="up-field-label">Mobile</span>
<span class="up-field-value">
{{mobile}}
<svg class="up-copy-btn" (click)="copy(mobile)" width="14" height="14" viewBox="0 0 14 14" fill="none">
<rect x="4.5" y="4.5" width="8" height="8" rx="1.5" stroke="#9CA3AF" stroke-width="1.2"/>
<path d="M9.5 4.5V3A1.5 1.5 0 008 1.5H3A1.5 1.5 0 001.5 3v5A1.5 1.5 0 003 9.5h1.5"
stroke="#9CA3AF" stroke-width="1.2"/>
</svg>
</span>
</div>
<div class="up-field" style="display: none;">
<span class="up-field-label">Address</span>
<span class="up-field-value">{{address}}</span>
</div>
</div>
</div>
</div>
<!-- ── Switch User Dialog (Kendo Dialog, same as user-ss-dashboard; design unchanged) ── -->
@if (showModal) {
<div class="blur-background">
<kendo-dialog class="ph-switch-dialog" (close)="onPopUpClose()" [width]="620" (keydown.escape)="$event.stopPropagation()">
<div class="ph-modal-card">
<div class="ph-modal-header">
<div class="ph-modal-header-left">
<div class="ph-modal-icon-wrap">
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="#045AEA" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M16 3l4 4-4 4"/>
<path d="M20 7H4"/>
<path d="M8 21l-4-4 4-4"/>
<path d="M4 17h16"/>
</svg>
</div>
<div>
<h2 class="ph-modal-title">Switch to Admin</h2>
<p class="ph-modal-subtitle">Select a payroll type to continue</p>
</div>
</div>
<button class="ph-modal-close" (click)="onPopUpClose()">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#6B7280" stroke-width="2.5" stroke-linecap="round">
<line x1="18" y1="6" x2="6" y2="18"/>
<line x1="6" y1="6" x2="18" y2="18"/>
</svg>
</button>
</div>
<div class="ph-modal-body">
<p class="ph-modal-hint">Select a payroll type to switch to Admin mode.</p>
<div class="ph-type-list">
@for (type of payrollTypes; track type) {
<div class="ph-type-item" (click)="selectAccessType(type.id)">
<div class="ph-type-icon-wrap">
<img class="ph-type-img" [src]="getImagePath(type.id)" alt="{{ type.description }}" />
</div>
<div class="ph-type-info">
<span class="ph-type-name">{{ type.description }}</span>
<span class="ph-type-sub">Admin Mode</span>
</div>
<div class="ph-type-arrow">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#045AEA" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<polyline points="9 18 15 12 9 6"/>
</svg>
</div>
</div>
}
</div>
</div>
<div class="ph-modal-footer">
<button class="ph-modal-cancel-btn" (click)="onPopUpClose()">Cancel</button>
</div>
</div>
</kendo-dialog>
</div>
}

View File

@ -0,0 +1,530 @@
/* Same as user-ss-dashboard: no layout padding around the page */
:host ::ng-deep .layout-wrapper .layout-main .layout-content {
padding: 0px !important;
}
/* ── Page wrapper ── */
.up-page {
display: flex;
flex-direction: column;
gap: 16px;
box-sizing: border-box;
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
/* Keep the page above the absolutely positioned background canvas */
position: relative;
z-index: 1;
}
/* Same width as user-ss-dashboard */
.customGrid {
margin: 0 80px;
transition: margin 0.4s ease;
}
@media (max-width: 991px) {
.customGrid { margin: 0; }
}
/* ── Profile Hero ── */
.up-hero {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px 20px;
border: 1px solid #D4E4F7;
border-radius: 14px;
background:
radial-gradient(ellipse 70% 150% at 0% 50%, rgba(219, 234, 254, 0.60) 0%, rgba(219, 234, 254, 0) 100%),
radial-gradient(ellipse 55% 150% at 100% 50%, rgba(191, 219, 254, 0.45) 0%, rgba(191, 219, 254, 0) 100%),
linear-gradient(to right, #EEF6FF 0%, #F8FBFF 45%, #FFFFFF 70%, #F8FBFF 100%);
box-sizing: border-box;
}
.up-hero-left {
display: flex;
align-items: center;
gap: 18px;
}
.up-photo {
width: 82px;
height: 82px;
border-radius: 12px;
object-fit: cover;
flex-shrink: 0;
border: 1.5px solid #DBEAFE;
}
.up-hero-info {
display: flex;
flex-direction: column;
gap: 5px;
}
.up-hero-name-row {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
}
.up-hero-name {
font-size: 22px;
font-weight: 700;
color: #0A0A0A;
line-height: 1.2;
}
.up-hero-status-badge {
background: #DCFCE7;
color: #16A34A;
font-size: 12px;
font-weight: 500;
padding: 2px 10px;
border-radius: 100px;
}
.up-hero-designation {
font-size: 14px;
color: #6B7280;
font-weight: 400;
}
.up-hero-location {
display: flex;
align-items: center;
gap: 4px;
font-size: 13px;
color: #9CA3AF;
font-weight: 400;
}
/* Hero right group */
.up-hero-right {
display: flex;
align-items: center;
gap: 10px;
flex-shrink: 0;
}
/* Global eye button */
.up-global-eye-btn {
display: flex;
align-items: center;
gap: 6px;
padding: 6px 12px;
border: 1.5px solid #BFDBFE;
border-radius: 20px;
background: #EFF6FF;
cursor: pointer;
font-size: 12.5px;
font-weight: 600;
color: #2563EB;
transition: background 0.15s, border-color 0.15s;
flex-shrink: 0;
}
.up-global-eye-btn:hover {
background: #DBEAFE;
border-color: #93C5FD;
}
.up-global-eye-btn.up-global-eye-active {
background: #2563EB;
border-color: #2563EB;
color: #ffffff;
}
/* Edit Profile button */
.up-btn-edit {
display: none;
/* display: inline-flex; */
align-items: center;
gap: 7px;
height: 40px;
padding: 0 18px;
background: rgba(255, 255, 255, 0.85);
border: 1px solid #BFDBFE;
border-radius: 10px;
color: #045AEA;
font-size: 14px;
font-weight: 500;
cursor: pointer;
white-space: nowrap;
transition: background 0.15s, border-color 0.15s;
font-family: 'Inter', -apple-system, sans-serif;
}
.up-btn-edit:hover {
background: rgba(239, 246, 255, 0.95);
border-color: #93C5FD;
}
/* ── Section cards ── */
.up-section {
background: #ffffff;
border: 1px solid #EEF1F5;
border-radius: 14px;
padding: 20px 24px;
box-sizing: border-box;
}
.up-section-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 22px;
}
.up-section-title-row {
display: flex;
align-items: center;
gap: 10px;
}
.up-section-icon-wrap {
width: 36px;
height: 36px;
border-radius: 9px;
background: #EEF4FF;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.up-section-title {
font-size: 16px;
font-weight: 600;
color: #0A0A0A;
}
.up-view-all {
/* display: flex; */
display: none;
align-items: center;
gap: 4px;
font-size: 13px;
color: #045AEA;
font-weight: 400;
cursor: pointer;
transition: color 0.15s;
user-select: none;
}
.up-view-all:hover { color: #0347c7; }
/* ── Fields grid ── */
.up-fields-grid {
display: grid;
gap: 22px 20px;
}
.up-grid-4 { grid-template-columns: repeat(4, 1fr); }
.up-grid-2 { grid-template-columns: repeat(2, 1fr); }
.up-field {
display: flex;
flex-direction: column;
gap: 6px;
}
.up-field-label {
font-size: 12px;
color: #9CA3AF;
font-weight: 400;
}
.up-field-value {
font-size: 14px;
font-weight: 500;
color: #0A0A0A;
display: flex;
align-items: center;
gap: 6px;
}
/* Active status badge */
.up-active-badge {
display: inline-flex;
align-items: center;
background: #DCFCE7;
color: #16A34A;
font-size: 12px;
font-weight: 500;
padding: 3px 10px;
border-radius: 100px;
}
/* Grade badge */
.up-grade-badge {
display: inline-flex;
align-items: center;
background: #D1FAE5;
color: #065F46;
font-size: 12px;
font-weight: 600;
padding: 3px 10px;
border-radius: 100px;
}
/* Eye toggle */
.up-eye {
cursor: pointer;
flex-shrink: 0;
opacity: 0.65;
transition: opacity 0.15s;
}
.up-eye:hover { opacity: 1; }
/* Copy button */
.up-copy-btn {
cursor: pointer;
flex-shrink: 0;
opacity: 0.45;
transition: opacity 0.15s;
}
.up-copy-btn:hover { opacity: 0.9; }
/* ── Responsive ── */
@media (max-width: 1100px) {
.up-page { padding: 20px 24px 28px; }
.up-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
.up-page { padding: 16px 16px 24px; }
.up-hero { flex-direction: column; align-items: flex-start; gap: 16px; }
.up-btn-edit { width: 100%; justify-content: center; }
.up-grid-4 { grid-template-columns: repeat(2, 1fr); }
.up-grid-2 { grid-template-columns: 1fr; }
.up-hero-name { font-size: 18px; }
}
@media (max-width: 480px) {
.up-section { padding: 18px 16px; }
.up-grid-4 { grid-template-columns: 1fr; }
.up-hero { padding: 18px 16px; }
}
/* ── Switch button + Switch User modal (from Payroll Home) ── */
.ph-btn-download {
display: inline-flex;
align-items: center;
gap: 8px;
background: linear-gradient(135deg, #045AEA, #3B82F6);
color: #ffffff;
border: none;
border-radius: 10px;
padding: 0 20px;
height: 40px;
font-size: 13.5px;
font-weight: 600;
cursor: pointer;
white-space: nowrap;
box-sizing: border-box;
}
.ph-btn-download:hover { opacity: 0.88; }
/* Kendo Dialog shell: strip its own frame so the card below keeps the same design */
:host ::ng-deep .ph-switch-dialog .k-window,
:host ::ng-deep .ph-switch-dialog .k-dialog {
background: transparent;
border: 0;
box-shadow: none;
border-radius: 20px;
max-width: calc(100vw - 32px);
}
:host ::ng-deep .ph-switch-dialog .k-window-content,
:host ::ng-deep .ph-switch-dialog .k-dialog-content {
padding: 0;
background: transparent;
overflow: visible;
}
.ph-modal-card {
background: #ffffff;
border-radius: 20px;
box-shadow: 0 24px 60px rgba(4, 90, 234, 0.15), 0 4px 16px rgba(0,0,0,0.1);
width: 100%;
max-width: 620px;
overflow: hidden;
animation: ph-slide-up 0.2s ease;
}
@keyframes ph-slide-up {
from { transform: translateY(24px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
/* Modal Header */
.ph-modal-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 22px 24px 20px;
border-bottom: 1px solid #F1F5F9;
}
.ph-modal-header-left {
display: flex;
align-items: center;
gap: 14px;
}
.ph-modal-icon-wrap {
width: 46px;
height: 46px;
background: #EEF4FF;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.ph-modal-title {
font-size: 17px;
font-weight: 700;
color: #0A0A0A;
margin: 0 0 2px;
line-height: 1.3;
}
.ph-modal-subtitle {
font-size: 13px;
color: #6B7280;
margin: 0;
}
.ph-modal-close {
width: 36px;
height: 36px;
border: none;
background: #F3F4F6;
border-radius: 8px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
transition: background 0.15s;
}
.ph-modal-close:hover { background: #E5E7EB; }
/* Modal Body */
.ph-modal-body {
padding: 20px 24px;
}
.ph-modal-hint {
font-size: 13px;
color: #6B7280;
margin: 0 0 16px;
}
/* Two payroll types side by side; a single one takes the full width */
.ph-type-list {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px;
}
.ph-type-item:only-child {
grid-column: 1 / -1;
}
@media (max-width: 480px) {
.ph-type-list { grid-template-columns: 1fr; }
}
/* Payroll type image (same images as user-ss-dashboard) */
.ph-type-img {
width: 32px;
height: 32px;
object-fit: contain;
}
.ph-type-item {
display: flex;
align-items: center;
gap: 14px;
padding: 16px 18px;
border: 1.5px solid #E5E7EB;
border-radius: 14px;
cursor: pointer;
transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
background: #ffffff;
}
.ph-type-item:hover {
border-color: #045AEA;
background: #F0F6FF;
box-shadow: 0 2px 10px rgba(4, 90, 234, 0.10);
}
.ph-type-icon-wrap {
width: 44px;
height: 44px;
background: #EEF4FF;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
transition: background 0.15s;
}
.ph-type-item:hover .ph-type-icon-wrap {
background: #DBEAFE;
}
.ph-type-info {
flex: 1;
display: flex;
flex-direction: column;
gap: 3px;
min-width: 0;
}
.ph-type-name {
font-size: 15px;
font-weight: 600;
color: #111827;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.ph-type-sub {
font-size: 12px;
color: #9CA3AF;
}
.ph-type-arrow {
flex-shrink: 0;
opacity: 0;
transition: opacity 0.15s, transform 0.15s;
}
.ph-type-item:hover .ph-type-arrow {
opacity: 1;
transform: translateX(3px);
}
/* Modal Footer */
.ph-modal-footer {
padding: 16px 24px 22px;
border-top: 1px solid #F1F5F9;
display: flex;
justify-content: flex-end;
}
.ph-modal-cancel-btn {
padding: 10px 28px;
border: 1.5px solid #D1D5DB;
border-radius: 8px;
background: #ffffff;
color: #374151;
font-size: 14px;
font-weight: 500;
cursor: pointer;
font-family: inherit;
transition: background 0.15s, border-color 0.15s;
}
.ph-modal-cancel-btn:hover { background: #F9FAFB; border-color: #9CA3AF; }

View File

@ -0,0 +1,345 @@
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { JwtHelperService } from '@auth0/angular-jwt';
import { HRMNotificationService } from 'src/app/app.notification.service';
import { EssService } from 'src/app/_services/ess/ess.service';
import { loadingPanelService } from 'src/app/hrm-loding panel/loding.panel.service';
import { AuthService } from 'src/app/_services/auth/auth.service';
import { ApiService } from 'src/app/app.api.service';
import { EnumUserType } from 'src/app/_models/enums';
import { PayrollType } from 'src/app/_models/Authentication/payrollType';
import { Bookmark } from 'src/app/_models/Basic/bookmark';
import { AppMainComponent } from 'src/app/app.main.component';
import { AuthGuard } from 'src/app/_guards/auth.guard';
@Component({
selector: 'app-brac-self-service',
templateUrl: './brac-self-service.component.html',
styleUrls: ['./brac-self-service.component.scss'],
changeDetection: ChangeDetectionStrategy.Eager,
standalone: false
})
export class BRACSelfServiceComponent implements OnInit {
// Hero
empName = '';
empStatus = '';
empDesignation = '';
empDepartment = '';
empLocation = '';
empPhoto = ApiService.DEFAULT_PHOTO;
// Personal Information
employeeId = '';
fullName = '';
dateOfBirth = '';
gender = '';
statusLabel = '';
nationalIdMasked = '';
nationalIdFull = '';
showNationalId = false;
tinMasked = '';
tinFull = '';
showTin = false;
// Employment Details
division = '';
department = '';
designation = '';
grade = '';
joiningDate = '';
yearsOfService = '';
manager = '';
workLocation = '';
// Contact Information
workEmail = '';
personalEmail = '';
mobile = '';
address = '';
showAllAmounts = false;
// Switch (same as GP_Master hress/payroll-home)
switchUserId: number;
payrollTypes: PayrollType[] = [];
showModal: boolean = false;
selectedPayrollTypeID: number;
bookmarks: Bookmark[];
// Payroll type images (same as user-ss-dashboard)
public payrollTypesImg = [
{ id: 1, imagePath: 'assets/payrolltype-img/payrolltype1.png' },
{ id: 2, imagePath: 'assets/payrolltype-img/payrolltype2.png' },
{ id: 3, imagePath: 'assets/payrolltype-img/payrolltype3.png' },
{ id: 4, imagePath: 'assets/payrolltype-img/payrolltype4.png' },
{ id: 5, imagePath: 'assets/payrolltype-img/payrolltype5.png' }
];
public getImagePath(typeId: number): string {
const typeImage = this.payrollTypesImg.find(img => img.id === typeId);
return typeImage ? typeImage.imagePath : 'assets/layout/images/Logo.png';
}
constructor(
private notify: HRMNotificationService,
private essService: EssService,
private loadingPanel: loadingPanelService,
private authService: AuthService,
private apiService: ApiService,
public appMain: AppMainComponent,
private auth: AuthGuard,
public router: Router,
) {}
ngOnInit(): void {
this.loadProfile();
}
private loadProfile(): void {
this.loadingPanel.ShowLoadingPanel = true;
this.essService.getUserProfile().subscribe(
(res) => {
const b = res?.basic && res.basic.length > 0 ? res.basic[0] : {};
const c = res?.contact && res.contact.length > 0 ? res.contact[0] : {};
this.mapBasicData(b);
this.mapContactData(c);
// Same as user-ss-dashboard: a plain URL, so the browser fetches and caches the image itself.
this.empPhoto = this.apiService.empPhotoUrl(this.employeeId);
},
(err) => {
this.loadingPanel.ShowLoadingPanel = false;
this.notify.showError(err?.error || 'Failed to load profile data');
},
() => {
this.loadingPanel.ShowLoadingPanel = false;
this.LoadSwitchUserId();
}
);
}
// Backend maps EMPLOYEE.STATUS = 1 to the literal 'Live' (see EmployeeDA.GetSelfServiceBasicData).
// Employees know this state as "Active", so present it that way.
private displayStatus(raw: string): string {
return /^live$/i.test(raw.trim()) ? 'Active' : raw.trim();
}
// Calendar-accurate elapsed time from joining date to today, e.g. "17 years 1 month 25 days".
private formatServiceLength(from: Date): string {
const now = new Date();
let years = now.getFullYear() - from.getFullYear();
let months = now.getMonth() - from.getMonth();
let days = now.getDate() - from.getDate();
if (days < 0) {
months -= 1;
const prevMonthDays = new Date(now.getFullYear(), now.getMonth(), 0).getDate();
days += prevMonthDays;
}
if (months < 0) {
years -= 1;
months += 12;
}
const parts: string[] = [];
if (years > 0) parts.push(years + (years === 1 ? ' year' : ' years'));
if (months > 0) parts.push(months + (months === 1 ? ' month' : ' months'));
if (days > 0) parts.push(days + (days === 1 ? ' day' : ' days'));
return parts.length ? parts.join(' ') : '0 days';
}
private mapBasicData(b: any): void {
const str = (v: any): string => (v != null ? String(v).trim() : '');
this.empName = str(b.fullName);
this.empStatus = this.displayStatus(str(b.status));
this.empDesignation = str(b.designation);
this.empDepartment = str(b.department);
this.empLocation = str(b.location);
this.employeeId = str(b.employeeNo);
this.fullName = str(b.fullName);
this.gender = str(b.gender);
this.statusLabel = this.displayStatus(str(b.status));
const nid = str(b.nid);
this.nationalIdFull = nid;
this.nationalIdMasked = nid.length > 4 ? '••••••••' + nid.slice(-4) : (nid ? '••••••••' : '—');
const tin = str(b.tin);
this.tinFull = tin;
this.tinMasked = tin.length > 3 ? '•••••••' + tin.slice(-3) : (tin ? '•••••••' : '—');
if (b.birthDate) {
const d = new Date(b.birthDate);
if (!isNaN(d.getTime()))
this.dateOfBirth = d.toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: 'numeric' });
}
this.division = str(b.division);
this.department = str(b.department);
this.designation = str(b.designation);
this.grade = str(b.grade);
const lm = str(b.lineManager);
const dash = lm.indexOf('-');
this.manager = dash >= 0 ? lm.substring(dash + 1).trim() : lm;
this.workLocation = str(b.location);
if (b.joiningDate) {
const jd = new Date(b.joiningDate);
if (!isNaN(jd.getTime())) {
this.joiningDate = jd.toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: 'numeric' });
this.yearsOfService = this.formatServiceLength(jd);
}
}
this.workEmail = str(b.emailAddress);
this.mobile = str(b.mobileNo);
}
private mapContactData(c: any): void {
const str = (v: any): string => (v != null ? String(v).trim() : '');
this.personalEmail = str(c.personalEmail);
this.address = str(c.permanentAddress) || str(c.presentAddress);
}
/** Same fallback as user-ss-dashboard when the employee has no photo on file. */
onOwnPhotoError() {
this.empPhoto = ApiService.DEFAULT_PHOTO;
}
toggleAllAmounts(e: MouseEvent): void {
e.stopPropagation();
this.showAllAmounts = !this.showAllAmounts;
}
toggleNationalId(e: MouseEvent): void {
e.stopPropagation();
this.showNationalId = !this.showNationalId;
}
toggleTin(e: MouseEvent): void {
e.stopPropagation();
this.showTin = !this.showTin;
}
copy(text: string): void {
navigator.clipboard?.writeText(text).then(() => {
this.notify.showSuccess('Copied to clipboard');
});
}
/* ── Switch User (same as GP_Master hress/payroll-home) ── */
private LoadSwitchUserId() {
this.authService.getSwitchUserId(EnumUserType.User).subscribe(
(resp) => {
if (resp == 0) {
this.switchUserId = undefined;
}
else {
this.switchUserId = resp;
}
},
(err) => {
},
() => {
});
}
switchUser() {
this.loadPayrollTypes();
}
private loadPayrollTypes() {
this.loadingPanel.ShowLoadingPanel = true;
this.authService.getAdminPayrollTypes().subscribe(
(resp) => {
this.payrollTypes = resp;
},
() => {
this.loadingPanel.ShowLoadingPanel = false;
},
() => {
this.loadingPanel.ShowLoadingPanel = false;
if (this.payrollTypes.length > 0) {
this.showModal = true;
}
});
}
onPopUpClose() {
this.showModal = false;
}
selectAccessType(typeId: number): void {
this.selectedPayrollTypeID = typeId;
this.processSwitchUser();
}
private processSwitchUser() {
this.loadingPanel.ShowLoadingPanel = true;
var currentUser;
this.authService.GetCurrentUser().subscribe(
(item: any) => {
currentUser = item;
},
(errmenu: any) => {
this.loadingPanel.ShowLoadingPanel = false;
},
() => {
currentUser.UserType = EnumUserType.User;
const data = {
user: currentUser,
payrollTypeId: this.selectedPayrollTypeID,
};
this.authService.SwtichUserMode(data).subscribe(
(resp: any) => {
localStorage.setItem('token', resp);
ApiService.AuthenticationToken = resp;
},
(err: any) => {
this.notify.showError('Invalid Login-ID or Password');
this.loadingPanel.ShowLoadingPanel = false;
},
() => {
const jwtHelper = new JwtHelperService();
const user = jwtHelper.decodeToken(localStorage.getItem('token'));
this.appMain.IsSelfService();
if (user.ChangePasswordAtNextLogon === 'True' && this.apiService.isSSO !== true) {
localStorage.removeItem('menuList');
this.auth.menuEvent.emit(false);
this.loadingPanel.ShowLoadingPanel = false;
this.router.navigate(['/authentication/change-password']);
} else {
this.authService.GetRolePermissionbyUserID().subscribe(
(menu: any) => {
localStorage.setItem('menuList', JSON.stringify(menu));
this.router.navigate(['/']);
},
(errmenu: any) => {
this.loadingPanel.ShowLoadingPanel = false;
},
() => {
this.loadingPanel.ShowLoadingPanel = false;
this.loadBookmark();
this.auth.menuEvent.emit(true);
});
}
this.loadingPanel.ShowLoadingPanel = false;
});
});
}
private loadBookmark() {
this.authService.getBookmarks().subscribe(
(resp: any) => {
this.bookmarks = resp;
},
(x) => {
},
() => {
localStorage.removeItem('bookmark');
localStorage.setItem('bookmark', JSON.stringify(this.bookmarks));
});
}
}

View File

@ -0,0 +1,656 @@
/* ─── Wrapper ────────────────────────────────────────────── */
.ap-wrapper {
display: flex;
flex-direction: column;
gap: 20px;
padding: 0 10px 24px 10px;
font-family: var(--gh-font);
color: var(--gh-tt);
}
/* ─── Card Base ───────────────────────────────────────────── */
.ap-card {
background: #ffffff;
border: 1px solid var(--gh-bo);
border-radius: 14px;
overflow: hidden;
}
.ap-card-pad {
padding: 22px 24px;
}
/* Table card: header padded, table full-width */
.ap-card-table {
padding: 0;
}
.ap-card-hdr {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
padding: 18px 24px;
border-bottom: 1px solid #F3F4F6;
}
.ap-table-wrap {
overflow-x: auto;
}
/* ─── Header Section ──────────────────────────────────────── */
.ap-header-section {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
gap: 20px;
}
.ap-page-title {
font-size: 22px;
font-weight: 800;
color: var(--gh-tt);
margin: 0 0 4px 0;
letter-spacing: -0.3px;
}
.ap-page-sub {
font-size: 13px;
color: var(--gh-muted);
margin: 0;
}
/* Header meta chips (salary month + approval deadline) */
.ap-header-meta {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-top: 12px;
}
.ap-meta-chip {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 5px 12px;
background: #F3F4F6;
border: 1px solid var(--gh-bo);
border-radius: 20px;
font-size: 12px;
color: var(--gh-muted);
white-space: nowrap;
}
.ap-meta-chip strong { color: var(--gh-tt); font-weight: 700; }
.ap-meta-chip-danger {
background: #FEE2E2;
border-color: #FECACA;
color: var(--gh-dnh);
}
.ap-meta-chip-danger strong { color: var(--gh-dnh); }
/* Approval-date-passed banner */
.ap-deadline-banner {
display: flex;
align-items: center;
gap: 10px;
padding: 13px 18px;
background: #FEE2E2;
border-color: #FECACA;
color: var(--gh-dnh);
font-size: 13px;
font-weight: 600;
line-height: 1.4;
}
.ap-deadline-banner svg { flex-shrink: 0; }
/* Orange Alert Banner (right side of header row) */
.ap-alert-banner {
display: flex;
align-items: center;
gap: 20px;
background: #FFF7ED;
border: 1px solid #FED7AA;
border-radius: 12px;
padding: 13px 20px;
flex-shrink: 0;
}
.ap-alert-left {
display: flex;
align-items: center;
gap: 10px;
}
.ap-alert-icon-wrap {
width: 32px;
height: 32px;
background: #FFEDD5;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.ap-alert-text {
font-size: 13.5px;
color: var(--gh-warn);
}
.ap-alert-text strong {
font-weight: 700;
color: var(--gh-warn);
}
.ap-view-pending-btn {
background: none;
border: none;
cursor: pointer;
font-size: 13px;
font-weight: 700;
color: var(--gh-warn);
padding: 0;
white-space: nowrap;
font-family: inherit;
transition: color 0.15s;
}
.ap-view-pending-btn:hover { color: var(--gh-warn); }
/* ─── Section Header ──────────────────────────────────────── */
.ap-section {
display: flex;
flex-direction: column;
gap: 12px;
}
.ap-section-hdr {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
}
.ap-section-title {
font-size: 17px;
font-weight: 700;
color: var(--gh-tt);
margin-bottom: 2px;
}
.ap-section-sub {
font-size: 12.5px;
color: var(--gh-muted);
}
.ap-view-all-pending-btn {
background: none;
border: none;
cursor: pointer;
font-size: 13px;
font-weight: 700;
color: var(--gh-warn);
padding: 0;
white-space: nowrap;
font-family: inherit;
flex-shrink: 0;
transition: color 0.15s;
}
.ap-view-all-pending-btn:hover { color: var(--gh-warn); }
/* ─── Approval Overview Cards ─────────────────────────────── */
.ap-overview-row {
display: flex;
gap: 14px;
align-items: stretch;
}
.ap-overview-card {
flex: 1;
min-width: 0;
background: #ffffff;
border: 1px solid var(--gh-bo);
border-radius: 14px;
padding: 18px 20px;
display: flex;
flex-direction: column;
gap: 10px;
}
.ap-ov-top {
display: flex;
align-items: center;
gap: 10px;
}
.ap-ov-icon-wrap {
width: 40px;
height: 40px;
background: #DCFCE7;
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.ap-ov-title {
font-size: 13.5px;
font-weight: 700;
color: var(--gh-bt);
line-height: 1.3;
}
.ap-ov-count {
font-size: 32px;
font-weight: 800;
color: var(--gh-tt);
letter-spacing: -1px;
line-height: 1;
text-align: center;
}
.ap-ov-stats {
display: flex;
flex-direction: column;
gap: 6px;
margin-top: 2px;
}
.ap-ov-stat {
display: flex;
align-items: center;
gap: 7px;
}
.ap-ov-dot {
width: 7px;
height: 7px;
border-radius: 50%;
flex-shrink: 0;
}
.ap-ov-dot-green { background: var(--gh-ok); }
.ap-ov-dot-orange { background: var(--gh-warn); }
.ap-ov-stat-lbl {
font-size: 12px;
color: var(--gh-muted);
flex: 1;
}
.ap-ov-stat-val {
font-size: 13px;
font-weight: 700;
color: var(--gh-tt);
}
.ap-ov-footer {
margin-top: auto;
padding-top: 10px;
border-top: 1px solid #F3F4F6;
}
.ap-view-all-btn {
background: none;
border: none;
cursor: pointer;
font-size: 12.5px;
font-weight: 700;
color: var(--gh-ok);
padding: 0;
font-family: inherit;
transition: color 0.15s;
}
.ap-view-all-btn:hover { color: var(--gh-ok); }
/* ─── Pending Requests Table ──────────────────────────────── */
.ap-table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
}
.ap-table thead tr {
background: #F9FAFB;
border-bottom: 1px solid var(--gh-bo);
}
.ap-table th {
padding: 12px 16px;
text-align: left;
font-size: 11px;
font-weight: 600;
color: var(--gh-muted);
text-transform: uppercase;
letter-spacing: 0.06em;
white-space: nowrap;
}
.ap-table tbody tr {
border-bottom: 1px solid #F3F4F6;
transition: background 0.1s;
}
.ap-table tbody tr:last-child { border-bottom: none; }
.ap-table tbody tr:hover { background: #FAFAFA; }
.ap-table td {
padding: 14px 16px;
vertical-align: middle;
}
/* Request Type cell */
.ap-type-cell {
display: flex;
align-items: center;
gap: 10px;
}
.ap-type-icon-wrap {
width: 34px;
height: 34px;
background: #DCFCE7;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.ap-type-name {
font-size: 13px;
font-weight: 600;
color: var(--gh-tt);
white-space: nowrap;
}
/* Employee cell */
.ap-employee-cell {
display: flex;
align-items: center;
gap: 10px;
}
.ap-avatar {
width: 32px;
height: 32px;
border-radius: 50%;
background: var(--gh-th);
color: var(--gh-btn);
font-size: 11px;
font-weight: 700;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
letter-spacing: 0.5px;
}
.ap-employee-info {
display: flex;
flex-direction: column;
gap: 2px;
}
.ap-employee-name {
font-size: 13px;
font-weight: 600;
color: var(--gh-tt);
white-space: nowrap;
}
.ap-employee-id {
font-size: 11.5px;
color: #9CA3AF;
}
/* Date cell */
.ap-date-cell {
display: flex;
align-items: flex-start;
gap: 6px;
color: var(--gh-bt);
white-space: nowrap;
}
.ap-date-info {
display: flex;
flex-direction: column;
gap: 2px;
}
.ap-date-val {
font-size: 13px;
color: var(--gh-bt);
}
.ap-date-time {
font-size: 11.5px;
color: #9CA3AF;
}
/* Description */
.ap-description {
font-size: 12.5px;
color: var(--gh-muted);
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
overflow: hidden;
max-width: 220px;
}
/* Status badge */
.ap-status-badge {
display: inline-flex;
align-items: center;
padding: 4px 12px;
background: #FFF7ED;
border: 1px solid #FED7AA;
border-radius: 20px;
font-size: 11.5px;
font-weight: 700;
color: var(--gh-warn);
white-space: nowrap;
letter-spacing: 0.03em;
}
.ap-status-badge-approved {
background: #DCFCE7;
border-color: #BBF7D0;
color: var(--gh-ok);
}
/* Action cell */
.ap-action-cell {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.ap-btn {
border: none;
border-radius: 8px;
padding: 7px 16px;
font-size: 12.5px;
font-weight: 700;
cursor: pointer;
font-family: inherit;
white-space: nowrap;
color: #ffffff;
transition: background 0.15s;
}
.ap-btn-review { background: var(--gh-btn); }
.ap-btn-review:hover { background: var(--gh-btn); }
.ap-btn-approve { background: var(--gh-ok); }
.ap-btn-approve:hover { background: var(--gh-ok); }
.ap-btn-reject { background: var(--gh-dn); }
.ap-btn-reject:hover { background: var(--gh-dnh); }
.ap-no-action { color: #9CA3AF; font-size: 13px; }
/* ─── Footer Strip ────────────────────────────────────────── */
.ap-footer-strip {
display: flex;
align-items: center;
justify-content: space-between;
background: #ffffff;
border: 1px solid var(--gh-bo);
border-radius: 12px;
padding: 14px 20px;
gap: 16px;
}
.ap-footer-left {
display: flex;
align-items: center;
gap: 10px;
}
.ap-footer-icon {
width: 34px;
height: 34px;
background: #DCFCE7;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.ap-footer-text {
font-size: 13px;
color: var(--gh-bt);
font-weight: 500;
}
.ap-footer-right {
display: flex;
align-items: center;
gap: 8px;
flex-shrink: 0;
}
.ap-footer-updated {
font-size: 12px;
color: var(--gh-muted);
white-space: nowrap;
}
.ap-refresh-btn {
background: none;
border: 1px solid var(--gh-bo);
border-radius: 7px;
width: 28px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: background 0.15s;
}
.ap-refresh-btn:hover { background: #F3F4F6; }
.ap-salary-month {
font-size: 12.5px;
font-weight: 600;
color: var(--gh-bt);
white-space: nowrap;
}
/* ─── Review dialog ───────────────────────────────────────── */
.ap-overlay {
position: fixed; inset: 0;
background: rgba(15, 23, 42, 0.45);
display: flex; align-items: center; justify-content: center;
z-index: 1000; padding: 20px;
}
.ap-modal {
background: #fff;
border-radius: 16px;
width: 100%; max-width: 640px;
max-height: 84vh;
display: flex; flex-direction: column;
overflow: hidden;
box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
font-family: var(--gh-font);
}
.ap-modal-hdr {
display: flex; align-items: flex-start; justify-content: space-between;
gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--gh-bo);
}
.ap-modal-title { font-size: 15px; font-weight: 700; color: var(--gh-tt); }
.ap-modal-sub { font-size: 12px; color: var(--gh-muted); margin-top: 2px; }
.ap-modal-close {
font-size: 22px; line-height: 1; color: #9CA3AF; cursor: pointer;
padding: 0 4px; transition: color 0.15s;
}
.ap-modal-close:hover { color: var(--gh-bt); }
.ap-modal-meta {
display: flex; gap: 10px; padding: 14px 20px;
border-bottom: 1px solid var(--gh-bo); flex-wrap: wrap;
}
.ap-modal-meta-item {
flex: 1; min-width: 120px;
display: flex; flex-direction: column; gap: 3px;
padding: 8px 12px; background: #F9FAFB; border: 1px solid var(--gh-bo); border-radius: 9px;
}
.ap-modal-meta-item span { font-size: 11px; color: #9CA3AF; text-transform: uppercase; letter-spacing: 0.3px; }
.ap-modal-meta-item strong { font-size: 14px; font-weight: 700; color: var(--gh-tt); }
.ap-modal-toolbar { padding: 12px 20px; border-bottom: 1px solid var(--gh-bo); }
.ap-search-wrap { position: relative; display: flex; align-items: center; }
.ap-search-wrap svg { position: absolute; left: 12px; pointer-events: none; }
.ap-search {
width: 100%; height: 38px; padding: 0 12px 0 34px;
border: 1px solid var(--gh-bo); border-radius: 8px;
font-size: 13px; color: var(--gh-tt); outline: none; font-family: inherit;
transition: border-color 0.15s;
}
.ap-search:focus { border-color: var(--gh-btn); }
.ap-modal-table-wrap { overflow-y: auto; flex: 1; }
.ap-modal-table { width: 100%; border-collapse: collapse; }
.ap-modal-table thead tr { border-bottom: 1px solid var(--gh-bo); }
.ap-modal-table th {
padding: 10px 20px; font-size: 11px; font-weight: 600; color: #9CA3AF;
text-align: left; letter-spacing: 0.5px; text-transform: uppercase;
background: #F9FAFB; white-space: nowrap; position: sticky; top: 0;
}
.ap-modal-table th.ap-th-right { text-align: right; }
.ap-modal-table tbody tr { border-bottom: 1px solid #F3F4F6; }
.ap-modal-table td { padding: 11px 20px; font-size: 13px; color: var(--gh-bt); }
.ap-td-right { text-align: right; font-weight: 600; color: var(--gh-tt); }
.ap-modal-empty { text-align: center; color: #9CA3AF; padding: 22px; }
.ap-modal-actions {
display: flex; justify-content: flex-end; gap: 10px;
padding: 14px 20px; border-top: 1px solid var(--gh-bo);
}
.ap-modal-approve, .ap-modal-reject {
height: 40px; padding: 0 24px; border-radius: 9px;
font-size: 13.5px; font-weight: 700; cursor: pointer; font-family: inherit;
transition: background 0.15s;
}
.ap-modal-approve { background: var(--gh-btn); color: #fff; border: none; }
.ap-modal-approve:hover { background: var(--gh-btn); }
.ap-modal-reject { background: #fff; color: var(--gh-dn); border: 1px solid #FECACA; }
.ap-modal-reject:hover { background: #FEF2F2; border-color: #FCA5A5; }
/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 1100px) {
.ap-overview-row { flex-wrap: wrap; }
.ap-overview-card { flex: 1 1 calc(50% - 7px); }
}
@media (max-width: 768px) {
.ap-overview-card { flex: 1 1 100%; }
.ap-table-card { overflow-x: auto; }
.ap-footer-strip { flex-direction: column; align-items: flex-start; }
}

View File

@ -0,0 +1,348 @@
<div class="ap-wrapper">
<!-- ═══ HEADER CARD ═══ -->
<div class="ap-card ap-card-pad">
<div class="ap-header-section">
<div class="ap-header-text">
<h1 class="ap-page-title">Approval Dashboard</h1>
<p class="ap-page-sub">Review and approve employee requests</p>
<div class="ap-header-meta">
<span class="ap-meta-chip">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>
<line x1="16" y1="2" x2="16" y2="6"></line>
<line x1="8" y1="2" x2="8" y2="6"></line>
<line x1="3" y1="10" x2="21" y2="10"></line>
</svg>
Salary Month:&nbsp;<strong>{{ salaryMonth ? (salaryMonth | date:'MMMM yyyy') : '—' }}</strong>
</span>
<span class="ap-meta-chip" [class.ap-meta-chip-danger]="deadlinePassed">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<polyline points="12 6 12 12 16 14"></polyline>
</svg>
Approve By:&nbsp;<strong>{{ approvalDeadline ? (approvalDeadline | date:'dd MMM yyyy') : '—' }}</strong>
</span>
</div>
</div>
<!-- Orange Alert Banner (same row, right side) -->
<div class="ap-alert-banner">
<div class="ap-alert-left">
<div class="ap-alert-icon-wrap">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#EA580C" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<line x1="12" y1="8" x2="12" y2="12"></line>
<line x1="12" y1="16" x2="12.01" y2="16"></line>
</svg>
</div>
<span class="ap-alert-text"><strong>{{ alertCount }} requests</strong> need your attention</span>
</div>
<!-- <button class="ap-view-pending-btn" (click)="viewPending()">View Pending →</button> -->
</div>
</div>
</div>
<!-- ═══ APPROVAL DATE PASSED BANNER ═══ -->
@if (deadlinePassed) {
<div class="ap-card ap-deadline-banner">
<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="5" y="11" width="14" height="10" rx="2"></rect>
<path d="M8 11V7a4 4 0 0 1 8 0v4"></path>
</svg>
<span>The approval date{{ approvalDeadline ? (' (' + (approvalDeadline | date:'dd MMM yyyy') + ')') : '' }} for {{ salaryMonth ? (salaryMonth | date:'MMMM yyyy') : 'this' }} salary month has passed. You can no longer approve component uploads.</span>
</div>
}
<!-- ═══ APPROVAL OVERVIEW CARD ═══ -->
<div class="ap-card ap-card-pad">
<div class="ap-section-hdr" style="margin-bottom: 16px;">
<span class="ap-section-title">Approval Overview</span>
</div>
<div class="ap-overview-row">
@for (card of overviewCards; track card) {
<div class="ap-overview-card">
<div class="ap-ov-top">
<div class="ap-ov-icon-wrap">
<!-- Tax icon -->
@if (card.iconType === 'tax') {
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#16A34A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
<polyline points="14 2 14 8 20 8"></polyline>
<line x1="16" y1="13" x2="8" y2="13"></line>
<line x1="16" y1="17" x2="8" y2="17"></line>
<polyline points="10 9 9 9 8 9"></polyline>
</svg>
}
<!-- AIT icon -->
@if (card.iconType === 'ait') {
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#16A34A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="19" y1="5" x2="5" y2="19"></line>
<circle cx="6.5" cy="6.5" r="2.5"></circle>
<circle cx="17.5" cy="17.5" r="2.5"></circle>
</svg>
}
<!-- Loan icon -->
@if (card.iconType === 'loan') {
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#16A34A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="1" y="4" width="22" height="16" rx="2" ry="2"></rect>
<line x1="1" y1="10" x2="23" y2="10"></line>
</svg>
}
<!-- PF icon -->
@if (card.iconType === 'pf') {
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#16A34A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path>
<polyline points="9 12 11 14 15 10"></polyline>
</svg>
}
<!-- Gratuity icon -->
@if (card.iconType === 'gratuity') {
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#16A34A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="8" r="7"></circle>
<polyline points="8.21 13.89 7 23 12 20 17 23 15.79 13.88"></polyline>
</svg>
}
<!-- Component icon -->
@if (card.iconType === 'component') {
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#16A34A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 16V8M12 8l-3 3M12 8l3 3"></path>
<path d="M8 20a5 5 0 0 1-1-9.9A7 7 0 1 1 19 14"></path>
</svg>
}
</div>
<span class="ap-ov-title">{{ card.title }}</span>
</div>
<div class="ap-ov-count">{{ padTotal(card.total) }}</div>
<div class="ap-ov-stats">
<div class="ap-ov-stat">
<span class="ap-ov-dot ap-ov-dot-green"></span>
<span class="ap-ov-stat-lbl">Approved:</span>
<span class="ap-ov-stat-val">{{ card.approved }}</span>
</div>
<div class="ap-ov-stat">
<span class="ap-ov-dot ap-ov-dot-orange"></span>
<span class="ap-ov-stat-lbl">Pending:</span>
<span class="ap-ov-stat-val">{{ card.pending }}</span>
</div>
</div>
<div class="ap-ov-footer">
<!-- <button class="ap-view-all-btn" (click)="viewAll(card)">View All →</button> -->
</div>
</div>
}
</div>
</div>
<!-- ═══ PENDING REQUESTS CARD ═══ -->
<div class="ap-card ap-card-table">
<!-- Card Header -->
<div class="ap-card-hdr">
<div>
<div class="ap-section-title">Pending Requests</div>
<div class="ap-section-sub">Requests waiting for your approval</div>
</div>
<!-- <button class="ap-view-all-pending-btn" (click)="viewPending()">View all pending →</button> -->
</div>
<!-- Table -->
<div class="ap-table-wrap">
<table class="ap-table">
<thead>
<tr>
<th>REQUEST TYPE</th>
<th>EMPLOYEE</th>
<th>REQUESTED DATE</th>
<th>SALARY MONTH</th>
<th>DESCRIPTION</th>
<th>STATUS</th>
<th>ACTION</th>
</tr>
</thead>
<tbody>
@for (req of pendingRequests; track req) {
<tr>
<!-- Request Type -->
<td>
<div class="ap-type-cell">
<div class="ap-type-icon-wrap">
@if (req.iconType === 'tax') {
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#16A34A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
<polyline points="14 2 14 8 20 8"></polyline>
<line x1="16" y1="13" x2="8" y2="13"></line>
<line x1="16" y1="17" x2="8" y2="17"></line>
</svg>
}
@if (req.iconType === 'ait') {
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#16A34A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="19" y1="5" x2="5" y2="19"></line>
<circle cx="6.5" cy="6.5" r="2.5"></circle>
<circle cx="17.5" cy="17.5" r="2.5"></circle>
</svg>
}
@if (req.iconType === 'loan') {
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#16A34A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="1" y="4" width="22" height="16" rx="2" ry="2"></rect>
<line x1="1" y1="10" x2="23" y2="10"></line>
</svg>
}
@if (req.iconType === 'pf') {
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#16A34A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path>
<polyline points="9 12 11 14 15 10"></polyline>
</svg>
}
@if (req.iconType === 'gratuity') {
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#16A34A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="8" r="7"></circle>
<polyline points="8.21 13.89 7 23 12 20 17 23 15.79 13.88"></polyline>
</svg>
}
@if (req.iconType === 'component') {
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#16A34A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 16V8M12 8l-3 3M12 8l3 3"></path>
<path d="M8 20a5 5 0 0 1-1-9.9A7 7 0 1 1 19 14"></path>
</svg>
}
</div>
<span class="ap-type-name">{{ req.type }}</span>
</div>
</td>
<!-- Employee -->
<td>
<div class="ap-employee-cell">
<div class="ap-avatar">{{ req.initials }}</div>
<div class="ap-employee-info">
<span class="ap-employee-name">{{ req.employee }}</span>
<span class="ap-employee-id">{{ req.employeeId }}</span>
</div>
</div>
</td>
<!-- Requested Date -->
<td>
<div class="ap-date-cell">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="#6B7280" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>
<line x1="16" y1="2" x2="16" y2="6"></line>
<line x1="8" y1="2" x2="8" y2="6"></line>
<line x1="3" y1="10" x2="21" y2="10"></line>
</svg>
<div class="ap-date-info">
<span class="ap-date-val">{{ req.requestedDate }}</span>
<span class="ap-date-time">{{ req.requestedTime }}</span>
</div>
</div>
</td>
<!-- Salary Month -->
<td>
<span class="ap-salary-month">{{ req.salaryMonth }}</span>
</td>
<!-- Description -->
<td>
<span class="ap-description">{{ req.description }}</span>
</td>
<!-- Status -->
<td>
<span class="ap-status-badge" [class.ap-status-badge-approved]="req.status === 'Approved'">{{ req.status }}</span>
</td>
<!-- Action -->
<td>
@if (req.status === 'Pending' && !deadlinePassed) {
<div class="ap-action-cell">
<button class="ap-btn ap-btn-review" (click)="reviewRequest(req)">Review</button>
<button class="ap-btn ap-btn-approve" (click)="approveRequest(req)">Approve</button>
<!-- <button class="ap-btn ap-btn-reject" (click)="rejectRequest(req)">Reject</button> -->
</div>
} @else {
<span class="ap-no-action">—</span>
}
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
<!-- ═══ FOOTER STRIP ═══ -->
<div class="ap-footer-strip">
<div class="ap-footer-left">
<div class="ap-footer-icon">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#16A34A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path>
<polyline points="9 12 11 14 15 10"></polyline>
</svg>
</div>
<span class="ap-footer-text">All approvals are secure and logged for compliance.</span>
</div>
<div class="ap-footer-right">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#9CA3AF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<polyline points="12 6 12 12 16 14"></polyline>
</svg>
<span class="ap-footer-updated">Last updated: {{ lastUpdated }}</span>
<button class="ap-refresh-btn" (click)="refresh()">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#6B7280" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="23 4 23 10 17 10"></polyline>
<polyline points="1 20 1 14 7 14"></polyline>
<path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path>
</svg>
</button>
</div>
</div>
</div>
<!-- ═══ REVIEW DIALOG ═══ -->
@if (showReviewModal && modalRequest) {
<div class="ap-overlay" (click)="closeReviewModal()">
<div class="ap-modal" (click)="$event.stopPropagation()">
<div class="ap-modal-hdr">
<div>
<div class="ap-modal-title">{{ modalRequest.type }}</div>
<div class="ap-modal-sub">Uploaded by {{ modalRequest.employee }} · {{ modalRequest.salaryMonth }}</div>
</div>
<span class="ap-modal-close" (click)="closeReviewModal()">×</span>
</div>
<div class="ap-modal-meta">
<div class="ap-modal-meta-item"><span>Employees</span><strong>{{ modalRowsAll.length }}</strong></div>
<div class="ap-modal-meta-item"><span>Total Amount</span><strong>{{ modalTotal | number:'1.0-2' }}</strong></div>
<div class="ap-modal-meta-item"><span>Uploaded</span><strong>{{ modalRequest.requestedDate }}</strong></div>
</div>
<div class="ap-modal-toolbar">
<div class="ap-search-wrap">
<svg width="14" height="14" viewBox="0 0 14 14" fill="none">
<circle cx="6" cy="6" r="4.5" stroke="#9CA3AF" stroke-width="1.3"/>
<path d="M9.5 9.5L12.5 12.5" stroke="#9CA3AF" stroke-width="1.3" stroke-linecap="round"/>
</svg>
<input class="ap-search" placeholder="Search employee, amount…"
[(ngModel)]="modalSearch" (ngModelChange)="filterModalRows($event)">
</div>
</div>
<div class="ap-modal-table-wrap">
<table class="ap-modal-table">
<thead>
<tr><th>EMPLOYEE NO</th><th>EMPLOYEE NAME</th><th class="ap-th-right">AMOUNT</th></tr>
</thead>
<tbody>
@for (row of modalRows; track row) {
<tr>
<td>{{ row.employeeNo }}</td>
<td>{{ row.name }}</td>
<td class="ap-td-right">{{ row.amount | number:'1.0-2' }}</td>
</tr>
}
@if (modalRows.length === 0) {
<tr>
<td colspan="3" class="ap-modal-empty">No rows to show.</td>
</tr>
}
</tbody>
</table>
</div>
<div class="ap-modal-actions">
<!-- <button class="ap-modal-reject" (click)="rejectFromModal()">Reject</button> -->
<button class="ap-modal-approve" (click)="approveFromModal()">Approve</button>
</div>
</div>
</div>
}

View File

@ -0,0 +1,295 @@
import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { BasicService } from 'src/app/_services/Basic/basic.service';
import { loadingPanelService } from 'src/app/hrm-loding panel/loding.panel.service';
import { HRMNotificationService } from 'src/app/app.notification.service';
import { EnumComponentType } from 'src/app/_models/enums';
import { ApiService } from 'src/app/app.api.service';
interface OverviewCard {
title: string;
total: number;
approved: number;
pending: number;
iconType: string;
}
interface PendingRequest {
id: number;
type: string;
iconType: string;
employee: string;
employeeId: string;
initials: string;
requestedDate: string;
requestedTime: string;
salaryMonth: string;
description: string;
status: string;
// raw keys used for approval
_uploadedComponentId: number;
_empId: number;
_componentID: number;
_componentType: number;
_componentName: string;
_amount: number;
_empCount: number;
}
interface BreakdownRow {
employeeNo: string;
name: string;
amount: number;
}
@Component({
selector: 'app-ess-component-approval',
templateUrl: './component-approval.component.html',
styleUrls: ['./component-approval.component.css'],
changeDetection: ChangeDetectionStrategy.Eager,
standalone: false,
})
/** ESS Component Approval (/ess/component-approval), as GP's /hress-approval-state/approval. */
export class EssComponentApprovalComponent implements OnInit {
alertCount = 0;
lastUpdated = '';
// current salary month + approval deadline (admin-set date, re-anchored to the salary month)
salaryMonth: Date | null = null;
deadlinePassed = false;
approvalDeadline: Date | null = null;
overviewCards: OverviewCard[] = [];
pendingRequests: PendingRequest[] = [];
// review dialog
showReviewModal = false;
modalRequest: PendingRequest | null = null;
modalRows: BreakdownRow[] = [];
private modalRowsAll: BreakdownRow[] = [];
modalSearch = '';
modalTotal = 0;
constructor(
private basicService: BasicService,
private loadingPanel: loadingPanelService,
private notify: HRMNotificationService,
private apiService: ApiService,
) {
this.apiService.selectedMenuName = 'Component Approval';
}
ngOnInit(): void {
this.loadDeadline();
this.loadApproverData();
}
private loadDeadline(): void {
this.basicService.getComponentUploadDeadline().subscribe(
(resp: any) => {
this.deadlinePassed = !!resp && resp.allowed === false;
this.approvalDeadline = (resp && resp.deadline) ? new Date(resp.deadline) : null;
if (resp && resp.salaryMonth) { this.salaryMonth = new Date(resp.salaryMonth); }
},
() => {},
);
}
// ───────────────────────── data ─────────────────────────
private loadApproverData(): void {
this.loadingPanel.ShowLoadingPanel = true;
this.basicService.getApproverComponentUploadDT().subscribe(
(resp: any) => {
const rows: any[] = Array.isArray(resp) ? resp : [];
this.pendingRequests = rows.map((r, i) => this.toRequest(r, i));
this.overviewCards = this.buildOverview(rows);
this.alertCount = this.pendingRequests.filter(r => r.status === 'Pending').length;
this.lastUpdated = new Date().toLocaleString('en-US', {
month: 'short', day: 'numeric', year: 'numeric', hour: 'numeric', minute: '2-digit',
});
},
() => { this.loadingPanel.ShowLoadingPanel = false; },
() => { this.loadingPanel.ShowLoadingPanel = false; },
);
}
private toRequest(r: any, index: number): PendingRequest {
const parts = String(r.employeeNoName || '').split('-');
const empNo = parts.length > 1 ? parts[0].trim() : '';
const name = parts.length > 1 ? parts.slice(1).join('-').trim() : String(r.employeeNoName || '').trim();
const empCount = Number(r.empCount) || 0;
return {
id: index,
type: r.componentName || 'Component',
iconType: 'component',
employee: name,
employeeId: empNo ? ('ID: ' + empNo) : '',
initials: this.initials(name),
requestedDate: r.uploadedDate || '',
requestedTime: '',
salaryMonth: r.salaryMonth || '—',
description: (empCount ? (empCount + ' employee' + (empCount > 1 ? 's' : '')) : '—')
+ (r.amount ? (' · total ' + (Number(r.amount) || 0).toLocaleString('en-US')) : ''),
status: r.status || 'Pending',
_uploadedComponentId: Number(r.uploadedComponentId) || 0,
_empId: Number(r.empId) || 0,
_componentID: Number(r.componentID) || 0,
_componentType: this.toComponentTypeNum(r.componentType),
_componentName: r.componentName || '',
_amount: Number(r.amount) || 0,
_empCount: empCount,
};
}
private buildOverview(rows: any[]): OverviewCard[] {
const groups = new Map<string, { total: number; approved: number; pending: number }>();
for (const r of rows) {
const key = r.componentName || 'Component';
const g = groups.get(key) || { total: 0, approved: 0, pending: 0 };
g.total++;
if (r.status === 'Approved') { g.approved++; } else { g.pending++; }
groups.set(key, g);
}
return Array.from(groups.entries()).map(([title, g]) => ({
title, total: g.total, approved: g.approved, pending: g.pending, iconType: 'component',
}));
}
// ───────────────────────── actions ─────────────────────────
// Review → open the dialog showing the uploaded per-employee breakdown.
reviewRequest(req: PendingRequest): void {
if (req.status !== 'Pending') { return; }
if (this.deadlinePassed) {
this.notify.showWarning('The approval date for this salary month has passed. Approval is no longer allowed.');
return;
}
this.loadingPanel.ShowLoadingPanel = true;
this.basicService.viewUploadedComponentForApprover(req._uploadedComponentId).subscribe(
(resp: any) => {
const rows: any[] = Array.isArray(resp) ? resp : [];
this.modalRowsAll = rows.map(x => ({
employeeNo: this.pick(x, 'employeeNo', 'EmployeeNo', 'EMPLOYEENO'),
name: this.pick(x, 'name', 'Name', 'NAME'),
amount: Number(this.pick(x, 'amount', 'Amount', 'AMOUNT')) || 0,
}));
this.modalTotal = this.modalRowsAll.reduce((s, r) => s + (r.amount || 0), 0);
},
() => { this.loadingPanel.ShowLoadingPanel = false; },
() => {
this.modalRows = [...this.modalRowsAll];
this.modalSearch = '';
this.modalRequest = req;
this.showReviewModal = true;
this.loadingPanel.ShowLoadingPanel = false;
},
);
}
filterModalRows(text: string): void {
const q = (text || '').toLowerCase();
this.modalRows = this.modalRowsAll.filter(r =>
Object.values(r).some(v => v != null && v.toString().toLowerCase().includes(q)),
);
}
closeReviewModal(): void {
this.showReviewModal = false;
this.modalRequest = null;
this.modalRows = [];
this.modalRowsAll = [];
}
approveFromModal(): void { if (this.modalRequest) { this.approveRequest(this.modalRequest); } }
rejectFromModal(): void { if (this.modalRequest) { this.rejectRequest(this.modalRequest); } }
approveRequest(req: PendingRequest): void {
if (!req || req.status !== 'Pending') { return; }
if (this.deadlinePassed) {
this.notify.showWarning('The approval date for this salary month has passed. Approval is no longer allowed.');
return;
}
this.notify.showActiveConfirm('Approve Component',
`Approve "${req.type}" uploaded by ${req.employee || 'employee'}? A confirmation mail will be sent.`).then((ok: boolean) => {
if (!ok) { return; }
this.loadingPanel.ShowLoadingPanel = true;
this.basicService.approveComponentUploadByKey(req._empId, req._componentID, req._componentType).subscribe(
() => {},
(err: any) => {
this.loadingPanel.ShowLoadingPanel = false;
this.notify.showError(typeof err?.error === 'string' ? err.error : 'Failed to approve the component.');
},
() => {
this.loadingPanel.ShowLoadingPanel = false;
this.notify.showSuccess('Component approved successfully.');
this.closeReviewModal();
this.loadApproverData();
},
);
});
}
rejectRequest(req: PendingRequest): void {
if (!req || req.status !== 'Pending') { return; }
if (this.deadlinePassed) {
this.notify.showWarning('The approval date for this salary month has passed. Reject is no longer allowed.');
return;
}
this.notify.showActiveConfirm('Reject Component',
`Reject "${req.type}" uploaded by ${req.employee || 'employee'}? The upload will be removed and the employee can submit it again.`).then((ok: boolean) => {
if (!ok) { return; }
this.loadingPanel.ShowLoadingPanel = true;
this.basicService.rejectComponentUploadByKey(req._empId, req._componentID, req._componentType).subscribe(
() => {},
(err: any) => {
this.loadingPanel.ShowLoadingPanel = false;
this.notify.showError(typeof err?.error === 'string' ? err.error : 'Failed to reject the component.');
},
() => {
this.loadingPanel.ShowLoadingPanel = false;
this.notify.showSuccess('Component upload rejected.');
this.closeReviewModal();
this.loadApproverData();
},
);
});
}
private pick(o: any, ...keys: string[]): any {
for (const k of keys) { if (o != null && o[k] != null) { return o[k]; } }
return undefined;
}
refresh(): void { this.loadApproverData(); }
viewPending(): void { this.scrollToTable(); }
viewAll(_card: OverviewCard): void { this.scrollToTable(); }
// ───────────────────────── ui helpers ─────────────────────────
padTotal(n: number): string {
return n < 10 ? '0' + n : '' + n;
}
private scrollToTable(): void {
try {
document.querySelector('.ap-card-table')?.scrollIntoView({ behavior: 'smooth', block: 'start' });
} catch { /* ignore */ }
}
private initials(name: string): string {
const parts = String(name || '').trim().split(/\s+/).filter(Boolean);
if (!parts.length) { return '—'; }
if (parts.length === 1) { return parts[0].substring(0, 2).toUpperCase(); }
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
}
private toComponentTypeNum(v: any): number {
if (v == null) { return 0; }
const n = Number(v);
if (!isNaN(n) && n > 0) { return n; }
const mapped = (EnumComponentType as any)[v];
return typeof mapped === 'number' ? mapped : 0;
}
}

View File

@ -0,0 +1,495 @@
/* ─────────────────────────────────────────
COMPONENT UPLOADER (prefix: cu-)
───────────────────────────────────────── */
.cu-page {
display: flex;
flex-direction: column;
gap: 15px;
box-sizing: border-box;
font-family: var(--gh-font);
color: var(--gh-tt);
}
.cu-top {
display: flex;
gap: 15px;
align-items: stretch;
width: 100%;
}
.cu-main-card { flex: 1; min-width: 0; }
/* Main card stacks its sections; the "Upload Excel File" step takes any leftover height
and the drag & drop zone grows into it, so there is no empty gap at the bottom of the card */
.cu-main-card { display: flex; flex-direction: column; }
.cu-main-card .cu-step-file { flex: 1 0 auto; display: flex; flex-direction: column; }
.cu-step-file .cu-step-body { flex: 1 0 auto; display: flex; flex-direction: column; }
.cu-step-file .cu-dropzone { flex: 1 0 auto; min-height: 220px; }
.cu-sidebar {
width: 300px;
flex-shrink: 0;
display: flex;
flex-direction: column;
gap: 14px;
}
.cu-sidebar-card:last-child { flex: 1; min-height: 0; }
/* Important Alerts at the top of the sidebar (important information first).
Every sidebar card keeps only its content height — Guidelines no longer stretches
into empty space. The taller sidebar makes .cu-top stretch the main card to match.
(Desktop only: the ≤900px wrap layout below keeps its own flex rules.) */
/* Desktop: main card and sidebar always end on the same line. The drop zone is
sized so the main card is normally no taller than the sidebar (then .cu-top
stretches it and the drop zone takes the extra height); if the main card grows
taller, Guidelines stretches so the sidebar still ends level with it. */
@media (min-width: 901px) {
.cu-sidebar .cu-sidebar-card:last-child { flex: 1 0 auto; }
.cu-step-file .cu-dropzone { min-height: 150px; }
}
/* ── card shell ── */
.cu-card {
background: #ffffff;
border: 1px solid var(--gh-bo);
border-radius: 16px;
box-shadow: 0 1px 4px rgba(16, 24, 40, 0.06);
box-sizing: border-box;
}
/* ── header ── */
.cu-card-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
padding: 16px 20px;
border-bottom: 1px solid var(--gh-bo);
}
.cu-title-group { display: flex; align-items: flex-start; gap: 12px; }
.cu-icon-wrap {
color: var(--gh-btn);
width: 44px; height: 44px;
border-radius: 10px;
background: var(--gh-th);
display: flex; align-items: center; justify-content: center;
flex-shrink: 0;
}
.cu-title { font-size: 17px; font-weight: 700; color: var(--gh-tt); margin: 0 0 2px; line-height: 1.2; }
.cu-subtitle { font-size: 12.5px; color: var(--gh-muted); margin: 0; line-height: 1.4; }
.cu-btn-ghost {
display: inline-flex; align-items: center; gap: 7px;
height: 38px; padding: 0 16px;
background: #ffffff;
border: 1px solid var(--gh-focus);
border-radius: 8px;
color: var(--gh-btn);
font-size: 13.5px; font-weight: 500;
cursor: pointer; white-space: nowrap;
font-family: inherit;
transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.cu-btn-ghost:hover { background: var(--gh-th); border-color: var(--gh-focus); }
.cu-btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }
/* ── banner ── */
.cu-banner {
display: flex; align-items: center; gap: 9px;
margin: 14px 20px 0;
padding: 10px 14px;
border-radius: 10px;
font-size: 12.75px; font-weight: 500;
line-height: 1.4;
}
.cu-banner-open { background: var(--gh-th); color: var(--gh-btn); border: 1px solid var(--gh-focus); }
.cu-banner-closed { background: #FEF3C7; color: var(--gh-warn); border: 1px solid #FDE68A; }
.cu-banner-locked { background: #FEE2E2; color: var(--gh-dnh); border: 1px solid #FECACA; }
.cu-banner svg { flex-shrink: 0; }
/* banner placed in the actions row, directly left of the Upload button */
.cu-banner-inline { margin: 0; flex: 0 1 auto; min-height: 42px; box-sizing: border-box; }
.cu-actions-right {
display: flex; align-items: center; justify-content: flex-end; gap: 10px;
flex: 1 1 auto; min-width: 0;
}
.cu-actions-right .cu-btn-primary { flex-shrink: 0; }
/* ── steps ── */
.cu-step { padding: 15px 20px; border-bottom: 1px solid var(--gh-bo); }
.cu-step:last-child { border-bottom: none; }
.cu-step-hdr { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cu-step-num {
display: inline-flex; align-items: center; justify-content: center;
width: 24px; height: 24px; border-radius: 50%;
background: var(--gh-btn); color: #fff;
font-size: 12px; font-weight: 700; line-height: 1; flex-shrink: 0;
}
.cu-step-title { font-size: 14px; font-weight: 600; color: var(--gh-tt); }
.cu-two-col {
display: grid;
grid-template-columns: 1fr 220px;
gap: 16px;
align-items: start;
}
/* ── Kendo dropdown — match HR-ESS self-service design ── */
.cu-dd-wrap { position: relative; }
.cu-dd-wrap ::ng-deep .k-dropdownlist {
width: 100%;
height: 44px;
min-height: 44px;
border: 1px solid var(--gh-bo);
border-radius: 9px;
background: #ffffff;
box-shadow: none;
transition: border-color 0.15s, box-shadow 0.15s;
}
.cu-dd-wrap ::ng-deep .k-dropdownlist:hover { border-color: #C3CEDD; }
.cu-dd-wrap ::ng-deep .k-dropdownlist.k-focus,
.cu-dd-wrap ::ng-deep .k-dropdownlist:focus-within {
border-color: var(--gh-btn);
box-shadow: 0 0 0 3px rgba(4, 90, 234, 0.12);
}
.cu-dd-wrap ::ng-deep .k-dropdownlist.k-disabled { background: #F3F4F6; opacity: 1; }
.cu-dd-wrap ::ng-deep .k-input-inner {
font-family: var(--gh-font);
font-size: 14px;
font-weight: 500;
color: var(--gh-bt);
padding-left: 14px;
background: transparent;
border: none;
box-shadow: none;
}
.cu-dd-wrap ::ng-deep .k-input-button {
background: transparent;
border: none;
color: var(--gh-muted);
box-shadow: none;
}
.cu-dd-wrap ::ng-deep .k-input-button .k-icon,
.cu-dd-wrap ::ng-deep .k-input-button .k-svg-icon { color: var(--gh-muted); }
.cu-empty-hint { font-size: 12px; color: var(--gh-warn); margin: 8px 0 0; line-height: 1.4; }
/* ── read-only field ── */
.cu-readonly-field { display: flex; flex-direction: column; gap: 6px; }
.cu-readonly-label { font-size: 12.5px; font-weight: 500; color: var(--gh-muted); }
.cu-readonly-value {
display: flex; align-items: center; gap: 7px;
height: 44px; padding: 0 14px;
background: #F9FAFB;
border: 1px solid var(--gh-bo);
border-radius: 9px;
font-size: 13.5px; font-weight: 600; color: var(--gh-bt);
}
/* ── dropzone ── */
.cu-dropzone {
display: flex; flex-direction: column; align-items: center; justify-content: center;
gap: 8px; min-height: 150px;
border: 1.5px dashed var(--gh-focus);
border-radius: 12px;
background: var(--gh-th);
padding: 20px;
cursor: pointer;
transition: border-color 0.15s, background 0.15s;
box-sizing: border-box;
}
.cu-dropzone-over { border-color: var(--gh-btn); background: var(--gh-th); }
/* disabled state — visible but not interactive until a component is chosen */
.cu-step-disabled .cu-step-num { background: #C7CDD6; }
.cu-dropzone-disabled {
border-color: var(--gh-bo);
background: #F5F6F8;
cursor: not-allowed;
}
.cu-dropzone-disabled .cu-dz-icon {
color: var(--gh-btn); background: var(--gh-bo); }
.cu-dropzone-disabled .cu-dz-icon svg path { stroke: #9CA3AF; }
.cu-dropzone-disabled .cu-dz-text { color: #9CA3AF; }
.cu-dropzone-disabled .cu-btn-choose {
pointer-events: none;
color: #9CA3AF;
border-color: var(--gh-bo);
background: #F5F6F8;
}
.cu-dropzone-disabled .cu-dz-hint { color: #9CA3AF; }
.cu-dz-icon {
width: 48px; height: 48px; border-radius: 50%;
background: var(--gh-th);
display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cu-dz-text { font-size: 14px; font-weight: 600; color: var(--gh-tt); margin: 4px 0 0; }
.cu-dz-or { font-size: 13px; color: #9CA3AF; }
.cu-btn-choose {
display: inline-flex; align-items: center; gap: 6px;
height: 34px; padding: 0 16px;
background: #ffffff;
border: 1.5px solid var(--gh-focus);
border-radius: 7px;
color: var(--gh-btn);
font-size: 13px; font-weight: 500;
cursor: pointer; font-family: inherit;
transition: background 0.15s, border-color 0.15s;
}
.cu-btn-choose:hover { background: var(--gh-th); border-color: var(--gh-focus); }
.cu-dz-hint { font-size: 11.5px; color: #9CA3AF; margin: 4px 0 0; line-height: 1.4; text-align: center; }
.cu-file-chip {
display: inline-flex; align-items: center; gap: 8px;
padding: 7px 12px;
background: #F0FDF4;
border: 1px solid #BBF7D0;
border-radius: 7px;
font-size: 13px; font-weight: 500; color: var(--gh-okh);
max-width: 340px;
}
.cu-file-chip svg { flex-shrink: 0; }
.cu-file-name {
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cu-file-remove {
cursor: pointer; font-size: 17px; line-height: 1; color: #9CA3AF;
padding: 0 2px; margin-left: 4px; transition: color 0.15s;
flex-shrink: 0;
}
.cu-file-remove:hover { color: var(--gh-bt); }
/* ── status ── */
.cu-status {
display: flex; align-items: center; gap: 9px;
padding: 11px 14px;
border-radius: 10px;
font-size: 12.75px; font-weight: 500; line-height: 1.45;
}
.cu-status svg { flex-shrink: 0; }
.cu-status-pending { background: var(--gh-th); color: var(--gh-btn); border: 1px solid var(--gh-focus); }
.cu-status-approved { background: #DCFCE7; color: var(--gh-ok); border: 1px solid #BBF7D0; }
/* ── actions ── */
.cu-actions {
display: flex; flex-wrap: wrap; gap: 10px;
justify-content: flex-end;
align-items: center;
padding: 16px 20px;
}
.cu-btn-primary, .cu-btn-outline, .cu-btn-danger {
display: inline-flex; align-items: center; justify-content: center; gap: 8px;
height: 42px; padding: 0 22px;
border-radius: 9px;
font-size: 14px; font-weight: 600;
cursor: pointer; font-family: inherit;
transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.cu-btn-primary { background: var(--gh-btn); color: #fff; border: none; }
.cu-btn-primary:hover { background: var(--gh-btnh); }
.cu-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.cu-btn-outline { background: #fff; color: var(--gh-btn); border: 1px solid var(--gh-focus); }
.cu-btn-outline:hover { background: var(--gh-th); border-color: var(--gh-focus); }
.cu-btn-danger { background: #fff; color: var(--gh-dn); border: 1px solid #FECACA; }
.cu-btn-danger:hover { background: #FEF2F2; border-color: #FCA5A5; }
/* ── sidebar cards ── */
.cu-sidebar-card {
background: #ffffff;
border: 1px solid var(--gh-bo);
border-radius: 14px;
padding: 18px 16px;
box-sizing: border-box;
box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
}
.cu-sc-label {
font-size: 12px; font-weight: 600; color: var(--gh-muted);
margin: 0 0 12px; text-transform: uppercase; letter-spacing: 0.3px;
}
.cu-window-box {
border: 1px solid var(--gh-bo);
border-radius: 10px;
overflow: hidden;
margin-bottom: 12px;
}
.cu-window-row {
display: flex; align-items: center; justify-content: space-between;
padding: 9px 12px; font-size: 13px;
}
.cu-window-row + .cu-window-row { border-top: 1px solid #F1F3F7; }
.cu-window-key { color: var(--gh-muted); }
.cu-window-val { font-weight: 700; color: var(--gh-tt); }
.cu-pill {
display: inline-flex; align-items: center;
font-size: 12px; font-weight: 600;
padding: 4px 12px; border-radius: 100px;
}
.cu-pill-open { background: #DCFCE7; color: var(--gh-ok); }
.cu-pill-closed { background: #FEE2E2; color: var(--gh-dn); }
.cu-sc-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cu-sc-icon {
color: var(--gh-btn);
width: 34px; height: 34px; border-radius: 8px;
background: var(--gh-th);
display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cu-sc-title { font-size: 14px; font-weight: 600; color: var(--gh-tt); }
.cu-guidelines {
list-style: none; padding: 0; margin: 0;
display: flex; flex-direction: column; gap: 10px;
}
.cu-guidelines li {
display: flex; align-items: flex-start; gap: 8px;
font-size: 12.75px; color: var(--gh-bt); line-height: 1.45;
}
.cu-help-text { font-size: 12.75px; color: var(--gh-muted); margin: 0; line-height: 1.5; }
/* ── results table ── */
.cu-results-card { width: 100%; overflow: hidden; }
.cu-results-hdr {
display: flex; align-items: center; gap: 9px;
padding: 14px 20px; border-bottom: 1px solid var(--gh-bo);
}
.cu-results-title { font-size: 14px; font-weight: 600; color: var(--gh-dnh); }
.cu-table-wrap { overflow-x: auto; width: 100%; }
.cu-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.cu-table thead tr { border-bottom: 1px solid var(--gh-bo); }
.cu-table th {
padding: 10px 20px;
font-size: 11px; font-weight: 600; color: #9CA3AF;
text-align: left; letter-spacing: 0.5px; text-transform: uppercase;
background: #F9FAFB; white-space: nowrap;
}
.cu-table th.cu-th-right { text-align: right; }
.cu-table tbody tr { border-bottom: 1px solid #F3F4F6; }
.cu-table tbody tr:last-child { border-bottom: none; }
.cu-table tbody tr:hover { background: #FAFBFD; }
.cu-table td { padding: 12px 20px; font-size: 13px; color: var(--gh-bt); vertical-align: middle; }
.cu-td-msg { color: var(--gh-dnh); }
.cu-td-right { text-align: right; font-weight: 600; color: var(--gh-tt); }
.cu-td-strong { font-weight: 600; color: var(--gh-tt); }
.cu-td-muted { color: var(--gh-muted); white-space: nowrap; }
.cu-empty-row { text-align: center; color: #9CA3AF; padding: 24px; }
/* ── uploaded components list header ── */
.cu-list-hdr {
display: flex; align-items: center; justify-content: space-between;
gap: 16px; flex-wrap: wrap;
padding: 14px 20px; border-bottom: 1px solid var(--gh-bo);
}
.cu-list-title-grp { color: var(--gh-btn); display: flex; align-items: center; gap: 9px; }
.cu-list-title { font-size: 14px; font-weight: 600; color: var(--gh-tt); }
.cu-list-search { width: 220px; max-width: 100%; }
.cu-badge {
display: inline-flex; align-items: center;
font-size: 12px; font-weight: 600;
padding: 3px 12px; border-radius: 100px; white-space: nowrap;
}
.cu-badge-approved { background: #DCFCE7; color: var(--gh-ok); }
.cu-badge-pending { background: #FEF3C7; color: var(--gh-warn); }
.cu-row-actions { display: flex; align-items: center; gap: 8px; }
/* Grid action buttons — matches the Approval page design */
.cu-tbl-btn {
border: none;
border-radius: 8px;
padding: 7px 16px;
font-size: 12.5px;
font-weight: 700;
cursor: pointer;
font-family: inherit;
white-space: nowrap;
color: #ffffff;
transition: background 0.15s;
}
.cu-tbl-btn-view { background: var(--gh-btn); }
.cu-tbl-btn-view:hover { background: var(--gh-btn); }
.cu-tbl-btn-delete { background: var(--gh-dn); }
.cu-tbl-btn-delete:hover { background: var(--gh-dnh); }
/* ── view overlay ── */
.cu-overlay {
position: fixed; inset: 0;
background: rgba(15, 23, 42, 0.45);
display: flex; align-items: center; justify-content: center;
z-index: 1000; padding: 20px;
}
.cu-modal {
background: #fff;
border-radius: 16px;
width: 100%; max-width: 640px;
max-height: 80vh;
display: flex; flex-direction: column;
overflow: hidden;
box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}
.cu-modal-hdr {
display: flex; align-items: center; justify-content: space-between;
padding: 16px 20px; border-bottom: 1px solid var(--gh-bo);
}
.cu-modal-title { font-size: 15px; font-weight: 700; color: var(--gh-tt); display: flex; align-items: center; gap: 8px; }
.cu-count-pill {
background: var(--gh-th); color: var(--gh-btn);
font-size: 12px; font-weight: 600;
padding: 2px 10px; border-radius: 100px;
}
.cu-modal-close {
font-size: 22px; line-height: 1; color: #9CA3AF; cursor: pointer;
padding: 0 4px; transition: color 0.15s;
}
.cu-modal-close:hover { color: var(--gh-bt); }
.cu-modal-toolbar { padding: 12px 20px; border-bottom: 1px solid var(--gh-bo); }
.cu-search-wrap { position: relative; display: flex; align-items: center; }
.cu-search-wrap svg { position: absolute; left: 12px; pointer-events: none; }
.cu-search {
width: 100%; height: 38px;
padding: 0 12px 0 34px;
border: 1px solid var(--gh-bo); border-radius: 8px;
font-size: 13px; color: var(--gh-tt); outline: none;
font-family: inherit;
transition: border-color 0.15s;
}
.cu-search:focus { border-color: var(--gh-btn); }
.cu-modal-table { overflow-y: auto; min-height: 0; }
/* ── responsive ── */
@media (max-width: 1100px) { .cu-sidebar { width: 264px; } }
@media (max-width: 900px) {
.cu-top { flex-direction: column; align-items: stretch; }
.cu-sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; }
.cu-sidebar-card { flex: 1 1 240px; }
.cu-sidebar-card:last-child { flex: 1 1 240px; }
}
@media (max-width: 640px) {
.cu-page { padding: 0 0 16px; }
.cu-two-col { grid-template-columns: 1fr; }
.cu-sidebar { flex-direction: column; }
.cu-sidebar-card { flex: none; width: 100%; }
.cu-card-header { flex-direction: column; }
}

View File

@ -0,0 +1,340 @@
<app-loading-panel></app-loading-panel>
<div class="cu-page" [ngClass]="{'customGrid': apiService.isSelService === true}">
<!-- ══════════ TOP: form card + sidebar ══════════ -->
<div class="cu-top">
<!-- ── Main card ── -->
<div class="cu-card cu-main-card">
<!-- Header -->
<div class="cu-card-header">
<div class="cu-title-group">
<div class="cu-icon-wrap">
<svg width="22" height="22" viewBox="0 0 22 22" fill="none">
<path d="M11 14V8M11 8L8.5 10.5M11 8l2.5 2.5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M7 18a5 5 0 01-1.031-9.875A7.5 7.5 0 1119 14h-1.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</div>
<div>
<h2 class="cu-title">Component Uploader</h2>
<p class="cu-subtitle">Upload your assigned salary components for the current month</p>
</div>
</div>
<button class="cu-btn-ghost" (click)="downloadSample()">
<svg width="14" height="14" viewBox="0 0 14 14" fill="none">
<path d="M7 2v7M7 9L4.5 6.5M7 9l2.5-2.5" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M2 12h10" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/>
</svg>
Download Sample
</button>
</div>
<!-- Validity warning — only when the upload window is closed -->
@if (!deadlinePassed && !windowValid && windowMessage) {
<div class="cu-banner cu-banner-closed">
<svg width="16" height="16" viewBox="0 0 16 16" fill="none">
<path d="M8 2l6.5 11.5H1.5L8 2z" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round"/>
<path d="M8 6.5v3.5M8 12h.01" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
</svg>
<span>{{ windowMessage }}</span>
</div>
}
<!-- Step 1 — component -->
<div class="cu-step">
<div class="cu-step-hdr">
<span class="cu-step-num">1</span>
<span class="cu-step-title">Select Component</span>
</div>
<div class="cu-step-body">
<div class="cu-dd-wrap">
<kendo-dropdownlist
[data]="components"
[value]="selectedComponent"
[defaultItem]="defaultComponent"
[textField]="'description'"
[valueField]="'itemID'"
[disabled]="components.length === 0"
(valueChange)="onComponentChange($event)"
style="width:100%">
</kendo-dropdownlist>
@if (components.length === 0) {
<p class="cu-empty-hint">
No components are assigned to you. Please contact your Payroll team.
</p>
}
</div>
</div>
</div>
<!-- Step 2 — file (always visible; disabled until a component is selected) -->
<div class="cu-step cu-step-file" [class.cu-step-disabled]="!canUpload">
<div class="cu-step-hdr">
<span class="cu-step-num">2</span>
<span class="cu-step-title">Upload Excel File</span>
</div>
<div class="cu-step-body">
<div class="cu-dropzone" [class.cu-dropzone-over]="dragOver && canUpload"
[class.cu-dropzone-disabled]="!canUpload"
(dragover)="onDragOver($event)" (dragleave)="onDragLeave($event)" (drop)="onDrop($event)">
<div class="cu-dz-icon">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
<path d="M12 15V7M12 7L9.5 9.5M12 7l2.5 2.5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M8 20a5.5 5.5 0 01-1.138-10.863A8.5 8.5 0 1121.5 16H20" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</div>
<p class="cu-dz-text">Drag &amp; drop your file here</p>
<span class="cu-dz-or">or</span>
<label class="cu-btn-choose">
<svg width="13" height="13" viewBox="0 0 13 13" fill="none">
<path d="M6.5 9V3M6.5 3L4 5.5M6.5 3L9 5.5" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M2 11h9" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/>
</svg>
Choose File
<input type="file" hidden [disabled]="!canUpload" (change)="onFileSelect($event)" accept=".xls,.xlsx">
</label>
<p class="cu-dz-hint">{{ uploadHint }}</p>
</div>
</div>
</div>
<!-- Already-uploaded status -->
@if (selectedComponent && alreadyUploaded) {
<div class="cu-step">
<div class="cu-status"
[class.cu-status-approved]="approved" [class.cu-status-pending]="!approved">
<svg width="16" height="16" viewBox="0 0 16 16" fill="none">
<circle cx="8" cy="8" r="7" stroke="currentColor" stroke-width="1.4"/>
<path d="M8 4.5v4M8 11h.01" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
</svg>
<span>{{ statusMessage }}</span>
</div>
</div>
}
<!-- Actions -->
<div class="cu-actions">
@if (selectedFile) {
<div class="cu-file-chip">
<svg width="14" height="16" viewBox="0 0 14 16" fill="none">
<path d="M2 2h7l4 4v9a1 1 0 01-1 1H2a1 1 0 01-1-1V3a1 1 0 011-1z" fill="#DCFCE7" stroke="#16A34A" stroke-width="1.2"/>
<path d="M9 2v4h4" stroke="#16A34A" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<span class="cu-file-name">{{ selectedFile.name }}</span>
<span class="cu-file-remove" (click)="removeFile()">×</span>
</div>
}
@if (alreadyUploaded) {
<button class="cu-btn-outline" (click)="viewUploaded()">
<svg width="15" height="15" viewBox="0 0 15 15" fill="none">
<path d="M1.5 7.5s2.3-4.5 6-4.5 6 4.5 6 4.5-2.3 4.5-6 4.5-6-4.5-6-4.5z" stroke="currentColor" stroke-width="1.2"/>
<circle cx="7.5" cy="7.5" r="1.8" stroke="currentColor" stroke-width="1.2"/>
</svg>
View Uploaded
</button>
}
@if (alreadyUploaded && !approved) {
<button class="cu-btn-danger" (click)="deleteUploaded()">
<svg width="15" height="15" viewBox="0 0 15 15" fill="none">
<path d="M2.5 4h10M6 2.5h3M3.5 4l.6 8a1 1 0 001 1h3.8a1 1 0 001-1l.6-8" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
Delete Upload
</button>
}
<!-- Approval date for this salary month has passed — on the far right of this row, next to Upload -->
<div class="cu-actions-right">
@if (deadlinePassed) {
<div class="cu-banner cu-banner-locked cu-banner-inline">
<svg width="16" height="16" viewBox="0 0 16 16" fill="none">
<rect x="3" y="7" width="10" height="7" rx="1.5" stroke="currentColor" stroke-width="1.4"/>
<path d="M5.5 7V5a2.5 2.5 0 015 0v2" stroke="currentColor" stroke-width="1.4"/>
</svg>
<span>The approval date{{ uploadDeadline ? (' (' + (uploadDeadline | date:'dd MMM yyyy') + ')') : '' }} for {{ salaryMonth ? (salaryMonth | date:'MMMM yyyy') : 'this' }} salary month has passed. Component upload is closed.</span>
</div>
}
<button class="cu-btn-primary" [disabled]="!canUpload || !selectedFile" (click)="upload()">
<svg width="17" height="17" viewBox="0 0 17 17" fill="none">
<path d="M8.5 12V4M8.5 4L5 7.5M8.5 4L12 7.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M3 13.5h11" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
</svg>
Upload
</button>
</div>
</div>
</div><!-- /main card -->
<!-- ── Sidebar ── -->
<div class="cu-sidebar">
<div class="cu-sidebar-card">
<p class="cu-sc-label">Upload Window</p>
<div class="cu-window-box">
<div class="cu-window-row">
<span class="cu-window-key">Salary Month</span>
<span class="cu-window-val">{{ salaryMonth ? (salaryMonth | date:'MMMM yyyy') : '—' }}</span>
</div>
<div class="cu-window-row">
<span class="cu-window-key">Upload By</span>
<span class="cu-window-val">{{ uploadDeadline ? (uploadDeadline | date:'dd MMM yyyy') : '—' }}</span>
</div>
</div>
<span class="cu-pill"
[class.cu-pill-open]="windowValid && !deadlinePassed"
[class.cu-pill-closed]="!windowValid || deadlinePassed">
{{ deadlinePassed ? 'Deadline passed' : (windowValid ? 'Open now' : 'Closed') }}
</span>
</div>
<div class="cu-sidebar-card">
<div class="cu-sc-title-row">
<div class="cu-sc-icon">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none">
<path d="M9 1.5L2.5 4.5V9c0 4 2.8 7.5 6.5 8.5C12.7 16.5 15.5 13 15.5 9V4.5L9 1.5z" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M6 9l2 2 4-4" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</div>
<span class="cu-sc-title">Guidelines</span>
</div>
<ul class="cu-guidelines">
@for (g of ['Only Excel files (.xls, .xlsx) are accepted',
'Download the sample file for the exact column format',
'One upload per component — delete the old one to replace it',
'Approved uploads cannot be edited or deleted',
'Uploads are only accepted inside the monthly window']; track g) {
<li>
<svg width="15" height="15" viewBox="0 0 15 15" fill="none" style="flex-shrink:0;margin-top:1px">
<circle cx="7.5" cy="7.5" r="7.5" fill="#22C55E"/>
<path d="M4.5 7.5l2 2 4-4" stroke="#fff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
{{ g }}
</li>
}
</ul>
</div>
</div><!-- /sidebar -->
</div><!-- /top -->
<!-- ══════════ Upload result ══════════ -->
@if (results && results.length) {
<div class="cu-card cu-results-card">
<div class="cu-results-hdr">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none">
<path d="M9 2l6.5 11.5H2.5L9 2z" stroke="#DC2626" stroke-width="1.4" stroke-linejoin="round"/>
<path d="M9 6.5v3.5M9 12h.01" stroke="#DC2626" stroke-width="1.5" stroke-linecap="round"/>
</svg>
<span class="cu-results-title">{{ results.length }} row(s) need attention</span>
</div>
<kendo-grid [kendoGridBinding]="results" [pageable]="false" [sortable]="true" [resizable]="true">
<kendo-grid-column field="rowNo" title="Excel Row" [width]="120"></kendo-grid-column>
<kendo-grid-column field="employeeNo" title="Employee ID" [width]="160"></kendo-grid-column>
<kendo-grid-column field="message" title="Message"></kendo-grid-column>
</kendo-grid>
</div>
}
<!-- ══════════ Uploaded Components ══════════ -->
<div class="cu-card cu-results-card">
<div class="cu-list-hdr">
<div class="cu-list-title-grp">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none">
<path d="M4 2h8l4 4v10a1 1 0 01-1 1H4a1 1 0 01-1-1V3a1 1 0 011-1z" fill="#EEF4FF" stroke="currentColor" stroke-width="1.3"/>
<path d="M12 2v4h4" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M6 10h6M6 13h4" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
</svg>
<span class="cu-list-title">Uploaded Components</span>
<span class="cu-count-pill">{{ uploadedList.length }}</span>
</div>
<div class="cu-search-wrap cu-list-search">
<svg width="14" height="14" viewBox="0 0 14 14" fill="none">
<circle cx="6" cy="6" r="4.5" stroke="#9CA3AF" stroke-width="1.3"/>
<path d="M9.5 9.5L12.5 12.5" stroke="#9CA3AF" stroke-width="1.3" stroke-linecap="round"/>
</svg>
<input class="cu-search" placeholder="Search…"
[(ngModel)]="uploadedListSearch" (ngModelChange)="filterUploadedList($event)">
</div>
</div>
<kendo-grid [kendoGridBinding]="uploadedList" [pageable]="true" [pageSize]="10" [sortable]="true" [resizable]="true">
<kendo-grid-column field="description" title="Component Name">
<ng-template kendoGridCellTemplate let-row>
{{ row.description }}
</ng-template>
</kendo-grid-column>
<kendo-grid-column field="uploadedDate" title="Upload Date" [width]="190">
<ng-template kendoGridCellTemplate let-row>
{{ row.uploadedDate ? (row.uploadedDate | date:'dd MMM yyyy, hh:mm a') : '—' }}
</ng-template>
</kendo-grid-column>
<kendo-grid-column field="salaryMonth" title="Salary Month" [width]="140">
<ng-template kendoGridCellTemplate let-row>
{{ row.salaryMonth ? (row.salaryMonth | date:'MMM yyyy') : '—' }}
</ng-template>
</kendo-grid-column>
<kendo-grid-column field="approver" title="Approver"></kendo-grid-column>
<kendo-grid-column field="status" title="Status" [width]="130"></kendo-grid-column>
<kendo-grid-column title="Action" [width]="170" [sortable]="false">
<ng-template kendoGridCellTemplate let-row>
<div class="cu-row-actions">
<button class="cu-tbl-btn cu-tbl-btn-view" (click)="viewById(row.uploadedComponentID)">View</button>
@if (row.status !== 'Approved') {
<button class="cu-tbl-btn cu-tbl-btn-delete"
(click)="deleteById(row.uploadedComponentID)">Delete</button>
}
</div>
</ng-template>
</kendo-grid-column>
<ng-template kendoGridNoRecordsTemplate>
<span class="cu-empty-row">You haven't uploaded any component yet.</span>
</ng-template>
</kendo-grid>
</div>
</div>
<!-- ══════════ View uploaded — overlay ══════════ -->
@if (showViewPanel) {
<div class="cu-overlay" (click)="closeViewPanel()">
<div class="cu-modal" (click)="$event.stopPropagation()">
<div class="cu-modal-hdr">
<span class="cu-modal-title">
Uploaded Rows
<span class="cu-count-pill">{{ viewRows.length }}</span>
</span>
<span class="cu-modal-close" (click)="closeViewPanel()">×</span>
</div>
<div class="cu-modal-toolbar">
<div class="cu-search-wrap">
<svg width="14" height="14" viewBox="0 0 14 14" fill="none">
<circle cx="6" cy="6" r="4.5" stroke="#9CA3AF" stroke-width="1.3"/>
<path d="M9.5 9.5L12.5 12.5" stroke="#9CA3AF" stroke-width="1.3" stroke-linecap="round"/>
</svg>
<input class="cu-search" placeholder="Search employee, amount…"
[(ngModel)]="viewSearch" (ngModelChange)="filterViewRows($event)">
</div>
</div>
<div class="cu-modal-table">
<kendo-grid [kendoGridBinding]="viewRows" [pageable]="true" [pageSize]="20" [sortable]="true" [resizable]="true">
<kendo-grid-column field="employeeNo" title="Employee No" [width]="140"></kendo-grid-column>
<kendo-grid-column field="name" title="Employee Name"></kendo-grid-column>
<kendo-grid-column field="amount" title="Amount" [width]="140"
[headerStyle]="{'text-align': 'right'}" [style]="{'text-align': 'right'}">
<ng-template kendoGridCellTemplate let-row>
{{ row.amount != null ? (row.amount | number:'1.0-2') : '—' }}
</ng-template>
</kendo-grid-column>
<ng-template kendoGridNoRecordsTemplate>
<span class="cu-empty-row">No rows to show.</span>
</ng-template>
</kendo-grid>
</div>
</div>
</div>
}

View File

@ -0,0 +1,418 @@
import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { AuthService } from 'src/app/_services/auth/auth.service';
import { BasicService } from 'src/app/_services/Basic/basic.service';
import { DataUploadService } from 'src/app/_services/Basic/dataUpload.service';
import { ApiService } from 'src/app/app.api.service';
import { loadingPanelService } from 'src/app/hrm-loding panel/loding.panel.service';
import { HRMNotificationService } from 'src/app/app.notification.service';
import { EnumComponentType, EnumRegularDataUpload } from 'src/app/_models/enums';
import * as XLSX from 'xlsx';
import * as fileSaver from 'file-saver';
const EXCEL_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
const EXCEL_EXTENSION = '.xlsx';
interface CuComponent {
itemID: number;
description: string;
componentType: EnumComponentType;
}
interface CuUploadedRow {
employeeNo: string;
name: string;
amount: number;
}
@Component({
selector: 'app-ess-component-uploader',
templateUrl: './component-uploader.component.html',
styleUrls: ['./component-uploader.component.css'],
changeDetection: ChangeDetectionStrategy.Eager,
standalone: false,
})
/** ESS Upload Component (/ess/component-uploader), as GP's /hress/component-uploader. */
export class EssComponentUploaderComponent implements OnInit {
private readonly uploadType = EnumRegularDataUpload.EssComponentUpload;
// reference data
components: CuComponent[] = [];
selectedComponent: CuComponent | null = null;
readonly defaultComponent = { itemID: null, description: 'Choose a component…' };
salaryMonth: Date | null = null;
// logged-in context
private employeeID = 0;
private payrollTypeID = 0;
// upload-window validity
windowValid = true;
windowFromDay: number | null = null;
windowToDay: number | null = null;
windowMessage = '';
// component upload deadline (admin-set approval date, re-anchored to the current salary month)
deadlinePassed = false;
uploadDeadline: Date | null = null;
// per-component upload state
uploadedComponent: any = null;
alreadyUploaded = false;
approved = false;
statusMessage = '';
// file selection
dragOver = false;
selectedFile: File | null = null;
private columnDefinition: any = null;
// result of an upload attempt
results: { rowNo: number; message: string; employeeNo: string }[] = [];
// "view uploaded" panel
showViewPanel = false;
viewRows: CuUploadedRow[] = [];
private viewRowsAll: CuUploadedRow[] = [];
viewSearch = '';
// "Uploaded Components" list (all components this employee has uploaded this cycle)
uploadedList: any[] = [];
private uploadedListAll: any[] = [];
uploadedListSearch = '';
constructor(
private authService: AuthService,
private basicService: BasicService,
private dataUploadService: DataUploadService,
private loadingPanel: loadingPanelService,
private notify: HRMNotificationService,
private apiService: ApiService,
) {
this.apiService.selectedMenuName = 'Upload Component';
}
ngOnInit(): void {
this.loadValidity();
this.loadUploadDeadline();
this.loadComponents();
this.loadContext();
this.loadColumnDefinition();
this.loadUploadedList();
}
// No component upload is allowed once the (re-anchored) approval date for this salary month has passed.
private loadUploadDeadline(): void {
this.basicService.getComponentUploadDeadline().subscribe(
(resp: any) => {
this.deadlinePassed = !!resp && resp.allowed === false;
this.uploadDeadline = (resp && resp.deadline) ? new Date(resp.deadline) : null;
if (resp && resp.salaryMonth) { this.salaryMonth = new Date(resp.salaryMonth); }
},
() => {},
);
}
// Load the generic Excel column template once (item-independent) so "Download Sample" works anytime.
private loadColumnDefinition(): void {
this.dataUploadService.getPrepareColumnDefinition(this.uploadType, 0).subscribe(
(resp: any) => { this.columnDefinition = resp; },
() => {},
);
}
// ───────────────────────── loaders ─────────────────────────
private loadValidity(): void {
this.basicService.checkComponentUploadValidity().subscribe(
(resp: any) => {
if (!resp) { return; }
this.windowValid = resp.valid === true;
this.windowFromDay = resp.componentuploadfromdate ?? null;
this.windowToDay = resp.componentuploadtodate ?? null;
const month = new Date().toLocaleString('en-US', { month: 'short' });
// Only warn when the window is CLOSED.
this.windowMessage = (!this.windowValid && this.windowFromDay != null && this.windowToDay != null)
? `Component upload is only allowed from ${this.windowFromDay}${this.ord(this.windowFromDay)} to ${this.windowToDay}${this.ord(this.windowToDay)} ${month}.`
: '';
},
() => { /* keep default state */ },
);
}
private loadComponents(): void {
this.loadingPanel.ShowLoadingPanel = true;
this.basicService.getEmpComponentUploadSetups().subscribe(
(resp: any) => {
this.components = Array.isArray(resp)
? resp.map((r: any) => ({ itemID: r.itemID, description: r.description, componentType: r.componentType }))
: [];
},
(err: any) => {
this.loadingPanel.ShowLoadingPanel = false;
this.notify.showError(typeof err?.error === 'string' ? err.error : 'Could not load your assigned components.');
},
() => { this.loadingPanel.ShowLoadingPanel = false; },
);
}
private loadContext(): void {
this.authService.GetCurrentUser().subscribe(
(u: any) => { if (u) { this.employeeID = u.employeeID; } },
() => {},
);
this.authService.GetPayrollTypeByLoginID().subscribe(
(pt: any) => {
if (!pt) { return; }
this.payrollTypeID = pt.id;
if (pt.nextPayProcessDate) {
this.salaryMonth = new Date(pt.nextPayProcessDate);
}
},
() => {},
);
}
// ─────────────────────── component select ───────────────────────
onComponentChange(component: any): void {
const valid: CuComponent | null =
component && component.itemID != null
? { itemID: component.itemID, description: component.description, componentType: component.componentType }
: null;
this.selectedComponent = valid;
this.resetUploadState();
if (!valid) { return; }
this.checkExisting(valid);
}
private checkExisting(component: CuComponent): void {
this.loadingPanel.ShowLoadingPanel = true;
this.basicService.getExistingUploadedComponent(component.itemID, component.componentType).subscribe(
(resp: any) => { this.uploadedComponent = resp; },
() => { this.loadingPanel.ShowLoadingPanel = false; },
() => {
if (this.uploadedComponent && this.uploadedComponent.id > 0) {
this.alreadyUploaded = true;
this.approved = this.uploadedComponent.approvedBy > 0;
this.statusMessage = this.approved
? 'This component is uploaded and approved by your approver. It can no longer be changed.'
: 'This component is already uploaded and waiting for approver review. Use "Delete Upload" if you need to replace the file.';
} else {
this.alreadyUploaded = false;
this.approved = false;
this.statusMessage = '';
}
this.loadingPanel.ShowLoadingPanel = false;
},
);
}
// ───────────────────────── file input ─────────────────────────
onDragOver(e: DragEvent): void { e.preventDefault(); if (this.canUpload) { this.dragOver = true; } }
onDragLeave(e: DragEvent): void { e.preventDefault(); this.dragOver = false; }
onDrop(e: DragEvent): void {
e.preventDefault();
this.dragOver = false;
if (!this.canUpload) { return; }
const file = e.dataTransfer?.files?.[0];
if (file) { this.setFile(file); }
}
onFileSelect(e: Event): void {
const input = e.target as HTMLInputElement;
if (this.canUpload && input.files?.length) { this.setFile(input.files[0]); }
input.value = '';
}
private setFile(file: File): void {
const ext = file.name.toLowerCase().slice(file.name.lastIndexOf('.'));
if (ext !== '.xls' && ext !== '.xlsx') {
this.notify.showWarning('Only Excel files (.xls, .xlsx) are allowed.');
return;
}
this.selectedFile = file;
}
removeFile(): void { this.selectedFile = null; }
// ───────────────────────── actions ─────────────────────────
get canUpload(): boolean {
return this.windowValid && !this.deadlinePassed && !!this.selectedComponent && !this.alreadyUploaded;
}
get uploadHint(): string {
if (this.deadlinePassed) { return 'The approval date for this salary month has passed — component upload is closed.'; }
if (!this.selectedComponent) { return 'Select a component above to enable file upload.'; }
if (!this.windowValid) { return 'The upload window is currently closed.'; }
if (this.alreadyUploaded) { return 'This component is already uploaded. Delete it below to upload again.'; }
return 'Only Excel files (.xls, .xlsx). Download the sample above to match the required format.';
}
upload(): void {
if (this.deadlinePassed) { this.notify.showWarning('The approval date for this salary month has passed. Upload is no longer allowed.'); return; }
if (!this.selectedComponent) { this.notify.showWarning('Please select a component.'); return; }
if (!this.selectedFile) { this.notify.showWarning('Please choose an Excel file.'); return; }
if (!this.salaryMonth) { this.notify.showWarning('Salary month is not available yet.'); return; }
this.results = [];
this.loadingPanel.ShowLoadingPanel = true;
this.dataUploadService.uploadFile(
this.selectedFile,
this.uploadType,
this.selectedComponent.itemID,
this.selectedComponent.componentType,
this.salaryMonth,
).subscribe(
(resp: any) => { this.results = (resp && resp.body) ? resp.body : []; },
(err: any) => {
this.loadingPanel.ShowLoadingPanel = false;
this.notify.showError(typeof err?.error === 'string' ? err.error : 'Failed to upload the file.');
},
() => {
this.loadingPanel.ShowLoadingPanel = false;
if (!this.results || this.results.length === 0) {
this.notify.showSuccess('File uploaded successfully. A mail has been sent to your approver.');
// Clean slate — the upload is confirmed in the list below.
this.selectedComponent = null;
this.resetUploadState();
this.loadUploadedList();
} else {
this.notify.showError('Some rows could not be processed. Please review the list below.');
}
},
);
}
// ─────────────────── Uploaded Components list ───────────────────
private loadUploadedList(): void {
this.basicService.getUploaderComponentUploadDT().subscribe(
(resp: any) => {
const rows = Array.isArray(resp) ? resp : [];
this.uploadedListAll = rows.map((item: any) => {
const approvedBy = this.pick(item, 'approvedBy', 'ApprovedBy', 'APPROVEDBY');
const empNo = this.pick(item, 'employeeNo', 'EmployeeNo', 'EMPLOYEENO');
const name = this.pick(item, 'name', 'Name', 'NAME');
const isApproved = approvedBy != null && approvedBy !== 0 && approvedBy !== '0';
// Approver comes from the component setup, so show it regardless of approval status.
const approver = (empNo != null || name != null)
? [empNo, name].filter(v => v != null && v !== '').join('-')
: '—';
return {
uploadedComponentID: this.pick(item, 'uploadedComponentID', 'UploadedComponentID', 'UPLOADEDCOMPONENTID'),
description: this.pick(item, 'description', 'Description', 'DESCRIPTION'),
salaryMonth: this.pick(item, 'salaryMonth', 'SalaryMonth', 'SALARYMONTH'),
uploadedDate: this.pick(item, 'uploadedDate', 'UploadedDate', 'UPLOADEDDATE'),
status: isApproved ? 'Approved' : 'Pending',
approver: approver || '—',
};
});
this.uploadedList = [...this.uploadedListAll];
},
() => {},
);
}
private pick(o: any, ...keys: string[]): any {
for (const k of keys) { if (o != null && o[k] != null) { return o[k]; } }
return undefined;
}
filterUploadedList(text: string): void {
const q = (text || '').toLowerCase();
this.uploadedList = this.uploadedListAll.filter(r =>
Object.values(r).some(v => v != null && v.toString().toLowerCase().includes(q)),
);
}
viewById(uploadedComponentID: number): void {
if (!uploadedComponentID) { return; }
this.loadingPanel.ShowLoadingPanel = true;
this.basicService.viewUploadedComponent(uploadedComponentID).subscribe(
(resp: any) => { this.viewRowsAll = Array.isArray(resp) ? resp : []; },
() => { this.loadingPanel.ShowLoadingPanel = false; },
() => {
this.viewRows = [...this.viewRowsAll];
this.viewSearch = '';
this.showViewPanel = true;
this.loadingPanel.ShowLoadingPanel = false;
},
);
}
deleteById(uploadedComponentID: number): void {
if (!uploadedComponentID) { return; }
this.notify.showActiveConfirm('Confirmation', 'Delete this uploaded component?').then((ok: boolean) => {
if (!ok) { return; }
this.loadingPanel.ShowLoadingPanel = true;
this.basicService.deleteUploadComponent(uploadedComponentID).subscribe(
() => {},
(err: any) => {
this.loadingPanel.ShowLoadingPanel = false;
this.notify.showError(typeof err?.error === 'string' ? err.error : 'Failed to delete the uploaded component.');
},
() => {
this.loadingPanel.ShowLoadingPanel = false;
this.notify.showSuccess('Deleted successfully.');
this.results = [];
this.loadUploadedList();
if (this.selectedComponent) { this.checkExisting(this.selectedComponent); }
},
);
});
}
downloadSample(): void {
if (!this.columnDefinition || !Array.isArray(this.columnDefinition.columnName)) {
this.notify.showWarning('Sample template is still loading. Please try again in a moment.');
return;
}
const headerRow = this.columnDefinition.columnName.reduce((acc: any, col: string) => { acc[col] = ''; return acc; }, {});
const sheetName = this.columnDefinition.sheetName || 'Sheet1';
const workbook = XLSX.utils.book_new();
const worksheet = XLSX.utils.json_to_sheet([headerRow]);
XLSX.utils.book_append_sheet(workbook, worksheet, sheetName);
const buffer: any = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
const blob: Blob = new Blob([buffer], { type: EXCEL_TYPE });
fileSaver.saveAs(blob, `${sheetName}_sample_${new Date().getTime()}${EXCEL_EXTENSION}`);
}
viewUploaded(): void {
if (this.uploadedComponent && this.uploadedComponent.id) { this.viewById(this.uploadedComponent.id); }
}
deleteUploaded(): void {
if (this.uploadedComponent && this.uploadedComponent.id) { this.deleteById(this.uploadedComponent.id); }
}
filterViewRows(text: string): void {
const q = (text || '').toLowerCase();
this.viewRows = this.viewRowsAll.filter(r =>
Object.values(r).some(v => v != null && v.toString().toLowerCase().includes(q)),
);
}
closeViewPanel(): void { this.showViewPanel = false; }
// ───────────────────────── helpers ─────────────────────────
private resetUploadState(): void {
this.uploadedComponent = null;
this.alreadyUploaded = false;
this.approved = false;
this.statusMessage = '';
this.selectedFile = null;
this.results = [];
this.showViewPanel = false;
}
ord(n: number): string {
const s = ['th', 'st', 'nd', 'rd'];
const v = n % 100;
return s[(v - 20) % 10] || s[v] || s[0];
}
}

View File

@ -39,6 +39,8 @@ import { ShortLeaveComponent } from '../ess/leave/short-leave/short-leave.compon
import { ShortLeaveApproveComponent } from './leave/short-leave-approve/short-leave-approve.component';
import { GatemanApprovalComponent } from './leave/gateman-approval/gateman-approval.component';
import { MyTeamComponent } from './my-team/my-team.component';
import { EssComponentUploaderComponent } from './component-uploader/component-uploader.component';
import { EssComponentApprovalComponent } from './component-approval/component-approval.component';
import { ScheduleMailLogComponent } from './schedule-mail-log/schedule-mail-log.component';
import { CordinatorDashboardComponent } from './cordinator-dashboard/cordinator-dashboard.component';
import { EditAttendanceModule } from '../attendance/attendance-manual-edit-for-multiple-employee/edit-attendance.module';
@ -52,6 +54,7 @@ import { TrainingNeedAnalysisLmComponent } from './training-need-analysis-lm/tra
import { CoreHrDashboardComponent } from '../core-hr/core-hr-dashboard/core-hr-dashboard/core-hr-dashboard.component';
import { SelfServiceDashboardComponent } from './self-service-dashboard/self-service-dashboard.component';
import { UserSSDashboardComponent } from './user-ssdashboard/user-ssdashboard.component';
import { BRACSelfServiceComponent } from './brac-self-service/brac-self-service.component';
import { CompanyUpdatesComponent } from './company-updates/company-updates.component';
import { CandidateSelectionOfferLetterComponent } from '../recruitment/candidate-selection-offer-letter/candidate-selection-offer-letter.component';
import { TaxMasterComponent } from '../payroll-tax/tax-master/tax-master.component';
@ -61,7 +64,7 @@ export const routes: Routes = [
{ path: 'self-profile', component: SelfProfileComponent, canActivate: [AuthGuard] },
{ path: 'ess-dashboard', component: EssDashboardComponent, canActivate: [AuthGuard] },
{ path: 'selfservice-dashboard', component: SelfServiceDashboardComponent, canActivate: [AuthGuard] },
{ path: 'self-dashboard', component: UserSSDashboardComponent, canActivate: [AuthGuard] },
{ path: 'self-dashboard', component: BRACSelfServiceComponent, canActivate: [AuthGuard] },
{ path: 'company-updates', component: CompanyUpdatesComponent, canActivate: [AuthGuard] },
{ path: 'landing-page', component: LandingPageComponent, canActivate: [AuthGuard] },
{ path: 'leave-approve', component: LeaveApproveComponent, canActivate: [AuthGuard] },
@ -120,6 +123,9 @@ export const routes: Routes = [
{ path: 'independent-development-plan/firstLM', component: IndependentDevelopmentPlanComponent, canActivate: [AuthGuard] },
{ path: 'independent-development-plan/LMAssesment', component: IndependentDevelopmentPlanComponent, canActivate: [AuthGuard] },
{ path: 'my-idp', component: MyIdpComponent, canActivate: [AuthGuard] },
// Component Upload (as GP): the menu shows only to an uploader / approver of a ComponentUploadSetup
{ path: 'component-uploader', component: EssComponentUploaderComponent, canActivate: [AuthGuard] },
{ path: 'component-approval', component: EssComponentApprovalComponent, canActivate: [AuthGuard] },
];
@NgModule({

View File

@ -77,6 +77,8 @@ import { ShortLeaveComponent } from '../ess/leave/short-leave/short-leave.compon
import { ShortLeaveApproveComponent } from './leave/short-leave-approve/short-leave-approve.component';
import { GatemanApprovalComponent } from './leave/gateman-approval/gateman-approval.component';
import { MyTeamComponent } from './my-team/my-team.component';
import { EssComponentUploaderComponent } from './component-uploader/component-uploader.component';
import { EssComponentApprovalComponent } from './component-approval/component-approval.component';
import { LeaveHistoryComponent } from './my-team/leave-history/leave-history.component';
import { ScheduleMailLogComponent } from './schedule-mail-log/schedule-mail-log.component';
import { CordinatorDashboardComponent } from './cordinator-dashboard/cordinator-dashboard.component';
@ -90,6 +92,7 @@ import { EssTrainingScheduleComponent } from './ess-training-schedule/ess-traini
import { TrainingNeedAnalysisLmComponent } from './training-need-analysis-lm/training-need-analysis-lm.component';
import { SelfServiceDashboardComponent } from './self-service-dashboard/self-service-dashboard.component';
import { UserSSDashboardComponent } from './user-ssdashboard/user-ssdashboard.component';
import { BRACSelfServiceComponent } from './brac-self-service/brac-self-service.component';
import { RecruitmentModule } from '../recruitment/recruitment.module';
import { TalentManagementModule } from '../talent-management/talent-management.module';
import { CandidateSelectionOfferLetterComponent } from '../recruitment/candidate-selection-offer-letter/candidate-selection-offer-letter.component';
@ -120,8 +123,9 @@ import { ChunkPipe } from '../helper/chunk.pipe';
GatemanApprovalComponent,MyTeamComponent, LeaveHistoryComponent, ScheduleMailLogComponent,
CordinatorDashboardComponent, ProratedApproveComponent, PfExceptionComponent, MemberBalanceLedgerComponent,
EssTrainingCalenderComponent, EssTrainingScheduleComponent, TrainingNeedAnalysisLmComponent, SelfServiceDashboardComponent,
UserSSDashboardComponent, CompanyUpdatesComponent,
EmployeeDictionaryComponent, IndependentDevelopmentPlanComponent, MyIdpComponent
UserSSDashboardComponent, BRACSelfServiceComponent, CompanyUpdatesComponent,
EmployeeDictionaryComponent, IndependentDevelopmentPlanComponent, MyIdpComponent,
EssComponentUploaderComponent, EssComponentApprovalComponent
],
imports: [

View File

@ -41,6 +41,15 @@ export class BasicEntryControlComponent implements OnInit {
//basiccontrol: BasicEntryFormControl<any>;
applyBanglaFont: boolean = false;
get isValid() { return this.form.controls[this.basiccontrol.controlID].valid; }
// the control's own placeholder, else "Select <label>" (e.g. "Select Religion")
get multiSelectPlaceholder(): string {
const own = (this.basiccontrol.placeholder || '').trim();
if (own != '') {
return own;
}
const label = (this.basiccontrol.label || '').trim();
return label != '' ? 'Select ' + label : 'Select';
}
constructor(public bsview: basicformbuilderService) {
@ -49,7 +58,8 @@ export class BasicEntryControlComponent implements OnInit {
ngOnInit() {
if (this.basiccontrol.controlType == EnumDynamicControlType.DropDownServerData
|| this.basiccontrol.controlType == EnumDynamicControlType.DropDownEnumData) {
if (this.basiccontrol.value != "") {
// `!= ""` alone is false for 0, which would leave a saved 0 option unselected
if (this.basiccontrol.value !== "" && this.basiccontrol.value != null) {
for (var i = 0; i < this.basiccontrol.dropDownValues.length; i++) {
if (this.basiccontrol.dropDownValues[i].keyValue.toString() == this.basiccontrol.value) {
// this.DDDefaultValue = this.basiccontrol.dropDownValues[i];

View File

@ -13,7 +13,7 @@
<fieldset style="padding: 0px;">
<div class="form-row-wrapper">
@for (ctl of this.basicMasterView.entryFrom.controls; track ctl) {
<div class="form-row">
<div class="form-row" [ngClass]="getRowClass(ctl)">
<app-basic-from-control [basiccontrol]="ctl" [form]="form"></app-basic-from-control>
</div>
}

View File

@ -1,5 +1,5 @@
import {HttpClient} from '@angular/common/http';
import {BasicEntryForm, EnumDynamicControlType} from './Basic-Entry-form';
import {BasicEntryForm, BasicEntryFormControl, EnumDynamicControlType} from './Basic-Entry-form';
import {Component, Input, OnInit, Output, EventEmitter, ElementRef, ChangeDetectionStrategy} from '@angular/core';
import {FormGroup} from '@angular/forms';
import {BasicMasterView, EnumFormView} from './Basic-Master-View';
@ -75,9 +75,21 @@ export class BasicEntryFormComponent implements OnInit {
}
// e.g. "Are you sure you want to save this Bonus?" / "...update this Bonus?"
private getSaveConfirmMessage(): string {
const caption = (this.basicMasterView.caption || '').trim();
const action = this.basicMasterView.entryFrom.isNew == false ? 'update' : 'save';
return caption != ''
? `Are you sure you want to ${action} this ${caption}?`
: `Are you sure you want to ${action}?`;
}
onSubmit() {
this.notificationService.confirm('Do you sure you want to save?', () => {
this.notificationService.showActiveConfirm('Confirmation', this.getSaveConfirmMessage()).then((isConfirmed) => {
if (!isConfirmed) {
return;
}
this.payLoad = JSON.stringify(this.form.value);
this.basicMasterView.entryFrom.controls.forEach(x => {
if (x.controlType == EnumDynamicControlType.DropDownEnumData) {
@ -91,6 +103,9 @@ export class BasicEntryFormComponent implements OnInit {
} else if (x.controlType == EnumDynamicControlType.DateTime) {
var ddate: Date = this.intl.parseDate(this.form.controls[x.controlID].value);
x.value = ddate.toDateString();
} else if (x.controlType == EnumDynamicControlType.MultiSelectServerData) {
const selected = this.form.controls[x.controlID].value;
x.value = Array.isArray(selected) ? selected.join(',') : '';
} else {
x.value = String(this.form.controls[x.controlID].value);
}
@ -119,12 +134,8 @@ export class BasicEntryFormComponent implements OnInit {
this.AutogeneratedCode();
}
});
},
() => {
// User canceled, do nothing
//this.notificationService.showInfo('Save operation canceled.');
});
}
@ -244,6 +255,38 @@ export class BasicEntryFormComponent implements OnInit {
this.opened = true;
}
// Layout of the two-per-line field grid, worked out only when the form has a multi-select
// (any other form returns '' and keeps the theme's own rule: an odd last field is full width).
// A multi-select always takes the full line; a field left without a partner before it,
// or at the end, takes the full line too; every other field shares its line.
public getRowClass(ctl: BasicEntryFormControl): string {
const controls = this.basicMasterView.entryFrom.controls;
if (!controls.some(x => x.controlType == EnumDynamicControlType.MultiSelectServerData)) {
return '';
}
const full = new Set<BasicEntryFormControl>();
let openField: BasicEntryFormControl = null; // field waiting for a partner on its right
controls.forEach(x => {
if (x.controlType == EnumDynamicControlType.MultiSelectServerData) {
if (openField != null) {
full.add(openField);
openField = null;
}
full.add(x);
} else if (openField == null) {
openField = x;
} else {
openField = null;
}
});
if (openField != null) {
full.add(openField);
}
return full.has(ctl) ? 'form-row-full' : 'form-row-half';
}
public scrollToTop(): void {
const element = this.elementRef.nativeElement;
element.scrollIntoView({ behavior: 'smooth', block: 'start' });

View File

@ -41,6 +41,17 @@
[style.width]="textFieldWidth">
</kendo-dropdownlist>
}
@case (8) {
<kendo-multiselect [id]="basiccontrol.controlID" [formControlName]="basiccontrol.controlID"
[data]="this.basiccontrol.dropDownValues"
[textField]="'dataValue'"
[valueField]="'keyValue'"
[valuePrimitive]="true"
[autoClose]="false"
[placeholder]="multiSelectPlaceholder"
[style.width]="textFieldWidth">
</kendo-multiselect>
}
}
</div>
@if (!isValid) {

View File

@ -8,6 +8,9 @@ export var EnumDynamicControlType;
EnumDynamicControlType[EnumDynamicControlType["DateTime"] = 5] = "DateTime";
EnumDynamicControlType[EnumDynamicControlType["NumText"] = 6] = "NumText";
EnumDynamicControlType[EnumDynamicControlType["IntNumText"] = 7] = "IntNumText";
// Kendo multi-select fed from a master object ('Object|Get|IDField|TextField').
// The value travels as comma-separated IDs, e.g. "1,3".
EnumDynamicControlType[EnumDynamicControlType["MultiSelectServerData"] = 8] = "MultiSelectServerData";
})(EnumDynamicControlType || (EnumDynamicControlType = {}));
export var EnumDefaultValidatorType;
(function (EnumDefaultValidatorType) {
@ -44,6 +47,8 @@ export class BasicEntryFormControl {
this.isNew = true;
this.readOnly = false;
this.codeAutoGenerate = false;
// MultiSelectServerData only: load the list filtered by the current payroll type.
this.multiSelectPayrollTypeSearch = false;
this.dropDownValues = [];
this.propertyName = PropertyName;
this.label = Label;

View File

@ -1 +1 @@
{"version":3,"file":"Basic-Entry-form.js","sourceRoot":"","sources":["Basic-Entry-form.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,sBASX;AATD,WAAY,sBAAsB;IAC9B,qEAAK,CAAA;IACL,yEAAO,CAAA;IACP,2FAAgB,CAAA;IAChB,+FAAkB,CAAA;IAClB,2EAAQ,CAAA;IACR,2EAAQ,CAAA;IACR,yEAAO,CAAA;IACP,+EAAU,CAAA;AACd,CAAC,EATW,sBAAsB,KAAtB,sBAAsB,QASjC;AAED,MAAM,CAAN,IAAY,wBAQX;AARD,WAAY,wBAAwB;IAChC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AAC,QAAQ,IAAI,IAAI,EAAE,CAAC;YACxB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QAC1B,CAAC;QACD,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;QACnD,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC7C,CAAC;CACJ;AAED,MAAM,OAAO,oBAAoB;IAI7B,YAAY,QAAgB,EAAE,SAAiB;QAC3C,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAE/B,CAAC;CACJ"}

View File

@ -8,7 +8,10 @@ export enum EnumDynamicControlType {
CheckBox,
DateTime,
NumText,
IntNumText
IntNumText,
// Kendo multi-select fed from a master object ('Object|Get|IDField|TextField').
// The value travels as comma-separated IDs, e.g. "1,3".
MultiSelectServerData
}
export enum EnumDefaultValidatorType {
@ -97,6 +100,10 @@ export class BasicEntryFormControl {
codeAutoGenerate: boolean = false;
treeViewTier: number;
treeViewparentID?: number;
// MultiSelectServerData only: load the list filtered by the current payroll type.
multiSelectPayrollTypeSearch: boolean = false;
// MultiSelectServerData only: placeholder text; when empty it is "Select <label>".
placeholder: string;
constructor(
Label: string,

View File

@ -168,6 +168,30 @@ export class BasicMasterViewComponent implements OnInit {
}
if (ctl.controlType == EnumDynamicControlType.MultiSelectServerData) {
this.bsView.GetMultiSelectValue(ctl).subscribe(data => {
const values: ControlDropDownValue[] = [];
const arrData: any[] = data || [];
arrData.forEach(row => {
let id: number = 0;
let text;
Object.keys(row).forEach(key => {
if (key.toLowerCase() == ctl.dropdownValue[2].toLowerCase()) {
id = row[key];
}
if (key.toLowerCase() == ctl.dropdownValue[3].toLowerCase()) {
text = row[key];
}
});
if (id != 0 && text != undefined) {
values.push(new ControlDropDownValue(id, text));
}
});
// replaced, not appended, so a reload (status change) does not duplicate the list
ctl.dropDownValues = values;
});
}
});
//for showing active inactive button
// if (this.selectedTreeNode != undefined) {
@ -551,10 +575,32 @@ export class BasicMasterViewComponent implements OnInit {
}
public Delete(row: DataItem, rowindex: any) {
if (confirm('Are you sure to Delete?') == false) {
return;
// e.g. 'Are you sure you want to delete this Bonus "Festival Bonus"?'
private getDeleteConfirmMessage(row: DataItem): string {
const caption = (this.BMasterView.caption || '').trim();
let name = '';
if (row != undefined && row != null) {
const nameKey = Object.keys(row).find(k => k.toLowerCase() == 'name');
if (nameKey != undefined && row[nameKey] != undefined && row[nameKey] != null) {
name = String(row[nameKey]).trim();
}
}
let message = caption != '' ? `Are you sure you want to delete this ${caption}` : 'Are you sure you want to delete this item';
if (name != '') {
message = message + ` "${name}"`;
}
return message + '?';
}
public Delete(row: DataItem, rowindex: any) {
this.notification.showActiveConfirm('Confirmation', this.getDeleteConfirmMessage(row)).then((isConfirmed) => {
if (isConfirmed) {
this.DeleteConfirmed(row, rowindex);
}
});
}
private DeleteConfirmed(row: DataItem, rowindex: any) {
this.setIDValue(row);
this.loadingService.ShowLoadingPanel = true;

View File

@ -92,6 +92,13 @@ export class basicformbuilderService {
// }
//}
else if (question.controlType == EnumDynamicControlType.MultiSelectServerData) {
fromctl = new FormControl(this.toMultiSelectValue(question.value));
}
else if (this.isZeroEnumOption(question)) {
// keep a stored 0 (e.g. EnumAllowanceType.Non_Gross); `|| ''` below would blank it
fromctl = new FormControl(0);
}
else {
fromctl = new FormControl(question.value || '');
}
@ -102,6 +109,23 @@ export class basicformbuilderService {
return new FormGroup(group);
}
// An enum dropdown whose saved value is 0 and which offers a 0 option.
isZeroEnumOption(question: any): boolean {
return question.controlType == EnumDynamicControlType.DropDownEnumData
&& question.value !== '' && question.value != null && Number(question.value) === 0
&& question.dropDownValues?.some(d => Number(d.keyValue) === 0);
}
// "1,3" -> [1, 3] (MultiSelectServerData keeps its value as comma-separated IDs)
private toMultiSelectValue(value: any): number[] {
if (value == undefined || value == null || String(value).trim() == '') {
return [];
}
return String(value).split(',')
.map(x => Number(x.trim()))
.filter(x => !isNaN(x) && x != 0);
}
search(): Observable<any> {
var functionName = 'Get/Null';
return this._apiService.httpGet<any>('/BasicBuilder/GetMasterViewData/' +
@ -117,6 +141,12 @@ export class basicformbuilderService {
}
GetMultiSelectValue(Dtpcontrol: BasicEntryFormControl): Observable<any> {
return this._apiService.httpGet<any>('/BasicBuilder/GetMasterViewData/' +
Dtpcontrol.dropdownValue[0] + '/' + 'Get/1/' + (Dtpcontrol.multiSelectPayrollTypeSearch == true));
//1 == Status-Active
}
GetByID(): Observable<any> {
return this._apiService.httpGet<any>('/BasicBuilder/Get/' +

View File

@ -14,12 +14,6 @@ import {OrganogramService} from '../../_services/payroll/organogram.service';
import {loadingPanelService} from '../../hrm-loding panel/loding.panel.service';
import {Observable} from 'rxjs';
import { type TreeNode } from 'src/app/_models/common/ui-types';
/** An organogram node also shows the second part of the position name (`label2`) in the chart. */
interface OrgTreeNode extends TreeNode {
label2?: string;
children?: OrgTreeNode[];
}
import {ApiService} from '../../app.api.service';
@ -36,6 +30,11 @@ import { TabViewCompatModule } from 'src/app/custom-components/tab-view-compat/t
import { EmployeePickerComponent } from 'src/app/picker/employee-picker.component';
import { TreeViewModule } from '@progress/kendo-angular-treeview';
import { OrganogramPickerComponent } from 'src/app/picker/organogram-picker.component';
/** PrimeNG TreeNode plus a second label line (e.g. designation) shown in the organogram chart. */
export interface OrgTreeNode extends TreeNode {
label2?: string;
children?: OrgTreeNode[];
}
const is = (fileName: string, ext: string) =>
new RegExp(`.${ext}\$`).test(fileName);

View File

@ -1,3 +1,5 @@
<!-- page-level spinner (Approve / Submit / attachments); the other loading panels are inside the pop-up windows -->
<app-loading-panel></app-loading-panel>
<div class="bm-head">
<span class="bm-head__icon"><i class="pi pi-calendar"></i></span>
<div class="bm-head__text">

View File

@ -37,6 +37,7 @@ export class BonusBasicEntryComponent implements OnInit {
this.msv.searchPayrolltype = true;
this.msv.listViewColumn.push(new BasicMasterListColumn('Code', 'Code', EnumColumnDataTypes.String));
this.msv.listViewColumn.push(new BasicMasterListColumn('Name', 'Name', EnumColumnDataTypes.String));
this.msv.listViewColumn.push(new BasicMasterListColumn('Religion', 'ReligionNames', EnumColumnDataTypes.String));
//this.msv.listViewColumn.push(new BasicMasterListColumn('Status', 'Status', EnumColumnDataTypes.String));
@ -49,6 +50,7 @@ export class BonusBasicEntryComponent implements OnInit {
this.msv.entryFrom.AddControl('Code', 'Code', EnumDynamicControlType.TextBox, '', true, EnumDefaultValidatorType.Custom, 256, 2);
this.msv.entryFrom.AddControl('Name', 'Name', EnumDynamicControlType.TextBox, '', true, EnumDefaultValidatorType.Custom, 256, 2);
this.msv.entryFrom.AddControl('Name in Bangla', 'NameInBangla', EnumDynamicControlType.TextBox, '', false, EnumDefaultValidatorType.Custom, 256, 2);
this.msv.entryFrom.AddControl('Religion', 'ReligionIDs', EnumDynamicControlType.MultiSelectServerData, 'Religion|Get|ID|Name', false);
}
}

View File

@ -68,3 +68,48 @@
span.bp-message {
padding: 0 4px;
}
/* Religion of the selected bonus: display only, one numbered badge per religion (palette colours only) */
.bp-religions {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 6px;
min-height: 34px;
padding: 4px 0;
}
.bp-religion {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 2px 10px 2px 3px;
border-radius: 999px;
border: 1px solid color-mix(in srgb, var(--gh-btn) 25%, var(--gh-tb));
background: color-mix(in srgb, var(--gh-btn) 10%, var(--gh-tb));
color: var(--gh-lk);
font-size: 12px;
font-weight: 600;
line-height: 20px;
white-space: nowrap;
}
.bp-religion__no {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 20px;
height: 20px;
padding: 0 5px;
border-radius: 999px;
background: var(--gh-btn);
color: var(--gh-tb);
font-size: 11px;
font-weight: 700;
}
.bp-religion-empty {
color: var(--gh-muted);
font-size: 13px;
font-style: italic;
}

View File

@ -51,6 +51,21 @@
formControlName="cutOffDate"
style="width:100%"></kendo-datepicker>
</div>
<div class="col-12 md:col-6 lg:col-4 bp-field">
<label class="bp-label">Religion</label>
<!-- display only: the religions set on the selected Bonus Type (Bonus master), in order -->
<div class="bp-religions">
@for (religion of bonusReligions; track religion.id; let i = $index) {
<span class="bp-religion">
<span class="bp-religion__no">{{ i + 1 }}</span>{{ religion.name }}
</span>
} @empty {
<span class="bp-religion-empty">
{{ selectedbonusID > 0 ? 'No Religion set for this Bonus' : 'Select Bonus Type first' }}
</span>
}
</div>
</div>
</div>
</div>

Some files were not shown because too many files have changed in this diff Show More