|
|
|
|
@ -5,38 +5,18 @@
|
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
|
|
@ -44,37 +24,6 @@ import retrofit2.HttpException;
|
|
|
|
|
* @author ronal
|
|
|
|
|
*/
|
|
|
|
|
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.
|
|
|
|
|
@ -82,9 +31,7 @@ public class DialogCariNotaTundaController extends Dialog<String> implements Ini
|
|
|
|
|
@Override
|
|
|
|
|
public void initialize(URL url, ResourceBundle rb) {
|
|
|
|
|
getDialogPane().getButtonTypes().add(new ButtonType("Tutup", ButtonData.CANCEL_CLOSE));
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DialogCariNotaTundaController(/*FormPresensiController parent*/) {
|
|
|
|
|
try {
|
|
|
|
|
@ -97,7 +44,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;
|
|
|
|
|
@ -107,38 +54,4 @@ 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() {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|