utilidades promocion

This commit is contained in:
Felipe
2023-07-26 18:30:28 -05:00
parent 190be28228
commit 25914187f5
2 changed files with 128 additions and 54 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ use Livewire\Component;
class ShowUtilidades extends Component class ShowUtilidades extends Component
{ {
public $promocion; public $promocion =1;
public $servicio_id; public $servicio_id;
@@ -17,7 +17,6 @@
<input type="checkbox" name="promocion" id="promocion" wire:model="promocion"> <input type="checkbox" name="promocion" id="promocion" wire:model="promocion">
</div> </div>
</div> </div>
<div class="grid gap-4 grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 my-6 mx-6"> <div class="grid gap-4 grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 my-6 mx-6">
<div> <div>
<label for="servicios" class="text-gray-600 text-sm font-semibold block">Filtrar por <label for="servicios" class="text-gray-600 text-sm font-semibold block">Filtrar por
@@ -82,66 +81,141 @@
<div class="mt-2"> <div class="mt-2">
<h1 class="text-center text-lg sm:mb-4">Utilidades</h1> <h1 class="text-center text-lg sm:mb-4">Utilidades</h1>
<div class="py-2"> <div class="py-2">
<table wire:loading.class="opacity-50 cursor-wait" class="text-center rounded-lg shadow-lg m-auto mt-4 mb-4 bg-white md:w-10/12"> @if ($promocion)
<thead class="font-normal bg-[#000029] text-white h-9 pr-4 sm:pr-2"> <table wire:loading.class="opacity-50 cursor-wait"
<tr class="text-left"> class="text-center rounded-lg shadow-lg m-auto mt-4 mb-4 bg-white md:w-10/12">
<th class="rounded-l-lg font-normal w-1/12 pr-[1rem] md:pl-[2rem]">Fecha inicio</th> <thead class="font-normal bg-[#000029] text-white h-9 pr-4 sm:pr-2">
<th class="font-normal w-1/12 pl-[1rem] sm:pr-[2rem]">Servicio</th> <tr class="text-left">
<th class="font-normal w-1/12 pl-[1rem] sm:pr-[2rem]">Pantallas</th> <th class="rounded-l-lg font-normal w-1/12 pr-[1rem] md:pl-[2rem]">Fecha inicio</th>
<th class="font-normal w-1/12 pl-[1rem] sm:pr-[2rem]">valor</th> <th class="font-normal w-1/12 pl-[1rem] sm:pr-[2rem]">Servicio</th>
<th class="rounded-r-lg font-normal w-1/12 pr-[1rem] md:pl-[2rem]">Utilidad</th> <th class="font-normal w-1/12 pl-[1rem] sm:pr-[2rem]">Pantallas</th>
</tr> <th class="font-normal w-1/12 pl-[1rem] sm:pr-[2rem]">valor</th>
</thead> <th class="rounded-r-lg font-normal w-1/12 pr-[1rem] md:pl-[2rem]">Utilidad</th>
@php </tr>
$totalUtilidades = 0; </thead>
@endphp @php
<tbody class="text-gray-500 select-none pr-4 sm:pr-2"> $totalUtilidades = 0;
@foreach ($historiales as $historial) @endphp
<tr <tbody class="text-gray-500 select-none pr-4 sm:pr-2">
class="border-gray-200 text-left w-full sm:pl-4 hover:bg-gray-200 hover:ring-gray-500"> @foreach ($historiales as $historial)
<td class="md:pl-[2rem] md:pr-[2rem]"> <tr
{{ $historial->fecha_inicio }} class="border-gray-200 text-left w-full sm:pl-4 hover:bg-gray-200 hover:ring-gray-500">
<td class="md:pl-[2rem] md:pr-[2rem]">
{{ $historial->fecha_inicio }}
</td>
<td class="md:pl-[2rem] md:pr-[2rem]">
@foreach ($historial->promocion->tarifas as $tarifa)
<p> {{ $tarifa->servicio->nombre }}</p>
@endforeach
</td>
<td class="md:pl-[2rem] md:pr-[2rem]">
@foreach ($historial->promocion->tarifas as $tarifa)
<p>{{ $tarifa->pantallas }}</p>
@endforeach
</td>
<td class="md:pl-[2rem] md:pr-[2rem]">
@foreach ($historial->promocion->tarifas as $tarifa)
<p>${{ number_format($tarifa->servicio->precio ?? 0, 2, ',', '.') }}</p>
@endforeach
</td>
<td class="md:pl-[2rem] md:pr-[2rem] text-right">
@foreach ($historial->promocion->tarifas as $tarifa)
<p>${{ number_format($tarifa->servicio->precio / $tarifa->pantallas ?? 0, 2, ',', '.') }}</p>
@endforeach
</td>
</tr>
@foreach ($historial->promocion->tarifas as $tarifa)
@php
$totalUtilidades += $tarifa->servicio->precio / $tarifa->pantallas;
@endphp
@endforeach
@endforeach
<tr>
<td class="border-t border-b">
</td> </td>
<td class="md:pl-[2rem] md:pr-[2rem]"> <td class="border-t border-b">
{{ $historial->tarifa->servicio->nombre }}
</td> </td>
<td class="md:pl-[2rem] md:pr-[2rem]"> <td class="border-t border-b">
{{ $historial->tarifa->pantallas }}
</td> </td>
<td class="md:pl-[2rem] md:pr-[2rem]"> <th class="border-t border-l border-b">
${{ $historial->tarifa->servicio->precio }} <p class="flex items-center px-6 py-4 cursor-pointer">
</td> Utilidad Total
<td class="md:pl-[2rem] md:pr-[2rem] text-right"> </p>
${{ number_format($historial->tarifa->servicio->precio / $historial->tarifa->pantallas ?? 0, 2, ',', '.') }} </th>
<td class="border-t border-b">
<p class="flex items-center px-6 py-4 cursor-pointer">
$ {{ number_format($totalUtilidades ?? 0, 2, ',', '.') }}
</p>
</td> </td>
</tr> </tr>
@php </tbody>
$totalUtilidades += $historial->tarifa->servicio->precio / $historial->tarifa->pantallas; </table>
@endphp @else
@endforeach <table wire:loading.class="opacity-50 cursor-wait"
<tr> class="text-center rounded-lg shadow-lg m-auto mt-4 mb-4 bg-white md:w-10/12">
<td class="border-t border-b"> <thead class="font-normal bg-[#000029] text-white h-9 pr-4 sm:pr-2">
<tr class="text-left">
<th class="rounded-l-lg font-normal w-1/12 pr-[1rem] md:pl-[2rem]">Fecha inicio</th>
<th class="font-normal w-1/12 pl-[1rem] sm:pr-[2rem]">Servicio</th>
<th class="font-normal w-1/12 pl-[1rem] sm:pr-[2rem]">Pantallas</th>
<th class="font-normal w-1/12 pl-[1rem] sm:pr-[2rem]">valor</th>
<th class="rounded-r-lg font-normal w-1/12 pr-[1rem] md:pl-[2rem]">Utilidad</th>
</tr>
</thead>
@php
$totalUtilidades = 0;
@endphp
<tbody class="text-gray-500 select-none pr-4 sm:pr-2">
@foreach ($historiales as $historial)
<tr
class="border-gray-200 text-left w-full sm:pl-4 hover:bg-gray-200 hover:ring-gray-500">
<td class="md:pl-[2rem] md:pr-[2rem]">
{{ $historial->fecha_inicio }}
</td>
<td class="md:pl-[2rem] md:pr-[2rem]">
{{ $historial->tarifa->servicio->nombre }}
</td>
<td class="md:pl-[2rem] md:pr-[2rem]">
{{ $historial->tarifa->pantallas }}
</td>
<td class="md:pl-[2rem] md:pr-[2rem]">
${{ $historial->tarifa->servicio->precio }}
</td>
<td class="md:pl-[2rem] md:pr-[2rem] text-right">
${{ number_format($historial->tarifa->servicio->precio / $historial->tarifa->pantallas ?? 0, 2, ',', '.') }}
</td>
</tr>
@php
$totalUtilidades += $historial->tarifa->servicio->precio / $historial->tarifa->pantallas;
@endphp
@endforeach
<tr>
<td class="border-t border-b">
</td> </td>
<td class="border-t border-b"> <td class="border-t border-b">
</td> </td>
<td class="border-t border-b"> <td class="border-t border-b">
</td> </td>
<th class="border-t border-l border-b"> <th class="border-t border-l border-b">
<p class="flex items-center px-6 py-4 cursor-pointer"> <p class="flex items-center px-6 py-4 cursor-pointer">
Utilidad Total Utilidad Total
</p> </p>
</th> </th>
<td class="border-t border-b"> <td class="border-t border-b">
<p class="flex items-center px-6 py-4 cursor-pointer"> <p class="flex items-center px-6 py-4 cursor-pointer">
$ {{ number_format($totalUtilidades ?? 0, 2, ',', '.') }} $ {{ number_format($totalUtilidades ?? 0, 2, ',', '.') }}
</p> </p>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@endif
</div> </div>
</div> </div>
</div> </div>