diff --git a/app/Classes/Modules/Exports/Services/ExportsPaymentTransactions.php b/app/Classes/Modules/Exports/Services/ExportsPaymentTransactions.php index 82f09025..9fd483bc 100644 --- a/app/Classes/Modules/Exports/Services/ExportsPaymentTransactions.php +++ b/app/Classes/Modules/Exports/Services/ExportsPaymentTransactions.php @@ -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 ? '<>' : '', + $transaction->created_at->format('m/d/Y H:m'), + $company->debtor, + $order->reference, + $order->reference, + '500-0000', + str_replace('
', ' ', $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 [ '<>', $transaction->created_at->format('m/d/Y H:m'), diff --git a/app/Classes/Modules/Transactions/Services/CreatesTransaction.php b/app/Classes/Modules/Transactions/Services/CreatesTransaction.php index 2032b7b8..dbe3fd5f 100644 --- a/app/Classes/Modules/Transactions/Services/CreatesTransaction.php +++ b/app/Classes/Modules/Transactions/Services/CreatesTransaction.php @@ -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); } } diff --git a/app/Classes/Notifications/InvoiceIssuedEmail.php b/app/Classes/Notifications/InvoiceIssuedEmail.php index 8a5c90cc..bbd4271d 100644 --- a/app/Classes/Notifications/InvoiceIssuedEmail.php +++ b/app/Classes/Notifications/InvoiceIssuedEmail.php @@ -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]); diff --git a/app/Classes/Notifications/ShipmentDepartureEmail.php b/app/Classes/Notifications/ShipmentDepartureEmail.php index 44362d44..902ece25 100644 --- a/app/Classes/Notifications/ShipmentDepartureEmail.php +++ b/app/Classes/Notifications/ShipmentDepartureEmail.php @@ -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]); diff --git a/resources/assets/vue/components/paymentsBilling/elements/CustomerPaymentsBillingComponent.vue b/resources/assets/vue/components/paymentsBilling/elements/CustomerPaymentsBillingComponent.vue index 244ba240..f93ba436 100644 --- a/resources/assets/vue/components/paymentsBilling/elements/CustomerPaymentsBillingComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/elements/CustomerPaymentsBillingComponent.vue @@ -68,10 +68,10 @@ - MYR {{(Math.round((item.outstanding + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}} -
+
Make Payment
@@ -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(){ diff --git a/resources/assets/vue/components/paymentsBilling/forms/PaymentFormComponent.vue b/resources/assets/vue/components/paymentsBilling/forms/PaymentFormComponent.vue index bd861a20..3ff38d1f 100644 --- a/resources/assets/vue/components/paymentsBilling/forms/PaymentFormComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/forms/PaymentFormComponent.vue @@ -157,6 +157,7 @@ this.error = response.payload.data.message; } else{ + this.closeModal(); this.updateList(); } } diff --git a/resources/assets/vue/components/paymentsBilling/forms/PaymentVerificationFormComponent.vue b/resources/assets/vue/components/paymentsBilling/forms/PaymentVerificationFormComponent.vue index bb1df036..a60f6b14 100644 --- a/resources/assets/vue/components/paymentsBilling/forms/PaymentVerificationFormComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/forms/PaymentVerificationFormComponent.vue @@ -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] } - \ No newline at end of file + diff --git a/resources/views/pages/pdfs/shipping_invoice_sst_inner.blade.php b/resources/views/pages/pdfs/shipping_invoice_sst_inner.blade.php index ab913a60..eadd5f87 100644 --- a/resources/views/pages/pdfs/shipping_invoice_sst_inner.blade.php +++ b/resources/views/pages/pdfs/shipping_invoice_sst_inner.blade.php @@ -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
- @php - $contact = $companyModule->contacts()->first(); - @endphp + @php + $contact = $companyModule->contacts()->first(); + @endphp Phone: {{ $contact ? $contact->phone : '' }}
@@ -81,63 +81,63 @@
- - - - - - - - - + + + + + + + + + - @foreach ($invoice_transaction->transactionDetails as $key => $transaction_detail) - - - - - - - - - - @endforeach + @foreach ($invoice_transaction->transactionDetails as $key => $transaction_detail) + + + + + + + + + + @endforeach - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + +
NoDescriptionQtyUnit Price
(RM)
Tax (%)Tax Amount
(RM)
Sub Total
(RM)
NoDescriptionQtyUnit Price
(RM)
Tax (%)Tax Amount
(RM)
Sub Total
(RM)
{{ $key + 1 }}{!! $transaction_detail->name !!}{{ round($transaction_detail->quantity, 3) }} - {{ round($transaction_detail->price, 2) }} - - {{ round($transaction_detail->tax_percentage, 2) }} - - {{ number_format(round($transaction_detail->tax_amount, 2), 2) }} - - {{ number_format(round($transaction_detail->amount, 2), 2) }} -
{{ $key + 1 }}{!! $transaction_detail->name !!}{{ round($transaction_detail->quantity, 3) }} + {{ round($transaction_detail->price, 2) }} + + {{ round($transaction_detail->tax_percentage, 2) }} + + {{ number_format(round($transaction_detail->tax_amount, 2), 2) }} + + {{ number_format(round($transaction_detail->amount, 2), 2) }} +
Subtotal - {{ number_format(round($invoice_transaction->amount - $invoice_transaction->tax, 2), 2) }} -
Service Charges - {{ number_format(round($invoice_transaction->service_charge, 2), 2) }} -
Total SST (6%) RM{{ number_format($invoice_transaction->tax, 2) }}
Total Amount RM - {{ number_format(round($invoice_transaction->amount, 2), 2) }} -
Subtotal + {{ number_format(round($invoice_transaction->amount - $invoice_transaction->tax, 2), 2) }} +
Service Charges + {{ number_format(round($invoice_transaction->service_charge, 2), 2) }} +
Total SST (6%) RM{{ number_format($invoice_transaction->tax, 2) }}
Total Amount RM + {{ number_format(round($invoice_transaction->amount, 2), 2) }} +
diff --git a/resources/views/pages/pdfs/shipping_invoices_sst_combined.blade.php b/resources/views/pages/pdfs/shipping_invoices_sst_combined.blade.php index deb11f5d..f7cff168 100644 --- a/resources/views/pages/pdfs/shipping_invoices_sst_combined.blade.php +++ b/resources/views/pages/pdfs/shipping_invoices_sst_combined.blade.php @@ -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 @@ -65,9 +65,9 @@ $grandSubTotal = 0; {{ $addresses->country()->first()->name }}
- @php - $contact = $companyModule->contacts()->first(); - @endphp + @php + $contact = $companyModule->contacts()->first(); + @endphp Phone: {{ $contact ? $contact->phone : '' }}
@@ -78,16 +78,16 @@ $grandSubTotal = 0;
- - - - - - - - - - + + + + + + + + + + @foreach ($invoice_transactions as $key => $invoice_transaction) @@ -119,28 +119,28 @@ $grandSubTotal = 0; @endforeach - - - - - - + - - - - - - - + + + + + + + + + + + - + +
NoInvoice NoDescriptionQtyUnit Price
(RM)
Tax (%)Tax Amount
(RM)
Sub Total
(RM)
NoInvoice NoDescriptionQtyUnit Price
(RM)
Tax (%)Tax Amount
(RM)
Sub Total
(RM)
Total Taxable Amount - {{ round($grandSubTotal, 2) }} -
Total SST (6%) RM - {{ round($grandTotalTax, 2) }} -
Total Amount RM - {{ round($grandTotal, 2) }} + Total Taxable Amount + {{ round($grandSubTotal, 2) }} +
Total SST (6%) RM + {{ round($grandTotalTax, 2) }} +
Total Amount RM + {{ round($grandTotal, 2) }} -