mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
modificadas tarifas en las que import minimo y precio minimo no tenian sentido. Revision de Presupuestos* para calcular la tarifa
This commit is contained in:
@ -9,8 +9,6 @@ class TarifaextraEntity extends \CodeIgniter\Entity\Entity
|
||||
"id" => null,
|
||||
"nombre" => null,
|
||||
"precio" => null,
|
||||
"precio_min" => 0,
|
||||
"importe_fijo" => 0,
|
||||
"margen" => 0,
|
||||
"mostrar_en_presupuesto" => 1,
|
||||
"user_created_id" => 1,
|
||||
@ -22,8 +20,6 @@ class TarifaextraEntity extends \CodeIgniter\Entity\Entity
|
||||
];
|
||||
protected $casts = [
|
||||
"precio" => "float",
|
||||
"precio_min" => "float",
|
||||
"importe_fijo" => "float",
|
||||
"margen" => "float",
|
||||
"mostrar_en_presupuesto" => "int",
|
||||
"user_created_id" => "int",
|
||||
|
||||
@ -9,8 +9,6 @@ class TarifapreimpresionEntity extends \CodeIgniter\Entity\Entity
|
||||
"id" => null,
|
||||
"nombre" => null,
|
||||
"precio" => null,
|
||||
"precio_min" => 0,
|
||||
"importe_fijo" => 0,
|
||||
"margen" => 0,
|
||||
"mostrar_en_presupuesto" => 1,
|
||||
"user_created_id" => 1,
|
||||
@ -22,8 +20,6 @@ class TarifapreimpresionEntity extends \CodeIgniter\Entity\Entity
|
||||
];
|
||||
protected $casts = [
|
||||
"precio" => "float",
|
||||
"precio_min" => "float",
|
||||
"importe_fijo" => "float",
|
||||
"margen" => "float",
|
||||
"mostrar_en_presupuesto" => "int",
|
||||
"user_created_id" => "int",
|
||||
|
||||
@ -13,7 +13,7 @@ return [
|
||||
'nombre' => 'Name',
|
||||
'precioMax' => 'Price Max',
|
||||
'precioMin' => 'Price Min',
|
||||
'precioMin' => 'Min Price',
|
||||
'importeMinimo' => 'Min Price',
|
||||
'importeFijo' => 'Fixed amount',
|
||||
'mostrar_en_presupuesto' => 'Show in budget',
|
||||
'margen' => 'Margin',
|
||||
|
||||
@ -10,6 +10,7 @@ return [
|
||||
'id' => 'ID',
|
||||
'moduleTitle' => 'Tarifas Manipulado',
|
||||
'nombre' => 'Nombre',
|
||||
'importeMinimo' => 'Importe mínimo',
|
||||
'precioMax' => 'Precio T. Mín',
|
||||
'precioMin' => 'Precio T. Máx',
|
||||
'importeFijo' => 'Importe Fijo',
|
||||
|
||||
@ -84,6 +84,13 @@ class PresupuestoManipuladosModel extends \App\Models\BaseModel
|
||||
$total = $precio_unidad * $tirada;
|
||||
$margen = floatval($tarifa->margen);
|
||||
|
||||
if($tarifa->tarifa_precio_min > $total){
|
||||
$total = $total-($total * $margen/100.0);
|
||||
$margen = round(100.0 * (floatval($tarifa->tarifa_precio_min) - $total) / floatval($tarifa->tarifa_precio_min), 0);
|
||||
$total = floatval($tarifa->tarifa_precio_min);
|
||||
$precio_unidad = round(floatval($total / $tirada), 2);
|
||||
}
|
||||
|
||||
if (!$is_POD){
|
||||
$total += floatval($tarifa->tarifa_importe_fijo);
|
||||
}
|
||||
|
||||
@ -69,7 +69,6 @@ class PresupuestoPreimpresionesModel extends \App\Models\BaseModel
|
||||
];
|
||||
return $ret_array;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
private function calcularTarifa($tarifa){
|
||||
@ -78,12 +77,6 @@ class PresupuestoPreimpresionesModel extends \App\Models\BaseModel
|
||||
$precio = $precio * (1+ floatval($tarifa->margen)/100.0);
|
||||
$margen = $tarifa->margen;
|
||||
|
||||
if($tarifa->tarifa_precio_min > $precio){
|
||||
$precio = $precio-($precio * $margen/100.0);
|
||||
$margen = round(100.0 * (floatval($tarifa->tarifa_precio_min) - $precio) / floatval($tarifa->tarifa_precio_min), 0);
|
||||
$precio = floatval($tarifa->tarifa_precio_min);
|
||||
}
|
||||
|
||||
return [$precio, $margen];
|
||||
}
|
||||
|
||||
|
||||
@ -78,12 +78,6 @@ class PresupuestoServiciosExtraModel extends \App\Models\BaseModel
|
||||
$precio = $precio * (1+ floatval($tarifa->margen)/100.0);
|
||||
$margen = $tarifa->margen;
|
||||
|
||||
if($tarifa->tarifa_precio_min > $precio){
|
||||
$precio = $precio-($precio * $margen/100.0);
|
||||
$margen = round(100.0 * (floatval($tarifa->tarifa_precio_min) - $precio) / floatval($tarifa->tarifa_precio_min), 0);
|
||||
$precio = floatval($tarifa->tarifa_precio_min);
|
||||
}
|
||||
|
||||
return [$precio, $margen];
|
||||
}
|
||||
|
||||
|
||||
@ -15,8 +15,6 @@ class TarifaextraModel extends \App\Models\BaseModel
|
||||
protected $allowedFields = [
|
||||
"nombre",
|
||||
"precio",
|
||||
"precio_min",
|
||||
"importe_fijo",
|
||||
"margen",
|
||||
"mostrar_en_presupuesto",
|
||||
"deleted_at",
|
||||
@ -39,14 +37,6 @@ class TarifaextraModel extends \App\Models\BaseModel
|
||||
"label" => "Tarifaextra.nombre",
|
||||
"rules" => "trim|required|max_length[255]",
|
||||
],
|
||||
"precio" => [
|
||||
"label" => "Tarifaextra.precio",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"precio_min" => [
|
||||
"label" => "Tarifaextra.precioMin",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"importe_fijo" => [
|
||||
"label" => "Tarifaextra.importeFijo",
|
||||
"rules" => "required|decimal",
|
||||
@ -66,14 +56,6 @@ class TarifaextraModel extends \App\Models\BaseModel
|
||||
"decimal" => "Tarifaextra.validation.precio.decimal",
|
||||
"required" => "Tarifaextra.validation.precio.required",
|
||||
],
|
||||
"precio_min" => [
|
||||
"required" => "Tarifaextra.validation.precio_min.required",
|
||||
"decimal" => "Tarifaextra.validation.precio_min.decimal",
|
||||
],
|
||||
"importe_fijo" => [
|
||||
"required" => "Tarifaextra.validation.importe_fijo.required",
|
||||
"decimal" => "Tarifaextra.validation.importe_fijo.decimal",
|
||||
],
|
||||
"margen" => [
|
||||
"required" => "Tarifaextra.validation.margen.required",
|
||||
"decimal" => "Tarifaextra.validation.margen.decimal",
|
||||
@ -101,8 +83,7 @@ class TarifaextraModel extends \App\Models\BaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS tarifa_extra_id, t1.nombre AS tarifa_extra_nombre, t1.precio AS precio, t1.margen AS margen,
|
||||
t1.precio_min AS tarifa_precio_min, t1.importe_fijo AS importe_fijo"
|
||||
"t1.id AS tarifa_extra_id, t1.nombre AS tarifa_extra_nombre, t1.precio AS precio, t1.margen AS margen"
|
||||
)
|
||||
->where("t1.is_deleted", 0);
|
||||
//->where("t1.mostrar_en_presupuesto", 1)
|
||||
|
||||
@ -15,8 +15,6 @@ class TarifapreimpresionModel extends \App\Models\BaseModel
|
||||
protected $allowedFields = [
|
||||
"nombre",
|
||||
"precio",
|
||||
"precio_min",
|
||||
"importe_fijo",
|
||||
"margen",
|
||||
"mostrar_en_presupuesto",
|
||||
"deleted_at",
|
||||
@ -43,14 +41,6 @@ class TarifapreimpresionModel extends \App\Models\BaseModel
|
||||
"label" => "Tarifapreimpresion.precio",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"precio_min" => [
|
||||
"label" => "Tarifapreimpresion.precioMin",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"importe_fijo" => [
|
||||
"label" => "Tarifapreimpresion.importeFijo",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"margen" => [
|
||||
"label" => "Tarifapreimpresion.margen",
|
||||
"rules" => "required|decimal",
|
||||
@ -66,14 +56,6 @@ class TarifapreimpresionModel extends \App\Models\BaseModel
|
||||
"decimal" => "Tarifapreimpresion.validation.precio.decimal",
|
||||
"required" => "Tarifapreimpresion.validation.precio.required",
|
||||
],
|
||||
"precio_min" => [
|
||||
"required" => "Tarifapreimpresion.validation.precio_min.required",
|
||||
"decimal" => "Tarifapreimpresion.validation.precio_min.decimal",
|
||||
],
|
||||
"importe_fijo" => [
|
||||
"required" => "Tarifapreimpresion.validation.importe_fijo.required",
|
||||
"decimal" => "Tarifapreimpresion.validation.importe_fijo.decimal",
|
||||
],
|
||||
"margen" => [
|
||||
"required" => "Tarifapreimpresion.validation.margen.required",
|
||||
"decimal" => "Tarifapreimpresion.validation.margen.decimal",
|
||||
@ -101,8 +83,7 @@ class TarifapreimpresionModel extends \App\Models\BaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS tarifa_preimpresion_id, t1.nombre AS tarifa_preimpresion_nombre, t1.precio AS precio, t1.margen AS margen,
|
||||
t1.precio_min AS tarifa_precio_min, t1.importe_fijo AS importe_fijo"
|
||||
"t1.id AS tarifa_preimpresion_id, t1.nombre AS tarifa_preimpresion_nombre, t1.precio AS precio, t1.margen AS margen"
|
||||
)
|
||||
->where("t1.is_deleted", 0);
|
||||
//->where("t1.mostrar_en_presupuesto", 1)
|
||||
|
||||
@ -31,34 +31,6 @@
|
||||
>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="precio_min" class="form-label">
|
||||
<?= lang('Tarifaextra.precioMin') ?>*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="precio_min"
|
||||
name="precio_min"
|
||||
required
|
||||
class="form-control"
|
||||
value="<?= old('precio_min', $tarifaextraEntity->precio_min) ?>"
|
||||
>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="importe_fijo" class="form-label">
|
||||
<?= lang('Tarifaextra.importeFijo') ?>*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="importe_fijo"
|
||||
name="importe_fijo"
|
||||
required
|
||||
class="form-control"
|
||||
value="<?= old('importe_fijo', $tarifaextraEntity->importe_fijo) ?>"
|
||||
>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="margen" class="form-label">
|
||||
<?= lang('Tarifaextra.margen') ?>*
|
||||
|
||||
@ -17,8 +17,6 @@
|
||||
<tr>
|
||||
<th><?= lang('Tarifaextra.nombre') ?></th>
|
||||
<th><?= lang('Tarifaextra.precio') ?></th>
|
||||
<th><?= lang('Tarifaextra.precioMin') ?></th>
|
||||
<th><?= lang('Tarifaextra.importeFijo') ?></th>
|
||||
<th><?= lang('Tarifaextra.margen') ?></th>
|
||||
<th><?= lang('Tarifaextra.mostrar_en_presupuesto') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
@ -33,12 +31,6 @@
|
||||
<td class="align-middle">
|
||||
<?= esc($item->precio) ?>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<?= esc($item->precio_min) ?>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<?= esc($item->importe_fijo) ?>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<?= esc($item->margen) ?>
|
||||
</td>
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="nombre" class="form-label">
|
||||
<?=lang('Tarifamanipulado.precioMin') ?>*
|
||||
<?=lang('Tarifamanipulado.importeMinimo') ?>*
|
||||
</label>
|
||||
<input type="text" id="precio_min" name="precio_min" class="form-control" value="<?=old('precio_min', $tarifaManipuladoEntity->precio_min) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('Tarifamanipulado.nombre') ?></th>
|
||||
<th><?= lang('Tarifamanipulado.precioMin') ?></th>
|
||||
<th><?= lang('Tarifamanipulado.importeMinimo') ?></th>
|
||||
<th><?= lang('Tarifamanipulado.importeFijo') ?></th>
|
||||
<th><?= lang('Tarifamanipulado.mostrar_en_presupuesto') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
|
||||
@ -31,33 +31,6 @@
|
||||
>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="precio_min" class="form-label">
|
||||
<?= lang('Tarifapreimpresion.precioMin') ?>*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="precio_min"
|
||||
name="precio_min"
|
||||
required
|
||||
class="form-control"
|
||||
value="<?= old('precio_min', $tarifapreimpresionEntity->precio_min) ?>"
|
||||
>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="importe_fijo" class="form-label">
|
||||
<?= lang('Tarifapreimpresion.importeFijo') ?>*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="importe_fijo"
|
||||
name="importe_fijo"
|
||||
required
|
||||
class="form-control"
|
||||
value="<?= old('importe_fijo', $tarifapreimpresionEntity->importe_fijo) ?>"
|
||||
>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="margen" class="form-label">
|
||||
|
||||
@ -17,8 +17,6 @@
|
||||
<tr>
|
||||
<th><?= lang('Tarifapreimpresion.nombre') ?></th>
|
||||
<th><?= lang('Tarifapreimpresion.precio') ?></th>
|
||||
<th><?= lang('Tarifapreimpresion.precioMin') ?></th>
|
||||
<th><?= lang('Tarifapreimpresion.importeFijo') ?></th>
|
||||
<th><?= lang('Tarifapreimpresion.margen') ?></th>
|
||||
<th><?= lang('Tarifapreimpresion.mostrar_en_presupuesto') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
@ -33,12 +31,6 @@
|
||||
<td class="align-middle">
|
||||
<?= esc($item->precio) ?>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<?= esc($item->precio_min) ?>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<?= esc($item->importe_fijo) ?>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<?= esc($item->margen) ?>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user