Compare commits

..

9 Commits

Author SHA1 Message Date
edmondlang 715635954a update file name 2022-04-07 12:30:39 +08:00
edmondlang 2919544769 Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into export-customer-order-list 2022-04-07 11:37:10 +08:00
edmondlang e3284fdf98 export customer order list 2022-04-07 11:36:03 +08:00
omair saleh bed78c053a remove memo 2022-04-07 10:59:50 +08:00
omair saleh 5b370a299c update pending delivery report excel 2022-04-06 16:01:31 +08:00
omair saleh e57dc231e6 update pending delivery report excel 2022-04-06 16:01:03 +08:00
omair saleh 5727801918 update pending delivery report excel 2022-04-06 15:59:28 +08:00
omair saleh bf325ff028 update pending delivery report excel 2022-04-06 15:55:31 +08:00
omair saleh 229e757663 Merge branch 'export-delivery-list' into 'master'
Export delivery list

See merge request CIEFWorldwideSdnBhd/shipping-portal!117
2022-04-06 07:32:01 +00:00
7 changed files with 236 additions and 56 deletions
@@ -0,0 +1,91 @@
<?php
namespace App\Classes\Modules\Exports\Services;
use App\Models\Container;
use App\Models\Package;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Carbon\Carbon;
class ExportsCompanyModuleSummary implements FromCollection, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize
{
use Exportable;
protected $companyModuleId, $containerIds;
public function headings(): array
{
return [
'Date',
'Full Marking',
'Container',
'Description',
'Ctns',
'L (cm)',
'H (cm)',
'W (cm)',
'CBM'
];
}
public function setParameters($companyModuleId, $containerIds)
{
$this->companyModuleId = $companyModuleId;
$this->containerIds = $containerIds;
}
/**
* @return \Illuminate\Support\Collection|mixed
*/
public function collection()
{
$packagesArray = collect();
$containers = Container::whereIn('reference', explode(',', $this->containerIds))->get();
foreach ($containers as $container){
$company_module_id = $this->companyModuleId;
$packingLists = $container->packingLists()->get()->filter(function ($packingList) use ($company_module_id) {
return $packingList->owner->company_module_id == $company_module_id;
});
foreach ($packingLists as $packingList){
if($packingList->packingLists->first()){
$packingList = $packingList->packingLists->first();
}
$packages = $packingList->packages;
foreach ($packages as $package){
$packagesArray->push($package);
}
}
}
return $packagesArray;
}
/**
* @param Package $package
*
* @return array
*/
public function map($package): array
{
$connection = $package->packingList->owner->companyModule->inviters()->withPivot('invitee_reference')->first();
$marking = $connection ? $connection->pivot->invitee_reference:'';
return [
Carbon::parse($package->created_at)->format('d-m-Y'),
$marking,
$package->packingList->containers()->first()->reference,
$package->description,
$package->quantity,
$package->length,
$package->height,
$package->width,
((($package->length / 100) * ($package->height / 100) * ($package->width / 100)) * $package->quantity)
];
}
}
@@ -20,16 +20,19 @@ class ExportsPendingArrangementDeliveryList implements FromQuery, WithHeadings,
public function headings(): array
{
return [
'Order Number',
'Container Ref.',
'ETA',
'Unstuffing',
'Marking',
'Order Number',
'Delay Days',
'Quantity',
'Remark',
'Contact Person Name',
'Contact Number',
'Delivery Date',
'Delivery Address',
'Delivery State',
'Delivery Postcode'
'State',
'Postcode',
'Address',
'PIC',
'Phone',
'Remark'
];
}
@@ -50,26 +53,29 @@ class ExportsPendingArrangementDeliveryList implements FromQuery, WithHeadings,
*/
public function map($packingList): array
{
$container = $packingList->containers()->first();
$ContainerTransport = $container->transports()->first();
$order = $packingList->owner;
$marking = $order->companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference;
$defaultAddress = $order->companyModule->addresses()->defaultAddress()->first();
$defaultAddress = $defaultAddress ? $defaultAddress : $order->companyModule->addresses()->first();
$address = $defaultAddress->street_one.', '.$defaultAddress->street_two.' '.$defaultAddress->district->name.' '.$defaultAddress->postcode.' '.$defaultAddress->state->name.' '.$defaultAddress->country->name;
$contacts = $defaultAddress->contacts->first() ? $defaultAddress->contacts->first(): '';
$address = $order->addresses()->where('status', ApprovalStatus::APPROVED)->first();
$contacts = $address->contacts->first() ? $address->contacts->first(): '';
$originalPackingList = $packingList->owner instanceof PackingList ? $packingList->owner : $packingList;
$transport = $originalPackingList->containers()->first()->transports()->first();
return [
$order->reference,
$container->reference,
$ContainerTransport->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()->eta,
$ContainerTransport->drop_date,
$marking,
$order->reference,
$transport ? Carbon::now()->diffInDays($transport->drop_date, false) . ' Days' : '',
$packingList->packages()->sum('quantity'),
$defaultAddress->remarks->first() ? $defaultAddress->remarks->first()->content: '',
$address->state->name,
$address->postcode,
$address->street_one.', '.$address->street_two.' '.$address->district->name.' '.$address->postcode.' '.$address->state->name.' '.$address->country->name,
$address->remarks->first() ? $address->remarks->first()->content: '',
$contacts ? $contacts ->reference : '',
$contacts ? $contacts ->phone : '',
$transport ? Carbon::now()->diffInDays($transport->drop_date, false) . ' Days' : '',
$address,
$defaultAddress->state->name,
$defaultAddress->postcode
];
}
}
@@ -0,0 +1,30 @@
<?php
namespace App\Http\Controllers\Exports;
use App\Classes\Modules\Exports\Services\ExportsCompanyModuleSummary;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Maatwebsite\Excel\Excel;
class ExportCompanyModuleSummaryController
{
/**
* ExportCompanyModuleSummaryController constructor.
* @param Request $request
*/
public function __construct(Request $request)
{
$token = Auth::fromUser(User::find(1));
$request->headers->set('Authorization', 'Bearer '.$token);
}
public function export(Request $request) {
$exportsCompanyModuleSummary = new ExportsCompanyModuleSummary($request);
$exportsCompanyModuleSummary->setParameters($request->route('company_module_id'), $request->input('containerNumber'));
$response = $exportsCompanyModuleSummary->download('customerid-markingno.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
ob_end_clean();
return $response;
}
}
@@ -82,16 +82,35 @@
</div>
</div>
</div>
<div class="row parentContainer" v-if="!item.identification">
<div class="row">
<div class="col">
<div class="row">
<div class="col no-padding">
<button class="btn btn-sm btn-success btn-block b-rad-none requestModal" data-type="identificationVerificationModal">Upload Identification</button>
<div class="row parentContainer" v-if="!item.identification">
<div class="col">
<div class="row">
<div class="col no-padding">
<button class="btn btn-sm btn-success btn-block b-rad-none requestModal" data-type="identificationVerificationModal">Upload Identification</button>
</div>
</div>
<modal-component type="identificationVerificationModal">
<identification-verification-form-component section="orderListSection" :data="item"></identification-verification-form-component>
</modal-component>
</div>
</div>
<div class="row parentContainer">
<div class="col no-padding">
<button type="button" class=" btn btn-sm btn-block p-t-10 p-b-10 p-r-35 p-l-35 btn-primary b-rad-none requestModal" data-type="exportCompanyModuleSummary">
<div class="row align-items-center">
<div class="col-auto p-r-0 p-l-0">
<i class="fa fa-file-excel-o fs-16"></i>
</div>
<div class="col p-r-5">Export To Excel</div>
</div>
</button>
<modal-component type="exportCompanyModuleSummary">
<export-company-module-summary-form-component section="exportCompanyModuleSummarySection" :data="item.company_module" @exit="closeModal"></export-company-module-summary-form-component>
</modal-component>
</div>
</div>
<modal-component type="identificationVerificationModal">
<identification-verification-form-component section="orderListSection" :data="item"></identification-verification-form-component>
</modal-component>
</div>
</div>
</div>
@@ -6,37 +6,6 @@
<customer-profile-component :data="company"></customer-profile-component>
</div>
</div>
<div class="alert alert-info padding-15" role="alert">
<div class="row">
<div class="col"></div>
<div class="col-auto">
<i class="fa fa-times text-info-darker pointer" data-dismiss="alert"></i>
</div>
</div>
<div class="row">
<div class="col">
<p>[清明节仓库放假通知 Qing Ming Warehouse Holiday Notice]<br>
尊敬的客户们<br>
仓库将为 2022年清明节假期做出如下安排 <br>
广州仓库 2022 4 4 - 2022 4 5 4月6日复工<br>
义乌仓库 2022 4 3 - 2022 4 4 4月5日复工<br>
*放假期间没有仓库人员值班 请大家安排好送货时间 感谢<br><br>
Dear Customers :<br>
Our warehouse holiday for Qing Ming is as below :<br>
Guangzhou : 4 April 2022 - 5 April 2022 (Resume date : 6 April)<br>
Yiwu : 3 April 2022 - 4 April 2022 (Resume date : 5 April)<br>
*Warehouse personnel are on leave during the holiday period, please arrange delivery date in advance, thank you</p>
</div>
</div>
</div>
<div class="row" v-show="!$store.getters.isShowing('createOrderForm')">
<div class="col">
<on-boarding-section-component v-if="!company.last_order"></on-boarding-section-component>
@@ -0,0 +1,63 @@
<template>
<div class="row">
<div class="col">
<loading-component style="height: 300px; top: 0;" key="1" color="success" v-show="isLoading" ></loading-component>
<div class="row justify-content-center" v-show="!isLoading">
<div class="col">
<div class="row m-b-20">
<div class="col">
<h3 class="all-caps text-center">Export Customer Summary</h3>
<div class="fs-11 text-center">Please key in the Container Number spereated by a comma.</div>
</div>
</div>
<div class="row m-b-15">
<div class="col">
<validation-wrapper-component :validator="$v.containerIds">
<label>Container Number</label>
<input class="form-control" v-model="containerIds">
</validation-wrapper-component>
</div>
</div>
<div class="row">
<div class="col p-r-5">
<div class="btn btn-sm btn-default bg-master-lighter btn-block b-rad-none" data-dismiss="modal">Cancel</div>
</div>
<div class="col p-l-5">
<div class="btn btn-sm btn-primary btn-block b-rad-none" @click="submitForm()">Confirm</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import componentHandler from '../../../general/mixins/componentHandler';
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
import { required } from "vuelidate/lib/validators";
export default {
data() {
return {
containerIds: '',
}
},
validations: {
containerIds: {
required
},
},
methods: {
submitForm() {
this.validate();
if(this.validate()){
this.$v.$reset();
this.closeModal();
window.open(this.route('customer.summary.export', this.item.id)+'?containerNumber='+this.containerIds, '_blank');
}
return;
}
},
mixins: [componentHandler, ModalFormHandler]
}
</script>
+2
View File
@@ -240,6 +240,8 @@ Route::get('/settings', function () {
return view('pages.settings');
})->name('settings');
Route::get('/customer/{company_module_id}/summary', 'Exports\ExportCompanyModuleSummaryController@export')->name('customer.summary.export');
Route::get('/customer/summary/monthly', function () {
// $containers = Container::whereMonth('loading_date', 1)->where('owner_id', 3)->get();
$containers = Container::whereIn('reference', ['EPS-3850', 'EPS-3863', 'WP-1331', 'EPS-3856'])->get();