Siopas Inventory PETI for ISTW Website
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.9 KiB

1 year ago
<?php
namespace App\Exports;
use App\Models\Peti;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\FromCollection;
class PetternLotPetiExport implements FromCollection, WithHeadings
{
public function collection()
{
// Ambil data dari model Peti
$petis = Peti::select(
'customer_id',
'warehouse_id',
'jumlah',
'tipe_peti_id',
'kondisipeti_id',
1 year ago
'packing_no',
'fix_lot',
'status_isi',
'warna',
'status',
1 year ago
)->get();
// Inisialisasi nomor awal
$nomor = 1;
// Modifikasi data dan tambahkan nomor
$data = $petis->map(function ($peti) use (&$nomor) {
return [
'No' => $nomor++,
1 year ago
'FIX LOT' => $peti->fix_lot,
'CUSTOMER' => $peti->customer->name,
'KODE CUSTOMER' => $peti->customer->code_customer,
'TIPE PETI' => $peti->tipe_peti->type,
1 year ago
'UKURAN PETI' => $peti->tipe_peti->size_peti,
'LOT NO' => $peti->customer->lot_no,
'PACKING NO' => $peti->packing_no,
'GUDANG' => $peti->warehouse->name,
'KONDISI PETI' => $peti->kondisipeti->nama_kondisi,
'ISI PETI' => $peti->status_isi,
'WARNA PETI' => $peti->warna,
'STATUS' => $peti->status,
1 year ago
];
});
return $data;
}
public function headings(): array
{
return [
'No',
1 year ago
'FIX LOT',
'CUSTOMER',
'KODE CUSTOMER',
'TIPE PETI',
1 year ago
'UKURAN PETI',
'LOT NO',
'PACKING NO',
'GUDANG',
'KONDISI PETI',
'ISI PETI',
'WARNA PETI',
'STATUS',
1 year ago
];
}
}