daily report done
parent
37d4d86c64
commit
a5d7562fdd
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Models\Transaksi;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
|
||||
class LaporanHarianExport implements FromView
|
||||
{
|
||||
|
||||
public function __construct($date, $tanggal)
|
||||
{
|
||||
$this->date = $date;
|
||||
$this->tanggal = $tanggal;
|
||||
}
|
||||
public function collection()
|
||||
{
|
||||
return Transaksi::orderBy('siswa_id','desc')->whereDate('created_at', $this->date)->get();
|
||||
}
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
return view('dashboard.export', [
|
||||
'transaksi' => $this->collection(),
|
||||
'date' => $this->date,
|
||||
'tanggal' => $this->tanggal,
|
||||
'jumlah' => 0
|
||||
]);
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
<h2 style="text-align:center"><b> {{ $sitename }} </b></h2 >
|
||||
<h3 style="text-align:center">Laporan Harian</h3>
|
||||
<p><b>Tanggal :</b> {{ $date }} </p>
|
||||
<table style="border: 1px solid black; width: 100%">
|
||||
<thead style="border: 1px solid black;">
|
||||
<tr>
|
||||
<th>Tanggal</th>
|
||||
<th>Nama</th>
|
||||
<th>Pembayaran</th>
|
||||
<th>Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($transaksi as $index => $item)
|
||||
<tr class="{{ ($index%2) ? 'gray' : '' }}">
|
||||
<td>{{ $item->created_at->format('d-m-Y') }}</td>
|
||||
<td>{{ $item->siswa->nama." (".$item->siswa->kelas->nama.")" }}</td>
|
||||
<td>{{ $item->tagihan->nama }}</td>
|
||||
<td>IDR. {{ format_idr($item->keuangan->jumlah) }}</td>
|
||||
@php
|
||||
$jumlah += $item->keuangan->jumlah
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
<tr>
|
||||
<td><b>Total</b></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>IDR. {{ format_idr($jumlah) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@if(isset($print))
|
||||
<style>
|
||||
@media print {
|
||||
tr.gray {
|
||||
background-color: #ececec !important;
|
||||
-webkit-print-color-adjust: exact;
|
||||
}
|
||||
th {
|
||||
background-color: #dadada !important;
|
||||
-webkit-print-color-adjust: exact;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
window.print()
|
||||
</script>
|
||||
@endif
|
Loading…
Reference in New Issue