Skip to content

Commit

Permalink
fixed advance salary miss calculation issue
Browse files Browse the repository at this point in the history
fixed advance salary miss calculation  issue
  • Loading branch information
Sharifur committed May 30, 2024
2 parents 58ae68f + 16f1be3 commit 3dc87ad
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/Http/Controllers/Admin/EmployeeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public function attenadance_check_global(){
public function details($id,Request $request){
$details = Employee::with('category')->find($id);
$details->designation = optional($details->category)->title;
//todo

$logs = AttendanceLog::query()
->where(['employee_id' => $id])
->where("status",1)
Expand Down Expand Up @@ -205,7 +205,7 @@ public function details($id,Request $request){
//if found cout/cin then show total office hour
}

//todo:: need to work here
//todo:: need to work here
$holidayCount = $logs->where('type','holiday')->count();
$leaveCount = $logs->where('type','leave')->count();
$sickLeaveCount = $logs->where('type','sick-leave')->count();
Expand All @@ -219,7 +219,10 @@ public function details($id,Request $request){
}

//advance salary this month
$AdvanceSalary = AdvanceSalary::where(['employee_id' => $id])->whereMonth("month",Carbon::parse($request->month))->get()->pluck("amount")->sum();
$AdvanceSalary = AdvanceSalary::where(['employee_id' => $id])
->whereMonth("month",Carbon::parse($request->month))
->whereYear('month',Carbon::now()->year)
->get()->pluck("amount")->sum();

return response([
'details' => $details,
Expand Down

0 comments on commit 3dc87ad

Please sign in to comment.