Total pesos en forma pago y detalle cuotas

This commit is contained in:
2023-11-27 17:23:10 -03:00
parent df679b2a1a
commit a28c51d94c
2 changed files with 113 additions and 15 deletions

View File

@ -19,31 +19,96 @@
<th>Fecha ISO</th>
<th>Banco</th>
<th>Identificador</th>
<th>Valor</th>
<th class="right aligned">Valor</th>
<th class="right aligned">Valor UF</th>
<th>Estado</th>
<th>Fecha Estado</th>
<th>Fecha Estado ISO</th>
</tr>
</thead>
<tbody>
<tbody>@php $now = new DateTimeImmutable(); @endphp
@foreach ($venta->formaPago()->pie->cuotas() as $cuota)
<tr>
<td>{{$cuota->numero}}</td>
<td>
{{$cuota->pago->fecha->format('d-m-Y')}}
<td>{{$cuota->pago->fecha->format('d-m-Y')}}</td>
<td>{{$cuota->pago->fecha->format('Y-m-d')}}</td>
<td>{{$cuota->pago->banco->nombre}}</td>
<td>{{$cuota->pago->identificador}}</td>
<td class="right aligned">{{$format->pesos($cuota->pago->valor)}}</td>
<td class="right aligned">
@if ($cuota->pago->currentEstado->fecha <= $now)
{{$format->ufs($cuota->pago->valor())}}
@endif
</td>
<td
@if ($cuota->pago->currentEstado->tipoEstadoPago->descripcion === 'abonado')
class="green"
@elseif ($cuota->pago->currentEstado->tipoEstadoPago->descripcion === 'depositado')
class="yellow"
@elseif ($cuota->pago->currentEstado->tipoEstadoPago->active !== 1)
class="red"
@endif
>{{ucwords($cuota->pago->currentEstado->tipoEstadoPago->descripcion)}}</td>
<td>
{{$cuota->pago->fecha->format('Y-m-d')}}
</td>
<td>
{{$cuota->pago->banco->nombre}}
</td>
<td>
{{$cuota->pago->identificador}}
</td>
<td>
{{$format->pesos($cuota->pago->valor)}}
@if ($cuota->pago->currentEstado->tipoEstadoPago->descripcion === 'abonado')
{{$cuota->pago->currentEstado->fecha->format('d-m-Y')}}
@else
<div class="ui action input">
<div class="ui calendar fecha_estado" data-date="{{$cuota->pago->currentEstado->fecha->format('Y-m-d')}}">
<div class="ui icon input">
<i class="calendar icon"></i>
<input type="text" name="fecha_estado" />
</div>
</div>
<button class="ui green basic icon button" id="accept_estado" data-pago="{{$cuota->pago->id}}">
<i class="check icon"></i>
</button>
@if ($cuota->pago->currentEstado->tipoEstadoPago->descripcion === 'depositado')
<button class="ui red basic icon button" id="reject_estado" data-pago="{{$cuota->pago->id}}">
<i class="remove icon"></i>
</button>
@endif
</div>
@endif
</td>
<td>{{$cuota->pago->currentEstado->fecha->format('Y-m-d')}}</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<th colspan="5">TOTAL</th>
<th class="right aligned">
{{$format->pesos(array_reduce($venta->formaPago()->pie->cuotas(),
function(float $sum, Incoviba\Model\Venta\Cuota $cuota) {
return $sum + $cuota->pago->valor;
}, 0))}}
</th>
<th class="right aligned">
{{$format->ufs(array_reduce($venta->formaPago()->pie->cuotas(),
function(float $sum, Incoviba\Model\Venta\Cuota $cuota) {
return $sum + $cuota->pago->valor();
}, 0))}}
</th>
<th colspan="3"></th>
</tr>
<tr>
<th colspan="5">TOTAL PAGADO</th>
<th class="right aligned">
{{$format->pesos(array_reduce($venta->formaPago()->pie->cuotas(true),
function(float $sum, Incoviba\Model\Venta\Cuota $cuota) {
return $sum + $cuota->pago->valor;
}, 0))}}
</th>
<th class="right aligned">
{{$format->ufs(array_reduce($venta->formaPago()->pie->cuotas(true),
function(float $sum, Incoviba\Model\Venta\Cuota $cuota) {
return $sum + $cuota->pago->valor();
}, 0))}}
</th>
<th colspan="3"></th>
</tr>
</tfoot>
</table>
</div>
@endsection
@ -53,6 +118,13 @@
@push('page_scripts')
<script type="text/javascript">
$(document).ready(() => {
$('.fecha_estado').calendar({
type: 'date',
formatter: {
date: 'DD-MM-YYYY'
}
})
new DataTable('#cuotas', {
language: {
info: 'Mostrando página _PAGE_ de _PAGES_',
@ -63,10 +135,23 @@
search: 'Buscar: '
},
columnDefs: [
{
target: 1,
orderData: [2]
},
{
target: 2,
visible: false,
searchable: false
},
{
target: 8,
orderData: [9]
},
{
target: 9,
visible: false,
searchable: false
}
],
order: [

View File

@ -12,8 +12,11 @@
</td>
<td class="right aligned">
<strong>
{{$format->pesos($formaPago->total('pesos'))}}
{{$format->pesos($formaPago->total('pesos') - (($formaPago->bonoPie) ? $formaPago->bonoPie->pago->valor : 0))}}
</strong>
@if ($formaPago->bonoPie)
<sup>*</sup>
@endif
</td>
<td class="right aligned" >
@if (abs($venta->saldo() / $venta->valor) > 0.01)
@ -26,3 +29,13 @@
</td>
<td></td>
</tr>
@if ($formaPago->bonoPie)
<tr>
<td colspan="6">
<span class="ui small text">
<sup>*</sup>
Total en pesos no incluye Promociones como Bono Pie
</span>
</td>
</tr>
@endif