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