From 72222f6ce42a1a09c824e2892d0b16615a72f3fe Mon Sep 17 00:00:00 2001 From: mashfiq Date: Wed, 13 Nov 2024 15:35:24 +0600 Subject: [PATCH 1/3] issues fixed --- HRM.Report/Class/rptDigitalServiceBook.cs | 4 ++-- HRM.Report/HRM.Report.csproj | 2 ++ .../core-hr/employee-profile/general/general.component.html | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/HRM.Report/Class/rptDigitalServiceBook.cs b/HRM.Report/Class/rptDigitalServiceBook.cs index 498eac0..09c4df4 100644 --- a/HRM.Report/Class/rptDigitalServiceBook.cs +++ b/HRM.Report/Class/rptDigitalServiceBook.cs @@ -40,8 +40,8 @@ namespace HRM.Report oDR["PARMANENTADDRESS"] = oDRow["PARMANENTADDRESS"]; oDR["PRESENTADDRESS"] = oDRow["PRESENTADDRESS"]; oDR["BIRTHDATE"] = Convert.ToDateTime(oDRow["BIRTHDATE"]).ToString("dd/MM/yyyy"); - if (oDRow["PHOTO"] is not DBNull) - oDR["PHOTO"] = Convert.ToBase64String((byte[])oDRow["PHOTO"]); + //if (oDRow["PHOTO"] is not DBNull) + // oDR["PHOTO"] = Convert.ToBase64String((byte[])oDRow["PHOTO"]); oDR["NIDNO"] = oDRow["NIDNO"]; oDR["HEIGHT"] = oDRow["HEIGHT"]; oDR["BLOODGROUP"] = GlobalExtensions.BloodGroupToFriendlyName((EnumBloodGroup)Enum.Parse(typeof(EnumBloodGroup), diff --git a/HRM.Report/HRM.Report.csproj b/HRM.Report/HRM.Report.csproj index ebe72d2..b3b32b4 100644 --- a/HRM.Report/HRM.Report.csproj +++ b/HRM.Report/HRM.Report.csproj @@ -42,6 +42,7 @@ + @@ -310,6 +311,7 @@ + diff --git a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.html b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.html index 123a050..320c1af 100644 --- a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.html +++ b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.html @@ -247,10 +247,12 @@
+ id="txtNationalId" pInputText style="width:84%" type="text"> + +
-- 2.40.0.windows.1 From 853b83e2e60ba09c3e202546d09a6124c27671e8 Mon Sep 17 00:00:00 2001 From: mashfiq Date: Thu, 14 Nov 2024 15:16:46 +0600 Subject: [PATCH 2/3] Production bonus workschedules dates fixed. swing and printing added --- .../app/_services/payroll/bonus.service.ts | 3 + .../production-bonus-attendance.component.ts | 26 ++++++- .../production-bonus-setup.component.html | 2 +- .../production-bonus-setup.component.ts | 67 ++++++++++++++----- HRM.UI/Controllers/Payroll/BonusController.cs | 51 ++++++++++++++ 5 files changed, 129 insertions(+), 20 deletions(-) diff --git a/HRM.UI/ClientApp/src/app/_services/payroll/bonus.service.ts b/HRM.UI/ClientApp/src/app/_services/payroll/bonus.service.ts index 275319c..64ceda2 100644 --- a/HRM.UI/ClientApp/src/app/_services/payroll/bonus.service.ts +++ b/HRM.UI/ClientApp/src/app/_services/payroll/bonus.service.ts @@ -120,6 +120,9 @@ export class BonusService { getProdBonusAttnEmployeeList(item: any) { return this.apiService.httpPost('/Bonus/getProdBonusAttnEmployeeList', item); } + getProdBonusAttnEmployeeListSwingAndPrinting(item: any) { + return this.apiService.httpPost('/Bonus/getProdBonusAttnEmployeeListSwingAndPrinting', item); + } saveAllProdBonusAttn(item: any) { return this.apiService.httpPost('/Bonus/saveAllProdBonusAttn', item); } 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 41bd1f4..6177bee 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 @@ -225,7 +225,6 @@ export class ProductionBonusAttendanceComponent implements OnInit { debugger this.employeeList = resp; this.employeeList.forEach(x => this.AddEmployeeGridData(x.id, false)); - // console.log('employee List', this.employeeList); }, (err) => { this.notificationService.showError(err.error); @@ -246,6 +245,31 @@ export class ProductionBonusAttendanceComponent implements OnInit { // } // } } + + //New For Swing And Printig + if (this.prodBonusAttn.length <= 0 && (this.productionBonusSetup.productionBonusType == EnumProductionBonusType.Sewing || + this.productionBonusSetup.productionBonusType == EnumProductionBonusType.Printing)) { + let data = { + prodLine: this.selectedLine, + date: this.selectedDate + } + this.loadingPanelService.ShowLoadingPanel = true; + this.bonusService.getProdBonusAttnEmployeeListSwingAndPrinting(data).subscribe( + (resp) => { + debugger + this.employeeList = resp; + this.employeeList.forEach(x => this.AddEmployeeGridData(x.id, false)); + }, + (err) => { + this.notificationService.showError(err.error); + this.loadingPanelService.ShowLoadingPanel = false; + }, + () => { + this.loadingPanelService.ShowLoadingPanel = false; + } + ); + } + if (this.prodBonusAttn.length > 0) { debugger; for (let i = 0; i < this.prodBonusAttn.length; i++) { 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 b17ec76..3cd65e3 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 @@ -141,7 +141,7 @@
- +
sv.employeeID == this._employee.id); + const index = this.prodBonusLine.prodBonusSupervisors.findIndex(sv => sv.employeeID == this._employee.id); if (index !== -1) { this.prodBonusLine.prodBonusSupervisors.splice(index, 1); } @@ -434,11 +434,12 @@ export class ProductionBonusSetupComponent implements OnInit { () => { //newlineItem.amount this.prodBonusLine.prodBonusSupervisors.push(newlineSupervisor); - this.prodBonusLine.prodBonusParameters.push(newlineParameter); + + //Commented For Test + // this.prodBonusLine.prodBonusParameters.push(newlineParameter); this.prodBonusLine.scheduledHour = this.scheduledHours; this.prodBonusLine.lineName = this.department.name; - // console.log(this.prodBonusLine); this.clearProdbonusLine(); // this.notificationService.showSuccess('Supervisor added to the line'); } @@ -456,17 +457,19 @@ export class ProductionBonusSetupComponent implements OnInit { // this.prodBonusLine.prodBonusWorkSchedules.push(newLayoutWork); // currentDate.setDate(currentDate.getDate() + 1); // } - for (let i = 0; currentDate <= this.productionBonusSetup.toDate; i++) { - let newLayoutWork: ProdBonusWorkSchedule = { - prodBonusSetupID: 0, - prodBonusLineID: 0, - id: 0, - startDateTime: new Date(currentDate.setHours(0, 0, 0, 0)), - endDateTime: new Date(currentDate.setHours(23, 59, 59, 999)) - }; - 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 = { + // prodBonusSetupID: 0, + // prodBonusLineID: 0, + // id: 0, + // startDateTime: new Date(currentDate.setHours(0, 0, 0, 0)), + // endDateTime: new Date(currentDate.setHours(23, 59, 59, 999)) + // }; + // this.prodBonusLine.prodBonusWorkSchedules.push(newLayoutWork); + // currentDate.setDate(currentDate.getDate() + 1); + // } } else { debugger; @@ -498,7 +501,7 @@ export class ProductionBonusSetupComponent implements OnInit { onClickOk() { debugger; if (this.isNewLine) { - if(this._departmentPicker.selectedID == undefined){ + if (this._departmentPicker.selectedID == undefined) { this.notificationService.showWarning('Please Select a Line'); return; } this.prodBonusLine.lineName = this._departmentPicker.selectedObjects[0]['name']; @@ -579,10 +582,38 @@ export class ProductionBonusSetupComponent implements OnInit { this.editDetails = false; this.prodBSdata = undefined; } - onScheduledHoursChange(value: number){ + onScheduledHoursChange(value: number) { debugger; this.prodBonusLine.scheduledHour = value; this.scheduledHours; this.productionBonusSetup.productionBonusLines } + + + createWorkSchedule(data: any) { + debugger; + var newlineParameter: ProdBonusParameter = new ProdBonusParameter(); + if (this.isNewLine){ + newlineParameter.itemID = this._departmentPicker.selectedID; + newlineParameter.itemType = 0; + newlineParameter.prodBonusSetupID = this.productionBonusSetup.id; + this.prodBonusLine.prodBonusParameters.push(newlineParameter); + + const currentDate = new Date(this.productionBonusSetup.fromDate); + const maxDate = new Date(this.productionBonusSetup.toDate); + maxDate.setDate(this.productionBonusSetup.toDate.getDate() + 1); + + for (let i = 0; currentDate <= maxDate; i++) { + let newLayoutWork: ProdBonusWorkSchedule = { + prodBonusSetupID: 0, + prodBonusLineID: 0, + id: 0, + startDateTime: new Date(currentDate.setHours(0, 0, 0, 0)), + endDateTime: new Date(currentDate.setHours(23, 59, 59, 999)) + }; + this.prodBonusLine.prodBonusWorkSchedules.push(newLayoutWork); + currentDate.setDate(currentDate.getDate() + 1); + } + } + } } diff --git a/HRM.UI/Controllers/Payroll/BonusController.cs b/HRM.UI/Controllers/Payroll/BonusController.cs index 386fac8..64a012c 100644 --- a/HRM.UI/Controllers/Payroll/BonusController.cs +++ b/HRM.UI/Controllers/Payroll/BonusController.cs @@ -609,6 +609,57 @@ namespace HRM.UI.Controllers.Payroll return Ok(_oFinalEmployees); } + [HttpPost] + [Route("getProdBonusAttnEmployeeListSwingAndPrinting")] + public ActionResult getProdBonusAttnEmployeeListSwingAndPrinting(dynamic pItem) + { + var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(pItem)); + DateTime date = (DateTime)item["date"].ToObject(); + ProdBonusLine _oProdBonusLine = (ProdBonusLine)item["prodLine"].ToObject(); + + CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User); + List _oEmployees = new EmployeeService().Get(EnumEmployeeStatus.Live, (int)currentUser.PayrollTypeID); + List _oFinalEmployees = new List(); + List _oProdBonusParameters = new List(); + List _oProdBonusSupervisors = new List(); + List _oDailyAttnProsess = new List(); + try + { + //List _oProdBonusWorkSchedules = _prodBonusWorkScheduleService.Get(); + List _oProdBonusAttns = _prodBonusAttnService.Get(_oProdBonusLine.ProdBonusSetupID, date.AddDays(-1)); + + //_oProdBonusParameters = _oProdBonusLine.ProdBonusParameters; + + //if (_oProdBonusParameters != null && _oProdBonusParameters.Count > 0) + //{ + List desigparam = _oProdBonusParameters.Where(o => o.ItemType == EnumBonusItemType.Designation).ToList(); + //foreach (ProdBonusParameter pbp in _oProdBonusParameters) + //{ + if(_oProdBonusAttns != null && _oProdBonusAttns.Count > 0) + { + foreach (var pda in _oProdBonusAttns) + { + Employee emp = _oEmployees.Find(o => o.ID == pda.EmployeeID); + + if (emp != null) _oFinalEmployees.Add(emp); + } + } + //} + //} + string emIds = _oFinalEmployees.Aggregate(new StringBuilder(), (sb, x) => sb.Append(x.ID + ","), sb => sb.ToString().Trim(',')); + if (emIds != "") + { + _oDailyAttnProsess = new DailyAttnProcessService().Get(emIds, date.Date, date.Date.AddHours(23.9)); + } + + } + catch (Exception e) + { + return StatusCode(StatusCodes.Status500InternalServerError, e.Message); + } + + return Ok(_oFinalEmployees); + } [HttpGet("getByLineID/{lineID}")] public ActionResult getByLineID(int lineID) { -- 2.40.0.windows.1 From 785e9c24ff6c6b371c6e2574cd33f3ecec0f06bd Mon Sep 17 00:00:00 2001 From: mashfiq Date: Thu, 14 Nov 2024 16:34:31 +0600 Subject: [PATCH 3/3] Swing, printing attendane modification --- HRM.BO/Bonus/ProdBonusAttn.cs | 3 +- HRM.DA/DA/Bonus/ProdBonusAttnDA.cs | 17 +++++++ HRM.DA/Service/Bonus/ProdBonusAttnService.cs | 51 +++++++++++++++++++ ...production-bonus-attendance.component.html | 3 +- .../production-bonus-attendance.component.ts | 3 +- HRM.UI/Controllers/Payroll/BonusController.cs | 30 +++++------ 6 files changed, 87 insertions(+), 20 deletions(-) diff --git a/HRM.BO/Bonus/ProdBonusAttn.cs b/HRM.BO/Bonus/ProdBonusAttn.cs index d1a3394..5a1d54a 100644 --- a/HRM.BO/Bonus/ProdBonusAttn.cs +++ b/HRM.BO/Bonus/ProdBonusAttn.cs @@ -283,12 +283,13 @@ namespace HRM.BO List Get(int setupID, int ScheduleID); List Get(int setupID, DateTime dateTime); - + List GetBySetupLineDate(int setupID, int lineID, DateTime dateTime); List GetBySetupID(int iD); List GetBySetupIDs(string iDs); List GetByLineID(int lineID); List GetbySetupAndLineID(int setupID, int lineID); + DateTime? GetMaxDate(int setupID, int lineID, DateTime date); } #endregion diff --git a/HRM.DA/DA/Bonus/ProdBonusAttnDA.cs b/HRM.DA/DA/Bonus/ProdBonusAttnDA.cs index 275ab7f..79f765d 100644 --- a/HRM.DA/DA/Bonus/ProdBonusAttnDA.cs +++ b/HRM.DA/DA/Bonus/ProdBonusAttnDA.cs @@ -90,7 +90,24 @@ namespace HRM.DA return tc.ExecuteReader(sql); //return tc.ExecuteReader("SELECT * FROM ProdBonusAttn WHERE ProdBonusSetupID=%n AND CAST(InTime AS date)=%d", setupID, dateTime); } + internal static IDataReader GetBySetupLineDate(TransactionContext tc, int setupID, int lineID, DateTime dateTime) + { + 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 PBA.ProdBonusLineID=%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, lineID, dateTime.Year, dateTime.Month,dateTime.Day); + return tc.ExecuteReader(sql); + } + internal static DateTime? GetMaxDate(TransactionContext tc, int setupID, int lineID, DateTime date) + { + DateTime? value = null; + object obj = tc.ExecuteScalar("SELECT max(intime) FROM ProdBonusAttn WHERE ProdBonusSetupID=%n AND ProdBonusLineID = %n AND OutTime < %d", setupID, lineID, date); + + if (obj is not DBNull) + { + value = Convert.ToDateTime(obj); + } + return value; + } #endregion #region Delete function diff --git a/HRM.DA/Service/Bonus/ProdBonusAttnService.cs b/HRM.DA/Service/Bonus/ProdBonusAttnService.cs index dd85054..9bb54b3 100644 --- a/HRM.DA/Service/Bonus/ProdBonusAttnService.cs +++ b/HRM.DA/Service/Bonus/ProdBonusAttnService.cs @@ -159,6 +159,32 @@ namespace HRM.DA return ProdBonusAttns; } + public List GetBySetupLineDate(int setupID, int lineID, DateTime dateTime) + { + + List ProdBonusAttns = new List(); + + TransactionContext tc = null; + try + { + tc = TransactionContext.Begin(); + DataReader dr = new DataReader(ProdBonusAttnDA.GetBySetupLineDate(tc, setupID, lineID, dateTime)); + ProdBonusAttns = this.CreateObjects(dr); + 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 ProdBonusAttns; + } public List GetBySetupID(int setupID) { @@ -295,6 +321,31 @@ namespace HRM.DA return ProdBonusAttns; } + public DateTime? GetMaxDate(int setupID, int lineID, DateTime date) + { + TransactionContext tc = null; + try + { + DateTime? dateValue = null; + + tc = TransactionContext.Begin(); + dateValue = ProdBonusAttnDA.GetMaxDate(tc, setupID, lineID, date); + tc.End(); + + return dateValue; + } + catch (Exception e) + { + #region Handle Exception + + if (tc != null) + tc.HandleError(); + ExceptionLog.Write(e); + throw new ServiceException(e.Message, e); + + #endregion + } + } public int Save(ProdBonusAttn oProdBonusAttn) { TransactionContext tc = null; 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 b9f9fb4..43822cd 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 @@ -84,7 +84,7 @@
-
@@ -94,6 +94,7 @@ Remove All + 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 6177bee..fc412a6 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 @@ -187,7 +187,7 @@ export class ProductionBonusAttendanceComponent implements OnInit { ) } - onClickRefresh() { + onClickLoad() { // debugger; const fromDate = new Date(this.productionBonusSetup.fromDate.setHours(0, 0, 0, 0)); const toDate = new Date(this.productionBonusSetup.toDate.setHours(0, 0, 0, 0)); @@ -195,6 +195,7 @@ export class ProductionBonusAttendanceComponent implements OnInit { if (selectedDate >= fromDate && selectedDate <= toDate) { var dataForAttn = { setupId: this.productionBonusSetup.id, + lineId: this.selectedLine.id, date: this.selectedDate } // console.log(dataForAttn); diff --git a/HRM.UI/Controllers/Payroll/BonusController.cs b/HRM.UI/Controllers/Payroll/BonusController.cs index 64a012c..ea556da 100644 --- a/HRM.UI/Controllers/Payroll/BonusController.cs +++ b/HRM.UI/Controllers/Payroll/BonusController.cs @@ -522,6 +522,7 @@ namespace HRM.UI.Controllers.Payroll { var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(processItems)); int setupID = (int)item["setupId"].ToObject(); + int lineID = (int)item["lineId"].ToObject(); DateTime date = (DateTime)item["date"].ToObject(); CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User); @@ -529,7 +530,7 @@ namespace HRM.UI.Controllers.Payroll List AttnItems = new List(); try { - AttnItems = _prodBonusAttnService.Get(setupID, date); + AttnItems = _prodBonusAttnService.GetBySetupLineDate(setupID, lineID, date); } catch (Exception e) @@ -623,29 +624,24 @@ namespace HRM.UI.Controllers.Payroll List _oProdBonusParameters = new List(); List _oProdBonusSupervisors = new List(); List _oDailyAttnProsess = new List(); + List _oProdBonusAttns = null; try { - //List _oProdBonusWorkSchedules = _prodBonusWorkScheduleService.Get(); - List _oProdBonusAttns = _prodBonusAttnService.Get(_oProdBonusLine.ProdBonusSetupID, date.AddDays(-1)); + DateTime? maxDate = _prodBonusAttnService.GetMaxDate(_oProdBonusLine.ProdBonusSetupID, _oProdBonusLine.ID, date); - //_oProdBonusParameters = _oProdBonusLine.ProdBonusParameters; + if(maxDate != null) + _oProdBonusAttns = _prodBonusAttnService.GetBySetupLineDate(_oProdBonusLine.ProdBonusSetupID, _oProdBonusLine.ID, (DateTime)maxDate); - //if (_oProdBonusParameters != null && _oProdBonusParameters.Count > 0) - //{ - List desigparam = _oProdBonusParameters.Where(o => o.ItemType == EnumBonusItemType.Designation).ToList(); - //foreach (ProdBonusParameter pbp in _oProdBonusParameters) - //{ - if(_oProdBonusAttns != null && _oProdBonusAttns.Count > 0) + List desigparam = _oProdBonusParameters.Where(o => o.ItemType == EnumBonusItemType.Designation).ToList(); + if(_oProdBonusAttns != null && _oProdBonusAttns.Count > 0) + { + foreach (var pda in _oProdBonusAttns) { - foreach (var pda in _oProdBonusAttns) - { - Employee emp = _oEmployees.Find(o => o.ID == pda.EmployeeID); + Employee emp = _oEmployees.Find(o => o.ID == pda.EmployeeID); - if (emp != null) _oFinalEmployees.Add(emp); - } + if (emp != null) _oFinalEmployees.Add(emp); } - //} - //} + } string emIds = _oFinalEmployees.Aggregate(new StringBuilder(), (sb, x) => sb.Append(x.ID + ","), sb => sb.ToString().Trim(',')); if (emIds != "") { -- 2.40.0.windows.1