{{-- Summary Section --}} {{-- Calculated Totals --}} @php $totalCost = 0; $totalVariance = 0; $totalReceived = 0; $totalQtyOrdered = 0; $totalQtyReceived = 0; $totalQtyVariance = 0; $notFoundQty = 0; $notFoundCost = 0; $receiveOrder->no_of_boxes != 0 ? (int) $this->receiveOrderLineCounts()->sum('qty') : (int) $this->receiveOrderLines()->sum('counted_qty') foreach ($receiveOrderLines as $line) { $lineCost = ($line->qty ?? 0) * $line->cost; $lineReceivedCost = ($line->counted_qty ?? 0) * $line->cost; $lineVariance = (($line->counted_qty ?? 0) - $line->qty) * $line->cost; // $lineVariance = ( $line->qty - ($line->counted_qty ?? 0)) * $line->cost; $totalCost += $lineCost; $totalVariance += $lineVariance; $totalReceived += $lineReceivedCost; $totalQtyOrdered += $line->qty; $totalQtyReceived += $line->counted_qty; $totalQtyVariance += ($line->qty ?? 0) - $line->counted_qty; // formula: Received + created - invoice } foreach ($receiveOrderNotFound as $notFound) { $notFoundQty += $notFound->counted_qty; $notFoundCost += $notFound->counted_qty * $notFound->alias_cost ?? 0; } $totalQtyVariance -= $notFoundQty; $totalQtyVariance = $totalQtyVariance * -1; $totalVariance += $notFoundCost; @endphp

RECEIVE ORDER DETAIL SHEET

{{-- --}}
Receive Order ID: {{ $receiveOrder->id }} Qty: Value:
Report Generated at: {{ date(config('app.datetime_format')) }} Invoice: {{ number_format((float) ($totalQtyOrdered ?? 0), 2) }}{{ number_format($totalQtyOrdered, 0) }}{{ number_format($totalCost, 2) }}
Session created at: {{ $receiveOrder->created_at->format(config('app.datetime_format')) }} Received: {{ number_format($totalQtyReceived, 0) }} {{ number_format($totalReceived, 2) }}
Session created by: {{ $receiveOrder->createdBy->name }} Created: {{ number_format($notFoundQty, 0) }} {{ number_format($notFoundCost, 2) }}
Session Closed at: {{ isset($receiveOrder->closed_at) ? $receiveOrder->closed_at->format(config('app.datetime_format')) : '' }} Variance: {{ is_numeric($totalQtyVariance) ? number_format((float) $totalQtyVariance, 2) : '0.00' }} {{ number_format($totalVariance, 2) }}
Session Closed by: {{ $receiveOrder->closedBy->name ?? '' }}
Franchise: {{ $receiveOrder->franchise->name }}
User Reference: {{ $receiveOrder->user_reference }}
Warehouse: {{ $receiveOrder->warehouse->name }}
No. of Cartons Completed: {{ $receiveOrder->completedBoxes }}
No. of Cartons Packing list: {{ $receiveOrder->no_of_boxes == 0 ? $receiveOrder->boxes->count() : 0 }}
Currency: {{ $receiveOrder->currency }}
Report status: {{ $reportType }}
{{-- Table --}} {{-- --}} @foreach ($receiveOrderLines as $line) {{-- --}} {{-- --}} {{-- Invoice Value --}} {{-- Received Value --}} {{-- Variance (Qty - Counted Qty) --}} {{-- Variance cost (Qty - Counted Qty) --}} @endforeach {{-- Total Row --}} @foreach ($receiveOrderNotFound as $notFound) {{-- --}} {{-- --}} @endforeach
Grand Total {{ number_format($totalQtyOrdered, 0) }} {{ number_format($totalCost, 2) }} {{ number_format($totalQtyReceived + $notFoundQty, 0) }} {{ number_format($totalReceived + $notFoundCost, 2) }} {{ number_format($totalQtyVariance, 0) }} {{ number_format($totalVariance, 2) }}
Barcode Description Size Codein Style Colour Carton No.Counted ByCounted At Unit Cost Invoice Qty Invoice Value Received Qty Received Value Variance Qty Variance Value
{{ $line->barcode }} {{ $line->description }} {{ $line->size }} {{ $line->codein }} {{ $line->style }} {{ $line->colour }} {{ isset($line->box->name) ? $line->box->name : '' }}{{ $line->countedBy->name }} {{ isset($line->box->name) ? $line->updated_at->format(config('app.datetime_format')) : '' }} {{ number_format($line->cost, 2) }} {{ $line->qty }} {{ number_format(($line->qty ?? 0) * $line->cost, 2) }} {{ $line->counted_qty ?? 0 }} {{ number_format(($line->counted_qty ?? 0) * $line->cost, 2) }} {{ ($line->counted_qty ?? 0) - $line->qty }} {{ number_format((($line->counted_qty ?? 0) - $line->qty) * $line->cost) }}
CREATED BARCODES
{{ $notFound->barcode }} {{ $notFound->description }} {{ $notFound->possible_alias != null ? " alias of $notFound->possible_alias" : '' }} {{ $notFound->size }} {{ $notFound->codein }} {{ $notFound->style }} {{ $notFound->colour }} {{ isset($line->box->name) ? $line->box->name : '' }}{{ $line->countedBy->name }} {{ isset($line->box->name) ? $line->updated_at->format(config('app.datetime_format')) : '' }} {{ number_format($notFound->alias_cost ?? 0, 2) }} 0 0 {{ $notFound->counted_qty }} {{ number_format(($notFound->alias_cost ?? 0) * ($notFound->counted_qty ?? 0), 2) }} {{ $notFound->counted_qty }} {{ number_format($notFound->counted_qty * $notFound->alias_cost ?? 0) }}