|
|
|
|
@ -5,26 +5,38 @@
|
|
|
|
|
*/
|
|
|
|
|
package id.amigogroup.posterminal.bayar;
|
|
|
|
|
|
|
|
|
|
import id.amigogroup.posterminal.FormUtamaController;
|
|
|
|
|
import id.amigogroup.posterminal.pencarian.DialogCariBarangController;
|
|
|
|
|
import id.amigogroup.posterminal.pencarian.DialogCetakNotaController;
|
|
|
|
|
import id.amigogroup.posterminal.util.AlertUtil;
|
|
|
|
|
import id.amigogroup.posterminal.util.Fucout;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.net.URL;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
import java.util.ResourceBundle;
|
|
|
|
|
import java.util.logging.Level;
|
|
|
|
|
import java.util.logging.Logger;
|
|
|
|
|
import javafx.application.Platform;
|
|
|
|
|
import javafx.event.ActionEvent;
|
|
|
|
|
import javafx.fxml.FXML;
|
|
|
|
|
import javafx.fxml.FXMLLoader;
|
|
|
|
|
import javafx.fxml.Initializable;
|
|
|
|
|
import javafx.scene.Node;
|
|
|
|
|
import javafx.scene.Parent;
|
|
|
|
|
import javafx.scene.control.Alert;
|
|
|
|
|
import javafx.scene.control.ButtonBar;
|
|
|
|
|
import javafx.scene.control.ButtonType;
|
|
|
|
|
import javafx.scene.control.CheckBox;
|
|
|
|
|
import javafx.scene.control.Dialog;
|
|
|
|
|
import javafx.scene.control.Label;
|
|
|
|
|
import javafx.scene.input.KeyCode;
|
|
|
|
|
import javafx.scene.input.KeyCodeCombination;
|
|
|
|
|
import javafx.scene.input.KeyCombination;
|
|
|
|
|
import javafx.scene.layout.AnchorPane;
|
|
|
|
|
import javafx.scene.layout.VBox;
|
|
|
|
|
import javafx.stage.Window;
|
|
|
|
|
|
|
|
|
|
@ -35,6 +47,8 @@ import javafx.stage.Window;
|
|
|
|
|
*/
|
|
|
|
|
public class DialogSelesaiBayarTidakLunasController extends Dialog implements Initializable, BayarInterface {
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
private AnchorPane apContent;
|
|
|
|
|
@FXML
|
|
|
|
|
private CheckBox chkTunai;
|
|
|
|
|
@FXML
|
|
|
|
|
@ -60,6 +74,7 @@ public class DialogSelesaiBayarTidakLunasController extends Dialog implements In
|
|
|
|
|
private List<CheckBox> daftarChkBayarSyarat;
|
|
|
|
|
private List<CheckBox> daftarChkBayarOpsional;
|
|
|
|
|
public BayarContent bayarContent = new BayarContent();
|
|
|
|
|
private FormUtamaController parentFormUtamaController = null;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initializes the controller class.
|
|
|
|
|
@ -74,6 +89,42 @@ public class DialogSelesaiBayarTidakLunasController extends Dialog implements In
|
|
|
|
|
daftarChkBayarOpsional.add(chkOvo);
|
|
|
|
|
daftarChkBayarOpsional.add(chkPoin);
|
|
|
|
|
getDialogPane().getButtonTypes().add(new ButtonType("Tutup", ButtonBar.ButtonData.CANCEL_CLOSE));
|
|
|
|
|
initShortcuts();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void initData(FormUtamaController parent) {
|
|
|
|
|
this.parentFormUtamaController = parent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void initShortcuts() {
|
|
|
|
|
Map<KeyCombination, Runnable> listShortcuts = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
KeyCombination kcSelesaiBayar = new KeyCodeCombination(KeyCode.F10);
|
|
|
|
|
Runnable rnSelesaiBayar = () -> {
|
|
|
|
|
if (bayarContent.getTotalBayar() >= bayarContent.getTotalPerluBayar()) {
|
|
|
|
|
if (parentFormUtamaController != null) {
|
|
|
|
|
DialogCetakNotaController dialogCetakNotaController = new DialogCetakNotaController();
|
|
|
|
|
dialogCetakNotaController.initOwner(parent.getWindow());
|
|
|
|
|
dialogCetakNotaController.initData(
|
|
|
|
|
parentFormUtamaController.notaContent.getControllerTunai() != null
|
|
|
|
|
? parentFormUtamaController.notaContent.getControllerTunai().daftarTabelTransaksi : null,
|
|
|
|
|
parentFormUtamaController.notaContent.getControllerRetur() != null
|
|
|
|
|
? parentFormUtamaController.notaContent.getControllerRetur().daftarTabelRetur : null,
|
|
|
|
|
this);
|
|
|
|
|
Optional<String> result = dialogCetakNotaController.showAndWait();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
Alert alert = AlertUtil.getAlertWarning(
|
|
|
|
|
AlertUtil.DIALOG_UANG_BELUM_CUKUP,
|
|
|
|
|
"Nominal yang anda masukan masih kurang");
|
|
|
|
|
alert.show();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
listShortcuts.put(kcSelesaiBayar, rnSelesaiBayar);
|
|
|
|
|
|
|
|
|
|
Platform.runLater(() -> {
|
|
|
|
|
apContent.getScene().getAccelerators().putAll(listShortcuts);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DialogSelesaiBayarTidakLunasController(BayarInterface parent, int kurangBayar) {
|
|
|
|
|
@ -226,4 +277,9 @@ public class DialogSelesaiBayarTidakLunasController extends Dialog implements In
|
|
|
|
|
lblPerluBayar.setText(Fucout.getTextColon(Fucout.formatRupiah(
|
|
|
|
|
bayarContent.getTotalPerluBayar() - bayarContent.getTotalBayar())));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Window getWindow() {
|
|
|
|
|
return apContent.getScene().getWindow();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|