Hi,
I would like to input code for calculate amount.
Below is my code;
public class OrderEdit extends AbstractEditor<Order> {
@Inject
private CollectionDatasource<OrderLine, java.util.UUID> linesDs;
@java.lang.Override
public void init(java.util.Map<java.lang.String, java.lang.Object> params) {
linesDs.addCollectionChangeListener(e -> calculateAmount());
}
private void calculateAmount(){
BigDecimal amount = BigDecimal.ZERO;
for (OrderLine line : linesDs.getItems())
amount = amount.add(line.getProduct().getPrice().multiply(line.getQuantity()));
getItem().setAmount(amount);
}
}
But when I run my application, there is an error as per below,
CharSequenceCompilerException: Compilation failed. Causes:
OrderEdit.java:22: error: cannot find symbol
BigDecimal amount = BigDecimal.ZERO;
^
symbol: class BigDecimal
location: class com.company.bizops.web.order.OrderEdit OrderEdit.java:22: error: cannot find symbol
BigDecimal amount = BigDecimal.ZERO;
^
symbol: variable BigDecimal
location: class com.company.bizops.web.order.OrderEdit
Can anyone help me figure out this issue?