VALIDACIONES
public class Validar {
    Connection conn;
    Statement sentencia;
 ResultSet resultado;
    String instruccion;
public int uncampovacio (String campo) {
     if (campo.equals (""))
     {
       return 0;
     }
     return 1;
}
 public int validarnumfloat (String campo) {
          float dato;
          try {
            dato= Float.parseFloat (campo);
            return 1;
              }
          catch (Exception e) {
           return 0;
          }
    }
 public int validarlong (String campo){
          int dato;
          try {
            dato= (int) Long.parseLong (campo);
            return 1;
              }
          catch (Exception e) {
           return 0;
          }
}
public int validarint (String campo) {
          int dato;
          try {
            dato= Integer.parseInt (campo);
            return 1;
              }
          catch (Exception e) {
           return 0;
          }}
 public float rango (String campo) {
    float num;
    try {
        num= Float.parseFloat (campo);
        if(num > 0.124)
        {
          return 1;
        }
         return 0;
    }
    catch (Exception e){
    return 0;
    }
  }
 public int rango1(String campo) {
    int num;
    try {
        num= Integer.parseInt (campo);
        if(num > 0)
        {
          return 1;
        }
         return 0;
    }
    catch (Exception e) {
    return 0;
    }
  }
   public int textbox1 (String a) {
       int res=0;
        try{
   if(a.equals("")){
     res=0;
 }else{
          res=1;
 }}
     catch(Exception e)
     {
         System.out.print ("");
     }
      return res;
    }
public int validarexisteArticulo (String campo) {
    //ResultSet resultado;
    try {
     AccesoBD abd = new  AccesoBD "Office_people","localhost","root","0000");
       // conn= c.getConexion();
        abd.Conexion.createStatement ();
        instruccion="SELECT código FROM  Artículos where código ='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next())
        {
              return 0;
        } else
        return 1;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 1;
    }
   }
public int existecodigoDano (String campo) {
//ResultSet resultado;
    try{
        AccesoBD abd = new AccesoBD("Office_people","localhost","root","0000");
       // conn= c.getConexion ();
        abd.Conexion.createStatement ();
       // sentencia = conn.createStatement();
       instrucción="SELECT codigo FROM Danos where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next())
        {
              return 1;
        }else
        return 0;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 0;
    }
 }
public int existeperdida_articulo (String campo) {
//ResultSet resultado;
    try{
        AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");
       // conn= c.getConexion ();
        abd.Conexion.createStatement ();
       // sentencia = conn.createStatement();
       instruccion="SELECT codigo FROM Perdidas_articulo where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
              return 1;
        }else
        return 0;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 0;
    }
 }
 public int existeDeudor (String campo) {
    try{
        AccesoBD abd = new AccesoBD("Office_people","localhost","root","0000");
       // conn= c.getConexion ();
       abd.Conexion.createStatement ();
        instruccion="SELECT numdoc FROM  Deudores where numdoc='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
           return 0;
        }else
         return 1;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 1;
    }
}
 public int existecodigomalestado (String campo) {
    try {
       AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");
       // conn= c.getConexion ();
        abd.Conexion.createStatement ();
        instruccion="SELECT codigo FROM Articulos_enmalestado where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
              return 0;
        }else
        return 1;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 1;
    }
 }
 public int existeventacontados (String campo) {
    try {
       AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");
        abd.Conexion.createStatement ();
        instruccion="SELECT codigo FROM Venta_contados where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
              return 0;
        } else
        return 1;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 1;
    }
 }
 public int existecodigo_utilizacion (String campo) {
    try {
       AccesoBD abd = new AccesoBD("Office_people","localhost","root","0000");
       // conn= c.getConexion();
        abd.Conexion.createStatement ();
        instruccion="SELECT codigo FROM Utilizacion_articulos where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
              return 0;
        } else
        return 1;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 1;
    }
 }
 public int existecodigo_prestamo (String campo){
    try{
       AccesoBD abd = new AccesoBD("Office_people","localhost","root","0000");
       // conn= c.getConexion ();
        abd.Conexion.createStatement ();
        instruccion="SELECT codigo FROM Prestamo_paraproveedor where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next())
        {
              return 0;
        } else
        return 1;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 1;
    }
 }
 public int existedonacion_articulo (String campo){
//ResultSet resultado;
    try {
        AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");
       // conn= c.getConexion ();
        abd.Conexion.createStatement ();
       // sentencia = conn.createStatement ();
       instruccion="SELECT codigo FROM Donacion_articulos where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
              return 1;
        } else
        return 0;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 0;
    }
 }
