Agnes-MencariNotaTunda から master へマージ 5年前
| @@ -58,6 +58,11 @@ public class AmigoPosRx { | |||
| .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) { | |||
| return UtilsApi.getServiceApiBarang().getDNotaTunaiByNoNota(noNota) | |||
| .subscribeOn(Schedulers.io()); | |||
| @@ -47,6 +47,12 @@ public interface ServiceApiBarang { | |||
| @GET("m-nota-tunai/no-nota/{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 | |||
| //Mengambil Detail Nota Tunai by No Nota | |||
| @GET("d-nota-tunai/no-nota/{noNota}") | |||
| @@ -5,18 +5,38 @@ | |||
| */ | |||
| 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.net.HttpURLConnection; | |||
| import java.net.URL; | |||
| import java.util.ResourceBundle; | |||
| import java.util.logging.Level; | |||
| 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.Initializable; | |||
| import javafx.scene.Parent; | |||
| import javafx.scene.control.Alert; | |||
| import javafx.scene.control.ButtonBar.ButtonData; | |||
| import javafx.scene.control.ButtonType; | |||
| import javafx.scene.control.ComboBox; | |||
| 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 retrofit2.HttpException; | |||
| /** | |||
| * FXML Controller class | |||
| @@ -25,14 +45,47 @@ import javafx.stage.Window; | |||
| */ | |||
| 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. | |||
| */ | |||
| @Override | |||
| public void initialize(URL url, ResourceBundle rb) { | |||
| getDialogPane().getButtonTypes().add(new ButtonType("Tutup", ButtonData.CANCEL_CLOSE)); | |||
| // | |||
| } | |||
| public DialogCariNotaTundaController(/*FormPresensiController parent*/) { | |||
| try { | |||
| Window window = getDialogPane().getScene().getWindow(); | |||
| @@ -44,7 +97,7 @@ public class DialogCariNotaTundaController extends Dialog<String> implements Ini | |||
| Parent root = loader.load(); | |||
| getDialogPane().setContent(root); | |||
| setTitle("Cari Nota Tunda"); | |||
| posRx.getMNotaTunaiByStatus("T", 25).subscribe(getNotaTunaiTundaObserver); | |||
| // getDialogPane().getButtonTypes().add(ButtonType.CANCEL); | |||
| // setResultConverter(buttonType -> { | |||
| // return str; | |||
| @@ -54,4 +107,38 @@ public class DialogCariNotaTundaController extends Dialog<String> implements Ini | |||
| .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 | |||
| private TableColumn<TabelBarangRetur, TextField> tcPramuniagaRetur; | |||
| @FXML | |||
| private TableColumn<TabelBarangRetur, Button> tcBtnBatal; | |||
| @FXML | |||
| private StackPane stpReturDrop; | |||
| @FXML | |||
| private Label lblTambahKeTabelRetur; | |||
| private TableColumn<TabelBarangTunai, Button> tcAction; | |||
| private final AmigoPosRx posRx = new AmigoPosRx(); | |||
| private String noNota = ""; | |||
| @@ -133,7 +134,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")); | |||
| tcBtnBatal.setCellValueFactory(new PropertyValueFactory<>("btnBatal")); | |||
| tbvPenjualan.setItems(daftarTabelPenjualan); | |||
| tcNoRetur.setCellValueFactory((TableColumn.CellDataFeatures<TabelBarangRetur, Integer> cell) -> { | |||
| @@ -166,8 +167,8 @@ public class FormTransaksiReturController implements Initializable { | |||
| for (DNotaTunai dNotaTunai : daftarNotaTunai) { | |||
| //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( | |||
| AlertUtil.DIALOG_KONFIRMASI_MESSAGE, | |||
| "Yakin ingin menghapus barang?"); | |||
| @@ -198,7 +199,7 @@ public class FormTransaksiReturController implements Initializable { | |||
| dNotaTunai.getHargaJual() * dNotaTunai.getJumlah() | |||
| )), | |||
| fldPramuniaga, | |||
| btnAction); | |||
| btnBatal); | |||
| tbt.setData(dNotaTunai); | |||
| daftarTabelPenjualan.add(tbt); | |||
| @@ -12,6 +12,7 @@ import id.amigogroup.posterminal.model.DNotaTunai; | |||
| import id.amigogroup.posterminal.model.NoBarang; | |||
| import id.amigogroup.posterminal.util.AmigoPosCache; | |||
| import id.amigogroup.posterminal.util.AlertUtil; | |||
| import id.amigogroup.posterminal.util.ButtonUtility; | |||
| import id.amigogroup.posterminal.util.Fucout; | |||
| import io.reactivex.Observable; | |||
| import io.reactivex.Observer; | |||
| @@ -90,7 +91,6 @@ public class FormTransaksiTunaiController implements Initializable { | |||
| final ObservableList<TabelBarangTunai> daftarTabelTransaksi = FXCollections.observableArrayList(); | |||
| @FXML | |||
| private Text lblGrandTotal; | |||
| public static final ButtonType btnAction = new ButtonType("BATAL", ButtonBar.ButtonData.YES); | |||
| private String noNota = ""; | |||
| private AmigoPosRx posRx = new AmigoPosRx(); | |||
| @@ -145,7 +145,7 @@ public class FormTransaksiTunaiController implements Initializable { | |||
| ComboBox<String> cbxPromo = new ComboBox<>(FXCollections.observableArrayList(promo)); | |||
| cbxPromo.getSelectionModel().select("Ulang Tahun"); | |||
| //Button | |||
| Button btnAction = new Button("BATAL"); | |||
| Button btnAction = ButtonUtility.generateButton(ButtonUtility.CLOSE_ICON); | |||
| btnAction.setOnAction((t) -> { | |||
| Alert alert = AlertUtil.getAlertError( | |||
| AlertUtil.DIALOG_KONFIRMASI_MESSAGE, | |||
| @@ -221,7 +221,7 @@ public class FormTransaksiTunaiController implements Initializable { | |||
| ComboBox<String> cbxPromo = new ComboBox<>(FXCollections.observableArrayList(promo)); | |||
| cbxPromo.getSelectionModel().select("Ulang Tahun"); | |||
| Button btnAction = new Button("BATAL"); | |||
| Button btnAction = ButtonUtility.generateButton(ButtonUtility.CLOSE_ICON); | |||
| btnAction.setOnAction((t) -> { | |||
| Alert alert = AlertUtil.getAlertDialogKonfirmasi( | |||
| AlertUtil.DIALOG_KONFIRMASI_MESSAGE, | |||
| @@ -14,7 +14,7 @@ | |||
| <Font size="16.0" /> | |||
| </font> | |||
| </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 layoutX="14.0" layoutY="76.0" text="Pelanggan" AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="76.0"> | |||
| <font> | |||
| @@ -26,7 +26,7 @@ | |||
| <Font size="14.0" /> | |||
| </font> | |||
| </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> | |||
| <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" /> | |||
| @@ -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="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="tcPromo" prefWidth="75.0" text="Promo" /> | |||
| <TableColumn fx:id="tcPramuniaga" editable="false" prefWidth="75.0" text="Pramuniaga" /> | |||
| </columns> | |||
| <columnResizePolicy> | |||