Bläddra i källkod

Dialog Bayar Belum Lunas, Bayar Poin, Menampilkan Kekurangan Bayar

* [UI] Dialog Bayar Belum Lunas muncul jika menekan F10 tapi belum dibayar lunas
* [Logic + UI] Bayar poin + menampilkan akumulasi poin menggunakan konversi 1 = 100.000
* [UI] Menampilkan biaya yang belum terbayar di layar checkout bayar, termasuk hasil gabungan berbagai pembayaran
pull/2/head
Ronaldo Christnawan 5 år sedan
förälder
incheckning
b8dd662f84
16 ändrade filer med 807 tillägg och 116 borttagningar
  1. +6
    -3
      src/main/java/id/amigogroup/posterminal/FormUtamaController.java
  2. +236
    -0
      src/main/java/id/amigogroup/posterminal/bayar/BayarContent.java
  3. +25
    -0
      src/main/java/id/amigogroup/posterminal/bayar/BayarInterface.java
  4. +226
    -0
      src/main/java/id/amigogroup/posterminal/bayar/DialogSelesaiBayarTidakLunasController.java
  5. +121
    -77
      src/main/java/id/amigogroup/posterminal/bayar/FormBayarController.java
  6. +8
    -0
      src/main/java/id/amigogroup/posterminal/bayar/FormBayarKartuController.java
  7. +42
    -3
      src/main/java/id/amigogroup/posterminal/bayar/FormBayarPoinController.java
  8. +18
    -11
      src/main/java/id/amigogroup/posterminal/bayar/FormBayarTunaiController.java
  9. +3
    -3
      src/main/java/id/amigogroup/posterminal/model/Pelanggan.java
  10. +7
    -3
      src/main/java/id/amigogroup/posterminal/util/Fucout.java
  11. +81
    -0
      src/main/resources/fxml/DialogSelesaiBayarTidakLunas.fxml
  12. +9
    -4
      src/main/resources/fxml/FormBayar.fxml
  13. +1
    -1
      src/main/resources/fxml/FormBayarKartu.fxml
  14. +3
    -4
      src/main/resources/fxml/FormBayarPoin.fxml
  15. +3
    -0
      src/main/resources/fxml/FormBayarTunai.fxml
  16. +18
    -7
      src/main/resources/fxml/FormUtama.fxml

+ 6
- 3
src/main/java/id/amigogroup/posterminal/FormUtamaController.java Visa fil

