enable customer 769SMC summary in 2 different year 2022 and 2023

This commit is contained in:
edmondlang
2023-04-11 11:39:22 +08:00
parent fa0c97b1da
commit f7a9b2332c
+14 -3
View File
@@ -431,10 +431,21 @@ Route::get('/settings', function () {
Route::get('/customer/{company_module_id}/summary', 'Exports\ExportCompanyModuleSummaryController@export')->name('customer.summary.export');
Route::get('/export-customer-order/{marking}', 'Exports\ExportCompanyModuleSummaryController@exportorderSummaryByMarking')->name('customer.orderSummary.export');
Route::get('/customer/summary/monthly', function () {
Route::get('/customer/summary/{year}/monthly', function ($year) {
if (!in_array($year, [2022, 2023])) {
return 'Year Error!';
}
// $containers = Container::whereMonth('loading_date', '>=', ((float)Carbon::now()->format('m') - 2))->whereYear('loading_date', (float)Carbon::now()->format('Y'))->get();
// $containers = Container::whereMonth('loading_date', '>=', 1)->whereYear('loading_date', 2023)->get();
$containers = Container::whereMonth('loading_date', '>=', 9)->whereYear('loading_date', 2022)->get();
if ($year == 2022) {
$containers = Container::whereMonth('loading_date', '>=', 9)->whereYear('loading_date', 2022)->get();
}
if ($year == 2023) {
$containers = Container::whereMonth('loading_date', '>=', 1)->whereYear('loading_date', 2023)->get();
}
$marking = '769SMC';
$connection = CompanyConnection::where('invitee_reference', $marking)->first();
$companyModuleId = $connection->invitee->id;