From d045e0401d499d980a9c7b99c6ef2a7d35834645 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Sat, 3 Sep 2022 15:03:17 +0800 Subject: [PATCH 1/2] billing segment --- .../Filters/DoesNotHaveTransactionType.php | 3 + .../General/Eloquent/Filters/SegmentIdIn.php | 20 +++ .../Services/AssignsCompanyToSegment.php | 6 +- .../CreateShippingInvoiceTransactionLogic.php | 71 ++++++---- .../Constants/TransactionDetailType.php | 4 +- ...onnectionToConnectionSegmentController.php | 2 +- app/Http/Resources/CompanyResource.php | 1 + app/Http/Resources/OrderResource.php | 34 ++--- app/Http/Resources/PackingListResource.php | 11 +- database/seeders/SegmentsTableSeeder.php | 7 +- .../elements/CustomerProfileComponent.vue | 26 ++++ .../forms/AssignSegmentFormComponent.vue | 73 ++++++++++ .../forms/DetachSegmentFormComponent.vue | 44 ++++++ .../sections/OrderProfileSectionComponent.vue | 2 +- .../AdminPaymentsBillingComponent.vue | 38 ++++-- resources/views/layouts/base_pdf.blade.php | 128 +++++++++++++++++- .../pages/pdfs/shipping_invoice.blade.php | 49 +++---- resources/views/pages/settings.blade.php | 2 +- resources/views/partials/menu.blade.php | 2 +- routes/company.php | 8 +- 20 files changed, 436 insertions(+), 95 deletions(-) create mode 100644 app/Classes/General/Eloquent/Filters/SegmentIdIn.php create mode 100644 resources/assets/vue/components/companies/forms/AssignSegmentFormComponent.vue create mode 100644 resources/assets/vue/components/companies/forms/DetachSegmentFormComponent.vue diff --git a/app/Classes/General/Eloquent/Filters/DoesNotHaveTransactionType.php b/app/Classes/General/Eloquent/Filters/DoesNotHaveTransactionType.php index 3568ac3b..486819bf 100644 --- a/app/Classes/General/Eloquent/Filters/DoesNotHaveTransactionType.php +++ b/app/Classes/General/Eloquent/Filters/DoesNotHaveTransactionType.php @@ -2,6 +2,7 @@ namespace App\Classes\General\Eloquent\Filters; +use Carbon\Carbon; use Illuminate\Database\Eloquent\Builder; class DoesNotHaveTransactionType implements Filter @@ -15,6 +16,8 @@ class DoesNotHaveTransactionType implements Filter { return $builder->whereDoesntHave('transactions', function (Builder $query) use($value) { $query->where('type', $value); + })->whereHas('containers', function ($query){ + return $query->whereDate('loading_date', '>=', Carbon::parse('08-08-2022')); }); } } \ No newline at end of file diff --git a/app/Classes/General/Eloquent/Filters/SegmentIdIn.php b/app/Classes/General/Eloquent/Filters/SegmentIdIn.php new file mode 100644 index 00000000..de66a61f --- /dev/null +++ b/app/Classes/General/Eloquent/Filters/SegmentIdIn.php @@ -0,0 +1,20 @@ +whereIn('segment_id', $value); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Companies/Services/AssignsCompanyToSegment.php b/app/Classes/Modules/Companies/Services/AssignsCompanyToSegment.php index 81b6e964..9c54d401 100644 --- a/app/Classes/Modules/Companies/Services/AssignsCompanyToSegment.php +++ b/app/Classes/Modules/Companies/Services/AssignsCompanyToSegment.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\Companies\Services; use App\Classes\Exceptions\MalformedRequestException; use App\Classes\General\Eloquent\AbstractUpdateRecord; +use App\Classes\ValueObjects\Constants\BusinessType; use App\Models\Company; use App\Models\Segment; use Illuminate\Database\QueryException; @@ -19,8 +20,9 @@ class AssignsCompanyToSegment extends AbstractUpdateRecord public function execute(Company $company, Segment $segment) { try { - - $company->segments()->attach($segment); + $companyModule = $company->companyModules()->where('type', BusinessType::IMPORTER)->first(); + $connection = $companyModule->connections()->where('inviter_reference', 'CIEF'); + $connection->segments()->attach($segment); return $company; diff --git a/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php index 50b6165f..dd64c5e9 100644 --- a/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php +++ b/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php @@ -6,6 +6,8 @@ namespace App\Classes\Modules\Transactions\ControllersLogic; use App\Classes\General\Abstracts\AbstractControllerLogic; use App\Classes\Modules\PackingLists\Services\FetchesPackingList; use App\Classes\Modules\SegmentConstants\Services\FetchesSegmentConstant; +use App\Classes\Modules\Segments\Services\ListsConstants; +use App\Classes\Modules\Segments\Services\ListsSegments; use App\Classes\Modules\Transactions\Services\GeneratesTransactionBillNumber; use App\Classes\Modules\Transactions\Services\CreatesTransaction; use App\Classes\Modules\Transactions\Services\CreatesTransactionDetail; @@ -24,7 +26,9 @@ use App\Classes\ValueObjects\Constants\PackageType; use App\Classes\ValueObjects\Constants\SegmentConstants; use App\Classes\ValueObjects\Constants\TransactionDetailType; +use App\Http\Resources\PackingListResource; use App\Models\Document; +use App\Models\PackingList; use App\Models\Transaction; use Carbon\Carbon; use Illuminate\Http\JsonResponse; @@ -36,7 +40,6 @@ use Meneses\LaravelMpdf\Facades\LaravelMpdf; class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic { - /** * @return array */ @@ -53,6 +56,9 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic /** @var FetchesSegmentConstant */ private $fetchesSegmentConstant; + /** @var ListsConstants */ + private $listsConstants; + /** @var GeneratesTransactionBillNumber */ private $generatesTransactionBillNumber; @@ -67,20 +73,24 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic /** @var CreatesFiles */ private $createsFile; - - public function __construct( - FetchesPackingList $fetchesPackingList, - FetchesSegmentConstant $fetchesSegmentConstant, - GeneratesTransactionBillNumber $generatesTransactionBillNumber, - CreatesTransaction $createsTransaction, - CreatesTransactionDetail $createsTransactionDetail, - CreatesDocument $createsDocument, - CreatesFiles $createsFile - ) - { + + /** + * CreateShippingInvoiceTransactionLogic constructor. + * @param FetchesPackingList $fetchesPackingList + * @param FetchesSegmentConstant $fetchesSegmentConstant + * @param ListsConstants $listsConstants + * @param GeneratesTransactionBillNumber $generatesTransactionBillNumber + * @param CreatesTransaction $createsTransaction + * @param CreatesTransactionDetail $createsTransactionDetail + * @param CreatesDocument $createsDocument + * @param CreatesFiles $createsFile + */ + public function __construct(FetchesPackingList $fetchesPackingList, FetchesSegmentConstant $fetchesSegmentConstant, ListsConstants $listsConstants, GeneratesTransactionBillNumber $generatesTransactionBillNumber, CreatesTransaction $createsTransaction, CreatesTransactionDetail $createsTransactionDetail, CreatesDocument $createsDocument, CreatesFiles $createsFile) + { $this->fetchesPackingList = $fetchesPackingList; $this->fetchesSegmentConstant = $fetchesSegmentConstant; + $this->listsConstants = $listsConstants; $this->generatesTransactionBillNumber = $generatesTransactionBillNumber; $this->createsTransaction = $createsTransaction; $this->createsTransactionDetail = $createsTransactionDetail; @@ -88,6 +98,7 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic $this->createsFile = $createsFile; } + public function logic(Request $request) : JsonResponse { $packing_list = $this->fetchesPackingList->execute(['id' => $request->input('packing_list_id')]); @@ -100,22 +111,33 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic return ($package->width / 100) * ($package->height / 100) *($package->length / 100) * ($package->quantity); }); + $minimum_charges = ($cbm + $over_weight_cbm) < 0.3 ? (0.3 - ($cbm + $over_weight_cbm)) : 0; + $order = $packing_list->owner; $address = $order->addresses()->first(); + $segments = $order->companyModule->connections->first()->segments->pluck('id'); + + $segment_price = 0; $base_price_constant = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => SegmentConstants::BASE_PRICE]); + + if(count($segments)){ + $segment_price_constants = $this->listsConstants->execute(['segment_id_in' => $segments, 'reference' => SegmentConstants::CUSTOM_PRICE]); + $segment_price_constant = $segment_price_constants->sortBy(function ($constant){ + return $constant->value[0]; + })->first(); + $segment_price = $segment_price_constant->value[0]; + + } + $warehouse_rate_constant = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => SegmentConstants::WAREHOUSE_RATE]); $state_rate_constant = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => SegmentConstants::STATE_RATE]); $center_postcode_constant = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => SegmentConstants::CENTER_POSTCODE]); $outstation_postcode_constant = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => SegmentConstants::OUTSTATION_POSTCODE]); - - $base_price = 0; - $warehouse_rate = 0; - $state_rate = 0; $state_select = ''; - $base_price = $this->getConstantByKey($base_price_constant, date('Y-m-d')); - + $packing_list_drop_date = Carbon::parse(PackingList::where('reference', $packing_list->reference)->where('type', 1)->first()->transports->first()->drop_date)->format('Y-m-d'); + $base_price = $this->getConstantByKey($base_price_constant, $packing_list_drop_date); $warehouseId = $order->orderRoles()->where('role_id', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->company_module_id; $selected_warehouse_rate = $this->getConstantByKey($warehouse_rate_constant, $warehouseId); $warehouse_rate = is_object($selected_warehouse_rate) ? $selected_warehouse_rate->amount : 0; @@ -128,12 +150,15 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic $this->checkPostcodeExistInConstant($center_postcode_constant, $postcode) === true ? $state_select = 'center' : '' ; $this->checkPostcodeExistInConstant($outstation_postcode_constant, $postcode) === true ? $state_select = 'outstation' : '' ; $state_rate_constant = (array)$state_rate_constant; - $state_rate = $state_select == '' ? 0 : $state_rate_constant[$state_select]; + $state_rate = $state_select == '' ? 0 : $state_rate_constant['center'] + ($state_select === 'outstation' ? $state_rate_constant['outstation'] : 0); + + $price_cbm = $base_price + $segment_price + $warehouse_rate + $state_rate; - $price_cbm = $base_price + $warehouse_rate + $state_rate; $total_cbm = $price_cbm * ($cbm + $over_weight_cbm); - $billNumber = $this->generatesTransactionBillNumber->execute('SHIP-'); + + + $billNumber = $this->generatesTransactionBillNumber->execute('SI-'); $object = new TransactionObject( $billNumber, @@ -158,7 +183,7 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic $object_detail = new TransactionDetailObject( 'SHIPPING_FEE', - TransactionDetailType::SHIPPING_FEE, + TransactionDetailType::SHIPPING_FEE.'
'.round($packing_list->packages->sum('quantity'), 3).' CTNS - '.$cbm.' CBM', $cbm, $price_cbm ); @@ -176,7 +201,7 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic $this->createsTransactionDetail->execute($invoice_transaction, $object_detail); } - return $this->response([]); + return $this->resourceResponse(new PackingListResource($packing_list)); } function getConstantByKey($segmentConstantObject, $key) { diff --git a/app/Classes/ValueObjects/Constants/TransactionDetailType.php b/app/Classes/ValueObjects/Constants/TransactionDetailType.php index b3e1541c..aa9e835c 100644 --- a/app/Classes/ValueObjects/Constants/TransactionDetailType.php +++ b/app/Classes/ValueObjects/Constants/TransactionDetailType.php @@ -4,9 +4,9 @@ namespace App\Classes\ValueObjects\Constants; final class TransactionDetailType { - public const SHIPPING_FEE = 'Shipping Fee'; + public const SHIPPING_FEE = 'X1 Freight Service Charge'; - public const OVER_WEIGHT_CHARGES = 'Over weight charges'; + public const OVER_WEIGHT_CHARGES = 'Overweight Charges'; public const CUSTOM_CHARGES = 'Custom charges'; } diff --git a/app/Http/Controllers/Companies/AssignCompanyConnectionToConnectionSegmentController.php b/app/Http/Controllers/Companies/AssignCompanyConnectionToConnectionSegmentController.php index fab9e692..e22c554f 100644 --- a/app/Http/Controllers/Companies/AssignCompanyConnectionToConnectionSegmentController.php +++ b/app/Http/Controllers/Companies/AssignCompanyConnectionToConnectionSegmentController.php @@ -10,7 +10,7 @@ class AssignCompanyConnectionToConnectionSegmentController { /** * @param Request $request - * @param AssignCompanyToSegmentLogic $logic + * @param AssignCompanyConnectionToConnectionSegmentLogic $logic * @return JsonResponse */ public function assign(Request $request, AssignCompanyConnectionToConnectionSegmentLogic $logic): JsonResponse { diff --git a/app/Http/Resources/CompanyResource.php b/app/Http/Resources/CompanyResource.php index 8e27ab73..899a9405 100644 --- a/app/Http/Resources/CompanyResource.php +++ b/app/Http/Resources/CompanyResource.php @@ -27,6 +27,7 @@ class CompanyResource extends JsonResource 'type' => (int) $this->type, 'business_type' => (int) $this->business_type, 'status' => (int) $this->status, + 'segments' => SegmentResource::collection($companyModule->connections()->first()->segments), 'contact' => new ContactResource ($this->when($this->has('contacts'), $this->contacts->first())), 'employee' => new UserResource($companyModule->employees()->first()), 'company_module' => new CompanyModuleResource($companyModule), diff --git a/app/Http/Resources/OrderResource.php b/app/Http/Resources/OrderResource.php index d2c72930..d25ecce9 100644 --- a/app/Http/Resources/OrderResource.php +++ b/app/Http/Resources/OrderResource.php @@ -29,23 +29,23 @@ class OrderResource extends JsonResource 'warehouse' => new CompanyModuleResource($this->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->appointee), 'address' => new AddressResource($this->addresses()->where('status', '=', ApprovalStatus::APPROVED)->first()), 'address_change_request' => new AddressResource($this->addressesPendingVerification()->first()), - 'parcels' => $this->whenLoaded('packingLists', function() { - return [ - 'origin_warehouse_packages' => PackingListResource::collection( - $this->originWarehousePackages()->get() - ), - 'in_transit_packages' => PackingListResource::collection( - $this->inTransitPackages()->get() - ), - 'destination_warehouse_packages' => PackingListResource::collection( - $this->destinationWarehousePackages()->get() - ), - 'delivered_packages' => PackingListResource::collection( - $this->deliveredPackages()->get() - ), - 'received_packages' => PackingListResource::collection($this->packingLists()->where('type', PackingListType::WAREHOUSE_RECEIVE_LIST)->whereHas('packages')->get()), - ]; - }), +// 'parcels' => $this->whenLoaded('packingLists', function() { +// return [ +// 'origin_warehouse_packages' => PackingListResource::collection( +// $this->originWarehousePackages()->get() +// ), +// 'in_transit_packages' => PackingListResource::collection( +// $this->inTransitPackages()->get() +// ), +// 'destination_warehouse_packages' => PackingListResource::collection( +// $this->destinationWarehousePackages()->get() +// ), +// 'delivered_packages' => PackingListResource::collection( +// $this->deliveredPackages()->get() +// ), +// 'received_packages' => PackingListResource::collection($this->packingLists()->where('type', PackingListType::WAREHOUSE_RECEIVE_LIST)->whereHas('packages')->get()), +// ]; +// }), 'remarks' => RemarkResource::collection($this->remarks), 'created_at' => $this->created_at->format('d-m-Y') ]; diff --git a/app/Http/Resources/PackingListResource.php b/app/Http/Resources/PackingListResource.php index 5256e3de..2c9463e8 100644 --- a/app/Http/Resources/PackingListResource.php +++ b/app/Http/Resources/PackingListResource.php @@ -2,11 +2,13 @@ namespace App\Http\Resources; +use App\Classes\ValueObjects\Constants\ApprovalStatus; use App\Classes\ValueObjects\Constants\PackingListType; use App\Classes\ValueObjects\Constants\TransactionType; use App\Classes\ValueObjects\Constants\RoleTypes; use App\Models\Order; use App\Models\PackingList; +use Carbon\Carbon; use Illuminate\Http\Resources\Json\JsonResource; class PackingListResource extends JsonResource @@ -27,14 +29,17 @@ class PackingListResource extends JsonResource 'claimant_id' => $this->claimant_id, 'reference' => $this->reference, 'status' => $this->status, - 'transport' => new TransportResource($this->transports()->first()), +// 'transport' => new TransportResource($this->transports()->first()), 'type' => $this->type, - 'receive_packing_list' => $this->when($this->type === PackingListType::SHIPPING_PACKING_LIST, new PackingListResource(PackingList::where('reference', $this->reference)->where('type', PackingListType::WAREHOUSE_RECEIVE_LIST)->first())), +// 'receive_packing_list' => $this->when($this->type === PackingListType::SHIPPING_PACKING_LIST, new PackingListResource(PackingList::where('reference', $this->reference)->where('type', PackingListType::WAREHOUSE_RECEIVE_LIST)->first())), 'packages' => PackageResource::collection($packages), $this->mergeWhen($this->owner instanceof Order, [ 'order' => New OrderResource($this->owner) ]), - 'shippng_transaction' => new TransactionResource($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->first()), + 'shippng_transaction' => new TransactionResource($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereNotIn('status', [ApprovalStatus::SUSPENDED, ApprovalStatus::EXPIRED])->first()), + 'suspended_invoice' => new TransactionResource($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::SUSPENDED])->first()), + // 'suspended_invoices' => TransactionResource::collection($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::SUSPENDED])->get()), + 'loading_days_ago' => $this->containers()->first()->loading_date->diffForHumans() ]; } } diff --git a/database/seeders/SegmentsTableSeeder.php b/database/seeders/SegmentsTableSeeder.php index 72545884..807441c7 100644 --- a/database/seeders/SegmentsTableSeeder.php +++ b/database/seeders/SegmentsTableSeeder.php @@ -15,12 +15,7 @@ class SegmentsTableSeeder extends Seeder 'id' => 1, 'company_module_id' => 1, 'name' => 'Default Segment', - ], - [ - 'id' => 2, - 'company_module_id' => 2, - 'name' => 'Normal Member', - ], + ] ] ); } diff --git a/resources/assets/vue/components/companies/elements/CustomerProfileComponent.vue b/resources/assets/vue/components/companies/elements/CustomerProfileComponent.vue index 512fa04d..8b0b6625 100644 --- a/resources/assets/vue/components/companies/elements/CustomerProfileComponent.vue +++ b/resources/assets/vue/components/companies/elements/CustomerProfileComponent.vue @@ -30,6 +30,32 @@ +
+
+
+ +
+
+
+
+
+ {{segment.name}} + +
+ + + +
+
+
+ + + +
+
diff --git a/resources/assets/vue/components/companies/forms/AssignSegmentFormComponent.vue b/resources/assets/vue/components/companies/forms/AssignSegmentFormComponent.vue new file mode 100644 index 00000000..bb96c859 --- /dev/null +++ b/resources/assets/vue/components/companies/forms/AssignSegmentFormComponent.vue @@ -0,0 +1,73 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/companies/forms/DetachSegmentFormComponent.vue b/resources/assets/vue/components/companies/forms/DetachSegmentFormComponent.vue new file mode 100644 index 00000000..7e87816d --- /dev/null +++ b/resources/assets/vue/components/companies/forms/DetachSegmentFormComponent.vue @@ -0,0 +1,44 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/orders/sections/OrderProfileSectionComponent.vue b/resources/assets/vue/components/orders/sections/OrderProfileSectionComponent.vue index a0880e40..5597261e 100644 --- a/resources/assets/vue/components/orders/sections/OrderProfileSectionComponent.vue +++ b/resources/assets/vue/components/orders/sections/OrderProfileSectionComponent.vue @@ -134,7 +134,7 @@
-
+
diff --git a/resources/assets/vue/components/paymentsBilling/elements/AdminPaymentsBillingComponent.vue b/resources/assets/vue/components/paymentsBilling/elements/AdminPaymentsBillingComponent.vue index 535ecfdc..4c2c0ab8 100644 --- a/resources/assets/vue/components/paymentsBilling/elements/AdminPaymentsBillingComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/elements/AdminPaymentsBillingComponent.vue @@ -9,9 +9,9 @@
{{item.order.company_module.marking}}/{{item.order.reference}} -

{{item.receive_packing_list.transport.drop_date}}

+

{{item.loading_days_ago}}

-
Unclaimed Packing List
+
Unclaimed Packing List
@@ -28,7 +28,7 @@
n/a
MYR {{ item.shippng_transaction.amount.toFixed(2) }}
-
+
@@ -53,7 +53,24 @@
-
Generate Invoice
+
+
+
Add Billing Address
+ + + +
+
+
Define Location
+ + + +
+
Generate Invoice
+
+
+ +
@@ -65,19 +82,23 @@
-
+

Container Reference

-
{{ item.packages.length ? item.packages[0].container.container_reference : 'n/a' }}
+
{{ item.packages[0].container ? item.packages[0].container.container_reference : 'n/a' }}
+
n/a

Due Date

-
{{ item.packages[0].container.transport.drop_date == null ? item.packages[0].container.transport.current_schedule.etd : item.packages[0].container.transport.drop_date }}
+
+
{{ item.packages[0].container.transport.drop_date == null ? item.packages[0].container.transport.current_schedule.etd : item.packages[0].container.transport.drop_date }}
+
n/a
+
n/a
n/a
@@ -191,8 +212,7 @@
MYR {{(Math.round((item.shippng_transaction.outstanding + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
- -
+
Make Payment
diff --git a/resources/views/layouts/base_pdf.blade.php b/resources/views/layouts/base_pdf.blade.php index ce46ac4f..8659c709 100644 --- a/resources/views/layouts/base_pdf.blade.php +++ b/resources/views/layouts/base_pdf.blade.php @@ -11,9 +11,135 @@ body { font-family: sun-extA; - padding: 0; } + .header { + margin-top: 5em; + } + + .separator { + text-align: right; + border-bottom: 0.5px solid black; + font-size: 0.7em; + } + + img.logo { + top: 10px; + } + + img { + height: 6em; + width: 9em; + } + + .title { + font-size: 2em; + font-weight: 1200; + } + + .details { + display: inline-block; + position: relative; + + } + + .sub-title { + font-size: 1.3em; + font-weight: bold; + } + + .label { + font-size: 1.1em; + font-weight: bold; + } + + .bill-to { + margin-top: 30px; + } + + table { + width: 100%; + vertical-align: top; + } + + th { + border-bottom: 1px solid black; + } + + td { + padding: 0.4em; + /* text-align: center; */ + } + + td.title { + text-align: left; + } + td.description, + th.description { + text-align: justify; + max-width: 40em; + } + + td.stock-code, + th.stock-code { + text-align: center; + } + + th { + vertical-align: middle; + } + + td, + th { + /* margin-top: 0.6em; + margin-right: 0.6em; */ + } + + .subtotal td { + border-top: 1px solid black; + } + + .total { + border-top: 1px solid black; + border-bottom: 3px double black; + font-weight: bolder; + } + + .address {} + + */ td.header-logo { + /* text-align: left; */ + width: fit-content; + } + + td.header-cief-address { + text-align: left; + margin-left: -30px; + } + + td.header-details { + text-align: left; + vertical-align: top; + } + + td.bill-to { + text-align: left; + } + + td.document-detail { + text-align: left; + border: 1px solid black; + padding: 1em 1em 1em 1em; + width: 16em; + } + + td.address { + text-align: left; + } + + .right { + text-align: right; + } diff --git a/resources/views/pages/pdfs/shipping_invoice.blade.php b/resources/views/pages/pdfs/shipping_invoice.blade.php index df4f2298..31e4c46e 100644 --- a/resources/views/pages/pdfs/shipping_invoice.blade.php +++ b/resources/views/pages/pdfs/shipping_invoice.blade.php @@ -17,27 +17,28 @@ (1134596-M)
- Malaysian Global Innovation & Creativity Center
- Level 1 CWS, Block 3730, Persiaran APEC,
- 63000 Cyberjaya, Malaysian.
- Tel: 018-2909252 + No. 72-3, Jalan Jalil 1,
+ The Earth Bukit Jalil,
+ 57000 Kuala Lumpur
+ Tel: 03-8082 1252 -
+
Invoice
-
EI#: {{ $invoice_transaction->bill_no }}
+
Invoice No: {{ $invoice_transaction->bill_no }}
@php $companyModule = $invoice_transaction->owner->owner->companyModule; @endphp -
Ref# {{ $invoice_transaction->owner->owner->reference }}
-
Date: {{ $invoice_transaction->created_at }}
+
Order No: {{ $invoice_transaction->owner->owner->reference }}
+
Container Ref: {{ $invoice_transaction->owner->containers()->first()->reference }}
+ {{--
{{ $companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference }}
--}}
 
@@ -56,7 +57,7 @@
@php - $addresses = $invoice_transaction->owner->owner->addresses()->where('status', '=', 2)->first(); + $addresses = $companyModule->addresses()->where('status', '=', \App\Classes\ValueObjects\Constants\ApprovalStatus::APPROVED)->where('type', '=', \App\Classes\ValueObjects\Constants\AddressType::BILLING)->first(); @endphp {{ $addresses->street_one }} {{ $addresses->street_two }} , @@ -82,53 +83,53 @@ No Description - Quantity - Unit Price (RM) - Total Amount
(RM) + Quantity + Unit Price (RM) + Total Amount
(RM) @foreach ($invoice_transaction->transactionDetails as $key => $transaction_detail) {{ $key + 1 }} - {{ $transaction_detail->name }} - {{ $transaction_detail->quantity }} - - {{ $transaction_detail->price }} + {!! $transaction_detail->name !!} + {{ round($transaction_detail->quantity, 3) }} + + {{ round($transaction_detail->price, 2) }} - {{ $transaction_detail->amount }} + {{ round($transaction_detail->amount, 2) }} @endforeach - + Subtotal - {{ number_format($invoice_transaction->amount, 2) }} + {{ round($invoice_transaction->amount, 2) }} - + Service Charges - {{ number_format($invoice_transaction->service_charge, 2) }} + {{ round($invoice_transaction->service_charge, 2) }} @if($invoice_transaction->tax > 0) - + Tax {{ number_format($invoice_transaction->tax, 2) }} @endif - + Total - {{ number_format($invoice_transaction->amount, 2) }} + {{ round($invoice_transaction->amount, 2) }} diff --git a/resources/views/pages/settings.blade.php b/resources/views/pages/settings.blade.php index 615f3eb3..e69f4fe2 100644 --- a/resources/views/pages/settings.blade.php +++ b/resources/views/pages/settings.blade.php @@ -285,7 +285,7 @@
- + diff --git a/resources/views/partials/menu.blade.php b/resources/views/partials/menu.blade.php index 42dd5141..952060c7 100644 --- a/resources/views/partials/menu.blade.php +++ b/resources/views/partials/menu.blade.php @@ -147,7 +147,7 @@
Shipping Queue
-
+
'company', 'as' => 'company.', 'namespace' => 'Compani Route::post('/team/create', 'AddNewMemberController@create')->name('team.create'); - Route::group(['prefix' => '{id}/segment', 'as' => 'segment.'], function () { - Route::post('/assign', 'AssignCompanyToSegmentController@assign')->name('assign'); - Route::delete('/detach/{segment_id}', 'RemoveCompanyFromSegmentController@detach')->name('detach'); - }); +// Route::group(['prefix' => '{id}/segment', 'as' => 'segment.'], function () { +// Route::post('/assign', 'AssignCompanyToSegmentController@assign')->name('assign'); +// Route::delete('/detach/{segment_id}', 'RemoveCompanyFromSegmentController@detach')->name('detach'); +// }); Route::group(['prefix' => '{id}/connection/{company_connection_id}', 'as' => 'connection.'], function () { Route::post('/assign', 'AssignCompanyConnectionToConnectionSegmentController@assign')->name('assign'); From 1a67fa31dc0b89b0c5facda38b40e51059cf4e16 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Sat, 3 Sep 2022 18:59:12 +0800 Subject: [PATCH 2/2] fix connection segment in customer page --- app/Http/Resources/CompanyModuleResource.php | 1 + .../components/companies/forms/AssignSegmentFormComponent.vue | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Http/Resources/CompanyModuleResource.php b/app/Http/Resources/CompanyModuleResource.php index 51c651f7..66491b1b 100644 --- a/app/Http/Resources/CompanyModuleResource.php +++ b/app/Http/Resources/CompanyModuleResource.php @@ -45,6 +45,7 @@ class CompanyModuleResource extends JsonResource 'remarks' => RemarkResource::collection($this->remarks), 'marking' => $marking, 'warehouseCharges' => array_key_exists($this->id, $segmentConstant) ? $segmentConstant[$this->id] : null, + 'connections' => $this->connections, ]; } diff --git a/resources/assets/vue/components/companies/forms/AssignSegmentFormComponent.vue b/resources/assets/vue/components/companies/forms/AssignSegmentFormComponent.vue index bb96c859..ba9d7a22 100644 --- a/resources/assets/vue/components/companies/forms/AssignSegmentFormComponent.vue +++ b/resources/assets/vue/components/companies/forms/AssignSegmentFormComponent.vue @@ -28,7 +28,7 @@
Not Now
-
Assign Segment
+
Assign Segment