diff --git a/ci4/app/Entities/Configuracion/PapelFormatoEntity.php b/ci4/app/Entities/Configuracion/PapelFormatoEntity.php index fa6c3d37..83907672 100755 --- a/ci4/app/Entities/Configuracion/PapelFormatoEntity.php +++ b/ci4/app/Entities/Configuracion/PapelFormatoEntity.php @@ -9,6 +9,7 @@ class PapelFormatoEntity extends \CodeIgniter\Entity\Entity "id" => null, "ancho" => null, "alto" => null, + "orden_select" => null, "is_deleted" => 0, "deleted_at" => null, "created_at" => null, @@ -17,6 +18,7 @@ class PapelFormatoEntity extends \CodeIgniter\Entity\Entity protected $casts = [ "ancho" => "float", "alto" => "float", + "orden_select" => "int", "is_deleted" => "int", ]; } diff --git a/ci4/app/Models/Configuracion/PapelFormatoModel.php b/ci4/app/Models/Configuracion/PapelFormatoModel.php index c92364d4..f9fa3187 100755 --- a/ci4/app/Models/Configuracion/PapelFormatoModel.php +++ b/ci4/app/Models/Configuracion/PapelFormatoModel.php @@ -20,7 +20,7 @@ class PapelFormatoModel extends \App\Models\GoBaseModel 5 => "t1.updated_at", ]; - protected $allowedFields = ["ancho", "alto"]; + protected $allowedFields = ["ancho", "alto", "orden_select"]; protected $returnType = "App\Entities\Configuracion\PapelFormatoEntity"; protected $useTimestamps = true; @@ -91,6 +91,6 @@ class PapelFormatoModel extends \App\Models\GoBaseModel ->table($this->table . " t1") ->select( "t1.id AS id, CONCAT(t1.ancho, ' x ', t1.alto) AS tamanio" - )->where('is_deleted', 0)->get()->getResultObject(); + )->where('is_deleted', 0)->orderBy('orden_select', 'asc')->get()->getResultObject(); } } diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestos.js b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestos.js index 636bd6db..f69d757a 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestos.js +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestos.js @@ -74,6 +74,8 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){ margenImpresion = parseFloat($('#margenImpresion').text().replace('€', '')) } + sumForFactorPonderado = sumForFactor; + if(updateServicios){ if ( typeof $("#tableOfServiciosEncuadernacion").DataTable() !== 'undefined' && $("#tableOfServiciosEncuadernacion").DataTable().rows().count() > 0){ @@ -119,15 +121,21 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){ } totalServicios -= margenServicios; + + sumForFactorPonderado += totalServicios; + var porcentajeMargenServicios = margenServicios/(margenServicios+totalServicios)*100 $('#porcentajeMargenServicios').text(isNaN(porcentajeMargenServicios.toFixed(0))?0:porcentajeMargenServicios.toFixed(0) + '%') $('#totalServicios').text(totalServicios.toFixed(2) + '€') $('#margenServicios').text(margenServicios.toFixed(2) + '€') + } else{ totalServicios = parseFloat($('#totalServicios').text().replace('€', '')) margenServicios = parseFloat($('#margenServicios').text().replace('€', '')) + + sumForFactorPonderado += totalServicios; } if(updateEnvio){ @@ -168,7 +176,7 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){ $('#precioUnidadPresupuesto').text((precioUnidad).toFixed(2) + '€') $('#factor').text(((totalPresupuesto-totalEnvios-margenEnvios)/sumForFactor).toFixed(2)) - $('#factor_ponderado').text(((totalPresupuesto-totalEnvios-margenEnvios)/totalCostes).toFixed(2)) + $('#factor_ponderado').text(((totalPresupuesto-totalEnvios-margenEnvios)/sumForFactorPonderado).toFixed(2)) } function getValuesResumenForm(){