Example #1
0
  public String elimina(Long id, Usuario usuario) throws NoEstaAbiertaException {
    FacturaAlmacen factura = obtiene(id);
    if (factura.getEstatus().getNombre().equals(Constantes.ABIERTA)) {
      String nombre = factura.getFolio();
      currentSession().delete(factura);
      audita(factura, usuario, Constantes.ELIMINAR, new Date());

      currentSession().flush();
      return nombre;
    } else {
      throw new NoEstaAbiertaException("No se puede eliminar una factura que no este abierta");
    }
  }
Example #2
0
 public String cierra(Long facturaId, Usuario usuario)
     throws NoSePuedeCerrarException, NoSePuedeCerrarEnCeroException, NoEstaAbiertaException {
   FacturaAlmacen factura = (FacturaAlmacen) currentSession().get(FacturaAlmacen.class, facturaId);
   factura = cierra(factura, usuario);
   return factura.getFolio();
 }