parent
cd2004c5b2
commit
0484944cbc
@ -388,15 +388,31 @@ class DingProcessDetailMirrorRepository
|
||||
if ($paidStart !== '' && $paidEnd !== '' && $paidStart > $paidEnd) {
|
||||
[$paidStart, $paidEnd] = [$paidEnd, $paidStart];
|
||||
}
|
||||
if ($paidStart !== '') {
|
||||
$query->where('ding_process_detail_mirror.paid_at', '>=', $paidStart);
|
||||
}
|
||||
if ($paidEnd !== '') {
|
||||
$query->where(
|
||||
'ding_process_detail_mirror.paid_at',
|
||||
'<',
|
||||
Carbon::createFromFormat('Y-m-d', $paidEnd)->addDay()->toDateString(),
|
||||
);
|
||||
if ($paidStart !== '' || $paidEnd !== '') {
|
||||
$query->whereExists(function (Builder $paidProcess) use ($paidStart, $paidEnd): void {
|
||||
$paidProcess
|
||||
->selectRaw('1')
|
||||
->from('ding_process_detail_mirror as paid_detail')
|
||||
->whereColumn(
|
||||
'paid_detail.business_id',
|
||||
'ding_process_detail_mirror.business_id',
|
||||
)
|
||||
->whereColumn(
|
||||
'paid_detail.source_scope',
|
||||
'ding_process_detail_mirror.source_scope',
|
||||
);
|
||||
|
||||
if ($paidStart !== '') {
|
||||
$paidProcess->where('paid_detail.paid_at', '>=', $paidStart);
|
||||
}
|
||||
if ($paidEnd !== '') {
|
||||
$paidProcess->where(
|
||||
'paid_detail.paid_at',
|
||||
'<',
|
||||
Carbon::createFromFormat('Y-m-d', $paidEnd)->addDay()->toDateString(),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$waitingBucket = self::normalizeWaitingBucketFilter($filters['waiting_bucket'] ?? '');
|
||||
|
||||
@ -1196,6 +1196,7 @@
|
||||
<div class="process-details-note-content">
|
||||
<p>
|
||||
金额合计按审批费用明细汇总,付款明细合计按审批表单中的结构化付款明细汇总,不等同于出纳已确认付款;
|
||||
打款日期以审批单为准:审批单在所选期间有打款记录时,整张审批单的明细和付款金额都计入汇总;
|
||||
同一笔付款不会因关联多条费用而重复计算。付款状态按审批状态和已抓取的结构化付款事实判断;
|
||||
付款差额按“费用合计 − 付款明细合计”单独计算,不参与付款状态判断。
|
||||
审批中的流程在出现结构化付款事实前显示“待付款”,已有付款事实时显示“已付款”。
|
||||
|
||||
@ -141,22 +141,22 @@ class DingProcessDetailMirrorRepositoryTest extends TestCase
|
||||
public function test_paginate_applies_paid_date_range_status_and_keyword_filters(): void
|
||||
{
|
||||
$this->assertSame(
|
||||
1,
|
||||
2,
|
||||
$this->repository->paginate(['paid_date' => '2026-01-02'], 1, 50)['total'],
|
||||
);
|
||||
$this->assertSame(
|
||||
1,
|
||||
2,
|
||||
$this->repository->paginate(['paid_date' => '2026-02-03'], 1, 50)['total'],
|
||||
);
|
||||
$this->assertSame(
|
||||
2,
|
||||
4,
|
||||
$this->repository->paginate([
|
||||
'paid_start' => '2026-01-10',
|
||||
'paid_end' => '2026-02-10',
|
||||
], 1, 50)['total'],
|
||||
);
|
||||
$this->assertSame(
|
||||
2,
|
||||
4,
|
||||
$this->repository->paginate([
|
||||
'paid_start' => '2026-02-10',
|
||||
'paid_end' => '2026-01-10',
|
||||
@ -172,6 +172,27 @@ class DingProcessDetailMirrorRepositoryTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function test_paid_date_filters_the_approval_and_summarizes_all_approval_lines(): void
|
||||
{
|
||||
$result = $this->repository->paginate(['paid_date' => '2026-01-02'], 1, 50);
|
||||
|
||||
$this->assertSame(2, $result['summary']['rows']);
|
||||
$this->assertSame(1, $result['summary']['approvals']);
|
||||
$this->assertEqualsWithDelta(
|
||||
$result['summary']['bank_amount_total'],
|
||||
$result['summary']['amount_total'],
|
||||
0.001,
|
||||
);
|
||||
$this->assertSame(
|
||||
['2026-01-02 00:00', '2026-01-15 00:00'],
|
||||
array_column($result['data'], 'paid_at'),
|
||||
);
|
||||
$this->assertCount(
|
||||
2,
|
||||
iterator_to_array($this->repository->exportRows(['paid_date' => '2026-01-02'])),
|
||||
);
|
||||
}
|
||||
|
||||
public function test_paginate_applies_document_type_originator_and_business_id_filters(): void
|
||||
{
|
||||
$this->assertSame(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user