@php $invNo = $purchaseOrder->grnInvoices->pluck('invoice_no', 'id')->toArray(); @endphp @foreach ($products as $item) @php $po = $po_details->where('product_id', $item->id)->first(); $grnInfo = ['invoices' => '', 'grn_qty' => 0, 'grn_date' => '', 'grn_price' => '']; foreach ($transactions->where('product_id', $item->id) as $value) { $grnInfo['invoices'] .= isset($invNo[$value->store_invoice_id]) ? $invNo[$value->store_invoice_id] . ', ': ''; $grnInfo['grn_qty'] += $value->quantity; $grnInfo['grn_date'] .= isset($value->date) ? date('d-m-Y H:i A', strtotime($value->date)) . ', ' : ''; $grnInfo['grn_price'] .= number_format($value->price,2) . ', '; } @endphp created_at)) style="background-color: rgb(235, 247, 149)" @endif> @endforeach
# Product PO Date GRN Date GRN Invoices PO Price GRN Price PO Qty GRN Qty Diff
{{ $loop->iteration }} {{ $item->name_eng }} @if (isset($po->created_at)) {{ date('d-m-Y H:i A', strtotime($po->created_at)) }} @endif {{ $grnInfo['grn_date'] }} {{ $grnInfo['invoices'] }} {{ number_format($po->rate??0, 2) }} {{ $grnInfo['grn_price'] }} {{ $po->quantity ?? '' }} {{ $grnInfo['grn_qty'] }} @php $PoQty = $po->quantity ?? 0; $diff = $PoQty - $grnInfo['grn_qty']; @endphp {{ $diff }}