Update: 2026-05-08 00:43:22

This commit is contained in:
Hamza-Ayed
2026-05-08 00:43:22 +03:00
parent 08e2a87c10
commit 522885d257
4 changed files with 79 additions and 34 deletions

View File

@@ -111,11 +111,11 @@ try {
// Save Lines
if (!empty($extracted['lines'])) {
$lineStmt = $db->prepare("INSERT INTO invoice_lines (id, invoice_id, line_number, description, quantity, unit_price, tax_rate, line_total) VALUES (?,?,?,?,?,?,?,?)");
$lineStmt = $db->prepare("INSERT INTO invoice_lines (id, invoice_id, line_number, description, quantity, unit_price, tax_rate, total_amount) VALUES (?,?,?,?,?,?,?,?)");
foreach ($extracted['lines'] as $idx => $line) {
$lineStmt->execute([
vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex(random_bytes(16)), 4)),
$invoiceId, $line['line_number'] ?? ($idx + 1), $line['description'] ?? '', $line['quantity'] ?? 1, $line['unit_price'] ?? 0, $line['tax_rate'] ?? 0, $line['line_total'] ?? 0
$invoiceId, $line['line_number'] ?? ($idx + 1), $line['description'] ?? '', $line['quantity'] ?? 1, $line['unit_price'] ?? 0, $line['tax_rate'] ?? 0, $line['line_total'] ?? $line['total_amount'] ?? 0
]);
}
}