Files
exchange-2.0/resources/views/pages/pdfs/purchase_order.blade.php
T

202 lines
8.3 KiB
PHP

@extends('layouts.base_pdf')
@section('inner_content')
<br>
<htmlpageheader name="page-header">
<br><br>
<div class="separator"><strong><i>{{ $po_order_transaction->bill_no }}</i></strong></div>
</htmlpageheader>
<br>
<table>
<tr>
<td class="title">
<strong>Purchase Order</strong>
</td>
<td class="document-detail">
PO#: {{ $po_order_transaction->bill_no }} <br>
Ref#: {{ $po_order_transaction->booking->marking }} <br>
Date: {{ $supplier->segments->whereIn('id', [23])->first() ? \Carbon\Carbon::now() : $po_order_transaction->booking->created_at }}
</td>
</tr>
</table>
<br>
<table class="buyer-seller">
<tr>
<td width="50%" class="top">
<span class="buyer-seller-title">
Buyer
</span>
<br>
<div class="buyer-company">
Marking#: {{ $po_order_transaction->booking->marking }}
</div>
<span class="buyer-company">
{{ $supplier->name }}
</span>
<span class="reg">
{{-- {{ $supplier }} --}}
</span>
<br>
<span class="address">
@php
$addresses = $supplier->addresses()->where('billing', '=', true)->first();
@endphp
{{ $addresses->street_one }}
{{ $addresses->street_two }}
{{ $addresses->state()->first()->name }}
{{ $addresses->district()->first()->name }}
</span>
<br>
<span class="contact-no">
Phone: {{ $supplier->contacts()->first()->phone }}
</span>
</td>
<td width="50%" class="top">
<span class="buyer-seller-title">
Seller
</span>
<br>
<span class="buyer-company">
CIEF Worldwide Sdn Bhd (1134596-M)
</span>
<div class="address">
No. 72-3, Jalan Jalil 1,<br>
The Earth Bukit Jalil,<br>
57000 Kuala Lumpur
</div>
<div class="contact-no">
Tel: 03-8082 1252
</div>
</td>
</tr>
</table>
<br>
<table class="line-table" style="overflow: wrap" autosize="1">
<thead>
<tr>
<th width="5%">No</th>
<th class="stock-code" width="10%">Stock Code</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>
@php
$subtotal = 0;
@endphp
@if($voucher_redemption)
@php
$voucher_discount = $voucher_redemption->value * -1;
$original_price = 1 / $voucher_redemption->transaction->currency_rate;
$currency_rate = $voucher_redemption->transaction->currency_rate;
@endphp
@else
@php
$voucher_discount = 0;
$currency_rate = $transaction->currency_rate;
@endphp
@endif
@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="15%" class="center top">
@if($transaction->booking()->first()->fix_currency_id !== 1)
{{ number_format( (1/$currency_rate) * $transaction_detail->price, 2) }}
@else
{{ number_format($transaction_detail->price, 2) }}
@endif
</td>
<td width="20%" class="right top">
@if($transaction->booking()->first()->fix_currency_id !== 1)
{{ number_format((float)number_format( (1/$currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }}
@php
$subtotal += number_format((float)number_format( (1/$currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.','');
@endphp
@else
{{ number_format((float)number_format($transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }}
@php
$subtotal += number_format((float)number_format($transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.','');
@endphp
@endif
</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr class="subtotal">
<td colspan="4"></td>
<td class="right middle">Subtotal</td>
<td class="right middle">
{{ number_format($subtotal, 2) }}
</td>
</tr>
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Service Charges</td>
<td class="right">
{{ number_format($transaction->service_charge, 2) }}
</td>
</tr>
@if($voucher_redemption)
<tr class="voucher">
<td colspan="4"></td>
<td class="right middle">Voucher ({{ $voucher_redemption->voucher->code }})</td>
<td class="right middle">
-{{ $voucher_redemption->value }}
</td>
</tr>
@endif
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Adjustment</td>
<td class="right">
@if($transaction->booking()->first()->fix_currency_id !== 1)
{{ number_format((float)number_format( (1/$currency_rate) * $transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }}
@else
{{ number_format((float)number_format($transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }}
@endif
</td>
</tr>
@if($transaction->tax > 0)
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Tax</td>
<td class="right">{{ number_format($transaction->tax, 2) }}</td>
</tr>
@endif
<tr>
<td colspan="4"></td>
<td class="right middle">Total</td>
<td class="total right middle">
@if($transaction->booking()->first()->fix_currency_id !== 1)
{{ number_format( ((1/$currency_rate) * $transaction->amount) + $transaction->service_charge + $transaction->tax + $voucher_discount, 2) }}
@else
{{ number_format($transaction->amount + $transaction->service_charge + $transaction->tax + $voucher_discount, 2) }}
@endif
</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