diff --git a/HRM.BO/Bonus/ProdBonusSupervisor.cs b/HRM.BO/Bonus/ProdBonusSupervisor.cs index 885f440..039054d 100644 --- a/HRM.BO/Bonus/ProdBonusSupervisor.cs +++ b/HRM.BO/Bonus/ProdBonusSupervisor.cs @@ -79,8 +79,8 @@ namespace HRM.BO #endregion - public string employeeNo { get; set; } - public string empName { get; set; } + public string EmployeeNo { get; set; } + public string EmpName { get; set; } //public Employee Employee { get; set; } diff --git a/HRM.DA/DA/Bonus/ProdBonusAttnDA.cs b/HRM.DA/DA/Bonus/ProdBonusAttnDA.cs index 3ab699a..275ab7f 100644 --- a/HRM.DA/DA/Bonus/ProdBonusAttnDA.cs +++ b/HRM.DA/DA/Bonus/ProdBonusAttnDA.cs @@ -85,7 +85,7 @@ namespace HRM.DA } internal static IDataReader Get(TransactionContext tc, int setupID, DateTime dateTime) { - string sql = SQLParser.MakeSQL("SELECT * FROM ProdBonusAttn WHERE ProdBonusSetupID=%n AND year(InTime)= %n AND month(InTime)= %n AND day(InTime)= %n", + string sql = SQLParser.MakeSQL("SELECT PBA.*, E.EMPLOYEENO FROM ProdBonusAttn PBA Left Join EMPLOYEE E on E.EMPLOYEEID = PBA.EmployeeID WHERE PBA.ProdBonusSetupID=%n AND year(PBA.InTime)= %n AND month(PBA.InTime)= %n AND day(PBA.InTime)= %n ORDER BY TRY_CAST(E.EMPLOYEENO AS INT) ASC", setupID, dateTime.Year, dateTime.Month,dateTime.Day); return tc.ExecuteReader(sql); //return tc.ExecuteReader("SELECT * FROM ProdBonusAttn WHERE ProdBonusSetupID=%n AND CAST(InTime AS date)=%d", setupID, dateTime); diff --git a/HRM.DA/DA/Bonus/ProductionBonusSetupDA.cs b/HRM.DA/DA/Bonus/ProductionBonusSetupDA.cs index 7ae9e9f..27f8686 100644 --- a/HRM.DA/DA/Bonus/ProductionBonusSetupDA.cs +++ b/HRM.DA/DA/Bonus/ProductionBonusSetupDA.cs @@ -23,9 +23,9 @@ namespace HRM.DA internal static void Insert(TransactionContext tc, ProductionBonusSetup item) { string sql = SQLParser.MakeSQL( - "INSERT INTO ProductionBonusSetup(ProductionBonusSetupID, ProgramName, AchivedPercent, OTHour, SalaryMonth, DesignNo, FromDate, ToDate, CreatedBy, CreationDate, Status)" + + "INSERT INTO ProductionBonusSetup(ProductionBonusSetupID, ProgramName, AchivedPercent, OTHour, SalaryMonth, DesignNo, FromDate, ToDate, MaxPerson, CreatedBy, CreationDate, Status)" + " VALUES(%n, %s, %n, %n, %d, %s, %d, %d, %n, %d, %n)", item.ID, item.ProgramName, item.AchivedPercent, item.OTHour, - item.SalaryMonth, item.DesignNo, item.FromDate, item.ToDate, item.CreatedBy, item.CreatedDate, + item.SalaryMonth, item.DesignNo, item.FromDate, item.ToDate, item.MaxPerson, item.CreatedBy, item.CreatedDate, item.Status); tc.ExecuteNonQuery(sql); } @@ -37,9 +37,9 @@ namespace HRM.DA internal static void Update(TransactionContext tc, ProductionBonusSetup item) { tc.ExecuteNonQuery( - "UPDATE ProductionBonusSetup SET ProgramName=%s, AchivedPercent=%n, OTHour=%n, SalaryMonth=%d, DesignNo=%s, FromDate=%d, ToDate=%d, Status=%n" + - "WHERE ProductionBonusSetupID=%n", item.ProgramName, item.AchivedPercent, item.OTHour, item.SalaryMonth, item.DesignNo, - item.FromDate, item.ToDate, item.Status, item.ID); + "UPDATE ProductionBonusSetup SET ProgramName=%s, AchivedPercent=%n, OTHour=%n, SalaryMonth=%d, DesignNo=%s, FromDate=%d, ToDate=%d, MaxPerson=%n, Status=%n " + + " WHERE ProductionBonusSetupID=%n", item.ProgramName, item.AchivedPercent, item.OTHour, item.SalaryMonth, item.DesignNo, + item.FromDate, item.ToDate, item.MaxPerson, item.Status, item.ID); } #endregion diff --git a/HRM.DA/DA/Employee/EmployeeDA.cs b/HRM.DA/DA/Employee/EmployeeDA.cs index b94bd88..881d975 100644 --- a/HRM.DA/DA/Employee/EmployeeDA.cs +++ b/HRM.DA/DA/Employee/EmployeeDA.cs @@ -4043,6 +4043,11 @@ AND ea.EMPLOYEEID=emp.EMPLOYEEID AND ea.LASTLEVEL=1),'') LastAcademic , } tc.ExecuteNonQuery(sSQL); } + internal static DataTable GetEmployeeNameAndNo(TransactionContext tc, int payrolltypeid) + { + return tc.ExecuteDataTable( + "SELECT e.employeeId as id, e.employeeNo, e.name FROM employee e WHERE e.payrolltypeid=%n", payrolltypeid); + } } #endregion diff --git a/HRM.DA/Service/Employee/EmployeeService.cs b/HRM.DA/Service/Employee/EmployeeService.cs index 8edf881..9d6f039 100644 --- a/HRM.DA/Service/Employee/EmployeeService.cs +++ b/HRM.DA/Service/Employee/EmployeeService.cs @@ -5542,5 +5542,29 @@ namespace HRM.DA } return oGrossPay; } + public DataTable GetEmployeeNameAndNo(int payrolltypeid) + { + DataTable dt = null; + TransactionContext tc = null; + try + { + tc = TransactionContext.Begin(); + dt = EmployeeDA.GetEmployeeNameAndNo(tc, payrolltypeid); + } + catch (Exception e) + { + #region Handle Exception + + if (tc != null) + tc.HandleError(); + ExceptionLog.Write(e); + + throw new ServiceException(e.Message, e); + + #endregion + } + + return dt; + } } } \ No newline at end of file diff --git a/HRM.UI/ClientApp/src/app/_services/employee/employee.service.ts b/HRM.UI/ClientApp/src/app/_services/employee/employee.service.ts index 0224671..226d8bc 100644 --- a/HRM.UI/ClientApp/src/app/_services/employee/employee.service.ts +++ b/HRM.UI/ClientApp/src/app/_services/employee/employee.service.ts @@ -507,4 +507,8 @@ export class EmployeeServices { getSearchEmployeesByEmpIds(empIds: string) { return this.apiService.httpGet('/Employee/getSearchEmployeesByEmpIds/' + empIds); } + + getAllEmployeeNameAndNo() { + return this.apiService.httpGet('/Employee/getAllEmployeeNameAndNo'); + } } diff --git a/HRM.UI/ClientApp/src/app/payroll-ot/production-bonus-attendance/production-bonus-attendance.component.html b/HRM.UI/ClientApp/src/app/payroll-ot/production-bonus-attendance/production-bonus-attendance.component.html index df10fd6..6aab005 100644 --- a/HRM.UI/ClientApp/src/app/payroll-ot/production-bonus-attendance/production-bonus-attendance.component.html +++ b/HRM.UI/ClientApp/src/app/payroll-ot/production-bonus-attendance/production-bonus-attendance.component.html @@ -1,4 +1,4 @@ - +
@@ -85,10 +85,10 @@
+ [disabled]="selectedProdBSdata===undefined||selectedLine===undefined||selectedDate===undefined">Load
- +
- - + -->
- - + -->
+ [MultiSelect]="false" (keydown)="onKeyDown($event)" *ngIf="allEmps.length!=0">
-
diff --git a/HRM.UI/ClientApp/src/app/payroll-ot/production-bonus-attendance/production-bonus-attendance.component.ts b/HRM.UI/ClientApp/src/app/payroll-ot/production-bonus-attendance/production-bonus-attendance.component.ts index 09ab037..40389e2 100644 --- a/HRM.UI/ClientApp/src/app/payroll-ot/production-bonus-attendance/production-bonus-attendance.component.ts +++ b/HRM.UI/ClientApp/src/app/payroll-ot/production-bonus-attendance/production-bonus-attendance.component.ts @@ -61,6 +61,11 @@ export class ProductionBonusAttendanceComponent implements OnInit { employeeSelection: string = 'commonEmployee'; + employeeList: Employee[] = []; + allEmps: any[] = []; + + value: ''; + constructor(public apiService: ApiService, public notificationService: HRMNotificationService, public dataTransferService: DataTransferService, @@ -72,25 +77,32 @@ export class ProductionBonusAttendanceComponent implements OnInit { this._departmentPicker = new DynamicPicker(EnumDynamicpickerType.Department, false); } + ngOnInit(): void { // this.Loadlayout(); + this.GetAllEmployees(); this.productionBonusSetup = new ProductionBonusSetup(); this.showScheduleDate = false; + this.startTime = this.setTime(this.startTime, 6, 0, 0); + this.endTime = this.setTime(this.endTime, 23, 59, 0); - // this.startTime.setHours(6); - // this.startTime.setMinutes(0); - // this.startTime.setSeconds(0); - this.startTime = this.setTime(this.startTime, 6, 0, 0) - - // this.endTime.setHours(23); - // this.endTime.setMinutes(0); - // this.endTime.setSeconds(0); - this.endTime = this.setTime(this.endTime, 23, 59, 0) } - - employeeList: Employee[] = []; - - value: ''; + private GetAllEmployees() { + debugger + this.loadingPanelService.ShowLoadingPanel = true; + this.employeeService.getAllEmployeeNameAndNo().subscribe( + (resp) => { + this.allEmps = resp; + }, + (err) => { + this.notificationService.showError(err.error); + this.loadingPanelService.ShowLoadingPanel = false; + }, + () => { + this.loadingPanelService.ShowLoadingPanel = false; + } + ); + } public GetSelectedEmployee(childData) { this.selectedEmps = childData; @@ -196,16 +208,17 @@ export class ProductionBonusAttendanceComponent implements OnInit { () => { this.loadingPanelService.ShowLoadingPanel = false; this.employeeList = []; - debugger; + // debugger; if (this.prodBonusAttn.length <= 0 && (this.productionBonusSetup.productionBonusType == EnumProductionBonusType.Cutting || this.productionBonusSetup.productionBonusType == EnumProductionBonusType.Finishing)) { let data = { - prodLine: this.selectedLine, + prodLine: this.selectedLine, date: this.selectedDate } this.loadingPanelService.ShowLoadingPanel = true; this.bonusService.getProdBonusAttnEmployeeList(data).subscribe( (resp) => { + debugger this.employeeList = resp; // console.log('employee List', this.employeeList); }, @@ -277,53 +290,52 @@ export class ProductionBonusAttendanceComponent implements OnInit { // } // } // else { - let sid: number; - const emp = this.employeeList.find((e1) => e1.id === this.selectedEmps['employeeID']); - const att = this.prodBonusAttn.find((e1) => e1.employeeID === this.selectedEmps['employeeID']); - if (emp === undefined && att === undefined) { - if (this.selectedProdBSdata !== undefined) { - if (this.employeeList.length < this.productionBonusSetup.maxPerson) { - let isNew = true; - for (let j = 0; j < this.employeeList.length; j++, isNew = true) { - if (this.selectedEmps['employeeID'] == this.employeeList[j].id) { - this.notificationService.showWarning("EmployeeNo " + this.employeeList[j].employeeNo + " Already Exists"); - isNew = false; - break; - } - } - if (isNew) { - this.AddEmployeebyId(this.selectedEmps['employeeID']); - this.AddEmployeeGridData(this.selectedEmps['employeeID'], false); + let sid: number; + const emp = this.employeeList.find((e1) => e1.id === this.selectedEmps['employeeID']); + const att = this.prodBonusAttn.find((e1) => e1.employeeID === this.selectedEmps['employeeID']); + if (emp === undefined && att === undefined) { + if (this.selectedProdBSdata !== undefined) { + if (this.employeeList.length < this.productionBonusSetup.maxPerson) { + let isNew = true; + for (let j = 0; j < this.employeeList.length; j++, isNew = true) { + if (this.selectedEmps['employeeID'] == this.employeeList[j].id) { + this.notificationService.showWarning("EmployeeNo " + this.employeeList[j].employeeNo + " Already Exists"); + isNew = false; + break; } } - else { - this.notificationService.showWarning('Maximum number of employee entry is done, you can\'t add more !'); + if (isNew) { + this.AddEmployeebyId(this.selectedEmps['employeeID']); + this.AddEmployeeGridData(this.selectedEmps['employeeID'], false); } } + else { + this.notificationService.showWarning('Maximum number of employee entry is done, you can\'t add more !'); + } } - else { - this.notificationService.showWarning('Employee already exist ! Can\'t Add'); - } + } + else { + this.notificationService.showWarning('Employee already exist ! Can\'t Add'); + } // } } AddEmployeebyId(empId: number) { - this.loadingPanelService.ShowLoadingPanel = true; - this.employeeService.getEmployeeByID(empId).subscribe( - (resp) => { - this.employeeList.push(resp); - // console.log(this.employeeList); - // debugger; - }, - (err) => { - this.notificationService.showError(err.error); - this.loadingPanelService.ShowLoadingPanel = false; - }, - () => { - // this.AddEmployeeGridData(empId, isCommonValue); - // console.log(this.prodBonusAttn); - this.loadingPanelService.ShowLoadingPanel = false; - } - ); + // this.loadingPanelService.ShowLoadingPanel = true; + // this.employeeService.getEmployeeByID(empId).subscribe( + // (resp) => { + // this.employeeList.push(resp); + // }, + // (err) => { + // this.notificationService.showError(err.error); + // this.loadingPanelService.ShowLoadingPanel = false; + // }, + // () => { + // // this.AddEmployeeGridData(empId, isCommonValue); + // // console.log(this.prodBonusAttn); + // this.loadingPanelService.ShowLoadingPanel = false; + // } + // ); + this.employeeList.push(this.allEmps.find(e => e.id == empId)); } AddEmployeeGridData(empId: number, isCommonValue: boolean) { // var newProdBonusAttn: ProdBonusAttn = new ProdBonusAttn(); @@ -406,7 +418,6 @@ export class ProductionBonusAttendanceComponent implements OnInit { ); } onClickRemove(data: any) { - // console.log(this.prodBonusAttn); // debugger; const index = this.employeeList.findIndex(item => item.id === data.id); const indexAttn = this.prodBonusAttn.findIndex(item => item['employeeID'] === data.id); @@ -424,7 +435,7 @@ export class ProductionBonusAttendanceComponent implements OnInit { } public onKeyDown(pressedKey) { - if (pressedKey.key==="Enter") { + if (pressedKey.key === "Enter") { // this.onSave(pressedKey); this.onClickAdd(); this.scrollToBottom(); @@ -443,7 +454,7 @@ export class ProductionBonusAttendanceComponent implements OnInit { this.gridScrollableElement.scrollTop = this.gridScrollableElement.scrollHeight; } - public setTime(date: Date, hour: number, min: number, sec: number): Date{ + public setTime(date: Date, hour: number, min: number, sec: number): Date { date.setHours(hour); date.setMinutes(min); date.setSeconds(sec); diff --git a/HRM.UI/ClientApp/src/app/payroll-ot/production-bonus-setup/production-bonus-setup.component.html b/HRM.UI/ClientApp/src/app/payroll-ot/production-bonus-setup/production-bonus-setup.component.html index 7df3964..b17ec76 100644 --- a/HRM.UI/ClientApp/src/app/payroll-ot/production-bonus-setup/production-bonus-setup.component.html +++ b/HRM.UI/ClientApp/src/app/payroll-ot/production-bonus-setup/production-bonus-setup.component.html @@ -46,7 +46,7 @@
-
@@ -97,7 +97,7 @@
- + @@ -106,17 +106,17 @@ Line - + - + - + - + style="width: fit-content; margin-right: 5px;">Edit + @@ -127,7 +127,7 @@
-
Production Bonus Line
@@ -180,21 +180,23 @@ style="width:80%">Add
- - - + [sort]="state.sort" [pageable]="true" (dataStateChange)="dataStateChange($event)">--> + + --> - + + - + + + + style="width: fit-content;" (click)="onClickRemoveSupervisors(dataItem)">Remove @@ -203,7 +205,7 @@ - + {{dataItem.startDateTime | date: 'dd MMMM yyyy'}} diff --git a/HRM.UI/ClientApp/src/app/payroll-ot/production-bonus-setup/production-bonus-setup.component.ts b/HRM.UI/ClientApp/src/app/payroll-ot/production-bonus-setup/production-bonus-setup.component.ts index 1dd9bbf..b66f876 100644 --- a/HRM.UI/ClientApp/src/app/payroll-ot/production-bonus-setup/production-bonus-setup.component.ts +++ b/HRM.UI/ClientApp/src/app/payroll-ot/production-bonus-setup/production-bonus-setup.component.ts @@ -198,7 +198,7 @@ export class ProductionBonusSetupComponent implements OnInit { (resp) => { this.productionBonusSetup = resp; debugger; - console.log(this.productionBonusSetup); + // console.log(this.productionBonusSetup); this.selectedBonusType = { value: this.productionBonusSetup.productionBonusType, label: EnumProductionBonusType[this.productionBonusSetup.productionBonusType] @@ -283,7 +283,7 @@ export class ProductionBonusSetupComponent implements OnInit { return this.notificationService.showWarning('Please select Bonus Type'); } this.saveProductionBonusSetup(); - console.log(this.productionBonusSetup); + // console.log(this.productionBonusSetup); debugger; if (this.productionBonusSetup.designNo === '' || this.productionBonusSetup.programName === '' || this.productionBonusSetup.fromDate === undefined || this.productionBonusSetup.toDate === undefined || this.productionBonusSetup.productionBonusType === null) { @@ -302,7 +302,7 @@ export class ProductionBonusSetupComponent implements OnInit { // } } else { //Edit Setup line - console.log(this.productionBonusSetup); + // console.log(this.productionBonusSetup); debugger; this.prodBonusLine.prodBonusSupervisors = []; this.prodBonusLine.prodBonusWorkSchedules = []; @@ -332,7 +332,7 @@ export class ProductionBonusSetupComponent implements OnInit { onCellClickEdit(dataItem: ProdBonusLine) { - console.log(dataItem); + // console.log(dataItem); this.isNewLine = false; this.prodBonusLine = new ProdBonusLine(); debugger; @@ -521,7 +521,7 @@ export class ProductionBonusSetupComponent implements OnInit { onClickSubmit() { debugger; this.saveProductionBonusSetup(); - console.log(this.productionBonusSetup); + // console.log(this.productionBonusSetup); 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'); @@ -530,12 +530,12 @@ export class ProductionBonusSetupComponent implements OnInit { this.loadingPanelService.ShowLoadingPanel = true; this.bonusService.saveProductionBonusSetup(this.productionBonusSetup).subscribe( (resp) => { - console.log(resp); + // console.log(resp); }, (err) => { this.loadingPanelService.ShowLoadingPanel = false; this.notificationService.showError(err.error); - console.log(err.error); + // console.log(err.error); }, () => { this.clearFields(); @@ -545,8 +545,8 @@ export class ProductionBonusSetupComponent implements OnInit { ); } onClickRemove(data: any) { - console.log(this.productionBonusSetup.productionBonusLines); - console.log(data); + // console.log(this.productionBonusSetup.productionBonusLines); + // console.log(data); debugger; const index = this.productionBonusSetup.productionBonusLines.findIndex(item => item.id === data.id); // const indexAttn = this.prodBonusAttn.findIndex(item => item['employeeID'] === data.id); diff --git a/HRM.UI/Controllers/Employee/EmployeeController.cs b/HRM.UI/Controllers/Employee/EmployeeController.cs index 942463f..9358322 100644 --- a/HRM.UI/Controllers/Employee/EmployeeController.cs +++ b/HRM.UI/Controllers/Employee/EmployeeController.cs @@ -2786,5 +2786,22 @@ namespace HRM.UI.Controllers return Ok(); } + + [HttpGet("getAllEmployeeNameAndNo")] + public ActionResult getAllEmployeeNameAndNo() + { + DataTable dt = new DataTable(); + CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User); + try + { + dt = new EmployeeService().GetEmployeeNameAndNo((int)currentUser.PayrollTypeID); + } + catch (Exception ex) + { + return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); + } + + return Ok(dt); + } } } \ No newline at end of file diff --git a/HRM.UI/Controllers/Payroll/BonusController.cs b/HRM.UI/Controllers/Payroll/BonusController.cs index 1e05d51..9591922 100644 --- a/HRM.UI/Controllers/Payroll/BonusController.cs +++ b/HRM.UI/Controllers/Payroll/BonusController.cs @@ -475,8 +475,8 @@ namespace HRM.UI.Controllers.Payroll { oEmp = new EmployeeService().Get(prodSupervisor.EmployeeID); - prodSupervisor.empName = oEmp.Name; - prodSupervisor.employeeNo = oEmp.EmployeeNo; + prodSupervisor.EmpName = oEmp.Name; + prodSupervisor.EmployeeNo = oEmp.EmployeeNo; } prodLine.ProdBonusParameters = _prodBonusParameterService.GetByLineID(prodLine.ID);