mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'main' into feat/ordenes-trabajo
This commit is contained in:
@ -276,7 +276,7 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
|||||||
$onlyActiveOnes = false;
|
$onlyActiveOnes = false;
|
||||||
$columns2select = [$reqId ?? 'id', $reqText ?? 'nombre'];
|
$columns2select = [$reqId ?? 'id', $reqText ?? 'nombre'];
|
||||||
$onlyActiveOnes = false;
|
$onlyActiveOnes = false;
|
||||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
|
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr, true);
|
||||||
$nonItem = new \stdClass;
|
$nonItem = new \stdClass;
|
||||||
$nonItem->id = '';
|
$nonItem->id = '';
|
||||||
$nonItem->text = '- ' . lang('Basic.global.None') . ' -';
|
$nonItem->text = '- ' . lang('Basic.global.None') . ' -';
|
||||||
|
|||||||
@ -417,7 +417,7 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
|||||||
if (!empty($selId)) :
|
if (!empty($selId)) :
|
||||||
$papelGenericoModel = model('App\Models\Configuracion\PapelGenericoModel');
|
$papelGenericoModel = model('App\Models\Configuracion\PapelGenericoModel');
|
||||||
|
|
||||||
$selOption = $papelGenericoModel->where('id', $selId)->findColumn('nombre');
|
$selOption = $papelGenericoModel->where('is_deleted', 0)->where('id', $selId)->findColumn('nombre');
|
||||||
if (!empty($selOption)) :
|
if (!empty($selOption)) :
|
||||||
$data[$selId] = $selOption[0];
|
$data[$selId] = $selOption[0];
|
||||||
endif;
|
endif;
|
||||||
|
|||||||
@ -997,9 +997,12 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
foreach ($resultado_presupuesto['info']['serviciosDefecto'] as $servicio) {
|
foreach ($resultado_presupuesto['info']['serviciosDefecto']['encuadernacion'] as $servicio) {
|
||||||
$this->guardarServicio($id, $servicio, 'encuadernacion');
|
$this->guardarServicio($id, $servicio, 'encuadernacion');
|
||||||
}
|
}
|
||||||
|
foreach ($resultado_presupuesto['info']['serviciosDefecto']['manipulado'] as $servicio) {
|
||||||
|
$this->guardarServicio($id, $servicio, 'manipulado');
|
||||||
|
}
|
||||||
foreach ($resultado_presupuesto['info']['servicios_automaticos'] as $servicio) {
|
foreach ($resultado_presupuesto['info']['servicios_automaticos'] as $servicio) {
|
||||||
if ($servicio->tarifa_id == 3 || $servicio->tarifa_id == 5 || $servicio->tarifa_id == 16) {
|
if ($servicio->tarifa_id == 3 || $servicio->tarifa_id == 5 || $servicio->tarifa_id == 16) {
|
||||||
// Servicios acabado
|
// Servicios acabado
|
||||||
@ -1124,7 +1127,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
[$data['datosGenerales']['paginasNegro'], $data['datosGenerales']['paginasColor']] =
|
[$data['datosGenerales']['paginasNegro'], $data['datosGenerales']['paginasColor']] =
|
||||||
$this->getPaginas($lineas);
|
$this->getPaginas($lineas);
|
||||||
|
|
||||||
if (intval($presupuesto->envios_recoge_cliente) == 1) {
|
if (intval($presupuesto->recoger_en_taller) == 1) {
|
||||||
$data['direcciones']['entrega_taller'] = 1;
|
$data['direcciones']['entrega_taller'] = 1;
|
||||||
} else {
|
} else {
|
||||||
$data['direcciones']['entrega_taller'] = 0;
|
$data['direcciones']['entrega_taller'] = 0;
|
||||||
@ -1894,7 +1897,8 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Servicios defecto
|
// Servicios defecto
|
||||||
$servDefecto = PresupuestoCLienteService::getServiciosEncuadernacionDefault([
|
$costeServiciosDefecto = 0.0;
|
||||||
|
$servDefectoEnc = PresupuestoCLienteService::getServiciosEncuadernacionDefault([
|
||||||
'tipo_impresion_id' => $tipo_impresion_id,
|
'tipo_impresion_id' => $tipo_impresion_id,
|
||||||
'tirada' => $datosPedido->tirada,
|
'tirada' => $datosPedido->tirada,
|
||||||
'paginas' => intval($paginas) ?? 0,
|
'paginas' => intval($paginas) ?? 0,
|
||||||
@ -1905,13 +1909,46 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
'paginasCuadernillo' => $paginasCuadernillo,
|
'paginasCuadernillo' => $paginasCuadernillo,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($servDefectoEnc as $servicio) {
|
||||||
$costeServiciosDefecto = 0.0;
|
|
||||||
foreach ($servDefecto as $servicio) {
|
|
||||||
if ($servicio->total <= 0) {
|
if ($servicio->total <= 0) {
|
||||||
|
|
||||||
$input_data['servicios'] = $servDefecto;
|
$input_data['servicios'] = $servDefectoEnc;
|
||||||
|
$errorModel = new ErrorPresupuesto();
|
||||||
|
$errorModel->insertError(
|
||||||
|
$datos_entrada['id'],
|
||||||
|
auth()->user()->id,
|
||||||
|
'No se puede obtener servicios',
|
||||||
|
$input_data
|
||||||
|
);
|
||||||
|
$return_data = [
|
||||||
|
'errors' => (object) ([
|
||||||
|
'status' => 1
|
||||||
|
]),
|
||||||
|
];
|
||||||
|
return $return_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$costeServiciosDefecto += floatval($servicio->total);
|
||||||
|
if ($extra_info) {
|
||||||
|
$totalServicios += floatval($servicio->total);
|
||||||
|
$margenServicios += floatval($servicio->total) * floatval($servicio->margen) / 100.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$servDefectoMan = PresupuestoCLienteService::getServiciosManipuladoDefault([
|
||||||
|
'tipo_impresion_id' => $tipo_impresion_id,
|
||||||
|
'tirada' => $datosPedido->tirada,
|
||||||
|
'POD' => $POD,
|
||||||
|
'solapas' => intval($solapasCubierta) > 0 ? 1 : 0,
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($servDefectoMan as $servicio) {
|
||||||
|
if ($servicio->total <= 0) {
|
||||||
|
|
||||||
|
$input_data['servicios'] = $servDefectoMan;
|
||||||
$errorModel = new ErrorPresupuesto();
|
$errorModel = new ErrorPresupuesto();
|
||||||
$errorModel->insertError(
|
$errorModel->insertError(
|
||||||
$datos_entrada['id'],
|
$datos_entrada['id'],
|
||||||
@ -2116,7 +2153,8 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
$return_data['info']['cubierta'] = $cubierta;
|
$return_data['info']['cubierta'] = $cubierta;
|
||||||
$return_data['info']['sobrecubierta'] = $linea_sobrecubierta;
|
$return_data['info']['sobrecubierta'] = $linea_sobrecubierta;
|
||||||
$return_data['info']['guardas'] = $guardas;
|
$return_data['info']['guardas'] = $guardas;
|
||||||
$return_data['info']['serviciosDefecto'] = $servDefecto;
|
$return_data['info']['serviciosDefecto']['encuadernacion'] = $servDefectoEnc;
|
||||||
|
$return_data['info']['serviciosDefecto']['manipulado'] = $servDefectoMan;
|
||||||
$return_data['info']['servicios_automaticos'] = $serviciosAutomaticos;
|
$return_data['info']['servicios_automaticos'] = $serviciosAutomaticos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -361,7 +361,7 @@ return [
|
|||||||
'sin_gramaje' => "Seleccione gramaje",
|
'sin_gramaje' => "Seleccione gramaje",
|
||||||
'tipo_cubierta' => 'Seleccione tipo de cubierta',
|
'tipo_cubierta' => 'Seleccione tipo de cubierta',
|
||||||
'opcion_solapas' => 'Seleccione la opción para las solapas',
|
'opcion_solapas' => 'Seleccione la opción para las solapas',
|
||||||
'paginas_cosido' => 'El número de páginas para <b>cosido</b> debe ser múltiplo de 4',
|
'paginas_multiplo_4' => 'El número de páginas para <b>cosido</b> o <b>grapado</b> debe ser múltiplo de 4',
|
||||||
'paginas_pares' => 'El número de páginas debe ser par',
|
'paginas_pares' => 'El número de páginas debe ser par',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ class MaquinaModel extends \App\Models\BaseModel
|
|||||||
|
|
||||||
const SORTABLE = [
|
const SORTABLE = [
|
||||||
0 => "t1.id",
|
0 => "t1.id",
|
||||||
1 => "t2.nombre",
|
1 => "t1.nombre",
|
||||||
2 => "t1.tipo",
|
2 => "t1.tipo",
|
||||||
3 => "t1.ancho_impresion",
|
3 => "t1.ancho_impresion",
|
||||||
4 => "t1.alto_impresion",
|
4 => "t1.alto_impresion",
|
||||||
|
|||||||
@ -419,12 +419,14 @@ class PresupuestoClienteService extends BaseService
|
|||||||
public static function getServiciosManipuladoDefault($data)
|
public static function getServiciosManipuladoDefault($data)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$tipo_impresion_id = $data['tipo_impresion_id'] ?? -1;
|
||||||
$tirada = $data['tirada'] ?? -1;
|
$tirada = $data['tirada'] ?? -1;
|
||||||
$anchoDesarrollo = $data['anchoDesarrollo'] ?? -1;
|
$POD = $data['POD'] ?? -1;
|
||||||
|
$solapas = $data['solapas'] ?? -1;
|
||||||
|
|
||||||
/*$model = model('App\Models\Presupuestos\PresupuestoEncuadernacionesModel');
|
$model = model('App\Models\Presupuestos\PresupuestoManipuladosModel');
|
||||||
$values = $model->initPresupuesto($tipo_impresion_id, $solapas, $tirada, $paginas, $ancho, $alto, $POD, $paginasCuadernillo);*/
|
$values = $model->initPresupuesto($tipo_impresion_id, $solapas, $tirada, $POD);
|
||||||
//return $values;
|
return $values;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getServiciosManipulado($data)
|
public static function getServiciosManipulado($data)
|
||||||
|
|||||||
@ -330,17 +330,18 @@ class DatosGenerales {
|
|||||||
|
|
||||||
divTipoLibro.find('.fv-plugins-message-container').remove();
|
divTipoLibro.find('.fv-plugins-message-container').remove();
|
||||||
if ($('.tipo-libro.selected').length > 0) {
|
if ($('.tipo-libro.selected').length > 0) {
|
||||||
if ($('#cosido').hasClass('selected')) {
|
if ($('#cosido').hasClass('selected') || $('#grapado').hasClass('selected')) {
|
||||||
const value = parseInt($("#paginas").val());
|
const value = parseInt($("#paginas").val());
|
||||||
if (value % 4 != 0) {
|
if (value % 4 != 0) {
|
||||||
divTipoLibro.append(`
|
divTipoLibro.append(`
|
||||||
<div class="fv-plugins-message-container invalid-feedback">
|
<div class="fv-plugins-message-container invalid-feedback">
|
||||||
<div data-field="div_tipo_libro" data-validator="callback" style="margin-top: 50px;">
|
<div data-field="div_tipo_libro" data-validator="callback" style="margin-top: 50px;">
|
||||||
${window.translations["validation"].paginas_cosido}
|
${window.translations["validation"].paginas_multiplo_4}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -583,6 +584,10 @@ class DatosGenerales {
|
|||||||
this.tiposLibro.removeClass('selected');
|
this.tiposLibro.removeClass('selected');
|
||||||
this.tiposLibro.find('.image-presupuesto').removeClass('selected');
|
this.tiposLibro.find('.image-presupuesto').removeClass('selected');
|
||||||
this.domItem.find('#' + datos.tipo).addClass('selected');
|
this.domItem.find('#' + datos.tipo).addClass('selected');
|
||||||
|
|
||||||
|
if(datos.tipo == 'cosido'){
|
||||||
|
this.divPaginasCuaderillo.removeClass('d-none');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.prototipo.prop('checked', datos.prototipo);
|
this.prototipo.prop('checked', datos.prototipo);
|
||||||
@ -726,6 +731,8 @@ class DatosGenerales {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.checkPaginasMultiplo4();
|
||||||
|
|
||||||
// Para recalcular el presupuesto
|
// Para recalcular el presupuesto
|
||||||
$('#divGramajeInterior').empty();
|
$('#divGramajeInterior').empty();
|
||||||
$('#divGramajeInteriorColor').empty();
|
$('#divGramajeInteriorColor').empty();
|
||||||
@ -789,6 +796,29 @@ class DatosGenerales {
|
|||||||
this.divPaginasColorConsecutivas.removeClass('d-none');
|
this.divPaginasColorConsecutivas.removeClass('d-none');
|
||||||
this.divPosPaginasColor.removeClass('d-none');
|
this.divPosPaginasColor.removeClass('d-none');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.checkPaginasMultiplo4();
|
||||||
|
}
|
||||||
|
|
||||||
|
checkPaginasMultiplo4(){
|
||||||
|
|
||||||
|
const divTipoLibro = $('#divTipoLibro'); // Selecciona el div
|
||||||
|
divTipoLibro.find('.fv-plugins-message-container').remove();
|
||||||
|
|
||||||
|
if ($('#cosido').hasClass('selected') || $('#grapado').hasClass('selected')) {
|
||||||
|
const value = parseInt($("#paginas").val());
|
||||||
|
if (value % 4 != 0) {
|
||||||
|
divTipoLibro.append(`
|
||||||
|
<div class="fv-plugins-message-container invalid-feedback">
|
||||||
|
<div data-field="div_tipo_libro" data-validator="callback" style="margin-top: 50px;">
|
||||||
|
${window.translations["validation"].paginas_multiplo_4}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -88,6 +88,7 @@ class Direcciones {
|
|||||||
|
|
||||||
if (datos.entrega_taller == 1) {
|
if (datos.entrega_taller == 1) {
|
||||||
this.recogidaTaller.prop('checked', true);
|
this.recogidaTaller.prop('checked', true);
|
||||||
|
this.recogidaTaller.trigger('change');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
|||||||
@ -211,11 +211,19 @@ class PresupuestoCliente {
|
|||||||
let datos_to_check = this.#prepareData();
|
let datos_to_check = this.#prepareData();
|
||||||
|
|
||||||
if (Object.values(datos_to_check).every(this.#isValidDataForm)) {
|
if (Object.values(datos_to_check).every(this.#isValidDataForm)) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (!this.datosGenerales.checkPaginasMultiplo4()) {
|
||||||
|
popErrorAlert("Compruebe que todos los campos son correctos.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
$('#loader').modal('show');
|
$('#loader').modal('show');
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Si se está ejecutando la petición, abortar la petición anterior
|
// Si se está ejecutando la petición, abortar la petición anterior
|
||||||
this.ajax_calcular.abort();
|
this.ajax_calcular.abort();
|
||||||
|
|
||||||
@ -453,6 +461,12 @@ class PresupuestoCliente {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($('.invalid-feedback').length > 0) {
|
||||||
|
popErrorAlert("Compruebe que todos los campos son correctos.");
|
||||||
|
$('#loader').modal('hide');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.#getDatos(true);
|
this.#getDatos(true);
|
||||||
|
|
||||||
if (confirmar) {
|
if (confirmar) {
|
||||||
|
|||||||
@ -301,10 +301,8 @@ class Resumen {
|
|||||||
return parseInt($(this).find('.tarjeta-tiradas-precios-tirada').attr('data')) == unidades;
|
return parseInt($(this).find('.tarjeta-tiradas-precios-tirada').attr('data')) == unidades;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
let precio_u_text = tarjetaPrecio.find('.tarjeta-tiradas-precios-precio-unidad').text();
|
let precio_u_text = tarjetaPrecio.find('.tarjeta-tiradas-precios-precio-unidad').text();
|
||||||
precio_u_text = precio_u_text.replace('€/u', '');
|
precio_u_text = precio_u_text.replace('€/ud', '');
|
||||||
precio_u_text = this.#changeDecimalFormat(precio_u_text);
|
|
||||||
|
|
||||||
const base = tarjetaPrecio.find('.tarjeta-tiradas-precios-precio').attr('data');
|
const base = tarjetaPrecio.find('.tarjeta-tiradas-precios-precio').attr('data');
|
||||||
let base_text = this.#changeDecimalFormat(base);
|
let base_text = this.#changeDecimalFormat(base);
|
||||||
|
|||||||
Reference in New Issue
Block a user