use of tab.Borrow in project Money-Manager by krHasan.
the class Undo method undoBorrow.
// /////////////////////// Borrow Undo Action /////////////////////////////////
// --------------------------------------------------------------------------//
private boolean undoBorrow(int globalID) {
boolean feedback = false;
String undoBo = "SELECT * FROM Borrow WHERE globalID = ?";
String deleteBo = "DELETE FROM Borrow WHERE globalID = ?";
String boBalanceBefore = null;
String boType = "None";
String boMethod = "None";
String boWhom = null;
String boExactTk = null;
String boDate = null;
try (Connection conn = connector();
PreparedStatement pstmt = conn.prepareStatement(undoBo)) {
pstmt.setInt(1, globalID);
ResultSet boResult = pstmt.executeQuery();
if (boResult.next()) {
boBalanceBefore = boResult.getString("boBalanceBefore");
boType = boResult.getString("boType");
boMethod = boResult.getString("boMethod");
boWhom = boResult.getString("boWhom");
boExactTk = boResult.getString("boExactTk");
boDate = boResult.getString("boDate");
feedback = true;
}
} catch (Exception e) {
e.printStackTrace();
}
if (boType.equals("Money Take")) {
if (boMethod.equals("bKash")) {
try (Connection connbo = connector();
PreparedStatement pstmtbo = connbo.prepareStatement(deleteBo)) {
pstmtbo.setInt(1, globalID);
pstmtbo.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}
String undoBk = "SELECT * FROM bKash WHERE globalID = ?";
String deleteBk = "DELETE FROM bKash WHERE globalID = ?";
String bkBalanceBefore = null;
try (Connection conn = connector();
PreparedStatement pstmt = conn.prepareStatement(undoBk)) {
pstmt.setInt(1, --globalID);
ResultSet bkResult = pstmt.executeQuery();
bkBalanceBefore = bkResult.getString("bkBalanceBefore");
} catch (Exception e) {
e.printStackTrace();
}
try (Connection connbk = connector();
PreparedStatement pstmtbk = connbk.prepareStatement(deleteBk)) {
pstmtbk.setInt(1, globalID);
pstmtbk.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}
String deleteBoSummary = "DELETE FROM Borrow_Summary WHERE boWhom = ?";
try (Connection connbk = connector();
PreparedStatement pstmtbk = connbk.prepareStatement(deleteBoSummary)) {
pstmtbk.setString(1, boWhom);
pstmtbk.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}
setCurrentbKashBalance(removeThousandSeparator(bkBalanceBefore));
setTotalBorrowTk(removeThousandSeparator(boBalanceBefore));
GlobalId.setGlobalId(globalID);
} else if (boMethod.equals("Rocket")) {
try (Connection conngm = connector();
PreparedStatement pstmtgm = conngm.prepareStatement(deleteBo)) {
pstmtgm.setInt(1, globalID);
pstmtgm.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}
String undoRoc = "SELECT * FROM Rocket WHERE globalID = ?";
String deleteRoc = "DELETE FROM Rocket WHERE globalID = ?";
String rocBalanceBefore = null;
try (Connection conn = connector();
PreparedStatement pstmt = conn.prepareStatement(undoRoc)) {
pstmt.setInt(1, --globalID);
ResultSet rocResult = pstmt.executeQuery();
rocBalanceBefore = rocResult.getString("rocBalanceBefore");
} catch (Exception e) {
e.printStackTrace();
}
try (Connection connroc = connector();
PreparedStatement pstmtroc = connroc.prepareStatement(deleteRoc)) {
pstmtroc.setInt(1, globalID);
pstmtroc.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}
String deleteBoSummary = "DELETE FROM Borrow_Summary WHERE boWhom = ?";
try (Connection connroc = connector();
PreparedStatement pstmtroc = connroc.prepareStatement(deleteBoSummary)) {
pstmtroc.setString(1, boWhom);
pstmtroc.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}
setCurrentRocketBalance(removeThousandSeparator(rocBalanceBefore));
setTotalBorrowTk(removeThousandSeparator(boBalanceBefore));
GlobalId.setGlobalId(globalID);
} else if (boMethod.equals("Hand to Hand")) {
try (Connection connHH = connector();
PreparedStatement pstmtHH = connHH.prepareStatement(deleteBo)) {
pstmtHH.setInt(1, globalID);
pstmtHH.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}
String deleteBoSummary = "DELETE FROM Borrow_Summary WHERE boWhom = ?";
try (Connection connHH = connector();
PreparedStatement pstmtHH = connHH.prepareStatement(deleteBoSummary)) {
pstmtHH.setString(1, boWhom);
pstmtHH.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}
setCurrentWalletBalance(longToString(currentWalletBalance() - stringToLong(removeThousandSeparator(boExactTk))));
setTotalBorrowTk(removeThousandSeparator(boBalanceBefore));
GlobalId.setGlobalId(globalID);
}
} else if (boType.equals("Return Borrowed Money")) {
if (boMethod.equals("bKash")) {
try (Connection connbo = connector();
PreparedStatement pstmtbo = connbo.prepareStatement(deleteBo)) {
pstmtbo.setInt(1, globalID);
pstmtbo.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}
String undoBk = "SELECT * FROM bKash WHERE globalID = ?";
String deleteBk = "DELETE FROM bKash WHERE globalID = ?";
String bkBalanceBefore = null;
try (Connection conn = connector();
PreparedStatement pstmt = conn.prepareStatement(undoBk)) {
pstmt.setInt(1, --globalID);
ResultSet bkResult = pstmt.executeQuery();
bkBalanceBefore = bkResult.getString("bkBalanceBefore");
} catch (Exception e) {
e.printStackTrace();
}
try (Connection connbk = connector();
PreparedStatement pstmtbk = connbk.prepareStatement(deleteBk)) {
pstmtbk.setInt(1, globalID);
pstmtbk.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}
Map<String, String> boleData = new HashMap<>();
boleData.put("boDate", boDate);
boleData.put("boWhom", boWhom);
boleData.put("boExactTk", removeThousandSeparator(boExactTk));
if (!new Borrow().boRepayPersonBorrowedAmount(boWhom).equals("0")) {
(new Borrow()).updateBorrowSummaryDataForUndo(boleData);
} else {
(new Borrow()).addBorrowSummaryData(boleData);
}
setCurrentbKashBalance(removeThousandSeparator(bkBalanceBefore));
setTotalBorrowTk(removeThousandSeparator(boBalanceBefore));
GlobalId.setGlobalId(globalID);
} else if (boMethod.equals("Rocket")) {
try (Connection conngm = connector();
PreparedStatement pstmtgm = conngm.prepareStatement(deleteBo)) {
pstmtgm.setInt(1, globalID);
pstmtgm.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}
String undoRoc = "SELECT * FROM Rocket WHERE globalID = ?";
String deleteRoc = "DELETE FROM Rocket WHERE globalID = ?";
String rocBalanceBefore = null;
try (Connection conn = connector();
PreparedStatement pstmt = conn.prepareStatement(undoRoc)) {
pstmt.setInt(1, --globalID);
ResultSet rocResult = pstmt.executeQuery();
rocBalanceBefore = rocResult.getString("rocBalanceBefore");
} catch (Exception e) {
e.printStackTrace();
}
try (Connection connroc = connector();
PreparedStatement pstmtroc = connroc.prepareStatement(deleteRoc)) {
pstmtroc.setInt(1, globalID);
pstmtroc.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}
Map<String, String> boleData = new HashMap<>();
boleData.put("boDate", boDate);
boleData.put("boWhom", boWhom);
boleData.put("boExactTk", removeThousandSeparator(boExactTk));
if (!new Borrow().boRepayPersonBorrowedAmount(boWhom).equals("0")) {
(new Borrow()).updateBorrowSummaryDataForUndo(boleData);
} else {
(new Borrow()).addBorrowSummaryData(boleData);
}
setCurrentRocketBalance(removeThousandSeparator(rocBalanceBefore));
setTotalBorrowTk(removeThousandSeparator(boBalanceBefore));
GlobalId.setGlobalId(globalID);
} else if (boMethod.equals("Hand to Hand")) {
try (Connection connHH = connector();
PreparedStatement pstmtHH = connHH.prepareStatement(deleteBo)) {
pstmtHH.setInt(1, globalID);
pstmtHH.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}
Map<String, String> boleData = new HashMap<>();
boleData.put("boDate", boDate);
boleData.put("boWhom", boWhom);
boleData.put("boExactTk", removeThousandSeparator(boExactTk));
if (!new Borrow().boRepayPersonBorrowedAmount(boWhom).equals("0")) {
(new Borrow()).updateBorrowSummaryDataForUndo(boleData);
} else {
(new Borrow()).addBorrowSummaryData(boleData);
}
setCurrentWalletBalance(longToString(currentWalletBalance() + stringToLong(removeThousandSeparator(boExactTk))));
setTotalBorrowTk(removeThousandSeparator(boBalanceBefore));
GlobalId.setGlobalId(globalID);
}
}
return feedback;
}
use of tab.Borrow 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) {
}
}
use of tab.Borrow in project Money-Manager by krHasan.
the class MakeATransactionController method boRepayPersonCmboFunction.
private void boRepayPersonCmboFunction() {
bolblAmountValidationMsg.setText("");
bolblAmountValidationMsg2.setText("");
bolblWarningMsg.setText("");
String boRepayPersonBorrowedAmount = new Borrow().boRepayPersonBorrowedAmount(bocmboRepaidPerson.getValue());
botxtExactAmount.setText(boRepayPersonBorrowedAmount);
botxtAmountWithCharge.setText(boRepayPersonBorrowedAmount);
}
Aggregations