Add currency symbol in all the decimalbox representing money
* Create a new method Util.getMoneyFormat() FEA: ItEr76S25CurrencyManagement
This commit is contained in:
parent
77d2fd65fa
commit
cd2720147e
27 changed files with 130 additions and 34 deletions
|
|
@ -5,6 +5,7 @@
|
|||
<parameter name="endingDate" class="java.util.Date"/>
|
||||
<parameter name="status" class="java.lang.String"/>
|
||||
<parameter name="logo" class="java.lang.String"/>
|
||||
<parameter name="currencySymbol" class="java.lang.String"/>
|
||||
<field name="status" class="java.lang.String"/>
|
||||
<field name="code" class="java.lang.String"/>
|
||||
<field name="name" class="java.lang.String"/>
|
||||
|
|
@ -156,7 +157,7 @@
|
|||
<textField isBlankWhenNull="true">
|
||||
<reportElement x="434" y="14" width="72" height="15"/>
|
||||
<textElement textAlignment="Center" verticalAlignment="Middle"/>
|
||||
<textFieldExpression class="java.math.BigDecimal"><![CDATA[$V{sumTotalPricePerDay}]]></textFieldExpression>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$V{sumTotalPricePerDay}.setScale(2) + " " + $P{currencySymbol}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</groupFooter>
|
||||
|
|
@ -291,7 +292,7 @@
|
|||
<rightPen lineWidth="1.0"/>
|
||||
</box>
|
||||
<textElement textAlignment="Center" verticalAlignment="Middle"/>
|
||||
<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{totalPrice}]]></textFieldExpression>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$F{totalPrice}.setScale(2) + " " + $P{currencySymbol}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement x="390" y="0" width="65" height="73"/>
|
||||
|
|
@ -303,7 +304,7 @@
|
|||
<rightPen lineWidth="1.0"/>
|
||||
</box>
|
||||
<textElement textAlignment="Center" verticalAlignment="Middle"/>
|
||||
<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{unitPrice}]]></textFieldExpression>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$F{unitPrice}.setScale(2) + " " + $P{currencySymbol}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement x="520" y="0" width="60" height="73">
|
||||
|
|
|
|||
|
|
@ -648,4 +648,15 @@ public class Util {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets money format for a {@link Decimalbox} using 2 figures for the
|
||||
* decimal part and concatenating the currency symbol
|
||||
*
|
||||
* @return Format for a {@link Decimalbox} <code>###.##</code> plus currency
|
||||
* symbol
|
||||
*/
|
||||
public static String getMoneyFormat() {
|
||||
return "###.## " + getCurrencySymbol();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,10 +38,8 @@ import org.libreplan.business.costcategories.entities.CostCategory;
|
|||
import org.libreplan.business.costcategories.entities.HourCost;
|
||||
import org.libreplan.business.costcategories.entities.TypeOfWorkHours;
|
||||
import org.libreplan.web.common.BaseCRUDController;
|
||||
import org.libreplan.web.common.ConstraintChecker;
|
||||
import org.libreplan.web.common.Level;
|
||||
import org.libreplan.web.common.Util;
|
||||
import org.libreplan.web.util.ValidationExceptionPrinter;
|
||||
import org.libreplan.web.workreports.WorkReportCRUDController;
|
||||
import org.zkoss.ganttz.util.ComponentsFinder;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
|
|
@ -305,6 +303,7 @@ public class CostCategoryCRUDController extends BaseCRUDController<CostCategory>
|
|||
Decimalbox boxCost = new Decimalbox();
|
||||
bindDecimalboxCost(boxCost, (HourCost) row.getValue());
|
||||
boxCost.setConstraint("no empty:" + _("cannot be null or empty"));
|
||||
boxCost.setFormat(Util.getMoneyFormat());
|
||||
row.appendChild(boxCost);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -141,4 +141,13 @@ public class TypeOfWorkHoursCRUDController extends BaseCRUDController<TypeOfWork
|
|||
protected boolean beforeDeleting(TypeOfWorkHours typeOfWorkHours) {
|
||||
return !isReferencedByOtherEntities(typeOfWorkHours);
|
||||
}
|
||||
|
||||
public String getCurrencySymbol() {
|
||||
return Util.getCurrencySymbol();
|
||||
}
|
||||
|
||||
public String getMoneyFormat() {
|
||||
return Util.getMoneyFormat();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -554,4 +554,9 @@ public class MaterialsController extends
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getMoneyFormat() {
|
||||
return Util.getMoneyFormat();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,4 +159,8 @@ public class AssignedHoursToOrderElementController extends
|
|||
}
|
||||
}
|
||||
|
||||
public String getCurrencySymbol() {
|
||||
return Util.getCurrencySymbol();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,4 +67,8 @@ public class DetailsOrderElementController extends
|
|||
return !orderElementModel.getOrderElement().isLeaf();
|
||||
}
|
||||
|
||||
public String getMoneyFormat() {
|
||||
return Util.getMoneyFormat();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -87,6 +87,7 @@ import org.zkoss.zul.Comboitem;
|
|||
import org.zkoss.zul.ComboitemRenderer;
|
||||
import org.zkoss.zul.Constraint;
|
||||
import org.zkoss.zul.Datebox;
|
||||
import org.zkoss.zul.Decimalbox;
|
||||
import org.zkoss.zul.Grid;
|
||||
import org.zkoss.zul.Hbox;
|
||||
import org.zkoss.zul.Label;
|
||||
|
|
@ -1210,7 +1211,8 @@ public class OrderCRUDController extends GenericForwardComposer {
|
|||
appendDate(row, order.getInitDate());
|
||||
appendDate(row, order.getDeadline());
|
||||
appendCustomer(row, order.getCustomer());
|
||||
appendObject(row, order.getTotalBudget());
|
||||
appendObject(row,
|
||||
order.getTotalBudget() + " " + Util.getCurrencySymbol());
|
||||
appendObject(row, order.getTotalHours());
|
||||
appendObject(row, _(order.getState().toString()));
|
||||
appendOperations(row, order);
|
||||
|
|
@ -1329,8 +1331,8 @@ public class OrderCRUDController extends GenericForwardComposer {
|
|||
return orderModel.gettooltipText(order);
|
||||
}
|
||||
|
||||
public void reloadTotalBudget(Label txtTotalBudget) {
|
||||
Util.reloadBindings(txtTotalBudget);
|
||||
public void reloadTotalBudget(Decimalbox decimalboxTotalBudget) {
|
||||
Util.reloadBindings(decimalboxTotalBudget);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1564,4 +1566,9 @@ public class OrderCRUDController extends GenericForwardComposer {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
public String getMoneyFormat() {
|
||||
return Util.getMoneyFormat();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -338,7 +338,8 @@ public abstract class AssignedMaterialsController<T, A> extends GenericForwardCo
|
|||
|
||||
Label lblName = new Label(materialCategory.getName());
|
||||
Label lblUnits = new Label(getUnits(materialCategory).toString());
|
||||
Label lblPrice = new Label(getPrice(materialCategory).toString());
|
||||
Label lblPrice = new Label(getPrice(materialCategory).toString()
|
||||
+ getCurrencySymbol());
|
||||
|
||||
Treerow tr = null;
|
||||
ti.setValue(node);
|
||||
|
|
@ -573,4 +574,12 @@ public abstract class AssignedMaterialsController<T, A> extends GenericForwardCo
|
|||
.getId().equals(material.getUnitType().getId())));
|
||||
}
|
||||
|
||||
public String getCurrencySymbol() {
|
||||
return Util.getCurrencySymbol();
|
||||
}
|
||||
|
||||
public String getMoneyFormat() {
|
||||
return Util.getMoneyFormat();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,4 +101,8 @@ public class SubcontractController extends GenericForwardComposer {
|
|||
subcontractModel.removeSubcontractedTaskData();
|
||||
}
|
||||
|
||||
public String getMoneyFormat() {
|
||||
return Util.getMoneyFormat();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
* Copyright (C) 2010-2011 Igalia, S.L.
|
||||
* Copyright (C) 2010-2012 Igalia, S.L.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
@ -639,4 +639,9 @@ public class TaskPropertiesController extends GenericForwardComposer {
|
|||
.toDate();
|
||||
Util.reloadBindings(startDateBox);
|
||||
}
|
||||
|
||||
public String getMoneyFormat() {
|
||||
return Util.getMoneyFormat();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,6 +185,8 @@ public class TimeLineRequiredMaterialController extends
|
|||
result.put("startingDate", getStartingDate());
|
||||
result.put("endingDate", getEndingDate());
|
||||
result.put("status", getSelectedStatusName());
|
||||
result.put("currencySymbol", Util.getCurrencySymbol());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -109,8 +109,9 @@ public class SubcontractedTasksController extends GenericForwardComposer {
|
|||
appendLabel(row, subcontractedTaskData.getSubcontractedCode());
|
||||
appendLabel(row, getTaskName(subcontractedTaskData));
|
||||
appendLabel(row, subcontractedTaskData.getWorkDescription());
|
||||
appendLabel(row, toString(subcontractedTaskData
|
||||
.getSubcontractPrice()));
|
||||
appendLabel(row,
|
||||
toString(subcontractedTaskData.getSubcontractPrice()) + " "
|
||||
+ Util.getCurrencySymbol());
|
||||
appendLabel(row, _(toString(subcontractedTaskData.getState())));
|
||||
appendOperations(row, subcontractedTaskData);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -408,4 +408,8 @@ public class OrderTemplatesController extends GenericForwardComposer implements
|
|||
Util.reloadBindings(tabPanel);
|
||||
}
|
||||
|
||||
public String getMoneyFormat() {
|
||||
return Util.getMoneyFormat();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -796,6 +796,7 @@ public abstract class TreeController<T extends ITreeNode<T>> extends
|
|||
// If it's a container budget cell is not editable
|
||||
Util.bind(result, getBudgetGetterFor(element));
|
||||
}
|
||||
result.setFormat(Util.getMoneyFormat());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@
|
|||
<label value="${i18n:_('Default price')}" />
|
||||
<decimalbox id="defaultPrice"
|
||||
constraint="no empty:${i18n:_('cannot be null or empty')}"
|
||||
value="@{controller.typeOfWorkHours.defaultPrice}" width="300px" />
|
||||
value="@{controller.typeOfWorkHours.defaultPrice}" width="300px"
|
||||
format="@{controller.moneyFormat}" />
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Enabled')}" />
|
||||
|
|
|
|||
|
|
@ -33,7 +33,10 @@
|
|||
<row self="@{each='typeOfWorkHours'}" value="@{typeOfWorkHours}" onClick="controller.goToEditForm(self.value);">
|
||||
<label value="@{typeOfWorkHours.code}" />
|
||||
<label value="@{typeOfWorkHours.name}" />
|
||||
<label value="@{typeOfWorkHours.defaultPrice}" />
|
||||
<hbox>
|
||||
<label value="@{typeOfWorkHours.defaultPrice}" />
|
||||
<label value="@{controller.currencySymbol}" />
|
||||
</hbox>
|
||||
<checkbox checked="@{typeOfWorkHours.enabled}" disabled="true" />
|
||||
<!-- Buttons for each row -->
|
||||
<hbox>
|
||||
|
|
|
|||
|
|
@ -92,7 +92,8 @@
|
|||
constraint="no empty:${i18n:_('cannot be null or empty')}" />
|
||||
<textbox value="@{material.description}" width="95%"
|
||||
constraint="no empty:${i18n:_('cannot be null or empty')}" />
|
||||
<doublebox value="@{material.defaultUnitPrice}" />
|
||||
<decimalbox value="@{material.defaultUnitPrice}"
|
||||
format="@{materialsController.moneyFormat}" />
|
||||
<listbox mold="select" model="@{materialsController.unitTypes}"
|
||||
onSelect = "materialsController.selectUnitType(self)"
|
||||
itemRenderer="@{materialsController.renderer}"/>
|
||||
|
|
|
|||
|
|
@ -41,9 +41,11 @@
|
|||
<doublebox value="@{assignedMaterial.units}"
|
||||
onChange="assignedMaterialsController.updateTotalPrice(self.parent)" style="text-align:right" />
|
||||
<label value="@{assignedMaterial.material.unitType.measure}"/>
|
||||
<doublebox value="@{assignedMaterial.unitPrice}"
|
||||
onChange="assignedMaterialsController.updateTotalPrice(self.parent)" style="text-align:right" />
|
||||
<doublebox value="@{assignedMaterial.totalPrice}" style="text-align:right" disabled="true" />
|
||||
<decimalbox value="@{assignedMaterial.unitPrice}"
|
||||
onChange="assignedMaterialsController.updateTotalPrice(self.parent)" style="text-align:right"
|
||||
format="@{assignedMaterialsController.moneyFormat}" />
|
||||
<decimalbox value="@{assignedMaterial.totalPrice}" style="text-align:right" disabled="true"
|
||||
format="@{assignedMaterialsController.moneyFormat}" />
|
||||
<listbox mold="select" model="@{materialStatus}"
|
||||
selectedItem="@{assignedMaterial.status}"
|
||||
itemRenderer="org.libreplan.web.common.EnumsListitemRenderer" />
|
||||
|
|
|
|||
|
|
@ -142,20 +142,28 @@
|
|||
<label value="${i18n:_('Work')}" />
|
||||
<decimalbox id="boxWorkBudget" width="150px" scale = "2"
|
||||
value="@{controller.order.workBudget}"
|
||||
onChange="controller.reloadTotalBudget(txtTotalBudget)" />
|
||||
onChange="controller.reloadTotalBudget(txtTotalBudget)"
|
||||
format="@{controller.moneyFormat}" />
|
||||
<separator bar="false" spacing="15px" orient="vertical"/>
|
||||
<label value="${i18n:_('Materials')}" />
|
||||
<decimalbox id="boxMaterialsBudget" width="150px" scale="2"
|
||||
value="@{controller.order.materialsBudget}"
|
||||
onChange="controller.reloadTotalBudget(txtTotalBudget)" />
|
||||
onChange="controller.reloadTotalBudget(txtTotalBudget)"
|
||||
format="@{controller.moneyFormat}" />
|
||||
<separator bar="false" spacing="15px" orient="vertical"/>
|
||||
<label value=" ${i18n:_('Total')} :" />
|
||||
<label id="txtTotalBudget" value="@{controller.order.totalBudget}"/>
|
||||
<decimalbox id="txtTotalBudget" width="150px"
|
||||
value="@{controller.order.totalBudget}"
|
||||
format="@{controller.moneyFormat}"
|
||||
disabled="true" />
|
||||
</hbox>
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Calculated budget')}" />
|
||||
<label id="budget" value="@{controller.order.budget}" />
|
||||
<decimalbox id="budget" width="150px"
|
||||
value="@{controller.order.budget}"
|
||||
format="@{controller.moneyFormat}"
|
||||
disabled="true" />
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Total hours')}" />
|
||||
|
|
|
|||
|
|
@ -149,14 +149,20 @@
|
|||
<row>
|
||||
<label
|
||||
value="${i18n:_('Budget in money')}:" />
|
||||
<label
|
||||
value="@{assignedHoursToOrderElementController.budget}" />
|
||||
<hbox>
|
||||
<label
|
||||
value="@{assignedHoursToOrderElementController.budget}" />
|
||||
<label value="@{assignedHoursToOrderElementController.currencySymbol}" />
|
||||
</hbox>
|
||||
</row>
|
||||
<row>
|
||||
<label
|
||||
value="${i18n:_('Money spent')}:" />
|
||||
<label
|
||||
value="@{assignedHoursToOrderElementController.moneyCost}" />
|
||||
<hbox>
|
||||
<label
|
||||
value="@{assignedHoursToOrderElementController.moneyCost}" />
|
||||
<label value="@{assignedHoursToOrderElementController.currencySymbol}" />
|
||||
</hbox>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
|
|
|||
|
|
@ -66,7 +66,8 @@
|
|||
<decimalbox id="budget"
|
||||
value="@{detailsController.orderElement.budget}"
|
||||
disabled="@{detailsController.container}"
|
||||
constraint="no negative:${i18n:_('Budget value cannot be negative')}" />
|
||||
constraint="no negative:${i18n:_('Budget value cannot be negative')}"
|
||||
format="@{detailsController.moneyFormat}" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
|
|
|||
|
|
@ -116,7 +116,10 @@
|
|||
<listcell label="@{material.code}" />
|
||||
<listcell label="@{material.description}" />
|
||||
<listcell label="@{material.unitType.measure}" />
|
||||
<listcell label="@{material.defaultUnitPrice}" />
|
||||
<listcell>
|
||||
<label value="@{material.defaultUnitPrice}" />
|
||||
<label value="@{assignedMaterialsController.currencySymbol}" />
|
||||
</listcell>
|
||||
<listcell label="@{material.category.name}" />
|
||||
</listitem>
|
||||
</listbox>
|
||||
|
|
|
|||
|
|
@ -50,7 +50,8 @@
|
|||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Subcontract price')}" />
|
||||
<decimalbox value="@{subController.subcontractedTaskData.subcontractPrice}" />
|
||||
<decimalbox value="@{subController.subcontractedTaskData.subcontractPrice}"
|
||||
format="@{subController.moneyFormat}" />
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Subcontracted code')}" />
|
||||
|
|
|
|||
|
|
@ -60,7 +60,8 @@
|
|||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Budget')}" />
|
||||
<decimalbox id="budget" disabled="true" />
|
||||
<decimalbox id="budget" disabled="true"
|
||||
format="@{propertiesController.moneyFormat}" />
|
||||
</row>
|
||||
<row id="startConstraint">
|
||||
<label value="${i18n:_('Constraint')}" />
|
||||
|
|
|
|||
|
|
@ -90,7 +90,8 @@
|
|||
<decimalbox
|
||||
value="@{templatesForOrdersController.template.budget}"
|
||||
disabled="@{templatesForOrdersController.container}"
|
||||
constraint="no negative:${i18n:_('Budget value cannot be negative')}" />
|
||||
constraint="no negative:${i18n:_('Budget value cannot be negative')}"
|
||||
format="@{templatesForOrdersController.moneyFormat}" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
|
|
|||
|
|
@ -44,9 +44,11 @@
|
|||
onSelect = "assignedMaterialsController.selectUnitType(self)"
|
||||
itemRenderer="@{assignedMaterialsController.renderer}"
|
||||
disabled="true"/>
|
||||
<doublebox value="@{assignedMaterial.unitPrice}"
|
||||
onChange="assignedMaterialsController.updateTotalPrice(self.parent)" />
|
||||
<doublebox id="totalPrice" value="@{assignedMaterial.totalPrice}" disabled="${true}"/>
|
||||
<decimalbox value="@{assignedMaterial.unitPrice}"
|
||||
onChange="assignedMaterialsController.updateTotalPrice(self.parent)"
|
||||
format="@{assignedMaterialsController.moneyFormat}" />
|
||||
<decimalbox id="totalPrice" value="@{assignedMaterial.totalPrice}" disabled="${true}"
|
||||
format="@{assignedMaterialsController.moneyFormat}" />
|
||||
<label value="@{assignedMaterial.material.category.name}" width="150px" />
|
||||
<hbox>
|
||||
<button sclass="icono"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue