use of tab.GetMoney 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 tab.GetMoney in project Money-Manager by krHasan.
the class MakeATransactionController method gmSavebtn.
@FXML
private void gmSavebtn(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();
(new GoToOperation()).goToDashboard(MakeATransactionStage);
} 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();
}
}
}
use of tab.GetMoney in project Money-Manager by krHasan.
the class MakeATransactionController method bnkSaveFunction.
private void bnkSaveFunction() {
Map<String, String> bnkData = new HashMap<>();
if (bnkSelectedTabName.equals("bKash")) {
try {
bnkData.put("bkTime", timeToSave());
bnkData.put("bkDate", (new DateFormatManager()).toString(bnkdateDate.getValue()));
bnkData.put("bkMonth", monthToSave(bnkdateDate.getValue()));
bnkData.put("bkBalanceBefore", getbkAccountBalance());
if (bnkAdjustBtnPressed) {
bnkData.put("bkType", "Adjusted Balance");
bnkData.put("bkNature", "Adjusted Balance");
bnkData.put("bkAmount", bnkAdjustAmount);
bnkData.put("bkBnkCharge", "None");
bnkData.put("bkBalanceAfter", bnkAdjustBalAfter);
(new Bkash()).saveBnkBkashData(bnkData);
setCurrentbKashBalance(bnkAdjustBalAfter);
} else {
bnkData.put("bkType", bkcmboTransactionType.getValue());
if (bkcmboAmountNature.getValue().equals("Credit")) {
bnkData.put("bkNature", "Credited by " + bkGetSelectedRbtn());
} else {
bnkData.put("bkNature", "Debited by " + bkGetSelectedRbtn());
}
bnkData.put("bkAmount", bktxtAmount.getText());
bnkData.put("bkBnkCharge", bkBankChargeShow());
bnkData.put("bkBalanceAfter", updatedbKashBalance(bktxtAmount.getText(), bkGetSelectedRbtn()));
if (bkcmboAmountNature.getValue().equals("Debit")) {
if (bkcmboTransactionType.getValue().equals("Personal")) {
bnkData.put("gmWalletBalanceBefore", longToString(currentWalletBalance()));
bnkData.put("gmWalletBalanceAfter", gmWalletBalanceAfter(bktxtAmount.getText()));
setCurrentWalletBalance(gmWalletBalanceAfter(bktxtAmount.getText()));
} else if (bkcmboTransactionType.getValue().equals("Get Money")) {
bnkData.put("gmWalletBalanceBefore", longToString(currentWalletBalance()));
bnkData.put("gmWalletBalanceAfter", gmWalletBalanceAfter(bktxtAmount.getText()));
(new GetMoney()).saveBnkBkashData(bnkData);
setCurrentWalletBalance(gmWalletBalanceAfter(bktxtAmount.getText()));
}
}
(new Bkash()).saveBnkBkashData(bnkData);
setCurrentbKashBalance(updatedbKashBalance(bktxtAmount.getText(), bkGetSelectedRbtn()));
}
(new ComboboxList()).setAllMonth(monthToSave(bnkdateDate.getValue()), yearToSave(bnkdateDate.getValue()));
bkInitialize();
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Successful Transaction");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText("Successful");
Stage MakeATransactionStage = (Stage) btnSignOut.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) 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 if (bnkSelectedTabName.equals("Rocket")) {
try {
bnkData.put("rocTime", timeToSave());
bnkData.put("rocDate", (new DateFormatManager()).toString(bnkdateDate.getValue()));
bnkData.put("rocMonth", monthToSave(bnkdateDate.getValue()));
bnkData.put("rocBalanceBefore", getRocAccountBalance());
if (bnkAdjustBtnPressed) {
bnkData.put("rocType", "Adjusted Balance");
bnkData.put("rocNature", "Adjusted Balance");
bnkData.put("rocAmount", bnkAdjustAmount);
bnkData.put("rocBnkCharge", "None");
bnkData.put("rocBalanceAfter", bnkAdjustBalAfter);
(new Rocket()).saveBnkRocketData(bnkData);
setCurrentRocketBalance(bnkAdjustBalAfter);
} else {
bnkData.put("rocType", roccmboTransactionType.getValue());
if (roccmboAmountNature.getValue().equals("Credit")) {
bnkData.put("rocNature", "Credited by " + rocGetSelectedRbtn());
} else {
bnkData.put("rocNature", "Debited by " + rocGetSelectedRbtn());
}
bnkData.put("rocAmount", roctxtAmount.getText());
bnkData.put("rocBnkCharge", rocBankChargeShow());
if (roccmboAmountNature.getValue().equals("Credit")) {
bnkData.put("rocBalanceAfter", updatedRocketBalance(roctxtAmount.getText(), "Cash In", rocGetSelectedRbtn()));
setCurrentRocketBalance(updatedRocketBalance(roctxtAmount.getText(), "Cash In", rocGetSelectedRbtn()));
} else {
bnkData.put("rocBalanceAfter", updatedRocketBalance(roctxtAmount.getText(), "Cash Out", rocGetSelectedRbtn()));
setCurrentRocketBalance(updatedRocketBalance(roctxtAmount.getText(), "Cash Out", rocGetSelectedRbtn()));
if (roccmboTransactionType.getValue().equals("Personal")) {
bnkData.put("gmWalletBalanceBefore", longToString(currentWalletBalance()));
bnkData.put("gmWalletBalanceAfter", gmWalletBalanceAfter(roctxtAmount.getText()));
setCurrentWalletBalance(gmWalletBalanceAfter(roctxtAmount.getText()));
} else if (roccmboTransactionType.getValue().equals("Get Money")) {
bnkData.put("gmWalletBalanceBefore", longToString(currentWalletBalance()));
bnkData.put("gmWalletBalanceAfter", gmWalletBalanceAfter(roctxtAmount.getText()));
(new GetMoney()).saveBnkRocketData(bnkData);
setCurrentWalletBalance(gmWalletBalanceAfter(roctxtAmount.getText()));
}
}
(new Rocket()).saveBnkRocketData(bnkData);
}
(new ComboboxList()).setAllMonth(monthToSave(bnkdateDate.getValue()), yearToSave(bnkdateDate.getValue()));
rocInitialize();
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Successfull Transaction");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText("Successful");
Stage MakeATransactionStage = (Stage) btnSignOut.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) 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 {
try {
bnkData.put("perTime", timeToSave());
bnkData.put("perDate", (new DateFormatManager()).toString(bnkdateDate.getValue()));
bnkData.put("perMonth", monthToSave(bnkdateDate.getValue()));
bnkData.put("perNature", percmboAmountNature.getValue());
bnkData.put("perAmount", pertxtAmount.getText());
bnkData.put("perBalanceBefore", getPerAccountBalance());
if (percmboAmountNature.getValue().equals("Credit")) {
bnkData.put("perBalanceAfter", updatedPersonalBalance(pertxtAmount.getText(), "Credit"));
bnkData.put("gmWalletBalanceBefore", longToString(currentWalletBalance()));
bnkData.put("gmWalletBalanceAfter", exWalletBalanceAfter(pertxtAmount.getText()));
setCurrentWalletBalance(exWalletBalanceAfter(pertxtAmount.getText()));
setCurrentPersonalBalance(updatedPersonalBalance(pertxtAmount.getText(), "Credit"));
} else {
bnkData.put("perBalanceAfter", updatedPersonalBalance(pertxtAmount.getText(), "Debit"));
bnkData.put("gmWalletBalanceBefore", longToString(currentWalletBalance()));
bnkData.put("gmWalletBalanceAfter", gmWalletBalanceAfter(pertxtAmount.getText()));
setCurrentWalletBalance(gmWalletBalanceAfter(pertxtAmount.getText()));
setCurrentPersonalBalance(updatedPersonalBalance(pertxtAmount.getText(), "Debit"));
}
(new Personal()).saveBnkPersonalData(bnkData);
(new ComboboxList()).setAllMonth(monthToSave(bnkdateDate.getValue()), yearToSave(bnkdateDate.getValue()));
perInitialize();
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Successfull Transaction");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText("Successful");
Stage MakeATransactionStage = (Stage) btnSignOut.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) 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();
}
}
}
Aggregations