Browse Source

[IMP] rounding currency with two places

Gogs 7 years ago
parent
commit
1c9749ca9c
2 changed files with 3 additions and 3 deletions
  1. 2 2
      src/components/filters/currency.js
  2. 1 1
      src/components/steps/PaymentAmount.vue

+ 2 - 2
src/components/filters/currency.js

@@ -17,8 +17,8 @@ const currency = (value = 0, symbol = '$', symbolPosition = 'before', thousandsS
     value[0] = value[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, `$1${thousandsSeparator}`)
 
     if (!!value[1]) {
-        value[1] = Number.parseFloat(`0.${value[1]}e${decimalPlaces}`)
-        value[1] = Math.round(value[1])
+        value[1] = Number.parseFloat(`1.${value[1]}e${decimalPlaces}`)
+        value[1] = Math.round(value[1]).toString().replace(/^1/, '')
     }
 
     value = value.join(decimalSeparator)

+ 1 - 1
src/components/steps/PaymentAmount.vue

@@ -23,7 +23,7 @@
                             th Fecha de Pago
                     tbody
                         tr(v-for='line in paymentLines')
-                            td {{ line.total }}
+                            td {{ line.total | currency }}
                             td {{ line.date }}
 </template>