Compare commits

...

3 Commits

Author SHA1 Message Date
Mohaimen Hasan
a458cdba4c Bonus Process 2026-11-11 15:54:19 +06:00
Mohaimen Hasan
9944262dd1 Bonus Process Employee Loading 2026-11-11 13:15:14 +06:00
Mohaimen Hasan
072b0a63c4 Done 2026-11-09 18:44:05 +06:00
14 changed files with 443 additions and 83 deletions

5
.gitignore vendored
View File

@ -749,11 +749,6 @@ 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.

View File

@ -563,6 +563,7 @@ 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);

View File

@ -0,0 +1,17 @@
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; }
}
}

View File

@ -798,6 +798,34 @@ 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;

View File

@ -212,17 +212,54 @@ namespace HRM.DA
DataSet oIncomeTaxs = new DataSet(); DataSet oIncomeTaxs = new DataSet();
try try
{ {
string sql = SQLParser.MakeSQL(@"select salarytax.EMPLOYEENO,salarytax.Name,salarytax.EMPLOYEEID, salarytax.TaxAmount SalaryData, st.thisyeartotal TaxData from // The employee IDs used to be spliced in twice as "in(1,2,3,...)". With 10k+ employees
// 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(%q) between %d and %d and ITEMCODE=-129 and ITEMID=-129 and s.EMPLOYEEID in (SELECT ID FROM #tdrEmpIds)
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 (%q) 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)
) 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;
fromdate, toDate, empids, fromdate, toDate, empids, GetTableName(dataFrom)); DROP TABLE #tdrEmpIds;",
oIncomeTaxs = tc.ExecuteDataSet(sql); fromdate, toDate, fromdate, toDate, GetTableName(dataFrom));
// 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)
{ {

View File

@ -860,8 +860,7 @@ namespace HRM.DA
else else
{ {
BonusProcessDA.Update(tc, oBonusProcess); BonusProcessDA.Update(tc, oBonusProcess);
BonusProcessDA.DeleteProcessDetailByProcessID(tc, oBonusProcess.BonusID, oBonusProcess.ID, BonusProcessDA.DeleteProcessDetailByProcessID(tc, oBonusProcess.BonusID, oBonusProcess.ID, oBonusProcess.PayrollTypeID);
oBonusProcess.PayrollTypeID);
BonusProcessDA.DeleteEmpCostCenter(tc, oBonusProcess.ID); BonusProcessDA.DeleteEmpCostCenter(tc, oBonusProcess.ID);
} }
List<IncomeTax> incometaxes = new List<IncomeTax>(); List<IncomeTax> incometaxes = new List<IncomeTax>();

View File

@ -1890,6 +1890,51 @@ 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)
{ {

View File

@ -0,0 +1,7 @@
// 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;
}

View File

@ -11,6 +11,7 @@ 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';
@ -135,6 +136,11 @@ 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);
} }

View File

@ -131,7 +131,10 @@
</div> </div>
<div class="col-12"> <div class="col-12">
<kendo-grid [data]="$safeNavigationMigration(bonusProcess?.bonusProcessDetails)"> <!-- virtual scrolling: only the rows on screen are rendered, so 10k+ employees (two numeric
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
@ -189,13 +192,13 @@
{{(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>
<kendo-grid-command-column title="Remove" width="8%" style="height:98%;"> <kendo-grid-command-column title="Remove" width="8%">
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex"> <ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
<button (click)="removefromList(rowIndex)" class="kt-delete" kendoButton [svgIcon]="apiService.KendoSVGIcon['delete']"> <button (click)="removefromList(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"></kendo-grid-excel> <kendo-grid-excel fileName="BonusProcess.xlsx" [fetchData]="allBonusRows"></kendo-grid-excel>
</kendo-grid> </kendo-grid>
</div> </div>

View File

@ -8,6 +8,7 @@ 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';
@ -96,7 +97,6 @@ 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;
@ -110,7 +110,6 @@ 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[]) {
this.processCompleted = false; this.processCompleted = false;
this.selectedEmps = searchEmp; this.selectedEmps = searchEmp;
@ -134,7 +133,6 @@ 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) {
@ -159,6 +157,7 @@ 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;
@ -167,37 +166,29 @@ export class BonusProcessComponent implements OnInit {
} }
RefreshEmployees() { RefreshEmployees() {
if (this.selectedEmps == undefined) return; if (this.selectedEmps == undefined) return;
var ids = SearchEmployee.getEmpIds(this.selectedEmps); const empIds: number[] = this.selectedEmps.map(e => e.employeeID);
var emps: EmployeeLite[];
const data = {
dataList: ids,
};
var emps: Employee[];
this.loadingPanelService.ShowLoadingPanel = true; this.loadingPanelService.ShowLoadingPanel = true;
this.empService.getEmployeesByEmpIDs(data).subscribe( this.empService.getEmployeeLiteByEmpIDs(empIds).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.id); let bindex = this.bonusProcess.bonusProcessDetails.findIndex(b => b.employeeID == x.employeeID);
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;
@ -208,35 +199,24 @@ 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;
} }
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(
@ -255,13 +235,10 @@ 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;
} }
var returnID: number; var returnID: number;
this.processRequest = []; this.processRequest = [];
var index: number = 0; var index: number = 0;
this.bonusProcess.bonusProcessDetails.forEach(x => { this.bonusProcess.bonusProcessDetails.forEach(x => {
this.processRequest.push({ this.processRequest.push({
'bonusid': this.selectedbonusID, 'bonusid': this.selectedbonusID,
'basicMonth': this.basicDate, 'basicMonth': this.basicDate,
@ -272,7 +249,6 @@ export class BonusProcessComponent implements OnInit {
'isTaxProcess': this.isTaxProcess, 'isTaxProcess': this.isTaxProcess,
'empid': x.employeeID 'empid': x.employeeID
}); });
}); });
this.errorOrSucessList = []; this.errorOrSucessList = [];
this.bonusService.BonusProcess(this.processRequest).subscribe( this.bonusService.BonusProcess(this.processRequest).subscribe(
@ -291,22 +267,17 @@ export class BonusProcessComponent implements OnInit {
this.notificationService.showSuccess('Bonus processed successfully'); this.notificationService.showSuccess('Bonus processed successfully');
this.returnMessage = 'Bonus processed successfully'; this.returnMessage = 'Bonus processed successfully';
}); });
} }
); );
} }
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;
@ -329,13 +300,9 @@ 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) {
@ -381,41 +348,28 @@ 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(
@ -429,18 +383,14 @@ 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;
@ -453,17 +403,117 @@ 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;
@ -509,8 +559,16 @@ export class BonusProcessComponent implements OnInit {
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];
} }
// 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);
} }

View File

@ -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]="true" scrollable="virtual" [skip]="skip" [rowHeight]="36" [pageable]="false" 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'">

View File

@ -2293,6 +2293,27 @@ 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)
{ {

143
HRM.UI/appsettings.json Normal file
View File

@ -0,0 +1,143 @@
{
"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=MasterProjectDBBRAC;User Id= DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;",
"SqlCommandConnection": "Data Source=103.197.204.164,1718;Initial Catalog=MasterProjectDBBRAC;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"
}
}