diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index 6668f74a..5ada7e45 100755 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -202,7 +202,7 @@ $routes->group('papelesimpresionmargenes', ['namespace' => 'App\Controllers\Conf $routes->post('datatable_editor', 'Papelimpresionmargenes::datatable_editor', ['as' => 'editorOfPapelImpresionMargenes']); $routes->get('delete/(:num)', 'Papelimpresionmargenes::delete/$1', ['as' => 'deletePapelImpresionMargen']); }); -$routes->resource('papelesimpresionmargenes', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Papelimpresionmargenes', 'except' => 'show,new,create,update']); +$routes->resource('papelesimpresionmargenes', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Papelimpresionmargenes', 'except' => 'show,new,create,update']); $routes->group('tarifaacabadolineas', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) { @@ -453,21 +453,21 @@ $routes->group('tarifasenvios', ['namespace' => 'App\Controllers\Tarifas'], func $routes->post('allmenuitems', 'Tarifasenvios::allItemsSelect', ['as' => 'select2ItemsOfTarifaEnvio']); $routes->post('menuitems', 'Tarifasenvios::menuItems', ['as' => 'menuItemsOfTarifaEnvio']); }); -$routes->resource('tarifasenvios', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifasenvios', 'except' => 'show,new,create,update']); +$routes->resource('tarifasenvios', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifasenvios', 'except' => 'show,new,create,update']); $routes->group('tarifasenviosprecios', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) { $routes->post('datatable', 'Tarifasenviosprecios::datatable', ['as' => 'dataTableOfTarifasEnvioPrecios']); $routes->post('datatable_editor', 'Tarifasenviosprecios::datatable_editor', ['as' => 'editorOfTarifasEnvioPrecios']); }); -$routes->resource('tarifasenviosprecios', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifasenviosprecios', 'except' => 'show,new,create,update']); +$routes->resource('tarifasenviosprecios', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifasenviosprecios', 'except' => 'show,new,create,update']); $routes->group('tarifasenvioszonas', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) { $routes->post('datatable', 'Tarifasenvioszonas::datatable', ['as' => 'dataTableOfTarifasEnvioZonas']); $routes->post('datatable_editor', 'Tarifasenvioszonas::datatable_editor', ['as' => 'editorOfTarifasEnvioZonas']); }); -$routes->resource('tarifasenvioszonas', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifasenvioszonas', 'except' => 'show,new,create,update']); +$routes->resource('tarifasenvioszonas', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifasenvioszonas', 'except' => 'show,new,create,update']); $routes->group('proveedores', ['namespace' => 'App\Controllers\Compras'], function ($routes) { @@ -513,9 +513,8 @@ $routes->group('clientedirecciones', ['namespace' => 'App\Controllers\Clientes'] $routes->resource('clientedirecciones', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'Clientedirecciones', 'except' => 'show,new,create,update']); - $routes->group('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) { - $routes->get('', 'Cosidotapablanda::index', ['as' => 'cosidotapablandaList']); + $routes->get('list/(:num)', 'Cosidotapablanda::list/$1', ['as' => 'cosidotapablandaList']); // HOMOGENIZAR CON ARGS DINAMICOS!!! $routes->get('add', 'Cosidotapablanda::add', ['as' => 'newCosidotapablanda']); $routes->post('add', 'Cosidotapablanda::add', ['as' => 'createCosidotapablanda']); $routes->post('create', 'Cosidotapablanda::create', ['as' => 'ajaxCreateCosidotapablanda']); @@ -526,7 +525,7 @@ $routes->group('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos $routes->post('allmenuitems', 'Cosidotapablanda::allItemsSelect', ['as' => 'select2ItemsOfCosidotapablanda']); $routes->post('menuitems', 'Cosidotapablanda::menuItems', ['as' => 'menuItemsOfCosidotapablanda']); }); -$routes->resource('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Cosidotapablanda', 'except' => 'show,new,create,update']); +$routes->resource('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Cosidotapablanda', 'except' => 'show,new,create,update']); $routes->group('serviciosacabados', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) { $routes->post('datatable', 'Presupuestoacabados::datatable', ['as' => 'dataTableOfPresupuestoAcabados']); @@ -538,7 +537,7 @@ $routes->group('serviciosencuadernaciones', ['namespace' => 'App\Controllers\Pre $routes->post('menuitems', 'Presupuestoencuadernaciones::menuItems', ['as' => 'menuItemsOfPresupuestoEncuadernaciones']); $routes->get('delete/(:num)', 'Presupuestoencuadernaciones::delete/$1', ['as' => 'deletePresupuestoencuadernaciones']); $routes->post('edit/(:num)', 'Presupuestoencuadernaciones::edit/$1', ['as' => 'updatePresupuestoencuadernaciones']); - + }); $routes->group('serviciosmanipulados', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) { @@ -555,10 +554,13 @@ $routes->group('presupuestodirecciones', ['namespace' => 'App\Controllers\Presup $routes->post('datatable', 'Presupuestodirecciones::datatable', ['as' => 'dataTableOfPresupuestoDirecciones']); }); -$routes->group('printpresupuestos', ['namespace' => 'App\Controllers\Pdf'], function ($routes) { - $routes->get('', 'PrintPresupuestos::index', ['as' => 'viewPresupuesto']); - $routes->get('generar', 'PrintPresupuestos::generar', ['as' => 'presupuestoToPdf']); -}); +$routes->group( + 'printpresupuestos', + ['namespace' => 'App\Controllers\Pdf'], + function ($routes) { + $routes->get('index/(:num)', 'PrintPresupuestos::index/$1', ['as' => 'viewPresupuesto']); + $routes->get('generar/(:num)', 'PrintPresupuestos::generar/$1', ['as' => 'presupuestoToPdf']); + }); /* diff --git a/ci4/app/Controllers/Pdf/PrintPresupuestos.php b/ci4/app/Controllers/Pdf/PrintPresupuestos.php index 4469e9dd..4adca2a3 100755 --- a/ci4/app/Controllers/Pdf/PrintPresupuestos.php +++ b/ci4/app/Controllers/Pdf/PrintPresupuestos.php @@ -1,4 +1,5 @@ getResourceForPdf($id_presupuesto)->get()->getRow(); + $data['lp_ByN'] = $lineasPresupuestoModel->getResourceByNForPdf($id_presupuesto)->get()->getRow(); + $data['lp_Color'] = $lineasPresupuestoModel->getResourceColorForPdf($id_presupuesto)->get()->getRow(); + $data['direccionesEnvio'] = $direccionesEnvioModel->getResourceForPdf($id_presupuesto)->get()->getResultObject(); + + + return view(getenv('theme.path') . 'pdfs/presupuesto', $data); } - public function index() + + public function generar($presupuesto_id) { - //return view('pdf_view'); - return view(getenv('theme.path').'pdfs/presupuesto'); - } - public function generar(){ - $dompdf = new \Dompdf\Dompdf(['isRemoteEnabled' => true]); - //$dompdf->loadHtml(view('pdf_view')); - $dompdf->loadHtml(view(getenv('theme.path').'pdfs/presupuesto')); + // Cargar modelos + $presupuestoModel = model('App\Models\Presupuestos\PresupuestoModel'); + $lineasPresupuestoModel = model('App\Models\Presupuestos\PresupuestoLineaModel'); + $direccionesEnvioModel = model('App\Models\Presupuestos\PresupuestoDireccionesModel'); + + // Informacion del presupuesto + $data['presupuesto'] = $presupuestoModel->getResourceForPdf($presupuesto_id)->get()->getRow(); + $data['lp_ByN'] = $lineasPresupuestoModel->getResourceByNForPdf($presupuesto_id)->get()->getRow(); + $data['lp_Color'] = $lineasPresupuestoModel->getResourceColorForPdf($presupuesto_id)->get()->getRow(); + $data['direccionesEnvio'] = $direccionesEnvioModel->getResourceForPdf($presupuesto_id)->get()->getResultObject(); + + // Crear una instancia de Dompdf + $options = new \Dompdf\Options(); + $options->set('isHtml5ParserEnabled', true); + $options->set('isPhpEnabled', true); + $options->set('isRemoteEnabled', true); + $dompdf = new \Dompdf\Dompdf($options); + + // Contenido HTML del documento + $dompdf->loadHtml(view(getenv('theme.path').'pdfs/presupuesto', $data)); + + // Establecer el tamaño del papel $dompdf->setPaper('A4', 'portrait'); + + // Renderizar el PDF $dompdf->render(); - $dompdf->stream('presupuesto-demo.pdf'); + + // Obtener el contenido generado + $output = $dompdf->output(); + + // Establecer las cabeceras para visualizar en lugar de descargar + $file_name = "presupuesto-$presupuesto_id.pdf"; + return $this->response + ->setStatusCode(200) + ->setHeader('Content-Type', 'application/pdf') + ->setHeader('Content-Disposition', 'inline; filename="' . $file_name . '"') + ->setHeader('Cache-Control', 'private, max-age=0, must-revalidate') + ->setHeader('Pragma', 'public') + ->setHeader('Content-Length', strlen($output)) + ->setBody($output); } } \ No newline at end of file diff --git a/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php b/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php index d55c4770..3329774e 100755 --- a/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php +++ b/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php @@ -60,7 +60,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController // Breadcrumbs $this->viewData['breadcrumb'] = [ ['title' => lang("App.menu_presupuestos"), 'route' => "javascript:void(0);", 'active' => false], - ['title' => lang("App.menu_libros_cosido_tapa_blanda"), 'route' => site_url('presupuestos/cosidotapablanda'), 'active' => true] + ['title' => lang("App.menu_libros_cosido_tapa_blanda"), 'route' => site_url('presupuestos/cosidotapablanda/list/4'), 'active' => true] ]; parent::initController($request, $response, $logger); @@ -68,8 +68,18 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController } - public function index() + + public function list($tipo_presupuesto = 4) { + switch ($tipo_presupuesto){ + + case 4: + break; + + default: + return "A IMPLEMENTAR!"; + + } $viewData = [ 'currentModule' => static::$controllerSlug, @@ -188,6 +198,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController $postData['updated_at'] = gmdate('Y-m-d H:m:s', time()); $sanitizedData = $this->sanitized($postData, $nullIfEmpty); + // JJO $sanitizedData['user_updated_id'] = $session->id_user; @@ -197,7 +208,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController } if ($this->request->getPost('retractilado5') == null) { $sanitizedData['retractilado5'] = false; - } + } if ($this->request->getPost('ferro') == null) { $sanitizedData['ferro'] = false; } @@ -213,29 +224,51 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController if ($this->request->getPost('faja_color') == null) { $sanitizedData['faja_color'] = false; } + if ($this->request->getPost('papel_formato_personalizado') == null) { + $sanitizedData['papel_formato_personalizado'] = false; + } $noException = true; - if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : + if($sanitizedData['papel_formato_id'] == null && $sanitizedData['papel_formato_ancho'] == null + && $sanitizedData['papel_formato_alto'] == null){ + if ($this->request->isAJAX()) { + $newTokenHash = csrf_hash(); + $csrfTokenName = csrf_token(); + $data = [ + 'errorMensaje' => lang('Presupuestos.errores.formato_papel'), + $csrfTokenName => $newTokenHash + ]; + return $this->respond($data); + + } + else{ + $this->session->setFlashData('errorMessage', lang('Presupuestos.errores.formato_papel')); + } + $successfulResult = false; + } + else{ + if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) - - if ($this->canValidate()) : - try { - $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); - } catch (\Exception $e) { - $noException = false; - $this->dealWithException($e); - } - else : - $this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Presupuestos.presupuesto'))]); - $this->session->setFlashdata('formErrors', $this->model->errors()); - + if ($this->canValidate()) : + try { + $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); + } catch (\Exception $e) { + $noException = false; + $this->dealWithException($e); + } + else : + $this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Presupuestos.presupuesto'))]); + $this->session->setFlashdata('formErrors', $this->model->errors()); + + endif; + + $presupuestoEntity->fill($sanitizedData); + + $thenRedirect = false; endif; + } - $presupuestoEntity->fill($sanitizedData); - - $thenRedirect = false; - endif; if ($noException && $successfulResult) : $id = $presupuestoEntity->id ?? $id; $message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Presupuestos.presupuesto'))]) . '.'; @@ -279,6 +312,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController endif; // ($requestMethod === 'post') + $this->viewData['presupuestoId'] = $id; $this->viewData['presupuestoEntity'] = $presupuestoEntity; $this->viewData['isCosido'] = (new TipoPresupuestoModel())->get_isCosido($presupuestoEntity->tipo_impresion_id); diff --git a/ci4/app/Language/es/Presupuestos.php b/ci4/app/Language/es/Presupuestos.php index cd1ff429..68b84bc6 100755 --- a/ci4/app/Language/es/Presupuestos.php +++ b/ci4/app/Language/es/Presupuestos.php @@ -230,7 +230,8 @@ return [ 'lineaDuplicada' => 'Ya existe ese tipo de linea en el presupuesto', 'errorRotColor' => 'Papeles y gramajes deben ser iguales en color y BN', 'error_servicios_anadidos' => 'Hay servicios sin datos', - 'error_servicios_duplicados' => 'El servicio seleccionado ya está añadido' + 'error_servicios_duplicados' => 'El servicio seleccionado ya está añadido', + 'formato_papel' => 'Debe seleccionar un formato de papel' ], diff --git a/ci4/app/Models/Presupuestos/PresupuestoDireccionesModel.php b/ci4/app/Models/Presupuestos/PresupuestoDireccionesModel.php index 46d0cc76..b70c2a3a 100755 --- a/ci4/app/Models/Presupuestos/PresupuestoDireccionesModel.php +++ b/ci4/app/Models/Presupuestos/PresupuestoDireccionesModel.php @@ -89,4 +89,28 @@ class PresupuestoDireccionesModel extends \App\Models\GoBaseModel ->orLike("t1.telefono", $search) ->groupEnd(); } + + /** + * Get resource data for pdf generation. + * + * @param int $presupuesto_id + * + * @return \CodeIgniter\Database\BaseBuilder + */ + public function getResourceForPdf($presupuesto_id = -1) + { + $builder = $this->db + ->table($this->table . " t1") + ->select( + "t1.direccion AS direccion, t2.nombre AS pais, + t1.municipio AS municipio, t1.provincia AS provincia, t1.cp AS cp, t1.telefono AS telefono, + t1.cantidad AS cantidad" + ); + + $builder->where('t1.presupuesto_id', $presupuesto_id); + $builder->join("lg_paises t2", "t1.pais_id = t2.id", "left"); + + return $builder; + } + } diff --git a/ci4/app/Models/Presupuestos/PresupuestoLineaModel.php b/ci4/app/Models/Presupuestos/PresupuestoLineaModel.php index 7512a0ae..b9071184 100755 --- a/ci4/app/Models/Presupuestos/PresupuestoLineaModel.php +++ b/ci4/app/Models/Presupuestos/PresupuestoLineaModel.php @@ -1,4 +1,5 @@ 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; + } + } diff --git a/ci4/app/Models/Presupuestos/PresupuestoModel.php b/ci4/app/Models/Presupuestos/PresupuestoModel.php index aa34dc7c..3d55cff5 100755 --- a/ci4/app/Models/Presupuestos/PresupuestoModel.php +++ b/ci4/app/Models/Presupuestos/PresupuestoModel.php @@ -1,4 +1,5 @@ [ "integer" => "Presupuestos.validation.integer", - + ], "coleccion" => [ "max_length" => "Presupuestos.validation.max_length", @@ -277,8 +278,9 @@ class PresupuestoModel extends \App\Models\GoBaseModel ], "referencia_cliente" => [ "max_length" => "Presupuestos.validation.max_length", - ], + ], ]; + public function findAllWithAllRelations(string $selcols = "*", int $limit = null, int $offset = 0) { $sql = @@ -324,14 +326,14 @@ class PresupuestoModel extends \App\Models\GoBaseModel $builder->where("t1.is_deleted", 0); - if(empty($search)) + if (empty($search)) return $builder; - else{ + else { $builder->groupStart(); - foreach($search as $col_search){ - if($col_search[0] != 1) + foreach ($search as $col_search) { + if ($col_search[0] != 1) $builder->like(self::SORTABLE[$col_search[0]], $col_search[2]); - else{ + else { $dates = explode(" ", $col_search[2]); $builder->where(self::SORTABLE[$col_search[0]] . ">=", $dates[0]); $builder->where(self::SORTABLE[$col_search[0]] . "<=", $dates[1]); @@ -340,6 +342,43 @@ class PresupuestoModel extends \App\Models\GoBaseModel $builder->groupEnd(); return $builder; } - + } + + + /** + * Get resource data for creating PDFs. + * + * @param string $search + * + * @return \CodeIgniter\Database\BaseBuilder + */ + public function getResourceForPdf($presupuesto_id = -1) + { + $builder = $this->db + ->table($this->table . " t1") + ->select( + "t1.id AS id, t1.created_at AS fecha, t1.titulo AS titulo, t1.autor AS autor, t1.ferro AS ferro, + t1.ferro_digital AS ferro_digital, t1.prototipo AS prototipo, t1.solapas AS solapas, + t1.solapas_ancho AS solapas_ancho, t1.paginas AS paginas, t1.tirada AS tirada, t1.coleccion AS coleccion, + t1.retractilado AS retractilado, t1.guardas AS guardas, t1.marcapaginas AS marcapaginas, + t1.comentarios_pdf AS comentarios_pdf, + t1.total_presupuesto AS total_presupuesto, t1.total_precio_unidad AS total_precio_unidad, + t1.papel_formato_personalizado AS isPersonalizado, t1.envios_recoge_cliente AS recoge_cliente, + CONCAT(t1.papel_formato_ancho, 'x', t1.papel_formato_alto) AS formatoPersonalizado, + t2.nombre AS cliente, + CONCAT(t3.first_name, ' ', t3.last_name) AS comercial, t3.email AS email_comercial, + CONCAT(t4.ancho, 'x', t4.alto) AS formato" + ); + $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_papel_formato t4", "t1.papel_formato_id = t4.id", "left"); + + $builder->where("t1.is_deleted", 0); + $builder->where("t1.id", $presupuesto_id); + + return $builder; + } + + } diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php index 5092de4b..0ac6cc15 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php @@ -31,7 +31,7 @@
solapas == true ? 'checked' : ''; ?>> - +
@@ -70,13 +70,13 @@
- + papel_formato_personalizado == true ? '' : 'style="display: none"'; ?> type="number" id="papelFormatoAncho" name="papel_formato_ancho" maxLength="8" step="0.01" class="form-control" value="papel_formato_ancho) ?>">
-
- +
+ papel_formato_personalizado == true ? '' : 'style="display: none"'; ?> type="number" id="papelFormatoAlto" name="papel_formato_alto" maxLength="8" step="0.01" class="form-control" value="papel_formato_alto) ?>">
@@ -341,6 +341,13 @@ $('#papelFormatoId').select2({ allowClear: false, }); +let initTamanioPersonalizado = papel_formato_personalizado==true?1:0); ?>; +if(initTamanioPersonalizado != null){ + if ( initTamanioPersonalizado){ + $('#papelFormatoId').next(".select2-container").hide(); + } +} + $('#papelFormatoPersonalizado').on("click",function(){ var checkbox = document.getElementById('papelFormatoPersonalizado'); if(checkbox.checked == true){ diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoClienteItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoClienteItems.php index aad2a126..8227098a 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoClienteItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoClienteItems.php @@ -1083,6 +1083,10 @@ $('#compPaginasNegrohq').val('0'); $('#compPaginasNegro').val($('#paginas').val()) + if($('#tipoImpresion').select2('data')[0].id == 'negro'){ + $('#compGramajeColor').val('').trigger('change') + $('#compPapelColor').val(0).trigger('change') + } if( $('#tableCompIntPlana').DataTable().rows().count() > 0 && $('#tableCompIntPlana').DataTable().cell(0, 0).data().includes('hq')) { @@ -1102,6 +1106,11 @@ $('#compPaginasColor').val('0') $('#compPaginasNegro').val('0') $('#compPaginasNegrohq').val($('#paginas').val()) + + if($('#tipoImpresion').select2('data')[0].id == 'negrohq'){ + $('#compGramajeColorhq').val('').trigger('change') + $('#compPapelColorhq').val(0).trigger('change') + } if($('#tableCompIntPlana').DataTable().rows().count() > 0 && !$('#tableCompIntPlana').DataTable().cell(0, 0).data().includes('hq')) { @@ -1118,7 +1127,7 @@ }) - function checkComparadorInt(is_color, is_hq, actualizarLinea=false) { + function checkComparadorInt(is_color, is_hq, actualizarLineaPlana=false, actualizarLineaRot=false) { try{ @@ -1135,11 +1144,11 @@ checkDatosPedidoForComp()) { - getLineasIntPlana(is_color, is_hq, actualizarLinea).then((result) =>{ + getLineasIntPlana(is_color, is_hq, actualizarLineaPlana).then((result) =>{ // Para rotativa, si es color el papel y el gramaje tiene que ser igual if(!is_color) { - getLineasIntRot(is_hq, actualizarLinea); + getLineasIntRot(is_hq, actualizarLineaRot); } else { @@ -1150,7 +1159,7 @@ if(($('#compPapelNegro').select2('data')[0].id == $('#compPapelColor').select2('data')[0].id && $('#compGramajeNegro').select2('data')[0].text.trim() == $('#compGramajeColor').select2('data')[0].text.trim())) { - getLineasIntRot(is_hq, actualizarLinea); + getLineasIntRot(is_hq, actualizarLineaRot); } else { diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php index 6ffc3931..f79763fa 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php @@ -37,10 +37,10 @@ value="" /> - "btn btn-dark float-start me-sm-3 me-1",]) ?> + "btn btn-dark float-start me-sm-3 me-1",'target' => '_blank']) ?> "btn btn-info float-start me-sm-3 me-1",]) ?> - "btn btn-secondary float-start",]) ?> + "btn btn-secondary float-start",]) ?>
@@ -120,38 +120,42 @@ const url_parts = url.split('/'); section("additionalInlineJs") ?> if(url_parts[url_parts.length-2] == 'edit'){ - id = url_parts[url_parts.length-1]; + id = url_parts[url_parts.length-1]; } else{ - id = -1; + id = -1; } $('#presupuestoForm').on( "submit", function( event ) { - event.preventDefault(); - save_servicios(); - save_datos_envios(); + + event.preventDefault(); + save_servicios(); + save_datos_envios(); - $.when(fill_bbdd_from_lp(id).then(function (data, textStatus, jqXHR){ - generateCompJSON() - form = $('#presupuestoForm').serialize() - form += getValuesResumenForm() + $.when(fill_bbdd_from_lp(id).then(function (data, textStatus, jqXHR){ + generateCompJSON() + form = $('#presupuestoForm').serialize() + form += getValuesResumenForm() - $.ajax({ - type: "POST", - url: "", - data: form, - success: function (data) { - yeniden(data.) - popSuccessAlert(data.mensaje) - } - }).fail(function (jqXHR, textStatus, error) { - // Handle error here - console.log(jqXHR) - });; - })) + $.ajax({ + type: "POST", + url: "", + data: form, + success: function (data) { + yeniden(data.) + if('errorMensaje' in data) + popErrorAlert(data.errorMensaje) + else + popSuccessAlert(data.mensaje) + } + }).fail(function (jqXHR, textStatus, error) { + // Handle error here + console.log(jqXHR) + });; + })) - return false; //stop the actual form post !important! + return false; //stop the actual form post !important! }); diff --git a/ci4/app/Views/themes/backend/vuexy/main/breadcrumbs.php b/ci4/app/Views/themes/backend/vuexy/main/breadcrumbs.php index ca33ed44..8778a9c7 100755 --- a/ci4/app/Views/themes/backend/vuexy/main/breadcrumbs.php +++ b/ci4/app/Views/themes/backend/vuexy/main/breadcrumbs.php @@ -52,12 +52,12 @@ } // SOLO PARA TEST - $(document).on("keypress", function(event) { + /*$(document).on("keypress", function(event) { if (event.keyCode === 112) { event.preventDefault(); showBreadCrumbSaveButton(true); } - }); + });*/ $('#bc-save').on( "click", function() { showBreadCrumbSaveButton(false); diff --git a/ci4/app/Views/themes/backend/vuexy/main/menu_impresion.php b/ci4/app/Views/themes/backend/vuexy/main/menu_impresion.php index 858ffb0d..870818fa 100755 --- a/ci4/app/Views/themes/backend/vuexy/main/menu_impresion.php +++ b/ci4/app/Views/themes/backend/vuexy/main/menu_impresion.php @@ -94,7 +94,7 @@ 0): ?> 0): ?> @@ -114,7 +114,7 @@ 0): ?> 0): ?> diff --git a/ci4/app/Views/themes/backend/vuexy/pdfs/presupuesto.php b/ci4/app/Views/themes/backend/vuexy/pdfs/presupuesto.php index 00241c88..a8983ed7 100755 --- a/ci4/app/Views/themes/backend/vuexy/pdfs/presupuesto.php +++ b/ci4/app/Views/themes/backend/vuexy/pdfs/presupuesto.php @@ -4,17 +4,16 @@ - <?= "Presupuesto " . "TBC" ?> - + @@ -37,34 +36,34 @@ PRESUPUESTO Nº: - id" ?> + id ?> CLIENTE: - customer->name" ?> + cliente ?> FECHA: - + fecha)); ?> - Título: titulo" ?> + Título: titulo ?> - Colección: coleccion" ?> + Colección: coleccion ?> - Autor: autor" ?> + Autor: autor ?> @@ -83,37 +82,39 @@ Ferro - TBD + ferro == 1) ? "SI" : "NO"); ?> Prototipo - SI + prototipo == 1) ? "SI" : "NO"); ?> Ferro Digital - SI + ferro_digital == 1) ? "SI" : "NO"); ?> Formato - papel_formato->format()" ?> mm. + isPersonalizado) ? $presupuesto->formatoPersonalizado : $presupuesto->formato) ?> mm Nº de páginas totales - paginas" ?> + paginas ?> + Nº de páginas ByN - + paginas ?> Papel - + papel ?> Gramaje - + gramaje ?> + Nº de páginas Color - + paginas ?> Papel - + papel ?> Gramaje - + gramaje ?> @@ -169,9 +170,9 @@ Tipo Solapas - + solapas == 1) ? "SI" : "NO"); ?> Ancho - TBD cm + solapas_ancho ?> cm @@ -185,15 +186,15 @@ Retractilado - NO + retractilado == 1) ? "SI" : "NO"); ?> Guardas - NO + guardas == 1) ? "SI" : "NO"); ?> Marcapáginas - NO + marcapaginas == 1) ? "SI" : "NO"); ?> @@ -204,45 +205,56 @@ ENVÍO - + recoge_cliente == 1) { ?> El pedido será recogido por el cliente - + + - - - Ejemplares - - Dirección - - - - País - - Provincia - - C.P. - - Ciudad - - Telf. - - - - + + + Ejemplares + cantidad ?> + Dirección + direccion ?> + + + País + pais ?> + Provincia + provincia ?> + C.P. + cp ?> + Ciudad + municipio ?> + Telf. + telefono ?> + + + + + + + No hay definidos envíos + + + - +
- - - - @@ -250,45 +262,45 @@ - - - - - - - - + + + + - - - - -
TiradaU.Impresión 4%U.Envío 21% Precio** Precio UD. TOTAL CON IVA
TBD uds.TBD €TBD €TBD €TBD €TBD €tirada ?> uds.total_presupuesto ?> €total_precio_unidad ?> €total_presupuesto * 1.04 ?> €
Estos precios no incluyen I.V.A.
- comentarios_pdf)) { ?> -
OBSERVACIONES
-
{!! nl2br($obj->comentarios_pdf) !!}
+ comentarios_pdf)) { ?> +
+
OBSERVACIONES
+
+ comentarios_pdf); ?> +
+
-