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
12 changed files with 261 additions and 81 deletions

View File

@ -283,12 +283,13 @@ namespace HRM.BO
List<ProdBonusAttn> Get(int setupID, int ScheduleID); List<ProdBonusAttn> Get(int setupID, int ScheduleID);
List<ProdBonusAttn> Get(int setupID, DateTime dateTime); List<ProdBonusAttn> Get(int setupID, DateTime dateTime);
List<ProdBonusAttn> GetBySetupLineDate(int setupID, int lineID, DateTime dateTime);
List<ProdBonusAttn> GetBySetupID(int iD); List<ProdBonusAttn> GetBySetupID(int iD);
List<ProdBonusAttn> GetBySetupIDs(string iDs); List<ProdBonusAttn> GetBySetupIDs(string iDs);
List<ProdBonusAttn> GetByLineID(int lineID); List<ProdBonusAttn> GetByLineID(int lineID);
List<ProdBonusAttn> GetbySetupAndLineID(int setupID, int lineID); List<ProdBonusAttn> GetbySetupAndLineID(int setupID, int lineID);
DateTime? GetMaxDate(int setupID, int lineID, DateTime date);
} }
#endregion #endregion

View File

@ -90,7 +90,24 @@ namespace HRM.DA
return tc.ExecuteReader(sql); return tc.ExecuteReader(sql);
//return tc.ExecuteReader("SELECT * FROM ProdBonusAttn WHERE ProdBonusSetupID=%n AND CAST(InTime AS date)=%d", setupID, dateTime); //return tc.ExecuteReader("SELECT * FROM ProdBonusAttn WHERE ProdBonusSetupID=%n AND CAST(InTime AS date)=%d", setupID, dateTime);
} }
internal static IDataReader GetBySetupLineDate(TransactionContext tc, int setupID, int lineID, DateTime dateTime)
{
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 PBA.ProdBonusLineID=%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, lineID, dateTime.Year, dateTime.Month,dateTime.Day);
return tc.ExecuteReader(sql);
}
internal static DateTime? GetMaxDate(TransactionContext tc, int setupID, int lineID, DateTime date)
{
DateTime? value = null;
object obj = tc.ExecuteScalar("SELECT max(intime) FROM ProdBonusAttn WHERE ProdBonusSetupID=%n AND ProdBonusLineID = %n AND OutTime < %d", setupID, lineID, date);
if (obj is not DBNull)
{
value = Convert.ToDateTime(obj);
}
return value;
}
#endregion #endregion
#region Delete function #region Delete function

View File

