Compare commits
No commits in common. "aa70fa1c8d54722c0ff04ee33c2862a7f8c9f775" and "f67232f55cc1ee98c61caa1539f91718302f3593" have entirely different histories.
aa70fa1c8d
...
f67232f55c
3 changed files with 5 additions and 39 deletions
|
@ -21,23 +21,18 @@ class GrupoDeCompra extends Model
|
||||||
return $this->hasMany('App\Subpedido');
|
return $this->hasMany('App\Subpedido');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pedidosAprobados() {
|
|
||||||
return $this->subpedidos->where('aprobado',1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function exportarPlanillasAPdf() {
|
public function exportarPlanillasAPdf() {
|
||||||
$subpedidos = $this->pedidosAprobados();
|
$subpedidos = $this->subpedidos;
|
||||||
//generar pdf
|
//generar pdf
|
||||||
$mpdf = new Mpdf();
|
$mpdf = new Mpdf();;
|
||||||
foreach ($subpedidos as $subpedido) {
|
foreach ($subpedidos as $subpedido) {
|
||||||
$tabla = $subpedido->generarHTML();
|
$tabla = $subpedido->generarHTML();
|
||||||
// agregar la tabla al pdf en una nueva página
|
// agregar la tabla al pdf en una nueva página
|
||||||
$mpdf->WriteHTML($tabla);
|
$mpdf->WriteHTML($tabla);
|
||||||
$mpdf->AddPage();
|
$mpdf->AddPage();
|
||||||
}
|
}
|
||||||
$filename = $this->nombre . '.pdf';
|
|
||||||
// imprimir el pdf
|
// imprimir el pdf
|
||||||
$mpdf->Output($filename, "D");
|
$mpdf->Output();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Asume que los productos están gruadados en orden de fila
|
//Asume que los productos están gruadados en orden de fila
|
||||||
|
|
21
public/js/app.js
vendored
21
public/js/app.js
vendored
|
@ -3021,13 +3021,6 @@ __webpack_require__.r(__webpack_exports__);
|
||||||
subpedidos: []
|
subpedidos: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
hayAprobados: function hayAprobados() {
|
|
||||||
return this.subpedidos.filter(function (sp) {
|
|
||||||
return sp.aprobado;
|
|
||||||
}).length > 0;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
beforeCreate: function beforeCreate() {
|
beforeCreate: function beforeCreate() {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
|
@ -6031,12 +6024,7 @@ var render = function () {
|
||||||
"a",
|
"a",
|
||||||
{
|
{
|
||||||
staticClass: "button is-success",
|
staticClass: "button is-success",
|
||||||
attrs: {
|
attrs: { href: "/admin/exportar-pedido-a-csv/" + _vm.gdc },
|
||||||
href: _vm.hayAprobados
|
|
||||||
? "/admin/exportar-pedido-a-csv/" + _vm.gdc
|
|
||||||
: "#",
|
|
||||||
disabled: !_vm.hayAprobados,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
_c("span", [
|
_c("span", [
|
||||||
|
@ -6051,12 +6039,7 @@ var render = function () {
|
||||||
"a",
|
"a",
|
||||||
{
|
{
|
||||||
staticClass: "button is-info",
|
staticClass: "button is-info",
|
||||||
attrs: {
|
attrs: { href: "/admin/exportar-planillas-a-pdf/" + _vm.gdc },
|
||||||
href: _vm.hayAprobados
|
|
||||||
? "/admin/exportar-planillas-a-pdf/" + _vm.gdc
|
|
||||||
: "#",
|
|
||||||
disabled: !_vm.hayAprobados,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
_c("span", [
|
_c("span", [
|
||||||
|
|
|
@ -37,16 +37,4 @@
|
||||||
</tr>
|
</tr>
|
||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
@foreach($subpedido->productos as $producto)
|
|
||||||
@if($producto->bono)
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
{{ $producto->nombre }}
|
|
||||||
</td>
|
|
||||||
<td style="text-align: center">
|
|
||||||
{{ $producto->pivot->cantidad }}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Add table
Reference in a new issue