This commit is contained in:
baodev0
2026-09-23 15:17:18 +07:00
parent cd38c5d6d0
commit 82a71244ca
107 changed files with 3332 additions and 3306 deletions
@@ -24,6 +24,8 @@ class InvoiceTransformer
$legacyId = (int) $row['id'];
$dueDate = $this->nullableDate($row['duedate'] ?? null);
$status = $this->mapStatus($row['status'], $dueDate);
$total = (int) round((float) $row['total']);
$whmcsOrderId = $this->extractor->orderIdFor($legacyId);
$rawItems = $this->extractor->items($legacyId);
@@ -46,8 +48,11 @@ class InvoiceTransformer
subTotal: (int) round((float) $row['subtotal']),
discountAmount: $discountAmount,
tax: (int) round((float) $row['tax'] + (float) $row['tax2']),
total: (int) round((float) $row['total']),
status: $this->mapStatus($row['status'], $dueDate),
total: $total,
// Không có amount_paid thì mọi hoá đơn WHMCS đã thanh toán sẽ hiện "chưa thu"
// và outstanding = total trên toàn bộ dữ liệu import.
amountPaid: $status === 2 ? $total : (int) round((float) ($row['credit'] ?? 0)),
status: $status,
paymentMethod: $row['paymentmethod'] ?: null,
dueDate: $dueDate,
paidAt: $this->nullableDate($row['datepaid'] ?? null),