修复进销存报表七月筛选 (#249)
This commit is contained in:
parent
5dab341631
commit
150df2d1cb
@ -549,7 +549,7 @@ class Pages extends Controller
|
||||
|| ! checkdate((int) $matches[2], 1, (int) $matches[1])) {
|
||||
$month = now()->startOfMonth()->subMonth()->format('Y-m');
|
||||
}
|
||||
$minimumMonth = substr(ThirdPartyWarehouseStorageMirrorRepository::START_DATE, 0, 7);
|
||||
$minimumMonth = substr(ThirdPartyWarehouseStorageMirrorRepository::INVENTORY_REPORT_START_DATE, 0, 7);
|
||||
if ($month < $minimumMonth) {
|
||||
$month = $minimumMonth;
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ class ThirdPartyWarehouseStorageMirrorRepository
|
||||
public const START_DATE = '2026-08-01';
|
||||
|
||||
/** Historical monthly report range can start one month before the flow page. */
|
||||
private const INVENTORY_REPORT_START_DATE = '2026-07-01';
|
||||
public const INVENTORY_REPORT_START_DATE = '2026-07-01';
|
||||
|
||||
/** @var array<string,string> */
|
||||
private const MOVEMENT_COLUMNS = [
|
||||
|
||||
@ -456,7 +456,7 @@
|
||||
<form method="GET" action="{{ request()->url() }}" class="installation-filter-bar" aria-label="进销存报表筛选查询栏">
|
||||
<label class="installation-filter-field">
|
||||
<span>月份:</span>
|
||||
<input type="month" name="month" min="2026-08" value="{{ request('month', now()->startOfMonth()->subMonth()->format('Y-m')) }}" aria-label="进销存报表月份">
|
||||
<input type="month" name="month" min="2026-07" value="{{ request('month', now()->startOfMonth()->subMonth()->format('Y-m')) }}" aria-label="进销存报表月份">
|
||||
</label>
|
||||
<label class="installation-filter-field">
|
||||
<span>商品编码:</span>
|
||||
|
||||
@ -51,6 +51,37 @@ class PagesTest extends FeatureTestCase
|
||||
])), false);
|
||||
}
|
||||
|
||||
public function testInventoryReportKeepsJulyMonthFilter(): void
|
||||
{
|
||||
$repository = Mockery::mock(ThirdPartyWarehouseStorageMirrorRepository::class);
|
||||
$repository->shouldReceive('available')->once()->andReturnTrue();
|
||||
$repository->shouldReceive('allWarehousesReady')->once()->andReturnTrue();
|
||||
$repository->shouldReceive('paginateMonthlyInventoryReport')->once()->with(
|
||||
[
|
||||
'month' => '2026-07',
|
||||
'product_code' => '',
|
||||
'warehouse_provider' => '',
|
||||
'category' => '',
|
||||
],
|
||||
1,
|
||||
Mockery::type('int'),
|
||||
)->andReturn([
|
||||
'data' => [],
|
||||
'total' => 0,
|
||||
'state' => ['status' => 'succeeded'],
|
||||
'sync' => ['code' => 'healthy'],
|
||||
]);
|
||||
$this->app->instance(ThirdPartyWarehouseStorageMirrorRepository::class, $repository);
|
||||
|
||||
$this->loginAs()->get(route('business.pages.show', [
|
||||
'section' => 'product-inventory',
|
||||
'page' => 'inventory-report',
|
||||
'month' => '2026-07',
|
||||
]))->assertOk()
|
||||
->assertSee('min="2026-07"', false)
|
||||
->assertSee('value="2026-07"', false);
|
||||
}
|
||||
|
||||
public function testInventoryReportExportUsesCurrentFiltersAndPageColumnOrder(): void
|
||||
{
|
||||
$filters = [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user