@php $formatMoney = static fn (float $value): string => number_format($value, 2, ',', '.'); $formatPercent = static fn (float $value): string => number_format($value, 2, ',', '.') . '%'; $kgMsCabDia = (($modelo->peso_neto_entrada + $modelo->peso_neto_venta) / 2) * $modelo->consumo_promedio_ms; $kgMvCabDia = (float) ($kgMsCabDia / ($dietaAverages['porcentaje_ms'] / 100) ?? 0); $costoAlimento = ($kgMvCabDia * $dietaAverages['costo_kg_tc']) * $diasEficiencia * (1 + ($modelo->mortandad / 2)); $costoSanidad = (float) ($costoSanidadCab ?? 0); $costoFletes = (float) ($fleteCompraCab ?? 0) + (float) ($fleteVentaCab ?? 0); $costoComercializacion = (float) ($gastoCompraCab ?? 0) + (float) ($gastoVentaCab ?? 0); $costoEstructura = (float) ($costoAmortizacionCab ?? 0); $subtotalA = $costoAlimento + $costoSanidad + $costoComercializacion + $costoFletes + $costoEstructura; $subtotalB = $costoSanidad + $costoComercializacion + $costoFletes + $costoEstructura; $rows = [ [ 'label' => 'Alimento', 'value' => $costoAlimento, 'percentA' => $subtotalA > 0 ? ($costoAlimento * 100) / $subtotalA : 0, 'percentB' => null, ], [ 'label' => 'Sanidad', 'value' => $costoSanidad, 'percentA' => $subtotalA > 0 ? ($costoSanidad * 100) / $subtotalA : 0, 'percentB' => $subtotalB > 0 ? ($costoSanidad * 100) / $subtotalB : 0, ], [ 'label' => 'Gs Comercialización', 'value' => $costoComercializacion, 'percentA' => $subtotalA > 0 ? ($costoComercializacion * 100) / $subtotalA : 0, 'percentB' => $subtotalB > 0 ? ($costoComercializacion * 100) / $subtotalB : 0, ], [ 'label' => 'Fletes', 'value' => $costoFletes, 'percentA' => $subtotalA > 0 ? ($costoFletes * 100) / $subtotalA : 0, 'percentB' => $subtotalB > 0 ? ($costoFletes * 100) / $subtotalB : 0, ], [ 'label' => 'Estructura', 'value' => $costoEstructura, 'percentA' => $subtotalA > 0 ? ($costoEstructura * 100) / $subtotalA : 0, 'percentB' => $subtotalB > 0 ? ($costoEstructura * 100) / $subtotalB : 0, ], ]; @endphp @if (! $modelo)
Seleccioná un modelo en el panel principal para ver el costo de engorde.
@else @foreach ($rows as $row) @endforeach
Costo de engorde % A % B
{{ $row['label'] }} {{ $formatMoney((float) $row['value']) }} $/cab. {{ $formatPercent((float) $row['percentA']) }} @if ($row['percentB'] === null) @else {{ $formatPercent((float) $row['percentB']) }} @endif
Subtotal A gastos C/aliment. {{ $formatMoney($subtotalA) }} $/cab. {{ $formatPercent(100) }}
Subtotal B costos S/aliment. {{ $formatMoney($subtotalB) }} $/cab. {{ $formatPercent(100) }}
@endif