diff --git a/src/main/java/id/amigogroup/posterminal/transaksi/FormTransaksiTunaiController.java b/src/main/java/id/amigogroup/posterminal/transaksi/FormTransaksiTunaiController.java index ba856b5..726ae04 100644 --- a/src/main/java/id/amigogroup/posterminal/transaksi/FormTransaksiTunaiController.java +++ b/src/main/java/id/amigogroup/posterminal/transaksi/FormTransaksiTunaiController.java @@ -5,23 +5,37 @@ */ package id.amigogroup.posterminal.transaksi; +import id.amigogroup.posterminal.pencarian.DialogCariBarangController; +import java.io.IOException; 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; 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.FXMLLoader; import javafx.fxml.Initializable; +import javafx.scene.Parent; import javafx.scene.control.Button; +import javafx.scene.control.ComboBox; +import javafx.scene.control.TableColumn; +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.text.Text; +import javafx.stage.Window; /** * FXML Controller class @@ -33,12 +47,36 @@ public class FormTransaksiTunaiController implements Initializable { @FXML private TextField fldScan; @FXML + private TableView tbvTranstunai; + @FXML + private TableColumn tcNo; + @FXML + private TableColumn tcKode; + @FXML + private TableColumn tcNama; + @FXML + private TableColumn tcUkur; + @FXML + private TableColumn tcJumlah; + @FXML + private TableColumn tcHarga; + @FXML + private TableColumn tcDisc1; + @FXML + private TableColumn tcDisc2; + @FXML + private TableColumn> tcPromo; + @FXML + private TableColumn tcSubtotal; + @FXML + private TableColumn tcPramuniaga; + final ObservableList daftarTabelBarang = FXCollections.observableArrayList(); + @FXML private Text lblGrandTotal; + { - private final String BTN_TUNAI = "tunai"; - private final String BTN_BAWA_DULU = "bawa dulu"; - private final String BTN_BON = "bon"; - private final String BTN_RETUR = "retur"; + } + // private String tableState = BTN_TUNAI; /** @@ -47,7 +85,22 @@ public class FormTransaksiTunaiController implements Initializable { @Override public void initialize(URL url, ResourceBundle rb) { - initShortcuts(); + tcNo.setCellValueFactory((TableColumn.CellDataFeatures cell) -> { + return new ReadOnlyObjectWrapper(tbvTranstunai.getItems().indexOf(cell.getValue()) + 1); + }); + tcKode.setCellValueFactory(new PropertyValueFactory<>("tcKode")); + tcNama.setCellValueFactory(new PropertyValueFactory<>("tcNama")); + tcUkur.setCellValueFactory(new PropertyValueFactory<>("tcUkur")); + tcJumlah.setCellValueFactory(new PropertyValueFactory<>("tcJumlah")); + tcHarga.setCellValueFactory(new PropertyValueFactory<>("tcHarga")); + tcDisc1.setCellValueFactory(new PropertyValueFactory<>("tcDisc1")); + tcDisc2.setCellValueFactory(new PropertyValueFactory<>("tcDisc2")); + tcPromo.setCellValueFactory(new PropertyValueFactory<>("tcPromo")); + tcSubtotal.setCellValueFactory(new PropertyValueFactory<>("tcSubtotal")); + tcPramuniaga.setCellValueFactory(new PropertyValueFactory<>("tcPramuniaga")); + tbvTranstunai.setItems(daftarTabelBarang); + fillTable(new ArrayList<>()); + } private void initShortcuts() { @@ -124,4 +177,12 @@ public class FormTransaksiTunaiController implements Initializable { System.out.println("Scan"); } } + + public void fillTable(List daftarBarangTunai) { + String[] tunai = {"Ulang Tahun", "Harbolnas", "Ultah Amigo"}; + ComboBox cbxAction = new ComboBox<>(FXCollections.observableArrayList(tunai)); + cbxAction.getSelectionModel().select("Ulang Tahun"); + daftarTabelBarang.add(new TabelBarangTunai("AACOBA001ABCDXL", "Barang x", "XL","1","79.900","0","0", cbxAction, + "79.900","0001")); + } } diff --git a/src/main/java/id/amigogroup/posterminal/transaksi/TabelBarang.java b/src/main/java/id/amigogroup/posterminal/transaksi/TabelBarang.java deleted file mode 100644 index b3fa77b..0000000 --- a/src/main/java/id/amigogroup/posterminal/transaksi/TabelBarang.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * 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 javafx.beans.property.SimpleObjectProperty; -import javafx.beans.property.SimpleStringProperty; -import javafx.scene.control.Button; - -/** - * - * @author AGNES - */ -public class TabelBarang { - - /** - * @return the kodeBarang - */ - private SimpleStringProperty kodeBarang; - private SimpleStringProperty namaBarang; - private SimpleStringProperty ukur; - private SimpleStringProperty qty; - private SimpleStringProperty harga; - private SimpleStringProperty disc1; - private SimpleStringProperty disc2; - private SimpleStringProperty promo; - private SimpleStringProperty subTotal; - private SimpleStringProperty pramuniaga; - - public TabelBarang(String kodeBarang, String namaBarang, String ukur, String qty, String harga, String disc1, - String disc2, String promo, String subTotal, String pramuniaga) { - this.kodeBarang = new SimpleStringProperty(kodeBarang); - this.namaBarang = new SimpleStringProperty(namaBarang); - this.ukur = new SimpleStringProperty(ukur); - this.qty = new SimpleStringProperty(qty); - this.harga = new SimpleStringProperty(harga); - this.disc1 = new SimpleStringProperty(disc1); - this.disc2 = new SimpleStringProperty(disc2); - this.promo = new SimpleStringProperty(promo); - this.subTotal = new SimpleStringProperty(subTotal); - this.pramuniaga = new SimpleStringProperty(pramuniaga); - } - - public SimpleStringProperty getKodeBarang() { - return kodeBarang; - } - - /** - * @param kodeBarang the kodeBarang to set - */ - public void setKodeBarang(SimpleStringProperty kodeBarang) { - this.kodeBarang = kodeBarang; - } - - /** - * @return the namaBarang - */ - public SimpleStringProperty getNamaBarang() { - return namaBarang; - } - - /** - * @param namaBarang the namaBarang to set - */ - public void setNamaBarang(SimpleStringProperty namaBarang) { - this.namaBarang = namaBarang; - } - - /** - * @return the ukur - */ - public SimpleStringProperty getUkur() { - return ukur; - } - - /** - * @param ukur the ukur to set - */ - public void setUkur(SimpleStringProperty ukur) { - this.ukur = ukur; - } - - /** - * @return the qty - */ - public SimpleStringProperty getQty() { - return qty; - } - - /** - * @param qty the qty to set - */ - public void setQty(SimpleStringProperty qty) { - this.qty = qty; - } - - /** - * @return the harga - */ - public SimpleStringProperty getHarga() { - return harga; - } - - /** - * @param harga the harga to set - */ - public void setHarga(SimpleStringProperty harga) { - this.harga = harga; - } - - /** - * @return the disc1 - */ - public SimpleStringProperty getDisc1() { - return disc1; - } - - /** - * @param disc1 the disc1 to set - */ - public void setDisc1(SimpleStringProperty disc1) { - this.disc1 = disc1; - } - - /** - * @return the disc2 - */ - public SimpleStringProperty getDisc2() { - return disc2; - } - - /** - * @param disc2 the disc2 to set - */ - public void setDisc2(SimpleStringProperty disc2) { - this.disc2 = disc2; - } - - /** - * @return the promo - */ - public SimpleStringProperty getPromo() { - return promo; - } - - /** - * @param promo the promo to set - */ - public void setPromo(SimpleStringProperty promo) { - this.promo = promo; - } - - /** - * @return the subTotal - */ - public SimpleStringProperty getSubTotal() { - return subTotal; - } - - /** - * @param subTotal the subTotal to set - */ - public void setSubTotal(SimpleStringProperty subTotal) { - this.subTotal = subTotal; - } - - /** - * @return the pramuniaga - */ - public SimpleStringProperty getPramuniaga() { - return pramuniaga; - } - - /** - * @param pramuniaga the pramuniaga to set - */ - public void setPramuniaga(SimpleStringProperty pramuniaga) { - this.pramuniaga = pramuniaga; - } -} \ No newline at end of file diff --git a/src/main/java/id/amigogroup/posterminal/transaksi/TabelBarangTunai.java b/src/main/java/id/amigogroup/posterminal/transaksi/TabelBarangTunai.java new file mode 100644 index 0000000..76b231e --- /dev/null +++ b/src/main/java/id/amigogroup/posterminal/transaksi/TabelBarangTunai.java @@ -0,0 +1,184 @@ +/* + * 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 javafx.beans.property.SimpleObjectProperty; +import javafx.beans.property.SimpleStringProperty; +import javafx.scene.control.Button; +import javafx.scene.control.ComboBox; + +/** + * + * @author AGNES + */ +public class TabelBarangTunai { + + + + private SimpleStringProperty tcKode; + private SimpleStringProperty tcNama; + private SimpleStringProperty tcUkur; + private SimpleStringProperty tcJumlah; + private SimpleStringProperty tcHarga; + private SimpleStringProperty tcDisc1; + private SimpleStringProperty tcDisc2; + private SimpleObjectProperty tcPromo; + private SimpleStringProperty tcSubtotal; + private SimpleStringProperty tcPramuniaga; + + public TabelBarangTunai(String tcKode, String tcNama, String tcUkur, String tcJumlah, String tcHarga, String tcDisc1, + String tcDisc2, ComboBox tcPromo, String tcSubtotal, String tcPramuniaga) { + this.tcKode = new SimpleStringProperty(tcKode); + this.tcNama = new SimpleStringProperty(tcNama); + this.tcUkur = new SimpleStringProperty(tcUkur); + this.tcJumlah = new SimpleStringProperty(tcJumlah); + this.tcHarga = new SimpleStringProperty(tcHarga); + this.tcDisc1 = new SimpleStringProperty(tcDisc1); + this.tcDisc2 = new SimpleStringProperty(tcDisc2); + this.tcPromo = new SimpleObjectProperty(tcPromo); + this.tcSubtotal = new SimpleStringProperty(tcSubtotal); + this.tcPramuniaga = new SimpleStringProperty(tcPramuniaga); + } + /** + * @return the tcKode + */ + public String getTcKode() { + return tcKode.get(); + } + + /** + * @param tcKode the tcKode to set + */ + public void setTcKode(String tcKode) { + this.tcKode.set(tcKode); + } + + /** + * @return the tcNama + */ + public String getTcNama() { + return tcNama.get(); + } + + /** + * @param tcNama the tcNama to set + */ + public void setTcNama(String tcNama) { + this.tcNama.set(tcNama); + } + + /** + * @return the tcUkur + */ + public String getTcUkur() { + return tcUkur.get(); + } + + /** + * @param tcUkur the tcUkur to set + */ + public void setTcUkur(String tcUkur) { + this.tcUkur.set(tcUkur); + } + + /** + * @return the tcJumlah + */ + public String getTcJumlah() { + return tcJumlah.get(); + } + + /** + * @param tcJumlah the tcJumlah to set + */ + public void setTcJumlah(String tcJumlah) { + this.tcJumlah.set(tcJumlah); + } + + /** + * @return the tcHarga + */ + public String getTcHarga() { + return tcHarga.get(); + } + + /** + * @param tcHarga the tcHarga to set + */ + public void setTcHarga(String tcHarga) { + this.tcHarga.set(tcHarga); + } + + /** + * @return the tcDisc1 + */ + public String getTcDisc1() { + return tcDisc1.get(); + } + + /** + * @param tcDisc1 the tcDisc1 to set + */ + public void setTcDisc1(String tcDisc1) { + this.tcDisc1.set(tcDisc1); + } + + /** + * @return the tcDisc2 + */ + public String getTcDisc2() { + return tcDisc2.get(); + } + + /** + * @param tcDisc2 the tcDisc2 to set + */ + public void setTcDisc2(String tcDisc2) { + this.tcDisc2.set(tcDisc2); + } + + /** + * @return the tcPromo + */ + public ComboBox getTcPromo() { + return tcPromo.get(); + } + + /** + * @param tcPromo the tcPromo to set + */ + public void setTcPromo(ComboBox tcPromo) { + this.tcPromo.set(tcPromo); + } + + /** + * @return the tcSubtotal + */ + public String getTcSubtotal() { + return tcSubtotal.get(); + } + + /** + * @param tcSubtotal the tcSubtotal to set + */ + public void setTcSubtotal(String tcSubtotal) { + this.tcSubtotal.set(tcSubtotal); + } + + /** + * @return the tcPramuniaga + */ + public String getTcPramuniaga() { + return tcPramuniaga.get(); + } + + /** + * @param tcPramuniaga the tcPramuniaga to set + */ + public void setTcPramuniaga(String tcPramuniaga) { + this.tcPramuniaga.set(tcPramuniaga); + } + } diff --git a/src/main/resources/fxml/FormTransaksiTunai.fxml b/src/main/resources/fxml/FormTransaksiTunai.fxml index 17170a4..92dcb3c 100644 --- a/src/main/resources/fxml/FormTransaksiTunai.fxml +++ b/src/main/resources/fxml/FormTransaksiTunai.fxml @@ -94,19 +94,19 @@ - + - - - - - - - - - - - + + + + + + + + + + +