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