cqp 1 miesiąc temu
rodzic
commit
6232400bc3

+ 2 - 1
app/Exports/ManMonthlyWorkHourMultipleSheetExport.php

@@ -21,7 +21,8 @@ class ManMonthlyWorkHourMultipleSheetExport implements WithMultipleSheets
             $sheets[] = new ManMonthlyWorkHourSheetExport(
                 (string)$monthName,
                 $config['data'] ?? [],
-                (int)($config['days'] ?? 30)
+                (int)($config['days'] ?? 30),
+                $config['company_name']
             );
         }
         return $sheets;

+ 4 - 2
app/Exports/ManMonthlyWorkHourSheetExport.php

@@ -15,12 +15,14 @@ class ManMonthlyWorkHourSheetExport implements WithEvents, WithTitle
     protected $monthName;
     protected $data;
     protected $daysInMonth;
+    protected $company_name;
 
-    public function __construct(string $monthName, array $data, int $daysInMonth)
+    public function __construct(string $monthName, array $data, int $daysInMonth, string $company_name)
     {
         $this->monthName   = $monthName;
         $this->data        = $data;
         $this->daysInMonth = $daysInMonth;
+        $this->company_name = $company_name;
     }
 
     public function title(): string
@@ -46,7 +48,7 @@ class ManMonthlyWorkHourSheetExport implements WithEvents, WithTitle
 
                 // --- 2. 第二行:单位行 ---
                 $sheet->mergeCells("A2:{$highestColumn}2");
-                $sheet->setCellValue('A2', "单位:");
+                $sheet->setCellValue('A2', "单位:" . $this->company_name);
                 $sheet->getStyle('A2')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_LEFT);
 
                 // --- 3. 第三行表头设置 ---