use of system.DateFormatManager in project Money-Manager by krHasan.
the class MakeATransactionController method gmSavebtn.
@FXML
private void gmSavebtn(ActionEvent event) {
if (amountIsZero(gmtxtAmount.getText())) {
gmlblWarningMsg.setText("Empty or Zero is not approved.");
} else {
try {
Map<String, String> stringData = new HashMap<>();
stringData.put("gmTime", timeToSave());
stringData.put("gmDate", (new DateFormatManager()).toString(gmdateDate.getValue()));
stringData.put("gmMonth", monthToSave(gmdateDate.getValue()));
stringData.put("gmAmount", gmtxtAmount.getText());
if ((gmcmboMethod.getValue()).equals("bKash")) {
stringData.put("gmBankCharge", bkashBnkCharge(gmtxtAmount.getText(), "Cash In"));
} else if ((gmcmboMethod.getValue()).equals("Rocket")) {
stringData.put("gmBankCharge", rocketBnkCharge(gmtxtAmount.getText(), "Cash In", gmGetSelectedrbtnName()));
} else {
stringData.put("gmBankCharge", "0.00");
}
if ((gmcmboMethod.getValue()).equals("bKash")) {
stringData.put("gmAmountNature", "Cash In from Agent");
} else if ((gmcmboMethod.getValue()).equals("Rocket")) {
stringData.put("gmAmountNature", gmGetSelectedrbtnName());
} else {
stringData.put("gmAmountNature", "None");
}
if ((gmcmboMethod.getValue()).equals("bKash")) {
stringData.put("bkBalanceAfter", updatedbKashBalance(gmtxtAmount.getText(), "Cash In"));
(new Bkash()).saveGmBkashData(stringData);
} else if ((gmcmboMethod.getValue()).equals("Rocket")) {
stringData.put("rocBalanceAfter", updatedRocketBalance(gmtxtAmount.getText(), "Cash In", gmGetSelectedrbtnName()));
(new Rocket()).saveGmRocketData(stringData);
}
stringData.put("gmSource", gmcmboSource.getValue());
if (gmIsDescripionEmpty()) {
stringData.put("gmDescription", "None");
} else {
stringData.put("gmDescription", gmtxtDescription.getText());
}
stringData.put("gmMethod", gmcmboMethod.getValue());
stringData.put("gmWalletBalanceBefore", getWalletBalance());
if ((gmcmboMethod.getValue()).equals("Hand to Hand")) {
stringData.put("gmWalletBalanceAfter", gmWalletBalanceAfter(gmtxtAmount.getText()));
setCurrentWalletBalance(gmWalletBalanceAfter(gmtxtAmount.getText()));
} else {
stringData.put("gmWalletBalanceAfter", getWalletBalance());
}
(new GetMoney()).saveGetMoneyData(stringData);
(new ComboboxList()).setAllMonth(monthToSave(gmdateDate.getValue()), yearToSave(gmdateDate.getValue()));
(new ComboboxList()).setAllGmMonth(monthToSave(gmdateDate.getValue()), yearToSave(gmdateDate.getValue()));
gmInitialize();
gmtxtAmount.clear();
gmtxtDescription.clear();
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Successfull Transaction");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText("Successful.");
Stage MakeATransactionStage = (Stage) gmbtnSave.getScene().getWindow();
confirmationMsg.setX(MakeATransactionStage.getX() + 200);
confirmationMsg.setY(MakeATransactionStage.getY() + 29);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
confirmationMsg.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
confirmationMsg.showAndWait();
(new GoToOperation()).goToDashboard(MakeATransactionStage);
} catch (Exception e) {
Alert alert = new Alert(AlertType.WARNING);
alert.setTitle("Transaction Failed");
alert.setHeaderText(null);
alert.setContentText("There something is wrong.");
Stage MakeATransactionStage = (Stage) gmbtnSave.getScene().getWindow();
alert.setX(MakeATransactionStage.getX() + 200);
alert.setY(MakeATransactionStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
alert.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
alert.showAndWait();
}
}
}
use of system.DateFormatManager in project Money-Manager by krHasan.
the class MakeATransactionController method exSaveFunction.
// save user input values to database
private void exSaveFunction() {
try {
Map<String, String> expenseData = new HashMap<>();
expenseData.put("exTime", timeToSave());
expenseData.put("exDate", (new DateFormatManager()).toString(exdateDate.getValue()));
expenseData.put("exMonth", monthToSave(exdateDate.getValue()));
if (adjustBtnPressed) {
expenseData.put("exAmount", exAdjustAmount);
} else {
expenseData.put("exAmount", extxtAmount.getText());
}
if (adjustBtnPressed) {
if (exIsDescripionEmpty()) {
expenseData.put("exDescription", "You have adjusted your Wallet Balance");
} else {
expenseData.put("exDescription", extxtDescription.getText());
}
} else {
if (exIsDescripionEmpty()) {
expenseData.put("exDescription", "None");
} else {
expenseData.put("exDescription", extxtDescription.getText());
}
}
if (adjustBtnPressed) {
expenseData.put("exSector", "Adjusted Balance");
} else {
expenseData.put("exSector", excmboSector.getValue());
}
expenseData.put("exWalletBalanceBefore", getWalletBalance());
if (adjustBtnPressed) {
expenseData.put("exWalletBalanceAfter", exAdjustBalAfter);
setCurrentWalletBalance(exAdjustBalAfter);
} else {
expenseData.put("exWalletBalanceAfter", exWalletBalanceAfter(extxtAmount.getText()));
setCurrentWalletBalance(exWalletBalanceAfter(extxtAmount.getText()));
}
(new Expense()).saveExpenseData(expenseData);
(new ComboboxList()).setAllMonth(monthToSave(exdateDate.getValue()), yearToSave(exdateDate.getValue()));
(new ComboboxList()).setAllExMonth(monthToSave(exdateDate.getValue()), yearToSave(exdateDate.getValue()));
exInitialize();
extxtAmount.clear();
extxtDescription.clear();
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Successfull Transaction");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText("Successful");
Stage MakeATransactionStage = (Stage) exbtnSave.getScene().getWindow();
confirmationMsg.setX(MakeATransactionStage.getX() + 200);
confirmationMsg.setY(MakeATransactionStage.getY() + 29);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
confirmationMsg.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
confirmationMsg.showAndWait();
} 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) exbtnSave.getScene().getWindow();
alert.setX(MakeATransactionStage.getX() + 200);
alert.setY(MakeATransactionStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
alert.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
alert.showAndWait();
}
}
use of system.DateFormatManager in project Money-Manager by krHasan.
the class MakeATransactionController method bnkSaveFunction.
private void bnkSaveFunction() {
Map<String, String> bnkData = new HashMap<>();
if (bnkSelectedTabName.equals("bKash")) {
try {
bnkData.put("bkTime", timeToSave());
bnkData.put("bkDate", (new DateFormatManager()).toString(bnkdateDate.getValue()));
bnkData.put("bkMonth", monthToSave(bnkdateDate.getValue()));
bnkData.put("bkBalanceBefore", getbkAccountBalance());
if (bnkAdjustBtnPressed) {
bnkData.put("bkType", "Adjusted Balance");
bnkData.put("bkNature", "Adjusted Balance");
bnkData.put("bkAmount", bnkAdjustAmount);
bnkData.put("bkBnkCharge", "None");
bnkData.put("bkBalanceAfter", bnkAdjustBalAfter);
(new Bkash()).saveBnkBkashData(bnkData);
setCurrentbKashBalance(bnkAdjustBalAfter);
} else {
bnkData.put("bkType", bkcmboTransactionType.getValue());
if (bkcmboAmountNature.getValue().equals("Credit")) {
bnkData.put("bkNature", "Credited by " + bkGetSelectedRbtn());
} else {
bnkData.put("bkNature", "Debited by " + bkGetSelectedRbtn());
}
bnkData.put("bkAmount", bktxtAmount.getText());
bnkData.put("bkBnkCharge", bkBankChargeShow());
bnkData.put("bkBalanceAfter", updatedbKashBalance(bktxtAmount.getText(), bkGetSelectedRbtn()));
if (bkcmboAmountNature.getValue().equals("Debit")) {
if (bkcmboTransactionType.getValue().equals("Personal")) {
bnkData.put("gmWalletBalanceBefore", longToString(currentWalletBalance()));
bnkData.put("gmWalletBalanceAfter", gmWalletBalanceAfter(bktxtAmount.getText()));
setCurrentWalletBalance(gmWalletBalanceAfter(bktxtAmount.getText()));
} else if (bkcmboTransactionType.getValue().equals("Get Money")) {
bnkData.put("gmWalletBalanceBefore", longToString(currentWalletBalance()));
bnkData.put("gmWalletBalanceAfter", gmWalletBalanceAfter(bktxtAmount.getText()));
(new GetMoney()).saveBnkBkashData(bnkData);
setCurrentWalletBalance(gmWalletBalanceAfter(bktxtAmount.getText()));
}
}
(new Bkash()).saveBnkBkashData(bnkData);
setCurrentbKashBalance(updatedbKashBalance(bktxtAmount.getText(), bkGetSelectedRbtn()));
}
(new ComboboxList()).setAllMonth(monthToSave(bnkdateDate.getValue()), yearToSave(bnkdateDate.getValue()));
bkInitialize();
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Successful Transaction");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText("Successful");
Stage MakeATransactionStage = (Stage) btnSignOut.getScene().getWindow();
confirmationMsg.setX(MakeATransactionStage.getX() + 200);
confirmationMsg.setY(MakeATransactionStage.getY() + 29);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
confirmationMsg.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
confirmationMsg.showAndWait();
} catch (Exception e) {
Alert alert = new Alert(AlertType.WARNING);
alert.setTitle("Transaction Failed");
alert.setHeaderText(null);
alert.setContentText("There something is wrong.");
Stage MakeATransactionStage = (Stage) btnSignOut.getScene().getWindow();
alert.setX(MakeATransactionStage.getX() + 200);
alert.setY(MakeATransactionStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
alert.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
alert.showAndWait();
}
} else if (bnkSelectedTabName.equals("Rocket")) {
try {
bnkData.put("rocTime", timeToSave());
bnkData.put("rocDate", (new DateFormatManager()).toString(bnkdateDate.getValue()));
bnkData.put("rocMonth", monthToSave(bnkdateDate.getValue()));
bnkData.put("rocBalanceBefore", getRocAccountBalance());
if (bnkAdjustBtnPressed) {
bnkData.put("rocType", "Adjusted Balance");
bnkData.put("rocNature", "Adjusted Balance");
bnkData.put("rocAmount", bnkAdjustAmount);
bnkData.put("rocBnkCharge", "None");
bnkData.put("rocBalanceAfter", bnkAdjustBalAfter);
(new Rocket()).saveBnkRocketData(bnkData);
setCurrentRocketBalance(bnkAdjustBalAfter);
} else {
bnkData.put("rocType", roccmboTransactionType.getValue());
if (roccmboAmountNature.getValue().equals("Credit")) {
bnkData.put("rocNature", "Credited by " + rocGetSelectedRbtn());
} else {
bnkData.put("rocNature", "Debited by " + rocGetSelectedRbtn());
}
bnkData.put("rocAmount", roctxtAmount.getText());
bnkData.put("rocBnkCharge", rocBankChargeShow());
if (roccmboAmountNature.getValue().equals("Credit")) {
bnkData.put("rocBalanceAfter", updatedRocketBalance(roctxtAmount.getText(), "Cash In", rocGetSelectedRbtn()));
setCurrentRocketBalance(updatedRocketBalance(roctxtAmount.getText(), "Cash In", rocGetSelectedRbtn()));
} else {
bnkData.put("rocBalanceAfter", updatedRocketBalance(roctxtAmount.getText(), "Cash Out", rocGetSelectedRbtn()));
setCurrentRocketBalance(updatedRocketBalance(roctxtAmount.getText(), "Cash Out", rocGetSelectedRbtn()));
if (roccmboTransactionType.getValue().equals("Personal")) {
bnkData.put("gmWalletBalanceBefore", longToString(currentWalletBalance()));
bnkData.put("gmWalletBalanceAfter", gmWalletBalanceAfter(roctxtAmount.getText()));
setCurrentWalletBalance(gmWalletBalanceAfter(roctxtAmount.getText()));
} else if (roccmboTransactionType.getValue().equals("Get Money")) {
bnkData.put("gmWalletBalanceBefore", longToString(currentWalletBalance()));
bnkData.put("gmWalletBalanceAfter", gmWalletBalanceAfter(roctxtAmount.getText()));
(new GetMoney()).saveBnkRocketData(bnkData);
setCurrentWalletBalance(gmWalletBalanceAfter(roctxtAmount.getText()));
}
}
(new Rocket()).saveBnkRocketData(bnkData);
}
(new ComboboxList()).setAllMonth(monthToSave(bnkdateDate.getValue()), yearToSave(bnkdateDate.getValue()));
rocInitialize();
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Successfull Transaction");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText("Successful");
Stage MakeATransactionStage = (Stage) btnSignOut.getScene().getWindow();
confirmationMsg.setX(MakeATransactionStage.getX() + 200);
confirmationMsg.setY(MakeATransactionStage.getY() + 29);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
confirmationMsg.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
confirmationMsg.showAndWait();
} catch (Exception e) {
Alert alert = new Alert(AlertType.WARNING);
alert.setTitle("Transaction Failed");
alert.setHeaderText(null);
alert.setContentText("There something is wrong.");
Stage MakeATransactionStage = (Stage) btnSignOut.getScene().getWindow();
alert.setX(MakeATransactionStage.getX() + 200);
alert.setY(MakeATransactionStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
alert.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
alert.showAndWait();
}
} else {
try {
bnkData.put("perTime", timeToSave());
bnkData.put("perDate", (new DateFormatManager()).toString(bnkdateDate.getValue()));
bnkData.put("perMonth", monthToSave(bnkdateDate.getValue()));
bnkData.put("perNature", percmboAmountNature.getValue());
bnkData.put("perAmount", pertxtAmount.getText());
bnkData.put("perBalanceBefore", getPerAccountBalance());
if (percmboAmountNature.getValue().equals("Credit")) {
bnkData.put("perBalanceAfter", updatedPersonalBalance(pertxtAmount.getText(), "Credit"));
bnkData.put("gmWalletBalanceBefore", longToString(currentWalletBalance()));
bnkData.put("gmWalletBalanceAfter", exWalletBalanceAfter(pertxtAmount.getText()));
setCurrentWalletBalance(exWalletBalanceAfter(pertxtAmount.getText()));
setCurrentPersonalBalance(updatedPersonalBalance(pertxtAmount.getText(), "Credit"));
} else {
bnkData.put("perBalanceAfter", updatedPersonalBalance(pertxtAmount.getText(), "Debit"));
bnkData.put("gmWalletBalanceBefore", longToString(currentWalletBalance()));
bnkData.put("gmWalletBalanceAfter", gmWalletBalanceAfter(pertxtAmount.getText()));
setCurrentWalletBalance(gmWalletBalanceAfter(pertxtAmount.getText()));
setCurrentPersonalBalance(updatedPersonalBalance(pertxtAmount.getText(), "Debit"));
}
(new Personal()).saveBnkPersonalData(bnkData);
(new ComboboxList()).setAllMonth(monthToSave(bnkdateDate.getValue()), yearToSave(bnkdateDate.getValue()));
perInitialize();
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Successfull Transaction");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText("Successful");
Stage MakeATransactionStage = (Stage) btnSignOut.getScene().getWindow();
confirmationMsg.setX(MakeATransactionStage.getX() + 200);
confirmationMsg.setY(MakeATransactionStage.getY() + 29);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
confirmationMsg.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
confirmationMsg.showAndWait();
} catch (Exception e) {
Alert alert = new Alert(AlertType.WARNING);
alert.setTitle("Transaction Failed");
alert.setHeaderText(null);
alert.setContentText("There something is wrong.");
Stage MakeATransactionStage = (Stage) btnSignOut.getScene().getWindow();
alert.setX(MakeATransactionStage.getX() + 200);
alert.setY(MakeATransactionStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
alert.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
alert.showAndWait();
}
}
}
use of system.DateFormatManager in project Money-Manager by krHasan.
the class SettingsController method timeRbtn.
private void timeRbtn() {
DateFormat formateTIME_h = new SimpleDateFormat("h:mm:ss a");
TIME_h.setText(formateTIME_h.format(now.getTime()));
TIME_h.setToggleGroup(timerbtnGroup);
TIME_h.setUserData("h:mm:ss a");
DateFormat formateTIME_hh = new SimpleDateFormat("hh:mm:ss a");
TIME_hh.setText(formateTIME_hh.format(now.getTime()));
TIME_hh.setToggleGroup(timerbtnGroup);
TIME_hh.setUserData("hh:mm:ss a");
DateFormat formateTIME_H = new SimpleDateFormat("H:mm:ss");
TIME_H.setText(formateTIME_H.format(now.getTime()));
TIME_H.setToggleGroup(timerbtnGroup);
TIME_H.setUserData("H:mm:ss");
DateFormat formateTIME_HH = new SimpleDateFormat("HH:mm:ss");
TIME_HH.setText(formateTIME_HH.format(now.getTime()));
TIME_HH.setToggleGroup(timerbtnGroup);
TIME_HH.setUserData("HH:mm:ss");
switch(new DateFormatManager().getTimeFormate()) {
case "h:mm:ss a":
TIME_h.setSelected(true);
break;
case "hh:mm:ss a":
TIME_hh.setSelected(true);
break;
case "H:mm:ss":
TIME_H.setSelected(true);
break;
default:
TIME_HH.setSelected(true);
break;
}
}
use of system.DateFormatManager in project Money-Manager by krHasan.
the class SettingsController method dateRbtn.
private void dateRbtn() {
DateFormat formateDATEddMMMM = new SimpleDateFormat("dd MMMM, yyyy");
DATEddMMMM.setText(formateDATEddMMMM.format(now.getTime()));
DATEddMMMM.setToggleGroup(daterbtnGroup);
DATEddMMMM.setUserData("dd MMMM, yyyy");
DateFormat formateDATEddMMM = new SimpleDateFormat("dd MMM, yyyy");
DATEddMMM.setText(formateDATEddMMM.format(now.getTime()));
DATEddMMM.setToggleGroup(daterbtnGroup);
DATEddMMM.setUserData("dd MMM, yyyy");
DateFormat formateDATEddMM = new SimpleDateFormat("dd-MM-yyyy");
DATEddMM.setText(formateDATEddMM.format(now.getTime()));
DATEddMM.setToggleGroup(daterbtnGroup);
DATEddMM.setUserData("dd-MM-yyyy");
DateFormat formateDATEEEddMMM = new SimpleDateFormat("EE dd MMMM, yyyy");
DATEEEddMMM.setText(formateDATEEEddMMM.format(now.getTime()));
DATEEEddMMM.setToggleGroup(daterbtnGroup);
DATEEEddMMM.setUserData("EE dd MMMM, yyyy");
DateFormat formateDATEMMM = new SimpleDateFormat("MMMM dd, yyyy");
DATEMMM.setText(formateDATEMMM.format(now.getTime()));
DATEMMM.setToggleGroup(daterbtnGroup);
DATEMMM.setUserData("MMMM dd, yyyy");
switch(new DateFormatManager().getDateFormat()) {
case "dd MMMM, yyyy":
DATEddMMMM.setSelected(true);
break;
case "dd MMM, yyyy":
DATEddMMM.setSelected(true);
break;
case "dd-MM-yyyy":
DATEddMM.setSelected(true);
break;
case "EE dd MMMM, yyyy":
DATEEEddMMM.setSelected(true);
break;
default:
DATEMMM.setSelected(true);
break;
}
}
Aggregations