export pdf list
parent
9328d5c10d
commit
c9e21b29aa
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Models\Payroll;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
|
||||
class PayrollExportFromView implements FromView
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
private $startDate;
|
||||
private $endDate;
|
||||
|
||||
public function __construct($startDate, $endDate)
|
||||
{
|
||||
$this->startDate = $startDate;
|
||||
$this->endDate = $endDate;
|
||||
}
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$items = Payroll::with('employee')->whereBetween('date', [$this->startDate, $this->endDate])->get();
|
||||
|
||||
return view('report', [
|
||||
'data' => $items,
|
||||
'startDate' => $this->startDate,
|
||||
'endDate' => $this->endDate
|
||||
]);
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
|
||||
</head>
|
||||
<body>
|
||||
<table style="text-align: center;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Laporan
|
||||
</th>
|
||||
<th>
|
||||
{{$startDate}}
|
||||
</th>
|
||||
<th>
|
||||
{{$endDate}}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colSpan="5" style="padding: 3em;"></th>
|
||||
</tr>
|
||||
<tr style="font-weight: bold;">
|
||||
<th>
|
||||
Nama karyawan
|
||||
</th>
|
||||
<th>
|
||||
Kontak
|
||||
</th>
|
||||
<th>
|
||||
Jumlah Item
|
||||
</th>
|
||||
<th>
|
||||
Total Gajian
|
||||
</th>
|
||||
<th>
|
||||
Tanggal
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($data as $item)
|
||||
<tr>
|
||||
<td style="width: 200px">{{$item->employee->name}}</td>
|
||||
<td style="width: 100px">{{$item->employee->whatsapp}}</td>
|
||||
<td style="width: 100px">{{$item->item_count}}</td>
|
||||
<td style="width: 100px">{{$item->recived}}</td>
|
||||
<td style="width: 100px">{{$item->date}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue