mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
añadido factor y factor ponderado a presupuesto
This commit is contained in:
@ -82,6 +82,8 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
|
|||||||
"total_descuentoPercent" => null,
|
"total_descuentoPercent" => null,
|
||||||
"total_presupuesto" => null,
|
"total_presupuesto" => null,
|
||||||
"total_precio_unidad" => null,
|
"total_precio_unidad" => null,
|
||||||
|
"total_factor" => null,
|
||||||
|
"total_factor_ponderado" => null,
|
||||||
"acabado_cubierta_id" => null,
|
"acabado_cubierta_id" => null,
|
||||||
"acabado_sobrecubierta_id" => null,
|
"acabado_sobrecubierta_id" => null,
|
||||||
];
|
];
|
||||||
@ -141,6 +143,8 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
|
|||||||
"total_descuentoPercent" => "?float",
|
"total_descuentoPercent" => "?float",
|
||||||
"total_presupuesto" => "?float",
|
"total_presupuesto" => "?float",
|
||||||
"total_precio_unidad" => "?float",
|
"total_precio_unidad" => "?float",
|
||||||
|
"total_factor" => "?float",
|
||||||
|
"total_factor_ponderado" => "?float",
|
||||||
"acabado_cubierta_id" => "int",
|
"acabado_cubierta_id" => "int",
|
||||||
"acabado_sobrecubierta_id" => "int",
|
"acabado_sobrecubierta_id" => "int",
|
||||||
];
|
];
|
||||||
|
|||||||
@ -100,6 +100,8 @@ class PresupuestoModel extends \App\Models\GoBaseModel
|
|||||||
"total_descuentoPercent",
|
"total_descuentoPercent",
|
||||||
"total_presupuesto",
|
"total_presupuesto",
|
||||||
"total_precio_unidad",
|
"total_precio_unidad",
|
||||||
|
"total_factor",
|
||||||
|
"total_factor_ponderado",
|
||||||
"acabado_cubierta_id",
|
"acabado_cubierta_id",
|
||||||
"acabado_sobrecubierta_id",
|
"acabado_sobrecubierta_id",
|
||||||
];
|
];
|
||||||
|
|||||||
@ -61,7 +61,11 @@
|
|||||||
<dt class="col-5 text-end">Total presupuesto</dt>
|
<dt class="col-5 text-end">Total presupuesto</dt>
|
||||||
<dd id="totalDespuesDecuento" class="col-6 fw-semibold text-end"><?= old('0', $presupuestoEntity->total_presupuesto) ?>€</dd>
|
<dd id="totalDespuesDecuento" class="col-6 fw-semibold text-end"><?= old('0', $presupuestoEntity->total_presupuesto) ?>€</dd>
|
||||||
<dt class="col-5 fw-normal text-end">Precio unidad</dt>
|
<dt class="col-5 fw-normal text-end">Precio unidad</dt>
|
||||||
<dd id="precioUnidadPresupuesto" class="col-6 text-end mb-0"><?= old('0', $presupuestoEntity->total_precio_unidad) ?>€</dd>
|
<dd id="precioUnidadPresupuesto" class="col-6 text-end mb-2"><?= old('0', $presupuestoEntity->total_precio_unidad) ?>€</dd>
|
||||||
|
<dt class="col-5 fw-normal text-end" style="font-size: smaller !important;">Factor</dt>
|
||||||
|
<dd id="factor" class="col-6 text-end mb-2" style="font-size: smaller !important;"><?= old('0', $presupuestoEntity->total_factor) ?></dd>
|
||||||
|
<dt class="col-5 fw-normal text-end" style="font-size: smaller !important;">Factor Ponderado</dt>
|
||||||
|
<dd id="factor_ponderado" class="col-6 text-end mb-0" style="font-size: smaller !important;"><?= old('0', $presupuestoEntity->total_factor_ponderado) ?></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-grid float-end mb-4">
|
<div class="d-grid float-end mb-4">
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
|
function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
|
||||||
|
|
||||||
var totalPapel = 0
|
var totalPapel = 0
|
||||||
var margenPapel = 0
|
var margenPapel = 0
|
||||||
|
|
||||||
@ -12,6 +13,9 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
|
|||||||
var totalEnvios = 0
|
var totalEnvios = 0
|
||||||
var margenEnvios = 0
|
var margenEnvios = 0
|
||||||
|
|
||||||
|
var sumForFactor = 0.0
|
||||||
|
var sumForFactorPonderado = 0.0
|
||||||
|
|
||||||
if(updateLP){
|
if(updateLP){
|
||||||
if(typeof $("#tableLineasPresupuesto").DataTable() !== 'undefined'){
|
if(typeof $("#tableLineasPresupuesto").DataTable() !== 'undefined'){
|
||||||
$("#tableLineasPresupuesto").DataTable().rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
$("#tableLineasPresupuesto").DataTable().rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
||||||
@ -21,19 +25,31 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
|
|||||||
totalPapel += parseFloat($('#' + rowData.row_id + '_totalPapelPedido').val())
|
totalPapel += parseFloat($('#' + rowData.row_id + '_totalPapelPedido').val())
|
||||||
margenPapel += parseFloat($('#' + rowData.row_id + '_margenPapelPedido').val())
|
margenPapel += parseFloat($('#' + rowData.row_id + '_margenPapelPedido').val())
|
||||||
|
|
||||||
|
sumForFactor += parseFloat($('#' + rowData.row_id + '_totalPapelPedido').val())
|
||||||
|
sumForFactor -= parseFloat($('#' + rowData.row_id + '_margenPapelPedido').val())
|
||||||
|
|
||||||
}
|
}
|
||||||
if(rowData.check_impresion_total){
|
if(rowData.check_impresion_total){
|
||||||
totalImpresion += parseFloat($('#' + rowData.row_id + '_precioImpresion').val())
|
totalImpresion += parseFloat($('#' + rowData.row_id + '_precioImpresion').val())
|
||||||
totalImpresion += parseFloat($('#' + rowData.row_id + '_totalClicks').val())
|
totalImpresion += parseFloat($('#' + rowData.row_id + '_totalClicks').val())
|
||||||
|
|
||||||
|
sumForFactor += parseFloat($('#' + rowData.row_id + '_totalClicks').val())
|
||||||
|
|
||||||
if(rowData.maquinaTipo=='inkjet'){
|
if(rowData.maquinaTipo=='inkjet'){
|
||||||
totalImpresion += parseFloat(rowData.totalTinta)
|
totalImpresion += parseFloat(rowData.totalTinta)
|
||||||
totalImpresion += parseFloat(rowData.totalCorte)
|
totalImpresion += parseFloat(rowData.totalCorte)
|
||||||
|
|
||||||
|
sumForFactor += (parseFloat(rowData.totalTinta) + parseFloat(rowData.totalCorte))
|
||||||
}
|
}
|
||||||
margenImpresion += parseFloat($('#' + rowData.row_id + '_margenImpresion').val())
|
margenImpresion += parseFloat($('#' + rowData.row_id + '_margenImpresion').val())
|
||||||
margenImpresion += parseFloat($('#' + rowData.row_id + '_margenClicks').val())
|
margenImpresion += parseFloat($('#' + rowData.row_id + '_margenClicks').val())
|
||||||
if(!isNaN(parseFloat($('#' + rowData.row_id + 'lp_bn_totalTinta').val())))
|
|
||||||
|
sumForFactor -= parseFloat($('#' + rowData.row_id + '_margenClicks').val())
|
||||||
|
|
||||||
|
if(!isNaN(parseFloat($('#' + rowData.row_id + 'lp_bn_totalTinta').val()))){
|
||||||
totalImpresion += parseFloat($('#' + rowData.row_id + 'lp_bn_totalTinta').val())
|
totalImpresion += parseFloat($('#' + rowData.row_id + 'lp_bn_totalTinta').val())
|
||||||
|
sumForFactor += parseFloat($('#' + rowData.row_id + 'lp_bn_totalTinta').val())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -150,6 +166,9 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
|
|||||||
$('#descuentoTotal').text((totalDescuento).toFixed(2) + '€')
|
$('#descuentoTotal').text((totalDescuento).toFixed(2) + '€')
|
||||||
$('#totalDespuesDecuento').text((totalPresupuesto).toFixed(2) + '€')
|
$('#totalDespuesDecuento').text((totalPresupuesto).toFixed(2) + '€')
|
||||||
$('#precioUnidadPresupuesto').text((precioUnidad).toFixed(2) + '€')
|
$('#precioUnidadPresupuesto').text((precioUnidad).toFixed(2) + '€')
|
||||||
|
|
||||||
|
$('#factor').text(((totalPresupuesto-totalEnvios-margenEnvios)/sumForFactor).toFixed(2))
|
||||||
|
$('#factor_ponderado').text(((totalPresupuesto-totalEnvios-margenEnvios)/totalCostes).toFixed(2))
|
||||||
}
|
}
|
||||||
|
|
||||||
function getValuesResumenForm(){
|
function getValuesResumenForm(){
|
||||||
@ -178,6 +197,9 @@ function getValuesResumenForm(){
|
|||||||
formResumen += '&total_presupuesto=' + $('#totalDespuesDecuento').text().replace('€', '')
|
formResumen += '&total_presupuesto=' + $('#totalDespuesDecuento').text().replace('€', '')
|
||||||
formResumen += '&total_precio_unidad=' + $('#precioUnidadPresupuesto').text().replace('€', '')
|
formResumen += '&total_precio_unidad=' + $('#precioUnidadPresupuesto').text().replace('€', '')
|
||||||
|
|
||||||
|
formResumen += '&total_factor=' + $('#total_factor').text()
|
||||||
|
formResumen += '&total_factor_ponderado=' + $('#total_factor_ponderado').text()
|
||||||
|
|
||||||
return formResumen
|
return formResumen
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user