| @@ -4,6 +4,8 @@ public class FormConstanta { | |||
| //daftarkan halaman disini | |||
| public static final String TRANSAKSI_TUNAI = "Transaksi Tunai"; | |||
| public static final String TRANSAKSI_BON = "Transaksi Bon"; | |||
| public static final String TRANSAKSI_BAWA = "Transaksi Bawa"; | |||
| public static final String TRANSAKSI_RETUR = "Transaksi Retur"; | |||
| public static final String BAYAR = "Bayar"; | |||
| } | |||
| @@ -376,7 +376,7 @@ public class FormUtamaController implements Initializable { | |||
| dialogTambahNota.initOwner(bpMain.getScene().getWindow()); | |||
| Optional<String> hasilReturn = dialogTambahNota.showAndWait(); | |||
| if (hasilReturn.isPresent() && hasilReturn.get().equals("Tambah")) { | |||
| if (hasilReturn.isPresent() && hasilReturn.get().equals("Tunai")) { | |||
| Button buttonBaru = generateButtonNota("10-0220-0000X", | |||
| FormConstanta.TRANSAKSI_TUNAI, | |||
| @@ -385,6 +385,33 @@ public class FormUtamaController implements Initializable { | |||
| vbNavigasi.getChildren().add(buttonBaru); | |||
| jumlahNota++; | |||
| } | |||
| else if (hasilReturn.isPresent() && hasilReturn.get().equals("Bon")) { | |||
| Button buttonBaru = generateButtonNota("10-0220-0000X", | |||
| FormConstanta.TRANSAKSI_BON, | |||
| Fucout.TIPE_NOTA_BON); | |||
| navigasi.add(buttonBaru); | |||
| vbNavigasi.getChildren().add(buttonBaru); | |||
| jumlahNota++; | |||
| } | |||
| else if (hasilReturn.isPresent() && hasilReturn.get().equals("Bawa")) { | |||
| Button buttonBaru = generateButtonNota("10-0220-0000X", | |||
| FormConstanta.TRANSAKSI_BAWA, | |||
| Fucout.TIPE_NOTA_BAWA); | |||
| navigasi.add(buttonBaru); | |||
| vbNavigasi.getChildren().add(buttonBaru); | |||
| jumlahNota++; | |||
| } | |||
| else if (hasilReturn.isPresent() && hasilReturn.get().equals("Retur")) { | |||
| Button buttonBaru = generateButtonNota("10-0220-0000X", | |||
| FormConstanta.TRANSAKSI_RETUR, | |||
| Fucout.TIPE_NOTA_RETUR); | |||
| navigasi.add(buttonBaru); | |||
| vbNavigasi.getChildren().add(buttonBaru); | |||
| jumlahNota++; | |||
| } | |||
| } | |||
| Observer<Pelanggan> pelangganObserver = new Observer<Pelanggan>() { | |||
| @@ -18,6 +18,7 @@ import javafx.scene.Parent; | |||
| import javafx.scene.control.ButtonType; | |||
| import javafx.scene.control.ComboBox; | |||
| import javafx.scene.control.Dialog; | |||
| import javafx.scene.control.RadioButton; | |||
| import javafx.scene.control.TextField; | |||
| import javafx.scene.control.ToggleGroup; | |||
| import javafx.scene.layout.AnchorPane; | |||
| @@ -34,13 +35,16 @@ public class DialogTambahNotaController extends Dialog<String> implements Initia | |||
| @FXML | |||
| private ToggleGroup tgTipe; | |||
| @FXML | |||
| private ComboBox cbxPilihNota; | |||
| private RadioButton rbBaru; | |||
| @FXML | |||
| private ComboBox<String> cbxPilihNota; | |||
| @FXML | |||
| private RadioButton rbAmbilDariCheckout; | |||
| @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) { | |||
| @@ -69,12 +73,15 @@ public class DialogTambahNotaController extends Dialog<String> implements Initia | |||
| setResultConverter(buttonType -> { | |||
| if (buttonType == btnLanjutkan) { | |||
| //radio button mana yang dipilih | |||
| if (((RadioButton) tgTipe.getSelectedToggle()) == rbBaru) { | |||
| return cbxPilihNota.getValue(); | |||
| } else if (((RadioButton) tgTipe.getSelectedToggle()) == rbAmbilDariCheckout) { | |||
| return txtFieldAmbilDariCheckout.getText(); | |||
| } | |||
| //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) { | |||
| @@ -27,7 +27,7 @@ public class Fucout { | |||
| public static final String TIPE_NOTA_TUNAI = "Tunai"; | |||
| public static final String TIPE_NOTA_BON = "Bon"; | |||
| public static final String TIPE_NOTA_BAWA_DULU = "Bawa"; | |||
| public static final String TIPE_NOTA_BAWA = "Bawa"; | |||
| public static final String TIPE_NOTA_RETUR = "Retur"; | |||
| //IMAGES URL | |||
| @@ -8,19 +8,19 @@ | |||
| <?import javafx.scene.layout.AnchorPane?> | |||
| <?import javafx.scene.text.Font?> | |||
| <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"> | |||
| <AnchorPane id="AnchorPane" fx:id="apTambahNota" prefHeight="150.0" prefWidth="300.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1"> | |||
| <children> | |||
| <Label layoutX="14.0" layoutY="14.0" text="Tambah Nota" AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="4.0"> | |||
| <Label layoutX="14.0" layoutY="14.0" text="Tambah Nota" AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="0.0"> | |||
| <font> | |||
| <Font size="16.0" /> | |||
| </font> | |||
| </Label> | |||
| <RadioButton layoutX="33.0" layoutY="45.0" mnemonicParsing="false" onAction="#rbNotaBaruOnAction" selected="true" text="Baru" AnchorPane.leftAnchor="32.0" AnchorPane.topAnchor="46.0"> | |||
| <RadioButton fx:id="rbBaru" layoutX="4.0" layoutY="30.0" mnemonicParsing="false" onAction="#rbNotaBaruOnAction" selected="true" text="Baru" AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="30.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" /> | |||
| <RadioButton fx:id="rbAmbilDariCheckout" layoutX="4.0" layoutY="90.0" mnemonicParsing="false" onAction="#rbAmbilDariCheckoutOnAction" text="Ambil dari checkout" toggleGroup="$tgTipe" AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="90.0" /> | |||
| <ComboBox fx:id="cbxPilihNota" layoutX="4.0" layoutY="52.0" prefWidth="150.0" promptText="Pilih nota" AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="52.0" /> | |||
| <TextField fx:id="txtFieldAmbilDariCheckout" disable="true" layoutX="4.0" layoutY="112.0" AnchorPane.leftAnchor="4.0" AnchorPane.rightAnchor="4.0" AnchorPane.topAnchor="112.0" /> | |||
| </children> | |||
| </AnchorPane> | |||