Exemplo n.º 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());
    }
  }
Exemplo n.º 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;
  }
Exemplo n.º 3
0
 public boolean deleteHargaJual(String kbarang) throws DAException {
   String strSQL = "DELETE FROM mhjual where kbarang=?";
   try {
     PreparedStatement p = db.getStatement(strSQL);
     p.setString(1, kbarang);
     return db.execute(p);
   } catch (SQLException e) {
     // TODO Auto-generated catch block
     throw new DAException(e.getMessage());
   }
 }
Exemplo n.º 4
0
  public boolean updateHargaJual(sf.inventory.HargaJual hj) throws DAException {
    if (hj.checkIsNULL()) {
      throw new DAException(hj.getErr());
    }

    String strSQL =
        "UPDATE mhjual SET nvaluta=?,potongan=?,recstatus=?,tglupdate=?,userupdate=? where kbarang=? and ktanggal=? and kvaluta=?";
    try {
      PreparedStatement p = db.getStatement(strSQL);
      p.setDouble(1, hj.getNvaluta());
      p.setDouble(2, hj.getPotongan());
      p.setString(3, hj.getRecstatus());
      p.setLong(4, hj.getTglupdate());
      p.setString(5, hj.getUserupdate());
      p.setString(6, hj.getKbarang());
      p.setString(7, hj.getKtanggal());
      p.setString(8, hj.getKvaluta());
      return db.execute(p);
    } catch (SQLException e) {
      // TODO Auto-generated catch block
      throw new DAException(e.getMessage());
    }
  }
Exemplo n.º 5
0
  public boolean insertHargaJual(sf.inventory.HargaJual hj) throws DAException {
    if (hj.checkIsNULL()) {
      throw new DAException(hj.getErr());
    }

    String strSQL = "INSERT INTO mhjual values (?,?,?,?,?,?,?,?,?,?)";
    try {
      PreparedStatement p = db.getStatement(strSQL);
      p.setString(1, hj.getKbarang());
      p.setString(2, hj.getKtanggal());
      p.setString(3, hj.getKvaluta());
      p.setDouble(4, hj.getNvaluta());
      p.setDouble(5, hj.getPotongan());
      p.setString(6, hj.getRecstatus());
      p.setString(7, hj.getUserinput());
      p.setLong(8, hj.getTglinput());
      p.setLong(9, hj.getTglupdate());
      p.setString(10, hj.getUserupdate());
      return db.execute(p);
    } catch (SQLException e) {
      // TODO Auto-generated catch block
      throw new DAException(e.getMessage());
    }
  }
Exemplo n.º 6
0
 public HargaJual() throws DAException {
   db = new DBEngine();
   if (!db.connect()) throw new DAException("Could not connect to database");
 }