/** * Show the form for editing the specified leaveapplication. * * @param int $id * @return Response */ public function edit($id) { $leaveapplication = Leaveapplication::find($id); $employees = Employee::all(); $leavetypes = Leavetype::all(); return View::make('leaveapplications.edit', compact('leaveapplication', 'employees', 'leavetypes')); }
public static function absentEmployee($employeeID) { $half = 0; foreach (Leavetype::all() as $leave) { // Half Day leaves are added to casual leaves.2 half days are equal to one Casual Leave if ($leave->leaveType == 'half day') { $half_day = Attendance::where('status', '=', 'absent')->where(function ($query) { $query->where('application_status', '=', 'approved')->orWhere('application_status', '=', null); })->where('employeeID', '=', $employeeID)->where('halfDayType', '<>', 'unpaid')->where('leaveType', '=', $leave->leaveType)->count(); // Added to casual $half += $half_day / 2; } else { $absent[$leave->leaveType] = Attendance::where('status', '=', 'absent')->where(function ($query) { $query->where('application_status', '=', 'approved')->orWhere('application_status', '=', null); })->where('employeeID', '=', $employeeID)->where('leaveType', '<>', 'unpaid')->where('leaveType', '=', $leave->leaveType)->count(); } } $absent['half day'] = $half; return $absent; }
/** * Display a listing of the resource. * * @return Response */ public function index() { $leavetypes = Leavetype::all(); return View::make('leavetypes.index', compact('leavetypes')); }
public function individualleave() { $id = Input::get("employeeid"); $employee = Employee::find($id); $leavetypes = Leavetype::all(); $organization = Organization::find(1); $pdf = PDF::loadView('leavereports.individualReport', compact('leavetypes', 'employee', 'organization'))->setPaper('a4')->setOrientation('potrait'); return $pdf->stream($employee->first_name . '_' . $employee->last_name . '_Leave_Report.pdf'); }
Route::get('css/leave', function () { $employeeid = DB::table('employee')->where('personal_file_number', '=', Confide::user()->username)->pluck('id'); $employee = Employee::findorfail($employeeid); $leaveapplications = DB::table('leaveapplications')->where('employee_id', '=', $employee->id)->get(); return View::make('css.leave', compact('employee', 'leaveapplications')); }); Route::get('css/leaveapply', function () { $employeeid = DB::table('employee')->where('personal_file_number', '=', Confide::user()->username)->pluck('id'); $employee = Employee::findorfail($employeeid); $leavetypes = Leavetype::all(); return View::make('css.leaveapply', compact('employee', 'leavetypes')); }); Route::get('css/balances', function () { $employeeid = DB::table('employee')->where('personal_file_number', '=', Confide::user()->username)->pluck('id'); $employee = Employee::findorfail($employeeid); $leavetypes = Leavetype::all(); return View::make('css.balances', compact('employee', 'leavetypes')); }); /* *##########################ERP REPORTS####################################### */ Route::get('erpReports', function () { return View::make('erpreports.erpReports'); }); Route::get('erpReports/clients', 'ErpReportsController@clients'); Route::get('erpReports/items', 'ErpReportsController@items'); Route::get('erpReports/expenses', 'ErpReportsController@expenses'); Route::get('erpReports/paymentmethods', 'ErpReportsController@paymentmethods'); Route::get('erpReports/payments', 'ErpReportsController@payments'); Route::get('erpReports/locations', 'ErpReportsController@locations'); Route::get('erpReports/stock', 'ErpReportsController@stock');