mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'bug/presupuestos_jm_2' into 'main'
Bug/presupuestos jm 2 See merge request jjimenez/safekat!96
This commit is contained in:
@ -189,6 +189,28 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
// JJO
|
||||
$sanitizedData['user_updated_id'] = $session->id_user;
|
||||
|
||||
if ($this->request->getPost('retractilado') == null) {
|
||||
$sanitizedData['retractilado'] = false;
|
||||
}
|
||||
if ($this->request->getPost('retractilado5') == null) {
|
||||
$sanitizedData['retractilado5'] = false;
|
||||
}
|
||||
if ($this->request->getPost('ferro') == null) {
|
||||
$sanitizedData['ferro'] = false;
|
||||
}
|
||||
if ($this->request->getPost('ferro_digital') == null) {
|
||||
$sanitizedData['ferro_digital'] = false;
|
||||
}
|
||||
if ($this->request->getPost('prototipo') == null) {
|
||||
$sanitizedData['prototipo'] = false;
|
||||
}
|
||||
if ($this->request->getPost('marcapaginas') == null) {
|
||||
$sanitizedData['marcapaginas'] = false;
|
||||
}
|
||||
if ($this->request->getPost('faja_color') == null) {
|
||||
$sanitizedData['faja_color'] = false;
|
||||
}
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
@ -295,6 +317,14 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
$this->viewData['POD'] = $this->getPOD();
|
||||
|
||||
$this->viewData['serviciosCheckboxes'] = [
|
||||
'retractilado' => 3,
|
||||
'retractilado5' => 5,
|
||||
'ferro' => 24,
|
||||
'prototipo' => 9,
|
||||
'fajaColor' => 16,
|
||||
];
|
||||
|
||||
$this->viewData['tipo_impresion_id'] = 4; // Cosido tapa blanda JJO
|
||||
|
||||
$this->viewData['formAction'] = route_to('updateCosidotapablanda', $id);
|
||||
|
||||
@ -17,9 +17,9 @@ class Test extends BaseController
|
||||
|
||||
public function index()
|
||||
{
|
||||
$model = model('App\Models\Tarifas\TarifaEnvioPrecioModel');
|
||||
|
||||
echo '<pre>';
|
||||
var_dump($model->getEnvioPrecio(2, 1.5, "cajas"));
|
||||
var_dump($this->get_tarifa_enc(18, 150, 100, 98,148));
|
||||
echo '</pre>';
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +49,6 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
|
||||
"sobrecubiertas_ancho" => 0.0,
|
||||
"merma" => null,
|
||||
"merma_portada" => 6.0,
|
||||
"imagenes_bn_interior" => false,
|
||||
"comentarios_cliente" => null,
|
||||
"comentarios_safekat" => null,
|
||||
"comentarios_pdf" => null,
|
||||
@ -215,7 +214,6 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
|
||||
"sobrecubiertas_ancho" => "float",
|
||||
"merma" => "float",
|
||||
"merma_portada" => "float",
|
||||
"imagenes_bn_interior" => "boolean",
|
||||
"en_produccion" => "boolean",
|
||||
"en_espera" => "boolean",
|
||||
"modo_comparador" => "boolean",
|
||||
|
||||
@ -159,6 +159,7 @@ return [
|
||||
|
||||
'errores' => [
|
||||
'paginas' => 'The field pages must be greater than zero',
|
||||
'paginasLP' => 'The number of pages does not match the total',
|
||||
'tiradas' => 'The field print must be greater than zero',
|
||||
'dimension' => 'The book dimension must be greater than 60mm',
|
||||
'lineaDuplicada' => 'That type of line already exists in the budget.',
|
||||
|
||||
@ -18,7 +18,7 @@ return [
|
||||
'precio' => 'Price',
|
||||
'saveDirection' => 'Save to client addresses (shipped on pallets)',
|
||||
'validation' => [
|
||||
'ejemplares_envio' => 'The number of copies sent does not match the print run'
|
||||
'ejemplares_envio' => 'The number of copies sent does not match the print run',
|
||||
'max_length' => 'Max. length ',
|
||||
'required' => 'Field required',
|
||||
'valid_email' => 'The email is not valid',
|
||||
|
||||
@ -218,6 +218,7 @@ return [
|
||||
|
||||
'errores' => [
|
||||
'paginas' => 'El campo páginas tiene que ser mayor que cero',
|
||||
'paginasLP' => 'El número de páginas no coincide con el total',
|
||||
'tiradas' => 'El campo tiradas tiene que ser mayor que cero',
|
||||
'dimension' => 'La dimensión del libro tiene que ser mayor que 60mm',
|
||||
'lineaDuplicada' => 'Ya existe ese tipo de linea en el presupuesto',
|
||||
|
||||
@ -158,10 +158,12 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel
|
||||
public function getPrecioTarifa($tarifa_encuadernacion_id, $paginas, $tirada, $ancho, $alto, $proveedor_id, $POD){
|
||||
|
||||
$modelTarifa = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
||||
if($proveedor_id != -1)
|
||||
if($proveedor_id != -1){
|
||||
$tarifa_value = $modelTarifa->getTarifaPresupuestoEncuadernacion($tarifa_encuadernacion_id, $paginas, $tirada, $ancho, $alto, $proveedor_id);
|
||||
else
|
||||
}
|
||||
else{
|
||||
$tarifa_value = $modelTarifa->getTarifaPresupuestoEncuadernacion($tarifa_encuadernacion_id, $paginas, $tirada, $ancho, $alto);
|
||||
}
|
||||
if (count($tarifa_value)>0) {
|
||||
|
||||
$result_data = $this->calcularTarifa($tarifa_value[0], $paginas, $POD<$tirada?false:true);
|
||||
|
||||
@ -69,7 +69,6 @@ class PresupuestoModel extends \App\Models\GoBaseModel
|
||||
"sobrecubiertas_ancho",
|
||||
"merma",
|
||||
"merma_portada",
|
||||
"imagenes_bn_interior",
|
||||
"comentarios_cliente",
|
||||
"comentarios_safekat",
|
||||
"comentarios_pdf",
|
||||
|
||||
@ -158,11 +158,11 @@ class TarifaEncuadernacionModel extends \App\Models\GoBaseModel
|
||||
$builder->where('t2.tirada_min <=', $tirada);
|
||||
$builder->where('t2.tirada_max >=', $tirada);
|
||||
$builder->where('t3.paginas_libro_min <=', $paginas);
|
||||
$builder->where('t3.paginas_libro_max >', $paginas);
|
||||
$builder->where('t3.paginas_libro_max >=', $paginas);
|
||||
$builder->where('t4.ancho_min <=', $ancho);
|
||||
$builder->where('t4.ancho_max >', $ancho);
|
||||
$builder->where('t4.ancho_max >=', $ancho);
|
||||
$builder->where('t4.alto_min <=', $alto);
|
||||
$builder->where('t4.alto_max >', $alto);
|
||||
$builder->where('t4.alto_max >=', $alto);
|
||||
|
||||
if($proveedor_id != -1){
|
||||
$builder->where('t2.proveedor_id', $proveedor_id);
|
||||
|
||||
@ -95,7 +95,7 @@
|
||||
<label for="merma" class="form-label">
|
||||
<?= lang('Presupuestos.merma') ?>*
|
||||
</label>
|
||||
<input type="number" id="merma" name="merma" maxLength="8" tabindex="4" step="1" placeholder="10" class="form-control" value="<?= old('merma', $presupuestoEntity->merma) ?>">
|
||||
<input readonly style="background: #E8E8E8;" id="merma" name="merma" maxLength="8" tabindex="4" step="1" placeholder="10" class="form-control" value="<?= old('merma', $presupuestoEntity->merma) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
@ -104,7 +104,7 @@
|
||||
<label for="mermacubierta" class="form-label">
|
||||
<?= lang('Presupuestos.mermacubierta') ?>*
|
||||
</label>
|
||||
<input type="number" id="mermacubierta" name="merma_cubierta" tabindex="5" placeholder="10" maxLength="8" step="1" class="form-control" value="<?= old('merma_cubierta', $presupuestoEntity->merma_cubierta) ?>">
|
||||
<input readonly style="background: #E8E8E8;" id="mermacubierta" name="merma_cubierta" tabindex="5" placeholder="10" maxLength="8" step="1" class="form-control" value="<?= old('merma_cubierta', $presupuestoEntity->merma_cubierta) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
@ -233,33 +233,8 @@
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-md-12 col-lg-3 px-4">
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<label for="recogerEnTaller" class="form-check-label">
|
||||
<input type="checkbox" id="recogerEnTaller" name="recoger_en_taller" value="1" class="form-check-input" <?= $presupuestoEntity->recoger_en_taller == true ? 'checked' : ''; ?>>
|
||||
<?= lang('Presupuestos.recogerEnTaller') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-12 col-lg-4 px-4">
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<label for="imagenesBnInterior" class="form-check-label">
|
||||
<input type="checkbox" id="imagenesBnInterior" name="imagenes_bn_interior" value="1" class="form-check-input" <?= $presupuestoEntity->imagenes_bn_interior == true ? 'checked' : ''; ?>>
|
||||
<?= lang('Presupuestos.imagenesBnInterior') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
</div> <!--//.row -->
|
||||
<?php endif; ?>
|
||||
|
||||
</div> <!-- //.accordion-body -->
|
||||
@ -273,17 +248,20 @@
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
$('#paginas').on("change", function () {
|
||||
checkPaginasPresupuesto()
|
||||
updateLineasPresupuesto()
|
||||
|
||||
// Si es negro o color
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'negro' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'color') {
|
||||
document.getElementById('compPaginasNegro').value = document.getElementById('paginas').value;
|
||||
document.getElementById('compPaginasColor').value = 0;
|
||||
$('#compPaginasNegro').val(parseInt($('#paginas').val())-parseInt($('#compPaginasColor').val()));
|
||||
$('#compPaginasNegro').trigger('change')
|
||||
}
|
||||
// Si es negrohq o colorhq
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'negrohq' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'colorhq') {
|
||||
document.getElementById('compPaginasNegrohq').value = document.getElementById('paginas').value;
|
||||
document.getElementById('compPaginasColorhq').value = 0;
|
||||
$('#compPaginasNegrohq').val(parseInt($('#paginas').val())-parseInt($('#compPaginasColorhq').val()));
|
||||
$('#compPaginasNegrohq').trigger('change');
|
||||
}
|
||||
|
||||
update_servicios(false)
|
||||
@ -292,9 +270,40 @@ $('#paginas').on("change", function () {
|
||||
$('#tirada').on("change", function () {
|
||||
|
||||
update_servicios(false)
|
||||
calcular_mermas()
|
||||
updateLineasPresupuesto()
|
||||
checkInsertar()
|
||||
})
|
||||
|
||||
function calcular_mermas(){
|
||||
|
||||
const tirada = parseInt($('#tirada').val())
|
||||
var merma = 0
|
||||
|
||||
if(tirada>POD){
|
||||
merma = tirada*0.1<=30 ? tirada*0.1 : 30
|
||||
}
|
||||
else{
|
||||
merma_lineas = []
|
||||
$('#tableLineasPresupuesto tbody tr:visible ').each(function(){
|
||||
if(!this.id.includes('_data') && !this.id.endsWith('_cubierta') && !this.id.endsWith('_sobrecubierta')){
|
||||
const formas_linea = parseInt($('#' + this.id + '_formas').val())
|
||||
if(formas_linea > tirada)
|
||||
merma_lineas.push(formas_linea-tirada)
|
||||
else
|
||||
merma_lineas.push(tirada%formas_linea)
|
||||
}
|
||||
})
|
||||
if(merma_lineas.length>0)
|
||||
merma = Math.max(...merma_lineas)
|
||||
else
|
||||
merma = 0
|
||||
}
|
||||
$('#mermacubierta').val(parseInt(merma))
|
||||
$('#merma').val(parseInt(merma))
|
||||
}
|
||||
|
||||
|
||||
$('#papelFormatoId').select2({
|
||||
allowClear: false,
|
||||
});
|
||||
@ -324,11 +333,37 @@ $('#papelFormatoPersonalizado').on("click",function(){
|
||||
<?php if(str_contains($formAction,'edit')): ?>
|
||||
var ancho_libro = getDimensionLibro().ancho;
|
||||
var alto_libro = getDimensionLibro().alto;
|
||||
|
||||
$('#retractilado').on("change", function () {
|
||||
checkRetractiladoComparador(this);
|
||||
servicioRetractilado()
|
||||
});
|
||||
|
||||
|
||||
$('#retractilado5').on("change", function () {
|
||||
checkRetractiladoComparador(this);
|
||||
servicioRetractilado5()
|
||||
});
|
||||
|
||||
$('#fajaColor').on("change", function () {
|
||||
servicioFajaColor()
|
||||
});
|
||||
|
||||
$('#ferro').on("change", function () {
|
||||
servicioFerro()
|
||||
});
|
||||
|
||||
$('#prototipo').on("change", function () {
|
||||
servicioPrototipo()
|
||||
servicioFerro()
|
||||
});
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
$('#papelFormatoId').on('select2:select', function (e){
|
||||
ancho_libro = getDimensionLibro().ancho;
|
||||
alto_libro = getDimensionLibro().alto;
|
||||
update_servicios(false)
|
||||
})
|
||||
|
||||
$('#papelFormatoAncho').on('change', function (e){
|
||||
|
||||
@ -829,7 +829,7 @@
|
||||
|
||||
|
||||
|
||||
async function getLineasIntPlana(is_color, is_hq){
|
||||
async function getLineasIntPlana(is_color, is_hq, actualizarLinea){
|
||||
|
||||
const dimension = getDimensionLibro();
|
||||
|
||||
@ -862,6 +862,28 @@
|
||||
selectIntLineas();
|
||||
$('#title_int_plana').html('<?= lang("Presupuestos.compInteriorPlana") ?>' + ' (' + tableCompIntPlana.rows().count() + ')');
|
||||
$('#insertarPlanaBtn').removeClass('d-none')
|
||||
if(actualizarLinea){
|
||||
var rows = $("#tableCompIntPlana").DataTable().rows( '.selected' ).data().toArray();
|
||||
for(row of rows){
|
||||
|
||||
if(row['tipo'] =='bn' && !is_color && !is_hq){
|
||||
if($('#lp_bn').css('display')!='none')
|
||||
fill_lp_bn(row, true);
|
||||
}
|
||||
else if(row['tipo'] =='bnhq' && !is_color && is_hq){
|
||||
if($('#lp_bnhq').css('display')!='none')
|
||||
fill_lp_bnhq(row, true);
|
||||
}
|
||||
else if(row['tipo'] =='color' && is_color && !is_hq){
|
||||
if($('#lp_color').css('display')!='none')
|
||||
fill_lp_color(row, true);
|
||||
}
|
||||
else if(row['tipo'] =='colorhq' && is_color && is_hq){
|
||||
if($('#lp_colorhq').css('display')!='none')
|
||||
fill_lp_colorhq(row, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
$('#title_int_plana').html('<?= lang("Presupuestos.compInteriorPlana") ?>');
|
||||
@ -878,7 +900,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
async function getLineasIntRot(is_hq){
|
||||
async function getLineasIntRot(is_hq, actualizarLinea=false){
|
||||
|
||||
const dimension = getDimensionLibro();
|
||||
|
||||
@ -917,6 +939,19 @@
|
||||
selectIntRotLineas();
|
||||
$('#title_int_rot').html('<?= lang("Presupuestos.compInteriorRotativa") ?>' + ' (' + tableCompIntRotativa.rows().count() + ')');
|
||||
$('#insertarRotativaBtn').removeClass('d-none')
|
||||
if(actualizarLinea){
|
||||
var rows = $("#tableCompIntRotativa").DataTable().rows( '.selected' ).data().toArray();
|
||||
for(row of rows){
|
||||
if(row['paginasColor'] ==0){
|
||||
if($('#lp_rot_bn').css('display')!='none')
|
||||
fill_lp_rot_bn(row, true);
|
||||
}
|
||||
else if(row['paginasColor'] >0){
|
||||
if($('#lp_rot_color').css('display')!='none')
|
||||
fill_lp_rot_color(row, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
$('#title_int_rot').html('<?= lang("Presupuestos.compInteriorRotativa") ?>');
|
||||
@ -938,6 +973,12 @@
|
||||
|
||||
$('.comp_cubierta_items').on('change', function (){
|
||||
|
||||
checkComparadorCubierta()
|
||||
});
|
||||
|
||||
|
||||
function checkComparadorCubierta(actualizarLinea = false){
|
||||
|
||||
if ($('#compCarasCubierta').select2('data').length > 0 &&
|
||||
$('#compPapelCubierta').select2('data').length > 0 &&
|
||||
$('#compGramajeCubierta').select2('data').length > 0 ){
|
||||
@ -974,7 +1015,12 @@
|
||||
selectCubiertaLineas();
|
||||
$('#title_cubierta').html('<?= lang("Presupuestos.cubierta") ?>' + ' (' + tableCompCubierta.rows().count() + ')');
|
||||
$('#insertarCubiertaBtn').removeClass('d-none')
|
||||
|
||||
if(actualizarLinea){
|
||||
var rows = $("#tableCompCubierta").DataTable().rows( '.selected' ).data().toArray();
|
||||
for(row of rows){
|
||||
fill_lp_cubierta(row, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
$('#title_cubierta').html('<?= lang("Presupuestos.cubierta") ?>');
|
||||
@ -994,8 +1040,7 @@
|
||||
else{
|
||||
clearCubierta();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$('.comp_negro_items').on('change', function (e) {
|
||||
|
||||
@ -1055,7 +1100,7 @@
|
||||
});
|
||||
|
||||
|
||||
function checkComparadorInt(is_color, is_hq) {
|
||||
function checkComparadorInt(is_color, is_hq, actualizarLinea=false) {
|
||||
|
||||
try{
|
||||
|
||||
@ -1072,11 +1117,11 @@
|
||||
checkDatosPedidoForComp()) {
|
||||
|
||||
|
||||
getLineasIntPlana(is_color, is_hq).then((result) =>{
|
||||
getLineasIntPlana(is_color, is_hq, actualizarLinea).then((result) =>{
|
||||
// Para rotativa, si es color el papel y el gramaje tiene que ser igual
|
||||
if(!is_color)
|
||||
{
|
||||
getLineasIntRot(is_hq);
|
||||
getLineasIntRot(is_hq, actualizarLinea);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1087,7 +1132,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);
|
||||
getLineasIntRot(is_hq, actualizarLinea);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1286,6 +1331,7 @@
|
||||
else{
|
||||
$('#insertarCubiertaBtn').addClass('d-none')
|
||||
$('#total_comp_cubierta').html('0.00')
|
||||
$('#compGramajeCubierta').empty().trigger("change");
|
||||
$('#compGramajeCubierta').val('').trigger('change');
|
||||
$('#compGramajeCubierta').prop('disabled', false);
|
||||
$('#compPapelCubierta').find('option[value="0"]').remove();
|
||||
|
||||
@ -404,6 +404,7 @@
|
||||
$('#precio_total_acabado_' + line[0].tarifa_id).val(parseFloat(line[0].total).toFixed(2))
|
||||
$('#acabado_margen_' + line[0].tarifa_id).text(parseFloat(line[0].margen).toFixed(2))
|
||||
});
|
||||
check_serv_acabado_error()
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
}).then(
|
||||
fetch(domain + "/presupuestos/presupuestoencuadernaciones/update/" + id , {
|
||||
@ -424,10 +425,12 @@
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
data.lines.forEach((line) => {
|
||||
|
||||
|
||||
$('#proveedor_enc_' + line[0].tarifa_id).off('change')
|
||||
if(line[0].hasOwnProperty('proveedor_id'))
|
||||
$('#proveedor_enc_' + line[0].tarifa_id).val(line[0].proveedor_id)
|
||||
if(line[0].hasOwnProperty('proveedor_id')){
|
||||
$('#proveedor_enc_' + line[0].tarifa_id)
|
||||
.append('<option selected="selected" value="' + line[0].proveedor_id + '">' + line[0].proveedor + '</option>')
|
||||
}
|
||||
else{
|
||||
$('#proveedor_enc_' + line[0].tarifa_id).empty()
|
||||
.append('<option selected="selected" value="' + line[0].proveedor_id + '">' + '<?= lang("Presupuestos.no_disponible") ?>' + '</option>')
|
||||
@ -437,6 +440,7 @@
|
||||
$('#enc_margen_' + line[0].tarifa_id).val(parseFloat(line[0].margen).toFixed(2))
|
||||
$('#proveedor_enc_' + line[0].tarifa_id).on('change', proveedor_enc_event)
|
||||
});
|
||||
check_serv_enc_error()
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
}).then(
|
||||
fetch(domain + "/presupuestos/presupuestomanipulados/update/" + id , {
|
||||
@ -458,6 +462,7 @@
|
||||
$('#precio_total_manipulado_' + line[0].tarifa_id).val(parseFloat(line[0].total).toFixed(2))
|
||||
$('#manipulado_margen_' + line[0].tarifa_id).val(parseFloat(line[0].margen).toFixed(2))
|
||||
});
|
||||
check_serv_manipulado_error()
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
}).then(function(){
|
||||
if(update_preimpresion){
|
||||
@ -478,7 +483,7 @@
|
||||
$('#precio_preimpresion_' + line[0].tarifa_id).val(parseFloat(line[0].total).toFixed(2))
|
||||
$('#preimpresion_margen_' + line[0].tarifa_id).val(parseFloat(line[0].margen).toFixed(2))
|
||||
});
|
||||
|
||||
check_serv_preimpresion_error()
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
})
|
||||
}
|
||||
@ -604,6 +609,54 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
function servicioRetractilado(){
|
||||
if($('#retractilado').prop('checked')){
|
||||
$('#add_servicio_acabado_list').val(<?php echo $serviciosCheckboxes['retractilado'] ?>)
|
||||
$('#insertar_serv_acabado').click()
|
||||
}
|
||||
else{
|
||||
var row_indexes = tableServiciosAcabado.rows().eq( 0 ).filter( function (rowIdx) {
|
||||
return tableServiciosAcabado.cell( rowIdx, 0 ).data() == <?php echo $serviciosCheckboxes['retractilado'] ?> ? true : false;
|
||||
} );
|
||||
if(row_indexes.length > 0){
|
||||
tableServiciosAcabado.row(row_indexes[0]).remove().draw()
|
||||
check_serv_acabado_error()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function servicioRetractilado5(){
|
||||
if($('#retractilado5').prop('checked')){
|
||||
$('#add_servicio_acabado_list').val(<?php echo $serviciosCheckboxes['retractilado5'] ?>)
|
||||
$('#insertar_serv_acabado').click()
|
||||
}
|
||||
else{
|
||||
var row_indexes = tableServiciosAcabado.rows().eq( 0 ).filter( function (rowIdx) {
|
||||
return tableServiciosAcabado.cell( rowIdx, 0 ).data() == <?php echo $serviciosCheckboxes['retractilado5'] ?> ? true : false;
|
||||
} );
|
||||
if(row_indexes.length > 0){
|
||||
tableServiciosAcabado.row(row_indexes[0]).remove().draw()
|
||||
check_serv_acabado_error()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function servicioFajaColor(){
|
||||
if($('#fajaColor').prop('checked')){
|
||||
$('#add_servicio_acabado_list').val(<?php echo $serviciosCheckboxes['fajaColor'] ?>)
|
||||
$('#insertar_serv_acabado').click()
|
||||
}
|
||||
else{
|
||||
var row_indexes = tableServiciosAcabado.rows().eq( 0 ).filter( function (rowIdx) {
|
||||
return tableServiciosAcabado.cell( rowIdx, 0 ).data() == <?php echo $serviciosCheckboxes['fajaColor'] ?> ? true : false;
|
||||
} );
|
||||
if(row_indexes.length > 0){
|
||||
tableServiciosAcabado.row(row_indexes[0]).remove().draw()
|
||||
check_serv_acabado_error()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$('#insertar_serv_acabado').on('click', function(){
|
||||
const tarifa_text = $('#add_servicio_acabado_list').select2('data')[0].text.trim()
|
||||
|
||||
@ -788,8 +841,9 @@
|
||||
|
||||
var htmlString = '';
|
||||
|
||||
if($('#tableOfServiciosEncuadernacion tr > td:contains(' + '<?= lang("Presupuestos.no_disponible") ?>' + ')').length > 0){
|
||||
htmlString = `
|
||||
$('#tableOfServiciosEncuadernacion tr').each(function(){
|
||||
if($(this).find('td').eq(3).text() == '0.00'){
|
||||
htmlString = `
|
||||
<div class="alert alert-danger d-flex align-items-baseline" role="alert">
|
||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||
<i class="ti ti-ban ti-sm"></i>
|
||||
@ -798,7 +852,8 @@
|
||||
<h5 class="alert-heading mb-2"><?= lang("Presupuestos.errores.error_servicios_anadidos") ?></h5>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
}
|
||||
})
|
||||
$('#serv-enc-error').html(htmlString)
|
||||
}
|
||||
|
||||
@ -1231,6 +1286,41 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function servicioPrototipo(){
|
||||
if($('#prototipo').prop('checked')){
|
||||
$('#add_servicio_preimpresion_list').val(<?php echo $serviciosCheckboxes['prototipo'] ?>)
|
||||
$('#insertar_serv_preimpresion').click()
|
||||
}
|
||||
else{
|
||||
var row_indexes = tableServiciosPreimpresion.rows().eq( 0 ).filter( function (rowIdx) {
|
||||
return tableServiciosPreimpresion.cell( rowIdx, 0 ).data() == <?php echo $serviciosCheckboxes['prototipo'] ?> ? true : false;
|
||||
} );
|
||||
if(row_indexes.length > 0){
|
||||
tableServiciosPreimpresion.row(row_indexes[0]).remove().draw()
|
||||
check_serv_preimpresion_error()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function servicioFerro(){
|
||||
var row_indexes = tableServiciosPreimpresion.rows().eq( 0 ).filter( function (rowIdx) {
|
||||
return tableServiciosPreimpresion.cell( rowIdx, 0 ).data() == <?php echo $serviciosCheckboxes['ferro'] ?> ? true : false;
|
||||
} );
|
||||
if($('#ferro').prop('checked')){
|
||||
if(row_indexes.length == 0){
|
||||
$('#add_servicio_preimpresion_list').val(<?php echo $serviciosCheckboxes['ferro'] ?>)
|
||||
$('#insertar_serv_preimpresion').click()
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(row_indexes.length > 0){
|
||||
tableServiciosPreimpresion.row(row_indexes[0]).remove().draw()
|
||||
check_serv_preimpresion_error()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$('#insertar_serv_preimpresion').on('click', function(){
|
||||
const tarifa_text = $('#add_servicio_preimpresion_list').select2('data')[0].text.trim()
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
<input type="hidden" name="lp_bn_formas_h" id="lp_bn_formas_h" class="form-control" value="0"></input>
|
||||
<input type="hidden" name="lp_bn_formas_orientacion" id="lp_bn_formas_orientacion" class="form-control" value="0"></input>
|
||||
<td class="lp-td"> <img style="padding: 0; margin:0;" src="<?= site_url('themes/vuexy/img/safekat/presupuestos/icon_bn.png') ?>" /></td>
|
||||
<td class="lp-td"><input id="lp_bn_paginas" name="lp_bn_paginas" class="lp-cell lp-input lp-bn-input" type="text" value="0"></td>
|
||||
<td class="lp-td"><input id="lp_bn_paginas" name="lp_bn_paginas" class="lp-cell lp-input lp-bn-input paginas-lp" type="text" value="0"></td>
|
||||
<td class="lp-td">
|
||||
<select id="lp_bn_papel" name="lp_bn_papel" class="form-control form-select-sm lp-cell lp-select" style="min-width: 150px;">
|
||||
<?php if (isset($papelGenericoNegroList) && is_array($papelGenericoNegroList) && !empty($papelGenericoNegroList)) :
|
||||
@ -104,7 +104,7 @@
|
||||
<input type="hidden" name="lp_bnhq_formas_h" id="lp_bnhq_formas_h" class="form-control" value="0"></input>
|
||||
<input type="hidden" name="lp_bnhq_formas_orientacion" id="lp_bnhq_formas_orientacion" class="form-control" value="0"></input>
|
||||
<td class="lp-td"> <img style="padding: 0; margin:0;" src="<?= site_url('themes/vuexy/img/safekat/presupuestos/icon_bnhq.png') ?>" /></td>
|
||||
<td class="lp-td"><input id="lp_bnhq_paginas" name="lp_bnhq_paginas" class="lp-cell lp-input lp-bnhq-input" type="text" value="0"></td>
|
||||
<td class="lp-td"><input id="lp_bnhq_paginas" name="lp_bnhq_paginas" class="lp-cell lp-input lp-bnhq-input paginas-lp" type="text" value="0"></td>
|
||||
<td class="lp-td">
|
||||
<select id="lp_bnhq_papel" name="lp_bnhq_papel" class="form-control form-select-sm lp-cell lp-select" style="min-width: 150px;">
|
||||
<?php if (isset($papelGenericoNegroHQList) && is_array($papelGenericoNegroHQList) && !empty($papelGenericoNegroHQList)) :
|
||||
@ -157,7 +157,7 @@
|
||||
<input type="hidden" name="lp_color_formas_h" id="lp_color_formas_h" class="form-control" value="0"></input>
|
||||
<input type="hidden" name="lp_color_formas_orientacion" id="lp_color_formas_orientacion" class="form-control" value="0"></input>
|
||||
<td class="lp-td"> <img style="padding: 0; margin:0;" src="<?= site_url('themes/vuexy/img/safekat/presupuestos/icon_color.png') ?>" /></td>
|
||||
<td class="lp-td"><input id="lp_color_paginas" name="lp_color_paginas" class="lp-cell lp-input lp-color-input" type="text" value="0"></td>
|
||||
<td class="lp-td"><input id="lp_color_paginas" name="lp_color_paginas" class="lp-cell lp-input lp-color-input paginas-lp" type="text" value="0"></td>
|
||||
<td class="lp-td">
|
||||
<select id="lp_color_papel" name="lp_color_papel" class="form-control form-select-sm lp-cell lp-select" style="min-width: 150px;">
|
||||
<?php if (isset($papelGenericoColorList) && is_array($papelGenericoColorList) && !empty($papelGenericoColorList)) :
|
||||
@ -211,7 +211,7 @@
|
||||
<input type="hidden" name="lp_colorhq_formas_h" id="lp_colorhq_formas_h" class="form-control" value="0"></input>
|
||||
<input type="hidden" name="lp_colorhq_formas_orientacion" id="lp_colorhq_formas_orientacion" class="form-control" value="0"></input>
|
||||
<td class="lp-td"> <img style="padding: 0; margin:0;" src="<?= site_url('themes/vuexy/img/safekat/presupuestos/icon_colorhq.png') ?>" /></td>
|
||||
<td class="lp-td"><input id="lp_colorhq_paginas" name="lp_colorhq_paginas" class="lp-cell lp-input lp-colorhq-input" type="text" value="0"></td>
|
||||
<td class="lp-td"><input id="lp_colorhq_paginas" name="lp_colorhq_paginas" class="lp-cell lp-input lp-colorhq-input paginas-lp" type="text" value="0"></td>
|
||||
<td class="lp-td">
|
||||
<select id="lp_colorhq_papel" name="lp_colorhq_papel" class="form-control form-select-sm lp-cell lp-select" style="min-width: 150px;">
|
||||
<?php if (isset($papelGenericoColorHQList) && is_array($papelGenericoColorHQList) && !empty($papelGenericoColorHQList)) :
|
||||
@ -264,7 +264,7 @@
|
||||
<input type="hidden" name="lp_rot_bn_formas_h" id="lp_rot_bn_formas_h" class="form-control" value="0"></input>
|
||||
<input type="hidden" name="lp_rot_bn_formas_orientacion" id="lp_rot_bn_formas_orientacion" class="form-control" value="0"></input>
|
||||
<td class="lp-td"> <img style="padding: 0; margin:0;" src="<?= site_url('themes/vuexy/img/safekat/presupuestos/icon_rotativa_bn.png') ?>" /></td>
|
||||
<td class="lp-td"><input id="lp_rot_bn_paginas" name="lp_rot_bn_paginas" class="lp-cell lp-input lp-rotbn-input" type="text" value="0"></td>
|
||||
<td class="lp-td"><input id="lp_rot_bn_paginas" name="lp_rot_bn_paginas" class="lp-cell lp-input lp-rotbn-input paginas-lp" type="text" value="0"></td>
|
||||
<td class="lp-td">
|
||||
<select id="lp_rot_bn_papel" name="lp_rot_bn_papel" class="form-control form-select-sm lp-cell lp-select" style="min-width: 150px;">
|
||||
<?php if (isset($papelGenericoRotativaNegroList) && is_array($papelGenericoRotativaNegroList) && !empty($papelGenericoRotativaNegroList)) :
|
||||
@ -524,11 +524,11 @@
|
||||
<input type="hidden" name="lp_rot_color_formas_h" id="lp_rot_color_formas_h" class="form-control" value="0"></input>
|
||||
<input type="hidden" name="lp_rot_color_formas_orientacion" id="lp_rot_color_formas_orientacion" class="form-control" value="0"></input>
|
||||
<td class="lp-td"> <img style="padding: 0; margin:0;" src="<?= site_url('themes/vuexy/img/safekat/presupuestos/icon_rotativa_color.png') ?>" /></td>
|
||||
<td class="lp-td"><input id="lp_rot_color_paginas" name="lp_rot_color_paginas" class="lp-cell lp-input lp-rotcolor-input" type="text" value="0"></td>
|
||||
<td class="lp-td"><input id="lp_rot_color_paginas" name="lp_rot_color_paginas" class="lp-cell lp-input lp-rotcolor-input paginas-lp" type="text" value="0"></td>
|
||||
<td class="lp-td">
|
||||
<select id="lp_rot_color_papel" name="lp_rot_color_papel" class="form-control form-select-sm lp-cell lp-select" style="min-width: 150px;">
|
||||
<?php if (isset($papelGenericoColorHQList) && is_array($papelGenericoColorHQList) && !empty($papelGenericoColorHQList)) :
|
||||
foreach ($papelGenericoColorHQList as $k => $v) : ?>
|
||||
<?php if (isset($papelGenericoRotativaColorList) && is_array($papelGenericoRotativaColorList) && !empty($papelGenericoRotativaColorList)) :
|
||||
foreach ($papelGenericoRotativaColorList as $k => $v) : ?>
|
||||
<?php if($v->id != 0): ?>
|
||||
<option value="<?= $v->id ?>">
|
||||
<?= $v->nombre ?>
|
||||
@ -933,6 +933,9 @@ $('#lp_cubierta_papel').val('');
|
||||
$('#lp_sobrecubierta_papel').val('');
|
||||
$('#addLineasPresupuesto').val('');
|
||||
|
||||
$('.paginas-lp').on('change', function(){
|
||||
checkPaginasPresupuesto()
|
||||
})
|
||||
|
||||
$('#lp_rot_color_vercalculos').on("click", function () {
|
||||
if($( ".calculos_rot_color" ).css('display') == 'none')
|
||||
@ -1077,6 +1080,7 @@ $('.insertarLinea').on("click", function (e) {
|
||||
fill_lp_cubierta(row, true);
|
||||
}
|
||||
}
|
||||
checkPaginasPresupuesto()
|
||||
});
|
||||
|
||||
|
||||
@ -1295,7 +1299,7 @@ function calcularPresupuesto_bn(){
|
||||
|
||||
const dimension = getDimensionLibro();
|
||||
|
||||
let datos = {
|
||||
var datos = {
|
||||
type: 'interior',
|
||||
color: 0,
|
||||
hq: 0,
|
||||
@ -1317,8 +1321,10 @@ function calcularPresupuesto_bn(){
|
||||
success: function (data) {
|
||||
|
||||
if(data.lineas.length >0){
|
||||
// Se cogen los valores de la linea con los datos correspondientes
|
||||
|
||||
$.each(data.lineas, function(key, value) {
|
||||
|
||||
// Se cogen los valores de la linea con los datos correspondientes
|
||||
if(value.fields.maquina_id === $('#lp_bn_maquina option:selected').val() &&
|
||||
value.fields.papel_generico_id === datos.papel_generico_id &&
|
||||
value.fields.papel_impresion_id === $('#lp_bn_papelImpresion option:selected').val() ) {
|
||||
@ -1329,7 +1335,7 @@ function calcularPresupuesto_bn(){
|
||||
else{
|
||||
clear_lp_bn(false);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
@ -1389,6 +1395,7 @@ function fill_lp_bn(row, fromComparator=false){
|
||||
$('#lp_bn_formas_v').val(isNaN(parseInt(row.num_formas.num_formas_verticales)) ? "" : parseInt(row.num_formas.num_formas_verticales))
|
||||
$('#lp_bn_formas_orientacion').val(row.num_formas.posicion_formas)
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales()
|
||||
}
|
||||
|
||||
@ -1626,6 +1633,7 @@ function fill_lp_color(row, fromComparator=false){
|
||||
$('#lp_color_formas_v').val(isNaN(parseInt(row.num_formas.num_formas_verticales)) ? "" : parseInt(row.num_formas.num_formas_verticales))
|
||||
$('#lp_color_formas_orientacion').val(row.num_formas.posicion_formas)
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales()
|
||||
}
|
||||
|
||||
@ -1862,6 +1870,7 @@ function fill_lp_bnhq(row, fromComparator=false){
|
||||
$('#lp_bnhq_formas_v').val(isNaN(parseInt(row.num_formas.num_formas_verticales)) ? "" : parseInt(row.num_formas.num_formas_verticales))
|
||||
$('#lp_bnhq_formas_orientacion').val(row.num_formas.posicion_formas)
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales()
|
||||
}
|
||||
|
||||
@ -2100,6 +2109,7 @@ function fill_lp_colorhq(row, fromComparator=false){
|
||||
$('#lp_colorhq_formas_v').val(isNaN(parseInt(row.num_formas.num_formas_verticales)) ? "" : parseInt(row.num_formas.num_formas_verticales))
|
||||
$('#lp_colorhq_formas_orientacion').val(row.num_formas.posicion_formas)
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales()
|
||||
}
|
||||
|
||||
@ -2444,6 +2454,7 @@ function fill_lp_rot_bn(row, fromComparador=false){
|
||||
$('#lp_rot_bn_formas_v').val(isNaN(parseInt(row.num_formas.num_formas_verticales)) ? "" : parseInt(row.num_formas.num_formas_verticales))
|
||||
$('#lp_rot_bn_formas_orientacion').val(row.num_formas.posicion_formas)
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales()
|
||||
}
|
||||
|
||||
@ -2709,7 +2720,7 @@ $('#lp_rot_color_defecto').on("click", function () {
|
||||
function fill_lp_rot_color(row, fromComparador=false){
|
||||
|
||||
if(fromComparador){
|
||||
|
||||
console.log(row)
|
||||
$('#lp_rot_color_paginas').val(row.paginas)
|
||||
$('#lp_rot_color_papel').val(row.papelGenericoId)
|
||||
$('#lp_rot_color_gramaje').empty()
|
||||
@ -2798,6 +2809,7 @@ function fill_lp_rot_color(row, fromComparador=false){
|
||||
$('#lp_rot_color_formas_v').val(isNaN(parseInt(row.num_formas.num_formas_verticales)) ? "" : parseInt(row.num_formas.num_formas_verticales))
|
||||
$('#lp_rot_color_formas_orientacion').val(row.num_formas.posicion_formas)
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales()
|
||||
}
|
||||
|
||||
@ -3078,6 +3090,7 @@ function fill_lp_cubierta(row, fromComparador=false){
|
||||
$('#lp_cubierta_formas_v').val(isNaN(parseInt(row.num_formas.num_formas_verticales)) ? "" : parseInt(row.num_formas.num_formas_verticales))
|
||||
$('#lp_cubierta_formas_orientacion').val(row.num_formas.posicion_formas)
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales()
|
||||
}
|
||||
|
||||
@ -3327,6 +3340,61 @@ async function fill_bbdd_from_lp(presupuesto_id){
|
||||
});
|
||||
}
|
||||
|
||||
function updateLineasPresupuesto(){
|
||||
|
||||
$('#tableLineasPresupuesto tbody tr:visible ').each(function(){
|
||||
if(!this.id.includes('_data')){
|
||||
if(this.id.endsWith('_bn')){
|
||||
checkComparadorInt(false, false, true);
|
||||
}
|
||||
else if(this.id.endsWith('_bnhq')){
|
||||
checkComparadorInt(false, true, true);
|
||||
}
|
||||
else if(this.id.endsWith('_color')){
|
||||
checkComparadorInt(true, false, true);
|
||||
}
|
||||
else if(this.id.endsWith('_colorhq')){
|
||||
checkComparadorInt(true, true, true);
|
||||
}
|
||||
else if(this.id.endsWith('_rot_bn')){
|
||||
checkComparadorInt(false, false, true)
|
||||
}
|
||||
else if(this.id.endsWith('_rot_color')){
|
||||
checkComparadorInt(false,true, true);
|
||||
}
|
||||
else if(this.id.endsWith('_cubierta')){
|
||||
checkComparadorCubierta(true)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function checkPaginasPresupuesto(){
|
||||
|
||||
cantidad_total = 0
|
||||
|
||||
$('#tableLineasPresupuesto tbody tr:visible ').each(function(){
|
||||
if(!this.id.includes('_data') && !this.id.endsWith('_cubierta') && !this.id.endsWith('_sobrecubierta')){
|
||||
cantidad_total += parseInt($('#' + this.id + '_paginas').val() )
|
||||
}
|
||||
} );
|
||||
htmlString = ''
|
||||
|
||||
if(cantidad_total != parseInt($('#paginas').val())){
|
||||
htmlString = `
|
||||
<div class="alert alert-warning d-flex align-items-baseline" role="alert">
|
||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||
<i class="ti ti-bell ti-sm"></i>
|
||||
</span>
|
||||
<div class="d-flex flex-column ps-1">
|
||||
<h5 class="alert-heading mb-2"><?= lang("Presupuestos.errores.paginasLP") ?></h5>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
$('#divAlarmasLineasPresupuesto').html(htmlString)
|
||||
}
|
||||
|
||||
checkPaginasPresupuesto()
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
@ -11,7 +11,7 @@
|
||||
<label for="add_clientedAdd" class="form-label">
|
||||
<?=lang('PresupuestosDirecciones.clientedAdd') ?>*
|
||||
</label>
|
||||
<select id="add_clientedAdd" tabindex="0" class="form-control select2bs" style="width: 100%;" >
|
||||
<select id="add_clientedAdd" class="form-control select2bs" style="width: 100%;" >
|
||||
|
||||
</select>
|
||||
</div><!--//.mb-3 -->
|
||||
@ -20,25 +20,25 @@
|
||||
<label for="add_cantidad" class="form-label">
|
||||
<?= lang('PresupuestosDirecciones.cantidad') ?>*
|
||||
</label>
|
||||
<input type="number" id="add_cantidad" tabindex="1" class="form-control">
|
||||
<input type="number" id="add_cantidad" class="form-control">
|
||||
</div><!--//.mb-3 -->
|
||||
<div class="mb-3">
|
||||
<label for="add_att" class="form-label">
|
||||
<?= lang('PresupuestosDirecciones.att') ?>*
|
||||
</label>
|
||||
<input type="text" id="add_att" tabindex="1" maxLength="100" class="form-control new-address">
|
||||
<input type="text" id="add_att" maxLength="100" class="form-control new-address">
|
||||
</div><!--//.mb-3 -->
|
||||
<div class="mb-3">
|
||||
<label for="add_email" class="form-label">
|
||||
<?= lang('PresupuestosDirecciones.email') ?>*
|
||||
</label>
|
||||
<input type="text" id="add_email" tabindex="2" maxLength="100" class="form-control new-address">
|
||||
<input type="text" id="add_email" maxLength="100" class="form-control new-address">
|
||||
</div><!--//.mb-3 -->
|
||||
<div class="mb-3">
|
||||
<label for="add_direccion" class="form-label">
|
||||
<?= lang('PresupuestosDirecciones.direccion') ?>*
|
||||
</label>
|
||||
<input type="text" id="add_direccion" tabindex="3" maxLength="255" class="form-control new-address">
|
||||
<input type="text" id="add_direccion" maxLength="255" class="form-control new-address">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
<label for="add_pais_id" class="form-label">
|
||||
<?=lang('PresupuestosDirecciones.pais') ?>*
|
||||
</label>
|
||||
<select id="add_pais_id" tabindex="4" class="form-control select2bs new-address" style="width: 100%;" >
|
||||
<select id="add_pais_id" class="form-control select2bs new-address" style="width: 100%;" >
|
||||
<option value="" disabled selected><?=lang('PresupuestosDirecciones.selectPais') ?></option>
|
||||
<?php foreach ($paisList as $item) : ?>
|
||||
<option value="<?=$item->id ?>"<?=$item->id==1 ? ' selected':'' ?>>
|
||||
@ -65,7 +65,7 @@
|
||||
<label for="add_municipio" class="form-label">
|
||||
<?=lang('PresupuestosDirecciones.municipio') ?>*
|
||||
</label>
|
||||
<input type="text" id="add_municipio" tabindex="6" maxLength="100" class="form-control new-address">
|
||||
<input type="text" id="add_municipio" maxLength="100" class="form-control new-address">
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
@ -74,7 +74,7 @@
|
||||
<label for="add_provincia" class="form-label">
|
||||
<?=lang('PresupuestosDirecciones.provincia') ?>*
|
||||
</label>
|
||||
<input type="text" id="add_provincia" tabindex="7" maxLength="100" class="form-control new-address">
|
||||
<input type="text" id="add_provincia" maxLength="100" class="form-control new-address">
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
@ -87,7 +87,7 @@
|
||||
<label for="add_cp" class="form-label">
|
||||
<?=lang('PresupuestosDirecciones.cp') ?>*
|
||||
</label>
|
||||
<input type="text" id="add_cp" tabindex="8" maxLength="100" class="form-control new-address">
|
||||
<input type="text" id="add_cp" maxLength="100" class="form-control new-address">
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
@ -96,7 +96,7 @@
|
||||
<label for="add_telefono" class="form-label">
|
||||
<?=lang('PresupuestosDirecciones.telefono') ?>*
|
||||
</label>
|
||||
<input type="text" id="add_telefono" tabindex="9" maxLength="100" class="form-control new-address"></input>
|
||||
<input type="text" id="add_telefono" maxLength="100" class="form-control new-address"></input>
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
@ -104,14 +104,14 @@
|
||||
|
||||
<div class="col-md-12 col-lg-6 pl-4">
|
||||
<div class="form-check form-switch mb-2">
|
||||
<input class="form-check-input" type="checkbox" id="add_entregaPieCalle" name="add_entregaPieCalle" tabindex="10" value="1" >
|
||||
<input class="form-check-input" type="checkbox" id="add_entregaPieCalle" name="add_entregaPieCalle" value="1" >
|
||||
<label class="form-check-label" for="add_entregaPieCalle"><?= lang('PresupuestosDirecciones.entregaPieCalle') ?></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 col-lg-6 pl-4">
|
||||
<div class="form-check form-switch mb-2">
|
||||
<input class="form-check-input" type="checkbox" id="add_saveDirection" name="add_saveDirection" tabindex="10" value="1" >
|
||||
<input class="form-check-input" type="checkbox" id="add_saveDirection" name="add_saveDirection" value="1" >
|
||||
<label class="form-check-label" for="add_saveDirection"><?= lang('PresupuestosDirecciones.saveDirection') ?></label>
|
||||
</div>
|
||||
</div>
|
||||
@ -120,7 +120,7 @@
|
||||
<label style="display:none" for="add_alias" class="form-label save-alias">
|
||||
<?= lang('PresupuestosDirecciones.alias') ?>*
|
||||
</label>
|
||||
<input type="text" id="add_alias" tabindex="1" maxLength="100" class="form-control new-address save-alias" style='display: none;'>
|
||||
<input type="text" id="add_alias" maxLength="100" class="form-control new-address save-alias" style='display: none;'>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
</div>
|
||||
|
||||
@ -72,33 +72,12 @@ $('#compPaginasColorhq').on("change", function () {
|
||||
});
|
||||
|
||||
|
||||
$('#compRetractilado').on("change", function () {
|
||||
checkRetractiladoComparador(this);
|
||||
|
||||
$('#prototipo').on("change", function () {
|
||||
$('#ferro').prop('checked', true)
|
||||
});
|
||||
|
||||
|
||||
$('#compRetractilado5').on("change", function () {
|
||||
checkRetractiladoComparador(this);
|
||||
});
|
||||
|
||||
|
||||
$('#imagenesBnInterior').on("change", function () {
|
||||
var e = document.getElementById('tipoImpresion');
|
||||
var optionToHide = e.querySelector("option[value='negro']");
|
||||
|
||||
if (document.getElementById('imagenesBnInterior').checked) {
|
||||
optionToHide.setAttribute('disabled', 'disabled')
|
||||
|
||||
if (e.value == 'negro') {
|
||||
e.value = 'negrohq';
|
||||
}
|
||||
}
|
||||
else {
|
||||
optionToHide.removeAttribute('disabled');
|
||||
}
|
||||
$('#tipoImpresion').select2();
|
||||
});
|
||||
|
||||
|
||||
$('#compPosPaginasColor').on("keyup", function () {
|
||||
computarPaginasColor(this.value);
|
||||
@ -108,21 +87,21 @@ $('#compPosPaginasColor').on("keyup", function () {
|
||||
// Este evento recoloca los headers de las tablas cuando se pulsa el
|
||||
// boton del acordeon
|
||||
$('.accordion-button').on('click', function (e) {
|
||||
|
||||
if(e.target.id.includes("plana")){
|
||||
|
||||
if (e.target.id.includes("plana")) {
|
||||
$("#tableCompIntPlana").DataTable().columns.adjust();
|
||||
}
|
||||
else if(e.target.id.includes("rotativa")){
|
||||
else if (e.target.id.includes("rotativa")) {
|
||||
$("#tableCompIntRotativa").DataTable().columns.adjust();
|
||||
}
|
||||
else if(e.target.id.includes("cubierta")){
|
||||
else if (e.target.id.includes("cubierta")) {
|
||||
$("#tableCompCubierta").DataTable().columns.adjust();
|
||||
}
|
||||
else if(e.target.id.includes("LineasPresupuesto")){
|
||||
else if (e.target.id.includes("LineasPresupuesto")) {
|
||||
$("#tableLineasPresupuesto").DataTable().columns.adjust();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
@ -168,7 +147,7 @@ function getRowFromLineaRot(linea) {
|
||||
'papel': linea.fields.papel_generico,
|
||||
'gramaje': linea.fields.gramaje,
|
||||
'marca': linea.fields.papel_impresion,
|
||||
'aFavorFibra':linea.fields.a_favor_fibra==1?'si':'no',
|
||||
'aFavorFibra': linea.fields.a_favor_fibra == 1 ? 'si' : 'no',
|
||||
'maquina': linea.fields.maquina,
|
||||
'numeroPliegos': isNaN(parseFloat(linea.fields.pliegos_libro)) ? "" : parseFloat(linea.fields.pliegos_libro).toFixed(2),
|
||||
'pliegosPedido': isNaN(parseFloat(linea.fields.pliegos_pedido)) ? "" : parseFloat(linea.fields.pliegos_pedido).toFixed(2),
|
||||
@ -181,8 +160,8 @@ function getRowFromLineaRot(linea) {
|
||||
'totalClicks': isNaN(parseFloat(linea.fields.precio_click_pedido)) ? "" : parseFloat(linea.fields.precio_click_pedido).toFixed(2),
|
||||
'precioPagNegro': isNaN(parseFloat(linea.fields.precio_pagina_negro)) ? "" : parseFloat(linea.fields.precio_pagina_negro).toFixed(6),
|
||||
'precioPagColor': isNaN(parseFloat(linea.fields.precio_pagina_color)) ? "" : parseFloat(linea.fields.precio_pagina_color).toFixed(6),
|
||||
'totalTinta':isNaN(parseFloat(linea.fields.precio_tinta)) ? "" : parseFloat(linea.fields.precio_tinta).toFixed(2),
|
||||
'totalCorte':isNaN(parseFloat(linea.fields.total_corte)) ? "" : parseFloat(linea.fields.total_corte).toFixed(2),
|
||||
'totalTinta': isNaN(parseFloat(linea.fields.precio_tinta)) ? "" : parseFloat(linea.fields.precio_tinta).toFixed(2),
|
||||
'totalCorte': isNaN(parseFloat(linea.fields.total_corte)) ? "" : parseFloat(linea.fields.total_corte).toFixed(2),
|
||||
'total': isNaN(parseFloat(linea.fields.total_impresion)) ? "" : (parseFloat(linea.fields.total_impresion)).toFixed(2),
|
||||
'maquinaId': linea.fields.maquina_id,
|
||||
'maquinaVelocidad': linea.fields.maquina_velocidad,
|
||||
@ -230,14 +209,14 @@ function computarPaginasColor(string) {
|
||||
function checkRetractiladoComparador(element) {
|
||||
|
||||
switch (element.id) {
|
||||
case 'compRetractilado':
|
||||
if (document.getElementById(element.id).checked) {
|
||||
document.getElementById('compRetractilado5').checked = false;
|
||||
case 'retractilado':
|
||||
if ($('#' + element.id).prop('checked')) {
|
||||
$('#retractilado5').prop('checked', false);
|
||||
}
|
||||
break;
|
||||
case 'compRetractilado5':
|
||||
if (document.getElementById(element.id).checked) {
|
||||
document.getElementById('compRetractilado').checked = false;
|
||||
case 'retractilado5':
|
||||
if ($('#' + element.id).prop('checked')) {
|
||||
$('#retractilado').prop('checked', false);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -322,13 +301,13 @@ function updatePapelesComparador() {
|
||||
|
||||
|
||||
|
||||
function clearIntLineas(is_color){
|
||||
function clearIntLineas(is_color) {
|
||||
//$("#tableCompIntPlana").DataTable().rows( '.selected' ).deselect();
|
||||
var tabla = $('#tableCompIntPlana').DataTable();
|
||||
tabla
|
||||
.rows( function ( idx, data, node ) {
|
||||
return data['tipo'].includes(is_color?'color':'bn');
|
||||
} )
|
||||
.rows(function (idx, data, node) {
|
||||
return data['tipo'].includes(is_color ? 'color' : 'bn');
|
||||
})
|
||||
.remove()
|
||||
.draw();
|
||||
//$('#tableCompIntPlana').DataTable().clear().draw();
|
||||
@ -336,132 +315,132 @@ function clearIntLineas(is_color){
|
||||
}
|
||||
|
||||
|
||||
function clearCubierta(){
|
||||
|
||||
function clearCubierta() {
|
||||
|
||||
$('#tableCompCubierta').DataTable().clear().draw();
|
||||
$('#insertarCubiertaBtn').css('display', 'none');
|
||||
}
|
||||
|
||||
|
||||
function clearIntRot(){
|
||||
|
||||
function clearIntRot() {
|
||||
|
||||
$('#errorComRot').html('');
|
||||
$('#tableCompIntRotativa').DataTable().clear().draw();
|
||||
$('#insertarRotativaBtn').css('display', 'none');
|
||||
}
|
||||
|
||||
|
||||
function selectIntLineas(){
|
||||
|
||||
function selectIntLineas() {
|
||||
var negro_selected = false;
|
||||
var color_selected = false;
|
||||
$("#tableCompIntPlana").DataTable().rows( '.selected' ).deselect();
|
||||
$("#tableCompIntPlana").DataTable().rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
||||
if( !negro_selected && $('#tableCompIntPlana').DataTable().cell(rowIdx, 0).data().includes('bn') ){
|
||||
$("#tableCompIntPlana").DataTable().row( rowIdx ).nodes().to$().toggleClass( 'selected' );
|
||||
$("#tableCompIntPlana").DataTable().rows('.selected').deselect();
|
||||
$("#tableCompIntPlana").DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||
if (!negro_selected && $('#tableCompIntPlana').DataTable().cell(rowIdx, 0).data().includes('bn')) {
|
||||
$("#tableCompIntPlana").DataTable().row(rowIdx).nodes().to$().toggleClass('selected');
|
||||
negro_selected = true;
|
||||
}
|
||||
if( !color_selected && $('#tableCompIntPlana').DataTable().cell(rowIdx, 0).data().includes('color') ){
|
||||
$("#tableCompIntPlana").DataTable().row( rowIdx ).nodes().to$().toggleClass( 'selected' );
|
||||
if (!color_selected && $('#tableCompIntPlana').DataTable().cell(rowIdx, 0).data().includes('color')) {
|
||||
$("#tableCompIntPlana").DataTable().row(rowIdx).nodes().to$().toggleClass('selected');
|
||||
color_selected = true;
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#tableCompIntPlana").DataTable();
|
||||
var rows = table.rows( '.selected' ).indexes();
|
||||
var data = table.rows( rows ).data();
|
||||
var rows = table.rows('.selected').indexes();
|
||||
var data = table.rows(rows).data();
|
||||
|
||||
var value_total = 0.00;
|
||||
|
||||
for (let i = 0; i < data.length ; i++) {
|
||||
|
||||
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
|
||||
value_total += parseFloat(data[i]['total'])
|
||||
}
|
||||
|
||||
|
||||
$('#total_comp_plana').html(value_total.toFixed(2));
|
||||
}
|
||||
|
||||
function selectIntRotLineas(){
|
||||
function selectIntRotLineas() {
|
||||
|
||||
$("#tableCompIntRotativa").DataTable().rows('.selected').deselect();
|
||||
|
||||
$("#tableCompIntRotativa").DataTable().rows( '.selected' ).deselect();
|
||||
|
||||
let value_total = 0.00;
|
||||
|
||||
if($("#tableCompIntRotativa").DataTable().rows().count()>0) {
|
||||
|
||||
$("#tableCompIntRotativa").DataTable().row( 0 ).nodes().to$().toggleClass( 'selected' );
|
||||
value_total = parseFloat($("#tableCompIntRotativa").DataTable().rows( 0 ).data()[0]['total'])
|
||||
if ($("#tableCompIntRotativa").DataTable().rows().count() > 0) {
|
||||
|
||||
$("#tableCompIntRotativa").DataTable().row(0).nodes().to$().toggleClass('selected');
|
||||
value_total = parseFloat($("#tableCompIntRotativa").DataTable().rows(0).data()[0]['total'])
|
||||
};
|
||||
|
||||
|
||||
|
||||
$('#total_comp_rot').html(value_total.toFixed(2));
|
||||
}
|
||||
|
||||
function selectCubiertaLineas(){
|
||||
|
||||
$("#tableCompCubierta").DataTable().rows( '.selected' ).deselect();
|
||||
|
||||
function selectCubiertaLineas() {
|
||||
|
||||
$("#tableCompCubierta").DataTable().rows('.selected').deselect();
|
||||
|
||||
let value_total = 0.00;
|
||||
|
||||
if($("#tableCompCubierta").DataTable().rows().count()>0) {
|
||||
|
||||
$("#tableCompCubierta").DataTable().row( 0 ).nodes().to$().toggleClass( 'selected' );
|
||||
value_total = parseFloat($("#tableCompCubierta").DataTable().rows( 0 ).data()[0]['total'])
|
||||
if ($("#tableCompCubierta").DataTable().rows().count() > 0) {
|
||||
|
||||
$("#tableCompCubierta").DataTable().row(0).nodes().to$().toggleClass('selected');
|
||||
value_total = parseFloat($("#tableCompCubierta").DataTable().rows(0).data()[0]['total'])
|
||||
};
|
||||
|
||||
|
||||
|
||||
$('#total_comp_cubierta').html(value_total.toFixed(2));
|
||||
}
|
||||
|
||||
function getIDsComparador(is_color, is_hq){
|
||||
|
||||
if(!is_color){
|
||||
if(is_hq){
|
||||
function getIDsComparador(is_color, is_hq) {
|
||||
|
||||
if (!is_color) {
|
||||
if (is_hq) {
|
||||
var papel = '#compPapelNegrohq';
|
||||
var gramaje = '#compGramajeNegrohq';
|
||||
var paginas = '#compPaginasNegrohq';
|
||||
}
|
||||
else{
|
||||
else {
|
||||
var papel = '#compPapelNegro';
|
||||
var gramaje = '#compGramajeNegro';
|
||||
var paginas = '#compPaginasNegro';
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(is_hq){
|
||||
else {
|
||||
if (is_hq) {
|
||||
var papel = '#compPapelColorhq';
|
||||
var gramaje = '#compGramajeColorhq';
|
||||
var paginas = '#compPaginasColorhq';
|
||||
}
|
||||
else{
|
||||
else {
|
||||
var papel = '#compPapelColor';
|
||||
var gramaje = '#compGramajeColor';
|
||||
var paginas = '#compPaginasColor';
|
||||
}
|
||||
}
|
||||
return{
|
||||
return {
|
||||
papel: papel,
|
||||
gramaje: gramaje,
|
||||
paginas: paginas,
|
||||
}
|
||||
}
|
||||
|
||||
function getDimensionLibro(){
|
||||
function getDimensionLibro() {
|
||||
var ancho = 0;
|
||||
var alto = 0;
|
||||
|
||||
|
||||
if($('#papelFormatoId').select2('data').length > 0){
|
||||
if($('#papelFormatoId').select2('data')[0].id.length > 0){
|
||||
|
||||
if ($('#papelFormatoId').select2('data').length > 0) {
|
||||
if ($('#papelFormatoId').select2('data')[0].id.length > 0) {
|
||||
ancho = parseFloat($('#papelFormatoId').select2('data')[0].text.trim().split(" x ")[0]);
|
||||
alto = parseFloat($('#papelFormatoId').select2('data')[0].text.trim().split(" x ")[1]);
|
||||
}
|
||||
else if(document.getElementById('papelFormatoPersonalizado').checked){
|
||||
else if (document.getElementById('papelFormatoPersonalizado').checked) {
|
||||
ancho = parseFloat(document.getElementById('papelFormatoAncho').value);
|
||||
alto = parseFloat(document.getElementById('papelFormatoAlto').value);
|
||||
}
|
||||
}
|
||||
|
||||
else if(document.getElementById('papelFormatoPersonalizado').checked){
|
||||
|
||||
else if (document.getElementById('papelFormatoPersonalizado').checked) {
|
||||
ancho = parseFloat(document.getElementById('papelFormatoAncho').value);
|
||||
alto = parseFloat(document.getElementById('papelFormatoAlto').value);
|
||||
}
|
||||
@ -471,75 +450,75 @@ function getDimensionLibro(){
|
||||
}
|
||||
}
|
||||
|
||||
function checkInputsForRotativa(){
|
||||
function checkInputsForRotativa() {
|
||||
|
||||
// Si es color, el gramaje y el papel tiene que ser el mismo
|
||||
try{
|
||||
|
||||
try {
|
||||
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'color') {
|
||||
if($('#compPapelNegro').select2('data')[0].id == $('#compPapelColor').select2('data')[0].id &&
|
||||
$('#compGramajeNegro').select2('data')[0].text.trim() == $('#compGramajeColor').select2('data')[0].text.trim() ){
|
||||
if ($('#compPapelNegro').select2('data')[0].id == $('#compPapelColor').select2('data')[0].id &&
|
||||
$('#compGramajeNegro').select2('data')[0].text.trim() == $('#compGramajeColor').select2('data')[0].text.trim()) {
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if ($('#tipoImpresion').select2('data')[0].id == 'negro') {
|
||||
if($('#compPapelNegro').select2('data')[0].id.length>0 &&
|
||||
$('#compGramajeNegro').select2('data')[0].text.length>0){
|
||||
return true;
|
||||
}
|
||||
if ($('#compPapelNegro').select2('data')[0].id.length > 0 &&
|
||||
$('#compGramajeNegro').select2('data')[0].text.length > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch(error){
|
||||
catch (error) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function fillIntPlana(data, is_color, is_hq){
|
||||
function fillIntPlana(data, is_color, is_hq) {
|
||||
let sorted = data.lineas.sort(
|
||||
(p1, p2) => ((p1.fields.precio_pedido+p1.fields.precio_click_pedido) < (p2.fields.precio_pedido+p2.fields.precio_click_pedido)) ?
|
||||
-1 : ((p1.fields.precio_pedido+p1.fields.precio_click_pedido) > (p2.fields.precio_pedido+p2.fields.precio_click_pedido)) ? 1 : 0);
|
||||
sorted.forEach(function(linea) {
|
||||
if(typeof linea.error == "undefined")
|
||||
$('#tableCompIntPlana').DataTable().row
|
||||
.add(getRowFromLineaInt(is_color?(is_hq?'colorhq':'color'):(is_hq?'bnhq':'bn'), linea))
|
||||
(p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ?
|
||||
-1 : ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) > (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ? 1 : 0);
|
||||
sorted.forEach(function (linea) {
|
||||
if (typeof linea.error == "undefined")
|
||||
$('#tableCompIntPlana').DataTable().row
|
||||
.add(getRowFromLineaInt(is_color ? (is_hq ? 'colorhq' : 'color') : (is_hq ? 'bnhq' : 'bn'), linea))
|
||||
.draw()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function fillIntRot(data){
|
||||
function fillIntRot(data) {
|
||||
let sorted = data.lineas.sort(
|
||||
(p1, p2) => ((p1.fields.precio_pedido+p1.fields.precio_click_pedido) < (p2.fields.precio_pedido+p2.fields.precio_click_pedido)) ?
|
||||
-1 : ((p1.fields.precio_pedido+p1.fields.precio_click_pedido) > (p2.fields.precio_pedido+p2.fields.precio_click_pedido)) ? 1 : 0);
|
||||
sorted.forEach(function(linea) {
|
||||
if(typeof linea.error == "undefined"){
|
||||
(p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ?
|
||||
-1 : ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) > (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ? 1 : 0);
|
||||
sorted.forEach(function (linea) {
|
||||
if (typeof linea.error == "undefined") {
|
||||
$('#tableCompIntRotativa').DataTable().row
|
||||
.add(getRowFromLineaRot(linea))
|
||||
.draw()
|
||||
}
|
||||
})
|
||||
.add(getRowFromLineaRot(linea))
|
||||
.draw()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function fillCubierta(data, is_color, is_hq){
|
||||
|
||||
function fillCubierta(data, is_color, is_hq) {
|
||||
|
||||
let sorted = data.lineas.sort(
|
||||
(p1, p2) => ((p1.fields.precio_pedido+p1.fields.precio_click_pedido) < (p2.fields.precio_pedido+p2.fields.precio_click_pedido)) ?
|
||||
-1 : ((p1.fields.precio_pedido+p1.fields.precio_click_pedido) > (p2.fields.precio_pedido+p2.fields.precio_click_pedido)) ? 1 : 0);
|
||||
sorted.forEach(function(linea) {
|
||||
if(typeof linea.error == "undefined")
|
||||
$('#tableCompCubierta').DataTable().row
|
||||
(p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ?
|
||||
-1 : ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) > (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ? 1 : 0);
|
||||
sorted.forEach(function (linea) {
|
||||
if (typeof linea.error == "undefined")
|
||||
$('#tableCompCubierta').DataTable().row
|
||||
.add(getRowFromLineaInt('cubierta', linea))
|
||||
.draw()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function clearCompTable(){
|
||||
function clearCompTable() {
|
||||
|
||||
$('#insertarPlanaBtn').addClass('d-none')
|
||||
$('#insertarRotativaBtn').addClass('d-none')
|
||||
@ -547,95 +526,91 @@ function clearCompTable(){
|
||||
$('#total_comp_rot').html('0.00')
|
||||
}
|
||||
|
||||
function generateCompJSON(){
|
||||
|
||||
function generateCompJSON() {
|
||||
|
||||
data = {}
|
||||
|
||||
if( $('#tipoImpresion').select2('data')[0].id == 'negro' || $('#tipoImpresion').select2('data')[0].id == 'color')
|
||||
{
|
||||
try{
|
||||
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'negro' || $('#tipoImpresion').select2('data')[0].id == 'color') {
|
||||
try {
|
||||
bn_obj = {
|
||||
"bn":{
|
||||
"bn": {
|
||||
'paginas': $('#compPaginasNegro').val(),
|
||||
'papel_id': $('#compPapelNegro').select2('data')[0].id,
|
||||
'gramaje': $('#compGramajeNegro').select2('data')[0].text.trim(),
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e){
|
||||
catch (e) {
|
||||
bn_obj = {}
|
||||
}
|
||||
$.extend( data, bn_obj );
|
||||
$.extend(data, bn_obj);
|
||||
}
|
||||
|
||||
if( $('#tipoImpresion').select2('data')[0].id == 'negrohq' || $('#tipoImpresion').select2('data')[0].id == 'colorhq')
|
||||
{
|
||||
try{
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'negrohq' || $('#tipoImpresion').select2('data')[0].id == 'colorhq') {
|
||||
try {
|
||||
bnhq_obj = {
|
||||
"bnhq":{
|
||||
"bnhq": {
|
||||
'paginas': $('#compPaginasNegrohq').val(),
|
||||
'papel_id': $('#compPapelNegrohq').select2('data')[0].id,
|
||||
'gramaje': $('#compGramajeNegrohq').select2('data')[0].text.trim(),
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e){
|
||||
catch (e) {
|
||||
bnhq_obj = {}
|
||||
}
|
||||
$.extend( data, bnhq_obj );
|
||||
$.extend(data, bnhq_obj);
|
||||
}
|
||||
|
||||
if($('#tipoImpresion').select2('data')[0].id == 'color')
|
||||
{
|
||||
try{
|
||||
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'color') {
|
||||
try {
|
||||
color_obj = {
|
||||
"color":{
|
||||
"color": {
|
||||
'paginas': $('#compPaginasColor').val(),
|
||||
'papel_id': $('#compPapelColor').select2('data')[0].id,
|
||||
'gramaje': $('#compGramajeColor').select2('data')[0].text.trim(),
|
||||
},
|
||||
}
|
||||
}
|
||||
catch (e){
|
||||
catch (e) {
|
||||
color_obj = {}
|
||||
}
|
||||
$.extend( data, color_obj );
|
||||
|
||||
$.extend(data, color_obj);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if($('#tipoImpresion').select2('data')[0].id == 'colorhq')
|
||||
{
|
||||
try{
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'colorhq') {
|
||||
try {
|
||||
colorhq_obj = {
|
||||
"colorhq":{
|
||||
"colorhq": {
|
||||
'paginas': $('#compPaginasColorhq').val(),
|
||||
'papel_id': $('#compPapelColorhq').select2('data')[0].id,
|
||||
'gramaje': $('#compGramajeColorhq').select2('data')[0].text.trim(),
|
||||
},
|
||||
}
|
||||
}
|
||||
catch (e){
|
||||
catch (e) {
|
||||
colorhq_obj = {}
|
||||
}
|
||||
$.extend( data, colorhq_obj );
|
||||
$.extend(data, colorhq_obj);
|
||||
}
|
||||
|
||||
|
||||
try{
|
||||
try {
|
||||
cubierta_obj = {
|
||||
"cubierta":{
|
||||
"cubierta": {
|
||||
'paginas': $('#compCarasCubierta').select2('data')[0].id,
|
||||
'papel_id': $('#compPapelCubierta').select2('data')[0].id,
|
||||
'gramaje': $('#compGramajeCubierta').select2('data')[0].text.trim(),
|
||||
},
|
||||
}
|
||||
}
|
||||
catch (e){
|
||||
catch (e) {
|
||||
cubierta_obj = {}
|
||||
}
|
||||
|
||||
$.extend( data, cubierta_obj );
|
||||
$.extend(data, cubierta_obj);
|
||||
|
||||
data_str = JSON.stringify(data)
|
||||
$('#comparador_json_data').val(data_str)
|
||||
|
||||
Reference in New Issue
Block a user