Employee Profile and Prod bonus setup
This commit is contained in:
parent
5b834601eb
commit
cde8907768
|
@ -542,6 +542,7 @@ namespace HRM.BO
|
||||||
void UpdatePayrollType(int empID, int payrollTypeID, DateTime dEffectDate);
|
void UpdatePayrollType(int empID, int payrollTypeID, DateTime dEffectDate);
|
||||||
//void SaveIntegration(List<HREmployee> oEmps);
|
//void SaveIntegration(List<HREmployee> oEmps);
|
||||||
int Save(Employee item);
|
int Save(Employee item);
|
||||||
|
Employee SaveEmployee(Employee item);
|
||||||
//void Delete(int id);
|
//void Delete(int id);
|
||||||
//void DeleteAll();
|
//void DeleteAll();
|
||||||
//string GenerateLoanNo(Employee oEmp, string sLoanName);
|
//string GenerateLoanNo(Employee oEmp, string sLoanName);
|
||||||
|
|
|
@ -2358,7 +2358,7 @@ namespace HRM.BO
|
||||||
#region parent's function definition
|
#region parent's function definition
|
||||||
|
|
||||||
HREmployee Get(int id);
|
HREmployee Get(int id);
|
||||||
int SavePersonalInfo(HREmployee employee);
|
HREmployee SavePersonalInfo(HREmployee employee);
|
||||||
void SaveEmployeeProfileUpload(List<HREmployee> oHREmployee);
|
void SaveEmployeeProfileUpload(List<HREmployee> oHREmployee);
|
||||||
void DeleteChildData(string tableName, string columnName, int id);
|
void DeleteChildData(string tableName, string columnName, int id);
|
||||||
List<HREmployee> GetAllHREmps();
|
List<HREmployee> GetAllHREmps();
|
||||||
|
|
|
@ -1985,6 +1985,39 @@ namespace HRM.DA
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public Employee SaveEmployee(Employee oEmployee)
|
||||||
|
{
|
||||||
|
TransactionContext tc = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
tc = TransactionContext.Begin(true);
|
||||||
|
if (oEmployee.IsNew)
|
||||||
|
{
|
||||||
|
int id = tc.GenerateID("Employee", "EmployeeID");
|
||||||
|
base.SetObjectID(oEmployee, id);
|
||||||
|
oEmployee.EmployeeNo = new HREmployeeService().GetNextEmployeeNo(tc);
|
||||||
|
EmployeeDA.Insert(tc, oEmployee);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EmployeeDA.Update(tc, oEmployee);
|
||||||
|
}
|
||||||
|
|
||||||
|
tc.End();
|
||||||
|
return oEmployee;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
#region Handle Exception
|
||||||
|
|
||||||
|
if (tc != null)
|
||||||
|
tc.HandleError();
|
||||||
|
ExceptionLog.Write(e);
|
||||||
|
throw new ServiceException(e.Message, e);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int SaveHnmEmployee(List<object> employeeData)
|
public int SaveHnmEmployee(List<object> employeeData)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2723,7 +2723,7 @@ namespace HRM.DA
|
||||||
tc.End();
|
tc.End();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int SavePersonalInfo(HREmployee employee)
|
public HREmployee SavePersonalInfo(HREmployee employee)
|
||||||
{
|
{
|
||||||
TransactionContext tc = null;
|
TransactionContext tc = null;
|
||||||
try
|
try
|
||||||
|
@ -2738,7 +2738,7 @@ namespace HRM.DA
|
||||||
if (employee.IsNew)
|
if (employee.IsNew)
|
||||||
{
|
{
|
||||||
this.SetObjectID(employee, (HREmployeeDA.GetNewID(tc)));
|
this.SetObjectID(employee, (HREmployeeDA.GetNewID(tc)));
|
||||||
|
employee.EmployeeNo = this.GetNextEmployeeNo(tc);
|
||||||
HREmployeeDA.Insert(tc, employee);
|
HREmployeeDA.Insert(tc, employee);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2750,7 +2750,7 @@ namespace HRM.DA
|
||||||
|
|
||||||
|
|
||||||
tc.End();
|
tc.End();
|
||||||
return employee.ID;
|
return employee;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -2764,7 +2764,35 @@ namespace HRM.DA
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public string GetNextEmployeeNo(TransactionContext tc)
|
||||||
|
{
|
||||||
|
string nextEmployeeNo = string.Empty;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
object obj = tc.ExecuteScalar("SELECT MAX(Cast(EmployeeNo AS Decimal(18,0)))+1 FROM EMPLOYEE");
|
||||||
|
if (obj == DBNull.Value)
|
||||||
|
{
|
||||||
|
nextEmployeeNo = "1";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextEmployeeNo = Convert.ToString(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
#region Handle Exception
|
||||||
|
if (tc != null)
|
||||||
|
tc.HandleError();
|
||||||
|
ExceptionLog.Write(e);
|
||||||
|
throw new Exception(e.Message, e);
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
return nextEmployeeNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public int Save(HREmployee employee)
|
public int Save(HREmployee employee)
|
||||||
|
|
|
@ -172,7 +172,7 @@
|
||||||
<div class="p-col-12 p-lg-12" align="right" style="margin-top: 20px;">
|
<div class="p-col-12 p-lg-12" align="right" style="margin-top: 20px;">
|
||||||
|
|
||||||
<button class="k-button k-primary" kendoButton icon="save"
|
<button class="k-button k-primary" kendoButton icon="save"
|
||||||
(click)="saveGeneratedEmployee()">
|
(click)="SavePersonalInfo()">
|
||||||
<!-- (click)="SavePersonalInfo()"> -->
|
<!-- (click)="SavePersonalInfo()"> -->
|
||||||
Save
|
Save
|
||||||
</button>
|
</button>
|
||||||
|
@ -361,7 +361,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="p-col-12 p-md-12 p-lg-4" style="margin-top: 11px;" align="right">
|
<div class="p-col-12 p-md-12 p-lg-4" style="margin-top: 11px;" align="right">
|
||||||
<button class="k-button k-primary" kendoButton icon="save"
|
<button class="k-button k-primary" kendoButton icon="save"
|
||||||
(click)="saveGeneratedEmployee()">
|
(click)="SavePersonalInfo()">
|
||||||
<!-- (click)="SavePersonalInfo()"> -->
|
<!-- (click)="SavePersonalInfo()"> -->
|
||||||
Save
|
Save
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -386,29 +386,29 @@ export class GeneralComponent implements OnInit {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public saveGeneratedEmployee() {
|
// public saveGeneratedEmployee() {
|
||||||
debugger
|
// debugger
|
||||||
if (this.active == false) {
|
// if (this.active == false) {
|
||||||
this.loadingPanel.ShowLoadingPanel = true;
|
// this.loadingPanel.ShowLoadingPanel = true;
|
||||||
this.employeeService.generateEmployeeNo().subscribe(
|
// this.employeeService.generateEmployeeNo().subscribe(
|
||||||
(resp) => {
|
// (resp) => {
|
||||||
this.employeeService.hrEmployee.employeeNo = resp as string;
|
// this.employeeService.hrEmployee.employeeNo = resp as string;
|
||||||
},
|
// },
|
||||||
(err) => {
|
// (err) => {
|
||||||
this.notificationService.showError(err);
|
// this.notificationService.showError(err);
|
||||||
this.loadingPanel.ShowLoadingPanel = false;
|
// this.loadingPanel.ShowLoadingPanel = false;
|
||||||
},
|
// },
|
||||||
() => {
|
// () => {
|
||||||
this.loadingPanel.ShowLoadingPanel = false; setTimeout(() => {
|
// this.loadingPanel.ShowLoadingPanel = false; setTimeout(() => {
|
||||||
this.SavePersonalInfo();
|
// this.SavePersonalInfo();
|
||||||
}, 1000);
|
// }, 1000);
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
else{
|
// else{
|
||||||
this.SavePersonalInfo();
|
// this.SavePersonalInfo();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
SavePersonalInfo() {
|
SavePersonalInfo() {
|
||||||
// console.log(this.hrEmployee.banglaName);
|
// console.log(this.hrEmployee.banglaName);
|
||||||
// return;
|
// return;
|
||||||
|
@ -424,12 +424,18 @@ export class GeneralComponent implements OnInit {
|
||||||
if (this.hrEmployee.lastName !== null) {
|
if (this.hrEmployee.lastName !== null) {
|
||||||
this.hrEmployee.name += ' ' + this.hrEmployee.lastName;
|
this.hrEmployee.name += ' ' + this.hrEmployee.lastName;
|
||||||
}
|
}
|
||||||
if (this.employeeService.hrEmployee.employeeNo.length > 0) {
|
// if (this.employeeService.hrEmployee.employeeNo.length > 0) {
|
||||||
this.hrEmployee.employeeNo = this.employeeService.hrEmployee.employeeNo;
|
// this.hrEmployee.employeeNo = this.employeeService.hrEmployee.employeeNo;
|
||||||
}
|
// }
|
||||||
this.employeeService.saveHrPersonalInfo(this.hrEmployee).subscribe(
|
this.employeeService.saveHrPersonalInfo(this.hrEmployee).subscribe(
|
||||||
(resp: any) => {
|
(resp: HrEmployee) => {
|
||||||
this.hrEmployee.id = resp;
|
if(resp != undefined){
|
||||||
|
this.hrEmployee.id = resp.id;
|
||||||
|
if (this.active == false) {
|
||||||
|
this.hrEmployee.employeeNo = resp.employeeNo;
|
||||||
|
this.employeeService.hrEmployee.employeeNo = resp.employeeNo;
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
(err: any) => {
|
(err: any) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
|
|
@ -187,7 +187,7 @@
|
||||||
style="width:80%">Add</button>
|
style="width:80%">Add</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<kendo-grid [kendoGridBinding]="prodBonusLine.prodBonusSupervisors" [sortable]="true" [style.height.%]="100"
|
<kendo-grid [kendoGridBinding]="prodBonusLine.prodBonusSupervisors" [sortable]="true" [style.height.px]="250"
|
||||||
[reorderable]="true">
|
[reorderable]="true">
|
||||||
<!-- [resizable]="true" [pageSize]="state.take" [skip]="state.skip"
|
<!-- [resizable]="true" [pageSize]="state.take" [skip]="state.skip"
|
||||||
[sort]="state.sort" [pageable]="true" (dataStateChange)="dataStateChange($event)">-->
|
[sort]="state.sort" [pageable]="true" (dataStateChange)="dataStateChange($event)">-->
|
||||||
|
@ -195,23 +195,23 @@
|
||||||
<!-- <ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
|
<!-- <ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
|
||||||
</ng-template> -->
|
</ng-template> -->
|
||||||
</kendo-grid-column>
|
</kendo-grid-column>
|
||||||
<kendo-grid-column field="employeeNo" title="Employee No" [width]="100">
|
<kendo-grid-column field="employeeNo" title="Employee No" [width]="80">
|
||||||
<!-- <ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
|
<!-- <ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
|
||||||
</ng-template> -->
|
</ng-template> -->
|
||||||
</kendo-grid-column>
|
</kendo-grid-column>
|
||||||
|
|
||||||
<kendo-grid-column field="devGrantParentName" title="top Parent (section)" [width]="120">
|
<kendo-grid-column field="devGrantParentName" title="Top Parent (section)" [width]="90">
|
||||||
</kendo-grid-column>
|
</kendo-grid-column>
|
||||||
<kendo-grid-column field="devParentName" title="parent (floor)" [width]="120">
|
<kendo-grid-column field="devParentName" title="Parent (floor)" [width]="80">
|
||||||
</kendo-grid-column>
|
</kendo-grid-column>
|
||||||
|
|
||||||
<kendo-grid-column field="devName" title="posted" [width]="120">
|
<kendo-grid-column field="devName" title="Posted" [width]="80">
|
||||||
</kendo-grid-column>
|
</kendo-grid-column>
|
||||||
|
|
||||||
|
|
||||||
<kendo-grid-column field="bonusPercent" title="Bonus Percent" [width]="100">
|
<kendo-grid-column field="bonusPercent" title="Bonus Percent" [width]="80">
|
||||||
</kendo-grid-column>
|
</kendo-grid-column>
|
||||||
<kendo-grid-column title="Actions" [width]="50">
|
<kendo-grid-column title="Actions" [width]="85">
|
||||||
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
|
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
|
||||||
<button type="button" kendoButton icon="delete" class="kt-delete"
|
<button type="button" kendoButton icon="delete" class="kt-delete"
|
||||||
style="width: fit-content;" (click)="onClickRemoveSupervisors(dataItem)">
|
style="width: fit-content;" (click)="onClickRemoveSupervisors(dataItem)">
|
||||||
|
|
|
@ -71,8 +71,8 @@ export class ProductionBonusSetupComponent implements OnInit {
|
||||||
prodBonusSupervisor: ProdBonusSupervisor;
|
prodBonusSupervisor: ProdBonusSupervisor;
|
||||||
prodBonusParameter: ProdBonusParameter;
|
prodBonusParameter: ProdBonusParameter;
|
||||||
|
|
||||||
prodBonusAttn: ProdBonusAttn[];
|
prodBonusAttn: ProdBonusAttn[];
|
||||||
depts: Department[] = [];
|
depts: Department[] = [];
|
||||||
layoutNo: string;
|
layoutNo: string;
|
||||||
// programName: string;
|
// programName: string;
|
||||||
// maxPerson: number;
|
// maxPerson: number;
|
||||||
|
@ -106,7 +106,7 @@ export class ProductionBonusSetupComponent implements OnInit {
|
||||||
department: Department;
|
department: Department;
|
||||||
|
|
||||||
selectedRow: any;
|
selectedRow: any;
|
||||||
scheduleTime: any;
|
scheduleTime: any;
|
||||||
|
|
||||||
|
|
||||||
editDetails: boolean = false;
|
editDetails: boolean = false;
|
||||||
|
@ -125,39 +125,39 @@ export class ProductionBonusSetupComponent implements OnInit {
|
||||||
this.prodBonusSupervisor = new ProdBonusSupervisor();
|
this.prodBonusSupervisor = new ProdBonusSupervisor();
|
||||||
this.prodBonusParameter = new ProdBonusParameter();
|
this.prodBonusParameter = new ProdBonusParameter();
|
||||||
this.prodBonusWork = new ProdBonusWorkSchedule();
|
this.prodBonusWork = new ProdBonusWorkSchedule();
|
||||||
this.getBonusType();
|
this.getBonusType();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OnclickCheckbox() {
|
OnclickCheckbox() {
|
||||||
debugger;
|
debugger;
|
||||||
if (this.isNewLayout === false) {
|
if (this.isNewLayout === false) {
|
||||||
this.isNewLayout = true;
|
this.isNewLayout = true;
|
||||||
this.productionBonusSetup = new ProductionBonusSetup();
|
this.productionBonusSetup = new ProductionBonusSetup();
|
||||||
this.prodBonusLine = new ProdBonusLine();
|
this.prodBonusLine = new ProdBonusLine();
|
||||||
this.prodBonusSupervisor = new ProdBonusSupervisor();
|
this.prodBonusSupervisor = new ProdBonusSupervisor();
|
||||||
this.prodBonusParameter = new ProdBonusParameter();
|
this.prodBonusParameter = new ProdBonusParameter();
|
||||||
this.prodBonusWork = new ProdBonusWorkSchedule();
|
this.prodBonusWork = new ProdBonusWorkSchedule();
|
||||||
this.productionBonusSetup.fromDate = new Date();
|
this.productionBonusSetup.fromDate = new Date();
|
||||||
this.productionBonusSetup.toDate = new Date();
|
this.productionBonusSetup.toDate = new Date();
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.isNewLayout = false;
|
|
||||||
this.productionBonusSetup.fromDate = undefined;
|
|
||||||
this.productionBonusSetup.toDate = undefined;
|
|
||||||
|
|
||||||
}
|
|
||||||
this.prodBSdata = undefined;
|
|
||||||
this.filteredProdBSdata = undefined;
|
|
||||||
this.selectedProdBSdata = undefined;
|
|
||||||
this.selectedBonusType = {
|
|
||||||
label: 'Select Bonus Type...',
|
|
||||||
value: null
|
|
||||||
}
|
|
||||||
this.editDetails = false;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
this.isNewLayout = false;
|
||||||
|
this.productionBonusSetup.fromDate = undefined;
|
||||||
|
this.productionBonusSetup.toDate = undefined;
|
||||||
|
|
||||||
|
}
|
||||||
|
this.prodBSdata = undefined;
|
||||||
|
this.filteredProdBSdata = undefined;
|
||||||
|
this.selectedProdBSdata = undefined;
|
||||||
|
this.selectedBonusType = {
|
||||||
|
label: 'Select Bonus Type...',
|
||||||
|
value: null
|
||||||
|
}
|
||||||
|
this.editDetails = false;
|
||||||
|
}
|
||||||
|
|
||||||
handleFilter(value) {
|
handleFilter(value) {
|
||||||
this.filteredProdBSdata = this.prodBSdata.filter(
|
this.filteredProdBSdata = this.prodBSdata.filter(
|
||||||
|
@ -272,97 +272,97 @@ export class ProductionBonusSetupComponent implements OnInit {
|
||||||
this.bonusPercent = 0;
|
this.bonusPercent = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
onClickAddLine(): void {
|
onClickAddLine(): void {
|
||||||
debugger;
|
debugger;
|
||||||
// this.onEdit = false;
|
// this.onEdit = false;
|
||||||
this.isNewLine = true;
|
this.isNewLine = true;
|
||||||
this.selectedRow = new ProdBonusLine();
|
this.selectedRow = new ProdBonusLine();
|
||||||
|
|
||||||
this._departmentPicker = new DynamicPicker(EnumDynamicpickerType.Department, false);
|
this._departmentPicker = new DynamicPicker(EnumDynamicpickerType.Department, false);
|
||||||
this.prodBonusLine = new ProdBonusLine();
|
this.prodBonusLine = new ProdBonusLine();
|
||||||
this.prodBonusWork = new ProdBonusWorkSchedule();
|
this.prodBonusWork = new ProdBonusWorkSchedule();
|
||||||
if (this.isNewLayout) {//Add Setup line
|
if (this.isNewLayout) {//Add Setup line
|
||||||
|
|
||||||
if (this.selectedBonusType === undefined || this.selectedBonusType === null) {
|
if (this.selectedBonusType === undefined || this.selectedBonusType === null) {
|
||||||
return this.notificationService.showWarning('Please select Bonus Type');
|
return this.notificationService.showWarning('Please select Bonus Type');
|
||||||
}
|
}
|
||||||
this.saveProductionBonusSetup();
|
this.saveProductionBonusSetup();
|
||||||
// console.log(this.productionBonusSetup);
|
// console.log(this.productionBonusSetup);
|
||||||
debugger;
|
debugger;
|
||||||
if (this.productionBonusSetup.designNo === '' || this.productionBonusSetup.programName === '' || this.productionBonusSetup.fromDate === undefined ||
|
if (this.productionBonusSetup.designNo === '' || this.productionBonusSetup.programName === '' || this.productionBonusSetup.fromDate === undefined ||
|
||||||
this.productionBonusSetup.toDate === undefined || this.productionBonusSetup.productionBonusType === null) {
|
this.productionBonusSetup.toDate === undefined || this.productionBonusSetup.productionBonusType === null) {
|
||||||
this.notificationService.showWarning('Please fill up the information of production bonus setup');
|
this.notificationService.showWarning('Please fill up the information of production bonus setup');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.prodBonusLine.prodBonusSupervisors = [];
|
this.prodBonusLine.prodBonusSupervisors = [];
|
||||||
this.prodBonusLine.prodBonusWorkSchedules = [];
|
this.prodBonusLine.prodBonusWorkSchedules = [];
|
||||||
|
|
||||||
// console.log(this.prodBonusLine);
|
|
||||||
|
|
||||||
// for (let j = 0; j < this.productionBonusSetup.productionBonusLines.length; j++) {
|
|
||||||
// for (let i = 0; i < this.productionBonusSetup.productionBonusLines[i].prodBonusSupervisors.length; i++)
|
|
||||||
// this.prodBonusLine.prodBonusSupervisors = this.productionBonusSetup.productionBonusLines[i].prodBonusSupervisors;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
else { //Edit Setup line
|
|
||||||
// console.log(this.productionBonusSetup);
|
|
||||||
debugger;
|
|
||||||
this.prodBonusLine.prodBonusSupervisors = [];
|
|
||||||
this.prodBonusLine.prodBonusWorkSchedules = [];
|
|
||||||
|
|
||||||
}
|
|
||||||
this.opened = true;
|
|
||||||
// create schedule
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = true;
|
|
||||||
debugger;
|
|
||||||
if (this.prodBonusLine.id !== 0) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// console.log(this.prodBonusLine);
|
||||||
|
|
||||||
|
// for (let j = 0; j < this.productionBonusSetup.productionBonusLines.length; j++) {
|
||||||
|
// for (let i = 0; i < this.productionBonusSetup.productionBonusLines[i].prodBonusSupervisors.length; i++)
|
||||||
|
// this.prodBonusLine.prodBonusSupervisors = this.productionBonusSetup.productionBonusLines[i].prodBonusSupervisors;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
else { //Edit Setup line
|
||||||
|
// console.log(this.productionBonusSetup);
|
||||||
|
debugger;
|
||||||
|
this.prodBonusLine.prodBonusSupervisors = [];
|
||||||
|
this.prodBonusLine.prodBonusWorkSchedules = [];
|
||||||
|
|
||||||
|
}
|
||||||
|
this.opened = true;
|
||||||
|
// create schedule
|
||||||
|
this.loadingPanelService.ShowLoadingPanel = true;
|
||||||
|
debugger;
|
||||||
|
if (this.prodBonusLine.id !== 0) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScheduleTime(dataItem: any) {
|
|
||||||
console.log('line');
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GetScheduleTime(dataItem: any) {
|
||||||
|
console.log('line');
|
||||||
|
console.log(this.prodBonusLine.prodBonusWorkSchedules);
|
||||||
|
this.loadingPanelService.ShowLoadingPanel = true;
|
||||||
|
this.bonusService.GetschedulewithTime(this.prodBonusLine.prodBonusWorkSchedules[0].prodBonusLineID).subscribe(
|
||||||
|
(resp) => {
|
||||||
|
this.scheduleTime = resp;
|
||||||
|
},
|
||||||
|
(err: any) => {
|
||||||
|
this.notificationService.showError(err.error);
|
||||||
|
this.loadingPanelService.ShowLoadingPanel = false;
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
console.log(this.scheduleTime);
|
||||||
|
if (this.prodBonusLine.prodBonusWorkSchedules != undefined) {
|
||||||
|
var pdrs = this.prodBonusLine.prodBonusWorkSchedules;
|
||||||
|
pdrs.forEach(x => {
|
||||||
|
var item = this.scheduleTime.find(y => y.startDateTime == x.startDateTime);
|
||||||
|
if (item != undefined) {
|
||||||
|
x.inTime = new Date(item.inTime);
|
||||||
|
x.outTime = new Date(item.outTime);
|
||||||
|
x.totalCount = item.scheduleCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
console.log(this.prodBonusLine.prodBonusWorkSchedules);
|
console.log(this.prodBonusLine.prodBonusWorkSchedules);
|
||||||
this.loadingPanelService.ShowLoadingPanel = true;
|
this.loadingPanelService.ShowLoadingPanel = false;
|
||||||
this.bonusService.GetschedulewithTime(this.prodBonusLine.prodBonusWorkSchedules[0].prodBonusLineID).subscribe(
|
}
|
||||||
(resp) => {
|
);
|
||||||
this.scheduleTime = resp;
|
}
|
||||||
},
|
|
||||||
(err: any) => {
|
|
||||||
this.notificationService.showError(err.error);
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
console.log(this.scheduleTime);
|
|
||||||
if (this.prodBonusLine.prodBonusWorkSchedules != undefined) {
|
|
||||||
var pdrs = this.prodBonusLine.prodBonusWorkSchedules;
|
|
||||||
pdrs.forEach(x => {
|
|
||||||
var item = this.scheduleTime.find(y => y.startDateTime == x.startDateTime);
|
|
||||||
if (item != undefined) {
|
|
||||||
x.inTime = new Date( item.inTime);
|
|
||||||
x.outTime = new Date( item.outTime);
|
|
||||||
x.totalCount = item.scheduleCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
console.log(this.prodBonusLine.prodBonusWorkSchedules);
|
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
onCellClickEdit(dataItem: ProdBonusLine) {
|
onCellClickEdit(dataItem: ProdBonusLine) {
|
||||||
|
|
||||||
// console.log(dataItem);
|
// console.log(dataItem);
|
||||||
this.isNewLine = false;
|
this.isNewLine = false;
|
||||||
this.prodBonusLine = new ProdBonusLine();
|
this.prodBonusLine = new ProdBonusLine();
|
||||||
|
|
||||||
// if (this.isNewLayout) { //ADD Line
|
// if (this.isNewLayout) { //ADD Line
|
||||||
// this.prodBonusLine.prodBonusSupervisors = [];
|
// this.prodBonusLine.prodBonusSupervisors = [];
|
||||||
// this.prodBonusLine.prodBonusWorkSchedules = [];
|
// this.prodBonusLine.prodBonusWorkSchedules = [];
|
||||||
|
@ -397,26 +397,26 @@ export class ProductionBonusSetupComponent implements OnInit {
|
||||||
this.opened = true;
|
this.opened = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
newLine() {
|
newLine() {
|
||||||
if ((this._departmentPicker.selectedID === undefined || this._departmentPicker.selectedID === 0) &&
|
if ((this._departmentPicker.selectedID === undefined || this._departmentPicker.selectedID === 0) &&
|
||||||
(this.prodBonusLine.lineName === '' || this.prodBonusLine.lineName === undefined)) {
|
(this.prodBonusLine.lineName === '' || this.prodBonusLine.lineName === undefined)) {
|
||||||
this.notificationService.showWarning('Please Select a Line');
|
this.notificationService.showWarning('Please Select a Line');
|
||||||
this.close();
|
this.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this._employee === undefined || this._employee.id === 0) {
|
if (this._employee === undefined || this._employee.id === 0) {
|
||||||
this.notificationService.showWarning('Please Select Supervisor');
|
this.notificationService.showWarning('Please Select Supervisor');
|
||||||
this.close();
|
this.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// if (this.scheduledHours === undefined || this.scheduledHours === 0) {
|
// if (this.scheduledHours === undefined || this.scheduledHours === 0) {
|
||||||
// this.notificationService.showWarning('Please Select Scheduled Hours');
|
// this.notificationService.showWarning('Please Select Scheduled Hours');
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
// if (this.bonusPercent === undefined || this.bonusPercent === 0) {
|
// if (this.bonusPercent === undefined || this.bonusPercent === 0) {
|
||||||
// this.notificationService.showWarning('Please Select Bonus Percentage');
|
// this.notificationService.showWarning('Please Select Bonus Percentage');
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
debugger;
|
debugger;
|
||||||
|
@ -430,9 +430,9 @@ export class ProductionBonusSetupComponent implements OnInit {
|
||||||
}
|
}
|
||||||
// this.isNewLine = true;
|
// this.isNewLine = true;
|
||||||
|
|
||||||
var newlineSupervisor: ProdBonusSupervisor = new ProdBonusSupervisor();
|
var newlineSupervisor: ProdBonusSupervisor = new ProdBonusSupervisor();
|
||||||
var newlineParameter: ProdBonusParameter = new ProdBonusParameter();
|
var newlineParameter: ProdBonusParameter = new ProdBonusParameter();
|
||||||
// var newLayoutWork: ProdBonusWorkSchedule = new ProdBonusWorkSchedule();
|
// var newLayoutWork: ProdBonusWorkSchedule = new ProdBonusWorkSchedule();
|
||||||
|
|
||||||
const index = this.prodBonusLine.prodBonusSupervisors.findIndex(sv => sv.employeeID == this._employee.id);
|
const index = this.prodBonusLine.prodBonusSupervisors.findIndex(sv => sv.employeeID == this._employee.id);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
|
@ -445,10 +445,10 @@ export class ProductionBonusSetupComponent implements OnInit {
|
||||||
newlineSupervisor.bonusPercent = this.bonusPercent;
|
newlineSupervisor.bonusPercent = this.bonusPercent;
|
||||||
newlineSupervisor.prodBonusSetupID = this.productionBonusSetup.id;
|
newlineSupervisor.prodBonusSetupID = this.productionBonusSetup.id;
|
||||||
|
|
||||||
if (this.isNewLine) {
|
if (this.isNewLine) {
|
||||||
newlineParameter.itemID = this._departmentPicker.selectedID;
|
newlineParameter.itemID = this._departmentPicker.selectedID;
|
||||||
newlineParameter.itemType = 0;
|
newlineParameter.itemType = 0;
|
||||||
newlineParameter.prodBonusSetupID = this.productionBonusSetup.id;
|
newlineParameter.prodBonusSetupID = this.productionBonusSetup.id;
|
||||||
|
|
||||||
// var department;
|
// var department;
|
||||||
this.basicService.getDepartmentByID(this._departmentPicker.selectedID).subscribe(
|
this.basicService.getDepartmentByID(this._departmentPicker.selectedID).subscribe(
|
||||||
|
@ -484,7 +484,7 @@ export class ProductionBonusSetupComponent implements OnInit {
|
||||||
// this.prodBonusLine.prodBonusWorkSchedules.push(newLayoutWork);
|
// this.prodBonusLine.prodBonusWorkSchedules.push(newLayoutWork);
|
||||||
// currentDate.setDate(currentDate.getDate() + 1);
|
// currentDate.setDate(currentDate.getDate() + 1);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// //Commented For Test
|
// //Commented For Test
|
||||||
// for (let i = 0; currentDate <= this.productionBonusSetup.toDate; i++) {
|
// for (let i = 0; currentDate <= this.productionBonusSetup.toDate; i++) {
|
||||||
// let newLayoutWork: ProdBonusWorkSchedule = {
|
// let newLayoutWork: ProdBonusWorkSchedule = {
|
||||||
|
@ -508,13 +508,13 @@ export class ProductionBonusSetupComponent implements OnInit {
|
||||||
// this.prodBonusLine.prodBonusParameters.push(newlineParameter);
|
// this.prodBonusLine.prodBonusParameters.push(newlineParameter);
|
||||||
|
|
||||||
|
|
||||||
// console.log(this.prodBonusLine);
|
// console.log(this.prodBonusLine);
|
||||||
this.clearProdbonusLine();
|
this.clearProdbonusLine();
|
||||||
// this.notificationService.showSuccess('Supervisor added to the line');
|
// this.notificationService.showSuccess('Supervisor added to the line');
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
saveProductionBonusSetup(): void {
|
saveProductionBonusSetup(): void {
|
||||||
this.productionBonusSetup.salaryMonth = this.selectedSalaryDate;
|
this.productionBonusSetup.salaryMonth = this.selectedSalaryDate;
|
||||||
if (this.isNewLayout)
|
if (this.isNewLayout)
|
||||||
|
@ -593,9 +593,16 @@ export class ProductionBonusSetupComponent implements OnInit {
|
||||||
}
|
}
|
||||||
onClickRemoveSupervisors(data: any) {
|
onClickRemoveSupervisors(data: any) {
|
||||||
debugger;
|
debugger;
|
||||||
const index = this.prodBonusLine.prodBonusSupervisors.findIndex(item => item.id === data.id);
|
if (data.id == 0) {
|
||||||
if (index !== -1) {
|
const index = this.prodBonusLine.prodBonusSupervisors.findIndex(item => item.employeeID === data.employeeID);
|
||||||
this.prodBonusLine.prodBonusSupervisors.splice(index, 1);
|
if (index !== -1) {
|
||||||
|
this.prodBonusLine.prodBonusSupervisors.splice(index, 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const index = this.prodBonusLine.prodBonusSupervisors.findIndex(item => item.id === data.id);
|
||||||
|
if (index !== -1) {
|
||||||
|
this.prodBonusLine.prodBonusSupervisors.splice(index, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clearFields() {
|
clearFields() {
|
||||||
|
@ -620,7 +627,7 @@ export class ProductionBonusSetupComponent implements OnInit {
|
||||||
createWorkSchedule(data: any) {
|
createWorkSchedule(data: any) {
|
||||||
debugger;
|
debugger;
|
||||||
var newlineParameter: ProdBonusParameter = new ProdBonusParameter();
|
var newlineParameter: ProdBonusParameter = new ProdBonusParameter();
|
||||||
if (this.isNewLine){
|
if (this.isNewLine) {
|
||||||
newlineParameter.itemID = this._departmentPicker.selectedID;
|
newlineParameter.itemID = this._departmentPicker.selectedID;
|
||||||
newlineParameter.itemType = 0;
|
newlineParameter.itemType = 0;
|
||||||
newlineParameter.prodBonusSetupID = this.productionBonusSetup.id;
|
newlineParameter.prodBonusSetupID = this.productionBonusSetup.id;
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="p-col-12 p-md-6 p-lg-8 form-control-lg ">
|
<div class="p-col-12 p-md-6 p-lg-8 form-control-lg ">
|
||||||
<input formControlName="employeeId"[readonly]="true"
|
<input formControlName="employeeId"[readonly]="true"
|
||||||
[(ngModel)]="employee.employeeNo" type="text" style="width:100%" pInputText required><!-- [readonly]="!newEmployee"-->
|
[(ngModel)]="employee.employeeNo" type="text" style="width:100%" pInputText><!-- [readonly]="!newEmployee"-->
|
||||||
</div>
|
</div>
|
||||||
<div class="p-col-12 p-md-6 p-lg-4" style="margin:auto">
|
<div class="p-col-12 p-md-6 p-lg-4" style="margin:auto">
|
||||||
<label for="txtempName">Name </label>
|
<label for="txtempName">Name </label>
|
||||||
|
@ -229,7 +229,7 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="p-col-6" align="right">
|
<div class="p-col-6" align="right">
|
||||||
<button icon="save" kendoButton [primary]="true" (click)="saveGeneratedEmployee()">
|
<button icon="save" kendoButton [primary]="true" (click)="saveEmployee()">
|
||||||
Save
|
Save
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -229,7 +229,8 @@ export class EmployeePayrollProfileComponent implements OnInit {
|
||||||
createForm() {
|
createForm() {
|
||||||
this.employeeForm = new FormBuilder().group({
|
this.employeeForm = new FormBuilder().group({
|
||||||
isNew: ['', Validators.required],
|
isNew: ['', Validators.required],
|
||||||
employeeId: ['', Validators.required],
|
// employeeId: ['', Validators.required],
|
||||||
|
employeeId: [''],
|
||||||
name: ['', Validators.required],
|
name: ['', Validators.required],
|
||||||
mobileNo: [''],
|
mobileNo: [''],
|
||||||
emailAddress: [''],
|
emailAddress: [''],
|
||||||
|
@ -276,7 +277,7 @@ export class EmployeePayrollProfileComponent implements OnInit {
|
||||||
this.employee.joiningDate = new Date(this.employee.joiningDate);
|
this.employee.joiningDate = new Date(this.employee.joiningDate);
|
||||||
},
|
},
|
||||||
(err: any) => {
|
(err: any) => {
|
||||||
|
this.notificationService.showError(err.error);
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
debugger;
|
debugger;
|
||||||
|
@ -298,7 +299,8 @@ export class EmployeePayrollProfileComponent implements OnInit {
|
||||||
|
|
||||||
},
|
},
|
||||||
(err: any) => {
|
(err: any) => {
|
||||||
console.log(err);
|
// console.log(err);
|
||||||
|
this.notificationService.showError(err.error);
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
this.empLineManager = new SearchEmployee();
|
this.empLineManager = new SearchEmployee();
|
||||||
|
@ -332,32 +334,32 @@ export class EmployeePayrollProfileComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public saveGeneratedEmployee() {
|
// public saveGeneratedEmployee() {
|
||||||
|
|
||||||
debugger;
|
// debugger;
|
||||||
if (this.newEmployee === true) {
|
// if (this.newEmployee === true) {
|
||||||
this.loadingPanelService.ShowLoadingPanel = true;
|
// this.loadingPanelService.ShowLoadingPanel = true;
|
||||||
this.employeeService.generateEmployeeNo().subscribe(
|
// this.employeeService.generateEmployeeNo().subscribe(
|
||||||
(resp) => {
|
// (resp) => {
|
||||||
this.employee.employeeNo = resp as string;
|
// this.employee.employeeNo = resp as string;
|
||||||
},
|
// },
|
||||||
(err) => {
|
// (err) => {
|
||||||
this.notificationService.showError(err);
|
// this.notificationService.showError(err);
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
// this.loadingPanelService.ShowLoadingPanel = false;
|
||||||
},
|
// },
|
||||||
() => {
|
// () => {
|
||||||
this.loadingPanelService.ShowLoadingPanel = false;
|
// this.loadingPanelService.ShowLoadingPanel = false;
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
this.saveEmployee();
|
// this.saveEmployee();
|
||||||
}, 1000);
|
// }, 1000);
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
|
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
this.saveEmployee();
|
// this.saveEmployee();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
saveEmployee() {
|
saveEmployee() {
|
||||||
|
|
||||||
|
|
|
@ -243,7 +243,7 @@ namespace HRM.UI.Controllers
|
||||||
[Route("saveEmployee")]
|
[Route("saveEmployee")]
|
||||||
public ActionResult SaveEmployee(Employee item)
|
public ActionResult SaveEmployee(Employee item)
|
||||||
{
|
{
|
||||||
int ans;
|
Employee ans;
|
||||||
|
|
||||||
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
||||||
if (item.IsNew == true)
|
if (item.IsNew == true)
|
||||||
|
@ -260,7 +260,8 @@ namespace HRM.UI.Controllers
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ans = _EmployeeService.Save(item);
|
//ans = _EmployeeService.Save(item);
|
||||||
|
ans = _EmployeeService.SaveEmployee(item);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -549,7 +550,7 @@ namespace HRM.UI.Controllers
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(item.ID);
|
return Ok(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user