fix: add missing line_total field during invoice item insertion to prevent General error 1364
This commit is contained in:
@@ -125,8 +125,8 @@ class InvoiceProcessor
|
|||||||
INSERT INTO invoice_lines (
|
INSERT INTO invoice_lines (
|
||||||
id, invoice_id, line_number, description,
|
id, invoice_id, line_number, description,
|
||||||
quantity, unit_price, tax_rate, tax_amount,
|
quantity, unit_price, tax_rate, tax_amount,
|
||||||
discount_amount, net_total, tax_category
|
discount_amount, net_total, line_total, tax_category
|
||||||
) VALUES (?,?,?,?,?,?,?,?,?,?,?)
|
) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)
|
||||||
");
|
");
|
||||||
foreach ($extracted['lines'] as $idx => $line) {
|
foreach ($extracted['lines'] as $idx => $line) {
|
||||||
$quantity = (float)($line['quantity'] ?? 1);
|
$quantity = (float)($line['quantity'] ?? 1);
|
||||||
@@ -148,6 +148,7 @@ class InvoiceProcessor
|
|||||||
$taxAmount,
|
$taxAmount,
|
||||||
$discount,
|
$discount,
|
||||||
$netTotal,
|
$netTotal,
|
||||||
|
$netTotal, // line_total
|
||||||
$line['tax_category'] ?? 'standard'
|
$line['tax_category'] ?? 'standard'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user