diff --git a/app/Classes/General/Eloquent/Filters/OwneId.php b/app/Classes/General/Eloquent/Filters/OwneId.php
deleted file mode 100644
index eac7e32d..00000000
--- a/app/Classes/General/Eloquent/Filters/OwneId.php
+++ /dev/null
@@ -1,20 +0,0 @@
-where('owner_id', $value);
- }
-
-}
\ No newline at end of file
diff --git a/app/Classes/Modules/PackingLists/Processors/FetchOrderListsFromYdPortalProcessor.php b/app/Classes/Modules/PackingLists/Processors/FetchOrderListsFromYdPortalProcessor.php
index f0ea5ed7..4cd92f9d 100644
--- a/app/Classes/Modules/PackingLists/Processors/FetchOrderListsFromYdPortalProcessor.php
+++ b/app/Classes/Modules/PackingLists/Processors/FetchOrderListsFromYdPortalProcessor.php
@@ -181,16 +181,38 @@ class FetchOrderListsFromYdPortalProcessor
$eta = Carbon::parse($tracking[2]);
}
- if (strpos($trackingRow->tracking, '预计船时间为') !== false) {
- $tracking = explode('预计船时间为', $trackingRow->tracking);
- $delayDate = Carbon::parse(explode('日', $tracking[1])[0]);
+ $rescheduleETD = strpos($trackingRow->remark, '开') || strpos($trackingRow->remark, '到港');
+ $rescheduleETA = strpos($trackingRow->remark, '到港');
+ if (($rescheduleETD !== false || $rescheduleETA !== false) && strpos($trackingRow->tracking, '货物装柜完成。') === false) {
+ preg_match_all('/([0-9]+.{3})/', $trackingRow->remark, $matches);
+ $dates = collect();
+
+ foreach($matches[0] as $date){
+ try {
+ $dates->push(Carbon::parse(str_replace('.', '/', $date).Carbon::now()->format('Y')));
+ } catch (\Exception $exception) {
+ continue;
+ }
+
+ }
+
+ $rescheduleDate = $dates->sortDesc()->first();
+ if(!$delayDate || $rescheduleDate > $delayDate){
+ /** @var Carbon $delayDate */
+ $delayDate = $rescheduleDate;
+
+ if($rescheduleETA === false && $delayDate) {
+ $delayDate = $delayDate->addDays('5');
+ }
+ }
+
}
- if (strpos($trackingRow->tracking, '预计开船为') !== false) {
- $tracking = explode('预计开船为', $trackingRow->tracking);
- $delayDate = Carbon::parse(explode('日', $tracking[1])[0]);
+ if ($trackingRow->tracking === '已开船') {
+ $delayDate = Carbon::parse($trackingRow->trackingtime)->addDays('5');
}
+
if ($trackingRow->tracking === '货物已进目的港仓库') {
$unstuffingDate = Carbon::parse($trackingRow->trackingtime);
}
@@ -344,7 +366,7 @@ class FetchOrderListsFromYdPortalProcessor
$transport = $container->transports()->first();
- if(!$transport->schedules()->where('eta', '=', $delayDate)->first()) {
+ if(!$transport->schedules()->whereDate('eta', '>=', $delayDate)->first()) {
$etd = $transport->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()->etd;
$transport->schedules()->update(['status' => ApprovalStatus::EXPIRED]);
$this->createsSchedule->execute($transport, new ScheduleObject($etd, $delayDate, ApprovalStatus::APPROVED));
diff --git a/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantLogic.php b/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantLogic.php
index dac04ec7..b7186064 100644
--- a/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantLogic.php
+++ b/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantLogic.php
@@ -76,7 +76,7 @@ class UpdateConstantLogic extends AbstractControllerLogic
public function logic(Request $request) : JsonResponse
{
- $object = new ConstantObject($request->input('name'), $request->input('reference'), $request->input('detail'));
+ $object = new ConstantObject($request->input('reference'), $request->input('value'));
$segment = $this->fetchesSegment->execute(['id' => $request->route('id')]);
diff --git a/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantPostcodeLogic.php b/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantPostcodeLogic.php
new file mode 100644
index 00000000..82edc1a2
--- /dev/null
+++ b/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantPostcodeLogic.php
@@ -0,0 +1,99 @@
+ 'Updated Segment Constant',
+ 'message' => 'You have successfully updated the Segment Constant'
+ ];
+ }
+
+ /** @var CanUpdateConstant */
+ private $canUpdateConstant;
+
+ /** @var UpdatesConstant */
+ private $updatesConstant;
+
+ /** @var FetchesSegment */
+ private $fetchesSegment;
+
+ /** @var FetchesConstant */
+ private $fetchesConstant;
+
+ /** @var AddItemToConstantValueArray */
+ private $addItemToConstantValueArray;
+
+ /** @var RemoveItemFromConstantValueArray */
+ private $removeItemFromConstantValueArray;
+
+
+ /**
+ * UpdateConstantLogic constructor.
+ * @param CanUpdateConstant $canUpdateConstant
+ * @param UpdatesConstant $updatesConstant
+ * @param FetchesSegment $fetchesSegment
+ * @param FetchesConstant $fetchesConstant
+ * @param AddItemToConstantValueArray $addItemToConstantValueArray
+ * @param RemoveItemFromConstantValueArray $removeItemFromConstantValueArray
+ */
+ public function __construct(CanUpdateConstant $canUpdateConstant, UpdatesConstant $updatesConstant, FetchesSegment $fetchesSegment, FetchesConstant $fetchesConstant,AddItemToConstantValueArray $addItemToConstantValueArray, RemoveItemFromConstantValueArray $removeItemFromConstantValueArray)
+ {
+ $this->canUpdateConstant = $canUpdateConstant;
+ $this->updatesConstant = $updatesConstant;
+ $this->fetchesSegment = $fetchesSegment;
+ $this->fetchesConstant = $fetchesConstant;
+ $this->addItemToConstantValueArray = $addItemToConstantValueArray;
+ $this->removeItemFromConstantValueArray = $removeItemFromConstantValueArray;
+ }
+ /**
+ * @param Request $request
+ * @return JsonResponse
+ * @throws \App\Classes\Exceptions\AccessForbiddenException
+ * @throws \App\Classes\Exceptions\MalformedRequestException
+ * @throws \App\Classes\Exceptions\RequestValidationException
+ */
+ public function logic(Request $request) : JsonResponse
+ {
+ $segment = $this->fetchesSegment->execute(['id' => $request->route('id')]);
+
+ $constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference')]);
+
+ $object = new ConstantObject($constant->reference, $this->addItemToConstantValueArray->execute($constant->value, $request->input('postcode')));
+ $this->canUpdateConstant->passes($object);
+
+ $constant = $this->updatesConstant->execute($constant, $object);
+
+ $oppositeConstant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference') == SegmentConstants::CENTER_POSTCODE ? SegmentConstants::OUTSTATION_POSTCODE : SegmentConstants::CENTER_POSTCODE]);
+
+ $oppositeObject = new ConstantObject($request->input('reference') == SegmentConstants::CENTER_POSTCODE ? SegmentConstants::OUTSTATION_POSTCODE : SegmentConstants::CENTER_POSTCODE, $this->removeItemFromConstantValueArray->execute($oppositeConstant->value, $request->input('postcode')));
+
+ $oppositeConstant = $this->updatesConstant->execute($oppositeConstant, $oppositeObject);
+
+
+ return $this->response([
+ 'CENTER_POSTCODE' => $constant->reference == SegmentConstants::CENTER_POSTCODE ? new ConstantResource($constant) : New ConstantResource($oppositeConstant),
+ 'OUTSTATION_POSTCODE' => $constant->reference == SegmentConstants::OUTSTATION_POSTCODE ? new ConstantResource($constant) : New ConstantResource($oppositeConstant),
+ ]);
+ }
+
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantStateLogic.php b/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantStateLogic.php
new file mode 100644
index 00000000..6dca08a6
--- /dev/null
+++ b/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantStateLogic.php
@@ -0,0 +1,87 @@
+ 'Updated Segment Constant',
+ 'message' => 'You have successfully updated the Segment Constant'
+ ];
+ }
+
+ /** @var CanUpdateConstant */
+ private $canUpdateConstant;
+
+ /** @var UpdatesConstant */
+ private $updatesConstant;
+
+ /** @var FetchesSegment */
+ private $fetchesSegment;
+
+ /** @var FetchesConstant */
+ private $fetchesConstant;
+
+ /** @var UpdatesConstantValueByState */
+ private $updatesConstantValueByState;
+
+
+ /**
+ * UpdateConstantLogic constructor.
+ * @param CanUpdateConstant $canUpdateConstant
+ * @param UpdatesConstant $updatesConstant
+ * @param FetchesSegment $fetchesSegment
+ * @param FetchesConstant $fetchesConstant
+ * @param UpdatesConstantValueByState $updatesConstantValueByState
+ */
+ public function __construct(CanUpdateConstant $canUpdateConstant, UpdatesConstant $updatesConstant, FetchesSegment $fetchesSegment, FetchesConstant $fetchesConstant,UpdatesConstantValueByState $updatesConstantValueByState)
+ {
+ $this->canUpdateConstant = $canUpdateConstant;
+ $this->updatesConstant = $updatesConstant;
+ $this->fetchesSegment = $fetchesSegment;
+ $this->fetchesConstant = $fetchesConstant;
+ $this->updatesConstantValueByState = $updatesConstantValueByState;
+ }
+ /**
+ * @param Request $request
+ * @return JsonResponse
+ * @throws \App\Classes\Exceptions\AccessForbiddenException
+ * @throws \App\Classes\Exceptions\MalformedRequestException
+ * @throws \App\Classes\Exceptions\RequestValidationException
+ */
+ public function logic(Request $request) : JsonResponse
+ {
+ $segment = $this->fetchesSegment->execute(['id' => $request->route('id')]);
+
+ $constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => SegmentConstants::STATE_RATE]);
+
+ $constantValue = $this->updatesConstantValueByState->execute($constant->value, $request->input('status_id'), $request->input('rate'));
+
+ $object = new ConstantObject(SegmentConstants::STATE_RATE, (array) $constantValue);
+ $this->canUpdateConstant->passes($object);
+
+ $constant = $this->updatesConstant->execute($constant, $object);
+
+
+ return $this->resourceResponse(new ConstantResource($constant));
+ }
+
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Segments/DataTransferObjects/ConstantObject.php b/app/Classes/Modules/Segments/DataTransferObjects/ConstantObject.php
index d5373a68..ebd5d2e4 100644
--- a/app/Classes/Modules/Segments/DataTransferObjects/ConstantObject.php
+++ b/app/Classes/Modules/Segments/DataTransferObjects/ConstantObject.php
@@ -7,34 +7,22 @@ use App\Classes\General\Interfaces\DataTransferObject;
class ConstantObject implements DataTransferObject
{
- /** @var string */
- private $name;
-
/** @var string */
private $reference;
/** @var array */
- private $detail;
+ private $value;
/**
* ConstantObject constructor.
* @param string $name
* @param string $reference
- * @param array $detail
+ * @param array $value
*/
- public function __construct(string $name, string $reference, array $detail)
+ public function __construct(string $reference, array $value)
{
- $this->name = $name;
$this->reference = $reference;
- $this->detail = $detail;
- }
-
- /**
- * @return string
- */
- public function getName(): string
- {
- return $this->name;
+ $this->value = $value;
}
/**
@@ -48,9 +36,9 @@ class ConstantObject implements DataTransferObject
/**
* @return array
*/
- public function getDetail(): array
+ public function getValue(): array
{
- return $this->detail;
+ return $this->value;
}
diff --git a/app/Classes/Modules/Segments/Services/AddItemToConstantValueArray.php b/app/Classes/Modules/Segments/Services/AddItemToConstantValueArray.php
new file mode 100644
index 00000000..af6d053b
--- /dev/null
+++ b/app/Classes/Modules/Segments/Services/AddItemToConstantValueArray.php
@@ -0,0 +1,19 @@
+reference === SegmentConstants::SUPPLIER_CURRENCIES) {
- return property_exists($constant->detail, 'id') ? new CurrencyResource($this->fetchesCurrency->execute(['id' => $constant->detail->id])) : '';
- }
+ // if($constant->reference === SegmentConstants::SUPPLIER_CURRENCIES) {
+ // return property_exists($constant->detail, 'id') ? new CurrencyResource($this->fetchesCurrency->execute(['id' => $constant->detail->id])) : '';
+ // }
- return $constant->detail;
+ return $constant->value;
}
diff --git a/app/Classes/Modules/Segments/Services/CreatesConstant.php b/app/Classes/Modules/Segments/Services/CreatesConstant.php
index b2addae8..48c1d018 100644
--- a/app/Classes/Modules/Segments/Services/CreatesConstant.php
+++ b/app/Classes/Modules/Segments/Services/CreatesConstant.php
@@ -18,9 +18,8 @@ class CreatesConstant extends AbstractUpdateRelationshipRecord
public function execute(Segment $segment, ConstantObject $object)
{
$model = new SegmentConstant();
- $model->name = $object->getName();
$model->reference = $object->getReference();
- $model->detail = json_encode($object->getDetail());
+ $model->value = json_encode($object->getValue());
return $this->handler($segment->constants(), $model);
}
diff --git a/app/Classes/Modules/Segments/Services/RemoveItemFromConstantValueArray.php b/app/Classes/Modules/Segments/Services/RemoveItemFromConstantValueArray.php
new file mode 100644
index 00000000..9eec46e5
--- /dev/null
+++ b/app/Classes/Modules/Segments/Services/RemoveItemFromConstantValueArray.php
@@ -0,0 +1,22 @@
+ $value){
+ if($array[$key] == $item){
+ unset($array[$key]);
+ }
+ }
+ return array_values($array);
+ }
+
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Segments/Services/UpdatesConstant.php b/app/Classes/Modules/Segments/Services/UpdatesConstant.php
index 13fb22c1..b8e8ec18 100644
--- a/app/Classes/Modules/Segments/Services/UpdatesConstant.php
+++ b/app/Classes/Modules/Segments/Services/UpdatesConstant.php
@@ -17,9 +17,8 @@ class UpdatesConstant extends AbstractUpdateRecord
*/
public function execute(SegmentConstant $model, ConstantObject $object)
{
- $model->name = $object->getName();
$model->reference = $object->getReference();
- $model->detail = json_encode($object->getDetail());
+ $model->value = json_encode($object->getValue());
return $this->handler($model);
}
diff --git a/app/Classes/Modules/Segments/Services/UpdatesConstantValueByState.php b/app/Classes/Modules/Segments/Services/UpdatesConstantValueByState.php
new file mode 100644
index 00000000..ae8728fa
--- /dev/null
+++ b/app/Classes/Modules/Segments/Services/UpdatesConstantValueByState.php
@@ -0,0 +1,32 @@
+config as $key => $object){
+ if($object->status_id == $status_id){
+ $newArray->config[$key] = (object) [
+ 'rate' => $rate,
+ 'status_id' => $object->status_id,
+ 'outstation_rate' => $object->outstation_rate,
+ ];
+ }else{
+ $newArray->config[$key] = $object;
+ }
+ }
+ return $newArray;
+
+ }
+
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Segments/Standards/Validators/ConstantValidation.php b/app/Classes/Modules/Segments/Standards/Validators/ConstantValidation.php
index d5ac8819..eb66adb5 100644
--- a/app/Classes/Modules/Segments/Standards/Validators/ConstantValidation.php
+++ b/app/Classes/Modules/Segments/Standards/Validators/ConstantValidation.php
@@ -15,9 +15,8 @@ class ConstantValidation extends AbstractValidation
protected function data($object): array {
$data = [
- 'name' => $object->getName(),
'reference' => $object->getReference(),
- 'detail' => $object->getDetail()
+ 'value' => $object->getValue()
];
return $data;
@@ -28,9 +27,8 @@ class ConstantValidation extends AbstractValidation
*/
protected function rules(): array {
return [
- 'name' => 'required',
'reference' => 'required',
- 'detail' => 'required'
+ 'value' => 'required'
];
}
diff --git a/app/Http/Controllers/Orders/DownloadOrderQrPdfController.php b/app/Http/Controllers/Orders/DownloadOrderQrPdfController.php
index 3218be52..fa264a03 100644
--- a/app/Http/Controllers/Orders/DownloadOrderQrPdfController.php
+++ b/app/Http/Controllers/Orders/DownloadOrderQrPdfController.php
@@ -24,7 +24,7 @@ class DownloadOrderQrPdfController
$warehousePrefix = '';
$deliveryPrefix = '';
$customerMarking = '';
- $remark = $warehouse->remarks()->first()->content;
+ $remark = $warehouse->remarks()->first();
if($warehouse->reference === WarehouseReferences::VT_GUANG_ZHOU || $warehouse->reference === WarehouseReferences::VT_YIWU) {
$customerMarking = $order->companyModule->connections()->first()->invitee_reference.'/';
@@ -44,11 +44,11 @@ class DownloadOrderQrPdfController
if($warehouse->reference === WarehouseReferences::YD_GUANG_ZHOU){
$warehousePrefix = 'YD/';
- if(strtolower($deliveryAddress->state->name) === 'sabah' || strtolower($deliveryAddress->state->name) === 'labuan') {
+ if(strtolower($deliveryAddress->state->name) === 'sabah' || strtolower($deliveryAddress->state->name) === 'labuan' || in_array(strtolower($deliveryAddress->district->name), ['limbang', 'lawas'])) {
$warehousePrefix = 'KK/';
}
- if(strtolower($deliveryAddress->state->name) === 'sarawak') {
+ if(strtolower($deliveryAddress->state->name) === 'sarawak' && !in_array(strtolower($deliveryAddress->district->name), ['limbang', 'lawas'])) {
$warehousePrefix = 'KU/';
}
}
@@ -60,7 +60,7 @@ class DownloadOrderQrPdfController
'delivery_address' => $deliveryAddress,
'warehouse_address' => $warehouseAddress,
'warehouse_contacts' => $warehouseContacts,
- 'remark' => $remark
+ 'remark' => $remark ? $remark->content : ''
];
$pdf = LaravelMpdf::loadView('pdfs.qr', $data, [], [
diff --git a/app/Http/Controllers/Reports/MonthlyReportController.php b/app/Http/Controllers/Reports/MonthlyReportController.php
index 20c90e70..fdb218e6 100644
--- a/app/Http/Controllers/Reports/MonthlyReportController.php
+++ b/app/Http/Controllers/Reports/MonthlyReportController.php
@@ -200,4 +200,62 @@ class MonthlyReportController
})->sum('quantity'),
]]))->handler();
}
+
+ public function customerActivityReport(Request $request): JsonResponse {
+
+ $active_start = $request->input('active_start');
+ $active_end = $request->input('active_end');
+ $inactive_start = $request->input('inactive_start');
+ $inactive_end = $request->input('inactive_end');
+ $minCbm = $request->input('cbm');
+ $minOrders = $request->input('minOrders');
+
+ $activeCompanies = CompanyModule::where('type', \App\Classes\ValueObjects\Constants\BusinessType::IMPORTER)->whereHas('orderPackingLists', function($query) use($inactive_start, $inactive_end) {
+ return $query->where('packing_lists.type', \App\Classes\ValueObjects\Constants\PackingListType::WAREHOUSE_RECEIVE_LIST)->whereHas('transports', function ($query) use ($inactive_start, $inactive_end) {
+ return $query->where('drop_date', '>=', \Carbon\Carbon::parse($inactive_start))->where('drop_date', '<=', \Carbon\Carbon::parse($inactive_end)->addDay());
+ });
+ })->pluck('id');
+
+ $companies = CompanyModule::where('type', \App\Classes\ValueObjects\Constants\BusinessType::IMPORTER)->whereHas('orderPackingLists', function($query) use($active_start, $active_end) {
+ return $query->where('packing_lists.type', \App\Classes\ValueObjects\Constants\PackingListType::WAREHOUSE_RECEIVE_LIST)->whereHas('transports', function ($query) use ($active_start, $active_end) {
+ return $query->whereDate('drop_date', '>=', \Carbon\Carbon::parse($active_start))->whereDate('drop_date', '<=', \Carbon\Carbon::parse($active_end)->addDay());
+ });
+ })->whereNotIn('id', $activeCompanies)->get();
+
+ $customerActivityData = [];
+ $counter = 1;
+
+ foreach ($companies as $key => $company){
+ $connection = $company->inviters()->withPivot('invitee_reference')->first();
+ $marking = $connection ? $connection->pivot->invitee_reference:'';
+ $packingList = $company->orderPackingLists()->where('packing_lists.type', \App\Classes\ValueObjects\Constants\PackingListType::SHIPPING_PACKING_LIST)->get();
+ $totalCbm = $packingList->flatMap(function ($packingList) {
+ return $packingList->packages;
+ })->sum(function($package){
+ return (( (float) $package->width / 100) * ( (float) $package->length / 100) * ( (float) $package->height / 100)) * $package->quantity;
+ });
+
+ if ($minCbm != 'null' && $totalCbm < $minCbm) { continue; }
+
+ if ($minOrders != 'null' && $packingList->count() < $minOrders) { continue; }
+
+ array_push($customerActivityData, array(
+ 'key' => $counter,
+ 'marking' => $marking,
+ 'packingListCount'=> $packingList->count(),
+ 'totalCbm'=> $totalCbm,
+ ));
+ $counter ++;
+ }
+
+ return (new ApiResponseObject('fetch service report Successful',
+ '',
+ HttpStatus::OK_WITH_MESSAGE, ['data' => [
+ 'active_start' => Carbon::parse($active_start)->format('d/m/Y'),
+ 'active_end' => Carbon::parse($active_end)->format('d/m/Y'),
+ 'inactive_start' => Carbon::parse($inactive_start)->format('d/m/Y'),
+ 'inactive_end' => Carbon::parse($inactive_end)->format('d/m/Y'),
+ 'customerActivityData' => $customerActivityData,
+ ]]))->handler();
+ }
}
diff --git a/app/Http/Controllers/Segments/UpdateConstantPostcodeController.php b/app/Http/Controllers/Segments/UpdateConstantPostcodeController.php
new file mode 100644
index 00000000..5d0098ed
--- /dev/null
+++ b/app/Http/Controllers/Segments/UpdateConstantPostcodeController.php
@@ -0,0 +1,20 @@
+execute($request);
+ }
+
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/Segments/UpdateConstantStateController.php b/app/Http/Controllers/Segments/UpdateConstantStateController.php
new file mode 100644
index 00000000..33e52100
--- /dev/null
+++ b/app/Http/Controllers/Segments/UpdateConstantStateController.php
@@ -0,0 +1,20 @@
+execute($request);
+ }
+
+}
\ No newline at end of file
diff --git a/app/Http/Resources/ConstantResource.php b/app/Http/Resources/ConstantResource.php
index c6bcf344..aba82526 100644
--- a/app/Http/Resources/ConstantResource.php
+++ b/app/Http/Resources/ConstantResource.php
@@ -19,9 +19,8 @@ class ConstantResource extends JsonResource
{
return [
'id' => $this->id,
- 'name' => $this->name,
'reference' => $this->reference,
- 'detail' => (App()->make(ConvertsConstantDetailsToResource::class))->execute($this->resource)
+ 'value' => (App()->make(ConvertsConstantDetailsToResource::class))->execute($this->resource)
];
}
}
diff --git a/resources/assets/vue/components/reports/sections/CustomerActivityReportSectionComponent.vue b/resources/assets/vue/components/reports/sections/CustomerActivityReportSectionComponent.vue
new file mode 100644
index 00000000..eef94603
--- /dev/null
+++ b/resources/assets/vue/components/reports/sections/CustomerActivityReportSectionComponent.vue
@@ -0,0 +1,145 @@
+
+ List of customers active between {{ activityData.active_start }} - {{ activityData.active_end }} & inactive between {{ activityData.active_start }} - {{ activityData.active_end }}
+
+
+
+
+ #
+ marking
+ Number of Orders
+ CBM
+
+
+ {{item.key}}
+ {{ item.marking }}
+ {{ item.packingListCount }}
+ {{ item.totalCbm }}
+
仓库地址:
{{$warehouse_address->state->name.' '.$warehouse_address->district->name.' '.$warehouse_address->street_one.' '.$warehouse_address->street_two.' 邮编:'.$warehouse_address->postcode}}
联系:@foreach($warehouse_contacts as $contact){{ $loop->first ? '' : ' / ' }}{{ $contact->phone.' '.$contact->reference }}@endforeach
-{{$remark}}
+{!! $remark !!}
diff --git a/routes/report.php b/routes/report.php index cd084cf6..1be3fe62 100644 --- a/routes/report.php +++ b/routes/report.php @@ -10,4 +10,6 @@ Route::group(['prefix' => 'report', 'as' => 'report.', 'namespace' => 'Reports'] Route::get('/profit/{model}/{value}/{from?}/{to?}', 'MonthlyReportController@profitModelReport')->name('profit'); Route::get('/service', 'MonthlyReportController@serviceReport')->name('service'); + + Route::get('/customers/active', 'MonthlyReportController@customerActivityReport')->name('customerActivity'); }); diff --git a/routes/segment.php b/routes/segment.php index ada2b84d..d4406d71 100644 --- a/routes/segment.php +++ b/routes/segment.php @@ -13,5 +13,7 @@ Route::group(['prefix' => 'segment', 'as' => 'segment.', 'namespace' => 'Segment Route::put('/service/update', 'UpdateCustomServiceConstantController@update')->name('service.update'); Route::put('/update', 'UpdateConstantController@update')->name('update'); Route::get('/show/{reference}', 'FetchConstantController@fetch')->name('show'); + Route::put('/update/state', 'UpdateConstantStateController@update')->name('update.state'); + Route::put('/update/postcode', 'UpdateConstantPostcodeController@update')->name('update.postcode'); }); }); \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 5b08b9e2..9bcda09f 100644 --- a/routes/web.php +++ b/routes/web.php @@ -239,6 +239,54 @@ Route::get('/settings', function () { return view('pages.settings'); })->name('settings'); +Route::get('/customer/summary/monthly', function () { +// $containers = Container::whereMonth('loading_date', 1)->where('owner_id', 3)->get(); + $containers = Container::whereIn('reference', ['SM21-166', 'SM21-168', 'SM21-170', 'SM21-171', 'SM21-172', 'SM21-173', 'EPS-3833'])->get(); + foreach ($containers as $container){ + $packingLists = $container->packingLists()->get()->filter(function ($packingList) { + return $packingList->owner->company_module_id === 248; + }); + + if (!count($packingLists)) continue; + + echo '| Date | +Full Marking | +Container | +Description | +Ctns | +L (cm) | +H (cm) | +W (cm) | +CBM | +
|---|---|---|---|---|---|---|---|---|
| - | +MS/CIEF/769SMC/'.$packingList->owner->reference.' | +'.$container->reference.' | +'.$package->description.' | +'.$package->quantity.' | +'.$package->length.' | +'.$package->height.' | +'.$package->width.' | +'.((($package->length / 100) * ($package->height / 100) * ($package->width / 100)) * $package->quantity).' | +
| # | +marking | +Number of Orders | +CBM | +
|---|---|---|---|
| '.$key.' | +'.$marking.' | +'. $packingList->count() .' | +'. $totalCbm .' | +