-Membuat notif error jika pembayaran masih kurang -Menambahkan tgl dan jam di form utamamaster
| @@ -20,14 +20,20 @@ import io.reactivex.disposables.Disposable; | |||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.net.HttpURLConnection; | import java.net.HttpURLConnection; | ||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.text.SimpleDateFormat; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| import java.util.Optional; | import java.util.Optional; | ||||
| import java.util.ResourceBundle; | import java.util.ResourceBundle; | ||||
| import java.util.Timer; | |||||
| import java.util.TimerTask; | |||||
| import java.util.logging.Level; | import java.util.logging.Level; | ||||
| import java.util.logging.Logger; | import java.util.logging.Logger; | ||||
| import javafx.animation.Animation; | |||||
| import javafx.animation.KeyFrame; | |||||
| import javafx.animation.Timeline; | |||||
| import javafx.application.Platform; | import javafx.application.Platform; | ||||
| import javafx.event.ActionEvent; | import javafx.event.ActionEvent; | ||||
| import javafx.fxml.FXML; | import javafx.fxml.FXML; | ||||
| @@ -50,6 +56,7 @@ import javafx.scene.layout.BorderPane; | |||||
| import javafx.scene.layout.VBox; | import javafx.scene.layout.VBox; | ||||
| import javafx.stage.Stage; | import javafx.stage.Stage; | ||||
| import javafx.stage.Window; | import javafx.stage.Window; | ||||
| import javafx.util.Duration; | |||||
| import retrofit2.HttpException; | import retrofit2.HttpException; | ||||
| public class FormUtamaController implements Initializable { | public class FormUtamaController implements Initializable { | ||||
| @@ -78,6 +85,8 @@ public class FormUtamaController implements Initializable { | |||||
| private Label lblNoTelpPelanggan; | private Label lblNoTelpPelanggan; | ||||
| @FXML | @FXML | ||||
| private TextField tfScanMember; | private TextField tfScanMember; | ||||
| @FXML | |||||
| private Label lblTanggal; | |||||
| private final FormFactory formFactory = new FormFactory(); | private final FormFactory formFactory = new FormFactory(); | ||||
| @@ -103,8 +112,8 @@ public class FormUtamaController implements Initializable { | |||||
| if (SystemValue.konversiPoin == null) { | if (SystemValue.konversiPoin == null) { | ||||
| posRx.getNilaiKonversiPoin().subscribe(getNilaiKonversiPoin); | posRx.getNilaiKonversiPoin().subscribe(getNilaiKonversiPoin); | ||||
| } | } | ||||
| System.out.println("Hello"); | |||||
| setTanggalJam(); | |||||
| initShorcuts(); | initShorcuts(); | ||||
| } | } | ||||
| @@ -641,6 +650,14 @@ public class FormUtamaController implements Initializable { | |||||
| } | } | ||||
| }; | }; | ||||
| public void setTanggalJam() { | |||||
| Timeline timeline = new Timeline(new KeyFrame(Duration.seconds(1), ev -> { | |||||
| lblTanggal.setText(new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(new java.util.Date())); | |||||
| })); | |||||
| timeline.setCycleCount(Animation.INDEFINITE); | |||||
| timeline.play(); | |||||
| } | |||||
| Observer<KonversiPoin> getNilaiKonversiPoin = new Observer<KonversiPoin>() { | Observer<KonversiPoin> getNilaiKonversiPoin = new Observer<KonversiPoin>() { | ||||
| @Override | @Override | ||||
| public void onSubscribe(Disposable dspsbl) { | public void onSubscribe(Disposable dspsbl) { | ||||
| @@ -6,6 +6,7 @@ | |||||
| package id.amigogroup.posterminal.bayar; | package id.amigogroup.posterminal.bayar; | ||||
| import javafx.scene.Node; | import javafx.scene.Node; | ||||
| import javafx.stage.Window; | |||||
| /** | /** | ||||
| * | * | ||||
| @@ -21,5 +22,6 @@ public interface BayarInterface { | |||||
| final String BAYAR_POIN = "Poin"; | final String BAYAR_POIN = "Poin"; | ||||
| public BayarContent getBayarContent(); | public BayarContent getBayarContent(); | ||||
| public Window getWindow(); | |||||
| public void updateKurangBayarView(); | public void updateKurangBayarView(); | ||||
| } | } | ||||
| @@ -5,26 +5,38 @@ | |||||
| */ | */ | ||||
| package id.amigogroup.posterminal.bayar; | package id.amigogroup.posterminal.bayar; | ||||
| import id.amigogroup.posterminal.FormUtamaController; | |||||
| import id.amigogroup.posterminal.pencarian.DialogCariBarangController; | 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 id.amigogroup.posterminal.util.Fucout; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.HashMap; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | |||||
| import java.util.Optional; | |||||
| import java.util.ResourceBundle; | import java.util.ResourceBundle; | ||||
| import java.util.logging.Level; | import java.util.logging.Level; | ||||
| import java.util.logging.Logger; | import java.util.logging.Logger; | ||||
| import javafx.application.Platform; | |||||
| import javafx.event.ActionEvent; | import javafx.event.ActionEvent; | ||||
| import javafx.fxml.FXML; | import javafx.fxml.FXML; | ||||
| import javafx.fxml.FXMLLoader; | import javafx.fxml.FXMLLoader; | ||||
| import javafx.fxml.Initializable; | import javafx.fxml.Initializable; | ||||
| import javafx.scene.Node; | import javafx.scene.Node; | ||||
| import javafx.scene.Parent; | import javafx.scene.Parent; | ||||
| import javafx.scene.control.Alert; | |||||
| import javafx.scene.control.ButtonBar; | import javafx.scene.control.ButtonBar; | ||||
| import javafx.scene.control.ButtonType; | import javafx.scene.control.ButtonType; | ||||
| import javafx.scene.control.CheckBox; | import javafx.scene.control.CheckBox; | ||||
| import javafx.scene.control.Dialog; | import javafx.scene.control.Dialog; | ||||
| import javafx.scene.control.Label; | 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.scene.layout.VBox; | ||||
| import javafx.stage.Window; | import javafx.stage.Window; | ||||
| @@ -35,6 +47,8 @@ import javafx.stage.Window; | |||||
| */ | */ | ||||
| public class DialogSelesaiBayarTidakLunasController extends Dialog implements Initializable, BayarInterface { | public class DialogSelesaiBayarTidakLunasController extends Dialog implements Initializable, BayarInterface { | ||||
| @FXML | |||||
| private AnchorPane apContent; | |||||
| @FXML | @FXML | ||||
| private CheckBox chkTunai; | private CheckBox chkTunai; | ||||
| @FXML | @FXML | ||||
| @@ -60,6 +74,7 @@ public class DialogSelesaiBayarTidakLunasController extends Dialog implements In | |||||
| private List<CheckBox> daftarChkBayarSyarat; | private List<CheckBox> daftarChkBayarSyarat; | ||||
| private List<CheckBox> daftarChkBayarOpsional; | private List<CheckBox> daftarChkBayarOpsional; | ||||
| public BayarContent bayarContent = new BayarContent(); | public BayarContent bayarContent = new BayarContent(); | ||||
| private FormUtamaController parentFormUtamaController = null; | |||||
| /** | /** | ||||
| * Initializes the controller class. | * Initializes the controller class. | ||||
| @@ -74,6 +89,42 @@ public class DialogSelesaiBayarTidakLunasController extends Dialog implements In | |||||
| daftarChkBayarOpsional.add(chkOvo); | daftarChkBayarOpsional.add(chkOvo); | ||||
| daftarChkBayarOpsional.add(chkPoin); | daftarChkBayarOpsional.add(chkPoin); | ||||
| getDialogPane().getButtonTypes().add(new ButtonType("Tutup", ButtonBar.ButtonData.CANCEL_CLOSE)); | 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) { | public DialogSelesaiBayarTidakLunasController(BayarInterface parent, int kurangBayar) { | ||||
| @@ -226,4 +277,9 @@ public class DialogSelesaiBayarTidakLunasController extends Dialog implements In | |||||
| lblPerluBayar.setText(Fucout.getTextColon(Fucout.formatRupiah( | lblPerluBayar.setText(Fucout.getTextColon(Fucout.formatRupiah( | ||||
| bayarContent.getTotalPerluBayar() - bayarContent.getTotalBayar()))); | bayarContent.getTotalPerluBayar() - bayarContent.getTotalBayar()))); | ||||
| } | } | ||||
| @Override | |||||
| public Window getWindow() { | |||||
| return apContent.getScene().getWindow(); | |||||
| } | |||||
| } | } | ||||
| @@ -32,6 +32,7 @@ import javafx.scene.input.KeyCodeCombination; | |||||
| import javafx.scene.input.KeyCombination; | import javafx.scene.input.KeyCombination; | ||||
| import javafx.scene.layout.AnchorPane; | import javafx.scene.layout.AnchorPane; | ||||
| import javafx.scene.layout.VBox; | import javafx.scene.layout.VBox; | ||||
| import javafx.stage.Window; | |||||
| /** | /** | ||||
| * FXML Controller class | * FXML Controller class | ||||
| @@ -136,6 +137,7 @@ public class FormBayarController implements Initializable, BayarInterface { | |||||
| = new DialogSelesaiBayarTidakLunasController(this, | = new DialogSelesaiBayarTidakLunasController(this, | ||||
| bayarContent.getTotalPerluBayar() | bayarContent.getTotalPerluBayar() | ||||
| - bayarContent.getTotalBayar()); | - bayarContent.getTotalBayar()); | ||||
| dsbtlc.initData(parent); | |||||
| dsbtlc.initOwner(apContent.getScene().getWindow()); | dsbtlc.initOwner(apContent.getScene().getWindow()); | ||||
| dsbtlc.show(); | dsbtlc.show(); | ||||
| } | } | ||||
| @@ -297,4 +299,9 @@ public class FormBayarController implements Initializable, BayarInterface { | |||||
| lblKurangBayar.setText(Fucout.formatRupiah( | lblKurangBayar.setText(Fucout.formatRupiah( | ||||
| bayarContent.getTotalPerluBayar() - bayarContent.getTotalBayar())); | bayarContent.getTotalPerluBayar() - bayarContent.getTotalBayar())); | ||||
| } | } | ||||
| @Override | |||||
| public Window getWindow() { | |||||
| return apContent.getScene().getWindow(); | |||||
| } | |||||
| } | } | ||||
| @@ -25,6 +25,7 @@ public class AlertUtil { | |||||
| public static final String ERROR_KONEKSI_TIMEOUT_MESSAGE = "Koneksi ke server mengalami kegagalan."; | public static final String ERROR_KONEKSI_TIMEOUT_MESSAGE = "Koneksi ke server mengalami kegagalan."; | ||||
| public static final String DIALOG_KONFIRMASI_MESSAGE = "Apakah anda yakin?"; | public static final String DIALOG_KONFIRMASI_MESSAGE = "Apakah anda yakin?"; | ||||
| public static final String ERROR_TIDAK_LENGKAP_TITLE = "Error: Data Tidak Lengkap"; | public static final String ERROR_TIDAK_LENGKAP_TITLE = "Error: Data Tidak Lengkap"; | ||||
| public static final String DIALOG_UANG_BELUM_CUKUP = "Nominal Belum Cukup"; | |||||
| public static final ButtonType BUTTON_YA = new ButtonType("Ya", ButtonData.YES); | public static final ButtonType BUTTON_YA = new ButtonType("Ya", ButtonData.YES); | ||||
| public static final ButtonType BUTTON_TIDAK = new ButtonType("Tidak", ButtonData.NO); | public static final ButtonType BUTTON_TIDAK = new ButtonType("Tidak", ButtonData.NO); | ||||
| @@ -9,8 +9,7 @@ | |||||
| <?import javafx.scene.layout.VBox?> | <?import javafx.scene.layout.VBox?> | ||||
| <?import javafx.scene.text.Font?> | <?import javafx.scene.text.Font?> | ||||
| <AnchorPane id="AnchorPane" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/11.0.1"> | |||||
| <AnchorPane id="AnchorPane" fx:id="apContent" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1"> | |||||
| <children> | <children> | ||||
| <Label layoutX="14.0" layoutY="14.0" text="Bayar" AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="4.0"> | <Label layoutX="14.0" layoutY="14.0" text="Bayar" AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="4.0"> | ||||
| <font> | <font> | ||||
| @@ -67,7 +67,7 @@ | |||||
| <Insets right="5.0" /> | <Insets right="5.0" /> | ||||
| </HBox.margin> | </HBox.margin> | ||||
| </Separator> | </Separator> | ||||
| <Label text="21/01/2019 11:55:44"> | |||||
| <Label fx:id="lblTanggal" text="21/01/2019 11:55:44"> | |||||
| <font> | <font> | ||||
| <Font name="System Bold" size="12.0" /> | <Font name="System Bold" size="12.0" /> | ||||
| </font> | </font> | ||||