Search in sources :

Example 11 with ComboboxList

use of operation.ComboboxList in project Money-Manager by krHasan.

the class MakeATransactionController method lendSaveBtn.

@FXML
private void lendSaveBtn(ActionEvent event) {
    Map<String, String> boleData = new HashMap<>();
    try {
        if (selectedTabName.equals("Borrow")) {
            if (bocmboType.getValue().equals("Money Take")) {
                // Borrow, Money Take, bKash
                if (bocmboMethod.getValue().equals("bKash")) {
                    if (amountIsZero(botxtAmountWithCharge.getText()) || letterCount(botxtFromWhom.getText()) == 100 || amountIsZero(botxtExactAmount.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) lendbtnSave.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 {
                        boleData.put("boTime", timeToSave());
                        boleData.put("boDate", (new DateFormatManager()).toString(lenddateDate.getValue()));
                        boleData.put("boMonth", monthToSave(lenddateDate.getValue()));
                        boleData.put("boType", bocmboType.getValue());
                        boleData.put("boMethod", bocmboMethod.getValue());
                        boleData.put("boWhom", botxtFromWhom.getText());
                        boleData.put("boTk", botxtAmountWithCharge.getText());
                        boleData.put("boNature", "None");
                        boleData.put("boBnkCharge", boBankChargeShow());
                        boleData.put("boBalanceBefore", longToString(totalBorrowTk()));
                        boleData.put("boBalanceAfter", updatedTotalBorrowTk(botxtExactAmount.getText(), "Money Take"));
                        boleData.put("boExactTk", botxtExactAmount.getText());
                        boleData.put("bkBalanceBefore", longToString(currentbKashBalance()));
                        boleData.put("bkBalanceAfter", updatedbKashBalance(botxtAmountWithCharge.getText(), "Cash In"));
                        (new Borrow()).addBorrowSummaryData(boleData);
                        (new Bkash()).saveBorrowBkashData(boleData);
                        (new Borrow()).saveBorrowData(boleData);
                        (new ComboboxList()).setAllMonth(monthToSave(lenddateDate.getValue()), yearToSave(lenddateDate.getValue()));
                        setCurrentbKashBalance(updatedbKashBalance(botxtAmountWithCharge.getText(), "Cash In"));
                        // setCurrentbKashBalance(boBkBalanceAfter(botxtAmountWithCharge.getText(), boBankChargeShow(), "Money Take"));
                        setTotalBorrowTk(updatedTotalBorrowTk(botxtExactAmount.getText(), "Money Take"));
                        boInitialize();
                        Alert confirmationMsg = new Alert(AlertType.INFORMATION);
                        confirmationMsg.setTitle("Successfull Transaction");
                        confirmationMsg.setHeaderText(null);
                        confirmationMsg.setContentText("Successful");
                        Stage MakeATransactionStage = (Stage) lendbtnSave.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();
                    }
                // Borrow, Money Take, Rocket
                } else if (bocmboMethod.getValue().equals("Rocket")) {
                    if (amountIsZero(botxtAmountWithCharge.getText()) || letterCount(botxtFromWhom.getText()) == 100 || amountIsZero(botxtExactAmount.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) lendbtnSave.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 {
                        boleData.put("boTime", timeToSave());
                        boleData.put("boDate", (new DateFormatManager()).toString(lenddateDate.getValue()));
                        boleData.put("boMonth", monthToSave(lenddateDate.getValue()));
                        boleData.put("boType", bocmboType.getValue());
                        boleData.put("boMethod", bocmboMethod.getValue());
                        boleData.put("boWhom", botxtFromWhom.getText());
                        boleData.put("boTk", botxtAmountWithCharge.getText());
                        boleData.put("boNature", boGetSelectedrbtnName());
                        boleData.put("boBnkCharge", boBankChargeShow());
                        boleData.put("boBalanceBefore", longToString(totalBorrowTk()));
                        boleData.put("boBalanceAfter", updatedTotalBorrowTk(botxtExactAmount.getText(), "Money Take"));
                        boleData.put("boExactTk", botxtExactAmount.getText());
                        boleData.put("rocBalanceBefore", longToString(currentRocketBalance()));
                        boleData.put("rocBalanceAfter", updatedRocketBalance(botxtAmountWithCharge.getText(), "Cash In", boGetSelectedrbtnName()));
                        (new Borrow()).addBorrowSummaryData(boleData);
                        (new Rocket()).saveBorrowRocketData(boleData);
                        (new Borrow()).saveBorrowData(boleData);
                        (new ComboboxList()).setAllMonth(monthToSave(lenddateDate.getValue()), yearToSave(lenddateDate.getValue()));
                        setCurrentRocketBalance(updatedRocketBalance(botxtAmountWithCharge.getText(), "Cash In", boGetSelectedrbtnName()));
                        // setCurrentRocketBalance(boRocBalanceAfter(botxtAmountWithCharge.getText(), boBankChargeShow(), "Money Take"));
                        setTotalBorrowTk(updatedTotalBorrowTk(botxtExactAmount.getText(), "Money Take"));
                        boInitialize();
                        Alert confirmationMsg = new Alert(AlertType.INFORMATION);
                        confirmationMsg.setTitle("Successfull Transaction");
                        confirmationMsg.setHeaderText(null);
                        confirmationMsg.setContentText("Successful");
                        Stage MakeATransactionStage = (Stage) lendbtnSave.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();
                    }
                } else {
                    // Borrow, Money Take, Hand to Hand
                    if (amountIsZero(botxtAmountWithCharge.getText()) || letterCount(botxtFromWhom.getText()) == 100) {
                        Alert alert = new Alert(AlertType.WARNING);
                        alert.setTitle("Transaction Failed");
                        alert.setHeaderText(null);
                        alert.setContentText("Zero or Empty is not allowed");
                        Stage MakeATransactionStage = (Stage) lendbtnSave.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 {
                        boleData.put("boTime", timeToSave());
                        boleData.put("boDate", (new DateFormatManager()).toString(lenddateDate.getValue()));
                        boleData.put("boMonth", monthToSave(lenddateDate.getValue()));
                        boleData.put("boType", bocmboType.getValue());
                        boleData.put("boMethod", bocmboMethod.getValue());
                        boleData.put("boWhom", botxtFromWhom.getText());
                        boleData.put("boTk", botxtAmountWithCharge.getText());
                        boleData.put("boNature", "None");
                        boleData.put("boBnkCharge", "None");
                        boleData.put("boBalanceBefore", longToString(totalBorrowTk()));
                        boleData.put("boBalanceAfter", updatedTotalBorrowTk(botxtAmountWithCharge.getText(), "Money Take"));
                        boleData.put("boExactTk", botxtAmountWithCharge.getText());
                        boleData.put("gmWalletBalanceBefore", longToString(currentWalletBalance()));
                        boleData.put("gmWalletBalanceAfter", gmWalletBalanceAfter(botxtAmountWithCharge.getText()));
                        (new Borrow()).saveBorrowData(boleData);
                        (new Borrow()).addBorrowSummaryData(boleData);
                        // if it activate, then you have to change in Undo Class --> undoBorrow() method
                        // (new GetMoney()).saveBorrowGMData(boleData);
                        (new ComboboxList()).setAllMonth(monthToSave(lenddateDate.getValue()), yearToSave(lenddateDate.getValue()));
                        setCurrentWalletBalance(gmWalletBalanceAfter(botxtAmountWithCharge.getText()));
                        setTotalBorrowTk(updatedTotalBorrowTk(botxtAmountWithCharge.getText(), "Money Take"));
                        boInitialize();
                        Alert confirmationMsg = new Alert(AlertType.INFORMATION);
                        confirmationMsg.setTitle("Successfull Transaction");
                        confirmationMsg.setHeaderText(null);
                        confirmationMsg.setContentText("Successful");
                        Stage MakeATransactionStage = (Stage) lendbtnSave.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();
                    }
                }
            } else {
                // Borrow, Return Borrowed Money, bKash
                if (bocmboMethod.getValue().equals("bKash")) {
                    if (amountIsZero(botxtAmountWithCharge.getText()) || amountIsZero(botxtExactAmount.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) lendbtnSave.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 (boRepayValidation(botxtExactAmount.getText(), bocmboRepaidPerson.getValue())) {
                            boleData.put("boTime", timeToSave());
                            boleData.put("boDate", (new DateFormatManager()).toString(lenddateDate.getValue()));
                            boleData.put("boMonth", monthToSave(lenddateDate.getValue()));
                            boleData.put("boType", bocmboType.getValue());
                            boleData.put("boMethod", bocmboMethod.getValue());
                            boleData.put("boWhom", bocmboRepaidPerson.getValue());
                            boleData.put("boTk", botxtAmountWithCharge.getText());
                            boleData.put("boNature", boGetSelectedrbtnName());
                            boleData.put("boBnkCharge", boBankChargeShow());
                            boleData.put("boBalanceBefore", longToString(totalBorrowTk()));
                            boleData.put("boBalanceAfter", updatedTotalBorrowTk(botxtExactAmount.getText(), "Return Borrowed Money"));
                            boleData.put("boExactTk", botxtExactAmount.getText());
                            boleData.put("bkBalanceBefore", longToString(currentbKashBalance()));
                            boleData.put("bkBalanceAfter", updatedbKashBalance(botxtAmountWithCharge.getText(), boGetSelectedrbtnName()));
                            if (boisTypedAmountLessThanBorrowed(botxtExactAmount.getText(), bocmboRepaidPerson.getValue())) {
                                (new Borrow()).updateBorrowSummaryData(boleData);
                            } else {
                                (new Borrow()).deleteBorrowSummaryData(boleData);
                            }
                            (new Bkash()).saveBorrowBkashData(boleData);
                            (new Borrow()).saveBorrowData(boleData);
                            (new ComboboxList()).setAllMonth(monthToSave(lenddateDate.getValue()), yearToSave(lenddateDate.getValue()));
                            setCurrentbKashBalance(updatedbKashBalance(botxtAmountWithCharge.getText(), boGetSelectedrbtnName()));
                            // setCurrentbKashBalance(boBkBalanceAfter(botxtAmountWithCharge.getText(), boBankChargeShow(), "Return Borrowed Money"));
                            setTotalBorrowTk(updatedTotalBorrowTk(botxtExactAmount.getText(), "Return Borrowed Money"));
                            boInitialize();
                            Alert confirmationMsg = new Alert(AlertType.INFORMATION);
                            confirmationMsg.setTitle("Successfull Transaction");
                            confirmationMsg.setHeaderText(null);
                            confirmationMsg.setContentText("Successful");
                            Stage MakeATransactionStage = (Stage) lendbtnSave.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();
                        } else {
                            Alert alert = new Alert(AlertType.WARNING);
                            alert.setTitle("Transaction Failed");
                            alert.setHeaderText(null);
                            alert.setContentText("Amount can't bigger than borrowed amount");
                            Stage MakeATransactionStage = (Stage) lendbtnSave.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();
                        }
                    }
                // Borrow, Return Borrowed Money, Rocket
                } else if (bocmboMethod.getValue().equals("Rocket")) {
                    if (amountIsZero(botxtAmountWithCharge.getText()) || amountIsZero(botxtExactAmount.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) lendbtnSave.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 (boRepayValidation(botxtExactAmount.getText(), bocmboRepaidPerson.getValue())) {
                            boleData.put("boTime", timeToSave());
                            boleData.put("boDate", (new DateFormatManager()).toString(lenddateDate.getValue()));
                            boleData.put("boMonth", monthToSave(lenddateDate.getValue()));
                            boleData.put("boType", bocmboType.getValue());
                            boleData.put("boMethod", bocmboMethod.getValue());
                            boleData.put("boWhom", bocmboRepaidPerson.getValue());
                            boleData.put("boTk", botxtAmountWithCharge.getText());
                            boleData.put("boNature", boGetSelectedrbtnName());
                            boleData.put("boBnkCharge", boBankChargeShow());
                            boleData.put("boBalanceBefore", longToString(totalBorrowTk()));
                            boleData.put("boBalanceAfter", updatedTotalBorrowTk(botxtExactAmount.getText(), "Return Borrowed Money"));
                            boleData.put("boExactTk", botxtExactAmount.getText());
                            boleData.put("rocBalanceBefore", longToString(currentRocketBalance()));
                            boleData.put("rocBalanceAfter", updatedRocketBalance(botxtAmountWithCharge.getText(), "Cash Out", boGetSelectedrbtnName()));
                            if (boisTypedAmountLessThanBorrowed(botxtExactAmount.getText(), bocmboRepaidPerson.getValue())) {
                                (new Borrow()).updateBorrowSummaryData(boleData);
                            } else {
                                (new Borrow()).deleteBorrowSummaryData(boleData);
                            }
                            (new Rocket()).saveBorrowRocketData(boleData);
                            (new Borrow()).saveBorrowData(boleData);
                            (new ComboboxList()).setAllMonth(monthToSave(lenddateDate.getValue()), yearToSave(lenddateDate.getValue()));
                            setCurrentRocketBalance(updatedRocketBalance(botxtAmountWithCharge.getText(), "Cash Out", boGetSelectedrbtnName()));
                            // setCurrentRocketBalance(boRocBalanceAfter(botxtAmountWithCharge.getText(), boBankChargeShow(), "Return Borrowed Money"));
                            setTotalBorrowTk(updatedTotalBorrowTk(botxtExactAmount.getText(), "Return Borrowed Money"));
                            boInitialize();
                            Alert confirmationMsg = new Alert(AlertType.INFORMATION);
                            confirmationMsg.setTitle("Successfull Transaction");
                            confirmationMsg.setHeaderText(null);
                            confirmationMsg.setContentText("Successful");
                            Stage MakeATransactionStage = (Stage) lendbtnSave.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();
                        } else {
                            Alert alert = new Alert(AlertType.WARNING);
                            alert.setTitle("Transaction Failed");
                            alert.setHeaderText(null);
                            alert.setContentText("Amount can't bigger than borrowed amount");
                            Stage MakeATransactionStage = (Stage) lendbtnSave.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 {
                    // Borrow, Return Borrowed Money, Hand to Hand
                    if (amountIsZero(botxtAmountWithCharge.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) lendbtnSave.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 (boRepayValidation(botxtAmountWithCharge.getText(), bocmboRepaidPerson.getValue())) {
                            boleData.put("boTime", timeToSave());
                            boleData.put("boDate", (new DateFormatManager()).toString(lenddateDate.getValue()));
                            boleData.put("boMonth", monthToSave(lenddateDate.getValue()));
                            boleData.put("boType", bocmboType.getValue());
                            boleData.put("boMethod", bocmboMethod.getValue());
                            boleData.put("boWhom", bocmboRepaidPerson.getValue());
                            boleData.put("boTk", botxtAmountWithCharge.getText());
                            boleData.put("boNature", "None");
                            boleData.put("boBnkCharge", "None");
                            boleData.put("boBalanceBefore", longToString(totalBorrowTk()));
                            boleData.put("boBalanceAfter", updatedTotalBorrowTk(botxtAmountWithCharge.getText(), "Return Borrowed Money"));
                            boleData.put("boExactTk", botxtAmountWithCharge.getText());
                            boleData.put("gmWalletBalanceBefore", longToString(currentWalletBalance()));
                            boleData.put("gmWalletBalanceAfter", exWalletBalanceAfter(botxtAmountWithCharge.getText()));
                            (new Borrow()).saveBorrowData(boleData);
                            if (boisTypedAmountLessThanBorrowed(botxtAmountWithCharge.getText(), bocmboRepaidPerson.getValue())) {
                                (new Borrow()).updateBorrowSummaryData(boleData);
                            } else {
                                (new Borrow()).deleteBorrowSummaryData(boleData);
                            }
                            // if it activate, then you have to change in Undo Class --> undoBorrow() method
                            // (new GetMoney()).saveBorrowGMData(boleData);
                            (new ComboboxList()).setAllMonth(monthToSave(lenddateDate.getValue()), yearToSave(lenddateDate.getValue()));
                            setCurrentWalletBalance(exWalletBalanceAfter(botxtAmountWithCharge.getText()));
                            setTotalBorrowTk(updatedTotalBorrowTk(botxtAmountWithCharge.getText(), "Return Borrowed Money"));
                            boInitialize();
                            Alert confirmationMsg = new Alert(AlertType.INFORMATION);
                            confirmationMsg.setTitle("Successfull Transaction");
                            confirmationMsg.setHeaderText(null);
                            confirmationMsg.setContentText("Successful");
                            Stage MakeATransactionStage = (Stage) lendbtnSave.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();
                        } else {
                            Alert alert = new Alert(AlertType.WARNING);
                            alert.setTitle("Transaction Failed");
                            alert.setHeaderText(null);
                            alert.setContentText("Amount can't bigger than borrowed amount");
                            Stage MakeATransactionStage = (Stage) lendbtnSave.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 (lecmboType.getValue().equals("Give Money")) {
                // Lend, Give Money, bKash
                if (lecmboMethod.getValue().equals("bKash")) {
                    if (amountIsZero(letxtAmountWithCharge.getText()) || letterCount(letxtFromWhom.getText()) == 100 || amountIsZero(letxtExactAmount.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) lendbtnSave.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 {
                        boleData.put("leTime", timeToSave());
                        boleData.put("leDate", (new DateFormatManager()).toString(lenddateDate.getValue()));
                        boleData.put("leMonth", monthToSave(lenddateDate.getValue()));
                        boleData.put("leType", lecmboType.getValue());
                        boleData.put("leMethod", lecmboMethod.getValue());
                        boleData.put("leWhom", letxtFromWhom.getText());
                        boleData.put("leTk", letxtAmountWithCharge.getText());
                        boleData.put("leNature", leGetSelectedrbtnName());
                        boleData.put("leBnkCharge", leBankChargeShow());
                        boleData.put("leBalanceBefore", longToString(totalLendTk()));
                        boleData.put("leBalanceAfter", updatedTotalLendTk(letxtExactAmount.getText(), "Give Money"));
                        boleData.put("leExactTk", letxtExactAmount.getText());
                        boleData.put("bkBalanceBefore", longToString(currentbKashBalance()));
                        boleData.put("bkBalanceAfter", updatedbKashBalance(letxtAmountWithCharge.getText(), leGetSelectedrbtnName()));
                        (new Lend()).addLendSummaryData(boleData);
                        (new Bkash()).saveLendBkashData(boleData);
                        (new Lend()).saveLendData(boleData);
                        (new ComboboxList()).setAllMonth(monthToSave(lenddateDate.getValue()), yearToSave(lenddateDate.getValue()));
                        setCurrentbKashBalance(updatedbKashBalance(letxtAmountWithCharge.getText(), leGetSelectedrbtnName()));
                        // setCurrentbKashBalance(leBkBalanceAfter(letxtAmountWithCharge.getText(), leBankChargeShow(), "Give Money"));
                        setTotalLendTk(updatedTotalLendTk(letxtExactAmount.getText(), "Give Money"));
                        leInitialize();
                        Alert confirmationMsg = new Alert(AlertType.INFORMATION);
                        confirmationMsg.setTitle("Successfull Transaction");
                        confirmationMsg.setHeaderText(null);
                        confirmationMsg.setContentText("Successful");
                        Stage MakeATransactionStage = (Stage) lendbtnSave.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();
                    }
                // Lend, Give Money, Rocket
                } else if (lecmboMethod.getValue().equals("Rocket")) {
                    if (amountIsZero(letxtAmountWithCharge.getText()) || letterCount(letxtFromWhom.getText()) == 100 || amountIsZero(letxtExactAmount.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) lendbtnSave.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 {
                        boleData.put("leTime", timeToSave());
                        boleData.put("leDate", (new DateFormatManager()).toString(lenddateDate.getValue()));
                        boleData.put("leMonth", monthToSave(lenddateDate.getValue()));
                        boleData.put("leType", lecmboType.getValue());
                        boleData.put("leMethod", lecmboMethod.getValue());
                        boleData.put("leWhom", letxtFromWhom.getText());
                        boleData.put("leTk", letxtAmountWithCharge.getText());
                        boleData.put("leNature", leGetSelectedrbtnName());
                        boleData.put("leBnkCharge", leBankChargeShow());
                        boleData.put("leBalanceBefore", longToString(totalLendTk()));
                        boleData.put("leBalanceAfter", updatedTotalLendTk(letxtExactAmount.getText(), "Give Money"));
                        boleData.put("leExactTk", letxtExactAmount.getText());
                        boleData.put("rocBalanceBefore", longToString(currentRocketBalance()));
                        boleData.put("rocBalanceAfter", updatedRocketBalance(letxtAmountWithCharge.getText(), "Cash Out", leGetSelectedrbtnName()));
                        (new Lend()).addLendSummaryData(boleData);
                        (new Rocket()).saveLendRocketData(boleData);
                        (new Lend()).saveLendData(boleData);
                        (new ComboboxList()).setAllMonth(monthToSave(lenddateDate.getValue()), yearToSave(lenddateDate.getValue()));
                        setCurrentRocketBalance(updatedRocketBalance(letxtAmountWithCharge.getText(), "Cash Out", leGetSelectedrbtnName()));
                        // setCurrentRocketBalance(leRocBalanceAfter(letxtAmountWithCharge.getText(), leBankChargeShow(), "Give Money"));
                        setTotalLendTk(updatedTotalLendTk(letxtExactAmount.getText(), "Give Money"));
                        leInitialize();
                        Alert confirmationMsg = new Alert(AlertType.INFORMATION);
                        confirmationMsg.setTitle("Successfull Transaction");
                        confirmationMsg.setHeaderText(null);
                        confirmationMsg.setContentText("Successful");
                        Stage MakeATransactionStage = (Stage) lendbtnSave.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();
                    }
                } else {
                    // Lend, Give Money, Hand to Hand
                    if (amountIsZero(letxtAmountWithCharge.getText()) || letterCount(letxtFromWhom.getText()) == 100) {
                        Alert alert = new Alert(AlertType.WARNING);
                        alert.setTitle("Transaction Failed");
                        alert.setHeaderText(null);
                        alert.setContentText("Zero or Empty is not allowed");
                        Stage MakeATransactionStage = (Stage) lendbtnSave.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 {
                        boleData.put("leTime", timeToSave());
                        boleData.put("leDate", (new DateFormatManager()).toString(lenddateDate.getValue()));
                        boleData.put("leMonth", monthToSave(lenddateDate.getValue()));
                        boleData.put("leType", lecmboType.getValue());
                        boleData.put("leMethod", lecmboMethod.getValue());
                        boleData.put("leWhom", letxtFromWhom.getText());
                        boleData.put("leTk", letxtAmountWithCharge.getText());
                        boleData.put("leNature", "None");
                        boleData.put("leBnkCharge", "None");
                        boleData.put("leBalanceBefore", longToString(totalLendTk()));
                        boleData.put("leBalanceAfter", updatedTotalLendTk(letxtAmountWithCharge.getText(), "Give Money"));
                        boleData.put("leExactTk", letxtAmountWithCharge.getText());
                        boleData.put("gmWalletBalanceBefore", longToString(currentWalletBalance()));
                        boleData.put("gmWalletBalanceAfter", exWalletBalanceAfter(letxtAmountWithCharge.getText()));
                        (new Lend()).saveLendData(boleData);
                        (new Lend()).addLendSummaryData(boleData);
                        // (new GetMoney()).saveLendGMData(boleData);
                        (new ComboboxList()).setAllMonth(monthToSave(lenddateDate.getValue()), yearToSave(lenddateDate.getValue()));
                        setCurrentWalletBalance(exWalletBalanceAfter(letxtAmountWithCharge.getText()));
                        setTotalLendTk(updatedTotalLendTk(letxtAmountWithCharge.getText(), "Give Money"));
                        leInitialize();
                        Alert confirmationMsg = new Alert(AlertType.INFORMATION);
                        confirmationMsg.setTitle("Successfull Transaction");
                        confirmationMsg.setHeaderText(null);
                        confirmationMsg.setContentText("Successful");
                        Stage MakeATransactionStage = (Stage) lendbtnSave.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();
                    }
                }
            } else {
                // Lend, Take Back Lended Money, bKash
                if (lecmboMethod.getValue().equals("bKash")) {
                    if (amountIsZero(letxtAmountWithCharge.getText()) || amountIsZero(letxtExactAmount.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) lendbtnSave.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 (leRepayValidation(letxtExactAmount.getText(), lecmboRepaidPerson.getValue())) {
                            boleData.put("leTime", timeToSave());
                            boleData.put("leDate", (new DateFormatManager()).toString(lenddateDate.getValue()));
                            boleData.put("leMonth", monthToSave(lenddateDate.getValue()));
                            boleData.put("leType", lecmboType.getValue());
                            boleData.put("leMethod", lecmboMethod.getValue());
                            boleData.put("leWhom", lecmboRepaidPerson.getValue());
                            boleData.put("leTk", letxtAmountWithCharge.getText());
                            boleData.put("leNature", leGetSelectedrbtnName());
                            boleData.put("leBnkCharge", leBankChargeShow());
                            boleData.put("leBalanceBefore", longToString(totalLendTk()));
                            boleData.put("leBalanceAfter", updatedTotalLendTk(letxtExactAmount.getText(), "Take Back Lended Money"));
                            boleData.put("leExactTk", letxtExactAmount.getText());
                            boleData.put("bkBalanceBefore", longToString(currentbKashBalance()));
                            boleData.put("bkBalanceAfter", updatedbKashBalance(letxtAmountWithCharge.getText(), "Cash In"));
                            if (leisTypedAmountLessThanLended(letxtExactAmount.getText(), lecmboRepaidPerson.getValue())) {
                                (new Lend()).updateLendSummaryData(boleData);
                            } else {
                                (new Lend()).deleteLendSummaryData(boleData);
                            }
                            (new Bkash()).saveLendBkashData(boleData);
                            (new Lend()).saveLendData(boleData);
                            (new ComboboxList()).setAllMonth(monthToSave(lenddateDate.getValue()), yearToSave(lenddateDate.getValue()));
                            setCurrentbKashBalance(updatedbKashBalance(letxtAmountWithCharge.getText(), "Cash In"));
                            // setCurrentbKashBalance(leBkBalanceAfter(letxtAmountWithCharge.getText(), leBankChargeShow(), "Take Back Lended Money"));
                            setTotalLendTk(updatedTotalLendTk(letxtExactAmount.getText(), "Take Back Lended Money"));
                            leInitialize();
                            Alert confirmationMsg = new Alert(AlertType.INFORMATION);
                            confirmationMsg.setTitle("Successfull Transaction");
                            confirmationMsg.setHeaderText(null);
                            confirmationMsg.setContentText("Successful");
                            Stage MakeATransactionStage = (Stage) lendbtnSave.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();
                        } else {
                            Alert alert = new Alert(AlertType.WARNING);
                            alert.setTitle("Transaction Failed");
                            alert.setHeaderText(null);
                            alert.setContentText("Amount can't bigger than borrowed amount");
                            Stage MakeATransactionStage = (Stage) lendbtnSave.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();
                        }
                    }
                // Lend, Take Back Lended Money, Rocket
                } else if (lecmboMethod.getValue().equals("Rocket")) {
                    if (amountIsZero(letxtAmountWithCharge.getText()) || amountIsZero(letxtExactAmount.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) lendbtnSave.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 (leRepayValidation(letxtExactAmount.getText(), lecmboRepaidPerson.getValue())) {
                            boleData.put("leTime", timeToSave());
                            boleData.put("leDate", (new DateFormatManager()).toString(lenddateDate.getValue()));
                            boleData.put("leMonth", monthToSave(lenddateDate.getValue()));
                            boleData.put("leType", lecmboType.getValue());
                            boleData.put("leMethod", lecmboMethod.getValue());
                            boleData.put("leWhom", lecmboRepaidPerson.getValue());
                            boleData.put("leTk", letxtAmountWithCharge.getText());
                            boleData.put("leNature", leGetSelectedrbtnName());
                            boleData.put("leBnkCharge", leBankChargeShow());
                            boleData.put("leBalanceBefore", longToString(totalLendTk()));
                            boleData.put("leBalanceAfter", updatedTotalLendTk(letxtExactAmount.getText(), "Take Back Lended Money"));
                            boleData.put("leExactTk", letxtExactAmount.getText());
                            boleData.put("rocBalanceBefore", longToString(currentRocketBalance()));
                            boleData.put("rocBalanceAfter", updatedRocketBalance(letxtAmountWithCharge.getText(), "Cash In", leGetSelectedrbtnName()));
                            if (leisTypedAmountLessThanLended(letxtExactAmount.getText(), lecmboRepaidPerson.getValue())) {
                                (new Lend()).updateLendSummaryData(boleData);
                            } else {
                                (new Lend()).deleteLendSummaryData(boleData);
                            }
                            (new Rocket()).saveLendRocketData(boleData);
                            (new Lend()).saveLendData(boleData);
                            (new ComboboxList()).setAllMonth(monthToSave(lenddateDate.getValue()), yearToSave(lenddateDate.getValue()));
                            setCurrentRocketBalance(updatedRocketBalance(letxtAmountWithCharge.getText(), "Cash In", leGetSelectedrbtnName()));
                            // setCurrentRocketBalance(leRocBalanceAfter(letxtAmountWithCharge.getText(), leBankChargeShow(), "Take Back Lended Money"));
                            setTotalLendTk(updatedTotalLendTk(letxtExactAmount.getText(), "Take Back Lended Money"));
                            leInitialize();
                            Alert confirmationMsg = new Alert(AlertType.INFORMATION);
                            confirmationMsg.setTitle("Successfull Transaction");
                            confirmationMsg.setHeaderText(null);
                            confirmationMsg.setContentText("Successful");
                            Stage MakeATransactionStage = (Stage) lendbtnSave.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();
                        } else {
                            Alert alert = new Alert(AlertType.WARNING);
                            alert.setTitle("Transaction Failed");
                            alert.setHeaderText(null);
                            alert.setContentText("Amount can't bigger than borrowed amount");
                            Stage MakeATransactionStage = (Stage) lendbtnSave.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 {
                    // Lend, Take Back Lended Money, Hand to Hand
                    if (amountIsZero(letxtAmountWithCharge.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) lendbtnSave.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 (leRepayValidation(letxtAmountWithCharge.getText(), lecmboRepaidPerson.getValue())) {
                            boleData.put("leTime", timeToSave());
                            boleData.put("leDate", (new DateFormatManager()).toString(lenddateDate.getValue()));
                            boleData.put("leMonth", monthToSave(lenddateDate.getValue()));
                            boleData.put("leType", lecmboType.getValue());
                            boleData.put("leMethod", lecmboMethod.getValue());
                            boleData.put("leWhom", lecmboRepaidPerson.getValue());
                            boleData.put("leTk", letxtAmountWithCharge.getText());
                            boleData.put("leNature", "None");
                            boleData.put("leBnkCharge", "None");
                            boleData.put("leBalanceBefore", longToString(totalLendTk()));
                            boleData.put("leBalanceAfter", updatedTotalLendTk(letxtAmountWithCharge.getText(), "Take Back Lended Money"));
                            boleData.put("leExactTk", letxtAmountWithCharge.getText());
                            boleData.put("gmWalletBalanceBefore", longToString(currentWalletBalance()));
                            boleData.put("gmWalletBalanceAfter", gmWalletBalanceAfter(letxtAmountWithCharge.getText()));
                            (new Lend()).saveLendData(boleData);
                            if (leisTypedAmountLessThanLended(letxtAmountWithCharge.getText(), lecmboRepaidPerson.getValue())) {
                                (new Lend()).updateLendSummaryData(boleData);
                            } else {
                                (new Lend()).deleteLendSummaryData(boleData);
                            }
                            // (new GetMoney()).saveLendGMData(boleData);
                            (new ComboboxList()).setAllMonth(monthToSave(lenddateDate.getValue()), yearToSave(lenddateDate.getValue()));
                            setCurrentWalletBalance(gmWalletBalanceAfter(letxtAmountWithCharge.getText()));
                            setTotalLendTk(updatedTotalLendTk(letxtAmountWithCharge.getText(), "Take Back Lended Money"));
                            leInitialize();
                            Alert confirmationMsg = new Alert(AlertType.INFORMATION);
                            confirmationMsg.setTitle("Successfull Transaction");
                            confirmationMsg.setHeaderText(null);
                            confirmationMsg.setContentText("Successful");
                            Stage MakeATransactionStage = (Stage) lendbtnSave.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();
                        } else {
                            Alert alert = new Alert(AlertType.WARNING);
                            alert.setTitle("Transaction Failed");
                            alert.setHeaderText(null);
                            alert.setContentText("Amount can't bigger than lended amount");
                            Stage MakeATransactionStage = (Stage) lendbtnSave.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();
                        }
                    }
                }
            }
        }
    } catch (Exception e) {
    }
}
Also used : Borrow(tab.Borrow) HashMap(java.util.HashMap) ActionEvent(javafx.event.ActionEvent) DateFormatManager(system.DateFormatManager) EventHandler(javafx.event.EventHandler) Lend(tab.Lend) Rocket(tab.Rocket) Timeline(javafx.animation.Timeline) ComboboxList(operation.ComboboxList) Stage(javafx.stage.Stage) KeyFrame(javafx.animation.KeyFrame) Bkash(tab.Bkash) Alert(javafx.scene.control.Alert) FXML(javafx.fxml.FXML)

Example 12 with ComboboxList

use of operation.ComboboxList 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.getX(), MakeATransactionStage.getY());
            MakeATransactionStage.close();
        } 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();
        }
    }
}
Also used : HashMap(java.util.HashMap) GetMoney(tab.GetMoney) ActionEvent(javafx.event.ActionEvent) DateFormatManager(system.DateFormatManager) EventHandler(javafx.event.EventHandler) GoToOperation(operation.GoToOperation) Rocket(tab.Rocket) Timeline(javafx.animation.Timeline) ComboboxList(operation.ComboboxList) Bkash(tab.Bkash) Stage(javafx.stage.Stage) KeyFrame(javafx.animation.KeyFrame) Alert(javafx.scene.control.Alert) FXML(javafx.fxml.FXML)

Example 13 with ComboboxList

use of operation.ComboboxList 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();
        }
    }
}
Also used : Personal(tab.Personal) HashMap(java.util.HashMap) GetMoney(tab.GetMoney) ActionEvent(javafx.event.ActionEvent) DateFormatManager(system.DateFormatManager) EventHandler(javafx.event.EventHandler) Rocket(tab.Rocket) Timeline(javafx.animation.Timeline) ComboboxList(operation.ComboboxList) Bkash(tab.Bkash) Stage(javafx.stage.Stage) KeyFrame(javafx.animation.KeyFrame) Alert(javafx.scene.control.Alert)

Example 14 with ComboboxList

use of operation.ComboboxList in project Money-Manager by krHasan.

the class GetMoneyChart method getSourceData.

public static Series<String, Number> getSourceData(String monthName) {
    XYChart.Series<String, Number> source = new XYChart.Series<>();
    String[] allSource = new ComboboxList().getSourceListForDashboard();
    for (String sourceName : allSource) {
        if (!sourceName.equals("All")) {
            if (sourceName.equals("Carried Over Amount")) {
                String sourceShortName = getAbbreviateName(sourceName);
                double amount = longToDouble(new CarriedOver().getCOAmount(monthName));
                source.getData().add(new XYChart.Data<>(sourceShortName, amount));
            } else {
                String sourceShortName = getAbbreviateName(sourceName);
                double amount = longToDouble(new Source().getAmountBySourceFromGM(monthName, sourceName));
                source.getData().add(new XYChart.Data<>(sourceShortName, amount));
            }
        }
    }
    return source;
}
Also used : Series(javafx.scene.chart.XYChart.Series) CarriedOver(operation.CarriedOver) ComboboxList(operation.ComboboxList) XYChart(javafx.scene.chart.XYChart) Source(tab.Source)

Example 15 with ComboboxList

use of operation.ComboboxList in project Money-Manager by krHasan.

the class SignInController method logIn.

@FXML
private void logIn(ActionEvent event) {
    if (authentication(txtUsername.getText(), passPassword.getText())) {
        Stage SignInStage = (Stage) btnSignIn.getScene().getWindow();
        new ComboboxList().setAllMonth(getThisMonthName(), getYear());
        new ComboboxList().setAllGmMonth(getThisMonthName(), getYear());
        new ComboboxList().setAllExMonth(getThisMonthName(), getYear());
        new CarriedOver().addCarriedOver(getThisMonthName());
        if (userIsNew()) {
            goToDashboard(SignInStage.getX(), SignInStage.getY());
            SignInStage.close();
        } else {
            updateLastAccessDate();
            goToDashboard(SignInStage.getX(), SignInStage.getY());
            SignInStage.close();
        }
    } else {
        lblWrongAuthentication.setText("Username or Password is Wrong");
        passPassword.clear();
    }
}
Also used : CarriedOver(operation.CarriedOver) ComboboxList(operation.ComboboxList) Stage(javafx.stage.Stage) FXML(javafx.fxml.FXML)

Aggregations

ComboboxList (operation.ComboboxList)16 Stage (javafx.stage.Stage)8 HashMap (java.util.HashMap)7 KeyFrame (javafx.animation.KeyFrame)7 Timeline (javafx.animation.Timeline)7 ActionEvent (javafx.event.ActionEvent)7 EventHandler (javafx.event.EventHandler)7 Alert (javafx.scene.control.Alert)7 DateFormatManager (system.DateFormatManager)7 FXML (javafx.fxml.FXML)6 Bkash (tab.Bkash)4 Rocket (tab.Rocket)4 Connection (java.sql.Connection)3 PreparedStatement (java.sql.PreparedStatement)3 ResultSet (java.sql.ResultSet)3 CarriedOver (operation.CarriedOver)3 Expense (tab.Expense)3 GetMoney (tab.GetMoney)3 Statement (java.sql.Statement)2 XYChart (javafx.scene.chart.XYChart)2