示例#1
0
  public void autoHarga() {
    double harga_tmp = 0;
    double jumlah_tmp = 0;
    double total1_tmp = 0;
    double diskon_tmp = 0;
    double diskonp_tmp = 0;
    double total_tmp = 0;
    double bayar_tmp = 0;
    try {
      harga.commitEdit();
      harga_tmp = Double.parseDouble(harga.getValue() + "");
    } catch (Exception e) {
      App.printErr(e);
    }
    try {
      jml.commitEdit();
      jumlah_tmp = Double.parseDouble(jml.getValue() + "");
    } catch (Exception e) {
      // App.showErrorJumlahTidakFalid();
      jml.setText("");
      App.printErr(e);
    }
    total1_tmp = harga_tmp * jumlah_tmp;
    total1.setValue(total1_tmp);

    try {
      diskon.commitEdit();
      diskon_tmp = Double.parseDouble(diskon.getValue() + "");
    } catch (Exception e) {
      diskon.setText("0");
      App.printErr(e);
    }
    try {
      diskonp.commitEdit();
      diskonp_tmp = Double.parseDouble(diskonp.getValue() + "");
    } catch (Exception e) {
      diskonp.setText("0");
      App.printErr(e);
    }

    double diskonp_rp = 0;
    if (diskonp_tmp > 0) {
      diskonp_rp = total1_tmp * diskonp_tmp / 100;
    }

    double total_diskon = diskon_tmp + diskonp_rp;
    App.info(total_diskon + "");
    total_tmp = total1_tmp - total_diskon;

    total.setValue(total_tmp);
    try {
      total.commitEdit();
    } catch (ParseException e) {
      App.printErr(e);
    }

    autoKembali();
  }
示例#2
0
  public void autoKembali() {
    double total_tmp = 0;
    double bayar_tmp = 0;
    double hutang_tmp = 0;
    double kembali_tmp = 0;

    if (!bayar.getText().equals("")) {
      try {
        bayar_tmp = Double.parseDouble(bayar.getText().replaceAll("\\,", ""));
      } catch (Exception e) {
        App.printErr(e);
      }
    }

    try {
      total.commitEdit();
      total_tmp = Double.parseDouble(total.getValue() + "");
    } catch (Exception e) {
      total.setText("0");
    }

    if (total_tmp > bayar_tmp) {
      hutang_tmp = total_tmp - bayar_tmp;
    } else {
      kembali_tmp = bayar_tmp - total_tmp;
    }

    k.setValue(hutang_tmp);
    kembali.setValue(kembali_tmp);
    try {
      k.commitEdit();
      kembali.commitEdit();
    } catch (ParseException e) {
      App.printErr(e);
    }
  }
示例#3
0
  @Override
  public void aksiReset() {
    code.setText("AUTO");

    tgl.setDate(new Date());
    clearText(pelanggan);

    cust = null;

    clearText(jml);
    double p = DataUser.getProduct().field(ProductDao.harga);
    harga.setValue(p);

    clearText(total1);
    diskon.setText("0");
    diskonp.setText("0.00");
    clearText(total);
    bayar.setText("");
    k.setText("0");
    kembali.setText("0");
    setCursor();
  }