use of javafx.event.ActionEvent in project Money-Manager by krHasan.
the class MakeATransactionController method exbtnAdvancedSaveAndAdd.
@FXML
private void exbtnAdvancedSaveAndAdd(ActionEvent event) {
if (total == 0) {
exlblAdvWarningMsg.setText("Empty or Zero is not approved.");
} else {
TextField[] AdvancedExtxt = { extxtAdvSector1, extxtAdvSector2, extxtAdvSector3, extxtAdvSector4, extxtAdvSector5, extxtAdvSector6, extxtAdvSector7 };
Label[] AdvancedExlbl = { exlblAdvSector1, exlblAdvSector2, exlblAdvSector3, exlblAdvSector4, exlblAdvSector5, exlblAdvSector6, exlblAdvSector7 };
int index = 0;
for (TextField textField : AdvancedExtxt) {
if ((!textField.getText().isEmpty()) && (!textField.getText().equals("0"))) {
exAdvSaveFunction(textField.getText(), AdvancedExlbl[index].getText());
}
++index;
}
exInitialize();
extxtAdvancedDescription.clear();
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Successfull Transaction");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText("Your transaction completed successfully.");
Stage MakeATransactionStage = (Stage) exbtnSave.getScene().getWindow();
confirmationMsg.setX(MakeATransactionStage.getX() + 200);
confirmationMsg.setY(MakeATransactionStage.getY() + 29);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
confirmationMsg.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
confirmationMsg.showAndWait();
}
}
use of javafx.event.ActionEvent in project Money-Manager by krHasan.
the class MakeATransactionController method bnkSaveBtn.
@FXML
private void bnkSaveBtn(ActionEvent event) {
if (bnkSelectedTabName.equals("bKash")) {
if (amountIsZero(bktxtAmount.getText())) {
Alert alert = new Alert(AlertType.WARNING);
alert.setTitle("Transaction Failed");
alert.setHeaderText(null);
alert.setContentText("Zero or Empty is not allowed");
Stage MakeATransactionStage = (Stage) btnSignOut.getScene().getWindow();
alert.setX(MakeATransactionStage.getX() + 200);
alert.setY(MakeATransactionStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
alert.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
alert.showAndWait();
} else {
bnkSaveFunction();
}
} else if (bnkSelectedTabName.equals("Rocket")) {
if (amountIsZero(roctxtAmount.getText())) {
Alert alert = new Alert(AlertType.WARNING);
alert.setTitle("Transaction Failed");
alert.setHeaderText(null);
alert.setContentText("Zero or Empty is not allowed");
Stage MakeATransactionStage = (Stage) btnSignOut.getScene().getWindow();
alert.setX(MakeATransactionStage.getX() + 200);
alert.setY(MakeATransactionStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
alert.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
alert.showAndWait();
} else {
bnkSaveFunction();
}
} else {
if (amountIsZero(pertxtAmount.getText())) {
Alert alert = new Alert(AlertType.WARNING);
alert.setTitle("Transaction Failed");
alert.setHeaderText(null);
alert.setContentText("Zero or Empty is not allowed");
Stage MakeATransactionStage = (Stage) btnSignOut.getScene().getWindow();
alert.setX(MakeATransactionStage.getX() + 200);
alert.setY(MakeATransactionStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
alert.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
alert.showAndWait();
} else {
bnkSaveFunction();
}
}
}
use of javafx.event.ActionEvent in project Money-Manager by krHasan.
the class MakeATransactionController method exbtnAdvancedAdjustBalance.
@FXML
private void exbtnAdvancedAdjustBalance(ActionEvent event) {
TextInputDialog dialog = new TextInputDialog();
dialog.setTitle("Adjust Wallet Balance");
dialog.setHeaderText("Provide Balance Status at Your Hand Now.");
dialog.setContentText("Please enter the amount:");
Stage MakeATransactionStage = (Stage) exbtnAdjustBalance.getScene().getWindow();
dialog.setX(MakeATransactionStage.getX() + 200);
dialog.setY(MakeATransactionStage.getY() + 170);
Optional<String> result = dialog.showAndWait();
if (result.isPresent()) {
String typedAmount = result.get();
if (!validAmount(typedAmount)) {
Alert alert = new Alert(AlertType.WARNING);
alert.setTitle("Transaction Failed");
alert.setHeaderText(null);
alert.setContentText(InvalidInput);
alert.setX(MakeATransactionStage.getX() + 200);
alert.setY(MakeATransactionStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
alert.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
alert.showAndWait();
} else if (amountIsZero(typedAmount)) {
Alert alert = new Alert(AlertType.WARNING);
alert.setTitle("Transaction Failed");
alert.setHeaderText(null);
alert.setContentText("Zero is not approved.");
alert.setX(MakeATransactionStage.getX() + 200);
alert.setY(MakeATransactionStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
alert.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
alert.showAndWait();
} else {
long dbWalletBalance = currentWalletBalance();
long typedBalance = stringToLong(typedAmount);
String exAdvAdjustBalAfter = typedAmount;
String exAdvAdjustAmount;
if (dbWalletBalance < typedBalance) {
exAdvAdjustAmount = "added " + longToString(typedBalance - dbWalletBalance) + " to Wallet";
} else if (dbWalletBalance > typedBalance) {
exAdvAdjustAmount = exWalletBalanceAfter(typedAmount);
} else {
exAdvAdjustAmount = "0.0";
}
try {
Map<String, String> expenseData = new HashMap<>();
expenseData.put("exTime", timeToSave());
expenseData.put("exDate", (new DateFormatManager()).toString(exdateAdvancedDate.getValue()));
expenseData.put("exMonth", monthToSave(exdateAdvancedDate.getValue()));
expenseData.put("exAmount", exAdvAdjustAmount);
if (exIsAdvDescripionEmpty()) {
expenseData.put("exDescription", "You have adjusted your Wallet Balance");
} else {
expenseData.put("exDescription", extxtAdvancedDescription.getText());
}
expenseData.put("exSector", "Adjusted Balance");
expenseData.put("exWalletBalanceBefore", getWalletBalance());
expenseData.put("exWalletBalanceAfter", exAdvAdjustBalAfter);
setCurrentWalletBalance(exAdvAdjustBalAfter);
(new Expense()).saveExpenseData(expenseData);
(new ComboboxList()).setAllMonth(monthToSave(exdateAdvancedDate.getValue()), yearToSave(exdateAdvancedDate.getValue()));
(new ComboboxList()).setAllExMonth(monthToSave(exdateAdvancedDate.getValue()), yearToSave(exdateAdvancedDate.getValue()));
exInitialize();
extxtAdvancedDescription.clear();
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Successfull Transaction");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText("Successful");
confirmationMsg.setX(MakeATransactionStage.getX() + 200);
confirmationMsg.setY(MakeATransactionStage.getY() + 29);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
confirmationMsg.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
confirmationMsg.showAndWait();
} catch (Exception e) {
Alert alert = new Alert(AlertType.WARNING);
alert.setTitle("Transaction Failed");
alert.setHeaderText(null);
alert.setContentText("There something is wrong.");
alert.setX(MakeATransactionStage.getX() + 200);
alert.setY(MakeATransactionStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
alert.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
alert.showAndWait();
}
}
}
}
use of javafx.event.ActionEvent in project Money-Manager by krHasan.
the class MakeATransactionController method gmbtnSaveAdd.
@FXML
private void gmbtnSaveAdd(ActionEvent event) {
if (amountIsZero(gmtxtAmount.getText())) {
gmlblWarningMsg.setText("Empty or Zero is not approved.");
} else {
try {
Map<String, String> stringData = new HashMap<>();
stringData.put("gmTime", timeToSave());
stringData.put("gmDate", (new DateFormatManager()).toString(gmdateDate.getValue()));
stringData.put("gmMonth", monthToSave(gmdateDate.getValue()));
stringData.put("gmAmount", gmtxtAmount.getText());
if ((gmcmboMethod.getValue()).equals("bKash")) {
stringData.put("gmBankCharge", bkashBnkCharge(gmtxtAmount.getText(), "Cash In"));
} else if ((gmcmboMethod.getValue()).equals("Rocket")) {
stringData.put("gmBankCharge", rocketBnkCharge(gmtxtAmount.getText(), "Cash In", gmGetSelectedrbtnName()));
} else {
stringData.put("gmBankCharge", "0.00");
}
if ((gmcmboMethod.getValue()).equals("bKash")) {
stringData.put("gmAmountNature", "Cash In from Agent");
} else if ((gmcmboMethod.getValue()).equals("Rocket")) {
stringData.put("gmAmountNature", gmGetSelectedrbtnName());
} else {
stringData.put("gmAmountNature", "None");
}
if ((gmcmboMethod.getValue()).equals("bKash")) {
stringData.put("bkBalanceAfter", updatedbKashBalance(gmtxtAmount.getText(), "Cash In"));
(new Bkash()).saveGmBkashData(stringData);
} else if ((gmcmboMethod.getValue()).equals("Rocket")) {
stringData.put("rocBalanceAfter", updatedRocketBalance(gmtxtAmount.getText(), "Cash In", gmGetSelectedrbtnName()));
(new Rocket()).saveGmRocketData(stringData);
}
stringData.put("gmSource", gmcmboSource.getValue());
if (gmIsDescripionEmpty()) {
stringData.put("gmDescription", "None");
} else {
stringData.put("gmDescription", gmtxtDescription.getText());
}
stringData.put("gmMethod", gmcmboMethod.getValue());
stringData.put("gmWalletBalanceBefore", getWalletBalance());
if ((gmcmboMethod.getValue()).equals("Hand to Hand")) {
stringData.put("gmWalletBalanceAfter", gmWalletBalanceAfter(gmtxtAmount.getText()));
setCurrentWalletBalance(gmWalletBalanceAfter(gmtxtAmount.getText()));
} else {
stringData.put("gmWalletBalanceAfter", getWalletBalance());
}
(new GetMoney()).saveGetMoneyData(stringData);
(new ComboboxList()).setAllMonth(monthToSave(gmdateDate.getValue()), yearToSave(gmdateDate.getValue()));
(new ComboboxList()).setAllGmMonth(monthToSave(gmdateDate.getValue()), yearToSave(gmdateDate.getValue()));
gmInitialize();
gmtxtAmount.clear();
gmtxtDescription.clear();
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Successfull Transaction");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText("Successful");
Stage MakeATransactionStage = (Stage) gmbtnSave.getScene().getWindow();
confirmationMsg.setX(MakeATransactionStage.getX() + 200);
confirmationMsg.setY(MakeATransactionStage.getY() + 29);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
confirmationMsg.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
confirmationMsg.showAndWait();
} catch (Exception e) {
Alert alert = new Alert(AlertType.WARNING);
alert.setTitle("Transaction Failed");
alert.setHeaderText(null);
alert.setContentText("There something is wrong.");
Stage MakeATransactionStage = (Stage) gmbtnSave.getScene().getWindow();
alert.setX(MakeATransactionStage.getX() + 200);
alert.setY(MakeATransactionStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
alert.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
alert.showAndWait();
}
}
cancelbtnPressed = true;
}
use of javafx.event.ActionEvent in project Money-Manager by krHasan.
the class MakeATransactionController method exbtnAdvancedSave.
@FXML
private void exbtnAdvancedSave(ActionEvent event) {
if (total == 0) {
exlblAdvWarningMsg.setText("Empty or Zero is not approved.");
} else {
TextField[] AdvancedExtxt = { extxtAdvSector1, extxtAdvSector2, extxtAdvSector3, extxtAdvSector4, extxtAdvSector5, extxtAdvSector6, extxtAdvSector7 };
Label[] AdvancedExlbl = { exlblAdvSector1, exlblAdvSector2, exlblAdvSector3, exlblAdvSector4, exlblAdvSector5, exlblAdvSector6, exlblAdvSector7 };
int index = 0;
for (TextField textField : AdvancedExtxt) {
if ((!textField.getText().isEmpty()) && (!textField.getText().equals("0"))) {
exAdvSaveFunction(textField.getText(), AdvancedExlbl[index].getText());
}
++index;
}
exInitialize();
extxtAdvancedDescription.clear();
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Successful Transaction");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText("Successful");
Stage MakeATransactionStage = (Stage) exbtnSave.getScene().getWindow();
confirmationMsg.setX(MakeATransactionStage.getX() + 200);
confirmationMsg.setY(MakeATransactionStage.getY() + 29);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
confirmationMsg.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
confirmationMsg.showAndWait();
(new GoToOperation()).goToDashboard(MakeATransactionStage);
}
}
Aggregations