diff --git a/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php b/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php
index 8e98b6af..68206afd 100644
--- a/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php
+++ b/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php
@@ -116,6 +116,9 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
$id = $this->model->db->insertID();
+ $lp_model = model('App\Models\Presupuestos\PresupuestoLineaModel');
+ $lp_model->createForPresupuesto($id);
+
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
if ($thenRedirect) :
@@ -137,21 +140,6 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
$this->viewData['clienteList'] = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null);
$this->viewData['incReiList'] = array('incidencia' => lang('Presupuestos.incidencia'), 'reimpresion' => lang('Presupuestos.reimpresion'), 'sin_cargo' => lang('Presupuestos.sinCargo'));
$this->viewData['paisList'] = $this->getPaisListItems();
- $this->viewData['papelFormatoList'] = $this->getPapelFormatoListItems($presupuestoEntity->papel_formato_id ?? null);
- $this->viewData['papelGenericoNegroList'] = $this->getPapelGenericoNegro();
- $this->viewData['papelGenericoNegroHQList'] = $this->getPapelGenericoNegroHQ();
- $this->viewData['papelGenericoColorList'] = $this->getPapelGenericoColor();
- $this->viewData['papelGenericoColorHQList'] = $this->getPapelGenericoColorHQ();
- $this->viewData['papelGenericoCubiertaList'] = $this->getPapelGenericoCubierta();
- $this->viewData['papelGenericoSobrecubiertaList'] = $this->getPapelGenericoSobreCubierta();
- $this->viewData['papelGenericoRotativaNegroList'] = $this->getPapelGenericoRotativaNegro();
- $this->viewData['papelGenericoRotativaColorList'] = $this->getPapelGenericoRotativaColor();
-
- // Tarifas
- $this->viewData['serviciosPreimpresion'] = $this->getServiciosPreimpresion();
- $this->viewData['serviciosEncuadernacion'] = $this->getServiciosEncuadernacion();
- $this->viewData['serviciosAcabado'] = $this->getServiciosAcabado();
- $this->viewData['serviciosManipulado'] = $this->getServiciosManipulado();
$this->viewData['tipo_impresion_id'] = 4; // Cosido tapa blanda JJO
@@ -310,34 +298,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
$this->viewData['presupuestoEntity'] = $presupuestoEntity;
$this->viewData['clienteList'] = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null);
- //$this->viewData['formaPagoList'] = $this->getFormaPagoListItems();
- //$this->viewData['tiposImpresionList'] = $this->getTiposImpresionListItems($presupuestoEntity->tipo_impresion_id ?? null);
- //$this->viewData['tipologiasLibroList'] = $this->getTipologiasLibroListItems($presupuestoEntity->tipologia_id ?? null);
$this->viewData['paisList'] = $this->getPaisListItems();
- //$this->viewData['ubicacionLibroList'] = $this->getUbicacionLibroListItems($presupuestoEntity->ubicacion_id ?? null);
- //$this->viewData['presupuestoEstadoList'] = $this->getPresupuestoEstadoListItems($presupuestoEntity->estado_id ?? null);
- //$this->viewData['papelFormatoList'] = $this->getPapelFormatoListItems($presupuestoEntity->papel_formato_id ?? null);
- //$this->viewData['papelGenericoList'] = $this->getPapelGenericoListItems($presupuestoEntity->paginas_negro_papel_id ?? null);
- //$this->viewData['papelImpresionList'] = $this->getPapelImpresionListItems($presupuestoEntity->paginas_negro_papel_impresion_id ?? null);
- //$this->viewData['maquinaList'] = $this->getMaquinaListItems($presupuestoEntity->paginas_negro_maquina_id ?? null);
- //$this->viewData['maquinasTarifasImpresionList'] = $this->getMaquinasTarifasImpresionListItems($presupuestoEntity->paginas_negro_tarifa_impresion_id ?? null);
- //$this->viewData['papelGenericoList2'] = $this->getPapelGenericoListItems2($presupuestoEntity->paginas_color_papel_id ?? null);
- /*$this->viewData['papelImpresionList2'] = $this->getPapelImpresionListItems2($presupuestoEntity->paginas_color_papel_impresion_id ?? null);
- $this->viewData['maquinaList2'] = $this->getMaquinaListItems2($presupuestoEntity->paginas_color_maquina_id ?? null);
- $this->viewData['maquinasTarifasImpresionList2'] = $this->getMaquinasTarifasImpresionListItems2($presupuestoEntity->paginas_color_tarifa_impresion_id ?? null);
- $this->viewData['papelGenericoList3'] = $this->getPapelGenericoListItems3($presupuestoEntity->paginas_portada_papel_id ?? null);
- $this->viewData['papelImpresionList3'] = $this->getPapelImpresionListItems3($presupuestoEntity->paginas_portada_papel_impresion_id ?? null);
- $this->viewData['maquinaList3'] = $this->getMaquinaListItems3($presupuestoEntity->paginas_portada_maquina_id ?? null);
- $this->viewData['maquinasTarifasImpresionList3'] = $this->getMaquinasTarifasImpresionListItems3($presupuestoEntity->paginas_portada_tarifa_impresion_id ?? null);
- $this->viewData['papelGenericoList4'] = $this->getPapelGenericoListItems4($presupuestoEntity->paginas_cubierta_papel_id ?? null);
- $this->viewData['papelImpresionList4'] = $this->getPapelImpresionListItems4($presupuestoEntity->paginas_cubierta_papel_impresion_id ?? null);
- $this->viewData['maquinaList4'] = $this->getMaquinaListItems4($presupuestoEntity->paginas_cubierta_maquina_id ?? null);
- $this->viewData['maquinasTarifasImpresionList4'] = $this->getMaquinasTarifasImpresionListItems4($presupuestoEntity->paginas_cubierta_tarifa_impresion_id ?? null);
- $this->viewData['userList'] = $this->getUserListItems($presupuestoEntity->total_confirmado_user_id ?? null);
- $this->viewData['userList2'] = $this->getUserListItems2($presupuestoEntity->aprobado_user_id ?? null);
- $this->viewData['userList3'] = $this->getUserListItems3($presupuestoEntity->pedido_espera_user_id ?? null);
- $this->viewData['paginasCubiertaList'] = $this->getPaginasCubiertaOptions();
- $this->viewData['paginasPortadaList'] = $this->getPaginasPortadaOptions();*/
$this->viewData['clienteList'] = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null);
$this->viewData['incReiList'] = array('incidencia' => lang('Presupuestos.incidencia'), 'reimpresion' => lang('Presupuestos.reimpresion'), 'sin_cargo' => lang('Presupuestos.sinCargo'));
@@ -352,12 +313,14 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
$this->viewData['papelGenericoRotativaNegroList'] = $this->getPapelGenericoRotativaNegro();
$this->viewData['papelGenericoRotativaColorList'] = $this->getPapelGenericoRotativaColor();
+ // Lineas Presupuesto
+ $this->viewData['lineasPresupuesto'] = $this->getLineasPresupuestoActivas($id);
+
// Tarifas
$this->viewData['serviciosPreimpresion'] = $this->getServiciosPreimpresion();
$this->viewData['serviciosEncuadernacion'] = $this->getServiciosEncuadernacion();
$this->viewData['serviciosAcabado'] = $this->getServiciosAcabado();
$this->viewData['serviciosManipulado'] = $this->getServiciosManipulado();
-
$this->viewData['tipo_impresion_id'] = 4; // Cosido tapa blanda JJO
@@ -1041,7 +1004,11 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
return $data;
}
-
+ protected function getLineasPresupuestoActivas($presupuesto_id)
+ {
+ $model = model('App\Models\Presupuestos\PresupuestoLineaModel');
+ return $model->getLineasPresupuesto($presupuesto_id);
+ }
}
diff --git a/ci4/app/Controllers/Test.php b/ci4/app/Controllers/Test.php
index f6f20f20..5e9404a0 100644
--- a/ci4/app/Controllers/Test.php
+++ b/ci4/app/Controllers/Test.php
@@ -17,7 +17,31 @@ class Test extends BaseController
public function index()
{
- $this->testLineasIntPlana();
+ $time = '99:59:59';
+
+ $time_parts = explode(":", $time);
+ $seconds = $time_parts[2] + $time_parts[1] * 60 + $time_parts[0] * 3600;
+ echo "Time in seconds: " . $seconds;
+ }
+
+ public function timeToSeconds(){
+ $time = '99:59:59';
+
+ $time_parts = explode(":", $time);
+ $seconds = $time_parts[2] + $time_parts[1] * 60 + $time_parts[0] * 3600;
+ echo "Time in seconds: " . $seconds;
+ }
+
+ public function getLP(){
+ $lp_model = model('App\Models\Presupuestos\PresupuestoLineaModel');
+ $data = $lp_model->getLineasPresupuesto(8);
+ foreach($data as $linea)
+ var_dump($linea->tipo);
+ }
+
+ public function createLP(){
+ $lp_model = model('App\Models\Presupuestos\PresupuestoLineaModel');
+ $lp_model->createForPresupuesto(8);
}
public function getPapelesHQ(){
diff --git a/ci4/app/Entities/Presupuestos/PresupuestoLineaEntity.php b/ci4/app/Entities/Presupuestos/PresupuestoLineaEntity.php
new file mode 100644
index 00000000..8fcc6c21
--- /dev/null
+++ b/ci4/app/Entities/Presupuestos/PresupuestoLineaEntity.php
@@ -0,0 +1,123 @@
+ null,
+ "presupuesto_id" => null,
+ "tipo" => null,
+ "paginas" => 0,
+ "paginas_color_posicion" => null,
+ "solapas_ancho" => 0.0,
+ "papel_id" => null,
+ "papel_impresion_id" => null,
+ "formas" => null,
+ "gramaje" => null,
+ "pliegos_libro" => null,
+ "pliegos_pedido" => null,
+ "pliegos_precio" => null,
+ "libro" => null,
+ "pedido" => null,
+ "mano" => null,
+ "peso" => null,
+ "maquina_id" => null,
+ "tarifa_impresion_id" => null,
+ "click" => null,
+ "precio" => null,
+ "rotativa_impresion" => null,
+ "rotativa_pag_color" => 0,
+ "rotativa_set_values" => false,
+ "rotativa_negro" => 0.0,
+ "rotativa_cyan" => 0.0,
+ "rotativa_magenta" => 0.0,
+ "rotativa_amarillo" => 0.0,
+ "rotativa_gota_negro" => 0.0,
+ "rotativa_gota_color" => 0.0,
+ "rotativa_saturacion" => 100.0,
+ "rotativa_a_favor_fibra" => true,
+ "rotativa_mxm" => null,
+ "rotativa_area_paginas" => null,
+ "rotativa_num_gotas_negro" => 0,
+ "rotativa_num_gotas_cyan" => 0,
+ "rotativa_num_gotas_magenta" => 0,
+ "rotativa_num_gotas_amarillo" => 0,
+ "rotativa_peso_gotas_negro" => 0,
+ "rotativa_peso_gotas_cyan" => 0,
+ "rotativa_peso_gotas_magenta" => 0,
+ "rotativa_peso_gotas_amarillo" => 0,
+ "rotativa_precio_pag_negro" => null,
+ "rotativa_precio_pag_color" => null,
+ "rotativa_factor_altura" => null,
+ "rotativa_factor_anchura" => null,
+ "rotativa_pag_por_pliego" => null,
+ "rotativa_metros_libro" => null,
+ "rotativa_metros_total" => null,
+ "rotativa_clicks_libro" => null,
+ "rotativa_clicks_total" => null,
+ "rotativa_precio_tinta" => null,
+ "rotativa_total_impresion" => null,
+ "rotativa_velocidad_corte" => 0,
+ "rotativa_tiempo_corte" => 0,
+ "rotativa_precio_hora_corte" => 0,
+ "rotativa_total_corte" => 0,
+ "isActiva" => false,
+ ];
+ protected $casts = [
+ "presupuesto_id" => "int",
+ "paginas" => "int",
+ "solapas_ancho" => "float",
+ "papel_id" => "?int",
+ "papel_impresion_id" => "?int",
+ "gramaje" => "?float",
+ "pliegos_libro" => "?float",
+ "pliegos_pedido" => "?float",
+ "pliegos_precio" => "?float",
+ "libro" => "?float",
+ "pedido" => "?float",
+ "mano" => "?float",
+ "peso" => "?float",
+ "maquina_id" => "?int",
+ "tarifa_impresion_id" => "?int",
+ "click" => "?float",
+ "precio" => "?float",
+ "rotativa_pag_color" => "int",
+ "rotativa_set_values" => "boolean",
+ "rotativa_negro" => "float",
+ "rotativa_cyan" => "float",
+ "rotativa_magenta" => "float",
+ "rotativa_amarillo" => "float",
+ "rotativa_gota_negro" => "float",
+ "rotativa_gota_color" => "float",
+ "rotativa_saturacion" => "float",
+ "rotativa_a_favor_fibra" => "boolean",
+ "rotativa_mxm" => "?float",
+ "rotativa_area_paginas" => "float",
+ "rotativa_num_gotas_negro" => "float",
+ "rotativa_num_gotas_cyan" => "float",
+ "rotativa_num_gotas_magenta" => "float",
+ "rotativa_num_gotas_amarillo" => "float",
+ "rotativa_peso_gotas_negro" => "float",
+ "rotativa_peso_gotas_cyan" => "float",
+ "rotativa_peso_gotas_magenta" => "float",
+ "rotativa_peso_gotas_amarillo" => "float",
+ "rotativa_precio_pag_negro" => "float",
+ "rotativa_precio_pag_color" => "float",
+ "rotativa_factor_altura" => "float",
+ "rotativa_factor_anchura" => "float",
+ "rotativa_pag_por_pliego" => "float",
+ "rotativa_metros_libro" => "float",
+ "rotativa_metros_total" => "float",
+ "rotativa_clicks_libro" => "float",
+ "rotativa_clicks_total" => "float",
+ "rotativa_precio_tinta" => "float",
+ "rotativa_total_impresion" => "float",
+ "rotativa_velocidad_corte" => "float",
+ "rotativa_tiempo_corte" => "float",
+ "rotativa_precio_hora_corte" => "float",
+ "rotativa_total_corte" => "float",
+ "isActiva" => "boolean",
+ ];
+}
diff --git a/ci4/app/Language/en/Presupuestos.php b/ci4/app/Language/en/Presupuestos.php
index 571c6720..aa954702 100644
--- a/ci4/app/Language/en/Presupuestos.php
+++ b/ci4/app/Language/en/Presupuestos.php
@@ -22,7 +22,8 @@ return [
'incRei' => 'Incident \ Reprint',
'paginas' => 'Pages',
'tirada' => 'Print',
- 'totalPapelPedido' => 'Total paper budget',
+ 'totalPedido' => 'Total paper budget',
+ 'totalPresupuesto' => 'Total Budget',
'presupuestoEstado' => 'State',
'presupuestoEstadoBorrador' => 'Draft',
'presupuestoEstadoAceptado' => 'Acepted',
diff --git a/ci4/app/Language/es/Presupuestos.php b/ci4/app/Language/es/Presupuestos.php
index d3be5e1c..b71dd428 100644
--- a/ci4/app/Language/es/Presupuestos.php
+++ b/ci4/app/Language/es/Presupuestos.php
@@ -21,7 +21,8 @@ return [
'incRei' => 'Incidencia \ Reimpresión',
'paginas' => 'Paginas',
'tirada' => 'Tirada',
- 'totalPedido' => 'Total Presupuesto',
+ 'totalPedido' => 'Total Pedido',
+ 'totalPresupuesto' => 'Total Presupuesto',
'presupuestoEstado' => 'Estado',
'presupuestoEstadoBorrador' => 'Borrador',
'presupuestoEstadoAceptado' => 'Aceptado',
diff --git a/ci4/app/Models/Presupuestos/PresupuestoLineaModel.php b/ci4/app/Models/Presupuestos/PresupuestoLineaModel.php
new file mode 100644
index 00000000..fabf40a5
--- /dev/null
+++ b/ci4/app/Models/Presupuestos/PresupuestoLineaModel.php
@@ -0,0 +1,332 @@
+ [
+ "label" => "PresupuestoLineas.click",
+ "rules" => "decimal|permit_empty",
+ ],
+ "formas" => [
+ "label" => "PresupuestoLineas.formas",
+ "rules" => "trim|max_length[16313]",
+ ],
+ "gramaje" => [
+ "label" => "PresupuestoLineas.gramaje",
+ "rules" => "decimal|permit_empty",
+ ],
+ "libro" => [
+ "label" => "PresupuestoLineas.libro",
+ "rules" => "decimal|permit_empty",
+ ],
+ "mano" => [
+ "label" => "PresupuestoLineas.mano",
+ "rules" => "decimal|permit_empty",
+ ],
+ "paginas" => [
+ "label" => "PresupuestoLineas.paginas",
+ "rules" => "required|integer",
+ ],
+ "paginas_color_posicion" => [
+ "label" => "PresupuestoLineas.paginasColorPosicion",
+ "rules" => "trim|max_length[16313]",
+ ],
+ "pedido" => [
+ "label" => "PresupuestoLineas.pedido",
+ "rules" => "decimal|permit_empty",
+ ],
+ "peso" => [
+ "label" => "PresupuestoLineas.peso",
+ "rules" => "decimal|permit_empty",
+ ],
+ "pliegos_libro" => [
+ "label" => "PresupuestoLineas.pliegosLibro",
+ "rules" => "decimal|permit_empty",
+ ],
+ "pliegos_pedido" => [
+ "label" => "PresupuestoLineas.pliegosPedido",
+ "rules" => "decimal|permit_empty",
+ ],
+ "pliegos_precio" => [
+ "label" => "PresupuestoLineas.pliegosPrecio",
+ "rules" => "decimal|permit_empty",
+ ],
+ "precio" => [
+ "label" => "PresupuestoLineas.precio",
+ "rules" => "decimal|permit_empty",
+ ],
+ "rotativa_amarillo" => [
+ "label" => "PresupuestoLineas.rotativaAmarillo",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_area_paginas" => [
+ "label" => "PresupuestoLineas.rotativaAreaPaginas",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_clicks_libro" => [
+ "label" => "PresupuestoLineas.rotativaClicksLibro",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_clicks_total" => [
+ "label" => "PresupuestoLineas.rotativaClicksTotal",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_cyan" => [
+ "label" => "PresupuestoLineas.rotativaCyan",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_factor_altura" => [
+ "label" => "PresupuestoLineas.rotativaFactorAltura",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_factor_anchura" => [
+ "label" => "PresupuestoLineas.rotativaFactorAnchura",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_gota_color" => [
+ "label" => "PresupuestoLineas.rotativaGotaColor",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_gota_negro" => [
+ "label" => "PresupuestoLineas.rotativaGotaNegro",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_impresion" => [
+ "label" => "PresupuestoLineas.rotativaImpresion",
+ "rules" => "required|in_list[negro,color]",
+ ],
+ "rotativa_magenta" => [
+ "label" => "PresupuestoLineas.rotativaMagenta",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_metros_libro" => [
+ "label" => "PresupuestoLineas.rotativaMetrosLibro",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_metros_total" => [
+ "label" => "PresupuestoLineas.rotativaMetrosTotal",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_mxm" => [
+ "label" => "PresupuestoLineas.rotativaMxm",
+ "rules" => "decimal|permit_empty",
+ ],
+ "rotativa_negro" => [
+ "label" => "PresupuestoLineas.rotativaNegro",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_num_gotas_amarillo" => [
+ "label" => "PresupuestoLineas.rotativaNumGotasAmarillo",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_num_gotas_cyan" => [
+ "label" => "PresupuestoLineas.rotativaNumGotasCyan",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_num_gotas_magenta" => [
+ "label" => "PresupuestoLineas.rotativaNumGotasMagenta",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_num_gotas_negro" => [
+ "label" => "PresupuestoLineas.rotativaNumGotasNegro",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_pag_color" => [
+ "label" => "PresupuestoLineas.rotativaPagColor",
+ "rules" => "required|integer",
+ ],
+ "rotativa_pag_por_pliego" => [
+ "label" => "PresupuestoLineas.rotativaPagPorPliego",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_peso_gotas_amarillo" => [
+ "label" => "PresupuestoLineas.rotativaPesoGotasAmarillo",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_peso_gotas_cyan" => [
+ "label" => "PresupuestoLineas.rotativaPesoGotasCyan",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_peso_gotas_magenta" => [
+ "label" => "PresupuestoLineas.rotativaPesoGotasMagenta",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_peso_gotas_negro" => [
+ "label" => "PresupuestoLineas.rotativaPesoGotasNegro",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_precio_hora_corte" => [
+ "label" => "PresupuestoLineas.rotativaPrecioHoraCorte",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_precio_pag_color" => [
+ "label" => "PresupuestoLineas.rotativaPrecioPagColor",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_precio_pag_negro" => [
+ "label" => "PresupuestoLineas.rotativaPrecioPagNegro",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_precio_tinta" => [
+ "label" => "PresupuestoLineas.rotativaPrecioTinta",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_saturacion" => [
+ "label" => "PresupuestoLineas.rotativaSaturacion",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_tiempo_corte" => [
+ "label" => "PresupuestoLineas.rotativaTiempoCorte",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_total_corte" => [
+ "label" => "PresupuestoLineas.rotativaTotalCorte",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_total_impresion" => [
+ "label" => "PresupuestoLineas.rotativaTotalImpresion",
+ "rules" => "required|decimal",
+ ],
+ "rotativa_velocidad_corte" => [
+ "label" => "PresupuestoLineas.rotativaVelocidadCorte",
+ "rules" => "required|decimal",
+ ],
+ "solapas_ancho" => [
+ "label" => "PresupuestoLineas.solapasAncho",
+ "rules" => "required|decimal",
+ ],
+ "tipo" => [
+ "label" => "PresupuestoLineas.tipo",
+ "rules" => "required|in_list[bn,bnhq,color,colorhq,cubierta,sobrecubierta,rot_bn,rot_color]",
+ ],
+ ];
+
+
+ public function findAllWithAllRelations(string $selcols = "*", int $limit = null, int $offset = 0)
+ {
+ $sql =
+ "SELECT t1." .
+ $selcols .
+ ", t2.id AS presupuesto, t3.nombre AS papel, t4.nombre AS papel_impresion, t5.nombre AS maquina, t6.tipo AS tarifa_impresion FROM " .
+ $this->table .
+ " t1 LEFT JOIN presupuestos t2 ON t1.presupuesto_id = t2.id LEFT JOIN lg_papel_generico t3 ON t1.papel_id = t3.id LEFT JOIN lg_papel_impresion t4 ON t1.papel_impresion_id = t4.id LEFT JOIN lg_maquinas t5 ON t1.maquina_id = t5.id LEFT JOIN lg_maquinas_tarifas_impresion t6 ON t1.tarifa_impresion_id = t6.id";
+ if (!is_null($limit) && intval($limit) > 0) {
+ $sql .= " LIMIT " . intval($limit);
+ }
+
+ if (!is_null($offset) && intval($offset) > 0) {
+ $sql .= " OFFSET " . intval($offset);
+ }
+
+ $query = $this->db->query($sql);
+ $result = $query->getResultObject();
+ return $result;
+ }
+
+ public function createForPresupuesto($presupuesto_id){
+
+ $tipos = ['bn','bnhq','color','colorhq','cubierta','sobrecubierta','rot_bn','rot_color'];
+ foreach($tipos as $tipo){
+ $builder = $this->db
+ ->table($this->table . " t1");
+ $data = [
+ 'presupuesto_id' => $presupuesto_id,
+ 'tipo' => $tipo,
+ ];
+
+ $builder->insert($data);
+ }
+ }
+
+ public function getLineasPresupuesto($presupuesto_id = -1)
+ {
+ /*
+ Todos los servicios de manipulado activas que se pueden usar en presupuestos
+ */
+ $builder = $this->db
+ ->table($this->table . " t1")
+ ->select(
+ "*"
+ )
+ ->where("t1.presupuesto_id", $presupuesto_id)
+ ->where("t1.isActiva", 1);
+
+
+ return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
+ }
+}
+
+
diff --git a/ci4/app/Models/Presupuestos/PresupuestoModel.php b/ci4/app/Models/Presupuestos/PresupuestoModel.php
index 31fb0400..e31afc8b 100644
--- a/ci4/app/Models/Presupuestos/PresupuestoModel.php
+++ b/ci4/app/Models/Presupuestos/PresupuestoModel.php
@@ -313,13 +313,15 @@ class PresupuestoModel extends \App\Models\GoBaseModel
"t1.id AS id, t1.created_at AS fecha, t2.nombre AS cliente,
CONCAT(t3.first_name, ' ', t3.last_name) AS comercial, t1.titulo AS titulo,
t5.nombre AS pais, t1.inc_rei AS inc_rei, t1.paginas AS paginas, t1.tirada AS tirada,
- t1.total_pedido AS total_pedido, t6.estado AS estado"
+ t1.total_pedido AS total_pedido, t1.total_presupuesto AS total_presupuesto, t6.estado AS estado"
);
$builder->join("clientes t2", "t1.cliente_id = t2.id", "left");
$builder->join("auth_user t3", "t1.user_update_id = t3.id_user", "left");
$builder->join("lg_paises t5", "t1.pais_id = t5.id", "left");
$builder->join("presupuesto_estados t6", "t1.estado_id = t6.id", "left");
+ $builder->where("t1.is_deleted", 0);
+
return empty($search)
? $builder
: $builder
diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoItems.php
index b61e1d61..6b0f405a 100644
--- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoItems.php
+++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoItems.php
@@ -34,7 +34,7 @@
-