Compare commits

...

9 Commits

15 changed files with 302 additions and 189 deletions

View File

@ -79,8 +79,8 @@ namespace HRM.BO
#endregion
public string employeeNo { get; set; }
public string empName { get; set; }
public string EmployeeNo { get; set; }
public string EmpName { get; set; }
//public Employee Employee { get; set; }

View File

@ -85,7 +85,7 @@ namespace HRM.DA
}
internal static IDataReader Get(TransactionContext tc, int setupID, DateTime dateTime)
{
string sql = SQLParser.MakeSQL("SELECT * FROM ProdBonusAttn WHERE ProdBonusSetupID=%n AND year(InTime)= %n AND month(InTime)= %n AND day(InTime)= %n",
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 year(PBA.InTime)= %n AND month(PBA.InTime)= %n AND day(PBA.InTime)= %n ORDER BY TRY_CAST(E.EMPLOYEENO AS INT) ASC",
setupID, dateTime.Year, dateTime.Month,dateTime.Day);
return tc.ExecuteReader(sql);
//return tc.ExecuteReader("SELECT * FROM ProdBonusAttn WHERE ProdBonusSetupID=%n AND CAST(InTime AS date)=%d", setupID, dateTime);

View File

@ -23,9 +23,9 @@ namespace HRM.DA
internal static void Insert(TransactionContext tc, ProductionBonusSetup item)
{
string sql = SQLParser.MakeSQL(
"INSERT INTO ProductionBonusSetup(ProductionBonusSetupID, ProgramName, AchivedPercent, OTHour, SalaryMonth, DesignNo, FromDate, ToDate, CreatedBy, CreationDate, Status)" +
" VALUES(%n, %s, %n, %n, %d, %s, %d, %d, %n, %d, %n)", item.ID, item.ProgramName, item.AchivedPercent, item.OTHour,
item.SalaryMonth, item.DesignNo, item.FromDate, item.ToDate, item.CreatedBy, item.CreatedDate,
"INSERT INTO ProductionBonusSetup(ProductionBonusSetupID, ProgramName, AchivedPercent, OTHour, SalaryMonth, DesignNo, FromDate, ToDate, MaxPerson, CreatedBy, CreationDate, Status)" +
" VALUES(%n, %s, %n, %n, %d, %s, %d, %d, %n, %n, %d, %n)", item.ID, item.ProgramName, item.AchivedPercent, item.OTHour,
item.SalaryMonth, item.DesignNo, item.FromDate, item.ToDate, item.MaxPerson, item.CreatedBy, item.CreatedDate,
item.Status);
tc.ExecuteNonQuery(sql);
}
@ -37,9 +37,9 @@ namespace HRM.DA
internal static void Update(TransactionContext tc, ProductionBonusSetup item)
{
tc.ExecuteNonQuery(
"UPDATE ProductionBonusSetup SET ProgramName=%s, AchivedPercent=%n, OTHour=%n, SalaryMonth=%d, DesignNo=%s, FromDate=%d, ToDate=%d, Status=%n" +
"WHERE ProductionBonusSetupID=%n", item.ProgramName, item.AchivedPercent, item.OTHour, item.SalaryMonth, item.DesignNo,
item.FromDate, item.ToDate, item.Status, item.ID);
"UPDATE ProductionBonusSetup SET ProgramName=%s, AchivedPercent=%n, OTHour=%n, SalaryMonth=%d, DesignNo=%s, FromDate=%d, ToDate=%d, MaxPerson=%n, Status=%n " +
" WHERE ProductionBonusSetupID=%n", item.ProgramName, item.AchivedPercent, item.OTHour, item.SalaryMonth, item.DesignNo,
item.FromDate, item.ToDate, item.MaxPerson, item.Status, item.ID);
}
#endregion

View File

@ -4043,6 +4043,11 @@ AND ea.EMPLOYEEID=emp.EMPLOYEEID AND ea.LASTLEVEL=1),'') LastAcademic ,
}
tc.ExecuteNonQuery(sSQL);
}
internal static DataTable GetEmployeeNameAndNo(TransactionContext tc, int payrolltypeid)
{
return tc.ExecuteDataTable(
"SELECT e.employeeId as id, e.employeeNo, e.name FROM employee e WHERE e.payrolltypeid=%n", payrolltypeid);
}
}
#endregion

View File

@ -5542,5 +5542,29 @@ namespace HRM.DA
}
return oGrossPay;
}
public DataTable GetEmployeeNameAndNo(int payrolltypeid)
{
DataTable dt = null;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
dt = EmployeeDA.GetEmployeeNameAndNo(tc, payrolltypeid);
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return dt;
}
}
}

View File

@ -246,6 +246,12 @@
</GroupExpressions>
</Group>
<SortExpressions>
<SortExpression>
<Value>=Year(Fields!Date.Value)</Value>
</SortExpression>
<SortExpression>
<Value>=Month(Fields!Date.Value)</Value>
</SortExpression>
<SortExpression>
<Value>=Fields!Date.Value</Value>
</SortExpression>

View File

