Skip to content
Snippets Groups Projects
Commit 6aa7ec63 authored by Harry Linrui XU's avatar Harry Linrui XU
Browse files

Validate budget setup, such that the entire budget amount must be used up before proceeding

parent 6060e55b
No related branches found
No related tags found
1 merge request!53Button validation confirmation
......@@ -127,10 +127,24 @@ public class BudgetController extends FinanceController {
ioe.printStackTrace();
showErrorDialogBox(ioe.getMessage(), ioe.getMessage(), ioe.getMessage());
}
double maxAmount = general.getMaxAmount();
//Set calendar, disposable amount and amount left
formatDatePicker();
disposableAmount.setText(String.valueOf(general.getMaxAmount()));
amountLeft.setText(String.valueOf(general.getMaxAmount()));
disposableAmount.setText(String.valueOf(maxAmount));
amountLeft.setText(String.valueOf(maxAmount));
//Prevent proceeding until all of budget has been used up
continueBtn.addEventFilter(
ActionEvent.ACTION, event -> {
if (maxAmount - general.totalSum() != 0) {
event.consume();
showErrorDialogBox("Use up budget",
"Please distribute the entire disposable amount",
"The amount must be used up before proceeding");
}
}
);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment