Beispiel #1
0
  public sf.inventory.HargaJual getLatestHargaJual(String kbarang, String tglBukti)
      throws DAException {
    try {
      String strSQL =
          "SELECT a.*,b.nbarang,b.satuan FROM mhjual a,mproduk b where a.recstatus<>? and a.kbarang=b.kbarang and a.kbarang=? and a.ktanggal <=? order by a.ktanggal desc LIMIT 0,1";
      log.info(strSQL + "[0]" + kbarang + ",[1]" + tglBukti);
      PreparedStatement p = db.getStatement(strSQL);
      p.setString(1, "D");
      p.setString(2, kbarang);
      p.setString(3, tglBukti);
      Vector rows = db.getData(p);
      Vector v = (Vector) rows.get(0);
      sf.inventory.HargaJual item = new sf.inventory.HargaJual();
      item.setKbarang(v.get(0).toString());
      item.setKtanggal(v.get(1).toString());
      item.setKvaluta(v.get(2).toString());
      item.setNvaluta(Double.parseDouble(v.get(3).toString()));
      item.setPotongan(Double.parseDouble(v.get(4).toString()));

      item.setRecstatus(v.get(5).toString());
      item.setTglupdate(Long.parseLong(v.get(6).toString()));
      item.setUserupdate(v.get(7).toString());
      item.setNbarang(v.get(8).toString());
      item.setSatuan(v.get(9).toString());
      return item;
    } catch (Exception ex) {
      throw new DAException(ex.getLocalizedMessage());
    }
  }
Beispiel #2
0
  @SuppressWarnings("unchecked")
  public sf.inventory.HargaJual[] getHargaJual() throws DAException {
    sf.inventory.HargaJual[] items; // new Branch[count];
    try {
      String strSQL =
          "SELECT a.*,b.nbarang,b.satuan FROM mhjual a, mproduk b where a.recstatus<>? and a.kbarang=b.kbarang";
      PreparedStatement p = db.getStatement(strSQL);
      p.setString(1, "D");
      Vector rows = db.getData(p);
      int count = rows.size();
      items = new sf.inventory.HargaJual[count];
      for (int i = 0; i < count; i++) {
        Vector v = (Vector) rows.get(i);
        sf.inventory.HargaJual item = new sf.inventory.HargaJual();
        item.setKbarang(v.get(0).toString());
        item.setKtanggal(v.get(1).toString());
        item.setKvaluta(v.get(2).toString());
        item.setNvaluta(Double.parseDouble(v.get(3).toString()));
        item.setPotongan(Double.parseDouble(v.get(4).toString()));

        item.setRecstatus(v.get(5).toString());
        item.setTglupdate(Long.parseLong(v.get(6).toString()));
        item.setUserupdate(v.get(7).toString());
        item.setNbarang(v.get(8).toString());
        item.setSatuan(v.get(9).toString());
        items[i] = item;
      }
    } catch (Exception ex) {
      throw new DAException(ex.getLocalizedMessage());
    }

    return items;
  }