账单导出

This commit is contained in:
2026-11-01 16:17:12 +08:00
parent f91939f1f0
commit c73910ba74
8 changed files with 69 additions and 9 deletions
+3 -1
View File
@@ -240,7 +240,7 @@ class BillExport implements FromCollection, WithStyles, WithTitle
}
/**
* 标题/列头/合计行加粗,合计行标签左合并 A:G;全表居中 + 全边框;金额列货币格式;
* 标题合并 A:H 并居中;标题/列头/合计行加粗,合计行标签左合并 A:G;全表居中 + 全边框;金额列货币格式;
* 数量(浅黄)/金额(浅红)非 0 条件填色(0 不填、列头固定填色),冻结列头
*/
public function styles(Worksheet $sheet): array
@@ -257,6 +257,8 @@ class BillExport implements FromCollection, WithStyles, WithTitle
$sheet->getColumnDimension('G')->setWidth(12);
$sheet->getColumnDimension('H')->setWidth(12);
$sheet->mergeCells('A1:H1');
foreach ($this->mergeRows as $row) {
$sheet->mergeCells('A' . $row . ':G' . $row);
}
+3 -1
View File
@@ -144,7 +144,7 @@ class ContainerReturnExport implements FromCollection, WithStyles, WithStrictNul
}
/**
* 标题/列头/合计行加粗;全表居中 + 全边框;金额区货币格式;
* 标题按实际列数合并居中;标题/列头/合计行加粗;全表居中 + 全边框;金额区货币格式;
* 门店列(浅蓝)/合计列(浅红)非 0 条件填色(0 不填、列头固定填色),冻结列头行
*/
public function styles(Worksheet $sheet): array
@@ -161,6 +161,8 @@ class ContainerReturnExport implements FromCollection, WithStyles, WithStrictNul
$storeIds = array_map(intval(...), array_keys($this->storeNames));
$lastColumn = Coordinate::stringFromColumnIndex($columnCount);
$sheet->mergeCells('A1:' . $lastColumn . '1');
// 全部单元格水平/垂直居中
$sheet->getStyle('A1:' . $lastColumn . $this->lastRow)
->getAlignment()
+2 -1
View File
@@ -252,7 +252,7 @@ class PurchaseOrderExport implements FromCollection, WithStrictNullComparison, W
}
/**
* 标题/列头/合计加粗;全表居中 + 全边框;金额类列货币格式;
* 标题按实际列数合并居中;标题/列头/合计加粗;全表居中 + 全边框;金额类列货币格式;
* 数量(浅黄)/门店数量(浅蓝)/金额(浅红)按值条件填色(0 不填、列头固定填色),冻结列头
*/
public function styles(Worksheet $sheet): array
@@ -279,6 +279,7 @@ class PurchaseOrderExport implements FromCollection, WithStrictNullComparison, W
}
// 全部单元格水平/垂直居中
$sheet->mergeCells('A1:' . $lastColumn . '1');
$sheet->getStyle('A1:' . $lastColumn . $this->lastRow)
->getAlignment()
->setHorizontal(Alignment::HORIZONTAL_CENTER)
+2 -1
View File
@@ -120,7 +120,7 @@ class PurchaseStoreSheet implements FromCollection, WithStrictNullComparison, Wi
}
/**
* 标题/列头/合计加粗;全表居中 + 全边框;金额类列货币格式;
* 标题合并 A:I 并居中;标题/列头/合计加粗;全表居中 + 全边框;金额类列货币格式;
* 数量(浅黄)/金额(浅红)按值条件填色(0 不填、列头固定填色),冻结列头
*/
public function styles(Worksheet $sheet): array
@@ -135,6 +135,7 @@ class PurchaseStoreSheet implements FromCollection, WithStrictNullComparison, Wi
}
// 全部单元格水平/垂直居中
$sheet->mergeCells('A1:I1');
$sheet->getStyle('A1:I' . $this->lastRow)
->getAlignment()
->setHorizontal(Alignment::HORIZONTAL_CENTER)
+6 -5
View File
@@ -122,7 +122,7 @@ class PurchaseSupplierSheet implements FromCollection, WithStrictNullComparison,
}
/**
* 标题合并 A1:C2、备注合并 D1:I2(红色 22 号字);标题/列头加粗;全表居中 + 全边框 + 列头行自动换行;
* 标题合并 A1:C2、备注从 D1 合并至实际末列(红色 22 号字);标题/列头加粗;全表居中 + 全边框 + 列头行自动换行;
* 汇总列(浅黄)/门店数量列(浅蓝)按值条件填色(0 不填、列头固定填色),冻结列头
*/
public function styles(Worksheet $sheet): array
@@ -131,16 +131,17 @@ class PurchaseSupplierSheet implements FromCollection, WithStrictNullComparison,
$sheet->freezePane('A' . ($this->headerRow + 1));
// 标题合并前三列占两行(A1:C2),备注合并六列两行(D1:I2)
$sheet->mergeCells('A1:C2');
$sheet->mergeCells('D1:I2');
$widths = [24, 10, 6];
foreach ($widths as $index => $width) {
$sheet->getColumnDimension(Coordinate::stringFromColumnIndex($index + 1))->setWidth($width);
}
$storeIds = array_map('intval', array_keys($this->stores));
$lastColumn = Coordinate::stringFromColumnIndex(3 + max(count($storeIds), 1));
// 标题占前三列,备注占其余实际表格列,均合并两行
$sheet->mergeCells('A1:C2');
$sheet->mergeCells('D1:' . $lastColumn . '2');
foreach ($storeIds as $i => $storeId) {
$sheet->getColumnDimension(Coordinate::stringFromColumnIndex(4 + $i))->setWidth(6);
}