mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en direcciones
This commit is contained in:
@ -100,5 +100,10 @@ class Js_loader extends BaseController
|
||||
return view('themes/backend/vuexy/form/presupuestos/cliente/disenioLibro.js');
|
||||
}
|
||||
|
||||
function presupuestoClienteDirecciones_js()
|
||||
{
|
||||
$this->response->setHeader('Content-Type', 'text/javascript');
|
||||
return view('themes/backend/vuexy/form/presupuestos/cliente/direcciones.js');
|
||||
}
|
||||
}
|
||||
|
||||
@ -613,10 +613,328 @@ class Presupuestocliente extends \App\Controllers\GoBaseResourceController
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
|
||||
$resultado_lineas = $this->getLineasPresupuesto($reqData);
|
||||
$error =(object)[
|
||||
'interior' => "",
|
||||
'cubierta' => "",
|
||||
'sobrecubierta' => "",
|
||||
'guardas' => "",
|
||||
'servicios' => "",
|
||||
'serviciosDefecto' => "",
|
||||
];
|
||||
$coste_servicios = 0.0;
|
||||
|
||||
$POD = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD();
|
||||
|
||||
|
||||
$tirada = $reqData['tirada'] ?? 0;
|
||||
$tamanio = $reqData['tamanio'];
|
||||
$tipo_impresion_id = $this->getTipoImpresion($reqData['tipo'], $reqData['tapa']);
|
||||
$precio_u = [];
|
||||
|
||||
for($t=0; $t<count($tirada); $t++){
|
||||
$tirada[$t] = intval($tirada[$t]);
|
||||
|
||||
$paginas_color = intval($reqData['paginasColor']) ?? 0;
|
||||
$is_cosido = (new TipoPresupuestoModel())->get_isCosido($tipo_impresion_id);
|
||||
|
||||
$datosPedido = (object)array(
|
||||
'paginas' => intval($reqData['paginas']) ?? 0,
|
||||
'tirada' => $tirada[$t],
|
||||
'merma' => $tirada[$t] > $POD ? $this->calcular_merma($tirada[$t], $POD) : 0,
|
||||
'ancho' => intval($tamanio['ancho']) ?? 100000,
|
||||
'alto' => intval($tamanio['alto']) ?? 100000,
|
||||
'isCosido' => $is_cosido,
|
||||
);
|
||||
|
||||
$papel_generico = [
|
||||
'id' => $reqData['papelInterior'] ?? 0,
|
||||
'nombre' => $reqData['papelInteriorNombre'] ?? "",
|
||||
];
|
||||
$gramaje = $reqData['gramajeInterior'] ?? 0;
|
||||
$cliente_id = $reqData['clienteId'] ?? -1;
|
||||
$excluirRotativa = $reqData['excluirRotativa'] ?? 0;
|
||||
|
||||
$input_data = array(
|
||||
'uso' => 'interior',
|
||||
'tipo_impresion_id' => $tipo_impresion_id,
|
||||
'datosPedido' => $datosPedido,
|
||||
'papel_generico' => $papel_generico,
|
||||
'gramaje' => $gramaje,
|
||||
'isColor' => intval($reqData['isColor']) ?? 0,
|
||||
'isHq' => intval($reqData['isHq']) ?? 0,
|
||||
'cliente_id' => $cliente_id,
|
||||
'paginas_color' => $paginas_color,
|
||||
'excluirRotativa' => $excluirRotativa,
|
||||
);
|
||||
|
||||
$interior = PresupuestoClienteService::obtenerInterior($input_data);
|
||||
|
||||
$costeInterior = 0.0;
|
||||
foreach ($interior as $linea) {
|
||||
if (count($linea) > 0) {
|
||||
$costeInterior += floatval($linea['total_impresion']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($costeInterior <= 0) {
|
||||
$error->interior = lang('Presupuestos.errores.noInterior');
|
||||
}
|
||||
|
||||
// Si es POD hay que volver a calcular para incluir la merma correcta
|
||||
if ($tirada[$t] <= $POD) {
|
||||
$num_formas = [];
|
||||
foreach ($interior as $linea) {
|
||||
if (count($linea) > 0) {
|
||||
$formas_linea = $is_cosido ? intval($linea['num_formas']['value']) / 2 : intval($linea['num_formas']['value']);
|
||||
array_push($num_formas, $formas_linea);
|
||||
}
|
||||
}
|
||||
$input_data['datosPedido']->merma = $this->calcular_merma($tirada[$t], $POD, $num_formas);
|
||||
|
||||
$interior = PresupuestoClienteService::obtenerInterior($input_data);
|
||||
}
|
||||
|
||||
$costeInterior = 0.0;
|
||||
foreach ($interior as $linea) {
|
||||
if (count($linea) > 0) {
|
||||
$costeInterior += floatval($linea['total_impresion']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($costeInterior <= 0)
|
||||
$error->interior = lang('Presupuestos.errores.noInterior');
|
||||
else
|
||||
$error->interior = "";
|
||||
|
||||
|
||||
// Cubierta
|
||||
$papel_generico = [
|
||||
'id' => $reqData['papelCubierta'] ?? 0,
|
||||
'nombre' => $reqData['papelCubiertaNombre'] ?? "",
|
||||
];
|
||||
$input_data['papel_generico'] = $papel_generico;
|
||||
$input_data['gramaje'] = $reqData['gramajeCubierta'] ?? 0;
|
||||
$input_data['datosPedido']->paginas = intval($reqData['carasCubierta'] ?? 0);
|
||||
$input_data['paginas_color'] = intval($reqData['carasCubierta'] ?? 0);
|
||||
$input_data['datosPedido']->solapas_ancho = intval($reqData['solapasCubierta'] ?? 0);
|
||||
$input_data['datosPedido']->solapas = $input_data['datosPedido']->solapas_ancho>0 ? 1 : 0;
|
||||
$input_data['datosPedido']->lomo = $this->calcular_lomo($interior, 0);
|
||||
$input_data['isColor'] = 1;
|
||||
$input_data['isHq'] = 1;
|
||||
$input_data['uso'] = 'cubierta';
|
||||
|
||||
$cubierta = PresupuestoClienteService::obtenerCubierta($input_data);
|
||||
$coste_cubierta = 0.0;
|
||||
if (count($cubierta) > 0) {
|
||||
$coste_cubierta += floatval($cubierta['total_impresion']);
|
||||
}
|
||||
if($coste_cubierta <= 0)
|
||||
$error->cubierta = lang('Presupuestos.errores.noCubiertaSobrecubierta');
|
||||
else
|
||||
$error->cubierta = "";
|
||||
|
||||
$tarifaAcabadoCubierta = intval($reqData['acabadoCubierta'] ?? 0);
|
||||
$acabadoCubierta = [];
|
||||
if($tarifaAcabadoCubierta > 0){
|
||||
$model = model('App\Models\Presupuestos\PresupuestoAcabadosModel');
|
||||
$acabadoCubierta = $model->getPrecioTarifa($tarifaAcabadoCubierta, $datosPedido->tirada, $POD);
|
||||
}
|
||||
if(count($acabadoCubierta) > 0){
|
||||
if($acabadoCubierta[0]->total <= 0 )
|
||||
$error->servicios = lang('Presupuestos.errores.errorPresupuesto');
|
||||
$coste_servicios += floatval($acabadoCubierta[0]->total);
|
||||
}
|
||||
|
||||
// Sobrecubierta
|
||||
$coste_sobrecubierta = 0.0;
|
||||
$linea_sobrecubierta = [];
|
||||
$acabadoSobrecubierta = [];
|
||||
$sobreCubierta = $reqData["sobrecubierta"] ?? null;
|
||||
if(!is_null($sobreCubierta)){
|
||||
|
||||
$papel_generico = [
|
||||
'id' => $sobreCubierta['papel'] ?? 0,
|
||||
'nombre' => $sobreCubierta['papel_nombre'] ?? "",
|
||||
];
|
||||
$input_data['papel_generico'] = $papel_generico;
|
||||
$input_data['gramaje'] = $sobreCubierta['gramaje'] ?? 0;
|
||||
$input_data['datosPedido']->paginas = 4;
|
||||
$input_data['paginas_color'] = 4;
|
||||
$input_data['datosPedido']->solapas_ancho = intval($sobreCubierta['solapas'] ?? 0);
|
||||
$input_data['datosPedido']->solapas = $input_data['datosPedido']->solapas_ancho>0 ? 1 : 0;
|
||||
$input_data['datosPedido']->lomo = $this->calcular_lomo([$cubierta], $input_data['datosPedido']->lomo);
|
||||
$input_data['isColor'] = 1;
|
||||
$input_data['isHq'] = 1;
|
||||
$input_data['uso'] = 'sobrecubierta';
|
||||
|
||||
$linea_sobrecubierta = PresupuestoClienteService::obtenerSobrecubierta($input_data);
|
||||
|
||||
if (count($linea_sobrecubierta) > 0) {
|
||||
$coste_sobrecubierta += floatval($linea_sobrecubierta['total_impresion']);
|
||||
}
|
||||
if($coste_sobrecubierta <= 0)
|
||||
$error->sobrecubierta = lang('Presupuestos.errores.noCubiertaSobrecubierta');
|
||||
else
|
||||
$error->sobrecubierta = "";
|
||||
|
||||
$tarifaAcabadoSobrecubierta = intval(strlen($sobreCubierta['acabado'])==0 ? 0:$sobreCubierta['acabado']);
|
||||
$acabadoSobrecubierta = [];
|
||||
if($tarifaAcabadoSobrecubierta > 0){
|
||||
$model = model('App\Models\Presupuestos\PresupuestoAcabadosModel');
|
||||
$acabadoSobrecubierta = $model->getPrecioTarifa($tarifaAcabadoSobrecubierta, $datosPedido->tirada, $POD);
|
||||
}
|
||||
if(count($acabadoSobrecubierta) > 0){
|
||||
if($acabadoSobrecubierta[0]->total <= 0 )
|
||||
$error->servicios = lang('Presupuestos.errores.errorPresupuesto');
|
||||
$coste_servicios += floatval($acabadoSobrecubierta[0]->total);
|
||||
}
|
||||
}
|
||||
|
||||
//Guardas
|
||||
$guardas = [];
|
||||
if($reqData['guardas'] ?? 0 > 0){
|
||||
|
||||
$guardas = $reqData['guardas'];
|
||||
$papel_generico = [
|
||||
'id' => $guardas['papel'] ?? 0,
|
||||
'nombre' => $guardas['nombre'] ?? "",
|
||||
];
|
||||
$input_data['papel_generico'] = $papel_generico;
|
||||
$input_data['gramaje'] = $guardas['gramaje'] ?? 0;
|
||||
$input_data['datosPedido']->paginas = 8;
|
||||
$input_data['paginas_color'] = 8;
|
||||
$input_data['datosPedido']->paginas_impresion = $guardas['caras'] ?? 0;
|
||||
$input_data['datosPedido']->solapas_ancho = 0;
|
||||
$input_data['datosPedido']->solapas = 0;
|
||||
$input_data['isColor'] = 1;
|
||||
$input_data['isHq'] = 1;
|
||||
$input_data['uso'] = 'guardas';
|
||||
|
||||
// Para el caso de Fresado y Cosido tapa dura, las guardas son un diptico
|
||||
// y hay que imprimirlas como "cosido" (dos hojas pegadas). En el caso de espiral
|
||||
// o wire-o tapa dura, las guardas se imprimen como hojas sueltas
|
||||
if ($tipo_impresion_id == 1 || $tipo_impresion_id == 3) {
|
||||
$input_data['datosPedido']->isCosido = true;
|
||||
} else if ($tipo_impresion_id == 5 || $tipo_impresion_id == 7) {
|
||||
$input_data['datosPedido']->isCosido = false;
|
||||
}
|
||||
|
||||
$guardas = PresupuestoClienteService::obtenerGuardas($input_data);
|
||||
$coste_guardas = 0.0;
|
||||
if (count($guardas) > 0) {
|
||||
$coste_guardas += floatval($guardas['total_impresion']);
|
||||
}
|
||||
if($coste_guardas <= 0)
|
||||
$error->guardas = lang('Presupuestos.errores.noGuardas');
|
||||
else
|
||||
$error->guardas = "";
|
||||
}
|
||||
|
||||
// Servicios defecto
|
||||
$servDefecto = PresupuestoCLienteService::getServiciosEncuadernacionDefault([
|
||||
'tipo_impresion_id' => $tipo_impresion_id,
|
||||
'tirada' => $datosPedido->tirada,
|
||||
'paginas' => intval($reqData['paginas']) ?? 0,
|
||||
'ancho' => $datosPedido->ancho,
|
||||
'alto' => $datosPedido->alto,
|
||||
'POD' => $POD,
|
||||
'solapas' => intval($reqData['solapasCubierta'] ?? 0)>0?1:0,
|
||||
]);
|
||||
$costeServiciosDefecto = 0.0;
|
||||
foreach ($servDefecto as $servicio) {
|
||||
if($servicio->total <= 0 )
|
||||
$error->serviciosDefecto = lang('Presupuestos.errores.errorPresupuesto');
|
||||
|
||||
$costeServiciosDefecto += floatval($servicio->total);
|
||||
}
|
||||
|
||||
// Servicios
|
||||
$servicios = $reqData['servicios'] ?? [];
|
||||
if($reqData['guardas'] ?? 0 > 0){
|
||||
array_push($servicios, 62); // Plegado de guardas
|
||||
}
|
||||
/*
|
||||
'retractilado' => 3,
|
||||
'retractilado5' => 5,
|
||||
'ferro' => 24,
|
||||
'prototipo' => 9,
|
||||
'fajaColor' => 16,
|
||||
'plegadoGuardas' => 62,
|
||||
*/
|
||||
$serviciosAutomaticos = [];
|
||||
|
||||
foreach($servicios as $servicio){
|
||||
if(intval($servicio) == 3 || intval($servicio) == 5 || intval($servicio) == 16)
|
||||
{
|
||||
// Servicios acabado
|
||||
$resultado = PresupuestoCLienteService::getServiciosManipulado([
|
||||
'tarifa_id' => $servicio,
|
||||
'tirada' => $datosPedido->tirada,
|
||||
'POD' => $POD,
|
||||
]);
|
||||
array_push($serviciosAutomaticos, $resultado[0]);
|
||||
if($resultado[0]->total <= 0 )
|
||||
$error->servicios = lang('Presupuestos.errores.errorPresupuesto');
|
||||
|
||||
$coste_servicios += floatval($resultado[0]->total);
|
||||
|
||||
}
|
||||
else if (intval($servicio) == 24 || intval($servicio) == 9 )
|
||||
{
|
||||
// Servicios preimpresion
|
||||
$resultado = PresupuestoCLienteService::getServiciosExtra([
|
||||
'tarifa_id' => $servicio,
|
||||
]);
|
||||
array_push($serviciosAutomaticos, $resultado[0]);
|
||||
if($resultado[0]->precio <= 0 )
|
||||
$error->servicios = lang('Presupuestos.errores.errorPresupuesto');
|
||||
|
||||
$coste_servicios += floatval($resultado[0]->precio);
|
||||
}
|
||||
else if (intval($servicio) == 62)
|
||||
{
|
||||
// Servicios manipulado
|
||||
$resultado = PresupuestoCLienteService::getServiciosManipulado([
|
||||
'tarifa_id' => $servicio,
|
||||
'tirada' => $datosPedido->tirada,
|
||||
'POD' => $POD,
|
||||
]);
|
||||
array_push($serviciosAutomaticos, $resultado[0]);
|
||||
if($resultado[0]->total <= 0 )
|
||||
$error->servicios = lang('Presupuestos.errores.errorPresupuesto');
|
||||
|
||||
$coste_servicios += floatval($resultado[0]->total);
|
||||
}
|
||||
}
|
||||
|
||||
array_push($precio_u, round(($costeInterior + $coste_cubierta + $coste_sobrecubierta + $costeServiciosDefecto + $coste_servicios)/$tirada[$t], 4));
|
||||
foreach($error as $err){
|
||||
if($err != "")
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$return_data = [
|
||||
'errors' => $error,
|
||||
'total_lp' => $costeInterior+$coste_cubierta+$coste_sobrecubierta,
|
||||
'acabadoCubierta' => $acabadoCubierta,
|
||||
'acabadoSobrecubierta' => $acabadoSobrecubierta,
|
||||
'total_servicios_defecto' => $costeServiciosDefecto,
|
||||
'total_servicios_automaticos' => $coste_servicios,
|
||||
'tiradas' => $tirada,
|
||||
'precio_u' => $precio_u,
|
||||
|
||||
'interior' => $interior,
|
||||
'cubierta' => $cubierta,
|
||||
'sobrecubierta' => $linea_sobrecubierta,
|
||||
'guardas' => $guardas,
|
||||
'serviciosDefecto' => $servDefecto,
|
||||
'servicios_automaticos' => $serviciosAutomaticos,
|
||||
];
|
||||
|
||||
|
||||
return $this->respond($resultado_lineas);
|
||||
return $this->respond($return_data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
@ -628,328 +946,7 @@ class Presupuestocliente extends \App\Controllers\GoBaseResourceController
|
||||
* Funciones auxiliares
|
||||
*
|
||||
**********************/
|
||||
protected function getLineasPresupuesto($reqData)
|
||||
{
|
||||
$error =(object)[
|
||||
'interior' => "",
|
||||
'cubierta' => "",
|
||||
'sobrecubierta' => "",
|
||||
'guardas' => "",
|
||||
'servicios' => "",
|
||||
'serviciosDefecto' => "",
|
||||
];
|
||||
$coste_servicios = 0.0;
|
||||
|
||||
$POD = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD();
|
||||
|
||||
|
||||
$tirada = $reqData['tirada'] ?? 0;
|
||||
$tamanio = $reqData['tamanio'];
|
||||
$tipo_impresion_id = $this->getTipoImpresion($reqData['tipo'], $reqData['tapa']);
|
||||
$precio_u = [];
|
||||
|
||||
for($t=0; $t<count($tirada); $t++){
|
||||
$tirada[$t] = intval($tirada[$t]);
|
||||
|
||||
$paginas_color = intval($reqData['paginasColor']) ?? 0;
|
||||
$is_cosido = (new TipoPresupuestoModel())->get_isCosido($tipo_impresion_id);
|
||||
|
||||
$datosPedido = (object)array(
|
||||
'paginas' => intval($reqData['paginas']) ?? 0,
|
||||
'tirada' => $tirada[$t],
|
||||
'merma' => $tirada[$t] > $POD ? $this->calcular_merma($tirada[$t], $POD) : 0,
|
||||
'ancho' => intval($tamanio['ancho']) ?? 100000,
|
||||
'alto' => intval($tamanio['alto']) ?? 100000,
|
||||
'isCosido' => $is_cosido,
|
||||
);
|
||||
|
||||
$papel_generico = [
|
||||
'id' => $reqData['papelInterior'] ?? 0,
|
||||
'nombre' => $reqData['papelInteriorNombre'] ?? "",
|
||||
];
|
||||
$gramaje = $reqData['gramajeInterior'] ?? 0;
|
||||
$cliente_id = $reqData['clienteId'] ?? -1;
|
||||
$excluirRotativa = $reqData['excluirRotativa'] ?? 0;
|
||||
|
||||
$input_data = array(
|
||||
'uso' => 'interior',
|
||||
'tipo_impresion_id' => $tipo_impresion_id,
|
||||
'datosPedido' => $datosPedido,
|
||||
'papel_generico' => $papel_generico,
|
||||
'gramaje' => $gramaje,
|
||||
'isColor' => intval($reqData['isColor']) ?? 0,
|
||||
'isHq' => intval($reqData['isHq']) ?? 0,
|
||||
'cliente_id' => $cliente_id,
|
||||
'paginas_color' => $paginas_color,
|
||||
'excluirRotativa' => $excluirRotativa,
|
||||
);
|
||||
|
||||
$interior = PresupuestoClienteService::obtenerInterior($input_data);
|
||||
|
||||
$costeInterior = 0.0;
|
||||
foreach ($interior as $linea) {
|
||||
if (count($linea) > 0) {
|
||||
$costeInterior += floatval($linea['total_impresion']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($costeInterior <= 0) {
|
||||
$error->interior = lang('Presupuestos.errores.noInterior');
|
||||
}
|
||||
|
||||
// Si es POD hay que volver a calcular para incluir la merma correcta
|
||||
if ($tirada[$t] <= $POD) {
|
||||
$num_formas = [];
|
||||
foreach ($interior as $linea) {
|
||||
if (count($linea) > 0) {
|
||||
$formas_linea = $is_cosido ? intval($linea['num_formas']['value']) / 2 : intval($linea['num_formas']['value']);
|
||||
array_push($num_formas, $formas_linea);
|
||||
}
|
||||
}
|
||||
$input_data['datosPedido']->merma = $this->calcular_merma($tirada[$t], $POD, $num_formas);
|
||||
|
||||
$interior = PresupuestoClienteService::obtenerInterior($input_data);
|
||||
}
|
||||
|
||||
$costeInterior = 0.0;
|
||||
foreach ($interior as $linea) {
|
||||
if (count($linea) > 0) {
|
||||
$costeInterior += floatval($linea['total_impresion']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($costeInterior <= 0)
|
||||
$error->interior = lang('Presupuestos.errores.noInterior');
|
||||
else
|
||||
$error->interior = "";
|
||||
|
||||
|
||||
// Cubierta
|
||||
$papel_generico = [
|
||||
'id' => $reqData['papelCubierta'] ?? 0,
|
||||
'nombre' => $reqData['papelCubiertaNombre'] ?? "",
|
||||
];
|
||||
$input_data['papel_generico'] = $papel_generico;
|
||||
$input_data['gramaje'] = $reqData['gramajeCubierta'] ?? 0;
|
||||
$input_data['datosPedido']->paginas = intval($reqData['carasCubierta'] ?? 0);
|
||||
$input_data['paginas_color'] = intval($reqData['carasCubierta'] ?? 0);
|
||||
$input_data['datosPedido']->solapas_ancho = intval($reqData['solapasCubierta'] ?? 0);
|
||||
$input_data['datosPedido']->solapas = $input_data['datosPedido']->solapas_ancho>0 ? 1 : 0;
|
||||
$input_data['datosPedido']->lomo = $this->calcular_lomo($interior, 0);
|
||||
$input_data['isColor'] = 1;
|
||||
$input_data['isHq'] = 1;
|
||||
$input_data['uso'] = 'cubierta';
|
||||
|
||||
$cubierta = PresupuestoClienteService::obtenerCubierta($input_data);
|
||||
$coste_cubierta = 0.0;
|
||||
if (count($cubierta) > 0) {
|
||||
$coste_cubierta += floatval($cubierta['total_impresion']);
|
||||
}
|
||||
if($coste_cubierta <= 0)
|
||||
$error->cubierta = lang('Presupuestos.errores.noCubiertaSobrecubierta');
|
||||
else
|
||||
$error->cubierta = "";
|
||||
|
||||
$tarifaAcabadoCubierta = intval($reqData['acabadoCubierta'] ?? 0);
|
||||
$acabadoCubierta = [];
|
||||
if($tarifaAcabadoCubierta > 0){
|
||||
$model = model('App\Models\Presupuestos\PresupuestoAcabadosModel');
|
||||
$acabadoCubierta = $model->getPrecioTarifa($tarifaAcabadoCubierta, $datosPedido->tirada, $POD);
|
||||
}
|
||||
if(count($acabadoCubierta) > 0){
|
||||
if($acabadoCubierta[0]->total <= 0 )
|
||||
$error->servicios = lang('Presupuestos.errores.errorPresupuesto');
|
||||
$coste_servicios += floatval($acabadoCubierta[0]->total);
|
||||
}
|
||||
|
||||
// Sobrecubierta
|
||||
$coste_sobrecubierta = 0.0;
|
||||
$linea_sobrecubierta = [];
|
||||
$acabadoSobrecubierta = [];
|
||||
$sobreCubierta = $reqData["sobrecubierta"] ?? null;
|
||||
if(!is_null($sobreCubierta)){
|
||||
|
||||
$papel_generico = [
|
||||
'id' => $sobreCubierta['papel'] ?? 0,
|
||||
'nombre' => $sobreCubierta['papel_nombre'] ?? "",
|
||||
];
|
||||
$input_data['papel_generico'] = $papel_generico;
|
||||
$input_data['gramaje'] = $sobreCubierta['gramaje'] ?? 0;
|
||||
$input_data['datosPedido']->paginas = 4;
|
||||
$input_data['paginas_color'] = 4;
|
||||
$input_data['datosPedido']->solapas_ancho = intval($sobreCubierta['solapas'] ?? 0);
|
||||
$input_data['datosPedido']->solapas = $input_data['datosPedido']->solapas_ancho>0 ? 1 : 0;
|
||||
$input_data['datosPedido']->lomo = $this->calcular_lomo([$cubierta], $input_data['datosPedido']->lomo);
|
||||
$input_data['isColor'] = 1;
|
||||
$input_data['isHq'] = 1;
|
||||
$input_data['uso'] = 'sobrecubierta';
|
||||
|
||||
$linea_sobrecubierta = PresupuestoClienteService::obtenerSobrecubierta($input_data);
|
||||
|
||||
if (count($linea_sobrecubierta) > 0) {
|
||||
$coste_sobrecubierta += floatval($linea_sobrecubierta['total_impresion']);
|
||||
}
|
||||
if($coste_sobrecubierta <= 0)
|
||||
$error->sobrecubierta = lang('Presupuestos.errores.noCubiertaSobrecubierta');
|
||||
else
|
||||
$error->sobrecubierta = "";
|
||||
|
||||
$tarifaAcabadoSobrecubierta = intval(strlen($sobreCubierta['acabado'])==0 ? 0:$sobreCubierta['acabado']);
|
||||
$acabadoSobrecubierta = [];
|
||||
if($tarifaAcabadoSobrecubierta > 0){
|
||||
$model = model('App\Models\Presupuestos\PresupuestoAcabadosModel');
|
||||
$acabadoSobrecubierta = $model->getPrecioTarifa($tarifaAcabadoSobrecubierta, $datosPedido->tirada, $POD);
|
||||
}
|
||||
if(count($acabadoSobrecubierta) > 0){
|
||||
if($acabadoSobrecubierta[0]->total <= 0 )
|
||||
$error->servicios = lang('Presupuestos.errores.errorPresupuesto');
|
||||
$coste_servicios += floatval($acabadoSobrecubierta[0]->total);
|
||||
}
|
||||
}
|
||||
|
||||
//Guardas
|
||||
$guardas = [];
|
||||
if($reqData['guardas'] ?? 0 > 0){
|
||||
|
||||
$guardas = $reqData['guardas'];
|
||||
$papel_generico = [
|
||||
'id' => $guardas['papel'] ?? 0,
|
||||
'nombre' => $guardas['nombre'] ?? "",
|
||||
];
|
||||
$input_data['papel_generico'] = $papel_generico;
|
||||
$input_data['gramaje'] = $guardas['gramaje'] ?? 0;
|
||||
$input_data['datosPedido']->paginas = 8;
|
||||
$input_data['paginas_color'] = 8;
|
||||
$input_data['datosPedido']->paginas_impresion = $guardas['caras'] ?? 0;
|
||||
$input_data['datosPedido']->solapas_ancho = 0;
|
||||
$input_data['datosPedido']->solapas = 0;
|
||||
$input_data['isColor'] = 1;
|
||||
$input_data['isHq'] = 1;
|
||||
$input_data['uso'] = 'guardas';
|
||||
|
||||
// Para el caso de Fresado y Cosido tapa dura, las guardas son un diptico
|
||||
// y hay que imprimirlas como "cosido" (dos hojas pegadas). En el caso de espiral
|
||||
// o wire-o tapa dura, las guardas se imprimen como hojas sueltas
|
||||
if ($tipo_impresion_id == 1 || $tipo_impresion_id == 3) {
|
||||
$input_data['datosPedido']->isCosido = true;
|
||||
} else if ($tipo_impresion_id == 5 || $tipo_impresion_id == 7) {
|
||||
$input_data['datosPedido']->isCosido = false;
|
||||
}
|
||||
|
||||
$guardas = PresupuestoClienteService::obtenerGuardas($input_data);
|
||||
$coste_guardas = 0.0;
|
||||
if (count($guardas) > 0) {
|
||||
$coste_guardas += floatval($guardas['total_impresion']);
|
||||
}
|
||||
if($coste_guardas <= 0)
|
||||
$error->guardas = lang('Presupuestos.errores.noGuardas');
|
||||
else
|
||||
$error->guardas = "";
|
||||
}
|
||||
|
||||
// Servicios defecto
|
||||
$servDefecto = PresupuestoCLienteService::getServiciosEncuadernacionDefault([
|
||||
'tipo_impresion_id' => $tipo_impresion_id,
|
||||
'tirada' => $datosPedido->tirada,
|
||||
'paginas' => intval($reqData['paginas']) ?? 0,
|
||||
'ancho' => $datosPedido->ancho,
|
||||
'alto' => $datosPedido->alto,
|
||||
'POD' => $POD,
|
||||
'solapas' => intval($reqData['solapasCubierta'] ?? 0)>0?1:0,
|
||||
]);
|
||||
$costeServiciosDefecto = 0.0;
|
||||
foreach ($servDefecto as $servicio) {
|
||||
if($servicio->total <= 0 )
|
||||
$error->serviciosDefecto = lang('Presupuestos.errores.errorPresupuesto');
|
||||
|
||||
$costeServiciosDefecto += floatval($servicio->total);
|
||||
}
|
||||
|
||||
// Servicios
|
||||
$servicios = $reqData['servicios'] ?? [];
|
||||
if($reqData['guardas'] ?? 0 > 0){
|
||||
array_push($servicios, 62); // Plegado de guardas
|
||||
}
|
||||
/*
|
||||
'retractilado' => 3,
|
||||
'retractilado5' => 5,
|
||||
'ferro' => 24,
|
||||
'prototipo' => 9,
|
||||
'fajaColor' => 16,
|
||||
'plegadoGuardas' => 62,
|
||||
*/
|
||||
$serviciosAutomaticos = [];
|
||||
|
||||
foreach($servicios as $servicio){
|
||||
if(intval($servicio) == 3 || intval($servicio) == 5 || intval($servicio) == 16)
|
||||
{
|
||||
// Servicios acabado
|
||||
$resultado = PresupuestoCLienteService::getServiciosManipulado([
|
||||
'tarifa_id' => $servicio,
|
||||
'tirada' => $datosPedido->tirada,
|
||||
'POD' => $POD,
|
||||
]);
|
||||
array_push($serviciosAutomaticos, $resultado[0]);
|
||||
if($resultado[0]->total <= 0 )
|
||||
$error->servicios = lang('Presupuestos.errores.errorPresupuesto');
|
||||
|
||||
$coste_servicios += floatval($resultado[0]->total);
|
||||
|
||||
}
|
||||
else if (intval($servicio) == 24 || intval($servicio) == 9 )
|
||||
{
|
||||
// Servicios preimpresion
|
||||
$resultado = PresupuestoCLienteService::getServiciosPreimpresion([
|
||||
'tarifa_id' => $servicio,
|
||||
]);
|
||||
array_push($serviciosAutomaticos, $resultado[0]);
|
||||
if($resultado[0]->total <= 0 )
|
||||
$error->servicios = lang('Presupuestos.errores.errorPresupuesto');
|
||||
|
||||
$coste_servicios += floatval($resultado[0]->total);
|
||||
}
|
||||
else if (intval($servicio) == 62)
|
||||
{
|
||||
// Servicios manipulado
|
||||
$resultado = PresupuestoCLienteService::getServiciosManipulado([
|
||||
'tarifa_id' => $servicio,
|
||||
'tirada' => $datosPedido->tirada,
|
||||
'POD' => $POD,
|
||||
]);
|
||||
array_push($serviciosAutomaticos, $resultado[0]);
|
||||
if($resultado[0]->total <= 0 )
|
||||
$error->servicios = lang('Presupuestos.errores.errorPresupuesto');
|
||||
|
||||
$coste_servicios += floatval($resultado[0]->total);
|
||||
}
|
||||
}
|
||||
|
||||
array_push($precio_u, round(($costeInterior + $coste_cubierta + $coste_sobrecubierta + $costeServiciosDefecto + $coste_servicios)/$tirada[$t], 4));
|
||||
foreach($error as $err){
|
||||
if($err != "")
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return [
|
||||
'errors' => $error,
|
||||
'total_lp' => $costeInterior+$coste_cubierta+$coste_sobrecubierta,
|
||||
'acabadoCubierta' => $acabadoCubierta,
|
||||
'acabadoSobrecubierta' => $acabadoSobrecubierta,
|
||||
'total_servicios_defecto' => $costeServiciosDefecto,
|
||||
'total_servicios_automaticos' => $coste_servicios,
|
||||
'tiradas' => $tirada,
|
||||
'precio_u' => $precio_u,
|
||||
|
||||
'interior' => $interior,
|
||||
'cubierta' => $cubierta,
|
||||
'sobrecubierta' => $linea_sobrecubierta,
|
||||
'guardas' => $guardas,
|
||||
'serviciosDefecto' => $servDefecto,
|
||||
'servicios_automaticos' => $serviciosAutomaticos,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -363,6 +363,16 @@ class PresupuestoClienteService extends BaseService
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
public static function getServiciosExtra($data){
|
||||
|
||||
$tarifa_id = $data['tarifa_id'] ?? -1;
|
||||
|
||||
$model = model('App\Models\Presupuestos\PresupuestoServiciosExtraModel');
|
||||
$values = $model->getPrecioTarifa($tarifa_id);
|
||||
return $values;
|
||||
}
|
||||
|
||||
public static function getServiciosAcabados($data){
|
||||
|
||||
$tarifa_id = $data['tarifa_id'] ?? -1;
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
<div class="col-12 pb-2">
|
||||
|
||||
<div id="containerTiradasEnvios" class="row mb-3">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row mb-3">
|
||||
|
||||
<div class="col-sm-4 mb-3">
|
||||
<label for="direcciones" class="form-label">Mis direcciones</label>
|
||||
<select id="direcciones" name="direcciones" class="form-control select2bs2" style="width: 100%;"></select>
|
||||
</div>
|
||||
<div class="col-sm-2 mb-3">
|
||||
<label for="unidadesEnvio" class="form-label">
|
||||
Unidades
|
||||
</label>
|
||||
<input type="number" class="form-control" id="unidadesEnvio" name="unidadesEnvio" maxLength="8" step="1" class="form-control">
|
||||
</div><!--//.mb-3 -->
|
||||
<div class="col-sm-2 mb-3 mt-auto mb-0">
|
||||
<button id="insertarDireccion" type="button" class="btn btn-secondary waves-effect waves-light">Insertar</button>
|
||||
</div>
|
||||
<div id="errorDirecciones" class="fv-plugins-message-container invalid-feedback" style="display: none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="divDirecciones" class="col-12 pb-2">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -0,0 +1,144 @@
|
||||
function initTiradasDirecciones() {
|
||||
const _this = this
|
||||
|
||||
$('#containerTiradasEnvios').empty();
|
||||
|
||||
for (i = 1; i <= 4; i++) {
|
||||
let id = "tiradaPrecio" + i;
|
||||
if ($('#' + id).length > 0) {
|
||||
|
||||
let tirada_id = "ud_tiradaPrecio" + i;
|
||||
let total_id = "tot_tiradaPrecio" + i;
|
||||
let precio_u_id = "pu_tiradaPrecio" + i;
|
||||
|
||||
let html = '';
|
||||
html += '<div class="col-sm-3">';
|
||||
html += '<div class="form-check custom-option custom-option-basic custom-option-tiradasDirecciones' + (i==1?' checked':'')+ ' ">';
|
||||
html += '<label class="form-check-label custom-option-content" for="tiradaEnvios' + i + '">';
|
||||
html += '<input name="' + id + '" class="form-check-input" type="radio" value="" id="' + id + '">';
|
||||
html += '<span class="custom-option-header">';
|
||||
html += '<span id="tiradaDireccionesValue' + i + '" class="h6 mb-0">' + $('#' + tirada_id).text().split(' ')[0] + '</span>';
|
||||
html += '<span class="text-muted">' + $('#' + total_id).text() + '</span>';
|
||||
html += '</span>';
|
||||
html += '<span class="custom-option-body">';
|
||||
html += '<small>' + $('#' + precio_u_id).text() + '</small>';
|
||||
html += '</span>';
|
||||
html += '</label>';
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
|
||||
$('#containerTiradasEnvios').append(html);
|
||||
|
||||
$('#' + id).hide();
|
||||
}
|
||||
}
|
||||
|
||||
const tiradasDireccionesList = [].slice.call(document.querySelectorAll('.custom-option-tiradasDirecciones .form-check-input'))
|
||||
tiradasDireccionesList.map(function (customOptionEL) {
|
||||
// Update custom options check on page load
|
||||
_this.updateTiradasDireccionesCheck(customOptionEL)
|
||||
|
||||
// Update custom options check on click
|
||||
customOptionEL.addEventListener('click', e => {
|
||||
_this.updateTiradasDireccionesCheck(customOptionEL)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function updateTiradasDireccionesCheck(el) {
|
||||
if (el.checked) {
|
||||
// If custom option element is radio, remove checked from the siblings (closest `.row`)
|
||||
if (el.type === 'radio') {
|
||||
const customRadioOptionList = [].slice.call(el.closest('.row').querySelectorAll('.custom-option-tiradasDirecciones'))
|
||||
customRadioOptionList.map(function (customRadioOptionEL) {
|
||||
customRadioOptionEL.closest('.custom-option-tiradasDirecciones').classList.remove('checked')
|
||||
})
|
||||
}
|
||||
el.closest('.custom-option-tiradasDirecciones').classList.add('checked')
|
||||
|
||||
} else {
|
||||
el.closest('.custom-option-tiradasDirecciones').classList.remove('checked')
|
||||
}
|
||||
}
|
||||
|
||||
$('#insertarDireccion').on('click', function() {
|
||||
//if( ('#direcciones').val() > 0 ) {
|
||||
|
||||
let unidades = $('#unidadesEnvio').val();
|
||||
if(unidades == '' || isNaN(unidades) || parseInt(unidades) <= 0){
|
||||
return false;
|
||||
}
|
||||
unidades = parseInt(unidades);
|
||||
|
||||
const seleccion = $('.custom-option-tiradasDirecciones.checked');
|
||||
if(seleccion.length == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const element_tirada =($(seleccion[0]).find('label input')[0]);
|
||||
const number = element_tirada.id.match(/\d+$/);
|
||||
if (number.length == 0) {
|
||||
return false;
|
||||
}
|
||||
let tirada = parseInt($('#tiradaDireccionesValue' + number[0]).text());
|
||||
|
||||
const elements = $('#divDirecciones').find('.row.mb-3');
|
||||
|
||||
let total = 0;
|
||||
if(elements.length > 0) {
|
||||
for (let index=0; index<elements.length; index++){
|
||||
let unidades_direcciones = parseInt($(elements[index]).find('div label span span').text().split(' ')[0]);
|
||||
total += unidades_direcciones;
|
||||
};
|
||||
}
|
||||
|
||||
if($('#prototipo').is(':checked')) {
|
||||
tirada += 1;
|
||||
}
|
||||
|
||||
if(total + unidades <= tirada) {
|
||||
|
||||
let html = '';
|
||||
html += '<div class="row mb-3">';
|
||||
html += '<div class="col-sm-5 form-check custom-option custom-option-basic checked">';
|
||||
html += '<label class="form-check-label custom-option-content" for="customRadioAddress1">';
|
||||
html += '<span class="custom-option-header mb-2">';
|
||||
html += '<h6 class="fw-semibold mb-0">Jaime Jiménez Ortega</h6>';
|
||||
html += '<span class="badge bg-label-primary">' + unidades + ' unidades</span>';
|
||||
html += '</span>';
|
||||
html += '<span class="custom-option-body">';
|
||||
html += '<small>Circunvalacion La Encina, 20, 5A</small><br>';
|
||||
html += '<small>18200</small><br>';
|
||||
html += '<small>Granada, España</small><br>';
|
||||
html += '<small>600620238</small><br>';
|
||||
html += '<hr class="my-2">';
|
||||
html += '<span class="d-flex">';
|
||||
html += '<a class="eliminar-direccion" href="javascript:void(0)">Eliminar</a>';
|
||||
html += '</span>';
|
||||
html += '</span>';
|
||||
html += '</label>';
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
|
||||
$('#divDirecciones').append(html);
|
||||
$('#errorDirecciones').hide();
|
||||
}
|
||||
else{
|
||||
$('#errorDirecciones').text('El número de unidades supera la tirada seleccionada.');
|
||||
$('#errorDirecciones').show();
|
||||
}
|
||||
|
||||
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
return false;
|
||||
})
|
||||
|
||||
|
||||
$(".eliminar-direccion").on('click', function() {
|
||||
$(this).closest('.row.mb-3').remove();
|
||||
return false;
|
||||
})
|
||||
@ -594,6 +594,10 @@ function comprobarTiradasPOD(){
|
||||
return false;
|
||||
}
|
||||
|
||||
$('#clienteId').on('select2:change', function () {
|
||||
calcularPresupuesto();
|
||||
});
|
||||
|
||||
|
||||
async function calcularPresupuesto() {
|
||||
|
||||
@ -714,10 +718,8 @@ async function calcularPresupuesto() {
|
||||
console.log(response);
|
||||
$('#loader').hide();
|
||||
if(error){
|
||||
$('#tiradaPrecio1').hide();
|
||||
$('#tiradaPrecio2').hide();
|
||||
$('#tiradaPrecio3').hide();
|
||||
$('#tiradaPrecio4').hide();
|
||||
$('#divTiradasPrecio').empty();
|
||||
|
||||
}
|
||||
else{
|
||||
$('#precios').show();
|
||||
@ -726,24 +728,28 @@ async function calcularPresupuesto() {
|
||||
const total = (parseFloat(response.precio_u[i]) * parseInt(response.tiradas[i])).toFixed(2) ;
|
||||
const label = "tiradaPrecio" + parseInt(i+1);
|
||||
|
||||
$('#ud_' + label).text(response.tiradas[i] + ' ud.');
|
||||
$('#tot_' + label).text('Total: ' + total + '€');
|
||||
$('#pu_' + label).text(response.precio_u[i] + '€/ud');
|
||||
$('#' + label).show();
|
||||
}
|
||||
for (i = response.tiradas.length; i < 4; i++) {
|
||||
const label = "tiradaPrecio" + parseInt(i+1);
|
||||
$('#' + label).hide();
|
||||
}
|
||||
let html = '';
|
||||
|
||||
|
||||
html += '<div id="' + label + '" class="list-group" >';
|
||||
html += '<a href="javascript:void(0);" class="list-group-item list-group-item-action">';
|
||||
html += '<div class="li-wrapper d-flex justify-content-start align-items-center" >';
|
||||
html += '<div class="list-content">';
|
||||
html += '<h7 id="ud_' + label + '" class="mb-1">' + (response.tiradas[i] + ' ud.') + '</h7>';
|
||||
html += '<h6 id="tot_' + label + '" class="mb-1">' + ('Total: ' + total + '€') + '</h6>';
|
||||
html += '<h7 id="pu_' + label + '" class="mb-1">' + (response.precio_u[i] + '€/ud') + '</h7>';
|
||||
html += '</div>';
|
||||
html += '</div>'
|
||||
html += '</a>';
|
||||
html += '</div>';
|
||||
|
||||
$('#divTiradasPrecio').append(html);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
error: function (error) {
|
||||
$('#loader').hide();
|
||||
$('#tiradaPrecio1').hide();
|
||||
$('#tiradaPrecio2').hide();
|
||||
$('#tiradaPrecio3').hide();
|
||||
$('#tiradaPrecio4').hide();
|
||||
$('#divTiradasPrecio').empty();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -208,6 +208,7 @@
|
||||
}
|
||||
}).on('core.form.valid', function () {
|
||||
validationStepper.next();
|
||||
initTiradasDirecciones();
|
||||
});
|
||||
|
||||
const tirada = $('#tirada');
|
||||
@ -218,7 +219,7 @@
|
||||
FormValidation2.revalidateField('gramajeSobrecubierta');
|
||||
});
|
||||
|
||||
// Deal Usage
|
||||
// Direcciones
|
||||
const FormValidation4 = FormValidation.formValidation(clientePresupuestoWizardFormStep4, {
|
||||
fields: {
|
||||
|
||||
@ -296,6 +297,12 @@
|
||||
break;
|
||||
|
||||
case 3:
|
||||
for (let i = 0; i < 4; i++) {
|
||||
let id = "tiradaPrecio" + i;
|
||||
if ($('#' + id).length > 0) {
|
||||
$('#' + id).show();
|
||||
}
|
||||
}
|
||||
validationStepper.previous();
|
||||
break;
|
||||
|
||||
|
||||
@ -68,52 +68,9 @@
|
||||
administrador.</p>
|
||||
</div>
|
||||
|
||||
<div id="tiradaPrecio1" class="list-group" style="display: none;">
|
||||
<a class="list-group-item list-group-item-action d-flex justify-content-between" style="display: none;">
|
||||
<div class="li-wrapper d-flex justify-content-start align-items-center" >
|
||||
<div class="list-content">
|
||||
<h7 id="ud_tiradaPrecio1" class="mb-1">100 unidades</h7>
|
||||
<h6 id="tot_tiradaPrecio1" class="mb-1">Total 387.54€</h6>
|
||||
<h7 id="pu_tiradaPrecio1" class="mb-1">3.8754€/ud</h7>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div id="tiradaPrecio2" class="list-group" style="display: none;">
|
||||
<a class="list-group-item list-group-item-action d-flex justify-content-between" style="display: none;">
|
||||
<div class="li-wrapper d-flex justify-content-start align-items-center" >
|
||||
<div class="list-content">
|
||||
<h7 id="ud_tiradaPrecio2" class="mb-1">100 unidades</h7>
|
||||
<h6 id="tot_tiradaPrecio2" class="mb-1">Total 387.54€</h6>
|
||||
<h7 id="pu_tiradaPrecio2" class="mb-1">3.8754€/ud</h7>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div id="tiradaPrecio3" class="list-group" style="display: none;">
|
||||
<a class="list-group-item list-group-item-action d-flex justify-content-between" style="display: none;">
|
||||
<div class="li-wrapper d-flex justify-content-start align-items-center" >
|
||||
<div class="list-content">
|
||||
<h7 id="ud_tiradaPrecio3" class="mb-1">100 unidades</h7>
|
||||
<h6 id="tot_tiradaPrecio3" class="mb-1">Total 387.54€</h6>
|
||||
<h7 id="pu_tiradaPrecio3" class="mb-1">3.8754€/ud</h7>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div id="tiradaPrecio4" class="list-group" style="display: none;">
|
||||
<a class="list-group-item list-group-item-action d-flex justify-content-between" style="display: none;">
|
||||
<div class="li-wrapper d-flex justify-content-start align-items-center" >
|
||||
<div class="list-content">
|
||||
<h7 id="ud_tiradaPrecio4" class="mb-1">100 unidades</h7>
|
||||
<h6 id="tot_tiradaPrecio4" class="mb-1">Total 387.54€</h6>
|
||||
<h7 id="pu_tiradaPrecio4" class="mb-1">3.8754€/ud</h7>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div id='divTiradasPrecio'>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -125,9 +82,10 @@
|
||||
<div id="tipo-libro" class="content active dstepper-block fv-plugins-bootstrap5 fv-plugins-framework">
|
||||
<div class="row g-3">
|
||||
|
||||
|
||||
<?= view("themes/backend/vuexy/form/presupuestos/cliente/_tipoLibroItems") ?>
|
||||
|
||||
<?= view("themes/backend/vuexy/form/presupuestos/cliente/_tipoLibroItems") ?>
|
||||
<?php /*
|
||||
<?= view("themes/backend/vuexy/form/presupuestos/cliente/_direccionesItems") ?>
|
||||
*/?>
|
||||
<div class="col-12 d-flex justify-content-between mt-4">
|
||||
<button class="btn btn-label-secondary btn-prev waves-effect">
|
||||
<i class="ti ti-arrow-left ti-xs me-sm-1 me-0"></i>
|
||||
@ -160,11 +118,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Deal Usage -->
|
||||
<!-- Direcciones -->
|
||||
<div id="direcciones-libro" class="content fv-plugins-bootstrap5 fv-plugins-framework">
|
||||
<div class="row g-3">
|
||||
|
||||
|
||||
<?= view("themes/backend/vuexy/form/presupuestos/cliente/_direccionesItems") ?>
|
||||
|
||||
<div class="col-12 d-flex justify-content-between mt-4">
|
||||
<button class="btn btn-label-secondary btn-prev waves-effect">
|
||||
@ -275,4 +233,5 @@ initDisenioLibro();
|
||||
<script src="<?= site_url('js_loader/presupuestoCliente_js') ?>"></script>
|
||||
<script src="<?= site_url('js_loader/presupuestoClienteTipoLibro_js') ?>"></script>
|
||||
<script src="<?= site_url('js_loader/presupuestoClienteDisenioLibro_js') ?>"></script>
|
||||
<script src="<?= site_url('js_loader/presupuestoClienteDirecciones_js') ?>"></script>
|
||||
<?= $this->endSection() ?>
|
||||
@ -1268,34 +1268,34 @@ function get_tarifas_preimpresion(tarifa_id = -1){
|
||||
|
||||
function servicioPrototipo(){
|
||||
if($('#prototipo').prop('checked')){
|
||||
$('#add_servicio_preimpresion_list').val(serviciosAutomaticos.prototipo)
|
||||
$('#insertar_serv_preimpresion').click()
|
||||
$('#add_servicio_extra_list').val(serviciosAutomaticos.prototipo)
|
||||
$('#insertar_serv_extra').click()
|
||||
}
|
||||
else{
|
||||
var row_indexes = tableServiciosPreimpresion.rows().eq( 0 ).filter( function (rowIdx) {
|
||||
return tableServiciosPreimpresion.cell( rowIdx, 0 ).data() == serviciosAutomaticos.prototipo ? true : false;
|
||||
var row_indexes = tableServiciosExtra.rows().eq( 0 ).filter( function (rowIdx) {
|
||||
return tableServiciosExtra.cell( rowIdx, 0 ).data() == serviciosAutomaticos.prototipo ? true : false;
|
||||
} );
|
||||
if(row_indexes.length > 0){
|
||||
tableServiciosPreimpresion.row(row_indexes[0]).remove().draw()
|
||||
tableServiciosExtra.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() == serviciosAutomaticos.ferro ? true : false;
|
||||
var row_indexes = tableServiciosExtra.rows().eq( 0 ).filter( function (rowIdx) {
|
||||
return tableServiciosExtra.cell( rowIdx, 0 ).data() == serviciosAutomaticos.ferro ? true : false;
|
||||
} );
|
||||
if($('#ferro').prop('checked')){
|
||||
if(row_indexes.length == 0){
|
||||
$('#add_servicio_preimpresion_list').val(serviciosAutomaticos.ferro)
|
||||
$('#insertar_serv_preimpresion').click()
|
||||
$('#add_servicio_extra_list').val(serviciosAutomaticos.ferro)
|
||||
$('#insertar_serv_extra').click()
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(row_indexes.length > 0){
|
||||
tableServiciosPreimpresion.row(row_indexes[0]).remove().draw()
|
||||
check_serv_preimpresion_error()
|
||||
tableServiciosExtra.row(row_indexes[0]).remove().draw()
|
||||
check_serv_extra_error()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
21504
xdebug.log
21504
xdebug.log
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user