* [Logic] Tampilan nota per jenis, bila sama ditumpuk * [Logic] Load data barang dimasukkan ke tabel di transaksi tunai (untuk ambil dari checkout), dan di transaksi retur (untuk mengambil no nota penjualan) * [UI] Poin ditampilkan nilai konversi, juga perhitungan input poin menjadi berapa rupiah * [Logic + UI] Fungsi voucher returpull/6/head
| @@ -17,26 +17,16 @@ public class App extends Application { | |||
| @Override | |||
| public void start(Stage stage) throws Exception { | |||
| // var javaVersion = SystemInfo.javaVersion(); | |||
| // var javafxVersion = SystemInfo.javafxVersion(); | |||
| // | |||
| // var label = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + "."); | |||
| Locale.setDefault(Locale.forLanguageTag("in-ID")); | |||
| Parent root = FXMLLoader.load(getClass().getResource("/fxml/FormLogin.fxml")); | |||
| Scene scene = new Scene(root); | |||
| System.out.println("Contoh Generate No Nota Temporary :" + Fucout.getNoNotaTemporary()); | |||
| stage.setScene(scene); | |||
| stage.setTitle(Fucout.APP_TITLE); | |||
| stage.getIcons().add(new Image(Fucout.APP_ICON)); | |||
| stage.show(); | |||
| // var scene = new Scene(new StackPane(label), 640, 480); | |||
| // stage.setScene(scene); | |||
| // stage.show(); | |||
| } | |||
| public static void main(String[] args) { | |||
| @@ -84,12 +84,12 @@ public class FormUtamaController implements Initializable { | |||
| private final List<Button> navigasi = new ArrayList<>(); | |||
| private int notaState = -1; | |||
| private String tipeNotaState = ""; | |||
| private String tipeTransaksiState = ""; | |||
| private int jumlahNota = 0; | |||
| private final char NOTA_PREV = 'p'; | |||
| private final char NOTA_NEXT = 'n'; | |||
| private NotaContent notaContent = new NotaContent(); | |||
| private AmigoPosRx posRx = new AmigoPosRx(); | |||
| private final NotaContent notaContent = new NotaContent(); | |||
| private final AmigoPosRx posRx = new AmigoPosRx(); | |||
| /** | |||
| * Initializes the controller class. | |||
| @@ -149,20 +149,20 @@ public class FormUtamaController implements Initializable { | |||
| // fldScan.requestFocus(); | |||
| } | |||
| private Button generateButtonNota(String noNota, String tipeNota, String tipeTeks) { | |||
| private Button generateButtonNota(String noNota, String tipeNota, String tipeTeks, boolean baru) { | |||
| Button button = new Button(tipeTeks + ": " + noNota); | |||
| button.getStyleClass().add("button-navigasi-transaksi"); | |||
| button.setMaxWidth(Double.MAX_VALUE); | |||
| button.setOnAction((event) -> { | |||
| setContent(loadNota(noNota, tipeNota)); | |||
| tipeNotaState = tipeNota; | |||
| setContent(loadNota(noNota, tipeNota, baru)); | |||
| tipeTransaksiState = tipeNota; | |||
| updateSelectedNota(event); | |||
| }); | |||
| return button; | |||
| } | |||
| private Node loadNota(String noNota, String tipe) { | |||
| private Node loadNota(String noNota, String tipe, boolean baru) { | |||
| Node node = null; | |||
| FXMLLoader loader = new FXMLLoader(); | |||
| try { | |||
| @@ -171,14 +171,19 @@ public class FormUtamaController implements Initializable { | |||
| loader.setLocation(getClass().getResource("/fxml/FormTransaksiTunai.fxml")); | |||
| node = loader.load(); | |||
| FormTransaksiTunaiController fttc = loader.getController(); | |||
| fttc.initData(noNota); | |||
| if (!baru) { | |||
| fttc.initData(noNota); | |||
| } | |||
| break; | |||
| case FormConstanta.TRANSAKSI_RETUR: | |||
| loader.setLocation(getClass().getResource("/fxml/FormTransaksiRetur.fxml")); | |||
| node = loader.load(); | |||
| FormTransaksiReturController ftrc = loader.getController(); | |||
| // ftrc.initData(noNota); | |||
| if (!baru) { | |||
| // ftrc.initData(noNota); | |||
| } | |||
| break; | |||
| } | |||
| } catch (IOException ex) { | |||
| Logger.getLogger(FormUtamaController.class.getName()).log(Level.SEVERE, null, ex); | |||
| @@ -275,7 +280,7 @@ public class FormUtamaController implements Initializable { | |||
| KeyCombination kcCheckout = new KeyCodeCombination(KeyCode.F8); | |||
| Runnable rnCheckout = () -> { | |||
| switch (tipeNotaState) { | |||
| switch (tipeTransaksiState) { | |||
| case FormConstanta.TRANSAKSI_TUNAI: | |||
| setContent(formFactory.getForm(FormConstanta.BAYAR, this)); | |||
| break; | |||
| @@ -335,6 +340,10 @@ public class FormUtamaController implements Initializable { | |||
| if (hasilReturn.isPresent()) { | |||
| if (hasilReturn.get().equals("Baru:Tunai")) { | |||
| if (tipeTransaksiState.equals(FormConstanta.TRANSAKSI_TUNAI)) { | |||
| setContent(null); | |||
| } | |||
| if (notaContent.btnTunai != null) { | |||
| navigasi.remove(notaContent.btnTunai); | |||
| vbNavigasi.getChildren().remove(notaContent.btnTunai); | |||
| @@ -342,12 +351,17 @@ public class FormUtamaController implements Initializable { | |||
| Button buttonBaru = generateButtonNota(Fucout.getNoNotaTemporary(), | |||
| FormConstanta.TRANSAKSI_TUNAI, | |||
| Fucout.TEKS_TIPE_NOTA_TUNAI); | |||
| Fucout.TEKS_TIPE_NOTA_TUNAI, | |||
| true); | |||
| navigasi.add(buttonBaru); | |||
| vbNavigasi.getChildren().add(buttonBaru); | |||
| notaContent.btnTunai = buttonBaru; | |||
| jumlahNota++; | |||
| } else if (hasilReturn.get().equals("Baru:Bon")) { | |||
| if (tipeTransaksiState.equals(FormConstanta.TRANSAKSI_BON)) { | |||
| setContent(null); | |||
| } | |||
| if (notaContent.btnBon != null) { | |||
| navigasi.remove(notaContent.btnBon); | |||
| vbNavigasi.getChildren().remove(notaContent.btnBon); | |||
| @@ -355,12 +369,17 @@ public class FormUtamaController implements Initializable { | |||
| Button buttonBaru = generateButtonNota("B-" + Fucout.getNoNotaTemporary(), | |||
| FormConstanta.TRANSAKSI_BON, | |||
| Fucout.TEKS_TIPE_NOTA_BON); | |||
| Fucout.TEKS_TIPE_NOTA_BON, | |||
| true); | |||
| navigasi.add(buttonBaru); | |||
| vbNavigasi.getChildren().add(buttonBaru); | |||
| notaContent.btnBon = buttonBaru; | |||
| jumlahNota++; | |||
| } else if (hasilReturn.get().equals("Baru:Bawa Dulu")) { | |||
| if (tipeTransaksiState.equals(FormConstanta.TRANSAKSI_BAWA)) { | |||
| setContent(null); | |||
| } | |||
| if (notaContent.btnBawa != null) { | |||
| navigasi.remove(notaContent.btnBawa); | |||
| vbNavigasi.getChildren().remove(notaContent.btnBawa); | |||
| @@ -368,12 +387,17 @@ public class FormUtamaController implements Initializable { | |||
| Button buttonBaru = generateButtonNota("W-" + Fucout.getNoNotaTemporary(), | |||
| FormConstanta.TRANSAKSI_BAWA, | |||
| Fucout.TEKS_TIPE_NOTA_BAWA); | |||
| Fucout.TEKS_TIPE_NOTA_BAWA, | |||
| true); | |||
| navigasi.add(buttonBaru); | |||
| vbNavigasi.getChildren().add(buttonBaru); | |||
| notaContent.btnBawa = buttonBaru; | |||
| jumlahNota++; | |||
| } else if (hasilReturn.get().equals("Baru:Retur")) { | |||
| if (tipeTransaksiState.equals(FormConstanta.TRANSAKSI_RETUR)) { | |||
| setContent(null); | |||
| } | |||
| if (notaContent.btnRetur != null) { | |||
| navigasi.remove(notaContent.btnRetur); | |||
| vbNavigasi.getChildren().remove(notaContent.btnRetur); | |||
| @@ -381,7 +405,8 @@ public class FormUtamaController implements Initializable { | |||
| Button buttonBaru = generateButtonNota("R-" + Fucout.getNoNotaTemporary(), | |||
| FormConstanta.TRANSAKSI_RETUR, | |||
| Fucout.TEKS_TIPE_NOTA_RETUR); | |||
| Fucout.TEKS_TIPE_NOTA_RETUR, | |||
| true); | |||
| navigasi.add(buttonBaru); | |||
| vbNavigasi.getChildren().add(buttonBaru); | |||
| notaContent.btnRetur = buttonBaru; | |||
| @@ -391,10 +416,19 @@ public class FormUtamaController implements Initializable { | |||
| Button buttonBaru = null; | |||
| switch (noNota.charAt(0)) { | |||
| case Fucout.KODE_NOTA_BON: | |||
| if (tipeTransaksiState.equals(FormConstanta.TRANSAKSI_BON)) { | |||
| setContent(null); | |||
| } | |||
| break; | |||
| case Fucout.KODE_NOTA_BAWA: | |||
| if (tipeTransaksiState.equals(FormConstanta.TRANSAKSI_BAWA)) { | |||
| setContent(null); | |||
| } | |||
| break; | |||
| case Fucout.KODE_NOTA_RETUR: | |||
| if (tipeTransaksiState.equals(FormConstanta.TRANSAKSI_RETUR)) { | |||
| setContent(null); | |||
| } | |||
| if (notaContent.btnRetur != null) { | |||
| navigasi.remove(notaContent.btnRetur); | |||
| vbNavigasi.getChildren().remove(notaContent.btnRetur); | |||
| @@ -402,18 +436,23 @@ public class FormUtamaController implements Initializable { | |||
| buttonBaru = generateButtonNota(noNota, | |||
| FormConstanta.TRANSAKSI_RETUR, | |||
| Fucout.TEKS_TIPE_NOTA_RETUR); | |||
| Fucout.TEKS_TIPE_NOTA_RETUR, | |||
| false); | |||
| notaContent.btnRetur = buttonBaru; | |||
| break; | |||
| default: | |||
| if (tipeTransaksiState.equals(FormConstanta.TRANSAKSI_TUNAI)) { | |||
| setContent(null); | |||
| } | |||
| if (notaContent.btnTunai != null) { | |||
| navigasi.remove(notaContent.btnTunai); | |||
| vbNavigasi.getChildren().remove(notaContent.btnTunai); | |||
| } | |||
| buttonBaru = generateButtonNota(noNota, | |||
| FormConstanta.TRANSAKSI_TUNAI, | |||
| Fucout.TEKS_TIPE_NOTA_TUNAI); | |||
| Fucout.TEKS_TIPE_NOTA_TUNAI, | |||
| false); | |||
| notaContent.btnTunai = buttonBaru; | |||
| break; | |||
| } | |||
| @@ -156,7 +156,9 @@ public class FormBayarController implements Initializable, BayarInterface { | |||
| if (bayarContent.getNodeRetur() == null && chkSource.selectedProperty().get()) { | |||
| loader.setLocation(getClass().getResource("/fxml/FormBayarRetur.fxml")); | |||
| node = loader.load(); | |||
| FormBayarReturController fbrc = loader.getController(); | |||
| fbrc.initData(this); | |||
| vbContent.getChildren().add(node); | |||
| bayarContent.setNodeRetur(node); | |||
| } else { | |||
| @@ -32,6 +32,7 @@ public class FormBayarKartuController implements Initializable { | |||
| private TextField fldNoKartu4; | |||
| private BayarInterface parent; | |||
| /** | |||
| * Initializes the controller class. | |||
| */ | |||
| @@ -42,9 +43,11 @@ public class FormBayarKartuController implements Initializable { | |||
| public void initData(BayarInterface parent) { | |||
| this.parent = parent; | |||
| parent.getBayarContent().setBayarKartu(50000); | |||
| parent.updateKurangBayarView(); | |||
| if (parent != null && parent.getBayarContent() != null | |||
| && parent.getBayarContent().getNodeKartu() != null) { | |||
| parent.getBayarContent().setBayarKartu(50000); | |||
| parent.updateKurangBayarView(); | |||
| } | |||
| } | |||
| private void initComponents() { | |||
| @@ -28,19 +28,18 @@ public class FormBayarPoinController implements Initializable { | |||
| private Label lblPoin; | |||
| private BayarInterface parent; | |||
| int poin = 0; | |||
| /** | |||
| * Initializes the controller class. | |||
| */ | |||
| @Override | |||
| public void initialize(URL url, ResourceBundle rb) { | |||
| int poin = 0; | |||
| if (SystemValue.member != null) { | |||
| lblPoin.setText(Fucout.getTextColon( | |||
| String.valueOf(SystemValue.member.getPoin()))); | |||
| lblPoin.setText(Fucout.getTextColon(Fucout.formatRibuan(SystemValue.member.getPoin()))); | |||
| poin = SystemValue.member.getPoin(); | |||
| } | |||
| Fucout.forceFieldInteger(fldPoin, poin); | |||
| Fucout.forceFieldInteger(fldPoin); | |||
| } | |||
| public void initData(BayarInterface parent) { | |||
| @@ -49,15 +48,35 @@ public class FormBayarPoinController implements Initializable { | |||
| @FXML | |||
| void fldPoinOnKeyReleased(KeyEvent event) { | |||
| int poin = 0; | |||
| int bayarPoin = 0; | |||
| if (!fldPoin.getText().equals("")) { | |||
| try { | |||
| poin = Integer.parseInt(fldPoin.getText()); | |||
| bayarPoin = Integer.parseInt(fldPoin.getText()); | |||
| } catch (NumberFormatException nfe) { | |||
| fldPoin.setText(""); | |||
| } | |||
| } | |||
| if (parent != null && parent.getBayarContent().getNodePoin() != null) { | |||
| parent.getBayarContent().setBayarPoin(poin * Fucout.KONVERSI_POIN); | |||
| if (parent != null && parent.getBayarContent() != null | |||
| && parent.getBayarContent().getNodePoin() != null) { | |||
| if (bayarPoin > poin) { | |||
| fldPoin.setText(String.valueOf(poin)); | |||
| fldPoin.positionCaret(fldPoin.getText().length()); | |||
| bayarPoin = poin; | |||
| } else if (bayarPoin <= 0) { | |||
| fldPoin.setText(""); | |||
| bayarPoin = 0; | |||
| } | |||
| if (bayarPoin > 0) { | |||
| lblPoin.setText(Fucout.getTextColon(Fucout.formatRibuan(poin) | |||
| + " (" | |||
| + Fucout.formatRibuan(bayarPoin) + " = " | |||
| + Fucout.formatRibuan(bayarPoin * Fucout.KONVERSI_POIN) | |||
| + ")")); | |||
| } else { | |||
| lblPoin.setText(Fucout.getTextColon(Fucout.formatRibuan(poin))); | |||
| } | |||
| parent.getBayarContent().setBayarPoin(bayarPoin * Fucout.KONVERSI_POIN); | |||
| parent.updateKurangBayarView(); | |||
| } | |||
| @@ -5,9 +5,29 @@ | |||
| */ | |||
| package id.amigogroup.posterminal.bayar; | |||
| import id.amigogroup.posterminal.FormUtamaController; | |||
| import id.amigogroup.posterminal.api.AmigoPosRx; | |||
| import id.amigogroup.posterminal.model.MNotaRetur; | |||
| import id.amigogroup.posterminal.util.AlertUtil; | |||
| 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.ResourceBundle; | |||
| import java.util.logging.Level; | |||
| import java.util.logging.Logger; | |||
| import javafx.application.Platform; | |||
| import javafx.fxml.FXML; | |||
| import javafx.fxml.Initializable; | |||
| import javafx.scene.control.Alert; | |||
| import javafx.scene.control.Label; | |||
| import javafx.scene.control.TextField; | |||
| import javafx.scene.input.KeyCode; | |||
| import javafx.scene.input.KeyEvent; | |||
| import javafx.scene.layout.AnchorPane; | |||
| import retrofit2.HttpException; | |||
| /** | |||
| * FXML Controller class | |||
| @@ -16,12 +36,88 @@ import javafx.fxml.Initializable; | |||
| */ | |||
| public class FormBayarReturController implements Initializable { | |||
| @FXML | |||
| private AnchorPane apMain; | |||
| @FXML | |||
| private TextField fldNoUrutRetur; | |||
| @FXML | |||
| private Label lblNominalRetur; | |||
| private BayarInterface parent; | |||
| private final AmigoPosRx posRx = new AmigoPosRx(); | |||
| /** | |||
| * Initializes the controller class. | |||
| */ | |||
| @Override | |||
| public void initialize(URL url, ResourceBundle rb) { | |||
| // TODO | |||
| } | |||
| } | |||
| public void initData(BayarInterface parent) { | |||
| this.parent = parent; | |||
| } | |||
| @FXML | |||
| void fldNoUrutReturOnKeyPressed(KeyEvent event) { | |||
| if (event.getCode() == KeyCode.ENTER) { | |||
| posRx.getMNotaReturByNoNota(fldNoUrutRetur.getText()).subscribe(getMNotaReturObserver); | |||
| } | |||
| } | |||
| Observer<MNotaRetur> getMNotaReturObserver = new Observer<>() { | |||
| @Override | |||
| public void onSubscribe(Disposable dspsbl) { | |||
| } | |||
| @Override | |||
| public void onNext(MNotaRetur mNotaRetur) { | |||
| if (parent != null && parent.getBayarContent() != null | |||
| && parent.getBayarContent().getNodeTunai() != null) { | |||
| lblNominalRetur.setText(Fucout.formatRupiah(mNotaRetur.getTotalDiskon())); | |||
| parent.getBayarContent().setBayarRetur(mNotaRetur.getTotalDiskon()); | |||
| parent.updateKurangBayarView(); | |||
| } | |||
| } | |||
| @Override | |||
| public void onError(Throwable error) { | |||
| if (error instanceof HttpException) { | |||
| switch (((HttpException) error).code()) { | |||
| case HttpURLConnection.HTTP_NOT_FOUND: | |||
| Platform.runLater(() -> { | |||
| Alert alert = AlertUtil.getAlertError( | |||
| AlertUtil.ERROR_TIDAK_DITEMUKAN_TITLE, | |||
| "Data nota tidak ditemukan."); | |||
| alert.initOwner(apMain.getScene().getWindow()); | |||
| alert.show(); | |||
| }); | |||
| } | |||
| } else if (error instanceof SocketTimeoutException) { | |||
| Platform.runLater(() -> { | |||
| Alert alert = AlertUtil.getAlertError( | |||
| AlertUtil.ERROR_KONEKSI_TIMEOUT_TITLE, | |||
| AlertUtil.ERROR_KONEKSI_TIMEOUT_MESSAGE); | |||
| alert.initOwner(apMain.getScene().getWindow()); | |||
| alert.show(); | |||
| }); | |||
| } else { | |||
| Platform.runLater(() -> { | |||
| Alert alert = AlertUtil.getAlertError( | |||
| AlertUtil.ERROR_TIDAK_TERDUGA_TITLE, | |||
| AlertUtil.ERROR_TIDAK_TERDUGA_MESSAGE); | |||
| alert.initOwner(apMain.getScene().getWindow()); | |||
| alert.show(); | |||
| Logger.getLogger(FormUtamaController.class | |||
| .getName()).log(Level.SEVERE, null, error); | |||
| }); | |||
| } | |||
| } | |||
| @Override | |||
| public void onComplete() { | |||
| } | |||
| }; | |||
| } | |||
| @@ -47,16 +47,18 @@ public class FormBayarTunaiController implements Initializable { | |||
| try { | |||
| bayar = Integer.parseInt(fldBayar.getText()); | |||
| } catch (NumberFormatException nfe) { | |||
| fldBayar.setText(""); | |||
| } | |||
| } | |||
| if (parent != null && parent.getBayarContent().getNodeTunai() != null) { | |||
| if (parent != null && parent.getBayarContent() != null | |||
| && parent.getBayarContent().getNodeTunai() != null) { | |||
| parent.getBayarContent().setBayarTunai(bayar); | |||
| parent.updateKurangBayarView(); | |||
| if (parent.getBayarContent().getTotalPerluBayar() < | |||
| parent.getBayarContent().getTotalBayar()) { | |||
| int kembali = parent.getBayarContent().getTotalBayar() | |||
| if (parent.getBayarContent().getTotalPerluBayar() | |||
| < parent.getBayarContent().getTotalBayar()) { | |||
| int kembali = parent.getBayarContent().getTotalBayar() | |||
| - parent.getBayarContent().getTotalPerluBayar(); | |||
| lblKembalian.setText(Fucout.formatRibuan(kembali)); | |||
| } else { | |||
| @@ -0,0 +1,195 @@ | |||
| package id.amigogroup.posterminal.model; | |||
| import com.fasterxml.jackson.annotation.JsonInclude; | |||
| import com.fasterxml.jackson.annotation.JsonProperty; | |||
| import com.fasterxml.jackson.annotation.JsonPropertyOrder; | |||
| import org.apache.commons.lang.builder.EqualsBuilder; | |||
| import org.apache.commons.lang.builder.HashCodeBuilder; | |||
| import org.apache.commons.lang.builder.ToStringBuilder; | |||
| @JsonInclude(JsonInclude.Include.NON_NULL) | |||
| @JsonPropertyOrder({ | |||
| "id", | |||
| "no_nota", | |||
| "kd_barang", | |||
| "no_barang", | |||
| "jumlah", | |||
| "diskon", | |||
| "diskon2", | |||
| "harga_jual", | |||
| "harga_pokok", | |||
| "kode_pram", | |||
| "no_nota_tunai", | |||
| "bonus" | |||
| }) | |||
| public class DNotaRetur { | |||
| @JsonProperty("id") | |||
| private int id; | |||
| @JsonProperty("no_nota") | |||
| private String noNota; | |||
| @JsonProperty("kd_barang") | |||
| private String kdBarang; | |||
| @JsonProperty("no_barang") | |||
| private String noBarang; | |||
| @JsonProperty("jumlah") | |||
| private int jumlah; | |||
| @JsonProperty("diskon") | |||
| private int diskon; | |||
| @JsonProperty("diskon2") | |||
| private int diskon2; | |||
| @JsonProperty("harga_jual") | |||
| private int hargaJual; | |||
| @JsonProperty("harga_pokok") | |||
| private String hargaPokok; | |||
| @JsonProperty("kode_pram") | |||
| private String kodePram; | |||
| @JsonProperty("no_nota_tunai") | |||
| private String noNotaTunai; | |||
| @JsonProperty("bonus") | |||
| private double bonus; | |||
| @JsonProperty("id") | |||
| public int getId() { | |||
| return id; | |||
| } | |||
| @JsonProperty("id") | |||
| public void setId(int id) { | |||
| this.id = id; | |||
| } | |||
| @JsonProperty("no_nota") | |||
| public String getNoNota() { | |||
| return noNota; | |||
| } | |||
| @JsonProperty("no_nota") | |||
| public void setNoNota(String noNota) { | |||
| this.noNota = noNota; | |||
| } | |||
| @JsonProperty("kd_barang") | |||
| public String getKdBarang() { | |||
| return kdBarang; | |||
| } | |||
| @JsonProperty("kd_barang") | |||
| public void setKdBarang(String kdBarang) { | |||
| this.kdBarang = kdBarang; | |||
| } | |||
| @JsonProperty("no_barang") | |||
| public String getNoBarang() { | |||
| return noBarang; | |||
| } | |||
| @JsonProperty("no_barang") | |||
| public void setNoBarang(String noBarang) { | |||
| this.noBarang = noBarang; | |||
| } | |||
| @JsonProperty("jumlah") | |||
| public int getJumlah() { | |||
| return jumlah; | |||
| } | |||
| @JsonProperty("jumlah") | |||
| public void setJumlah(int jumlah) { | |||
| this.jumlah = jumlah; | |||
| } | |||
| @JsonProperty("diskon") | |||
| public int getDiskon() { | |||
| return diskon; | |||
| } | |||
| @JsonProperty("diskon") | |||
| public void setDiskon(int diskon) { | |||
| this.diskon = diskon; | |||
| } | |||
| @JsonProperty("diskon2") | |||
| public int getDiskon2() { | |||
| return diskon2; | |||
| } | |||
| @JsonProperty("diskon2") | |||
| public void setDiskon2(int diskon2) { | |||
| this.diskon2 = diskon2; | |||
| } | |||
| @JsonProperty("harga_jual") | |||
| public int getHargaJual() { | |||
| return hargaJual; | |||
| } | |||
| @JsonProperty("harga_jual") | |||
| public void setHargaJual(int hargaJual) { | |||
| this.hargaJual = hargaJual; | |||
| } | |||
| @JsonProperty("harga_pokok") | |||
| public String getHargaPokok() { | |||
| return hargaPokok; | |||
| } | |||
| @JsonProperty("harga_pokok") | |||
| public void setHargaPokok(String hargaPokok) { | |||
| this.hargaPokok = hargaPokok; | |||
| } | |||
| @JsonProperty("kode_pram") | |||
| public String getKodePram() { | |||
| return kodePram; | |||
| } | |||
| @JsonProperty("kode_pram") | |||
| public void setKodePram(String kodePram) { | |||
| this.kodePram = kodePram; | |||
| } | |||
| @JsonProperty("no_nota_tunai") | |||
| public String getNoNotaTunai() { | |||
| return noNotaTunai; | |||
| } | |||
| @JsonProperty("no_nota_tunai") | |||
| public void setNoNotaTunai(String noNotaTunai) { | |||
| this.noNotaTunai = noNotaTunai; | |||
| } | |||
| @JsonProperty("bonus") | |||
| public double getBonus() { | |||
| return bonus; | |||
| } | |||
| @JsonProperty("bonus") | |||
| public void setBonus(double bonus) { | |||
| this.bonus = bonus; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return new ToStringBuilder(this).append("id", id).append("noNota", noNota).append("kdBarang", kdBarang).append("noBarang", noBarang).append("jumlah", jumlah).append("diskon", diskon).append("diskon2", diskon2).append("hargaJual", hargaJual).append("hargaPokok", hargaPokok).append("kodePram", kodePram).append("noNotaTunai", noNotaTunai).append("bonus", bonus).toString(); | |||
| } | |||
| @Override | |||
| public int hashCode() { | |||
| return new HashCodeBuilder().append(bonus).append(noBarang).append(hargaJual).append(noNotaTunai).append(jumlah).append(diskon2).append(kdBarang).append(hargaPokok).append(kodePram).append(noNota).append(id).append(diskon).toHashCode(); | |||
| } | |||
| @Override | |||
| public boolean equals(Object other) { | |||
| if (other == this) { | |||
| return true; | |||
| } | |||
| if ((other instanceof DNotaRetur) == false) { | |||
| return false; | |||
| } | |||
| DNotaRetur rhs = ((DNotaRetur) other); | |||
| return new EqualsBuilder().append(bonus, rhs.bonus).append(noBarang, rhs.noBarang).append(hargaJual, rhs.hargaJual).append(noNotaTunai, rhs.noNotaTunai).append(jumlah, rhs.jumlah).append(diskon2, rhs.diskon2).append(kdBarang, rhs.kdBarang).append(hargaPokok, rhs.hargaPokok).append(kodePram, rhs.kodePram).append(noNota, rhs.noNota).append(id, rhs.id).append(diskon, rhs.diskon).isEquals(); | |||
| } | |||
| } | |||
| @@ -36,7 +36,7 @@ public class MNotaRetur { | |||
| @JsonProperty("keterangan") | |||
| private String keterangan; | |||
| @JsonProperty("status_nota") | |||
| private String statusNota; | |||
| private char statusNota; | |||
| @JsonProperty("no_nota") | |||
| public String getNoNota() { | |||
| @@ -109,12 +109,12 @@ public class MNotaRetur { | |||
| } | |||
| @JsonProperty("status_nota") | |||
| public String getStatusNota() { | |||
| public char getStatusNota() { | |||
| return statusNota; | |||
| } | |||
| @JsonProperty("status_nota") | |||
| public void setStatusNota(String statusNota) { | |||
| public void setStatusNota(char statusNota) { | |||
| this.statusNota = statusNota; | |||
| } | |||
| @@ -18,9 +18,7 @@ import java.net.HttpURLConnection; | |||
| import java.net.SocketTimeoutException; | |||
| import java.net.URL; | |||
| import java.util.ArrayList; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.ResourceBundle; | |||
| import java.util.logging.Level; | |||
| import java.util.logging.Logger; | |||
| @@ -28,7 +26,6 @@ import javafx.application.Platform; | |||
| import javafx.beans.property.ReadOnlyObjectWrapper; | |||
| import javafx.collections.FXCollections; | |||
| import javafx.collections.ObservableList; | |||
| import javafx.concurrent.Task; | |||
| import javafx.fxml.FXML; | |||
| import javafx.fxml.Initializable; | |||
| import javafx.scene.control.Alert; | |||
| @@ -17,15 +17,14 @@ import io.reactivex.disposables.Disposable; | |||
| import java.net.HttpURLConnection; | |||
| import java.net.SocketTimeoutException; | |||
| import java.net.URL; | |||
| import java.util.ArrayList; | |||
| 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; | |||
| import javafx.collections.ObservableList; | |||
| import javafx.event.ActionEvent; | |||
| import javafx.fxml.FXML; | |||
| import javafx.fxml.Initializable; | |||
| import javafx.scene.control.Alert; | |||
| @@ -119,7 +118,7 @@ public class FormTransaksiTunaiController implements Initializable { | |||
| for (DNotaTunai dNotaTunai : daftarNotaTunai) { | |||
| ComboBox<String> cbxPromo = new ComboBox<>(FXCollections.observableArrayList(promo)); | |||
| cbxPromo.getSelectionModel().select("Ulang Tahun"); | |||
| TextField fldPramuniaga = new TextField(dNotaTunai.getKodePram()); | |||
| fldPramuniaga.setOnKeyPressed((t) -> { | |||
| if (t.getCode() == KeyCode.ENTER) { | |||
| @@ -166,7 +165,6 @@ public class FormTransaksiTunaiController implements Initializable { | |||
| // daftarTabelTransaksi.add(new TabelBarangTunai("AACOBA001ABCDXL", "Barang x", "XL", "1", "79.900", "0", "0", cbxAction, | |||
| // "79.900", txtScan)); | |||
| // } | |||
| @FXML | |||
| void fldScanOnKeyPressed(KeyEvent event) { | |||
| if (event.getCode() == KeyCode.ENTER) { | |||
| @@ -190,26 +188,32 @@ public class FormTransaksiTunaiController implements Initializable { | |||
| if (error instanceof HttpException) { | |||
| switch (((HttpException) error).code()) { | |||
| case HttpURLConnection.HTTP_NOT_FOUND: | |||
| Alert alert = AlertUtil.getAlertError( | |||
| AlertUtil.ERROR_TIDAK_DITEMUKAN_TITLE, | |||
| "Data nota tidak ditemukan."); | |||
| alert.initOwner(apMain.getScene().getWindow()); | |||
| alert.show(); | |||
| Platform.runLater(() -> { | |||
| Alert alert = AlertUtil.getAlertError( | |||
| AlertUtil.ERROR_TIDAK_DITEMUKAN_TITLE, | |||
| "Data nota tidak ditemukan."); | |||
| alert.initOwner(apMain.getScene().getWindow()); | |||
| alert.show(); | |||
| }); | |||
| } | |||
| } else if (error instanceof SocketTimeoutException) { | |||
| Alert alert = AlertUtil.getAlertError( | |||
| AlertUtil.ERROR_KONEKSI_TIMEOUT_TITLE, | |||
| AlertUtil.ERROR_KONEKSI_TIMEOUT_MESSAGE); | |||
| alert.initOwner(apMain.getScene().getWindow()); | |||
| alert.show(); | |||
| Platform.runLater(() -> { | |||
| Alert alert = AlertUtil.getAlertError( | |||
| AlertUtil.ERROR_KONEKSI_TIMEOUT_TITLE, | |||
| AlertUtil.ERROR_KONEKSI_TIMEOUT_MESSAGE); | |||
| alert.initOwner(apMain.getScene().getWindow()); | |||
| alert.show(); | |||
| }); | |||
| } else { | |||
| Alert alert = AlertUtil.getAlertError( | |||
| AlertUtil.ERROR_TIDAK_TERDUGA_TITLE, | |||
| AlertUtil.ERROR_TIDAK_TERDUGA_MESSAGE); | |||
| alert.initOwner(apMain.getScene().getWindow()); | |||
| alert.show(); | |||
| Logger.getLogger(FormUtamaController.class | |||
| .getName()).log(Level.SEVERE, null, error); | |||
| Platform.runLater(() -> { | |||
| Alert alert = AlertUtil.getAlertError( | |||
| AlertUtil.ERROR_TIDAK_TERDUGA_TITLE, | |||
| AlertUtil.ERROR_TIDAK_TERDUGA_MESSAGE); | |||
| alert.initOwner(apMain.getScene().getWindow()); | |||
| alert.show(); | |||
| Logger.getLogger(FormUtamaController.class | |||
| .getName()).log(Level.SEVERE, null, error); | |||
| }); | |||
| } | |||
| } | |||
| @@ -36,7 +36,7 @@ public class Fucout { | |||
| public static final char KODE_NOTA_BON = 'B'; | |||
| public static final char KODE_NOTA_BAWA = 'W'; | |||
| public static final char KODE_NOTA_RETUR = 'R'; | |||
| public static final int KONVERSI_POIN = 100000; | |||
| public static final int KONVERSI_POIN = 500; | |||
| //IMAGES URL | |||
| public static final String APP_ICON = "/assets/logo-mini-squared.png"; | |||
| @@ -75,7 +75,7 @@ public class Fucout { | |||
| scrollPane.setVvalue(scrollPane.getVmax() * ((y - 0.5 * v) / (h - v))); | |||
| } | |||
| public static final void forceFieldToInteger(TextField field) { | |||
| public static final void forceFieldInteger(TextField field) { | |||
| forceFieldInteger(field, 0); | |||
| } | |||
| @@ -21,9 +21,9 @@ | |||
| <GridPane layoutX="14.0" layoutY="39.0" AnchorPane.bottomAnchor="5.0" AnchorPane.leftAnchor="14.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="39.0"> | |||
| <columnConstraints> | |||
| <ColumnConstraints hgrow="SOMETIMES" maxWidth="75.0" minWidth="10.0" prefWidth="75.0" /> | |||
| <ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="10.0" prefWidth="150.0" /> | |||
| <ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="10.0" prefWidth="30.0" /> | |||
| <ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="10.0" prefWidth="40.0" /> | |||
| <ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="10.0" prefWidth="30.0" /> | |||
| <ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="10.0" /> | |||
| </columnConstraints> | |||
| <rowConstraints> | |||
| <RowConstraints minHeight="10.0" vgrow="SOMETIMES" /> | |||
| @@ -63,5 +63,6 @@ | |||
| </children> | |||
| </GridPane> | |||
| <Separator layoutX="65.0" layoutY="13.0" prefWidth="200.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="5.0" /> | |||
| <Label layoutX="558.0" layoutY="18.0" text="(1 Poin = Rp500)" textAlignment="RIGHT" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="18.0" /> | |||
| </children> | |||
| </AnchorPane> | |||
| @@ -7,11 +7,11 @@ | |||
| <?import javafx.scene.layout.AnchorPane?> | |||
| <?import javafx.scene.layout.ColumnConstraints?> | |||
| <?import javafx.scene.layout.GridPane?> | |||
| <?import javafx.scene.layout.HBox?> | |||
| <?import javafx.scene.layout.RowConstraints?> | |||
| <?import javafx.scene.text.Font?> | |||
| <AnchorPane id="AnchorPane" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/11.0.1" fx:controller="id.amigogroup.posterminal.bayar.FormBayarReturController"> | |||
| <AnchorPane id="AnchorPane" fx:id="apMain" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="id.amigogroup.posterminal.bayar.FormBayarReturController"> | |||
| <children> | |||
| <Label layoutX="14.0" layoutY="14.0" text="Voucher Retur" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="14.0"> | |||
| <font> | |||
| @@ -27,7 +27,6 @@ | |||
| </columnConstraints> | |||
| <rowConstraints> | |||
| <RowConstraints minHeight="10.0" vgrow="SOMETIMES" /> | |||
| <RowConstraints minHeight="10.0" vgrow="SOMETIMES" /> | |||
| </rowConstraints> | |||
| <children> | |||
| <Label text="Nomor Urut Retur"> | |||
| @@ -35,26 +34,24 @@ | |||
| <Insets bottom="2.5" /> | |||
| </GridPane.margin> | |||
| </Label> | |||
| <TextField alignment="CENTER_RIGHT" GridPane.columnIndex="1"> | |||
| <TextField fx:id="fldNoUrutRetur" alignment="CENTER_RIGHT" onKeyPressed="#fldNoUrutReturOnKeyPressed" GridPane.columnIndex="1"> | |||
| <GridPane.margin> | |||
| <Insets bottom="2.5" left="5.0" right="2.5" /> | |||
| </GridPane.margin> | |||
| </TextField> | |||
| <Label text="Total Sisa" GridPane.rowIndex="1"> | |||
| <GridPane.margin> | |||
| <Insets top="2.5" /> | |||
| </GridPane.margin> | |||
| </Label> | |||
| <TextField alignment="CENTER_RIGHT" GridPane.columnIndex="1" GridPane.rowIndex="1"> | |||
| <HBox alignment="CENTER_LEFT" maxWidth="1.7976931348623157E308" GridPane.columnIndex="2"> | |||
| <GridPane.margin> | |||
| <Insets left="5.0" right="2.5" top="2.5" /> | |||
| <Insets bottom="2.5" left="5.0" /> | |||
| </GridPane.margin> | |||
| </TextField> | |||
| <TextField alignment="CENTER_RIGHT" GridPane.columnIndex="2"> | |||
| <GridPane.margin> | |||
| <Insets bottom="2.5" left="2.5" /> | |||
| </GridPane.margin> | |||
| </TextField> | |||
| <children> | |||
| <Label text="Nominal Retur" /> | |||
| <Label fx:id="lblNominalRetur" text=": -"> | |||
| <HBox.margin> | |||
| <Insets left="2.5" /> | |||
| </HBox.margin> | |||
| </Label> | |||
| </children> | |||
| </HBox> | |||
| </children> | |||
| </GridPane> | |||
| <Separator layoutX="6.0" layoutY="13.0" prefWidth="200.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="5.0" /> | |||