IDEMPIERE-6257: WListbox cannot add total line for Integer (#2470)

* IDEMPIERE-6257: WListbox cannot add total line for Integer

* IDEMPIERE-6257: WListbox cannot add total line for Integer

implement Carlos's suggestion (to reduce number of lines)

Co-Authored-By: Carlos Ruiz <carg67@gmail.com>

---------

Co-authored-by: Carlos Ruiz <carg67@gmail.com>
This commit is contained in:
Nicolas Micoud 2024-10-03 14:27:31 +02:00 committed by Carlos Ruiz
parent f60f599619
commit 43c78b3018
1 changed files with 13 additions and 5 deletions

View File

@ -1234,7 +1234,19 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis
if(amt == null )
amt = Double.valueOf(0);
total[col] = subtotal + amt;
}
else if (c == Integer.class)
{
Integer subtotal = Integer.valueOf(0);
if(total[col] != null)
subtotal = (Integer)(total[col]);
Integer amt = (Integer) data;
if(subtotal == null)
subtotal = Integer.valueOf(0);
if(amt == null )
amt = Integer.valueOf(0);
total[col] = subtotal + amt;
}
}
}
@ -1246,14 +1258,10 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis
for (int col = 0; col < layout.length; col++)
{
Class<?> c = layout[col].getColClass();
if (c == BigDecimal.class)
if (c == BigDecimal.class || c == Double.class || c == Integer.class)
{
setValueAt(total[col] , row - 1, col);
}
else if (c == Double.class)
{
setValueAt(total[col] , row -1 , col);
}
else
{
if(col == 0 )