@php
use App\Helpers\CommonHelper;
$companyId = $companyId ?? Session::get('run_company');
$printDate = date('d-M-y h:i A');
$deliveryDate = !empty($row->due_date)
? strtoupper(date('d-M-y', strtotime($row->due_date)))
: strtoupper(date('d-M-y', strtotime($row->purchase_request_date)));
$orderNo = $row->purchase_request_no ?? '';
$numericOrderNo = ltrim(preg_replace('/\D/', '', (string) $orderNo), '0');
$orderNoDisplay = $numericOrderNo !== '' ? $numericOrderNo : $orderNo;
$soNo = trim($row->s_order_no ?? '');
if ($soNo === '' && !empty($row->sales_order_id)) {
CommonHelper::companyDatabaseConnection($companyId);
$soNo = DB::table('sales_order')->where('id', $row->sales_order_id)->value('so_no') ?? '';
CommonHelper::reconnectMasterDatabase();
}
$productCount = count($purchaseRequestDataDetail);
$lineTotal = 0;
foreach ($purchaseRequestDataDetail as $lineRow) {
$lineTotal += (float) ($lineRow->net_amount ?? 0);
}
$grandTotal = $lineTotal + (float) ($row->sales_tax_amount ?? 0);
if ($grandTotal <= 0 && !empty($row->total_amount)) {
$grandTotal = (float) $row->total_amount;
}
$paymentContact = trim($letterhead->footer_text ?? '');
if ($paymentContact === '') {
$paymentContact = 'FOR PAYMENTS PLEASE CONTACT ACCOUNTS DEPARTMENT.';
}
@endphp
| Supplier : |
{{ strtoupper($supplier->name ?? '') }} |
| Address : |
{{ strtoupper(trim($supplier->address ?? '')) }} |
|
| Order No. : |
{{ $orderNoDisplay }} |
| Delivery Date : |
{{ $deliveryDate }} |
| Prepared By : |
{{ strtoupper($row->username ?? '') }} |
| Print Date : |
{{ strtoupper($printDate) }} |
|
| Particulars |
Remarks |
| Quantity |
Unit |
Rate |
Amount |
|
@foreach($purchaseRequestDataDetail as $row1)
@php
$subIcDetail = explode(',', CommonHelper::get_subitem_detail($row1->sub_item_id));
$itemName = CommonHelper::get_item_name($row1->sub_item_id);
if (!empty($row1->description) && !is_numeric($row1->description)) {
$itemName = $row1->description;
}
$uomId = $row1->uom_id ?? ($subIcDetail[0] ?? '');
$uomName = CommonHelper::get_uom_name($uomId);
$qty = $row1->display_qty ?? $row1->purchase_approve_qty ?? 0;
$remarksText = trim($qty . ' ' . $uomName);
@endphp
|
{{ strtoupper($itemName) }}
| {{ number_format((float) $qty, 4, '.', '') }} |
{{ $uomName }} |
{{ number_format((float) ($row1->rate ?? 0), 4, '.', '') }} |
{{ number_format((float) ($row1->net_amount ?? 0), 2) }} |
|
{{ $remarksText }} |
@endforeach
Total No of Products : {{ $productCount }}
{{ strtoupper($paymentContact) }}
|
Amount In Words :
{{ $row->amount_in_words ?? '' }}
|
Total Amount :
{{ number_format($grandTotal, 2) }}
|
@if($soNo !== '')
S.O. No. : {{ strtoupper($soNo) }}
@endif