* [Logic] Membuat Shortcut CTRL + T di nota tunai * [Model] Mengupdate model MNotatunai, ignore unknown, dan perbaiki tipe data * [Logic] Fungsi menunda nota, dan menampilkan alert saat selesaipull/11/head
| @@ -163,25 +163,19 @@ public class FormUtamaController implements Initializable { | |||
| Node node = null; | |||
| FXMLLoader loader = new FXMLLoader(); | |||
| try { | |||
| Map<KeyCombination, Runnable> listShortcuts = new HashMap<>(); | |||
| KeyCombination kcCetakNota = new KeyCodeCombination(KeyCode.F10); | |||
| Runnable rnCetakNota = () -> { | |||
| openCetakNota(); | |||
| }; | |||
| listShortcuts.put(kcCetakNota, rnCetakNota); | |||
| bpMain.getScene().getAccelerators().putAll(listShortcuts); | |||
| resetShortcutToDefault(); | |||
| switch (tipe) { | |||
| case FormConstanta.TRANSAKSI_TUNAI: | |||
| if (notaContent.getNodeTunai() != null) { | |||
| node = notaContent.getNodeTunai(); | |||
| if (notaContent.nodeTunai != null) { | |||
| node = notaContent.nodeTunai; | |||
| } else { | |||
| loader.setLocation(getClass().getResource("/fxml/FormTransaksiTunai.fxml")); | |||
| node = loader.load(); | |||
| notaContent.setNodeTunai(node); | |||
| notaContent.nodeTunai = node; | |||
| FormTransaksiTunaiController fttc = loader.getController(); | |||
| notaContent.setControllerTunai(fttc); | |||
| fttc.initData(noNota, baru); | |||
| fttc.initData(this,noNota, baru); | |||
| } | |||
| break; | |||
| case FormConstanta.TRANSAKSI_RETUR: | |||
| @@ -241,6 +235,24 @@ public class FormUtamaController implements Initializable { | |||
| Optional<String> result = dialogCetakNotaController.showAndWait(); | |||
| } | |||
| private void resetShortcutToDefault() { | |||
| Map<KeyCombination, Runnable> listShortcuts = new HashMap<>(); | |||
| KeyCombination kcCetakNota = new KeyCodeCombination(KeyCode.F10); | |||
| Runnable rnCetakNota = () -> { | |||
| openCetakNota(); | |||
| }; | |||
| listShortcuts.put(kcCetakNota, rnCetakNota); | |||
| KeyCombination kcTundaNota = new KeyCodeCombination(KeyCode.T, KeyCombination.CONTROL_DOWN); | |||
| Runnable rnTundaNota = () -> { | |||
| //do nothing | |||
| }; | |||
| listShortcuts.put(kcTundaNota, rnTundaNota); | |||
| bpMain.getScene().getAccelerators().putAll(listShortcuts); | |||
| } | |||
| private void initShorcuts() { | |||
| Map<KeyCombination, Runnable> listShortcuts = new HashMap<>(); | |||
| @@ -492,8 +504,10 @@ public class FormUtamaController implements Initializable { | |||
| if (tipeTransaksiState.equals(FormConstanta.TRANSAKSI_RETUR)) { | |||
| setContent(null); | |||
| } | |||
| if (notaContent.getBtnRetur() != null) { | |||
| navigasi.remove(notaContent.getBtnRetur()); | |||
| if (notaContent.btnRetur != null) { | |||
| notaContent.nodeRetur = null; | |||
| notaContent.controllerRetur = null; | |||
| navigasi.remove(notaContent.btnRetur); | |||
| vbNavigasi.getChildren().remove(notaContent.getBtnRetur()); | |||
| } | |||
| @@ -508,6 +522,8 @@ public class FormUtamaController implements Initializable { | |||
| setContent(null); | |||
| } | |||
| if (notaContent.getBtnTunai() != null) { | |||
| notaContent.nodeRetur = null; | |||
| notaContent.controllerRetur = null; | |||
| navigasi.remove(notaContent.getBtnTunai()); | |||
| vbNavigasi.getChildren().remove(notaContent.getBtnTunai()); | |||
| } | |||
| @@ -528,6 +544,13 @@ public class FormUtamaController implements Initializable { | |||
| } | |||
| } | |||
| public void removeNota(Button btn){ | |||
| setContent(null); | |||
| navigasi.remove(btn); | |||
| vbNavigasi.getChildren().remove(btn); | |||
| jumlahNota--; | |||
| } | |||
| //scan member | |||
| @FXML | |||
| void scanMemberOnPressed(KeyEvent event) { | |||
| @@ -694,7 +717,6 @@ public class FormUtamaController implements Initializable { | |||
| public void setNodeRetur(Node nodeRetur) { | |||
| this.nodeRetur = nodeRetur; | |||
| } | |||
| } | |||
| } | |||
| @@ -16,4 +16,5 @@ public class SystemValue { | |||
| public static boolean isMember = false; | |||
| public static Pelanggan member = null; | |||
| public static Karyawan karyawanLogin = null; | |||
| public static String idToko = "03"; | |||
| } | |||
| @@ -54,6 +54,11 @@ public class AmigoPosRx { | |||
| return UtilsApi.getServiceApiBarang().getByIdGabunganNomor(idGabungan, nomor) | |||
| .subscribeOn(Schedulers.io()); | |||
| } | |||
| public Observable<MNotaTunai> addMNotaTunai(String idToko, MNotaTunai mNotaTunai){ | |||
| return UtilsApi.getServiceApiBarang().addMNotaTunai(idToko, mNotaTunai) | |||
| .subscribeOn(Schedulers.trampoline()); | |||
| } | |||
| public Observable<MNotaTunai> getMNotaTunaiByNoNota(String noNota) { | |||
| return UtilsApi.getServiceApiBarang().getMNotaTunaiByNoNota(noNota) | |||
| @@ -69,6 +74,11 @@ public class AmigoPosRx { | |||
| return UtilsApi.getServiceApiBarang().getDNotaTunaiByNoNota(noNota) | |||
| .subscribeOn(Schedulers.io()); | |||
| } | |||
| public Observable<Void> addDNotaTunai(DNotaTunai dNotaTunai){ | |||
| return UtilsApi.getServiceApiBarang().addDNotaTunai(dNotaTunai) | |||
| .subscribeOn(Schedulers.io()); | |||
| } | |||
| public Observable<MNotaRetur> getMNotaReturByNoNota(String noNota) { | |||
| return UtilsApi.getServiceApiBarang().getMNotaReturByNoNota(noNota) | |||
| @@ -14,7 +14,10 @@ import id.amigogroup.posterminal.model.Pagination; | |||
| import io.reactivex.Observable; | |||
| import java.util.List; | |||
| import okhttp3.ResponseBody; | |||
| import retrofit2.http.Body; | |||
| import retrofit2.http.GET; | |||
| import retrofit2.http.POST; | |||
| import retrofit2.http.PUT; | |||
| import retrofit2.http.Path; | |||
| /** | |||
| @@ -27,6 +30,10 @@ public interface ServiceApiBarang { | |||
| @GET("barangs/kode/{kode}") | |||
| Observable<Barang> getBarangByKodeBarang(@Path("kode") String kode); | |||
| //Mengambil Barang Berdasarkan Nama Barang | |||
| @GET("barangs/nama/{namaBarang}") | |||
| Observable<Pagination<Barang>> getBarangByNamaBarang(@Path("namaBarang") String namaBarang); | |||
| //NO-BARANG | |||
| //Mengambil No Barang by Id Gabungan & Ukuran | |||
| @GET("no-barangs/id-gabungan/{idGabungan}/kolom-urut/nomor") | |||
| @@ -38,10 +45,13 @@ public interface ServiceApiBarang { | |||
| Observable<NoBarang> getByIdGabunganNomor( | |||
| @Path("idGabungan") String idGabungan, | |||
| @Path("nomor") String nomor); | |||
| //Mengambil Barang Berdasarkan Nama Barang | |||
| @GET("barangs/nama/{namaBarang}") | |||
| Observable<Pagination<Barang>> getBarangByNamaBarang(@Path("namaBarang") String namaBarang); | |||
| //Update Stok Operasional Berdasarkan Id Gabungan dan Nomor | |||
| @PUT("no-barangs/id-gabungan/{idGabungan}/nomor/{nomor}/stok-operasional/{operasi}") | |||
| Observable<Pagination<Barang>> updateStokOperasionalByIdGabunganDanNomor( | |||
| @Path("idGabungan") String idGabungan, | |||
| @Path("nomor") String nomor, | |||
| @Path("operasi") String operasi); | |||
| //M-NOTA-TUNAI | |||
| //Mengambil Master Nota Tunai by No Nota | |||
| @@ -52,11 +62,25 @@ public interface ServiceApiBarang { | |||
| @GET("m-nota-tunai/no-nota/{noNota}/valid") | |||
| Observable<ResponseBody> validasiMNotaTunaiByNoNotaTanggal(@Path("noNota") String noNota); | |||
| //Generate No Nota | |||
| @GET("m-nota-tunai/generate/{idtoko}") | |||
| Observable<String> generateNoNota(@Path("idtoko") String idToko); | |||
| //Add Nota Tunai | |||
| @POST("m-nota-tunai/toko/{idtoko}") | |||
| Observable<MNotaTunai> addMNotaTunai( | |||
| @Path("idtoko") String idToko, | |||
| @Body MNotaTunai mNotaTunai); | |||
| //D-NOTA-TUNAI | |||
| //Mengambil Detail Nota Tunai by No Nota | |||
| @GET("d-nota-tunai/no-nota/{noNota}") | |||
| Observable<List<DNotaTunai>> getDNotaTunaiByNoNota(@Path("noNota") String noNota); | |||
| //Add Nota Tunai | |||
| @POST("d-nota-tunai") | |||
| Observable<Void> addDNotaTunai(@Body DNotaTunai dNotaTunai); | |||
| //M-NOTA-BAWA | |||
| // //Mengambil Master Nota Bawa Dulu by No Nota | |||
| // @GET("m-nota-bawa/no-nota/{noNota}") | |||
| @@ -1,14 +1,18 @@ | |||
| package id.amigogroup.posterminal.model; | |||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |||
| import com.fasterxml.jackson.annotation.JsonInclude; | |||
| import com.fasterxml.jackson.annotation.JsonProperty; | |||
| import com.fasterxml.jackson.annotation.JsonPropertyOrder; | |||
| import java.util.Date; | |||
| 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) | |||
| @JsonIgnoreProperties(ignoreUnknown = true) | |||
| @JsonPropertyOrder({ | |||
| "no_nota", | |||
| "nota_lama", | |||
| @@ -36,9 +40,10 @@ public class MNotaTunai { | |||
| @JsonProperty("no_nota") | |||
| private String noNota; | |||
| @JsonProperty("nota_lama") | |||
| private Object notaLama; | |||
| private String notaLama; | |||
| @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "YYYY-MM-DD hh:mm:ss") | |||
| @JsonProperty("tgl_nota") | |||
| private String tglNota; | |||
| private Date tglNota; | |||
| @JsonProperty("kd_customer") | |||
| private String kdCustomer; | |||
| @JsonProperty("jumlah_total") | |||
| @@ -50,29 +55,30 @@ public class MNotaTunai { | |||
| @JsonProperty("total_diskon") | |||
| private int totalDiskon; | |||
| @JsonProperty("status_bayar") | |||
| private String statusBayar; | |||
| private Character statusBayar; | |||
| @JsonProperty("bank") | |||
| private Object bank; | |||
| private String bank; | |||
| @JsonProperty("edc") | |||
| private Object edc; | |||
| private String edc; | |||
| @JsonProperty("no_kartu") | |||
| private Object noKartu; | |||
| private String noKartu; | |||
| @JsonProperty("no_validasi_bank") | |||
| private Object noValidasiBank; | |||
| private String noValidasiBank; | |||
| @JsonProperty("status_nota") | |||
| private String statusNota; | |||
| private char statusNota; | |||
| @JsonProperty("no_nota_retur") | |||
| private String noNotaRetur; | |||
| @JsonProperty("jumlah_total_retur") | |||
| private int jumlahTotalRetur; | |||
| private Integer jumlahTotalRetur; | |||
| @JsonProperty("jenis_diskon") | |||
| private Object jenisDiskon; | |||
| private Integer jenisDiskon; | |||
| @JsonProperty("jenis_hadiah") | |||
| private Object jenisHadiah; | |||
| private String jenisHadiah; | |||
| @JsonProperty("tgl_ambilhadiah") | |||
| private Object tglAmbilhadiah; | |||
| @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "YYYY-MM-DD hh:mm:ss") | |||
| private Date tglAmbilhadiah; | |||
| @JsonProperty("user_ambilhadiah") | |||
| private Object userAmbilhadiah; | |||
| private String userAmbilhadiah; | |||
| @JsonProperty("no_nota") | |||
| public String getNoNota() { | |||
| @@ -85,22 +91,22 @@ public class MNotaTunai { | |||
| } | |||
| @JsonProperty("nota_lama") | |||
| public Object getNotaLama() { | |||
| public String getNotaLama() { | |||
| return notaLama; | |||
| } | |||
| @JsonProperty("nota_lama") | |||
| public void setNotaLama(Object notaLama) { | |||
| public void setNotaLama(String notaLama) { | |||
| this.notaLama = notaLama; | |||
| } | |||
| @JsonProperty("tgl_nota") | |||
| public String getTglNota() { | |||
| public Date getTglNota() { | |||
| return tglNota; | |||
| } | |||
| @JsonProperty("tgl_nota") | |||
| public void setTglNota(String tglNota) { | |||
| public void setTglNota(Date tglNota) { | |||
| this.tglNota = tglNota; | |||
| } | |||
| @@ -155,62 +161,62 @@ public class MNotaTunai { | |||
| } | |||
| @JsonProperty("status_bayar") | |||
| public String getStatusBayar() { | |||
| public Character getStatusBayar() { | |||
| return statusBayar; | |||
| } | |||
| @JsonProperty("status_bayar") | |||
| public void setStatusBayar(String statusBayar) { | |||
| public void setStatusBayar(Character statusBayar) { | |||
| this.statusBayar = statusBayar; | |||
| } | |||
| @JsonProperty("bank") | |||
| public Object getBank() { | |||
| public String getBank() { | |||
| return bank; | |||
| } | |||
| @JsonProperty("bank") | |||
| public void setBank(Object bank) { | |||
| public void setBank(String bank) { | |||
| this.bank = bank; | |||
| } | |||
| @JsonProperty("edc") | |||
| public Object getEdc() { | |||
| public String getEdc() { | |||
| return edc; | |||
| } | |||
| @JsonProperty("edc") | |||
| public void setEdc(Object edc) { | |||
| public void setEdc(String edc) { | |||
| this.edc = edc; | |||
| } | |||
| @JsonProperty("no_kartu") | |||
| public Object getNoKartu() { | |||
| public String getNoKartu() { | |||
| return noKartu; | |||
| } | |||
| @JsonProperty("no_kartu") | |||
| public void setNoKartu(Object noKartu) { | |||
| public void setNoKartu(String noKartu) { | |||
| this.noKartu = noKartu; | |||
| } | |||
| @JsonProperty("no_validasi_bank") | |||
| public Object getNoValidasiBank() { | |||
| public String getNoValidasiBank() { | |||
| return noValidasiBank; | |||
| } | |||
| @JsonProperty("no_validasi_bank") | |||
| public void setNoValidasiBank(Object noValidasiBank) { | |||
| public void setNoValidasiBank(String noValidasiBank) { | |||
| this.noValidasiBank = noValidasiBank; | |||
| } | |||
| @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; | |||
| } | |||
| @@ -225,52 +231,52 @@ public class MNotaTunai { | |||
| } | |||
| @JsonProperty("jumlah_total_retur") | |||
| public int getJumlahTotalRetur() { | |||
| public Integer getJumlahTotalRetur() { | |||
| return jumlahTotalRetur; | |||
| } | |||
| @JsonProperty("jumlah_total_retur") | |||
| public void setJumlahTotalRetur(int jumlahTotalRetur) { | |||
| public void setJumlahTotalRetur(Integer jumlahTotalRetur) { | |||
| this.jumlahTotalRetur = jumlahTotalRetur; | |||
| } | |||
| @JsonProperty("jenis_diskon") | |||
| public Object getJenisDiskon() { | |||
| public Integer getJenisDiskon() { | |||
| return jenisDiskon; | |||
| } | |||
| @JsonProperty("jenis_diskon") | |||
| public void setJenisDiskon(Object jenisDiskon) { | |||
| public void setJenisDiskon(Integer jenisDiskon) { | |||
| this.jenisDiskon = jenisDiskon; | |||
| } | |||
| @JsonProperty("jenis_hadiah") | |||
| public Object getJenisHadiah() { | |||
| public String getJenisHadiah() { | |||
| return jenisHadiah; | |||
| } | |||
| @JsonProperty("jenis_hadiah") | |||
| public void setJenisHadiah(Object jenisHadiah) { | |||
| public void setJenisHadiah(String jenisHadiah) { | |||
| this.jenisHadiah = jenisHadiah; | |||
| } | |||
| @JsonProperty("tgl_ambilhadiah") | |||
| public Object getTglAmbilhadiah() { | |||
| public Date getTglAmbilhadiah() { | |||
| return tglAmbilhadiah; | |||
| } | |||
| @JsonProperty("tgl_ambilhadiah") | |||
| public void setTglAmbilhadiah(Object tglAmbilhadiah) { | |||
| public void setTglAmbilhadiah(Date tglAmbilhadiah) { | |||
| this.tglAmbilhadiah = tglAmbilhadiah; | |||
| } | |||
| @JsonProperty("user_ambilhadiah") | |||
| public Object getUserAmbilhadiah() { | |||
| public String getUserAmbilhadiah() { | |||
| return userAmbilhadiah; | |||
| } | |||
| @JsonProperty("user_ambilhadiah") | |||
| public void setUserAmbilhadiah(Object userAmbilhadiah) { | |||
| public void setUserAmbilhadiah(String userAmbilhadiah) { | |||
| this.userAmbilhadiah = userAmbilhadiah; | |||
| } | |||
| @@ -5,9 +5,12 @@ | |||
| */ | |||
| package id.amigogroup.posterminal.transaksi; | |||
| import id.amigogroup.posterminal.FormUtamaController; | |||
| import id.amigogroup.posterminal.SystemValue; | |||
| import id.amigogroup.posterminal.api.AmigoPosRx; | |||
| import id.amigogroup.posterminal.model.Barang; | |||
| import id.amigogroup.posterminal.model.DNotaTunai; | |||
| import id.amigogroup.posterminal.model.MNotaTunai; | |||
| import id.amigogroup.posterminal.model.NoBarang; | |||
| import id.amigogroup.posterminal.util.AmigoPosCache; | |||
| import id.amigogroup.posterminal.util.AlertUtil; | |||
| @@ -17,7 +20,10 @@ import io.reactivex.Observer; | |||
| import io.reactivex.disposables.Disposable; | |||
| import java.net.HttpURLConnection; | |||
| 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 javafx.application.Platform; | |||
| import javafx.beans.property.ReadOnlyObjectWrapper; | |||
| @@ -36,6 +42,8 @@ import javafx.scene.control.TableView; | |||
| import javafx.scene.control.TextField; | |||
| import javafx.scene.control.cell.PropertyValueFactory; | |||
| import javafx.scene.input.KeyCode; | |||
| import javafx.scene.input.KeyCodeCombination; | |||
| import javafx.scene.input.KeyCombination; | |||
| import javafx.scene.input.KeyEvent; | |||
| import javafx.scene.layout.AnchorPane; | |||
| import javafx.scene.text.Text; | |||
| @@ -90,6 +98,7 @@ public class FormTransaksiTunaiController implements Initializable { | |||
| private String noNota = ""; | |||
| private AmigoPosRx posRx = new AmigoPosRx(); | |||
| public int total = 0; | |||
| private FormUtamaController parent; | |||
| /** | |||
| * Initializes the controller class. | |||
| @@ -98,6 +107,7 @@ public class FormTransaksiTunaiController implements Initializable { | |||
| public void initialize(URL url, ResourceBundle rb) { | |||
| Platform.runLater(() -> { | |||
| fldScan.requestFocus(); | |||
| initShortcuts(); | |||
| }); | |||
| tcNo.setCellValueFactory((TableColumn.CellDataFeatures<TabelBarangTunai, Integer> cell) -> { | |||
| @@ -119,15 +129,72 @@ public class FormTransaksiTunaiController implements Initializable { | |||
| lblGrandTotal.setText(Fucout.formatRupiah(0)); | |||
| } | |||
| public void initData(String noNota, boolean baru) { | |||
| public void initData(FormUtamaController parent, String noNota, boolean baru) { | |||
| if (!baru) { | |||
| posRx.getDNotaTunaiByNoNota(noNota).subscribe(getDNotaTunaiObserver); | |||
| } | |||
| this.parent = parent; | |||
| this.noNota = noNota; | |||
| lblNoNota.setText(Fucout.getTextColon(noNota)); | |||
| setTanggal(); | |||
| } | |||
| private void initShortcuts() { | |||
| Map<KeyCombination, Runnable> listShortcuts = new HashMap<>(); | |||
| KeyCombination kcTundaNota = new KeyCodeCombination(KeyCode.T, KeyCombination.CONTROL_DOWN); | |||
| Runnable rnTundaNota = () -> { | |||
| //Tunda Nota | |||
| System.out.println("Tunda"); | |||
| List<DNotaTunai> daftarDNotaTunai = new ArrayList<>(); | |||
| if (noNota != null && !noNota.equals("")) { | |||
| for (TabelBarangTunai tbt : daftarTabelTransaksi) { | |||
| tbt.getData().setNoNota(noNota); | |||
| daftarDNotaTunai.add(tbt.getData()); | |||
| } | |||
| MNotaTunai mNotaTunai = new MNotaTunai(); | |||
| if (SystemValue.isMember) { | |||
| mNotaTunai.setKdCustomer(SystemValue.member.getAlias()); | |||
| } else { | |||
| mNotaTunai.setKdCustomer(Fucout.KODE_NON_MEMBER); | |||
| } | |||
| mNotaTunai.setJumlahTotal(hitungTotal(daftarDNotaTunai)); | |||
| mNotaTunai.setKasir(SystemValue.karyawanLogin.getNik()); | |||
| mNotaTunai.setTotalUang(0); | |||
| mNotaTunai.setTotalDiskon(0); | |||
| mNotaTunai.setStatusBayar(null); | |||
| mNotaTunai.setBank(null); | |||
| mNotaTunai.setEdc(null); | |||
| mNotaTunai.setNoKartu(null); | |||
| mNotaTunai.setNoValidasiBank(null); | |||
| mNotaTunai.setStatusNota('T'); | |||
| mNotaTunai.setNoNotaRetur(null); | |||
| mNotaTunai.setJumlahTotalRetur(null); | |||
| mNotaTunai.setJenisDiskon(null); | |||
| mNotaTunai.setJenisHadiah(null); | |||
| mNotaTunai.setTglAmbilhadiah(null); | |||
| mNotaTunai.setUserAmbilhadiah(null); | |||
| Observable.zip( | |||
| posRx.addMNotaTunai(SystemValue.idToko, mNotaTunai), | |||
| Observable.just(daftarDNotaTunai), | |||
| (mT, daftarDT) -> { | |||
| NotaWithListDetail<MNotaTunai, DNotaTunai> notaWithListDetail = new NotaWithListDetail<>(); | |||
| notaWithListDetail.setNota(mT); | |||
| notaWithListDetail.setDaftarDetail(daftarDT); | |||
| return notaWithListDetail; | |||
| }).subscribe(postMNotaTunai); | |||
| } | |||
| }; | |||
| listShortcuts.put(kcTundaNota, rnTundaNota); | |||
| apMain.getScene().getAccelerators().putAll(listShortcuts); | |||
| } | |||
| public void setTanggal() { | |||
| java.util.Date skrg = new java.util.Date(); | |||
| java.text.SimpleDateFormat kal = new java.text.SimpleDateFormat("dd/MM/yyyy"); | |||
| @@ -247,7 +314,7 @@ public class FormTransaksiTunaiController implements Initializable { | |||
| DNotaTunai dNotaTunai = new DNotaTunai( | |||
| noNota, | |||
| barang.getKodeBarang(), | |||
| barang.getNamaBarang(), | |||
| noBarang.getNomor(), | |||
| 1, | |||
| 0, | |||
| 0, | |||
| @@ -339,6 +406,7 @@ public class FormTransaksiTunaiController implements Initializable { | |||
| } | |||
| //Observer untuk menampilkan DNotaTunai ke tabel melalui ambil dari checkout | |||
| Observer<List<DNotaTunai>> getDNotaTunaiObserver = new Observer<>() { | |||
| @Override | |||
| public void onSubscribe(Disposable dspsbl) { | |||
| @@ -373,6 +441,7 @@ public class FormTransaksiTunaiController implements Initializable { | |||
| }; | |||
| //Observer untuk menampilkan data sebuah barang ke tabel, yang sudah mempunyai DNotaTunai | |||
| Observer<Barang> getBarangObserver = new Observer<>() { | |||
| @Override | |||
| public void onSubscribe(Disposable dspsbl) { | |||
| @@ -413,6 +482,7 @@ public class FormTransaksiTunaiController implements Initializable { | |||
| }; | |||
| //Observer untuk menampilkan data sebuah barang ke tabel, hasil scan tambah baru | |||
| Observer<Barang> getTambahBarangObserver = new Observer<>() { | |||
| @Override | |||
| public void onSubscribe(Disposable dspsbl) { | |||
| @@ -461,6 +531,7 @@ public class FormTransaksiTunaiController implements Initializable { | |||
| }; | |||
| //Observer untuk menampilkan data no barang ke tabel, hasil scan tambah baru | |||
| Observer<BarangFull> getBarangFullGetNoBarangFromBarangObserver = new Observer<>() { | |||
| @Override | |||
| public void onSubscribe(Disposable dspsbl) { | |||
| @@ -493,4 +564,71 @@ public class FormTransaksiTunaiController implements Initializable { | |||
| public void onComplete() { | |||
| } | |||
| }; | |||
| //Observer untuk menambahkan no nota baru | |||
| Observer<NotaWithListDetail<MNotaTunai, DNotaTunai>> postMNotaTunai = new Observer<>() { | |||
| @Override | |||
| public void onSubscribe(Disposable dspsbl) { | |||
| } | |||
| @Override | |||
| public void onNext(NotaWithListDetail<MNotaTunai, DNotaTunai> notaWithListDetail) { | |||
| for (DNotaTunai dNotaTunai : notaWithListDetail.getDaftarDetail()) { | |||
| MNotaTunai mNotaTunai = notaWithListDetail.getNota(); | |||
| dNotaTunai.setNoNota(mNotaTunai.getNoNota()); | |||
| posRx.addDNotaTunai(dNotaTunai).subscribe(postDNotaTunai); | |||
| } | |||
| } | |||
| @Override | |||
| public void onError(Throwable error) { | |||
| if (false) { | |||
| } else { | |||
| AmigoPosRx.handleGenericError(error, apMain.getScene().getWindow()); | |||
| } | |||
| } | |||
| @Override | |||
| public void onComplete() { | |||
| } | |||
| }; | |||
| Observer<Void> postDNotaTunai = new Observer<Void>() { | |||
| @Override | |||
| public void onSubscribe(Disposable dspsbl) { | |||
| } | |||
| @Override | |||
| public void onNext(Void v) { | |||
| } | |||
| @Override | |||
| public void onError(Throwable error) { | |||
| if (false) { | |||
| } else { | |||
| AmigoPosRx.handleGenericError(error, apMain.getScene().getWindow()); | |||
| } | |||
| } | |||
| @Override | |||
| public void onComplete() { | |||
| Platform.runLater(() -> { | |||
| Alert alert = AlertUtil.getAlertInfo( | |||
| "Berhasil Ditunda", | |||
| "Nota berhasil ditunda!"); | |||
| alert.initOwner(apMain.getScene().getWindow()); | |||
| alert.show(); | |||
| if (parent != null) { | |||
| parent.notaContent.setControllerTunai(null); | |||
| parent.notaContent.setNodeTunai(null); | |||
| parent.removeNota(parent.notaContent.getBtnTunai()); | |||
| } | |||
| }); | |||
| } | |||
| }; | |||
| } | |||
| @@ -0,0 +1,45 @@ | |||
| /* | |||
| * To change this license header, choose License Headers in Project Properties. | |||
| * To change this template file, choose Tools | Templates | |||
| * and open the template in the editor. | |||
| */ | |||
| package id.amigogroup.posterminal.transaksi; | |||
| import java.util.List; | |||
| /** | |||
| * | |||
| * @author ronal | |||
| */ | |||
| public class NotaWithListDetail<N,D> { | |||
| private N nota; | |||
| private List<D> daftarDetail; | |||
| /** | |||
| * @return the nota | |||
| */ | |||
| public N getNota() { | |||
| return nota; | |||
| } | |||
| /** | |||
| * @param nota the nota to set | |||
| */ | |||
| public void setNota(N nota) { | |||
| this.nota = nota; | |||
| } | |||
| /** | |||
| * @return the daftarDetail | |||
| */ | |||
| public List<D> getDaftarDetail() { | |||
| return daftarDetail; | |||
| } | |||
| /** | |||
| * @param daftarDetail the daftarDetail to set | |||
| */ | |||
| public void setDaftarDetail(List<D> daftarDetail) { | |||
| this.daftarDetail = daftarDetail; | |||
| } | |||
| } | |||
| @@ -27,6 +27,13 @@ public class AlertUtil { | |||
| public static final ButtonType BUTTON_YA = new ButtonType("Ya", ButtonData.YES); | |||
| public static Alert getAlertInfo(String title, String message){ | |||
| Alert alert = new Alert(Alert.AlertType.INFORMATION, message, ButtonType.OK); | |||
| alert.setTitle(title); | |||
| alert.setHeaderText(null); | |||
| return alert; | |||
| } | |||
| public static Alert getAlertWarning(String title, String message){ | |||
| Alert alert = new Alert(Alert.AlertType.WARNING, message, ButtonType.OK); | |||
| alert.setTitle(title); | |||
| @@ -37,6 +37,7 @@ public class Fucout { | |||
| public static final char KODE_NOTA_BAWA = 'W'; | |||
| public static final char KODE_NOTA_RETUR = 'R'; | |||
| public static final int KONVERSI_POIN = 500; | |||
| public static final String KODE_NON_MEMBER = "99999999999"; | |||
| //IMAGES URL | |||
| public static final String APP_ICON = "/assets/logo-mini-squared.png"; | |||