2022-11-12 21:16:35 -03:00
|
|
|
<template>
|
|
|
|
<table class="table is-fullwidth is-striped is-bordered">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Núcleo</th>
|
|
|
|
<th><abbr title="Total a Pagar">Total $</abbr></th>
|
|
|
|
<th class="is-1"><abbr title="Aprobacion">Aprobación</abbr></th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tfoot>
|
|
|
|
<tr>
|
|
|
|
<th></th>
|
2023-10-04 22:37:59 -03:00
|
|
|
<th>Total a recaudar:</th>
|
|
|
|
<th class="has-text-right">$ {{ totalAprobados() }}</th>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th></th>
|
|
|
|
<th>Total bonos barriales:</th>
|
|
|
|
<th class="has-text-right">$ {{ totalBonosBarriales }}</th>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th></th>
|
|
|
|
<th>Total a transferir:</th>
|
|
|
|
<th class="has-text-right">$ {{ totalAprobados() - totalBonosBarriales }}</th>
|
2022-11-12 21:16:35 -03:00
|
|
|
</tr>
|
|
|
|
</tfoot>
|
|
|
|
<tbody>
|
|
|
|
<pedidos-admin-fila-pedido v-for="pedido in this.pedidos"
|
|
|
|
:pedido="pedido" :key="pedido.id">
|
|
|
|
</pedidos-admin-fila-pedido>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-11-13 17:00:24 -03:00
|
|
|
import PedidosAdminFilaPedidoVue from './PedidosAdminFilaPedido.vue';
|
2022-11-12 21:16:35 -03:00
|
|
|
export default {
|
|
|
|
name: "PedidosAdminTablaPedidos",
|
2022-11-13 17:00:24 -03:00
|
|
|
components: {
|
|
|
|
PedidosAdminFilaPedidoVue
|
|
|
|
},
|
2022-11-12 21:16:35 -03:00
|
|
|
props: {
|
|
|
|
pedidos: {
|
|
|
|
type: Array,
|
|
|
|
required: true
|
2023-05-24 15:01:31 -03:00
|
|
|
},
|
|
|
|
bonosDeTransporte: {
|
|
|
|
type: Number,
|
|
|
|
required: true
|
|
|
|
},
|
2023-10-04 22:37:59 -03:00
|
|
|
totalBonosBarriales: {
|
|
|
|
type: Number,
|
|
|
|
required: true
|
|
|
|
},
|
2022-11-12 21:16:35 -03:00
|
|
|
},
|
|
|
|
methods: {
|
2023-10-04 22:37:59 -03:00
|
|
|
totalBonosBarriales() {
|
2022-11-12 21:16:35 -03:00
|
|
|
let suma = 0;
|
|
|
|
let aprobados = this.pedidos.filter(p => p.aprobado);
|
2023-10-04 22:37:59 -03:00
|
|
|
for (let i = 0; i < aprobados.length; i++) {
|
|
|
|
let bonoBarrial = aprobados[i].productos.find(p => p.nombre.includes("barrial"))
|
|
|
|
if (bonoBarrial) {
|
|
|
|
suma += this.$limpiarInt(bonoBarrial.pivot.total)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return suma;
|
|
|
|
},
|
|
|
|
totalAprobados() {
|
|
|
|
let suma = 0
|
|
|
|
let aprobados = this.pedidos.filter(p => p.aprobado);
|
2022-11-12 21:16:35 -03:00
|
|
|
for (let i = 0; i < aprobados.length; i++) {
|
2023-09-09 13:32:49 -03:00
|
|
|
suma += this.$limpiarFloat(aprobados[i].subtotal_bonos)
|
|
|
|
suma += this.$limpiarFloat(aprobados[i].subtotal_productos)
|
2022-11-12 21:16:35 -03:00
|
|
|
}
|
2023-05-24 15:01:31 -03:00
|
|
|
suma += parseInt(this.bonosDeTransporte)*15
|
2022-11-12 21:16:35 -03:00
|
|
|
return suma;
|
|
|
|
}
|
2023-05-24 15:01:31 -03:00
|
|
|
},
|
2022-11-12 21:16:35 -03:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
</style>
|