From 1f1b690515c01511b52e34b0fdc1c184296d221a Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Sat, 18 Jul 2026 15:36:57 +0530 Subject: [PATCH] Added serial export excel page --- app/Exports/SerialExport.php | 68 ++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 app/Exports/SerialExport.php diff --git a/app/Exports/SerialExport.php b/app/Exports/SerialExport.php new file mode 100644 index 0000000..153e5e9 --- /dev/null +++ b/app/Exports/SerialExport.php @@ -0,0 +1,68 @@ +itemCode = $itemCode; + $this->fromSerial = $fromSerial; + $this->toSerial = $toSerial; + } + + public function bindValue(Cell $cell, $value) + { + $cell->setValueExplicit((string) $value, DataType::TYPE_STRING); + + return true; + } + + public function collection() + { + $rows = []; + + for ($i = $this->fromSerial; $i <= $this->toSerial; $i++) { + $rows[] = [ + 'item_code' => $this->itemCode, + 'serial_number' => str_pad($i, 6, '0', STR_PAD_LEFT), + ]; + } + + return new Collection($rows); + } + + public function columnFormats(): array + { + return [ + 'B' => NumberFormat::FORMAT_TEXT, + ]; + } + + public function headings(): array + { + return [ + 'Item Code', + 'Serial Number', + ]; + } +}