(OFBIZ-7532)
To display a number we had different possibilities :
* on ftl use the template <@ofbizAmount and <@ofbizCurrency
* by java call a function UtilFormatOut.formatAmount, UtilFormatOut.formatPrice, UtilFormatOut.formatQuantity, etc..
* by form widget, use <display type=accounting-number for accounting but nothing for other
To simplify and homogenize all, I implemented a number type purpose :
* default: display a number by default, use when no purpose is present
* quantity: display a number as a quantity
* amount: display a number as an amount (like price without currency)
* spelled: litteral displaying for a number (use on <@ofbizAmount ftl only before)
* percentage: display a number as a percentage
* accounting: diplay a number for accounting specific
Each purpose can be associate to a number for displaying it :
* on ftl <@ofbizNumber number=value format=purpose/>
* on java UtilFormatOut.formatNumber(value, purpose, delegator, locale)
* on form widget <display type=number format=purpose/>
The format use by a purpose is define on framework/common/config/number.properties with the template
.displaying.format = ##0.00
With this, you can surchage a configuration, create your own purpose or surchage only one through entity SystemProperty.
Concerning the backware compatibility:
* For the ftl the template <@ofbizAmount is now a link to '<@ofbizNumber format=amount'
* For java all previous function call UtilFormatOut.formatNumber with the matching purpose
* For form xml accounting-number is managed as an exection
Last point, display a currency is different that a number, so I didn't refactoring some code for this case (only move properties from general to number for centralize de configuration on the same file)
Thanks Charles Steltzlen to start the refactoring
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1864832 13f79535-47bb-0310-9956-ffa450edef68
52 lines
2.4 KiB
Properties
52 lines
2.4 KiB
Properties
###############################################################################
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
# or more contributor license agreements. See the NOTICE file
|
|
# distributed with this work for additional information
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
# to you under the Apache License, Version 2.0 (the
|
|
# "License"); you may not use this file except in compliance
|
|
# with the License. You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing,
|
|
# software distributed under the License is distributed on an
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
# KIND, either express or implied. See the License for the
|
|
# specific language governing permissions and limitations
|
|
# under the License.
|
|
###############################################################################
|
|
#
|
|
# Arithmetic properties for configuring BigDecimal calculations
|
|
#
|
|
|
|
# This is only used for rounding of GL posting trial balances and should be 1 digit more than any other financial rounding setting.
|
|
ledger.decimals = 4
|
|
# These should correspond to the convention in minilang which is different than that for BigDecimal in Java. See simple-methods.xsd
|
|
ledger.rounding = HalfUp
|
|
|
|
# For setting decimal precision and rounding method of operations related to invoices
|
|
invoice.decimals = 2
|
|
invoice.SALES_INVOICE.decimals = 2
|
|
invoice.PURCHASE_INVOICE.decimals = 4
|
|
invoice.rounding = ROUND_HALF_UP
|
|
|
|
# For setting decimal precision and rounding method of operations related to orders,
|
|
# such as shopping cart amounts and order amounts
|
|
order.decimals = 2
|
|
order.rounding = ROUND_HALF_UP
|
|
|
|
# For setting decimal precision and rounding method of operations related to customer accounts
|
|
# such as Financial Accounts
|
|
finaccount.decimals = 2
|
|
finaccount.rounding = ROUND_HALF_UP
|
|
finaccount.roundingSimpleMethod = HalfUp
|
|
|
|
# Most companies would want their sales tax calculations ALWAYS to round up (ie, 100.081 becomes 100.09)
|
|
# This could be ROUND_CEILING or ROUND_UP. (The difference is that ROUND_CEILING rounds towards positive infinity,
|
|
# ROUND_UP away from zero. So, for 1.13, both ROUND_UP and ROUND_CEILING will round to 1.2, but for -1.13,
|
|
# ROUND_UP gives you -1.2 and ROUND_CEILING -1.1.)
|
|
salestax.calc.decimals = 3
|
|
salestax.final.decimals = 2
|
|
salestax.rounding = ROUND_HALF_UP
|