diff --git a/HRM.UI/ClientApp/src/app/authentication/data-permssion/data-permssion.component.html b/HRM.UI/ClientApp/src/app/authentication/data-permssion/data-permssion.component.html
index 67a262d..ffb73f3 100644
--- a/HRM.UI/ClientApp/src/app/authentication/data-permssion/data-permssion.component.html
+++ b/HRM.UI/ClientApp/src/app/authentication/data-permssion/data-permssion.component.html
@@ -26,11 +26,12 @@
@@ -48,6 +49,7 @@
[valueField]="'id'"
[valuePrimitive]="true"
(valueChange)="onPayrollChange($event)"
+ [disabled]="!_selectedRoleType"
>
@@ -59,10 +61,11 @@
diff --git a/HRM.UI/ClientApp/src/app/authentication/data-permssion/data-permssion.component.ts b/HRM.UI/ClientApp/src/app/authentication/data-permssion/data-permssion.component.ts
index d8dceed..a7f9551 100644
--- a/HRM.UI/ClientApp/src/app/authentication/data-permssion/data-permssion.component.ts
+++ b/HRM.UI/ClientApp/src/app/authentication/data-permssion/data-permssion.component.ts
@@ -10,13 +10,13 @@ import { DataTransferService } from '../../data.transfer.service';
import { ApiService } from '../../app.api.service';
import { User } from '../../_models/Authentication/user';
import { EnumAuthStatus, EnumExtension, TempEnumAuthStatus } from '../../_models/enums';
-import {PayrollType} from '../../_models/Authentication/payrollType';
-import {Employee} from '../../_models/Employee/employee';
-import {Grade} from '../../_models/Basic/grade';
-import {Department} from '../../_models/Basic/department';
-import {Designation} from '../../_models/HRBasic/designation';
-import {Location} from '../../_models/Basic/location';
-import {DynamicPicker, EnumDynamicpickerType} from '../../picker/dynamic-picker/Dynamic-Picker';
+import { PayrollType } from '../../_models/Authentication/payrollType';
+import { Employee } from '../../_models/Employee/employee';
+import { Grade } from '../../_models/Basic/grade';
+import { Department } from '../../_models/Basic/department';
+import { Designation } from '../../_models/HRBasic/designation';
+import { Location } from '../../_models/Basic/location';
+import { DynamicPicker, EnumDynamicpickerType } from '../../picker/dynamic-picker/Dynamic-Picker';
import { DataPermission } from 'src/app/_models/Basic/DataPermission';
@@ -52,19 +52,25 @@ export class DataPermssionComponent implements OnInit {
public isLocation: boolean = false;
onUserTypeChange(_selectedRoleType: any): void {
- this.utilityHandlerService.ShowLoadingPanel = true;
- this.userService.GetUsers(this._selectedRoleType.value).subscribe(
- (x) => {
- this.users = x;
- this.utilityHandlerService.ShowLoadingPanel = false;
- },
- (x) => {
- this.notificationService.showError(x);
- this.utilityHandlerService.ShowLoadingPanel = false;
- },
- () => {
- this.utilityHandlerService.ShowLoadingPanel = false;
- });
+ if (this._selectedRoleType.value != null) {
+ this.utilityHandlerService.ShowLoadingPanel = true;
+ this.userService.GetUsers(this._selectedRoleType.value).subscribe(
+ (x) => {
+ this.users = x;
+ this.utilityHandlerService.ShowLoadingPanel = false;
+ },
+ (x) => {
+ this.notificationService.showError(x);
+ this.utilityHandlerService.ShowLoadingPanel = false;
+ },
+ () => {
+ this.utilityHandlerService.ShowLoadingPanel = false;
+ });
+ }
+ else {
+ this.users = [];
+ this.selectedUser = undefined;
+ }
}
EventPermissionType(selectedPermissionType: any): void {
@@ -80,11 +86,13 @@ export class DataPermssionComponent implements OnInit {
}
onUserChange(selectedUserID: any): void {
- this._selectedUser = selectedUserID;
- this._userID = this._selectedUser.id;
-
- if (this._userID != undefined && this._selectedPayroll != undefined)
- this.loadGridView()
+ if(selectedUserID.id != null){
+ this._selectedUser = selectedUserID;
+ this._userID = this._selectedUser.id;
+
+ if (this._userID != undefined && this._selectedPayroll != undefined)
+ this.loadGridView()
+ }
}
onPayrollChange(selectedPayrollID: any): void {
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 43822cd..f53ca56 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
@@ -66,7 +66,7 @@
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 f2f3539..f7dff41 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
@@ -43,7 +43,8 @@ export class ProductionBonusAttendanceComponent implements OnInit {
prodBonusAttn: ProdBonusAttn[];
- selectedDate: Date = new Date;
+ // selectedDate: Date = new Date;
+ selectedDate: Date;
startTime: Date = new Date();
endTime: Date = new Date();
@@ -160,6 +161,7 @@ export class ProductionBonusAttendanceComponent implements OnInit {
loadLines(value: any) {
// console.log('Selected value changed:', newValue);
// debugger;
+ this.selectedDate = undefined;
this.loadingPanelService.ShowLoadingPanel = true;
debugger;
// this.bonusService.getLines(this.selectedProdBSdata.id).subscribe(
@@ -189,33 +191,34 @@ export class ProductionBonusAttendanceComponent implements OnInit {
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));
- const selectedDate = new Date(this.selectedDate.setHours(0, 0, 0, 0));
- if (selectedDate >= fromDate && selectedDate <= toDate) {
- var dataForAttn = {
- setupId: this.productionBonusSetup.id,
- lineId: this.selectedLine.id,
- date: this.selectedDate
- }
- // console.log(dataForAttn);
- this.loadingPanelService.ShowLoadingPanel = true;
- this.bonusService.getProdBonusAtten(dataForAttn).subscribe(
- (resp) => {
- this.prodBonusAttn = resp;
- // console.log('Attn List', this.prodBonusAttn);
- // console.log(this.prodBonusAttn);
- },
- (err) => {
- this.notificationService.showError(err.error);
- this.loadingPanelService.ShowLoadingPanel = false;
- },
- () => {
- this.loadingPanelService.ShowLoadingPanel = false;
- this.employeeList = [];
+ // const fromDate = new Date(this.productionBonusSetup.fromDate.setHours(0, 0, 0, 0));
+ // const toDate = new Date(this.productionBonusSetup.toDate.setHours(0, 0, 0, 0));
+ // const selectedDate = new Date(this.selectedDate.setHours(0, 0, 0, 0));
+ // if (selectedDate >= fromDate && selectedDate <= toDate) {
+ // var dataForAttn = {
+ // setupId: this.productionBonusSetup.id,
+ // lineId: this.selectedLine.id,
+ // date: this.selectedDate
+ // }
+ // // console.log(dataForAttn);
+ // this.loadingPanelService.ShowLoadingPanel = true;
+ // this.bonusService.getProdBonusAtten(dataForAttn).subscribe(
+ // (resp) => {
+ // this.prodBonusAttn = resp;
+ // // console.log('Attn List', this.prodBonusAttn);
+ // // console.log(this.prodBonusAttn);
+ // },
+ // (err) => {
+ // this.notificationService.showError(err.error);
+ // this.loadingPanelService.ShowLoadingPanel = false;
+ // },
+ // () => {
+ // this.loadingPanelService.ShowLoadingPanel = false;
+ // this.employeeList = [];
// debugger;
if (this.prodBonusAttn.length <= 0 && (this.productionBonusSetup.productionBonusType == EnumProductionBonusType.Cutting ||
this.productionBonusSetup.productionBonusType == EnumProductionBonusType.Finishing)) {
+ this.employeeList = [];
let data = {
prodLine: this.selectedLine,
date: this.selectedDate
@@ -235,21 +238,12 @@ export class ProductionBonusAttendanceComponent implements OnInit {
this.loadingPanelService.ShowLoadingPanel = false;
}
);
- // if (this.selectedLine.prodBonusParameters !== null && this.selectedLine.prodBonusParameters.length > 0) {
- // var desigparam: ProdBonusParameter;
- // desigparam = this.selectedLine.prodBonusParameters.find(o => o.itemType == EnumBonusItemType.Designation);
- // // var pbp: ProdBonusParameter;
- // for (let pbp in this.selectedLine.prodBonusParameters) {
- // if (pbp['itemType'] == EnumBonusItemType.Department) {
- // oTempEmployees: Employee[] = this.employeeList.filter(e1 => e1.DepartmentID === pbp['itemID'] && e1.DesignationID !== 2);
- // }
- // }
- // }
}
//New For Swing And Printig
if (this.prodBonusAttn.length <= 0 && (this.productionBonusSetup.productionBonusType == EnumProductionBonusType.Sewing ||
this.productionBonusSetup.productionBonusType == EnumProductionBonusType.Printing)) {
+ this.employeeList = [];
let data = {
prodLine: this.selectedLine,
date: this.selectedDate
@@ -271,25 +265,25 @@ export class ProductionBonusAttendanceComponent implements OnInit {
);
}
- if (this.prodBonusAttn.length > 0) {
- debugger;
- for (let i = 0; i < this.prodBonusAttn.length; i++) {
- this.AddEmployeebyId(this.prodBonusAttn[i].employeeID);
- }
- let inTime = new Date(this.prodBonusAttn[0].inTime);
- let outTime = new Date(this.prodBonusAttn[0].outTime);
- this.startTime = this.setTime(inTime, inTime.getHours(), inTime.getMinutes(), inTime.getSeconds());
- this.endTime = this.setTime(outTime, outTime.getHours(), outTime.getMinutes(), outTime.getSeconds());
- }
- }
- );
- }
- else {
- this.notificationService.showWarning('Date did not match with Work Schedule','Schedule not matched!');
- }
+ // if (this.prodBonusAttn.length > 0) {
+ // debugger;
+ // this.employeeList = [];
+ // for (let i = 0; i < this.prodBonusAttn.length; i++) {
+ // this.AddEmployeebyId(this.prodBonusAttn[i].employeeID);
+ // }
+ // let inTime = new Date(this.prodBonusAttn[0].inTime);
+ // let outTime = new Date(this.prodBonusAttn[0].outTime);
+ // this.startTime = this.setTime(inTime, inTime.getHours(), inTime.getMinutes(), inTime.getSeconds());
+ // this.endTime = this.setTime(outTime, outTime.getHours(), outTime.getMinutes(), outTime.getSeconds());
+ // }
+ // }
+ // );
+ // }
+ // else {
+ // this.notificationService.showWarning('Date did not match with Work Schedule','Schedule not matched!');
+ // }
}
onClickAdd() {
- // console.log(this.employeeSelection);
debugger;
if (this.selectedEmps === undefined) {
this.notificationService.showWarning('Please Select an Employee');
@@ -297,11 +291,6 @@ export class ProductionBonusAttendanceComponent implements OnInit {
}
if (this.employeeSelection === 'commonEmployee') {
if (this.selectedEmps !== null || this.selectedEmps !== undefined) {
- // console.log(this.selectedEmps);
- // console.log(this.employeeList);
- // for (let i = 0; i < this.selectedEmps.length; i++) {
- // this.AddEmployeebyId(this.selectedEmps[i].employeeID);
- // }
for (let i = 0, isNew = true; i < this.selectedEmps.length; i++, isNew = true) {
for (let j = 0; j < this.employeeList.length; j++) {
if (this.selectedEmps[i].employeeID == this.employeeList[j].id) {
@@ -350,21 +339,6 @@ export class ProductionBonusAttendanceComponent implements OnInit {
}
}
AddEmployeebyId(empId: number) {
- // 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) {
@@ -381,29 +355,9 @@ export class ProductionBonusAttendanceComponent implements OnInit {
isCommon: false
};
this.prodBonusAttn.push(newProdBonusAttn);
- // console.log('emplist ' + this.employeeList.length + '\n PbAttn ' + this.prodBonusAttn.length);
// this.selectedEmps = undefined;
}
- // GetSelectedEmployee(sremployee: SearchEmployee) {
- // if (sremployee === undefined) {
- // this._employee = new Employee();
- // return;
- // }
- // this.loadingPanelService.ShowLoadingPanel = true;
- // this.employeeService.getEmployeeByID(sremployee.employeeID).subscribe(
- // (resp: any) => {
- // this._employee = resp;
- // },
- // (err: any) => {
- // this.loadingPanelService.ShowLoadingPanel = false;
- // },
- // () => {
- // this.loadingPanelService.ShowLoadingPanel = false;
- // }
- // );
- // }
onClickSubmit() {
- // console.log(this.prodBonusAttn);
debugger;
if (this.startTime == undefined || this.endTime == undefined) {
this.notificationService.showWarning('Please Select In/Out Time');
@@ -466,6 +420,8 @@ export class ProductionBonusAttendanceComponent implements OnInit {
this.productionBonusSetup = new ProductionBonusSetup();
this.employeeList = [];
this.selectedLine = undefined;
+ this.selectedProdBSdata = undefined;
+ this.selectedDate = undefined;
}
public onKeyDown(pressedKey) {
@@ -496,5 +452,52 @@ export class ProductionBonusAttendanceComponent implements OnInit {
date.setSeconds(sec);
return date;
}
+ public scheduleDateChange(date: any){
+ debugger;
+ date;
+ if(this.selectedProdBSdata != undefined && this.selectedLine != undefined ){
+
+ const fromDate = new Date(this.productionBonusSetup.fromDate.setHours(0, 0, 0, 0));
+ const toDate = new Date(this.productionBonusSetup.toDate.setHours(0, 0, 0, 0));
+ const selectedDate = new Date(this.selectedDate.setHours(0, 0, 0, 0));
+ if (selectedDate >= fromDate && selectedDate <= toDate) {
+ var dataForAttn = {
+ setupId: this.productionBonusSetup.id,
+ lineId: this.selectedLine.id,
+ date: this.selectedDate
+ }
+ this.loadingPanelService.ShowLoadingPanel = true;
+ this.bonusService.getProdBonusAtten(dataForAttn).subscribe(
+ (resp) => {
+ this.prodBonusAttn = resp;
+ },
+ (err) => {
+ this.notificationService.showError(err.error);
+ this.loadingPanelService.ShowLoadingPanel = false;
+ },
+ () => {
+ this.loadingPanelService.ShowLoadingPanel = false;
+ if (this.prodBonusAttn.length > 0) {
+ debugger;
+ this.employeeList = [];
+ for (let i = 0; i < this.prodBonusAttn.length; i++) {
+ this.AddEmployeebyId(this.prodBonusAttn[i].employeeID);
+ }
+ let inTime = new Date(this.prodBonusAttn[0].inTime);
+ let outTime = new Date(this.prodBonusAttn[0].outTime);
+ this.startTime = this.setTime(inTime, inTime.getHours(), inTime.getMinutes(), inTime.getSeconds());
+ this.endTime = this.setTime(outTime, outTime.getHours(), outTime.getMinutes(), outTime.getSeconds());
+ }
+ else{
+ this.employeeList.forEach(x => this.AddEmployeeGridData(x.id, false));
+ }
+ }
+ );
+ }
+ else {
+ this.notificationService.showWarning('Date did not match with Work Schedule','Schedule not matched!');
+ }
+ }
+ }
}
diff --git a/HRM.UI/Controllers/DynamicPickerController.cs b/HRM.UI/Controllers/DynamicPickerController.cs
index a77a23d..ee8a407 100644
--- a/HRM.UI/Controllers/DynamicPickerController.cs
+++ b/HRM.UI/Controllers/DynamicPickerController.cs
@@ -89,7 +89,11 @@ namespace HRM.UI.Controllers
param = new object[2];
param[i] = EnumStatus.Active;
- param[i + 1] = (int)CurrentUser.GetCurrentUser(HttpContext.User).PayrollTypeID;
+
+ if(cty.PayrollTypeID == null)
+ param[i + 1] = (int)CurrentUser.GetCurrentUser(HttpContext.User).PayrollTypeID;
+ else
+ param[i + 1] = (int)cty.PayrollTypeID;
paramtypes = new Type[2];
paramtypes[i] = typeof(EnumStatus);
diff --git a/HRM.UI/Controllers/Payroll/BonusController.cs b/HRM.UI/Controllers/Payroll/BonusController.cs
index beb1dd8..4542f29 100644
--- a/HRM.UI/Controllers/Payroll/BonusController.cs
+++ b/HRM.UI/Controllers/Payroll/BonusController.cs
@@ -666,7 +666,9 @@ namespace HRM.UI.Controllers.Payroll
ProdBonusLine _oProdBonusLine = (ProdBonusLine)item["prodLine"].ToObject
();
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
- List _oEmployees = new EmployeeService().Get(EnumEmployeeStatus.Live, (int)currentUser.PayrollTypeID);
+ //List _oEmployees = new EmployeeService().Get(EnumEmployeeStatus.Live, (int)currentUser.PayrollTypeID);
+
+ DataTable EmployeeDT = new EmployeeService().GetEmployeeNameAndNo((int)currentUser.PayrollTypeID);
List _oFinalEmployees = new List();
List _oProdBonusParameters = new List();
List _oProdBonusSupervisors = new List();
@@ -684,7 +686,13 @@ namespace HRM.UI.Controllers.Payroll
{
foreach (var pda in _oProdBonusAttns)
{
- Employee emp = _oEmployees.Find(o => o.ID == pda.EmployeeID);
+ //Employee emp = _oEmployees.Find(o => o.ID == pda.EmployeeID);
+
+ DataRow[] foundRows = EmployeeDT.Select($"id = {pda.EmployeeID}");
+ Employee emp = new Employee();
+ emp.ID = Convert.ToInt32(foundRows[0]["id"]);
+ emp.EmployeeNo = Convert.ToString(foundRows[0]["EmployeeNo"]);
+ emp.Name = Convert.ToString(foundRows[0]["Name"]);
if (emp != null) _oFinalEmployees.Add(emp);
}