@ -507,4 +507,8 @@ export class EmployeeServices {
getSearchEmployeesByEmpIds(empIds: string) {
return this.apiService.httpGet<SearchEmployee[]>('/Employee/getSearchEmployeesByEmpIds/' + empIds);
}
getAllEmployeeNameAndNo() {
return this.apiService.httpGet<Employee[]>('/Employee/getAllEmployeeNameAndNo');
}
}

View File

@ -13,7 +13,7 @@ export class ApiService {
public isSSO = false;
public versionDeployement = false;
public versionNumber = `V-${GlobalfunctionExtension.generateVersionNumber(new Date(2024, 7, 18))}-`+"01";
public versionNumber = `V-${GlobalfunctionExtension.generateVersionNumber(new Date(2024, 9, 31))}-`+"01";
public static BASE_URL = '';
public base_url = '';
// public currentLink = '';

View File

@ -1,4 +1,4 @@
<app-loading-panel></app-loading-panel>
<app-loading-panel> </app-loading-panel>
<div class="p-grid card">
<div class="p-col-6 p-md-1 label-ailgn">
<label>Design Date</label>
@ -85,12 +85,12 @@
<div class="p-col-12" align="right">
<button icon="refresh" kendoButton [primary]="true" style="width: fit-content" (click)="onClickRefresh()"
[disabled]="selectedProdBSdata===undefined||selectedLine===undefined||selectedDate===undefined">Refresh</button>
[disabled]="selectedProdBSdata===undefined||selectedLine===undefined||selectedDate===undefined">Load</button>
</div>
<div class="p-col-12">
<kendo-grid #grid [data]="employeeList" [pageable]="true" [sortable]="true" [reorderable]="true" [resizable]="true" [height]="450">
<kendo-grid #grid [data]="employeeList" [pageable]="false" [sortable]="true" [reorderable]="true" [resizable]="true" [height]="450">
<ng-template kendoGridToolbarTemplate>
<button type="button" kendoButton icon="delete" class="kt-delete">
<button type="button" kendoButton icon="delete" class="kt-delete" (click)="onClickRemoveAll()">
Remove All
</button>
<kendo-grid-spacer></kendo-grid-spacer>
@ -116,21 +116,21 @@
<div class="p-col-2 label-ailgn">
<input type="radio" name="employeeSelection" value="commonEmployee" #commonEmployee
[(ngModel)]="employeeSelection" kendoRadioButton />
<kendo-label [for]="commonEmployee" text=" Common Employee"></kendo-label>
<kendo-label [for]="commonEmployee" text=" Multiple"></kendo-label>
</div>
<div class="p-col-2 label-ailgn">
<input type="radio" name="employeeSelection" value="supervisor" #supervisor [(ngModel)]="employeeSelection"
kendoRadioButton />
<kendo-label [for]="supervisor" text=" Supervisor"></kendo-label>
<kendo-label [for]="supervisor" text=" Single"></kendo-label>
</div>
<div class="p-col-4">
<app-employee-picker (ItemSelected)="GetSelectedEmployee($event)" [setSelectedEmp]="selectedEmps"
[MultiSelect]="false" (keydown)="onKeyDown($event)"></app-employee-picker>
<!-- [MultiSelect]="employeeSelection==='commonEmployee'"></app-employee-picker> -->
[MultiSelect]="employeeSelection==='commonEmployee'" (keydown)="onKeyDown($event)" ></app-employee-picker>
<!-- [MultiSelect]="false" (keydown)="onKeyDown($event)" *ngIf="allEmps.length!=0"></app-employee-picker> -->
</div>
<div class="p-col-2"></div>
<div class="p-col-2" align="right">
<button icon="plus" kendoButton [primary]="true" style="width:80%" (click)="onClickAdd()"
<button icon="plus" kendoButton [primary]="true" style="width:fit-content" (click)="onClickAdd()"
[disabled]="false">Add</button>
</div>
<div class="p-col-10"></div>

View File

@ -61,6 +61,11 @@ export class ProductionBonusAttendanceComponent implements OnInit {
employeeSelection: string = 'commonEmployee';
employeeList: Employee[] = [];
allEmps: any[] = [];
value: '';
constructor(public apiService: ApiService,
public notificationService: HRMNotificationService,
public dataTransferService: DataTransferService,
@ -72,25 +77,32 @@ export class ProductionBonusAttendanceComponent implements OnInit {
this._departmentPicker = new DynamicPicker(EnumDynamicpickerType.Department, false);
}
ngOnInit(): void {
// this.Loadlayout();
this.GetAllEmployees();
this.productionBonusSetup = new ProductionBonusSetup();
this.showScheduleDate = false;
this.startTime = this.setTime(this.startTime, 6, 0, 0);
this.endTime = this.setTime(this.endTime, 23, 59, 0);
// this.startTime.setHours(6);
// this.startTime.setMinutes(0);
// this.startTime.setSeconds(0);
this.startTime = this.setTime(this.startTime, 6, 0, 0)
// this.endTime.setHours(23);
// this.endTime.setMinutes(0);
// this.endTime.setSeconds(0);
this.endTime = this.setTime(this.endTime, 23, 59, 0)
}
employeeList: Employee[] = [];
value: '';
private GetAllEmployees() {
debugger
this.loadingPanelService.ShowLoadingPanel = true;
this.employeeService.getAllEmployeeNameAndNo().subscribe(
(resp) => {
this.allEmps = resp;
},
(err) => {
this.notificationService.showError(err.error);
this.loadingPanelService.ShowLoadingPanel = false;
},
() => {
this.loadingPanelService.ShowLoadingPanel = false;
}
);
}
public GetSelectedEmployee(childData) {
this.selectedEmps = childData;
@ -167,6 +179,10 @@ export class ProductionBonusAttendanceComponent implements OnInit {
this.productionBonusSetup.fromDate = new Date(this.productionBonusSetup.fromDate);
this.productionBonusSetup.toDate = new Date(this.productionBonusSetup.toDate);
this.loadingPanelService.ShowLoadingPanel = false;
this.startTime = this.setTime(this.startTime, 6, 0, 0);
this.endTime = this.setTime(this.endTime, 23, 59, 0);
this.selectedLine = undefined;
}
)
}
@ -196,17 +212,19 @@ export class ProductionBonusAttendanceComponent implements OnInit {
() => {
this.loadingPanelService.ShowLoadingPanel = false;
this.employeeList = [];
debugger;
// debugger;
if (this.prodBonusAttn.length <= 0 && (this.productionBonusSetup.productionBonusType == EnumProductionBonusType.Cutting ||
this.productionBonusSetup.productionBonusType == EnumProductionBonusType.Finishing)) {
let data = {
prodLine: this.selectedLine,
prodLine: this.selectedLine,
date: this.selectedDate
}
this.loadingPanelService.ShowLoadingPanel = true;
this.bonusService.getProdBonusAttnEmployeeList(data).subscribe(
(resp) => {
this.employeeList = resp;
debugger
this.employeeList = resp;
this.employeeList.forEach(x => this.AddEmployeeGridData(x.id, false));
// console.log('employee List', this.employeeList);
},
(err) => {
@ -252,78 +270,77 @@ export class ProductionBonusAttendanceComponent implements OnInit {
this.notificationService.showWarning('Please Select an Employee');
return;
}
// 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) {
// this.notificationService.showWarning("EmployeeNo " + this.employeeList[j].employeeNo + " Already Exists");
// isNew = false;
// break;
// }
// }
// if (isNew) {
// this.AddEmployeebyId(this.selectedEmps[i].employeeID);
// this.AddEmployeeGridData(this.selectedEmps[i].employeeID, true);
// }
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) {
this.notificationService.showWarning("EmployeeNo " + this.employeeList[j].employeeNo + " Already Exists");
isNew = false;
break;
}
}
if (isNew) {
this.AddEmployeebyId(this.selectedEmps[i].employeeID);
this.AddEmployeeGridData(this.selectedEmps[i].employeeID, true);
}
// debugger;
// }
// }
// }
// else {
let sid: number;
const emp = this.employeeList.find((e1) => e1.id === this.selectedEmps['employeeID']);
const att = this.prodBonusAttn.find((e1) => e1.employeeID === this.selectedEmps['employeeID']);
if (emp === undefined && att === undefined) {
if (this.selectedProdBSdata !== undefined) {
if (this.employeeList.length < this.productionBonusSetup.maxPerson) {
let isNew = true;
for (let j = 0; j < this.employeeList.length; j++, isNew = true) {
if (this.selectedEmps['employeeID'] == this.employeeList[j].id) {
this.notificationService.showWarning("EmployeeNo " + this.employeeList[j].employeeNo + " Already Exists");
isNew = false;
break;
}
}
if (isNew) {
this.AddEmployeebyId(this.selectedEmps['employeeID']);
this.AddEmployeeGridData(this.selectedEmps['employeeID'], false);
}
}
else {
this.notificationService.showWarning('Maximum number of employee entry is done, you can\'t add more !');
}
debugger;
}
}
else {
this.notificationService.showWarning('Employee already exist ! Can\'t Add');
}
else {
let sid: number;
const emp = this.employeeList.find((e1) => e1.id === this.selectedEmps['employeeID']);
const att = this.prodBonusAttn.find((e1) => e1.employeeID === this.selectedEmps['employeeID']);
if (emp === undefined && att === undefined) {
if (this.selectedProdBSdata !== undefined) {
if (this.employeeList.length < this.productionBonusSetup.maxPerson) {
let isNew = true;
for (let j = 0; j < this.employeeList.length; j++, isNew = true) {
if (this.selectedEmps['employeeID'] == this.employeeList[j].id) {
this.notificationService.showWarning("EmployeeNo " + this.employeeList[j].employeeNo + " Already Exists");
isNew = false;
break;
}
}
if (isNew) {
this.AddEmployeebyId(this.selectedEmps['employeeID']);
this.AddEmployeeGridData(this.selectedEmps['employeeID'], false);
}
}
else {
this.notificationService.showWarning('Maximum number of employee entry is done, you can\'t add more !');
}
}
// }
}
else {
this.notificationService.showWarning('Employee already exist ! Can\'t Add');
}
}
}
AddEmployeebyId(empId: number) {
this.loadingPanelService.ShowLoadingPanel = true;
this.employeeService.getEmployeeByID(empId).subscribe(
(resp) => {
this.employeeList.push(resp);
// console.log(this.employeeList);
// debugger;
},
(err) => {
this.notificationService.showError(err.error);
this.loadingPanelService.ShowLoadingPanel = false;
},
() => {
// this.AddEmployeeGridData(empId, isCommonValue);
// console.log(this.prodBonusAttn);
this.loadingPanelService.ShowLoadingPanel = false;
}
);
// 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) {
// var newProdBonusAttn: ProdBonusAttn = new ProdBonusAttn();
@ -336,11 +353,11 @@ export class ProductionBonusAttendanceComponent implements OnInit {
outTime: this.selectedDate,
bonusHour: 0,
employeeID: empId,
isCommon: isCommonValue
isCommon: false
};
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) {
@ -406,7 +423,6 @@ export class ProductionBonusAttendanceComponent implements OnInit {
);
}
onClickRemove(data: any) {
// console.log(this.prodBonusAttn);
// debugger;
const index = this.employeeList.findIndex(item => item.id === data.id);
const indexAttn = this.prodBonusAttn.findIndex(item => item['employeeID'] === data.id);
@ -416,18 +432,24 @@ export class ProductionBonusAttendanceComponent implements OnInit {
this.prodBonusAttn.splice(index, 1);
}
}
public onClickRemoveAll(){
this.employeeList = [];
this.prodBonusAttn = [];
}
clear() {
public clear() {
this.productionBonusSetup = new ProductionBonusSetup();
this.employeeList = [];
this.selectedLine = undefined;
}
public onKeyDown(pressedKey) {
if (pressedKey.key==="Enter") {
debugger;
if (pressedKey.key === "Enter") {
// this.onSave(pressedKey);
this.onClickAdd();
this.scrollToBottom();
this.selectedEmps = undefined;
}
}
@ -443,7 +465,7 @@ export class ProductionBonusAttendanceComponent implements OnInit {
this.gridScrollableElement.scrollTop = this.gridScrollableElement.scrollHeight;
}
public setTime(date: Date, hour: number, min: number, sec: number): Date{
public setTime(date: Date, hour: number, min: number, sec: number): Date {
date.setHours(hour);
date.setMinutes(min);
date.setSeconds(sec);

View File

@ -1,88 +1,88 @@
<app-loading-panel></app-loading-panel>
<!-- <form [formGroup]="productionBonousSetupForm"> -->
<div class="p-grid card">
<div class="p-col-1 label-ailgn">
<div class="p-col-12 p-lg-1 label-ailgn">
<input type="checkbox" kendoCheckBox id="disabled" (change)="OnclickCheckbox()" [checked]="isNewLayout"
style="margin-top: -3px ;" />
<label style="padding-left: 1%; margin: auto;" for="disabled">
New Layout</label>
</div>
<div class="p-col-1 label-ailgn" align="right">
<div class="p-col-12 p-lg-1 label-ailgn">
<label>Salary Month</label>
</div>
<div class="p-col-2">
<div class="p-col-12 p-lg-2">
<kendo-datepicker [(ngModel)]="selectedSalaryDate" [format]="'dd MMMM yyyy'"
style="width:100%"></kendo-datepicker>
</div>
<div class="p-col-2" align="right">
<button icon="reload" kendoButton [primary]="true" style="width:60%" *ngIf="!isNewLayout" for="disabled"
<div class="p-col-12 p-lg-2">
<button icon="reload" kendoButton [primary]="true" style="width: fit-content" *ngIf="!isNewLayout" for="disabled"
(click)="Loadlayout()">Refresh</button>
</div>
<div class="p-col-1 label-ailgn" align="right">
<div class="p-col-12 p-lg-1 label-ailgn">
<label>Layout No.</label>
</div>
<div class="p-col-3" align="right">
<div class="p-col-12 p-lg-3">
<kendo-dropdownlist [data]="filteredProdBSdata" [(ngModel)]="selectedProdBSdata" [filterable]="true"
textField="design" valueField="id" style="width:95%" (filterChange)="handleFilter($event)"
*ngIf="!isNewLayout" [defaultItem]="{ design: 'Select layout no..'}" [disabled]="prodBSdata===undefined">
textField="design" valueField="id" style="width:100%" (filterChange)="handleFilter($event)"
*ngIf="!isNewLayout" [defaultItem]="{ design: 'Select layout no..'}" [disabled]="prodBSdata===undefined"(valueChange)="LayoutDetails()">
</kendo-dropdownlist>
<input [(ngModel)]="layoutNo" type="text" style="width:95%" pInputText *ngIf="isNewLayout">
<input [(ngModel)]="layoutNo" type="text" style="width:100%" pInputText *ngIf="isNewLayout">
</div>
<div class="p-col-2" align="right">
<button icon="information" kendoButton [primary]="true" style="width:60%" *ngIf="selectedProdBSdata!==undefined"
(click)="LayoutDetails()" [disabled]="selectedProdBSdata===undefined">Details</button>
<div class="p-col-12 p-lg-2">
<!-- <button icon="information" kendoButton [primary]="true" style="width:60%" *ngIf="selectedProdBSdata!==undefined"
(click)="LayoutDetails()" [disabled]="selectedProdBSdata===undefined">Details</button> -->
</div>
<!-- <div class="p-col-3"></div> -->
<kendo-card class="p-col-12 p-md-12 p-lg-12" width="100%" *ngIf="isNewLayout || editDetails" for="disabled">
<!-- <div class="p-col-12 p-lg-3"></div> -->
<kendo-card class="p-col-12 p-lg-12 p-md-12 p-lg-12" width="100%" *ngIf="isNewLayout || editDetails" for="disabled">
<div class="p-grid">
<div class="p-col-1 label-ailgn">
<div class="p-col-12 p-lg-1 label-ailgn">
<label>Program Name</label>
</div>
<div class="p-col-3">
<div class="p-col-12 p-lg-3">
<input [(ngModel)]="productionBonusSetup.programName" style="width:100%" type="text" pInputText>
</div>
<div class="p-col-1 label-ailgn" align="right">
<div class="p-col-12 p-lg-1 label-ailgn">
<label>Max Persons</label>
</div>
<div class="p-col-3">
<kendo-numerictextbox [(ngModel)]="productionBonusSetup.maxPerson"
<div class="p-col-12 p-lg-3">
<kendo-numerictextbox [(ngModel)]="productionBonusSetup.maxPerson" [decimals]="0"
style="width:100%"></kendo-numerictextbox>
</div>
<div class="p-col-1 label-ailgn" align="right">
<div class="p-col-12 p-lg-1 label-ailgn">
<label>Achieved %</label>
</div>
<div class="p-col-3">
<div class="p-col-12 p-lg-3">
<kendo-numerictextbox [(ngModel)]="productionBonusSetup.achivedPercent" [decimals]="2"
style="width:100%"></kendo-numerictextbox>
</div>
<div class="p-col-1 label-ailgn">
<div class="p-col-12 p-lg-1 label-ailgn">
<label>Bonus Type</label>
</div>
<div class="p-col-2">
<div class="p-col-12 p-lg-2">
<kendo-dropdownlist [data]="bonusType" [(ngModel)]="selectedBonusType" [textField]="'label'"
[defaultItem]="{ label: 'Select Bonus Type...', value: null }" [valueField]="'value'" style="width:100%">
</kendo-dropdownlist>
</div>
<div class="p-col-1 label-ailgn" align="right">
<div class="p-col-12 p-lg-1 label-ailgn">
<label>From Date</label>
</div>
<div class="p-col-2">
<div class="p-col-12 p-lg-2">
<kendo-datepicker [(ngModel)]="productionBonusSetup.fromDate" [format]="'dd MMMM yyyy'"
style="width:100%"></kendo-datepicker>
</div>
<div class="p-col-1 label-ailgn" align="right">
<div class="p-col-12 p-lg-1 label-ailgn">
<label>To Date</label>
</div>
<div class="p-col-2">
<div class="p-col-12 p-lg-2">
<kendo-datepicker [(ngModel)]="productionBonusSetup.toDate" [format]="'dd MMMM yyyy'"
style="width:100%"></kendo-datepicker>
</div>
<div class="p-col-1 label-ailgn" align="right">
<div class="p-col-12 p-lg-1 label-ailgn">
<label>Bonus Hours</label>
</div>
<div class="p-col-2">
<div class="p-col-12 p-lg-2">
<kendo-numerictextbox [(ngModel)]="productionBonusSetup.otHour" [decimals]="2"
style="width:100%"></kendo-numerictextbox>
</div>
@ -97,105 +97,106 @@
</div>
<div class="p-grid">
<p-panel header="Production Bonus Line" style="width: 100%">
<p-panel header="Production Bonus Line" [style.height.%]="100">
<kendo-grid [data]="productionBonusSetup.productionBonusLines" [pageable]="true" [sortable]="true"
[resizable]="true">
<ng-template kendoGridToolbarTemplate>
<button kendoButton icon="plus" [primary]="true" style="width: 10%; padding: 7px;"
<button kendoButton icon="plus" [primary]="true" style="width: fit-content"
(click)="onClickAddLine()">Add
Line</button>
<kendo-grid-spacer></kendo-grid-spacer>
</ng-template>
<kendo-grid-column field="lineName" title="Line Name" width="50%">
<kendo-grid-column field="lineName" title="Line Name" [width]="250">
<!-- <ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
</ng-template> -->
</kendo-grid-column>
<kendo-grid-column field="scheduledHour" title="Scheduled Hours" width="30%">
<kendo-grid-column field="scheduledHour" title="Scheduled Hours" [width]="200">
</kendo-grid-column>
<kendo-grid-column title="Actions" width="20%">
<kendo-grid-column title="Actions" [width]="220">
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
<button kendoButton icon="gear" [primary]="true" (click)="onCellClickEdit(dataItem)"
style="width: 40%; margin-right: 5px;">Edit</button>
<button kendoButton icon="delete" [primary]="true" style="width: 40%;" (click)="onClickRemove(dataItem)">Remove</button>
style="width: fit-content; margin-right: 5px;">Edit</button>
<button type="button" kendoButton icon="delete" class="kt-delete" style="width: fit-content;" (click)="onClickRemove(dataItem)">Remove</button>
</ng-template>
</kendo-grid-column>
</kendo-grid>
<div class="p-col-12" align="right">
<button kendoButton icon="save" [primary]="true" style="width: 10%; padding: 7px;" (click)="onClickSubmit()">Submit</button>
<div class="p-col-12 p-lg-12" align="right">
<button kendoButton icon="save" [primary]="true" style="width: fit-content" (click)="onClickSubmit()">Submit</button>
</div>
<div>
<kendo-dialog class="blur-background" *ngIf="opened" (close)="close()" [maxHeight]="700"
<kendo-dialog class="blur-background" *ngIf="opened" (close)="close()" [minHeight]="400" [maxHeight]="600" [minWidth]="400"
[maxWidth]="1050">
<kendo-dialog-titlebar>
<div style="font-size: 18px; line-height: 1.3em;"><span class=""></span>Production Bonus Line</div>
</kendo-dialog-titlebar>
<kendo-dialog-content>
<app-hr-notification-list></app-hr-notification-list>
<div class="p-col-12 p-md-12">
<div class="p-col-12 p-lg-12 p-md-12">
<div class="p-grid">
<div class="p-col-1 label-ailgn">
<div class="p-col-12 p-lg-1 label-ailgn">
<label>Line Name</label>
</div>
<div class="p-col-5" *ngIf="isNewLine">
<div class="p-col-12 p-lg-5" *ngIf="isNewLine">
<app-dynamic-picker [dynamicPickerView]="_departmentPicker"></app-dynamic-picker>
</div>
<div class="p-col-5" *ngIf="!isNewLine">
<div class="p-col-12 p-lg-5" *ngIf="!isNewLine">
<input [(ngModel)]="selectedRow.lineName" [readonly]="!isNewLine" type="text"
style="width:100%" pInputText>
</div>
<div class="p-col-2">
<div class="p-col-12 p-lg-2">
</div>
<div class="p-col-2 label-ailgn">
<div class="p-col-12 p-lg-2 label-ailgn">
<label>Scheduled Hours</label>
</div>
<div class="p-col-2">
<kendo-numerictextbox [(ngModel)]="scheduledHours" [decimals]="2"
[readonly]="!isNewLine" style="width: 100%;"></kendo-numerictextbox>
<div class="p-col-12 p-lg-2">
<kendo-numerictextbox [(ngModel)]="selectedRow.scheduledHour" [decimals]="2" style="width: 100%;"(ngModelChange)="onScheduledHoursChange($event)"></kendo-numerictextbox>
</div>
</div>
<p-tabView>
<p-tabPanel header="Supervisor/Line Chief/Common Worker" leftIcon="pi pi-user">
<div class="p-grid">
<div class="p-col-3 label-ailgn">
<div class="p-col-12 p-lg-3 label-ailgn">
<label>Supervisor/Line Chief/Common Worker</label>
</div>
<div class="p-col-3">
<div class="p-col-12 p-lg-3">
<app-employee-picker (ItemSelected)="GetSelectedEmployee($event)"
[setSelectedEmp]="_pickerSelecteEmp"
[isActive]="empPickerActive"></app-employee-picker>
</div>
<div class="p-col-2 label-ailgn" align="right">
<div class="p-col-12 p-lg-2 label-ailgn" align="right">
<label>Bonus Percent</label>
</div>
<div class="p-col-2">
<div class="p-col-12 p-lg-2">
<kendo-numerictextbox [(ngModel)]="bonusPercent"
[decimals]="2"></kendo-numerictextbox>
</div>
<div class="p-col-2" align="right">
<div class="p-col-12 p-lg-2" align="right">
<button icon="plus" kendoButton [primary]="true" (click)="newLine()"
style="width:80%">Add</button>
</div>
</div>
<kendo-grid [kendoGridBinding]="prodBonusLine.prodBonusSupervisors" [sortable]="true"
<kendo-grid [kendoGridBinding]="prodBonusLine.prodBonusSupervisors" [sortable]="true" [style.height.%]="100"
[reorderable]="true"><!-- [resizable]="true" [pageSize]="state.take" [skip]="state.skip"
[sort]="state.sort" [pageable]="true" (dataStateChange)="dataStateChange($event)">-->
<kendo-grid-column field="empName" title="Supervisor/Line Chief/Common Worker"
width="40%">
[sort]="state.sort" [pageable]="true" (dataStateChange)="dataStateChange($event)">-->
<kendo-grid-column field="empName" title="Supervisor/Line Chief/Common Worker" [width]="170">
<!-- <ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
</ng-template> -->
</ng-template> -->
</kendo-grid-column>
<kendo-grid-column field="bonusPercent" title="Bonus Percent" width="30%">
<kendo-grid-column field="employeeNo" title="Employee No" [width]="120">
<!-- <ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
</ng-template> -->
</kendo-grid-column>
<kendo-grid-column title="Actions" width="30%">
<kendo-grid-column field="bonusPercent" title="Bonus Percent" [width]="100">
</kendo-grid-column>
<kendo-grid-column title="Actions" [width]="200">
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
<button kendoButton icon="delete" [primary]="true"
style="width: 40%;" (click)="onClickRemoveSupervisors(dataItem)">Remove</button>
<button type="button" kendoButton icon="delete" class="kt-delete"
style="width: fit-content;" (click)="onClickRemoveSupervisors(dataItem)">Remove</button>
</ng-template>
</kendo-grid-column>
</kendo-grid>
@ -204,18 +205,30 @@
<kendo-grid [kendoGridBinding]="prodBonusLine.prodBonusWorkSchedules" [pageable]="true"
[sortable]="true" [reorderable]="true" [resizable]="true">
<kendo-grid-column field="startDateTime" title="Date" width="100%">
<kendo-grid-column field="startDateTime" title="Date" [width]="120">
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
{{dataItem.startDateTime | date: 'dd MMMM yyyy'}}
</ng-template>
</kendo-grid-column>
<!-- <kendo-grid-column field="startDateTime" title="Start Time" width="100">
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
{{dataItem.startDateTime | date: 'hh:mm a'}}
</ng-template>
</kendo-grid-column>
<kendo-grid-column field="endDateTime" title="End Time" width="100">
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
{{dataItem.endDateTime | date: 'hh:mm a'}}
</ng-template>
</kendo-grid-column> -->
</kendo-grid>
</p-tabPanel>
</p-tabView>
</div>
</kendo-dialog-content>
<kendo-dialog-actions>
<div class="p-col-12" align="right">
<div class="p-col-12 p-lg-12" align="right">
<button kendoButton icon="save" (click)="onClickOk()" [primary]="true"
style="margin: 5px; width: 15%;">Ok</button>
<button kendoButton icon="close" (click)="close()" [primary]="true"

View File

@ -198,7 +198,7 @@ export class ProductionBonusSetupComponent implements OnInit {
(resp) => {
this.productionBonusSetup = resp;
debugger;
console.log(this.productionBonusSetup);
// console.log(this.productionBonusSetup);
this.selectedBonusType = {
value: this.productionBonusSetup.productionBonusType,
label: EnumProductionBonusType[this.productionBonusSetup.productionBonusType]
@ -272,6 +272,8 @@ export class ProductionBonusSetupComponent implements OnInit {
debugger;
// this.onEdit = false;
this.isNewLine = true;
this.selectedRow = new ProdBonusLine();
this._departmentPicker = new DynamicPicker(EnumDynamicpickerType.Department, false);
this.prodBonusLine = new ProdBonusLine();
this.prodBonusWork = new ProdBonusWorkSchedule();
@ -281,7 +283,7 @@ export class ProductionBonusSetupComponent implements OnInit {
return this.notificationService.showWarning('Please select Bonus Type');
}
this.saveProductionBonusSetup();
console.log(this.productionBonusSetup);
// console.log(this.productionBonusSetup);
debugger;
if (this.productionBonusSetup.designNo === '' || this.productionBonusSetup.programName === '' || this.productionBonusSetup.fromDate === undefined ||
this.productionBonusSetup.toDate === undefined || this.productionBonusSetup.productionBonusType === null) {
@ -300,7 +302,7 @@ export class ProductionBonusSetupComponent implements OnInit {
// }
}
else { //Edit Setup line
console.log(this.productionBonusSetup);
// console.log(this.productionBonusSetup);
debugger;
this.prodBonusLine.prodBonusSupervisors = [];
this.prodBonusLine.prodBonusWorkSchedules = [];
@ -330,7 +332,7 @@ export class ProductionBonusSetupComponent implements OnInit {
onCellClickEdit(dataItem: ProdBonusLine) {
console.log(dataItem);
// console.log(dataItem);
this.isNewLine = false;
this.prodBonusLine = new ProdBonusLine();
debugger;
@ -369,7 +371,6 @@ export class ProductionBonusSetupComponent implements OnInit {
}
newLine() {
debugger;
if ((this._departmentPicker.selectedID === undefined || this._departmentPicker.selectedID === 0) &&
(this.prodBonusLine.lineName === '' || this.prodBonusLine.lineName === undefined)) {
this.notificationService.showWarning('Please Select a Line');
@ -389,6 +390,13 @@ export class ProductionBonusSetupComponent implements OnInit {
// this.notificationService.showWarning('Please Select Bonus Percentage');
// return;
// }
debugger;
this._employee;
this.prodBonusLine.prodBonusSupervisors;
if (this.scheduledHours < 0 || this.bonusPercent < 0) {
this.notificationService.showWarning('Scheduled Hours and Bonus Percentage can\'t be negative');
return;
@ -399,6 +407,10 @@ export class ProductionBonusSetupComponent implements OnInit {
var newlineParameter: ProdBonusParameter = new ProdBonusParameter();
// var newLayoutWork: ProdBonusWorkSchedule = new ProdBonusWorkSchedule();
const index = this.prodBonusLine.prodBonusSupervisors.findIndex(sv=> sv.employeeID == this._employee.id);
if (index !== -1) {
this.prodBonusLine.prodBonusSupervisors.splice(index, 1);
}
//Supervisor
newlineSupervisor.employeeID = this._employee.id;
newlineSupervisor.employeeNo = this._employee.employeeNo;
@ -406,8 +418,6 @@ export class ProductionBonusSetupComponent implements OnInit {
newlineSupervisor.bonusPercent = this.bonusPercent;
newlineSupervisor.prodBonusSetupID = this.productionBonusSetup.id;
if (this.isNewLine) {
newlineParameter.itemID = this._departmentPicker.selectedID;
newlineParameter.itemType = 0;
@ -464,7 +474,6 @@ export class ProductionBonusSetupComponent implements OnInit {
this.prodBonusLine.id = this.selectedRow.id;
this.prodBonusLine.lineName = this.selectedRow.lineName;
this.prodBonusLine.scheduledHour = this.selectedRow.scheduledHours;
this.prodBonusLine.prodBonusSupervisors.push(newlineSupervisor);
// this.prodBonusLine.prodBonusParameters.push(newlineParameter);
@ -487,7 +496,12 @@ export class ProductionBonusSetupComponent implements OnInit {
}
onClickOk() {
debugger;
if (this.isNewLine) {
if(this._departmentPicker.selectedID == undefined){
this.notificationService.showWarning('Please Select a Line'); return;
}
this.prodBonusLine.lineName = this._departmentPicker.selectedObjects[0]['name'];
this.productionBonusSetup.productionBonusLines.push(this.prodBonusLine); // for new
this.notificationService.showSuccess('New Line added');
}
@ -511,7 +525,7 @@ export class ProductionBonusSetupComponent implements OnInit {
onClickSubmit() {
debugger;
this.saveProductionBonusSetup();
console.log(this.productionBonusSetup);
// console.log(this.productionBonusSetup);
if (this.productionBonusSetup.designNo === '' || this.productionBonusSetup.programName === '' || this.productionBonusSetup.fromDate === undefined ||
this.productionBonusSetup.toDate === undefined || this.productionBonusSetup.productionBonusType === null) {
this.notificationService.showWarning('Please fill up the information of production bonus setup');
@ -520,12 +534,12 @@ export class ProductionBonusSetupComponent implements OnInit {
this.loadingPanelService.ShowLoadingPanel = true;
this.bonusService.saveProductionBonusSetup(this.productionBonusSetup).subscribe(
(resp) => {
console.log(resp);
// console.log(resp);
},
(err) => {
this.loadingPanelService.ShowLoadingPanel = false;
this.notificationService.showError(err.error);
console.log(err.error);
// console.log(err.error);
},
() => {
this.clearFields();
@ -535,8 +549,8 @@ export class ProductionBonusSetupComponent implements OnInit {
);
}
onClickRemove(data: any) {
console.log(this.productionBonusSetup.productionBonusLines);
console.log(data);
// console.log(this.productionBonusSetup.productionBonusLines);
// console.log(data);
debugger;
const index = this.productionBonusSetup.productionBonusLines.findIndex(item => item.id === data.id);
// const indexAttn = this.prodBonusAttn.findIndex(item => item['employeeID'] === data.id);
@ -565,4 +579,10 @@ export class ProductionBonusSetupComponent implements OnInit {
this.editDetails = false;
this.prodBSdata = undefined;
}
onScheduledHoursChange(value: number){
debugger;
this.prodBonusLine.scheduledHour = value;
this.scheduledHours;
this.productionBonusSetup.productionBonusLines
}
}

View File

@ -230,6 +230,7 @@ export class ProductionBonusReportsComponent implements OnInit {
this.showDate = true;
this.showDesign = true;
this.salaryMonth = new Date();
this.Loadlayout(this.salaryMonth);
}
else {
this.showDate = false;

View File

@ -2786,5 +2786,22 @@ namespace HRM.UI.Controllers
return Ok();
}
[HttpGet("getAllEmployeeNameAndNo")]
public ActionResult getAllEmployeeNameAndNo()
{
DataTable dt = new DataTable();
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
try
{
dt = new EmployeeService().GetEmployeeNameAndNo((int)currentUser.PayrollTypeID);
}
catch (Exception ex)
{
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
}
return Ok(dt);
}
}
}

View File

@ -475,8 +475,8 @@ namespace HRM.UI.Controllers.Payroll
{
oEmp = new EmployeeService().Get(prodSupervisor.EmployeeID);
prodSupervisor.empName = oEmp.Name;
prodSupervisor.employeeNo = oEmp.EmployeeNo;
prodSupervisor.EmpName = oEmp.Name;
prodSupervisor.EmployeeNo = oEmp.EmployeeNo;
}
prodLine.ProdBonusParameters = _prodBonusParameterService.GetByLineID(prodLine.ID);
@ -547,7 +547,8 @@ namespace HRM.UI.Controllers.Payroll
DateTime date = (DateTime)item["date"].ToObject<DateTime>();
ProdBonusLine _oProdBonusLine = (ProdBonusLine)item["prodLine"].ToObject<ProdBonusLine>();
List<Employee> _oEmployees = new List<Employee>();
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
List<Employee> _oEmployees = new EmployeeService().Get(EnumEmployeeStatus.Live, (int)currentUser.PayrollTypeID);
List<Employee> _oFinalEmployees = new List<Employee>();
List<ProdBonusParameter> _oProdBonusParameters = new List<ProdBonusParameter>();
List<ProdBonusSupervisor> _oProdBonusSupervisors = new List<ProdBonusSupervisor>();