48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Exports;
|
|
|
|
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
|
|
|
|
class GadaiTebusMasaExport implements WithMultipleSheets
|
|
{
|
|
public $cawangan_detail;
|
|
public $query;
|
|
public $gadaian;
|
|
public $summary_gadaian;
|
|
protected $gadaian_full_data;
|
|
|
|
public function __construct($data)
|
|
{
|
|
$this->cawangan_detail = $data['cawangan_detail'];
|
|
$this->query = $data['query'];
|
|
$this->gadaian = $data['gadaian'];
|
|
$this->summary_gadaian = $data['summary_gadaian'];
|
|
}
|
|
|
|
public function sheets(): array
|
|
{
|
|
// Sheet untuk senarai penuh gadaian (gabung semua teller)
|
|
$full_gadaian_data = [];
|
|
|
|
foreach ($this->gadaian as $teller => $data) {
|
|
if (isset($data['gadaian']) && is_array($data['gadaian'])) {
|
|
foreach ($data['gadaian'] as $item) {
|
|
$item['teller'] = $teller; // optional: simpan info teller
|
|
$full_gadaian_data[] = $item;
|
|
}
|
|
}
|
|
}
|
|
|
|
$sheets[] = new GadaiTebusMasaFullExport(
|
|
$this->cawangan_detail,
|
|
$this->query,
|
|
$this->gadaian,
|
|
$full_gadaian_data
|
|
);
|
|
|
|
return $sheets;
|
|
}
|
|
|
|
}
|