mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
falta update servicios
This commit is contained in:
@ -172,6 +172,7 @@ $routes->group('tarifapreimpresion', ['namespace' => 'App\Controllers\Tarifas'],
|
||||
$routes->get('delete/(:num)', 'Tarifapreimpresion::delete/$1', ['as' => 'deleteTarifapreimpresion']);
|
||||
$routes->post('allmenuitems', 'Tarifapreimpresion::allItemsSelect', ['as' => 'select2ItemsOfTarifaspreimpresion']);
|
||||
$routes->post('menuitems', 'Tarifapreimpresion::menuItems', ['as' => 'menuItemsOfTarifaspreimpresion']);
|
||||
$routes->get('gettarifas', 'Tarifapreimpresion::getSelect2');
|
||||
});
|
||||
|
||||
|
||||
@ -186,6 +187,7 @@ $routes->group('tarifaextra', ['namespace' => 'App\Controllers\Tarifas'], functi
|
||||
$routes->get('delete/(:num)', 'Tarifaextra::delete/$1', ['as' => 'deleteTarifaextra']);
|
||||
$routes->post('allmenuitems', 'Tarifaextra::allItemsSelect', ['as' => 'select2ItemsOfTarifasextra']);
|
||||
$routes->post('menuitems', 'Tarifaextra::menuItems', ['as' => 'menuItemsOfTarifasextra']);
|
||||
$routes->get('gettarifas', 'Tarifaextra::getSelect2');
|
||||
});
|
||||
|
||||
|
||||
@ -201,6 +203,7 @@ $routes->group('tarifasmanipulado', ['namespace' => 'App\Controllers\Tarifas'],
|
||||
$routes->post('allmenuitems', 'Tarifasmanipulado::allItemsSelect', ['as' => 'select2ItemsOfTarifasManipulado']);
|
||||
$routes->post('menuitems', 'Tarifasmanipulado::menuItems', ['as' => 'menuItemsOfTarifasManipulado']);
|
||||
$routes->get('select', 'Tarifasmanipulado::show_select', ["as" => "showSelectTarifaManipulado"]);
|
||||
$routes->get('gettarifas', 'Tarifasmanipulado::getSelect2');
|
||||
});
|
||||
$routes->resource('tarifasmanipulado', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifasmanipulado', 'except' => 'show,new,create,update']);
|
||||
|
||||
@ -496,6 +499,7 @@ $routes->group('tarifasencuadernacion', ['namespace' => 'App\Controllers\Tarifas
|
||||
$routes->post('datatable', 'Tarifasencuadernacion::datatable', ['as' => 'dataTableOfTarifasEncuadernacion']);
|
||||
$routes->post('allmenuitems', 'Tarifasencuadernacion::allItemsSelect', ['as' => 'select2ItemsOfTarifasEncuadernacion']);
|
||||
$routes->post('menuitems', 'Tarifasencuadernacion::menuItems', ['as' => 'menuItemsOfTarifasEncuadernacion']);
|
||||
$routes->get('gettarifas', 'Tarifasencuadernacion::getSelect2');
|
||||
});
|
||||
$routes->resource('tarifasencuadernacion', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifasencuadernacion', 'except' => 'show,new,create,update']);
|
||||
|
||||
@ -663,24 +667,30 @@ $routes->group('serviciosacabados', ['namespace' => 'App\Controllers\Presupuesto
|
||||
|
||||
$routes->group('serviciosencuadernaciones', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
$routes->post('datatable', 'Presupuestoencuadernaciones::datatable', ['as' => 'dataTableOfPresupuestoEncuadernaciones']);
|
||||
$routes->post('getvalues', 'Presupuestoencuadernaciones::getRowValues');
|
||||
$routes->post('menuitems', 'Presupuestoencuadernaciones::menuItems', ['as' => 'menuItemsOfPresupuestoEncuadernaciones']);
|
||||
$routes->get('delete/(:num)', 'Presupuestoencuadernaciones::delete/$1', ['as' => 'deletePresupuestoencuadernaciones']);
|
||||
$routes->post('edit/(:num)', 'Presupuestoencuadernaciones::edit/$1', ['as' => 'updatePresupuestoencuadernaciones']);
|
||||
|
||||
});
|
||||
|
||||
$routes->group('serviciosmanipulados', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
$routes->post('getvalues', 'Presupuestomanipulados::getRowValues');
|
||||
$routes->post('datatable', 'Presupuestomanipulados::datatable', ['as' => 'dataTableOfPresupuestoManipulados']);
|
||||
$routes->post('edit/(:num)', 'Presupuestomanipulados::edit/$1', ['as' => 'updatePresupuestomanipulados']);
|
||||
});
|
||||
|
||||
$routes->group('serviciospreimpresiones', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
$routes->post('getvalues', 'Presupuestopreimpresiones::getRowValues');
|
||||
$routes->post('datatable', 'Presupuestopreimpresiones::datatable', ['as' => 'dataTableOfPresupuestoPreimpresiones']);
|
||||
$routes->post('edit/(:num)', 'Presupuestopreimpresiones::edit/$1', ['as' => 'updatePresupuestopreimpresiones']);
|
||||
$routes->get('cargar', 'Presupuestopreimpresiones::getSelect2');
|
||||
});
|
||||
|
||||
$routes->group('serviciosextra', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
$routes->post('datatable', 'Presupuestoserviciosextra::datatable', ['as' => 'dataTableOfPresupuestoServiciosExtra']);
|
||||
$routes->post('edit/(:num)', 'Presupuestoserviciosextra::edit/$1', ['as' => 'updatePresupuestoServiciosExtra']);
|
||||
$routes->post('getvalues', 'Presupuestoserviciosextra::getRowValues');
|
||||
});
|
||||
|
||||
$routes->group('presupuestodirecciones', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
|
||||
@ -330,43 +330,6 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
else
|
||||
$this->viewData['comp_data'] = "";
|
||||
|
||||
$this->viewData['clienteList'] = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null);
|
||||
$this->viewData['paisList'] = $this->getPaisListItems();
|
||||
$this->viewData['ccaaList'] = $this->getCcaaListItems();
|
||||
|
||||
$this->viewData['clienteList'] = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null);
|
||||
$this->viewData['incReiList'] = array('incidencia' => lang('Presupuestos.incidencia'), 'reimpresion' => lang('Presupuestos.reimpresion'), 'sin_cargo' => lang('Presupuestos.sinCargo'));
|
||||
$this->viewData['papelFormatoList'] = $this->getPapelFormatoListItems($presupuestoEntity->papel_formato_id ?? null);
|
||||
|
||||
|
||||
// Acabados exteriores
|
||||
$this->viewData['acabadosCubierta'] = $this->getAcabadosCubierta();
|
||||
$this->viewData['acabadosSobrecubierta'] = $this->getAcabadosSobrecubierta();
|
||||
|
||||
// Lineas Presupuesto
|
||||
[$cambios_lineas, $this->viewData['lineasPresupuesto']] = $this->loadLineasPresupuesto($presupuestoEntity);
|
||||
$this->viewData['presupuestoEntity']->cambios_lineas = $cambios_lineas;
|
||||
|
||||
// Servicios
|
||||
$this->viewData['serviciosPreimpresion'] = $this->getServiciosPreimpresion();
|
||||
$this->viewData['serviciosEncuadernacion'] = $this->getServiciosEncuadernacion();
|
||||
$this->viewData['serviciosManipulado'] = $this->getServiciosManipulado();
|
||||
$this->viewData['serviciosAcabado'] = $this->getServiciosAcabado();
|
||||
$this->viewData['serviciosExtra'] = $this->getServiciosExtra();
|
||||
|
||||
[$cambios_en_servicios, $servicios] = $this->getLineasServicios($presupuestoEntity);
|
||||
$this->viewData['presupuestoEntity']->cambios_servicios = $cambios_en_servicios;
|
||||
|
||||
$this->viewData['serviciosEncuadernacionList'] = $servicios->serviciosEncuadernacion;
|
||||
$this->viewData['serviciosAcabadosList'] = $servicios->serviciosAcabado;
|
||||
$this->viewData['serviciosManipuladoList'] = $servicios->serviciosManipulado;
|
||||
$this->viewData['serviciosPreimpresionList'] = $servicios->serviciosPreimpresion;
|
||||
$this->viewData['serviciosExtraList'] = $servicios->serviciosExtra;
|
||||
|
||||
// Direciones presupuesto
|
||||
[$cambios_en_direcciones, $this->viewData['direccionesList']] = $this->getLineasDirecciones($presupuestoEntity);
|
||||
$this->viewData['presupuestoEntity']->cambios_direcciones = $cambios_en_direcciones;
|
||||
|
||||
$this->viewData['POD'] = $this->getPOD();
|
||||
|
||||
$this->viewData['serviciosAutomaticos'] = [
|
||||
@ -494,6 +457,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
$data['datosGenerales']['numero_edicion'] = $presupuesto->numero_edicion;
|
||||
$data['datosGenerales']['isbn'] = $presupuesto->isbn;
|
||||
$data['datosGenerales']['pais'] = $presupuesto->pais_id;
|
||||
$data['datosGenerales']['pais_nombre'] = model('App\Models\Configuracion\PaisModel')->find($presupuesto->pais_id)->nombre;
|
||||
$data['datosGenerales']['cliente']['id'] = $presupuesto->cliente_id;
|
||||
$data['datosGenerales']['cliente']['nombre'] = $modelCliente->getNombre($presupuesto->cliente_id);
|
||||
$data['datosGenerales']['referenciaCliente'] = $presupuesto->referencia_cliente;
|
||||
@ -544,6 +508,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
|
||||
$data['lineasPresupuesto'] = $this->loadLineasPresupuesto($presupuesto);
|
||||
|
||||
$data['servicios'] = $this->getLineasServicios($presupuesto)[1];
|
||||
|
||||
/*
|
||||
|
||||
@ -1397,319 +1362,6 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getPaisListItems()
|
||||
{
|
||||
$paisModel = model('App\Models\Configuracion\PaisModel');
|
||||
$onlyActiveOnes = true;
|
||||
$data = $paisModel->getAllForMenu('id, nombre', 'nombre', $onlyActiveOnes);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getCcaaListItems($selId = null)
|
||||
{
|
||||
$ccaaModel = model('App\Models\Configuracion\ComunidadAutonomaModel');
|
||||
$onlyActiveOnes = true;
|
||||
$data = $ccaaModel->getAllForMenu('id, nombre', 'nombre', $onlyActiveOnes);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
protected function getAcabadosCubierta()
|
||||
{
|
||||
$model = model('App\Models\Tarifas\Acabados\TarifaAcabadoModel');
|
||||
$data = $model->getServiciosAcabadoCubierta();
|
||||
array_unshift($data, (object) ['id' => '', 'label' => lang('Basic.global.None')]);
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getAcabadosSobrecubierta()
|
||||
{
|
||||
$model = model('App\Models\Tarifas\Acabados\TarifaAcabadoModel');
|
||||
$data = $model->getServiciosAcabadoSobrecubierta();
|
||||
array_unshift($data, (object) ['id' => '', 'label' => lang('Basic.global.None')]);
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getPapelGenerico()
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$POD_value = $this->getPOD();
|
||||
$tirada = $this->request->getGet("tirada");
|
||||
$isPOD = intval($tirada) <= intval($POD_value);
|
||||
|
||||
$tipo_impresion_id = $this->request->getGet("tipo_impresion");
|
||||
$tapa_dura = model('App\Models\Configuracion\TipoPresupuestoModel')->get_isTapaDura(intval($tipo_impresion_id));
|
||||
|
||||
$tipo = $this->request->getGet("tipo");
|
||||
|
||||
$uso = $this->request->getGet("uso") ?? 'interior';
|
||||
$cubierta = false;
|
||||
if ($uso == 'cubierta') {
|
||||
$cubierta = true;
|
||||
}
|
||||
$sobrecubierta = false;
|
||||
if ($uso == 'sobrecubierta') {
|
||||
$sobrecubierta = true;
|
||||
}
|
||||
$guardas = false;
|
||||
if ($uso == 'guardas') {
|
||||
$guardas = true;
|
||||
}
|
||||
$rotativa = false;
|
||||
if ($uso == 'rotativa') {
|
||||
$rotativa = true;
|
||||
}
|
||||
|
||||
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
||||
$query = $model->getPapelForComparador($tipo, $cubierta, $sobrecubierta, $rotativa, $guardas, $tapa_dura, $isPOD);
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("lg_papel_generico.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->orderBy("t1.nombre", "asc")->get()->getResultObject());
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function getGramaje()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$papel_generico_id = $this->request->getGet("papel_generico");
|
||||
|
||||
$POD_value = $this->getPOD();
|
||||
$tirada = $this->request->getGet("tirada");
|
||||
$isPOD = intval($tirada) <= intval($POD_value);
|
||||
|
||||
$tipo_impresion_id = $this->request->getGet("tipo_impresion");
|
||||
$tapa_dura = model('App\Models\Configuracion\TipoPresupuestoModel')->get_isTapaDura(intval($tipo_impresion_id));
|
||||
|
||||
$tipo = $this->request->getGet("tipo");
|
||||
|
||||
$uso = $this->request->getGet("uso") ?? 'interior';
|
||||
$cubierta = false;
|
||||
if ($uso == 'cubierta') {
|
||||
$cubierta = true;
|
||||
}
|
||||
$sobrecubierta = false;
|
||||
if ($uso == 'sobrecubierta') {
|
||||
$sobrecubierta = true;
|
||||
}
|
||||
$guardas = false;
|
||||
if ($uso == 'guardas') {
|
||||
$guardas = true;
|
||||
}
|
||||
$rotativa = false;
|
||||
if ($uso == 'rotativa') {
|
||||
$rotativa = true;
|
||||
}
|
||||
|
||||
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
||||
$query = $model->getGramajeForComparador($tipo, $papel_generico_id, $cubierta, $sobrecubierta, $rotativa, $guardas, $tapa_dura, $isPOD);
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("lg_papel_impresion.gramaje", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->orderBy("t2.gramaje", "asc")->get()->getResultObject());
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getPapelImpresion()
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$papel_generico_id = $this->request->getGet('papel_generico');
|
||||
$gramaje = $this->request->getGet('gramaje');
|
||||
|
||||
$tipo_impresion_id = $this->request->getGet("tipo_impresion");
|
||||
$tapa_dura = model('App\Models\Configuracion\TipoPresupuestoModel')->get_isTapaDura(intval($tipo_impresion_id));
|
||||
|
||||
$tipo = $this->request->getGet("tipo");
|
||||
|
||||
$uso = $this->request->getGet("uso") ?? 'interior';
|
||||
|
||||
$model = model('App\Models\Configuracion\PapelImpresionModel');
|
||||
$query = $model->getPapelesImpresionForMenu(
|
||||
$papel_generico_id,
|
||||
$gramaje,
|
||||
$tipo,
|
||||
$uso,
|
||||
$tapa_dura,
|
||||
false
|
||||
);
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("lg_papel_impresion.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->orderBy("t1.nombre", "asc")->get()->getResultObject());
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getMaquinas()
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$ancho = $this->request->getGet('ancho');
|
||||
$alto = $this->request->getGet('alto');
|
||||
$tirada = $this->request->getGet('tirada');
|
||||
$merma = $this->request->getGet('merma');
|
||||
$tipo_impresion_id = $this->request->getGet('tipo_impresion');
|
||||
$isCosido = (new TipoPresupuestoModel())->get_isCosido($tipo_impresion_id);
|
||||
$papel_impresion_id = $this->request->getGet('papel_impresion');
|
||||
$tarifa_tipo = $this->request->getGet("tarifa_tipo"); // negro, color, negrohq, colorhq
|
||||
$uso_tarifa = $this->request->getGet("uso_tarifa") ?? 'interior'; // interior, cubierta, sobrecubierta
|
||||
$is_rotativa = $this->request->getGet('is_rotativa') ?? 0;
|
||||
$lomo_redondo = $this->request->getGet('lomo_redondo');
|
||||
$lomo = $this->request->getGet('lomo');
|
||||
$solapas = $this->request->getGet('solapas');
|
||||
$solapas_ancho = $this->request->getGet('solapas_ancho');
|
||||
|
||||
$model = model('App\Models\Configuracion\MaquinaModel');
|
||||
$query = $model->getMaquinaImpresionForPresupuesto(
|
||||
$is_rotativa,
|
||||
$tarifa_tipo,
|
||||
$uso_tarifa,
|
||||
intval($tirada) + intval($merma),
|
||||
$papel_impresion_id
|
||||
);
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("lg_maquinas.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
$data = $query->orderBy("t1.nombre", "asc")->get()->getResultObject();
|
||||
|
||||
$query = $model->db->getLastQuery();
|
||||
$datosPedido = ((object) array(
|
||||
'ancho' => $ancho,
|
||||
'alto' => $alto,
|
||||
'isCosido' => $isCosido,
|
||||
'lomo' => $lomo,
|
||||
'solapas' => $solapas,
|
||||
'solapas_ancho' => $solapas_ancho,
|
||||
));
|
||||
|
||||
for ($i = 0; $i < count($data); $i++) {
|
||||
|
||||
if ($is_rotativa) {
|
||||
|
||||
$has_error = true;
|
||||
for ($f = 0; $f < 2; $f++) {
|
||||
|
||||
$parametrosRotativa = (object) array(
|
||||
'a_favor_fibra' => $f,
|
||||
);
|
||||
$values = [];
|
||||
[$values['ancho'], $values['alto']] = PresupuestoService::calculoDimForma($datosPedido, $parametrosRotativa);
|
||||
|
||||
$factor_anchura = round($data[$i]->ancho_impresion / $values['ancho'], 2);
|
||||
|
||||
if (floor($factor_anchura) != 0) {
|
||||
$has_error = false;
|
||||
}
|
||||
}
|
||||
if ($has_error) {
|
||||
unset($data[$i]);
|
||||
}
|
||||
} else {
|
||||
|
||||
if ($uso_tarifa != 'interior') {
|
||||
$datosPedido->anchoExteriores = PresupuestoService::getAnchoTotalExteriores($uso_tarifa, $tipo_impresion_id, $datosPedido, $data[$i]->maquina_id, $lomo_redondo);
|
||||
$datosPedido->altoExteriores = PresupuestoService::getAltoTotalExteriores($uso_tarifa, $tipo_impresion_id, $datosPedido);
|
||||
}
|
||||
|
||||
$ancho_calculo = ($uso_tarifa == 'cubierta' || $uso_tarifa == 'sobrecubierta') ? $datosPedido->anchoExteriores : $datosPedido->ancho;
|
||||
$alto_calculo = ($uso_tarifa == 'cubierta' || $uso_tarifa == 'sobrecubierta') ? $datosPedido->altoExteriores : $datosPedido->alto;
|
||||
$formas = PresupuestoService::getNumFormasPlana($uso_tarifa, $data[$i], $ancho_calculo, $alto_calculo, $datosPedido->isCosido);
|
||||
if ($formas['num_formas']['posicion_formas'] == 'n/a') {
|
||||
unset($data[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->response->setJSON($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected function getServiciosPreimpresion()
|
||||
{
|
||||
$model = model('App\Models\Tarifas\TarifapreimpresionModel');
|
||||
$data = $model->getServiciosPreimpresionSelector();
|
||||
array_unshift($data, (object) array(
|
||||
"value" => 0,
|
||||
"label" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.servicioPreimpresion'))])
|
||||
));
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getServiciosExtra()
|
||||
{
|
||||
$model = model('App\Models\Tarifas\TarifaextraModel');
|
||||
$data = $model->getServiciosExtraSelector();
|
||||
array_unshift($data, (object) array(
|
||||
"value" => 0,
|
||||
"label" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.servicioExtra'))])
|
||||
));
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getServiciosEncuadernacion()
|
||||
{
|
||||
$model = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
||||
$data = $model->getServiciosEncuadernacionSelector();
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getPapelFormatoListItems($selId = null)
|
||||
{
|
||||
$papelFormatoModel = model('App\Models\Configuracion\PapelFormatoModel');
|
||||
$data = $papelFormatoModel->getElementsForMenu();
|
||||
array_shift($data);
|
||||
array_unshift($data, (object) ['id' => '', 'tamanio' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papelFormatoId'))])]);
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getServiciosAcabado()
|
||||
{
|
||||
$model = model('App\Models\Tarifas\Acabados\TarifaAcabadoModel');
|
||||
$data = $model->getServiciosAcabadoSelector();
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getServiciosManipulado()
|
||||
{
|
||||
$model = model('App\Models\Tarifas\TarifaManipuladoModel');
|
||||
$data = $model->getServiciosManipuladoSelector();
|
||||
array_unshift($data, (object) array(
|
||||
"value" => 0,
|
||||
"label" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.servicioManipulado'))])
|
||||
));
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getPOD()
|
||||
{
|
||||
return model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php namespace App\Controllers\Presupuestos;
|
||||
<?php
|
||||
namespace App\Controllers\Presupuestos;
|
||||
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
@ -9,7 +10,7 @@ use App\Models\Presupuestos\PresupuestoEncuadernacionesModel;
|
||||
use DataTables\Editor;
|
||||
use DataTables\Editor\Field;
|
||||
use DataTables\Editor\Validate;
|
||||
|
||||
|
||||
class Presupuestoencuadernaciones extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
|
||||
@ -25,7 +26,7 @@ class Presupuestoencuadernaciones extends \App\Controllers\BaseResourceControlle
|
||||
|
||||
protected static $viewPath = 'themes/vuexy/form/presupuestos/';
|
||||
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
@ -35,20 +36,19 @@ class Presupuestoencuadernaciones extends \App\Controllers\BaseResourceControlle
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
|
||||
if ($requestedId == null) :
|
||||
if ($requestedId == null):
|
||||
return;
|
||||
endif;
|
||||
|
||||
$postData = $this->request->getJSON();
|
||||
$tarifas = array_column($postData->datos, 'tarifa_id');
|
||||
if(count($tarifas)>0){
|
||||
if (count($tarifas) > 0) {
|
||||
$this->model->deleteServiciosNotInArray($requestedId, $tarifas);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$this->model->deleteAllServicios($requestedId);
|
||||
}
|
||||
|
||||
if(count($tarifas)>0){
|
||||
if (count($tarifas) > 0) {
|
||||
$this->model->updateTarifas($requestedId, $postData->datos);
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ class Presupuestoencuadernaciones extends \App\Controllers\BaseResourceControlle
|
||||
$data = [
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ class Presupuestoencuadernaciones extends \App\Controllers\BaseResourceControlle
|
||||
{
|
||||
$tarifaModel = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
||||
|
||||
if ($requestedId == null) :
|
||||
if ($requestedId == null):
|
||||
return;
|
||||
endif;
|
||||
|
||||
@ -78,24 +78,24 @@ class Presupuestoencuadernaciones extends \App\Controllers\BaseResourceControlle
|
||||
$alto = $postData->alto ?? 0;
|
||||
$result = [];
|
||||
|
||||
if(count($tarifas)>0){
|
||||
foreach ($tarifas as $tarifa){
|
||||
if($tarifaModel->isTarifaPorHoras($tarifa)){
|
||||
if (count($tarifas) > 0) {
|
||||
foreach ($tarifas as $tarifa) {
|
||||
if ($tarifaModel->isTarifaPorHoras($tarifa)) {
|
||||
$values = $this->model->getPrecioTarifaHoras($tarifa, $paginas, $tirada, -1, $POD);
|
||||
}else{
|
||||
} else {
|
||||
$values = $this->model->getPrecioTarifa($tarifa, $paginas, $tirada, $ancho, $alto, -1, $POD);
|
||||
}
|
||||
array_push($result, $values);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'lines' => $result,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
@ -105,96 +105,127 @@ class Presupuestoencuadernaciones extends \App\Controllers\BaseResourceControlle
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
$tipo = $reqData['tipo'] ?? null;
|
||||
if(is_null($tipo) || $tipo=='tarifa'){
|
||||
if (is_null($tipo) || $tipo == 'tarifa') {
|
||||
$tarifa_encuadernacion_id = $reqData['tarifa_encuadernacion_id'] ?? 0;
|
||||
$proveedor_id = $reqData['proveedor_id'] ?? 0;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$solapas = $reqData['solapas'] ?? 0;
|
||||
}
|
||||
$paginas = $reqData['paginas'] ?? 0;
|
||||
$tirada = $reqData['tirada'] ?? 0;
|
||||
$ancho = $reqData['ancho'] ?? 0;
|
||||
$alto = $reqData['alto'] ?? 0;
|
||||
|
||||
|
||||
$POD = $reqData['POD'] ?? 0;
|
||||
$paginas_cuadernillo = $reqData['paginas_por_cuadernillo'] ?? null;
|
||||
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
|
||||
$tarifaModel = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
||||
if(is_null($tipo)){
|
||||
if($tarifaModel->isTarifaPorHoras($tarifa_encuadernacion_id)){
|
||||
if (is_null($tipo)) {
|
||||
if ($tarifaModel->isTarifaPorHoras($tarifa_encuadernacion_id)) {
|
||||
$values = $this->model->getPrecioTarifaHoras($tarifa_encuadernacion_id, $paginas, $tirada, $proveedor_id, $POD, $paginas_cuadernillo);
|
||||
}else{
|
||||
} else {
|
||||
$values = $this->model->getPrecioTarifa($tarifa_encuadernacion_id, $paginas, $tirada, $ancho, $alto, $proveedor_id, $POD);
|
||||
}
|
||||
}
|
||||
|
||||
else if($tipo=='tarifa'){
|
||||
if($tarifaModel->isTarifaPorHoras($tarifa_encuadernacion_id)){
|
||||
} else if ($tipo == 'tarifa') {
|
||||
if ($tarifaModel->isTarifaPorHoras($tarifa_encuadernacion_id)) {
|
||||
$values = $this->model->getPrecioTarifaHoras($tarifa_encuadernacion_id, $paginas, $tirada, -1, $POD);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$values = $this->model->getPrecioTarifa($tarifa_encuadernacion_id, $paginas, $tirada, $ancho, $alto, -1, $POD);
|
||||
}
|
||||
}
|
||||
|
||||
else{
|
||||
} else {
|
||||
$tipo_impresion_id = $reqData['tipo_impresion_id'] ?? 4;
|
||||
$values = $this->model->initPresupuesto($tipo_impresion_id, $solapas, $tirada, $paginas, $ancho, $alto, $POD);
|
||||
}
|
||||
|
||||
|
||||
$data = [
|
||||
'values' => $values,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
|
||||
return $this->respond($data);
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getRowValues()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$tarifaModel = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
||||
|
||||
$reqData = $this->request->getPost();
|
||||
|
||||
$tarifa_enc_id = $reqData['tarifa_enc_id'] ?? 0;
|
||||
$tirada = $reqData['tirada'] ?? 0;
|
||||
$paginas = $reqData['paginas'] ?? 0;
|
||||
$ancho = $reqData['ancho'] ?? 0;
|
||||
$alto = $reqData['alto'] ?? 0;
|
||||
$proveedor_id = $reqData['proveedor_id'] ?? -1;
|
||||
$paginas_cuadernillo = $reqData['paginas_por_cuadernillo'] ?? 32;
|
||||
$POD = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
if ($tarifaModel->isTarifaPorHoras($tarifa_enc_id)) {
|
||||
$values = $this->model->getPrecioTarifaHoras($tarifa_enc_id, $paginas, $tirada, $proveedor_id, $POD, $paginas_cuadernillo);
|
||||
} else {
|
||||
$values = $this->model->getPrecioTarifa($tarifa_enc_id, $paginas, $tirada, $ancho, $alto, $proveedor_id, $POD);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'values' => $values,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function menuItems()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$reqData = $this->request->getPost();
|
||||
try{
|
||||
try {
|
||||
|
||||
$tarifa_id = $reqData['tarifa_id'] ?? -1;
|
||||
$paginas = $reqData['paginas'] ?? 0;
|
||||
$tirada = $reqData['tirada'] ?? 0;
|
||||
$ancho = $reqData['ancho'] ?? 0;
|
||||
$alto = $reqData['alto'] ?? 0;
|
||||
//$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
|
||||
$paginas_cuadernillo = $reqData['paginas_por_cuadernillo'] ?? 32;
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
$menu = $this->model->getProveedoresForSelector($tarifa_id, $paginas, $tirada, $ancho, $alto);
|
||||
$menu = $this->model->getProveedoresForSelector($tarifa_id, $paginas, $tirada, $ancho, $alto, $paginas_cuadernillo);
|
||||
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
}
|
||||
catch(Exception $e){
|
||||
} catch (Exception $e) {
|
||||
$data = [
|
||||
'error' => $e,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
}
|
||||
finally{
|
||||
} finally {
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ class Presupuestomanipulados extends \App\Controllers\BaseResourceController
|
||||
|
||||
$tarifa_manipulado_id = $reqData['tarifa_manipulado_id'] ?? 0;
|
||||
$tirada = $reqData['tirada'] ?? 0;
|
||||
$POD = $reqData['POD'] ?? 0;
|
||||
$POD = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||
$tipo = $reqData['tipo'] ?? null;
|
||||
|
||||
|
||||
@ -129,4 +129,29 @@ class Presupuestomanipulados extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
public function getRowValues()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
|
||||
$tarifa_manipulado_id = $reqData['tarifa_manipulado_id'] ?? 0;
|
||||
$tirada = $reqData['tirada'] ?? 0;
|
||||
$POD = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
$values = $this->model->getPrecioTarifa($tarifa_manipulado_id, $tirada, $POD);
|
||||
|
||||
$data = [
|
||||
'values' => $values,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,4 +110,47 @@ class Presupuestopreimpresiones extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
public function getRowValues()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
|
||||
$tarifa_preimpresion_id = $reqData['tarifa_preimpresion_id'] ?? 0;
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
$values = $this->model->getPrecioTarifa($tarifa_preimpresion_id);
|
||||
|
||||
$data = [
|
||||
'values' => $values,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function cargar()
|
||||
{
|
||||
if($this->request->isAJAX()) {
|
||||
$presupuesto_id = $this->request->getGet('presupuesto_id') ?? null;
|
||||
|
||||
$rows = $this->model->getResource($presupuesto_id)->get()->getResultObject();
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'rows' => $rows,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,4 +110,28 @@ class Presupuestoserviciosextra extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
public function getRowValues()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
|
||||
$tarifa_extra_id = $reqData['tarifa_extra_id'] ?? 0;
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
$values = $this->model->getPrecioTarifa($tarifa_extra_id);
|
||||
|
||||
$data = [
|
||||
'values' => $values,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -239,4 +239,25 @@ class Tarifaextra extends \App\Controllers\GoBaseController
|
||||
}
|
||||
}
|
||||
|
||||
public function getSelect2()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"nombre as name"
|
||||
]
|
||||
)->where("deleted_at", null)
|
||||
->where("mostrar_en_presupuesto", 1);
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("tarifa_extra.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -242,4 +242,25 @@ class Tarifapreimpresion extends \App\Controllers\GoBaseController
|
||||
}
|
||||
}
|
||||
|
||||
public function getSelect2()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"nombre as name"
|
||||
]
|
||||
)->where("deleted_at", null)
|
||||
->where("mostrar_en_presupuesto", 1);
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("lg_tarifa_preimpresion.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -356,4 +356,26 @@ class Tarifasencuadernacion extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
return $dimensiones;
|
||||
}
|
||||
|
||||
public function getSelect2()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"nombre as name"
|
||||
]
|
||||
)->where("deleted_at", null)
|
||||
->where("mostrar_en_presupuesto", 1);
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("tarifa_encuadernacion.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -310,4 +310,26 @@ class Tarifasmanipulado extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
}
|
||||
|
||||
public function getSelect2()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"nombre as name"
|
||||
]
|
||||
)->where("deleted_at", null)
|
||||
->where("mostrar_en_presupuesto", 1);
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("lg_tarifa_manipulado.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,9 +84,11 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
$datos = [
|
||||
'tarifa_id'=> $tarifa['tarifa_id'],
|
||||
'tarifa_nombre'=> $tarifa_proveedor->tarifa_enc_nombre,
|
||||
'nombre'=> $tarifa_proveedor->tarifa_enc_nombre,
|
||||
'precio_unidad'=> $result_data[0],
|
||||
'tiempo' => $tiempo,
|
||||
'total'=> $result_data[1],
|
||||
'precio_total'=> $result_data[1],
|
||||
'margen' => $result_data[2],
|
||||
'proveedor' => $tarifa_proveedor->proveedor_nombre,
|
||||
'proveedor_id' => $tarifa_proveedor->proveedor_id,
|
||||
@ -117,10 +119,12 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
(object)[
|
||||
'tarifa_id'=> $tarifa['tarifa_id'],
|
||||
'tarifa_nombre'=> $tarifa['tarifa_nombre'],
|
||||
'nombre'=> $tarifa['tarifa_nombre'],
|
||||
'proveedor' => lang('Presupuestos.no_disponible'),
|
||||
'precio_unidad'=> 0,
|
||||
'tiempo' => null,
|
||||
'total'=> 0,
|
||||
'precio_total'=> 0,
|
||||
'margen' => 0,
|
||||
]);
|
||||
}
|
||||
@ -135,9 +139,11 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
array_push($result_array, (object)[
|
||||
'tarifa_id'=> $tarifa_proveedor->tarifa_enc_id,
|
||||
'tarifa_nombre'=> $tarifa_proveedor->tarifa_enc_nombre,
|
||||
'nombre'=> $tarifa_proveedor->tarifa_enc_nombre,
|
||||
'precio_unidad'=> $result_data[0],
|
||||
'tiempo' => null,
|
||||
'total'=> $result_data[1],
|
||||
'precio_total'=> $result_data[1],
|
||||
'margen'=> $result_data[2],
|
||||
'proveedor' => $tarifa_proveedor->proveedor_nombre,
|
||||
'proveedor_id' => $tarifa_proveedor->proveedor_id,
|
||||
@ -159,10 +165,12 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
(object)[
|
||||
'tarifa_id'=> $tarifa['tarifa_id'] ,
|
||||
'tarifa_nombre'=> $tarifa['tarifa_nombre'],
|
||||
'nombre'=> $tarifa['tarifa_nombre'],
|
||||
'proveedor' => lang('Presupuestos.no_disponible'),
|
||||
'precio_unidad'=> 0,
|
||||
'tiempo' => null,
|
||||
'total'=> 0,
|
||||
'precio_total'=> 0,
|
||||
'margen' => 0,
|
||||
]);
|
||||
}
|
||||
@ -173,17 +181,17 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
}
|
||||
|
||||
|
||||
public function getProveedoresForSelector($tarifa_encuadernacion_id, $paginas, $tirada, $ancho, $alto){
|
||||
public function getProveedoresForSelector($tarifa_encuadernacion_id, $paginas, $tirada, $ancho, $alto, $paginasCuadernillo = 32){
|
||||
|
||||
$proveedores = [];
|
||||
$modelTarifa = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
||||
|
||||
$tiempo = $this->calcularTiempo(16, $paginas, $tirada); // ID fija. Cambiar cuando se metan maquinas de corte. Velocidad en minutos
|
||||
|
||||
if($modelTarifa->isTarifaPorHoras($tarifa_encuadernacion_id)){
|
||||
$tiempo = $this->calcularTiempoCosido(16, $paginas, $tirada, $paginasCuadernillo); // ID fija. Cambiar cuando se metan maquinas de corte. Velocidad en minutos
|
||||
$tarifa_value = $modelTarifa->getTarifaPresupuestoEncuadernacionHoras($tarifa_encuadernacion_id, $tiempo, $tirada);
|
||||
}
|
||||
else{
|
||||
$tiempo = $this->calcularTiempo(16, $paginas, $tirada); // ID fija. Cambiar cuando se metan maquinas de corte. Velocidad en minutos
|
||||
$tarifa_value = $modelTarifa->getTarifaPresupuestoEncuadernacion($tarifa_encuadernacion_id, $paginas, $tirada, $ancho, $alto);
|
||||
}
|
||||
if (count($tarifa_value)>0) {
|
||||
@ -215,9 +223,11 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
array_push($ret_array, (object)[
|
||||
'tarifa_id'=> $tarifa->tarifa_enc_id,
|
||||
'tarifa_nombre'=> $tarifa->tarifa_enc_nombre,
|
||||
'nombre'=> $tarifa->tarifa_enc_nombre,
|
||||
'precio_unidad'=> $result_data[0],
|
||||
'tiempo' => null,
|
||||
'total'=> $result_data[1],
|
||||
'precio_total'=> $result_data[1],
|
||||
'margen'=> $result_data[2],
|
||||
'proveedor' => $tarifa->proveedor_nombre,
|
||||
'proveedor_id' => $tarifa->proveedor_id,
|
||||
@ -237,10 +247,12 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
$ret_array[] = (object)[
|
||||
'tarifa_id'=> $tarifa_encuadernacion_id,
|
||||
'tarifa_nombre'=> $modelTarifa->getNombreTarifaEncuadernacion($tarifa_encuadernacion_id)[0]->nombre,
|
||||
'nombre'=> $modelTarifa->getNombreTarifaEncuadernacion($tarifa_encuadernacion_id)[0]->nombre,
|
||||
'proveedor' => lang('Presupuestos.no_disponible'),
|
||||
'precio_unidad'=> 0,
|
||||
'tiempo' => null,
|
||||
'total'=> 0,
|
||||
'precio_total'=> 0,
|
||||
'margen'=> 0,
|
||||
];
|
||||
return $ret_array;
|
||||
@ -286,9 +298,11 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
(object)[
|
||||
'tarifa_id'=> $tarifa_proveedor->tarifa_enc_id,
|
||||
'tarifa_nombre'=> $tarifa_proveedor->tarifa_enc_nombre,
|
||||
'nombre'=> $tarifa_proveedor->tarifa_enc_nombre,
|
||||
'precio_unidad'=> $result_data[0],
|
||||
'tiempo' => $tiempo,
|
||||
'paginas_por_cuadernillo' => $paginas_cuadernillo,
|
||||
'precio_total'=> $result_data[1],
|
||||
'total'=> $result_data[1],
|
||||
'margen' => $result_data[2],
|
||||
'proveedor' => $tarifa_proveedor->proveedor_nombre,
|
||||
@ -310,11 +324,13 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
$ret_array[] = (object)[
|
||||
'tarifa_id'=> $tarifa_encuadernacion_id,
|
||||
'tarifa_nombre'=> $modelTarifa->getNombreTarifaEncuadernacion($tarifa_encuadernacion_id)[0]->nombre,
|
||||
'nombre'=> $modelTarifa->getNombreTarifaEncuadernacion($tarifa_encuadernacion_id)[0]->nombre,
|
||||
'proveedor' => lang('Presupuestos.no_disponible'),
|
||||
'precio_unidad'=> 0,
|
||||
'tiempo' => null,
|
||||
'paginas_por_cuadernillo' => null,
|
||||
'total'=> 0,
|
||||
'precio_total'=> 0,
|
||||
'margen' => 0,
|
||||
];
|
||||
return $ret_array;
|
||||
|
||||
@ -50,28 +50,37 @@ class PresupuestoManipuladosModel extends \App\Models\BaseModel
|
||||
$modelTarifa = model('App\Models\Tarifas\TarifaManipuladoModel');
|
||||
$tarifa_value = $modelTarifa->getTarifaPresupuestoManipulado($tarifa_manipulado_id, $tirada);
|
||||
if (count($tarifa_value)>0) {
|
||||
$ret_array = [];
|
||||
foreach($tarifa_value as $tarifa){
|
||||
$result_data = $this->calcularTarifa($tarifa, $tirada, $POD<$tirada?false:true);
|
||||
array_push($ret_array, (object)[
|
||||
'tarifa_id'=> $tarifa->tarifa_manipulado_id,
|
||||
'tarifa_nombre'=> $tarifa->tarifa_manipulado_nombre,
|
||||
'nombre'=> $tarifa->tarifa_manipulado_nombre,
|
||||
'precio_unidad'=> $result_data[0],
|
||||
'total'=> $result_data[1],
|
||||
'precio_total'=> $result_data[1],
|
||||
'margen' => $result_data[2],
|
||||
]);
|
||||
}
|
||||
|
||||
usort($ret_array, function($a, $b) {
|
||||
return $a->precio_total <=> $b->precio_total;
|
||||
});
|
||||
|
||||
$result_data = $this->calcularTarifa($tarifa_value[0], $tirada, $POD<$tirada?false:true);
|
||||
$ret_array[] = (object)[
|
||||
'tarifa_id'=> $tarifa_value[0]->tarifa_manipulado_id,
|
||||
'tarifa_nombre'=> $tarifa_value[0]->tarifa_manipulado_nombre,
|
||||
'precio_unidad'=> $result_data[0],
|
||||
'total'=> $result_data[1],
|
||||
'margen' => $result_data[2],
|
||||
];
|
||||
return $ret_array;
|
||||
}
|
||||
else{
|
||||
$ret_array[] = (object)[
|
||||
'tarifa_id'=> $tarifa_manipulado_id,
|
||||
'tarifa_nombre'=> $modelTarifa->getNombreTarifaManipulado($tarifa_manipulado_id)[0]->nombre,
|
||||
'nombre'=> $modelTarifa->getNombreTarifaManipulado($tarifa_manipulado_id)[0]->nombre,
|
||||
'precio_unidad' => 0,
|
||||
'total'=> 0,
|
||||
'margen' => 0,
|
||||
];
|
||||
return $ret_array;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
private function calcularTarifa($tarifa, $tirada, $is_POD=false){
|
||||
@ -170,8 +179,10 @@ class PresupuestoManipuladosModel extends \App\Models\BaseModel
|
||||
array_push($tarifas, (object)[
|
||||
'tarifa_id'=> $tarifa_value[0]->tarifa_manipulado_id,
|
||||
'tarifa_nombre'=> $tarifa_value[0]->tarifa_manipulado_nombre,
|
||||
'nombre'=> $tarifa_value[0]->tarifa_manipulado_nombre,
|
||||
'precio_unidad'=> $result_data[0],
|
||||
'total'=> $result_data[1],
|
||||
'precio_total'=> $result_data[1],
|
||||
'margen'=> $result_data[2],
|
||||
]);
|
||||
}
|
||||
@ -180,8 +191,10 @@ class PresupuestoManipuladosModel extends \App\Models\BaseModel
|
||||
(object)[
|
||||
'tarifa_id'=> $tarifa['tarifa_id'] ,
|
||||
'tarifa_nombre'=> $tarifa['tarifa_nombre'],
|
||||
'nombre'=> $tarifa['tarifa_nombre'],
|
||||
'precio_unidad' => 0,
|
||||
'total'=> 0,
|
||||
'precio_total'=> 0,
|
||||
'margen' => 0,
|
||||
]);
|
||||
}
|
||||
|
||||
@ -51,19 +51,30 @@ class PresupuestoPreimpresionesModel extends \App\Models\BaseModel
|
||||
$tarifa_value = $modelTarifa->getTarifaPresupuestoPreimpresion($tarifa_preimpresion_id);
|
||||
if (count($tarifa_value)>0) {
|
||||
|
||||
$result_data = $this->calcularTarifa($tarifa_value[0]);
|
||||
$ret_array[] = (object)[
|
||||
'tarifa_id'=> $tarifa_value[0]->tarifa_preimpresion_id,
|
||||
'tarifa_nombre'=> $tarifa_value[0]->tarifa_preimpresion_nombre,
|
||||
'precio'=> $result_data[0],
|
||||
'margen'=> $result_data[1],
|
||||
];
|
||||
|
||||
$ret_array = [];
|
||||
foreach ($tarifa_value as $tarifa) {
|
||||
$result_data = $this->calcularTarifa($tarifa);
|
||||
array_push($ret_array, (object)[
|
||||
'tarifa_id'=> $tarifa->tarifa_preimpresion_id,
|
||||
'tarifa_nombre'=> $tarifa->tarifa_preimpresion_nombre,
|
||||
'nombre'=> $tarifa->tarifa_preimpresion_nombre,
|
||||
'precio'=> $result_data[0],
|
||||
'margen'=> $result_data[1],
|
||||
]);
|
||||
}
|
||||
|
||||
usort($ret_array, function($a, $b) {
|
||||
return $a->precio <=> $b->precio;
|
||||
});
|
||||
|
||||
return $ret_array;
|
||||
}
|
||||
else{
|
||||
$ret_array[] = (object)[
|
||||
'tarifa_id'=> $tarifa_preimpresion_id,
|
||||
'tarifa_nombre'=> $modelTarifa->getNombreTarifaPreimpresion($tarifa_preimpresion_id)[0]->nombre,
|
||||
'nombre'=> $modelTarifa->getNombreTarifaPreimpresion($tarifa_preimpresion_id)[0]->nombre,
|
||||
'precio' => 0,
|
||||
'margen' => 0,
|
||||
];
|
||||
@ -146,7 +157,7 @@ class PresupuestoPreimpresionesModel extends \App\Models\BaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS id, t1.tarifa_preimpresion_id AS tarifa_preimpresion_id, t1.precio AS precio, t1.margen AS margen, t2.nombre AS nombre"
|
||||
"t1.id AS id, t1.tarifa_preimpresion_id AS tarifa_preimpresion_id, t1.tarifa_preimpresion_id AS tarifa_id, t1.precio AS precio, t1.margen AS margen, t2.nombre AS nombre"
|
||||
);
|
||||
|
||||
$builder->where('t1.presupuesto_id', $presupuesto_id);
|
||||
|
||||
@ -50,19 +50,27 @@ class PresupuestoServiciosExtraModel extends \App\Models\BaseModel
|
||||
$tarifa_value = $modelTarifa->getTarifaPresupuestoExtra($tarifa_extra_id);
|
||||
if (count($tarifa_value)>0) {
|
||||
|
||||
$result_data = $this->calcularTarifa($tarifa_value[0]);
|
||||
$ret_array[] = (object)[
|
||||
'tarifa_id'=> $tarifa_value[0]->tarifa_extra_id,
|
||||
'tarifa_nombre'=> $tarifa_value[0]->tarifa_extra_nombre,
|
||||
'precio'=> $result_data[0],
|
||||
'margen'=> $result_data[1],
|
||||
];
|
||||
$ret_array = [];
|
||||
foreach($tarifa_value as $tarifa){
|
||||
$result_data = $this->calcularTarifa($tarifa);
|
||||
array_push($ret_array, (object)[
|
||||
'tarifa_id'=> $tarifa->tarifa_extra_id,
|
||||
'tarifa_nombre'=> $tarifa->tarifa_extra_nombre,
|
||||
'nombre'=> $tarifa->tarifa_extra_nombre,
|
||||
'precio'=> $result_data[0],
|
||||
'margen'=> $result_data[1],
|
||||
]);
|
||||
}
|
||||
usort($ret_array, function($a, $b) {
|
||||
return $a->precio <=> $b->precio;
|
||||
});
|
||||
return $ret_array;
|
||||
}
|
||||
else{
|
||||
$ret_array[] = (object)[
|
||||
'tarifa_id'=> $tarifa_extra_id,
|
||||
'tarifa_nombre'=> $modelTarifa->getNombreTarifaExtra($tarifa_extra_id)[0]->nombre,
|
||||
'tarifa'=> $modelTarifa->getNombreTarifaExtra($tarifa_extra_id)[0]->nombre,
|
||||
'precio' => 0,
|
||||
'margen' => 0,
|
||||
];
|
||||
|
||||
@ -55,24 +55,3 @@
|
||||
</div> <!-- //.accordion-item -->
|
||||
</div> <!-- //.accordion -->
|
||||
|
||||
<!------------------------------------------->
|
||||
<!-- Código JS comportamiento general pag. -->
|
||||
<!------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
/*
|
||||
window.paisList = <?php echo json_encode($paisList); ?>;
|
||||
window.direccionesList = <?php echo json_encode($direccionesList); ?>;
|
||||
|
||||
window.routes_envios = {
|
||||
dataTableOfPresupuestoDirecciones: '<?= route_to('dataTableOfPresupuestoDirecciones') ?>'
|
||||
}
|
||||
|
||||
window.url_get_precio_envio = '<?= route_to('processDataDirecciones') ?>';
|
||||
window.error_no_tarifa_envio = '<?= lang('PresupuestosDirecciones.validation.no_tarifa') ?>'
|
||||
window.token_ajax= {<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v};
|
||||
|
||||
$( document ).ready(function() {
|
||||
load_datos_envios();
|
||||
});
|
||||
*/
|
||||
<?= $this->endSection() ?>
|
||||
@ -125,12 +125,6 @@
|
||||
<?=lang('Presupuestos.paisId') ?>
|
||||
</label>
|
||||
<select id="paisId" name="pais_id" class="form-control select2bs" style="width: 100%;" >
|
||||
<option value=""><?=lang('Basic.global.pleaseSelectA', [lang('Presupuestos.paisId')]) ?></option>
|
||||
<?php foreach ($paisList as $item) : ?>
|
||||
<option value="<?=$item->id ?>">
|
||||
<?=$item->nombre ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
@ -127,7 +127,7 @@
|
||||
<th><?= lang('Tarifapreimpresion.tarifapreimpresion') ?></th>
|
||||
<th><?= lang('Tarifapreimpresion.coste') ?></th>
|
||||
<th><?= lang('Presupuestos.precio') ?></th>
|
||||
<th></th>
|
||||
<th><?= lang('Tarifaacabado.margen') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -137,12 +137,6 @@
|
||||
<div class="row mb-3 px-4">
|
||||
<div class="col-md-12 col-lg-4 py-4">
|
||||
<select id="add_servicio_preimpresion_list" class="select2bs2" style="width: 100%;">
|
||||
<option></option>
|
||||
<?php foreach ($serviciosPreimpresion as $item) : ?>
|
||||
<option value="<?= $item->value ?>" >
|
||||
<?= $item->label ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-4 px-2 py-4">
|
||||
@ -164,11 +158,11 @@
|
||||
<th><?= lang('Presupuestos.id') ?></th>
|
||||
<th><?= lang('Presupuestos.tarifa') ?></th>
|
||||
<th><?= lang('Proveedores.proveedor') ?></th>
|
||||
<th><?= lang('Presupuestos.precioUnidad') ?></th>
|
||||
<th><?= lang('Presupuestos.paginasCuadernillo') ?></th>
|
||||
<th><?= lang('Presupuestos.tiempo') ?></th>
|
||||
<th><?= lang('Presupuestos.precioUnidad') ?></th>
|
||||
<th><?= lang('Presupuestos.precioTotal') ?></th>
|
||||
<th></th>
|
||||
<th><?= lang('Tarifaacabado.margen') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -179,12 +173,6 @@
|
||||
<div class="row mb-3 px-4">
|
||||
<div class="col-md-12 col-lg-4 py-4">
|
||||
<select id="add_servicio_enc_list" class="select2bs2" style="width: 100%;">
|
||||
<option></option>
|
||||
<?php foreach ($serviciosEncuadernacion as $item) : ?>
|
||||
<option value="<?= $item->value ?>" >
|
||||
<?= $item->label ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-4 px-2 py-4">
|
||||
@ -207,7 +195,7 @@
|
||||
<th><?= lang('Tarifamanipulado.tarifamanipulado') ?></th>
|
||||
<th><?= lang('Presupuestos.precioUnidad') ?></th>
|
||||
<th><?= lang('Presupuestos.precioTotal') ?></th>
|
||||
<th></th>
|
||||
<th><?= lang('Tarifaacabado.margen') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -217,12 +205,6 @@
|
||||
<div class="row mb-3 px-4">
|
||||
<div class="col-md-12 col-lg-4 py-4">
|
||||
<select id="add_servicio_manipulado_list" class="select2bs2" style="width: 100%;">
|
||||
<option></option>
|
||||
<?php foreach ($serviciosManipulado as $item) : ?>
|
||||
<option value="<?= $item->value ?>" >
|
||||
<?= $item->label ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-4 px-2 py-4">
|
||||
@ -245,7 +227,7 @@
|
||||
<th><?= lang('Tarifaextra.tarifaextra') ?></th>
|
||||
<th><?= lang('Tarifaextra.coste') ?></th>
|
||||
<th><?= lang('Presupuestos.precio') ?></th>
|
||||
<th></th>
|
||||
<th><?= lang('Tarifaacabado.margen') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -255,12 +237,6 @@
|
||||
<div class="row mb-3 px-4">
|
||||
<div class="col-md-12 col-lg-4 py-4">
|
||||
<select id="add_servicio_extra_list" class="select2bs2" style="width: 100%;">
|
||||
<option></option>
|
||||
<?php foreach ($serviciosExtra as $item) : ?>
|
||||
<option value="<?= $item->value ?>" >
|
||||
<?= $item->label ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-4 px-2 py-4">
|
||||
@ -276,91 +252,3 @@
|
||||
</div> <!-- //.accordion-collapse -->
|
||||
</div> <!-- //.accordion-item -->
|
||||
</div> <!-- //.accordion -->
|
||||
|
||||
|
||||
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
// Generación de la lista de servicios de acabado (id, nombre)
|
||||
<?php /*
|
||||
window.acabadosList = <?php echo json_encode($serviciosAcabado); ?>;
|
||||
window.serviciosacabadosList = <?php echo json_encode($serviciosAcabadosList); ?>;
|
||||
window.serviciosAutomaticos = <?php echo json_encode($serviciosAutomaticos); ?>;
|
||||
|
||||
window.serviciosencuadernadosList = <?php echo json_encode($serviciosEncuadernacionList); ?>;
|
||||
|
||||
window.serviciosmanipuladoList = <?php echo json_encode($serviciosManipuladoList); ?>;
|
||||
|
||||
window.serviciospreimpresionList = <?php echo json_encode($serviciosPreimpresionList); ?>;
|
||||
|
||||
window.serviciosextraList = <?php echo json_encode($serviciosExtraList); ?>;
|
||||
|
||||
window.routes_servicios = {
|
||||
dataTableOfPresupuestoAcabados: "<?=route_to('dataTableOfPresupuestoAcabados') ?>",
|
||||
menuItemsOfPresupuestoAcabados: '<?= route_to("menuItemsOfPresupuestoAcabados") ?>',
|
||||
dataTableOfPresupuestoPreimpresion: "<?=route_to('dataTableOfPresupuestoPreimpresiones') ?>",
|
||||
dataTableOfPresupuestoEncuadernaciones: "<?=route_to('dataTableOfPresupuestoEncuadernaciones') ?>",
|
||||
dataTableOfPresupuestoManipulados: "<?=route_to('dataTableOfPresupuestoManipulados') ?>",
|
||||
menuItemsOfPresupuestoEncuadernaciones: '<?= route_to("menuItemsOfPresupuestoEncuadernaciones") ?>',
|
||||
dataTableOfPresupuestoServiciosExtra: "<?=route_to('dataTableOfPresupuestoServiciosExtra') ?>",
|
||||
}
|
||||
|
||||
init_servicio_acabado()
|
||||
|
||||
init_servicio_encuadernado()
|
||||
|
||||
init_servicio_manipulado()
|
||||
|
||||
init_servicio_preimpresion()
|
||||
|
||||
init_servicio_extra()
|
||||
|
||||
/// ELIMINADO PARA COMPROBAR EL MAXIMO DE SOLAPAS DESDE EL BACKEND
|
||||
PENDIENTE
|
||||
$('.solapas_cubierta').on('change', function(){
|
||||
|
||||
const ancho_libro = getDimensionLibro().ancho;
|
||||
|
||||
// ancho_libro*2 + lomo + solapas*2 <= 630
|
||||
const limite_1 = ((630 - ancho_libro*2 - getLomoLineasPresupuesto()) / 2.0).toFixed(1);
|
||||
// solapas <= ancho_libro - 10
|
||||
const limite_2 = ancho_libro - 10;
|
||||
const limite = Math.min(limite_1, limite_2);
|
||||
|
||||
if(parseInt($('#solapas_ancho').val()) > limite){
|
||||
$('#solapas_ancho').val(limite)
|
||||
asyncMessageDialog(
|
||||
window.Presupuestos.advertencia,
|
||||
window.Presupuestos.actualizacionSolapasCubierta,
|
||||
function(){});
|
||||
}
|
||||
|
||||
$('#compGramajeCubierta').trigger('change')
|
||||
|
||||
})
|
||||
|
||||
|
||||
$('.solapas_sobrecubierta').on('change', function(){
|
||||
|
||||
const ancho_libro = getDimensionLibro().ancho;
|
||||
|
||||
// ancho_libro*2 + lomo + solapas*2 <= 630
|
||||
const limite_1 = ((630 - ancho_libro*2 - getLomoLineasPresupuesto()) / 2.0).toFixed(1);
|
||||
// solapas <= ancho_libro - 10
|
||||
const limite_2 = ancho_libro - 10;
|
||||
const limite = Math.min(limite_1, limite_2);
|
||||
|
||||
if(parseInt($('#solapas_ancho_sobrecubierta').val()) > limite){
|
||||
$('#solapas_ancho_sobrecubierta').val(limite)
|
||||
asyncMessageDialog(
|
||||
window.Presupuestos.advertencia,
|
||||
window.Presupuestos.actualizacionSolapasSobrecubierta,
|
||||
function(){});
|
||||
}
|
||||
|
||||
$('#compGramajeSobrecubierta').trigger('change')
|
||||
})
|
||||
|
||||
*/?>
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
@ -70,36 +70,3 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!------------------------------------------->
|
||||
<!-- Código JS de las lineas de presupuesto. -->
|
||||
<!------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
/*window.papelGenericoNegroList = [];
|
||||
window.papelGenericoNegroHQList = [];
|
||||
window.papelGenericoColorList = [];
|
||||
window.papelGenericoColorHQList = [];
|
||||
window.papelGenericoCubiertaList = [];
|
||||
window.papelGenericoSobrecubiertaList = [];
|
||||
window.papelGenericoRotativaNegroList = [];
|
||||
window.papelGenericoRotativaColorList = [];
|
||||
|
||||
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
|
||||
window.papelGenericoGuardasList = [];
|
||||
<?php endif; ?>
|
||||
|
||||
window.lineasPresupuestoList = <?php echo json_encode($lineasPresupuesto); ?>;
|
||||
|
||||
window.routes_lp = {
|
||||
menuItemsOfPresupuestoAdmin: '<?= route_to("menuItemsOfPresupuestoAdmin") ?>',
|
||||
updateDataOfPresupuestoAdmin: '<?= route_to("updateDataOfPresupuestoAdmin") ?>',
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
fill_lp_from_bbdd()
|
||||
|
||||
checkPaginasPresupuesto()
|
||||
*/
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
@ -47,12 +47,6 @@
|
||||
<?=lang('PresupuestosDirecciones.pais') ?>*
|
||||
</label>
|
||||
<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':'' ?>>
|
||||
<?=$item->nombre ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
|
||||
@ -123,7 +123,7 @@ class PresupuestoAdminEdit {
|
||||
self.comparador.cargarDatos(response.data.comparador);
|
||||
self.lineasPresupuesto.cargarDatos(response.data.lineasPresupuesto);
|
||||
|
||||
self.servicios.cargar();
|
||||
self.servicios.cargar(response.data.servicios);
|
||||
/*self.direcciones.handleChangeCliente();
|
||||
|
||||
self.direcciones.cargarDatos(response.data.direcciones, response.data.datosGenerales);
|
||||
|
||||
@ -195,6 +195,8 @@ class Comparador {
|
||||
|
||||
initSelect2() {
|
||||
|
||||
const self = this;
|
||||
|
||||
this.paginasCubierta.select2({
|
||||
allowClear: false,
|
||||
minimumResultsForSearch: Infinity,
|
||||
@ -240,7 +242,7 @@ class Comparador {
|
||||
});
|
||||
this.papelSobrecubierta.init();
|
||||
this.gramajeSobrecubierta.init();
|
||||
this.papelSobrecubierta.onChange(() => this.gramajeSobrecubierta.setVal(0))
|
||||
this.papelSobrecubierta.onChange(() => self.gramajeSobrecubierta.empty());
|
||||
this.sobrecubierta.on('change', () => {
|
||||
if (this.sobrecubierta.val() == 1) {
|
||||
$('#solapas_sobrecubierta').prop('checked', true);
|
||||
@ -262,15 +264,14 @@ class Comparador {
|
||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3 || this.tipo_impresion_id == 5 || this.tipo_impresion_id == 7) {
|
||||
this.papelGuardas.init();
|
||||
this.gramajeGuardas.init();
|
||||
this.papelGuardas.onChange(() => this.gramajeGuardas.setVal(0))
|
||||
this.papelGuardas.onChange(() => self.gramajeGuardas.empty());
|
||||
}
|
||||
|
||||
this.papelNegro.onChange(() => this.gramajeNegro.setVal(0))
|
||||
this.papelNegrohq.onChange(() => this.gramajeNegrohq.setVal(0))
|
||||
this.papelColor.onChange(() => this.gramajeColor.setVal(0))
|
||||
this.papelColorhq.onChange(() => this.gramajeColorhq.setVal(0))
|
||||
this.papelCubierta.onChange(() => this.gramajeCubierta.setVal(0))
|
||||
this.papelCubierta.onChange(() => this.gramajeSobrecubierta.setVal(0))
|
||||
this.papelNegro.onChange(() => self.gramajeNegro.empty());
|
||||
this.papelNegrohq.onChange(() => self.gramajeNegrohq.empty());
|
||||
this.papelColor.onChange(() => self.gramajeColor.empty());
|
||||
this.papelColorhq.onChange(() => self.gramajeColorhq.empty());
|
||||
this.papelCubierta.onChange(() => self.gramajeCubierta.empty());
|
||||
|
||||
|
||||
this.tipo_impresion.select2({
|
||||
|
||||
@ -15,9 +15,10 @@ class DatosGenerales{
|
||||
this.coleccion = this.domItem.find('#coleccion');
|
||||
this.numeroEdicion = this.domItem.find('#numeroEdicion');
|
||||
this.isbn = this.domItem.find('#isbn');
|
||||
this.pais = this.domItem.find('#paisId');
|
||||
|
||||
|
||||
this.cliente = new ClassSelect($('#clienteId'), '/clientes/cliente/getSelect2', 'Seleccione cliente');
|
||||
this.pais = new ClassSelect($('#paisId'), '/paises/menuitems2', 'Seleccione País');
|
||||
this.referenciaCliente = this.domItem.find('#referenciaCliente');
|
||||
|
||||
}
|
||||
@ -25,14 +26,11 @@ class DatosGenerales{
|
||||
init(){
|
||||
|
||||
this.cliente.init();
|
||||
this.pais.init();
|
||||
|
||||
this.inc_rei.select2({
|
||||
allowClear: false,
|
||||
});
|
||||
|
||||
this.pais.select2({
|
||||
allowClear: false,
|
||||
});
|
||||
}
|
||||
|
||||
cargarDatos(datos){
|
||||
@ -46,9 +44,10 @@ class DatosGenerales{
|
||||
this.coleccion.val(datos.coleccion);
|
||||
this.numeroEdicion.val(datos.numero_edicion);
|
||||
this.isbn.val(datos.isbn);
|
||||
this.pais.val(datos.pais).trigger('change');
|
||||
|
||||
|
||||
this.cliente.setOption(datos.cliente.id, datos.cliente.nombre);
|
||||
this.pais.setOption(datos.pais, datos.pais_nombre);
|
||||
this.referenciaCliente.val(datos.referenciaCliente);
|
||||
}
|
||||
}
|
||||
|
||||
@ -219,10 +219,10 @@ class DatosLibro {
|
||||
changeSolapasCubierta() {
|
||||
|
||||
if (this.solapasCubierta.prop('checked')) {
|
||||
$('#div_solapas_ancho_sobrecubierta').removeClass('d-none');
|
||||
$('#div_solapas_ancho').removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
$('#div_solapas_ancho_sobrecubierta').divSolapasCubierta.addClass('d-none');
|
||||
$('#div_solapas_ancho').divSolapasCubierta.addClass('d-none');
|
||||
this.anchoSolapasCubierta.val(0);
|
||||
}
|
||||
$('#serv_default').trigger('click');
|
||||
@ -327,7 +327,7 @@ class DatosLibro {
|
||||
}
|
||||
else{
|
||||
let merma_lineas = []
|
||||
tableLineasPresupuesto.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
||||
$('#tableLineasPresupuesto').DataTable().rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
||||
var rowData = this.data();
|
||||
if(rowData.row_id != 'lp_guardas' && rowData.row_id != 'lp_cubierta' && rowData.row_id != 'lp_sobrecubierta'){
|
||||
const formas_linea = parseInt($('#isCosido').val())==0?parseInt(rowData.formas):parseInt(rowData.formas)/2
|
||||
@ -350,7 +350,7 @@ class DatosLibro {
|
||||
</span>
|
||||
<div class="d-flex flex-column ps-1">
|
||||
<h5 class="alert-heading mb-2">` +
|
||||
window.Presupuestos.validation.no_lp_for_merma +
|
||||
window.language.Presupuestos.validation.no_lp_for_merma +
|
||||
`</h5>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user