Add function for number formatting in decimals (#1088)
* Add function for number formatting in decimals * minimal changes * rename function Co-authored-by: elsiosanchez <elsiossanches@gmail.com>pull/3793/head
							parent
							
								
									37eb7240f9
								
							
						
					
					
						commit
						54a4612e7b
					
				| 
						 | 
				
			
			@ -670,6 +670,9 @@ export default {
 | 
			
		|||
          }
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    precision() {
 | 
			
		||||
      return this.$store.getters.getCurrency.standardPrecision
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  created() {
 | 
			
		||||
| 
						 | 
				
			
			@ -749,13 +752,14 @@ export default {
 | 
			
		|||
        containerUuid,
 | 
			
		||||
        columnName: 'ReferenceNo'
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
      if (this.sendToServer) {
 | 
			
		||||
        this.$store.dispatch('setPaymentBox', {
 | 
			
		||||
          posUuid,
 | 
			
		||||
          orderUuid,
 | 
			
		||||
          bankUuid,
 | 
			
		||||
          referenceNo,
 | 
			
		||||
          amount: this.amontSend,
 | 
			
		||||
          amount: this.round(this.amontSend, this.precision),
 | 
			
		||||
          convertedAmount: this.amontSend * this.dayRate.divideRate,
 | 
			
		||||
          paymentDate,
 | 
			
		||||
          tenderTypeCode,
 | 
			
		||||
| 
						 | 
				
			
			@ -767,7 +771,7 @@ export default {
 | 
			
		|||
          orderUuid,
 | 
			
		||||
          bankUuid,
 | 
			
		||||
          referenceNo,
 | 
			
		||||
          amount: this.amontSend,
 | 
			
		||||
          amount: this.round(this.amontSend, this.precision),
 | 
			
		||||
          convertedAmount: this.amontSend * this.dayRate.divideRate,
 | 
			
		||||
          paymentDate,
 | 
			
		||||
          tenderTypeCode,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -97,22 +97,6 @@
 | 
			
		|||
                    </el-select>
 | 
			
		||||
                  </el-form-item>
 | 
			
		||||
                </el-col>
 | 
			
		||||
                <el-col :span="8">
 | 
			
		||||
                  <el-form-item v-if="displayeCurrency" :label="$t('form.pos.collect.Currency')">
 | 
			
		||||
                    <el-select
 | 
			
		||||
                      v-model="currentFieldCurrency"
 | 
			
		||||
                      style="width: -webkit-fill-available;"
 | 
			
		||||
                      @change="changeCurrency"
 | 
			
		||||
                    >
 | 
			
		||||
                      <el-option
 | 
			
		||||
                        v-for="item in listCurrency"
 | 
			
		||||
                        :key="item.id"
 | 
			
		||||
                        :label="item.name"
 | 
			
		||||
                        :value="item.key"
 | 
			
		||||
                      />
 | 
			
		||||
                    </el-select>
 | 
			
		||||
                  </el-form-item>
 | 
			
		||||
                </el-col>
 | 
			
		||||
                <el-col
 | 
			
		||||
                  v-for="field in hiddenFieldsList"
 | 
			
		||||
                  :key="field.sequence"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,6 +24,7 @@ export {
 | 
			
		|||
  currencyFind,
 | 
			
		||||
  tenderTypeFind,
 | 
			
		||||
  formatConversionCurrenty,
 | 
			
		||||
  round,
 | 
			
		||||
  convertValuesToSend,
 | 
			
		||||
  typeValue
 | 
			
		||||
} from '@/utils/ADempiere/valueUtils.js'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -114,6 +114,13 @@ export function extractPagingToken(token) {
 | 
			
		|||
  return onlyToken
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @param {number} number
 | 
			
		||||
 */
 | 
			
		||||
export function round(number, standardPrecision) {
 | 
			
		||||
  const amount = number.toFixed(standardPrecision)
 | 
			
		||||
  return Number(amount)
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * zero pad
 | 
			
		||||
 * @author EdwinBetanc0urt <EdwinBetanc0urt@oulook.com>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue