mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Añadidas lineas de presupuesto ByN y Color al presupuesto. Cambios esteticos
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Presupuestos;
|
||||
|
||||
class PresupuestoLineaModel extends \App\Models\GoBaseModel
|
||||
@ -307,17 +308,18 @@ class PresupuestoLineaModel extends \App\Models\GoBaseModel
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function createForPresupuesto($presupuesto_id){
|
||||
public function createForPresupuesto($presupuesto_id)
|
||||
{
|
||||
|
||||
$tipos = ['bn','bnhq','color','colorhq','cubierta','sobrecubierta','rot_bn','rot_color'];
|
||||
foreach($tipos as $tipo){
|
||||
$tipos = ['bn', 'bnhq', 'color', 'colorhq', 'cubierta', 'sobrecubierta', 'rot_bn', 'rot_color'];
|
||||
foreach ($tipos as $tipo) {
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1");
|
||||
->table($this->table . " t1");
|
||||
$data = [
|
||||
'presupuesto_id' => $presupuesto_id,
|
||||
'tipo' => $tipo,
|
||||
'presupuesto_id' => $presupuesto_id,
|
||||
'tipo' => $tipo,
|
||||
];
|
||||
|
||||
|
||||
$builder->insert($data);
|
||||
}
|
||||
}
|
||||
@ -330,30 +332,58 @@ class PresupuestoLineaModel extends \App\Models\GoBaseModel
|
||||
"*"
|
||||
)
|
||||
->where("t1.presupuesto_id", $presupuesto_id);
|
||||
|
||||
|
||||
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
|
||||
}
|
||||
|
||||
public function deleteLineasPresupuesto($presupuesto_id){
|
||||
public function deleteLineasPresupuesto($presupuesto_id)
|
||||
{
|
||||
$this->db
|
||||
->table($this->table . " t1")
|
||||
->where("presupuesto_id", $presupuesto_id)
|
||||
->delete();
|
||||
}
|
||||
|
||||
public function insertLineasPresupuesto($presupuesto_id = -1, $datos=[])
|
||||
public function insertLineasPresupuesto($presupuesto_id = -1, $datos = [])
|
||||
{
|
||||
$this->deleteLineasPresupuesto($presupuesto_id);
|
||||
|
||||
foreach($datos as $linea){
|
||||
|
||||
foreach ($datos as $linea) {
|
||||
|
||||
$this->db
|
||||
->table($this->table . " t1")
|
||||
->where("t1.presupuesto_id", $presupuesto_id)
|
||||
->insert($linea);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getResourceByNForPdf($presupuesto_id = -1)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.paginas AS paginas, t1.papel_impresion AS papel, t1.gramaje AS gramaje"
|
||||
)
|
||||
->where("t1.presupuesto_id", $presupuesto_id)
|
||||
->whereIn('t1.tipo', ['lp_bn', 'lp_bnhq', 'lp_rot_bn']);
|
||||
|
||||
return $builder;
|
||||
}
|
||||
|
||||
public function getResourceColorForPdf($presupuesto_id = -1)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.paginas AS paginas, t1.papel_impresion AS papel, t1.gramaje AS gramaje"
|
||||
)
|
||||
->where("t1.presupuesto_id", $presupuesto_id)
|
||||
->whereIn('t1.tipo', ['lp_color', 'lp_colorhq', 'lp_rot_color']);
|
||||
|
||||
return $builder;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user