Production Bonus attn Swing and Printing #12

Merged
chapal merged 4 commits from dev_mashfiq into devqc 2024-11-18 15:05:35 +06:00
14 changed files with 320 additions and 161 deletions
Showing only changes of commit ba4cdaf6b9 - Show all commits

View File

@ -78,8 +78,10 @@ namespace HRM.BO
}
#endregion
public string EmployeeNo { get; set; }
public string devName { get; set; }
public string devParentName{ get; set; }
public string devGrantParentName{ get; set; }
public string EmployeeNo { get; set; }
public string EmpName { get; set; }
//public Employee Employee { get; set; }

View File

@ -55,6 +55,20 @@ namespace HRM.DA
{
return tc.ExecuteReader("SELECT * FROM ProdBonusWorkSchedule where ProdBonusSetupID=%n", nSetupID);
}
internal static DataTable GetschedulewithTime(TransactionContext tc, int lineID)
{
return tc.ExecuteDataTable(@"select a.*,bb.scheduleCount , (select max(ps.InTime) from ProdBonusAttn ps where ps.ProdBonusLineID =%n
and DATEADD(dd, 0, DATEDIFF(dd, 0, ps.InTime)) = bb.scheduleDate) as inTime,
(select max(ps.OutTime) from ProdBonusAttn ps where ps.ProdBonusLineID =%n
and DATEADD(dd, 0, DATEDIFF(dd, 0, ps.InTime)) = bb.scheduleDate) as outTime from
(SELECT * FROM ProdBonusWorkSchedule where ProdBonusLineID=%n) a,
(
select DATEADD(dd, 0, DATEDIFF(dd, 0, InTime)) scheduleDate,COUNT(*) scheduleCount from ProdBonusAttn where
ProdBonusLineID =%n group by DATEADD(dd, 0, DATEDIFF(dd, 0, InTime))
) bb
where bb.scheduleDate = DATEADD(dd, 0, DATEDIFF(dd, 0, a.StartDateTime)) ", lineID, lineID, lineID, lineID);
}
internal static IDataReader GetByLineID(TransactionContext tc, int lineID)
{

View File

@ -23,10 +23,10 @@ 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, 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,
"INSERT INTO ProductionBonusSetup(ProductionBonusSetupID, ProgramName, AchivedPercent, OTHour, SalaryMonth, DesignNo, FromDate, ToDate, MaxPerson, CreatedBy, CreationDate, Status,ProductionBonusType)" +
" VALUES(%n, %s, %n, %n, %d, %s, %d, %d, %n, %n, %d, %n,%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);
item.Status, (int)item.ProductionBonusType);
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, MaxPerson=%n, Status=%n " +
"UPDATE ProductionBonusSetup SET ProgramName=%s, AchivedPercent=%n, OTHour=%n, SalaryMonth=%d, DesignNo=%s, FromDate=%d, ToDate=%d, MaxPerson=%n, Status=%n,ProductionBonusType=%n " +
" WHERE ProductionBonusSetupID=%n", item.ProgramName, item.AchivedPercent, item.OTHour, item.SalaryMonth, item.DesignNo,
item.FromDate, item.ToDate, item.MaxPerson, item.Status, item.ID);
item.FromDate, item.ToDate, item.MaxPerson, item.Status,(int)item.ProductionBonusType, item.ID);
}
#endregion

View File

