* No nota saat dipindahkan data barang yang sudah di load tidak hilangpull/7/head
| @@ -164,17 +164,30 @@ public class FormUtamaController implements Initializable { | |||||
| try { | try { | ||||
| switch (tipe) { | switch (tipe) { | ||||
| case FormConstanta.TRANSAKSI_TUNAI: | case FormConstanta.TRANSAKSI_TUNAI: | ||||
| loader.setLocation(getClass().getResource("/fxml/FormTransaksiTunai.fxml")); | |||||
| node = loader.load(); | |||||
| FormTransaksiTunaiController fttc = loader.getController(); | |||||
| notaContent.controllerTunai = fttc; | |||||
| fttc.initData(noNota, baru); | |||||
| if (notaContent.nodeTunai != null) { | |||||
| node = notaContent.nodeTunai; | |||||
| } else { | |||||
| loader.setLocation(getClass().getResource("/fxml/FormTransaksiTunai.fxml")); | |||||
| node = loader.load(); | |||||
| notaContent.nodeTunai = node; | |||||
| FormTransaksiTunaiController fttc = loader.getController(); | |||||
| notaContent.controllerTunai = fttc; | |||||
| fttc.initData(noNota, baru); | |||||
| } | |||||
| break; | break; | ||||
| case FormConstanta.TRANSAKSI_RETUR: | case FormConstanta.TRANSAKSI_RETUR: | ||||
| loader.setLocation(getClass().getResource("/fxml/FormTransaksiRetur.fxml")); | |||||
| node = loader.load(); | |||||
| FormTransaksiReturController ftrc = loader.getController(); | |||||
| ftrc.initData(noNota, baru); | |||||
| if (notaContent.nodeRetur != null) { | |||||
| node = notaContent.nodeRetur; | |||||
| } else { | |||||
| loader.setLocation(getClass().getResource("/fxml/FormTransaksiRetur.fxml")); | |||||
| node = loader.load(); | |||||
| notaContent.nodeRetur = node; | |||||
| FormTransaksiReturController ftrc = loader.getController(); | |||||
| notaContent.controllerRetur = ftrc; | |||||
| ftrc.initData(noNota, baru); | |||||
| } | |||||
| break; | break; | ||||
| } | } | ||||
| @@ -227,6 +240,12 @@ public class FormUtamaController implements Initializable { | |||||
| }; | }; | ||||
| listShortcuts.put(kcNextNota, rnNextNota); | listShortcuts.put(kcNextNota, rnNextNota); | ||||
| KeyCombination kcTambah = new KeyCodeCombination(KeyCode.F3); | |||||
| Runnable rnTambah = () -> { | |||||
| btnTambahNota.fire(); | |||||
| }; | |||||
| listShortcuts.put(kcTambah, rnTambah); | |||||
| KeyCombination kcCariBarang = new KeyCodeCombination(KeyCode.F5); | KeyCombination kcCariBarang = new KeyCodeCombination(KeyCode.F5); | ||||
| Runnable rnCariBarang = () -> { | Runnable rnCariBarang = () -> { | ||||
| DialogCariBarangController dialogCariBarang = new DialogCariBarangController(); | DialogCariBarangController dialogCariBarang = new DialogCariBarangController(); | ||||
| @@ -306,12 +325,6 @@ public class FormUtamaController implements Initializable { | |||||
| }; | }; | ||||
| listShortcuts.put(kcCariCetakUlangNota, rnCetakUlangNota); | listShortcuts.put(kcCariCetakUlangNota, rnCetakUlangNota); | ||||
| KeyCombination kcTambah = new KeyCodeCombination(KeyCode.T, KeyCombination.CONTROL_DOWN); | |||||
| Runnable rnTambah = () -> { | |||||
| btnTambahNota.fire(); | |||||
| }; | |||||
| listShortcuts.put(kcTambah, rnTambah); | |||||
| KeyCombination kcScanMember = new KeyCodeCombination(KeyCode.S, KeyCombination.CONTROL_DOWN); | KeyCombination kcScanMember = new KeyCodeCombination(KeyCode.S, KeyCombination.CONTROL_DOWN); | ||||
| Runnable rnScanMember = () -> { | Runnable rnScanMember = () -> { | ||||
| tfScanMember.requestFocus(); | tfScanMember.requestFocus(); | ||||
| @@ -321,7 +334,10 @@ public class FormUtamaController implements Initializable { | |||||
| KeyCombination kcLogout = new KeyCodeCombination(KeyCode.L, KeyCombination.CONTROL_DOWN); | KeyCombination kcLogout = new KeyCodeCombination(KeyCode.L, KeyCombination.CONTROL_DOWN); | ||||
| Runnable rnLogout = () -> { | Runnable rnLogout = () -> { | ||||
| try { | try { | ||||
| generateNewWindow("/fxml/FormLogin.fxml").show(); | |||||
| Stage stage = generateNewWindow("/fxml/FormLogin.fxml"); | |||||
| stage.setResizable(false); | |||||
| stage.show(); | |||||
| Stage thisStage = (Stage) bpMain.getScene().getWindow(); | Stage thisStage = (Stage) bpMain.getScene().getWindow(); | ||||
| thisStage.close(); | thisStage.close(); | ||||
| } catch (IOException ex) { | } catch (IOException ex) { | ||||
| @@ -538,9 +554,11 @@ public class FormUtamaController implements Initializable { | |||||
| Button btnTunai; | Button btnTunai; | ||||
| FormTransaksiTunaiController controllerTunai = null; | FormTransaksiTunaiController controllerTunai = null; | ||||
| Node nodeTunai = null; | |||||
| Button btnBawa; | Button btnBawa; | ||||
| Button btnBon; | Button btnBon; | ||||
| Button btnRetur; | Button btnRetur; | ||||
| FormTransaksiReturController controllerRetur = null; | FormTransaksiReturController controllerRetur = null; | ||||
| Node nodeRetur = null; | |||||
| } | } | ||||
| } | } | ||||
| @@ -39,6 +39,8 @@ import javafx.scene.control.ToggleGroup; | |||||
| import javafx.scene.control.cell.PropertyValueFactory; | import javafx.scene.control.cell.PropertyValueFactory; | ||||
| import javafx.scene.input.KeyCode; | import javafx.scene.input.KeyCode; | ||||
| import javafx.scene.input.KeyEvent; | import javafx.scene.input.KeyEvent; | ||||
| import javafx.scene.input.MouseButton; | |||||
| import javafx.scene.input.MouseEvent; | |||||
| import javafx.scene.layout.AnchorPane; | import javafx.scene.layout.AnchorPane; | ||||
| import javafx.stage.Window; | import javafx.stage.Window; | ||||
| import retrofit2.HttpException; | import retrofit2.HttpException; | ||||
| @@ -78,7 +80,7 @@ public class DialogCariPelangganController extends Dialog<Pelanggan> implements | |||||
| private TableColumn<TabelPelanggan, String> tcUpline; | private TableColumn<TabelPelanggan, String> tcUpline; | ||||
| final ObservableList<TabelPelanggan> daftarTabelPelanggan = FXCollections.observableArrayList(); | final ObservableList<TabelPelanggan> daftarTabelPelanggan = FXCollections.observableArrayList(); | ||||
| AmigoPosRx posRx = new AmigoPosRx(); | AmigoPosRx posRx = new AmigoPosRx(); | ||||
| private Pelanggan pelanggan = null; | |||||
| private Pelanggan selectedPelanggan = null; | |||||
| /** | /** | ||||
| * Initializes the controller class. | * Initializes the controller class. | ||||
| @@ -112,7 +114,7 @@ public class DialogCariPelangganController extends Dialog<Pelanggan> implements | |||||
| setTitle("Cari Pelanggan"); | setTitle("Cari Pelanggan"); | ||||
| setResultConverter(buttonType -> { | setResultConverter(buttonType -> { | ||||
| return pelanggan; | |||||
| return selectedPelanggan; | |||||
| }); | }); | ||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| Logger.getLogger(DialogCariBarangController.class | Logger.getLogger(DialogCariBarangController.class | ||||
| @@ -123,15 +125,18 @@ public class DialogCariPelangganController extends Dialog<Pelanggan> implements | |||||
| public void updateTabelPelanggan(List<Pelanggan> daftarPelanggan) { | public void updateTabelPelanggan(List<Pelanggan> daftarPelanggan) { | ||||
| daftarTabelPelanggan.clear(); | daftarTabelPelanggan.clear(); | ||||
| for (Pelanggan pelanggan : daftarPelanggan) { | for (Pelanggan pelanggan : daftarPelanggan) { | ||||
| daftarTabelPelanggan.add(new TabelPelanggan( | |||||
| TabelPelanggan tp = new TabelPelanggan( | |||||
| pelanggan.getAlias(), | pelanggan.getAlias(), | ||||
| pelanggan.getNama(), | pelanggan.getNama(), | ||||
| pelanggan.getAlamat(), | pelanggan.getAlamat(), | ||||
| pelanggan.getTelp() + " / " + pelanggan.getPonsel(), | pelanggan.getTelp() + " / " + pelanggan.getPonsel(), | ||||
| pelanggan.getUpline())); | |||||
| pelanggan.getUpline()); | |||||
| tp.setData(pelanggan); | |||||
| daftarTabelPelanggan.add(tp); | |||||
| } | } | ||||
| } | } | ||||
| @FXML | @FXML | ||||
| void tfPencarianOnKeyReleased(KeyEvent event) { | void tfPencarianOnKeyReleased(KeyEvent event) { | ||||
| daftarTabelPelanggan.clear(); | daftarTabelPelanggan.clear(); | ||||
| @@ -148,6 +153,28 @@ public class DialogCariPelangganController extends Dialog<Pelanggan> implements | |||||
| } | } | ||||
| @FXML | |||||
| void tbvPelangganOnKeyPressed(KeyEvent event) { | |||||
| if (event.getCode() == KeyCode.ENTER) { | |||||
| if (tbvPelanggan.getSelectionModel().getSelectedItem() != null) { | |||||
| selectedPelanggan = tbvPelanggan.getSelectionModel().getSelectedItem().getData(); | |||||
| close(); | |||||
| } | |||||
| } | |||||
| } | |||||
| @FXML | |||||
| void tbvPelangganOnMouseClicked(MouseEvent event) { | |||||
| if (event.getButton().equals(MouseButton.PRIMARY)) { | |||||
| if (event.getClickCount() >= 2) { | |||||
| if (tbvPelanggan.getSelectionModel().getSelectedItem() != null) { | |||||
| selectedPelanggan = tbvPelanggan.getSelectionModel().getSelectedItem().getData(); | |||||
| close(); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| public Observer<Pelanggan> pelangganMemberObserver = new Observer<Pelanggan>() { | public Observer<Pelanggan> pelangganMemberObserver = new Observer<Pelanggan>() { | ||||
| @Override | @Override | ||||
| public void onSubscribe(Disposable dspsbl) { | public void onSubscribe(Disposable dspsbl) { | ||||
| @@ -155,9 +182,8 @@ public class DialogCariPelangganController extends Dialog<Pelanggan> implements | |||||
| @Override | @Override | ||||
| public void onNext(Pelanggan p) { | public void onNext(Pelanggan p) { | ||||
| System.out.println("COBA AJA"); | |||||
| if (p != null) { | if (p != null) { | ||||
| pelanggan = p; | |||||
| selectedPelanggan = p; | |||||
| close(); | close(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -5,6 +5,7 @@ | |||||
| */ | */ | ||||
| package id.amigogroup.posterminal.pencarian; | package id.amigogroup.posterminal.pencarian; | ||||
| import id.amigogroup.posterminal.model.Pelanggan; | |||||
| import javafx.beans.property.SimpleStringProperty; | import javafx.beans.property.SimpleStringProperty; | ||||
| /** | /** | ||||
| @@ -18,6 +19,8 @@ public class TabelPelanggan { | |||||
| private final SimpleStringProperty alamat; | private final SimpleStringProperty alamat; | ||||
| private final SimpleStringProperty noTelp; | private final SimpleStringProperty noTelp; | ||||
| private final SimpleStringProperty upline; | private final SimpleStringProperty upline; | ||||
| private Pelanggan data; | |||||
| public TabelPelanggan(String kode, String nama, String alamat, String noTelp, String upline) { | public TabelPelanggan(String kode, String nama, String alamat, String noTelp, String upline) { | ||||
| this.kode = new SimpleStringProperty(kode); | this.kode = new SimpleStringProperty(kode); | ||||
| @@ -96,4 +99,18 @@ public class TabelPelanggan { | |||||
| public void setUpline(String upline) { | public void setUpline(String upline) { | ||||
| this.upline.set(upline); | this.upline.set(upline); | ||||
| } | } | ||||
| /** | |||||
| * @return the data | |||||
| */ | |||||
| public Pelanggan getData() { | |||||
| return data; | |||||
| } | |||||
| /** | |||||
| * @param data the data to set | |||||
| */ | |||||
| public void setData(Pelanggan data) { | |||||
| this.data = data; | |||||
| } | |||||
| } | } | ||||
| @@ -5,7 +5,6 @@ | |||||
| */ | */ | ||||
| package id.amigogroup.posterminal.transaksi; | package id.amigogroup.posterminal.transaksi; | ||||
| import id.amigogroup.posterminal.FormUtamaController; | |||||
| import id.amigogroup.posterminal.api.AmigoPosRx; | import id.amigogroup.posterminal.api.AmigoPosRx; | ||||
| import id.amigogroup.posterminal.model.Barang; | import id.amigogroup.posterminal.model.Barang; | ||||
| import id.amigogroup.posterminal.model.DNotaRetur; | import id.amigogroup.posterminal.model.DNotaRetur; | ||||
| @@ -17,12 +16,9 @@ import id.amigogroup.posterminal.util.Fucout; | |||||
| import io.reactivex.Observer; | import io.reactivex.Observer; | ||||
| import io.reactivex.disposables.Disposable; | import io.reactivex.disposables.Disposable; | ||||
| import java.net.HttpURLConnection; | import java.net.HttpURLConnection; | ||||
| import java.net.SocketTimeoutException; | |||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.ResourceBundle; | import java.util.ResourceBundle; | ||||
| import java.util.logging.Level; | |||||
| import java.util.logging.Logger; | |||||
| import javafx.application.Platform; | import javafx.application.Platform; | ||||
| import javafx.beans.property.ReadOnlyObjectWrapper; | import javafx.beans.property.ReadOnlyObjectWrapper; | ||||
| import javafx.collections.FXCollections; | import javafx.collections.FXCollections; | ||||
| @@ -109,7 +105,7 @@ public class FormTransaksiReturController implements Initializable { | |||||
| @FXML | @FXML | ||||
| private Label lblTambahKeTabelRetur; | private Label lblTambahKeTabelRetur; | ||||
| private TableColumn<TabelBarangTunai, Button> tcAction; | private TableColumn<TabelBarangTunai, Button> tcAction; | ||||
| private final AmigoPosRx posRx = new AmigoPosRx(); | private final AmigoPosRx posRx = new AmigoPosRx(); | ||||
| private String noNota = ""; | private String noNota = ""; | ||||
| private final ObservableList<TabelBarangTunai> daftarTabelPenjualan = FXCollections.observableArrayList(); | private final ObservableList<TabelBarangTunai> daftarTabelPenjualan = FXCollections.observableArrayList(); | ||||
| @@ -133,7 +129,7 @@ public class FormTransaksiReturController implements Initializable { | |||||
| tcDisc2.setCellValueFactory(new PropertyValueFactory<>("disc2")); | tcDisc2.setCellValueFactory(new PropertyValueFactory<>("disc2")); | ||||
| tcSubTotal.setCellValueFactory(new PropertyValueFactory<>("subTotal")); | tcSubTotal.setCellValueFactory(new PropertyValueFactory<>("subTotal")); | ||||
| tcPramuniaga.setCellValueFactory(new PropertyValueFactory<>("fldPramuniaga")); | tcPramuniaga.setCellValueFactory(new PropertyValueFactory<>("fldPramuniaga")); | ||||
| tcAction.setCellValueFactory(new PropertyValueFactory<>("btnAction")); | |||||
| // tcAction.setCellValueFactory(new PropertyValueFactory<>("btnAction")); | |||||
| tbvPenjualan.setItems(daftarTabelPenjualan); | tbvPenjualan.setItems(daftarTabelPenjualan); | ||||
| tcNoRetur.setCellValueFactory((TableColumn.CellDataFeatures<TabelBarangRetur, Integer> cell) -> { | tcNoRetur.setCellValueFactory((TableColumn.CellDataFeatures<TabelBarangRetur, Integer> cell) -> { | ||||
| @@ -5,7 +5,6 @@ | |||||
| */ | */ | ||||
| package id.amigogroup.posterminal.transaksi; | package id.amigogroup.posterminal.transaksi; | ||||
| import id.amigogroup.posterminal.FormUtamaController; | |||||
| import id.amigogroup.posterminal.api.AmigoPosRx; | import id.amigogroup.posterminal.api.AmigoPosRx; | ||||
| import id.amigogroup.posterminal.model.Barang; | import id.amigogroup.posterminal.model.Barang; | ||||
| import id.amigogroup.posterminal.model.DNotaTunai; | import id.amigogroup.posterminal.model.DNotaTunai; | ||||
| @@ -17,12 +16,9 @@ import io.reactivex.Observable; | |||||
| import io.reactivex.Observer; | import io.reactivex.Observer; | ||||
| import io.reactivex.disposables.Disposable; | import io.reactivex.disposables.Disposable; | ||||
| import java.net.HttpURLConnection; | import java.net.HttpURLConnection; | ||||
| import java.net.SocketTimeoutException; | |||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.ResourceBundle; | import java.util.ResourceBundle; | ||||
| import java.util.logging.Level; | |||||
| import java.util.logging.Logger; | |||||
| import javafx.application.Platform; | import javafx.application.Platform; | ||||
| import javafx.beans.property.ReadOnlyObjectWrapper; | import javafx.beans.property.ReadOnlyObjectWrapper; | ||||
| import javafx.collections.FXCollections; | import javafx.collections.FXCollections; | ||||
| @@ -43,7 +39,6 @@ import javafx.scene.input.KeyCode; | |||||
| import javafx.scene.input.KeyEvent; | import javafx.scene.input.KeyEvent; | ||||
| import javafx.scene.layout.AnchorPane; | import javafx.scene.layout.AnchorPane; | ||||
| import javafx.scene.text.Text; | import javafx.scene.text.Text; | ||||
| import javax.swing.JOptionPane; | |||||
| import retrofit2.HttpException; | import retrofit2.HttpException; | ||||
| /** | /** | ||||
| @@ -26,7 +26,7 @@ | |||||
| </RadioButton> | </RadioButton> | ||||
| <RadioButton fx:id="rbNama" layoutX="80.0" layoutY="93.0" mnemonicParsing="false" selected="true" text="Nama" toggleGroup="$tgTipe" AnchorPane.leftAnchor="80.0" AnchorPane.topAnchor="93.0" /> | <RadioButton fx:id="rbNama" layoutX="80.0" layoutY="93.0" mnemonicParsing="false" selected="true" text="Nama" toggleGroup="$tgTipe" AnchorPane.leftAnchor="80.0" AnchorPane.topAnchor="93.0" /> | ||||
| <RadioButton fx:id="rbNoTelpNoHp" layoutX="143.0" layoutY="93.0" mnemonicParsing="false" text="NoTelp/No.Hp" toggleGroup="$tgTipe" AnchorPane.leftAnchor="143.0" AnchorPane.topAnchor="93.0" /> | <RadioButton fx:id="rbNoTelpNoHp" layoutX="143.0" layoutY="93.0" mnemonicParsing="false" text="NoTelp/No.Hp" toggleGroup="$tgTipe" AnchorPane.leftAnchor="143.0" AnchorPane.topAnchor="93.0" /> | ||||
| <TableView fx:id="tbvPelanggan" layoutX="14.0" layoutY="117.0" prefHeight="338.0" prefWidth="500.0" AnchorPane.bottomAnchor="-5.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="117.0"> | |||||
| <TableView fx:id="tbvPelanggan" layoutX="14.0" layoutY="117.0" onKeyPressed="#tbvPelangganOnKeyPressed" onMouseClicked="#tbvPelangganOnMouseClicked" prefHeight="338.0" prefWidth="500.0" AnchorPane.bottomAnchor="-5.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="117.0"> | |||||
| <columns> | <columns> | ||||
| <TableColumn fx:id="tcNo" maxWidth="30.0" minWidth="30.0" prefWidth="30.0" resizable="false" text="No" /> | <TableColumn fx:id="tcNo" maxWidth="30.0" minWidth="30.0" prefWidth="30.0" resizable="false" text="No" /> | ||||
| <TableColumn fx:id="tcKode" prefWidth="75.0" text="Kode" /> | <TableColumn fx:id="tcKode" prefWidth="75.0" text="Kode" /> | ||||
| @@ -110,11 +110,11 @@ | |||||
| <TableColumn fx:id="tcNoRetur" maxWidth="30.0" minWidth="30.0" prefWidth="30.0" resizable="false" text="No" /> | <TableColumn fx:id="tcNoRetur" maxWidth="30.0" minWidth="30.0" prefWidth="30.0" resizable="false" text="No" /> | ||||
| <TableColumn fx:id="tcKodeRetur" prefWidth="75.0" text="Kode Barang" /> | <TableColumn fx:id="tcKodeRetur" prefWidth="75.0" text="Kode Barang" /> | ||||
| <TableColumn fx:id="tcNamaRetur" prefWidth="75.0" text="Nama Barang" /> | <TableColumn fx:id="tcNamaRetur" prefWidth="75.0" text="Nama Barang" /> | ||||
| <TableColumn fx:id="tcUkurRetur" prefWidth="75.0" text="Ukur" /> | |||||
| <TableColumn fx:id="tcJumlahRetur" prefWidth="75.0" text="Jumlah" /> | |||||
| <TableColumn fx:id="tcUkurRetur" maxWidth="40.0" minWidth="40.0" prefWidth="40.0" resizable="false" text="Ukur" /> | |||||
| <TableColumn fx:id="tcJumlahRetur" maxWidth="30.0" minWidth="30.0" prefWidth="30.0" resizable="false" text="Jml" /> | |||||
| <TableColumn fx:id="tcHargaRetur" prefWidth="75.0" text="Harga" /> | <TableColumn fx:id="tcHargaRetur" prefWidth="75.0" text="Harga" /> | ||||
| <TableColumn fx:id="tcDisc1Retur" prefWidth="75.0" text="Disc 1" /> | |||||
| <TableColumn fx:id="tcDisc2Retur" prefWidth="75.0" text="Disc 2" /> | |||||
| <TableColumn fx:id="tcDisc1Retur" maxWidth="50.0" minWidth="50.0" prefWidth="50.0" resizable="false" text="Disc 1" /> | |||||
| <TableColumn fx:id="tcDisc2Retur" maxWidth="50.0" minWidth="50.0" prefWidth="50.0" resizable="false" text="Disc 2" /> | |||||
| <TableColumn fx:id="tcSubTotalRetur" prefWidth="75.0" text="Sub Total" /> | <TableColumn fx:id="tcSubTotalRetur" prefWidth="75.0" text="Sub Total" /> | ||||
| <TableColumn fx:id="tcPramuniagaRetur" prefWidth="75.0" text="Pramuniaga" /> | <TableColumn fx:id="tcPramuniagaRetur" prefWidth="75.0" text="Pramuniaga" /> | ||||
| </columns> | </columns> | ||||