|
|
|
|
@ -5,8 +5,11 @@
|
|
|
|
|
*/
|
|
|
|
|
package id.amigogroup.posterminal.bayar;
|
|
|
|
|
|
|
|
|
|
import id.amigogroup.posterminal.util.Fucout;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.net.URL;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.ResourceBundle;
|
|
|
|
|
import java.util.logging.Level;
|
|
|
|
|
import java.util.logging.Logger;
|
|
|
|
|
@ -16,6 +19,7 @@ import javafx.fxml.FXMLLoader;
|
|
|
|
|
import javafx.fxml.Initializable;
|
|
|
|
|
import javafx.scene.Node;
|
|
|
|
|
import javafx.scene.control.CheckBox;
|
|
|
|
|
import javafx.scene.control.Label;
|
|
|
|
|
import javafx.scene.layout.VBox;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -25,36 +29,71 @@ import javafx.scene.layout.VBox;
|
|
|
|
|
*/
|
|
|
|
|
public class FormBayarController implements Initializable {
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
private CheckBox chkTunai;
|
|
|
|
|
@FXML
|
|
|
|
|
private CheckBox chkKartu;
|
|
|
|
|
@FXML
|
|
|
|
|
private CheckBox chkPromo;
|
|
|
|
|
@FXML
|
|
|
|
|
private CheckBox chkRetur;
|
|
|
|
|
@FXML
|
|
|
|
|
private CheckBox chkGopay;
|
|
|
|
|
@FXML
|
|
|
|
|
private CheckBox chkOvo;
|
|
|
|
|
@FXML
|
|
|
|
|
private CheckBox chkPoin;
|
|
|
|
|
@FXML
|
|
|
|
|
private VBox vbContent;
|
|
|
|
|
@FXML
|
|
|
|
|
private Label lblGrandTotal;
|
|
|
|
|
|
|
|
|
|
private final String BAYAR_TUNAI = "Tunai";
|
|
|
|
|
private final String BAYAR_KARTU = "Debit/Kredit";
|
|
|
|
|
private final String BAYAR_RETUR = "Voucher Retur";
|
|
|
|
|
private final String BAYAR_PROMO = "Voucher Promo";
|
|
|
|
|
private final String BAYAR_RETUR = "Voucher Retur";
|
|
|
|
|
private final String BAYAR_GOPAY = "GoPay";
|
|
|
|
|
private final String BAYAR_OVO = "OVO";
|
|
|
|
|
private final String BAYAR_POIN = "Poin";
|
|
|
|
|
|
|
|
|
|
private List<CheckBox> daftarChkBayar;
|
|
|
|
|
|
|
|
|
|
public int totalBayar = 178800;
|
|
|
|
|
|
|
|
|
|
public class BayarContent {
|
|
|
|
|
|
|
|
|
|
Node nodeTunai;
|
|
|
|
|
int bayarTunai;
|
|
|
|
|
Node nodeKartu;
|
|
|
|
|
Node nodeRetur;
|
|
|
|
|
int bayarKartu;
|
|
|
|
|
Node nodePromo;
|
|
|
|
|
int bayarPromo;
|
|
|
|
|
Node nodeRetur;
|
|
|
|
|
int bayarRetur;
|
|
|
|
|
Node nodeGopay;
|
|
|
|
|
Node nodeOvo;
|
|
|
|
|
Node nodePoin;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private BayarContent kumpulanContent = new BayarContent();
|
|
|
|
|
public BayarContent kumpulanContent = new BayarContent();
|
|
|
|
|
|
|
|
|
|
public FormBayarController() {
|
|
|
|
|
daftarChkBayar = new ArrayList<>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initializes the controller class.
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void initialize(URL url, ResourceBundle rb) {
|
|
|
|
|
// TODO
|
|
|
|
|
lblGrandTotal.setText(Fucout.formatRupiah(totalBayar));
|
|
|
|
|
daftarChkBayar.add(chkTunai);
|
|
|
|
|
daftarChkBayar.add(chkKartu);
|
|
|
|
|
daftarChkBayar.add(chkPromo);
|
|
|
|
|
daftarChkBayar.add(chkRetur);
|
|
|
|
|
daftarChkBayar.add(chkGopay);
|
|
|
|
|
daftarChkBayar.add(chkOvo);
|
|
|
|
|
daftarChkBayar.add(chkPoin);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
@ -65,10 +104,13 @@ public class FormBayarController implements Initializable {
|
|
|
|
|
try {
|
|
|
|
|
switch (chkSource.getText()) {
|
|
|
|
|
case BAYAR_TUNAI:
|
|
|
|
|
chkSyaratValueOnChanged(chkSource);
|
|
|
|
|
if (kumpulanContent.nodeTunai == null && chkSource.selectedProperty().get()) {
|
|
|
|
|
loader.setLocation(getClass().getResource("/fxml/FormBayarTunai.fxml"));
|
|
|
|
|
node = loader.load();
|
|
|
|
|
|
|
|
|
|
FormBayarTunaiController fbtc = loader.getController();
|
|
|
|
|
fbtc.initData(this);
|
|
|
|
|
vbContent.getChildren().add(node);
|
|
|
|
|
kumpulanContent.nodeTunai = node;
|
|
|
|
|
} else {
|
|
|
|
|
@ -143,4 +185,24 @@ public class FormBayarController implements Initializable {
|
|
|
|
|
Logger.getLogger(FormBayarController.class.getName()).log(Level.SEVERE, null, ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void chkSyaratValueOnChanged(CheckBox chkSyarat) {
|
|
|
|
|
if (kumpulanContent.nodeTunai == null && chkSyarat.selectedProperty().get()) {
|
|
|
|
|
for (CheckBox chk : daftarChkBayar) {
|
|
|
|
|
if (chk != chkSyarat) {
|
|
|
|
|
chk.setDisable(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
for (CheckBox chk : daftarChkBayar) {
|
|
|
|
|
if (chk != chkSyarat) {
|
|
|
|
|
if (chk.selectedProperty().get()) {
|
|
|
|
|
chk.fire();
|
|
|
|
|
}
|
|
|
|
|
chk.setDisable(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|