@if(session('success'))
{{ session('success') }}
@endif
@php
$totalRawWeight = $production->inputItems->sum('quantity');
$totalFinishWeight = $production->outputItems->sum('quantity');
$totalWastageWeight = $production->wastageItems ? $production->wastageItems->sum('quantity') : 0;
$totalFinishAmount = $production->outputItems->sum('amount');
$wastagePercent = $totalRawWeight > 0 ? ($totalWastageWeight / $totalRawWeight) * 100 : 0;
// Calculate wastage weight (input - output)
$actualWastage = $totalRawWeight - $totalFinishWeight;
// Calculate wastage cost (proportional cost of wasted material)
$wastageCost = $totalRawWeight > 0 ? ($actualWastage / $totalRawWeight) * $production->raw_material_cost : 0;
// Wastage cost per unit of output
$wastePerUnit = $totalFinishWeight > 0 ? $wastageCost / $totalFinishWeight : 0;
// Wastage percentage of output
$wastageOutputPercent = $totalRawWeight > 0 ? (($totalRawWeight - $totalFinishWeight) / $totalRawWeight) * 100 : 0;
@endphp
RAW MATERIAL
| Description |
Total Weight |
% |
Rate |
Amount |
@foreach($production->inputItems as $item)
@php
$percentage = $totalRawWeight > 0 ? ($item->quantity / $totalRawWeight) * 100 : 0;
@endphp
| {{ $item->item->name ?? '-' }} |
{{ number_format($item->quantity, 0) }} |
{{ number_format($percentage, 2) }} |
{{ number_format($item->rate, 2) }} |
{{ number_format($item->amount, 0) }} |
@endforeach
{{-- Empty rows to match Excel style --}}
@for($i = $production->inputItems->count(); $i < 8; $i++)
| |
|
|
|
0 |
@endfor
@if($totalWastageWeight > 0)
| Panjee (Wastage) |
{{ number_format($totalWastageWeight, 0) }} |
{{ number_format($wastagePercent, 2) }} |
|
|
@endif
| TOTAL |
{{ number_format($totalRawWeight, 0) }} |
100.00 |
|
{{ number_format($production->raw_material_cost, 0) }} |
FINISH MATERIAL
| Description |
Total Weight |
Rate |
Amount |
@foreach($production->outputItems as $item)
| {{ $item->item->name ?? '-' }} |
{{ number_format($item->quantity, 0) }} |
{{ number_format($item->rate, 2) }} |
{{ number_format($item->amount, 0) }} |
@endforeach
{{-- Empty rows to match Excel style --}}
@for($i = $production->outputItems->count(); $i < 8; $i++)
| |
|
|
0 |
@endfor
| Panjee |
{{ number_format($totalRawWeight, 0) }} |
|
|
| TOTAL |
{{ number_format($totalFinishWeight, 0) }} |
|
{{ number_format($totalFinishAmount, 0) }} |
Raw Material Cost
Rs. {{ number_format($production->raw_material_cost, 0) }}
Total Output Weight
{{ number_format($totalFinishWeight, 0) }} KG
Finish Material Value
Rs. {{ number_format($totalFinishAmount, 0) }}
Avg Cost Per KG
Rs. {{ number_format($production->cost_per_unit, 2) }}
Input Weight
{{ number_format($totalRawWeight, 0) }} KG
−
Output Weight
{{ number_format($totalFinishWeight, 0) }} KG
=
Wastage Weight
{{ number_format($actualWastage, 0) }} KG
|
Wastage %
{{ number_format($wastageOutputPercent, 2) }}%
|
Wastage Cost
Rs. {{ number_format($wastageCost, 0) }}
|
Waste Per Unit
Rs. {{ number_format($wastePerUnit, 2) }}/KG
@if($production->narration)
{{ $production->narration }}
@endif
Created by: {{ $production->creator->name ?? 'System' }} |
Created: {{ $production->created_at->format('d-M-Y h:i A') }}
@if($production->updated_at != $production->created_at)
| Updated: {{ $production->updated_at->format('d-M-Y h:i A') }}
@endif