Prod bonus #7

Merged
chapal merged 1 commits from dev_mashfiq into devqc 2024-10-29 15:00:42 +06:00
12 changed files with 166 additions and 103 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)" +
"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, %d, %n)", item.ID, item.ProgramName, item.AchivedPercent, item.OTHour,
item.SalaryMonth, item.DesignNo, item.FromDate, item.ToDate, item.CreatedBy, item.CreatedDate,
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

@ -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

@ -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,10 +85,10 @@
<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">
Remove All
@ -114,23 +114,23 @@
</kendo-grid>
</div>
<div class="p-col-2 label-ailgn">
<input type="radio" name="employeeSelection" value="commonEmployee" #commonEmployee
<!-- <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=" Common Employee"></kendo-label> -->
</div>
<div class="p-col-2 label-ailgn">
<input type="radio" name="employeeSelection" value="supervisor" #supervisor [(ngModel)]="employeeSelection"
<!-- <input type="radio" name="employeeSelection" value="supervisor" #supervisor [(ngModel)]="employeeSelection"
kendoRadioButton />
<kendo-label [for]="supervisor" text=" Supervisor"></kendo-label>
<kendo-label [for]="supervisor" text=" Supervisor"></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]="false" (keydown)="onKeyDown($event)" *ngIf="allEmps.length!=0"></app-employee-picker>
<!-- [MultiSelect]="employeeSelection==='commonEmployee'"></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;
@ -196,7 +208,7 @@ 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 = {
@ -206,6 +218,7 @@ export class ProductionBonusAttendanceComponent implements OnInit {
this.loadingPanelService.ShowLoadingPanel = true;
this.bonusService.getProdBonusAttnEmployeeList(data).subscribe(
(resp) => {
debugger
this.employeeList = resp;
// console.log('employee List', this.employeeList);
},
@ -307,23 +320,22 @@ export class ProductionBonusAttendanceComponent implements OnInit {
// }
}
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();
@ -406,7 +418,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);
@ -424,7 +435,7 @@ export class ProductionBonusAttendanceComponent implements OnInit {
}
public onKeyDown(pressedKey) {
if (pressedKey.key==="Enter") {
if (pressedKey.key === "Enter") {
// this.onSave(pressedKey);
this.onClickAdd();
this.scrollToBottom();
@ -443,7 +454,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

@ -46,7 +46,7 @@
<label>Max Persons</label>
</div>
<div class="p-col-12 p-lg-3">
<kendo-numerictextbox [(ngModel)]="productionBonusSetup.maxPerson"
<kendo-numerictextbox [(ngModel)]="productionBonusSetup.maxPerson" [decimals]="0"
style="width:100%"></kendo-numerictextbox>
</div>
<div class="p-col-12 p-lg-1 label-ailgn">
@ -97,7 +97,7 @@
</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>
@ -106,17 +106,17 @@
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 type="button" kendoButton icon="delete" class="kt-delete" 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>
@ -127,7 +127,7 @@
</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>
@ -180,21 +180,23 @@
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%">
<kendo-grid-column field="empName" title="Supervisor/Line Chief/Common Worker" [width]="170">
<!-- <ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
</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 type="button" kendoButton icon="delete" class="kt-delete"
style="width: 40%;" (click)="onClickRemoveSupervisors(dataItem)">Remove</button>
style="width: fit-content;" (click)="onClickRemoveSupervisors(dataItem)">Remove</button>
</ng-template>
</kendo-grid-column>
</kendo-grid>
@ -203,7 +205,7 @@
<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>

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]
@ -283,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) {
@ -302,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 = [];
@ -332,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;
@ -521,7 +521,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');
@ -530,12 +530,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();
@ -545,8 +545,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);

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);