public int existeventamenudeo (String campo){
 AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");
    try{
        instruccion="SELECT codigo FROM  Venta_menudeo where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next())
        {
           return 0;
        }
         return 1;
    }
    catch (Exception e)
    {
  JOptionPane.showMessageDialog (null, "*** ERROR... ****  "+e);
 return 0;
    }
}
 public int existeabono (String campo) {
    try{
        AccesoBD abd = new AccesoBD("Office_people","localhost","root","0000");
        abd.Conexion.createStatement ();
       instruccion="SELECT codigo FROM Abonos where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
              return 1;
        } else
        return 0;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 0;
    }
 }
public float validarnumfloatprueba (String campo){
          float dato;
          try {
            dato= Float.parseFloat (campo);
            return 1;
              }
          catch (Exception e) {
           return 0;
          }
    }
public int existecodigocompra (String campo){
    try{
        AccesoBD abd = new AccesoBD("Office_people","localhost","root","0000");
       // conn= c.getConexion ();
        abd.Conexion.createStatement ();
        instruccion="SELECT codigo FROM Compras where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
              return 1;
        } else
        return 0;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 0;
    }
 }
public  int existeventa_contado (String campo){
    try {
        AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");
        abd.Conexion.createStatement ();
        instruccion="SELECT codigo FROM Venta_contados where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
              return 1;
        }else
        return 0;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 0;
    }
 }
public boolean existe_prestamo (String campo) {
    try {
        AccesoBD abd = new AccesoBD("Office_people","localhost","root","0000");
        abd.Conexion.createStatement ();
        instruccion="SELECT codigo FROM Prestamos_deproveedor where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next())
        {
              return true;
        }else
        return false;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return false;
    }
 }
public int existe_codigoprestamo (String campo) {
    try{
        AccesoBD abd = new AccesoBD("Office_people","localhost","root","0000");
        abd.Conexion.createStatement ();
        instruccion="SELECT codigo FROM Prestamos_deproveedor where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
              return 0;
        }else
        return 1;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 1;
    }
} 
public int existedevoluciondeproveedor (String campo){
    try {
        AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");
        abd.Conexion.createStatement ();
        instruccion="SELECT codigo FROM Devoluciones_de_proveedor where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next())
        {
              return 1;
        } else
        return 0;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 0;
    }
 }
public int existedevolucion (String campo){
    try {
        AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");
        abd.Conexion.createStatement ();
        instruccion="SELECT codigo FROM Devoluciones_paraproveedor where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
              return 1;
        } else
        return 0;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 0;
    }
 }
public int existeventa_servicios (String campo){
    try {
        AccesoBD abd = new AccesoBD("Office_people","localhost","root","0000");
        abd.Conexion.createStatement ();
        instruccion="SELECT codigo FROM Ventas_servicios where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
              return 1;
        } else
        return 0;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 0;
    }} 
public int existedevolucionproveedor (String campo){
    try {
        AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");
        abd.Conexion.createStatement ();
        instruccion="SELECT codigo FROM Devoluciones_de_proveedor where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
              return 0;
        }else
        return 1;
    }
    catch (Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 1;
    }
 }
public int existeventa_credito(String campo) {
    try{
        AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");
        abd.Conexion.createStatement ();
        instruccion="SELECT codigo FROM Ventas_creditos where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next())
        {
              return 1;
        }else
        return 0;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 0;
    }
 }
