@foreach ($units as $unit => $sections)
@foreach ($sections as $section => $productions)
| {{ \App\Models\Section::find($section)->name }} |
{{ number_format(($productions->sum('planned')),0, ',', ' ') }} |
{{ number_format(($productions->map(fn($p) => $p->product ? $p->planned * $p->product->weight : 0)->sum()),0, ',', ' ') }} |
{{ number_format(($productions->sum('achieve')),0, ',', ' ') }} |
{{ number_format(($productions->map(fn($p) => $p->product ? $p->achieve * $p->product->weight : 0)->sum()),0, ',', ' ') }} |
{{ number_format(($productions->sum('conform')),0, ',', ' ') }} |
{{ number_format(($productions->map(fn($p) => $p->product ? $p->conform * $p->product->weight : 0)->sum()),0, ',', ' ') }} |
{{ number_format(($productions->sum('lost')) ,0, ',', ' ')}} |
{{ number_format(($productions->map(fn($p) => $p->product ? $p->lost * $p->product->weight : 0)->sum()),0, ',', ' ') }} |
{{ number_format(($productions->map(fn($p) => $p->product ? $p->achieve * $p->product->weight : 0)->sum()/(($productions->map(fn($p) => $p->product ? $p->planned * $p->product->weight : 0)->sum()) == 0 ? 1 :($productions->map(fn($p) => $p->product ? $p->planned * $p->product->weight : 0)->sum()))*100),2, ',', ' ') }}% |
{{ number_format(((($productions->sum('achieve') - ($productions->sum('conform') + $productions->sum('lost'))) / (($productions->sum('achieve')) == 0 ? 1 : $productions->sum('achieve'))) * 100),2, ',', ' ') }}% |
| # |
Produit |
Poids |
Prévue |
Réalisée |
Non-conforme |
Casse |
@foreach (uniqueProduction($productions) as $production)
| {{ $loop->index + 1 }} |
{{ $production->product ? $production->product->name : 'Product non défini' }} |
{{ $production->product ? number_format($production->product->weight,2, ' ,', ' ') : '0' }} Kg |
{{ number_format($production->planned,0, ',', ' ') }} |
{{ number_format($production->achieve,0, ',', ' ') }} |
{{ number_format($production->conform,0, ',', ' ') }} |
{{ number_format($production->lost,0, ',', ' ') }} |
@endforeach
|
@endforeach
| {{ \App\Models\Unit::find($unit)->name }} |
{{ number_format(($sections->map(fn($ps) => $ps->sum('planned'))->sum()),0, ',', ' ') }} |
{{ number_format($sections->map(fn($ps) => $ps->map(fn($p) => $p->product ? ($p->planned * $p->product->weight) : 0)->sum())->sum(),0, ',', ' ') }} |
{{ number_format(($sections->map(fn($ps) => $ps->sum('achieve'))->sum()),0, ',', ' ') }} |
{{ number_format($sections->map(fn($ps) => $ps->map(fn($p) => $p->product ? ($p->achieve * $p->product->weight) : 0)->sum())->sum(),0, ',', ' ') }} |
{{ number_format(($sections->map(fn($ps) => $ps->sum('conform'))->sum()),0, ',', ' ') }} |
{{ number_format($sections->map(fn($ps) => $ps->map(fn($p) => $p->product ? ($p->conform * $p->product->weight) : 0)->sum())->sum(),0, ',', ' ') }} |
{{ number_format(($sections->map(fn($ps) => $ps->sum('lost'))->sum()),0, ',', ' ') }} |
{{ number_format($sections->map(fn($ps) => $ps->map(fn($p) => $p->product ? ($p->lost * $p->product->weight) : 0)->sum())->sum(),0, ',', ' ') }} |
{{ number_format(($sections->map(fn($ps) => $ps->map(fn($p) => $p->product ? ($p->achieve * $p->product->weight) : 0)->sum())->sum() / $sections->map(fn($ps) => $ps->map(fn($p) => $p->product ? ($p->planned * $p->product->weight) : 0)->sum())->sum()) * 100, 2, ',', ' ') }}% |
{{ number_format((($sections->map(fn($ps) => $ps->map(fn($p) => $p->achieve)->sum())->sum() - ($sections->map(fn($ps) => $ps->map(fn($p) => $p->conform)->sum())->sum() + $sections->map(fn($ps) => $ps->map(fn($p) => $p->lost)->sum())->sum())) / ($sections->map(fn($ps) => $ps->map(fn($p) => $p->achieve)->sum())->sum() ? : 1)) * 100, 2, ',', ' ') }}% |
{{-- {{ number_format(($sections->map(fn($ps) => ((($ps->sum('achieve') - ($ps->sum('conform') + $ps->sum('lost'))) / ($ps->sum('achieve')== 0 ? 1 : $ps->sum('achieve'))) * 100))->sum()),2, ',', ' ') }}% | --}}
{{-- {{ number_format(($sections->map(fn($ps) => ((($ps->sum('achieve') - ($ps->sum('conform') + $ps->sum('lost'))) / ($ps->sum('achieve')== 0 ? 1 : $ps->sum('achieve'))) * 100))->sum() / (count($sections) == 0 ? 1 : count($sections))),2, ',', ' ') }}% | --}}
@endforeach
| Total |
{{ number_format($units->map(fn($sc) => $sc->map(fn($ps) => $ps->sum('planned'))->sum())->sum(),0, ',', ' ') }} |
{{ number_format($units->map(fn($sc) => $sc->map(fn($ps) => $ps->map(fn($p) => $p->product ? ($p->planned * $p->product->weight) : 0)->sum())->sum())->sum(),0, ',', ' ') }} |
{{ number_format($units->map(fn($sc) => $sc->map(fn($ps) => $ps->sum('achieve'))->sum())->sum(),0, ',', ' ') }} |
{{ number_format($units->map(fn($sc) => $sc->map(fn($ps) => $ps->map(fn($p) => $p->product ? ($p->achieve * $p->product->weight) : 0)->sum())->sum())->sum(),0, ',', ' ') }} |
{{ number_format($units->map(fn($sc) => $sc->map(fn($ps) => $ps->sum('conform'))->sum())->sum(),0, ',', ' ') }} |
{{ number_format($units->map(fn($sc) => $sc->map(fn($ps) => $ps->map(fn($p) => $p->product ? ($p->conform * $p->product->weight) : 0)->sum())->sum())->sum(),0, ',', ' ') }} |
{{ number_format($units->map(fn($sc) => $sc->map(fn($ps) => $ps->sum('lost'))->sum())->sum(),0, ',', ' ') }} |
{{ number_format($units->map(fn($sc) => $sc->map(fn($ps) => $ps->map(fn($p) => $p->product ? ($p->lost * $p->product->weight) : 0)->sum())->sum())->sum(),2, ',', ' ') }} |
@php
$denominator = $units->map(fn($sc) => $sc->map(fn($ps) => $ps->map(fn($p) => $p->product ? ($p->planned * $p->product->weight) : 0)->sum())->sum())->sum();
$numerator = $units->map(fn($sc) => $sc->map(fn($ps) => $ps->map(fn($p) => $p->product ? ($p->achieve * $p->product->weight) : 0)->sum())->sum())->sum();
$result = $denominator != 0 ? ($numerator / $denominator) * 100 : 0;
@endphp
{{ number_format($result, 2, ',', ' ') }}%
|
{{ number_format(((($units->map(fn($sc) => $sc->map(fn($ps) => $ps->map(fn($p) => $p->achieve)->sum())->sum())->sum())-(($units->map(fn($sc) => $sc->map(fn($ps) => $ps->map(fn($p) => $p->conform)->sum())->sum())->sum())+($units->map(fn($sc) => $sc->map(fn($ps) => $ps->map(fn($p) => $p->lost)->sum())->sum())->sum())))/(($units->map(fn($sc) => $sc->map(fn($ps) => $ps->map(fn($p) => $p->achieve)->sum())->sum())->sum())== 0 ? 1 : ($units->map(fn($sc) => $sc->map(fn($ps) => $ps->map(fn($p) => $p->achieve)->sum())->sum())->sum())) )*100,2, ',', ' ') }}% |