Compare commits
No commits in common. "dev_mohaimen_bonus" and "main" have entirely different histories.
dev_mohaim
...
main
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -749,6 +749,11 @@ FodyWeavers.xsd
|
||||||
# Additional files built by Visual Studio
|
# Additional files built by Visual Studio
|
||||||
|
|
||||||
# End of https://www.toptal.com/developers/gitignore/api/csharp,angular,aspnetcore,visualstudio,visualstudiocode
|
# End of https://www.toptal.com/developers/gitignore/api/csharp,angular,aspnetcore,visualstudio,visualstudiocode
|
||||||
|
/HRM.UI/appsettings.json
|
||||||
|
/HRM.UI/appsettings.json
|
||||||
|
/HRM.UI/appsettings.json
|
||||||
|
/HRM.UI/appsettings.json
|
||||||
|
/HRM.UI/appsettings.json
|
||||||
|
|
||||||
# Employee photos written at runtime (approved thumbnails + photos awaiting approval).
|
# Employee photos written at runtime (approved thumbnails + photos awaiting approval).
|
||||||
# Not source; regenerated/repopulated by the app.
|
# Not source; regenerated/repopulated by the app.
|
||||||
|
|
|
||||||
|
|
@ -106,9 +106,7 @@ npm test # ng test (Karma, entry src/test.ts)
|
||||||
Both SPAs `ng serve` on 4200, so only one of the two can run at a time.
|
Both SPAs `ng serve` on 4200, so only one of the two can run at a time.
|
||||||
|
|
||||||
- `npm run lint` is **broken**: `angular.json` still points at the `@angular-devkit/build-angular:tslint`
|
- `npm run lint` is **broken**: `angular.json` still points at the `@angular-devkit/build-angular:tslint`
|
||||||
builder (with a `tslint.json`), which no longer exists in Angular 19. The `@angular-eslint/*` and `eslint` 9 devDependencies are
|
builder (with a `tslint.json`), which no longer exists in Angular 19. There is no ESLint config.
|
||||||
installed, but there is no ESLint config file and no `@angular-eslint/builder:lint` target yet, so
|
|
||||||
wiring ESLint up means adding both.
|
|
||||||
- `npm test` works, but coverage is nominal — 18 `.spec.ts` files across the whole app. Single spec:
|
- `npm test` works, but coverage is nominal — 18 `.spec.ts` files across the whole app. Single spec:
|
||||||
`ng test --include='**/some.component.spec.ts'`.
|
`ng test --include='**/some.component.spec.ts'`.
|
||||||
- There are no `*.Tests.csproj` anywhere in the solution.
|
- There are no `*.Tests.csproj` anywhere in the solution.
|
||||||
|
|
@ -476,9 +474,7 @@ When behavior differs between clients, look for or add a Logic key rather than b
|
||||||
## Branches: one product, many client deployments
|
## Branches: one product, many client deployments
|
||||||
|
|
||||||
**This checkout is not that repo.** It is `HRM-10` (`origin` = `103.197.204.162:3025/CelHRTeam/HRM-10`),
|
**This checkout is not that repo.** It is `HRM-10` (`origin` = `103.197.204.162:3025/CelHRTeam/HRM-10`),
|
||||||
a fresh import whose history starts at one squashed commit (`838b8d4` "first commit"). Since then it
|
a fresh import with a single branch `main` and a single squashed commit (`838b8d4` "first commit").
|
||||||
uses ordinary short-lived branches: `main` is the integration branch (PR target), with per-developer
|
|
||||||
branches (`dev_<name>`, `dev_<name>_<feature>`, `shamim`) merged back into it.
|
|
||||||
None of the older history exists here: every commit hash quoted elsewhere in this file (`c8588ce67`,
|
None of the older history exists here: every commit hash quoted elsewhere in this file (`c8588ce67`,
|
||||||
`91369150c`, `ac179c03e`, `73f466cd0`, `bfd085e0e`) is from the original `CelHRTeam/cel.hrm` repo, and
|
`91369150c`, `ac179c03e`, `73f466cd0`, `bfd085e0e`) is from the original `CelHRTeam/cel.hrm` repo, and
|
||||||
`git show`/`git log` recovery commands only work in a clone of that repo, not here.
|
`git show`/`git log` recovery commands only work in a clone of that repo, not here.
|
||||||
|
|
|
||||||
|
|
@ -949,13 +949,6 @@ namespace HRM.BO
|
||||||
DataSet GetBonusBankAdvice(int BonusID, DateTime dBonusMonth, string sEmpID);
|
DataSet GetBonusBankAdvice(int BonusID, DateTime dBonusMonth, string sEmpID);
|
||||||
DataSet GetBonusPaySlip(int BonusID, DateTime dBonusMonth, string sEmpID);
|
DataSet GetBonusPaySlip(int BonusID, DateTime dBonusMonth, string sEmpID);
|
||||||
int Save(BonusProcess item);
|
int Save(BonusProcess item);
|
||||||
BonusProcessAndSaveResult ProcessAndSave(BonusProcessAndSaveRequest request, int payrolltypeid, int userID);
|
|
||||||
BonusProcessAndSaveResult UploadAndSave(List<BonusProcess.BonusProcessDetail> uploadedRows,
|
|
||||||
BonusProcessAndSaveRequest request, int payrolltypeid, int userID);
|
|
||||||
BonusProcessRowTaxResult CalculateRowTax(BonusProcessRowTaxRequest request, int payrolltypeid);
|
|
||||||
BonusProcessGridRow SaveRow(BonusProcessRowSaveRequest request, int payrolltypeid, int userID);
|
|
||||||
List<BonusProcessGridRow> ClearTaxAndSave(int bonusProcessID, int payrolltypeid, int userID);
|
|
||||||
BonusProcessRowRemoveResult RemoveRow(int bonusProcessDetailID, int payrolltypeid);
|
|
||||||
void Delete(BonusProcess oBonusProcess);
|
void Delete(BonusProcess oBonusProcess);
|
||||||
List<BonusProcess> GetProcess(int bonusID, DateTime bonusMonth);
|
List<BonusProcess> GetProcess(int bonusID, DateTime bonusMonth);
|
||||||
List<BonusProcess> GetProcess(DateTime bonusMonth);
|
List<BonusProcess> GetProcess(DateTime bonusMonth);
|
||||||
|
|
|
||||||
|
|
@ -1,96 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace HRM.BO
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Bonus Process screen, "Process" button: calculate the bonus (and tax) of these employees and save it
|
|
||||||
/// in the same request (api/Bonus/processAndSave). Only the header and the employee IDs travel — the
|
|
||||||
/// browser no longer sends the whole calculated BonusProcess back for a separate Save.
|
|
||||||
/// </summary>
|
|
||||||
public class BonusProcessAndSaveRequest
|
|
||||||
{
|
|
||||||
public int BonusID { get; set; }
|
|
||||||
public DateTime BasicMonth { get; set; }
|
|
||||||
public DateTime PayDate { get; set; }
|
|
||||||
public DateTime CuttOfDate { get; set; }
|
|
||||||
public double CurrProcess { get; set; }
|
|
||||||
public bool IsDisburseWithSalary { get; set; }
|
|
||||||
public bool IsTaxProcess { get; set; }
|
|
||||||
public List<int> EmployeeIDs { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>One saved row of the Bonus Process grid, read back from the database.</summary>
|
|
||||||
public class BonusProcessGridRow
|
|
||||||
{
|
|
||||||
public int BonusProcessDetailID { get; set; }
|
|
||||||
public int BonusProcessID { get; set; }
|
|
||||||
public int BonusID { get; set; }
|
|
||||||
public int EmployeeID { get; set; }
|
|
||||||
public string EmployeeNo { get; set; }
|
|
||||||
public string Name { get; set; }
|
|
||||||
public DateTime? JoiningDate { get; set; }
|
|
||||||
public bool IsConfirmed { get; set; }
|
|
||||||
public double GrossSalary { get; set; }
|
|
||||||
public double BasicSalary { get; set; }
|
|
||||||
public double BonusAmount { get; set; }
|
|
||||||
public double ChangeBonusAmount { get; set; }
|
|
||||||
public double TaxAmount { get; set; }
|
|
||||||
public double ChangeTaxAmount { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>What processAndSave returns: the saved process and its rows.</summary>
|
|
||||||
public class BonusProcessAndSaveResult
|
|
||||||
{
|
|
||||||
public int BonusProcessID { get; set; }
|
|
||||||
public List<BonusProcessGridRow> Rows { get; set; } = new List<BonusProcessGridRow>();
|
|
||||||
/// <summary>Employees left out because this bonus was already processed for them this month.</summary>
|
|
||||||
public List<int> AlreadyProcessedEmployeeIDs { get; set; } = new List<int>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Modify dialog, "Calculate": the tax of one saved row for this bonus amount
|
|
||||||
/// (api/Bonus/calculateRowTax). Nothing is saved.
|
|
||||||
/// </summary>
|
|
||||||
public class BonusProcessRowTaxRequest
|
|
||||||
{
|
|
||||||
public int BonusProcessDetailID { get; set; }
|
|
||||||
public double BonusAmount { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class BonusProcessRowTaxResult
|
|
||||||
{
|
|
||||||
public int BonusProcessDetailID { get; set; }
|
|
||||||
public double BonusAmount { get; set; }
|
|
||||||
public double TaxAmount { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Modify dialog, "Save": saves one row (api/Bonus/saveRow). With CalculateTax the server works the tax
|
|
||||||
/// out again from BonusAmount (TaxAmount is ignored); without it TaxAmount is the amount typed in.
|
|
||||||
/// </summary>
|
|
||||||
public class BonusProcessRowSaveRequest
|
|
||||||
{
|
|
||||||
public int BonusProcessDetailID { get; set; }
|
|
||||||
public double BonusAmount { get; set; }
|
|
||||||
public double TaxAmount { get; set; }
|
|
||||||
public bool CalculateTax { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// "Edited Tax Amount" (with CalculateTax): the tax the user settled on after seeing the calculated one.
|
|
||||||
/// Saved as CHANGETAXAMOUNT and on the Tax Deducted line; TAXAMOUNT keeps the calculated tax.
|
|
||||||
/// Null = use the calculated tax.
|
|
||||||
/// </summary>
|
|
||||||
public double? EditedTaxAmount { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Remove button on a saved row (api/Bonus/removeRow/{id}): what was deleted. ProcessDeleted is true when
|
|
||||||
/// that was the process's last employee, so the (now empty) BONUSPROCESS header was deleted too.
|
|
||||||
/// </summary>
|
|
||||||
public class BonusProcessRowRemoveResult
|
|
||||||
{
|
|
||||||
public int BonusProcessDetailID { get; set; }
|
|
||||||
public int BonusProcessID { get; set; }
|
|
||||||
public bool ProcessDeleted { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -563,7 +563,6 @@ namespace HRM.BO
|
||||||
//void SaveBasicInfo(Employee item);
|
//void SaveBasicInfo(Employee item);
|
||||||
List<Employee> GetByEmpIDs(string empIDs, int payrollTypeID);
|
List<Employee> GetByEmpIDs(string empIDs, int payrollTypeID);
|
||||||
List<Employee> GetByEmpIDs(string empIDs);
|
List<Employee> GetByEmpIDs(string empIDs);
|
||||||
List<EmployeeLite> GetLiteByEmpIDs(List<int> empIDs);
|
|
||||||
List<Employee> GetFssEmp(string empIDs, int payrollTypeID);
|
List<Employee> GetFssEmp(string empIDs, int payrollTypeID);
|
||||||
List<Employee> GetEmpsWithDiscontinue(string empIDs, int payrollTypeID);
|
List<Employee> GetEmpsWithDiscontinue(string empIDs, int payrollTypeID);
|
||||||
DataSet GetEmpJoining4Novartis(DateTime dEffectDate, int payrollTypeID);
|
DataSet GetEmpJoining4Novartis(DateTime dEffectDate, int payrollTypeID);
|
||||||
|
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace HRM.BO
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A light Employee: only the few columns that screens working on thousands of employees at once need
|
|
||||||
/// (Bonus Process today). Loading the whole Employee row for 10k+ employees never reached the browser.
|
|
||||||
/// To add a field: add the property here, the column in EmployeeDA.GetLiteByEmpIDs, and the read in
|
|
||||||
/// EmployeeService.GetLiteByEmpIDs (and in ClientApp _models/Employee/employeeLite.ts).
|
|
||||||
/// </summary>
|
|
||||||
public class EmployeeLite
|
|
||||||
{
|
|
||||||
public int EmployeeID { get; set; }
|
|
||||||
public bool IsConfirmed { get; set; }
|
|
||||||
public DateTime? JoiningDate { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
using Ease.Core.DataAccess;
|
using Ease.Core.DataAccess;
|
||||||
using Ease.Core.Utility;
|
using Ease.Core.Utility;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -33,176 +32,6 @@ namespace HRM.DA
|
||||||
item.UsedProcess, item.PayrollTypeID, item.IsApprove, item.wfstatus);
|
item.UsedProcess, item.PayrollTypeID, item.IsApprove, item.wfstatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Inserts every detail row in one SqlBulkCopy (10k+ rows), instead of one INSERT per row.
|
|
||||||
/// Same columns and values as Insert(tc, BonusProcessDetail) below; IDs must already be set.
|
|
||||||
/// Runs inside the caller's transaction.
|
|
||||||
/// </summary>
|
|
||||||
internal static void InsertBulk(TransactionContext tc, List<BonusProcess.BonusProcessDetail> items)
|
|
||||||
{
|
|
||||||
if (items == null || items.Count == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// money columns: round like SQL Server does when it converts a number literal to money (4 places)
|
|
||||||
Func<double, decimal> money = v => Math.Round((decimal)v, 4, MidpointRounding.AwayFromZero);
|
|
||||||
|
|
||||||
// column names exactly as in the BONUSPROCESSDETAIL table (bulk copy mapping is case-sensitive)
|
|
||||||
DataTable table = new DataTable("BONUSPROCESSDETAIL");
|
|
||||||
table.Columns.Add("BONUSPROCESSDETAILID", typeof(int));
|
|
||||||
table.Columns.Add("BONUSPROCESSID", typeof(int));
|
|
||||||
table.Columns.Add("BONUSID", typeof(int));
|
|
||||||
table.Columns.Add("EMPLOYEEID", typeof(int));
|
|
||||||
table.Columns.Add("DISBURSEDATE", typeof(DateTime));
|
|
||||||
table.Columns.Add("BONUSAMOUNT", typeof(decimal));
|
|
||||||
table.Columns.Add("GROSSSALARY", typeof(decimal));
|
|
||||||
table.Columns.Add("BASICSALARY", typeof(decimal));
|
|
||||||
table.Columns.Add("CHANGEBONUSAMOUNT", typeof(decimal));
|
|
||||||
table.Columns.Add("CHANGETAXAMOUNT", typeof(decimal));
|
|
||||||
table.Columns.Add("CHANGEADJUSTAMOUNT", typeof(decimal));
|
|
||||||
table.Columns.Add("CHANGESALARYITEMAMOUNT", typeof(decimal));
|
|
||||||
table.Columns.Add("CALCULATEDADJUSTAMOUNT", typeof(decimal));
|
|
||||||
table.Columns.Add("CALCULATEDSALARYITEMAMOUNT", typeof(decimal));
|
|
||||||
table.Columns.Add("TAXAMOUNT", typeof(decimal));
|
|
||||||
|
|
||||||
foreach (BonusProcess.BonusProcessDetail item in items)
|
|
||||||
{
|
|
||||||
table.Rows.Add(item.ID, item.BonusProcessID, item.BonusID, item.EmployeeID,
|
|
||||||
item.BonusMonth.Date, // Insert writes it with %d (date only)
|
|
||||||
money(item.BonusAmount), money(item.GrossSalary), money(item.BasicSalary),
|
|
||||||
money(item.ChangeBonusAmount), money(item.ChangeTaxAmount), money(item.ChangeAdjustAmount),
|
|
||||||
money(item.ChangeSalaryItemAmount), money(item.CalculatedAdjustAmount),
|
|
||||||
money(item.CalculatedSalaryItemAmount), money(item.TaxAmount));
|
|
||||||
}
|
|
||||||
|
|
||||||
using (Microsoft.Data.SqlClient.SqlBulkCopy bulkCopy = new Microsoft.Data.SqlClient.SqlBulkCopy(
|
|
||||||
(Microsoft.Data.SqlClient.SqlConnection)tc.Connection, Microsoft.Data.SqlClient.SqlBulkCopyOptions.Default,
|
|
||||||
(Microsoft.Data.SqlClient.SqlTransaction)tc.Transaction))
|
|
||||||
{
|
|
||||||
bulkCopy.BulkCopyTimeout = 6000; // in seconds, as SaveBonusEmpCostCenter
|
|
||||||
bulkCopy.DestinationTableName = "BONUSPROCESSDETAIL";
|
|
||||||
foreach (DataColumn column in table.Columns)
|
|
||||||
bulkCopy.ColumnMappings.Add(column.ColumnName, column.ColumnName);
|
|
||||||
bulkCopy.WriteToServer(table);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>The saved rows of one bonus process, with the employee columns the Bonus Process grid shows.</summary>
|
|
||||||
internal static IDataReader GetGridRows(TransactionContext tc, int bonusProcessID)
|
|
||||||
{
|
|
||||||
return tc.ExecuteReader(@"SELECT bd.BONUSPROCESSDETAILID, bd.BONUSPROCESSID, bd.BONUSID, bd.EMPLOYEEID,
|
|
||||||
e.EMPLOYEENO, e.NAME, e.JOININGDATE, e.ISCONFIRMED,
|
|
||||||
bd.GROSSSALARY, bd.BASICSALARY, bd.BONUSAMOUNT, bd.CHANGEBONUSAMOUNT, bd.TAXAMOUNT, bd.CHANGETAXAMOUNT
|
|
||||||
FROM BONUSPROCESSDETAIL bd
|
|
||||||
INNER JOIN EMPLOYEE e ON e.EMPLOYEEID = bd.EMPLOYEEID
|
|
||||||
WHERE bd.BONUSPROCESSID = %n
|
|
||||||
ORDER BY e.EMPLOYEENO", bonusProcessID);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>One saved row (Modify dialog), with the employee columns the grid shows.</summary>
|
|
||||||
internal static IDataReader GetGridRow(TransactionContext tc, int bonusProcessDetailID)
|
|
||||||
{
|
|
||||||
return tc.ExecuteReader(@"SELECT bd.BONUSPROCESSDETAILID, bd.BONUSPROCESSID, bd.BONUSID, bd.EMPLOYEEID,
|
|
||||||
e.EMPLOYEENO, e.NAME, e.JOININGDATE, e.ISCONFIRMED,
|
|
||||||
bd.GROSSSALARY, bd.BASICSALARY, bd.BONUSAMOUNT, bd.CHANGEBONUSAMOUNT, bd.TAXAMOUNT, bd.CHANGETAXAMOUNT
|
|
||||||
FROM BONUSPROCESSDETAIL bd
|
|
||||||
INNER JOIN EMPLOYEE e ON e.EMPLOYEEID = bd.EMPLOYEEID
|
|
||||||
WHERE bd.BONUSPROCESSDETAILID = %n", bonusProcessDetailID);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>One saved row and the header fields the Modify dialog needs (bonus, month, payroll type).</summary>
|
|
||||||
internal static IDataReader GetRowWithHeader(TransactionContext tc, int bonusProcessDetailID)
|
|
||||||
{
|
|
||||||
return tc.ExecuteReader(@"SELECT bd.BONUSPROCESSDETAILID, bd.BONUSPROCESSID, bd.BONUSID, bd.EMPLOYEEID,
|
|
||||||
bd.CHANGEBONUSAMOUNT, bd.CHANGETAXAMOUNT, bd.TAXAMOUNT,
|
|
||||||
b.BONUSMONTH, b.PAYROLLTYPEID, b.ISTAXPROCESS
|
|
||||||
FROM BONUSPROCESSDETAIL bd
|
|
||||||
INNER JOIN BONUSPROCESS b ON b.BONUSPROCESSID = bd.BONUSPROCESSID
|
|
||||||
WHERE bd.BONUSPROCESSDETAILID = %n", bonusProcessDetailID);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Modify dialog, Save: the amounts of one row.</summary>
|
|
||||||
internal static void UpdateRowAmounts(TransactionContext tc, int bonusProcessDetailID, double changeBonusAmount,
|
|
||||||
double changeTaxAmount, double taxAmount, int modifiedBy, DateTime modifiedDate)
|
|
||||||
{
|
|
||||||
tc.ExecuteNonQuery(@"UPDATE BONUSPROCESSDETAIL SET CHANGEBONUSAMOUNT = %n, CHANGETAXAMOUNT = %n, TAXAMOUNT = %n,
|
|
||||||
MODIFIEDBY = %n, MODIFIEDDATE = %D
|
|
||||||
WHERE BONUSPROCESSDETAILID = %n",
|
|
||||||
changeBonusAmount, changeTaxAmount, taxAmount, modifiedBy, modifiedDate, bonusProcessDetailID);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Clear Tax: the header fields of one bonus process (bonus, month, payroll type, options).</summary>
|
|
||||||
internal static IDataReader GetProcessHeaderForClearTax(TransactionContext tc, int bonusProcessID)
|
|
||||||
{
|
|
||||||
return tc.ExecuteReader(@"SELECT BONUSPROCESSID, BONUSID, BONUSMONTH, PAYROLLTYPEID, ISTAXPROCESS, ISDISBURSEWITHSALARY
|
|
||||||
FROM BONUSPROCESS
|
|
||||||
WHERE BONUSPROCESSID = %n", bonusProcessID);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clear Tax: the tax of every row of one bonus process becomes 0 — what the old Clear Tax + Save wrote
|
|
||||||
/// to BONUSPROCESSDETAIL (only CHANGETAXAMOUNT; TAXAMOUNT, the calculated tax, is kept).
|
|
||||||
/// </summary>
|
|
||||||
internal static void ClearTaxOfProcess(TransactionContext tc, int bonusProcessID, int modifiedBy, DateTime modifiedDate)
|
|
||||||
{
|
|
||||||
tc.ExecuteNonQuery(@"UPDATE BONUSPROCESSDETAIL SET CHANGETAXAMOUNT = 0, MODIFIEDBY = %n, MODIFIEDDATE = %D
|
|
||||||
WHERE BONUSPROCESSID = %n",
|
|
||||||
modifiedBy, modifiedDate, bonusProcessID);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clear Tax: the Tax Deducted line (ITEMCODE = Tax_Deducted, -212) of the bonus tax data (BONUSTEMPIT) of
|
|
||||||
/// every employee of one bonus process gets THISMONTHAMOUNT = 0 — the old save() merge with a cleared tax.
|
|
||||||
/// The other lines and columns are not touched.
|
|
||||||
/// </summary>
|
|
||||||
internal static void ClearBonusTempTaxOfProcess(TransactionContext tc, int bonusProcessID, int taxDeductedItemCode)
|
|
||||||
{
|
|
||||||
tc.ExecuteNonQuery(@"UPDATE BONUSTEMPIT SET THISMONTHAMOUNT = 0
|
|
||||||
WHERE ITEMCODE = %n
|
|
||||||
AND EMPLOYEEID IN (SELECT EMPLOYEEID FROM BONUSPROCESSDETAIL WHERE BONUSPROCESSID = %n)",
|
|
||||||
taxDeductedItemCode, bonusProcessID);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Remove (saved row): this employee's bonus tax data (BONUSTEMPIT), only when the process was saved
|
|
||||||
/// with Calculate Tax — a process without tax wrote no BONUSTEMPIT rows for it.
|
|
||||||
/// </summary>
|
|
||||||
internal static void DeleteRowBonusTempTax(TransactionContext tc, int bonusProcessID, int employeeID)
|
|
||||||
{
|
|
||||||
tc.ExecuteNonQuery(@"DELETE FROM BONUSTEMPIT
|
|
||||||
WHERE EMPLOYEEID = %n
|
|
||||||
AND EXISTS (SELECT 1 FROM BONUSPROCESS WHERE BONUSPROCESSID = %n AND ISTAXPROCESS = 1)",
|
|
||||||
employeeID, bonusProcessID);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Remove (saved row): this employee's cost-center split in this process.</summary>
|
|
||||||
internal static void DeleteRowCostCenter(TransactionContext tc, int bonusProcessID, int employeeID)
|
|
||||||
{
|
|
||||||
tc.ExecuteNonQuery("DELETE FROM BonusEmpCostCenter WHERE BonusProcessID = %n AND EmployeeID = %n",
|
|
||||||
bonusProcessID, employeeID);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Remove (saved row): the row itself.</summary>
|
|
||||||
internal static void DeleteRow(TransactionContext tc, int bonusProcessDetailID)
|
|
||||||
{
|
|
||||||
tc.ExecuteNonQuery("DELETE FROM BONUSPROCESSDETAIL WHERE BONUSPROCESSDETAILID = %n", bonusProcessDetailID);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Remove (saved row): how many rows the process still has.</summary>
|
|
||||||
internal static int CountRows(TransactionContext tc, int bonusProcessID)
|
|
||||||
{
|
|
||||||
object count = tc.ExecuteScalar("SELECT COUNT(*) FROM BONUSPROCESSDETAIL WHERE BONUSPROCESSID = %n", bonusProcessID);
|
|
||||||
return count == null || count == DBNull.Value ? 0 : Convert.ToInt32(count);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Remove (saved row): the header of a process that has no rows left, and anything still hanging on it.</summary>
|
|
||||||
internal static void DeleteEmptyProcess(TransactionContext tc, int bonusProcessID)
|
|
||||||
{
|
|
||||||
tc.ExecuteNonQuery("DELETE FROM BonusEmpCostCenter WHERE BonusProcessID = %n", bonusProcessID);
|
|
||||||
tc.ExecuteNonQuery(@"DELETE FROM BONUSPROCESS WHERE BONUSPROCESSID = %n
|
|
||||||
AND NOT EXISTS (SELECT 1 FROM BONUSPROCESSDETAIL WHERE BONUSPROCESSID = %n)",
|
|
||||||
bonusProcessID, bonusProcessID);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void Insert(TransactionContext tc, BonusProcess.BonusProcessDetail item)
|
internal static void Insert(TransactionContext tc, BonusProcess.BonusProcessDetail item)
|
||||||
{
|
{
|
||||||
string sql = SQLParser.MakeSQL(
|
string sql = SQLParser.MakeSQL(
|
||||||
|
|
@ -658,19 +487,6 @@ AND BP.PayrollTypeID=%n", emps, FromDate, ToDate, payrollTypeID);
|
||||||
|
|
||||||
return approved;
|
return approved;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Bonus Process screen: how many BONUSPROCESS headers this bonus already has in this month (whole month)
|
|
||||||
/// for this payroll type. Used to stop the same bonus type being processed twice in one month.
|
|
||||||
/// </summary>
|
|
||||||
internal static int CountProcessInMonth(TransactionContext tc, int payrolltypeid, int bonusid, DateTime bonusMonth)
|
|
||||||
{
|
|
||||||
object count = tc.ExecuteScalar(
|
|
||||||
"SELECT COUNT(*) FROM BONUSPROCESS WHERE PAYROLLTYPEID = %n AND BONUSID = %n AND BONUSMONTH BETWEEN %d AND %d",
|
|
||||||
payrolltypeid, bonusid, PayrollGlobalFunctions.PayrollFirstDateOfMonth(bonusMonth),
|
|
||||||
PayrollGlobalFunctions.PayrollLastDateOfMonth(bonusMonth));
|
|
||||||
return (count == null || count == DBNull.Value) ? 0 : Convert.ToInt32(count);
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
internal static DataSet GetMontlyProdBonus(TransactionContext tc, DateTime dBonusMonth)
|
internal static DataSet GetMontlyProdBonus(TransactionContext tc, DateTime dBonusMonth)
|
||||||
|
|
|
||||||
|
|
@ -785,32 +785,6 @@ namespace HRM.DA
|
||||||
tc.ExecuteNonQuery("UPDATE EMPCONTACT SET presentPOInBangla = %s, presentAddressInBangla = %s, parmanentPOInBangla = %s, permanentAddressInBangla =%s WHERE EMPLOYEEID = %s", employeBanglaInfo[1], employeBanglaInfo[2], employeBanglaInfo[3], employeBanglaInfo[4], employeBanglaInfo[0]);
|
tc.ExecuteNonQuery("UPDATE EMPCONTACT SET presentPOInBangla = %s, presentAddressInBangla = %s, parmanentPOInBangla = %s, permanentAddressInBangla =%s WHERE EMPLOYEEID = %s", employeBanglaInfo[1], employeBanglaInfo[2], employeBanglaInfo[3], employeBanglaInfo[4], employeBanglaInfo[0]);
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// The full Employee rows of the given employees of one payroll type, for any number of employees
|
|
||||||
/// (10k+). Same result as GetByEmpIDs(tc, empIDs, payrollTypeID), but the IDs go in as ONE
|
|
||||||
/// varchar(max) parameter and a temp table with a primary key instead of an "IN (1,2,3,...)" list in
|
|
||||||
/// the SQL text. Needs SQL Server 2016+ (STRING_SPLIT).
|
|
||||||
/// </summary>
|
|
||||||
internal static IDataReader GetByEmpIDList(TransactionContext tc, List<int> empIDs, int payrollTypeID)
|
|
||||||
{
|
|
||||||
string sql = SQLParser.MakeSQL(@"SET NOCOUNT ON;
|
|
||||||
IF OBJECT_ID('tempdb..#empListIds') IS NOT NULL DROP TABLE #empListIds;
|
|
||||||
CREATE TABLE #empListIds (ID int NOT NULL PRIMARY KEY);
|
|
||||||
INSERT INTO #empListIds (ID) SELECT DISTINCT CONVERT(int, value) FROM STRING_SPLIT(@empIds, ',') WHERE value <> '';
|
|
||||||
SELECT e.* FROM Employee e
|
|
||||||
INNER JOIN #empListIds t ON t.ID = e.EMPLOYEEID
|
|
||||||
WHERE e.PAYROLLTYPEID = %n
|
|
||||||
ORDER BY e.EmployeeNo;
|
|
||||||
DROP TABLE #empListIds;", payrollTypeID);
|
|
||||||
|
|
||||||
// must be a SqlParameter[]: Ease.Core casts the array to SqlParameter[]
|
|
||||||
SqlParameter[] parameters =
|
|
||||||
{
|
|
||||||
SqlHelperExtension.CreateInParam("@empIds", SqlDbType.VarChar, string.Join(",", empIDs), -1) // varchar(max)
|
|
||||||
};
|
|
||||||
return tc.ExecuteReader(CommandType.Text, sql, parameters);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static IDataReader GetByEmpIDs(TransactionContext tc, string empIDs)
|
internal static IDataReader GetByEmpIDs(TransactionContext tc, string empIDs)
|
||||||
{
|
{
|
||||||
string sTableName;
|
string sTableName;
|
||||||
|
|
@ -824,34 +798,6 @@ namespace HRM.DA
|
||||||
return dr;
|
return dr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The EmployeeLite columns only, for any number of employees (10k+ at a time).
|
|
||||||
/// The IDs go in as ONE varchar(max) parameter and land in a temp table with a primary key, so the
|
|
||||||
/// SQL text stays small and SQL Server knows how many rows to expect (an inline IN list or
|
|
||||||
/// STRING_SPLIT in the join is much slower at this size). Needs SQL Server 2016+ (STRING_SPLIT).
|
|
||||||
/// </summary>
|
|
||||||
internal static IDataReader GetLiteByEmpIDs(TransactionContext tc, List<int> empIDs)
|
|
||||||
{
|
|
||||||
const string sql = @"SET NOCOUNT ON;
|
|
||||||
IF OBJECT_ID('tempdb..#elEmpIds') IS NOT NULL DROP TABLE #elEmpIds;
|
|
||||||
CREATE TABLE #elEmpIds (ID int NOT NULL PRIMARY KEY);
|
|
||||||
INSERT INTO #elEmpIds (ID) SELECT DISTINCT CONVERT(int, value) FROM STRING_SPLIT(@empIds, ',') WHERE value <> '';
|
|
||||||
SELECT e.EMPLOYEEID AS EmployeeID, e.ISCONFIRMED AS IsConfirmed, e.JOININGDATE AS JoiningDate
|
|
||||||
FROM Employee e
|
|
||||||
INNER JOIN #elEmpIds t ON t.ID = e.EMPLOYEEID;
|
|
||||||
DROP TABLE #elEmpIds;";
|
|
||||||
|
|
||||||
// ints only (the caller passes List<int>), so the parameter can never carry anything but digits and commas
|
|
||||||
string ids = string.Join(",", empIDs);
|
|
||||||
// must be a SqlParameter[]: Ease.Core casts the array to SqlParameter[], and a lone parameter
|
|
||||||
// passed to "params IDataParameter[]" would arrive as an IDataParameter[] and fail that cast
|
|
||||||
SqlParameter[] parameters =
|
|
||||||
{
|
|
||||||
SqlHelperExtension.CreateInParam("@empIds", SqlDbType.VarChar, ids, -1) // varchar(max)
|
|
||||||
};
|
|
||||||
return tc.ExecuteReader(CommandType.Text, sql, parameters);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static IDataReader GetFssEmp(TransactionContext tc, string empIDs, int payrollTypeID)
|
internal static IDataReader GetFssEmp(TransactionContext tc, string empIDs, int payrollTypeID)
|
||||||
{
|
{
|
||||||
string sTableName;
|
string sTableName;
|
||||||
|
|
|
||||||
|
|
@ -160,19 +160,6 @@ namespace HRM.DA
|
||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Like hasTaxDataInSalaryTemp(tc, employeeId), but only SALARYTEMPIT (a salary processed and not yet
|
|
||||||
/// finalized) — BONUSTEMPIT is not looked at. Used by the Bonus Process Modify dialog: there the
|
|
||||||
/// employee's BONUSTEMPIT rows are that same bonus's own tax data, saved by Process.
|
|
||||||
/// </summary>
|
|
||||||
internal static bool hasTaxDataInSalaryTempOnly(TransactionContext tc, int employeeId)
|
|
||||||
{
|
|
||||||
object isprocessed = tc.ExecuteScalar(@"select count(*) cnt from SALARYTEMPIT WHERE EmployeeID =%n", employeeId);
|
|
||||||
if (isprocessed == null || isprocessed == DBNull.Value)
|
|
||||||
return false;
|
|
||||||
return Convert.ToInt32(isprocessed) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static EnumIncomeTaxDataFrom TaxDataFrom(TransactionContext tc, int employeeId)
|
internal static EnumIncomeTaxDataFrom TaxDataFrom(TransactionContext tc, int employeeId)
|
||||||
{
|
{
|
||||||
object isprocessed = tc.ExecuteScalar(@"if exists(select * from SALARYTEMPIT where EmployeeID =%n ) select 3
|
object isprocessed = tc.ExecuteScalar(@"if exists(select * from SALARYTEMPIT where EmployeeID =%n ) select 3
|
||||||
|
|
@ -225,54 +212,17 @@ namespace HRM.DA
|
||||||
DataSet oIncomeTaxs = new DataSet();
|
DataSet oIncomeTaxs = new DataSet();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// The employee IDs used to be spliced in twice as "in(1,2,3,...)". With 10k+ employees
|
string sql = SQLParser.MakeSQL(@"select salarytax.EMPLOYEENO,salarytax.Name,salarytax.EMPLOYEEID, salarytax.TaxAmount SalaryData, st.thisyeartotal TaxData from
|
||||||
// SQL Server cannot build a plan for that ("The query processor ran out of internal
|
|
||||||
// resources", error 8623). Now they go in as ONE varchar(max) parameter, land in a temp
|
|
||||||
// table with a primary key, and both parts of the UNION read "in (SELECT ID FROM #tdrEmpIds)".
|
|
||||||
// The query itself (columns, conditions, result) is unchanged. Needs SQL Server 2016+ (STRING_SPLIT).
|
|
||||||
List<string> ids = new List<string>();
|
|
||||||
foreach (string part in (empids ?? string.Empty).Split(','))
|
|
||||||
{
|
|
||||||
string id = part.Trim();
|
|
||||||
if (id.Length == 0) continue;
|
|
||||||
if (!int.TryParse(id, out int empId))
|
|
||||||
throw new ArgumentException("Invalid employee id: " + id);
|
|
||||||
ids.Add(empId.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
//string sql = SQLParser.MakeSQL(@"select salarytax.EMPLOYEENO,salarytax.Name,salarytax.EMPLOYEEID, salarytax.TaxAmount SalaryData, st.thisyeartotal TaxData from
|
|
||||||
// (Select tab.EMPLOYEENO,tab.Name,tab.EMPLOYEEID,sum(tab.TaxAmount) TaxAmount from
|
|
||||||
// (Select e.EMPLOYEENO,e.Name,e.EMPLOYEEID,sd.CHANGEDAMOUNT TaxAmount,s.salarymonth from SALARYMONTHLYDETAIL sd, SALARYMONTHLY s,Employee e where s.EMPLOYEEID=e.EMPLOYEEID and sd.SALARYMONTHLYID=s.SALARYMONTHLYID and s.SALARYMONTH
|
|
||||||
// between %d and %d and ITEMCODE=-129 and ITEMID=-129 and s.EMPLOYEEID in(%q)
|
|
||||||
// union
|
|
||||||
// Select e.EMPLOYEENO,e.Name,e.EMPLOYEEID,s.CHANGETAXAMOUNT TaxAmount,s.DISBURSEDATE salarymonth from BONUSPROCESSDETAIL s,Employee e where e.EMPLOYEEID=s.EMPLOYEEID and s.DISBURSEDATE between %d and %d and s.EMPLOYEEID in (%q)
|
|
||||||
// ) tab group by tab.EMPLOYEENO,tab.Name,tab.EMPLOYEEID) salarytax
|
|
||||||
// left join
|
|
||||||
// %q st on salarytax.Employeeid=st.employeeid and st.itemcode=-212 and st.itemid=-212",
|
|
||||||
//fromdate, toDate, empids, fromdate, toDate, empids, GetTableName(dataFrom));
|
|
||||||
|
|
||||||
string sql = SQLParser.MakeSQL(@"SET NOCOUNT ON;
|
|
||||||
IF OBJECT_ID('tempdb..#tdrEmpIds') IS NOT NULL DROP TABLE #tdrEmpIds;
|
|
||||||
CREATE TABLE #tdrEmpIds (ID int NOT NULL PRIMARY KEY);
|
|
||||||
INSERT INTO #tdrEmpIds (ID) SELECT DISTINCT CONVERT(int, value) FROM STRING_SPLIT(@empIds, ',') WHERE value <> '';
|
|
||||||
select salarytax.EMPLOYEENO,salarytax.Name,salarytax.EMPLOYEEID, salarytax.TaxAmount SalaryData, st.thisyeartotal TaxData from
|
|
||||||
(Select tab.EMPLOYEENO,tab.Name,tab.EMPLOYEEID,sum(tab.TaxAmount) TaxAmount from
|
(Select tab.EMPLOYEENO,tab.Name,tab.EMPLOYEEID,sum(tab.TaxAmount) TaxAmount from
|
||||||
(Select e.EMPLOYEENO,e.Name,e.EMPLOYEEID,sd.CHANGEDAMOUNT TaxAmount,s.salarymonth from SALARYMONTHLYDETAIL sd, SALARYMONTHLY s,Employee e where s.EMPLOYEEID=e.EMPLOYEEID and sd.SALARYMONTHLYID=s.SALARYMONTHLYID and s.SALARYMONTH
|
(Select e.EMPLOYEENO,e.Name,e.EMPLOYEEID,sd.CHANGEDAMOUNT TaxAmount,s.salarymonth from SALARYMONTHLYDETAIL sd, SALARYMONTHLY s,Employee e where s.EMPLOYEEID=e.EMPLOYEEID and sd.SALARYMONTHLYID=s.SALARYMONTHLYID and s.SALARYMONTH
|
||||||
between %d and %d and ITEMCODE=-129 and ITEMID=-129 and s.EMPLOYEEID in (SELECT ID FROM #tdrEmpIds)
|
between %d and %d and ITEMCODE=-129 and ITEMID=-129 and s.EMPLOYEEID in(%q)
|
||||||
union
|
union
|
||||||
Select e.EMPLOYEENO,e.Name,e.EMPLOYEEID,s.CHANGETAXAMOUNT TaxAmount,s.DISBURSEDATE salarymonth from BONUSPROCESSDETAIL s,Employee e where e.EMPLOYEEID=s.EMPLOYEEID and s.DISBURSEDATE between %d and %d and s.EMPLOYEEID in (SELECT ID FROM #tdrEmpIds)
|
Select e.EMPLOYEENO,e.Name,e.EMPLOYEEID,s.CHANGETAXAMOUNT TaxAmount,s.DISBURSEDATE salarymonth from BONUSPROCESSDETAIL s,Employee e where e.EMPLOYEEID=s.EMPLOYEEID and s.DISBURSEDATE between %d and %d and s.EMPLOYEEID in (%q)
|
||||||
) tab group by tab.EMPLOYEENO,tab.Name,tab.EMPLOYEEID) salarytax
|
) tab group by tab.EMPLOYEENO,tab.Name,tab.EMPLOYEEID) salarytax
|
||||||
left join
|
left join
|
||||||
%q st on salarytax.Employeeid=st.employeeid and st.itemcode=-212 and st.itemid=-212;
|
%q st on salarytax.Employeeid=st.employeeid and st.itemcode=-212 and st.itemid=-212",
|
||||||
DROP TABLE #tdrEmpIds;",
|
fromdate, toDate, empids, fromdate, toDate, empids, GetTableName(dataFrom));
|
||||||
fromdate, toDate, fromdate, toDate, GetTableName(dataFrom));
|
oIncomeTaxs = tc.ExecuteDataSet(sql);
|
||||||
|
|
||||||
// must be a Microsoft.Data.SqlClient.SqlParameter[]: Ease.Core casts the array to that type
|
|
||||||
Microsoft.Data.SqlClient.SqlParameter[] parameters =
|
|
||||||
{
|
|
||||||
Ease.Core.DataAccess.SQL.SqlHelperExtension.CreateInParam("@empIds", SqlDbType.VarChar, string.Join(",", ids), -1) // varchar(max)
|
|
||||||
};
|
|
||||||
oIncomeTaxs = tc.ExecuteDataSet(CommandType.Text, sql, parameters);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -495,60 +495,6 @@ namespace HRM.DA
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A copy of CalculateTax for the Bonus Process Modify dialog (one employee, after Process has already
|
|
||||||
/// saved). The only difference: the "salary processed and not yet finalized" check looks at SALARYTEMPIT
|
|
||||||
/// only, not at BONUSTEMPIT — after Process the employee's BONUSTEMPIT rows are this same bonus's own
|
|
||||||
/// tax data, so CalculateTax would always refuse. A salary in the middle of its process still stops it.
|
|
||||||
/// CalculateTax itself is unchanged and still used by Process, Upload and CalculateBonusTax.
|
|
||||||
/// </summary>
|
|
||||||
public void CalculateTaxForModify(List<BonusProcess.BonusProcessDetail> bprocesdetails, List<Employee> oEmployees, Bonus oBonus, int payrolltypeid)
|
|
||||||
{
|
|
||||||
if (_payrolltype == null)
|
|
||||||
_payrolltype = new PayrollTypeService().Get(payrolltypeid);
|
|
||||||
|
|
||||||
if (_parameters == null)
|
|
||||||
_parameters = new BonusParameterService().Get(EnumStatus.Regardless, payrolltypeid);
|
|
||||||
|
|
||||||
if (_payrolltype.TaxParamID == null) throw new ServiceException("Current year Tax paramter setup not found.");
|
|
||||||
TaxParameter oparamter = new TaxParameterService().Get((int)_payrolltype.TaxParamID);
|
|
||||||
|
|
||||||
List<ADParameter> oParams = new ADParameterService().Get(EnumStatus.Regardless, EnumAllowOrDeduct.Allowance, _payrolltype.ID);
|
|
||||||
List<IncomeTax> oTaxes = new IncomeTaxService().Get(EnumIncomeTaxDataFrom.ProcessTempData, _payrolltype.ID);
|
|
||||||
double nTaxAmount = 0;
|
|
||||||
int nCount = 0;
|
|
||||||
// salary only (SALARYTEMPIT); the employee's own bonus tax rows (BONUSTEMPIT) do not stop a Modify
|
|
||||||
IncomeTaxService taxService = new IncomeTaxService();
|
|
||||||
bool salaryProcessed = oEmployees.Any(e => e != null && taxService.hasTaxDataInSalaryTempOnly(e.ID));
|
|
||||||
if (salaryProcessed == true)
|
|
||||||
{
|
|
||||||
throw new ServiceException("Current month salary is processed and not yet finalized. Tax calculation "
|
|
||||||
+ " is not allowed middle of this process. You have to Undo or finalize the salary to calculate tax.");
|
|
||||||
}
|
|
||||||
TaxCalculator oCalculator = new TaxCalculator((int)_payrolltype.TaxParamID, _payrolltype.ID);
|
|
||||||
oCalculator.TaxParameter = oparamter;
|
|
||||||
oCalculator.payrolltype = _payrolltype;
|
|
||||||
foreach (BonusProcess.BonusProcessDetail item in bprocesdetails)
|
|
||||||
{
|
|
||||||
nCount++;
|
|
||||||
oCalculator.Employee = oEmployees.FirstOrDefault(x => x.ID == item.EmployeeID);
|
|
||||||
if (item.BonusParam == null)
|
|
||||||
{
|
|
||||||
item.BonusParam = new BonusParameterService().GetApplicableParameter(item.Employee, (int)item.Employee.GradeID, _parameters, oBonus.ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.ChangeBonusAmount > 0)
|
|
||||||
{
|
|
||||||
List<TaxRawItem> oTaxRowItems = new List<TaxRawItem>();
|
|
||||||
oTaxRowItems.Add(TaxRawItem.Create(oBonus.Name, item.ChangeBonusAmount, enumIncomeTaxItemType.Bonus, item.BonusID));
|
|
||||||
nTaxAmount = 0;
|
|
||||||
item.IncomeTaxcoll = oCalculator.CalculateBonus(oTaxRowItems, item.BonusParam, ref nTaxAmount, oParams, oTaxes);
|
|
||||||
item.TaxAmount = nTaxAmount;
|
|
||||||
item.ChangeTaxAmount = nTaxAmount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UndoTax(BonusProcess oProcessedItems, List<Employee> oEmployees, Bonus oBonus)
|
public void UndoTax(BonusProcess oProcessedItems, List<Employee> oEmployees, Bonus oBonus)
|
||||||
{
|
{
|
||||||
if (_payrolltype.TaxParamID == null) throw new ServiceException("Current year Tax paramter setup not found.");
|
if (_payrolltype.TaxParamID == null) throw new ServiceException("Current year Tax paramter setup not found.");
|
||||||
|
|
|
||||||
|
|
@ -860,7 +860,8 @@ namespace HRM.DA
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BonusProcessDA.Update(tc, oBonusProcess);
|
BonusProcessDA.Update(tc, oBonusProcess);
|
||||||
BonusProcessDA.DeleteProcessDetailByProcessID(tc, oBonusProcess.BonusID, oBonusProcess.ID, oBonusProcess.PayrollTypeID);
|
BonusProcessDA.DeleteProcessDetailByProcessID(tc, oBonusProcess.BonusID, oBonusProcess.ID,
|
||||||
|
oBonusProcess.PayrollTypeID);
|
||||||
BonusProcessDA.DeleteEmpCostCenter(tc, oBonusProcess.ID);
|
BonusProcessDA.DeleteEmpCostCenter(tc, oBonusProcess.ID);
|
||||||
}
|
}
|
||||||
List<IncomeTax> incometaxes = new List<IncomeTax>();
|
List<IncomeTax> incometaxes = new List<IncomeTax>();
|
||||||
|
|
@ -903,694 +904,6 @@ namespace HRM.DA
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Bonus Process screen, "Process" button: calculate the bonus (and tax) of the given employees and
|
|
||||||
/// save it in the same call — there is no separate Save step any more. Does on the server what the
|
|
||||||
/// screen used to do in three requests (BonusProcess, the tax-merge step of save(), saveBonusProcess):
|
|
||||||
/// 1. checks: bonus not approved, inputs present; employees this bonus was already processed for this
|
|
||||||
/// month are left out (the screen already leaves them out and lists them);
|
|
||||||
/// 2. CalculateBonus — the same BonusCalculator.CalCulate the old Process button called;
|
|
||||||
/// 3. tax merge — the same rule save() applied in the browser, now for every row;
|
|
||||||
/// 4. save — the same rows Save(BonusProcess) writes, in ONE transaction (all or nothing), with the
|
|
||||||
/// detail rows inserted by one bulk copy instead of one INSERT each;
|
|
||||||
/// 5. returns the saved rows, read back from the database.
|
|
||||||
/// </summary>
|
|
||||||
public BonusProcessAndSaveResult ProcessAndSave(BonusProcessAndSaveRequest request, int payrolltypeid, int userID)
|
|
||||||
{
|
|
||||||
if (request == null)
|
|
||||||
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.");
|
|
||||||
|
|
||||||
PayrollType payrollType = new PayrollTypeService().Get(payrolltypeid);
|
|
||||||
if (payrollType == null)
|
|
||||||
throw new ServiceException("Payroll type not found.");
|
|
||||||
DateTime bonusMonth = payrollType.NextPayProcessDate;
|
|
||||||
|
|
||||||
// 1. checks
|
|
||||||
if (this.IsApproved(request.BonusID, bonusMonth, payrolltypeid))
|
|
||||||
throw new ServiceException("selected Bonus is already process and Approved");
|
|
||||||
this.CheckAlreadyProcessedInMonth(request.BonusID, bonusMonth, payrolltypeid);
|
|
||||||
|
|
||||||
BonusProcessAndSaveResult result = new BonusProcessAndSaveResult();
|
|
||||||
HashSet<int> alreadyProcessed = new HashSet<int>(
|
|
||||||
(this.GetBonusDetails(payrolltypeid, request.BonusID, bonusMonth) ?? new List<BonusProcess.BonusProcessDetail>())
|
|
||||||
.Select(x => x.EmployeeID));
|
|
||||||
List<int> empIDs = new List<int>();
|
|
||||||
foreach (int id in request.EmployeeIDs.Distinct())
|
|
||||||
{
|
|
||||||
if (alreadyProcessed.Contains(id)) result.AlreadyProcessedEmployeeIDs.Add(id);
|
|
||||||
else empIDs.Add(id);
|
|
||||||
}
|
|
||||||
if (empIDs.Count == 0)
|
|
||||||
throw new ServiceException("The selected bonus is already processed for all the selected employees.");
|
|
||||||
|
|
||||||
List<Employee> employees = new EmployeeService().GetByEmpIDList(empIDs, payrolltypeid);
|
|
||||||
if (employees.Count == 0)
|
|
||||||
throw new ServiceException("Selected employees not found in the current payroll type.");
|
|
||||||
|
|
||||||
// 2. calculate (bonus, and tax when IsTaxProcess and not disbursed with salary)
|
|
||||||
BonusProcess oProcess = this.CalculateBonus(payrolltypeid, employees, request.BonusID, request.BasicMonth,
|
|
||||||
request.PayDate, request.CuttOfDate, request.CurrProcess, request.IsDisburseWithSalary, request.IsTaxProcess);
|
|
||||||
if (oProcess == null || oProcess.BonusProcessDetails == null || oProcess.BonusProcessDetails.Count == 0)
|
|
||||||
throw new ServiceException("There are no data to save");
|
|
||||||
|
|
||||||
// 3. tax merge: the bonus head's tax line carries the bonus amount, the Tax Deducted line the tax
|
|
||||||
if (request.IsTaxProcess)
|
|
||||||
ApplyTaxMerge(oProcess, employees, payrollType, request.BonusID);
|
|
||||||
|
|
||||||
// 4. save — header as saveBonusProcess set it, then the same rows Save(BonusProcess) writes
|
|
||||||
oProcess.PayrollTypeID = payrolltypeid;
|
|
||||||
oProcess.DisburseDate = request.PayDate;
|
|
||||||
oProcess.IsTaxProcess = request.IsTaxProcess;
|
|
||||||
oProcess.IsDisburseWithSalary = request.IsDisburseWithSalary;
|
|
||||||
oProcess.CreatedBy = userID;
|
|
||||||
oProcess.CreatedDate = DateTime.Today;
|
|
||||||
SaveNewProcess(oProcess);
|
|
||||||
|
|
||||||
// 5. what was saved
|
|
||||||
result.BonusProcessID = oProcess.ID;
|
|
||||||
result.Rows = this.GetGridRows(oProcess.ID);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Bonus Process screen, "Upload Data": the rows read from the bonus Excel file (employee + amount,
|
|
||||||
/// RegularDataUploadService.GetBonusData) are saved in the same request — what used to be upload →
|
|
||||||
/// (Tax Re-calculate) → Save, now on the server in one go:
|
|
||||||
/// 1. checks: bonus selected, pay date, not approved; every employee in the current payroll type and
|
|
||||||
/// only once in the file; employees this bonus was already processed for this month are left out;
|
|
||||||
/// 2. with IsTaxProcess, the tax of every row (the same CalculateTax "Tax Re-calculate" ran) and the
|
|
||||||
/// save() tax merge; without it the amounts are saved as they are in the file;
|
|
||||||
/// 3. the same save as the Process button (one transaction, all or nothing);
|
|
||||||
/// 4. returns the saved rows, read back from the database.
|
|
||||||
/// The header is filled the way the screen filled it after an upload (bonus month and basic month =
|
|
||||||
/// the next pay process month, disburse date = pay date).
|
|
||||||
/// </summary>
|
|
||||||
public BonusProcessAndSaveResult UploadAndSave(List<BonusProcess.BonusProcessDetail> uploadedRows,
|
|
||||||
BonusProcessAndSaveRequest request, int payrolltypeid, int userID)
|
|
||||||
{
|
|
||||||
if (request == null || request.BonusID <= 0)
|
|
||||||
throw new ServiceException("Please select a bonus.");
|
|
||||||
if (request.PayDate == DateTime.MinValue)
|
|
||||||
throw new ServiceException("Please select the pay date.");
|
|
||||||
if (uploadedRows == null || uploadedRows.Count == 0)
|
|
||||||
throw new ServiceException("No employee found in the uploaded file.");
|
|
||||||
|
|
||||||
PayrollType payrollType = new PayrollTypeService().Get(payrolltypeid);
|
|
||||||
if (payrollType == null)
|
|
||||||
throw new ServiceException("Payroll type not found.");
|
|
||||||
DateTime bonusMonth = payrollType.NextPayProcessDate;
|
|
||||||
|
|
||||||
// 1. checks
|
|
||||||
if (this.IsApproved(request.BonusID, bonusMonth, payrolltypeid))
|
|
||||||
throw new ServiceException("selected Bonus is already process and Approved");
|
|
||||||
this.CheckAlreadyProcessedInMonth(request.BonusID, bonusMonth, payrolltypeid);
|
|
||||||
|
|
||||||
List<string> problems = new List<string>();
|
|
||||||
var otherPayroll = uploadedRows.Where(x => x.Employee != null && x.Employee.PayrollTypeID != payrolltypeid)
|
|
||||||
.Select(x => x.Employee.EmployeeNo).Distinct().ToList();
|
|
||||||
if (otherPayroll.Count > 0)
|
|
||||||
problems.Add("Not in the current payroll type: " + string.Join(", ", otherPayroll));
|
|
||||||
var duplicates = uploadedRows.GroupBy(x => x.EmployeeID).Where(g => g.Count() > 1)
|
|
||||||
.Select(g => g.First().Employee?.EmployeeNo ?? g.Key.ToString()).ToList();
|
|
||||||
if (duplicates.Count > 0)
|
|
||||||
problems.Add("More than once in the file: " + string.Join(", ", duplicates));
|
|
||||||
var negative = uploadedRows.Where(x => x.BonusAmount < 0).Select(x => x.Employee?.EmployeeNo ?? x.EmployeeID.ToString()).ToList();
|
|
||||||
if (negative.Count > 0)
|
|
||||||
problems.Add("Negative amount: " + string.Join(", ", negative));
|
|
||||||
if (problems.Count > 0)
|
|
||||||
throw new ServiceException("Nothing was saved. " + string.Join(" | ", problems));
|
|
||||||
|
|
||||||
BonusProcessAndSaveResult result = new BonusProcessAndSaveResult();
|
|
||||||
HashSet<int> alreadyProcessed = new HashSet<int>(
|
|
||||||
(this.GetBonusDetails(payrolltypeid, request.BonusID, bonusMonth) ?? new List<BonusProcess.BonusProcessDetail>())
|
|
||||||
.Select(x => x.EmployeeID));
|
|
||||||
|
|
||||||
BonusProcess oProcess = new BonusProcess();
|
|
||||||
oProcess.BonusProcessDetails = new List<BonusProcess.BonusProcessDetail>();
|
|
||||||
oProcess.BonusID = request.BonusID;
|
|
||||||
oProcess.BonusMonth = bonusMonth;
|
|
||||||
oProcess.BasicOnMonth = bonusMonth;
|
|
||||||
oProcess.DisburseDate = request.PayDate;
|
|
||||||
oProcess.IsTaxProcess = request.IsTaxProcess;
|
|
||||||
oProcess.IsDisburseWithSalary = request.IsDisburseWithSalary;
|
|
||||||
oProcess.PayrollTypeID = payrolltypeid;
|
|
||||||
oProcess.CreatedBy = userID;
|
|
||||||
oProcess.CreatedDate = DateTime.Today;
|
|
||||||
|
|
||||||
List<Employee> employees = new List<Employee>();
|
|
||||||
foreach (BonusProcess.BonusProcessDetail row in uploadedRows)
|
|
||||||
{
|
|
||||||
if (alreadyProcessed.Contains(row.EmployeeID))
|
|
||||||
{
|
|
||||||
result.AlreadyProcessedEmployeeIDs.Add(row.EmployeeID);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
row.BonusID = request.BonusID;
|
|
||||||
row.BonusMonth = bonusMonth;
|
|
||||||
oProcess.BonusProcessDetails.Add(row);
|
|
||||||
if (row.Employee != null) employees.Add(row.Employee);
|
|
||||||
}
|
|
||||||
if (oProcess.BonusProcessDetails.Count == 0)
|
|
||||||
throw new ServiceException("The selected bonus is already processed for all the employees in the file.");
|
|
||||||
|
|
||||||
// 2. tax (as "Tax Re-calculate" did) and the save() merge
|
|
||||||
if (request.IsTaxProcess)
|
|
||||||
{
|
|
||||||
Bonus obonus = new BonusService().Get(request.BonusID);
|
|
||||||
new BonusCalculator().CalculateTax(oProcess.BonusProcessDetails, employees, obonus, payrolltypeid);
|
|
||||||
ApplyTaxMerge(oProcess, employees, payrollType, request.BonusID);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. save
|
|
||||||
SaveNewProcess(oProcess);
|
|
||||||
|
|
||||||
// 4. what was saved
|
|
||||||
result.BonusProcessID = oProcess.ID;
|
|
||||||
result.Rows = this.GetGridRows(oProcess.ID);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The tax-merge rule the screen's save() applied: on every row the bonus head's tax line
|
|
||||||
/// (TaxMergeMaster of this bonus) carries the bonus amount and the Tax Deducted line the tax.
|
|
||||||
/// </summary>
|
|
||||||
private void ApplyTaxMerge(BonusProcess oProcess, List<Employee> employees, PayrollType payrollType, int bonusID)
|
|
||||||
{
|
|
||||||
// a row with no bonus gets no tax lines (CalculateTax skips it), so only rows with a bonus need them
|
|
||||||
if (oProcess.BonusProcessDetails.Any(x => x.ChangeBonusAmount > 0 && (x.IncomeTaxcoll == null || x.IncomeTaxcoll.Count == 0)))
|
|
||||||
throw new ServiceException("Tax Calculation not yet done");
|
|
||||||
if (payrollType.TaxParamID == null)
|
|
||||||
throw new ServiceException("Current year Tax paramter setup not found.");
|
|
||||||
|
|
||||||
TaxMergeMaster mitem = new TaxMergeMasterService().Get(payrollType.ID, (int)payrollType.TaxParamID,
|
|
||||||
EnumTaxMergeType.Bonus, bonusID);
|
|
||||||
if (mitem == null)
|
|
||||||
throw new ServiceException("Bonus head not found in the income tax Grouping");
|
|
||||||
|
|
||||||
Dictionary<int, Employee> empByID = employees.GroupBy(x => x.ID).ToDictionary(g => g.Key, g => g.First());
|
|
||||||
foreach (BonusProcess.BonusProcessDetail detail in oProcess.BonusProcessDetails)
|
|
||||||
{
|
|
||||||
if (detail.IncomeTaxcoll == null || detail.IncomeTaxcoll.Count == 0)
|
|
||||||
continue; // no bonus, no tax lines
|
|
||||||
IncomeTax bonusLine = detail.IncomeTaxcoll.Find(y => y.ItemGroup == mitem.ItemGroup && y.ItemID == mitem.ItemID);
|
|
||||||
if (bonusLine == null)
|
|
||||||
{
|
|
||||||
Employee emp;
|
|
||||||
empByID.TryGetValue(detail.EmployeeID, out emp);
|
|
||||||
throw new ServiceException("Income tax amount not found in the collection"
|
|
||||||
+ (emp != null ? " (" + emp.EmployeeNo + " " + emp.Name + ")" : ""));
|
|
||||||
}
|
|
||||||
bonusLine.ThisMonthAmount = detail.ChangeBonusAmount;
|
|
||||||
|
|
||||||
IncomeTax taxLine = detail.IncomeTaxcoll.Find(y => y.ItemGroup == EnumIncomeTaxItemGroup.Tax_Deducted);
|
|
||||||
if (taxLine != null)
|
|
||||||
taxLine.ThisMonthAmount = detail.ChangeTaxAmount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Saves a new bonus process in ONE transaction: the header, every detail row (one bulk copy), the
|
|
||||||
/// bonus tax data (BonusITTempData) and the employee cost-center split — the rows Save(BonusProcess)
|
|
||||||
/// writes for a new process. Sets the IDs on oProcess and its details.
|
|
||||||
/// </summary>
|
|
||||||
private void SaveNewProcess(BonusProcess oProcess)
|
|
||||||
{
|
|
||||||
TransactionContext tc = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
tc = TransactionContext.Begin(true);
|
|
||||||
|
|
||||||
int processID = tc.GenerateID("BONUSPROCESS", "BONUSPROCESSID");
|
|
||||||
base.SetObjectID(oProcess, processID);
|
|
||||||
BonusProcessDA.Insert(tc, oProcess);
|
|
||||||
|
|
||||||
int detailID = tc.GenerateID("BONUSPROCESSDETAIL", "BonusProcessDetailID");
|
|
||||||
List<IncomeTax> incometaxes = new List<IncomeTax>();
|
|
||||||
foreach (BonusProcess.BonusProcessDetail detail in oProcess.BonusProcessDetails)
|
|
||||||
{
|
|
||||||
base.SetObjectID(detail, detailID++);
|
|
||||||
detail.BonusProcessID = oProcess.ID;
|
|
||||||
// IncomeTaxcoll null means tax process not required
|
|
||||||
if (detail.IncomeTaxcoll != null && detail.IncomeTaxcoll.Count > 0)
|
|
||||||
incometaxes.AddRange(detail.IncomeTaxcoll);
|
|
||||||
}
|
|
||||||
BonusProcessDA.InsertBulk(tc, oProcess.BonusProcessDetails);
|
|
||||||
|
|
||||||
if (incometaxes.Count > 0)
|
|
||||||
new IncomeTaxService().SaveBulk(tc, incometaxes, EnumIncomeTaxDataFrom.BonusITTempData);
|
|
||||||
|
|
||||||
SaveBonusEmpCostCenter(tc, oProcess);
|
|
||||||
|
|
||||||
tc.End();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
#region Handle Exception
|
|
||||||
|
|
||||||
if (tc != null)
|
|
||||||
tc.HandleError();
|
|
||||||
ExceptionLog.Write(e);
|
|
||||||
throw new ServiceException(e.Message, e);
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>The saved rows of one bonus process, as the Bonus Process grid shows them.</summary>
|
|
||||||
public List<BonusProcessGridRow> GetGridRows(int bonusProcessID)
|
|
||||||
{
|
|
||||||
List<BonusProcessGridRow> rows = new List<BonusProcessGridRow>();
|
|
||||||
TransactionContext tc = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
tc = TransactionContext.Begin();
|
|
||||||
|
|
||||||
DataReader dr = new DataReader(BonusProcessDA.GetGridRows(tc, bonusProcessID));
|
|
||||||
while (dr.Read())
|
|
||||||
rows.Add(MapGridRow(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 rows;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static BonusProcessGridRow MapGridRow(DataReader dr)
|
|
||||||
{
|
|
||||||
return new BonusProcessGridRow
|
|
||||||
{
|
|
||||||
BonusProcessDetailID = dr.GetInt32("BONUSPROCESSDETAILID", 0),
|
|
||||||
BonusProcessID = dr.GetInt32("BONUSPROCESSID", 0),
|
|
||||||
BonusID = dr.GetInt32("BONUSID", 0),
|
|
||||||
EmployeeID = dr.GetInt32("EMPLOYEEID", 0),
|
|
||||||
EmployeeNo = dr.GetString("EMPLOYEENO", string.Empty),
|
|
||||||
Name = dr.GetString("NAME", string.Empty),
|
|
||||||
JoiningDate = dr.GetDateTime("JOININGDATE"),
|
|
||||||
IsConfirmed = dr.GetBoolean("ISCONFIRMED", false),
|
|
||||||
GrossSalary = dr.GetDouble("GROSSSALARY", 0),
|
|
||||||
BasicSalary = dr.GetDouble("BASICSALARY", 0),
|
|
||||||
BonusAmount = dr.GetDouble("BONUSAMOUNT", 0),
|
|
||||||
ChangeBonusAmount = dr.GetDouble("CHANGEBONUSAMOUNT", 0),
|
|
||||||
TaxAmount = dr.GetDouble("TAXAMOUNT", 0),
|
|
||||||
ChangeTaxAmount = dr.GetDouble("CHANGETAXAMOUNT", 0),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>One saved row of the Bonus Process grid (after a Modify-dialog save).</summary>
|
|
||||||
public BonusProcessGridRow GetGridRow(int bonusProcessDetailID)
|
|
||||||
{
|
|
||||||
BonusProcessGridRow row = null;
|
|
||||||
TransactionContext tc = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
tc = TransactionContext.Begin();
|
|
||||||
|
|
||||||
DataReader dr = new DataReader(BonusProcessDA.GetGridRow(tc, bonusProcessDetailID));
|
|
||||||
if (dr.Read())
|
|
||||||
row = MapGridRow(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 row;
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Modify dialog (one row at a time)
|
|
||||||
|
|
||||||
/// <summary>A saved bonus row and the header fields the Modify dialog needs.</summary>
|
|
||||||
private class ModifyRow
|
|
||||||
{
|
|
||||||
public int BonusProcessDetailID;
|
|
||||||
public int BonusProcessID;
|
|
||||||
public int BonusID;
|
|
||||||
public int EmployeeID;
|
|
||||||
public double TaxAmount;
|
|
||||||
public DateTime BonusMonth;
|
|
||||||
public int PayrollTypeID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Loads a saved row for the Modify dialog and refuses it when it is not the current payroll type's
|
|
||||||
/// or the bonus is already approved (the same rule as the Process button).
|
|
||||||
/// </summary>
|
|
||||||
private ModifyRow GetRowForModify(int bonusProcessDetailID, int payrolltypeid)
|
|
||||||
{
|
|
||||||
ModifyRow row = null;
|
|
||||||
TransactionContext tc = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
tc = TransactionContext.Begin();
|
|
||||||
|
|
||||||
DataReader dr = new DataReader(BonusProcessDA.GetRowWithHeader(tc, bonusProcessDetailID));
|
|
||||||
if (dr.Read())
|
|
||||||
{
|
|
||||||
row = new ModifyRow
|
|
||||||
{
|
|
||||||
BonusProcessDetailID = dr.GetInt32("BONUSPROCESSDETAILID", 0),
|
|
||||||
BonusProcessID = dr.GetInt32("BONUSPROCESSID", 0),
|
|
||||||
BonusID = dr.GetInt32("BONUSID", 0),
|
|
||||||
EmployeeID = dr.GetInt32("EMPLOYEEID", 0),
|
|
||||||
TaxAmount = dr.GetDouble("TAXAMOUNT", 0),
|
|
||||||
BonusMonth = dr.GetDateTime("BONUSMONTH", DateTime.MinValue),
|
|
||||||
PayrollTypeID = dr.GetInt32("PAYROLLTYPEID", 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
|
|
||||||
}
|
|
||||||
|
|
||||||
if (row == null)
|
|
||||||
throw new ServiceException("Bonus row not found. Please process the bonus again.");
|
|
||||||
if (row.PayrollTypeID != payrolltypeid)
|
|
||||||
throw new ServiceException("This bonus row does not belong to the current payroll type.");
|
|
||||||
if (this.IsApproved(row.BonusID, row.BonusMonth, payrolltypeid))
|
|
||||||
throw new ServiceException("selected Bonus is already process and Approved");
|
|
||||||
return row;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The tax of one row for this bonus amount — the same BonusCalculator.CalculateTax that
|
|
||||||
/// "Tax Re-calculate" (CalculateBonusTax) runs, for one employee. Returns the detail with TaxAmount,
|
|
||||||
/// ChangeTaxAmount and IncomeTaxcoll filled in.
|
|
||||||
/// </summary>
|
|
||||||
private BonusProcess.BonusProcessDetail CalculateTaxFor(ModifyRow row, double bonusAmount, int payrolltypeid)
|
|
||||||
{
|
|
||||||
Employee emp = new EmployeeService().Get(row.EmployeeID);
|
|
||||||
if (emp == null)
|
|
||||||
throw new ServiceException("Employee not found.");
|
|
||||||
|
|
||||||
BonusProcess.BonusProcessDetail detail = new BonusProcess.BonusProcessDetail();
|
|
||||||
detail.BonusID = row.BonusID;
|
|
||||||
detail.EmployeeID = row.EmployeeID;
|
|
||||||
detail.BonusMonth = row.BonusMonth;
|
|
||||||
detail.ChangeBonusAmount = bonusAmount;
|
|
||||||
detail.Employee = emp;
|
|
||||||
|
|
||||||
Bonus obonus = new BonusService().Get(row.BonusID);
|
|
||||||
// CalculateTaxForModify: CalculateTax, except that this employee's own (already saved) bonus tax rows
|
|
||||||
// do not block it — only an unfinalized salary does
|
|
||||||
new BonusCalculator().CalculateTaxForModify(new List<BonusProcess.BonusProcessDetail> { detail },
|
|
||||||
new List<Employee> { emp }, obonus, payrolltypeid);
|
|
||||||
return detail;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Modify dialog, "Calculate": the tax for this bonus amount. Nothing is saved.</summary>
|
|
||||||
public BonusProcessRowTaxResult CalculateRowTax(BonusProcessRowTaxRequest request, int payrolltypeid)
|
|
||||||
{
|
|
||||||
if (request == null || request.BonusProcessDetailID <= 0)
|
|
||||||
throw new ServiceException("Please select a bonus row.");
|
|
||||||
if (request.BonusAmount < 0)
|
|
||||||
throw new ServiceException("Bonus amount can not be negative.");
|
|
||||||
|
|
||||||
ModifyRow row = GetRowForModify(request.BonusProcessDetailID, payrolltypeid);
|
|
||||||
BonusProcess.BonusProcessDetail detail = CalculateTaxFor(row, request.BonusAmount, payrolltypeid);
|
|
||||||
return new BonusProcessRowTaxResult
|
|
||||||
{
|
|
||||||
BonusProcessDetailID = row.BonusProcessDetailID,
|
|
||||||
BonusAmount = request.BonusAmount,
|
|
||||||
TaxAmount = detail.ChangeTaxAmount,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Modify dialog, "Save": saves ONE row — what Save(BonusProcess) did for every row after
|
|
||||||
/// "Tax Re-calculate", now for one employee, in one transaction:
|
|
||||||
/// - BONUSPROCESSDETAIL: ChangeBonusAmount, ChangeTaxAmount (and TaxAmount when the tax is calculated);
|
|
||||||
/// - this employee's BonusITTempData (BONUSTEMPIT) rows: deleted and written again, with the bonus
|
|
||||||
/// head's line carrying the bonus amount and the Tax Deducted line the tax (the save() merge rule).
|
|
||||||
/// With CalculateTax the tax is worked out again here (the amount the browser sent is not trusted);
|
|
||||||
/// without it the typed tax is used and the employee's existing tax rows are updated, as the old
|
|
||||||
/// screen did when a tax was typed into the grid and saved without recalculating.
|
|
||||||
/// </summary>
|
|
||||||
public BonusProcessGridRow SaveRow(BonusProcessRowSaveRequest request, int payrolltypeid, int userID)
|
|
||||||
{
|
|
||||||
if (request == null || request.BonusProcessDetailID <= 0)
|
|
||||||
throw new ServiceException("Please select a bonus row.");
|
|
||||||
if (request.BonusAmount < 0)
|
|
||||||
throw new ServiceException("Bonus amount can not be negative.");
|
|
||||||
if (!request.CalculateTax && request.TaxAmount < 0)
|
|
||||||
throw new ServiceException("Tax amount can not be negative.");
|
|
||||||
if (request.CalculateTax && request.EditedTaxAmount.HasValue && request.EditedTaxAmount.Value < 0)
|
|
||||||
throw new ServiceException("Edited tax amount can not be negative.");
|
|
||||||
|
|
||||||
ModifyRow row = GetRowForModify(request.BonusProcessDetailID, payrolltypeid);
|
|
||||||
|
|
||||||
double bonusAmount = request.BonusAmount;
|
|
||||||
double changeTaxAmount;
|
|
||||||
double taxAmount = row.TaxAmount; // the calculated tax; kept when a tax is typed in
|
|
||||||
List<IncomeTax> taxLines = null;
|
|
||||||
|
|
||||||
if (request.CalculateTax)
|
|
||||||
{
|
|
||||||
BonusProcess.BonusProcessDetail detail = CalculateTaxFor(row, bonusAmount, payrolltypeid);
|
|
||||||
// the user's "Edited Tax Amount" wins over the calculated one; TAXAMOUNT keeps the calculated tax
|
|
||||||
changeTaxAmount = request.EditedTaxAmount.HasValue ? request.EditedTaxAmount.Value : detail.ChangeTaxAmount;
|
|
||||||
taxAmount = detail.TaxAmount;
|
|
||||||
taxLines = detail.IncomeTaxcoll;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
changeTaxAmount = request.TaxAmount;
|
|
||||||
List<IncomeTax> existing = new IncomeTaxService().Get(row.EmployeeID, EnumIncomeTaxDataFrom.BonusITTempData);
|
|
||||||
if (existing != null && existing.Count > 0)
|
|
||||||
taxLines = existing;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (taxLines != null && taxLines.Count > 0)
|
|
||||||
{
|
|
||||||
PayrollType payrollType = new PayrollTypeService().Get(payrolltypeid);
|
|
||||||
if (payrollType == null || payrollType.TaxParamID == null)
|
|
||||||
throw new ServiceException("Current year Tax paramter setup not found.");
|
|
||||||
TaxMergeMaster mitem = new TaxMergeMasterService().Get(payrolltypeid, (int)payrollType.TaxParamID,
|
|
||||||
EnumTaxMergeType.Bonus, row.BonusID);
|
|
||||||
if (mitem == null)
|
|
||||||
throw new ServiceException("Bonus head not found in the income tax Grouping");
|
|
||||||
|
|
||||||
IncomeTax bonusLine = taxLines.Find(y => y.ItemGroup == mitem.ItemGroup && y.ItemID == mitem.ItemID);
|
|
||||||
if (bonusLine == null)
|
|
||||||
throw new ServiceException("Income tax amount not found in the collection");
|
|
||||||
bonusLine.ThisMonthAmount = bonusAmount;
|
|
||||||
|
|
||||||
IncomeTax taxLine = taxLines.Find(y => y.ItemGroup == EnumIncomeTaxItemGroup.Tax_Deducted);
|
|
||||||
if (taxLine != null)
|
|
||||||
taxLine.ThisMonthAmount = changeTaxAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
TransactionContext tc = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
tc = TransactionContext.Begin(true);
|
|
||||||
|
|
||||||
BonusProcessDA.UpdateRowAmounts(tc, row.BonusProcessDetailID, bonusAmount, changeTaxAmount, taxAmount,
|
|
||||||
userID, DateTime.Now);
|
|
||||||
|
|
||||||
if (taxLines != null && taxLines.Count > 0)
|
|
||||||
{
|
|
||||||
IncomeTaxService taxService = new IncomeTaxService();
|
|
||||||
taxService.Delete(tc, row.EmployeeID.ToString(), EnumIncomeTaxDataFrom.BonusITTempData);
|
|
||||||
taxService.SaveBulk(tc, taxLines, EnumIncomeTaxDataFrom.BonusITTempData);
|
|
||||||
}
|
|
||||||
|
|
||||||
tc.End();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
#region Handle Exception
|
|
||||||
|
|
||||||
if (tc != null)
|
|
||||||
tc.HandleError();
|
|
||||||
ExceptionLog.Write(e);
|
|
||||||
throw new ServiceException(e.Message, e);
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.GetGridRow(row.BonusProcessDetailID);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Remove (one saved row, deleted straight away)
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Remove button on a saved row: what the old Remove + Save left in the database (the employee simply
|
|
||||||
/// not saved), now deleted at once since Process already saved it — in one transaction:
|
|
||||||
/// - BONUSTEMPIT: this employee's rows (only when the process was saved with Calculate Tax);
|
|
||||||
/// - BonusEmpCostCenter: this employee's rows in this process;
|
|
||||||
/// - BONUSPROCESSDETAIL: the row;
|
|
||||||
/// - BONUSPROCESS: the header too, when that was the process's last employee.
|
|
||||||
/// Refused when the row is not found, not the current payroll type's, or the bonus is already approved
|
|
||||||
/// (the same checks as the Modify dialog). Rows not saved yet are removed in the browser only, as before.
|
|
||||||
/// </summary>
|
|
||||||
public BonusProcessRowRemoveResult RemoveRow(int bonusProcessDetailID, int payrolltypeid)
|
|
||||||
{
|
|
||||||
if (bonusProcessDetailID <= 0)
|
|
||||||
throw new ServiceException("Please select a bonus row.");
|
|
||||||
|
|
||||||
ModifyRow row = GetRowForModify(bonusProcessDetailID, payrolltypeid);
|
|
||||||
BonusProcessRowRemoveResult result = new BonusProcessRowRemoveResult
|
|
||||||
{
|
|
||||||
BonusProcessDetailID = row.BonusProcessDetailID,
|
|
||||||
BonusProcessID = row.BonusProcessID,
|
|
||||||
};
|
|
||||||
|
|
||||||
TransactionContext tc = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
tc = TransactionContext.Begin(true);
|
|
||||||
|
|
||||||
BonusProcessDA.DeleteRowBonusTempTax(tc, row.BonusProcessID, row.EmployeeID);
|
|
||||||
BonusProcessDA.DeleteRowCostCenter(tc, row.BonusProcessID, row.EmployeeID);
|
|
||||||
BonusProcessDA.DeleteRow(tc, row.BonusProcessDetailID);
|
|
||||||
|
|
||||||
if (BonusProcessDA.CountRows(tc, row.BonusProcessID) == 0)
|
|
||||||
{
|
|
||||||
BonusProcessDA.DeleteEmptyProcess(tc, row.BonusProcessID);
|
|
||||||
result.ProcessDeleted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
tc.End();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
#region Handle Exception
|
|
||||||
|
|
||||||
if (tc != null)
|
|
||||||
tc.HandleError();
|
|
||||||
ExceptionLog.Write(e);
|
|
||||||
throw new ServiceException(e.Message, e);
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Clear Tax (whole process, saved straight away)
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Bonus Process screen, "Clear Tax": what the old Clear Tax + Save did, now saved at once (there is no
|
|
||||||
/// Save button any more), for every employee of the process on the screen, in one transaction:
|
|
||||||
/// - BONUSPROCESSDETAIL: CHANGETAXAMOUNT = 0 (TAXAMOUNT, the calculated tax, is kept);
|
|
||||||
/// - BONUSTEMPIT: THISMONTHAMOUNT = 0 on the Tax Deducted line (-212) of those employees.
|
|
||||||
/// Refused when the process is not the current payroll type's or the bonus is already approved.
|
|
||||||
/// The old clearTax() (browser only) is kept as it was.
|
|
||||||
/// </summary>
|
|
||||||
public List<BonusProcessGridRow> ClearTaxAndSave(int bonusProcessID, int payrolltypeid, int userID)
|
|
||||||
{
|
|
||||||
if (bonusProcessID <= 0)
|
|
||||||
throw new ServiceException("Please process the bonus first.");
|
|
||||||
|
|
||||||
int bonusID = 0;
|
|
||||||
int processPayrollTypeID = 0;
|
|
||||||
DateTime bonusMonth = DateTime.MinValue;
|
|
||||||
bool found = false;
|
|
||||||
|
|
||||||
TransactionContext tc = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
tc = TransactionContext.Begin();
|
|
||||||
DataReader dr = new DataReader(BonusProcessDA.GetProcessHeaderForClearTax(tc, bonusProcessID));
|
|
||||||
if (dr.Read())
|
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
bonusID = dr.GetInt32("BONUSID", 0);
|
|
||||||
bonusMonth = dr.GetDateTime("BONUSMONTH", DateTime.MinValue);
|
|
||||||
processPayrollTypeID = dr.GetInt32("PAYROLLTYPEID", 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
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found)
|
|
||||||
throw new ServiceException("Bonus process not found. Please process the bonus again.");
|
|
||||||
if (processPayrollTypeID != payrolltypeid)
|
|
||||||
throw new ServiceException("This bonus process does not belong to the current payroll type.");
|
|
||||||
if (this.IsApproved(bonusID, bonusMonth, payrolltypeid))
|
|
||||||
throw new ServiceException("selected Bonus is already process and Approved");
|
|
||||||
|
|
||||||
tc = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
tc = TransactionContext.Begin(true);
|
|
||||||
|
|
||||||
BonusProcessDA.ClearTaxOfProcess(tc, bonusProcessID, userID, DateTime.Now);
|
|
||||||
BonusProcessDA.ClearBonusTempTaxOfProcess(tc, bonusProcessID, (int)EnumIncomeTaxItemGroup.Tax_Deducted);
|
|
||||||
|
|
||||||
tc.End();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
#region Handle Exception
|
|
||||||
|
|
||||||
if (tc != null)
|
|
||||||
tc.HandleError();
|
|
||||||
ExceptionLog.Write(e);
|
|
||||||
throw new ServiceException(e.Message, e);
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.GetGridRows(bonusProcessID);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Builds the employee cost-center split for every employee in the bonus process and
|
/// Builds the employee cost-center split for every employee in the bonus process and
|
||||||
/// bulk-inserts it into BonusEmpCostCenter (mirrors the SalaryEmpCostCenter handling in
|
/// bulk-inserts it into BonusEmpCostCenter (mirrors the SalaryEmpCostCenter handling in
|
||||||
|
|
@ -1844,36 +1157,6 @@ namespace HRM.DA
|
||||||
return isApproved;
|
return isApproved;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Bonus Process screen (Process and Upload): the same bonus type may be processed only once in a month.
|
|
||||||
/// Throws when this bonus already has a process in this month for this payroll type.
|
|
||||||
/// </summary>
|
|
||||||
public void CheckAlreadyProcessedInMonth(int bonusID, DateTime bonusMonth, int payrolltypeid)
|
|
||||||
{
|
|
||||||
TransactionContext tc = null;
|
|
||||||
int count = 0;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
tc = TransactionContext.Begin();
|
|
||||||
count = BonusProcessDA.CountProcessInMonth(tc, payrolltypeid, bonusID, bonusMonth);
|
|
||||||
tc.End();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
#region Handle Exception
|
|
||||||
|
|
||||||
if (tc != null)
|
|
||||||
tc.HandleError();
|
|
||||||
ExceptionLog.Write(e);
|
|
||||||
throw new ServiceException(e.Message, e);
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
if (count > 0)
|
|
||||||
throw new ServiceException("This bonus type is already processed for " + bonusMonth.ToString("MMMM yyyy") +
|
|
||||||
". The same bonus type cannot be processed twice in the same month.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public DataTable GetUnApprovedBonuses(DateTime dMonthDate, int payrollTypeID)
|
public DataTable GetUnApprovedBonuses(DateTime dMonthDate, int payrollTypeID)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1860,43 +1860,6 @@ namespace HRM.DA
|
||||||
return employees;
|
return employees;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Same as GetByEmpIDs(string, int), for any number of employees (10k+): the IDs reach SQL Server as
|
|
||||||
/// one parameter and a temp table, not as an IN list in the SQL text.
|
|
||||||
/// </summary>
|
|
||||||
public List<Employee> GetByEmpIDList(List<int> empIDs, int payrollTypeID)
|
|
||||||
{
|
|
||||||
List<Employee> employees = new List<Employee>();
|
|
||||||
if (empIDs == null || empIDs.Count == 0)
|
|
||||||
return employees;
|
|
||||||
|
|
||||||
TransactionContext tc = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
tc = TransactionContext.Begin();
|
|
||||||
|
|
||||||
DataReader dr = new DataReader(EmployeeDA.GetByEmpIDList(tc, empIDs.Distinct().ToList(), payrollTypeID));
|
|
||||||
employees = this.CreateObjects<Employee>(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 employees;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Employee> GetByEmpIDs(string empIDs)
|
public List<Employee> GetByEmpIDs(string empIDs)
|
||||||
{
|
{
|
||||||
List<Employee> employees = new List<Employee>();
|
List<Employee> employees = new List<Employee>();
|
||||||
|
|
@ -1927,51 +1890,6 @@ namespace HRM.DA
|
||||||
|
|
||||||
return employees;
|
return employees;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A light Employee (EmployeeLite) for each of the given employees — an alternative to GetByEmpIDs
|
|
||||||
/// for screens that need only a few fields for thousands of employees (Bonus Process).
|
|
||||||
/// </summary>
|
|
||||||
public List<EmployeeLite> GetLiteByEmpIDs(List<int> empIDs)
|
|
||||||
{
|
|
||||||
List<EmployeeLite> items = new List<EmployeeLite>();
|
|
||||||
if (empIDs == null || empIDs.Count == 0)
|
|
||||||
return items;
|
|
||||||
|
|
||||||
TransactionContext tc = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
tc = TransactionContext.Begin();
|
|
||||||
|
|
||||||
DataReader dr = new DataReader(EmployeeDA.GetLiteByEmpIDs(tc, empIDs.Distinct().ToList()));
|
|
||||||
while (dr.Read())
|
|
||||||
{
|
|
||||||
items.Add(new EmployeeLite
|
|
||||||
{
|
|
||||||
EmployeeID = dr.GetInt32("EmployeeID").Value,
|
|
||||||
IsConfirmed = dr.GetBoolean("IsConfirmed", false),
|
|
||||||
JoiningDate = dr.GetDateTime("JoiningDate")
|
|
||||||
});
|
|
||||||
}
|
|
||||||
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 items;
|
|
||||||
}
|
|
||||||
public void UpdateBanglaInformation(List<object> employeBanglaInfo)
|
public void UpdateBanglaInformation(List<object> employeBanglaInfo)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -316,36 +316,6 @@ namespace HRM.DA
|
||||||
return DataExist;
|
return DataExist;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Only SALARYTEMPIT (salary processed, not yet finalized) — unlike hasTaxDataInSalaryTemp, the
|
|
||||||
/// employee's BONUSTEMPIT rows are not counted. For the Bonus Process Modify dialog.
|
|
||||||
/// </summary>
|
|
||||||
public bool hasTaxDataInSalaryTempOnly(int employeeID)
|
|
||||||
{
|
|
||||||
bool DataExist = false;
|
|
||||||
TransactionContext tc = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
tc = TransactionContext.Begin();
|
|
||||||
DataExist = IncomeTaxDA.hasTaxDataInSalaryTempOnly(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 DataExist;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public EnumIncomeTaxDataFrom currentYeardataSource(int employeeID)
|
public EnumIncomeTaxDataFrom currentYeardataSource(int employeeID)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
// A light Employee: only the few fields screens working on thousands of employees at once need
|
|
||||||
// (api/Employee/getEmployeeLiteByEmpIDs). Mirrors HRM.BO.EmployeeLite — add a field in both.
|
|
||||||
export class EmployeeLite {
|
|
||||||
public employeeID: number;
|
|
||||||
public isConfirmed: boolean;
|
|
||||||
public joiningDate: Date;
|
|
||||||
}
|
|
||||||
|
|
@ -31,8 +31,6 @@ export class BonusProcess extends BaseObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BonusProcessDetail {
|
export class BonusProcessDetail {
|
||||||
// the saved row's BONUSPROCESSDETAILID (set on rows that came back from api/Bonus/processAndSave)
|
|
||||||
bonusProcessDetailID?: number;
|
|
||||||
isProjectedBonus: boolean;
|
isProjectedBonus: boolean;
|
||||||
bonusProcessID: number;
|
bonusProcessID: number;
|
||||||
bonusID: number;
|
bonusID: number;
|
||||||
|
|
|
||||||
|
|
@ -1,66 +0,0 @@
|
||||||
// api/Bonus/processAndSave — mirrors HRM.BO BonusProcessAndSave.cs (add a field in both).
|
|
||||||
|
|
||||||
// What the Process button sends: the header and the employee IDs only.
|
|
||||||
export interface BonusProcessAndSaveRequest {
|
|
||||||
bonusID: number;
|
|
||||||
basicMonth: Date;
|
|
||||||
payDate: Date;
|
|
||||||
cuttOfDate: Date;
|
|
||||||
currProcess: number;
|
|
||||||
isDisburseWithSalary: boolean;
|
|
||||||
isTaxProcess: boolean;
|
|
||||||
employeeIDs: number[];
|
|
||||||
}
|
|
||||||
|
|
||||||
// One saved row of the Bonus Process grid, read back from the database.
|
|
||||||
export interface BonusProcessGridRow {
|
|
||||||
bonusProcessDetailID: number;
|
|
||||||
bonusProcessID: number;
|
|
||||||
bonusID: number;
|
|
||||||
employeeID: number;
|
|
||||||
employeeNo: string;
|
|
||||||
name: string;
|
|
||||||
joiningDate: Date;
|
|
||||||
isConfirmed: boolean;
|
|
||||||
grossSalary: number;
|
|
||||||
basicSalary: number;
|
|
||||||
bonusAmount: number;
|
|
||||||
changeBonusAmount: number;
|
|
||||||
taxAmount: number;
|
|
||||||
changeTaxAmount: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Modify dialog, Calculate (api/Bonus/calculateRowTax): nothing is saved
|
|
||||||
export interface BonusProcessRowTaxRequest {
|
|
||||||
bonusProcessDetailID: number;
|
|
||||||
bonusAmount: number;
|
|
||||||
}
|
|
||||||
export interface BonusProcessRowTaxResult {
|
|
||||||
bonusProcessDetailID: number;
|
|
||||||
bonusAmount: number;
|
|
||||||
taxAmount: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Modify dialog, Save (api/Bonus/saveRow): with calculateTax the server works the tax out again
|
|
||||||
export interface BonusProcessRowSaveRequest {
|
|
||||||
bonusProcessDetailID: number;
|
|
||||||
bonusAmount: number;
|
|
||||||
taxAmount: number;
|
|
||||||
calculateTax: boolean;
|
|
||||||
// "Edited Tax Amount": with calculateTax, the tax the user settled on (saved as changeTaxAmount); undefined = the calculated tax
|
|
||||||
editedTaxAmount?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface BonusProcessAndSaveResult {
|
|
||||||
bonusProcessID: number;
|
|
||||||
rows: BonusProcessGridRow[];
|
|
||||||
// employees left out because this bonus was already processed for them this month
|
|
||||||
alreadyProcessedEmployeeIDs: number[];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove on a saved row (api/Bonus/removeRow/{id}): processDeleted = it was the last employee, the header is gone too
|
|
||||||
export interface BonusProcessRowRemoveResult {
|
|
||||||
bonusProcessDetailID: number;
|
|
||||||
bonusProcessID: number;
|
|
||||||
processDeleted: boolean;
|
|
||||||
}
|
|
||||||
|
|
@ -2,7 +2,6 @@ import {Injectable} from '@angular/core';
|
||||||
import {ApiService} from '../../app.api.service';
|
import {ApiService} from '../../app.api.service';
|
||||||
import {HttpClient, HttpEvent, HttpRequest} from '@angular/common/http';
|
import {HttpClient, HttpEvent, HttpRequest} from '@angular/common/http';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { BonusProcessAndSaveRequest, BonusProcessAndSaveResult } from '../../_models/Payroll/bonusProcessAndSave';
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
|
|
@ -36,15 +35,6 @@ export class DataUploadService {
|
||||||
return this.http.request<any>(req);
|
return this.http.request<any>(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bonus Process, Upload Data: the file is read AND saved (with the tax when asked) in one request.
|
|
||||||
// header = the same fields the Process button sends (api/dataUpload/uploadBonusFileAndSave)
|
|
||||||
public uploadBonusFileAndSave(selectedFile: File, header: BonusProcessAndSaveRequest): Observable<BonusProcessAndSaveResult> {
|
|
||||||
const formData: FormData = new FormData();
|
|
||||||
formData.append('excelfile', selectedFile);
|
|
||||||
formData.append('header', JSON.stringify(header));
|
|
||||||
return this.http.post<BonusProcessAndSaveResult>(`${this.apiService.base_url + '/'}dataUpload/uploadBonusFileAndSave`, formData);
|
|
||||||
}
|
|
||||||
|
|
||||||
public uploadBonusFile(selectedFile: File, payrolltypeid: number):
|
public uploadBonusFile(selectedFile: File, payrolltypeid: number):
|
||||||
Observable<HttpEvent<any>> {
|
Observable<HttpEvent<any>> {
|
||||||
const formData: FormData = new FormData();
|
const formData: FormData = new FormData();
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import {TrainingType} from '../../_models/Basic/trainingType';
|
||||||
import {EducationType} from '../../_models/HRBasic/education-type';
|
import {EducationType} from '../../_models/HRBasic/education-type';
|
||||||
import {NominationPurpose} from '../../_models/HRBasic/nomination-purpose';
|
import {NominationPurpose} from '../../_models/HRBasic/nomination-purpose';
|
||||||
import {Employee} from '../../_models/Employee/employee';
|
import {Employee} from '../../_models/Employee/employee';
|
||||||
import {EmployeeLite} from '../../_models/Employee/employeeLite';
|
|
||||||
import {EmployeeBankAccount} from '../../_models/Employee/employeeBankAccount';
|
import {EmployeeBankAccount} from '../../_models/Employee/employeeBankAccount';
|
||||||
import {EmployeeCostCenter} from '../../_models/Employee/employeeCostCenter';
|
import {EmployeeCostCenter} from '../../_models/Employee/employeeCostCenter';
|
||||||
import {Relation} from '../../_models/HRBasic/relation';
|
import {Relation} from '../../_models/HRBasic/relation';
|
||||||
|
|
@ -139,11 +138,6 @@ export class EmployeeServices {
|
||||||
getEmployeesByEmpIDs(data: any) {
|
getEmployeesByEmpIDs(data: any) {
|
||||||
return this.apiService.httpPost<Employee[]>('/Employee/getEmployeesByEmpIDs', data);
|
return this.apiService.httpPost<Employee[]>('/Employee/getEmployeesByEmpIDs', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// A light Employee (only a few fields) — light enough for 10k+ employees (Bonus Process).
|
|
||||||
getEmployeeLiteByEmpIDs(empIds: number[]) {
|
|
||||||
return this.apiService.httpPost<EmployeeLite[]>('/Employee/getEmployeeLiteByEmpIDs', empIds);
|
|
||||||
}
|
|
||||||
getEmployeeDetailByEmpIDs(data: any) {
|
getEmployeeDetailByEmpIDs(data: any) {
|
||||||
return this.apiService.httpPost<Employee[]>('/Employee/getEmployeeDetailByEmpIDs', data);
|
return this.apiService.httpPost<Employee[]>('/Employee/getEmployeeDetailByEmpIDs', data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,6 @@ import { ProductionBonusSetup } from '../../_models/Payroll/ProductionBonus/prod
|
||||||
import { ProductionBonusSetupComponent } from 'src/app/payroll-ot/production-bonus-setup/production-bonus-setup.component';
|
import { ProductionBonusSetupComponent } from 'src/app/payroll-ot/production-bonus-setup/production-bonus-setup.component';
|
||||||
import { ProdBonusLine } from 'src/app/_models/Payroll/ProductionBonus/prodBonusLine';
|
import { ProdBonusLine } from 'src/app/_models/Payroll/ProductionBonus/prodBonusLine';
|
||||||
import { Employee } from 'src/app/_models/Employee/employee';
|
import { Employee } from 'src/app/_models/Employee/employee';
|
||||||
import { BonusProcessAndSaveRequest, BonusProcessAndSaveResult, BonusProcessGridRow, BonusProcessRowSaveRequest,
|
|
||||||
BonusProcessRowTaxRequest, BonusProcessRowTaxResult, BonusProcessRowRemoveResult } from 'src/app/_models/Payroll/bonusProcessAndSave';
|
|
||||||
import { ProdBonusAttn } from 'src/app/_models/Payroll/ProductionBonus/prodBonusAttn';
|
import { ProdBonusAttn } from 'src/app/_models/Payroll/ProductionBonus/prodBonusAttn';
|
||||||
import { ProdBonusProcess } from 'src/app/_models/Payroll/ProductionBonus/prodBonusProcess';
|
import { ProdBonusProcess } from 'src/app/_models/Payroll/ProductionBonus/prodBonusProcess';
|
||||||
import { PRBCalculation, PRBCalculationReport, PRBKpi } from '../../_models/Payroll/prbCalculation';
|
import { PRBCalculation, PRBCalculationReport, PRBKpi } from '../../_models/Payroll/prbCalculation';
|
||||||
|
|
@ -46,23 +44,6 @@ export class BonusService {
|
||||||
saveBonusProcess(param: any) {
|
saveBonusProcess(param: any) {
|
||||||
return this.apiService.httpPost<any>('/Bonus/saveBonusProcess/', param);
|
return this.apiService.httpPost<any>('/Bonus/saveBonusProcess/', param);
|
||||||
}
|
}
|
||||||
// Process button: calculates and saves in one request; returns the saved rows (see BonusProcessService.ProcessAndSave)
|
|
||||||
processAndSave(param: BonusProcessAndSaveRequest) {
|
|
||||||
return this.apiService.httpPost<BonusProcessAndSaveResult>('/Bonus/processAndSave', param);
|
|
||||||
}
|
|
||||||
// Modify dialog: tax of one saved row (nothing saved), and saving one row
|
|
||||||
calculateRowTax(param: BonusProcessRowTaxRequest) {
|
|
||||||
return this.apiService.httpPost<BonusProcessRowTaxResult>('/Bonus/calculateRowTax', param);
|
|
||||||
}
|
|
||||||
saveRow(param: BonusProcessRowSaveRequest) {
|
|
||||||
return this.apiService.httpPost<BonusProcessGridRow>('/Bonus/saveRow', param);
|
|
||||||
}
|
|
||||||
clearTaxAndSave(bonusProcessID: number) {
|
|
||||||
return this.apiService.httpPost<BonusProcessGridRow[]>('/Bonus/clearTaxAndSave/' + bonusProcessID, {});
|
|
||||||
}
|
|
||||||
removeRow(bonusProcessDetailID: number) {
|
|
||||||
return this.apiService.httpPost<BonusProcessRowRemoveResult>('/Bonus/removeRow/' + bonusProcessDetailID, {});
|
|
||||||
}
|
|
||||||
GetUnApprovedBonusses() {
|
GetUnApprovedBonusses() {
|
||||||
return this.apiService.httpGet<any>('/Bonus/GetUnApprovedBonusses' );
|
return this.apiService.httpGet<any>('/Bonus/GetUnApprovedBonusses' );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
.customGrid{
|
.customGrid{
|
||||||
margin: 0px 80px 0px 80px !important;
|
margin: 0px 100px 0px 100px !important;
|
||||||
}
|
}
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.customGrid {
|
.customGrid {
|
||||||
|
|
|
||||||
|
|
@ -32,13 +32,13 @@
|
||||||
</kendo-grid-column>
|
</kendo-grid-column>
|
||||||
}
|
}
|
||||||
@if (isWorkflowRequired) {
|
@if (isWorkflowRequired) {
|
||||||
<kendo-grid-column field="count" title="Add Attachment" width="15%">
|
<kendo-grid-column field="count" title="Add Attachment" width="20%">
|
||||||
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
|
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
|
||||||
<button kendoButton (click)="showAddApprovalAttachment(dataItem)" [svgIcon]="apiService.KendoSVGIcon['clip']">Attachment</button>
|
<button kendoButton (click)="showAddApprovalAttachment(dataItem)" [svgIcon]="apiService.KendoSVGIcon['add']">Approve</button>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</kendo-grid-column>
|
</kendo-grid-column>
|
||||||
}
|
}
|
||||||
<kendo-grid-command-column title="Action" width="15%">
|
<kendo-grid-command-column title="Action" width="10%">
|
||||||
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
|
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
|
||||||
@if (!isWorkflowRequired) {
|
@if (!isWorkflowRequired) {
|
||||||
<button kendoButton (click)="ApproveBonus(dataItem.bonusid)" [svgIcon]="apiService.KendoSVGIcon['delete']">Approve</button>
|
<button kendoButton (click)="ApproveBonus(dataItem.bonusid)" [svgIcon]="apiService.KendoSVGIcon['delete']">Approve</button>
|
||||||
|
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
||||||
/* Bonus Process: the input panels at the top (colors are the app's $brand-* / $gray-* tokens as literals) */
|
|
||||||
.bp-panel {
|
|
||||||
background: #ffffff;
|
|
||||||
border: 1px solid #E4E4EE;
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 12px 16px 6px 16px;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bp-panel-title {
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 14px;
|
|
||||||
color: #414278;
|
|
||||||
padding-bottom: 8px;
|
|
||||||
margin-bottom: 6px;
|
|
||||||
border-bottom: 1px solid #DEDEFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bp-field {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bp-label {
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: #666666;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bp-required {
|
|
||||||
color: #d9534f;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bp-options {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
align-items: center;
|
|
||||||
gap: 24px;
|
|
||||||
min-height: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bp-option {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bp-option label {
|
|
||||||
cursor: pointer;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Process / Clear Tax / Upload Data: pushed to the far right of the options row */
|
|
||||||
.bp-actions {
|
|
||||||
display: inline-flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 6px;
|
|
||||||
margin-left: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bp-message {
|
|
||||||
padding: 6px 2px 8px 2px;
|
|
||||||
color: #414278;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* in the grid toolbar: no extra height, kept on the far right */
|
|
||||||
span.bp-message {
|
|
||||||
padding: 0 4px;
|
|
||||||
}
|
|
||||||
|
|
@ -3,110 +3,140 @@
|
||||||
|
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
|
|
||||||
<!-- Inputs grouped in two panels; every control keeps its bindings (ngModel, formControlName, events) -->
|
<div class="md:col-6 col-12">
|
||||||
<div class="col-12">
|
<div class="grid">
|
||||||
<div class="bp-panel">
|
<div class="col-5" style="margin: auto;">
|
||||||
<div class="bp-panel-title">Bonus Information</div>
|
<label>Bonus Type</label>
|
||||||
<div class="grid">
|
</div>
|
||||||
<div class="col-12 md:col-6 lg:col-4 bp-field">
|
<div class="col-7">
|
||||||
<label class="bp-label">Bonus Type <span class="bp-required">*</span></label>
|
<kendo-dropdownlist [(ngModel)]="selectedbonusID"
|
||||||
<kendo-dropdownlist [(ngModel)]="selectedbonusID"
|
[data]="bonuses"
|
||||||
[data]="bonuses"
|
[defaultItem]="{ name: 'Select Bonus Type..', id: null }"
|
||||||
[defaultItem]="{ name: 'Select Bonus Type..', id: null }"
|
[textField]="'name'"
|
||||||
[textField]="'name'"
|
[valueField]="'id'"
|
||||||
[valueField]="'id'"
|
[valuePrimitive]="true"
|
||||||
[valuePrimitive]="true"
|
class="form-control form-control-sm input-sm"
|
||||||
class="form-control form-control-sm input-sm"
|
formControlName="bonusType"
|
||||||
formControlName="bonusType"
|
(valueChange)="BonusvalueChange($event)"
|
||||||
(valueChange)="BonusvalueChange($event)"
|
style="width:100%">
|
||||||
style="width:100%">
|
</kendo-dropdownlist>
|
||||||
</kendo-dropdownlist>
|
|
||||||
</div>
|
|
||||||
<div class="col-12 md:col-6 lg:col-4 bp-field">
|
|
||||||
<label class="bp-label">Consider Basic Of <span class="bp-required">*</span></label>
|
|
||||||
<kendo-datepicker [format]="'dd-MMM-yyyy'"
|
|
||||||
[(ngModel)]="basicDate"
|
|
||||||
formControlName="basicDate"
|
|
||||||
style="width:100%"></kendo-datepicker>
|
|
||||||
</div>
|
|
||||||
<div class="col-12 md:col-6 lg:col-4 bp-field">
|
|
||||||
<label class="bp-label">Currently Process For Basic <span class="bp-required">*</span></label>
|
|
||||||
<kendo-numerictextbox
|
|
||||||
[(ngModel)]="processFor"
|
|
||||||
style="width:100%"
|
|
||||||
formControlName="processFor">
|
|
||||||
</kendo-numerictextbox>
|
|
||||||
</div>
|
|
||||||
<div class="col-12 md:col-6 lg:col-4 bp-field">
|
|
||||||
<label class="bp-label">Pay Date <span class="bp-required">*</span></label>
|
|
||||||
<kendo-datepicker [format]="'dd-MMM-yyyy'"
|
|
||||||
[(ngModel)]="payDate"
|
|
||||||
formControlName="payDate"
|
|
||||||
style="width:100%"></kendo-datepicker>
|
|
||||||
</div>
|
|
||||||
<div class="col-12 md:col-6 lg:col-4 bp-field">
|
|
||||||
<label class="bp-label">Bonus Cut Off Date <span class="bp-required">*</span></label>
|
|
||||||
<kendo-datepicker [format]="'dd-MMM-yyyy'"
|
|
||||||
[(ngModel)]="cuttofDate"
|
|
||||||
formControlName="cutOffDate"
|
|
||||||
style="width:100%"></kendo-datepicker>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="md:col-6 col-12">
|
||||||
|
<div class="grid">
|
||||||
|
<div class="col-5" style="margin: auto;">
|
||||||
|
<label>Consider Basic Of</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-7">
|
||||||
|
<kendo-datepicker [format]="'dd-MMM-yyyy'"
|
||||||
|
[(ngModel)]="basicDate"
|
||||||
|
formControlName="basicDate"
|
||||||
|
style="width:100%"></kendo-datepicker>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="md:col-6 col-12">
|
||||||
|
<div class="grid">
|
||||||
|
<div class="col-5" style="margin: auto;">
|
||||||
|
<label>Pay Date</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-7">
|
||||||
|
<kendo-datepicker [format]="'dd-MMM-yyyy'"
|
||||||
|
[(ngModel)]="payDate"
|
||||||
|
formControlName="payDate"
|
||||||
|
style="width:100%"></kendo-datepicker>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="md:col-6 col-12">
|
||||||
|
<div class="grid">
|
||||||
|
<div class="col-5" style="margin: auto;">
|
||||||
|
<label>Bonus Cut Off Date</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-7">
|
||||||
|
<kendo-datepicker [format]="'dd-MMM-yyyy'"
|
||||||
|
[(ngModel)]="cuttofDate"
|
||||||
|
formControlName="cutOffDate"
|
||||||
|
style="width:100%"></kendo-datepicker>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="md:col-6 col-12">
|
||||||
|
<div class="grid">
|
||||||
|
<div class="col-5" style="margin: auto;">
|
||||||
|
<label>Currently Process For Basic</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-7">
|
||||||
|
<kendo-numerictextbox
|
||||||
|
[(ngModel)]="processFor"
|
||||||
|
style="width:100%"
|
||||||
|
formControlName="processFor">
|
||||||
|
</kendo-numerictextbox>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="bp-panel" style="margin-bottom: 0px !important;">
|
</div>
|
||||||
<div class="bp-panel-title">Employees & Options</div>
|
</div>
|
||||||
<div class="grid">
|
<div class="md:col-6 col-12">
|
||||||
<div class="col-12 md:col-6 lg:col-4 bp-field">
|
<div class="grid">
|
||||||
<label class="bp-label">Select Employee</label>
|
<div class="col-5" style="margin: auto;">
|
||||||
<app-employee-picker [MultiSelect]="true" (ItemSelected)="GetSelectedEmployee($event)"></app-employee-picker>
|
<label>Select Employee: </label>
|
||||||
|
</div>
|
||||||
|
<div class="col-7">
|
||||||
|
<app-employee-picker [MultiSelect]="true" (ItemSelected)="GetSelectedEmployee($event)"></app-employee-picker>
|
||||||
|
<b> {{returnMessage}}</b>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="md:col-6 col-12">
|
||||||
|
<div class="grid" style="margin-top: 8px;">
|
||||||
|
<div class="col-5">
|
||||||
|
<div class="p-field-checkbox">
|
||||||
|
<input formControlName="disburseWithSalary" kendoCheckBox
|
||||||
|
[(ngModel)]="disburseWithSalary" (change)="checkWithOrTax(1, disburseWithSalary)" style="margin-right: 10px"
|
||||||
|
type="checkbox" />
|
||||||
|
<label>Disburse With Salary</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 md:col-6 lg:col-8 bp-field">
|
<div class="col-7">
|
||||||
<label class="bp-label">Options</label>
|
<div class="p-field-checkbox">
|
||||||
<div class="bp-options">
|
<input formControlName="calculateTax" kendoCheckBox (change)="checkWithOrTax(2, isTaxProcess)"
|
||||||
<span class="bp-option">
|
[(ngModel)]="isTaxProcess" style="margin-right: 10px"
|
||||||
<input id="bpDisburseWithSalary" formControlName="disburseWithSalary" kendoCheckBox
|
type="checkbox" />
|
||||||
[(ngModel)]="disburseWithSalary" (change)="checkWithOrTax(1, disburseWithSalary)"
|
<label>Calculate Tax</label>
|
||||||
type="checkbox" />
|
</div>
|
||||||
<label for="bpDisburseWithSalary">Disburse With Salary</label>
|
|
||||||
</span>
|
|
||||||
<span class="bp-option">
|
|
||||||
<input id="bpCalculateTax" formControlName="calculateTax" kendoCheckBox (change)="checkWithOrTax(2, isTaxProcess)"
|
|
||||||
[(ngModel)]="isTaxProcess"
|
|
||||||
type="checkbox" />
|
|
||||||
<label for="bpCalculateTax">Calculate Tax</label>
|
|
||||||
</span>
|
|
||||||
<!-- Process, Clear Tax and Upload Data on the right of the same row (moved here from the row under the panel) -->
|
|
||||||
<span class="bp-actions">
|
|
||||||
<button type="button" kendoButton [svgIcon]="apiService.KendoSVGIcon['gear']" themeColor="primary" (click)="process()">Process</button>
|
|
||||||
<!-- Clear Tax now saves at once (clearTaxAndSave); the old browser-only clearTax() is kept in the .ts -->
|
|
||||||
<button type="button" kendoButton [svgIcon]="apiService.KendoSVGIcon['cross']" themeColor="primary" (click)="clearTaxAndSave()">Clear Tax</button>
|
|
||||||
<button type="button" kendoButton [svgIcon]="apiService.KendoSVGIcon['upload']" themeColor="primary" (click)="showBonusUploadPopUp()">Upload Data</button>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- the message now shows on the right of the grid toolbar (next to Export to Excel). Kept for reference.
|
|
||||||
@if (returnMessage) {
|
|
||||||
<div class="bp-message"><b>{{returnMessage}}</b></div>
|
|
||||||
}
|
<div class="md:col-12 col-12">
|
||||||
-->
|
<div class="grid" style="margin-left: 5px; margin-right: 5px;">
|
||||||
</div>
|
<div class="col-12" align="right">
|
||||||
</div>
|
<button kendoButton [svgIcon]="apiService.KendoSVGIcon['gear']" themeColor="primary" (click)="process()" style="margin-right:5px;">Process</button>
|
||||||
|
<!--<button kendoButton [svgIcon]="apiService.KendoSVGIcon['upload']" themeColor="primary" (click)="uploadData()" style="margin-right:5px; float:right;">Upload</button>-->
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
<button kendoButton [svgIcon]="apiService.KendoSVGIcon['upload']" themeColor="primary" (click)="showBonusUploadPopUp()" style="margin-right:5px;">Upload Data</button>
|
||||||
|
<!--<button kendoButton [svgIcon]="apiService.KendoSVGIcon['upload']" themeColor="primary" (click)="uploadData()" style="margin-right:5px; float:right;">Upload</button>-->
|
||||||
|
</div>
|
||||||
|
<div class="col-6" align="right">
|
||||||
|
<button kendoButton [svgIcon]="apiService.KendoSVGIcon['cross']" themeColor="primary" (click)="clearTax()" style="margin-right:5px;">Clear Tax</button>
|
||||||
|
<button kendoButton [svgIcon]="apiService.KendoSVGIcon['gear']" themeColor="primary" (click)="TaxRecalculate()" style="margin-right:5px;">Tax Re-calculate</button>
|
||||||
|
<button kendoButton [svgIcon]="apiService.KendoSVGIcon['save']" themeColor="primary" (click)="save()" style="margin-right:5px;">Save</button>
|
||||||
|
<!--<button kendoButton [svgIcon]="apiService.KendoSVGIcon['upload']" themeColor="primary" (click)="uploadData()" style="margin-right:5px; float:right;">Upload</button>-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<!-- virtual scrolling: only the rows on screen are rendered, so 10k+ employees (two numeric
|
<kendo-grid [data]="$safeNavigationMigration(bonusProcess?.bonusProcessDetails)">
|
||||||
textboxes per row) do not freeze the page. kendoGridBinding pages the array itself. -->
|
|
||||||
<kendo-grid [kendoGridBinding]="$safeNavigationMigration(bonusProcess?.bonusProcessDetails)"
|
|
||||||
scrollable="virtual" [pageSize]="50" [rowHeight]="40" [height]="500">
|
|
||||||
<ng-template kendoGridToolbarTemplate>
|
<ng-template kendoGridToolbarTemplate>
|
||||||
<button type="button" kendoGridExcelCommand [svgIcon]="apiService.KendoSVGIcon['fileExcel']">
|
<button type="button" kendoGridExcelCommand [svgIcon]="apiService.KendoSVGIcon['fileExcel']">
|
||||||
Export to Excel
|
Export to Excel
|
||||||
</button>
|
</button>
|
||||||
Count: {{ bonusProcess?.bonusProcessDetails.length}}
|
Count: {{ bonusProcess?.bonusProcessDetails.length}}
|
||||||
@if (returnMessage) {
|
|
||||||
<kendo-grid-spacer></kendo-grid-spacer>
|
|
||||||
<span class="bp-message"><b>{{returnMessage}}</b></span>
|
|
||||||
}
|
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<kendo-grid-column field="employee.employeeNo" title="Emp. ID" width="10%">
|
<kendo-grid-column field="employee.employeeNo" title="Emp. ID" width="10%">
|
||||||
</kendo-grid-column>
|
</kendo-grid-column>
|
||||||
|
|
@ -134,8 +164,6 @@
|
||||||
{{dataItem.employee.basicSalary | number:'1.2-2'}}
|
{{dataItem.employee.basicSalary | number:'1.2-2'}}
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</kendo-grid-column>
|
</kendo-grid-column>
|
||||||
<!-- Bonus Amount and Bonus Tax are read-only: they are changed one employee at a time in the Modify dialog.
|
|
||||||
The old editable cells are kept below for reference.
|
|
||||||
<kendo-grid-column field="bonusAmount" title="Bonus Amount" width="10%">
|
<kendo-grid-column field="bonusAmount" title="Bonus Amount" width="10%">
|
||||||
<ng-template kendoGridCellTemplate let-dataItem>
|
<ng-template kendoGridCellTemplate let-dataItem>
|
||||||
<kendo-numerictextbox [(ngModel)]="dataItem.changeBonusAmount"
|
<kendo-numerictextbox [(ngModel)]="dataItem.changeBonusAmount"
|
||||||
|
|
@ -156,46 +184,30 @@
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
</kendo-grid-column>
|
</kendo-grid-column>
|
||||||
-->
|
|
||||||
<kendo-grid-column field="changeBonusAmount" title="Bonus Amount" width="10%">
|
|
||||||
<ng-template kendoGridCellTemplate let-dataItem>
|
|
||||||
{{dataItem.changeBonusAmount | number:'1.2-2'}}
|
|
||||||
</ng-template>
|
|
||||||
</kendo-grid-column>
|
|
||||||
<kendo-grid-column field="changeTaxAmount" title="Bonus Tax" width="10%">
|
|
||||||
<ng-template kendoGridCellTemplate let-dataItem>
|
|
||||||
{{dataItem.changeTaxAmount | number:'1.2-2'}}
|
|
||||||
</ng-template>
|
|
||||||
</kendo-grid-column>
|
|
||||||
<kendo-grid-column field="totalAmount" title="Total Amount" width="10%">
|
<kendo-grid-column field="totalAmount" title="Total Amount" width="10%">
|
||||||
<ng-template kendoGridCellTemplate let-dataItem>
|
<ng-template kendoGridCellTemplate let-dataItem>
|
||||||
{{(dataItem.changeBonusAmount - dataItem.changeTaxAmount) | number:'1.2-2'}}
|
{{(dataItem.changeBonusAmount - dataItem.changeTaxAmount) | number:'1.2-2'}}
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</kendo-grid-column>
|
</kendo-grid-column>
|
||||||
<!-- Modify is for the bonus tax: hidden when the process was saved with Disburse With Salary (no bonus tax then) -->
|
<kendo-grid-command-column title="Remove" width="8%" style="height:98%;">
|
||||||
<kendo-grid-command-column title="Modify" width="8%" [hidden]="bonusProcess?.isDisburseWithSalary == true"
|
|
||||||
[style]="{ 'text-align': 'center' }" [headerStyle]="{ 'text-align': 'center' }">
|
|
||||||
<ng-template kendoGridCellTemplate let-dataItem>
|
|
||||||
<!-- only saved rows (after Process) can be modified -->
|
|
||||||
@if (dataItem.bonusProcessDetailID) {
|
|
||||||
<button type="button" kendoButton [svgIcon]="apiService.KendoSVGIcon['edit']" themeColor="primary"
|
|
||||||
title="Modify" (click)="openModify(dataItem)">Modify</button>
|
|
||||||
}
|
|
||||||
</ng-template>
|
|
||||||
</kendo-grid-command-column>
|
|
||||||
<kendo-grid-command-column title="Remove" width="8%"
|
|
||||||
[style]="{ 'text-align': 'center' }" [headerStyle]="{ 'text-align': 'center' }">
|
|
||||||
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
|
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
|
||||||
<!-- old: (click)="removefromList(rowIndex)". removeRow keeps that for unsaved rows and deletes saved rows in the DB -->
|
<button (click)="removefromList(rowIndex)" class="kt-delete" kendoButton [svgIcon]="apiService.KendoSVGIcon['delete']">
|
||||||
<button type="button" (click)="removeRow(dataItem, rowIndex)" class="kt-delete" kendoButton [svgIcon]="apiService.KendoSVGIcon['delete']">
|
|
||||||
</button>
|
</button>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</kendo-grid-command-column>
|
</kendo-grid-command-column>
|
||||||
<kendo-grid-excel fileName="BonusProcess.xlsx" [fetchData]="allBonusRows"></kendo-grid-excel>
|
<kendo-grid-excel fileName="BonusProcess.xlsx"></kendo-grid-excel>
|
||||||
</kendo-grid>
|
</kendo-grid>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@if (showModal) {
|
@if (showModal) {
|
||||||
<kendo-dialog (close)="onPopUpClose()" [minWidth]="650"
|
<kendo-dialog (close)="onPopUpClose()" [minWidth]="650"
|
||||||
[width]="650">
|
[width]="650">
|
||||||
|
|
@ -220,6 +232,8 @@
|
||||||
</div>
|
</div>
|
||||||
</kendo-dialog>
|
</kendo-dialog>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@if (showBonusUpload) {
|
@if (showBonusUpload) {
|
||||||
<kendo-dialog (close)="onPopUpClose()" [minWidth]="650"
|
<kendo-dialog (close)="onPopUpClose()" [minWidth]="650"
|
||||||
[width]="650">
|
[width]="650">
|
||||||
|
|
@ -238,9 +252,8 @@
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class="col-12" align="right">
|
<div class="col-12" align="right">
|
||||||
<app-loading-panel></app-loading-panel>
|
<app-loading-panel></app-loading-panel>
|
||||||
<!-- the file is checked, read and saved on the server in one go (old handler uploadBonusFile kept) -->
|
<input id="fupEmpPhoto" kendoTextBox title="Upload"
|
||||||
<input id="fupEmpPhoto" kendoTextBox title="Upload" accept=".xlsx,.xls"
|
(change)="uploadBonusFile($event)" type="file">
|
||||||
(change)="uploadBonusFileAndSave($event)" type="file">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
|
|
@ -250,61 +263,3 @@
|
||||||
</div>
|
</div>
|
||||||
</kendo-dialog>
|
</kendo-dialog>
|
||||||
}
|
}
|
||||||
|
|
||||||
<!-- Modify dialog: one employee's bonus and tax, saved on its own (api/Bonus/calculateRowTax, api/Bonus/saveRow) -->
|
|
||||||
@if (showModify && modifyRow) {
|
|
||||||
<div class="blur-background">
|
|
||||||
<kendo-dialog title="Modify Bonus" [width]="520" maxHeight="90vh" (close)="closeModify()"
|
|
||||||
(keydown.escape)="$event.stopPropagation()">
|
|
||||||
<app-loading-panel></app-loading-panel>
|
|
||||||
<div class="grid">
|
|
||||||
<div class="col-4"><label>Employee</label></div>
|
|
||||||
<div class="col-8"><b>{{modifyRow.employee?.employeeNo}} - {{modifyRow.employee?.name}}</b></div>
|
|
||||||
<div class="col-4" style="margin: auto;"><label>Bonus Amount</label></div>
|
|
||||||
<div class="col-8">
|
|
||||||
<kendo-numerictextbox [(ngModel)]="modifyBonusAmount" [ngModelOptions]="{standalone: true}"
|
|
||||||
[min]="0" [autoCorrect]="true" [spinners]="false" [format]="'n2'"
|
|
||||||
(valueChange)="onModifyBonusChange()" style="width: 100%;">
|
|
||||||
</kendo-numerictextbox>
|
|
||||||
</div>
|
|
||||||
<div class="col-4" style="margin: auto;"><label>Calculated tax</label></div>
|
|
||||||
<div class="col-8">
|
|
||||||
<input type="checkbox" kendoCheckBox [(ngModel)]="modifyCalculateTax" [ngModelOptions]="{standalone: true}"
|
|
||||||
(ngModelChange)="onModifyCalculateTaxChange()" />
|
|
||||||
<button type="button" kendoButton themeColor="primary" [svgIcon]="apiService.KendoSVGIcon['check']"
|
|
||||||
[disabled]="!modifyCalculateTax || modifyBusy" (click)="calculateModifyTax()" style="margin-left: 10px;">
|
|
||||||
Calculate
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-4" style="margin: auto;"><label>Tax Amount</label></div>
|
|
||||||
<div class="col-8">
|
|
||||||
<kendo-numerictextbox [(ngModel)]="modifyTaxAmount" [ngModelOptions]="{standalone: true}"
|
|
||||||
[min]="0" [autoCorrect]="true" [spinners]="false" [format]="'n2'"
|
|
||||||
[readonly]="modifyCalculateTax" style="width: 100%;">
|
|
||||||
</kendo-numerictextbox>
|
|
||||||
@if (modifyCalculateTax && !modifyTaxCalculated) {
|
|
||||||
<small>Press Calculate to see the tax. On Save the tax is calculated again for this bonus.</small>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<!-- Edited Tax Amount: the calculated tax lands here, the user may change it; this one is saved (changeTaxAmount) -->
|
|
||||||
@if (modifyCalculateTax) {
|
|
||||||
<div class="col-4" style="margin: auto;"><label>Edited Tax Amount</label></div>
|
|
||||||
<div class="col-8">
|
|
||||||
<kendo-numerictextbox [(ngModel)]="modifyEditedTaxAmount" [ngModelOptions]="{standalone: true}"
|
|
||||||
[min]="0" [autoCorrect]="true" [spinners]="false" [format]="'n2'"
|
|
||||||
[readonly]="!modifyTaxCalculated" style="width: 100%;">
|
|
||||||
</kendo-numerictextbox>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
<div class="col-4"><label>Total</label></div>
|
|
||||||
<div class="col-8"><b>{{ ((modifyBonusAmount || 0) - ((modifyCalculateTax ? modifyEditedTaxAmount : modifyTaxAmount) || 0)) | number:'1.2-2' }}</b></div>
|
|
||||||
</div>
|
|
||||||
<kendo-dialog-actions>
|
|
||||||
<button type="button" kendoButton [svgIcon]="apiService.KendoSVGIcon['cancel']" (click)="closeModify()">Cancel</button>
|
|
||||||
<button type="button" kendoButton themeColor="primary" [svgIcon]="apiService.KendoSVGIcon['save']"
|
|
||||||
[disabled]="modifyBusy" (click)="saveModify()">Save</button>
|
|
||||||
</kendo-dialog-actions>
|
|
||||||
</kendo-dialog>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,9 @@ import {loadingPanelService} from '../../hrm-loding panel/loding.panel.service';
|
||||||
import {PayrollType} from '../../_models/Authentication/payrollType';
|
import {PayrollType} from '../../_models/Authentication/payrollType';
|
||||||
import {Bonus} from '../../_models/Basic/bonus';
|
import {Bonus} from '../../_models/Basic/bonus';
|
||||||
import {Employee} from '../../_models/Employee/employee';
|
import {Employee} from '../../_models/Employee/employee';
|
||||||
import {EmployeeLite} from '../../_models/Employee/employeeLite';
|
|
||||||
import {SearchEmployee} from '../../_models/Employee/searchEmployee';
|
import {SearchEmployee} from '../../_models/Employee/searchEmployee';
|
||||||
import {EnumIncomeTaxItemGroup, EnumStatus, EnumTaxMergeType} from '../../_models/enums';
|
import {EnumIncomeTaxItemGroup, EnumStatus, EnumTaxMergeType} from '../../_models/enums';
|
||||||
import {BonusProcess, BonusProcessDetail} from '../../_models/Payroll/bonusProcess';
|
import {BonusProcess, BonusProcessDetail} from '../../_models/Payroll/bonusProcess';
|
||||||
import {BonusProcessAndSaveRequest, BonusProcessAndSaveResult, BonusProcessGridRow, BonusProcessRowTaxResult, BonusProcessRowRemoveResult} from '../../_models/Payroll/bonusProcessAndSave';
|
|
||||||
import {TaxMergeMaster} from '../../_models/Payroll/Tax/taxMergeMaster';
|
import {TaxMergeMaster} from '../../_models/Payroll/Tax/taxMergeMaster';
|
||||||
import {AuthService} from '../../_services/auth/auth.service';
|
import {AuthService} from '../../_services/auth/auth.service';
|
||||||
import {BasicService} from '../../_services/Basic/basic.service';
|
import {BasicService} from '../../_services/Basic/basic.service';
|
||||||
|
|
@ -67,17 +65,6 @@ export class BonusProcessComponent implements OnInit {
|
||||||
processCompleted: boolean = false;
|
processCompleted: boolean = false;
|
||||||
showBonusUpload: boolean = false;
|
showBonusUpload: boolean = false;
|
||||||
|
|
||||||
// Modify dialog (one saved row at a time)
|
|
||||||
showModify: boolean = false;
|
|
||||||
modifyRow: BonusProcessDetail;
|
|
||||||
modifyBonusAmount: number = 0;
|
|
||||||
modifyTaxAmount: number = 0;
|
|
||||||
// "Edited Tax Amount" (with Calculated tax): starts as the calculated tax, the user may change it; saved as changeTaxAmount
|
|
||||||
modifyEditedTaxAmount: number = 0;
|
|
||||||
modifyCalculateTax: boolean = false;
|
|
||||||
modifyTaxCalculated: boolean = false; // the tax shown was calculated for the bonus shown
|
|
||||||
modifyBusy: boolean = false;
|
|
||||||
|
|
||||||
constructor(public basicService: BasicService, public notificationService: HRMNotificationService,
|
constructor(public basicService: BasicService, public notificationService: HRMNotificationService,
|
||||||
public loadingPanelService: loadingPanelService, public empService: EmployeeServices,
|
public loadingPanelService: loadingPanelService, public empService: EmployeeServices,
|
||||||
public datatransferservice: DataTransferService,
|
public datatransferservice: DataTransferService,
|
||||||
|
|
@ -109,6 +96,7 @@ export class BonusProcessComponent implements OnInit {
|
||||||
() => {
|
() => {
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
this.loadingPanelService.ShowLoadingPanel = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.authSerivce.GetPayrollTypeByLoginID().subscribe(
|
this.authSerivce.GetPayrollTypeByLoginID().subscribe(
|
||||||
(x) => {
|
(x) => {
|
||||||
this.payrollType = x;
|
this.payrollType = x;
|
||||||
|
|
@ -122,14 +110,8 @@ export class BonusProcessComponent implements OnInit {
|
||||||
this.cuttofDate = new Date(this.payrollType.nextPayProcessDate);
|
this.cuttofDate = new Date(this.payrollType.nextPayProcessDate);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public GetSelectedEmployee(searchEmp: SearchEmployee[]) {
|
public GetSelectedEmployee(searchEmp: SearchEmployee[]) {
|
||||||
// the already-processed check needs the bonus: stop here (nothing added to the grid) until one is chosen
|
|
||||||
if (this.selectedbonusID == undefined || this.selectedbonusID <= 0) {
|
|
||||||
const message = 'Please select a Bonus Type first, then select the employees.';
|
|
||||||
this.notificationService.showWarning(message);
|
|
||||||
this.returnMessage = message;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.processCompleted = false;
|
this.processCompleted = false;
|
||||||
this.selectedEmps = searchEmp;
|
this.selectedEmps = searchEmp;
|
||||||
if (this.bonusProcessDetails == undefined) {
|
if (this.bonusProcessDetails == undefined) {
|
||||||
|
|
@ -152,6 +134,7 @@ export class BonusProcessComponent implements OnInit {
|
||||||
this.RefreshDefaultGrid();
|
this.RefreshDefaultGrid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RefreshDefaultGrid() {
|
RefreshDefaultGrid() {
|
||||||
if (this.selectedEmps != undefined && this.bonusProcessDetails != undefined) {
|
if (this.selectedEmps != undefined && this.bonusProcessDetails != undefined) {
|
||||||
if (this.bonusProcess == undefined) {
|
if (this.bonusProcess == undefined) {
|
||||||
|
|
@ -176,7 +159,6 @@ export class BonusProcessComponent implements OnInit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.bonusProcess.bonusProcessDetails = [...this.bonusProcess.bonusProcessDetails];
|
|
||||||
this.RefreshEmployees();
|
this.RefreshEmployees();
|
||||||
if (this.alreadyProcessesList.length > 0) {
|
if (this.alreadyProcessesList.length > 0) {
|
||||||
this.showModal = true;
|
this.showModal = true;
|
||||||
|
|
@ -185,29 +167,37 @@ export class BonusProcessComponent implements OnInit {
|
||||||
}
|
}
|
||||||
RefreshEmployees() {
|
RefreshEmployees() {
|
||||||
if (this.selectedEmps == undefined) return;
|
if (this.selectedEmps == undefined) return;
|
||||||
const empIds: number[] = this.selectedEmps.map(e => e.employeeID);
|
var ids = SearchEmployee.getEmpIds(this.selectedEmps);
|
||||||
var emps: EmployeeLite[];
|
|
||||||
|
const data = {
|
||||||
|
dataList: ids,
|
||||||
|
};
|
||||||
|
var emps: Employee[];
|
||||||
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = true;
|
this.loadingPanelService.ShowLoadingPanel = true;
|
||||||
this.empService.getEmployeeLiteByEmpIDs(empIds).subscribe(
|
this.empService.getEmployeesByEmpIDs(data).subscribe(
|
||||||
(resp: any) => {
|
(resp: any) => {
|
||||||
emps = resp;
|
emps = resp;
|
||||||
},
|
},
|
||||||
(err: any) => {
|
(err: any) => {
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
this.loadingPanelService.ShowLoadingPanel = false;
|
||||||
this.notificationService.showWarning(err.error);
|
this.notificationService.showWarning(err.error);
|
||||||
|
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
this.loadingPanelService.ShowLoadingPanel = false;
|
||||||
emps.forEach(x => {
|
emps.forEach(x => {
|
||||||
let bindex = this.bonusProcess.bonusProcessDetails.findIndex(b => b.employeeID == x.employeeID);
|
let bindex = this.bonusProcess.bonusProcessDetails.findIndex(b => b.employeeID == x.id);
|
||||||
if (bindex != -1) {
|
if (bindex != -1) {
|
||||||
this.bonusProcess.bonusProcessDetails[bindex].employee.isConfirmed = x.isConfirmed;
|
this.bonusProcess.bonusProcessDetails[bindex].employee.isConfirmed = x.isConfirmed;
|
||||||
this.bonusProcess.bonusProcessDetails[bindex].employee.joiningDate = x.joiningDate;
|
this.bonusProcess.bonusProcessDetails[bindex].employee.joiningDate = x.joiningDate;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
checkWithOrTax(from: number, value: boolean) {
|
checkWithOrTax(from: number, value: boolean) {
|
||||||
|
debugger;
|
||||||
if (from == 1) {
|
if (from == 1) {
|
||||||
if (value == true) {
|
if (value == true) {
|
||||||
this.isTaxProcess = false;
|
this.isTaxProcess = false;
|
||||||
|
|
@ -218,38 +208,35 @@ export class BonusProcessComponent implements OnInit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onPopUpClose() {
|
onPopUpClose() {
|
||||||
this.showModal = false;
|
this.showModal = false;
|
||||||
this.showBonusUpload = false;
|
this.showBonusUpload = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
showBonusUploadPopUp() {
|
showBonusUploadPopUp() {
|
||||||
this.showBonusUpload = true;
|
this.showBonusUpload = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentlyProcess($event) {
|
currentlyProcess($event) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
remainingBasic($event) {
|
remainingBasic($event) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
search() {
|
search() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
process() {
|
process() {
|
||||||
if (this.bonusProcess == undefined || this.bonusProcess.bonusProcessDetails.length == 0) {
|
if (this.bonusProcess == undefined || this.bonusProcess.bonusProcessDetails.length == 0) {
|
||||||
this.notificationService.showWarning('Please select employee for the proces');
|
this.notificationService.showWarning('Please select employee for the proces');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Process saves straight to the database, so ask first
|
|
||||||
// tell the user which option the process runs with (the two checkboxes can't both be ticked)
|
|
||||||
const option = this.disburseWithSalary ? 'with Disburse With Salary'
|
|
||||||
: this.isTaxProcess ? 'with Calculate Tax'
|
|
||||||
: 'without Disburse With Salary and Calculate Tax';
|
|
||||||
this.notificationService.showActiveConfirm('Confirmation', 'Are you sure you want to process the bonus ' + option + '?').then((isConfirmed) => {
|
|
||||||
if (isConfirmed)
|
|
||||||
{
|
|
||||||
this.processConfirmed();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// the rest of Process, run only after the user confirmed
|
|
||||||
private processConfirmed() {
|
|
||||||
var isApproved = false;
|
var isApproved = false;
|
||||||
this.loadingPanelService.ShowLoadingPanel = true;
|
this.loadingPanelService.ShowLoadingPanel = true;
|
||||||
this.bonusService.IsBonusApproved(this.selectedbonusID, this.payrollType.nextPayProcessDate).subscribe(
|
this.bonusService.IsBonusApproved(this.selectedbonusID, this.payrollType.nextPayProcessDate).subscribe(
|
||||||
|
|
@ -268,289 +255,58 @@ export class BonusProcessComponent implements OnInit {
|
||||||
this.returnMessage = 'selected Bonus is already process and Approved';
|
this.returnMessage = 'selected Bonus is already process and Approved';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Process = calculate + save on the server in one request (no separate Save step).
|
|
||||||
// Only the header and the employee IDs are sent; the saved rows come back from the database.
|
|
||||||
const request: BonusProcessAndSaveRequest = {
|
var returnID: number;
|
||||||
bonusID: this.selectedbonusID,
|
this.processRequest = [];
|
||||||
basicMonth: this.basicDate,
|
var index: number = 0;
|
||||||
payDate: this.payDate,
|
this.bonusProcess.bonusProcessDetails.forEach(x => {
|
||||||
cuttOfDate: this.cuttofDate,
|
|
||||||
currProcess: this.processFor,
|
this.processRequest.push({
|
||||||
isDisburseWithSalary: this.disburseWithSalary,
|
'bonusid': this.selectedbonusID,
|
||||||
isTaxProcess: this.isTaxProcess,
|
'basicMonth': this.basicDate,
|
||||||
employeeIDs: this.bonusProcess.bonusProcessDetails.map(x => x.employeeID),
|
'payDate': this.payDate,
|
||||||
};
|
'cuttOfDate': this.cuttofDate,
|
||||||
var result: BonusProcessAndSaveResult;
|
'currProcess': this.processFor,
|
||||||
|
'isDisburseWithSalary': this.disburseWithSalary,
|
||||||
|
'isTaxProcess': this.isTaxProcess,
|
||||||
|
'empid': x.employeeID
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
this.errorOrSucessList = [];
|
this.errorOrSucessList = [];
|
||||||
this.bonusService.processAndSave(request).subscribe(
|
this.bonusService.BonusProcess(this.processRequest).subscribe(
|
||||||
(resp: BonusProcessAndSaveResult) => {
|
(resp: any) => {
|
||||||
result = resp;
|
this.bonusProcess = resp;
|
||||||
},
|
},
|
||||||
(err: any) => {
|
(err: any) => {
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
this.loadingPanelService.ShowLoadingPanel = false;
|
||||||
const message = (typeof err?.error === 'string' && err.error) ? err.error
|
this.notificationService.showWarning(err.error);
|
||||||
: 'Bonus process failed. Please check the connection and try again.';
|
this.returnMessage = err.error;
|
||||||
this.notificationService.showWarning(message);
|
|
||||||
this.returnMessage = message;
|
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
this.bonusProcess = new BonusProcess();
|
|
||||||
this.bonusProcess.id = result?.bonusProcessID;
|
|
||||||
// kept so the grid knows how this process was saved (Modify is hidden for Disburse With Salary)
|
|
||||||
this.bonusProcess.isDisburseWithSalary = request.isDisburseWithSalary;
|
|
||||||
this.bonusProcess.bonusProcessDetails = (result?.rows ?? []).map(r => this.toGridDetail(r));
|
|
||||||
// the already-processed list changed: read it again on the next employee selection
|
|
||||||
this.bonusProcessDetails = undefined;
|
|
||||||
this.alreadyProcessesList = [];
|
|
||||||
this.processCompleted = true;
|
this.processCompleted = true;
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
this.loadingPanelService.ShowLoadingPanel = false;
|
||||||
this.pbuttonEnalble = false;
|
this.pbuttonEnalble = false;
|
||||||
const skipped = result?.alreadyProcessedEmployeeIDs?.length ?? 0;
|
this.notificationService.showSuccess('Bonus processed successfully');
|
||||||
const message = 'Bonus processed and saved successfully'
|
this.returnMessage = 'Bonus processed successfully';
|
||||||
+ (skipped > 0 ? ' (' + skipped + ' already processed employee(s) left out)' : '');
|
|
||||||
this.notificationService.showSuccess(message);
|
|
||||||
this.returnMessage = message;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
|
||||||
// ---- Upload Data: check every input, then the server reads the file, calculates the tax (when asked)
|
|
||||||
// and saves, in one request (api/dataUpload/uploadBonusFileAndSave). The old uploadBonusFile is kept. ----
|
|
||||||
uploadBonusFileAndSave(event: any): void {
|
|
||||||
const input: HTMLInputElement = event?.target;
|
|
||||||
const file: File | null = input?.files && input.files.length > 0 ? input.files.item(0) : null;
|
|
||||||
const clearInput = () => { if (input) input.value = ''; }; // so the same file can be chosen again
|
|
||||||
|
|
||||||
const problems: string[] = [];
|
|
||||||
if (this.selectedbonusID == undefined || this.selectedbonusID <= 0) problems.push('Bonus Type');
|
|
||||||
if (this.basicDate == undefined) problems.push('Consider Basic Of');
|
|
||||||
if (this.payDate == undefined) problems.push('Pay Date');
|
|
||||||
if (this.cuttofDate == undefined) problems.push('Bonus Cut Off Date');
|
|
||||||
if (this.processFor == undefined || this.processFor <= 0) problems.push('Currently Process For Basic (must be greater than 0)');
|
|
||||||
if (this.payrollType == undefined) problems.push('Payroll type (please reload the page)');
|
|
||||||
if (problems.length > 0) {
|
|
||||||
this.notificationService.showWarning('Please give: ' + problems.join(', '));
|
|
||||||
clearInput();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (file == null) {
|
|
||||||
this.notificationService.showWarning('please select a file');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const name = (file.name || '').toLowerCase();
|
|
||||||
if (!name.endsWith('.xlsx') && !name.endsWith('.xls')) {
|
|
||||||
this.notificationService.showWarning('Please select an Excel file (.xlsx or .xls)');
|
|
||||||
clearInput();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const header: BonusProcessAndSaveRequest = {
|
|
||||||
bonusID: this.selectedbonusID,
|
|
||||||
basicMonth: this.basicDate,
|
|
||||||
payDate: this.payDate,
|
|
||||||
cuttOfDate: this.cuttofDate,
|
|
||||||
currProcess: this.processFor,
|
|
||||||
isDisburseWithSalary: this.disburseWithSalary,
|
|
||||||
isTaxProcess: this.isTaxProcess,
|
|
||||||
employeeIDs: [],
|
|
||||||
};
|
|
||||||
var isApproved = false;
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = true;
|
|
||||||
this.bonusService.IsBonusApproved(this.selectedbonusID, this.payrollType.nextPayProcessDate).subscribe(
|
|
||||||
(resp: any) => {
|
|
||||||
isApproved = resp;
|
|
||||||
},
|
|
||||||
(err: any) => {
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
|
||||||
this.notificationService.showWarning(this.errorText(err, 'Could not check the bonus. Please try again.'));
|
|
||||||
clearInput();
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
if (isApproved == true) {
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
|
||||||
this.notificationService.showWarning('selected Bonus is already process and Approved');
|
|
||||||
this.returnMessage = 'selected Bonus is already process and Approved';
|
|
||||||
clearInput();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var result: BonusProcessAndSaveResult;
|
|
||||||
this.dataUploadService.uploadBonusFileAndSave(file, header).subscribe(
|
|
||||||
(resp: BonusProcessAndSaveResult) => {
|
|
||||||
result = resp;
|
|
||||||
},
|
|
||||||
(err: any) => {
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
|
||||||
const message = this.errorText(err, 'Upload failed. Please check the connection and try again.');
|
|
||||||
this.notificationService.showWarning(message);
|
|
||||||
this.returnMessage = message;
|
|
||||||
clearInput();
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
this.bonusProcess = new BonusProcess();
|
|
||||||
this.bonusProcess.id = result?.bonusProcessID;
|
|
||||||
// kept so the grid knows how this process was saved (Modify is hidden for Disburse With Salary)
|
|
||||||
this.bonusProcess.isDisburseWithSalary = header.isDisburseWithSalary;
|
|
||||||
this.bonusProcess.bonusProcessDetails = (result?.rows ?? []).map(r => this.toGridDetail(r));
|
|
||||||
// the already-processed list changed: read it again on the next employee selection
|
|
||||||
this.bonusProcessDetails = undefined;
|
|
||||||
this.alreadyProcessesList = [];
|
|
||||||
this.processCompleted = true;
|
|
||||||
this.showBonusUpload = false;
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
|
||||||
const skipped = result?.alreadyProcessedEmployeeIDs?.length ?? 0;
|
|
||||||
const message = 'Bonus uploaded and saved successfully (' + (result?.rows?.length ?? 0) + ' employee(s))'
|
|
||||||
+ (skipped > 0 ? '; ' + skipped + ' already processed employee(s) left out' : '');
|
|
||||||
this.notificationService.showSuccess(message);
|
|
||||||
this.returnMessage = message;
|
|
||||||
clearInput();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// ---- Modify dialog: one saved row at a time (api/Bonus/calculateRowTax, api/Bonus/saveRow) ----
|
|
||||||
openModify(row: BonusProcessDetail) {
|
|
||||||
if (row == undefined || !row.bonusProcessDetailID) {
|
|
||||||
this.notificationService.showWarning('Please process the Bonus first');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.modifyRow = row;
|
|
||||||
this.modifyBonusAmount = row.changeBonusAmount ?? 0;
|
|
||||||
this.modifyCalculateTax = this.isTaxProcess == true;
|
|
||||||
// with Calculated tax: Tax Amount = the system's tax (taxAmount), Edited Tax Amount = the saved one (changeTaxAmount);
|
|
||||||
// without it the Tax Amount field is typed in as before and starts at the saved tax
|
|
||||||
this.modifyTaxAmount = this.modifyCalculateTax ? (row.taxAmount ?? 0) : (row.changeTaxAmount ?? 0);
|
|
||||||
this.modifyEditedTaxAmount = row.changeTaxAmount ?? 0;
|
|
||||||
this.modifyTaxCalculated = true; // the saved tax belongs to the saved bonus
|
|
||||||
this.modifyBusy = false;
|
|
||||||
this.showModify = true;
|
|
||||||
}
|
|
||||||
closeModify() {
|
|
||||||
this.showModify = false;
|
|
||||||
this.modifyRow = undefined;
|
|
||||||
this.modifyBusy = false;
|
|
||||||
}
|
|
||||||
onModifyBonusChange() {
|
|
||||||
// the tax shown no longer matches the bonus until Calculate is pressed again
|
|
||||||
if (this.modifyCalculateTax) this.modifyTaxCalculated = false;
|
|
||||||
}
|
|
||||||
onModifyCalculateTaxChange() {
|
|
||||||
if (this.modifyCalculateTax) this.modifyTaxCalculated = false;
|
|
||||||
}
|
|
||||||
private errorText(err: any, fallback: string): string {
|
|
||||||
return (typeof err?.error === 'string' && err.error) ? err.error : fallback;
|
|
||||||
}
|
|
||||||
calculateModifyTax() {
|
|
||||||
if (this.modifyRow == undefined) return;
|
|
||||||
if (this.modifyBonusAmount == undefined || this.modifyBonusAmount < 0) {
|
|
||||||
this.notificationService.showWarning('Please enter a valid bonus amount');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.modifyBusy = true;
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = true;
|
|
||||||
this.bonusService.calculateRowTax({
|
|
||||||
bonusProcessDetailID: this.modifyRow.bonusProcessDetailID,
|
|
||||||
bonusAmount: this.modifyBonusAmount,
|
|
||||||
}).subscribe(
|
|
||||||
(resp: BonusProcessRowTaxResult) => {
|
|
||||||
this.modifyTaxAmount = resp?.taxAmount ?? 0;
|
|
||||||
// the user sees the new tax in Edited Tax Amount and may change it before Save
|
|
||||||
this.modifyEditedTaxAmount = this.modifyTaxAmount;
|
|
||||||
this.modifyTaxCalculated = true;
|
|
||||||
},
|
|
||||||
(err: any) => {
|
|
||||||
this.modifyBusy = false;
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
|
||||||
this.notificationService.showWarning(this.errorText(err, 'Tax calculation failed. Please try again.'));
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
this.modifyBusy = false;
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
saveModify() {
|
|
||||||
if (this.modifyRow == undefined) return;
|
|
||||||
if (this.modifyBonusAmount == undefined || this.modifyBonusAmount < 0) {
|
|
||||||
this.notificationService.showWarning('Please enter a valid bonus amount');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!this.modifyCalculateTax && (this.modifyTaxAmount == undefined || this.modifyTaxAmount < 0)) {
|
|
||||||
this.notificationService.showWarning('Please enter a valid tax amount');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (this.modifyCalculateTax && !this.modifyTaxCalculated) {
|
|
||||||
// the Edited Tax Amount must be chosen against the tax of THIS bonus amount
|
|
||||||
this.notificationService.showWarning('Please press Calculate first, then check the Edited Tax Amount');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (this.modifyCalculateTax && (this.modifyEditedTaxAmount == undefined || this.modifyEditedTaxAmount < 0)) {
|
|
||||||
this.notificationService.showWarning('Please enter a valid edited tax amount');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const row = this.modifyRow;
|
|
||||||
var saved: BonusProcessGridRow;
|
|
||||||
this.modifyBusy = true;
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = true;
|
|
||||||
this.bonusService.saveRow({
|
|
||||||
bonusProcessDetailID: row.bonusProcessDetailID,
|
|
||||||
bonusAmount: this.modifyBonusAmount,
|
|
||||||
taxAmount: this.modifyTaxAmount ?? 0,
|
|
||||||
calculateTax: this.modifyCalculateTax == true,
|
|
||||||
editedTaxAmount: this.modifyCalculateTax == true ? (this.modifyEditedTaxAmount ?? 0) : undefined,
|
|
||||||
}).subscribe(
|
|
||||||
(resp: BonusProcessGridRow) => {
|
|
||||||
saved = resp;
|
|
||||||
},
|
|
||||||
(err: any) => {
|
|
||||||
this.modifyBusy = false;
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
|
||||||
this.notificationService.showWarning(this.errorText(err, 'Save failed. Please try again.'));
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
this.modifyBusy = false;
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
|
||||||
if (saved != undefined) {
|
|
||||||
// only this row changes in the grid, with what the database now holds
|
|
||||||
const updated = this.toGridDetail(saved);
|
|
||||||
row.changeBonusAmount = updated.changeBonusAmount;
|
|
||||||
row.changeTaxAmount = updated.changeTaxAmount;
|
|
||||||
row.taxAmount = updated.taxAmount;
|
|
||||||
row.bonusAmount = updated.bonusAmount;
|
|
||||||
row.basicSalary = updated.basicSalary;
|
|
||||||
row.employee = updated.employee;
|
|
||||||
}
|
|
||||||
this.notificationService.showSuccess('Bonus saved for ' + (row.employee?.employeeNo ?? 'the employee'));
|
|
||||||
this.closeModify();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// a saved row from processAndSave, in the shape the grid binds to (dataItem.employee.*, changeBonusAmount, ...)
|
|
||||||
private toGridDetail(r: BonusProcessGridRow): BonusProcessDetail {
|
|
||||||
const item: BonusProcessDetail = new BonusProcessDetail();
|
|
||||||
item.bonusProcessDetailID = r.bonusProcessDetailID;
|
|
||||||
item.bonusProcessID = r.bonusProcessID;
|
|
||||||
item.bonusID = r.bonusID;
|
|
||||||
item.employeeID = r.employeeID;
|
|
||||||
item.basicSalary = r.basicSalary;
|
|
||||||
item.bonusAmount = r.bonusAmount;
|
|
||||||
item.changeBonusAmount = r.changeBonusAmount;
|
|
||||||
item.taxAmount = r.taxAmount;
|
|
||||||
item.changeTaxAmount = r.changeTaxAmount;
|
|
||||||
item.employee = new Employee();
|
|
||||||
item.employee.id = r.employeeID;
|
|
||||||
item.employee.employeeID = r.employeeID;
|
|
||||||
item.employee.employeeNo = r.employeeNo;
|
|
||||||
item.employee.name = r.name;
|
|
||||||
item.employee.joiningDate = r.joiningDate;
|
|
||||||
item.employee.isConfirmed = r.isConfirmed;
|
|
||||||
item.employee.grossSalary = r.grossSalary;
|
|
||||||
item.employee.basicSalary = r.basicSalary;
|
|
||||||
return item;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BonusvalueChange(value: any): void {
|
public BonusvalueChange(value: any): void {
|
||||||
this.alreadyProcessesList = [];
|
this.alreadyProcessesList = [];
|
||||||
this.bonusProcess = new BonusProcess();
|
this.bonusProcess = new BonusProcess();
|
||||||
this.bonusProcess.bonusProcessDetails = [];
|
this.bonusProcess.bonusProcessDetails = [];
|
||||||
this.selectedEmps = [];
|
this.selectedEmps = [];
|
||||||
this.processCompleted = false;
|
this.processCompleted = false;
|
||||||
this.pbuttonEnalble = false;
|
this.pbuttonEnalble = false;
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
||||||
TaxRecalculate() {
|
TaxRecalculate() {
|
||||||
this.loadingPanelService.ShowLoadingPanel = true;
|
this.loadingPanelService.ShowLoadingPanel = true;
|
||||||
|
|
||||||
|
|
@ -573,9 +329,13 @@ export class BonusProcessComponent implements OnInit {
|
||||||
this.pbuttonEnalble = false;
|
this.pbuttonEnalble = false;
|
||||||
this.notificationService.showSuccess('Tax Recalculated processed successfully');
|
this.notificationService.showSuccess('Tax Recalculated processed successfully');
|
||||||
this.returnMessage = 'Tax Recalculated processed successfully';
|
this.returnMessage = 'Tax Recalculated processed successfully';
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadBonusFile(event: any): void {
|
uploadBonusFile(event: any): void {
|
||||||
|
debugger;
|
||||||
let tempResponse: any;
|
let tempResponse: any;
|
||||||
this.selectedFiles = event.target.files;
|
this.selectedFiles = event.target.files;
|
||||||
if (this.selectedFiles.length > 0) {
|
if (this.selectedFiles.length > 0) {
|
||||||
|
|
@ -621,28 +381,41 @@ export class BonusProcessComponent implements OnInit {
|
||||||
this.notificationService.showWarning('please select a file');
|
this.notificationService.showWarning('please select a file');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
edit() {
|
edit() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clearAll() {
|
clearAll() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
remove() {
|
remove() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
if (this.processCompleted == false) {
|
if (this.processCompleted == false) {
|
||||||
this.notificationService.showWarning('Please process the Bonus first');
|
this.notificationService.showWarning('Please process the Bonus first');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this.bonusProcess == undefined || this.bonusProcess?.bonusProcessDetails.length == 0) {
|
if (this.bonusProcess == undefined || this.bonusProcess?.bonusProcessDetails.length == 0) {
|
||||||
this.notificationService.showWarning('There are no data to save');
|
this.notificationService.showWarning('There are no data to save');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isTaxProcess == true && (this.bonusProcess.bonusProcessDetails[0].incomeTaxcoll == undefined
|
if (this.isTaxProcess == true && (this.bonusProcess.bonusProcessDetails[0].incomeTaxcoll == undefined
|
||||||
|| this.bonusProcess.bonusProcessDetails[0].incomeTaxcoll.length == 0)) {
|
|| this.bonusProcess.bonusProcessDetails[0].incomeTaxcoll.length == 0)) {
|
||||||
this.notificationService.showWarning('Tax Calculation not yet done');
|
this.notificationService.showWarning('Tax Calculation not yet done');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isTaxProcess == true) {
|
if (this.isTaxProcess == true) {
|
||||||
var mitem: TaxMergeMaster = undefined;
|
var mitem: TaxMergeMaster = undefined;
|
||||||
this.taxService.getTaxMergeMaster(EnumTaxMergeType.Bonus, this.selectedbonusID).subscribe(
|
this.taxService.getTaxMergeMaster(EnumTaxMergeType.Bonus, this.selectedbonusID).subscribe(
|
||||||
|
|
@ -656,14 +429,18 @@ export class BonusProcessComponent implements OnInit {
|
||||||
() => {
|
() => {
|
||||||
if (mitem != undefined) {
|
if (mitem != undefined) {
|
||||||
console.log(mitem);
|
console.log(mitem);
|
||||||
|
|
||||||
this.bonusProcess.bonusProcessDetails.every(x => {
|
this.bonusProcess.bonusProcessDetails.every(x => {
|
||||||
|
//console.log(x.incomeTaxcoll);
|
||||||
var item = x.incomeTaxcoll.find(y => y.itemGroup == mitem.itemGroup && y.itemID == mitem.itemID);
|
var item = x.incomeTaxcoll.find(y => y.itemGroup == mitem.itemGroup && y.itemID == mitem.itemID);
|
||||||
if (item != undefined) {
|
if (item != undefined) {
|
||||||
item.thisMonthAmount = x.changeBonusAmount;
|
item.thisMonthAmount = x.changeBonusAmount;
|
||||||
} else {
|
} else {
|
||||||
this.notificationService.showWarning('Income tax amount not found in the collection');
|
this.notificationService.showWarning('Income tax amount not found in the collection');
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
item = x.incomeTaxcoll.find(y => y.itemGroup == EnumIncomeTaxItemGroup.Tax_Deducted);
|
item = x.incomeTaxcoll.find(y => y.itemGroup == EnumIncomeTaxItemGroup.Tax_Deducted);
|
||||||
if (item != undefined) {
|
if (item != undefined) {
|
||||||
item.thisMonthAmount = x.changeTaxAmount;
|
item.thisMonthAmount = x.changeTaxAmount;
|
||||||
|
|
@ -676,116 +453,17 @@ export class BonusProcessComponent implements OnInit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.saveData();
|
this.saveData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
private logSavePayloadSize() {
|
|
||||||
try {
|
|
||||||
const enc = new TextEncoder();
|
|
||||||
const bytes = (v: any): number => { const s = JSON.stringify(v); return s === undefined ? 0 : enc.encode(s).length; };
|
|
||||||
const MB = (b: number) => (b / 1024 / 1024).toFixed(2) + ' MB';
|
|
||||||
const KB = (b: number) => (b / 1024).toFixed(2) + ' KB';
|
|
||||||
const LIMIT = 30000000; // IIS / ASP.NET Core default request body limit (bytes)
|
|
||||||
|
|
||||||
// size of every field over a list of objects (bytes of "key":value, per field), biggest first
|
|
||||||
const fieldTable = (objs: any[], total: number, top = 999) => {
|
|
||||||
const sum: { [k: string]: { b: number, nulls: number, objs: number } } = {};
|
|
||||||
objs.forEach(o => {
|
|
||||||
if (o == null || typeof o !== 'object') return;
|
|
||||||
Object.keys(o).forEach(k => {
|
|
||||||
const v = o[k];
|
|
||||||
const e = sum[k] || (sum[k] = { b: 0, nulls: 0, objs: 0 });
|
|
||||||
if (v === undefined) return;
|
|
||||||
e.b += enc.encode(JSON.stringify(k)).length + 2 + bytes(v);
|
|
||||||
if (v === null) e.nulls++;
|
|
||||||
else if (typeof v === 'object') e.objs++;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return Object.keys(sum)
|
|
||||||
.map(k => ({ field: k, size: MB(sum[k].b), percent: (total ? (sum[k].b * 100 / total) : 0).toFixed(1) + '%', nullRows: sum[k].nulls, objectRows: sum[k].objs, _b: sum[k].b }))
|
|
||||||
.sort((a, b) => b._b - a._b)
|
|
||||||
.slice(0, top)
|
|
||||||
.map(({ _b, ...r }) => r);
|
|
||||||
};
|
|
||||||
const stats = (counts: number[]) => {
|
|
||||||
if (counts.length == 0) return { total: 0, min: 0, max: 0, avg: '0' };
|
|
||||||
let total = 0, min = counts[0], max = counts[0];
|
|
||||||
counts.forEach(c => { total += c; if (c < min) min = c; if (c > max) max = c; });
|
|
||||||
return { total, min, max, avg: (total / counts.length).toFixed(1) };
|
|
||||||
};
|
|
||||||
|
|
||||||
const d: any[] = this.bonusProcess?.bonusProcessDetails ?? [];
|
|
||||||
|
|
||||||
// 1. Overview
|
|
||||||
const t0 = performance.now();
|
|
||||||
const totalBytes = bytes(this.bonusProcess);
|
|
||||||
const stringifyMs = Math.round(performance.now() - t0);
|
|
||||||
const header = { ...this.bonusProcess, bonusProcessDetails: undefined };
|
|
||||||
console.log('%c[SAVE SIZE] 1. Overview', 'font-weight:bold');
|
|
||||||
console.table({
|
|
||||||
rows: d.length,
|
|
||||||
totalRequest: MB(totalBytes),
|
|
||||||
serverLimit: MB(LIMIT),
|
|
||||||
overLimitBy: totalBytes > LIMIT ? MB(totalBytes - LIMIT) + ' (' + (totalBytes / LIMIT).toFixed(1) + 'x the limit)' : 'within the limit',
|
|
||||||
header_withoutDetails: KB(bytes(header)),
|
|
||||||
averagePerRow: d.length ? KB(totalBytes / d.length) : '0',
|
|
||||||
jsonStringifyTime: stringifyMs + ' ms',
|
|
||||||
});
|
|
||||||
|
|
||||||
// 2. Every field of a BonusProcessDetail (employee / bonus / incomeTaxcoll are fields too)
|
|
||||||
console.log('%c[SAVE SIZE] 2. Fields of each detail row (all rows together)', 'font-weight:bold');
|
|
||||||
console.table(fieldTable(d, totalBytes));
|
|
||||||
|
|
||||||
// 3. employee
|
|
||||||
const emps = d.map(x => x.employee).filter(x => x != null);
|
|
||||||
const empBytes = bytes(emps);
|
|
||||||
console.log('%c[SAVE SIZE] 3. employee — ' + MB(empBytes) + ', ' + emps.length + ' objects, ' + new Set(emps).size + ' distinct; top 25 fields', 'font-weight:bold');
|
|
||||||
console.table(fieldTable(emps, empBytes, 25));
|
|
||||||
|
|
||||||
// 4. bonus
|
|
||||||
const bonuses = d.map(x => x.bonus).filter(x => x != null);
|
|
||||||
const bonusBytes = bytes(bonuses);
|
|
||||||
console.log('%c[SAVE SIZE] 4. bonus — ' + MB(bonusBytes) + ', ' + bonuses.length + ' objects, ' + new Set(bonuses).size
|
|
||||||
+ ' distinct (' + new Set(bonuses.map(b => b?.id)).size + ' distinct ids); one copy = ' + KB(bytes(bonuses[0])), 'font-weight:bold');
|
|
||||||
if (bonuses.length) console.table(fieldTable(bonuses, bonusBytes, 25));
|
|
||||||
|
|
||||||
// 5. incomeTaxcoll
|
|
||||||
const taxCounts = d.map(x => (x.incomeTaxcoll ?? []).length);
|
|
||||||
const taxItems = ([] as any[]).concat(...d.map(x => x.incomeTaxcoll ?? []));
|
|
||||||
const taxBytes = bytes(taxItems);
|
|
||||||
console.log('%c[SAVE SIZE] 5. incomeTaxcoll — ' + MB(taxBytes) + '; items per row:', 'font-weight:bold', stats(taxCounts),
|
|
||||||
'; rows with no items:', taxCounts.filter(c => c == 0).length, '; one item ≈', taxItems.length ? (taxBytes / taxItems.length).toFixed(0) + ' bytes' : '-');
|
|
||||||
if (taxItems.length) console.table(fieldTable(taxItems, taxBytes));
|
|
||||||
|
|
||||||
// 6. bonusEmpCostCenters
|
|
||||||
const ccCounts = d.map(x => (x.bonusEmpCostCenters ?? []).length);
|
|
||||||
const ccItems = ([] as any[]).concat(...d.map(x => x.bonusEmpCostCenters ?? []));
|
|
||||||
console.log('%c[SAVE SIZE] 6. bonusEmpCostCenters — ' + MB(bytes(ccItems)) + '; items per row:', 'font-weight:bold', stats(ccCounts));
|
|
||||||
|
|
||||||
// 7. What the server actually saves: BonusProcessDA.Insert (detail) + IncomeTaxService.SaveBulk (tax)
|
|
||||||
const pick = (o: any, keys: string[]) => { const r: any = {}; keys.forEach(k => { if (o?.[k] !== undefined) r[k] = o[k]; }); return r; };
|
|
||||||
const detailKeys = ['employeeID', 'bonusID', 'bonusMonth', 'bonusAmount', 'grossSalary', 'basicSalary', 'changeBonusAmount', 'changeTaxAmount',
|
|
||||||
'changeAdjustAmount', 'changeSalaryItemAmount', 'calculatedAdjustAmount', 'calculatedSalaryItemAmount', 'taxAmount'];
|
|
||||||
const taxKeys = ['employeeID', 'itemGroup', 'itemID', 'description', 'totalAmount', 'previousAmount', 'thisMonthAmount', 'projectedAmount',
|
|
||||||
'side', 'position', 'isChanged', 'taxParameterID'];
|
|
||||||
const minimal = {
|
|
||||||
...header,
|
|
||||||
bonusProcessDetails: d.map(x => ({ ...pick(x, detailKeys), incomeTaxcoll: (x.incomeTaxcoll ?? []).map((t: any) => pick(t, taxKeys)) })),
|
|
||||||
};
|
|
||||||
const minimalBytes = bytes(minimal);
|
|
||||||
console.log('%c[SAVE SIZE] 7. Only the fields the server saves', 'font-weight:bold');
|
|
||||||
console.table({
|
|
||||||
minimalRequest: MB(minimalBytes),
|
|
||||||
ofWhichTax: MB(bytes(minimal.bonusProcessDetails.map(x => x.incomeTaxcoll))),
|
|
||||||
smallerBy: minimalBytes ? (totalBytes / minimalBytes).toFixed(1) + 'x' : '-',
|
|
||||||
fitsInLimit: minimalBytes <= LIMIT ? 'yes' : 'NO',
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
console.log('[SAVE SIZE] could not measure:', e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
saveData() {
|
saveData() {
|
||||||
|
debugger;
|
||||||
this.loadingPanelService.ShowLoadingPanel = true;
|
this.loadingPanelService.ShowLoadingPanel = true;
|
||||||
this.bonusProcess.disburseDate = this.payDate;
|
this.bonusProcess.disburseDate = this.payDate;
|
||||||
this.bonusProcess.isTaxProcess = this.isTaxProcess;
|
this.bonusProcess.isTaxProcess = this.isTaxProcess;
|
||||||
|
|
@ -810,52 +488,8 @@ export class BonusProcessComponent implements OnInit {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
clearTax() {
|
clearTax() {
|
||||||
this.notificationService.showActiveConfirm('Confirmation', "Are you sure you want to clear the tax?").then((isConfirmed) => {
|
|
||||||
if (isConfirmed)
|
|
||||||
{
|
|
||||||
this.clearTaxConfirmed();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
clearTaxAndSave() {
|
|
||||||
const bonusProcessID = this.bonusProcess?.id;
|
|
||||||
if (bonusProcessID == undefined || bonusProcessID <= 0
|
|
||||||
|| !(this.bonusProcess.bonusProcessDetails ?? []).some(x => x.bonusProcessDetailID)) {
|
|
||||||
this.notificationService.showWarning('Please process the bonus first, then clear the tax.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.notificationService.showActiveConfirm('Confirmation', "Are you sure you want to clear the tax?").then((isConfirmed) => {
|
|
||||||
if (isConfirmed)
|
|
||||||
{
|
|
||||||
this.clearTaxAndSaveConfirmed(bonusProcessID);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
private clearTaxAndSaveConfirmed(bonusProcessID: number) {
|
|
||||||
var rows: BonusProcessGridRow[];
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = true;
|
|
||||||
this.bonusService.clearTaxAndSave(bonusProcessID).subscribe(
|
|
||||||
(resp: BonusProcessGridRow[]) => {
|
|
||||||
rows = resp;
|
|
||||||
},
|
|
||||||
(err: any) => {
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
|
||||||
const message = this.errorText(err, 'Clear tax failed. Please check the connection and try again.');
|
|
||||||
this.notificationService.showWarning(message);
|
|
||||||
this.returnMessage = message;
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
// the saved rows, read back from the database (new array, so the virtual grid re-reads it)
|
|
||||||
this.bonusProcess.bonusProcessDetails = (rows ?? []).map(r => this.toGridDetail(r));
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
|
||||||
const message = 'Tax cleared and saved successfully';
|
|
||||||
this.notificationService.showSuccess(message);
|
|
||||||
this.returnMessage = message;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// the old Clear Tax body, run only after the user confirmed
|
|
||||||
private clearTaxConfirmed() {
|
|
||||||
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = true;
|
this.loadingPanelService.ShowLoadingPanel = true;
|
||||||
|
|
||||||
|
|
@ -864,72 +498,28 @@ export class BonusProcessComponent implements OnInit {
|
||||||
});
|
});
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
this.loadingPanelService.ShowLoadingPanel = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo() {
|
undo() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadData() {
|
uploadData() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
removefromList(rowIndex: number) {
|
removefromList(rowIndex: number) {
|
||||||
this.bonusProcess.bonusProcessDetails.splice(rowIndex, 1);
|
this.bonusProcess.bonusProcessDetails.splice(rowIndex, 1);
|
||||||
// new array reference so the (virtual) grid re-reads it
|
|
||||||
this.bonusProcess.bonusProcessDetails = [...this.bonusProcess.bonusProcessDetails];
|
|
||||||
}
|
}
|
||||||
// ---- Remove button: a row not saved yet is only taken off the grid (removefromList, as before); a saved
|
|
||||||
// row (after Process / Upload) is deleted from the database at once (api/Bonus/removeRow). ----
|
|
||||||
removeRow(dataItem: BonusProcessDetail, rowIndex: number) {
|
|
||||||
if (!dataItem?.bonusProcessDetailID) {
|
|
||||||
this.removefromList(rowIndex);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const who = (dataItem.employee?.employeeNo ? dataItem.employee.employeeNo + ' - ' : '') + (dataItem.employee?.name ?? '');
|
|
||||||
this.notificationService.showActiveConfirm('Confirmation',
|
|
||||||
'Are you sure you want to remove ' + who + '? The saved bonus of this employee will be deleted.').then((isConfirmed) => {
|
|
||||||
if (isConfirmed)
|
|
||||||
{
|
|
||||||
this.removeRowConfirmed(dataItem);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
private removeRowConfirmed(dataItem: BonusProcessDetail) {
|
|
||||||
var result: BonusProcessRowRemoveResult;
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = true;
|
|
||||||
this.bonusService.removeRow(dataItem.bonusProcessDetailID).subscribe(
|
|
||||||
(resp: BonusProcessRowRemoveResult) => {
|
|
||||||
result = resp;
|
|
||||||
},
|
|
||||||
(err: any) => {
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
|
||||||
const message = this.errorText(err, 'Remove failed. Please check the connection and try again.');
|
|
||||||
this.notificationService.showWarning(message);
|
|
||||||
this.returnMessage = message;
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
// take that row off the grid (new array, so the virtual grid re-reads it)
|
|
||||||
this.bonusProcess.bonusProcessDetails = this.bonusProcess.bonusProcessDetails
|
|
||||||
.filter(x => x.bonusProcessDetailID !== dataItem.bonusProcessDetailID);
|
|
||||||
// the already-processed list changed: read it again on the next employee selection
|
|
||||||
this.bonusProcessDetails = undefined;
|
|
||||||
let message = 'Employee removed successfully';
|
|
||||||
if (result?.processDeleted) {
|
|
||||||
// that was the last employee: the bonus process itself is gone
|
|
||||||
this.bonusProcess.id = undefined;
|
|
||||||
message = 'Last employee removed, so the bonus process was deleted too';
|
|
||||||
}
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
|
||||||
this.notificationService.showSuccess(message);
|
|
||||||
this.returnMessage = message;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// Excel export: every row, not only the rows the virtual grid has on screen
|
|
||||||
public allBonusRows = (): any => {
|
|
||||||
const rows = this.bonusProcess?.bonusProcessDetails ?? [];
|
|
||||||
return { data: rows, total: rows.length };
|
|
||||||
};
|
|
||||||
removeHandler({dataItem}) {
|
removeHandler({dataItem}) {
|
||||||
console.log(dataItem);
|
console.log(dataItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
editHandler({dataItem}) {
|
editHandler({dataItem}) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
addHandler() {
|
addHandler() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,186 +2,8 @@ kendo-numerictextbox{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* .checkBoxGrid.grid {
|
.checkBoxGrid.grid {
|
||||||
justify-content: space-evenly;
|
justify-content: space-evenly;
|
||||||
} */
|
|
||||||
|
|
||||||
/* ---- Layout only (alignment / spacing); no behaviour depends on these classes ---- */
|
|
||||||
.adp-card {
|
|
||||||
padding: 14px 16px;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.adp-section-title {
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 13px;
|
|
||||||
color: #495057;
|
|
||||||
padding-bottom: 6px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
border-bottom: 1px solid #e9ecef;
|
|
||||||
}
|
|
||||||
|
|
||||||
.adp-required {
|
|
||||||
color: #dc3545;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* label + control on one line, labels the same width so the controls line up */
|
|
||||||
.adp-field {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 10px;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.adp-label {
|
|
||||||
flex: 0 0 110px;
|
|
||||||
margin: 0;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.adp-control {
|
|
||||||
flex: 1 1 auto;
|
|
||||||
min-width: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* every input on the page the same height, so the rows line up */
|
|
||||||
.adp-page kendo-dropdownlist,
|
|
||||||
.adp-page kendo-numerictextbox,
|
|
||||||
.adp-page kendo-datepicker {
|
|
||||||
height: 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.adp-page kendo-dropdownlist.form-control {
|
|
||||||
padding: 0;
|
|
||||||
font-size: inherit;
|
|
||||||
min-height: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* the four check boxes in two even columns, starting under the inputs (label width + gap) */
|
|
||||||
.adp-checks {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
||||||
gap: 8px 12px;
|
|
||||||
margin: 4px 0 0 120px;
|
|
||||||
padding: 10px 12px;
|
|
||||||
border: 1px solid #dee2e6;
|
|
||||||
border-radius: 6px;
|
|
||||||
background: #fafbfc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.adp-check {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 6px;
|
|
||||||
margin: 0;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.adp-check .k-checkbox-label {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* the tab panels on this page are empty (only the headers are used), so drop their padding */
|
|
||||||
:host ::ng-deep .adp-card .tab-view-compat-panels {
|
|
||||||
padding: 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.adp-detail-text {
|
|
||||||
margin: 12px 0 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* employee entry: label above each control, all on one row */
|
|
||||||
.adp-entry-row {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
align-items: flex-start;
|
|
||||||
gap: 12px 16px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.adp-entry-item {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 4px;
|
|
||||||
flex: 0 1 200px;
|
|
||||||
min-width: 160px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.adp-entry-emp {
|
|
||||||
flex-basis: 140px;
|
|
||||||
min-width: 120px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* the picker (icon + count) sits in a 32px box like the inputs */
|
|
||||||
.adp-entry-emp app-employee-picker {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* the picker sizes its search button and count as 15% of its box; on this page give them a fixed size
|
|
||||||
(this page only — the picker component itself is unchanged) */
|
|
||||||
/* direct path only, so the buttons inside the picker's pop-up dialog are not touched */
|
|
||||||
:host ::ng-deep .adp-entry-emp app-employee-picker > div > div > div > button {
|
|
||||||
width: 32px !important;
|
|
||||||
max-width: none !important;
|
|
||||||
height: 32px;
|
|
||||||
flex: 0 0 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:host ::ng-deep .adp-entry-emp app-employee-picker > div > div > div > label {
|
|
||||||
width: auto !important;
|
|
||||||
max-width: none !important;
|
|
||||||
margin: 0 0 0 8px;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
:host ::ng-deep .adp-entry-emp app-employee-picker > div > div > div {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* every label the same height (the To Date one has a check box), so all inputs start on one line */
|
|
||||||
.adp-entry-label {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 4px;
|
|
||||||
height: 22px;
|
|
||||||
margin: 0;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.adp-entry-label .k-checkbox-label {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sum on the left, buttons on the right */
|
|
||||||
.adp-action-bar {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 8px;
|
|
||||||
padding: 8px 0;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
border-top: 1px solid #e9ecef;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* virtual scrolling needs every row the same height ([rowHeight]="40"): 32px inputs + 4px padding */
|
|
||||||
:host ::ng-deep .adp-emp-grid .k-grid-content td {
|
|
||||||
height: 40px;
|
|
||||||
padding-top: 4px;
|
|
||||||
padding-bottom: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.adp-sum {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.adp-actions {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 6px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 400px) {
|
@media screen and (max-width: 400px) {
|
||||||
|
|
@ -195,11 +17,4 @@ kendo-numerictextbox{
|
||||||
flex-flow: column wrap;
|
flex-flow: column wrap;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
}
|
}
|
||||||
.adp-checks {
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
margin-left: 0;
|
|
||||||
}
|
|
||||||
.adp-entry-item {
|
|
||||||
flex: 1 1 100%;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,13 @@
|
||||||
<app-loading-panel></app-loading-panel>
|
<app-loading-panel></app-loading-panel>
|
||||||
<form [formGroup]="_fromValidator" class="adp-page">
|
<form [formGroup]="_fromValidator">
|
||||||
<!-- Setup: layout only was tidied; every control, binding and event is the same as before. -->
|
<div class="card" style="padding: 1%">
|
||||||
<div class="card adp-card">
|
|
||||||
<div class="topGrid grid">
|
<div class="topGrid grid">
|
||||||
<!-- General -->
|
<div class="col-5">
|
||||||
<div class="col-12 lg:col-5 adp-section">
|
<div class="grid">
|
||||||
<div class="adp-section-title">General</div>
|
<div class="col-4" style="margin: auto;">
|
||||||
<div class="adp-field">
|
<label class="form-control-label" for="ddlAllowance">Allowance *</label>
|
||||||
<label class="adp-label form-control-label" for="ddlAllowance">Allowance <span class="adp-required">*</span></label>
|
</div>
|
||||||
<div class="adp-control">
|
<div class="col-8">
|
||||||
<kendo-dropdownlist
|
<kendo-dropdownlist
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
class="form-control form-control-sm input-sm"
|
class="form-control form-control-sm input-sm"
|
||||||
|
|
@ -16,14 +15,14 @@
|
||||||
[(ngModel)]="_adPram.allowDeductID"
|
[(ngModel)]="_adPram.allowDeductID"
|
||||||
id="ddlAllowance"
|
id="ddlAllowance"
|
||||||
[data]="_allowDeducts"
|
[data]="_allowDeducts"
|
||||||
[defaultItem]="{
|
[defaultItem]="{
|
||||||
name: 'Select Allowance',
|
name: 'Select Allowance',
|
||||||
id: null
|
id: null
|
||||||
}"
|
}"
|
||||||
[textField]="'name'"
|
[textField]="'name'"
|
||||||
(selectionChange)="
|
(selectionChange)="
|
||||||
AllowDeductselectionChange($event)
|
AllowDeductselectionChange($event)
|
||||||
"
|
"
|
||||||
[valueField]="'id'"
|
[valueField]="'id'"
|
||||||
[valuePrimitive]="true"
|
[valuePrimitive]="true"
|
||||||
required
|
required
|
||||||
|
|
@ -31,18 +30,20 @@
|
||||||
</kendo-dropdownlist>
|
</kendo-dropdownlist>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="adp-field">
|
<div class="grid">
|
||||||
<label class="adp-label" for="ddlPeriodicity">Periodicity <span class="adp-required">*</span></label>
|
<div class="col-4" style="margin: auto;">
|
||||||
<div class="adp-control">
|
<label for="ddlPeriodicity">Periodicity *</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-8">
|
||||||
<kendo-dropdownlist
|
<kendo-dropdownlist
|
||||||
class="form-control form-control-sm input-sm"
|
class="form-control form-control-sm input-sm"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
id="ddlPeriodicity"
|
id="ddlPeriodicity"
|
||||||
[data]="_periodicity"
|
[data]="_periodicity"
|
||||||
[defaultItem]="{
|
[defaultItem]="{
|
||||||
name: 'Select Periodicity',
|
name: 'Select Periodicity',
|
||||||
value: null
|
value: null
|
||||||
}"
|
}"
|
||||||
[textField]="'name'"
|
[textField]="'name'"
|
||||||
[valueField]="'value'"
|
[valueField]="'value'"
|
||||||
[valuePrimitive]="true"
|
[valuePrimitive]="true"
|
||||||
|
|
@ -53,18 +54,20 @@
|
||||||
</kendo-dropdownlist>
|
</kendo-dropdownlist>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="adp-field">
|
<div class="grid">
|
||||||
<label class="adp-label" for="ddlGender">Gender</label>
|
<div class="col-4" style="margin: auto;">
|
||||||
<div class="adp-control">
|
<label for="ddlGender">Gender</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-8">
|
||||||
<kendo-dropdownlist
|
<kendo-dropdownlist
|
||||||
class="form-control form-control-sm input-sm"
|
class="form-control form-control-sm input-sm"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
id="ddlGender"
|
id="ddlGender"
|
||||||
[data]="_gender"
|
[data]="_gender"
|
||||||
[defaultItem]="{
|
[defaultItem]="{
|
||||||
name: 'Select Gender',
|
name: 'Select Gender',
|
||||||
value: null
|
value: null
|
||||||
}"
|
}"
|
||||||
[textField]="'name'"
|
[textField]="'name'"
|
||||||
[valueField]="'value'"
|
[valueField]="'value'"
|
||||||
[valuePrimitive]="true"
|
[valuePrimitive]="true"
|
||||||
|
|
@ -73,133 +76,145 @@
|
||||||
</kendo-dropdownlist>
|
</kendo-dropdownlist>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkBoxGrid adp-checks">
|
<div class="checkBoxGrid" class="grid" style="margin-top: 0px;">
|
||||||
<label class="k-form-field right adp-check">
|
<div class="col-6" style="margin: auto;">
|
||||||
<input
|
<label class="k-form-field right">
|
||||||
type="checkbox"
|
<input
|
||||||
formControlName="isForConfirmOnly"
|
type="checkbox"
|
||||||
id="enableConfirmCheck"
|
formControlName="isForConfirmOnly"
|
||||||
[(ngModel)]="_adPram.isForConfirmOnly"
|
id="enableConfirmCheck"
|
||||||
kendoCheckBox/>
|
[(ngModel)]="_adPram.isForConfirmOnly"
|
||||||
<label class="k-checkbox-label" for="enableConfirmCheck">Confirmation Required</label>
|
kendoCheckBox/>
|
||||||
</label>
|
<label class="k-checkbox-label" for="enableConfirmCheck">Confirmation Required</label>
|
||||||
<label class="k-form-field right adp-check">
|
</label>
|
||||||
<input
|
</div>
|
||||||
type="checkbox"
|
<div class="col-6" style="margin: auto;">
|
||||||
formControlName="isDependsOnAttendance"
|
<label class="k-form-field right">
|
||||||
id="enableDepandentCheck"
|
<input
|
||||||
[(ngModel)]="_adPram.isDependsOnAttendance"
|
type="checkbox"
|
||||||
kendoCheckBox/>
|
formControlName="isDependsOnAttendance"
|
||||||
<label class="k-checkbox-label" for="enableDepandentCheck">Is Dependence on Attendance</label>
|
id="enableDepandentCheck"
|
||||||
</label>
|
[(ngModel)]="_adPram.isDependsOnAttendance"
|
||||||
<label class="k-form-field right adp-check">
|
kendoCheckBox/>
|
||||||
<input
|
<label class="k-checkbox-label" for="enableDepandentCheck">Is Dependence on Attendance</label>
|
||||||
type="checkbox"
|
</label>
|
||||||
formControlName="isFractionateApplicable"
|
</div>
|
||||||
id="enableFractionateCheck"
|
<div class="col-6" style="margin: auto;">
|
||||||
[(ngModel)]="_adPram.isFractionateApplicable"
|
<label class="k-form-field right">
|
||||||
kendoCheckBox/>
|
<input
|
||||||
<label class="k-checkbox-label" for="enableFractionateCheck">Is fractionate Available</label>
|
type="checkbox"
|
||||||
</label>
|
formControlName="isFractionateApplicable"
|
||||||
<label class="k-form-field right adp-check">
|
id="enableFractionateCheck"
|
||||||
<input
|
[(ngModel)]="_adPram.isFractionateApplicable"
|
||||||
type="checkbox"
|
kendoCheckBox/>
|
||||||
formControlName="isTaxable"
|
<label class="k-checkbox-label" for="enableFractionateCheck">Is fractionate Available</label>
|
||||||
id="enabletaxableCheck"
|
</label>
|
||||||
[(ngModel)]="_adPram.isTaxable"
|
</div>
|
||||||
kendoCheckBox/>
|
<div class="col-6" style="margin: auto;">
|
||||||
<label class="k-checkbox-label" for="enabletaxableCheck">Taxable</label>
|
<label class="k-form-field right">
|
||||||
</label>
|
<input
|
||||||
</div>
|
type="checkbox"
|
||||||
</div>
|
formControlName="isTaxable"
|
||||||
|
id="enabletaxableCheck"
|
||||||
<!-- Amount -->
|
[(ngModel)]="_adPram.isTaxable"
|
||||||
<div class="col-12 md:col-6 lg:col-3 adp-section">
|
kendoCheckBox/>
|
||||||
<div class="adp-section-title">Amount</div>
|
<label class="k-checkbox-label" for="enabletaxableCheck">Taxable</label>
|
||||||
<div class="adp-field">
|
</label>
|
||||||
<label class="adp-label" for="txtFlatAmount">Flat Amount</label>
|
</div>
|
||||||
<div class="adp-control">
|
</div>
|
||||||
<kendo-numerictextbox
|
</div>
|
||||||
[min]="-10000000"
|
<div class="col-3">
|
||||||
[max]="10000000"
|
<div class="grid">
|
||||||
[(ngModel)]="_adPram.flatAmount"
|
<div class="col-4" style="margin: auto;">
|
||||||
formControlName="flatAmount"
|
<label for="txtFlatAmount">Flat Amount</label>
|
||||||
>
|
</div>
|
||||||
</kendo-numerictextbox>
|
<div class="col-8">
|
||||||
</div>
|
<kendo-numerictextbox
|
||||||
</div>
|
[min]="-10000000"
|
||||||
<div class="adp-field">
|
[max]="10000000"
|
||||||
<label class="adp-label" for="txtBasic">% of Basic</label>
|
[(ngModel)]="_adPram.flatAmount"
|
||||||
<div class="adp-control">
|
formControlName="flatAmount"
|
||||||
<kendo-numerictextbox
|
>
|
||||||
[min]="-1000"
|
</kendo-numerictextbox>
|
||||||
[max]="1000"
|
</div>
|
||||||
[(ngModel)]="_adPram.percentOfBasic"
|
</div>
|
||||||
formControlName="percentOfBasic"
|
<div class="grid">
|
||||||
>
|
<div class="col-4" style="margin: auto;">
|
||||||
</kendo-numerictextbox>
|
<label for="txtBasic">% of Basic</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col-8">
|
||||||
<div class="adp-field">
|
<kendo-numerictextbox
|
||||||
<label class="adp-label" for="txtGross">% of Gross</label>
|
[min]="-1000"
|
||||||
<div class="adp-control">
|
[max]="1000"
|
||||||
<kendo-numerictextbox
|
[(ngModel)]="_adPram.percentOfBasic"
|
||||||
[min]="-1000"
|
formControlName="percentOfBasic"
|
||||||
[max]="1000"
|
>
|
||||||
[(ngModel)]="_adPram.percentOfGross"
|
</kendo-numerictextbox>
|
||||||
formControlName="percentOfGross"
|
</div>
|
||||||
>
|
</div>
|
||||||
</kendo-numerictextbox>
|
<div class="grid">
|
||||||
</div>
|
<div class="col-4" style="margin: auto;">
|
||||||
</div>
|
<label for="txtGross">% of Gross</label>
|
||||||
<div class="adp-field">
|
</div>
|
||||||
<label class="adp-label" for="txtMininmum">Mininmum</label>
|
<div class="col-8">
|
||||||
<div class="adp-control">
|
<kendo-numerictextbox
|
||||||
<kendo-numerictextbox
|
[min]="-1000"
|
||||||
[min]="-10000000"
|
[max]="1000"
|
||||||
[max]="10000000"
|
[(ngModel)]="_adPram.percentOfGross"
|
||||||
[(ngModel)]="_adPram.minAmount"
|
formControlName="percentOfGross"
|
||||||
formControlName="minAmount"
|
>
|
||||||
>
|
</kendo-numerictextbox>
|
||||||
</kendo-numerictextbox>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="grid">
|
||||||
<div class="adp-field">
|
<div class="col-4" style="margin: auto;">
|
||||||
<label class="adp-label" for="txtMaximum">Maximum</label>
|
<label for="txtMininmum" style="margin: auto;">Mininmum</label>
|
||||||
<div class="adp-control">
|
</div>
|
||||||
<kendo-numerictextbox
|
<div class="col-8">
|
||||||
[min]="-10000000"
|
<kendo-numerictextbox
|
||||||
[max]="10000000"
|
[min]="-10000000"
|
||||||
[(ngModel)]="_adPram.maxAmount"
|
[max]="10000000"
|
||||||
formControlName="maxAmount"
|
[(ngModel)]="_adPram.minAmount"
|
||||||
>
|
formControlName="minAmount"
|
||||||
</kendo-numerictextbox>
|
>
|
||||||
</div>
|
</kendo-numerictextbox>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="grid">
|
||||||
<!-- Grades -->
|
<div class="col-4" style="margin: auto;">
|
||||||
<div class="col-12 md:col-6 lg:col-4 adp-section">
|
<label for="txtMaximum" style="margin: auto;">Maximum</label>
|
||||||
<div class="adp-section-title">Grade <span class="adp-required">*</span></div>
|
</div>
|
||||||
<kendo-grid
|
<div class="col-8">
|
||||||
[data]="_grades"
|
<kendo-numerictextbox
|
||||||
height="220"
|
[min]="-10000000"
|
||||||
[(selectedKeys)]="_selectedgrades"
|
[max]="10000000"
|
||||||
[kendoGridSelectBy]="'id'"
|
[(ngModel)]="_adPram.maxAmount"
|
||||||
>
|
formControlName="maxAmount"
|
||||||
<kendo-grid-checkbox-column
|
>
|
||||||
showSelectAll="true"
|
</kendo-numerictextbox>
|
||||||
[width]="50"
|
</div>
|
||||||
[headerClass]="{ 'text-center': true }"
|
</div>
|
||||||
[class]="{ 'text-center': true }"
|
</div>
|
||||||
></kendo-grid-checkbox-column>
|
<div class="col-4">
|
||||||
<kendo-grid-column field="code" title="Code">
|
<kendo-grid
|
||||||
</kendo-grid-column>
|
[data]="_grades"
|
||||||
<kendo-grid-column field="name" title="Description">
|
height="180"
|
||||||
</kendo-grid-column>
|
[(selectedKeys)]="_selectedgrades"
|
||||||
</kendo-grid>
|
[kendoGridSelectBy]="'id'"
|
||||||
</div>
|
>
|
||||||
</div>
|
<kendo-grid-checkbox-column
|
||||||
|
showSelectAll="true"
|
||||||
|
[width]="50"
|
||||||
|
[headerClass]="{ 'text-center': true }"
|
||||||
|
[class]="{ 'text-center': true }"
|
||||||
|
></kendo-grid-checkbox-column>
|
||||||
|
<kendo-grid-column field="code" title="Code">
|
||||||
|
</kendo-grid-column>
|
||||||
|
<kendo-grid-column field="name" title="Description">
|
||||||
|
</kendo-grid-column>
|
||||||
|
</kendo-grid>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- <hr>
|
<!-- <hr>
|
||||||
<div class="checkBoxGrid grid">
|
<div class="checkBoxGrid grid">
|
||||||
|
|
@ -263,7 +278,7 @@
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div> -->
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="card" style="padding: 1%;">
|
<!-- <div class="card" style="padding: 1%;">
|
||||||
<div class="middleGrid grid">
|
<div class="middleGrid grid">
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
|
|
@ -340,187 +355,203 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div> -->
|
</div> -->
|
||||||
|
<div class="card" style="padding: 1%">
|
||||||
|
<div class="grid">
|
||||||
|
<div class="col-12">
|
||||||
|
<app-tab-view (onChange)="IndividualChecked($event)">
|
||||||
|
@if (_selectedPeriodicity == 1) {
|
||||||
|
<app-tab-panel
|
||||||
|
header="Exception ( {{
|
||||||
|
this._adPram.exception?.length
|
||||||
|
}} )"
|
||||||
|
leftIcon="pi pi-user"
|
||||||
|
>
|
||||||
|
</app-tab-panel>
|
||||||
|
}
|
||||||
|
@if (_selectedPeriodicity == 1) {
|
||||||
|
<app-tab-panel
|
||||||
|
header="Not Applicable ( {{
|
||||||
|
this._adPram.notApplicable?.length
|
||||||
|
}} )"
|
||||||
|
leftIcon="pi pi-user"
|
||||||
|
>
|
||||||
|
</app-tab-panel>
|
||||||
|
}
|
||||||
|
@if (_selectedPeriodicity != 1) {
|
||||||
|
<app-tab-panel
|
||||||
|
header="Individual ( {{
|
||||||
|
this._adPram.adParameterEmployees?.length
|
||||||
|
}} )"
|
||||||
|
leftIcon="pi pi-user"
|
||||||
|
>
|
||||||
|
</app-tab-panel>
|
||||||
|
}
|
||||||
|
</app-tab-view>
|
||||||
|
<div class="grid">
|
||||||
|
<div class="col-12">
|
||||||
|
<b> {{ _detailLevelText }}</b>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Employees -->
|
<div class="grid" style="margin-top: 5px;">
|
||||||
<div class="card adp-card">
|
<div class="col-2">
|
||||||
<app-tab-view (onChange)="IndividualChecked($event)">
|
<div class="grid">
|
||||||
@if (_selectedPeriodicity == 1) {
|
<div class="col-5" style="margin: auto;">
|
||||||
<app-tab-panel
|
<label for="txtEmp"> Select Emp</label>
|
||||||
header="Exception ( {{
|
</div>
|
||||||
this._adPram.exception?.length
|
<div class="col-7" align="left">
|
||||||
}} )"
|
<app-employee-picker [MultiSelect]="true"
|
||||||
leftIcon="pi pi-user"
|
[fixedGrades]="_selectedgrades"
|
||||||
>
|
(ItemSelected)="GetSelectedEmployee($event)"
|
||||||
</app-tab-panel>
|
style="width: 80%;"></app-employee-picker>
|
||||||
}
|
<!-- <app-employee-picker for="chkIsnew" id="idself" [isActive]="!newEmployee" [setSelectedEmp]="selectedEmployee"
|
||||||
@if (_selectedPeriodicity == 1) {
|
(ItemSelected)="GetSelectedEmployee($event)"></app-employee-picker> -->
|
||||||
<app-tab-panel
|
</div>
|
||||||
header="Not Applicable ( {{
|
</div>
|
||||||
this._adPram.notApplicable?.length
|
</div>
|
||||||
}} )"
|
@if (!_ischecknotapplicable) {
|
||||||
leftIcon="pi pi-user"
|
<div class="col-10">
|
||||||
>
|
<div class="grid">
|
||||||
</app-tab-panel>
|
<div class="col-1" style="margin: auto;" align="right">
|
||||||
}
|
<label for="txtEmp">Amount</label>
|
||||||
@if (_selectedPeriodicity != 1) {
|
</div>
|
||||||
<app-tab-panel
|
<div class="col-3">
|
||||||
header="Individual ( {{
|
<kendo-numerictextbox
|
||||||
this._adPram.adParameterEmployees?.length
|
[min]="-10000000"
|
||||||
}} )"
|
[max]="10000000"
|
||||||
leftIcon="pi pi-user"
|
[(ngModel)]="_individualAmount"
|
||||||
>
|
[ngModelOptions]="{ standalone: true }"
|
||||||
</app-tab-panel>
|
>
|
||||||
}
|
</kendo-numerictextbox>
|
||||||
</app-tab-view>
|
</div>
|
||||||
|
@if (!_ischeckException) {
|
||||||
|
<div class="col-1" style="margin: auto;" align="right">
|
||||||
|
<label for="dtpFromDate">From Date</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
<kendo-datepicker
|
||||||
|
id="dtpFromDate"
|
||||||
|
[format]="'dd-MMM-yyyy'"
|
||||||
|
[readonly]="this._adPram.periodicity == 2"
|
||||||
|
[(ngModel)]="_individualFromDate"
|
||||||
|
[ngModelOptions]="{ standalone: true }"
|
||||||
|
style="width: 100%"
|
||||||
|
></kendo-datepicker>
|
||||||
|
</div>
|
||||||
|
<div class="col-1" style="margin: auto;" align="right">
|
||||||
|
<label class="k-form-field right">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
[(ngModel)]="_checkedToDate"
|
||||||
|
[ngModelOptions]="{ standalone: true }"
|
||||||
|
[disabled]="this._adPram.periodicity == 2"
|
||||||
|
(click)="todateclicked()" kendoCheckBox/>
|
||||||
|
<label
|
||||||
|
class="k-checkbox-label"
|
||||||
|
for="isIndividualEmployee"
|
||||||
|
>
|
||||||
|
To Date
|
||||||
|
</label>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
<kendo-datepicker
|
||||||
|
id="dtpToDate"
|
||||||
|
[format]="'dd-MMM-yyyy'"
|
||||||
|
[(ngModel)]="_individualToDate"
|
||||||
|
[readonly]="
|
||||||
|
this._adPram.periodicity == 2 ||
|
||||||
|
_checkedToDate == false
|
||||||
|
"
|
||||||
|
[ngModelOptions]="{ standalone: true }"
|
||||||
|
style="width: 100%"
|
||||||
|
></kendo-datepicker>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div class="grid">
|
||||||
|
<div class="col-2" style="font-weight: bold;">
|
||||||
|
Sum: {{get2FloatingPoint(sumofIndividualAmount())}}
|
||||||
|
</div>
|
||||||
|
<div class="col-10" align="right">
|
||||||
|
<button kendoButton
|
||||||
|
[svgIcon]="apiService.KendoSVGIcon['plus']"
|
||||||
|
class="k-button k-primary"
|
||||||
|
(click)="AddEmployee()">
|
||||||
|
Add
|
||||||
|
</button>
|
||||||
|
<button kendoButton style="margin-left:3px" [svgIcon]="apiService.KendoSVGIcon['delete']" class="kt-delete" (click)="RemoveAll()">Remove All</button>
|
||||||
|
<button kendoButton [svgIcon]="apiService.KendoSVGIcon['save']" themeColor="primary" style="margin-left:3px" (click)="Save()" >Save</button>
|
||||||
|
|
||||||
<div class="adp-detail-text">
|
</div>
|
||||||
<b> {{ _detailLevelText }}</b>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="grid">
|
||||||
<div class="adp-entry-row">
|
<div class="col-12">
|
||||||
<div class="adp-entry-item adp-entry-emp">
|
<kendo-grid [data]="_individualEmplyees"
|
||||||
<label class="adp-entry-label" for="txtEmp">Select Emp</label>
|
height="300"
|
||||||
<app-employee-picker [MultiSelect]="true"
|
(remove)="removeHandler($event)">
|
||||||
[fixedGrades]="_selectedgrades"
|
<kendo-grid-column field="employeeNo" title="Emp ID">
|
||||||
(ItemSelected)="GetSelectedEmployee($event)"
|
</kendo-grid-column>
|
||||||
></app-employee-picker>
|
<kendo-grid-column field="employeeName" title="Name">
|
||||||
<!-- <app-employee-picker for="chkIsnew" id="idself" [isActive]="!newEmployee" [setSelectedEmp]="selectedEmployee"
|
</kendo-grid-column>
|
||||||
(ItemSelected)="GetSelectedEmployee($event)"></app-employee-picker> -->
|
@if (_ischeckappliedtoInvididual) {
|
||||||
</div>
|
<kendo-grid-column field="formDate" title="From Month">
|
||||||
@if (!_ischecknotapplicable) {
|
<ng-template kendoGridCellTemplate let-dataItem>
|
||||||
<div class="adp-entry-item">
|
<kendo-datepicker id="idformDate"
|
||||||
<label class="adp-entry-label" for="txtEmp">Amount</label>
|
[(ngModel)]="dataItem.formDate"
|
||||||
<kendo-numerictextbox
|
[ngModelOptions]="{ standalone: true }"
|
||||||
[min]="-10000000"
|
[format]="'dd MMM yyyy'"
|
||||||
[max]="10000000"
|
name="formDate">
|
||||||
[(ngModel)]="_individualAmount"
|
</kendo-datepicker>
|
||||||
[ngModelOptions]="{ standalone: true }"
|
</ng-template>
|
||||||
>
|
</kendo-grid-column>
|
||||||
</kendo-numerictextbox>
|
<kendo-grid-column field="tillDate"
|
||||||
</div>
|
title="Till Month">
|
||||||
@if (!_ischeckException) {
|
<ng-template kendoGridCellTemplate let-dataItem>
|
||||||
<div class="adp-entry-item">
|
<kendo-datepicker id="idtilldate"
|
||||||
<label class="adp-entry-label" for="dtpFromDate">From Date</label>
|
[(ngModel)]="dataItem.tillDate"
|
||||||
<kendo-datepicker
|
[format]="'dd MMM yyyy'"
|
||||||
id="dtpFromDate"
|
[ngModelOptions]="{ standalone: true }"
|
||||||
[format]="'dd-MMM-yyyy'"
|
name="tillstartDate">
|
||||||
[readonly]="this._adPram.periodicity == 2"
|
</kendo-datepicker>
|
||||||
[(ngModel)]="_individualFromDate"
|
</ng-template>
|
||||||
[ngModelOptions]="{ standalone: true }"
|
</kendo-grid-column>
|
||||||
style="width: 100%"
|
}
|
||||||
></kendo-datepicker>
|
@if (!_ischecknotapplicable) {
|
||||||
</div>
|
<kendo-grid-command-column title="Amount">
|
||||||
<div class="adp-entry-item">
|
<ng-template kendoGridCellTemplate let-dataItem>
|
||||||
<label class="k-form-field right adp-entry-label">
|
<kendo-numerictextbox [(ngModel)]="dataItem.monthlyAmount"
|
||||||
<input
|
[ngModelOptions]="{ standalone: true }"
|
||||||
type="checkbox"
|
[autoCorrect]="true"
|
||||||
[(ngModel)]="_checkedToDate"
|
[spinners]="false">
|
||||||
[ngModelOptions]="{ standalone: true }"
|
</kendo-numerictextbox>
|
||||||
[disabled]="this._adPram.periodicity == 2"
|
</ng-template>
|
||||||
(click)="todateclicked()" kendoCheckBox/>
|
</kendo-grid-command-column>
|
||||||
<label
|
}
|
||||||
class="k-checkbox-label"
|
<kendo-grid-column field="approvalStatus"
|
||||||
for="isIndividualEmployee"
|
title="Approval Status">
|
||||||
>
|
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
|
||||||
To Date
|
{{ statusString(dataItem.approvalStatus)}}
|
||||||
</label>
|
</ng-template>
|
||||||
</label>
|
</kendo-grid-column>
|
||||||
<kendo-datepicker
|
<kendo-grid-command-column title="Action" width="220">
|
||||||
id="dtpToDate"
|
<ng-template kendoGridCellTemplate
|
||||||
[format]="'dd-MMM-yyyy'"
|
let-dataItem
|
||||||
[(ngModel)]="_individualToDate"
|
let-rowIndex="rowIndex">
|
||||||
[readonly]="
|
<button kendoGridRemoveCommand [svgIcon]="apiService.KendoSVGIcon['delete']" class="kt-delete"></button>
|
||||||
this._adPram.periodicity == 2 ||
|
</ng-template>
|
||||||
_checkedToDate == false
|
</kendo-grid-command-column>
|
||||||
"
|
</kendo-grid>
|
||||||
[ngModelOptions]="{ standalone: true }"
|
</div>
|
||||||
style="width: 100%"
|
</div>
|
||||||
></kendo-datepicker>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
<div class="grid">
|
||||||
}
|
<div class="col-12" align="right">
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="adp-action-bar">
|
</form>
|
||||||
<div class="adp-sum">
|
|
||||||
Sum: {{get2FloatingPoint(sumofIndividualAmount())}}
|
|
||||||
</div>
|
|
||||||
<div class="adp-actions">
|
|
||||||
<button kendoButton
|
|
||||||
[svgIcon]="apiService.KendoSVGIcon['plus']"
|
|
||||||
class="k-button k-primary"
|
|
||||||
(click)="AddEmployee()">
|
|
||||||
Add
|
|
||||||
</button>
|
|
||||||
<button kendoButton [svgIcon]="apiService.KendoSVGIcon['delete']" class="kt-delete" (click)="RemoveAll()">Remove All</button>
|
|
||||||
<button kendoButton [svgIcon]="apiService.KendoSVGIcon['save']" themeColor="primary" (click)="Save()" >Save</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- <kendo-grid [data]="_individualEmplyees"
|
|
||||||
height="300"
|
|
||||||
(remove)="removeHandler($event)"> -->
|
|
||||||
<!-- virtual scrolling: only the rows on screen are built (empGridView = a window of _individualEmplyees) -->
|
|
||||||
<kendo-grid [data]="empGridView"
|
|
||||||
class="adp-emp-grid"
|
|
||||||
[height]="360"
|
|
||||||
scrollable="virtual"
|
|
||||||
[rowHeight]="40"
|
|
||||||
[skip]="empGridSkip"
|
|
||||||
[pageSize]="empGridPageSize"
|
|
||||||
(pageChange)="onEmpGridPageChange($event)"
|
|
||||||
(remove)="removeHandler($event)">
|
|
||||||
<kendo-grid-column field="employeeNo" title="Emp ID">
|
|
||||||
</kendo-grid-column>
|
|
||||||
<kendo-grid-column field="employeeName" title="Name">
|
|
||||||
</kendo-grid-column>
|
|
||||||
@if (_ischeckappliedtoInvididual) {
|
|
||||||
<kendo-grid-column field="formDate" title="From Month">
|
|
||||||
<ng-template kendoGridCellTemplate let-dataItem>
|
|
||||||
<kendo-datepicker id="idformDate"
|
|
||||||
[(ngModel)]="dataItem.formDate"
|
|
||||||
[ngModelOptions]="{ standalone: true }"
|
|
||||||
[format]="'dd MMM yyyy'"
|
|
||||||
name="formDate">
|
|
||||||
</kendo-datepicker>
|
|
||||||
</ng-template>
|
|
||||||
</kendo-grid-column>
|
|
||||||
<kendo-grid-column field="tillDate"
|
|
||||||
title="Till Month">
|
|
||||||
<ng-template kendoGridCellTemplate let-dataItem>
|
|
||||||
<kendo-datepicker id="idtilldate"
|
|
||||||
[(ngModel)]="dataItem.tillDate"
|
|
||||||
[format]="'dd MMM yyyy'"
|
|
||||||
[ngModelOptions]="{ standalone: true }"
|
|
||||||
name="tillstartDate">
|
|
||||||
</kendo-datepicker>
|
|
||||||
</ng-template>
|
|
||||||
</kendo-grid-column>
|
|
||||||
}
|
|
||||||
@if (!_ischecknotapplicable) {
|
|
||||||
<kendo-grid-command-column title="Amount">
|
|
||||||
<ng-template kendoGridCellTemplate let-dataItem>
|
|
||||||
<kendo-numerictextbox [(ngModel)]="dataItem.monthlyAmount"
|
|
||||||
[ngModelOptions]="{ standalone: true }"
|
|
||||||
[autoCorrect]="true"
|
|
||||||
[spinners]="false">
|
|
||||||
</kendo-numerictextbox>
|
|
||||||
</ng-template>
|
|
||||||
</kendo-grid-command-column>
|
|
||||||
}
|
|
||||||
<kendo-grid-column field="approvalStatus"
|
|
||||||
title="Approval Status">
|
|
||||||
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
|
|
||||||
{{ statusString(dataItem.approvalStatus)}}
|
|
||||||
</ng-template>
|
|
||||||
</kendo-grid-column>
|
|
||||||
<kendo-grid-command-column title="Action" width="120">
|
|
||||||
<ng-template kendoGridCellTemplate
|
|
||||||
let-dataItem
|
|
||||||
let-rowIndex="rowIndex">
|
|
||||||
<button kendoGridRemoveCommand [svgIcon]="apiService.KendoSVGIcon['delete']" class="kt-delete"></button>
|
|
||||||
</ng-template>
|
|
||||||
</kendo-grid-command-column>
|
|
||||||
</kendo-grid>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import {Component, OnInit, ChangeDetectionStrategy, DoCheck} from '@angular/core';
|
import {Component, OnInit, ChangeDetectionStrategy} from '@angular/core';
|
||||||
import { GridDataResult, PageChangeEvent } from '@progress/kendo-angular-grid';
|
|
||||||
import {FormGroup, FormControl, FormBuilder, Validators} from '@angular/forms';
|
import {FormGroup, FormControl, FormBuilder, Validators} from '@angular/forms';
|
||||||
import {SearchEmployee} from '../../../../_models/Employee/searchEmployee';
|
import {SearchEmployee} from '../../../../_models/Employee/searchEmployee';
|
||||||
import {AdparameterService} from '../../../../_services/payroll/adparameter.service';
|
import {AdparameterService} from '../../../../_services/payroll/adparameter.service';
|
||||||
|
|
@ -35,7 +34,7 @@ import { EmployeePickerComponent } from 'src/app/picker/employee-picker.componen
|
||||||
standalone: false,
|
standalone: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
export class AllowanceDeductionParameterizationEntryComponent implements OnInit, DoCheck {
|
export class AllowanceDeductionParameterizationEntryComponent implements OnInit {
|
||||||
_adPram: ADParameter;
|
_adPram: ADParameter;
|
||||||
_allowDeducts: AllowanceDeduction[];
|
_allowDeducts: AllowanceDeduction[];
|
||||||
_grades: Grade[];
|
_grades: Grade[];
|
||||||
|
|
@ -263,16 +262,10 @@ export class AllowanceDeductionParameterizationEntryComponent implements OnInit,
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveAll() {
|
RemoveAll() {
|
||||||
// if (!confirm("Are you sure to delete all employees allowance entry")) {
|
if (!confirm("Are you sure to delete all employees allowance entry")) {
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
// this._individualEmplyees.splice(0, this._individualEmplyees.length);
|
this._individualEmplyees.splice(0, this._individualEmplyees.length);
|
||||||
this.notificationService.showActiveConfirm('Confirmation', "Are you sure to delete all employees allowance entry?").then((isConfirmed) => {
|
|
||||||
if (isConfirmed)
|
|
||||||
{
|
|
||||||
this._individualEmplyees.splice(0, this._individualEmplyees.length);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
AddEmployee() {
|
AddEmployee() {
|
||||||
|
|
@ -284,6 +277,7 @@ export class AllowanceDeductionParameterizationEntryComponent implements OnInit,
|
||||||
this.notificationService.showWarning("Please enter an Amount");
|
this.notificationService.showWarning("Please enter an Amount");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._selectedEmps == undefined) return;
|
if (this._selectedEmps == undefined) return;
|
||||||
this._selectedEmps.forEach(x => {
|
this._selectedEmps.forEach(x => {
|
||||||
let newItem: ADParameterEmployee = this._individualEmplyees.find(e => e.employeeID == x.employeeID);
|
let newItem: ADParameterEmployee = this._individualEmplyees.find(e => e.employeeID == x.employeeID);
|
||||||
|
|
@ -307,14 +301,19 @@ export class AllowanceDeductionParameterizationEntryComponent implements OnInit,
|
||||||
newItem.tillDate = this._individualToDate;
|
newItem.tillDate = this._individualToDate;
|
||||||
newItem.monthlyAmount = this._individualAmount;
|
newItem.monthlyAmount = this._individualAmount;
|
||||||
newItem.adEmpType = this._adEmpType;
|
newItem.adEmpType = this._adEmpType;
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public GetSelectedEmployee(searchEmp: SearchEmployee[]) {
|
public GetSelectedEmployee(searchEmp: SearchEmployee[]) {
|
||||||
|
|
||||||
if (searchEmp != null) {
|
if (searchEmp != null) {
|
||||||
this._selectedEmps = [];
|
this._selectedEmps = [];
|
||||||
searchEmp.forEach(x => { this._selectedEmps.push(x); });
|
searchEmp.forEach(x => {
|
||||||
|
this._selectedEmps.push(x);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PrepareGradeData(usedGrades: ADParameterGrade[]) {
|
PrepareGradeData(usedGrades: ADParameterGrade[]) {
|
||||||
|
|
@ -364,6 +363,7 @@ export class AllowanceDeductionParameterizationEntryComponent implements OnInit,
|
||||||
}
|
}
|
||||||
|
|
||||||
public Save() {
|
public Save() {
|
||||||
|
debugger;
|
||||||
if (this._fromValidator.invalid) {
|
if (this._fromValidator.invalid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -389,6 +389,7 @@ export class AllowanceDeductionParameterizationEntryComponent implements OnInit,
|
||||||
}
|
}
|
||||||
if (this._adPram.adParameterEmployees.length > 0) {
|
if (this._adPram.adParameterEmployees.length > 0) {
|
||||||
this._adPram.adParameterEmployees.forEach(x => {
|
this._adPram.adParameterEmployees.forEach(x => {
|
||||||
|
debugger;
|
||||||
let adParamEmpItem: ADParameterEmployee = this.prADParameterEmployees.find(y => y.id === x.id);
|
let adParamEmpItem: ADParameterEmployee = this.prADParameterEmployees.find(y => y.id === x.id);
|
||||||
let oPayrollType: PayrollType = new PayrollType();
|
let oPayrollType: PayrollType = new PayrollType();
|
||||||
if (adParamEmpItem) {
|
if (adParamEmpItem) {
|
||||||
|
|
@ -401,6 +402,8 @@ export class AllowanceDeductionParameterizationEntryComponent implements OnInit,
|
||||||
x.oldTillDate = adParamEmpItem.tillDate;
|
x.oldTillDate = adParamEmpItem.tillDate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
debugger;
|
debugger;
|
||||||
|
|
@ -448,49 +451,6 @@ export class AllowanceDeductionParameterizationEntryComponent implements OnInit,
|
||||||
return parseFloat((value).toFixed(2));
|
return parseFloat((value).toFixed(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
//#region Employee grid: virtual scrolling (display only)
|
|
||||||
// The employee grid shows only the rows on screen (a window of empGridPageSize rows), so 12k-20k
|
|
||||||
// employees load at once. _individualEmplyees stays the one full list that every existing function
|
|
||||||
// (Add, Remove, Remove All, Sum, Save, tabs) works on; each window holds the same row objects, so an
|
|
||||||
// amount or date typed in the grid lands in that list exactly as before.
|
|
||||||
empGridView: GridDataResult = { data: [], total: 0 };
|
|
||||||
empGridSkip = 0;
|
|
||||||
empGridPageSize = 50;
|
|
||||||
private empGridSource: ADParameterEmployee[];
|
|
||||||
private empGridLength = -1;
|
|
||||||
|
|
||||||
/** Rebuilds the window when the list is replaced (tab change, load) or grows / shrinks (Add, Remove, Remove All). */
|
|
||||||
ngDoCheck(): void {
|
|
||||||
const list = this._individualEmplyees;
|
|
||||||
const length = list ? list.length : 0;
|
|
||||||
if (list !== this.empGridSource || length !== this.empGridLength) {
|
|
||||||
if (list !== this.empGridSource) {
|
|
||||||
this.empGridSkip = 0; // another list (tab): start from the top
|
|
||||||
}
|
|
||||||
this.empGridSource = list;
|
|
||||||
this.empGridLength = length;
|
|
||||||
this.loadEmpGridView();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** The grid scrolled: show the rows of the new window. */
|
|
||||||
onEmpGridPageChange(event: PageChangeEvent): void {
|
|
||||||
this.empGridSkip = event.skip;
|
|
||||||
this.loadEmpGridView();
|
|
||||||
}
|
|
||||||
|
|
||||||
private loadEmpGridView(): void {
|
|
||||||
const list = this._individualEmplyees || [];
|
|
||||||
if (this.empGridSkip >= list.length) { // rows were removed below the current window
|
|
||||||
this.empGridSkip = Math.max(0, list.length - this.empGridPageSize);
|
|
||||||
}
|
|
||||||
this.empGridView = {
|
|
||||||
data: list.slice(this.empGridSkip, this.empGridSkip + this.empGridPageSize),
|
|
||||||
total: list.length
|
|
||||||
};
|
|
||||||
}
|
|
||||||
//#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -316,7 +316,7 @@
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<kendo-grid [data]="gridView" (pageChange)="onDataChange($event)" [pageSize]="pageSize"
|
<kendo-grid [data]="gridView" (pageChange)="onDataChange($event)" [pageSize]="pageSize"
|
||||||
[pageable]="false" scrollable="virtual" [skip]="skip" [rowHeight]="36"
|
[pageable]="true" scrollable="virtual" [skip]="skip" [rowHeight]="36"
|
||||||
[(selectedKeys)]="selectedItems" [state]="selectAllState" [style.height.px]="gridHeight"
|
[(selectedKeys)]="selectedItems" [state]="selectAllState" [style.height.px]="gridHeight"
|
||||||
(selectedKeysChange)="onSelectedKeysChange($event)" [selectable]="selectableSettings"
|
(selectedKeysChange)="onSelectedKeysChange($event)" [selectable]="selectableSettings"
|
||||||
[kendoGridSelectBy]="'employeeID'">
|
[kendoGridSelectBy]="'employeeID'">
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ export class DiscontinueEmployeeDetailsComponent implements OnInit {
|
||||||
this.notificationService.showWarning('From Date cannot be after To Date.', 'Warning');
|
this.notificationService.showWarning('From Date cannot be after To Date.', 'Warning');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// debugger;
|
debugger;
|
||||||
this.grid.load({ fromDate: this.fromDate, toDate: this.toDate });
|
this.grid.load({ fromDate: this.fromDate, toDate: this.toDate });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"version": "20261115-03",
|
"version": "20261108-01",
|
||||||
"buildTime": "2026-11-15T08:30:42.0805569Z"
|
"buildTime": "2026-11-08T05:31:24.9714459Z"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,21 +24,18 @@ namespace HRM.UI.Controllers.Payroll
|
||||||
private readonly ISalaryMasterBulkUploadService _salaryMasterBulkUploadService;
|
private readonly ISalaryMasterBulkUploadService _salaryMasterBulkUploadService;
|
||||||
private readonly IEmployeePhotoBulkUploadService _employeePhotoBulkUploadService;
|
private readonly IEmployeePhotoBulkUploadService _employeePhotoBulkUploadService;
|
||||||
private readonly ICacheManager _cashManager;
|
private readonly ICacheManager _cashManager;
|
||||||
private readonly IBonusProcessService _bonusProcessService;
|
|
||||||
|
|
||||||
public DataUploadController(IDataUploadColumnDefinition columnDefination,
|
public DataUploadController(IDataUploadColumnDefinition columnDefination,
|
||||||
IEmployeeBulkUploadService employeeBulkUploadService,
|
IEmployeeBulkUploadService employeeBulkUploadService,
|
||||||
ISalaryMasterBulkUploadService salaryMasterBulkUploadService,
|
ISalaryMasterBulkUploadService salaryMasterBulkUploadService,
|
||||||
IEmployeePhotoBulkUploadService employeePhotoBulkUploadService,
|
IEmployeePhotoBulkUploadService employeePhotoBulkUploadService,
|
||||||
ICacheManager cashManager,
|
ICacheManager cashManager)
|
||||||
IBonusProcessService bonusProcessService)
|
|
||||||
{
|
{
|
||||||
this._columnDefination = columnDefination;
|
this._columnDefination = columnDefination;
|
||||||
this._employeeBulkUploadService = employeeBulkUploadService;
|
this._employeeBulkUploadService = employeeBulkUploadService;
|
||||||
this._salaryMasterBulkUploadService = salaryMasterBulkUploadService;
|
this._salaryMasterBulkUploadService = salaryMasterBulkUploadService;
|
||||||
this._employeePhotoBulkUploadService = employeePhotoBulkUploadService;
|
this._employeePhotoBulkUploadService = employeePhotoBulkUploadService;
|
||||||
this._cashManager = cashManager;
|
this._cashManager = cashManager;
|
||||||
this._bonusProcessService = bonusProcessService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// loan
|
// loan
|
||||||
|
|
@ -159,53 +156,6 @@ namespace HRM.UI.Controllers.Payroll
|
||||||
return Ok(items);
|
return Ok(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Bonus Process screen, "Upload Data": reads the bonus file (sheet EmpBonus: Employee No, Amount — the
|
|
||||||
/// same reader as uploadBonusFile) and saves it in the same request, with the tax when the header asks
|
|
||||||
/// for it (BonusProcessService.UploadAndSave). Form fields: excelfile, and header = the JSON of a
|
|
||||||
/// BonusProcessAndSaveRequest (bonus, dates, flags). Returns the saved rows.
|
|
||||||
/// </summary>
|
|
||||||
[HttpPost]
|
|
||||||
[Route("uploadBonusFileAndSave")]
|
|
||||||
public ActionResult uploadBonusFileAndSave()
|
|
||||||
{
|
|
||||||
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
||||||
BonusProcessAndSaveResult result = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int payrolltypeid = (int)currentUser.PayrollTypeID;
|
|
||||||
string headerJson = Convert.ToString(Request.Form["header"]);
|
|
||||||
if (string.IsNullOrWhiteSpace(headerJson))
|
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError, "Bonus information not found.");
|
|
||||||
// same JSON reading as the Process button's request (Newtonsoft defaults), so dates arrive the same way
|
|
||||||
BonusProcessAndSaveRequest request = JsonConvert.DeserializeObject<BonusProcessAndSaveRequest>(headerJson);
|
|
||||||
|
|
||||||
IFormFile formFile = Request.Form.Files.FirstOrDefault();
|
|
||||||
if (formFile == null || formFile.Length == 0)
|
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError, "Please select a file.");
|
|
||||||
string extension = Path.GetExtension(formFile.FileName ?? string.Empty).ToLowerInvariant();
|
|
||||||
if (extension != ".xlsx" && extension != ".xls")
|
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError, "Please select an Excel file (.xlsx or .xls).");
|
|
||||||
|
|
||||||
DataUploadColumnDefinition oColumnDefination = this._columnDefination.GetColumnDefinition(
|
|
||||||
(int)EnumRegularDataUpload.Bonus, null, payrolltypeid);
|
|
||||||
List<BonusProcess.BonusProcessDetail> items;
|
|
||||||
using (Stream stream = formFile.OpenReadStream())
|
|
||||||
{
|
|
||||||
items = new RegularDataUploadService().GetBonusData((int)EnumRegularDataUpload.Bonus, oColumnDefination,
|
|
||||||
stream, payrolltypeid);
|
|
||||||
}
|
|
||||||
|
|
||||||
result = _bonusProcessService.UploadAndSave(items, request, payrolltypeid, currentUser.UserID);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ok(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Employee Bulk Upload layout — groups, sub-groups and columns — that the page shows
|
/// The Employee Bulk Upload layout — groups, sub-groups and columns — that the page shows
|
||||||
/// as section checkboxes and in its template guide.
|
/// as section checkboxes and in its template guide.
|
||||||
|
|
|
||||||
|
|
@ -2313,27 +2313,6 @@ namespace HRM.UI.Controllers
|
||||||
|
|
||||||
return Ok(employeeList);
|
return Ok(employeeList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A light Employee (EmployeeLite) for each posted employee ID (body: [1, 2, 3]).
|
|
||||||
/// For screens that pick 10k+ employees and need only a few fields (Bonus Process);
|
|
||||||
/// getEmployeesByEmpIDs returns the whole Employee row and is too heavy for that.
|
|
||||||
/// </summary>
|
|
||||||
[HttpPost("getEmployeeLiteByEmpIDs")]
|
|
||||||
public ActionResult GetEmployeeLiteByEmpIDs([FromBody] List<int> empIds)
|
|
||||||
{
|
|
||||||
List<EmployeeLite> items = new List<EmployeeLite>();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
items = _EmployeeService.GetLiteByEmpIDs(empIds);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ok(items);
|
|
||||||
}
|
|
||||||
[HttpPost("updateBanglaInformation")]
|
[HttpPost("updateBanglaInformation")]
|
||||||
public ActionResult updateBanglaInformation(dynamic data)
|
public ActionResult updateBanglaInformation(dynamic data)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -239,105 +239,6 @@ namespace HRM.UI.Controllers.Payroll
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Bonus Process screen, "Process" button: calculates the bonus (and tax) of the posted employees and
|
|
||||||
/// saves it in the same request — there is no separate Save step. Body: the header and the employee
|
|
||||||
/// IDs only. Returns the saved rows read back from the database. See BonusProcessService.ProcessAndSave.
|
|
||||||
/// </summary>
|
|
||||||
[HttpPost]
|
|
||||||
[Route("processAndSave")]
|
|
||||||
public ActionResult ProcessAndSave([FromBody] BonusProcessAndSaveRequest request)
|
|
||||||
{
|
|
||||||
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
||||||
BonusProcessAndSaveResult result = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
result = _bonusProcessService.ProcessAndSave(request, (int)currentUser.PayrollTypeID, currentUser.UserID);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ok(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Modify dialog, "Calculate": the tax of one saved row for a bonus amount. Nothing is saved.</summary>
|
|
||||||
[HttpPost]
|
|
||||||
[Route("calculateRowTax")]
|
|
||||||
public ActionResult CalculateRowTax([FromBody] BonusProcessRowTaxRequest request)
|
|
||||||
{
|
|
||||||
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
||||||
BonusProcessRowTaxResult result = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
result = _bonusProcessService.CalculateRowTax(request, (int)currentUser.PayrollTypeID);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ok(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Modify dialog, "Save": saves one row (amounts + that employee's bonus tax data); returns the saved row.</summary>
|
|
||||||
[HttpPost]
|
|
||||||
[Route("saveRow")]
|
|
||||||
public ActionResult SaveRow([FromBody] BonusProcessRowSaveRequest request)
|
|
||||||
{
|
|
||||||
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
||||||
BonusProcessGridRow row = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
row = _bonusProcessService.SaveRow(request, (int)currentUser.PayrollTypeID, currentUser.UserID);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ok(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>"Clear Tax": the tax of every row of the process becomes 0 and is saved at once; returns the saved rows.</summary>
|
|
||||||
[HttpPost]
|
|
||||||
[Route("clearTaxAndSave/{bonusProcessID}")]
|
|
||||||
public ActionResult ClearTaxAndSave(int bonusProcessID)
|
|
||||||
{
|
|
||||||
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
||||||
List<BonusProcessGridRow> rows = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
rows = _bonusProcessService.ClearTaxAndSave(bonusProcessID, (int)currentUser.PayrollTypeID, currentUser.UserID);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ok(rows);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Remove button on a saved row: deletes that employee's saved bonus data (and the header when it was the last).</summary>
|
|
||||||
[HttpPost]
|
|
||||||
[Route("removeRow/{bonusProcessDetailID}")]
|
|
||||||
public ActionResult RemoveRow(int bonusProcessDetailID)
|
|
||||||
{
|
|
||||||
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
||||||
BonusProcessRowRemoveResult result = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
result = _bonusProcessService.RemoveRow(bonusProcessDetailID, (int)currentUser.PayrollTypeID);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ok(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route("CalculateBonusTax")]
|
[Route("CalculateBonusTax")]
|
||||||
public ActionResult CalculateBonusTax(List<BonusProcess.BonusProcessDetail> items)
|
public ActionResult CalculateBonusTax(List<BonusProcess.BonusProcessDetail> items)
|
||||||
|
|
|
||||||
|
|
@ -217,5 +217,3 @@
|
||||||
[10-Sep-2026 11:02:56 AM] - Mail Sent to rashedul@celimited.com, From: gtlm@celimited.com, CC: . Subject: D1250-Jamal Hossain, has applied Casual Leave from 10 Sep 2026 to 10 Sep 2026 days:1. Your Approval is required. Body: Dear Shikdar Mamun,<br/><br/>D1250-Jamal Hossain, has applied Casual Leave from 10 Sep 2026 to 10 Sep 2026 days:1. Your Approval is required. To accept the reliever request during the mentioned period, please click on this http://37.61.216.162/sanofi/.<br/><br/>This is a system generated mail, Please do not reply.
|
[10-Sep-2026 11:02:56 AM] - Mail Sent to rashedul@celimited.com, From: gtlm@celimited.com, CC: . Subject: D1250-Jamal Hossain, has applied Casual Leave from 10 Sep 2026 to 10 Sep 2026 days:1. Your Approval is required. Body: Dear Shikdar Mamun,<br/><br/>D1250-Jamal Hossain, has applied Casual Leave from 10 Sep 2026 to 10 Sep 2026 days:1. Your Approval is required. To accept the reliever request during the mentioned period, please click on this http://37.61.216.162/sanofi/.<br/><br/>This is a system generated mail, Please do not reply.
|
||||||
[10-Sep-2026 12:28:14 PM] - Mail Sent to rashedul@celimited.com, From: gtlm@celimited.com, CC: . Subject: D1250-Jamal Hossain, has applied Sick Leave from 11 Sep 2026 to 11 Sep 2026 days:1. Your Approval is required. Body: Dear Shikdar Mamun,<br/><br/>D1250-Jamal Hossain, has applied Sick Leave from 11 Sep 2026 to 11 Sep 2026 days:1. Your Approval is required. To accept the reliever request during the mentioned period, please click on this http://37.61.216.162/sanofi/.<br/><br/>This is a system generated mail, Please do not reply.
|
[10-Sep-2026 12:28:14 PM] - Mail Sent to rashedul@celimited.com, From: gtlm@celimited.com, CC: . Subject: D1250-Jamal Hossain, has applied Sick Leave from 11 Sep 2026 to 11 Sep 2026 days:1. Your Approval is required. Body: Dear Shikdar Mamun,<br/><br/>D1250-Jamal Hossain, has applied Sick Leave from 11 Sep 2026 to 11 Sep 2026 days:1. Your Approval is required. To accept the reliever request during the mentioned period, please click on this http://37.61.216.162/sanofi/.<br/><br/>This is a system generated mail, Please do not reply.
|
||||||
[13-Sep-2026 04:52:45 PM] - Mail Sent to salauddin.shamim@celimited.com, From: gtlm@celimited.com, CC: . Subject: D1265-Shikdar Mamun, has approved your Casual Leave from 10 Sep 2026 to 10 Sep 2026 days:1.. Body: Dear Jamal Hossain,<br/><br/>D1265-Shikdar Mamun, has approved your Casual Leave from 10 Sep 2026 to 10 Sep 2026 days:1. Please click on this http://37.61.216.162/sanofi/ to access.<br/><br/>This is a system generated mail, Please do not reply.
|
[13-Sep-2026 04:52:45 PM] - Mail Sent to salauddin.shamim@celimited.com, From: gtlm@celimited.com, CC: . Subject: D1265-Shikdar Mamun, has approved your Casual Leave from 10 Sep 2026 to 10 Sep 2026 days:1.. Body: Dear Jamal Hossain,<br/><br/>D1265-Shikdar Mamun, has approved your Casual Leave from 10 Sep 2026 to 10 Sep 2026 days:1. Please click on this http://37.61.216.162/sanofi/ to access.<br/><br/>This is a system generated mail, Please do not reply.
|
||||||
[12-Nov-2026 03:10:27 PM] - Mail Sent to rashedul@celimited.com, From: gtlm@celimited.com, CC: . Subject: Bonus process (Festival Bonus) for month - October 2025. Your Approval is required.. Body: Dear Shikdar Mamun,<br/><br/>Bonus process (Festival Bonus) for month - October 2025. Your Approval is required. To accept the reliever request during the mentioned period, please click on this http://37.61.216.162/sanofi/.<br/><br/>This is a system generated mail, Please do not reply.
|
|
||||||
[12-Nov-2026 03:24:45 PM] - Mail Sent to rashedul@celimited.com, From: gtlm@celimited.com, CC: . Subject: Bonus process (Festival Bonus) for month - October 2025. Your Approval is required.. Body: Dear Shikdar Mamun,<br/><br/>Bonus process (Festival Bonus) for month - October 2025. Your Approval is required. To accept the reliever request during the mentioned period, please click on this http://37.61.216.162/sanofi/.<br/><br/>This is a system generated mail, Please do not reply.
|
|
||||||
|
|
|
||||||
|
|
@ -1,143 +0,0 @@
|
||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Warning"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Jwt": {
|
|
||||||
"Secret": "6A2609257D581456601B1F5367702414311F0C2E1B31110F4B383B0C3D2226043F1D7E5B170D255C3245",
|
|
||||||
"Issuer": "492609050A061C37055E31",
|
|
||||||
"Audience": "4C2629050A061C37055B250D28270D26",
|
|
||||||
"TokenLifetimeMinutes": 86400
|
|
||||||
},
|
|
||||||
"LDAPSettings": {
|
|
||||||
"ADServer": "100.100.100.40", // Ad Server
|
|
||||||
"ADServerPort": 389, //636 for LDAPS (SSL)
|
|
||||||
"MasterDomain": "celimited.com",
|
|
||||||
"Domain": "ease.local",
|
|
||||||
"isADLogin": "false", // only true or false
|
|
||||||
"isMFA": "false", // only true or false
|
|
||||||
"MFATimer": "2"
|
|
||||||
},
|
|
||||||
"AppSettings": {
|
|
||||||
"DefaultDB": "spadb3",
|
|
||||||
"AttendanceDataLocation": "C:\\Local\\",
|
|
||||||
"AttendanceDataPassword": "1235",
|
|
||||||
"AttendanceCollectionType": 5,
|
|
||||||
//"Secret": "Computer ease limited, dhaka, bangladesh",
|
|
||||||
"Secret": "fB5fx0XD0nu7Xw7DJy7fLctn+Uq7haV8wngouK3/TuZM9HDoj0ksFimbVGlF+eJI",
|
|
||||||
// JWT signing key (HS512). Must be 64+ ASCII chars since the .NET 10 upgrade (IdentityModel 8 rejects shorter HS512 keys, IDX10720; Ease.Core.Utility.JwtSigningKey stretches a shorter one). Random, one per client/server, never commit it. Changing it signs everyone out once.
|
|
||||||
"downloadFolder": "D:\\Local\\ionic\\Ease.ERP.Api\\Ease.ERP.Api\\DownloadedFiles",
|
|
||||||
"API": {
|
|
||||||
"Title": "FSIE API",
|
|
||||||
"Description": "REST API"
|
|
||||||
},
|
|
||||||
"Swagger": {
|
|
||||||
"Enabled": true
|
|
||||||
},
|
|
||||||
"DbConfig": [
|
|
||||||
{
|
|
||||||
"ConnectionNode": {
|
|
||||||
"ConnectionString": "server=CEL70;Database=EFT;User ID=sa;Password=;",
|
|
||||||
"Key": "spadb",
|
|
||||||
"Provider": "sql",
|
|
||||||
"SqlSyntax": "SQL"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"dbSettings": {
|
|
||||||
//master project DB
|
|
||||||
|
|
||||||
//"Default": "provider=sql;sqlSyntax=SQL;server=103.197.204.164,1718;Database=MasterProjectDB;User Id=DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;",
|
|
||||||
//"SqlCommandConnection": "Data Source=103.197.204.164,1718;Initial Catalog=autocrop;Persist Security Info=True; User ID=DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;", // Development
|
|
||||||
|
|
||||||
"Default": "provider=sql;sqlSyntax=SQL;server=103.197.204.164,1718;Database=MasterProjectDBUATBRAC;User Id= DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;",
|
|
||||||
"SqlCommandConnection": "Data Source=103.197.204.164,1718;Initial Catalog=MasterProjectDBUATBRAC;Persist Security Info=True; User ID=DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;" // Development
|
|
||||||
|
|
||||||
},
|
|
||||||
"Calendar": {
|
|
||||||
"RemindersEnabled": true,
|
|
||||||
"SendMail": true,
|
|
||||||
"RedirectAllMailTo": "",
|
|
||||||
"ReminderGraceMinutes": 60,
|
|
||||||
"TimeZoneId": "",
|
|
||||||
"IcsDomain": "",
|
|
||||||
"OutlookSync": "Ics", // None | Ics | Graph
|
|
||||||
"MaxAttendees": 500,
|
|
||||||
"ScheduleJobsEnabled": true,
|
|
||||||
"ScheduleEmailsEnabled": true
|
|
||||||
},
|
|
||||||
"EmailSettings": {
|
|
||||||
//"WebAddress": "https://celclouds.com/synoviahr/",
|
|
||||||
// live
|
|
||||||
"WebAddress": "http://37.61.216.162/sanofi/", // UAT
|
|
||||||
"SendMethod": "SMTP",
|
|
||||||
"EmailServer": "celimited.com",
|
|
||||||
"FromAddress": "gtlm@celimited.com",
|
|
||||||
"UserID": "gtlm@celimited.com",
|
|
||||||
"Password": "4A2218420C245F295C76",
|
|
||||||
"isSSO": "false",
|
|
||||||
"isNewDashboard": "true",
|
|
||||||
"PortNumber": "587",
|
|
||||||
"EnableSSL": "YES",
|
|
||||||
"SingleSignOn": "NO",
|
|
||||||
"LDAP": "CEL14"
|
|
||||||
|
|
||||||
},
|
|
||||||
"OpenAI": {
|
|
||||||
"ApiKey": "E71627443D1B3B0F6917242B7A2D213648250712000B17165C0E2D1F7E2F6E21022D24253E5D025E0D53607B5D0C5023007536330C307A73203938316E5D09393F1F3154284411121E7C1A7B08740D193E3B55101D03082F222809170911203F1F1F0F4319081E222B04071A10202F2E152F4724223D223D021F794420062354351C06343A000A31537438203037100C631E1508713637232733345A1C1F224D0323222E2F",
|
|
||||||
"Model": "gpt-5"
|
|
||||||
},
|
|
||||||
"Approver": {
|
|
||||||
"ApproverOneId": "1",
|
|
||||||
"ApproverTwoId": "2",
|
|
||||||
"Balance": "1120000"
|
|
||||||
},
|
|
||||||
"EmployeeApiInfo": {
|
|
||||||
"UserId": "sanofi",
|
|
||||||
"Password": "x"
|
|
||||||
},
|
|
||||||
"AdminPendingJob": {
|
|
||||||
"Profile": "Admin",
|
|
||||||
"MedicalClaim": "x"
|
|
||||||
},
|
|
||||||
"RDLCLocation": "",
|
|
||||||
"AllowedHosts": "*",
|
|
||||||
|
|
||||||
// for Synovia only
|
|
||||||
// the emails has to be comma separated (,) not comma
|
|
||||||
// subordinates of first one and others will be just CC
|
|
||||||
//"SalesEmpEmail": "raq@synoviapharma.com;mtamiz.uddin@synoviapharma.com;ashraful.sharif@synoviapharma.com" // Live
|
|
||||||
"SalesEmpEmail": "", // test
|
|
||||||
|
|
||||||
"BankHead": "22010105",
|
|
||||||
"BergerHead": "11010101",
|
|
||||||
"EPFHead": "21020103",
|
|
||||||
"EPFInterestHead": "21020101",
|
|
||||||
"CPFHead": "21020104",
|
|
||||||
"CPFInterestHead": "21020102",
|
|
||||||
"CPFForfittedHead": "22010102",
|
|
||||||
"EPFPerInterest": "41030101",
|
|
||||||
"CPFPerInterest": "41030102",
|
|
||||||
"EPFFractionYearInterest": "41030103",
|
|
||||||
"LoanHead": "11014101",
|
|
||||||
"LoanInterestHead": "31030102",
|
|
||||||
|
|
||||||
"TrainingSettings": {
|
|
||||||
"InProduction": "NO",
|
|
||||||
"ProjectPath": "\\\\100.100.100.164\\c$\\inetpub\\wwwroot\\SGSRevamp",
|
|
||||||
"ServerIP": "100.100.100.164",
|
|
||||||
"UserID": "EASE\\EaseOne",
|
|
||||||
"Password": "cel1@3$5"
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"SAPSettings": {
|
|
||||||
//"URL": "http://s4dev.bergerbd.com:8001/hrapipossrv/prfbpos?sap-client=900",
|
|
||||||
"URL": "http://bpblecchq.bergerbd.com:8000/hrapipossrvn/prfbpos?sap-client=900",
|
|
||||||
"UserID": "dev_odata",
|
|
||||||
"Password": "Missi@n2020"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
38
deploy.ps1
38
deploy.ps1
|
|
@ -11,7 +11,7 @@
|
||||||
# Update these values for each client/environment before running
|
# Update these values for each client/environment before running
|
||||||
|
|
||||||
$baseHref = "/CELHRM_Master/"
|
$baseHref = "/CELHRM_Master/"
|
||||||
$outputFolder = "publish\CELHRM_Master" # relative to this script's folder (repo root); the version is added: CELHRM_Master_<version>
|
$outputFolder = "publish\CELHRM_Master" # relative to this script's folder (repo root)
|
||||||
|
|
||||||
# These never change
|
# These never change
|
||||||
$repoRoot = $PSScriptRoot
|
$repoRoot = $PSScriptRoot
|
||||||
|
|
@ -48,10 +48,6 @@ $newCounter = $lastCounter + 1
|
||||||
$version = "$today-" + $newCounter.ToString("D2") # D2 = always 2 digits (01, 02, 03...)
|
$version = "$today-" + $newCounter.ToString("D2") # D2 = always 2 digits (01, 02, 03...)
|
||||||
$buildTime = (Get-Date).ToUniversalTime().ToString("o")
|
$buildTime = (Get-Date).ToUniversalTime().ToString("o")
|
||||||
|
|
||||||
# Output folder carries the version: e.g. publish\CELHRM_Master_20260517-01
|
|
||||||
$destinationPath = Join-Path $repoRoot ($outputFolder + "_" + $version)
|
|
||||||
$wwwrootPath = Join-Path $destinationPath "wwwroot"
|
|
||||||
|
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host "============================================" -ForegroundColor Cyan
|
Write-Host "============================================" -ForegroundColor Cyan
|
||||||
Write-Host " CEL HRM - Full Build & Deploy Script" -ForegroundColor Cyan
|
Write-Host " CEL HRM - Full Build & Deploy Script" -ForegroundColor Cyan
|
||||||
|
|
@ -136,26 +132,6 @@ Copy-Item -Path $distPath -Destination $wwwrootPath -Recurse -Force
|
||||||
Write-Host "[OK] Angular files copied to: $wwwrootPath" -ForegroundColor Green
|
Write-Host "[OK] Angular files copied to: $wwwrootPath" -ForegroundColor Green
|
||||||
|
|
||||||
|
|
||||||
# ---- STEP 5b: Copy everything in HRM.UI\RDLC into the published RDLC folder ---- #
|
|
||||||
# dotnet publish only copies the RDLC files the csproj lists, so a report (or an
|
|
||||||
# image it uses) can be missing on the server. Copy the whole folder as it is in
|
|
||||||
# the repo, overwriting what publish already put there.
|
|
||||||
|
|
||||||
$rdlcSourcePath = Join-Path $repoRoot "HRM.UI\RDLC"
|
|
||||||
$rdlcDestinationPath = Join-Path $destinationPath "RDLC"
|
|
||||||
|
|
||||||
if (Test-Path $rdlcSourcePath) {
|
|
||||||
if (-not (Test-Path $rdlcDestinationPath)) {
|
|
||||||
New-Item -ItemType Directory -Path $rdlcDestinationPath -Force | Out-Null
|
|
||||||
}
|
|
||||||
Copy-Item -Path (Join-Path $rdlcSourcePath "*") -Destination $rdlcDestinationPath -Recurse -Force
|
|
||||||
$rdlcCount = (Get-ChildItem -Path $rdlcDestinationPath -Recurse -File).Count
|
|
||||||
Write-Host "[OK] RDLC folder copied to: $rdlcDestinationPath ($rdlcCount files)" -ForegroundColor Green
|
|
||||||
} else {
|
|
||||||
Write-Host "[WARN] RDLC folder not found: $rdlcSourcePath (skipped)" -ForegroundColor Yellow
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# ---- STEP 6: Write Angular web.config to wwwroot ---- #
|
# ---- STEP 6: Write Angular web.config to wwwroot ---- #
|
||||||
# This is separate from the backend web.config that dotnet publish
|
# This is separate from the backend web.config that dotnet publish
|
||||||
# already generated at the root of $destinationPath (for the IIS
|
# already generated at the root of $destinationPath (for the IIS
|
||||||
|
|
@ -224,18 +200,6 @@ $angularWebConfig | Out-File -FilePath "$wwwrootPath\web.config" -Encoding utf8
|
||||||
Write-Host "[OK] Angular web.config written to: $wwwrootPath\web.config" -ForegroundColor Green
|
Write-Host "[OK] Angular web.config written to: $wwwrootPath\web.config" -ForegroundColor Green
|
||||||
|
|
||||||
|
|
||||||
# ---- STEP 7: Remove the backend web.config from the version folder ---- #
|
|
||||||
# The server keeps its own web.config (hosting settings per client), so the one
|
|
||||||
# dotnet publish generated at the folder root must not overwrite it on deploy.
|
|
||||||
# Only the root file is removed; wwwroot\web.config (Angular, STEP 6) stays.
|
|
||||||
|
|
||||||
$rootWebConfig = Join-Path $destinationPath "web.config"
|
|
||||||
if (Test-Path $rootWebConfig) {
|
|
||||||
Remove-Item -Path $rootWebConfig -Force
|
|
||||||
Write-Host "[OK] Removed web.config from: $destinationPath" -ForegroundColor Green
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# ---- DONE ---- #
|
# ---- DONE ---- #
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host "============================================" -ForegroundColor Cyan
|
Write-Host "============================================" -ForegroundColor Cyan
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user