| @@ -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<TabelBarangTunai> tbvTranstunai; | |||
| @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> tcJumlah; | |||
| @FXML | |||
| private TableColumn<TabelBarangTunai, String> tcHarga; | |||
| @FXML | |||
| private TableColumn<TabelBarangTunai, String> tcDisc1; | |||
| @FXML | |||
| private TableColumn<TabelBarangTunai, String> tcDisc2; | |||
| @FXML | |||
| private TableColumn<TabelBarangTunai, ComboBox<String>> tcPromo; | |||
| @FXML | |||
| private TableColumn<TabelBarangTunai, String> tcSubtotal; | |||
| @FXML | |||
| private TableColumn<TabelBarangTunai, String> tcPramuniaga; | |||
| final ObservableList<TabelBarangTunai> 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<TabelBarangTunai, Integer> 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<TabelBarangTunai> daftarBarangTunai) { | |||
| String[] tunai = {"Ulang Tahun", "Harbolnas", "Ultah Amigo"}; | |||
| ComboBox<String> 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")); | |||
| } | |||
| } | |||
| @@ -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; | |||
| } | |||
| } | |||
| @@ -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<ComboBox> 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<ComboBox>(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); | |||
| } | |||
| } | |||
| @@ -94,19 +94,19 @@ | |||
| </children> | |||
| </GridPane> | |||
| <Separator layoutY="116.0" prefHeight="0.0" prefWidth="800.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="116.0" /> | |||
| <TableView layoutY="150.0" prefHeight="245.0" prefWidth="800.0" AnchorPane.bottomAnchor="55.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="150.0"> | |||
| <TableView fx:id="tbvTranstunai" layoutY="150.0" prefHeight="245.0" prefWidth="800.0" AnchorPane.bottomAnchor="55.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="150.0"> | |||
| <columns> | |||
| <TableColumn maxWidth="30.0" minWidth="30.0" prefWidth="30.0" resizable="false" text="No" /> | |||
| <TableColumn prefWidth="133.5999755859375" text="Kode Barang" /> | |||
| <TableColumn minWidth="0.0" prefWidth="88.0" text="Nama Barang" /> | |||
| <TableColumn minWidth="0.0" prefWidth="61.5999755859375" resizable="false" text="Ukur" /> | |||
| <TableColumn minWidth="52.0" prefWidth="84.0" text="Jumlah" /> | |||
| <TableColumn prefWidth="75.0" text="Harga" /> | |||
| <TableColumn prefWidth="75.0" text="Disc1" /> | |||
| <TableColumn prefWidth="75.0" text="Disc2" /> | |||
| <TableColumn prefWidth="75.0" text="Promo" /> | |||
| <TableColumn prefWidth="75.0" text="Sub Total" /> | |||
| <TableColumn prefWidth="75.0" text="Pramuniaga" /> | |||
| <TableColumn fx:id="tcNo" maxWidth="30.0" minWidth="30.0" prefWidth="30.0" resizable="false" text="No" /> | |||
| <TableColumn fx:id="tcKode" prefWidth="-1.0" text="Kode Barang" /> | |||
| <TableColumn fx:id="tcNama" minWidth="0.0" prefWidth="-1.0" text="Nama Barang" /> | |||
| <TableColumn fx:id="tcUkur" minWidth="0.0" prefWidth="61.5999755859375" text="Ukur" /> | |||
| <TableColumn fx:id="tcJumlah" minWidth="52.0" prefWidth="-1.0" text="Jumlah" /> | |||
| <TableColumn fx:id="tcHarga" prefWidth="-1.0" text="Harga" /> | |||
| <TableColumn fx:id="tcDisc1" prefWidth="-1.0" text="Disc1" /> | |||
| <TableColumn fx:id="tcDisc2" prefWidth="-1.0" text="Disc2" /> | |||
| <TableColumn fx:id="tcPromo" prefWidth="-1.0" text="Promo" /> | |||
| <TableColumn fx:id="tcSubtotal" prefWidth="-1.0" text="Sub Total" /> | |||
| <TableColumn fx:id="tcPramuniaga" prefWidth="-1.0" text="Pramuniaga" /> | |||
| </columns> | |||
| <columnResizePolicy> | |||
| <TableView fx:constant="CONSTRAINED_RESIZE_POLICY" /> | |||