Production Bonus attn Swing and Printing #12
|
@ -120,6 +120,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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,7 +225,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 +245,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++) {
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -391,12 +391,12 @@ export class ProductionBonusSetupComponent implements OnInit {
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
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;
|
||||||
|
@ -407,7 +407,7 @@ export class ProductionBonusSetupComponent implements OnInit {
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
@ -434,11 +434,12 @@ export class ProductionBonusSetupComponent implements OnInit {
|
||||||
() => {
|
() => {
|
||||||
//newlineItem.amount
|
//newlineItem.amount
|
||||||
this.prodBonusLine.prodBonusSupervisors.push(newlineSupervisor);
|
this.prodBonusLine.prodBonusSupervisors.push(newlineSupervisor);
|
||||||
this.prodBonusLine.prodBonusParameters.push(newlineParameter);
|
|
||||||
|
//Commented For Test
|
||||||
|
// this.prodBonusLine.prodBonusParameters.push(newlineParameter);
|
||||||
|
|
||||||
this.prodBonusLine.scheduledHour = this.scheduledHours;
|
this.prodBonusLine.scheduledHour = this.scheduledHours;
|
||||||
this.prodBonusLine.lineName = this.department.name;
|
this.prodBonusLine.lineName = this.department.name;
|
||||||
// console.log(this.prodBonusLine);
|
|
||||||
this.clearProdbonusLine();
|
this.clearProdbonusLine();
|
||||||
// this.notificationService.showSuccess('Supervisor added to the line');
|
// this.notificationService.showSuccess('Supervisor added to the line');
|
||||||
}
|
}
|
||||||
|
@ -456,17 +457,19 @@ export class ProductionBonusSetupComponent implements OnInit {
|
||||||
// this.prodBonusLine.prodBonusWorkSchedules.push(newLayoutWork);
|
// this.prodBonusLine.prodBonusWorkSchedules.push(newLayoutWork);
|
||||||
// currentDate.setDate(currentDate.getDate() + 1);
|
// currentDate.setDate(currentDate.getDate() + 1);
|
||||||
// }
|
// }
|
||||||
for (let i = 0; currentDate <= this.productionBonusSetup.toDate; i++) {
|
|
||||||
let newLayoutWork: ProdBonusWorkSchedule = {
|
// //Commented For Test
|
||||||
prodBonusSetupID: 0,
|
// for (let i = 0; currentDate <= this.productionBonusSetup.toDate; i++) {
|
||||||
prodBonusLineID: 0,
|
// let newLayoutWork: ProdBonusWorkSchedule = {
|
||||||
id: 0,
|
// prodBonusSetupID: 0,
|
||||||
startDateTime: new Date(currentDate.setHours(0, 0, 0, 0)),
|
// prodBonusLineID: 0,
|
||||||
endDateTime: new Date(currentDate.setHours(23, 59, 59, 999))
|
// id: 0,
|
||||||
};
|
// startDateTime: new Date(currentDate.setHours(0, 0, 0, 0)),
|
||||||
this.prodBonusLine.prodBonusWorkSchedules.push(newLayoutWork);
|
// endDateTime: new Date(currentDate.setHours(23, 59, 59, 999))
|
||||||
currentDate.setDate(currentDate.getDate() + 1);
|
// };
|
||||||
}
|
// this.prodBonusLine.prodBonusWorkSchedules.push(newLayoutWork);
|
||||||
|
// currentDate.setDate(currentDate.getDate() + 1);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
debugger;
|
debugger;
|
||||||
|
@ -498,7 +501,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'];
|
||||||
|
@ -579,10 +582,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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -609,6 +609,57 @@ 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>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//List<ProdBonusWorkSchedule> _oProdBonusWorkSchedules = _prodBonusWorkScheduleService.Get();
|
||||||
|
List<ProdBonusAttn> _oProdBonusAttns = _prodBonusAttnService.Get(_oProdBonusLine.ProdBonusSetupID, date.AddDays(-1));
|
||||||
|
|
||||||
|
//_oProdBonusParameters = _oProdBonusLine.ProdBonusParameters;
|
||||||
|
|
||||||
|
//if (_oProdBonusParameters != null && _oProdBonusParameters.Count > 0)
|
||||||
|
//{
|
||||||
|
List<ProdBonusParameter> desigparam = _oProdBonusParameters.Where(o => o.ItemType == EnumBonusItemType.Designation).ToList();
|
||||||
|
//foreach (ProdBonusParameter pbp in _oProdBonusParameters)
|
||||||
|
//{
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user