Invoice Document Amendment

This commit is contained in:
glovetleong
2021-04-29 00:33:25 +08:00
parent 69eccb2d9c
commit 590021bde9
12 changed files with 326 additions and 81 deletions
@@ -5,7 +5,6 @@ namespace App\Classes\Modules\Bookings\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Transactions\Processors\CreateInvoiceTransactionProcessor;
use App\Classes\Modules\Documents\Services\ApprovesDocument;
use App\Classes\Modules\Documents\Services\FetchesDocument;
@@ -29,13 +28,12 @@ class ApprovePaymentVerificationLogic extends AbstractControllerLogic
* @param FetchesDocument $fetchesDocument
* @param CreateInvoiceTransactionProcessor $createInvoiceTransactionProcessor
*/
public function __construct(FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, FetchesDocument $fetchesDocument, CreateInvoiceTransactionProcessor $createInvoiceTransactionProcessor)
public function __construct(FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, FetchesDocument $fetchesDocument)
{
$this->fetchesTransaction = $fetchesTransaction;
$this->updatesTransactionStatus = $updatesTransactionStatus;
$this->approvesDocument = $approvesDocument;
$this->rejectsDocument = $rejectsDocument;
$this->createInvoiceTransactionProcessor = $createInvoiceTransactionProcessor;
}
/**
@@ -60,9 +58,6 @@ class ApprovePaymentVerificationLogic extends AbstractControllerLogic
/** @var RejectsDocument */
private $rejectsDocument;
/** @var CreateInvoiceTransactionProcessor */
private $createInvoiceTransactionProcessor;
/**
* @param Request $request
* @return JsonResponse
@@ -79,7 +74,7 @@ class ApprovePaymentVerificationLogic extends AbstractControllerLogic
$this->updatesTransactionStatus->execute($transaction, $status === 'approve' ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED);
$this->createInvoiceTransactionProcessor->execute($transaction->booking);
// $this->createInvoiceTransactionProcessor->execute($transaction->booking);
return $this->response([]);
}
@@ -9,11 +9,20 @@ use Carbon\Carbon;
class CalculatesBookingCurrencyAverageRate
{
public function execute(Booking $booking){
public function execute(Booking $booking, $type){
if ($type == TransactionType::PAYMENT) {
return $booking->transactions()
->where('type', TransactionType::PAYMENT)
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
->avg('currency_rate');
}
else if ($type == TransactionType::BILL) {
return $booking->transactions()
->where('type', TransactionType::BILL)
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
->avg('currency_rate');
}
}
}
@@ -19,6 +19,9 @@ use App\Models\Document;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use App\Classes\Modules\Transactions\Processors\CreateInvoiceTransactionProcessor;
class CreatePaymentProofDocumentLogic extends AbstractControllerLogic
{
@@ -44,6 +47,9 @@ class CreatePaymentProofDocumentLogic extends AbstractControllerLogic
/** @var UpdatesTransactionStatus */
private $updatesTransactionStatus;
/** @var CreateInvoiceTransactionProcessor */
private $createInvoiceTransactionProcessor;
/**
* CreatePaymentVerificationDocumentLogic constructor.
* @param FetchesTransaction $fetchesTransaction
@@ -51,12 +57,13 @@ class CreatePaymentProofDocumentLogic extends AbstractControllerLogic
* @param CreatesFiles $createsFile
* @param UpdatesTransactionStatus $updatesTransactionStatus
*/
public function __construct(FetchesTransaction $fetchesTransaction, CreatesDocument $createsDocument, CreatesFiles $createsFile, UpdatesTransactionStatus $updatesTransactionStatus)
public function __construct(FetchesTransaction $fetchesTransaction, CreatesDocument $createsDocument, CreatesFiles $createsFile, UpdatesTransactionStatus $updatesTransactionStatus, CreateInvoiceTransactionProcessor $createInvoiceTransactionProcessor)
{
$this->fetchesTransaction = $fetchesTransaction;
$this->createsDocument = $createsDocument;
$this->createsFile = $createsFile;
$this->updatesTransactionStatus = $updatesTransactionStatus;
$this->createInvoiceTransactionProcessor = $createInvoiceTransactionProcessor;
}
/**
@@ -77,6 +84,9 @@ class CreatePaymentProofDocumentLogic extends AbstractControllerLogic
$this->createsFile->execute($document, $object);
$this->updatesTransactionStatus->execute($transaction, ApprovalStatus::COMPLETED);
$this->createInvoiceTransactionProcessor->execute($transaction->booking);
return $this->response([]);
}
@@ -26,6 +26,9 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Meneses\LaravelLaravelMpdf\Facades\LaravelLaravelMpdf;
use Meneses\LaravelMpdf\Facades\LaravelMpdf;
class CreateSupplierTransactionLogic extends AbstractControllerLogic
{
@@ -106,10 +109,9 @@ class CreateSupplierTransactionLogic extends AbstractControllerLogic
$rate, 0, 0, null, ApprovalStatus::APPROVED);
$transactions[] = $this->createsTransaction->execute($payment->booking, $object);
}
$pdf = $this->pdf->loadView('pages.pdfs.supplier_order', ['transactions' => $transactions, 'supplier' => $supplier]);
$pdf = LaravelMpdf::loadView('pages.pdfs.currency_vendor_order', ['transactions' => $transactions, 'supplier' => $supplier]);
$path = Str::studly($supplier->name).'_'.Carbon::now()->format('Y_m_d_h_s_i').'.pdf';
@@ -118,7 +120,7 @@ class CreateSupplierTransactionLogic extends AbstractControllerLogic
[chunk_split('data:application/pdf;base64,'.base64_encode($pdf->output()))],
'',
ApprovalStatus::COMPLETED,
'supplier_orders'
'currency_vendor_order'
);
foreach ($transactions as $key => $row) {
@@ -81,6 +81,7 @@ class CreateInvoiceTransactionProcessor
->where('type', TransactionType::PURCHASE_ORDER)
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
->first();
if ($po_order_transaction) {
$paymant_amount = $this->calculatesBookingPaidAmount->execute($booking, $booking->fix_currency_id);
$booking_amount = $booking->fix_amount;
@@ -93,7 +94,17 @@ class CreateInvoiceTransactionProcessor
$billNumber = $this->generatesTransactionBillNumber->execute('INV-');
$booking_currency_average_rate = $this->calculatesBookingCurrencyAverageRate->execute($booking);
$booking_currency_average_rate = $this->calculatesBookingCurrencyAverageRate->execute($booking, TransactionType::PAYMENT);
$total_service_charge = $booking->transactions()
->where('type', TransactionType::PAYMENT)
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
->sum('service_charge');
$total_tax = $booking->transactions()
->where('type', TransactionType::PAYMENT)
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
->sum('tax');
$transaction_object = new TransactionObject(
$billNumber,
@@ -107,15 +118,16 @@ class CreateInvoiceTransactionProcessor
$transaction->currency_id,
$transaction->original_currency_id,
$booking_currency_average_rate,
$transaction->tax,
$transaction->service_charge,
$total_tax,
$total_service_charge,
null,
ApprovalStatus::APPROVED
);
$invoice_transaction = $this->createsTransaction->execute($po_order_transaction->booking, $transaction_object);
$supplier = $this->fetchesCompany->execute(['id' => $transaction->receiver]);
$purchase_order_pdf = LaravelMpdf::loadView('pages.pdfs.purchase_order', ['transaction' => $po_order_transaction, 'supplier' => $supplier]);
$purchase_order_pdf = LaravelMpdf::loadView('pages.pdfs.purchase_order', ['invoice_transaction' => $invoice_transaction, 'po_order_transaction' => $po_order_transaction, 'supplier' => $supplier]);
$document_object = new DocumentObject(
DocumentType::PURCHASE_ORDER,
[chunk_split('data:application/pdf;base64,'.base64_encode($purchase_order_pdf->output()))],
@@ -126,7 +138,7 @@ class CreateInvoiceTransactionProcessor
$document = $this->createsDocument->execute($po_order_transaction->booking, $document_object);
$this->createsFile->execute($document, $document_object);
$deliver_order_pdf = LaravelMpdf::loadView('pages.pdfs.deliver_order', ['transaction' => $po_order_transaction, 'supplier' => $supplier]);
$deliver_order_pdf = LaravelMpdf::loadView('pages.pdfs.deliver_order', ['invoice_transaction' => $invoice_transaction, 'po_order_transaction' => $po_order_transaction, 'supplier' => $supplier]);
$document_object = new DocumentObject(
DocumentType::DELIVER_ORDER,
[chunk_split('data:application/pdf;base64,'.base64_encode($deliver_order_pdf->output()))],
@@ -137,7 +149,8 @@ class CreateInvoiceTransactionProcessor
$document = $this->createsDocument->execute($po_order_transaction->booking, $document_object);
$this->createsFile->execute($document, $document_object);
$payment_order_pdf = LaravelMpdf::loadView('pages.pdfs.payment_order', ['transaction' => $po_order_transaction, 'supplier' => $supplier]);
$payment_order_pdf = LaravelMpdf::loadView('pages.pdfs.payment_order', ['invoice_transaction' => $invoice_transaction, 'po_order_transaction' => $po_order_transaction, 'supplier' => $supplier]);
$document_object = new DocumentObject(
DocumentType::PAYMENT_ORDER,
[chunk_split('data:application/pdf;base64,'.base64_encode($payment_order_pdf->output()))],
@@ -148,7 +161,30 @@ class CreateInvoiceTransactionProcessor
$document = $this->createsDocument->execute($po_order_transaction->booking, $document_object);
$this->createsFile->execute($document, $document_object);
$supplier_order_pdf = LaravelMpdf::loadView('pages.pdfs.supplier_deliver_order', ['transaction' => $po_order_transaction, 'supplier' => $supplier]);
$billNumber = $this->generatesTransactionBillNumber->execute('SPDO-');
$booking_currency_average_rate = $this->calculatesBookingCurrencyAverageRate->execute($booking, TransactionType::BILL);
$transaction_object = new TransactionObject(
$billNumber,
TransactionType::SUPPLIER_DELIVER,
$transaction->issuer,
$transaction->receiver,
$transaction->recipient_bank_account_id,
$transaction->payment_method,
$paymant_amount,
$booking_amount,
$transaction->currency_id,
$transaction->original_currency_id,
$booking_currency_average_rate,
$total_tax,
$total_service_charge,
null,
ApprovalStatus::APPROVED
);
$supplier_deliver_order_transaction = $this->createsTransaction->execute($po_order_transaction->booking, $transaction_object);
$supplier_order_pdf = LaravelMpdf::loadView('pages.pdfs.supplier_deliver_order', ['supplier_deliver_order_transaction' => $supplier_deliver_order_transaction, 'po_order_transaction' => $po_order_transaction, 'supplier' => $supplier]);
$document_object = new DocumentObject(
DocumentType::SUPPLIER_DELIVER_ORDER,
[chunk_split('data:application/pdf;base64,'.base64_encode($supplier_order_pdf->output()))],
@@ -159,7 +195,6 @@ class CreateInvoiceTransactionProcessor
$document = $this->createsDocument->execute($po_order_transaction->booking, $document_object);
$this->createsFile->execute($document, $document_object);
$transaction = $this->createsTransaction->execute($po_order_transaction->booking, $transaction_object);
$this->updatesBookingStatus->execute($booking, ApprovalStatus::COMPLETED);
}
}
@@ -20,4 +20,6 @@ final class TransactionType {
public const PURCHASE_ORDER = 7;
public const SUPPLIER_DELIVER = 8;
}
+2
View File
@@ -60,6 +60,8 @@ class Transaction extends AbstractModel implements Documentable
{
if($this->booking()->first()->fix_currency_id !== 1) {
$currency_rate = $this->currency()->first()->rates()->where('payment_method_type', $this->payment_method)->first();
dd($this->payment_method);
return number_format($this->original_amount / $currency_rate->selling, 2);
}
return $this->original_amount;
@@ -0,0 +1,46 @@
@extends('layouts.base_pdf')
@section('inner_content')
<br>
<htmlpageheader name="page-header">
<br>
<table width="100%" style="border-bottom: 1px solid black;">
<tr>
<td
style="text-align: center; color: red; text-transform: uppercase; font-weight: bold; font-size: 18px; padding-bottom: 5px;">
Atvantic Import & Export Snd. Bhd (1309816-P)</td>
</tr>
</table>
</htmlpageheader>
@foreach ($transactions as $key => $transaction)
<table class="line-table" style="overflow: wrap" autosize="1">
<thead>
<tr>
<th width="5%">No</th>
<th class="stock-code" width="10%">Subtotal</th>
<th class="description">Service Charges</th>
<th width="10%">Tax</th>
<th width="10%">Total Amount<br>(RM)</th>
</tr>
</thead>
<tbody>
<tr>
<td width="5%" class="center top">{{ $key + 1 }}</td>
<td class="stock-code top" width="10%">{{ $transaction->amount }}</td>
<td class="description">MYR {{ number_format($transaction->service_charge, 2) }}</td>
<td width="10%" class="center top">MYR {{ number_format($transaction->tax, 2) }}</td>
<td width="12%" class="center top">{{ $transaction->amount }}</td>
</tr>
</tbody>
</table>
@endforeach
<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
@@ -3,7 +3,7 @@
<br>
<htmlpageheader name="page-header">
<br><br>
<div class="separator"><strong><i>{{ $transaction->bill_no }}</i></strong></div>
<div class="separator"><strong><i>{{ $invoice_transaction->bill_no }}</i></strong></div>
</htmlpageheader>
<table>
@@ -30,11 +30,11 @@
</strong>
</div>
<div class="number">EDO: {{ $transaction->bill_no }}</div>
<div class="number">EDO: {{ $invoice_transaction->bill_no }}</div>
<div class="ref">REF: {{ $transaction->payment_reference ?? '-' }}</div>
<div class="date">Date: {{ $transaction->created_at }}</div>
<div class="ref">REF: {{ $invoice_transaction->payment_reference ?? '-' }}</div>
<div class="date">Date: {{ $invoice_transaction->created_at }}</div>
<div>&nbsp;</div>
</div>
</td>
@@ -51,7 +51,13 @@
Company: {{ $supplier->name }}
</div>
<div class="address">
sdas sda sdsd dtaman asdksd 4.000
@php
$addresses = $supplier->addresses()->first();
@endphp
{{ $addresses->street_one }}
{{ $addresses->street_two }}
{{ $addresses->state()->first()->name }}
{{ $addresses->district()->first()->name }}
</div>
<div>
Phone: {{ $supplier->contacts()->first()->phone }}
@@ -62,7 +68,7 @@
<br>
<br>
<table style="overflow: wrap" autosize="1">
<table class="line-table" style="overflow: wrap" autosize="1">
<thead>
<tr>
<th width="5%">No</th>
@@ -74,29 +80,66 @@
</tr>
</thead>
<tbody>
@foreach ($transaction->transactionDetails as $key => $transaction_detail)
@foreach ($po_order_transaction->transactionDetails as $key => $transaction_detail)
<tr>
<td width="5%">{{ $key + 1 }}</td>
<td class="stock-code" width="10%">{{ $transaction_detail->product_code }}</td>
<td width="5%" class="center top">{{ $key + 1 }}</td>
<td class="stock-code top" width="10%">{{ $transaction_detail->product_code }}</td>
<td class="description">{{ $transaction_detail->product_name }}</td>
<td width="10%">{{ $transaction_detail->quantity }}</td>
<td width="12%">{{ $transaction_detail->convert_original_price() }}</td>
<td width="20%" class="right">{{ $transaction_detail->convert_original_amount() }}</td>
<td width="10%" class="center top">{{ $transaction_detail->quantity }}</td>
<td width="12%" class="center top">
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
{{ number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2) }}
@else
{{ number_format($transaction_detail->price, 2) }}
@endif
</td>
<td width="20%" class="right top">
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
{{ number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->amount, 2) }}
@else
{{ number_format($transaction_detail->amount, 2) }}
@endif
</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr class="subtotal">
<td colspan="4"></td>
<td class="right">Subtotal</td>
<td class="right">{{ $transaction->convert_original_amount() }}</td>
<td class="right middle">Subtotal</td>
<td class="right middle">
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
{{ number_format( (1/$invoice_transaction->currency_rate) * $invoice_transaction->amount, 2) }}
@else
{{ number_format($invoice_transaction->amount, 2) }}
@endif
</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">Total</td>
<td class="total right">{{ $transaction->convert_original_amount() }}</td>
<td class="right middle">Total</td>
<td class="total right middle">
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
{{ number_format( ((1/$invoice_transaction->currency_rate) * $invoice_transaction->amount) - $invoice_transaction->service_charge - $invoice_transaction->tax, 2) }}
@else
{{ number_format($invoice_transaction->amount - $invoice_transaction->service_charge - $invoice_transaction->tax, 2) }}
@endif
</td>
</tr>
</tfoot>
</table>
<htmlpagefooter name="page-footer">
@@ -3,7 +3,7 @@
<br>
<htmlpageheader name="page-header">
<br><br>
<div class="separator"><strong><i>{{ $transaction->bill_no }}</i></strong></div>
<div class="separator"><strong><i>{{ $invoice_transaction->bill_no }}</i></strong></div>
</htmlpageheader>
<table>
<tr>
@@ -29,11 +29,11 @@
</strong>
</div>
<div class="number">EI#: {{ $transaction->bill_no }}</div>
<div class="number">EI#: {{ $invoice_transaction->bill_no }}</div>
<div class="ref">Ref# {{ $transaction->payment_reference ?? '-' }}</div>
<div class="date">Date: {{ $transaction->created_at }}</div>
<div class="ref">Ref# {{ $invoice_transaction->payment_reference ?? '-' }}</div>
<div class="date">Date: {{ $invoice_transaction->created_at }}</div>
<div>&nbsp;</div>
</div>
</td>
@@ -50,7 +50,13 @@
Company: {{ $supplier->name }}
</div>
<div class="address">
sdas sda sdsd dtaman asdksd 4.000
@php
$addresses = $supplier->addresses()->first();
@endphp
{{ $addresses->street_one }}
{{ $addresses->street_two }}
{{ $addresses->state()->first()->name }}
{{ $addresses->district()->first()->name }}
</div>
<div>
Phone: {{ $supplier->contacts()->first()->phone }}
@@ -61,7 +67,7 @@
<br>
<br>
<table style="overflow: wrap" autosize="1">
<table class="line-table" style="overflow: wrap" autosize="1">
<thead>
<tr>
<th width="5%">No</th>
@@ -73,32 +79,65 @@
</tr>
</thead>
<tbody>
@foreach ($transaction->transactionDetails as $key => $transaction_detail)
@foreach ($po_order_transaction->transactionDetails as $key => $transaction_detail)
<tr>
<td width="5%">{{ $key + 1 }}</td>
<td class="stock-code" width="10%">{{ $transaction_detail->product_code }}</td>
<td width="5%" class="center top">{{ $key + 1 }}</td>
<td class="stock-code top" width="10%">{{ $transaction_detail->product_code }}</td>
<td class="description">{{ $transaction_detail->product_name }}</td>
<td width="10%">{{ $transaction_detail->quantity }}</td>
<td width="12%">{{ $transaction_detail->convert_original_price() }}</td>
<td width="20%" class="right">{{ $transaction_detail->convert_original_amount() }}</td>
<td width="10%" class="center top">{{ $transaction_detail->quantity }}</td>
<td width="12%" class="center top">
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
{{ number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2) }}
@else
{{ number_format($transaction_detail->price, 2) }}
@endif
</td>
<td width="20%" class="right top">
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
{{ number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->amount, 2) }}
@else
{{ number_format($transaction_detail->amount, 2) }}
@endif
</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr class="subtotal">
<td colspan="4"></td>
<td class="right">Subtotal</td>
<td class="right">{{ $transaction->convert_original_amount() }}</td>
<td class="right middle">Subtotal</td>
<td class="right middle">
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
{{ number_format( (1/$invoice_transaction->currency_rate) * $invoice_transaction->amount, 2) }}
@else
{{ number_format($invoice_transaction->amount, 2) }}
@endif
</td>
</tr>
{{-- <tr class="billingcharges">
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Billing Charges</td>
<td class="right">{{ $transaction->service_charge }}</td>
</tr> --}}
<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">Total</td>
<td class="total right">{{ $transaction->convert_original_amount() }}</td>
<td class="right middle">Total</td>
<td class="total right middle">
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
{{ number_format( ((1/$invoice_transaction->currency_rate) * $invoice_transaction->amount) - $invoice_transaction->service_charge - $invoice_transaction->tax, 2) }}
@else
{{ number_format($invoice_transaction->amount - $invoice_transaction->service_charge - $invoice_transaction->tax, 2) }}
@endif
</td>
</tr>
</tfoot>
</table>
@@ -3,7 +3,7 @@
<br>
<htmlpageheader name="page-header">
<br><br>
<div class="separator"><strong><i>{{ $transaction->bill_no }}</i></strong></div>
<div class="separator"><strong><i>{{ $po_order_transaction->bill_no }}</i></strong></div>
</htmlpageheader>
<br>
<table>
@@ -12,9 +12,9 @@
<strong>Purchase Order</strong>
</td>
<td class="document-detail">
PO#: {{ $transaction->bill_no }} <br>
Ref#: {{ $transaction->payment_reference ?? '-' }} <br>
Date: {{ $transaction->created_at }}
PO#: {{ $po_order_transaction->bill_no }} <br>
Ref#: {{ $po_order_transaction->payment_reference ?? '-' }} <br>
Date: {{ $po_order_transaction->created_at }}
</td>
</tr>
</table>
@@ -30,7 +30,7 @@
<br>
<div class="buyer-company">
Marking#: {{ $transaction->booking->marking }}
Marking#: {{ $po_order_transaction->booking->marking }}
</div>
<span class="buyer-company">
@@ -41,7 +41,13 @@
</span>
<br>
<span class="address">
{{-- {{ $buyer['address'] }} --}}
@php
$addresses = $supplier->addresses()->first();
@endphp
{{ $addresses->street_one }}
{{ $addresses->street_two }}
{{ $addresses->state()->first()->name }}
{{ $addresses->district()->first()->name }}
</span>
<br>
<span class="contact-no">
@@ -80,14 +86,26 @@
</tr>
</thead>
<tbody>
@foreach ($transaction->transactionDetails as $key => $transaction_detail)
@foreach ($po_order_transaction->transactionDetails as $key => $transaction_detail)
<tr>
<td width="5%" class="center top">{{ $key + 1 }}</td>
<td class="stock-code top" width="10%">{{ $transaction_detail->product_code }}</td>
<td class="description">{{ $transaction_detail->product_name }}</td>
<td width="10%" class="center top">{{ $transaction_detail->quantity }}</td>
<td width="12%" class="center top">{{ $transaction_detail->convert_original_price() }}</td>
<td width="20%" class="right top">{{ $transaction_detail->convert_original_amount() }}</td>
<td width="12%" class="center top">
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
{{ number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2) }}
@else
{{ number_format($transaction_detail->price, 2) }}
@endif
</td>
<td width="20%" class="right top">
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
{{ number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->amount, 2) }}
@else
{{ number_format($transaction_detail->amount, 2) }}
@endif
</td>
</tr>
@endforeach
</tbody>
@@ -95,17 +113,38 @@
<tr class="subtotal">
<td colspan="4"></td>
<td class="right middle">Subtotal</td>
<td class="right middle">{{ $transaction->convert_original_amount() }}</td>
<td class="right middle">
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
{{ number_format( (1/$invoice_transaction->currency_rate) * $invoice_transaction->amount, 2) }}
@else
{{ number_format($invoice_transaction->amount, 2) }}
@endif
</td>
</tr>
{{-- <tr class="billingcharges">
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right middle">Billing Charges</td>
<td class="right middle">{{ number_format($billingcharges, 2) }}</td>
</tr> --}}
<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">{{ $transaction->convert_original_amount() }}</td>
<td class="total right middle">
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
{{ number_format( ((1/$invoice_transaction->currency_rate) * $invoice_transaction->amount) - $invoice_transaction->service_charge - $invoice_transaction->tax, 2) }}
@else
{{ number_format($invoice_transaction->amount - $invoice_transaction->service_charge - $invoice_transaction->tax, 2) }}
@endif
</td>
</tr>
</tfoot>
</table>
@@ -18,9 +18,9 @@
<strong>Delivery Order</strong>
</td>
<td class="document-detail">
PO#: {{ $transaction->bill_no }} <br>
Ref#: {{ $transaction->payment_reference ?? '-' }} <br>
Date: {{ $transaction->created_at }}
PO#: {{ $supplier_deliver_order_transaction->bill_no }} <br>
Ref#: {{ $supplier_deliver_order_transaction->payment_reference ?? '-' }} <br>
Date: {{ $supplier_deliver_order_transaction->created_at }}
</td>
</tr>
</table>
@@ -71,14 +71,26 @@
</tr>
</thead>
<tbody>
@foreach ($transaction->transactionDetails as $key => $transaction_detail)
@foreach ($po_order_transaction->transactionDetails as $key => $transaction_detail)
<tr>
<td width="5%" class="center top">{{ $key + 1 }}</td>
<td class="stock-code top" width="10%">{{ $transaction_detail->product_code }}</td>
<td class="description">{{ $transaction_detail->product_name }}</td>
<td width="10%" class="center top">{{ $transaction_detail->quantity }}</td>
<td width="12%" class="center top">{{ $transaction_detail->convert_original_price() }}</td>
<td width="20%" class="right top">{{ $transaction_detail->convert_original_amount() }}</td>
<td width="12%" class="center top">
@if($supplier_deliver_order_transaction->booking()->first()->fix_currency_id !== 1)
{{ number_format( (1/$supplier_deliver_order_transaction->currency_rate) * $transaction_detail->price, 2) }}
@else
{{ number_format($transaction_detail->price, 2) }}
@endif
</td>
<td width="20%" class="right top">
@if($supplier_deliver_order_transaction->booking()->first()->fix_currency_id !== 1)
{{ number_format( (1/$supplier_deliver_order_transaction->currency_rate) * $transaction_detail->amount, 2) }}
@else
{{ number_format($transaction_detail->amount, 2) }}
@endif
</td>
</tr>
@endforeach
</tbody>
@@ -86,14 +98,25 @@
<tr class="subtotal">
<td colspan="4"></td>
<td class="right middle">Subtotal</td>
<td class="right middle">{{ $transaction->convert_original_amount() }}</td>
<td class="right middle">
@if($supplier_deliver_order_transaction->booking()->first()->fix_currency_id !== 1)
{{ number_format( (1/$supplier_deliver_order_transaction->currency_rate) * $supplier_deliver_order_transaction->amount, 2) }}
@else
{{ number_format($supplier_deliver_order_transaction->amount, 2) }}
@endif
</td>
</tr>
<tr>
<td colspan="4"></td>
<td class="right middle">Total</td>
<td class="total right middle">{{ $transaction->convert_original_amount() }}</td>
<td class="total right middle">
@if($supplier_deliver_order_transaction->booking()->first()->fix_currency_id !== 1)
{{ number_format( ((1/$supplier_deliver_order_transaction->currency_rate) * $supplier_deliver_order_transaction->amount), 2) }}
@else
{{ number_format($supplier_deliver_order_transaction->amount, 2) }}
@endif
</td>
</tr>
</tfoot>
</table>
<htmlpagefooter name="page-footer">