E-Invoice - Receipt Voucher

This commit is contained in:
Dillon Ngo
2025-05-24 22:14:35 +08:00
parent de799dc356
commit b3693aa1e3
21 changed files with 543 additions and 46 deletions
+8 -1
View File
@@ -24,6 +24,12 @@ class BookingResource extends JsonResource
*/
public function toArray($request)
{
$eInvoice = false;
$eInvoiceStartDate = Carbon::parse(env('E_INVOICE_START_DATE', '2025-07-01 00:00:00'));
$bookingCreatedDate = Carbon::parse($this->created_at);
if ($bookingCreatedDate->isAfter($eInvoiceStartDate) && $this->company->e_invoice === 1) {
$eInvoice = true;
}
return [
'id' => $this->id,
'company' => new CompanyResource($this->company),
@@ -76,7 +82,8 @@ class BookingResource extends JsonResource
});
});
})->latest()->get())
])
]),
'einvoice' => $eInvoice,
];
}
}