posGridBuilder.newSplitPanel(GridSize.COL50, true);
posGridBuilder.newSubSplitPanel(GridSize.COL33);
{
final FieldsetPanel fieldset = posGridBuilder.newFieldset(getString("fibu.common.netto")).setLabelSide(false)
.suppressLabelForWarning();
final TextPanel netTextPanel = new TextPanel(fieldset.newChildId(), new Model<String>() {
@Override
public String getObject()
{
return CurrencyFormatter.format(position.getNetSum());
};
});
ajaxUpdatePositionComponents.add(netTextPanel.getLabel4Ajax());
fieldset.add(netTextPanel);
}
}
{
posGridBuilder.newSubSplitPanel(GridSize.COL33);
{
final FieldsetPanel fieldset = posGridBuilder.newFieldset(getString("fibu.common.vatAmount")).setLabelSide(false)
.suppressLabelForWarning();
final TextPanel vatTextPanel = new TextPanel(fieldset.newChildId(), new Model<String>() {
@Override
public String getObject()
{
return CurrencyFormatter.format(position.getVatAmount());
};
});
fieldset.add(vatTextPanel);
ajaxUpdatePositionComponents.add(vatTextPanel.getLabel4Ajax());
}
}
{
posGridBuilder.newSubSplitPanel(GridSize.COL33);
{
final FieldsetPanel fieldset = posGridBuilder.newFieldset(getString("fibu.common.brutto")).setLabelSide(false)
.suppressLabelForWarning();
final TextPanel grossTextPanel = new TextPanel(fieldset.newChildId(), new Model<String>() {
@Override
public String getObject()
{
return CurrencyFormatter.format(position.getBruttoSum());
};
});
fieldset.add(grossTextPanel);
ajaxUpdatePositionComponents.add(grossTextPanel.getLabel4Ajax());
}
}
{
// Text
if (costConfigured == true) {
posGridBuilder.newSplitPanel(GridSize.COL50);
} else {
posGridBuilder.newGridPanel();
}
final FieldsetPanel fieldset = posGridBuilder.newFieldset(getString("fibu.rechnung.text"));
fieldset.add(new MaxLengthTextArea(TextAreaPanel.WICKET_ID, new PropertyModel<String>(position, "text")), true);
}
if (costConfigured == true) {
{
// Cost assignments
posGridBuilder.newSplitPanel(GridSize.COL50, true);
{
posGridBuilder.newSubSplitPanel(GridSize.COL50);
DivPanel panel = posGridBuilder.getPanel();
final RechnungCostTablePanel costTable = new RechnungCostTablePanel(panel.newChildId(), position) {
/**
* @see org.projectforge.web.fibu.RechnungCostTablePanel#onRenderCostRow(org.projectforge.fibu.AbstractRechnungsPositionDO,
* org.apache.wicket.Component, org.apache.wicket.Component)
*/
@Override
protected void onRenderCostRow(final AbstractRechnungsPositionDO position, final KostZuweisungDO costAssignment,
final Component cost1, final Component cost2)
{
AbstractRechnungEditForm.this.onRenderCostRow(position, costAssignment, cost1, cost2);
}
};
panel.add(costTable);
ajaxUpdatePositionComponents.add(costTable.refresh().getTable());
posGridBuilder.newSubSplitPanel(GridSize.COL50);
panel = posGridBuilder.getPanel();
final BigDecimal fehlbetrag = position.getKostZuweisungNetFehlbetrag();
if (hasInsertAccess == true) {
ButtonType buttonType;
if (NumberHelper.isNotZero(fehlbetrag) == true) {
buttonType = ButtonType.RED;
} else {
buttonType = ButtonType.LIGHT;
}
final AjaxButton editCostButton = new AjaxButton(ButtonPanel.BUTTON_ID, this) {
@Override
protected void onSubmit(final AjaxRequestTarget target, final Form< ? > form)
{
costEditModalDialog.open(target);
// Redraw the content:
costEditModalDialog.redraw(position, costTable);
// The content was changed:
costEditModalDialog.addContent(target);
}
@Override
protected void onError(final AjaxRequestTarget target, final Form< ? > form)
{
target.add(AbstractRechnungEditForm.this.feedbackPanel);
}
};
editCostButton.setDefaultFormProcessing(false);
panel.add(new ButtonPanel(panel.newChildId(), getString("edit"), editCostButton, buttonType));
} else {
panel.add(new TextPanel(panel.newChildId(), " "));
}
panel.add(new TextPanel(panel.newChildId(), new Model<String>() {
@Override
public String getObject()
{
final BigDecimal fehlbetrag = position.getKostZuweisungNetFehlbetrag();
if (NumberHelper.isNotZero(fehlbetrag) == true) {