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:
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user