@foreach ($registros as $row)
|
{{ $num }} |
{{ $row['poliza'] }}
|
{{ $row['inicio_fecha'] . ' al ' . $row['fin_fecha'] }}
|
{{ $row['contratante'] }} |
$
{{ number_format($row['prima_comisionable'], 2) }} |
{{ $row['tipo'] . ' ' . $row['recibo'] }}
|
{{ $row['porcentaje'] }} % |
$
@if ($row['tipo_d'] == 'D')
- {{ number_format($row['prima_comisionable'], 2) }}
@else
{{ number_format($row['prima_comisionable'] * ($row['porcentaje'] / 100), 2, '.', ',') }}
@endif
|
|
@php $num++; @endphp
@endforeach
@foreach ($bonosDelColaborador as $bono)
|
{{ $num }} |
|
|
|
$
{{ number_format($bono['venta'], 2) }} |
@if ($bono['descripcion'] == 'Pago bono manual')
{{ $bono['comentario'] }}
@else
{{ $bono['descripcion'] }}
@endif
|
{{ $bono['porcentaje'] }} % |
$
{{ number_format($bono['total']) }}
|
|
@php $num++; @endphp
@endforeach
@php
$importeCalculado = $registros->sum(function ($item) {
return $item['tipo_d'] == 'D' ? -$item['prima_comisionable'] : $item['prima_comisionable'] * ($item['porcentaje'] / 100);
}) + $bonosDelColaborador->sum('total');
$tipoPersona = $colaborador->tipo_persona ?? 'Fisica';
$isMoral = strtolower($tipoPersona) === 'moral';
if ($isMoral) {
$importe = $importeCalculado;
$iva = $importe * 0.16;
$retIsr = $importe * 0.0125;
$retIva = $importe * 0.106667;
$totalFinal = $importe + $iva - $retIsr - $retIva;
} else {
$importe = $importeCalculado / 1.16;
$iva = $importeCalculado - $importe;
$totalFinal = $importeCalculado;
}
@endphp
@if($isMoral)
| SUBTOTAL: |
$ {{ number_format($importe, 2) }} |
|
| IVA: |
$ {{ number_format($iva, 2) }} |
|
| RET ISR: |
- $ {{ number_format($retIsr, 2) }} |
|
| RET IVA: |
- $ {{ number_format($retIva, 2) }} |
|
@else
| IMPORTE: |
$ {{ number_format($importe, 2) }} |
|
| IVA: |
$ {{ number_format($iva, 2) }} |
|
@endif
|
TOTAL:
|
$ {{ number_format($totalFinal, 2) }}
|
|