Production Bonus attn Swing and Printing #12
|
@ -283,12 +283,13 @@ namespace HRM.BO
|
|||
|
||||
List<ProdBonusAttn> Get(int setupID, int ScheduleID);
|
||||
List<ProdBonusAttn> Get(int setupID, DateTime dateTime);
|
||||
|
||||
List<ProdBonusAttn> GetBySetupLineDate(int setupID, int lineID, DateTime dateTime);
|
||||
List<ProdBonusAttn> GetBySetupID(int iD);
|
||||
List<ProdBonusAttn> GetBySetupIDs(string iDs);
|
||||
|
||||
List<ProdBonusAttn> GetByLineID(int lineID);
|
||||
List<ProdBonusAttn> GetbySetupAndLineID(int setupID, int lineID);
|
||||
DateTime? GetMaxDate(int setupID, int lineID, DateTime date);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -90,7 +90,24 @@ namespace HRM.DA
|
|||
return tc.ExecuteReader(sql);
|
||||
//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
|
||||
|
||||
#region Delete function
|
||||
|
|
|
@ -159,6 +159,32 @@ namespace HRM.DA
|
|||
|
||||
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)
|
||||
{
|
||||
|
@ -295,6 +321,31 @@ namespace HRM.DA
|
|||
|
||||
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)
|
||||
{
|
||||
TransactionContext tc = null;
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
</div>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
<div class="p-col-12">
|
||||
|
@ -94,6 +94,7 @@
|
|||
Remove All
|
||||
</button>
|
||||
<kendo-grid-spacer></kendo-grid-spacer>
|
||||
<label>Attendance Count: {{employeeList.length}} </label>
|
||||
<!--<button kendoGridExcelCommand type="button" icon="file-excel">Export to
|
||||
Excel</button>class="customButton"-->
|
||||
</ng-template>
|
||||
|
|
|
@ -187,7 +187,7 @@ export class ProductionBonusAttendanceComponent implements OnInit {
|
|||
)
|
||||
}
|
||||
|
||||
onClickRefresh() {
|
||||
onClickLoad() {
|
||||
// debugger;
|
||||
const fromDate = new Date(this.productionBonusSetup.fromDate.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) {
|
||||
var dataForAttn = {
|
||||
setupId: this.productionBonusSetup.id,
|
||||
lineId: this.selectedLine.id,
|
||||
date: this.selectedDate
|
||||
}
|
||||
// console.log(dataForAttn);
|
||||
|
|
|
@ -522,6 +522,7 @@ namespace HRM.UI.Controllers.Payroll
|
|||
{
|
||||
var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(processItems));
|
||||
int setupID = (int)item["setupId"].ToObject<int>();
|
||||
int lineID = (int)item["lineId"].ToObject<int>();
|
||||
DateTime date = (DateTime)item["date"].ToObject<DateTime>();
|
||||
|
||||
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
||||
|
@ -529,7 +530,7 @@ namespace HRM.UI.Controllers.Payroll
|
|||
List<ProdBonusAttn> AttnItems = new List<ProdBonusAttn>();
|
||||
try
|
||||
{
|
||||
AttnItems = _prodBonusAttnService.Get(setupID, date);
|
||||
AttnItems = _prodBonusAttnService.GetBySetupLineDate(setupID, lineID, date);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -623,18 +624,15 @@ namespace HRM.UI.Controllers.Payroll
|
|||
List<ProdBonusParameter> _oProdBonusParameters = new List<ProdBonusParameter>();
|
||||
List<ProdBonusSupervisor> _oProdBonusSupervisors = new List<ProdBonusSupervisor>();
|
||||
List<DailyAttnProcess> _oDailyAttnProsess = new List<DailyAttnProcess>();
|
||||
List<ProdBonusAttn> _oProdBonusAttns = null;
|
||||
try
|
||||
{
|
||||
//List<ProdBonusWorkSchedule> _oProdBonusWorkSchedules = _prodBonusWorkScheduleService.Get();
|
||||
List<ProdBonusAttn> _oProdBonusAttns = _prodBonusAttnService.Get(_oProdBonusLine.ProdBonusSetupID, date.AddDays(-1));
|
||||
DateTime? maxDate = _prodBonusAttnService.GetMaxDate(_oProdBonusLine.ProdBonusSetupID, _oProdBonusLine.ID, date);
|
||||
|
||||
//_oProdBonusParameters = _oProdBonusLine.ProdBonusParameters;
|
||||
if(maxDate != null)
|
||||
_oProdBonusAttns = _prodBonusAttnService.GetBySetupLineDate(_oProdBonusLine.ProdBonusSetupID, _oProdBonusLine.ID, (DateTime)maxDate);
|
||||
|
||||
//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)
|
||||
|
@ -644,8 +642,6 @@ namespace HRM.UI.Controllers.Payroll
|
|||
if (emp != null) _oFinalEmployees.Add(emp);
|
||||
}
|
||||
}
|
||||
//}
|
||||
//}
|
||||
string emIds = _oFinalEmployees.Aggregate(new StringBuilder(), (sb, x) => sb.Append(x.ID + ","), sb => sb.ToString().Trim(','));
|
||||
if (emIds != "")
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user