Production Bonus attn Swing and Printing #12
|
@ -120,6 +120,9 @@ export class BonusService {
|
|||
getProdBonusAttnEmployeeList(item: any) {
|
||||
return this.apiService.httpPost<Employee[]>('/Bonus/getProdBonusAttnEmployeeList', item);
|
||||
}
|
||||
getProdBonusAttnEmployeeListSwingAndPrinting(item: any) {
|
||||
return this.apiService.httpPost<Employee[]>('/Bonus/getProdBonusAttnEmployeeListSwingAndPrinting', item);
|
||||
}
|
||||
saveAllProdBonusAttn(item: any) {
|
||||
return this.apiService.httpPost<any[]>('/Bonus/saveAllProdBonusAttn', item);
|
||||
}
|
||||
|
|
|
@ -225,7 +225,6 @@ export class ProductionBonusAttendanceComponent implements OnInit {
|
|||
debugger
|
||||
this.employeeList = resp;
|
||||
this.employeeList.forEach(x => this.AddEmployeeGridData(x.id, false));
|
||||
// console.log('employee List', this.employeeList);
|
||||
},
|
||||
(err) => {
|
||||
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) {
|
||||
debugger;
|
||||
for (let i = 0; i < this.prodBonusAttn.length; i++) {
|
||||
|
|
|
@ -141,7 +141,7 @@
|
|||
<label>Line Name</label>
|
||||
</div>
|
||||
<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 class="p-col-12 p-lg-5" *ngIf="!isNewLine">
|
||||
<input [(ngModel)]="selectedRow.lineName" [readonly]="!isNewLine" type="text"
|
||||
|
|
|
@ -407,7 +407,7 @@ 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);
|
||||
const index = this.prodBonusLine.prodBonusSupervisors.findIndex(sv => sv.employeeID == this._employee.id);
|
||||
if (index !== -1) {
|
||||
this.prodBonusLine.prodBonusSupervisors.splice(index, 1);
|
||||
}
|
||||
|
@ -434,11 +434,12 @@ export class ProductionBonusSetupComponent implements OnInit {
|
|||
() => {
|
||||
//newlineItem.amount
|
||||
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.lineName = this.department.name;
|
||||
// console.log(this.prodBonusLine);
|
||||
this.clearProdbonusLine();
|
||||
// this.notificationService.showSuccess('Supervisor added to the line');
|
||||
}
|
||||
|
@ -456,17 +457,19 @@ export class ProductionBonusSetupComponent implements OnInit {
|
|||
// 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);
|
||||
}
|
||||
|
||||
// //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;
|
||||
|
@ -498,7 +501,7 @@ export class ProductionBonusSetupComponent implements OnInit {
|
|||
onClickOk() {
|
||||
debugger;
|
||||
if (this.isNewLine) {
|
||||
if(this._departmentPicker.selectedID == undefined){
|
||||
if (this._departmentPicker.selectedID == undefined) {
|
||||
this.notificationService.showWarning('Please Select a Line'); return;
|
||||
}
|
||||
this.prodBonusLine.lineName = this._departmentPicker.selectedObjects[0]['name'];
|
||||
|
@ -579,10 +582,38 @@ export class ProductionBonusSetupComponent implements OnInit {
|
|||
this.editDetails = false;
|
||||
this.prodBSdata = undefined;
|
||||
}
|
||||
onScheduledHoursChange(value: number){
|
||||
onScheduledHoursChange(value: number) {
|
||||
debugger;
|
||||
this.prodBonusLine.scheduledHour = value;
|
||||
this.scheduledHours;
|
||||
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);
|
||||
}
|
||||
[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}")]
|
||||
public ActionResult getByLineID(int lineID)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user