Agnes-MencariNotaTunda em master 5 anos atrás
| @@ -57,6 +57,11 @@ public class AmigoPosRx { | |||||
| return UtilsApi.getServiceApiBarang().getMNotaTunaiByNoNota(noNota) | return UtilsApi.getServiceApiBarang().getMNotaTunaiByNoNota(noNota) | ||||
| .subscribeOn(Schedulers.trampoline()); | .subscribeOn(Schedulers.trampoline()); | ||||
| } | } | ||||
| public Observable<Pagination<MNotaTunai>> getMNotaTunaiByStatus(String status, Integer limit) { | |||||
| return UtilsApi.getServiceApiBarang().getMNotaTunaiByStatus(status, limit) | |||||
| .subscribeOn(Schedulers.io()); | |||||
| } | |||||
| public Observable<List<DNotaTunai>> getDNotaTunaiByNoNota(String noNota) { | public Observable<List<DNotaTunai>> getDNotaTunaiByNoNota(String noNota) { | ||||
| return UtilsApi.getServiceApiBarang().getDNotaTunaiByNoNota(noNota) | return UtilsApi.getServiceApiBarang().getDNotaTunaiByNoNota(noNota) | ||||
| @@ -47,6 +47,12 @@ public interface ServiceApiBarang { | |||||
| @GET("m-nota-tunai/no-nota/{noNota}") | @GET("m-nota-tunai/no-nota/{noNota}") | ||||
| Observable<MNotaTunai> getMNotaTunaiByNoNota(@Path("noNota") String noNota); | Observable<MNotaTunai> getMNotaTunaiByNoNota(@Path("noNota") String noNota); | ||||
| //Mengambil Master Nota Tunai By Status Tunda | |||||
| @GET("m-nota-tunai/status/{status}/limit/{limit}") | |||||
| Observable<Pagination<MNotaTunai>> getMNotaTunaiByStatus( | |||||
| @Path("status") String status, | |||||
| @Path("limit") Integer limit); | |||||
| //D-NOTA-TUNAI | //D-NOTA-TUNAI | ||||
| //Mengambil Detail Nota Tunai by No Nota | //Mengambil Detail Nota Tunai by No Nota | ||||
| @GET("d-nota-tunai/no-nota/{noNota}") | @GET("d-nota-tunai/no-nota/{noNota}") | ||||
| @@ -5,18 +5,38 @@ | |||||
| */ | */ | ||||
| package id.amigogroup.posterminal.pencarian; | package id.amigogroup.posterminal.pencarian; | ||||
| import id.amigogroup.posterminal.api.AmigoPosRx; | |||||
| import id.amigogroup.posterminal.model.MNotaTunai; | |||||
| import id.amigogroup.posterminal.model.Pagination; | |||||
| import id.amigogroup.posterminal.transaksi.TabelBarangTunai; | |||||
| import id.amigogroup.posterminal.util.AlertUtil; | |||||
| import io.reactivex.Observer; | |||||
| import io.reactivex.disposables.Disposable; | |||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.net.HttpURLConnection; | |||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.util.ResourceBundle; | import java.util.ResourceBundle; | ||||
| import java.util.logging.Level; | import java.util.logging.Level; | ||||
| import java.util.logging.Logger; | import java.util.logging.Logger; | ||||
| import javafx.beans.property.ReadOnlyObjectWrapper; | |||||
| import javafx.collections.FXCollections; | |||||
| import javafx.collections.ObservableList; | |||||
| import javafx.fxml.FXML; | |||||
| import javafx.fxml.FXMLLoader; | import javafx.fxml.FXMLLoader; | ||||
| import javafx.fxml.Initializable; | import javafx.fxml.Initializable; | ||||
| import javafx.scene.Parent; | import javafx.scene.Parent; | ||||
| import javafx.scene.control.Alert; | |||||
| import javafx.scene.control.ButtonBar.ButtonData; | import javafx.scene.control.ButtonBar.ButtonData; | ||||
| import javafx.scene.control.ButtonType; | import javafx.scene.control.ButtonType; | ||||
| import javafx.scene.control.ComboBox; | |||||
| import javafx.scene.control.Dialog; | import javafx.scene.control.Dialog; | ||||
| import javafx.scene.control.TableColumn; | |||||
| import javafx.scene.control.TableView; | |||||
| import javafx.scene.control.cell.PropertyValueFactory; | |||||
| import javafx.scene.input.KeyEvent; | |||||
| import javafx.scene.layout.AnchorPane; | |||||
| import javafx.stage.Window; | import javafx.stage.Window; | ||||
| import retrofit2.HttpException; | |||||
| /** | /** | ||||
| * FXML Controller class | * FXML Controller class | ||||
| @@ -24,6 +44,37 @@ import javafx.stage.Window; | |||||
| * @author ronal | * @author ronal | ||||
| */ | */ | ||||
| public class DialogCariNotaTundaController extends Dialog<String> implements Initializable { | public class DialogCariNotaTundaController extends Dialog<String> implements Initializable { | ||||
| @FXML | |||||
| AnchorPane apContent; | |||||
| @FXML | |||||
| private ComboBox<String> cbxCariNotaTunda; | |||||
| @FXML | |||||
| private TableView<TabelBarangTunai> tbvBarangTunda; | |||||
| @FXML | |||||
| private TableColumn<TabelBarangTunai, Integer> tcNo; | |||||
| @FXML | |||||
| private TableColumn<TabelBarangTunai, String> tcKode; | |||||
| @FXML | |||||
| private TableColumn<TabelBarangTunai, String> tcNama; | |||||
| @FXML | |||||
| private TableColumn<TabelBarangTunai, String> tcUkur; | |||||
| @FXML | |||||
| private TableColumn<TabelBarangTunai, String> tcJml; | |||||
| @FXML | |||||
| private TableColumn<TabelBarangTunai, String> tcHarga; | |||||
| @FXML | |||||
| private TableColumn<TabelBarangTunai, String> tcDisc1; | |||||
| @FXML | |||||
| private TableColumn<TabelBarangTunai, String> tcDisc2; | |||||
| @FXML | |||||
| private TableColumn<TabelBarangTunai, String> tcSubTotal; | |||||
| @FXML | |||||
| private TableColumn<TabelBarangTunai, String> tcPromo; | |||||
| @FXML | |||||
| private TableColumn<TabelBarangTunai, String> tcPramuniaga; | |||||
| final ObservableList<TabelBarangTunai> daftarTabelBarangTunai = FXCollections.observableArrayList(); | |||||
| AmigoPosRx posRx = new AmigoPosRx(); | |||||
| /** | /** | ||||
| * Initializes the controller class. | * Initializes the controller class. | ||||
| @@ -31,7 +82,9 @@ public class DialogCariNotaTundaController extends Dialog<String> implements Ini | |||||
| @Override | @Override | ||||
| public void initialize(URL url, ResourceBundle rb) { | public void initialize(URL url, ResourceBundle rb) { | ||||
| getDialogPane().getButtonTypes().add(new ButtonType("Tutup", ButtonData.CANCEL_CLOSE)); | getDialogPane().getButtonTypes().add(new ButtonType("Tutup", ButtonData.CANCEL_CLOSE)); | ||||
| } | |||||
| // | |||||
| } | |||||
| public DialogCariNotaTundaController(/*FormPresensiController parent*/) { | public DialogCariNotaTundaController(/*FormPresensiController parent*/) { | ||||
| try { | try { | ||||
| @@ -44,7 +97,7 @@ public class DialogCariNotaTundaController extends Dialog<String> implements Ini | |||||
| Parent root = loader.load(); | Parent root = loader.load(); | ||||
| getDialogPane().setContent(root); | getDialogPane().setContent(root); | ||||
| setTitle("Cari Nota Tunda"); | setTitle("Cari Nota Tunda"); | ||||
| posRx.getMNotaTunaiByStatus("T", 25).subscribe(getNotaTunaiTundaObserver); | |||||
| // getDialogPane().getButtonTypes().add(ButtonType.CANCEL); | // getDialogPane().getButtonTypes().add(ButtonType.CANCEL); | ||||
| // setResultConverter(buttonType -> { | // setResultConverter(buttonType -> { | ||||
| // return str; | // return str; | ||||
| @@ -54,4 +107,38 @@ public class DialogCariNotaTundaController extends Dialog<String> implements Ini | |||||
| .getName()).log(Level.SEVERE, null, e); | .getName()).log(Level.SEVERE, null, e); | ||||
| } | } | ||||
| } | } | ||||
| public Observer<Pagination<MNotaTunai>> getNotaTunaiTundaObserver = new Observer<Pagination<MNotaTunai>>() { | |||||
| @Override | |||||
| public void onSubscribe(Disposable dspsbl) { | |||||
| } | |||||
| @Override | |||||
| public void onNext(Pagination<MNotaTunai> daftarMNotaTunai) { | |||||
| for (MNotaTunai mNotaTunai : daftarMNotaTunai.getData()){ | |||||
| cbxCariNotaTunda.getItems().add(mNotaTunai.getNoNota()); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void onError(Throwable error) { | |||||
| if (error instanceof HttpException) { | |||||
| switch (((HttpException) error).code()) { | |||||
| case HttpURLConnection.HTTP_NOT_FOUND: | |||||
| Alert alert = AlertUtil.getAlertError( | |||||
| AlertUtil.ERROR_TIDAK_DITEMUKAN_TITLE, | |||||
| "Nota Tunda Tidak Ditemukan"); | |||||
| alert.initOwner(apContent.getScene().getWindow()); | |||||
| alert.show(); | |||||
| } | |||||
| } else { | |||||
| AmigoPosRx.handleGenericError(error, apContent.getScene().getWindow()); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void onComplete() { | |||||
| } | |||||
| }; | |||||
| } | } | ||||
| @@ -105,10 +105,11 @@ public class FormTransaksiReturController implements Initializable { | |||||
| @FXML | @FXML | ||||
| private TableColumn<TabelBarangRetur, TextField> tcPramuniagaRetur; | private TableColumn<TabelBarangRetur, TextField> tcPramuniagaRetur; | ||||
| @FXML | @FXML | ||||
| private TableColumn<TabelBarangRetur, Button> tcBtnBatal; | |||||
| @FXML | |||||
| private StackPane stpReturDrop; | private StackPane stpReturDrop; | ||||
| @FXML | @FXML | ||||
| private Label lblTambahKeTabelRetur; | private Label lblTambahKeTabelRetur; | ||||
| private TableColumn<TabelBarangTunai, Button> tcAction; | |||||
| private final AmigoPosRx posRx = new AmigoPosRx(); | private final AmigoPosRx posRx = new AmigoPosRx(); | ||||
| private String noNota = ""; | private String noNota = ""; | ||||
| @@ -133,7 +134,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")); | |||||
| tcBtnBatal.setCellValueFactory(new PropertyValueFactory<>("btnBatal")); | |||||
| tbvPenjualan.setItems(daftarTabelPenjualan); | tbvPenjualan.setItems(daftarTabelPenjualan); | ||||
| tcNoRetur.setCellValueFactory((TableColumn.CellDataFeatures<TabelBarangRetur, Integer> cell) -> { | tcNoRetur.setCellValueFactory((TableColumn.CellDataFeatures<TabelBarangRetur, Integer> cell) -> { | ||||
| @@ -166,8 +167,8 @@ public class FormTransaksiReturController implements Initializable { | |||||
| for (DNotaTunai dNotaTunai : daftarNotaTunai) { | for (DNotaTunai dNotaTunai : daftarNotaTunai) { | ||||
| //Button | //Button | ||||
| Button btnAction = ButtonUtility.generateButton(ButtonUtility.CLOSE_ICON); | |||||
| btnAction.setOnAction((t) -> { | |||||
| Button btnBatal = ButtonUtility.generateButton(ButtonUtility.CLOSE_ICON); | |||||
| btnBatal.setOnAction((t) -> { | |||||
| Alert alert = AlertUtil.getAlertDialogKonfirmasi( | Alert alert = AlertUtil.getAlertDialogKonfirmasi( | ||||
| AlertUtil.DIALOG_KONFIRMASI_MESSAGE, | AlertUtil.DIALOG_KONFIRMASI_MESSAGE, | ||||
| "Yakin ingin menghapus barang?"); | "Yakin ingin menghapus barang?"); | ||||
| @@ -198,7 +199,7 @@ public class FormTransaksiReturController implements Initializable { | |||||
| dNotaTunai.getHargaJual() * dNotaTunai.getJumlah() | dNotaTunai.getHargaJual() * dNotaTunai.getJumlah() | ||||
| )), | )), | ||||
| fldPramuniaga, | fldPramuniaga, | ||||
| btnAction); | |||||
| btnBatal); | |||||
| tbt.setData(dNotaTunai); | tbt.setData(dNotaTunai); | ||||
| daftarTabelPenjualan.add(tbt); | daftarTabelPenjualan.add(tbt); | ||||
| @@ -12,6 +12,7 @@ import id.amigogroup.posterminal.model.DNotaTunai; | |||||
| import id.amigogroup.posterminal.model.NoBarang; | import id.amigogroup.posterminal.model.NoBarang; | ||||
| import id.amigogroup.posterminal.util.AmigoPosCache; | import id.amigogroup.posterminal.util.AmigoPosCache; | ||||
| import id.amigogroup.posterminal.util.AlertUtil; | import id.amigogroup.posterminal.util.AlertUtil; | ||||
| import id.amigogroup.posterminal.util.ButtonUtility; | |||||
| import id.amigogroup.posterminal.util.Fucout; | import id.amigogroup.posterminal.util.Fucout; | ||||
| import io.reactivex.Observable; | import io.reactivex.Observable; | ||||
| import io.reactivex.Observer; | import io.reactivex.Observer; | ||||
| @@ -90,7 +91,6 @@ public class FormTransaksiTunaiController implements Initializable { | |||||
| final ObservableList<TabelBarangTunai> daftarTabelTransaksi = FXCollections.observableArrayList(); | final ObservableList<TabelBarangTunai> daftarTabelTransaksi = FXCollections.observableArrayList(); | ||||
| @FXML | @FXML | ||||
| private Text lblGrandTotal; | private Text lblGrandTotal; | ||||
| public static final ButtonType btnAction = new ButtonType("BATAL", ButtonBar.ButtonData.YES); | |||||
| private String noNota = ""; | private String noNota = ""; | ||||
| private AmigoPosRx posRx = new AmigoPosRx(); | private AmigoPosRx posRx = new AmigoPosRx(); | ||||
| @@ -145,7 +145,7 @@ public class FormTransaksiTunaiController implements Initializable { | |||||
| ComboBox<String> cbxPromo = new ComboBox<>(FXCollections.observableArrayList(promo)); | ComboBox<String> cbxPromo = new ComboBox<>(FXCollections.observableArrayList(promo)); | ||||
| cbxPromo.getSelectionModel().select("Ulang Tahun"); | cbxPromo.getSelectionModel().select("Ulang Tahun"); | ||||
| //Button | //Button | ||||
| Button btnAction = new Button("BATAL"); | |||||
| Button btnAction = ButtonUtility.generateButton(ButtonUtility.CLOSE_ICON); | |||||
| btnAction.setOnAction((t) -> { | btnAction.setOnAction((t) -> { | ||||
| Alert alert = AlertUtil.getAlertError( | Alert alert = AlertUtil.getAlertError( | ||||
| AlertUtil.DIALOG_KONFIRMASI_MESSAGE, | AlertUtil.DIALOG_KONFIRMASI_MESSAGE, | ||||
| @@ -221,7 +221,7 @@ public class FormTransaksiTunaiController implements Initializable { | |||||
| ComboBox<String> cbxPromo = new ComboBox<>(FXCollections.observableArrayList(promo)); | ComboBox<String> cbxPromo = new ComboBox<>(FXCollections.observableArrayList(promo)); | ||||
| cbxPromo.getSelectionModel().select("Ulang Tahun"); | cbxPromo.getSelectionModel().select("Ulang Tahun"); | ||||
| Button btnAction = new Button("BATAL"); | |||||
| Button btnAction = ButtonUtility.generateButton(ButtonUtility.CLOSE_ICON); | |||||
| btnAction.setOnAction((t) -> { | btnAction.setOnAction((t) -> { | ||||
| Alert alert = AlertUtil.getAlertDialogKonfirmasi( | Alert alert = AlertUtil.getAlertDialogKonfirmasi( | ||||
| AlertUtil.DIALOG_KONFIRMASI_MESSAGE, | AlertUtil.DIALOG_KONFIRMASI_MESSAGE, | ||||
| @@ -14,7 +14,7 @@ | |||||
| <Font size="16.0" /> | <Font size="16.0" /> | ||||
| </font> | </font> | ||||
| </Label> | </Label> | ||||
| <ComboBox fx:id="ddCariNota" layoutX="4.0" layoutY="46.0" prefWidth="281.0" promptText="Nomor Nota" AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="46.0" /> | |||||
| <ComboBox fx:id="cbxCariNotaTunda" layoutX="4.0" layoutY="46.0" prefWidth="281.0" promptText="Nomor Nota" AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="46.0" /> | |||||
| <Label layoutY="29.0" text="Nomor Nota Tunda" AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="29.0" /> | <Label layoutY="29.0" text="Nomor Nota Tunda" AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="29.0" /> | ||||
| <Label layoutX="14.0" layoutY="76.0" text="Pelanggan" AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="76.0"> | <Label layoutX="14.0" layoutY="76.0" text="Pelanggan" AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="76.0"> | ||||
| <font> | <font> | ||||
| @@ -26,7 +26,7 @@ | |||||
| <Font size="14.0" /> | <Font size="14.0" /> | ||||
| </font> | </font> | ||||
| </Label> | </Label> | ||||
| <TableView layoutX="8.0" layoutY="100.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="100.0"> | |||||
| <TableView fx:id="tbvBarangTunda" layoutX="8.0" layoutY="100.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="100.0"> | |||||
| <columns> | <columns> | ||||
| <TableColumn fx:id="tcNo" editable="false" maxWidth="30.0" minWidth="30.0" prefWidth="30.0" resizable="false" sortable="false" text="No" /> | <TableColumn fx:id="tcNo" editable="false" maxWidth="30.0" minWidth="30.0" prefWidth="30.0" resizable="false" sortable="false" text="No" /> | ||||
| <TableColumn fx:id="tcKode" editable="false" prefWidth="75.0" text="Kode Barang" /> | <TableColumn fx:id="tcKode" editable="false" prefWidth="75.0" text="Kode Barang" /> | ||||
| @@ -37,6 +37,7 @@ | |||||
| <TableColumn fx:id="tcDisc1" editable="false" maxWidth="50.0" minWidth="50.0" prefWidth="50.0" resizable="false" text="Disc I" /> | <TableColumn fx:id="tcDisc1" editable="false" maxWidth="50.0" minWidth="50.0" prefWidth="50.0" resizable="false" text="Disc I" /> | ||||
| <TableColumn fx:id="tcDisc2" editable="false" maxWidth="50.0" minWidth="50.0" prefWidth="50.0" resizable="false" text="Disc II" /> | <TableColumn fx:id="tcDisc2" editable="false" maxWidth="50.0" minWidth="50.0" prefWidth="50.0" resizable="false" text="Disc II" /> | ||||
| <TableColumn fx:id="tcSubTotal" editable="false" prefWidth="75.0" text="Sub Total" /> | <TableColumn fx:id="tcSubTotal" editable="false" prefWidth="75.0" text="Sub Total" /> | ||||
| <TableColumn fx:id="tcPromo" prefWidth="75.0" text="Promo" /> | |||||
| <TableColumn fx:id="tcPramuniaga" editable="false" prefWidth="75.0" text="Pramuniaga" /> | <TableColumn fx:id="tcPramuniaga" editable="false" prefWidth="75.0" text="Pramuniaga" /> | ||||
| </columns> | </columns> | ||||
| <columnResizePolicy> | <columnResizePolicy> | ||||