| @@ -4,6 +4,8 @@ public class FormConstanta { | |||||
| //daftarkan halaman disini | //daftarkan halaman disini | ||||
| public static final String TRANSAKSI_TUNAI = "Transaksi Tunai"; | 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 TRANSAKSI_RETUR = "Transaksi Retur"; | ||||
| public static final String BAYAR = "Bayar"; | public static final String BAYAR = "Bayar"; | ||||
| } | } | ||||
| @@ -376,7 +376,7 @@ public class FormUtamaController implements Initializable { | |||||
| dialogTambahNota.initOwner(bpMain.getScene().getWindow()); | dialogTambahNota.initOwner(bpMain.getScene().getWindow()); | ||||
| Optional<String> hasilReturn = dialogTambahNota.showAndWait(); | 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", | Button buttonBaru = generateButtonNota("10-0220-0000X", | ||||
| FormConstanta.TRANSAKSI_TUNAI, | FormConstanta.TRANSAKSI_TUNAI, | ||||
| @@ -385,6 +385,33 @@ public class FormUtamaController implements Initializable { | |||||
| vbNavigasi.getChildren().add(buttonBaru); | vbNavigasi.getChildren().add(buttonBaru); | ||||
| jumlahNota++; | 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>() { | Observer<Pelanggan> pelangganObserver = new Observer<Pelanggan>() { | ||||
| @@ -18,6 +18,7 @@ import javafx.scene.Parent; | |||||
| import javafx.scene.control.ButtonType; | import javafx.scene.control.ButtonType; | ||||
| import javafx.scene.control.ComboBox; | import javafx.scene.control.ComboBox; | ||||
| import javafx.scene.control.Dialog; | import javafx.scene.control.Dialog; | ||||
| import javafx.scene.control.RadioButton; | |||||
| import javafx.scene.control.TextField; | import javafx.scene.control.TextField; | ||||
| import javafx.scene.control.ToggleGroup; | import javafx.scene.control.ToggleGroup; | ||||
| import javafx.scene.layout.AnchorPane; | import javafx.scene.layout.AnchorPane; | ||||
| @@ -34,13 +35,16 @@ public class DialogTambahNotaController extends Dialog<String> implements Initia | |||||
| @FXML | @FXML | ||||
| private ToggleGroup tgTipe; | private ToggleGroup tgTipe; | ||||
| @FXML | @FXML | ||||
| private ComboBox cbxPilihNota; | |||||
| private RadioButton rbBaru; | |||||
| @FXML | |||||
| private ComboBox<String> cbxPilihNota; | |||||
| @FXML | |||||
| private RadioButton rbAmbilDariCheckout; | |||||
| @FXML | @FXML | ||||
| private TextField txtFieldAmbilDariCheckout; | private TextField txtFieldAmbilDariCheckout; | ||||
| public static final ButtonType btnLanjutkan = new ButtonType("Lanjutkan"); | public static final ButtonType btnLanjutkan = new ButtonType("Lanjutkan"); | ||||
| public static final ButtonType btnBatal = new ButtonType("Batal"); | public static final ButtonType btnBatal = new ButtonType("Batal"); | ||||
| @Override | @Override | ||||
| public void initialize(URL url, ResourceBundle rb) { | public void initialize(URL url, ResourceBundle rb) { | ||||
| @@ -69,12 +73,15 @@ public class DialogTambahNotaController extends Dialog<String> implements Initia | |||||
| setResultConverter(buttonType -> { | setResultConverter(buttonType -> { | ||||
| if (buttonType == btnLanjutkan) { | if (buttonType == btnLanjutkan) { | ||||
| //radio button mana yang dipilih | //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 | //baru, balikin tipe yang dipilih | ||||
| //dari checkout, balikin isi nomor nota (hanya jika nota ditemukan) | //dari checkout, balikin isi nomor nota (hanya jika nota ditemukan) | ||||
| return "Tambah"; | |||||
| } | } | ||||
| return "Batal"; | return "Batal"; | ||||
| }); | }); | ||||
| setTitle("Tambah Nota"); | setTitle("Tambah Nota"); | ||||
| } catch (IOException ex) { | } catch (IOException ex) { | ||||
| @@ -27,7 +27,7 @@ public class Fucout { | |||||
| public static final String TIPE_NOTA_TUNAI = "Tunai"; | public static final String TIPE_NOTA_TUNAI = "Tunai"; | ||||
| public static final String TIPE_NOTA_BON = "Bon"; | 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"; | public static final String TIPE_NOTA_RETUR = "Retur"; | ||||
| //IMAGES URL | //IMAGES URL | ||||
| @@ -8,19 +8,19 @@ | |||||
| <?import javafx.scene.layout.AnchorPane?> | <?import javafx.scene.layout.AnchorPane?> | ||||
| <?import javafx.scene.text.Font?> | <?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> | <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> | ||||
| <Font size="16.0" /> | <Font size="16.0" /> | ||||
| </font> | </font> | ||||
| </Label> | </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> | ||||
| <ToggleGroup fx:id="tgTipe" /> | <ToggleGroup fx:id="tgTipe" /> | ||||
| </toggleGroup></RadioButton> | </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> | </children> | ||||
| </AnchorPane> | </AnchorPane> | ||||