@php
if (@$order) $order->date = date('d-m-Y H:i:s', strtotime($order->date));
@endphp
@include('v2.inventory.global.party_live_dd', ['type'=> 2, 'binder'=> 'order.party_id', 'skip_add_new'=> 1, 'selected_party'=> @$order?@$order->party:null])
@include('v2.admin.global.date', [
'binder'=> 'order.date',
'value'=> @$order?date('d-m-Y', strtotime($order->date)):date('d-m-Y')
])
| {{ __('obs.sl') }} |
{{ __('obs.product') }} |
{{ __('obs.unit') }} |
{{ __('obs.rate') }} |
{{ __('obs.qty') }} |
{{ __('obs.note') }} |
@php
$products = $products->sortBy(function ($q) {
return [
$q->accGroup->serial,
$q->catByCatCode->serial,
$q->serial,
];
});
$cat_code = null;
$acc_group_id = null;
$orderDetails = [];
$i = -1;
if (@$order) $order->date = date('d-m-Y H:i:s', strtotime($order->date));
@endphp
@foreach ($products as $item)
@if ($item->acc_group_id != $acc_group_id)
@php $acc_group_id = $item->acc_group_id @endphp
|
|
|
|
|
{{ $item->accGroup->name }} |
@endif
@if ($item->cat_code != $cat_code)
@php $cat_code = $item->cat_code @endphp
|
|
|
|
|
{{ $item->catByCatCode->name_eng }} |
@endif
@php
$i++;
$odrDet = null;
if (@$order && $odrDet = $order->details->where('product_id', $item->id)->first()) $odrDet->product = $item;
$orderDetails[] = $odrDet ?? (object) [
'unit_qty' => 1,
'order_qty' => 0,
'description' => '',
'dr_cr' => request()->tran_type==14?2:1,
'id' => null,
'party_id' => null,
'order_invoice_id' => null,
'product' => $item,
'product_id' => $item->id,
'price' => $item->sell_price,
'order_price' => $item->sell_price,
// 'acc_group_id' => $item->acc_group_id,
'transaction_type' => request()->tran_type,
'attribute_transactions' => [],
];
@endphp
| {{ $i+1 }} |
{{ $item->name_eng }}
|
{{ $item->primaryUnit->name }} |
{{ $orderDetails[$i]->price }} |
|
|
@endforeach