Correccion de cosas .w. No estoy seguro que e hecho
This commit is contained in:
@@ -47,6 +47,8 @@ public abstract class EfectivoDAO {
|
||||
public abstract boolean updateEfectivo(Efectivo efectivo);
|
||||
public abstract boolean deleteEfectivo(Efectivo efectivo);
|
||||
|
||||
public abstract int getTotalEfectivo(Caja caja);
|
||||
|
||||
protected List<Efectivo> efectivosFromResultSet(ResultSet rs) throws SQLException {
|
||||
List<Efectivo> efectivoList = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
|
||||
@@ -215,4 +215,24 @@ public class MysqlEfectivoDAO extends EfectivoDAO {
|
||||
return updates > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalEfectivo(Caja caja) {
|
||||
int total = 0;
|
||||
try {
|
||||
Connection conn = connectionHolder.getConnection();
|
||||
PreparedStatement ps = conn.prepareStatement("select veinte_mil + diez_mil + cinco_mil + dos_mil + mil + quinientos + cien + cincuenta + diez from efectivos where caja_id = ?");
|
||||
ps.setInt(1, caja.getId());
|
||||
|
||||
ResultSet rs = ps.executeQuery();
|
||||
rs.next();
|
||||
total = rs.getInt(1);
|
||||
|
||||
rs.close();
|
||||
ps.close();
|
||||
conn.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return total;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,4 +215,25 @@ public class SQLiteEfectivoDAO extends EfectivoDAO {
|
||||
}
|
||||
return updates > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalEfectivo(Caja caja) {
|
||||
int total = 0;
|
||||
try {
|
||||
Connection conn = connectionHolder.getConnection();
|
||||
PreparedStatement ps = conn.prepareStatement("select veinte_mil + diez_mil + cinco_mil + dos_mil + mil + quinientos + cien + cincuenta + diez from efectivos where caja_id = ?");
|
||||
ps.setInt(1, caja.getId());
|
||||
|
||||
ResultSet rs = ps.executeQuery();
|
||||
rs.next();
|
||||
total = rs.getInt(1);
|
||||
|
||||
rs.close();
|
||||
ps.close();
|
||||
conn.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return total;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user