Prod Bonus Attn stable grid modified
This commit is contained in:
parent
a0474a12b3
commit
6063bf6cf9
|
@ -66,7 +66,7 @@
|
|||
<label>Schedule Date</label>
|
||||
</div>
|
||||
<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 class="p-col-6 p-md-1 label-ailgn">
|
||||
|
|
|
@ -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!');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -666,7 +666,9 @@ namespace HRM.UI.Controllers.Payroll
|
|||
ProdBonusLine _oProdBonusLine = (ProdBonusLine)item["prodLine"].ToObject<ProdBonusLine>();
|
||||
|
||||
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<ProdBonusParameter> _oProdBonusParameters = new List<ProdBonusParameter>();
|
||||
List<ProdBonusSupervisor> _oProdBonusSupervisors = new List<ProdBonusSupervisor>();
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user