应付款终版货款对账:新增「入库单号/采购单号/对账人」列
「月份」后补入库单号、采购单号,末尾「未发出」后补对账人;导入模板/表格/导入/编辑/导出同一套字段,只作用于终版目录。
This commit is contained in:
parent
da2a26c485
commit
f596a09f9f
@ -34,9 +34,21 @@ class PayablesFinalRegistry
|
||||
/** 所有终版导入模板都带“月份”列,方便按月导入和查看。 */
|
||||
private const MONTH_FIELD = ['summary_month' => ['label' => '月份', 'type' => 'month']];
|
||||
|
||||
/** 供应商应付(终版)在基础字段之后追加的列(只影响终版目录,基础目录的「未发出」另有口径)。 */
|
||||
/**
|
||||
* 供应商应付(终版)在基础字段前后追加的列(只影响终版目录,基础目录对应列另有口径):
|
||||
* 货款对账在「月份」后补入库单号、采购单号,在末尾补未发出、对账人。
|
||||
*/
|
||||
private const SUPPLIER_EXTRA_FIELDS = [
|
||||
'payment-reconciliation' => ['unsent' => ['label' => '未发出', 'type' => 'text']],
|
||||
'payment-reconciliation' => [
|
||||
'before' => [
|
||||
'stockNo' => ['label' => '入库单号', 'type' => 'text'],
|
||||
'purchaseNo' => ['label' => '采购单号', 'type' => 'text'],
|
||||
],
|
||||
'after' => [
|
||||
'unsent' => ['label' => '未发出', 'type' => 'text'],
|
||||
'reconciler' => ['label' => '对账人', 'type' => 'text'],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
public function __construct(
|
||||
@ -84,6 +96,8 @@ class PayablesFinalRegistry
|
||||
? $this->productPrices->templateFields()
|
||||
: $this->supplier->fields($dataset);
|
||||
|
||||
return self::MONTH_FIELD + $fields + (self::SUPPLIER_EXTRA_FIELDS[$dataset] ?? []);
|
||||
$extra = self::SUPPLIER_EXTRA_FIELDS[$dataset] ?? [];
|
||||
|
||||
return self::MONTH_FIELD + ($extra['before'] ?? []) + $fields + ($extra['after'] ?? []);
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ class SupplierPayableFinalPagesTest extends FeatureTestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function test_final_payment_reconciliation_template_adds_unsent_as_the_last_column(): void
|
||||
public function test_final_payment_reconciliation_template_keeps_the_extra_columns_in_order(): void
|
||||
{
|
||||
$response = $this->loginAs()
|
||||
->get(route('business.supplier-payables-final.payment-reconciliation.template'))
|
||||
@ -84,24 +84,25 @@ class SupplierPayableFinalPagesTest extends FeatureTestCase
|
||||
try {
|
||||
file_put_contents($path, $response->streamedContent());
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($path);
|
||||
$header = $spreadsheet->getSheet(0)->rangeToArray('A1:Q1')[0];
|
||||
$header = $spreadsheet->getSheet(0)->rangeToArray('A1:T1')[0];
|
||||
$spreadsheet->disconnectWorksheets();
|
||||
|
||||
$this->assertSame([
|
||||
'记录标识', '月份', '供应商', '货号', '商品编码', '规格名称', '数量', '单价', '金额',
|
||||
'预估单价', '预估金额', '供应商商品编码', '备注', '仓库名称', '快递名称', '快递单号', '未发出',
|
||||
'记录标识', '月份', '入库单号', '采购单号', '供应商', '货号', '商品编码', '规格名称', '数量', '单价',
|
||||
'金额', '预估单价', '预估金额', '供应商商品编码', '备注', '仓库名称', '快递名称', '快递单号',
|
||||
'未发出', '对账人',
|
||||
], $header);
|
||||
} finally {
|
||||
@unlink($path);
|
||||
}
|
||||
}
|
||||
|
||||
public function test_final_payment_reconciliation_import_keeps_the_unsent_column(): void
|
||||
public function test_final_payment_reconciliation_import_keeps_the_extra_columns(): void
|
||||
{
|
||||
$file = UploadedFile::fake()->createWithContent(
|
||||
'payment-reconciliation.csv',
|
||||
"\xEF\xBB\xBF月份,供应商,货号,商品编码,规格名称,数量,单价,金额,预估单价,预估金额,供应商商品编码,备注,仓库名称,快递名称,快递单号,未发出\n"
|
||||
. "2026-09,终版供应商,X-1,P-1,规格甲,2,10,20,9,18,SC-1,备注甲,华东仓,顺丰,SF-1,未发出\n",
|
||||
"\xEF\xBB\xBF月份,入库单号,采购单号,供应商,货号,商品编码,规格名称,数量,单价,金额,预估单价,预估金额,供应商商品编码,备注,仓库名称,快递名称,快递单号,未发出,对账人\n"
|
||||
. "2026-09,RK-1,CG-1,终版供应商,X-1,P-1,规格甲,2,10,20,9,18,SC-1,备注甲,华东仓,顺丰,SF-1,未发出,对账人甲\n",
|
||||
);
|
||||
|
||||
$this->loginAs()
|
||||
@ -120,12 +121,18 @@ class SupplierPayableFinalPagesTest extends FeatureTestCase
|
||||
'page' => 'payment-reconciliation',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSeeText('入库单号')
|
||||
->assertSeeText('采购单号')
|
||||
->assertSeeText('对账人')
|
||||
->assertSeeText('RK-1')
|
||||
->assertSeeText('CG-1')
|
||||
->assertSeeText('未发出')
|
||||
->assertSeeText('对账人甲')
|
||||
->assertSeeText('SF-1');
|
||||
|
||||
$export = $this->loginAs()->get(route('business.supplier-payables-final.payment-reconciliation.export'));
|
||||
$export->assertOk();
|
||||
$this->assertStringContainsString('快递单号,未发出', $export->streamedContent());
|
||||
$this->assertStringContainsString('快递单号,未发出,对账人', $export->streamedContent());
|
||||
}
|
||||
|
||||
public function test_product_price_final_page_reuses_the_price_template_columns(): void
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user