移除对账

This commit is contained in:
liu
2026-08-14 15:54:53 +08:00
parent 629d28a369
commit f0927e57e9
20 changed files with 1 additions and 2363 deletions
-74
View File
@@ -1,74 +0,0 @@
<?php
namespace App\Exports;
use App\Models\ReconciliationItemModel;
use App\Models\SettlementModel;
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithStyles;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
/**
* D10 结算表导出(结算头 + 来源对账单中该门店的明细)
*/
class SettlementExport implements FromCollection, WithHeadings, WithMapping, WithStyles
{
public function __construct(private readonly SettlementModel $settlement)
{
}
public function collection(): Collection
{
return ReconciliationItemModel::query()
->where('recon_id', $this->settlement->recon_id)
->where('store_id', $this->settlement->store_id)
->orderBy('sort')
->get();
}
public function headings(): array
{
return ['品名', '数量', '称重', '公布金额', '实际金额', '差额', '对账状态', '门店备注'];
}
public function map($item): array
{
return [
$item->product_name,
(float) $item->quantity,
(float) $item->weight,
(float) $item->publish_amount,
(float) $item->actual_amount,
(float) $item->diff_amount,
$item->is_reconciled ? '已对账' : '未对账',
$item->store_remark,
];
}
public function styles(Worksheet $sheet): array
{
$sheet->freezePane('A2');
return [
1 => ['font' => ['bold' => true]],
];
}
/**
* PDF 模板视图数据
*
* @return array{settlement: SettlementModel, storeName: string, reconNo: string, items: Collection}
*/
public function viewData(): array
{
return [
'settlement' => $this->settlement,
'storeName' => $this->settlement->store?->name ?? '',
'reconNo' => $this->settlement->recon?->recon_no ?? '',
'items' => $this->collection(),
];
}
}