public int existeproveedor (String campo) {
   try {
        AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");        
        abd.Conexion.createStatement ();
        instruccion="SELECT nit FROM  proveedores where nit='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
           return 0;
        }
        else
           return 1;
        }
    catch (Exception e)
    {
   JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
    return 1;
    }
}
public int validarnoexistearticulo (String campo){
    try {
        AccesoBD abd = new AccesoBD("Office_people","localhost","root","0000");       
        abd.Conexion.createStatement ();
        instruccion="SELECT codigo FROM  Artículos where código ='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
              return 1;
        }else
        return 0;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 0;
    }
   }
public int existecodigoprestamoprov (String campo) {
    try {
        AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");        
        sentencia = conn.createStatement ();
        instruccion="SELECT codigo FROM Prestamos_paraProveedor where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
              return 1;
        } else
        return 0;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 0;
    }
 }
public int existecodigoutilizacion (String campo){
    try{
        AccesoBD abd = new AccesoBD("Office_people","localhost","root","0000");
        abd.Conexion.createStatement ();
        instruccion="SELECT codigo FROM Utilizacion_articulos where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next())
        {
              return 1;
        } else
        return 0;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 0;
    }
 }
public int existecodigomalo (String campo) {
    try {
        AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");       
        abd.Conexion.createStatement ();
        instruccion="SELECT codigo FROM Articulos_enmalestado where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
              return 1;
        } else
        return 0;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 0;
    }
 }
public int validarexisteencargado (String campo){
    try {
        AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");
        abd.Conexion.createStatement ();
        instruccion="SELECT numdoc FROM Encargados where numdoc='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
              return 1;
        }else
        return 0;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 0;
    }
 }
public int validarexistecodigoencargado (String campo) {
    try{
        AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");
        abd.Conexion.createStatement ();
        instruccion="SELECT numdoc FROM Encargados where numdoc='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
              return 0;
        } else
        return 1;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 1;
    }
 }
 public int existeVendedor (String campo) {
    try{
        AccesoBD abd = new AccesoBD("Office_people","localhost","root","0000");        
       abd.Conexion.createStatement ();
        instruccion="SELECT numdoc FROM  Vendedores where numdoc='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
           return 0;
        } else
         return 1;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 1;
    }
}
 public int validarnodocumentoadministrador (String campo){
    try {
        AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");       
        abd.Conexion.createStatement ();
        instruccion="SELECT numdoc FROM  Administradores where numdoc ='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
              return 1;
        } else
        return 0;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 0;  }}       
