Compare commits
3 Commits
main
...
dev_mohaim
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a458cdba4c | ||
|
|
9944262dd1 | ||
|
|
072b0a63c4 |
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -749,11 +749,6 @@ FodyWeavers.xsd
|
|||
# Additional files built by Visual Studio
|
||||
|
||||
# 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).
|
||||
# Not source; regenerated/repopulated by the app.
|
||||
|
|
|
|||
|
|
@ -563,6 +563,7 @@ namespace HRM.BO
|
|||
//void SaveBasicInfo(Employee item);
|
||||
List<Employee> GetByEmpIDs(string empIDs, int payrollTypeID);
|
||||
List<Employee> GetByEmpIDs(string empIDs);
|
||||
List<EmployeeLite> GetLiteByEmpIDs(List<int> empIDs);
|
||||
List<Employee> GetFssEmp(string empIDs, int payrollTypeID);
|
||||
List<Employee> GetEmpsWithDiscontinue(string empIDs, int payrollTypeID);
|
||||
DataSet GetEmpJoining4Novartis(DateTime dEffectDate, int payrollTypeID);
|
||||
|
|
|
|||
17
HRM.BO/Employee/EmployeeLite.cs
Normal file
17
HRM.BO/Employee/EmployeeLite.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
|
|
@ -798,6 +798,34 @@ namespace HRM.DA
|
|||
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)
|
||||
{
|
||||
string sTableName;
|
||||
|
|
|
|||
|
|
@ -212,17 +212,54 @@ namespace HRM.DA
|
|||
DataSet oIncomeTaxs = new DataSet();
|
||||
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 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
|
||||
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
|
||||
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));
|
||||
oIncomeTaxs = tc.ExecuteDataSet(sql);
|
||||
%q st on salarytax.Employeeid=st.employeeid and st.itemcode=-212 and st.itemid=-212;
|
||||
DROP TABLE #tdrEmpIds;",
|
||||
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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -860,8 +860,7 @@ namespace HRM.DA
|
|||
else
|
||||
{
|
||||
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);
|
||||
}
|
||||
List<IncomeTax> incometaxes = new List<IncomeTax>();
|
||||
|
|
|
|||
|
|
@ -1890,6 +1890,51 @@ namespace HRM.DA
|
|||
|
||||
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)
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@ import {TrainingType} from '../../_models/Basic/trainingType';
|
|||
import {EducationType} from '../../_models/HRBasic/education-type';
|
||||
import {NominationPurpose} from '../../_models/HRBasic/nomination-purpose';
|
||||
import {Employee} from '../../_models/Employee/employee';
|
||||
import {EmployeeLite} from '../../_models/Employee/employeeLite';
|
||||
import {EmployeeBankAccount} from '../../_models/Employee/employeeBankAccount';
|
||||
import {EmployeeCostCenter} from '../../_models/Employee/employeeCostCenter';
|
||||
import {Relation} from '../../_models/HRBasic/relation';
|
||||
|
|
@ -135,6 +136,11 @@ export class EmployeeServices {
|
|||
getEmployeesByEmpIDs(data: any) {
|
||||
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) {
|
||||
return this.apiService.httpPost<Employee[]>('/Employee/getEmployeeDetailByEmpIDs', data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,7 +131,10 @@
|
|||
</div>
|
||||
|
||||
<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>
|
||||
<button type="button" kendoGridExcelCommand [svgIcon]="apiService.KendoSVGIcon['fileExcel']">
|
||||
Export to Excel
|
||||
|
|
@ -189,13 +192,13 @@
|
|||
{{(dataItem.changeBonusAmount - dataItem.changeTaxAmount) | number:'1.2-2'}}
|
||||
</ng-template>
|
||||
</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">
|
||||
<button (click)="removefromList(rowIndex)" class="kt-delete" kendoButton [svgIcon]="apiService.KendoSVGIcon['delete']">
|
||||
</button>
|
||||
</ng-template>
|
||||
</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>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import {loadingPanelService} from '../../hrm-loding panel/loding.panel.service';
|
|||
import {PayrollType} from '../../_models/Authentication/payrollType';
|
||||
import {Bonus} from '../../_models/Basic/bonus';
|
||||
import {Employee} from '../../_models/Employee/employee';
|
||||
import {EmployeeLite} from '../../_models/Employee/employeeLite';
|
||||
import {SearchEmployee} from '../../_models/Employee/searchEmployee';
|
||||
import {EnumIncomeTaxItemGroup, EnumStatus, EnumTaxMergeType} from '../../_models/enums';
|
||||
import {BonusProcess, BonusProcessDetail} from '../../_models/Payroll/bonusProcess';
|
||||
|
|
@ -96,7 +97,6 @@ export class BonusProcessComponent implements OnInit {
|
|||
() => {
|
||||
this.loadingPanelService.ShowLoadingPanel = false;
|
||||
});
|
||||
|
||||
this.authSerivce.GetPayrollTypeByLoginID().subscribe(
|
||||
(x) => {
|
||||
this.payrollType = x;
|
||||
|
|
@ -110,7 +110,6 @@ export class BonusProcessComponent implements OnInit {
|
|||
this.cuttofDate = new Date(this.payrollType.nextPayProcessDate);
|
||||
});
|
||||
}
|
||||
|
||||
public GetSelectedEmployee(searchEmp: SearchEmployee[]) {
|
||||
this.processCompleted = false;
|
||||
this.selectedEmps = searchEmp;
|
||||
|
|
@ -134,7 +133,6 @@ export class BonusProcessComponent implements OnInit {
|
|||
this.RefreshDefaultGrid();
|
||||
}
|
||||
}
|
||||
|
||||
RefreshDefaultGrid() {
|
||||
if (this.selectedEmps != undefined && this.bonusProcessDetails != undefined) {
|
||||
if (this.bonusProcess == undefined) {
|
||||
|
|
@ -159,6 +157,7 @@ export class BonusProcessComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
});
|
||||
this.bonusProcess.bonusProcessDetails = [...this.bonusProcess.bonusProcessDetails];
|
||||
this.RefreshEmployees();
|
||||
if (this.alreadyProcessesList.length > 0) {
|
||||
this.showModal = true;
|
||||
|
|
@ -167,37 +166,29 @@ export class BonusProcessComponent implements OnInit {
|
|||
}
|
||||
RefreshEmployees() {
|
||||
if (this.selectedEmps == undefined) return;
|
||||
var ids = SearchEmployee.getEmpIds(this.selectedEmps);
|
||||
|
||||
const data = {
|
||||
dataList: ids,
|
||||
};
|
||||
var emps: Employee[];
|
||||
|
||||
const empIds: number[] = this.selectedEmps.map(e => e.employeeID);
|
||||
var emps: EmployeeLite[];
|
||||
this.loadingPanelService.ShowLoadingPanel = true;
|
||||
this.empService.getEmployeesByEmpIDs(data).subscribe(
|
||||
this.empService.getEmployeeLiteByEmpIDs(empIds).subscribe(
|
||||
(resp: any) => {
|
||||
emps = resp;
|
||||
},
|
||||
(err: any) => {
|
||||
this.loadingPanelService.ShowLoadingPanel = false;
|
||||
this.notificationService.showWarning(err.error);
|
||||
|
||||
},
|
||||
() => {
|
||||
this.loadingPanelService.ShowLoadingPanel = false;
|
||||
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) {
|
||||
this.bonusProcess.bonusProcessDetails[bindex].employee.isConfirmed = x.isConfirmed;
|
||||
this.bonusProcess.bonusProcessDetails[bindex].employee.joiningDate = x.joiningDate;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
checkWithOrTax(from: number, value: boolean) {
|
||||
debugger;
|
||||
if (from == 1) {
|
||||
if (value == true) {
|
||||
this.isTaxProcess = false;
|
||||
|
|
@ -208,35 +199,24 @@ export class BonusProcessComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
onPopUpClose() {
|
||||
this.showModal = false;
|
||||
this.showBonusUpload = false;
|
||||
}
|
||||
|
||||
showBonusUploadPopUp() {
|
||||
this.showBonusUpload = true;
|
||||
}
|
||||
|
||||
currentlyProcess($event) {
|
||||
|
||||
}
|
||||
|
||||
remainingBasic($event) {
|
||||
|
||||
}
|
||||
|
||||
search() {
|
||||
|
||||
}
|
||||
|
||||
process() {
|
||||
if (this.bonusProcess == undefined || this.bonusProcess.bonusProcessDetails.length == 0) {
|
||||
this.notificationService.showWarning('Please select employee for the proces');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var isApproved = false;
|
||||
this.loadingPanelService.ShowLoadingPanel = true;
|
||||
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';
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var returnID: number;
|
||||
this.processRequest = [];
|
||||
var index: number = 0;
|
||||
this.bonusProcess.bonusProcessDetails.forEach(x => {
|
||||
|
||||
this.processRequest.push({
|
||||
'bonusid': this.selectedbonusID,
|
||||
'basicMonth': this.basicDate,
|
||||
|
|
@ -272,7 +249,6 @@ export class BonusProcessComponent implements OnInit {
|
|||
'isTaxProcess': this.isTaxProcess,
|
||||
'empid': x.employeeID
|
||||
});
|
||||
|
||||
});
|
||||
this.errorOrSucessList = [];
|
||||
this.bonusService.BonusProcess(this.processRequest).subscribe(
|
||||
|
|
@ -291,22 +267,17 @@ export class BonusProcessComponent implements OnInit {
|
|||
this.notificationService.showSuccess('Bonus processed successfully');
|
||||
this.returnMessage = 'Bonus processed successfully';
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public BonusvalueChange(value: any): void {
|
||||
this.alreadyProcessesList = [];
|
||||
this.bonusProcess = new BonusProcess();
|
||||
this.bonusProcess.bonusProcessDetails = [];
|
||||
this.selectedEmps = [];
|
||||
this.processCompleted = false;
|
||||
this.pbuttonEnalble = false;
|
||||
|
||||
}
|
||||
|
||||
this.bonusProcess = new BonusProcess();
|
||||
this.bonusProcess.bonusProcessDetails = [];
|
||||
this.selectedEmps = [];
|
||||
this.processCompleted = false;
|
||||
this.pbuttonEnalble = false;
|
||||
}
|
||||
TaxRecalculate() {
|
||||
this.loadingPanelService.ShowLoadingPanel = true;
|
||||
|
||||
|
|
@ -329,13 +300,9 @@ export class BonusProcessComponent implements OnInit {
|
|||
this.pbuttonEnalble = false;
|
||||
this.notificationService.showSuccess('Tax Recalculated processed successfully');
|
||||
this.returnMessage = 'Tax Recalculated processed successfully';
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
uploadBonusFile(event: any): void {
|
||||
debugger;
|
||||
let tempResponse: any;
|
||||
this.selectedFiles = event.target.files;
|
||||
if (this.selectedFiles.length > 0) {
|
||||
|
|
@ -381,41 +348,28 @@ export class BonusProcessComponent implements OnInit {
|
|||
this.notificationService.showWarning('please select a file');
|
||||
}
|
||||
}
|
||||
|
||||
refresh() {
|
||||
|
||||
}
|
||||
|
||||
edit() {
|
||||
|
||||
}
|
||||
|
||||
clearAll() {
|
||||
|
||||
}
|
||||
|
||||
remove() {
|
||||
|
||||
}
|
||||
|
||||
save() {
|
||||
if (this.processCompleted == false) {
|
||||
this.notificationService.showWarning('Please process the Bonus first');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (this.bonusProcess == undefined || this.bonusProcess?.bonusProcessDetails.length == 0) {
|
||||
this.notificationService.showWarning('There are no data to save');
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.isTaxProcess == true && (this.bonusProcess.bonusProcessDetails[0].incomeTaxcoll == undefined
|
||||
|| this.bonusProcess.bonusProcessDetails[0].incomeTaxcoll.length == 0)) {
|
||||
this.notificationService.showWarning('Tax Calculation not yet done');
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.isTaxProcess == true) {
|
||||
var mitem: TaxMergeMaster = undefined;
|
||||
this.taxService.getTaxMergeMaster(EnumTaxMergeType.Bonus, this.selectedbonusID).subscribe(
|
||||
|
|
@ -429,18 +383,14 @@ export class BonusProcessComponent implements OnInit {
|
|||
() => {
|
||||
if (mitem != undefined) {
|
||||
console.log(mitem);
|
||||
|
||||
this.bonusProcess.bonusProcessDetails.every(x => {
|
||||
//console.log(x.incomeTaxcoll);
|
||||
var item = x.incomeTaxcoll.find(y => y.itemGroup == mitem.itemGroup && y.itemID == mitem.itemID);
|
||||
if (item != undefined) {
|
||||
item.thisMonthAmount = x.changeBonusAmount;
|
||||
} else {
|
||||
this.notificationService.showWarning('Income tax amount not found in the collection');
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
item = x.incomeTaxcoll.find(y => y.itemGroup == EnumIncomeTaxItemGroup.Tax_Deducted);
|
||||
if (item != undefined) {
|
||||
item.thisMonthAmount = x.changeTaxAmount;
|
||||
|
|
@ -453,17 +403,117 @@ export class BonusProcessComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
} else {
|
||||
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() {
|
||||
debugger;
|
||||
this.loadingPanelService.ShowLoadingPanel = true;
|
||||
this.bonusProcess.disburseDate = this.payDate;
|
||||
this.bonusProcess.isTaxProcess = this.isTaxProcess;
|
||||
|
|
@ -509,8 +559,16 @@ export class BonusProcessComponent implements OnInit {
|
|||
|
||||
removefromList(rowIndex: number) {
|
||||
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}) {
|
||||
console.log(dataItem);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@
|
|||
<div class="grid">
|
||||
<div class="col-12">
|
||||
<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"
|
||||
(selectedKeysChange)="onSelectedKeysChange($event)" [selectable]="selectableSettings"
|
||||
[kendoGridSelectBy]="'employeeID'">
|
||||
|
|
|
|||
|
|
@ -2293,6 +2293,27 @@ namespace HRM.UI.Controllers
|
|||
|
||||
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")]
|
||||
public ActionResult updateBanglaInformation(dynamic data)
|
||||
{
|
||||
|
|
|
|||
143
HRM.UI/appsettings.json
Normal file
143
HRM.UI/appsettings.json
Normal 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"
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user