Add method in Util to include currency symbol in a BigDecimal

FEA: ItEr76S25CurrencyManagement
This commit is contained in:
Manuel Rego Casasnovas 2012-05-07 10:42:14 +02:00
parent 7b2f407e7a
commit 65d13f4d6f
4 changed files with 17 additions and 8 deletions

View file

@ -655,6 +655,18 @@ public class Util {
});
}
/**
* Returns the value using the money format, that means, 2 figures for the
* decimal part and concatenating the currency symbol from
* {@link Configuration} object.
*/
public static String addCurrencySymbol(BigDecimal value) {
DecimalFormat decimalFormat = (DecimalFormat) DecimalFormat
.getInstance();
decimalFormat.applyPattern(getMoneyFormat());
return decimalFormat.format(value);
}
/**
* Gets money format for a {@link Decimalbox} using 2 figures for the
* decimal part and concatenating the currency symbol

View file

@ -1211,8 +1211,7 @@ public class OrderCRUDController extends GenericForwardComposer {
appendDate(row, order.getInitDate());
appendDate(row, order.getDeadline());
appendCustomer(row, order.getCustomer());
appendObject(row,
order.getTotalBudget() + " " + Util.getCurrencySymbol());
appendObject(row, Util.addCurrencySymbol(order.getTotalBudget()));
appendObject(row, order.getTotalHours());
appendObject(row, _(order.getState().toString()));
appendOperations(row, order);

View file

@ -1034,9 +1034,8 @@ public class TaskElementAdapter {
if (taskElement.getOrderElement() instanceof Order) {
result.append(_("State") + ": ").append(getOrderState());
} else {
String currencySymbol = Util.getCurrencySymbol();
String budget = getBudget() + " " + currencySymbol;
String moneyCost = getMoneyCost() + " " + currencySymbol;
String budget = Util.addCurrencySymbol(getBudget());
String moneyCost = Util.addCurrencySymbol(getMoneyCost());
result.append(
_("Budget: {0}, Consumed: {1} ({2}%)", budget,
moneyCost, getMoneyCostBarPercentage()

View file

@ -109,9 +109,8 @@ public class SubcontractedTasksController extends GenericForwardComposer {
appendLabel(row, subcontractedTaskData.getSubcontractedCode());
appendLabel(row, getTaskName(subcontractedTaskData));
appendLabel(row, subcontractedTaskData.getWorkDescription());
appendLabel(row,
toString(subcontractedTaskData.getSubcontractPrice()) + " "
+ Util.getCurrencySymbol());
appendLabel(row, Util.addCurrencySymbol(subcontractedTaskData
.getSubcontractPrice()));
appendLabel(row, _(toString(subcontractedTaskData.getState())));
appendOperations(row, subcontractedTaskData);
}