public int validarnodocumentovendedor (String campo){
    try {
        AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");        
        abd.Conexion.createStatement ();
        instruccion="SELECT numdoc FROM  Vendedores where numdoc ='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
              return 1;
        } else
        return 0;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 0;
    }
   }
 public int existeAdministrador (String campo) {
    try {
        AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");        
       abd.Conexion.createStatement ();
        instruccion="SELECT numdoc FROM  Administradores where numdoc='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
           return 0;
        }else
         return 1;
    }
    catch (Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 1;
    }
}  
public int totalabono (String campo) {
   float numero;
    try {
        numero= Integer.parseInt (campo);
        if ((numero <= 0.0))
        {
          return 1;
        }
         return 0;
    }
    catch (Exception e) {
    return 0;
    }
  }
 public int existecantidad (String campo) {
    try {
        AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");        
       abd.Conexion.createStatement ();
        instruccion="SELECT cantidad FROM  Artículos where codigo='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next())
        {
           return 0;
        } else
         return 1;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 1;
    }
}  
 public int noexisteproveedor (String campo) { 
   try {
       AccesoBD abd = new AccesoBD("Office_people","localhost","root","0000");       
        abd.Conexion.createStatement ();
        instruccion="SELECT nit FROM  proveedores where nit='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
           return 1;
        }
        else
           return 0;
        }
    catch(Exception e)
    {
   JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
    return 0;
    }
}
 public int existecantidad (String campo1, String campo2) {
    try {
        AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");       
        abd.Conexion.createStatement ();
        instruccion="select * from artículos where código='"+campo1+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        If (resultado.next ())
        {
           return 1;
        }
         return 0;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR 2****  "+e);
      return 0;
    }
}
  public int existecodigoprestamo (String campo ){
    try {    AccesoBD abd= new AccesoBD ("Office_people","localhost","root","0000");
        abd.Conexion.createStatement ();
        instruccion="select código from Prestamos_paraproveedor where código='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
           return 0;
        } else
         return 1;
    }
    catch(Exception e) {
      JOptionPane.showMessageDialog (null, "*** ERROR2 ****  "+e);
      return 1;
    }}
  public int existeperdida (String campo) {    
    try {
        AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");       
        abd.Conexion.createStatement ();
        instruccion="SELECT código FROM  perdidas_articulo where código='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
           return 1;
        }
         return 0;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog (null, "*** ERROR 3****  "+e);
      return 0;
    }
}
    public int existeventacontado (String campo) {
 AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");
    try {
        instruccion="SELECT código FROM  Venta_contados where código='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
           return 0;
        }
         return 1;
    }
    catch(Exception e)
    {
  JOptionPane.showMessageDialog (null, "*** ERROR... ****  "+e);
 return 0;
    }
}
  public int existeventacredito (String campo) {
 AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");
    try {
        instruccion="SELECT código FROM  Ventas_creditos where código='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
           return 0;
        }
         return 1;
    }
    catch(Exception e)
    {
  JOptionPane.showMessageDialog (null, "*** ERROR... ****  "+e);
 return 0;
    }
}
   public int existecompra (String campo){
 AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");
    try {
        instruccion="SELECT código FROM Compras where código='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
           return 0;
        }
         return 1;
    }
    catch(Exception e)
    {
  JOptionPane.showMessageDialog (null, "*** ERROR... ****  "+e);
 return 0;
    }
}
   public int existedonacionarticulo (String campo) {
 AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");
    try {
        instruccion="SELECT código FROM Donación _ artículos where código='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
           return 0;
        }
         return 1;
    }
    catch(Exception e)
    {
  JOptionPane.showMessageDialog (null, "*** ERROR... ****  "+e);
 return 0;
    }
}
   public int existedaño (String campo) {
 AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");
    try {
        abd.Conexion.createStatement ();
        instruccion="SELECT código FROM Danos where código='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
           return 0;
              }else
         return 1;
    }
    catch(Exception e)
    {
  JOptionPane.showMessageDialog (null, "*** ERROR2... ****  "+e);
 return 1;
    }
}
         public int existeperdidaarticulo (String campo) {
 AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");
    try {
        instruccion="SELECT código FROM  Perdidas_articulo where código='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
           return 0;
        }
         return 1;
    }
    catch(Exception e)
    {
  JOptionPane.showMessageDialog (null, "*** ERROR... ****  "+e);
 return 0;
    }
}
         public int existemalestado (String campo) {
 AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");
    try{
        instruccion="SELECT código FROM  Articulos_enmalestado where código='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
           return 0;
        }
         return 1;
    }
    catch(Exception e)
    {
  JOptionPane.showMessageDialog (null, "*** ERROR... ****  "+e);
 return 0;
    }
}
      public int existeventaservicio (String campo){
 AccesoBD abd = new AccesoBD ("Office_people","localhost","root","0000");
    try {
        instruccion="SELECT código FROM Ventas_servicios where código='"+campo+"'";
        resultado = abd.sentencia.executeQuery (instruccion);
        if (resultado.next ())
        {
           return 0;
        }
         return 1;
    }
    catch(Exception e)
    {
  JOptionPane.showMessageDialog (null, "*** ERROR... ****  "+e);
 return 0;
    }
}
public int cantidad(String campo) {
    float num;
    try {
         num= Float.parseFloat (campo);
        if ((num <=0))
        {
          return 1;
        }else
         return 0;
    }
    catch (Exception e) {
    return 0;
    }
  }
 public int deuda pagada (String campo) {
    float num;
    try {
        num= Float.parseFloat (campo);
        if ((num >= 0.0))
        {
          return 1;
        }
         return 0;
    }
    catch (Exception e) {
    return 0;
    }
  } 
}