E-Invoice - Automapping Issues, Sales Invoice Report (Import) with batch processing for E-Invoices

This commit is contained in:
Dillon Ngo
2025-07-28 23:52:51 +08:00
parent 6ce71a1259
commit e09fe86728
@@ -74,12 +74,21 @@ class ImportExcelLogic extends AbstractControllerLogic
'businessactivitydesc', 'debtorcode', 'tradename', 'address', 'postcode',
'phone', 'emailaddress', 'city', 'countrycode', 'statecode'
];
if (
($reportType === 'Sales Invoice Report' && $normalizedHeader !== $salesInvoiceHeader) ||
($reportType === 'Customers Report' && $normalizedHeader !== $customersReportHeader)
) {
if ($reportType === 'Sales Invoice Report') {
$optionalColumn = 'einvoicevalidationlink';
if (
$normalizedHeader !== $salesInvoiceHeader &&
$normalizedHeader !== [...$salesInvoiceHeader, $optionalColumn]
) {
throw new MalformedRequestException('Uploaded Excel file format is incorrect. Column headers do not match expected format.');
}
} elseif ($reportType === 'Customers Report' && $normalizedHeader !== $customersReportHeader) {
throw new MalformedRequestException('Uploaded Excel file format is incorrect. Column headers do not match expected format.');
}
$rows = $sheet->skip(1);
foreach ($rows as $index => $details) {