mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
finalizado servicios encuadernado
This commit is contained in:
@ -988,10 +988,10 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
{
|
||||
$model = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
||||
$data = $model->getServiciosEncuadernacionSelector();
|
||||
array_unshift($data, (object)array(
|
||||
/*array_unshift($data, (object)array(
|
||||
"value" => 0,
|
||||
"label" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.servicioEncuadernado'))])
|
||||
));
|
||||
));*/
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
@ -32,22 +32,62 @@ class Presupuestoencuadernaciones extends \App\Controllers\GoBaseResourceControl
|
||||
}
|
||||
|
||||
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
|
||||
if ($requestedId == null) :
|
||||
return;
|
||||
endif;
|
||||
|
||||
$postData = $this->request->getJSON();
|
||||
$tarifas = array_column($postData->datos, 'tarifa_id');
|
||||
if(count($tarifas)>0){
|
||||
$this->model->deleteServiciosNotInArray($requestedId, $tarifas);
|
||||
}
|
||||
else{
|
||||
$this->model->deleteAllServicios($requestedId);
|
||||
}
|
||||
|
||||
$this->model->updateTarifas($requestedId, $postData->datos);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
$tarifa_encuadernacion_id = $reqData['tarifa_encuadernacion_id'] ?? 0;
|
||||
$tipo = $reqData['tipo'] ?? null;
|
||||
if(is_null($tipo) || $tipo=='tarifa'){
|
||||
$tarifa_encuadernacion_id = $reqData['tarifa_encuadernacion_id'] ?? 0;
|
||||
$proveedor_id = $reqData['proveedor_id'] ?? 0;
|
||||
}
|
||||
else{
|
||||
$solapas = $reqData['solapas'] ?? -1;
|
||||
}
|
||||
$paginas = $reqData['paginas'] ?? 0;
|
||||
$tirada = $reqData['tirada'] ?? 0;
|
||||
$ancho = $reqData['ancho'] ?? 0;
|
||||
$alto = $reqData['alto'] ?? 0;
|
||||
$proveedor_id = $reqData['proveedor_id'] ?? 0;
|
||||
|
||||
$POD = $reqData['POD'] ?? 0;
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
$values = $this->model->getPrecioTarifa($tarifa_encuadernacion_id, $paginas, $tirada, $ancho, $alto, $proveedor_id, $POD);
|
||||
if(is_null($tipo))
|
||||
$values = $this->model->getPrecioTarifa($tarifa_encuadernacion_id, $paginas, $tirada, $ancho, $alto, $proveedor_id, $POD);
|
||||
else if($tipo=='tarifa')
|
||||
$values = $this->model->getPrecioTarifa($tarifa_encuadernacion_id, $paginas, $tirada, $ancho, $alto, -1, $POD);
|
||||
else
|
||||
$values = $this->model->initPresupuesto(4, $solapas, $tirada, $paginas, $ancho, $alto, $POD);
|
||||
$data = [
|
||||
'values' => $values,
|
||||
$csrfTokenName => $newTokenHash
|
||||
|
||||
@ -83,7 +83,6 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
@ -156,7 +155,6 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
@ -177,6 +177,15 @@ class Tarifasencuadernacion extends \App\Controllers\GoBaseResourceController
|
||||
if ($this->request->getPost('mostrar_en_presupuesto') == null) {
|
||||
$sanitizedData['mostrar_en_presupuesto'] = false;
|
||||
}
|
||||
|
||||
if ($this->request->getPost('tipo_encuadernacion') == null) {
|
||||
$sanitizedData['tipo_encuadernacion'] = false;
|
||||
}
|
||||
|
||||
if ($this->request->getPost('servicio_encuadernacion') == null) {
|
||||
$sanitizedData['servicio_encuadernacion'] = false;
|
||||
}
|
||||
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
@ -18,12 +18,12 @@ class Test extends BaseController
|
||||
public function index()
|
||||
{
|
||||
echo '<pre>';
|
||||
var_dump($this->get_precio_tarifa(1,200,110,150,210, 8, 30)['precio_unidad']);
|
||||
//var_dump($this->get_precio_tarifa(18,200,110,150,210, 115, 30));
|
||||
|
||||
//$model = model('App\Models\Configuracion\ConfiguracionSistemaModel');
|
||||
//var_dump($this->init_presupuesto_encuadernacion(4, 1, 300, 100, 150, 210, 30) );
|
||||
|
||||
//var_dump($this->get_tarifa_enc(1, 100, 300, 150, 210));
|
||||
var_dump($this->get_tarifa_enc(18, 200, 110, 150, 210));
|
||||
echo '</pre>';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user