@ -159,6 +159,32 @@ namespace HRM.DA
return ProdBonusAttns; return ProdBonusAttns;
} }
public List<ProdBonusAttn> GetBySetupLineDate(int setupID, int lineID, DateTime dateTime)
{
List<ProdBonusAttn> ProdBonusAttns = new List<ProdBonusAttn>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr = new DataReader(ProdBonusAttnDA.GetBySetupLineDate(tc, setupID, lineID, dateTime));
ProdBonusAttns = this.CreateObjects<ProdBonusAttn>(dr);
dr.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return ProdBonusAttns;
}
public List<ProdBonusAttn> GetBySetupID(int setupID) public List<ProdBonusAttn> GetBySetupID(int setupID)
{ {
@ -295,6 +321,31 @@ namespace HRM.DA
return ProdBonusAttns; return ProdBonusAttns;
} }
public DateTime? GetMaxDate(int setupID, int lineID, DateTime date)
{
TransactionContext tc = null;
try
{
DateTime? dateValue = null;
tc = TransactionContext.Begin();
dateValue = ProdBonusAttnDA.GetMaxDate(tc, setupID, lineID, date);
tc.End();
return dateValue;
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
}
public int Save(ProdBonusAttn oProdBonusAttn) public int Save(ProdBonusAttn oProdBonusAttn)
{ {
TransactionContext tc = null; TransactionContext tc = null;

View File

@ -40,8 +40,8 @@ namespace HRM.Report
oDR["PARMANENTADDRESS"] = oDRow["PARMANENTADDRESS"]; oDR["PARMANENTADDRESS"] = oDRow["PARMANENTADDRESS"];
oDR["PRESENTADDRESS"] = oDRow["PRESENTADDRESS"]; oDR["PRESENTADDRESS"] = oDRow["PRESENTADDRESS"];
oDR["BIRTHDATE"] = Convert.ToDateTime(oDRow["BIRTHDATE"]).ToString("dd/MM/yyyy"); oDR["BIRTHDATE"] = Convert.ToDateTime(oDRow["BIRTHDATE"]).ToString("dd/MM/yyyy");
if (oDRow["PHOTO"] is not DBNull) //if (oDRow["PHOTO"] is not DBNull)
oDR["PHOTO"] = Convert.ToBase64String((byte[])oDRow["PHOTO"]); // oDR["PHOTO"] = Convert.ToBase64String((byte[])oDRow["PHOTO"]);
oDR["NIDNO"] = oDRow["NIDNO"]; oDR["NIDNO"] = oDRow["NIDNO"];
oDR["HEIGHT"] = oDRow["HEIGHT"]; oDR["HEIGHT"] = oDRow["HEIGHT"];
oDR["BLOODGROUP"] = GlobalExtensions.BloodGroupToFriendlyName((EnumBloodGroup)Enum.Parse(typeof(EnumBloodGroup), oDR["BLOODGROUP"] = GlobalExtensions.BloodGroupToFriendlyName((EnumBloodGroup)Enum.Parse(typeof(EnumBloodGroup),

View File

@ -42,6 +42,7 @@
<None Remove="Attendence\RDLC\rptMonthlyKPI.rdlc" /> <None Remove="Attendence\RDLC\rptMonthlyKPI.rdlc" />
<None Remove="RDLC\ActiveEmployeeDetail.rdlc" /> <None Remove="RDLC\ActiveEmployeeDetail.rdlc" />
<None Remove="RDLC\Advice.rdlc" /> <None Remove="RDLC\Advice.rdlc" />
<None Remove="RDLC\AllDigitalServiceBook.rdlc" />
<None Remove="RDLC\AllEmpTaxInfo.rdlc" /> <None Remove="RDLC\AllEmpTaxInfo.rdlc" />
<None Remove="RDLC\AllMedicalClaim.rdlc" /> <None Remove="RDLC\AllMedicalClaim.rdlc" />
<None Remove="RDLC\ApointmentLetterForStuff.rdlc" /> <None Remove="RDLC\ApointmentLetterForStuff.rdlc" />
@ -310,6 +311,7 @@
<EmbeddedResource Include="Attendence\RDLC\MultipleJobCardSub.rdlc" /> <EmbeddedResource Include="Attendence\RDLC\MultipleJobCardSub.rdlc" />
<EmbeddedResource Include="Attendence\RDLC\rptMonthlyKPI.rdlc" /> <EmbeddedResource Include="Attendence\RDLC\rptMonthlyKPI.rdlc" />
<EmbeddedResource Include="RDLC\ActiveEmployeeDetail.rdlc" /> <EmbeddedResource Include="RDLC\ActiveEmployeeDetail.rdlc" />
<EmbeddedResource Include="RDLC\AllDigitalServiceBook.rdlc" />
<EmbeddedResource Include="RDLC\AllEmpTaxInfo.rdlc" /> <EmbeddedResource Include="RDLC\AllEmpTaxInfo.rdlc" />
<EmbeddedResource Include="RDLC\AllMedicalClaim.rdlc" /> <EmbeddedResource Include="RDLC\AllMedicalClaim.rdlc" />
<EmbeddedResource Include="RDLC\ApointmentLetterForStuff.rdlc" /> <EmbeddedResource Include="RDLC\ApointmentLetterForStuff.rdlc" />

View File

@ -124,6 +124,9 @@ export class BonusService {
getProdBonusAttnEmployeeList(item: any) { getProdBonusAttnEmployeeList(item: any) {
return this.apiService.httpPost<Employee[]>('/Bonus/getProdBonusAttnEmployeeList', item); return this.apiService.httpPost<Employee[]>('/Bonus/getProdBonusAttnEmployeeList', item);
} }
getProdBonusAttnEmployeeListSwingAndPrinting(item: any) {
return this.apiService.httpPost<Employee[]>('/Bonus/getProdBonusAttnEmployeeListSwingAndPrinting', item);
}
saveAllProdBonusAttn(item: any) { saveAllProdBonusAttn(item: any) {
return this.apiService.httpPost<any[]>('/Bonus/saveAllProdBonusAttn', item); return this.apiService.httpPost<any[]>('/Bonus/saveAllProdBonusAttn', item);
} }

View File

@ -247,10 +247,12 @@
</div> </div>
<div class="p-col-12 p-md-12 p-lg-8"> <div class="p-col-12 p-md-12 p-lg-8">
<input [(ngModel)]="hrEmployee.nationalID" formControlName="nationalId" <input [(ngModel)]="hrEmployee.nationalID" formControlName="nationalId"
id="txtNationalId" pInputText style="width:84%" type="text" [readonly]="!active"> id="txtNationalId" pInputText style="width:84%" type="text">
<!-- [readonly]="!active" -->
<button class="k-button k-primary" kendoButton icon="k-i-attachment-45 k-i-clip-45" <button class="k-button k-primary" kendoButton icon="k-i-attachment-45 k-i-clip-45"
style="width: 15.5%; vertical-align: bottom; padding: 16px;" [disabled]="!active" style="width: 15.5%; vertical-align: bottom; padding: 16px;"
(click)="popUpAttachment('NID')"></button> (click)="popUpAttachment('NID')"></button>
<!-- [disabled]="!active" -->
</div> </div>
<div class="p-col-12 p-md-12 p-lg-4"> <div class="p-col-12 p-md-12 p-lg-4">
<label for="txtPassportNo">Passport No</label> <label for="txtPassportNo">Passport No</label>

View File

@ -84,7 +84,7 @@
</div> </div>
<div class="p-col-12" align="right"> <div class="p-col-12" align="right">
<button icon="refresh" kendoButton [primary]="true" style="width: fit-content" (click)="onClickRefresh()" <button icon="refresh" kendoButton [primary]="true" style="width: fit-content" (click)="onClickLoad()"
[disabled]="selectedProdBSdata===undefined||selectedLine===undefined||selectedDate===undefined">Load</button> [disabled]="selectedProdBSdata===undefined||selectedLine===undefined||selectedDate===undefined">Load</button>
</div> </div>
<div class="p-col-12"> <div class="p-col-12">
@ -94,6 +94,7 @@
Remove All Remove All
</button> </button>
<kendo-grid-spacer></kendo-grid-spacer> <kendo-grid-spacer></kendo-grid-spacer>
<label>Attendance Count: {{employeeList.length}} </label>
<!--<button kendoGridExcelCommand type="button" icon="file-excel">Export to <!--<button kendoGridExcelCommand type="button" icon="file-excel">Export to
Excel</button>class="customButton"--> Excel</button>class="customButton"-->
</ng-template> </ng-template>

View File

@ -187,7 +187,7 @@ export class ProductionBonusAttendanceComponent implements OnInit {
) )
} }
onClickRefresh() { onClickLoad() {
// debugger; // debugger;
const fromDate = new Date(this.productionBonusSetup.fromDate.setHours(0, 0, 0, 0)); 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 toDate = new Date(this.productionBonusSetup.toDate.setHours(0, 0, 0, 0));
@ -195,6 +195,7 @@ export class ProductionBonusAttendanceComponent implements OnInit {
if (selectedDate >= fromDate && selectedDate <= toDate) { if (selectedDate >= fromDate && selectedDate <= toDate) {
var dataForAttn = { var dataForAttn = {
setupId: this.productionBonusSetup.id, setupId: this.productionBonusSetup.id,
lineId: this.selectedLine.id,
date: this.selectedDate date: this.selectedDate
} }
// console.log(dataForAttn); // console.log(dataForAttn);
@ -225,7 +226,6 @@ export class ProductionBonusAttendanceComponent implements OnInit {
debugger debugger
this.employeeList = resp; this.employeeList = resp;
this.employeeList.forEach(x => this.AddEmployeeGridData(x.id, false)); this.employeeList.forEach(x => this.AddEmployeeGridData(x.id, false));
// console.log('employee List', this.employeeList);
}, },
(err) => { (err) => {
this.notificationService.showError(err.error); this.notificationService.showError(err.error);
@ -246,6 +246,31 @@ export class ProductionBonusAttendanceComponent implements OnInit {
// } // }
// } // }
} }
//New For Swing And Printig
if (this.prodBonusAttn.length <= 0 && (this.productionBonusSetup.productionBonusType == EnumProductionBonusType.Sewing ||
this.productionBonusSetup.productionBonusType == EnumProductionBonusType.Printing)) {
let data = {
prodLine: this.selectedLine,
date: this.selectedDate
}
this.loadingPanelService.ShowLoadingPanel = true;
this.bonusService.getProdBonusAttnEmployeeListSwingAndPrinting(data).subscribe(
(resp) => {
debugger
this.employeeList = resp;
this.employeeList.forEach(x => this.AddEmployeeGridData(x.id, false));
},
(err) => {
this.notificationService.showError(err.error);
this.loadingPanelService.ShowLoadingPanel = false;
},
() => {
this.loadingPanelService.ShowLoadingPanel = false;
}
);
}
if (this.prodBonusAttn.length > 0) { if (this.prodBonusAttn.length > 0) {
debugger; debugger;
for (let i = 0; i < this.prodBonusAttn.length; i++) { for (let i = 0; i < this.prodBonusAttn.length; i++) {
@ -260,7 +285,7 @@ export class ProductionBonusAttendanceComponent implements OnInit {
); );
} }
else { 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() { onClickAdd() {

View File

@ -141,7 +141,7 @@
<label>Line Name</label> <label>Line Name</label>
</div> </div>
<div class="p-col-12 p-lg-5" *ngIf="isNewLine"> <div class="p-col-12 p-lg-5" *ngIf="isNewLine">
<app-dynamic-picker [dynamicPickerView]="_departmentPicker"></app-dynamic-picker> <app-dynamic-picker [dynamicPickerView]="_departmentPicker" (onSelectCompleted)="createWorkSchedule($event)"></app-dynamic-picker>
</div> </div>
<div class="p-col-12 p-lg-5" *ngIf="!isNewLine"> <div class="p-col-12 p-lg-5" *ngIf="!isNewLine">
<input [(ngModel)]="selectedRow.lineName" [readonly]="!isNewLine" type="text" <input [(ngModel)]="selectedRow.lineName" [readonly]="!isNewLine" type="text"

View File

@ -419,90 +419,93 @@ export class ProductionBonusSetupComponent implements OnInit {
// } // }
debugger; debugger;
this._employee; this._employee;
this.prodBonusLine.prodBonusSupervisors; this.prodBonusLine.prodBonusSupervisors;
if (this.scheduledHours < 0 || this.bonusPercent < 0) { if (this.scheduledHours < 0 || this.bonusPercent < 0) {
this.notificationService.showWarning('Scheduled Hours and Bonus Percentage can\'t be negative'); this.notificationService.showWarning('Scheduled Hours and Bonus Percentage can\'t be negative');
return; return;
} }
// this.isNewLine = true; // this.isNewLine = true;
var newlineSupervisor: ProdBonusSupervisor = new ProdBonusSupervisor(); var newlineSupervisor: ProdBonusSupervisor = new ProdBonusSupervisor();
var newlineParameter: ProdBonusParameter = new ProdBonusParameter(); var newlineParameter: ProdBonusParameter = new ProdBonusParameter();
// var newLayoutWork: ProdBonusWorkSchedule = new ProdBonusWorkSchedule(); // var newLayoutWork: ProdBonusWorkSchedule = new ProdBonusWorkSchedule();
const index = this.prodBonusLine.prodBonusSupervisors.findIndex(sv => sv.employeeID == this._employee.id); const index = this.prodBonusLine.prodBonusSupervisors.findIndex(sv => sv.employeeID == this._employee.id);
if (index !== -1) { if (index !== -1) {
this.prodBonusLine.prodBonusSupervisors.splice(index, 1); this.prodBonusLine.prodBonusSupervisors.splice(index, 1);
} }
//Supervisor //Supervisor
newlineSupervisor.employeeID = this._employee.id; newlineSupervisor.employeeID = this._employee.id;
newlineSupervisor.employeeNo = this._employee.employeeNo; newlineSupervisor.employeeNo = this._employee.employeeNo;
newlineSupervisor.empName = this._employee.name; newlineSupervisor.empName = this._employee.name;
newlineSupervisor.bonusPercent = this.bonusPercent; newlineSupervisor.bonusPercent = this.bonusPercent;
newlineSupervisor.prodBonusSetupID = this.productionBonusSetup.id; newlineSupervisor.prodBonusSetupID = this.productionBonusSetup.id;
if (this.isNewLine) { if (this.isNewLine) {
newlineParameter.itemID = this._departmentPicker.selectedID; newlineParameter.itemID = this._departmentPicker.selectedID;
newlineParameter.itemType = 0; newlineParameter.itemType = 0;
newlineParameter.prodBonusSetupID = this.productionBonusSetup.id; newlineParameter.prodBonusSetupID = this.productionBonusSetup.id;
// var department; // var department;
this.basicService.getDepartmentByID(this._departmentPicker.selectedID).subscribe( this.basicService.getDepartmentByID(this._departmentPicker.selectedID).subscribe(
(resp) => { (resp) => {
this.department = resp; this.department = resp;
}, },
(err) => { (err) => {
this.notificationService.showError(err.error); this.notificationService.showError(err.error);
}, },
() => { () => {
//newlineItem.amount //newlineItem.amount
this.prodBonusLine.prodBonusSupervisors.push(newlineSupervisor); this.prodBonusLine.prodBonusSupervisors.push(newlineSupervisor);
this.prodBonusLine.prodBonusParameters.push(newlineParameter);
this.prodBonusLine.scheduledHour = this.scheduledHours; //Commented For Test
this.prodBonusLine.lineName = this.department.name; // this.prodBonusLine.prodBonusParameters.push(newlineParameter);
// console.log(this.prodBonusLine);
this.clearProdbonusLine();
// this.notificationService.showSuccess('Supervisor added to the line');
}
);
debugger; this.prodBonusLine.scheduledHour = this.scheduledHours;
//WorkSchedules this.prodBonusLine.lineName = this.department.name;
// newLayoutWork.prodBonusSetupID = this.productionBonusSetup.id; this.clearProdbonusLine();
// newLayoutWork.prodBonusLineID = this.selectedRow.id; // this.notificationService.showSuccess('Supervisor added to the line');
const currentDate = new Date(this.productionBonusSetup.fromDate);
// while (currentDate <= this.productionBonusSetup.toDate) {
// newLayoutWork.startDateTime = new Date(currentDate.setHours(0, 0, 0, 0));
// newLayoutWork.endDateTime = new Date(currentDate.setHours(23, 59, 59, 999));
// debugger;
// this.prodBonusLine.prodBonusWorkSchedules.push(newLayoutWork);
// currentDate.setDate(currentDate.getDate() + 1);
// }
for (let i = 0; currentDate <= this.productionBonusSetup.toDate; i++) {
let newLayoutWork: ProdBonusWorkSchedule = {
prodBonusSetupID: 0,
prodBonusLineID: 0,
id: 0,
startDateTime: new Date(currentDate.setHours(0, 0, 0, 0)),
endDateTime: new Date(currentDate.setHours(23, 59, 59, 999))
};
this.prodBonusLine.prodBonusWorkSchedules.push(newLayoutWork);
currentDate.setDate(currentDate.getDate() + 1);
}
} }
else { );
debugger;
newlineSupervisor.prodBonusLineID = this.selectedRow.id; debugger;
this.prodBonusLine.id = this.selectedRow.id; //WorkSchedules
this.prodBonusLine.lineName = this.selectedRow.lineName; // newLayoutWork.prodBonusSetupID = this.productionBonusSetup.id;
this.prodBonusLine.scheduledHour = this.selectedRow.scheduledHours; // newLayoutWork.prodBonusLineID = this.selectedRow.id;
this.prodBonusLine.prodBonusSupervisors.push(newlineSupervisor); const currentDate = new Date(this.productionBonusSetup.fromDate);
// this.prodBonusLine.prodBonusParameters.push(newlineParameter); // while (currentDate <= this.productionBonusSetup.toDate) {
// newLayoutWork.startDateTime = new Date(currentDate.setHours(0, 0, 0, 0));
// newLayoutWork.endDateTime = new Date(currentDate.setHours(23, 59, 59, 999));
// debugger;
// this.prodBonusLine.prodBonusWorkSchedules.push(newLayoutWork);
// currentDate.setDate(currentDate.getDate() + 1);
// }
// //Commented For Test
// for (let i = 0; currentDate <= this.productionBonusSetup.toDate; i++) {
// let newLayoutWork: ProdBonusWorkSchedule = {
// prodBonusSetupID: 0,
// prodBonusLineID: 0,
// id: 0,
// startDateTime: new Date(currentDate.setHours(0, 0, 0, 0)),
// endDateTime: new Date(currentDate.setHours(23, 59, 59, 999))
// };
// this.prodBonusLine.prodBonusWorkSchedules.push(newLayoutWork);
// currentDate.setDate(currentDate.getDate() + 1);
// }
}
else {
debugger;
newlineSupervisor.prodBonusLineID = this.selectedRow.id;
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);
// console.log(this.prodBonusLine); // console.log(this.prodBonusLine);
@ -525,7 +528,7 @@ export class ProductionBonusSetupComponent implements OnInit {
onClickOk() { onClickOk() {
debugger; debugger;
if (this.isNewLine) { if (this.isNewLine) {
if(this._departmentPicker.selectedID == undefined){ if (this._departmentPicker.selectedID == undefined) {
this.notificationService.showWarning('Please Select a Line'); return; this.notificationService.showWarning('Please Select a Line'); return;
} }
this.prodBonusLine.lineName = this._departmentPicker.selectedObjects[0]['name']; this.prodBonusLine.lineName = this._departmentPicker.selectedObjects[0]['name'];
@ -606,10 +609,38 @@ export class ProductionBonusSetupComponent implements OnInit {
this.editDetails = false; this.editDetails = false;
this.prodBSdata = undefined; this.prodBSdata = undefined;
} }
onScheduledHoursChange(value: number){ onScheduledHoursChange(value: number) {
debugger; debugger;
this.prodBonusLine.scheduledHour = value; this.prodBonusLine.scheduledHour = value;
this.scheduledHours; this.scheduledHours;
this.productionBonusSetup.productionBonusLines this.productionBonusSetup.productionBonusLines
} }
createWorkSchedule(data: any) {
debugger;
var newlineParameter: ProdBonusParameter = new ProdBonusParameter();
if (this.isNewLine){
newlineParameter.itemID = this._departmentPicker.selectedID;
newlineParameter.itemType = 0;
newlineParameter.prodBonusSetupID = this.productionBonusSetup.id;
this.prodBonusLine.prodBonusParameters.push(newlineParameter);
const currentDate = new Date(this.productionBonusSetup.fromDate);
const maxDate = new Date(this.productionBonusSetup.toDate);
maxDate.setDate(this.productionBonusSetup.toDate.getDate() + 1);
for (let i = 0; currentDate <= maxDate; i++) {
let newLayoutWork: ProdBonusWorkSchedule = {
prodBonusSetupID: 0,
prodBonusLineID: 0,
id: 0,
startDateTime: new Date(currentDate.setHours(0, 0, 0, 0)),
endDateTime: new Date(currentDate.setHours(23, 59, 59, 999))
};
this.prodBonusLine.prodBonusWorkSchedules.push(newLayoutWork);
currentDate.setDate(currentDate.getDate() + 1);
}
}
}
} }

View File

@ -569,6 +569,7 @@ namespace HRM.UI.Controllers.Payroll
{ {
var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(processItems)); var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(processItems));
int setupID = (int)item["setupId"].ToObject<int>(); int setupID = (int)item["setupId"].ToObject<int>();
int lineID = (int)item["lineId"].ToObject<int>();
DateTime date = (DateTime)item["date"].ToObject<DateTime>(); DateTime date = (DateTime)item["date"].ToObject<DateTime>();
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User); CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
@ -576,7 +577,7 @@ namespace HRM.UI.Controllers.Payroll
List<ProdBonusAttn> AttnItems = new List<ProdBonusAttn>(); List<ProdBonusAttn> AttnItems = new List<ProdBonusAttn>();
try try
{ {
AttnItems = _prodBonusAttnService.Get(setupID, date); AttnItems = _prodBonusAttnService.GetBySetupLineDate(setupID, lineID, date);
} }
catch (Exception e) catch (Exception e)
@ -656,6 +657,52 @@ namespace HRM.UI.Controllers.Payroll
return Ok(_oFinalEmployees); return Ok(_oFinalEmployees);
} }
[HttpPost]
[Route("getProdBonusAttnEmployeeListSwingAndPrinting")]
public ActionResult getProdBonusAttnEmployeeListSwingAndPrinting(dynamic pItem)
{
var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(pItem));
DateTime date = (DateTime)item["date"].ToObject<DateTime>();
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> _oFinalEmployees = new List<Employee>();
List<ProdBonusParameter> _oProdBonusParameters = new List<ProdBonusParameter>();
List<ProdBonusSupervisor> _oProdBonusSupervisors = new List<ProdBonusSupervisor>();
List<DailyAttnProcess> _oDailyAttnProsess = new List<DailyAttnProcess>();
List<ProdBonusAttn> _oProdBonusAttns = null;
try
{
DateTime? maxDate = _prodBonusAttnService.GetMaxDate(_oProdBonusLine.ProdBonusSetupID, _oProdBonusLine.ID, date);
if(maxDate != null)
_oProdBonusAttns = _prodBonusAttnService.GetBySetupLineDate(_oProdBonusLine.ProdBonusSetupID, _oProdBonusLine.ID, (DateTime)maxDate);
List<ProdBonusParameter> desigparam = _oProdBonusParameters.Where(o => o.ItemType == EnumBonusItemType.Designation).ToList();
if(_oProdBonusAttns != null && _oProdBonusAttns.Count > 0)
{
foreach (var pda in _oProdBonusAttns)
{
Employee emp = _oEmployees.Find(o => o.ID == pda.EmployeeID);
if (emp != null) _oFinalEmployees.Add(emp);
}
}
string emIds = _oFinalEmployees.Aggregate(new StringBuilder(), (sb, x) => sb.Append(x.ID + ","), sb => sb.ToString().Trim(','));
if (emIds != "")
{
_oDailyAttnProsess = new DailyAttnProcessService().Get(emIds, date.Date, date.Date.AddHours(23.9));
}
}
catch (Exception e)
{
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
}
return Ok(_oFinalEmployees);
}
[HttpGet("getByLineID/{lineID}")] [HttpGet("getByLineID/{lineID}")]
public ActionResult getByLineID(int lineID) public ActionResult getByLineID(int lineID)
{ {