Update: 2026-05-04 02:14:03
This commit is contained in:
@@ -91,28 +91,34 @@ if (move_uploaded_file($_FILES['invoice']['tmp_name'], $targetFile)) {
|
||||
buyer_tin, buyer_name, buyer_national_id,
|
||||
subtotal, tax_amount, discount_total, grand_total, currency_code,
|
||||
created_at
|
||||
) VALUES (?, ?, ?, ?, ?, ?, 'extracted', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW())
|
||||
) VALUES (
|
||||
:id, :tenant_id, :company_id, :uploaded_by, :path, 'extracted',
|
||||
:num, :date, :type, :cat, :s_tin, :s_name, :s_addr, :b_tin, :b_name, :b_nid,
|
||||
:sub, :tax, :disc, :total, :cur, NOW()
|
||||
)
|
||||
");
|
||||
|
||||
$stmt->execute([
|
||||
$invoiceId,
|
||||
$tenantId, $companyId, $userId, $targetFile,
|
||||
$extracted['invoice_number'] ?? null,
|
||||
$extracted['invoice_date'] ?? null,
|
||||
$extracted['invoice_type'] ?? 'cash',
|
||||
$extracted['invoice_category'] ?? 'simplified',
|
||||
// Encrypt sensitive details
|
||||
\App\Core\Encryption::encrypt($extracted['supplier_tin'] ?? ''),
|
||||
\App\Core\Encryption::encrypt($extracted['supplier_name'] ?? ''),
|
||||
\App\Core\Encryption::encrypt($extracted['supplier_address'] ?? ''),
|
||||
\App\Core\Encryption::encrypt($extracted['buyer_tin'] ?? ''),
|
||||
\App\Core\Encryption::encrypt($extracted['buyer_name'] ?? ''),
|
||||
\App\Core\Encryption::encrypt($extracted['buyer_national_id'] ?? ''),
|
||||
$extracted['subtotal'] ?? 0,
|
||||
$extracted['tax_amount'] ?? 0,
|
||||
$extracted['discount_total'] ?? 0,
|
||||
$extracted['grand_total'] ?? 0,
|
||||
$extracted['currency'] ?? 'JOD'
|
||||
'id' => $invoiceId,
|
||||
'tenant_id' => $tenantId,
|
||||
'company_id' => $companyId,
|
||||
'uploaded_by'=> $userId,
|
||||
'path' => $targetFile,
|
||||
'num' => $extracted['invoice_number'] ?? null,
|
||||
'date' => $extracted['invoice_date'] ?? null,
|
||||
'type' => $extracted['invoice_type'] ?? 'cash',
|
||||
'cat' => $extracted['invoice_category'] ?? 'simplified',
|
||||
's_tin' => \App\Core\Encryption::encrypt($extracted['supplier_tin'] ?? ''),
|
||||
's_name' => \App\Core\Encryption::encrypt($extracted['supplier_name'] ?? ''),
|
||||
's_addr' => \App\Core\Encryption::encrypt($extracted['supplier_address'] ?? ''),
|
||||
'b_tin' => \App\Core\Encryption::encrypt($extracted['buyer_tin'] ?? ''),
|
||||
'b_name' => \App\Core\Encryption::encrypt($extracted['buyer_name'] ?? ''),
|
||||
'b_nid' => \App\Core\Encryption::encrypt($extracted['buyer_national_id'] ?? ''),
|
||||
'sub' => $extracted['subtotal'] ?? 0,
|
||||
'tax' => $extracted['tax_amount'] ?? 0,
|
||||
'disc' => $extracted['discount_total'] ?? 0,
|
||||
'total' => $extracted['grand_total'] ?? 0,
|
||||
'cur' => $extracted['currency'] ?? 'JOD'
|
||||
]);
|
||||
|
||||
// Save Line Items
|
||||
|
||||
Reference in New Issue
Block a user