PK

ADDRLIN : /home/questend/public_html/subdomain/payroll.questend.com/app/Exports/
FLL :
Current File : /home/questend/public_html/subdomain/payroll.questend.com/app/Exports/PayrollExport.php

<?php

namespace App\Exports;

use App\Models\Payroll;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;

class PayrollExport implements FromCollection, WithHeadings
{
    protected int $month;
    protected int $year;

    public function __construct(int $month, int $year)
    {
        $this->month = $month;
        $this->year  = $year;
    }

    public function collection()
    {
        return Payroll::with('employee')
            ->where('month', $this->month)
            ->where('year', $this->year)
            ->get()
            ->map(function ($p) {
                return [
                    'Emp Code'     => $p->employee->emp_code,
                    'Name'         => $p->employee->name,
                    'Month'        => $p->month,
                    'Year'         => $p->year,
                    'Gross'        => $p->gross,
                    'PF (EE)'      => $p->pf_employee,
                    'ESI (EE)'     => $p->esi_employee,
                    'PT'           => $p->professional_tax,
                    'TDS'          => $p->tds,
                    'Deductions'   => $p->deductions,
                    'Net Pay'      => $p->net,
                ];
            });
    }

    public function headings(): array
    {
        return [
            'Employee Code',
            'Employee Name',
            'Month',
            'Year',
            'Gross Salary',
            'PF (Employee)',
            'ESI (Employee)',
            'Professional Tax',
            'TDS',
            'Total Deductions',
            'Net Pay'
        ];
    }
}


PK 99
E-SHOP || DASHBOARD
404

Page Not Found

It looks like you found a glitch in the matrix...

← Back to Home