Merge branch 'bug/presupuestos3' into 'dev/presupuestos3'

solucionados bugs (pe, cuando es cubierta o sobrecubierta no se necesita color=1)

See merge request jjimenez/safekat!72
This commit is contained in:
2023-11-12 16:29:02 +00:00
9 changed files with 98 additions and 74 deletions

View File

@ -527,14 +527,14 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
if( $uso == 'cubierta' ){
$opciones_papel = array(
'cubierta' => 1,
'color' => 1,
//'color' => 1,
'rotativa' => 0,
);
}
else if ( $uso == 'sobrecubierta' ){
$opciones_papel = array(
'sobrecubierta' => 1,
'color' => 1,
//'color' => 1,
'rotativa' => 0,
);
}

View File

@ -146,6 +146,7 @@ return [
'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.',
'errorRotColor' => 'Papers and weights must be the same in color and BW',
],
/* '4x0' => '4x0',

View File

@ -174,7 +174,8 @@ return [
'paginas' => 'El campo páginas tiene que ser mayor que cero',
'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'
'lineaDuplicada' => 'Ya existe ese tipo de linea en el presupuesto',
'errorRotColor' => 'Papeles y gramajes deben ser iguales en color y BN',
],

View File

@ -226,10 +226,6 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
$uso_tarifa = 'interior';
if($tipo == 'negro' || $tipo == 'negrohq')
$builder->where("t2.bn", 1);
else if ($tipo == 'color' || $tipo == 'colorhq')
$builder->where("t2.color", 1);
if ($uso == 'cubierta'){
$uso_tarifa = 'cubierta';
$builder->where("t2.cubierta", 1);
@ -238,6 +234,13 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
$uso_tarifa = 'sobrecubierta';
$builder->where("t2.sobrecubierta", 1);
}
else{
if($tipo == 'negro' || $tipo == 'negrohq')
$builder->where("t2.bn", 1);
else if ($tipo == 'color' || $tipo == 'colorhq')
$builder->where("t2.color", 1);
}
if($uso=='rotativa')
$builder->where("t2.rotativa", 1);
else

View File

@ -283,20 +283,21 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
$builder->where("t2.id", $papel_generico);
$builder->where("t1.gramaje", $gramaje);
if($tipo == 'negro' || $tipo == 'negrohq')
$builder->where("t1.bn", 1);
else if ($tipo == 'color' || $tipo == 'colorhq')
$builder->where("t1.color", 1);
if ($uso == 'cubierta')
$builder->where("t1.cubierta", 1);
else if ($uso == 'sobrecubierta')
$builder->where("t1.sobrecubierta", 1);
else{
if($tipo == 'negro' || $tipo == 'negrohq')
$builder->where("t1.bn", 1);
else if ($tipo == 'color' || $tipo == 'colorhq')
$builder->where("t1.color", 1);
}
if($uso=='rotativa')
$builder->where("t1.rotativa", 1);
else
$builder->where("t1.rotativa", 0);
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
}
}

View File

@ -345,7 +345,8 @@
</tbody>
<tfoot>
<tr>
<td class="dt-result dt-result-text" colspan="19"><?= lang('Presupuestos.total') ?> <?= lang("Presupuestos.compInteriorRotativa") ?>:</td>
<td id="errorComRot" class="dt-result dt-result-text" colspan="15"></td>
<td class="dt-result dt-result-text" colspan="4"><?= lang('Presupuestos.total') ?> <?= lang("Presupuestos.compInteriorRotativa") ?>:</td>
<td id="total_comp_rot" class="dt-result dt-result-value" colspan="2">0.00</td>
</tr>
</tfoot>

View File

@ -997,52 +997,66 @@ $('.insertarLinea').on("click", function (e) {
$('#addLineasPresupuesto').on("change", function (e) {
switch($('#addLineasPresupuesto').val()){
// Se chequean todas las lineas de negro y todas las de color
// (solo una de cada en interior)
case 'lp_bn':
if($('#lp_bn').css('display') == 'none'){
$('.lp_bn').css('display', 'flex')
if($('#lp_bn').css('display') != 'none' ||
$('#lp_bnhq').css('display') != 'none' ||
$('#lp_rot_bn').css('display') != 'none'){
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
}
else{
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
$('.lp_bn').css('display', 'flex')
}
break
case 'lp_bnhq':
if($('#lp_bnhq').css('display') == 'none'){
$('.lp_bnhq').css('display', 'flex')
if($('#lp_bn').css('display') != 'none' ||
$('#lp_bnhq').css('display') != 'none' ||
$('#lp_rot_bn').css('display') != 'none'){
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
}
else{
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
$('.lp_bnhq').css('display', 'flex')
}
break
case 'lp_color':
if($('#lp_color').css('display') == 'none'){
$('.lp_color').css('display', 'flex')
if($('#lp_color').css('display') != 'none' ||
$('#lp_colorhq').css('display') != 'none' ||
$('#lp_rot_color').css('display') != 'none'){
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
}
else{
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
$('.lp_color').css('display', 'flex')
}
break
case 'lp_colorhq':
if($('#lp_colorhq').css('display') == 'none'){
$('.lp_colorhq').css('display', 'flex')
if($('#lp_color').css('display') != 'none' ||
$('#lp_colorhq').css('display') != 'none' ||
$('#lp_rot_color').css('display') != 'none'){
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
}
else{
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
$('.lp_colorhq').css('display', 'flex')
}
break
case 'lp_rot_bn':
if($('#lp_rot_bn').css('display') == 'none'){
$('.lp_rot_bn').css('display', 'flex')
if($('#lp_bn').css('display') != 'none' ||
$('#lp_bnhq').css('display') != 'none' ||
$('#lp_rot_bn').css('display') != 'none'){
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
}
else{
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
$('.lp_rot_bn').css('display', 'flex')
}
break
case 'lp_rot_color':
if($('#lp_rot_color').css('display') == 'none'){
$('.lp_rot_color').css('display', 'flex')
if($('#lp_color').css('display') != 'none' ||
$('#lp_colorhq').css('display') != 'none' ||
$('#lp_rot_color').css('display') != 'none'){
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
}
else{
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
$('.lp_rot_color').css('display', 'flex')
}
break
case 'lp_cubierta':

View File

@ -357,7 +357,7 @@ function clearNegro() {
function clearIntLineas(is_color){
$("#tableCompIntPlana").DataTable().rows( '.selected' ).deselect();
//$("#tableCompIntPlana").DataTable().rows( '.selected' ).deselect();
var tabla = $('#tableCompIntPlana').DataTable();
tabla
.rows( function ( idx, data, node ) {
@ -365,6 +365,7 @@ function clearIntLineas(is_color){
} )
.remove()
.draw();
//$('#tableCompIntPlana').DataTable().clear().draw();
$('#insertarPlanaBtn').css('display', 'none');
}
@ -372,12 +373,15 @@ function clearIntLineas(is_color){
function clearCubierta(){
$('#tableCompCubierta').DataTable().clear().draw();
$('#insertarCubiertaBtn').css('display', 'none');
}
function clearIntRot(){
$('#errorComRot').html('');
$('#tableCompIntRotativa').DataTable().clear().draw();
$('#insertarRotativaBtn').css('display', 'none');
}
@ -568,3 +572,14 @@ function fillCubierta(data, is_color, is_hq){
.draw()
})
}
function clearCompTable(clearNegro=true,clearColor=false,clearCubierta=false){
if(clearNegro){
}
$('#insertarPlanaBtn').addClass('d-none')
$('#insertarRotativaBtn').addClass('d-none')
$('#total_comp_plana').html('0.00')
$('#total_comp_rot').html('0.00')
}

View File

@ -564,33 +564,6 @@
});
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 &&
checkDatosPedidoForComp()) {
getLineasIntPlana(is_color, is_hq).then((result) =>{
// Para rotativa, si es color el papel y el gramaje tiene que ser igual
if(!is_color || ($('#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);
}
});
}
else{
clearIntLineas(is_color);
clearIntRot();
$('#title_int_rot').html('<?= lang("Presupuestos.compInteriorRotativa") ?>');
$('#title_int_plana').html('<?= lang("Presupuestos.compInteriorPlana") ?>');
}
}
$('.comp_negro_items').on('change', function (e) {
checkComparadorInt(false,false);
@ -818,23 +791,38 @@
function checkComparadorInt(is_color, is_hq) {
elementos = getIDsComparador(is_color, is_hq)
clearIntLineas(is_color);
clearIntRot();
$('#title_int_rot').html('<?= lang("Presupuestos.compInteriorRotativa") ?>');
$('#title_int_plana').html('<?= lang("Presupuestos.compInteriorPlana") ?>');
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);
// Para rotativa, si es color el papel y el gramaje tiene que ser igual
if(!is_color)
{
getLineasIntRot(is_hq);
}
else
{
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);
}
else
{
$('#errorComRot').html('<?= lang("Presupuestos.errores.errorRotColor") ?>');
}
}
});
}
else{
clearIntLineas(is_color);
clearIntRot();
$('#title_int_rot').html('<?= lang("Presupuestos.compInteriorRotativa") ?>');
$('#title_int_plana').html('<?= lang("Presupuestos.compInteriorPlana") ?>');
}
}
@ -854,7 +842,7 @@
$('#compGramajeNegro').empty().trigger("change");
$('#compGramajeNegro').prop('disabled', false);
$('#compGramajeNegro').select2({
allowClear: true,
allowClear: false,
minimumResultsForSearch: Infinity,
ajax: {
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
@ -896,7 +884,7 @@
$('#compGramajeNegrohq').empty().trigger("change");
$('#compGramajeNegrohq').prop('disabled', false);
$('#compGramajeNegrohq').select2({
allowClear: true,
allowClear: false,
minimumResultsForSearch: Infinity,
ajax: {
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
@ -940,7 +928,7 @@
$('#compGramajeColor').prop('disabled', false);
$('#compPapelColor').find('option[value="0"]').remove();
$('#compGramajeColor').select2({
allowClear: true,
allowClear: false,
minimumResultsForSearch: Infinity,
ajax: {
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
@ -984,7 +972,7 @@
$('#compGramajeColorhq').prop('disabled', false);
$('#compPapelColorhq').find('option[value="0"]').remove();
$('#compGramajeColorhq').select2({
allowClear: true,
allowClear: false,
minimumResultsForSearch: Infinity,
ajax: {
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
@ -1024,7 +1012,7 @@
$('#compGramajeCubierta').prop('disabled', false);
$('#compPapelCubierta').find('option[value="0"]').remove();
$('#compGramajeCubierta').select2({
allowClear: true,
allowClear: false,
minimumResultsForSearch: Infinity,
ajax: {
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',