Compare commits

...

6 Commits

4 changed files with 118 additions and 98 deletions

View File

@ -24,7 +24,7 @@ namespace HRM.DA
oSystemInformation.factoryAddress = oReader.GetString("FACTORYADDRESS");
oSystemInformation.TelephoneNo = oReader.GetString("TELEPHONE");
oSystemInformation.email = oReader.GetString("EMAIL");
oSystemInformation.webAddress = oReader.GetString("WEBADDRESS");
//oSystemInformation.webAddress = oReader.GetString("WEBADDRESS");
oSystemInformation.systemStartDate = oReader.GetDateTime("SYSTEMSTARTDATE").Value;
oSystemInformation.TaxYearEndDate = oReader.GetDateTime("TAXYEARENDDATE").Value;
oSystemInformation.NextPayProcessDate = oReader.GetDateTime("NEXTPAYPROCESSDATE").Value;

View File

@ -642,10 +642,12 @@ namespace HRM.DA
_oProdBonusProcess.ProdBonusProcessEmps = new List<ProdBonusProcessEmp>();
List<ProdBonusAttn> prodAttn = null;
List<ProdBonusProcessEmp> oProcessEmps = new List<ProdBonusProcessEmp>();
List<Shift> oShifts = new ShiftService().GetAllShift();
//List<Shift> oShifts = new ShiftService().GetAllShift();
Shift oShift = null;
ProdBonusProcessEmp oProcessEmp = null;
int setupID = 21;
DateTime? bonusIntime = DateTime.MinValue;
DateTime? bonusOuttime = DateTime.MinValue;
ADParameter _ADParam = new ADParameterService().Get(setupID, payrollTypeId);
List<ProdBonusAttn> prodAttns = new ProdBonusAttnService().GetBySetupIDs(_oProductionBonusSetups.CommaSeparatedIDs());
@ -660,11 +662,13 @@ namespace HRM.DA
foreach (ProductionBonusSetup oProductionBonusSetup in _oProductionBonusSetups)
{
if(oProductionBonusSetup.ID == 10302)
if (oProductionBonusSetup.DesignNo == "C 24 16-30 Sep P A-Com" || oProductionBonusSetup.DesignNo == "C 24 16-30 Sep P B-Com")
{
}
prodAttn = prodAttns.Where(x => x.ProdBonusSetupID == oProductionBonusSetup.ID).ToList();//ToObjectsTemplate();
else
{ continue; }
prodAttn = prodAttns.Where(x => x.ProdBonusSetupID == oProductionBonusSetup.ID).ToList();//ToObjectsTemplate();
ProdBonusProcessItem oProcessItem = null;
foreach (ProdBonusLine oLine in oProductionBonusSetup.ProductionBonusLinesNew)
{
@ -687,29 +691,19 @@ namespace HRM.DA
foreach (DataRow dr in foundRows)
{
basicSal = Convert.ToDouble(dr["BASICSALARY"]);
//
int empidtest = Convert.ToInt32(dr["EMPLOYEEID"]);
if(oProductionBonusSetup.SalaryMonth == new DateTime(2023, 10, 31))
{
if (empidtest == 27620)
{
basicSal = 5145;
}
}
}
}
bool isSuperVisor = allProdBonusSupervisors.FindIndex(x => x.EmployeeID == item.Key
&& x.ProdBonusLineID == oLine.ID) == -1 ? false : true;
List<DailyAttnProcess> dailyAttm = alldailyAttm.FindAll(x => x.EmployeeID == item.Key);
//if (oProcessItem.EmployeeID == 36901)
//{
if (item.Key == 65088)
{
//}
if (isSuperVisor == false)
}
if (isSuperVisor == false)
{
#region Not Supervisor
@ -717,19 +711,26 @@ namespace HRM.DA
{
DailyAttnProcess dailyAtt = dailyAttm.FirstOrDefault(o => o.AttnDate.Date == tAtt.InTime.Date);
double wh = 0;
if (dailyAtt != null)
{
bonusIntime = dailyAtt.InTime;
bonusOuttime = dailyAtt.OutTime;
if (dailyAtt.OutTime != DateTime.MinValue && dailyAtt.InTime != DateTime.MinValue)
{
oShift = oShifts.FirstOrDefault(x => x.ID == dailyAtt.ShiftID);
// oShift = oShifts.FirstOrDefault(x => x.ID == dailyAtt.ShiftID);
if (oProductionBonusSetup.FromDate.Date == dailyAtt.AttnDate.Date)
dailyAtt.InTime = oProductionBonusSetup.FromDate > dailyAtt.InTime ? oProductionBonusSetup.FromDate : dailyAtt.InTime;
else if (oProductionBonusSetup.ToDate.Date == dailyAtt.AttnDate.Date)
dailyAtt.OutTime = oProductionBonusSetup.ToDate < dailyAtt.OutTime ? oProductionBonusSetup.ToDate : dailyAtt.OutTime;
else if (oShift != null && dailyAtt.InTime.GetValueOrDefault().TimeOfDay < oShift.InTime.TimeOfDay)
dailyAtt.InTime = dailyAtt.InTime.GetValueOrDefault().Date.AddHours(oShift.InTime.Hour).AddMinutes(oShift.InTime.Minute);
bonusIntime = oProductionBonusSetup.FromDate > dailyAtt.InTime ? oProductionBonusSetup.FromDate : dailyAtt.InTime;
else if (dailyAtt.InTime.GetValueOrDefault().TimeOfDay < tAtt.InTime.TimeOfDay)
bonusIntime = dailyAtt.InTime.GetValueOrDefault().Date.AddHours(tAtt.InTime.Hour).AddMinutes(tAtt.InTime.Minute);
if (oProductionBonusSetup.ToDate.Date == dailyAtt.AttnDate.Date)
bonusOuttime = oProductionBonusSetup.ToDate < dailyAtt.OutTime ? oProductionBonusSetup.ToDate : dailyAtt.OutTime;
else if (dailyAtt.OutTime.GetValueOrDefault().TimeOfDay > tAtt.OutTime.TimeOfDay)
bonusOuttime = dailyAtt.OutTime.GetValueOrDefault().Date.AddHours(tAtt.OutTime.Hour).AddMinutes(tAtt.OutTime.Minute);
//else if (oShift != null && dailyAtt.InTime.GetValueOrDefault().TimeOfDay < oShift.InTime.TimeOfDay)
// bonusIntime = dailyAtt.InTime.GetValueOrDefault().Date.AddHours(oShift.InTime.Hour).AddMinutes(oShift.InTime.Minute);
TimeSpan ts = (TimeSpan)(dailyAtt.OutTime - dailyAtt.InTime);
TimeSpan ts = (TimeSpan)(bonusOuttime - bonusIntime);
if (ts.Minutes < 16 && ts.Hours < 5)
wh = ts.Hours;
else if (ts.Minutes < 16)
@ -749,22 +750,8 @@ namespace HRM.DA
oProcessItem = new ProdBonusProcessItem();
oProcessItem.EmployeeID = item.Key;
oProcessItem.OTHour = oth;
if(oProcessItem.EmployeeID == 283)
{
}
//Amount mismatch hude ammount
if (oProcessItem.EmployeeID == 27620 || oProcessItem.EmployeeID == 27620 || oProcessItem.EmployeeID == 31161 || oProcessItem.EmployeeID == 1822
|| oProcessItem.EmployeeID == 36901 || oProcessItem.EmployeeID == 37542 || oProcessItem.EmployeeID == 41160 || oProcessItem.EmployeeID == 44495
|| oProcessItem.EmployeeID == 44495 || oProcessItem.EmployeeID == 46607 || oProcessItem.EmployeeID == 49783 || oProcessItem.EmployeeID == 55041
|| oProcessItem.EmployeeID == 55155 || oProcessItem.EmployeeID == 55388)
{
}
if (oProcessItem.EmployeeID == 27620)
{
}
oProcessItem.Amount = Math.Round(((double)basicSal / 208 * oth) * 2, 2);
//if(oProcessItem.EmployeeID == 55388)
//{
@ -791,16 +778,22 @@ namespace HRM.DA
{
if (dailyAtt.OutTime != DateTime.MinValue && dailyAtt.InTime != DateTime.MinValue)
{
oShift = oShifts.FirstOrDefault(x => x.ID == dailyAtt.ShiftID);
bonusIntime = dailyAtt.InTime;
bonusOuttime = dailyAtt.OutTime;
//oShift = oShifts.FirstOrDefault(x => x.ID == dailyAtt.ShiftID);
if (oProductionBonusSetup.FromDate.Date == dailyAtt.AttnDate.Date)
dailyAtt.InTime = oProductionBonusSetup.FromDate > dailyAtt.InTime ? oProductionBonusSetup.FromDate : dailyAtt.InTime;
else if (oProductionBonusSetup.ToDate.Date == dailyAtt.AttnDate.Date)
dailyAtt.OutTime = oProductionBonusSetup.ToDate < dailyAtt.OutTime ? oProductionBonusSetup.ToDate : dailyAtt.OutTime;
else if (oShift != null && dailyAtt.InTime.GetValueOrDefault().TimeOfDay < oShift.InTime.TimeOfDay)
dailyAtt.InTime = dailyAtt.InTime.GetValueOrDefault().Date.AddHours(oShift.InTime.Hour).AddMinutes(oShift.InTime.Minute);
bonusIntime = oProductionBonusSetup.FromDate > dailyAtt.InTime ? oProductionBonusSetup.FromDate : dailyAtt.InTime;
else if (dailyAtt.InTime.GetValueOrDefault().TimeOfDay < tAtt.InTime.TimeOfDay)
bonusIntime = dailyAtt.InTime.GetValueOrDefault().Date.AddHours(tAtt.InTime.Hour).AddMinutes(tAtt.InTime.Minute);
if (oProductionBonusSetup.ToDate.Date == dailyAtt.AttnDate.Date)
bonusOuttime = oProductionBonusSetup.ToDate < dailyAtt.OutTime ? oProductionBonusSetup.ToDate : dailyAtt.OutTime;
else if (dailyAtt.OutTime.GetValueOrDefault().TimeOfDay > tAtt.OutTime.TimeOfDay)
bonusOuttime = dailyAtt.OutTime.GetValueOrDefault().Date.AddHours(tAtt.OutTime.Hour).AddMinutes(tAtt.OutTime.Minute);
//else if (oShift != null && dailyAtt.InTime.GetValueOrDefault().TimeOfDay < oShift.InTime.TimeOfDay)
// bonusIntime = dailyAtt.InTime.GetValueOrDefault().Date.AddHours(oShift.InTime.Hour).AddMinutes(oShift.InTime.Minute);
TimeSpan ts = (TimeSpan)(dailyAtt.OutTime - dailyAtt.InTime);
TimeSpan ts = (TimeSpan)(bonusOuttime - bonusIntime);
if (ts.Minutes < 16 && ts.Hours < 5)
wh = ts.Hours;
else if (ts.Minutes < 16)
@ -827,17 +820,17 @@ namespace HRM.DA
oLine.ProdBonusSupervisors = allProdBonusSupervisors.FindAll(x => x.ProdBonusSetupID == oProductionBonusSetup.ID
&& x.ProdBonusLineID == oLine.ID);
//Amount mismatch hude ammount
if (oProcessItem.EmployeeID == 27388 || oProcessItem.EmployeeID == 27620 || oProcessItem.EmployeeID == 31161 || oProcessItem.EmployeeID == 1822
|| oProcessItem.EmployeeID == 36901 || oProcessItem.EmployeeID == 37542 || oProcessItem.EmployeeID == 41160 || oProcessItem.EmployeeID == 44495
|| oProcessItem.EmployeeID == 44495 || oProcessItem.EmployeeID == 46607 || oProcessItem.EmployeeID == 49783 || oProcessItem.EmployeeID == 55041
|| oProcessItem.EmployeeID == 55155 || oProcessItem.EmployeeID == 55388)
{
//if (oProcessItem.EmployeeID == 27388 || oProcessItem.EmployeeID == 27620 || oProcessItem.EmployeeID == 31161 || oProcessItem.EmployeeID == 1822
// || oProcessItem.EmployeeID == 36901 || oProcessItem.EmployeeID == 37542 || oProcessItem.EmployeeID == 41160 || oProcessItem.EmployeeID == 44495
// || oProcessItem.EmployeeID == 44495 || oProcessItem.EmployeeID == 46607 || oProcessItem.EmployeeID == 49783 || oProcessItem.EmployeeID == 55041
// || oProcessItem.EmployeeID == 55155 || oProcessItem.EmployeeID == 55388)
//{
}
if(oProcessItem.EmployeeID == 27620)
{
double x = ((double)oLine.ProdBonusSupervisors.First(o => o.EmployeeID == item.Key).BonusPercent / 100);
}
//}
//if(oProcessItem.EmployeeID == 27620)
//{
// double x = ((double)oLine.ProdBonusSupervisors.First(o => o.EmployeeID == item.Key).BonusPercent / 100);
//}
oProcessItem.Amount = Math.Round(((double)basicSal / 208 * (double)oth *
((double)oLine.ProdBonusSupervisors.First(o => o.EmployeeID == item.Key).BonusPercent / 100)) * 2, 2);
oProcessItem.AchievePercent = 0;
@ -872,17 +865,7 @@ namespace HRM.DA
oProcessEmp = new ProdBonusProcessEmp();
oProcessEmp.EmployeeID = item.EmployeeID;
//Amount mismatch hude ammount
if (oProcessEmp.EmployeeID == 27388 || oProcessEmp.EmployeeID == 27620 || oProcessEmp.EmployeeID == 31161 || oProcessEmp.EmployeeID == 1822
|| oProcessEmp.EmployeeID == 36901 || oProcessEmp.EmployeeID == 37542 || oProcessEmp.EmployeeID == 41160 || oProcessEmp.EmployeeID == 44495
|| oProcessEmp.EmployeeID == 44495 || oProcessEmp.EmployeeID == 46607 || oProcessEmp.EmployeeID == 49783 || oProcessEmp.EmployeeID == 55041
|| oProcessEmp.EmployeeID == 55155 || oProcessEmp.EmployeeID == 55388)
{
}
if (oProcessEmp.EmployeeID == 27620)
{
}
oProcessEmp.Amount = Math.Round((double)item.Amount, 2);
oProcessEmp.Description = item.Description;
_oProdBonusProcess.ProdBonusProcessEmps.Add(oProcessEmp);

View File

@ -1,55 +1,55 @@
<app-loading-panel></app-loading-panel>
<div class="p-grid card">
<div class="p-col-1 label-ailgn">
<div class="p-col-6 p-md-1 label-ailgn">
<label>Design Date</label>
</div>
<div class="p-col-2">
<div class="p-col-6 p-md-2">
<kendo-datepicker [(ngModel)]="selectedSalaryDate" [format]="'dd MMMM yyyy'"
style="width:100%"></kendo-datepicker>
</div>
<div class="p-col-1">
<button icon="refresh" kendoButton [primary]="true" style="width:100%" (click)="Loadlayout()">Refresh</button>
<div class="p-col-12 p-md-1" align="right">
<button icon="refresh" kendoButton [primary]="true" style="width:fit-content" (click)="Loadlayout()">Refresh</button>
</div>
<div class="p-col-1 label-ailgn" align="right">
<div class="p-col-6 p-md-1 label-ailgn">
<label>Design</label>
</div>
<div class="p-col-3">
<div class="p-col-6 p-md-3">
<!-- <app-dynamic-picker [dynamicPickerView]="_departmentPicker"
(onSelectCompleted)="SetFromDescription()"></app-dynamic-picker> -->
<kendo-dropdownlist [data]="filteredProdBSdata" [(ngModel)]="selectedProdBSdata" [filterable]="true"
textField="design" valueField="id" style="width:95%" (filterChange)="handleFilter($event)"
textField="design" valueField="id" style="width:100%" (filterChange)="handleFilter($event)"
[defaultItem]="{ design: 'Select layout no..'}" (valueChange)="loadLines($event)">
</kendo-dropdownlist>
</div>
<!-- <div class="p-col-2">
<!-- <div class="p-col-6 p-md-2">
</div> -->
<div class="p-col-1 label-ailgn" align="right">
<div class="p-col-6 p-md-1 label-ailgn">
<label>Line Name</label>
</div>
<div class="p-col-3">
<div class="p-col-6 p-md-3">
<kendo-dropdownlist [data]="productionBonusSetup.productionBonusLines" [(ngModel)]="selectedLine"
textField="lineName" valueField="id" [defaultItem]="{ lineName: 'Select Line..'}" style="width:100%">
</kendo-dropdownlist>
</div>
<div class="p-col-6 label-ailgn" *ngIf="showScheduleDate">
<div class="p-col-12 p-md-3 label-ailgn" *ngIf="showScheduleDate">
<!-- <div class="p-grid">
<div class="p-col-3 label-ailgn">
<div class="p-col-6 p-md-3 label-ailgn">
<label>Schedule Date From</label>
</div>
<div class="p-col-4">
<div class="p-col-6 p-md-4">
<kendo-datepicker [(ngModel)]="productionBonusSetup.fromDate" [format]="'dd MMMM yyyy'"
style="width:100%" [readonly]="true"></kendo-datepicker>
</div>
<div class="p-col-1 label-ailgn">
<div class="p-col-6 p-md-1 label-ailgn">
<label>Upto</label>
</div>
<div class="p-col-4">
<div class="p-col-6 p-md-4">
<kendo-datepicker [(ngModel)]="productionBonusSetup.toDate" [format]="'dd MMMM yyyy'" style="width:100%"
[readonly]="true"></kendo-datepicker>
</div>
<div class="p-col-12 label-ailgn"></div>
<div class="p-col-6 p-md-12 label-ailgn"></div>
</div> -->
<p style="color: red; font-style: italic;">Select Schedule Date Betweeen {{productionBonusSetup.fromDate | date:
'dd MMMM yyyy'}} and
@ -58,18 +58,33 @@
</div>
<!--
<div class="p-col-6 p-md-6" *ngIf="!showScheduleDate">
</div> -->
<div class="p-col-6" *ngIf="!showScheduleDate">
</div>
<div class="p-col-2 label-ailgn" align="right">
<div class="p-col-6 p-md-1 label-ailgn">
<label>Schedule Date</label>
</div>
<div class="p-col-2">
<div class="p-col-6 p-md-2">
<kendo-datepicker [(ngModel)]="selectedDate" [format]="'dd MMMM yyyy'" style="width:100%"></kendo-datepicker>
</div>
<div class="p-col-2" align="right">
<button icon="refresh" kendoButton [primary]="true" style="width:80%" (click)="onClickRefresh()"
<div class="p-col-6 p-md-1 label-ailgn">
<label>In Time</label>
</div>
<div class="p-col-6 p-md-2">
<kendo-timepicker [(ngModel)]="startTime" style="width:100%"></kendo-timepicker>
</div>
<div class="p-col-6 p-md-1 label-ailgn">
<label>Out Time</label>
</div>
<div class="p-col-6 p-md-2">
<kendo-timepicker [(ngModel)]="endTime" style="width:100%"></kendo-timepicker>
</div>
<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>
</div>
<div class="p-col-12">
@ -110,8 +125,8 @@
</div>
<div class="p-col-4">
<app-employee-picker (ItemSelected)="GetSelectedEmployee($event)"
[MultiSelect]="employeeSelection==='commonEmployee'"></app-employee-picker>
<!-- [setSelectedEmp]="_pickerSelecteEmp" [isActive]="empPickerActive" -->
[MultiSelect]="false"></app-employee-picker>
<!-- [MultiSelect]="employeeSelection==='commonEmployee'"></app-employee-picker> -->
</div>
<div class="p-col-2"></div>
<div class="p-col-2" align="right">

View File

@ -44,6 +44,9 @@ export class ProductionBonusAttendanceComponent implements OnInit {
selectedDate: Date = new Date;
startTime: Date;
endTime: Date;
selectedSalaryDate: Date = new Date();
showScheduleDate: boolean;
@ -343,8 +346,27 @@ export class ProductionBonusAttendanceComponent implements OnInit {
// );
// }
onClickSubmit() {
console.log(this.prodBonusAttn);
// console.log(this.prodBonusAttn);
debugger;
if (this.startTime == undefined || this.endTime == undefined) {
this.notificationService.showWarning('Please Select In/Out Time');
return;
}
this.prodBonusAttn.forEach(element => {
let inTime = new Date(element.inTime);
inTime.setHours(this.startTime.getHours());
inTime.setMinutes(this.startTime.getMinutes());
inTime.setSeconds(this.startTime.getSeconds());
element.inTime = inTime;
let outTime = new Date(element.outTime);
outTime.setHours(this.endTime.getHours());
outTime.setMinutes(this.endTime.getMinutes());
outTime.setSeconds(this.endTime.getSeconds());
element.outTime = outTime;
});
const data = {
prodBonusAttn: this.prodBonusAttn,
setupId: this.productionBonusSetup.id,