@if($filtros['tipoAtencion'] != 'Todos' || !empty($filtros['meses'])) @endif @if(!empty($compararAno)) @endif @foreach($meses as $row) @php $esMejor = isset($mejor_mes) && $mejor_mes['mes_num'] == $row['mes_num'] && $row['ventas_netas'] > 0; $momClass = $row['crecimiento_mom_pct'] >= 0 ? '#155724' : '#721c24'; @endphp @if(!empty($compararAno) && isset($row['comparacion'])) @php $comp = $row['comparacion']; $yoyClass = $comp['crecimiento_yoy_pct'] >= 0 ? '#155724' : '#721c24'; @endphp @endif @endforeach @if(!empty($compararAno) && isset($resumen_comparativo)) @endif
ANÁLISIS DE VENTAS Y CRECIMIENTO MES A MES (Año: {{ $ano }} @if(!empty($compararAno)) vs Año: {{ $compararAno }} @endif)
Filtro Tipo de Atención: [{{ $filtros['tipoAtencion'] }}] | Meses: [{{ is_array($filtros['meses']) ? implode(', ', $filtros['meses']) : $filtros['meses'] }}]
Mes Ventas Brutas ($) Devoluciones ($) Venta Neta {{ $ano }} ($) Costo Neto ($) Utilidad Bruta ($) Margen (%) Cant. Facturas Ticket Prom. ($) Crecimiento MoM (%)Venta Neta {{ $compararAno }} ($) Dif. Venta ($) Crecimiento YoY (%) Utilidad {{ $compararAno }} ($)% Part. Año
{{ $row['nombre'] }} @if($esMejor) 🏆 (MEJOR MES) @endif {{ round($row['ventas_brutas']) }} {{ round($row['devoluciones']) }} {{ round($row['ventas_netas']) }} {{ round($row['costo_neto']) }} {{ round($row['utilidad_neta']) }} {{ $row['rentabilidad_pct'] }}% {{ $row['cantidad_facturas'] }} {{ round($row['ticket_promedio']) }} {{ $row['crecimiento_mom_pct'] > 0 ? '+' : '' }}{{ $row['crecimiento_mom_pct'] }}% {{ round($comp['ventas_netas']) }} {{ round($comp['diferencia_ventas']) }} {{ $comp['crecimiento_yoy_pct'] > 0 ? '+' : '' }}{{ $comp['crecimiento_yoy_pct'] }}% {{ round($comp['utilidad_neta']) }}{{ $row['porcentaje_ano'] ?? 0 }}%
TOTALES CONSOLIDADOS {{ round($totales['gran_total_bruto'] ?? 0) }} {{ round($totales['gran_total_dev'] ?? 0) }} {{ round($totales['gran_total_neto']) }} {{ round($totales['gran_total_costo'] ?? 0) }} {{ round($totales['gran_total_utilidad'] ?? 0) }} {{ $totales['gran_total_rentabilidad'] ?? 0 }}% {{ $totales['gran_total_facturas'] }} {{ round($totales['ticket_promedio_general']) }} -{{ round($resumen_comparativo['gran_total_neto_comp']) }} {{ round($resumen_comparativo['diferencia_venta_anual']) }} {{ $resumen_comparativo['crecimiento_anual_pct'] > 0 ? '+' : '' }}{{ $resumen_comparativo['crecimiento_anual_pct'] }}% {{ round($resumen_comparativo['gran_total_utilidad_comp']) }}100%
@if(!empty($compararAno) && isset($resumen_comparativo))

RESUMEN COMPARATIVO ANUAL (Año {{ $ano }} vs Año {{ $compararAno }})
Concepto Año {{ $ano }} Año {{ $compararAno }} Diferencia ($) Crecimiento Interanual (%)
Venta Neta Total {{ round($totales['gran_total_neto']) }} {{ round($resumen_comparativo['gran_total_neto_comp']) }} {{ round($resumen_comparativo['diferencia_venta_anual']) }} {{ $resumen_comparativo['crecimiento_anual_pct'] > 0 ? '+' : '' }}{{ $resumen_comparativo['crecimiento_anual_pct'] }}%
Utilidad Bruta {{ round($totales['gran_total_utilidad']) }} {{ round($resumen_comparativo['gran_total_utilidad_comp']) }} {{ round($resumen_comparativo['diferencia_util_anual']) }} {{ $resumen_comparativo['crecimiento_util_pct'] > 0 ? '+' : '' }}{{ $resumen_comparativo['crecimiento_util_pct'] }}%
Facturas Emitidas {{ $totales['gran_total_facturas'] }} {{ $resumen_comparativo['gran_total_facturas_comp'] }} {{ $totales['gran_total_facturas'] - $resumen_comparativo['gran_total_facturas_comp'] }} @php $difFacPct = $resumen_comparativo['gran_total_facturas_comp'] > 0 ? round((($totales['gran_total_facturas'] - $resumen_comparativo['gran_total_facturas_comp']) / $resumen_comparativo['gran_total_facturas_comp']) * 100, 2) : 0; @endphp {{ $difFacPct > 0 ? '+' : '' }}{{ $difFacPct }}%
Promedio Mensual de Venta {{ round($totales['promedio_mensual_venta']) }} {{ round($resumen_comparativo['gran_total_neto_comp'] / ($totales['meses_evaluados'] ?: 1)) }} {{ round($totales['promedio_mensual_venta'] - ($resumen_comparativo['gran_total_neto_comp'] / ($totales['meses_evaluados'] ?: 1))) }} -
@endif