mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
arraglado solapas en servicios manipulado por defecto
This commit is contained in:
@ -102,11 +102,18 @@ class Presupuestomanipulados extends \App\Controllers\GoBaseResourceController
|
|||||||
$tarifa_manipulado_id = $reqData['tarifa_manipulado_id'] ?? 0;
|
$tarifa_manipulado_id = $reqData['tarifa_manipulado_id'] ?? 0;
|
||||||
$tirada = $reqData['tirada'] ?? 0;
|
$tirada = $reqData['tirada'] ?? 0;
|
||||||
$POD = $reqData['POD'] ?? 0;
|
$POD = $reqData['POD'] ?? 0;
|
||||||
|
$tipo = $reqData['tipo'] ?? null;
|
||||||
|
|
||||||
$newTokenHash = csrf_hash();
|
$newTokenHash = csrf_hash();
|
||||||
$csrfTokenName = csrf_token();
|
$csrfTokenName = csrf_token();
|
||||||
|
|
||||||
$values = $this->model->getPrecioTarifa($tarifa_manipulado_id, $tirada, $POD);
|
if(is_null($tipo)){
|
||||||
|
$values = $this->model->getPrecioTarifa($tarifa_manipulado_id, $tirada, $POD);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$solapas = $reqData['solapas'] ?? -1;
|
||||||
|
$values = $this->model->initPresupuesto(4, $solapas, $tirada, $POD);
|
||||||
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'values' => $values,
|
'values' => $values,
|
||||||
|
|||||||
@ -17,9 +17,9 @@ class Test extends BaseController
|
|||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$model = model('App\Models\Tarifas\TarifaManipuladoModel');
|
$model = model('App\Models\Presupuestos\TipoPresupuestoServiciosDefectoModel');
|
||||||
echo '<pre>';
|
echo '<pre>';
|
||||||
var_dump($model->getTarifaPresupuestoManipulado(21, 200));
|
var_dump($model->get_tarifas(4,0,"manipulado"));
|
||||||
echo '</pre>';
|
echo '</pre>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
32
ci4/app/Entities/Presupuestos/TipoPresupuestoServiciosDefecto.php
Executable file
32
ci4/app/Entities/Presupuestos/TipoPresupuestoServiciosDefecto.php
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Entities\Presupuestos;
|
||||||
|
|
||||||
|
use CodeIgniter\Entity;
|
||||||
|
|
||||||
|
class TipoPresupuestoServiciosDefecto extends \CodeIgniter\Entity\Entity
|
||||||
|
{
|
||||||
|
protected $attributes = [
|
||||||
|
"id" => null,
|
||||||
|
"tipo_presupuesto_id" => null,
|
||||||
|
"tarifa_id" => null,
|
||||||
|
"solapas" => null,
|
||||||
|
"is_servicio_encuadernacion" => null,
|
||||||
|
"is_servicio_acabado" => null,
|
||||||
|
"is_servicio_manipulado" => null,
|
||||||
|
"is_servicio_preimpresion" => null,
|
||||||
|
"is_deleted" => 0,
|
||||||
|
"deleted_at" => null,
|
||||||
|
"created_at" => null,
|
||||||
|
"updated_at" => null,
|
||||||
|
];
|
||||||
|
protected $casts = [
|
||||||
|
"tipo_presupuesto_id" => "int",
|
||||||
|
"tarifa_id" => "int",
|
||||||
|
"solapas" => "int",
|
||||||
|
"is_servicio_encuadernacion" => "int",
|
||||||
|
"is_servicio_acabado" => "int",
|
||||||
|
"is_servicio_manipulado" => "int",
|
||||||
|
"is_servicio_preimpresion" => "int",
|
||||||
|
"is_deleted" => "int",
|
||||||
|
];
|
||||||
|
}
|
||||||
@ -1,24 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace App\Entities\Presupuestos;
|
|
||||||
|
|
||||||
use CodeIgniter\Entity;
|
|
||||||
|
|
||||||
class TipoPresupuestoTarifaEncuadernacion extends \CodeIgniter\Entity\Entity
|
|
||||||
{
|
|
||||||
protected $attributes = [
|
|
||||||
"id" => null,
|
|
||||||
"tipo_presupuesto_id" => null,
|
|
||||||
"tarifa_encuadernacion_id" => null,
|
|
||||||
"solapas" => null,
|
|
||||||
"is_deleted" => 0,
|
|
||||||
"deleted_at" => null,
|
|
||||||
"created_at" => null,
|
|
||||||
"updated_at" => null,
|
|
||||||
];
|
|
||||||
protected $casts = [
|
|
||||||
"tipo_presupuesto_id" => "int",
|
|
||||||
"tarifa_encuadernacion_id" => "int",
|
|
||||||
"solapas" => "int",
|
|
||||||
"is_deleted" => "int",
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@ -142,7 +142,7 @@ return [
|
|||||||
|
|
||||||
'addLineaPresupuesto' => 'Add line...',
|
'addLineaPresupuesto' => 'Add line...',
|
||||||
|
|
||||||
'serviciosEncDefault' => 'Default binding services',
|
'serviciosDefault' => 'Default services',
|
||||||
|
|
||||||
'validation' => [
|
'validation' => [
|
||||||
'decimal' => 'The {field} field must contain a decimal number.',
|
'decimal' => 'The {field} field must contain a decimal number.',
|
||||||
|
|||||||
@ -173,7 +173,7 @@ return [
|
|||||||
'precio' => 'Precio',
|
'precio' => 'Precio',
|
||||||
'precioUnidad' => 'Precio unitario',
|
'precioUnidad' => 'Precio unitario',
|
||||||
'precioTotal' => 'Precio total',
|
'precioTotal' => 'Precio total',
|
||||||
'serviciosEncDefault' => 'Servicios Enc. por defecto',
|
'serviciosDefault' => 'Servicios por defecto',
|
||||||
'tarifa' => 'Tarifa',
|
'tarifa' => 'Tarifa',
|
||||||
'insertar' => 'Insertar',
|
'insertar' => 'Insertar',
|
||||||
'no_disponible' => 'No disponible',
|
'no_disponible' => 'No disponible',
|
||||||
|
|||||||
@ -50,8 +50,8 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel
|
|||||||
|
|
||||||
public function initPresupuesto($tipo_presupuesto, $solapas, $tirada, $paginas, $ancho, $alto, $POD){
|
public function initPresupuesto($tipo_presupuesto, $solapas, $tirada, $paginas, $ancho, $alto, $POD){
|
||||||
|
|
||||||
$model = model('App\Models\Presupuestos\TipoPresupuestoTarifaEncuadernacionModel');
|
$model = model('App\Models\Presupuestos\TipoPresupuestoServiciosDefectoModel');
|
||||||
$tarifas_procesar = $model->get_tarifas($tipo_presupuesto,$solapas);
|
$tarifas_procesar = $model->get_tarifas($tipo_presupuesto,$solapas, "encuadernacion");
|
||||||
|
|
||||||
$modelTarifa = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
$modelTarifa = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
||||||
$tarifas = [];
|
$tarifas = [];
|
||||||
@ -59,11 +59,11 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel
|
|||||||
|
|
||||||
foreach($tarifas_procesar as $tarifa){
|
foreach($tarifas_procesar as $tarifa){
|
||||||
|
|
||||||
if($modelTarifa->isTarifaPorHoras($tarifa['tarifa_encuadernacion_id'])){
|
if($modelTarifa->isTarifaPorHoras($tarifa['tarifa_id'])){
|
||||||
|
|
||||||
$tiempo = $this->calcularTiempo(16, $paginas, $tirada); // ID fija. Cambiar cuando se metan maquinas de corte. Velocidad en minutos
|
$tiempo = $this->calcularTiempo(16, $paginas, $tirada); // ID fija. Cambiar cuando se metan maquinas de corte. Velocidad en minutos
|
||||||
|
|
||||||
$tarifa_value = $modelTarifa->getTarifaPresupuestoEncuadernacionHoras($tarifa['tarifa_encuadernacion_id'], $tiempo, $tirada);
|
$tarifa_value = $modelTarifa->getTarifaPresupuestoEncuadernacionHoras($tarifa['tarifa_id'], $tiempo, $tirada);
|
||||||
if (count($tarifa_value)>0) {
|
if (count($tarifa_value)>0) {
|
||||||
|
|
||||||
$result_data[0] = floatval(1.0* $tarifa_value[0]->precio_hora* $tiempo / $tirada);
|
$result_data[0] = floatval(1.0* $tarifa_value[0]->precio_hora* $tiempo / $tirada);
|
||||||
@ -73,7 +73,7 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel
|
|||||||
}
|
}
|
||||||
array_push($tarifas,
|
array_push($tarifas,
|
||||||
(object)[
|
(object)[
|
||||||
'tarifa_id'=> $tarifa['tarifa_encuadernacion_id'],
|
'tarifa_id'=> $tarifa['tarifa_id'],
|
||||||
'tarifa_nombre'=> $tarifa_value[0]->tarifa_enc_nombre,
|
'tarifa_nombre'=> $tarifa_value[0]->tarifa_enc_nombre,
|
||||||
'precio_unidad'=> $result_data[0],
|
'precio_unidad'=> $result_data[0],
|
||||||
'total'=> $result_data[1],
|
'total'=> $result_data[1],
|
||||||
@ -84,8 +84,8 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel
|
|||||||
else{
|
else{
|
||||||
array_push($tarifas,
|
array_push($tarifas,
|
||||||
(object)[
|
(object)[
|
||||||
'tarifa_id'=> $tarifa['tarifa_encuadernacion_id'],
|
'tarifa_id'=> $tarifa['tarifa_id'],
|
||||||
'tarifa_nombre'=> $tarifa['tarifa_encuadernacion_nombre'],
|
'tarifa_nombre'=> $tarifa['tarifa_nombre'],
|
||||||
'proveedor' => lang('Presupuestos.no_disponible'),
|
'proveedor' => lang('Presupuestos.no_disponible'),
|
||||||
'precio_unidad'=> 0,
|
'precio_unidad'=> 0,
|
||||||
'total'=> 0,
|
'total'=> 0,
|
||||||
@ -93,12 +93,12 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$tarifa_value = $modelTarifa->getTarifaPresupuestoEncuadernacion($tarifa['tarifa_encuadernacion_id'], $paginas, $tirada, $ancho, $alto);
|
$tarifa_value = $modelTarifa->getTarifaPresupuestoEncuadernacion($tarifa['tarifa_id'], $paginas, $tirada, $ancho, $alto);
|
||||||
if (count($tarifa_value)>0) {
|
if (count($tarifa_value)>0) {
|
||||||
$result_data = $this->calcularTarifa($tarifa_value[0], $paginas, $POD<$tirada?false:true);
|
$result_data = $this->calcularTarifa($tarifa_value[0], $paginas, $POD<$tirada?false:true);
|
||||||
array_push($tarifas,
|
array_push($tarifas,
|
||||||
(object)[
|
(object)[
|
||||||
'tarifa_id'=> $tarifa['tarifa_encuadernacion_id'],
|
'tarifa_id'=> $tarifa['tarifa_id'],
|
||||||
'tarifa_nombre'=> $tarifa_value[0]->tarifa_enc_nombre,
|
'tarifa_nombre'=> $tarifa_value[0]->tarifa_enc_nombre,
|
||||||
'precio_unidad'=> $result_data[0],
|
'precio_unidad'=> $result_data[0],
|
||||||
'total'=> $result_data[1],
|
'total'=> $result_data[1],
|
||||||
@ -109,8 +109,8 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel
|
|||||||
else{
|
else{
|
||||||
array_push($tarifas,
|
array_push($tarifas,
|
||||||
(object)[
|
(object)[
|
||||||
'tarifa_id'=> $tarifa['tarifa_encuadernacion_id'] ,
|
'tarifa_id'=> $tarifa['tarifa_id'] ,
|
||||||
'tarifa_nombre'=> $tarifa['tarifa_encuadernacion_nombre'],
|
'tarifa_nombre'=> $tarifa['tarifa_nombre'],
|
||||||
'proveedor' => lang('Presupuestos.no_disponible'),
|
'proveedor' => lang('Presupuestos.no_disponible'),
|
||||||
'precio_unidad'=> 0,
|
'precio_unidad'=> 0,
|
||||||
'total'=> 0,
|
'total'=> 0,
|
||||||
|
|||||||
@ -140,6 +140,43 @@ class PresupuestoManipuladosModel extends \App\Models\GoBaseModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function initPresupuesto($tipo_presupuesto, $solapas, $tirada, $POD){
|
||||||
|
|
||||||
|
$model = model('App\Models\Presupuestos\TipoPresupuestoServiciosDefectoModel');
|
||||||
|
$tarifas_procesar = $model->get_tarifas($tipo_presupuesto, $solapas, "manipulado");
|
||||||
|
|
||||||
|
$modelTarifa = model('App\Models\Tarifas\TarifaManipuladoModel');
|
||||||
|
$tarifas = [];
|
||||||
|
|
||||||
|
|
||||||
|
foreach($tarifas_procesar as $tarifa){
|
||||||
|
|
||||||
|
$tarifa_value = $modelTarifa->getTarifaPresupuestoManipulado($tarifa['tarifa_id'], $tirada);
|
||||||
|
if (count($tarifa_value)>0) {
|
||||||
|
$result_data = $this->calcularTarifa($tarifa_value[0], $tirada, $POD<$tirada?false:true);
|
||||||
|
array_push($tarifas, (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],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
array_push($tarifas,
|
||||||
|
(object)[
|
||||||
|
'tarifa_id'=> $tarifa['tarifa_id'] ,
|
||||||
|
'tarifa_nombre'=> $tarifa['tarifa_nombre'],
|
||||||
|
'precio_unidad' => 0,
|
||||||
|
'total'=> 0,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tarifas;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get resource data.
|
* Get resource data.
|
||||||
*
|
*
|
||||||
|
|||||||
89
ci4/app/Models/Presupuestos/TipoPresupuestoServiciosDefectoModel.php
Executable file
89
ci4/app/Models/Presupuestos/TipoPresupuestoServiciosDefectoModel.php
Executable file
@ -0,0 +1,89 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Presupuestos;
|
||||||
|
|
||||||
|
class TipoPresupuestoServiciosDefectoModel extends \App\Models\GoBaseModel
|
||||||
|
{
|
||||||
|
protected $table = "tipos_presupuestos_servicios_defecto";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether primary key uses auto increment.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $useAutoIncrement = true;
|
||||||
|
|
||||||
|
protected $allowedFields = [
|
||||||
|
"tipo_presupuesto_id",
|
||||||
|
"tarifa_id",
|
||||||
|
"solapas",
|
||||||
|
"is_servicio_encuadernacion",
|
||||||
|
"is_servicio_acabado",
|
||||||
|
"is_servicio_manipulado",
|
||||||
|
"is_servicio_preimpresion",
|
||||||
|
"is_deleted"];
|
||||||
|
protected $returnType = "App\Entities\Presupuestos\TipoPresupuestoServiciosDefecto";
|
||||||
|
|
||||||
|
protected $useTimestamps = true;
|
||||||
|
protected $useSoftDeletes = false;
|
||||||
|
|
||||||
|
protected $createdField = "created_at";
|
||||||
|
protected $updatedField = "updated_at";
|
||||||
|
|
||||||
|
public static $labelField = "tipo_presupuesto_id";
|
||||||
|
|
||||||
|
public function get_tarifas($tipo_presupuesto=-1, $solapas=0, $tipo=""){
|
||||||
|
|
||||||
|
$where = "(t1.solapas=2) OR (t1.solapas=" . $solapas . ")";
|
||||||
|
|
||||||
|
$builder = $this->db
|
||||||
|
->table($this->table . " t1")
|
||||||
|
->where("t1.tipo_presupuesto_id", $tipo_presupuesto);
|
||||||
|
|
||||||
|
if(strcmp($tipo, "encuadernacion")==0){
|
||||||
|
|
||||||
|
$builder->join("tarifa_encuadernacion t2", "t1.tarifa_id = t2.id", "left");
|
||||||
|
$builder->where("is_servicio_encuadernacion", 1);
|
||||||
|
$builder->where("is_servicio_acabado", 0);
|
||||||
|
$builder->where("is_servicio_manipulado", 0);
|
||||||
|
$builder->where("is_servicio_preimpresion", 0);
|
||||||
|
}
|
||||||
|
else if(strcmp($tipo, "acabado")==0){
|
||||||
|
|
||||||
|
$builder->join("lg_tarifa_acabado t2", "t1.tarifa_id = t2.id", "left");
|
||||||
|
$builder->where("is_servicio_acabado", 1);
|
||||||
|
$builder->where("is_servicio_encuadernacion", 0);
|
||||||
|
$builder->where("is_servicio_manipulado", 0);
|
||||||
|
$builder->where("is_servicio_preimpresion", 0);
|
||||||
|
}
|
||||||
|
else if(strcmp($tipo, "manipulado")==0){
|
||||||
|
|
||||||
|
$builder->join("lg_tarifa_manipulado t2", "t1.tarifa_id = t2.id", "left");
|
||||||
|
$builder->where("is_servicio_manipulado", 1);
|
||||||
|
$builder->where("is_servicio_encuadernacion", 0);
|
||||||
|
$builder->where("is_servicio_acabado", 0);
|
||||||
|
$builder->where("is_servicio_preimpresion", 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(strcmp($tipo, "preimpresion")==0){
|
||||||
|
|
||||||
|
$builder->join("lg_tarifa_preimpresion t2", "t1.tarifa_id = t2.id", "left");
|
||||||
|
$builder->where("is_servicio_preimpresion", 1);
|
||||||
|
$builder->where("is_servicio_encuadernacion", 0);
|
||||||
|
$builder->where("is_servicio_acabado", 0);
|
||||||
|
$builder->where("is_servicio_manipulado", 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$where = "t1.solapas IS NULL OR t1.solapas='" . $solapas . "'";
|
||||||
|
$builder->where($where);
|
||||||
|
|
||||||
|
$builder->where("t2.is_deleted", 0);
|
||||||
|
$builder->select("t1.tarifa_id AS tarifa_id, t2.nombre AS tarifa_nombre");
|
||||||
|
|
||||||
|
return $builder->get()->getResultArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,40 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models\Presupuestos;
|
|
||||||
|
|
||||||
class TipoPresupuestoTarifaEncuadernacionModel extends \App\Models\GoBaseModel
|
|
||||||
{
|
|
||||||
protected $table = "tipos_presupuestos_tarifas_encuadernacion";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether primary key uses auto increment.
|
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
protected $useAutoIncrement = true;
|
|
||||||
|
|
||||||
protected $allowedFields = ["tipo_presupuesto_id", "tarifa_encuadernacion_id", "solapas", "is_deleted"];
|
|
||||||
protected $returnType = "App\Entities\Presupuestos\TipoPresupuestoTarifaEncuadernacionEntity";
|
|
||||||
|
|
||||||
protected $useTimestamps = true;
|
|
||||||
protected $useSoftDeletes = false;
|
|
||||||
|
|
||||||
protected $createdField = "created_at";
|
|
||||||
protected $updatedField = "updated_at";
|
|
||||||
|
|
||||||
public static $labelField = "tipo_presupuesto_id";
|
|
||||||
|
|
||||||
public function get_tarifas($tipo_presupuesto=-1, $solapas=0){
|
|
||||||
|
|
||||||
$where = "t1.solapas IS NULL OR t1.solapas='" . $solapas . "'";
|
|
||||||
|
|
||||||
$builder = $this->db
|
|
||||||
->table($this->table . " t1")
|
|
||||||
->select("t1.tarifa_encuadernacion_id AS tarifa_encuadernacion_id, t2.nombre AS tarifa_encuadernacion_nombre")
|
|
||||||
->join("tarifa_encuadernacion t2", "t1.tarifa_encuadernacion_id = t2.id", "left")
|
|
||||||
->where("t1.tipo_presupuesto_id", $tipo_presupuesto)
|
|
||||||
|
|
||||||
->where($where);
|
|
||||||
return $builder->get()->getResultArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -346,6 +346,7 @@ $("#solapas").on("click", function () {
|
|||||||
else {
|
else {
|
||||||
e.style.display = "none";
|
e.style.display = "none";
|
||||||
}
|
}
|
||||||
get_tarifas_enc('default');
|
|
||||||
|
$('#serv_default').click()
|
||||||
});
|
});
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|||||||
@ -11,6 +11,11 @@
|
|||||||
<div id="accordionDatosServiciosTip" class="accordion-collapse collapse show"
|
<div id="accordionDatosServiciosTip" class="accordion-collapse collapse show"
|
||||||
data-bs-parent="#accordionDatosServicios">
|
data-bs-parent="#accordionDatosServicios">
|
||||||
<div class="accordion-body">
|
<div class="accordion-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 col-lg-4 py-4">
|
||||||
|
<button id="serv_default" type="button" class="btn btn-secondary waves-effect waves-light float-start"><?= lang("Presupuestos.serviciosDefault")?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="nav-align-top mb-4">
|
<div class="nav-align-top mb-4">
|
||||||
<ul class="nav nav-pills mb-3 nav-servicios" role="tablist">
|
<ul class="nav nav-pills mb-3 nav-servicios" role="tablist">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
@ -140,11 +145,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="serv-enc-error">
|
<div id="serv-enc-error">
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12 col-lg-4 px-4">
|
|
||||||
<button id="serv_enc_default" type="button" class="btn btn-secondary waves-effect waves-light float-start"><?= lang("Presupuestos.serviciosEncDefault")?></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<table id="tableOfServiciosEncuadernacion" class="table dt-responsive dataTable" style="width: 100%;">
|
<table id="tableOfServiciosEncuadernacion" class="table dt-responsive dataTable" style="width: 100%;">
|
||||||
<thead>
|
<thead>
|
||||||
@ -247,6 +247,12 @@
|
|||||||
|
|
||||||
const POD = <?php echo $POD; ?>;
|
const POD = <?php echo $POD; ?>;
|
||||||
|
|
||||||
|
$('#serv_default').on('click', function(){
|
||||||
|
get_tarifas_enc('default').then(
|
||||||
|
get_tarifas_manipulado('default')
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
// Delete row
|
// Delete row
|
||||||
$(document).on('click', '.btn-delete-serv', function(e) {
|
$(document).on('click', '.btn-delete-serv', function(e) {
|
||||||
const dataId = $(this).attr('data-id');
|
const dataId = $(this).attr('data-id');
|
||||||
@ -749,7 +755,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function get_tarifas_enc(tipo=null, tarifa_id = -1){
|
async function get_tarifas_enc(tipo=null, tarifa_id = -1){
|
||||||
const dimension = getDimensionLibro();
|
const dimension = getDimensionLibro();
|
||||||
|
|
||||||
if(parseInt($('#tirada').val())>0){
|
if(parseInt($('#tirada').val())>0){
|
||||||
@ -850,10 +856,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$('#serv_enc_default').on('click', function(){
|
|
||||||
get_tarifas_enc('default');
|
|
||||||
})
|
|
||||||
|
|
||||||
$('#insertar_serv_enc').on('click', function(){
|
$('#insertar_serv_enc').on('click', function(){
|
||||||
const tarifa_text = $('#add_servicio_enc_list').select2('data')[0].text.trim()
|
const tarifa_text = $('#add_servicio_enc_list').select2('data')[0].text.trim()
|
||||||
|
|
||||||
@ -965,7 +967,7 @@
|
|||||||
$('#serv-manipulado-error').html(htmlString)
|
$('#serv-manipulado-error').html(htmlString)
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_tarifas_manipulado(tarifa_id = -1){
|
async function get_tarifas_manipulado(tipo=null, tarifa_id = -1){
|
||||||
|
|
||||||
if(parseInt($('#tirada').val())>0){
|
if(parseInt($('#tirada').val())>0){
|
||||||
var tirada = parseInt($('#tirada').val())
|
var tirada = parseInt($('#tirada').val())
|
||||||
@ -981,6 +983,12 @@
|
|||||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(tipo != null){
|
||||||
|
datos['tipo'] = tipo;
|
||||||
|
datos['solapas'] = $('#solapas').is(':checked')?1:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
@ -988,6 +996,9 @@
|
|||||||
data: datos,
|
data: datos,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
|
|
||||||
|
if(tipo=='default')
|
||||||
|
tableServiciosManipulado.clear().draw()
|
||||||
|
|
||||||
data.values.forEach((row) => {
|
data.values.forEach((row) => {
|
||||||
|
|
||||||
tableServiciosManipulado.row.add([
|
tableServiciosManipulado.row.add([
|
||||||
|
|||||||
Reference in New Issue
Block a user