@@ -72,6 +72,8 @@ public class FormUtamaController implements Initializable {
@FXML
private Label lblMemberNonMember;
@FXML
private Label lblKodePelanggan;
@FXML
private Label lblNamaPelanggan;
@FXML
private Label lblTglLahirPelanggan;
@@ -96,11 +98,11 @@ public class FormUtamaController implements Initializable {
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
//Kode Nur Indah Suciati (00334), Kode Wuryaningsih/RT (010004)
//Kode Sri Sumarmi (i140411), Nur Indah Suciati (00334), Kode Wuryaningsih/RT (010004)
updateLabelMemberNonMember();

Platform.runLater(() -> {
posRx.getPelangganByKodeMember("00334").subscribe(pelangganObserver);
posRx.getPelangganByKodeMember("i140411").subscribe(pelangganObserver);
});

if (SystemValue.karyawanLogin != null) {
@@ -116,7 +118,7 @@ public class FormUtamaController implements Initializable {
jumlahNota = 3;

btnTunai1Static.setOnAction((event) -> {
posRx.getPelangganByKodeMember("010004").subscribe(pelangganObserver);
// posRx.getPelangganByKodeMember("010004").subscribe(pelangganObserver);
setContent(loadNota("", FormConstanta.TRANSAKSI_TUNAI));
updateSelectedNota(event);
tipeNotaState = Fucout.TIPE_NOTA_TUNAI;
@@ -140,6 +142,7 @@ public class FormUtamaController implements Initializable {
alertUltah.initOwner(bpMain.getScene().getWindow());
alertUltah.show();
}
lblKodePelanggan.setText(Fucout.getTextColon(p.getAlias()));
lblNamaPelanggan.setText(Fucout.getTextColon(p.getNama()));
lblTglLahirPelanggan.setText(Fucout.getTextColon(Fucout.formatTanggal(p.getTglLahir())));
lblNoTelpPelanggan.setText(Fucout.getTextColon(


+ 236
- 0
src/main/java/id/amigogroup/posterminal/bayar/BayarContent.java Visa fil

@@ -0,0 +1,236 @@
/*
* 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.bayar;

import javafx.scene.Node;

/**
*
* @author ronal
*/
public class BayarContent {

private Node nodeTunai;
private int bayarTunai;
private Node nodeKartu;
private int bayarKartu;
private Node nodePromo;
private int bayarPromo;
private Node nodeRetur;
private int bayarRetur;
private Node nodeGopay;
private Node nodeOvo;
private Node nodePoin;
private int bayarPoin;

private int totalPerluBayar = 178800;
private int totalBayar = 0;

private void hitungBayar() {
totalBayar = bayarTunai + bayarKartu + bayarPromo + bayarRetur + bayarPoin;
}

/**
* @return the nodeTunai
*/
public Node getNodeTunai() {
return nodeTunai;
}

/**
* @param nodeTunai the nodeTunai to set
*/
public void setNodeTunai(Node nodeTunai) {
this.nodeTunai = nodeTunai;
}

/**
* @return the bayarTunai
*/
public int getBayarTunai() {
return bayarTunai;
}

/**
* @param bayarTunai the bayarTunai to set
*/
public void setBayarTunai(int bayarTunai) {
this.bayarTunai = bayarTunai;
hitungBayar();
}

/**
* @return the nodeKartu
*/
public Node getNodeKartu() {
return nodeKartu;
}

/**
* @param nodeKartu the nodeKartu to set
*/
public void setNodeKartu(Node nodeKartu) {
this.nodeKartu = nodeKartu;
}

/**
* @return the bayarKartu
*/
public int getBayarKartu() {
return bayarKartu;
}

/**
* @param bayarKartu the bayarKartu to set
*/
public void setBayarKartu(int bayarKartu) {
this.bayarKartu = bayarKartu;
hitungBayar();
}

/**
* @return the nodePromo
*/
public Node getNodePromo() {
return nodePromo;
}

/**
* @param nodePromo the nodePromo to set
*/
public void setNodePromo(Node nodePromo) {
this.nodePromo = nodePromo;
}

/**
* @return the bayarPromo
*/
public int getBayarPromo() {
return bayarPromo;
}

/**
* @param bayarPromo the bayarPromo to set
*/
public void setBayarPromo(int bayarPromo) {
this.bayarPromo = bayarPromo;
hitungBayar();
}

/**
* @return the nodeRetur
*/
public Node getNodeRetur() {
return nodeRetur;
}

/**
* @param nodeRetur the nodeRetur to set
*/
public void setNodeRetur(Node nodeRetur) {
this.nodeRetur = nodeRetur;
}

/**
* @return the bayarRetur
*/
public int getBayarRetur() {
return bayarRetur;
}

/**
* @param bayarRetur the bayarRetur to set
*/
public void setBayarRetur(int bayarRetur) {
this.bayarRetur = bayarRetur;
hitungBayar();
}

/**
* @return the nodeGopay
*/
public Node getNodeGopay() {
return nodeGopay;
}

/**
* @param nodeGopay the nodeGopay to set
*/
public void setNodeGopay(Node nodeGopay) {
this.nodeGopay = nodeGopay;
}

/**
* @return the nodeOvo
*/
public Node getNodeOvo() {
return nodeOvo;
}

/**
* @param nodeOvo the nodeOvo to set
*/
public void setNodeOvo(Node nodeOvo) {
this.nodeOvo = nodeOvo;
}

/**
* @return the nodePoin
*/
public Node getNodePoin() {
return nodePoin;
}

/**
* @param nodePoin the nodePoin to set
*/
public void setNodePoin(Node nodePoin) {
this.nodePoin = nodePoin;
}

/**
* @return the bayarPoin
*/
public int getBayarPoin() {
return bayarPoin;
}

/**
* @param bayarPoin the bayarPoin to set
*/
public void setBayarPoin(int bayarPoin) {
this.bayarPoin = bayarPoin;
hitungBayar();
}

/**
* @return the totalPerluBayar
*/
public int getTotalPerluBayar() {
return totalPerluBayar;
}

/**
* @param totalPerluBayar the totalPerluBayar to set
*/
public void setTotalPerluBayar(int totalPerluBayar) {
this.totalPerluBayar = totalPerluBayar;
}

/**
* @return the totalBayar
*/
public int getTotalBayar() {
return totalBayar;
}

/**
* @param totalBayar the totalBayar to set
*/
public void setTotalBayar(int totalBayar) {
this.totalBayar = totalBayar;
}
}

+ 25
- 0
src/main/java/id/amigogroup/posterminal/bayar/BayarInterface.java Visa fil

@@ -0,0 +1,25 @@
/*
* 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.bayar;

import javafx.scene.Node;

/**
*
* @author ronal
*/
public interface BayarInterface {
final String BAYAR_TUNAI = "Tunai";
final String BAYAR_KARTU = "Debit/Kredit";
final String BAYAR_PROMO = "Voucher Promo";
final String BAYAR_RETUR = "Voucher Retur";
final String BAYAR_GOPAY = "GoPay";
final String BAYAR_OVO = "OVO";
final String BAYAR_POIN = "Poin";
public BayarContent getBayarContent();
public void updateKurangBayarView();
}

+ 226
- 0
src/main/java/id/amigogroup/posterminal/bayar/DialogSelesaiBayarTidakLunasController.java Visa fil

@@ -0,0 +1,226 @@
/*
* 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.bayar;

import id.amigogroup.posterminal.pencarian.DialogCariBarangController;
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;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Dialog;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.stage.Window;

/**
* FXML Controller class
*
* @author ronal
*/
public class DialogSelesaiBayarTidakLunasController extends Dialog implements Initializable, BayarInterface {

@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 lblPerluBayar;

private BayarInterface parent;
private int kurangBayar;

private List<CheckBox> daftarChkBayarSyarat;
private List<CheckBox> daftarChkBayarOpsional;
public BayarContent bayarContent = new BayarContent();

/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
daftarChkBayarSyarat.add(chkTunai);
daftarChkBayarSyarat.add(chkKartu);
daftarChkBayarOpsional.add(chkPromo);
daftarChkBayarOpsional.add(chkRetur);
daftarChkBayarOpsional.add(chkGopay);
daftarChkBayarOpsional.add(chkOvo);
daftarChkBayarOpsional.add(chkPoin);
}

public DialogSelesaiBayarTidakLunasController(BayarInterface parent, int kurangBayar) {
this.daftarChkBayarSyarat = new ArrayList<>();
this.daftarChkBayarOpsional = new ArrayList<>();
this.parent = parent;
bayarContent.setTotalPerluBayar(kurangBayar);

try {
Window window = getDialogPane().getScene().getWindow();
window.setOnCloseRequest(event -> this.close());

FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/DialogSelesaiBayarTidakLunas.fxml"));
loader.setController(this);
Parent root = loader.load();
getDialogPane().setContent(root);

setTitle("Pembayaran Belum Lunas!");
lblPerluBayar.setText(Fucout.getTextColon(Fucout.formatRupiah(
bayarContent.getTotalPerluBayar())));
} catch (IOException e) {
Logger.getLogger(DialogCariBarangController.class
.getName()).log(Level.SEVERE, null, e);
}
}

@FXML
void chkPilihanOnAction(ActionEvent event) {
CheckBox chkSource = (CheckBox) event.getSource();
FXMLLoader loader = new FXMLLoader();
Node node = null;
try {
switch (chkSource.getText()) {
case FormBayarController.BAYAR_TUNAI:
if (bayarContent.getNodeTunai() == 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);
bayarContent.setNodeTunai(node);
} else {
if (bayarContent.getNodeTunai() != null) {
vbContent.getChildren().remove(bayarContent.getNodeTunai());
bayarContent.setNodeTunai(null);
}
}
break;
case FormBayarController.BAYAR_KARTU:
if (bayarContent.getNodeKartu() == null && chkSource.selectedProperty().get()) {
loader.setLocation(getClass().getResource("/fxml/FormBayarKartu.fxml"));
node = loader.load();

vbContent.getChildren().add(node);
bayarContent.setNodeKartu(node);
} else {
if (bayarContent.getNodeKartu() != null) {
vbContent.getChildren().remove(bayarContent.getNodeKartu());
bayarContent.setNodeKartu(null);
}
}
break;
case FormBayarController.BAYAR_RETUR:
if (bayarContent.getNodeRetur() == null && chkSource.selectedProperty().get()) {
loader.setLocation(getClass().getResource("/fxml/FormBayarRetur.fxml"));
node = loader.load();

vbContent.getChildren().add(node);
bayarContent.setNodeRetur(node);
} else {
if (bayarContent.getNodeRetur() != null) {
vbContent.getChildren().remove(bayarContent.getNodeRetur());
bayarContent.setNodeRetur(null);
}
}
break;
case FormBayarController.BAYAR_PROMO:
if (bayarContent.getNodePromo() == null && chkSource.selectedProperty().get()) {
loader.setLocation(getClass().getResource("/fxml/FormBayarVoucherPromo.fxml"));
node = loader.load();

vbContent.getChildren().add(node);
bayarContent.setNodePromo(node);
} else {
if (bayarContent.getNodePromo() != null) {
vbContent.getChildren().remove(bayarContent.getNodePromo());
bayarContent.setNodePromo(null);
}
}
break;
case FormBayarController.BAYAR_GOPAY:
break;
case FormBayarController.BAYAR_OVO:
break;
case FormBayarController.BAYAR_POIN:
if (bayarContent.getNodePoin() == null && chkSource.selectedProperty().get()) {
loader.setLocation(getClass().getResource("/fxml/FormBayarPoin.fxml"));
node = loader.load();

vbContent.getChildren().add(node);
bayarContent.setNodePoin(node);
} else {
if (bayarContent.getNodePoin() != null) {
vbContent.getChildren().remove(bayarContent.getNodePoin());
bayarContent.setNodePoin(null);
}
}
break;
}

if (daftarChkBayarSyarat.contains(chkSource)) {
chkSyaratValueOnChanged();
}
} catch (IOException ex) {
Logger.getLogger(FormBayarController.class.getName()).log(Level.SEVERE, null, ex);
}
}

private void chkSyaratValueOnChanged() {
boolean isSyaratTerpenuhi = false;
for (CheckBox chkSyarat : daftarChkBayarSyarat) {
if (chkSyarat.selectedProperty().get()) {
isSyaratTerpenuhi = true;
break;
}
}

if (isSyaratTerpenuhi) {
for (CheckBox chk : daftarChkBayarOpsional) {
chk.setDisable(false);
}
} else {
for (CheckBox chk : daftarChkBayarOpsional) {
if (chk.selectedProperty().get()) {
chk.fire();
}
chk.setDisable(true);
}
}
}

@Override
public BayarContent getBayarContent() {
return bayarContent;
}

@Override
public void updateKurangBayarView() {
lblPerluBayar.setText(Fucout.getTextColon(Fucout.formatRupiah(
bayarContent.getTotalPerluBayar() - bayarContent.getTotalBayar())));
}
}

+ 121
- 77
src/main/java/id/amigogroup/posterminal/bayar/FormBayarController.java Visa fil

@@ -9,10 +9,13 @@ import id.amigogroup.posterminal.util.Fucout;
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.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
@@ -20,6 +23,10 @@ import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyCodeCombination;
import javafx.scene.input.KeyCombination;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.VBox;

/**
@@ -27,8 +34,10 @@ import javafx.scene.layout.VBox;
*
* @author ronal
*/
public class FormBayarController implements Initializable {
public class FormBayarController implements Initializable, BayarInterface {

@FXML
private AnchorPane apContent;
@FXML
private CheckBox chkTunai;
@FXML
@@ -44,41 +53,19 @@ public class FormBayarController implements Initializable {
@FXML
private CheckBox chkPoin;
@FXML
private Label lblKurangBayar;
@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_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;
int bayarKartu;
Node nodePromo;
int bayarPromo;
Node nodeRetur;
int bayarRetur;
Node nodeGopay;
Node nodeOvo;
Node nodePoin;
}

public BayarContent kumpulanContent = new BayarContent();
private final List<CheckBox> daftarChkBayarSyarat;
private final List<CheckBox> daftarChkBayarOpsional;
public BayarContent bayarContent = new BayarContent();

public FormBayarController() {
daftarChkBayar = new ArrayList<>();
daftarChkBayarSyarat = new ArrayList<>();
daftarChkBayarOpsional = new ArrayList<>();
}

/**
@@ -86,14 +73,40 @@ public class FormBayarController implements Initializable {
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
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);
lblGrandTotal.setText(Fucout.formatRupiah(bayarContent.getTotalPerluBayar()));
lblKurangBayar.setText(Fucout.formatRupiah(bayarContent.getTotalPerluBayar()));
daftarChkBayarSyarat.add(chkTunai);
daftarChkBayarSyarat.add(chkKartu);
daftarChkBayarOpsional.add(chkPromo);
daftarChkBayarOpsional.add(chkRetur);
daftarChkBayarOpsional.add(chkGopay);
daftarChkBayarOpsional.add(chkOvo);
daftarChkBayarOpsional.add(chkPoin);

initShortcuts();
}

private void initShortcuts() {
Map<KeyCombination, Runnable> listShortcuts = new HashMap<>();

KeyCombination kcSelesaiBayar = new KeyCodeCombination(KeyCode.F10);
Runnable rnSelesaiBayar = () -> {
if (bayarContent.getTotalBayar() >= bayarContent.getTotalPerluBayar()) {

} else {
DialogSelesaiBayarTidakLunasController dsbtlc
= new DialogSelesaiBayarTidakLunasController(this,
bayarContent.getTotalPerluBayar()
- bayarContent.getTotalBayar());
dsbtlc.initOwner(apContent.getScene().getWindow());
dsbtlc.show();
}
};
listShortcuts.put(kcSelesaiBayar, rnSelesaiBayar);

Platform.runLater(() -> {
apContent.getScene().getAccelerators().putAll(listShortcuts);
});
}

@FXML
@@ -104,61 +117,70 @@ public class FormBayarController implements Initializable {
try {
switch (chkSource.getText()) {
case BAYAR_TUNAI:
chkSyaratValueOnChanged(chkSource);
if (kumpulanContent.nodeTunai == null && chkSource.selectedProperty().get()) {
if (bayarContent.getNodeTunai() == 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;
bayarContent.setNodeTunai(node);
} else {
if (kumpulanContent.nodeTunai != null) {
vbContent.getChildren().remove(kumpulanContent.nodeTunai);
kumpulanContent.nodeTunai = null;
if (bayarContent.getNodeTunai() != null) {
vbContent.getChildren().remove(bayarContent.getNodeTunai());
bayarContent.setNodeTunai(null);
bayarContent.setBayarTunai(0);
updateKurangBayarView();
}
}
break;
case BAYAR_KARTU:
if (kumpulanContent.nodeKartu == null && chkSource.selectedProperty().get()) {
if (bayarContent.getNodeKartu() == null && chkSource.selectedProperty().get()) {
loader.setLocation(getClass().getResource("/fxml/FormBayarKartu.fxml"));
node = loader.load();

FormBayarKartuController fbkc = loader.getController();
fbkc.initData(this);
vbContent.getChildren().add(node);
kumpulanContent.nodeKartu = node;
bayarContent.setNodeKartu(node);
} else {
if (kumpulanContent.nodeKartu != null) {
vbContent.getChildren().remove(kumpulanContent.nodeKartu);
kumpulanContent.nodeKartu = null;
if (bayarContent.getNodeKartu() != null) {
vbContent.getChildren().remove(bayarContent.getNodeKartu());
bayarContent.setNodeKartu(null);
bayarContent.setBayarKartu(0);
updateKurangBayarView();
}
}
break;
case BAYAR_RETUR:
if (kumpulanContent.nodeRetur == null && chkSource.selectedProperty().get()) {
if (bayarContent.getNodeRetur() == null && chkSource.selectedProperty().get()) {
loader.setLocation(getClass().getResource("/fxml/FormBayarRetur.fxml"));
node = loader.load();

vbContent.getChildren().add(node);
kumpulanContent.nodeRetur = node;
bayarContent.setNodeRetur(node);
} else {
if (kumpulanContent.nodeRetur != null) {
vbContent.getChildren().remove(kumpulanContent.nodeRetur);
kumpulanContent.nodeRetur = null;
if (bayarContent.getNodeRetur() != null) {
vbContent.getChildren().remove(bayarContent.getNodeRetur());
bayarContent.setNodeRetur(null);
bayarContent.setBayarRetur(0);
updateKurangBayarView();
}
}
break;
case BAYAR_PROMO:
if (kumpulanContent.nodePromo == null && chkSource.selectedProperty().get()) {
if (bayarContent.getNodePromo() == null && chkSource.selectedProperty().get()) {
loader.setLocation(getClass().getResource("/fxml/FormBayarVoucherPromo.fxml"));
node = loader.load();

vbContent.getChildren().add(node);
kumpulanContent.nodePromo = node;
bayarContent.setNodePromo(node);
} else {
if (kumpulanContent.nodePromo != null) {
vbContent.getChildren().remove(kumpulanContent.nodePromo);
kumpulanContent.nodePromo = null;
if (bayarContent.getNodePromo() != null) {
vbContent.getChildren().remove(bayarContent.getNodePromo());
bayarContent.setNodePromo(null);
bayarContent.setBayarPromo(0);
updateKurangBayarView();
}
}
break;
@@ -167,42 +189,64 @@ public class FormBayarController implements Initializable {
case BAYAR_OVO:
break;
case BAYAR_POIN:
if (kumpulanContent.nodePoin == null && chkSource.selectedProperty().get()) {
if (bayarContent.getNodePoin() == null && chkSource.selectedProperty().get()) {
loader.setLocation(getClass().getResource("/fxml/FormBayarPoin.fxml"));
node = loader.load();

FormBayarPoinController fbpc = loader.getController();
fbpc.initData(this);
vbContent.getChildren().add(node);
kumpulanContent.nodePoin = node;
bayarContent.setNodePoin(node);
} else {
if (kumpulanContent.nodePoin != null) {
vbContent.getChildren().remove(kumpulanContent.nodePoin);
kumpulanContent.nodePoin = null;
if (bayarContent.getNodePoin() != null) {
vbContent.getChildren().remove(bayarContent.getNodePoin());
bayarContent.setNodePoin(null);
bayarContent.setBayarPoin(0);
updateKurangBayarView();
}
}
break;
}

if (daftarChkBayarSyarat.contains(chkSource)) {
chkSyaratValueOnChanged();
}
} catch (IOException ex) {
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);
}
private void chkSyaratValueOnChanged() {
boolean isSyaratTerpenuhi = false;
for (CheckBox chkSyarat : daftarChkBayarSyarat) {
if (chkSyarat.selectedProperty().get()) {
isSyaratTerpenuhi = true;
break;
}
}

if (isSyaratTerpenuhi) {
for (CheckBox chk : daftarChkBayarOpsional) {
chk.setDisable(false);
}
} else {
for (CheckBox chk : daftarChkBayar) {
if (chk != chkSyarat) {
if (chk.selectedProperty().get()) {
chk.fire();
}
chk.setDisable(true);
for (CheckBox chk : daftarChkBayarOpsional) {
if (chk.selectedProperty().get()) {
chk.fire();
}
chk.setDisable(true);
}
}
}

@Override
public BayarContent getBayarContent() {
return bayarContent;
}

@Override
public void updateKurangBayarView() {
lblKurangBayar.setText(Fucout.formatRupiah(
bayarContent.getTotalPerluBayar() - bayarContent.getTotalBayar()));
}
}

+ 8
- 0
src/main/java/id/amigogroup/posterminal/bayar/FormBayarKartuController.java Visa fil

@@ -31,6 +31,7 @@ public class FormBayarKartuController implements Initializable {
@FXML
private TextField fldNoKartu4;

private BayarInterface parent;
/**
* Initializes the controller class.
*/
@@ -39,6 +40,13 @@ public class FormBayarKartuController implements Initializable {
initComponents();
}

public void initData(BayarInterface parent) {
this.parent = parent;
parent.getBayarContent().setBayarKartu(50000);
parent.updateKurangBayarView();
}

private void initComponents() {
Fucout.forceFieldInteger(fldNoKartu1, 4);
Fucout.forceFieldInteger(fldNoKartu2, 4);


+ 42
- 3
src/main/java/id/amigogroup/posterminal/bayar/FormBayarPoinController.java Visa fil

@@ -5,9 +5,15 @@
*/
package id.amigogroup.posterminal.bayar;

import id.amigogroup.posterminal.SystemValue;
import id.amigogroup.posterminal.util.Fucout;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyEvent;

/**
* FXML Controller class
@@ -16,12 +22,45 @@ import javafx.fxml.Initializable;
*/
public class FormBayarPoinController implements Initializable {

@FXML
private TextField fldPoin;
@FXML
private Label lblPoin;

private BayarInterface parent;

/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}
int poin = 0;
if (SystemValue.member != null) {
lblPoin.setText(Fucout.getTextColon(
String.valueOf(SystemValue.member.getPoin())));
poin = SystemValue.member.getPoin();
}
Fucout.forceFieldInteger(fldPoin, poin);
}

public void initData(BayarInterface parent) {
this.parent = parent;
}

@FXML
void fldPoinOnKeyReleased(KeyEvent event) {
int poin = 0;
if (!fldPoin.getText().equals("")) {
try {
poin = Integer.parseInt(fldPoin.getText());
} catch (NumberFormatException nfe) {
}
}
if (parent != null && parent.getBayarContent().getNodePoin() != null) {
parent.getBayarContent().setBayarPoin(poin * Fucout.KONVERSI_POIN);
parent.updateKurangBayarView();
}

}

}

+ 18
- 11
src/main/java/id/amigogroup/posterminal/bayar/FormBayarTunaiController.java Visa fil

@@ -26,7 +26,7 @@ public class FormBayarTunaiController implements Initializable {
@FXML
private Label lblKembalian;

private FormBayarController parent;
private BayarInterface parent;

/**
* Initializes the controller class.
@@ -36,24 +36,31 @@ public class FormBayarTunaiController implements Initializable {
Fucout.forceFieldInteger(fldBayar, Integer.MAX_VALUE);
}

public void initData(FormBayarController parent) {
public void initData(BayarInterface parent) {
this.parent = parent;
}

@FXML
void fldBayarOnKeyReleased(KeyEvent event) {
if (parent != null && parent.kumpulanContent.nodeTunai != null
&& !fldBayar.getText().equals("")) {
int bayar = 0;
if (!fldBayar.getText().equals("")) {
try {
int bayar = Integer.parseInt(fldBayar.getText());
if (parent.totalBayar < bayar) {
int kembali = bayar - parent.totalBayar;
lblKembalian.setText(Fucout.formatRibuan(kembali));
} else {
lblKembalian.setText("-");
}
bayar = Integer.parseInt(fldBayar.getText());
} catch (NumberFormatException nfe) {
}
}
if (parent != null && parent.getBayarContent().getNodeTunai() != null) {
parent.getBayarContent().setBayarTunai(bayar);
parent.updateKurangBayarView();

if (parent.getBayarContent().getTotalPerluBayar() <
parent.getBayarContent().getTotalBayar()) {
int kembali = parent.getBayarContent().getTotalBayar()
- parent.getBayarContent().getTotalPerluBayar();
lblKembalian.setText(Fucout.formatRibuan(kembali));
} else {
lblKembalian.setText("-");
}
}
}


+ 3
- 3
src/main/java/id/amigogroup/posterminal/model/Pelanggan.java Visa fil

@@ -113,7 +113,7 @@ public class Pelanggan {
@JsonProperty("saldonetbon")
private Integer saldonetbon;
@JsonProperty("poin")
private Integer poin;
private int poin;
@JsonProperty("gambar")
private String gambar;
@JsonProperty("firebase_uid")
@@ -430,12 +430,12 @@ public class Pelanggan {
}

@JsonProperty("poin")
public Integer getPoin() {
public int getPoin() {
return poin;
}

@JsonProperty("poin")
public void setPoin(Integer poin) {
public void setPoin(int poin) {
this.poin = poin;
}



+ 7
- 3
src/main/java/id/amigogroup/posterminal/util/Fucout.java Visa fil

@@ -32,6 +32,9 @@ public class Fucout {
public static final String TIPE_NOTA_BAWA = "Bawa Dulu";
public static final String TIPE_NOTA_RETUR = "Retur";

//VALUES
public static final int KONVERSI_POIN = 100000;

//IMAGES URL
public static final String APP_ICON = "/assets/logo-mini-squared.png";

@@ -123,17 +126,18 @@ public class Fucout {

return nf.format(price);
}
public static boolean checkBirthday(Date tanggal) {
return checkBirthday(toLocalDate(tanggal));
}

public static boolean checkBirthday(LocalDate tanggal) {
if (tanggal == null) {
return false;
}
LocalDate now = LocalDate.now();
return tanggal.getMonthValue() == now.getMonthValue() &&
tanggal.getDayOfMonth() == now.getDayOfMonth();
return tanggal.getMonthValue() == now.getMonthValue()
&& tanggal.getDayOfMonth() == now.getDayOfMonth();
}

public static LocalDate toLocalDate(Date date) {


+ 81
- 0
src/main/resources/fxml/DialogSelesaiBayarTidakLunas.fxml Visa fil

@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>


<AnchorPane id="AnchorPane" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/11.0.1">
<children>
<Label layoutX="14.0" layoutY="14.0" text="Bayar" AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="4.0">
<font>
<Font name="System Bold" size="16.0" />
</font>
</Label>
<HBox layoutX="4.0" layoutY="29.0" AnchorPane.leftAnchor="4.0" AnchorPane.rightAnchor="4.0" AnchorPane.topAnchor="29.0">
<children>
<Label text="Sisa yang kurang dibayarkan">
<font>
<Font size="14.0" />
</font>
</Label>
<Label fx:id="lblPerluBayar" text=": -">
<font>
<Font size="14.0" />
</font>
<HBox.margin>
<Insets left="5.0" />
</HBox.margin>
</Label>
</children>
</HBox>
<ScrollPane fitToHeight="true" layoutX="-10.0" layoutY="29.0" minHeight="0.0" minWidth="0.0" prefHeight="40.0" style="-fx-background-color: transparent;" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="59.0">
<content>
<HBox spacing="5.0">
<children>
<CheckBox fx:id="chkTunai" mnemonicParsing="false" onAction="#chkPilihanOnAction" text="Tunai">
<HBox.margin>
<Insets right="10.0" />
</HBox.margin>
</CheckBox>
<CheckBox fx:id="chkKartu" mnemonicParsing="false" onAction="#chkPilihanOnAction" text="Debit/Kredit">
<HBox.margin>
<Insets right="10.0" />
</HBox.margin>
</CheckBox>
<CheckBox fx:id="chkPromo" disable="true" mnemonicParsing="false" onAction="#chkPilihanOnAction" text="Voucher Promo" />
<CheckBox fx:id="chkRetur" disable="true" mnemonicParsing="false" onAction="#chkPilihanOnAction" text="Voucher Retur" />
<CheckBox fx:id="chkGopay" disable="true" mnemonicParsing="false" onAction="#chkPilihanOnAction" text="Gopay">
<HBox.margin>
<Insets right="10.0" />
</HBox.margin>
</CheckBox>
<CheckBox fx:id="chkOvo" disable="true" mnemonicParsing="false" onAction="#chkPilihanOnAction" text="OVO">
<HBox.margin>
<Insets right="10.0" />
</HBox.margin>
</CheckBox>
<CheckBox fx:id="chkPoin" disable="true" mnemonicParsing="false" onAction="#chkPilihanOnAction" text="Poin">
<HBox.margin>
<Insets right="10.0" />
</HBox.margin>
</CheckBox>
</children>
</HBox>
</content>
<padding>
<Insets bottom="5.0" left="14.0" right="14.0" top="5.0" />
</padding>
</ScrollPane>
<ScrollPane fitToWidth="true" layoutX="8.0" layoutY="69.0" style="-fx-background-color: transparent;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="99.0">
<content>
<VBox fx:id="vbContent" />
</content>
</ScrollPane>
</children>
</AnchorPane>

+ 9
- 4
src/main/resources/fxml/FormBayar.fxml Visa fil

@@ -10,7 +10,7 @@
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>

<AnchorPane id="AnchorPane" minHeight="-Infinity" minWidth="-Infinity" prefHeight="300.0" prefWidth="450.0" stylesheets="@../styles/pos_styles.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="id.amigogroup.posterminal.bayar.FormBayarController">
<AnchorPane id="AnchorPane" fx:id="apContent" minHeight="-Infinity" minWidth="-Infinity" prefHeight="350.0" prefWidth="450.0" stylesheets="@../styles/pos_styles.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="id.amigogroup.posterminal.bayar.FormBayarController">
<children>
<Label layoutX="14.0" layoutY="14.0" text="Bayar" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="14.0">
<font>
@@ -26,7 +26,7 @@
<Insets right="10.0" />
</HBox.margin>
</CheckBox>
<CheckBox fx:id="chkKartu" disable="true" mnemonicParsing="false" onAction="#chkPilihanOnAction" text="Debit/Kredit">
<CheckBox fx:id="chkKartu" mnemonicParsing="false" onAction="#chkPilihanOnAction" text="Debit/Kredit">
<HBox.margin>
<Insets right="10.0" />
</HBox.margin>
@@ -55,14 +55,19 @@
<Insets bottom="5.0" left="14.0" right="14.0" top="5.0" />
</padding>
</ScrollPane>
<ScrollPane fitToWidth="true" layoutY="73.0" style="-fx-background-color: transparent;" AnchorPane.bottomAnchor="55.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="73.0">
<ScrollPane fitToWidth="true" layoutY="73.0" style="-fx-background-color: transparent;" AnchorPane.bottomAnchor="105.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="73.0">
<content>
<VBox fx:id="vbContent" />
</content>
</ScrollPane>
<Label fx:id="lblKurangBayar" alignment="CENTER_RIGHT" layoutX="153.0" layoutY="242.0" maxWidth="1.7976931348623157E308" text="Rp99.999.999,00" textAlignment="RIGHT" textFill="#7c7c7c" AnchorPane.bottomAnchor="55.0" AnchorPane.leftAnchor="153.0" AnchorPane.rightAnchor="14.0">
<font>
<Font name="System Bold" size="36.0" />
</font>
</Label>
<StackPane id="price-background" alignment="CENTER_RIGHT" layoutX="77.0" layoutY="245.0" maxHeight="1.7976931348623157E308" prefHeight="55.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
<children>
<Label fx:id="lblGrandTotal" text="Rp99.999.999,00" textAlignment="RIGHT" textFill="YELLOW">
<Label fx:id="lblGrandTotal" alignment="CENTER_RIGHT" maxWidth="1.7976931348623157E308" text="Rp99.999.999,00" textAlignment="RIGHT" textFill="YELLOW">
<font>
<Font name="System Bold" size="36.0" />
</font>


+ 1
- 1
src/main/resources/fxml/FormBayarKartu.fxml Visa fil

@@ -15,7 +15,7 @@
<AnchorPane id="AnchorPane" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="id.amigogroup.posterminal.bayar.FormBayarKartuController">
<children>
<Separator layoutX="30.0" layoutY="13.0" prefWidth="200.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="5.0" />
<Label layoutX="15.0" layoutY="14.0" text="Non Tunai" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="14.0">
<Label layoutX="15.0" layoutY="14.0" text="Non Tunai - diset statis bayar 50rb" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="14.0">
<font>
<Font size="16.0" />
</font>


+ 3
- 4
src/main/resources/fxml/FormBayarPoin.fxml Visa fil

@@ -11,8 +11,7 @@
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>


<AnchorPane id="AnchorPane" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/11.0.1" fx:controller="id.amigogroup.posterminal.bayar.FormBayarPoinController">
<AnchorPane id="AnchorPane" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="id.amigogroup.posterminal.bayar.FormBayarPoinController">
<children>
<Label layoutX="14.0" layoutY="14.0" text="Poin" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="14.0">
<font>
@@ -46,12 +45,12 @@
<Insets right="2.5" top="2.5" />
</GridPane.margin>
</Label>
<TextField alignment="CENTER_RIGHT" GridPane.columnIndex="3" GridPane.rowIndex="1">
<TextField fx:id="fldPoin" alignment="CENTER_RIGHT" onKeyReleased="#fldPoinOnKeyReleased" GridPane.columnIndex="3" GridPane.rowIndex="1">
<GridPane.margin>
<Insets left="5.0" top="2.5" />
</GridPane.margin>
</TextField>
<Label text=": -" GridPane.columnIndex="3">
<Label fx:id="lblPoin" text=": -" GridPane.columnIndex="3">
<GridPane.margin>
<Insets bottom="2.5" left="5.0" />
</GridPane.margin>


+ 3
- 0
src/main/resources/fxml/FormBayarTunai.fxml Visa fil

@@ -47,6 +47,9 @@
<GridPane.margin>
<Insets left="5.0" right="2.5" top="2.5" />
</GridPane.margin>
<font>
<Font name="System Bold" size="12.0" />
</font>
</Label>
</children>
</GridPane>


+ 18
- 7
src/main/resources/fxml/FormUtama.fxml Visa fil

@@ -81,7 +81,7 @@
</GridPane>
</bottom>
<left>
<SplitPane dividerPositions="0.6" orientation="VERTICAL" prefWidth="200.0">
<SplitPane dividerPositions="0.45" orientation="VERTICAL" prefWidth="200.0">
<items>
<ScrollPane fx:id="spNavigasi" fitToHeight="true" fitToWidth="true" style="-fx-background-color: transparent;">
<content>
@@ -139,33 +139,44 @@
<RowConstraints valignment="TOP" vgrow="SOMETIMES" />
<RowConstraints valignment="TOP" vgrow="SOMETIMES" />
<RowConstraints valignment="TOP" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" valignment="TOP" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Nama">
<Label text="Nama" GridPane.rowIndex="1">
<GridPane.margin>
<Insets bottom="2.5" top="2.5" />
</GridPane.margin>
</Label>
<Label fx:id="lblNamaPelanggan" maxWidth="110.0" text=": -" wrapText="true" GridPane.columnIndex="1">
<Label fx:id="lblNamaPelanggan" maxWidth="110.0" text=": -" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="1">
<GridPane.margin>
<Insets bottom="2.5" top="2.5" />
</GridPane.margin></Label>
<Label text="Tgl Lahir" GridPane.rowIndex="1">
<Label text="Tgl Lahir" GridPane.rowIndex="2">
<GridPane.margin>
<Insets bottom="2.5" top="2.5" />
</GridPane.margin>
</Label>
<Label fx:id="lblTglLahirPelanggan" maxWidth="110.0" text=": -" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="1">
<Label fx:id="lblTglLahirPelanggan" maxWidth="110.0" text=": -" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="2">
<GridPane.margin>
<Insets bottom="2.5" top="2.5" />
</GridPane.margin>
</Label>
<Label text="No Telp" GridPane.rowIndex="2">
<Label text="No Telp" GridPane.rowIndex="3">
<GridPane.margin>
<Insets bottom="2.5" top="2.5" />
</GridPane.margin>
</Label>
<Label fx:id="lblNoTelpPelanggan" maxWidth="110.0" text=": -" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="2">
<Label fx:id="lblNoTelpPelanggan" maxWidth="110.0" text=": -" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="3">
<GridPane.margin>
<Insets bottom="2.5" top="2.5" />
</GridPane.margin>
</Label>
<Label text="Kode">
<GridPane.margin>
<Insets bottom="2.5" top="2.5" />
</GridPane.margin>
</Label>
<Label fx:id="lblKodePelanggan" maxWidth="110.0" text=": -" wrapText="true" GridPane.columnIndex="1">
<GridPane.margin>
<Insets bottom="2.5" top="2.5" />
</GridPane.margin>


Laddar…
Avbryt
Spara