IMMREX7

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

<?php

namespace App\Http\Controllers\School;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use DB;
use Auth;
use Carbon\Carbon;

class SalaryReportController extends SchoolController {

    public function salReport(Request $request) {
        $month = \App\Month::where('idMonth', '=', $request->idMonth)->first();
        $departments = ['' => '--Select--'] + \App\Department::where('idSchool', '=', Auth::guard('school')->user()->idSchool)
                        ->orderBy('departmentName')->get()->pluck('departmentName', 'idDepartment')->toArray();
        $empsalaries = DB::table('employee_payment')
                ->join('employees','employee_payment.idEmployee','=','employees.idEmployee')
                ->join('departments','employees.idDepartment','=','departments.idDepartment')
                ->join('designations','employees.idDesignation','=','designations.idDesignation')
                ->join('months','employee_payment.idMonth','=','months.idMonth')
                ->where('employee_payment.idSchool', '=', Auth::guard('school')->user()->idSchool);
        if (($request->has('employees') && count($request->employees) > 0) && ($request->has('idMonth') && $request->idMonth != null)) {
            $empsalaries = $empsalaries->whereIn('employees.idEmployee', $request->employees)
                    ->where('employee_payment.idMonth','=',$request->idMonth)->get();
        } elseif (($request->has('designations') && count($request->designations) > 0) && ($request->has('idMonth') && $request->idMonth != null)) {
            $empsalaries = $empsalaries->whereIn('employees.idDesignation', $request->designations)
                    ->where('employee_payment.idMonth','=',$request->idMonth)->get();
        } else if (($request->has('idDepartment') && $request->idDepartment != null) && ($request->has('idMonth') && $request->idMonth != null)) {
            $empsalaries = $empsalaries->where('employees.idDepartment','=' ,$request->idDepartment)
                    ->where('employee_payment.idMonth','=',$request->idMonth)->get();
        } else if ($request->has('idMonth') && $request->idMonth != null) {
            $empsalaries = $empsalaries->where('employee_payment.idMonth','=',$request->idMonth)->get();
        }else{
            $empsalaries = [];
        }
        if(Auth::guard('school')->user()->idSchool == 25)
        return view('schools.reports.salary_report_royal', compact('empsalaries','departments','month'));   
        else
        return view('schools.reports.salary_report', compact('empsalaries','departments','month'));   
    }

    public function ptReport(Request $request){
        $month = \App\Month::where('idMonth', '=', $request->idMonth)->first();
        $departments = ['' => '--Select--'] + \App\Department::where('idSchool', '=', Auth::guard('school')->user()->idSchool)
                        ->orderBy('departmentName')->get()->pluck('departmentName', 'idDepartment')->toArray();
        $empsalaries = DB::table('employee_payment')
                ->join('employees','employee_payment.idEmployee','=','employees.idEmployee')
                ->join('departments','employees.idDepartment','=','departments.idDepartment')
                ->join('designations','employees.idDesignation','=','designations.idDesignation')
                ->join('months','employee_payment.idMonth','=','months.idMonth')
                ->where('employee_payment.idSchool', '=', Auth::guard('school')->user()->idSchool);
        if (($request->has('employees') && count($request->employees) > 0) && ($request->has('idMonth') && $request->idMonth != null)) {
            $empsalaries = $empsalaries->whereIn('employees.idEmployee', $request->employees)
                    ->where('employee_payment.idMonth','=',$request->idMonth)->get();
        } elseif (($request->has('designations') && count($request->designations) > 0) && ($request->has('idMonth') && $request->idMonth != null)) {
            $empsalaries = $empsalaries->whereIn('idDesignation', $request->designations)
                    ->where('employee_payment.idMonth','=',$request->idMonth)->get();
        } else if (($request->has('idDepartment') && $request->idDepartment != null) && ($request->has('idMonth') && $request->idMonth != null)) {
            $empsalaries = $empsalaries->where('idDepartment','=' ,$request->idDepartment)
                    ->where('employee_payment.idMonth','=',$request->idMonth)->get();
        } else if ($request->has('idMonth') && $request->idMonth != null) {
            $empsalaries = $empsalaries->where('employee_payment.idMonth','=',$request->idMonth)->get();
        }else{
            $empsalaries = [];
        }
        return view('schools.reports.salary_pt', compact('empsalaries','departments','month'));
    }

    public function epfReport(Request $request){
        $month = \App\Month::where('idMonth', '=', $request->idMonth)->first();
        $departments = ['' => '--Select--'] + \App\Department::where('idSchool', '=', Auth::guard('school')->user()->idSchool)
                        ->orderBy('departmentName')->get()->pluck('departmentName', 'idDepartment')->toArray();
        $empsalaries = DB::table('employee_payment')
                ->join('employees','employee_payment.idEmployee','=','employees.idEmployee')
                ->join('departments','employees.idDepartment','=','departments.idDepartment')
                ->join('designations','employees.idDesignation','=','designations.idDesignation')
                ->join('months','employee_payment.idMonth','=','months.idMonth')
                ->where('employee_payment.idSchool', '=', Auth::guard('school')->user()->idSchool);
        if (($request->has('employees') && count($request->employees) > 0) && ($request->has('idMonth') && $request->idMonth != null)) {
            $empsalaries = $empsalaries->whereIn('employees.idEmployee', $request->employees)
                    ->where('employee_payment.idMonth','=',$request->idMonth)->get();
        } elseif (($request->has('designations') && count($request->designations) > 0) && ($request->has('idMonth') && $request->idMonth != null)) {
            $empsalaries = $empsalaries->whereIn('idDesignation', $request->designations)
                    ->where('employee_payment.idMonth','=',$request->idMonth)->get();
        } else if (($request->has('idDepartment') && $request->idDepartment != null) && ($request->has('idMonth') && $request->idMonth != null)) {
            $empsalaries = $empsalaries->where('idDepartment','=' ,$request->idDepartment)
                    ->where('employee_payment.idMonth','=',$request->idMonth)->get();
        } else if ($request->has('idMonth') && $request->idMonth != null) {
            $empsalaries = $empsalaries->where('employee_payment.idMonth','=',$request->idMonth)->get();
        }else{
            $empsalaries = [];
        }
        return view('schools.reports.salary_epf', compact('empsalaries','departments','month'));
    }

}

Copyright © 2021 - 2025 IMMREX7