|
|
@@ -79,7 +79,7 @@ class ProjectDepreciationSheetExport implements WithEvents, WithTitle
|
|
|
$dataRowsCount = count($items);
|
|
|
foreach ($items as $index => $item) {
|
|
|
$sheet->setCellValue("A{$currentRow}", $index + 1);
|
|
|
- $sheet->setCellValue("B{$currentRow}", $item['name'] ?? '');
|
|
|
+ $sheet->setCellValue("B{$currentRow}", $item['device_name'] ?? '');
|
|
|
$sheet->setCellValue("C{$currentRow}", $item['total_hours'] ?? 0);
|
|
|
$sheet->setCellValue("D{$currentRow}", $item['project_hours'] ?? 0);
|
|
|
$sheet->setCellValue("E{$currentRow}", ($item['ratio'] ?? 0) . '%');
|
|
|
@@ -103,7 +103,33 @@ class ProjectDepreciationSheetExport implements WithEvents, WithTitle
|
|
|
// 5. 合计行
|
|
|
$sheet->setCellValue("A{$currentRow}", "合计");
|
|
|
$sheet->mergeCells("A{$currentRow}:B{$currentRow}");
|
|
|
- // 这里可以填充合计逻辑...
|
|
|
+
|
|
|
+ $total = 0;
|
|
|
+ $totalProjectHours = 0;
|
|
|
+ $totalOriginalValue = 0;
|
|
|
+ $totalDepreciation = 0;
|
|
|
+ $totalConfirmedDepreciation = 0;
|
|
|
+ $totalAdjustAmount = 0;
|
|
|
+
|
|
|
+ foreach ($items as $item) {
|
|
|
+ $total += ($item['total_hours'] ?? 0);
|
|
|
+ $totalProjectHours += ($item['project_hours'] ?? 0);
|
|
|
+ $totalOriginalValue += ($item['original_value'] ?? 0);
|
|
|
+ $totalDepreciation += ($item['depreciation'] ?? 0);
|
|
|
+ $totalConfirmedDepreciation += ($item['confirmed_depreciation'] ?? 0);
|
|
|
+ $totalAdjustAmount += ($item['adjust_amount'] ?? 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ $sheet->setCellValue("C{$currentRow}", $total);
|
|
|
+ $sheet->setCellValue("D{$currentRow}", $totalProjectHours);
|
|
|
+ $sheet->setCellValue("F{$currentRow}", $totalOriginalValue);
|
|
|
+ $sheet->setCellValue("G{$currentRow}", $totalDepreciation);
|
|
|
+ $sheet->setCellValue("H{$currentRow}", $totalConfirmedDepreciation);
|
|
|
+ $sheet->setCellValue("J{$currentRow}", $totalAdjustAmount);
|
|
|
+
|
|
|
+ // 设置合计行样式:加粗
|
|
|
+ $sheet->getStyle("A{$currentRow}:J{$currentRow}")->getFont()->setBold(true);
|
|
|
+
|
|
|
$currentRow++;
|
|
|
|
|
|
// 6. 备注
|