Merge branch 'dillon/46.11-warehouse-storage-related-fixes' into development

This commit is contained in:
Dillon Ngo
2024-05-06 13:23:45 +08:00
9 changed files with 171 additions and 115 deletions
@@ -41,6 +41,9 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
'DeptNo',
'Qty',
'UnitPrice',
'TaxType',
'TaxableAmt',
'TaxRate',
// 'marking',
// 'contact person',
// 'contact number',
@@ -130,6 +133,37 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
$furtherDescription .= $item->name.' '.$item->quantity.' X '.$item->price."\n";
}
$transactionDetails = $transaction->transactionDetails;
$firstItem = true;
$rows = [];
foreach ($transactionDetails as $detail) {
// Prepare each row based on the transaction detail
$rows[] = [
$firstItem ? '<<New>>' : '',
$transaction->created_at->format('m/d/Y H:m'),
$company->debtor,
$order->reference,
$order->reference,
'500-0000',
str_replace('<br>', ' ', $detail->name),
'',
$container->reference,
'CIEF',
$detail->quantity,
$detail->price,
floatval($detail->tax_percentage) > 0 ? 'SV-6' : '',
floatval($detail->tax_percentage) > 0 ? $detail->amount : '0',
$detail->tax_percentage,
];
if($firstItem) {
$firstItem = false;
}
}
return $rows;
return [
'<<New>>',
$transaction->created_at->format('m/d/Y H:m'),
@@ -35,11 +35,6 @@ class CreatesTransaction extends AbstractUpdateRelationshipRecord
$model->expires_on = $object->getExpiresOn();
$model->status = $object->getStatus();
if((int)$object->getTransactionType() === TransactionType::SHIPPING_INVOICE){
$model->created_at = Carbon::now()->subDays(10);
$model->updated_at = Carbon::now()->subDays(10);
}
return $this->handler($packing_list->transactions(), $model);
}
}
@@ -8,6 +8,7 @@ use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\PackingList;
use App\Models\User;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
class InvoiceIssuedEmail extends AbstractEmail
@@ -35,10 +36,14 @@ class InvoiceIssuedEmail extends AbstractEmail
$invoice = $this->packingList->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->where('status', ApprovalStatus::APPROVED)->first();
$invoiceDocument = $invoice->documents()->first()->files;
// $fileContent = Storage::disk('documents')->get($invoiceDocument->first()->file->file_info->original->file);
$filePath = storage_path('app/documents/' . $invoiceDocument->first()->file->file_info->original->file);
Log::info('InvoiceIssuedEmail sent - Att: '.$this->user->name.' - Invoice for order no.'. $this->packingList->owner->reference);
return (new MailMessage)
->subject('Att: '.$this->user->name.' - Invoice for order no.'. $this->packingList->owner->reference)
->attach(Storage::disk('documents')->get($invoiceDocument->first()->file->file_info->original->file), [
->attach($filePath, [
'as' => 'name.pdf',
'mime' => 'application/pdf',
])->view('emails.shipment.invoice', ['user' => $this->user, 'packingList' => $this->packingList]);
@@ -9,6 +9,7 @@ use App\Models\PackingList;
use App\Models\PasswordReset;
use App\Models\User;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
class ShipmentDepartureEmail extends AbstractEmail
@@ -40,10 +41,14 @@ class ShipmentDepartureEmail extends AbstractEmail
$invoiceDocument = $invoice->documents()->first()->files;
// $fileContent = Storage::disk('documents')->get($invoiceDocument->first()->file->file_info->original->file);
$filePath= storage_path('app/documents/' . $invoiceDocument->first()->file->file_info->original->file);
Log::info('ShipmentDepartureEmail sent - Att: '.$this->user->name.' - Invoice for order no.'. $this->packingList->owner->reference);
return (new MailMessage)
->subject('Your packages are on the way to malaysia - Invoice pending payment for order no.'. $this->packingList->owner->reference)
->attach(Storage::disk('documents')->get($invoiceDocument->first()->file->file_info->original->file), [
->attach($filePath, [
'as' => 'name.pdf',
'mime' => 'application/pdf',
])->bcc(['email_test@cief-malaysia.com'])->view('emails.shipment.ETD', ['user' => $this->user, 'packingList' => $this->packingList]);
@@ -68,10 +68,10 @@
<i class="fa fa-repeat"></i>
</span>
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="regenerateInvoice">
<general-confirmation-form-component
contentText="Are you sure you want to regenerate this Invoice?"
modalType="delete"
buttonText="Regenerate"
<general-confirmation-form-component
contentText="Are you sure you want to regenerate this Invoice?"
modalType="delete"
buttonText="Regenerate"
class="text-center"
:apiRoute="route('api.transaction.invoice.regenerate', item.id)"
apiMethod="post"
@@ -179,7 +179,7 @@
<div class="font-heading fs-12">MYR {{(Math.round((item.outstanding + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div>
</div>
</div>
<div class="row m-t-20" v-if="item.outstanding - item.floating > 0.009">
<div class="row m-t-20" v-if="item.outstanding - item.floating > 0.009 && !paymentPending">
<div class="col">
<div class="btn btn-sm all-caps b-rad-none btn-success btn-block requestModal" data-type="makePayment">Make Payment</div>
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="makePayment">
@@ -238,6 +238,17 @@
latestComment() {
let questions = this.item.remarks;
return questions.slice().reverse()[0];
},
paymentPending(){
if (Array.isArray(this.item.transactions)) {
for (let i = 0; i < this.item.transactions.length; i++) {
const status = this.item.transactions[i].status;
if (status === 1) {
return true;
}
}
}
return false;
}
},
created(){
@@ -157,6 +157,7 @@
this.error = response.payload.data.message;
}
else{
this.closeModal();
this.updateList();
}
}
@@ -76,9 +76,14 @@
files: this.files
};
this.submit(this.route('api.transaction.payment.verification.create', this.data.id), 'post', this.section, true, true)
}
},
successHandler(response){
this.closeModal();
this.formHandler();
window.location.reload();
},
},
mixins: [ModalFromHandler]
}
</script>
</script>
@@ -59,18 +59,18 @@
$addresses = $companyModule->addresses()->where('status', '=', \App\Classes\ValueObjects\Constants\ApprovalStatus::APPROVED)->where('type', '=', \App\Classes\ValueObjects\Constants\AddressType::BILLING)->first();
@endphp
@if($addresses)
{{ $addresses->street_one }}
{{ $addresses->street_two }} ,
{{ $addresses->district()->first()->name }},
{{ $addresses->postcode }}
{{ $addresses->state()->first()->name }},
{{ $addresses->country()->first()->name }}
{{ $addresses->street_one }}
{{ $addresses->street_two }} ,
{{ $addresses->district()->first()->name }},
{{ $addresses->postcode }}
{{ $addresses->state()->first()->name }},
{{ $addresses->country()->first()->name }}
@endif
</div>
<div>
@php
$contact = $companyModule->contacts()->first();
@endphp
@php
$contact = $companyModule->contacts()->first();
@endphp
Phone: {{ $contact ? $contact->phone : '' }}
</div>
</td>
@@ -81,63 +81,63 @@
<br>
<table class="line-table" style="overflow: wrap" autosize="1">
<thead>
<tr>
<th width="5%">No</th>
<th class="description">Description</th>
<th width="10%">Qty</th>
<th width="10%">Unit Price <br>(RM)</th>
<th width="10%">Tax (%)</th>
<th width="20%">Tax Amount <br>(RM)</th>
<th width="15%">Sub Total<br>(RM)</th>
</tr>
<tr>
<th width="5%">No</th>
<th class="description">Description</th>
<th width="10%">Qty</th>
<th width="10%">Unit Price <br>(RM)</th>
<th width="10%">Tax (%)</th>
<th width="20%">Tax Amount <br>(RM)</th>
<th width="15%">Sub Total<br>(RM)</th>
</tr>
</thead>
<tbody>
@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" style="text-align: center">{{ round($transaction_detail->quantity, 3) }}</td>
<td width="10%" class="center top" style="text-align: center">
{{ round($transaction_detail->price, 2) }}
</td>
<td width="10%" class="center top" style="text-align: center">
{{ round($transaction_detail->tax_percentage, 2) }}
</td>
<td width="20%" class="center top" style="text-align: center">
{{ number_format(round($transaction_detail->tax_amount, 2), 2) }}
</td>
<td width="15%" class="right top">
{{ number_format(round($transaction_detail->amount, 2), 2) }}
</td>
</tr>
@endforeach
@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" style="text-align: center">{{ round($transaction_detail->quantity, 3) }}</td>
<td width="10%" class="center top" style="text-align: center">
{{ round($transaction_detail->price, 2) }}
</td>
<td width="10%" class="center top" style="text-align: center">
{{ round($transaction_detail->tax_percentage, 2) }}
</td>
<td width="20%" class="center top" style="text-align: center">
{{ number_format(round($transaction_detail->tax_amount, 2), 2) }}
</td>
<td width="15%" class="right top">
{{ number_format(round($transaction_detail->amount, 2), 2) }}
</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr class="subtotal">
<td colspan="5"></td>
<td class="right middle">Subtotal</td>
<td class="right middle">
{{ number_format(round($invoice_transaction->amount - $invoice_transaction->tax, 2), 2) }}
</td>
</tr>
<tr class="billingcharges">
<td colspan="5"></td>
<td class="right">Service Charges</td>
<td class="right">
{{ number_format(round($invoice_transaction->service_charge, 2), 2) }}
</td>
</tr>
<tr class="billingcharges">
<td colspan="5"></td>
<td class="right">Total SST (6%) RM</td>
<td class="right">{{ number_format($invoice_transaction->tax, 2) }}</td>
</tr>
<tr>
<td colspan="5"></td>
<td class="right middle">Total Amount RM</td>
<td class="total right middle">
{{ number_format(round($invoice_transaction->amount, 2), 2) }}
</td>
</tr>
<tr class="subtotal">
<td colspan="5"></td>
<td class="right middle">Subtotal</td>
<td class="right middle">
{{ number_format(round($invoice_transaction->amount - $invoice_transaction->tax, 2), 2) }}
</td>
</tr>
<tr class="billingcharges">
<td colspan="5"></td>
<td class="right">Service Charges</td>
<td class="right">
{{ number_format(round($invoice_transaction->service_charge, 2), 2) }}
</td>
</tr>
<tr class="billingcharges">
<td colspan="5"></td>
<td class="right">Total SST (6%) RM</td>
<td class="right">{{ number_format($invoice_transaction->tax, 2) }}</td>
</tr>
<tr>
<td colspan="5"></td>
<td class="right middle">Total Amount RM</td>
<td class="total right middle">
{{ number_format(round($invoice_transaction->amount, 2), 2) }}
</td>
</tr>
</tfoot>
</table>
@@ -1,10 +1,10 @@
@extends('layouts.base_pdf')
@section('inner_content')
@php
$grandTotal = 0;
$grandTotalTax = 0;
$grandSubTotal = 0;
@endphp
@php
$grandTotal = 0;
$grandTotalTax = 0;
$grandSubTotal = 0;
@endphp
<table>
<tr>
@@ -65,9 +65,9 @@ $grandSubTotal = 0;
{{ $addresses->country()->first()->name }}
</div>
<div>
@php
$contact = $companyModule->contacts()->first();
@endphp
@php
$contact = $companyModule->contacts()->first();
@endphp
Phone: {{ $contact ? $contact->phone : '' }}
</div>
</td>
@@ -78,16 +78,16 @@ $grandSubTotal = 0;
<br>
<table class="line-table" style="overflow: wrap" autosize="1">
<thead>
<tr>
<th width="5%">No</th>
<th class="description">Invoice No</th>
<th class="description">Description</th>
<th width="10%">Qty</th>
<th width="10%">Unit Price <br>(RM)</th>
<th width="10%">Tax (%)</th>
<th width="20%">Tax Amount <br>(RM)</th>
<th width="15%">Sub Total<br>(RM)</th>
</tr>
<tr>
<th width="5%">No</th>
<th class="description">Invoice No</th>
<th class="description">Description</th>
<th width="10%">Qty</th>
<th width="10%">Unit Price <br>(RM)</th>
<th width="10%">Tax (%)</th>
<th width="20%">Tax Amount <br>(RM)</th>
<th width="15%">Sub Total<br>(RM)</th>
</tr>
</thead>
<tbody>
@foreach ($invoice_transactions as $key => $invoice_transaction)
@@ -119,28 +119,28 @@ $grandSubTotal = 0;
@endforeach
</tbody>
<tfoot>
<tr class="subtotal">
<td colspan="6"></td>
<td class="right middle">Total Taxable Amount</td>
<td class="right middle">
{{ round($grandSubTotal, 2) }}
</td>
</tr>
<tr class="billingcharges">
<tr class="subtotal">
<td colspan="6"></td>
<td class="right middle">Total SST (6%) RM</td>
<td class="right middle">
{{ round($grandTotalTax, 2) }}
</td>
</tr>
<tr>
<td colspan="6"></td>
<td class="right middle">Total Amount RM</td>
<td class="total right middle">
{{ round($grandTotal, 2) }}
<td class="right middle">Total Taxable Amount</td>
<td class="right middle">
{{ round($grandSubTotal, 2) }}
</td>
</tr>
<tr class="billingcharges">
<td colspan="6"></td>
<td class="right middle">Total SST (6%) RM</td>
<td class="right middle">
{{ round($grandTotalTax, 2) }}
</td>
</tr>
<tr>
<td colspan="6"></td>
<td class="right middle">Total Amount RM</td>
<td class="total right middle">
{{ round($grandTotal, 2) }}
</td>
</tr>
</td>
</tr>
</tfoot>
</table>