mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Añadido comportamiento demo al boton imprimir en añadir/editar presupuestos
This commit is contained in:
@ -50,11 +50,6 @@ $routes->delete('api/user/(:segment)', 'Api::user/delete/$1');
|
||||
* Route Definitions
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
$routes->group('pdfcontroller', ['namespace' => 'App\Controllers\Pdf'], function ($routes) {
|
||||
$routes->get('', 'PdfController::index', ['as' => 'pdfList']);
|
||||
$routes->match(['get', 'post'], 'htmltopdf', 'PdfController::htmlToPDF', ['as' => 'toPdf']);
|
||||
});
|
||||
|
||||
$routes->group('tarifaacabado', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) {
|
||||
$routes->get('', 'Tarifaacabado::index', ['as' => 'tarifaAcabadoList']);
|
||||
$routes->get('index', 'Tarifaacabado::index', ['as' => 'tarifaAcabadoIndex']);
|
||||
@ -483,6 +478,11 @@ $routes->group('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos
|
||||
});
|
||||
$routes->resource('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Cosidotapablanda', 'except' => 'show,new,create,update']);
|
||||
|
||||
$routes->group('printpresupuestos', ['namespace' => 'App\Controllers\Pdf'], function ($routes) {
|
||||
$routes->get('', 'PrintPresupuestos::index', ['as' => 'pdfList']);
|
||||
$routes->match(['get', 'post'], 'generar', 'PrintPresupuestos::generar', ['as' => 'presupuestoToPdf']);
|
||||
});
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* Additional Routing
|
||||
|
||||
@ -4,7 +4,7 @@ namespace App\Controllers\Pdf;
|
||||
use App\Controllers\BaseController;
|
||||
|
||||
|
||||
class PdfController extends BaseController
|
||||
class PrintPresupuestos extends BaseController
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
@ -16,12 +16,12 @@ class PdfController extends BaseController
|
||||
//return view('pdf_view');
|
||||
return view(getenv('theme.path').'pdfs/presupuesto');
|
||||
}
|
||||
public function htmlToPDF(){
|
||||
public function generar(){
|
||||
$dompdf = new \Dompdf\Dompdf(['isRemoteEnabled' => true]);
|
||||
//$dompdf->loadHtml(view('pdf_view'));
|
||||
$dompdf->loadHtml(view(getenv('theme.path').'pdfs/presupuesto'));
|
||||
$dompdf->setPaper('A4', 'portrait');
|
||||
$dompdf->render();
|
||||
$dompdf->stream();
|
||||
$dompdf->stream('presupuesto-demo.pdf');
|
||||
}
|
||||
}
|
||||
@ -10,6 +10,8 @@ return [
|
||||
'Cancel' => 'Cancelar',
|
||||
'ChangePassword' => 'Cambiar contraseña',
|
||||
'Close' => 'Cerrar',
|
||||
'Print' => 'Imprimir',
|
||||
'Clone' => 'Duplicar',
|
||||
'Dashboard' => 'Panel de control',
|
||||
'Delete' => 'Borrar',
|
||||
'Error' => 'Error',
|
||||
|
||||
@ -1,115 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>Codeigniter 4 PDF Example - positronx.io</title>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
|
||||
<style>
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container mt-5">
|
||||
<h2>Generate PDF in Codeigniter from View</h2>
|
||||
<div class="d-flex flex-row-reverse bd-highlight">
|
||||
<a href="<?php echo site_url('pdfcontroller/htmltopdf') ?>" class="btn btn-primary">
|
||||
Download PDF
|
||||
</a>
|
||||
</div>
|
||||
<table class="table table-striped table-hover mt-4">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Profile</th>
|
||||
<th>City</th>
|
||||
<th>Date</th>
|
||||
<th>CTC</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Airi Satou</td>
|
||||
<td>Accountant</td>
|
||||
<td>Tokyo</td>
|
||||
<td>33</td>
|
||||
<td>2008/11/28</td>
|
||||
<td>$162,700</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Angelica Ramos</td>
|
||||
<td>Chief Executive Officer (CEO)</td>
|
||||
<td>London</td>
|
||||
<td>47</td>
|
||||
<td>2009/10/09</td>
|
||||
<td>$1,200,000</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Ashton Cox</td>
|
||||
<td>Junior Technical Author</td>
|
||||
<td>San Francisco</td>
|
||||
<td>66</td>
|
||||
<td>2009/01/12</td>
|
||||
<td>$86,000</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Bradley Greer</td>
|
||||
<td>Software Engineer</td>
|
||||
<td>London</td>
|
||||
<td>41</td>
|
||||
<td>2012/10/13</td>
|
||||
<td>$132,000</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Brenden Wagner</td>
|
||||
<td>Software Engineer</td>
|
||||
<td>San Francisco</td>
|
||||
<td>28</td>
|
||||
<td>2011/06/07</td>
|
||||
<td>$206,850</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Brielle Williamson</td>
|
||||
<td>Integration Specialist</td>
|
||||
<td>New York</td>
|
||||
<td>61</td>
|
||||
<td>2012/12/02</td>
|
||||
<td>$372,000</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Bruno Nash</td>
|
||||
<td>Software Engineer</td>
|
||||
<td>London</td>
|
||||
<td>38</td>
|
||||
<td>2011/05/03</td>
|
||||
<td>$163,500</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Caesar Vance</td>
|
||||
<td>Pre-Sales Support</td>
|
||||
<td>New York</td>
|
||||
<td>21</td>
|
||||
<td>2011/12/12</td>
|
||||
<td>$106,450</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Cara Stevens</td>
|
||||
<td>Sales Assistant</td>
|
||||
<td>New York</td>
|
||||
<td>46</td>
|
||||
<td>2011/12/06</td>
|
||||
<td>$145,600</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Cedric Kelly</td>
|
||||
<td>Senior Javascript Developer</td>
|
||||
<td>Edinburgh</td>
|
||||
<td>22</td>
|
||||
<td>2012/03/29</td>
|
||||
<td>$433,060</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -17,13 +17,19 @@
|
||||
<?= view("themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoItems") ?>
|
||||
<?= view("themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems") ?>
|
||||
<?= view("themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoClienteItems") ?>
|
||||
<?= view("themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems") ?>
|
||||
<?= view("themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems") ?>
|
||||
<?= view("themes/backend/vuexy/form/presupuestos/cosidotapablanda/_comentariosItems") ?>
|
||||
<?= view("themes/backend/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestoItems") ?>
|
||||
<div class="pt-4">
|
||||
<input type="submit"
|
||||
class="btn btn-primary float-start me-sm-3 me-1"
|
||||
name="save"
|
||||
value="<?= lang("Basic.global.Save") ?>"
|
||||
/>
|
||||
<?= anchor(route_to("cosidotapablandaList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start",]) ?>
|
||||
<?= anchor(route_to("presupuestoToPdf"), lang("Basic.global.Print"), ["class" => "btn btn-dark float-start me-sm-3 me-1",]) ?>
|
||||
<?= anchor(route_to("#"), lang("Basic.global.Clone"), ["class" => "btn btn-info float-start me-sm-3 me-1",]) ?>
|
||||
<?= anchor(route_to("cosidotapablandaList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start",]) ?>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- //.card -->
|
||||
@ -63,6 +69,9 @@
|
||||
}
|
||||
});
|
||||
|
||||
/*******************************
|
||||
* Inicialización de los Select2
|
||||
*******************************/
|
||||
$('#incRei').select2({
|
||||
allowClear: false,
|
||||
});
|
||||
@ -94,7 +103,7 @@
|
||||
$('#compGramajeNegrohq').select2({
|
||||
allowClear: false,
|
||||
});
|
||||
|
||||
|
||||
$('#compPapelColor').select2({
|
||||
allowClear: false,
|
||||
});
|
||||
@ -102,11 +111,15 @@
|
||||
$('#compPapelColorhq').select2({
|
||||
allowClear: false,
|
||||
});
|
||||
|
||||
|
||||
$('#compGramajeColor').select2({
|
||||
allowClear: false,
|
||||
});
|
||||
|
||||
$('#compGramajeColorhq').select2({
|
||||
allowClear: false,
|
||||
});
|
||||
|
||||
$('#compPapelCubierta').select2({
|
||||
allowClear: false,
|
||||
});
|
||||
@ -119,14 +132,11 @@
|
||||
allowClear: false,
|
||||
});
|
||||
|
||||
$('#compPaginasCubierta').select2({
|
||||
$('#compCarasCubierta').select2({
|
||||
allowClear: false,
|
||||
minimumResultsForSearch: Infinity,
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
@ -136,24 +146,25 @@
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
autosize($('#compCalPaginasColor'));
|
||||
|
||||
|
||||
|
||||
|
||||
$('#papelFormatoPersonalizado').on("click",function(){
|
||||
var checkbox = document.getElementById('papelFormatoPersonalizado');
|
||||
if(checkbox.checked == true){
|
||||
document.getElementById("papelFormatoAncho").style.display = "block";
|
||||
document.getElementById("papelFormatoAlto").style.display = "block";
|
||||
$('#papelFormatoId').next(".select2-container").hide();
|
||||
document.getElementById("label_papelFormatoId").innerHTML =
|
||||
$('#papelFormatoId').val('').change();
|
||||
document.getElementById("label_papelFormatoId").innerHTML =
|
||||
"<?=lang('Presupuestos.papelFormatoId') ?> (" +
|
||||
"<?=lang('Presupuestos.papelFormatoAncho') ?> x <?=lang('Presupuestos.papelFormatoAncho') ?>)*";
|
||||
}
|
||||
else{
|
||||
document.getElementById("papelFormatoAncho").value= "";
|
||||
document.getElementById("papelFormatoAlto").value= "";
|
||||
document.getElementById("papelFormatoAncho").style.display = "none";
|
||||
document.getElementById("papelFormatoAlto").style.display = "none";
|
||||
$('#papelFormatoId').next(".select2-container").show();
|
||||
document.getElementById("label_papelFormatoId").innerHTML =
|
||||
document.getElementById("label_papelFormatoId").innerHTML =
|
||||
"<?=lang('Presupuestos.papelFormatoId') ?>*";
|
||||
}
|
||||
});
|
||||
@ -164,221 +175,649 @@
|
||||
|
||||
var tableCompIntPlana = new DataTable('#tableCompIntPlana',{
|
||||
scrollX: true,
|
||||
searching: false,
|
||||
paging: false,
|
||||
searching: false,
|
||||
paging: false,
|
||||
info: false,
|
||||
ordering: false,
|
||||
ordering: false,
|
||||
responsive: true,
|
||||
select: true,
|
||||
language: {
|
||||
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
|
||||
},
|
||||
columns: [
|
||||
{ 'data': 'tipo',
|
||||
'render': function ( data, type, row, meta ) {
|
||||
if(data=='bn')
|
||||
return '<?= lang('Presupuestos.bn') ?>';
|
||||
else if(data=='bnhq')
|
||||
return '<?= lang('Presupuestos.bnhq') ?>';
|
||||
else if(data=='color')
|
||||
return '<?= lang('Presupuestos.color') ?>';
|
||||
else if(data=='colorhq')
|
||||
return '<?= lang('Presupuestos.colorhq') ?>';
|
||||
}
|
||||
},
|
||||
{ 'data': 'paginas' },
|
||||
{ 'data': 'papel' },
|
||||
{ 'data': 'gramaje' },
|
||||
{ 'data': 'marca' },
|
||||
{ 'data': 'maquina' },
|
||||
{ 'data': 'numeroPliegos' },
|
||||
{ 'data': 'pliegosPedido' },
|
||||
{ 'data': 'precioPliego' },
|
||||
{ 'data': 'libro' },
|
||||
{ 'data': 'totalPapelPedido' },
|
||||
{ 'data': 'lomo' },
|
||||
{ 'data': 'peso' },
|
||||
{ 'data': 'click' },
|
||||
{ 'data': 'totalClicks' },
|
||||
{ 'data': 'total' },
|
||||
{ 'data': 'maquinaId'},
|
||||
{ 'data': 'maquinaVelocidad'},
|
||||
{ 'data': 'tiempoMaquina'},
|
||||
{ 'data': 'papelGenericoId'},
|
||||
{ 'data': 'papelImpresionId'}
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
target: [16,17,18,19,20],
|
||||
visible: false,
|
||||
searchable: false
|
||||
},
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
var tableCompIntRotativa = new DataTable('#tableCompIntRotativa',{
|
||||
scrollX: true,
|
||||
searching: false,
|
||||
paging: false,
|
||||
searching: false,
|
||||
paging: false,
|
||||
info: false,
|
||||
ordering: false,
|
||||
ordering: false,
|
||||
responsive: true,
|
||||
select: true,
|
||||
language: {
|
||||
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
|
||||
},
|
||||
columns: [
|
||||
{ 'data': 'tipo',
|
||||
'render': function ( data, type, row, meta ) {
|
||||
if(data=='rotativa')
|
||||
return '<?= lang('Presupuestos.rotativa') ?>';
|
||||
}
|
||||
},
|
||||
{ 'data': 'paginas' },
|
||||
{ 'data': 'papel' },
|
||||
{ 'data': 'gramaje' },
|
||||
{ 'data': 'marca' },
|
||||
{ 'data': 'aFavorFibra',
|
||||
'render': function(data, type, row, meta){
|
||||
if(data=='si')
|
||||
return '<?= lang('Presupuestos.si') ?>';
|
||||
else if(data=='no')
|
||||
return '<?= lang('Presupuestos.no') ?>';
|
||||
}
|
||||
},
|
||||
{ 'data': 'maquina' },
|
||||
{ 'data': 'numeroPliegos' },
|
||||
{ 'data': 'pliegosPedido' },
|
||||
{ 'data': 'precioPliego' },
|
||||
{ 'data': 'libro' },
|
||||
{ 'data': 'totalPapelPedido' },
|
||||
{ 'data': 'lomo' },
|
||||
{ 'data': 'peso' },
|
||||
{ 'data': 'click' },
|
||||
{ 'data': 'totalClicks' },
|
||||
{ 'data': 'precioPagNegro' },
|
||||
{ 'data': 'precioPagColor' },
|
||||
{ 'data': 'totalTinta' },
|
||||
{ 'data': 'totalCorte' },
|
||||
{ 'data': 'total' },
|
||||
{ 'data': 'maquinaId'},
|
||||
{ 'data': 'maquinaVelocidad'},
|
||||
{ 'data': 'tiempoMaquina'},
|
||||
{ 'data': 'papelGenericoId'},
|
||||
{ 'data': 'papelImpresionId'}
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
target: [21,22,23,24,25],
|
||||
visible: false,
|
||||
searchable: false
|
||||
},
|
||||
]
|
||||
});
|
||||
|
||||
var tableCompIntCubierta = new DataTable('#tableCompCubierta',{
|
||||
var tableCompCubierta = new DataTable('#tableCompCubierta',{
|
||||
scrollX: true,
|
||||
searching: false,
|
||||
paging: false,
|
||||
searching: false,
|
||||
paging: false,
|
||||
info: false,
|
||||
ordering: false,
|
||||
ordering: false,
|
||||
responsive: true,
|
||||
select: true,
|
||||
language: {
|
||||
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
|
||||
},
|
||||
columns: [
|
||||
{ 'data': 'tipo',
|
||||
'render': function ( data, type, row, meta ) {
|
||||
if(data=='cubierta')
|
||||
return '<?= lang('Presupuestos.cubierta') ?>';
|
||||
else if(data=='sobrecubierta')
|
||||
return '<?= lang('Presupuestos.sobrecubierta') ?>';
|
||||
}
|
||||
},
|
||||
{ 'data': 'paginas' },
|
||||
{ 'data': 'papel' },
|
||||
{ 'data': 'gramaje' },
|
||||
{ 'data': 'marca' },
|
||||
{ 'data': 'maquina' },
|
||||
{ 'data': 'numeroPliegos' },
|
||||
{ 'data': 'pliegosPedido' },
|
||||
{ 'data': 'precioPliego' },
|
||||
{ 'data': 'libro' },
|
||||
{ 'data': 'totalPapelPedido' },
|
||||
{ 'data': 'lomo' },
|
||||
{ 'data': 'peso' },
|
||||
{ 'data': 'click' },
|
||||
{ 'data': 'totalClicks' },
|
||||
{ 'data': 'total' },
|
||||
{ 'data': 'maquinaId'},
|
||||
{ 'data': 'maquinaVelocidad'},
|
||||
{ 'data': 'tiempoMaquina'},
|
||||
{ 'data': 'papelGenericoId'},
|
||||
{ 'data': 'papelImpresionId'}
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
target: [16,17,18,19,20],
|
||||
visible: false,
|
||||
searchable: false
|
||||
},
|
||||
]
|
||||
});
|
||||
|
||||
var tableCompIntSobrecubierta = new DataTable('#tableCompSobrecubierta',{
|
||||
const papelGenericoNegroList = <?php echo json_encode($papelGenericoNegroList); ?>;
|
||||
|
||||
|
||||
var tableLineasPresupuesto = new DataTable('#tableLineasPresupuesto',{
|
||||
scrollX: true,
|
||||
searching: false,
|
||||
paging: false,
|
||||
searching: false,
|
||||
paging: false,
|
||||
info: false,
|
||||
ordering: false,
|
||||
ordering: false,
|
||||
responsive: true,
|
||||
select: false,
|
||||
language: {
|
||||
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('.comp_negro_items').on('change', function (e) {
|
||||
|
||||
checkComparadorInt(false,false);
|
||||
});
|
||||
|
||||
$('.comp_negrohq_items').on('change', function (e) {
|
||||
|
||||
checkComparadorInt(false, true);
|
||||
});
|
||||
|
||||
$('.comp_color_items').on('change', function (e) {
|
||||
|
||||
checkComparadorInt(true, false);
|
||||
});
|
||||
|
||||
$('.comp_colorhq_items').on('change', function (e) {
|
||||
checkComparadorInt(true, true);
|
||||
});
|
||||
|
||||
async function getLineasIntPlana(is_color, is_hq){
|
||||
|
||||
const dimension = getDimensionLibro();
|
||||
|
||||
let datos = {
|
||||
type: 'interior',
|
||||
color: is_color?1:0,
|
||||
hq: is_hq?1:0,
|
||||
paginas: parseInt($(''+ elementos.paginas).val()),
|
||||
tirada: parseInt($('#tirada').val()),
|
||||
merma: parseInt($('#merma').val()),
|
||||
ancho: dimension.ancho,
|
||||
alto: dimension.alto,
|
||||
papel_generico_id: $(''+ elementos.papel).select2('data')[0].id,
|
||||
papel_generico: $(''+ elementos.papel).select2('data')[0].text.trim(),
|
||||
gramaje: $(''+ elementos.gramaje).select2('data')[0].text.trim() ,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/cosidotapablanda/datatable",
|
||||
data: datos,
|
||||
success: function (data) {
|
||||
|
||||
clearIntLineas(is_color);
|
||||
|
||||
if(data.lineas.length >0){
|
||||
|
||||
fillIntPlana(data, is_color, is_hq);
|
||||
selectIntLineas();
|
||||
$('#title_int_plana').html('<?= lang("Presupuestos.compInteriorPlana") ?>' + ' (' + tableCompIntPlana.rows().count() + ')');
|
||||
$('#insertarPlanaBtn').removeClass('d-none')
|
||||
}
|
||||
else{
|
||||
$('#title_int_plana').html('<?= lang("Presupuestos.compInteriorPlana") ?>');
|
||||
$('#insertarPlanaBtn').addClass('d-none')
|
||||
$('#total_comp_plana').html('0.00');
|
||||
}
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
return true;
|
||||
},
|
||||
error: function(e){
|
||||
return false;
|
||||
}
|
||||
})
|
||||
return false;
|
||||
}
|
||||
|
||||
async function getLineasIntRot(is_hq){
|
||||
|
||||
const dimension = getDimensionLibro();
|
||||
|
||||
// Rotativa solo negro o color (no hq)
|
||||
if ( is_hq==false){
|
||||
|
||||
if(checkInputsForRotativa()){
|
||||
|
||||
let datos = {
|
||||
type: 'interior_rot',
|
||||
paginas: parseInt($('#paginas').val()),
|
||||
paginas_negro: parseInt($('#compPaginasNegro').val()),
|
||||
paginas_color: parseInt($('#compPaginasColor').val()),
|
||||
tirada: parseInt($('#tirada').val()),
|
||||
merma: parseInt($('#merma').val()),
|
||||
ancho: dimension.ancho,
|
||||
alto: dimension.alto,
|
||||
// el papel y el gramaje se coge del negro (siempre estará)
|
||||
papel_generico_id: $('#compPapelNegro').select2('data')[0].id,
|
||||
papel_generico: $('#compPapelNegro').select2('data')[0].text.trim(),
|
||||
gramaje: $('#compGramajeNegro').select2('data')[0].text.trim() ,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/cosidotapablanda/datatable",
|
||||
data: datos,
|
||||
success: function (data) {
|
||||
|
||||
clearIntRot();
|
||||
|
||||
if(data.lineas.length >0){
|
||||
|
||||
fillIntRot(data);
|
||||
selectIntRotLineas();
|
||||
$('#title_int_rot').html('<?= lang("Presupuestos.compInteriorRotativa") ?>' + ' (' + tableCompIntRotativa.rows().count() + ')');
|
||||
$('#insertarRotativaBtn').removeClass('d-none')
|
||||
}
|
||||
else{
|
||||
$('#title_int_rot').html('<?= lang("Presupuestos.compInteriorRotativa") ?>');
|
||||
$('#insertarRotativaBtn').addClass('d-none')
|
||||
$('#total_comp_rot').html('0.00')
|
||||
|
||||
}
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
return true;
|
||||
},
|
||||
error: function(e){
|
||||
return false;
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$('.comp_cubierta_items').on('change', function (){
|
||||
|
||||
if ($('#compCarasCubierta').select2('data').length > 0 &&
|
||||
$('#compPapelCubierta').select2('data').length > 0 &&
|
||||
$('#compGramajeCubierta').select2('data').length > 0 ){
|
||||
|
||||
const dimension = getDimensionLibro();
|
||||
|
||||
let datos = {
|
||||
type: 'cubierta',
|
||||
paginas: parseInt($('#compCarasCubierta').select2('data')[0].id),
|
||||
tirada: parseInt($('#tirada').val()),
|
||||
merma: parseInt($('#mermacubierta').val()),
|
||||
color: 1,
|
||||
ancho: dimension.ancho,
|
||||
alto: dimension.alto,
|
||||
solapas: $('#solapas').is(':checked')?1:0,
|
||||
solapas_ancho: parseInt($('#solapas_ancho').val()),
|
||||
papel_generico_id: $('#compPapelCubierta').select2('data')[0].id,
|
||||
papel_generico: $('#compPapelCubierta').select2('data')[0].text.trim(),
|
||||
gramaje: $('#compGramajeCubierta').select2('data')[0].text.trim() ,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/cosidotapablanda/datatable",
|
||||
data: datos,
|
||||
success: function (data) {
|
||||
|
||||
clearCubierta();
|
||||
|
||||
if(data.lineas.length >0){
|
||||
|
||||
fillCubierta(data);
|
||||
selectCubiertaLineas();
|
||||
$('#title_cubierta').html('<?= lang("Presupuestos.cubierta") ?>' + ' (' + tableCompCubierta.rows().count() + ')');
|
||||
$('#insertarCubiertaBtn').removeClass('d-none')
|
||||
|
||||
}
|
||||
else{
|
||||
$('#title_cubierta').html('<?= lang("Presupuestos.cubierta") ?>');
|
||||
$('#insertarCubiertaBtn').addClass('d-none')
|
||||
$('#total_comp_cubierta').html('0.00')
|
||||
|
||||
}
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
return true;
|
||||
},
|
||||
error: function(e){
|
||||
return false;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
else{
|
||||
clearCubierta();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#tipoImpresion').on("change", function () {
|
||||
updatePapelesComparador();
|
||||
$('#title_int_rot').html('<?= lang("Presupuestos.compInteriorRotativa") ?>');
|
||||
$('#title_int_plana').html('<?= lang("Presupuestos.compInteriorPlana") ?>');
|
||||
$('#paginas').change();
|
||||
|
||||
|
||||
if (($('#tipoImpresion').select2('data')[0].id == 'negro' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'color')){
|
||||
|
||||
$('#tableCompIntRotativa').DataTable().clear().draw();
|
||||
$('#total_comp_rot').html("0.00");
|
||||
|
||||
if( $('#tableCompIntPlana').DataTable().rows().count() > 0 &&
|
||||
$('#tableCompIntPlana').DataTable().cell(0, 0).data().includes('hq')) {
|
||||
|
||||
$('#tableCompIntPlana').DataTable().clear().draw();
|
||||
$('#total_comp_plana').html("0.00");
|
||||
}
|
||||
|
||||
}
|
||||
else if (($('#tipoImpresion').select2('data')[0].id == 'negrohq' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'colorhq')){
|
||||
|
||||
$('#tableCompIntRotativa').DataTable().clear().draw();
|
||||
$('#total_comp_rot').html("0.00");
|
||||
|
||||
if($('#tableCompIntPlana').DataTable().rows().count() > 0 &&
|
||||
!$('#tableCompIntPlana').DataTable().cell(0, 0).data().includes('hq')) {
|
||||
|
||||
$('#tableCompIntPlana').DataTable().clear().draw();
|
||||
$('#total_comp_plana').html("0.00");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function checkComparadorInt(is_color, is_hq) {
|
||||
|
||||
elementos = getIDsComparador(is_color, is_hq)
|
||||
|
||||
if ($(''+ elementos.papel).select2('data').length > 0 &&
|
||||
$(''+ elementos.gramaje).select2('data').length > 0 &&
|
||||
parseInt($(''+ elementos.paginas).val()) > 0 &&
|
||||
checkDatosPedidoForComp()) {
|
||||
|
||||
getLineasIntPlana(is_color, is_hq).then((result) =>{
|
||||
getLineasIntRot(is_hq);
|
||||
});
|
||||
}
|
||||
else{
|
||||
clearIntLineas(is_color);
|
||||
clearIntRot();
|
||||
$('#title_int_rot').html('<?= lang("Presupuestos.compInteriorRotativa") ?>');
|
||||
$('#title_int_plana').html('<?= lang("Presupuestos.compInteriorPlana") ?>');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$('#compPapelNegro').on('select2:select', function (e){
|
||||
|
||||
$('#compGramajeNegro').val(null).trigger('change');
|
||||
$('#compGramajeNegro').prop('disabled', false);
|
||||
$('#compPapelNegro').find('option[value="0"]').remove();
|
||||
$('#compGramajeNegro').select2({
|
||||
allowClear: true,
|
||||
minimumResultsForSearch: Infinity,
|
||||
ajax: {
|
||||
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
if($('#compPapelNegro').select2('data')[0].id=='0'){
|
||||
$('#compGramajeNegro').val('').change();
|
||||
$('#compGramajeNegro').prop('disabled', true);
|
||||
}
|
||||
|
||||
data: function (params) {
|
||||
return {
|
||||
tipo: 'gramaje',
|
||||
datos: $('#compPapelNegro').select2('data')[0].text.trim() ,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
},
|
||||
delay: 60,
|
||||
processResults: function (response) {
|
||||
yeniden(response.<?= csrf_token() ?>);
|
||||
return {
|
||||
results: response.menu
|
||||
};
|
||||
},
|
||||
cache: true
|
||||
}
|
||||
});
|
||||
else{
|
||||
$('#insertarPlanaBtn').addClass('d-none')
|
||||
$('#insertarRotativaBtn').addClass('d-none')
|
||||
$('#total_comp_plana').html('0.00')
|
||||
$('#total_comp_rot').html('0.00')
|
||||
$('#compGramajeNegro').val('').change();
|
||||
$('#compGramajeNegro').empty().trigger("change");
|
||||
$('#compGramajeNegro').prop('disabled', false);
|
||||
$('#compGramajeNegro').select2({
|
||||
allowClear: true,
|
||||
minimumResultsForSearch: Infinity,
|
||||
ajax: {
|
||||
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
|
||||
data: function (params) {
|
||||
return {
|
||||
tipo: 'gramaje',
|
||||
uso: 'bn',
|
||||
datos: $('#compPapelNegro').select2('data')[0].text.trim() ,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
},
|
||||
delay: 60,
|
||||
processResults: function (response) {
|
||||
yeniden(response.<?= csrf_token() ?>);
|
||||
return {
|
||||
results: response.menu
|
||||
};
|
||||
},
|
||||
cache: true
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#compPapelNegrohq').on('select2:select', function (e){
|
||||
|
||||
$('#compGramajeNegrohq').val(null).trigger('change');
|
||||
$('#compGramajeNegrohq').prop('disabled', false);
|
||||
$('#compPapelNegrohq').find('option[value="0"]').remove();
|
||||
$('#compGramajeNegrohq').select2({
|
||||
allowClear: true,
|
||||
minimumResultsForSearch: Infinity,
|
||||
ajax: {
|
||||
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
if($('#compPapelNegrohq').select2('data')[0].id=='0'){
|
||||
$('#compGramajeNegrohq').val('').change();
|
||||
$('#compGramajeNegrohq').prop('disabled', true);
|
||||
}
|
||||
else{
|
||||
$('#insertarPlanaBtn').addClass('d-none')
|
||||
$('#insertarRotativaBtn').addClass('d-none')
|
||||
$('#total_comp_plana').html('0.00')
|
||||
$('#total_comp_rot').html('0.00')
|
||||
$('#compGramajeNegrohq').empty().trigger("change");
|
||||
$('#compGramajeNegrohq').prop('disabled', false);
|
||||
$('#compGramajeNegrohq').select2({
|
||||
allowClear: true,
|
||||
minimumResultsForSearch: Infinity,
|
||||
ajax: {
|
||||
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
|
||||
data: function (params) {
|
||||
return {
|
||||
tipo: 'gramaje',
|
||||
datos: $('#compPapelNegrohq').select2('data')[0].text.trim() ,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
},
|
||||
delay: 60,
|
||||
processResults: function (response) {
|
||||
yeniden(response.<?= csrf_token() ?>);
|
||||
return {
|
||||
results: response.menu
|
||||
};
|
||||
},
|
||||
cache: true
|
||||
}
|
||||
});
|
||||
data: function (params) {
|
||||
return {
|
||||
tipo: 'gramaje',
|
||||
uso: 'bnhq',
|
||||
datos: $('#compPapelNegrohq').select2('data')[0].text.trim() ,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
},
|
||||
delay: 60,
|
||||
processResults: function (response) {
|
||||
yeniden(response.<?= csrf_token() ?>);
|
||||
return {
|
||||
results: response.menu
|
||||
};
|
||||
},
|
||||
cache: true
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#compPapelColor').on('select2:select', function (e){
|
||||
|
||||
$('#compGramajeColor').val(null).trigger('change');
|
||||
$('#compGramajeColor').prop('disabled', false);
|
||||
$('#compPapelColor').find('option[value="0"]').remove();
|
||||
$('#compGramajeColor').select2({
|
||||
allowClear: true,
|
||||
minimumResultsForSearch: Infinity,
|
||||
ajax: {
|
||||
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
if($('#compPapelColor').select2('data')[0].id=='0'){
|
||||
$('#compGramajeColor').val('').change();
|
||||
$('#compGramajeColor').prop('disabled', true);
|
||||
}
|
||||
else{
|
||||
$('#insertarPlanaBtn').addClass('d-none')
|
||||
$('#insertarRotativaBtn').addClass('d-none')
|
||||
$('#total_comp_plana').html('0.00')
|
||||
$('#total_comp_rot').html('0.00')
|
||||
$('#compGramajeColor').empty().trigger("change");
|
||||
$('#compGramajeColor').prop('disabled', false);
|
||||
$('#compPapelColor').find('option[value="0"]').remove();
|
||||
$('#compGramajeColor').select2({
|
||||
allowClear: true,
|
||||
minimumResultsForSearch: Infinity,
|
||||
ajax: {
|
||||
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
|
||||
data: function (params) {
|
||||
return {
|
||||
tipo: 'gramaje',
|
||||
datos: $('#compPapelColor').select2('data')[0].text.trim() ,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
},
|
||||
delay: 60,
|
||||
processResults: function (response) {
|
||||
yeniden(response.<?= csrf_token() ?>);
|
||||
return {
|
||||
results: response.menu
|
||||
};
|
||||
},
|
||||
cache: true
|
||||
}
|
||||
});
|
||||
data: function (params) {
|
||||
return {
|
||||
tipo: 'gramaje',
|
||||
uso: 'color',
|
||||
datos: $('#compPapelColor').select2('data')[0].text.trim() ,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
},
|
||||
delay: 60,
|
||||
processResults: function (response) {
|
||||
yeniden(response.<?= csrf_token() ?>);
|
||||
return {
|
||||
results: response.menu
|
||||
};
|
||||
},
|
||||
cache: true
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#compPapelColorhq').on('select2:select', function (e){
|
||||
|
||||
$('#compGramajeColorhq').val(null).trigger('change');
|
||||
$('#compGramajeColorhq').prop('disabled', false);
|
||||
$('#compPapelColorhq').find('option[value="0"]').remove();
|
||||
$('#compGramajeColorhq').select2({
|
||||
allowClear: true,
|
||||
minimumResultsForSearch: Infinity,
|
||||
ajax: {
|
||||
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
if($('#compPapelColorhq').select2('data')[0].id=='0'){
|
||||
$('#compGramajeColorhq').val('').change();
|
||||
$('#compGramajeColorhq').prop('disabled', true);
|
||||
}
|
||||
else{
|
||||
$('#insertarPlanaBtn').addClass('d-none')
|
||||
$('#insertarRotativaBtn').addClass('d-none')
|
||||
$('#total_comp_plana').html('0.00')
|
||||
$('#total_comp_rot').html('0.00')
|
||||
$('#compGramajeColorhq').empty().trigger("change");
|
||||
$('#compGramajeColorhq').prop('disabled', false);
|
||||
$('#compPapelColorhq').find('option[value="0"]').remove();
|
||||
$('#compGramajeColorhq').select2({
|
||||
allowClear: true,
|
||||
minimumResultsForSearch: Infinity,
|
||||
ajax: {
|
||||
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
|
||||
data: function (params) {
|
||||
return {
|
||||
tipo: 'gramaje',
|
||||
datos: $('#compPapelColorhq').select2('data')[0].text.trim() ,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
},
|
||||
delay: 60,
|
||||
processResults: function (response) {
|
||||
yeniden(response.<?= csrf_token() ?>);
|
||||
return {
|
||||
results: response.menu
|
||||
};
|
||||
},
|
||||
cache: true
|
||||
}
|
||||
});
|
||||
data: function (params) {
|
||||
return {
|
||||
tipo: 'gramaje',
|
||||
uso: 'colorhq',
|
||||
datos: $('#compPapelColorhq').select2('data')[0].text.trim() ,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
},
|
||||
delay: 60,
|
||||
processResults: function (response) {
|
||||
yeniden(response.<?= csrf_token() ?>);
|
||||
return {
|
||||
results: response.menu
|
||||
};
|
||||
},
|
||||
cache: true
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#compPapelCubierta').on('select2:select', function (e){
|
||||
if($('#compPapelCubierta').select2('data')[0].id=='0'){
|
||||
$('#compGramajeCubierta').val('').change();
|
||||
$('#compGramajeCubierta').prop('disabled', true);
|
||||
}
|
||||
else{
|
||||
$('#insertarCubiertaBtn').addClass('d-none')
|
||||
$('#total_comp_cubierta').html('0.00')
|
||||
$('#compGramajeCubierta').val('').trigger('change');
|
||||
$('#compGramajeCubierta').prop('disabled', false);
|
||||
$('#compPapelCubierta').find('option[value="0"]').remove();
|
||||
$('#compGramajeCubierta').select2({
|
||||
allowClear: true,
|
||||
minimumResultsForSearch: Infinity,
|
||||
ajax: {
|
||||
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
|
||||
$('#compGramajeCubierta').val(null).trigger('change');
|
||||
$('#compGramajeCubierta').prop('disabled', false);
|
||||
$('#compPapelCubierta').find('option[value="0"]').remove();
|
||||
$('#compGramajeCubierta').select2({
|
||||
allowClear: true,
|
||||
minimumResultsForSearch: Infinity,
|
||||
ajax: {
|
||||
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
|
||||
data: function (params) {
|
||||
return {
|
||||
tipo: 'gramaje',
|
||||
datos: $('#compPapelCubierta').select2('data')[0].text.trim() ,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
},
|
||||
delay: 60,
|
||||
processResults: function (response) {
|
||||
yeniden(response.<?= csrf_token() ?>);
|
||||
return {
|
||||
results: response.menu
|
||||
};
|
||||
},
|
||||
cache: true
|
||||
}
|
||||
});
|
||||
data: function (params) {
|
||||
return {
|
||||
tipo: 'gramaje',
|
||||
uso: 'cubierta',
|
||||
datos: $('#compPapelCubierta').select2('data')[0].text.trim() ,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
},
|
||||
delay: 60,
|
||||
processResults: function (response) {
|
||||
yeniden(response.<?= csrf_token() ?>);
|
||||
return {
|
||||
results: response.menu
|
||||
};
|
||||
},
|
||||
cache: true
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<?=$this->section('css') ?>
|
||||
@ -386,12 +825,7 @@
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/datatables-editor/editor.dataTables.min.css') ?>">
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.bootstrap5.min.css">
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/sk-datatables.css') ?>">
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
<?= $this->section('additionalExternalJs') ?>
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/autosize/autosize.js') ?>"></script>
|
||||
<script src="<?= site_url('js_loader/comparadorCosidoTapaBlanda_js') ?>"></script>
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
|
||||
@ -400,4 +834,9 @@
|
||||
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.bootstrap5.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
|
||||
<?=$this->endSection() ?>
|
||||
<script src="https://cdn.datatables.net/select/1.7.0/js/dataTables.select.min.js"></script>
|
||||
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.min.js') ?>"></script>
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/autosize/autosize.js') ?>"></script>
|
||||
<script src="<?= site_url('js_loader/comparadorCosidoTapaBlanda_js') ?>"></script>
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
Reference in New Issue
Block a user