| @@ -5,6 +5,7 @@ import id.amigogroup.posterminal.pencarian.DialogCariNotaTundaController; | |||||
| import id.amigogroup.posterminal.pencarian.DialogCariPelangganController; | import id.amigogroup.posterminal.pencarian.DialogCariPelangganController; | ||||
| import id.amigogroup.posterminal.pencarian.DialogCetakUlangNotaController; | import id.amigogroup.posterminal.pencarian.DialogCetakUlangNotaController; | ||||
| import id.amigogroup.posterminal.transaksi.DialogKonfirmasiReturController; | import id.amigogroup.posterminal.transaksi.DialogKonfirmasiReturController; | ||||
| import id.amigogroup.posterminal.transaksi.DialogTambahNotaController; | |||||
| import id.amigogroup.posterminal.transaksi.FormTransaksiReturController; | import id.amigogroup.posterminal.transaksi.FormTransaksiReturController; | ||||
| import id.amigogroup.posterminal.transaksi.FormTransaksiTunaiController; | import id.amigogroup.posterminal.transaksi.FormTransaksiTunaiController; | ||||
| import id.amigogroup.posterminal.util.Fucout; | import id.amigogroup.posterminal.util.Fucout; | ||||
| @@ -93,11 +94,11 @@ public class FormUtamaController implements Initializable { | |||||
| tipeNotaState = Fucout.TIPE_NOTA_TUNAI; | tipeNotaState = Fucout.TIPE_NOTA_TUNAI; | ||||
| }); | }); | ||||
| } | } | ||||
| private void updateSelectedNota(ActionEvent event) { | private void updateSelectedNota(ActionEvent event) { | ||||
| Button buttonSource = (Button) event.getSource(); | Button buttonSource = (Button) event.getSource(); | ||||
| notaState = navigasi.indexOf(buttonSource); | notaState = navigasi.indexOf(buttonSource); | ||||
| Fucout.scrollToNode(spNavigasi,buttonSource); | |||||
| Fucout.scrollToNode(spNavigasi, buttonSource); | |||||
| // if (!tableState.equals(buttonSource.getText().toLowerCase())) { | // if (!tableState.equals(buttonSource.getText().toLowerCase())) { | ||||
| // switch (buttonSource.getText().toLowerCase()) { | // switch (buttonSource.getText().toLowerCase()) { | ||||
| // case BTN_TUNAI: | // case BTN_TUNAI: | ||||
| @@ -248,7 +249,7 @@ public class FormUtamaController implements Initializable { | |||||
| }; | }; | ||||
| listShortcuts.put(kcCariNotaTunda, rnCariNotaTunda); | listShortcuts.put(kcCariNotaTunda, rnCariNotaTunda); | ||||
| KeyCombination kcCariCetakUlangNota = new KeyCodeCombination(KeyCode.P,KeyCombination.CONTROL_DOWN); | |||||
| KeyCombination kcCariCetakUlangNota = new KeyCodeCombination(KeyCode.P, KeyCombination.CONTROL_DOWN); | |||||
| Runnable rnCetakUlangNota = () -> { | Runnable rnCetakUlangNota = () -> { | ||||
| DialogCetakUlangNotaController dialogCetakUlangNota = new DialogCetakUlangNotaController(); | DialogCetakUlangNotaController dialogCetakUlangNota = new DialogCetakUlangNotaController(); | ||||
| dialogCetakUlangNota.initOwner((Stage) bpMain.getScene().getWindow()); | dialogCetakUlangNota.initOwner((Stage) bpMain.getScene().getWindow()); | ||||
| @@ -260,7 +261,7 @@ public class FormUtamaController implements Initializable { | |||||
| KeyCombination kcCheckout = new KeyCodeCombination(KeyCode.F8); | KeyCombination kcCheckout = new KeyCodeCombination(KeyCode.F8); | ||||
| Runnable rnCheckout = () -> { | Runnable rnCheckout = () -> { | ||||
| switch(tipeNotaState){ | |||||
| switch (tipeNotaState) { | |||||
| case Fucout.TIPE_NOTA_TUNAI: | case Fucout.TIPE_NOTA_TUNAI: | ||||
| setContent(formFactory.getForm(FormConstanta.BAYAR, this)); | setContent(formFactory.getForm(FormConstanta.BAYAR, this)); | ||||
| break; | break; | ||||
| @@ -314,11 +315,18 @@ public class FormUtamaController implements Initializable { | |||||
| @FXML | @FXML | ||||
| void btnTambahNotaOnAction(ActionEvent event) { | void btnTambahNotaOnAction(ActionEvent event) { | ||||
| Button buttonBaru = generateButtonNota("10-0220-0000X", | |||||
| FormConstanta.TRANSAKSI_TUNAI, | |||||
| Fucout.TIPE_NOTA_TUNAI); | |||||
| navigasi.add(buttonBaru); | |||||
| vbNavigasi.getChildren().add(buttonBaru); | |||||
| jumlahNota++; | |||||
| DialogTambahNotaController dialogTambahNota = new DialogTambahNotaController(); | |||||
| dialogTambahNota.initOwner((Stage) bpMain.getScene().getWindow()); | |||||
| Optional<String> hasilReturn = dialogTambahNota.showAndWait(); | |||||
| if (hasilReturn.isPresent() && hasilReturn.get().equals("Tambah")) { | |||||
| Button buttonBaru = generateButtonNota("10-0220-0000X", | |||||
| FormConstanta.TRANSAKSI_TUNAI, | |||||
| Fucout.TIPE_NOTA_TUNAI); | |||||
| navigasi.add(buttonBaru); | |||||
| vbNavigasi.getChildren().add(buttonBaru); | |||||
| jumlahNota++; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,103 @@ | |||||
| /* | |||||
| * To change this license header, choose License Headers in Project Properties. | |||||
| * To change this template file, choose Tools | Templates | |||||
| * and open the template in the editor. | |||||
| */ | |||||
| package id.amigogroup.posterminal.transaksi; | |||||
| import java.io.IOException; | |||||
| import java.net.URL; | |||||
| import java.util.ResourceBundle; | |||||
| import java.util.logging.Level; | |||||
| import java.util.logging.Logger; | |||||
| import javafx.event.ActionEvent; | |||||
| import javafx.fxml.FXML; | |||||
| import javafx.fxml.FXMLLoader; | |||||
| import javafx.fxml.Initializable; | |||||
| import javafx.scene.Parent; | |||||
| import javafx.scene.control.ButtonType; | |||||
| import javafx.scene.control.ComboBox; | |||||
| import javafx.scene.control.Dialog; | |||||
| import javafx.scene.control.TextField; | |||||
| import javafx.scene.control.ToggleGroup; | |||||
| import javafx.scene.layout.AnchorPane; | |||||
| import javafx.stage.Window; | |||||
| /** | |||||
| * | |||||
| * @author Josua | |||||
| */ | |||||
| public class DialogTambahNotaController extends Dialog<String> implements Initializable { | |||||
| @FXML | |||||
| private AnchorPane apTambahNota; | |||||
| @FXML | |||||
| private ToggleGroup tgTipe; | |||||
| @FXML | |||||
| private ComboBox cbxPilihNota; | |||||
| @FXML | |||||
| private TextField txtFieldAmbilDariCheckout; | |||||
| public static final ButtonType btnLanjutkan = new ButtonType("Lanjutkan"); | |||||
| public static final ButtonType btnBatal = new ButtonType("Batal"); | |||||
| @Override | |||||
| public void initialize(URL url, ResourceBundle rb) { | |||||
| cbxPilihNota.getItems().setAll( | |||||
| "Tunai", | |||||
| "Bon", | |||||
| "Bawa Dulu", | |||||
| "Retur" | |||||
| ); | |||||
| } | |||||
| public DialogTambahNotaController() { | |||||
| try { | |||||
| Window window = getDialogPane().getScene().getWindow(); | |||||
| window.setOnCloseRequest(event -> this.close()); | |||||
| FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/DialogTambahNota.fxml")); | |||||
| loader.setController(this); | |||||
| // DialogCariBarangController controller = loader.<DialogCariBarangController>getController(); | |||||
| Parent root = loader.load(); | |||||
| getDialogPane().setContent(root); | |||||
| getDialogPane().getButtonTypes().add(btnBatal); | |||||
| getDialogPane().getButtonTypes().add(btnLanjutkan); | |||||
| setResultConverter(buttonType -> { | |||||
| if (buttonType == btnLanjutkan) { | |||||
| //radio button mana yang dipilih | |||||
| //baru, balikin tipe yang dipilih | |||||
| //dari checkout, balikin isi nomor nota (hanya jika nota ditemukan) | |||||
| return "Tambah"; | |||||
| } | |||||
| return "Batal"; | |||||
| }); | |||||
| setTitle("Tambah Nota"); | |||||
| } catch (IOException ex) { | |||||
| Logger.getLogger(DialogKonfirmasiReturController.class.getName()).log(Level.SEVERE, null, ex); | |||||
| } | |||||
| } | |||||
| @FXML | |||||
| void rbNotaBaruOnAction(ActionEvent event) { | |||||
| cbxPilihNota.setDisable(false); | |||||
| txtFieldAmbilDariCheckout.setDisable(true); | |||||
| // Button buttonBaru FormConstanta= generateButtonNota("10-0220-0000X", | |||||
| // FormConstanta.TRANSAKSI_TUNAI, | |||||
| // Fucout.TIPE_NOTA_TUNAI); | |||||
| // navigasi.add(buttonBaru); | |||||
| // vbNavigasi.getChildren().add(buttonBaru); | |||||
| // jumlahNota++; | |||||
| } | |||||
| @FXML | |||||
| void rbAmbilDariCheckoutOnAction(ActionEvent event) { | |||||
| cbxPilihNota.setDisable(true); | |||||
| txtFieldAmbilDariCheckout.setDisable(false); | |||||
| } | |||||
| } | |||||
| @@ -1,25 +1,26 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||
| <?import javafx.scene.control.Button?> | |||||
| <?import javafx.scene.control.ComboBox?> | <?import javafx.scene.control.ComboBox?> | ||||
| <?import javafx.scene.control.Label?> | <?import javafx.scene.control.Label?> | ||||
| <?import javafx.scene.control.RadioButton?> | <?import javafx.scene.control.RadioButton?> | ||||
| <?import javafx.scene.control.TextField?> | <?import javafx.scene.control.TextField?> | ||||
| <?import javafx.scene.control.ToggleGroup?> | |||||
| <?import javafx.scene.layout.AnchorPane?> | <?import javafx.scene.layout.AnchorPane?> | ||||
| <?import javafx.scene.text.Font?> | <?import javafx.scene.text.Font?> | ||||
| <AnchorPane id="AnchorPane" prefHeight="250.0" prefWidth="400.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1"> | |||||
| <AnchorPane id="AnchorPane" fx:id="apTambahNota" prefHeight="189.0" prefWidth="400.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="Tambah" AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="4.0"> | |||||
| <Label layoutX="14.0" layoutY="14.0" text="Tambah Nota" AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="4.0"> | |||||
| <font> | <font> | ||||
| <Font size="16.0" /> | <Font size="16.0" /> | ||||
| </font> | </font> | ||||
| </Label> | </Label> | ||||
| <RadioButton layoutX="33.0" layoutY="45.0" mnemonicParsing="false" onAction="#rbTambahNotaBaru" text="Baru" AnchorPane.leftAnchor="32.0" AnchorPane.topAnchor="46.0" /> | |||||
| <RadioButton layoutX="33.0" layoutY="121.0" mnemonicParsing="false" text="Ambil dari checkout" AnchorPane.leftAnchor="32.0" AnchorPane.topAnchor="122.0" /> | |||||
| <ComboBox layoutX="61.0" layoutY="79.0" prefWidth="150.0" promptText="Pilih salah satu" AnchorPane.leftAnchor="62.0" AnchorPane.topAnchor="70.0" /> | |||||
| <TextField layoutX="63.0" layoutY="150.0" AnchorPane.leftAnchor="62.0" AnchorPane.topAnchor="146.0" /> | |||||
| <Button layoutX="250.0" layoutY="200.0" mnemonicParsing="false" onAction="#btnBatal" text="Batal" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="90.0" /> | |||||
| <Button layoutX="318.0" layoutY="200.0" mnemonicParsing="false" onAction="#btnLanjutkan" text="Lanjutkan" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="10.0" /> | |||||
| <RadioButton layoutX="33.0" layoutY="45.0" mnemonicParsing="false" onAction="#rbNotaBaruOnAction" selected="true" text="Baru" AnchorPane.leftAnchor="32.0" AnchorPane.topAnchor="46.0"> | |||||
| <toggleGroup> | |||||
| <ToggleGroup fx:id="tgTipe" /> | |||||
| </toggleGroup></RadioButton> | |||||
| <RadioButton layoutX="33.0" layoutY="121.0" mnemonicParsing="false" onAction="#rbAmbilDariCheckoutOnAction" text="Ambil dari checkout" toggleGroup="$tgTipe" AnchorPane.leftAnchor="32.0" AnchorPane.topAnchor="122.0" /> | |||||
| <ComboBox fx:id="cbxPilihNota" layoutX="61.0" layoutY="79.0" prefWidth="150.0" promptText="Pilih nota" AnchorPane.leftAnchor="62.0" AnchorPane.topAnchor="70.0" /> | |||||
| <TextField fx:id="txtFieldAmbilDariCheckout" disable="true" layoutX="63.0" layoutY="150.0" AnchorPane.leftAnchor="62.0" AnchorPane.topAnchor="146.0" /> | |||||
| </children> | </children> | ||||
| </AnchorPane> | </AnchorPane> | ||||