Merge pull request 'Prod Bonus Attn grid modified' (#20) from dev_mashfiq into devqc

Reviewed-on: http://103.197.204.162:3025/CelHRTeam/EchoTex_Payroll/pulls/20
This commit is contained in:
chapal 2024-12-17 14:12:57 +06:00
commit 55590f8035
6 changed files with 151 additions and 125 deletions

View File

@ -26,11 +26,12 @@
<kendo-dropdownlist <kendo-dropdownlist
style="width:100%" style="width:100%"
[data]="users" [data]="users"
[defaultItem]="{ userName: 'Select User', userID: null }" [defaultItem]="{ userName: 'Select User', id: null }"
[textField]="'userName'" [textField]="'userName'"
[valueField]="'userID'" [valueField]="'id'"
[(ngModel)]="selectedUser" [(ngModel)]="selectedUser"
(valueChange)="onUserChange($event)" (valueChange)="onUserChange($event)"
[disabled]="!(_selectedPayroll != null && _selectedRoleType != null) "
> >
</kendo-dropdownlist> </kendo-dropdownlist>
</div> </div>
@ -48,6 +49,7 @@
[valueField]="'id'" [valueField]="'id'"
[valuePrimitive]="true" [valuePrimitive]="true"
(valueChange)="onPayrollChange($event)" (valueChange)="onPayrollChange($event)"
[disabled]="!_selectedRoleType"
> >
</kendo-dropdownlist> </kendo-dropdownlist>
</div> </div>
@ -59,10 +61,11 @@
<kendo-dropdownlist class="form-control form-control-sm input-sm" <kendo-dropdownlist class="form-control form-control-sm input-sm"
style="width:100%" style="width:100%"
[data]="permissionTypes" [data]="permissionTypes"
[defaultItem]="{ name: 'Select Permission Type', id: null }" [defaultItem]="{ name: 'Select Permission Type', value: null }"
[textField]="'name'" [textField]="'name'"
[valueField]="'id'" [valueField]="'value'"
(selectionChange)="EventPermissionType($event)" (selectionChange)="EventPermissionType($event)"
[disabled]="!_selectedPayroll"
> >
</kendo-dropdownlist> </kendo-dropdownlist>
</div> </div>

View File

@ -10,13 +10,13 @@ import { DataTransferService } from '../../data.transfer.service';
import { ApiService } from '../../app.api.service'; import { ApiService } from '../../app.api.service';
import { User } from '../../_models/Authentication/user'; import { User } from '../../_models/Authentication/user';
import { EnumAuthStatus, EnumExtension, TempEnumAuthStatus } from '../../_models/enums'; import { EnumAuthStatus, EnumExtension, TempEnumAuthStatus } from '../../_models/enums';
import {PayrollType} from '../../_models/Authentication/payrollType'; import { PayrollType } from '../../_models/Authentication/payrollType';
import {Employee} from '../../_models/Employee/employee'; import { Employee } from '../../_models/Employee/employee';
import {Grade} from '../../_models/Basic/grade'; import { Grade } from '../../_models/Basic/grade';
import {Department} from '../../_models/Basic/department'; import { Department } from '../../_models/Basic/department';
import {Designation} from '../../_models/HRBasic/designation'; import { Designation } from '../../_models/HRBasic/designation';
import {Location} from '../../_models/Basic/location'; import { Location } from '../../_models/Basic/location';
import {DynamicPicker, EnumDynamicpickerType} from '../../picker/dynamic-picker/Dynamic-Picker'; import { DynamicPicker, EnumDynamicpickerType } from '../../picker/dynamic-picker/Dynamic-Picker';
import { DataPermission } from 'src/app/_models/Basic/DataPermission'; import { DataPermission } from 'src/app/_models/Basic/DataPermission';
@ -52,19 +52,25 @@ export class DataPermssionComponent implements OnInit {
public isLocation: boolean = false; public isLocation: boolean = false;
onUserTypeChange(_selectedRoleType: any): void { onUserTypeChange(_selectedRoleType: any): void {
this.utilityHandlerService.ShowLoadingPanel = true; if (this._selectedRoleType.value != null) {
this.userService.GetUsers(this._selectedRoleType.value).subscribe( this.utilityHandlerService.ShowLoadingPanel = true;
(x) => { this.userService.GetUsers(this._selectedRoleType.value).subscribe(
this.users = x; (x) => {
this.utilityHandlerService.ShowLoadingPanel = false; this.users = x;
}, this.utilityHandlerService.ShowLoadingPanel = false;
(x) => { },
this.notificationService.showError(x); (x) => {
this.utilityHandlerService.ShowLoadingPanel = false; this.notificationService.showError(x);
}, this.utilityHandlerService.ShowLoadingPanel = false;
() => { },
this.utilityHandlerService.ShowLoadingPanel = false; () => {
}); this.utilityHandlerService.ShowLoadingPanel = false;
});
}
else {
this.users = [];
this.selectedUser = undefined;
}
} }
EventPermissionType(selectedPermissionType: any): void { EventPermissionType(selectedPermissionType: any): void {
@ -80,11 +86,13 @@ export class DataPermssionComponent implements OnInit {
} }
onUserChange(selectedUserID: any): void { onUserChange(selectedUserID: any): void {
this._selectedUser = selectedUserID; if(selectedUserID.id != null){
this._userID = this._selectedUser.id; this._selectedUser = selectedUserID;
this._userID = this._selectedUser.id;
if (this._userID != undefined && this._selectedPayroll != undefined)
this.loadGridView() if (this._userID != undefined && this._selectedPayroll != undefined)
this.loadGridView()
}
} }
onPayrollChange(selectedPayrollID: any): void { onPayrollChange(selectedPayrollID: any): void {

View File

@ -66,7 +66,7 @@
<label>Schedule Date</label> <label>Schedule Date</label>
</div> </div>
<div class="p-col-6 p-md-2"> <div class="p-col-6 p-md-2">
<kendo-datepicker [(ngModel)]="selectedDate" [format]="'dd MMMM yyyy'" style="width:100%"></kendo-datepicker> <kendo-datepicker [(ngModel)]="selectedDate" [format]="'dd MMMM yyyy'" style="width:100%" (valueChange)="scheduleDateChange($event)" ></kendo-datepicker>
</div> </div>
<div class="p-col-6 p-md-1 label-ailgn"> <div class="p-col-6 p-md-1 label-ailgn">

View File

@ -43,7 +43,8 @@ export class ProductionBonusAttendanceComponent implements OnInit {
prodBonusAttn: ProdBonusAttn[]; prodBonusAttn: ProdBonusAttn[];
selectedDate: Date = new Date; // selectedDate: Date = new Date;
selectedDate: Date;
startTime: Date = new Date(); startTime: Date = new Date();
endTime: Date = new Date(); endTime: Date = new Date();
@ -160,6 +161,7 @@ export class ProductionBonusAttendanceComponent implements OnInit {
loadLines(value: any) { loadLines(value: any) {
// console.log('Selected value changed:', newValue); // console.log('Selected value changed:', newValue);
// debugger; // debugger;
this.selectedDate = undefined;
this.loadingPanelService.ShowLoadingPanel = true; this.loadingPanelService.ShowLoadingPanel = true;
debugger; debugger;
// this.bonusService.getLines(this.selectedProdBSdata.id).subscribe( // this.bonusService.getLines(this.selectedProdBSdata.id).subscribe(
@ -189,33 +191,34 @@ export class ProductionBonusAttendanceComponent implements OnInit {
onClickLoad() { onClickLoad() {
// debugger; // debugger;
const fromDate = new Date(this.productionBonusSetup.fromDate.setHours(0, 0, 0, 0)); // 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 toDate = new Date(this.productionBonusSetup.toDate.setHours(0, 0, 0, 0));
const selectedDate = new Date(this.selectedDate.setHours(0, 0, 0, 0)); // const selectedDate = new Date(this.selectedDate.setHours(0, 0, 0, 0));
if (selectedDate >= fromDate && selectedDate <= toDate) { // if (selectedDate >= fromDate && selectedDate <= toDate) {
var dataForAttn = { // var dataForAttn = {
setupId: this.productionBonusSetup.id, // setupId: this.productionBonusSetup.id,
lineId: this.selectedLine.id, // lineId: this.selectedLine.id,
date: this.selectedDate // date: this.selectedDate
} // }
// console.log(dataForAttn); // // console.log(dataForAttn);
this.loadingPanelService.ShowLoadingPanel = true; // this.loadingPanelService.ShowLoadingPanel = true;
this.bonusService.getProdBonusAtten(dataForAttn).subscribe( // this.bonusService.getProdBonusAtten(dataForAttn).subscribe(
(resp) => { // (resp) => {
this.prodBonusAttn = resp; // this.prodBonusAttn = resp;
// console.log('Attn List', this.prodBonusAttn); // // console.log('Attn List', this.prodBonusAttn);
// console.log(this.prodBonusAttn); // // console.log(this.prodBonusAttn);
}, // },
(err) => { // (err) => {
this.notificationService.showError(err.error); // this.notificationService.showError(err.error);
this.loadingPanelService.ShowLoadingPanel = false; // this.loadingPanelService.ShowLoadingPanel = false;
}, // },
() => { // () => {
this.loadingPanelService.ShowLoadingPanel = false; // this.loadingPanelService.ShowLoadingPanel = false;
this.employeeList = []; // this.employeeList = [];
// debugger; // debugger;
if (this.prodBonusAttn.length <= 0 && (this.productionBonusSetup.productionBonusType == EnumProductionBonusType.Cutting || if (this.prodBonusAttn.length <= 0 && (this.productionBonusSetup.productionBonusType == EnumProductionBonusType.Cutting ||
this.productionBonusSetup.productionBonusType == EnumProductionBonusType.Finishing)) { this.productionBonusSetup.productionBonusType == EnumProductionBonusType.Finishing)) {
this.employeeList = [];
let data = { let data = {
prodLine: this.selectedLine, prodLine: this.selectedLine,
date: this.selectedDate date: this.selectedDate
@ -235,21 +238,12 @@ export class ProductionBonusAttendanceComponent implements OnInit {
this.loadingPanelService.ShowLoadingPanel = false; 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 //New For Swing And Printig
if (this.prodBonusAttn.length <= 0 && (this.productionBonusSetup.productionBonusType == EnumProductionBonusType.Sewing || if (this.prodBonusAttn.length <= 0 && (this.productionBonusSetup.productionBonusType == EnumProductionBonusType.Sewing ||
this.productionBonusSetup.productionBonusType == EnumProductionBonusType.Printing)) { this.productionBonusSetup.productionBonusType == EnumProductionBonusType.Printing)) {
this.employeeList = [];
let data = { let data = {
prodLine: this.selectedLine, prodLine: this.selectedLine,
date: this.selectedDate date: this.selectedDate
@ -271,25 +265,25 @@ export class ProductionBonusAttendanceComponent implements OnInit {
); );
} }
if (this.prodBonusAttn.length > 0) { // if (this.prodBonusAttn.length > 0) {
debugger; // debugger;
for (let i = 0; i < this.prodBonusAttn.length; i++) { // this.employeeList = [];
this.AddEmployeebyId(this.prodBonusAttn[i].employeeID); // 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); // let inTime = new Date(this.prodBonusAttn[0].inTime);
this.startTime = this.setTime(inTime, inTime.getHours(), inTime.getMinutes(), inTime.getSeconds()); // let outTime = new Date(this.prodBonusAttn[0].outTime);
this.endTime = this.setTime(outTime, outTime.getHours(), outTime.getMinutes(), outTime.getSeconds()); // 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!'); // else {
} // this.notificationService.showWarning('Date did not match with Work Schedule','Schedule not matched!');
// }
} }
onClickAdd() { onClickAdd() {
// console.log(this.employeeSelection);
debugger; debugger;
if (this.selectedEmps === undefined) { if (this.selectedEmps === undefined) {
this.notificationService.showWarning('Please Select an Employee'); this.notificationService.showWarning('Please Select an Employee');
@ -297,11 +291,6 @@ export class ProductionBonusAttendanceComponent implements OnInit {
} }
if (this.employeeSelection === 'commonEmployee') { if (this.employeeSelection === 'commonEmployee') {
if (this.selectedEmps !== null || this.selectedEmps !== undefined) { 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 i = 0, isNew = true; i < this.selectedEmps.length; i++, isNew = true) {
for (let j = 0; j < this.employeeList.length; j++) { for (let j = 0; j < this.employeeList.length; j++) {
if (this.selectedEmps[i].employeeID == this.employeeList[j].id) { if (this.selectedEmps[i].employeeID == this.employeeList[j].id) {
@ -350,21 +339,6 @@ export class ProductionBonusAttendanceComponent implements OnInit {
} }
} }
AddEmployeebyId(empId: number) { 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)); this.employeeList.push(this.allEmps.find(e => e.id == empId));
} }
AddEmployeeGridData(empId: number, isCommonValue: boolean) { AddEmployeeGridData(empId: number, isCommonValue: boolean) {
@ -381,29 +355,9 @@ export class ProductionBonusAttendanceComponent implements OnInit {
isCommon: false isCommon: false
}; };
this.prodBonusAttn.push(newProdBonusAttn); this.prodBonusAttn.push(newProdBonusAttn);
// console.log('emplist ' + this.employeeList.length + '\n PbAttn ' + this.prodBonusAttn.length);
// this.selectedEmps = undefined; // 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() { onClickSubmit() {
// console.log(this.prodBonusAttn);
debugger; debugger;
if (this.startTime == undefined || this.endTime == undefined) { if (this.startTime == undefined || this.endTime == undefined) {
this.notificationService.showWarning('Please Select In/Out Time'); this.notificationService.showWarning('Please Select In/Out Time');
@ -466,6 +420,8 @@ export class ProductionBonusAttendanceComponent implements OnInit {
this.productionBonusSetup = new ProductionBonusSetup(); this.productionBonusSetup = new ProductionBonusSetup();
this.employeeList = []; this.employeeList = [];
this.selectedLine = undefined; this.selectedLine = undefined;
this.selectedProdBSdata = undefined;
this.selectedDate = undefined;
} }
public onKeyDown(pressedKey) { public onKeyDown(pressedKey) {
@ -496,5 +452,52 @@ export class ProductionBonusAttendanceComponent implements OnInit {
date.setSeconds(sec); date.setSeconds(sec);
return date; 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!');
}
}
}
} }

View File

@ -89,7 +89,11 @@ namespace HRM.UI.Controllers
param = new object[2]; param = new object[2];
param[i] = EnumStatus.Active; 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 = new Type[2];
paramtypes[i] = typeof(EnumStatus); paramtypes[i] = typeof(EnumStatus);

View File

@ -666,7 +666,9 @@ namespace HRM.UI.Controllers.Payroll
ProdBonusLine _oProdBonusLine = (ProdBonusLine)item["prodLine"].ToObject<ProdBonusLine>(); ProdBonusLine _oProdBonusLine = (ProdBonusLine)item["prodLine"].ToObject<ProdBonusLine>();
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User); CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
List<Employee> _oEmployees = new EmployeeService().Get(EnumEmployeeStatus.Live, (int)currentUser.PayrollTypeID); //List<Employee> _oEmployees = new EmployeeService().Get(EnumEmployeeStatus.Live, (int)currentUser.PayrollTypeID);
DataTable EmployeeDT = new EmployeeService().GetEmployeeNameAndNo((int)currentUser.PayrollTypeID);
List<Employee> _oFinalEmployees = new List<Employee>(); List<Employee> _oFinalEmployees = new List<Employee>();
List<ProdBonusParameter> _oProdBonusParameters = new List<ProdBonusParameter>(); List<ProdBonusParameter> _oProdBonusParameters = new List<ProdBonusParameter>();
List<ProdBonusSupervisor> _oProdBonusSupervisors = new List<ProdBonusSupervisor>(); List<ProdBonusSupervisor> _oProdBonusSupervisors = new List<ProdBonusSupervisor>();
@ -684,7 +686,13 @@ namespace HRM.UI.Controllers.Payroll
{ {
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);
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); if (emp != null) _oFinalEmployees.Add(emp);
} }