mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'fix/porcentaje_margen_total' into 'main'
añadido porcentaje al margen total See merge request jjimenez/safekat!334
This commit is contained in:
@ -47,7 +47,8 @@
|
|||||||
<dt class="col-5 fw-normal text-end">Total Costes</dt>
|
<dt class="col-5 fw-normal text-end">Total Costes</dt>
|
||||||
<dd id="totalCostes" class="col-6 text-end"><?= old('0', $presupuestoEntity->total_costes) ?>€</dd>
|
<dd id="totalCostes" class="col-6 text-end"><?= old('0', $presupuestoEntity->total_costes) ?>€</dd>
|
||||||
<dt class="col-5 fw-normal text-end">Total Margen</dt>
|
<dt class="col-5 fw-normal text-end">Total Margen</dt>
|
||||||
<dd id="totalMargenes" class="col-6 text-end"><?= old('0', $presupuestoEntity->total_margenes) ?>€</dd>
|
<dd id="porcentajeMargen" class="col-3 text-end py-1"><?= old('0', round(100*$presupuestoEntity->total_margenes/($presupuestoEntity->total_costes+$presupuestoEntity->total_margenes),0)) ?>%</dd>
|
||||||
|
<dd id="totalMargenes" class="col-3 text-end py-1"><?= old('0', $presupuestoEntity->total_margenes) ?>€</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<hr class="mx-n4">
|
<hr class="mx-n4">
|
||||||
|
|||||||
@ -198,10 +198,13 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
|
|||||||
|
|
||||||
var totalCostes = parseFloat(totalPapel.toFixed(2)) + parseFloat(totalImpresion.toFixed(2)) + parseFloat(totalServicios.toFixed(2)) + parseFloat(totalEnvios.toFixed(2))
|
var totalCostes = parseFloat(totalPapel.toFixed(2)) + parseFloat(totalImpresion.toFixed(2)) + parseFloat(totalServicios.toFixed(2)) + parseFloat(totalEnvios.toFixed(2))
|
||||||
var totalMargenes = parseFloat(margenPapel.toFixed(2)) + parseFloat(margenImpresion.toFixed(2)) + parseFloat(margenServicios.toFixed(2)) + parseFloat(margenEnvios.toFixed(2))
|
var totalMargenes = parseFloat(margenPapel.toFixed(2)) + parseFloat(margenImpresion.toFixed(2)) + parseFloat(margenServicios.toFixed(2)) + parseFloat(margenEnvios.toFixed(2))
|
||||||
|
var porcentajeMargen = (100*totalMargenes/(totalCostes+totalMargenes)).toFixed(0)
|
||||||
$('#totalCostes').text((addSeparatorsNF(totalCostes.toFixed(2), ".", ",", ".")) + "€")
|
$('#totalCostes').text((addSeparatorsNF(totalCostes.toFixed(2), ".", ",", ".")) + "€")
|
||||||
$('#totalMargenes').text((addSeparatorsNF(totalMargenes.toFixed(2), ".", ",", ".")) + "€")
|
$('#totalMargenes').text((addSeparatorsNF(totalMargenes.toFixed(2), ".", ",", ".")) + "€")
|
||||||
$('#totalCostes').attr('val',(totalCostes).toFixed(2) + '€')
|
$('#totalCostes').attr('val',(totalCostes).toFixed(2) + '€')
|
||||||
$('#totalMargenes').attr('val',(totalMargenes).toFixed(2) + '€')
|
$('#totalMargenes').attr('val',(totalMargenes).toFixed(2) + '€')
|
||||||
|
$('#porcentajeMargen').text(porcentajeMargen + '%')
|
||||||
|
$('#porcentajeMargen').attr('val',porcentajeMargen)
|
||||||
|
|
||||||
if($('#total_descuentoPercent').val()<0){
|
if($('#total_descuentoPercent').val()<0){
|
||||||
$('#total_descuentoPercent').val(0)
|
$('#total_descuentoPercent').val(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user