use of system.DateFormatManager in project Money-Manager by krHasan.
the class SettingsController method systembtnSave.
@FXML
private void systembtnSave(ActionEvent event) {
DateFormatManager format = new DateFormatManager();
try {
String timeFormat = (String) timerbtnGroup.getSelectedToggle().getUserData();
String dateFormat = (String) daterbtnGroup.getSelectedToggle().getUserData();
format.setTimeFormate(timeFormat);
format.setDateFormate(dateFormat);
updateLastAccessDate();
if (checkBoxWeekNum.isSelected()) {
setWeekStatus(true);
} else {
setWeekStatus(false);
}
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Message");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText("Information updated successfully");
Stage SettingsStage = (Stage) btnDashboard.getScene().getWindow();
confirmationMsg.setX(SettingsStage.getX() + 200);
confirmationMsg.setY(SettingsStage.getY() + 170);
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();
tabSystemInitialize();
} catch (Exception e) {
e.printStackTrace();
}
}
use of system.DateFormatManager in project Money-Manager by krHasan.
the class MakeATransactionController method exbtnAdvancedAdjustBalance.
@FXML
private void exbtnAdvancedAdjustBalance(ActionEvent event) {
TextInputDialog dialog = new TextInputDialog();
dialog.setTitle("Adjust Wallet Balance");
dialog.setHeaderText("Provide Balance Status at Your Hand Now.");
dialog.setContentText("Please enter the amount:");
Stage MakeATransactionStage = (Stage) exbtnAdjustBalance.getScene().getWindow();
dialog.setX(MakeATransactionStage.getX() + 200);
dialog.setY(MakeATransactionStage.getY() + 170);
Optional<String> result = dialog.showAndWait();
if (result.isPresent()) {
String typedAmount = result.get();
if (!validAmount(typedAmount)) {
Alert alert = new Alert(AlertType.WARNING);
alert.setTitle("Transaction Failed");
alert.setHeaderText(null);
alert.setContentText(InvalidInput);
alert.setX(MakeATransactionStage.getX() + 200);
alert.setY(MakeATransactionStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
alert.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
alert.showAndWait();
} else if (amountIsZero(typedAmount)) {
Alert alert = new Alert(AlertType.WARNING);
alert.setTitle("Transaction Failed");
alert.setHeaderText(null);
alert.setContentText("Zero is not approved.");
alert.setX(MakeATransactionStage.getX() + 200);
alert.setY(MakeATransactionStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
alert.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
alert.showAndWait();
} else {
long dbWalletBalance = currentWalletBalance();
long typedBalance = stringToLong(typedAmount);
String exAdvAdjustBalAfter = typedAmount;
String exAdvAdjustAmount;
if (dbWalletBalance < typedBalance) {
exAdvAdjustAmount = "added " + longToString(typedBalance - dbWalletBalance) + " to Wallet";
} else if (dbWalletBalance > typedBalance) {
exAdvAdjustAmount = exWalletBalanceAfter(typedAmount);
} else {
exAdvAdjustAmount = "0.0";
}
try {
Map<String, String> expenseData = new HashMap<>();
expenseData.put("exTime", timeToSave());
expenseData.put("exDate", (new DateFormatManager()).toString(exdateAdvancedDate.getValue()));
expenseData.put("exMonth", monthToSave(exdateAdvancedDate.getValue()));
expenseData.put("exAmount", exAdvAdjustAmount);
if (exIsAdvDescripionEmpty()) {
expenseData.put("exDescription", "You have adjusted your Wallet Balance");
} else {
expenseData.put("exDescription", extxtAdvancedDescription.getText());
}
expenseData.put("exSector", "Adjusted Balance");
expenseData.put("exWalletBalanceBefore", getWalletBalance());
expenseData.put("exWalletBalanceAfter", exAdvAdjustBalAfter);
setCurrentWalletBalance(exAdvAdjustBalAfter);
(new Expense()).saveExpenseData(expenseData);
(new ComboboxList()).setAllMonth(monthToSave(exdateAdvancedDate.getValue()), yearToSave(exdateAdvancedDate.getValue()));
(new ComboboxList()).setAllExMonth(monthToSave(exdateAdvancedDate.getValue()), yearToSave(exdateAdvancedDate.getValue()));
exInitialize();
extxtAdvancedDescription.clear();
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Successfull Transaction");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText("Successful");
confirmationMsg.setX(MakeATransactionStage.getX() + 200);
confirmationMsg.setY(MakeATransactionStage.getY() + 29);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
confirmationMsg.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
confirmationMsg.showAndWait();
} catch (Exception e) {
Alert alert = new Alert(AlertType.WARNING);
alert.setTitle("Transaction Failed");
alert.setHeaderText(null);
alert.setContentText("There something is wrong.");
alert.setX(MakeATransactionStage.getX() + 200);
alert.setY(MakeATransactionStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
alert.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
alert.showAndWait();
}
}
}
}
use of system.DateFormatManager in project Money-Manager by krHasan.
the class MakeATransactionController method gmbtnSaveAdd.
@FXML
private void gmbtnSaveAdd(ActionEvent event) {
if (amountIsZero(gmtxtAmount.getText())) {
gmlblWarningMsg.setText("Empty or Zero is not approved.");
} else {
try {
Map<String, String> stringData = new HashMap<>();
stringData.put("gmTime", timeToSave());
stringData.put("gmDate", (new DateFormatManager()).toString(gmdateDate.getValue()));
stringData.put("gmMonth", monthToSave(gmdateDate.getValue()));
stringData.put("gmAmount", gmtxtAmount.getText());
if ((gmcmboMethod.getValue()).equals("bKash")) {
stringData.put("gmBankCharge", bkashBnkCharge(gmtxtAmount.getText(), "Cash In"));
} else if ((gmcmboMethod.getValue()).equals("Rocket")) {
stringData.put("gmBankCharge", rocketBnkCharge(gmtxtAmount.getText(), "Cash In", gmGetSelectedrbtnName()));
} else {
stringData.put("gmBankCharge", "0.00");
}
if ((gmcmboMethod.getValue()).equals("bKash")) {
stringData.put("gmAmountNature", "Cash In from Agent");
} else if ((gmcmboMethod.getValue()).equals("Rocket")) {
stringData.put("gmAmountNature", gmGetSelectedrbtnName());
} else {
stringData.put("gmAmountNature", "None");
}
if ((gmcmboMethod.getValue()).equals("bKash")) {
stringData.put("bkBalanceAfter", updatedbKashBalance(gmtxtAmount.getText(), "Cash In"));
(new Bkash()).saveGmBkashData(stringData);
} else if ((gmcmboMethod.getValue()).equals("Rocket")) {
stringData.put("rocBalanceAfter", updatedRocketBalance(gmtxtAmount.getText(), "Cash In", gmGetSelectedrbtnName()));
(new Rocket()).saveGmRocketData(stringData);
}
stringData.put("gmSource", gmcmboSource.getValue());
if (gmIsDescripionEmpty()) {
stringData.put("gmDescription", "None");
} else {
stringData.put("gmDescription", gmtxtDescription.getText());
}
stringData.put("gmMethod", gmcmboMethod.getValue());
stringData.put("gmWalletBalanceBefore", getWalletBalance());
if ((gmcmboMethod.getValue()).equals("Hand to Hand")) {
stringData.put("gmWalletBalanceAfter", gmWalletBalanceAfter(gmtxtAmount.getText()));
setCurrentWalletBalance(gmWalletBalanceAfter(gmtxtAmount.getText()));
} else {
stringData.put("gmWalletBalanceAfter", getWalletBalance());
}
(new GetMoney()).saveGetMoneyData(stringData);
(new ComboboxList()).setAllMonth(monthToSave(gmdateDate.getValue()), yearToSave(gmdateDate.getValue()));
(new ComboboxList()).setAllGmMonth(monthToSave(gmdateDate.getValue()), yearToSave(gmdateDate.getValue()));
gmInitialize();
gmtxtAmount.clear();
gmtxtDescription.clear();
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Successfull Transaction");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText("Successful");
Stage MakeATransactionStage = (Stage) gmbtnSave.getScene().getWindow();
confirmationMsg.setX(MakeATransactionStage.getX() + 200);
confirmationMsg.setY(MakeATransactionStage.getY() + 29);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
confirmationMsg.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
confirmationMsg.showAndWait();
} catch (Exception e) {
Alert alert = new Alert(AlertType.WARNING);
alert.setTitle("Transaction Failed");
alert.setHeaderText(null);
alert.setContentText("There something is wrong.");
Stage MakeATransactionStage = (Stage) gmbtnSave.getScene().getWindow();
alert.setX(MakeATransactionStage.getX() + 200);
alert.setY(MakeATransactionStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
alert.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
alert.showAndWait();
}
}
cancelbtnPressed = true;
}
use of system.DateFormatManager in project Money-Manager by krHasan.
the class MakeATransactionController method exAdvSaveFunction.
private void exAdvSaveFunction(String amount, String sectorName) {
try {
Map<String, String> expenseData = new HashMap<>();
expenseData.put("exTime", timeToSave());
expenseData.put("exDate", (new DateFormatManager()).toString(exdateAdvancedDate.getValue()));
expenseData.put("exMonth", monthToSave(exdateAdvancedDate.getValue()));
expenseData.put("exAmount", amount);
if (exIsAdvDescripionEmpty()) {
expenseData.put("exDescription", "None");
} else {
expenseData.put("exDescription", extxtAdvancedDescription.getText());
}
expenseData.put("exSector", sectorName);
expenseData.put("exWalletBalanceBefore", getWalletBalance());
expenseData.put("exWalletBalanceAfter", exWalletBalanceAfter(amount));
setCurrentWalletBalance(exWalletBalanceAfter(amount));
(new Expense()).saveExpenseData(expenseData);
(new ComboboxList()).setAllMonth(monthToSave(exdateAdvancedDate.getValue()), yearToSave(exdateAdvancedDate.getValue()));
(new ComboboxList()).setAllExMonth(monthToSave(exdateAdvancedDate.getValue()), yearToSave(exdateAdvancedDate.getValue()));
} catch (Exception e) {
}
}
use of system.DateFormatManager 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) {
}
}
Aggregations