Cambios para usar nuevos resources (pedidos, gdc)

This commit is contained in:
Alejandro Tasistro 2025-03-18 19:58:49 -03:00
parent fd2c1b2970
commit 45e8a189cf
3 changed files with 18 additions and 63 deletions

View file

@ -14,13 +14,13 @@
</div> </div>
<div class="dropdown-menu" id="dropdown-menu" role="menu"> <div class="dropdown-menu" id="dropdown-menu" role="menu">
<div class="dropdown-content"> <div class="dropdown-content">
<a :href="'/admin/exportar-pedido-a-csv/' + gdc" class="dropdown-item has-background-primary"> <a :href="'/admin/exportar-pedido-a-csv/' + gdc_id" class="dropdown-item has-background-primary">
Planilla para central (CSV) Planilla para central (CSV)
</a> </a>
<a :href="'/admin/exportar-planillas-a-pdf/' + gdc" class="dropdown-item"> <a :href="'/admin/exportar-planillas-a-pdf/' + gdc_id" class="dropdown-item">
Planillas para armado (PDF) Planillas para armado (PDF)
</a> </a>
<a :href="'/admin/exportar-pedido-con-nucleos-a-csv/' + gdc" class="dropdown-item"> <a :href="'/admin/exportar-pedido-con-nucleos-a-csv/' + gdc_id" class="dropdown-item">
Planilla completa de la canasta (CSV) Planilla completa de la canasta (CSV)
</a> </a>
</div> </div>
@ -32,7 +32,7 @@
<script> <script>
export default { export default {
props: { props: {
gdc: { gdc_id: {
type: Number, type: Number,
required: true required: true
}, },

View file

@ -3,7 +3,7 @@
<td>{{ pedido.nombre }}</td> <td>{{ pedido.nombre }}</td>
<td v-if="$root.devoluciones" class="has-text-right" >{{ pedido.total_sin_devoluciones }}</td> <td v-if="$root.devoluciones" class="has-text-right" >{{ pedido.total_sin_devoluciones }}</td>
<td v-if="$root.devoluciones" class="has-text-right" ><abbr :title="pedido.devoluciones_notas">-{{ pedido.devoluciones_total }}</abbr></td> <td v-if="$root.devoluciones" class="has-text-right" ><abbr :title="pedido.devoluciones_notas">-{{ pedido.devoluciones_total }}</abbr></td>
<td class="has-text-right" >{{ pedido.total }}</td> <td class="has-text-right" >{{ $root.devoluciones ? pedido.total : pedido.total_sin_devoluciones }}</td>
<td> <td>
<admin-switch-aprobacion <admin-switch-aprobacion
:pedido="pedido"> :pedido="pedido">

View file

@ -12,7 +12,7 @@
</thead> </thead>
<tbody> <tbody>
<admin-fila-pedido <admin-fila-pedido
v-for="pedido in this.pedidos" v-for="pedido in gdc.pedidos"
:pedido="pedido" :key="pedido.id"> :pedido="pedido" :key="pedido.id">
</admin-fila-pedido> </admin-fila-pedido>
</tbody> </tbody>
@ -23,23 +23,27 @@
</tr> </tr>
<tr> <tr>
<th>Total a recaudar:</th> <th>Total a recaudar:</th>
<td class="has-text-right">$ {{ totalARecaudar }}</td> <td class="has-text-right">$ {{ gdc.total_a_recaudar }}</td>
</tr> </tr>
<tr> <tr>
<th>Total bonos barriales:</th> <th>Total bonos barriales:</th>
<td class="has-text-right">$ {{ $parent.totalBonosBarriales }}</td> <td class="has-text-right">$ {{ gdc.total_barrial }}</td>
</tr> </tr>
<tr v-if="$root.devoluciones"> <tr v-if="$root.devoluciones">
<th>Total devoluciones:</th> <th>Total devoluciones:</th>
<td class="has-text-right">- $ {{ totalDevoluciones() }}</td> <td class="has-text-right">- $ {{ gdc.total_devoluciones }}</td>
</tr>
<tr>
<th>Cantidad bonos de transporte:</th>
<td class="has-text-right">{{ gdc.cantidad_transporte }}</td>
</tr> </tr>
<tr> <tr>
<th>Total bonos de transporte:</th> <th>Total bonos de transporte:</th>
<td class="has-text-right">$ {{ bonosDeTransporte * 15 }}</td> <td class="has-text-right">$ {{ gdc.total_transporte }}</td>
</tr> </tr>
<tr> <tr>
<th>Total a depositar:</th> <th>Total a depositar:</th>
<td class="has-text-right">$ {{ totalAprobadosConTransporteRecalculado() - totalBonosBarriales }}</td> <td class="has-text-right">$ {{ gdc.total_a_transferir }}</td>
</tr> </tr>
</table> </table>
</div> </div>
@ -52,60 +56,11 @@ export default {
FilaPedido FilaPedido
}, },
props: { props: {
pedidos: { gdc: {
type: Array, type: Object,
required: true required: true
},
bonosDeTransporte: {
type: Number,
required: true
},
totalBonosBarriales: {
type: Number,
required: true
},
},
computed: {
totalARecaudar: function() {
return this.$root.devoluciones ? this.totalAprobadosMenosDevoluciones() : this.totalAprobados();
},
},
methods: {
totalDevoluciones() {
let suma = 0
let aprobados = this.pedidos.filter(p => p.aprobado);
for (let i = 0; i < aprobados.length; i++) {
suma += aprobados[i].devoluciones_total
}
return suma;
},
totalAprobados() {
let suma = 0
let aprobados = this.pedidos.filter(p => p.aprobado);
for (let i = 0; i < aprobados.length; i++) {
suma += this.$limpiarFloat(aprobados[i].total)
}
return suma;
},
totalAprobadosMenosDevoluciones() {
let suma = 0
let aprobados = this.pedidos.filter(p => p.aprobado);
for (let i = 0; i < aprobados.length; i++) {
suma += this.$limpiarFloat(aprobados[i].total_menos_devoluciones)
}
return suma;
},
totalAprobadosConTransporteRecalculado() {
let suma = 0
let aprobados = this.pedidos.filter(p => p.aprobado);
for (let i = 0; i < aprobados.length; i++) {
suma += this.$limpiarFloat(aprobados[i].total)
suma -= this.$limpiarFloat(aprobados[i].subtotal_bonos_de_transporte)
}
suma += parseInt(this.bonosDeTransporte)*15
return suma;
} }
}, }
} }
</script> </script>