update
This commit is contained in:
@@ -21,6 +21,9 @@ class InvoiceDetailResource extends JsonResource
|
||||
'discount_amount' => (float) ($this->discount_amount ?? 0),
|
||||
'tax' => (float) $this->tax,
|
||||
'total' => (float) $this->total,
|
||||
// Công nợ: đã thu / còn thiếu. Dịch vụ chỉ kích hoạt khi outstanding = 0.
|
||||
'amount_paid' => (float) $this->amount_paid,
|
||||
'outstanding' => (float) \App\Services\InvoicePaymentService::outstanding($this->resource),
|
||||
'payment_method' => $this->resolvePaymentMethod($this->resource),
|
||||
'auto_renew' => (bool) $this->auto_renew,
|
||||
'created_at' => $this->created_at?->toISOString(),
|
||||
|
||||
@@ -15,6 +15,9 @@ class InvoiceSummaryResource extends JsonResource
|
||||
'invoice_number' => $this->invoice_number,
|
||||
'service_name' => $this->order?->orderItems->first()?->product?->name ?? ('Đơn hàng ' . $this->order?->order_num),
|
||||
'total' => (float) $this->total,
|
||||
// Khách trả một phần thì hoá đơn vẫn chưa thanh toán — phải thấy được còn thiếu bao nhiêu.
|
||||
'amount_paid' => (float) $this->amount_paid,
|
||||
'outstanding' => (float) \App\Services\InvoicePaymentService::outstanding($this->resource),
|
||||
'status' => $this->status,
|
||||
'status_text' => InvoiceStatus::tryFrom((int) $this->status)?->label() ?? '-',
|
||||
'created_at' => $this->created_at?->toISOString(),
|
||||
|
||||
Reference in New Issue
Block a user