Refactor the shipping rate import process to support bidirectional data handling (import/export) and implement currency conversion using system settings. Update the price calculator to ensure valid zone data is retrieved. - Update `ShippingRatesImport` to handle both import and export directions via `SimpleRateSheetImport`. - Implement AED to IRR conversion during rate importation using `SystemSetting`. - Add validation for zone numbers and rate values during import. - Enhance `PriceCalculatorService` to filter for non-zero zone values. - Add various debug and testing scripts for pricing and data structure verification.
30 lines
968 B
PHP
30 lines
968 B
PHP
<?php
|
|
require 'vendor/autoload.php';
|
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
|
|
|
$file = 'storage/app/public/01KYWGVNKS5TNMN37RV77PCYNZ.xlsx';
|
|
$spreadsheet = IOFactory::load($file);
|
|
|
|
$sheets = ['DocNor', 'DocEco', 'Parcel', 'Import Rate', 'Export Rate'];
|
|
|
|
foreach ($sheets as $sheetName) {
|
|
$sheet = $spreadsheet->getSheetByName($sheetName);
|
|
if (!$sheet) {
|
|
echo "Sheet '$sheetName' not found" . PHP_EOL;
|
|
continue;
|
|
}
|
|
|
|
echo "=== Sheet: $sheetName ===" . PHP_EOL;
|
|
echo "Total rows: " . $sheet->getHighestRow() . PHP_EOL;
|
|
echo "Total cols: " . $sheet->getHighestColumn() . PHP_EOL;
|
|
|
|
// Print first 10 rows
|
|
for ($row = 1; $row <= min(10, $sheet->getHighestRow()); $row++) {
|
|
$rowData = $sheet->rangeToArray("A{$row}:J{$row}")[0];
|
|
echo "Row $row: " . implode(' | ', array_map(function($cell) {
|
|
return $cell === null ? '(null)' : $cell;
|
|
}, $rowData)) . PHP_EOL;
|
|
}
|
|
echo PHP_EOL;
|
|
}
|