update shipping-invoice

This commit is contained in:
edmondlang
2022-03-06 21:12:09 +08:00
parent 35cf8a20c3
commit 3b86a50bed
4 changed files with 176 additions and 16 deletions
@@ -221,7 +221,7 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
$document = $this->createsDocument->execute($invoice_transaction, $document_object);
$this->createsFile->execute($document, $document_object);
dd('yess');
// dd('yess');
return $this->response([]);
}
}
@@ -9,4 +9,8 @@ class Notifications
'message' => 'you have received new parcel for your order #-'
];
public const UNDEFINED = [
'title' => 'UNDEFINED TITLE',
'message' => 'undefined message'
];
}
@@ -26,17 +26,45 @@
<p class="no-margin">{{item.transport ? item.transport.current_schedule.eta : 'n/a'}}</p>
</div>
<div class="col-auto text-right" v-if="!item.transport">
<div v-if="item.order">
<div class="btn btn-xs btn-success pointer" v-if="item.status === 5" @click="updateStatus(item.status === 1 ? 1 : 2)"><i class="fa fa-check m-r-5"></i>Release</div>
<div class="btn btn-xs btn-danger pointer" v-if="item.status !== 5" @click="updateStatus(5)"><i class="fa fa-hand-paper-o m-r-5"></i>Hold</div>
<div class="row m-b-5">
<div class="col">
<div v-if="item.order">
<div class="btn btn-xs btn-success pointer" v-if="item.status === 5" @click="updateStatus(item.status === 1 ? 1 : 2)"><i class="fa fa-check m-r-5"></i>Release</div>
<div class="btn btn-xs btn-danger pointer" v-if="item.status !== 5" @click="updateStatus(5)"><i class="fa fa-hand-paper-o m-r-5"></i>Hold</div>
</div>
<div v-if="!item.order" class="text-danger">Unclaimed</div>
</div>
</div>
<div class="row">
<div class="col">
<div v-if="!item.shippng_transaction">
<div class="btn btn-xs btn-primary pointer" @click="generateInvoice()">Generate Invoice</div>
</div>
<div v-if="item.shippng_transaction">
<div v-for="files in item.shippng_transaction.documents.files" v-bind:key="files.id" class="col-auto no-padding">
<document-file-viewer-component :file="files">
<template slot="button">
<div class="btn btn-xs btn-primary pointer d-block m-b-5">View Invoice</div>
</template>
</document-file-viewer-component>
</div>
<!-- <div class="btn btn-xs btn-primary pointer d-block">Pay Invoice</div> -->
</div>
</div>
</div>
<div v-if="!item.order" class="text-danger">Unclaimed</div>
</div>
</div>
</template>
<script>
import componentHandler from '../../../general/mixins/componentHandler';
export default {
data(){
return {
parameters: {
packing_list_id: null,
}
}
},
computed: {
cbm () {
return (Math.ceil((this.item.packages.reduce((total, obj) => (obj.type === 2 ? 0 : obj.cbm) + total, 0)) * 1000) / 1000).toFixed(3)
@@ -45,7 +73,13 @@
return (Math.ceil((this.item.packages.reduce((total, obj) => (obj.type === 2 ? obj.cbm : 0) + total, 0)) * 1000) / 1000).toFixed(3)
}
},
created(){
this.parameters.packing_list_id = this.data.id;
},
methods: {
generateInvoice() {
this.submit(this.route('api.transaction.supplier.create'), 'post', '', true, true);
},
updateStatus(status){
this.submit(this.route('api.packing_list.status.update', this.item.id, status), 'put', '', true, true)
},
@@ -1,19 +1,141 @@
@extends('layouts.base_pdf')
@section('inner_content')
<table>
<thead>
<br>
<htmlpageheader name="page-header">
<br><br>
<div class="separator"><strong><i>{{ $invoice_transaction->bill_no }}</i></strong></div>
</htmlpageheader>
<table>
<tr>
<td class="header-logo">
<img src="{{ asset('images/ri_1.png') }}" alt="logo" id="logo" class="logo">
</td>
<td class="header-cief-address">
<span class="company-name">
<strong>
CIEF WORLDWIDE SDN BHD
</strong>
</span>
<span class="company-reg">(1134596-M)</span><br>
Malaysian Global Innovation &amp; Creativity Center <br>
Level 1 CWS, Block 3730, Persiaran APEC, <br>
63000 Cyberjaya, Malaysian. <br>
Tel: 018-2909252
</td>
<td class="header-details">
<div class="title">
<strong>
Invoice
</strong>
</div>
<div class="number">EI#: {{ $invoice_transaction->bill_no }}</div>
@php
$companyModule = $invoice_transaction->owner->owner->companyModule;
@endphp
<div class="ref">Ref# {{ $invoice_transaction->owner->owner->reference }}</div>
<!-- <div class="d-none">{{ $companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference }}</div> -->
<div class="date">Date: {{ invoice_transaction->created_at }}</div>
<div>&nbsp;</div>
</div>
</td>
</tr>
<tr>
<td colspan="3" class="bill-to">
<span class="sub-title">
Bill To
</span>
</td>
</tr>
<tr>
<td colspan="3" class="address">
<div class="label">
{{ $companyModule->name }}
</div>
<div class="address">
@php
$addresses = $invoice_transaction->owner->owner->addresses()->where('status', '=', 2)->first();
@endphp
{{ $addresses->street_one }}
{{ $addresses->street_two }} ,
{{ $addresses->district()->first()->name }},
{{ $addresses->postcode }}
{{ $addresses->state()->first()->name }},
{{ $addresses->country()->first()->name }}
</div>
<div>
Phone: {{ $companyModule->contacts()->first()->phone }}
</div>
</td>
</tr>
</table>
<br>
<br>
<table class="line-table" style="overflow: wrap" autosize="1">
<thead>
<tr>
<th>Bill No</th>
<th>Packing List</th>
<th>Total Cbm</th>
<th width="5%">No</th>
<th class="description">Description</th>
<th width="10%">Quantity</th>
<th width="15%">Unit Price (RM)</th>
<th width="10%">Total Amount<br>(RM)</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ $invoice_transaction->bill_no }}</td>
<td>{{ $invoice_transaction->owner()->first()->reference }}</td>
<td>{{ $invoice_transaction->original_amount }}</td>
</tr>
@foreach ($invoice_transaction->transactionDetails as $key => $transaction_detail)
<tr>
<td width="5%" class="center top">{{ $key + 1 }}</td>
<td class="description">{{ $transaction_detail->name }}</td>
<td width="10%" class="center top">{{ $transaction_detail->quantity }}</td>
<td width="15%" class="center top">
{{ $transaction_detail->price }}
</td>
<td width="20%" class="right top">
{{ $transaction_detail->amount }}
</td>
</tr>
@endforeach
</tbody>
</table>
<tfoot>
<tr class="subtotal">
<td colspan="4"></td>
<td class="right middle">Subtotal</td>
<td class="right middle">
{{ number_format($invoice_transaction->amount, 2) }}
</td>
</tr>
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Service Charges</td>
<td class="right">
{{ number_format($invoice_transaction->service_charge, 2) }}
</td>
</tr>
@if($invoice_transaction->tax > 0)
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Tax</td>
<td class="right">{{ number_format($invoice_transaction->tax, 2) }}</td>
</tr>
@endif
<tr>
<td colspan="4"></td>
<td class="right middle">Total</td>
<td class="total right middle">
{{ number_format($invoice_transaction->amount, 2) }}
</td>
</tr>
</tfoot>
</table>
<htmlpagefooter name="page-footer">
<table width="100%">
<tr>
<td style="text-align: right; ">This is generated by computer. No signature required.</td>
<td style="text-align: right; ">Page {PAGENO} of {nbpg}</td>
</tr>
</table>
</htmlpagefooter>
@endsection