IMMREX7

aku nok ndi : /home/spdtg/www/schoolmis/app/Http/Controllers/Teacher/
File Up :
aku nok ndi : /home/spdtg/www/schoolmis/app/Http/Controllers/Teacher/SalaryReportController.php

<?php

namespace App\Http\Controllers\Teacher;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Auth;
use PDF;

class SalaryReportController extends Controller
{
    public function viewPaidReport(Request $request) {
        $salreport = \App\EmpPayment::where('idEmployee','=',Auth::guard('teacher')->user()->idEmployee)->where('isPaid','Y')->get();
        $teacher = \App\Teacher::where('idEmployee', '=', Auth::guard('teacher')->user()->idEmployee)->first();
        $school = \App\School::where('idSchool','=',$teacher->idSchool)->first();
        return view('teachers.salreport', compact('salreport','school'));
    }

    public function viewUnPaidReport(Request $request) {
        $salreport = \App\EmpPayment::where('idEmployee','=',Auth::guard('teacher')->user()->idEmployee)->where('isPaid','N')->get();
        $teacher = \App\Teacher::where('idEmployee', '=', Auth::guard('teacher')->user()->idEmployee)->first();
        $school = \App\School::where('idSchool','=',$teacher->idSchool)->first();
        return view('teachers.salreport', compact('salreport','school'));
    }

    public function printSlip($id){
        $empsalary = \App\EmpPayment::where('idEmpPayment', '=',base64_decode($id))->first();
        if($empsalary == null){
            return redirect('/teacher');
        }
        if($empsalary->idEmployee != Auth::guard('teacher')->user()->idEmployee){
            return redirect('/teacher');
        }
        $school = \App\School::where('idSchool', '=', $empsalary->idSchool)->first();
        $month = \App\Month::where('idMonth', '=', $empsalary->idMonth)->first();
        $employee = \App\Employee::where('idEmployee', '=', $empsalary->idEmployee)->first();
        $now = \Carbon\Carbon::now();
        $pay_start = '01' . '-' . $month->idMonth . '-' . $now->year;
        $pay_end = $month->noOfDays . '-' . $month->idMonth . '-' . $now->year;
        $y = $now->year;
        $earnings = \App\SalaryStrAllowances::where('idSalaryStr', '=', $empsalary->idSalaryStr)->get();
        $deductions = \App\SalaryStrDeduction::where('idSalaryStr', '=', $empsalary->idSalaryStr)->get();
        $pdf = PDF::loadView('schools.hrms.print_salaryslip', ['margin_top' => 20], compact('pay_start','pay_end','school', 'empsalary', 'month', 'employee', 'earnings', 'deductions'));
        return $pdf->stream('salaryslip.pdf');
    }
}

Copyright © 2021 - 2025 IMMREX7