* No nota saat dipindahkan data barang yang sudah di load tidak hilangpull/7/head
| @@ -164,17 +164,30 @@ public class FormUtamaController implements Initializable { | |||
| try { | |||
| switch (tipe) { | |||
| 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; | |||
| 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; | |||
| } | |||
| @@ -227,6 +240,12 @@ public class FormUtamaController implements Initializable { | |||
| }; | |||
| listShortcuts.put(kcNextNota, rnNextNota); | |||
| KeyCombination kcTambah = new KeyCodeCombination(KeyCode.F3); | |||
| Runnable rnTambah = () -> { | |||
| btnTambahNota.fire(); | |||
| }; | |||
| listShortcuts.put(kcTambah, rnTambah); | |||
| KeyCombination kcCariBarang = new KeyCodeCombination(KeyCode.F5); | |||
| Runnable rnCariBarang = () -> { | |||
| DialogCariBarangController dialogCariBarang = new DialogCariBarangController(); | |||
| @@ -306,12 +325,6 @@ public class FormUtamaController implements Initializable { | |||
| }; | |||
| 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); | |||
| Runnable rnScanMember = () -> { | |||
| tfScanMember.requestFocus(); | |||
| @@ -321,7 +334,10 @@ public class FormUtamaController implements Initializable { | |||
| KeyCombination kcLogout = new KeyCodeCombination(KeyCode.L, KeyCombination.CONTROL_DOWN); | |||
| Runnable rnLogout = () -> { | |||
| try { | |||
| generateNewWindow("/fxml/FormLogin.fxml").show(); | |||
| Stage stage = generateNewWindow("/fxml/FormLogin.fxml"); | |||
| stage.setResizable(false); | |||
| stage.show(); | |||
| Stage thisStage = (Stage) bpMain.getScene().getWindow(); | |||
| thisStage.close(); | |||
| } catch (IOException ex) { | |||
| @@ -538,9 +554,11 @@ public class FormUtamaController implements Initializable { | |||
| Button btnTunai; | |||
| FormTransaksiTunaiController controllerTunai = null; | |||
| Node nodeTunai = null; | |||
| Button btnBawa; | |||
| Button btnBon; | |||
| Button btnRetur; | |||
| FormTransaksiReturController controllerRetur = null; | |||
| Node nodeRetur = null; | |||
| } | |||
| } | |||
| @@ -39,6 +39,8 @@ import javafx.scene.control.ToggleGroup; | |||
| import javafx.scene.control.cell.PropertyValueFactory; | |||
| import javafx.scene.input.KeyCode; | |||
| import javafx.scene.input.KeyEvent; | |||
| import javafx.scene.input.MouseButton; | |||
| import javafx.scene.input.MouseEvent; | |||
| import javafx.scene.layout.AnchorPane; | |||
| import javafx.stage.Window; | |||
| import retrofit2.HttpException; | |||
| @@ -78,7 +80,7 @@ public class DialogCariPelangganController extends Dialog<Pelanggan> implements | |||
| private TableColumn<TabelPelanggan, String> tcUpline; | |||
| final ObservableList<TabelPelanggan> daftarTabelPelanggan = FXCollections.observableArrayList(); | |||
| AmigoPosRx posRx = new AmigoPosRx(); | |||
| private Pelanggan pelanggan = null; | |||
| private Pelanggan selectedPelanggan = null; | |||
| /** | |||
| * Initializes the controller class. | |||
| @@ -112,7 +114,7 @@ public class DialogCariPelangganController extends Dialog<Pelanggan> implements | |||
| setTitle("Cari Pelanggan"); | |||
| setResultConverter(buttonType -> { | |||
| return pelanggan; | |||
| return selectedPelanggan; | |||
| }); | |||
| } catch (IOException e) { | |||
| Logger.getLogger(DialogCariBarangController.class | |||
| @@ -123,15 +125,18 @@ public class DialogCariPelangganController extends Dialog<Pelanggan> implements | |||
| public void updateTabelPelanggan(List<Pelanggan> daftarPelanggan) { | |||
| daftarTabelPelanggan.clear(); | |||
| for (Pelanggan pelanggan : daftarPelanggan) { | |||
| daftarTabelPelanggan.add(new TabelPelanggan( | |||
| TabelPelanggan tp = new TabelPelanggan( | |||
| pelanggan.getAlias(), | |||
| pelanggan.getNama(), | |||
| pelanggan.getAlamat(), | |||
| pelanggan.getTelp() + " / " + pelanggan.getPonsel(), | |||
| pelanggan.getUpline())); | |||
| pelanggan.getUpline()); | |||
| tp.setData(pelanggan); | |||
| daftarTabelPelanggan.add(tp); | |||
| } | |||
| } | |||
| @FXML | |||
| void tfPencarianOnKeyReleased(KeyEvent event) { | |||
| 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>() { | |||
| @Override | |||
| public void onSubscribe(Disposable dspsbl) { | |||
| @@ -155,9 +182,8 @@ public class DialogCariPelangganController extends Dialog<Pelanggan> implements | |||
| @Override | |||
| public void onNext(Pelanggan p) { | |||
| System.out.println("COBA AJA"); | |||
| if (p != null) { | |||
| pelanggan = p; | |||
| selectedPelanggan = p; | |||
| close(); | |||
| } | |||
| } | |||
| @@ -5,6 +5,7 @@ | |||
| */ | |||
| package id.amigogroup.posterminal.pencarian; | |||
| import id.amigogroup.posterminal.model.Pelanggan; | |||
| import javafx.beans.property.SimpleStringProperty; | |||
| /** | |||
| @@ -18,6 +19,8 @@ public class TabelPelanggan { | |||
| private final SimpleStringProperty alamat; | |||
| private final SimpleStringProperty noTelp; | |||
| private final SimpleStringProperty upline; | |||
| private Pelanggan data; | |||
| public TabelPelanggan(String kode, String nama, String alamat, String noTelp, String upline) { | |||
| this.kode = new SimpleStringProperty(kode); | |||
| @@ -96,4 +99,18 @@ public class TabelPelanggan { | |||
| public void setUpline(String 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; | |||
| import id.amigogroup.posterminal.FormUtamaController; | |||
| import id.amigogroup.posterminal.api.AmigoPosRx; | |||
| import id.amigogroup.posterminal.model.Barang; | |||
| import id.amigogroup.posterminal.model.DNotaRetur; | |||
| @@ -17,12 +16,9 @@ import id.amigogroup.posterminal.util.Fucout; | |||
| import io.reactivex.Observer; | |||
| import io.reactivex.disposables.Disposable; | |||
| import java.net.HttpURLConnection; | |||
| import java.net.SocketTimeoutException; | |||
| import java.net.URL; | |||
| import java.util.List; | |||
| import java.util.ResourceBundle; | |||
| import java.util.logging.Level; | |||
| import java.util.logging.Logger; | |||
| import javafx.application.Platform; | |||
| import javafx.beans.property.ReadOnlyObjectWrapper; | |||
| import javafx.collections.FXCollections; | |||
| @@ -109,7 +105,7 @@ public class FormTransaksiReturController implements Initializable { | |||
| @FXML | |||
| private Label lblTambahKeTabelRetur; | |||
| private TableColumn<TabelBarangTunai, Button> tcAction; | |||
| private final AmigoPosRx posRx = new AmigoPosRx(); | |||
| private String noNota = ""; | |||
| private final ObservableList<TabelBarangTunai> daftarTabelPenjualan = FXCollections.observableArrayList(); | |||
| @@ -133,7 +129,7 @@ public class FormTransaksiReturController implements Initializable { | |||
| tcDisc2.setCellValueFactory(new PropertyValueFactory<>("disc2")); | |||
| tcSubTotal.setCellValueFactory(new PropertyValueFactory<>("subTotal")); | |||
| tcPramuniaga.setCellValueFactory(new PropertyValueFactory<>("fldPramuniaga")); | |||
| tcAction.setCellValueFactory(new PropertyValueFactory<>("btnAction")); | |||
| // tcAction.setCellValueFactory(new PropertyValueFactory<>("btnAction")); | |||
| tbvPenjualan.setItems(daftarTabelPenjualan); | |||
| tcNoRetur.setCellValueFactory((TableColumn.CellDataFeatures<TabelBarangRetur, Integer> cell) -> { | |||
| @@ -5,7 +5,6 @@ | |||
| */ | |||
| package id.amigogroup.posterminal.transaksi; | |||
| import id.amigogroup.posterminal.FormUtamaController; | |||
| import id.amigogroup.posterminal.api.AmigoPosRx; | |||
| import id.amigogroup.posterminal.model.Barang; | |||
| import id.amigogroup.posterminal.model.DNotaTunai; | |||
| @@ -17,12 +16,9 @@ import io.reactivex.Observable; | |||
| import io.reactivex.Observer; | |||
| import io.reactivex.disposables.Disposable; | |||
| import java.net.HttpURLConnection; | |||
| import java.net.SocketTimeoutException; | |||
| import java.net.URL; | |||
| import java.util.List; | |||
| import java.util.ResourceBundle; | |||
| import java.util.logging.Level; | |||
| import java.util.logging.Logger; | |||
| import javafx.application.Platform; | |||
| import javafx.beans.property.ReadOnlyObjectWrapper; | |||
| import javafx.collections.FXCollections; | |||
| @@ -43,7 +39,6 @@ import javafx.scene.input.KeyCode; | |||
| import javafx.scene.input.KeyEvent; | |||
| import javafx.scene.layout.AnchorPane; | |||
| import javafx.scene.text.Text; | |||
| import javax.swing.JOptionPane; | |||
| import retrofit2.HttpException; | |||
| /** | |||
| @@ -26,7 +26,7 @@ | |||
| </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="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> | |||
| <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" /> | |||
| @@ -110,11 +110,11 @@ | |||
| <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="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="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="tcPramuniagaRetur" prefWidth="75.0" text="Pramuniaga" /> | |||
| </columns> | |||