@ -129,6 +129,31 @@ namespace HRM.DA
return ProdBonusWorkSchedules;
}
public DataTable GetschedulewithTime(int lineid)
{
DataTable items = null;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
items = ProdBonusWorkScheduleDA.GetschedulewithTime(tc, lineid);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return items;
}
public List<ProdBonusWorkSchedule> GetWithSetupID(int nSetupID)
{
List<ProdBonusWorkSchedule> ProdBonusWorkSchedules = null;

View File

@ -11,7 +11,9 @@ export class ProdBonusSupervisor {
employeeNo:string; // view purpose
empName:string; // view purpose
// employee: Employee;
devName: string;
devParentName: string;
devGrantParentName: string;
constructor() {
// super();
this.id = 0;

View File

@ -7,6 +7,8 @@ var ProdBonusWorkSchedule = /** @class */ (function () {
this.prodBonusLineID = 0;
this.startDateTime = new Date();
this.endDateTime = new Date();
this.inTime = undefined;
this.outTime = undefined;
}
return ProdBonusWorkSchedule;
}());

View File

@ -1 +1 @@
{"version":3,"file":"prodBonusWorkSchedule.js","sourceRoot":"","sources":["prodBonusWorkSchedule.ts"],"names":[],"mappings":";;;AAEA;IAOI;QACI,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QACZ,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,aAAa,GAAG,IAAI,IAAI,EAAE,CAAC;QAChC,IAAI,CAAC,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC;IAClC,CAAC;IACL,4BAAC;AAAD,CAAC,AAbD,IAaC;AAbY,sDAAqB"}
{"version":3,"file":"prodBonusWorkSchedule.js","sourceRoot":"","sources":["prodBonusWorkSchedule.ts"],"names":[],"mappings":";;;AAEA;IASI;QACI,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QACZ,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,aAAa,GAAG,IAAI,IAAI,EAAE,CAAC;QAChC,IAAI,CAAC,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;IAC7B,CAAC;IACL,4BAAC;AAAD,CAAC,AAjBD,IAiBC;AAjBY,sDAAqB"}

View File

@ -6,11 +6,15 @@ export class ProdBonusWorkSchedule{
prodBonusLineID: number;
startDateTime: Date;
endDateTime: Date;
inTime?: Date;
outTime?: Date;
totalCount?: number;
constructor(){
this.id = 0;
this.prodBonusLineID = 0;
this.startDateTime = new Date();
this.endDateTime = new Date();
this.inTime = undefined;
this.outTime = undefined;
}
}

View File

@ -111,6 +111,10 @@ export class BonusService {
getLayoutDetails(setUpid: number) {
return this.apiService.httpGet<any>('/Bonus/getLayoutDetails/'+ setUpid);
}
GetschedulewithTime(lineid: number) {
return this.apiService.httpGet<any>('/Bonus/GetschedulewithTime/' + lineid);
}
getLines(setupid: number) {
return this.apiService.httpGet<ProdBonusLine[]>('/Bonus/getLines/'+ setupid);
}

View File

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

View File

@ -285,7 +285,7 @@ export class ProductionBonusAttendanceComponent implements OnInit {
);
}
else {
this.notificationService.showWarning('Date did not match with Work Schedule! Schedule not match');
this.notificationService.showWarning('Date did not match with Work Schedule','Schedule not matched!');
}
}
onClickAdd() {

View File

@ -181,27 +181,54 @@
</div>
</div>
<kendo-grid [kendoGridBinding]="prodBonusLine.prodBonusSupervisors" [sortable]="true" [style.height.%]="100"
[reorderable]="true"><!-- [resizable]="true" [pageSize]="state.take" [skip]="state.skip"
[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]="170">
<kendo-grid-column field="empName" title="Supervisor/Line Chief/Common Worker" [width]="150">
<!-- <ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
</ng-template> -->
</kendo-grid-column>
<kendo-grid-column field="employeeNo" title="Employee No" [width]="120">
<kendo-grid-column field="employeeNo" title="Employee No" [width]="100">
<!-- <ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
</ng-template> -->
</kendo-grid-column>
<kendo-grid-column field="devGrantParentName" title="top Parent (section)" [width]="120">
</kendo-grid-column>
<kendo-grid-column field="devParentName" title="parent (floor)" [width]="120">
</kendo-grid-column>
<kendo-grid-column field="devName" title="posted" [width]="120">
</kendo-grid-column>
<kendo-grid-column field="bonusPercent" title="Bonus Percent" [width]="100">
</kendo-grid-column>
<kendo-grid-column title="Actions" [width]="200">
<kendo-grid-column title="Actions" [width]="50">
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
<button type="button" kendoButton icon="delete" class="kt-delete"
style="width: fit-content;" (click)="onClickRemoveSupervisors(dataItem)">Remove</button>
style="width: fit-content;" (click)="onClickRemoveSupervisors(dataItem)">
Remove
</button>
</ng-template>
</kendo-grid-column>
</kendo-grid>
</p-tabPanel>
<p-tabPanel header="Work Schedule" leftIcon="pi pi-briefcase">
<app-loading-panel></app-loading-panel>
<div class="p-grid">
<div class="p-col-12 p-lg-3 label-ailgn">
<button type="button" kendoButton class="kt-delete"
style="width: fit-content;" (click)="GetScheduleTime(dataItem)">
Load Time Schedule
</button>
</div>
<div class="p-col-12 p-lg-5 label-ailgn">
this will take around 30 Second or more.
</div>
</div>
<kendo-grid [kendoGridBinding]="prodBonusLine.prodBonusWorkSchedules" [pageable]="true"
[sortable]="true" [reorderable]="true" [resizable]="true">
@ -211,20 +238,25 @@
</ng-template>
</kendo-grid-column>
<!-- <kendo-grid-column field="startDateTime" title="Start Time" width="100">
<kendo-grid-column field="inTime" title="Start Time" width="100">
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
{{dataItem.startDateTime | date: 'hh:mm a'}}
{{dataItem?.inTime | date: 'hh:mm'}}
</ng-template>
</kendo-grid-column>
<kendo-grid-column field="endDateTime" title="End Time" width="100">
<kendo-grid-column field="outTime" title="End Time" width="100">
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
{{dataItem.endDateTime | date: 'hh:mm a'}}
{{dataItem?.outTime | date: 'hh:mm'}}
</ng-template>
</kendo-grid-column> -->
</kendo-grid-column>
<kendo-grid-column field="totalCount" title="Count" 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>
</p-tabView>
</div>
</kendo-dialog-content>
<kendo-dialog-actions>

View File

@ -28,6 +28,7 @@ import { numberSymbols } from '@progress/kendo-angular-intl';
import { process, State } from '@progress/kendo-data-query';
import { DataStateChangeEvent } from '@progress/kendo-angular-grid';
import { noUndefined } from '@angular/compiler/src/util';
import { EnumStatus } from '../../_models/enums';
@ -71,6 +72,7 @@ export class ProductionBonusSetupComponent implements OnInit {
prodBonusParameter: ProdBonusParameter;
prodBonusAttn: ProdBonusAttn[];
depts: Department[] = [];
layoutNo: string;
// programName: string;
// maxPerson: number;
@ -104,7 +106,7 @@ export class ProductionBonusSetupComponent implements OnInit {
department: Department;
selectedRow: any;
scheduleTime: any;
editDetails: boolean = false;
@ -124,7 +126,9 @@ export class ProductionBonusSetupComponent implements OnInit {
this.prodBonusParameter = new ProdBonusParameter();
this.prodBonusWork = new ProdBonusWorkSchedule();
this.getBonusType();
// this.createForm();
}
OnclickCheckbox() {
@ -313,21 +317,44 @@ export class ProductionBonusSetupComponent implements OnInit {
this.loadingPanelService.ShowLoadingPanel = true;
debugger;
if (this.prodBonusLine.id !== 0) {
this.bonusService.getProdBonusAttenbyLineId(this.prodBonusLine.id).subscribe(
}
}
GetScheduleTime(dataItem: any) {
console.log('line');
console.log(this.prodBonusLine.prodBonusWorkSchedules);
this.loadingPanelService.ShowLoadingPanel = true;
this.bonusService.GetschedulewithTime(this.prodBonusLine.prodBonusWorkSchedules[0].prodBonusLineID).subscribe(
(resp) => {
this.prodBonusAttn = resp;
this.scheduleTime = resp;
},
(err: any) => {
this.notificationService.showError(err.error);
this.loadingPanelService.ShowLoadingPanel = false;
},
() => {
this.loadingPanelService.ShowLoadingPanel = false;
console.log(this.scheduleTime);
if (this.prodBonusLine.prodBonusWorkSchedules != undefined) {
var pdrs = this.prodBonusLine.prodBonusWorkSchedules;
pdrs.forEach(x => {
var item = this.scheduleTime.find(y => y.startDateTime == x.startDateTime);
if (item != undefined) {
x.inTime = new Date( item.inTime);
x.outTime = new Date( item.outTime);
x.totalCount = item.scheduleCount;
}
}
);
}
console.log(this.prodBonusLine.prodBonusWorkSchedules);
this.loadingPanelService.ShowLoadingPanel = false;
}
);
}
onCellClickEdit(dataItem: ProdBonusLine) {
@ -335,7 +362,7 @@ export class ProductionBonusSetupComponent implements OnInit {
// console.log(dataItem);
this.isNewLine = false;
this.prodBonusLine = new ProdBonusLine();
debugger;
// if (this.isNewLayout) { //ADD Line
// this.prodBonusLine.prodBonusSupervisors = [];
// this.prodBonusLine.prodBonusWorkSchedules = [];

View File

@ -22,6 +22,7 @@ using NPOI.SS.Formula.Eval;
using System.Globalization;
using Payroll.BO;
using Ease.Core.Model;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
namespace HRM.UI.Controllers.Payroll
{
@ -463,6 +464,7 @@ namespace HRM.UI.Controllers.Payroll
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
ProductionBonusSetup item = new ProductionBonusSetup();
//ProdBonusLine item = new ProdBonusLine();
List<Department> detps = new DepartmentService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
try
{
item = _productionBonusSetupService.Get(ID);
@ -474,7 +476,33 @@ namespace HRM.UI.Controllers.Payroll
foreach (ProdBonusSupervisor prodSupervisor in prodLine.ProdBonusSupervisors)
{
oEmp = new EmployeeService().Get(prodSupervisor.EmployeeID);
if (oEmp.DepartmentID != null)
{
var dev = detps.FirstOrDefault(x => x.ID == oEmp.DepartmentID);
prodSupervisor.devName = dev.Name;
if(dev.ParentsID !=null)
{
var pr = detps.FirstOrDefault(x => x.ID == dev.ParentID);
if (pr != null)
{
prodSupervisor.devParentName = pr.Name;
if (pr.ParentsID != null)
{
var gpr = detps.FirstOrDefault(x => x.ID == pr.ParentID);
if (gpr != null)
{
prodSupervisor.devGrantParentName = gpr.Name;
}
}
}
}
}
prodSupervisor.EmpName = oEmp.Name;
prodSupervisor.EmployeeNo = oEmp.EmployeeNo;
@ -496,6 +524,25 @@ namespace HRM.UI.Controllers.Payroll
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
}
return Ok(item);
}
[HttpGet("GetschedulewithTime/{lineid}")]
public ActionResult GetschedulewithTime(int lineid)
{
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
DataTable item =null;
try
{
item = new ProdBonusWorkScheduleService().GetschedulewithTime(lineid);
}
catch (Exception e)
{
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
}
return Ok(item);
}