viernes, 12 de febrero de 2010

DIAGRAMA DE ESTADO 5.2




PUBLICADO POR: LUIS SIERRA
SINCE
SENA REGIONAL SUCRE

DIAGRAMA DE ESTADO 5.1



PUBLICADO POR: LUIS SIERRA
SINCE
SENA REGIONAL SUCRE

DIAGRAMA DE ESTADO 5.0



PUBLICADO POR: LUIS SIERRA
SINCE
SENA REGIONAL SUCRE

DIAGRAMA DE SECUENCIA 3.0.8



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE SECUENCIA 3.0.7



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE SECUENCIA 3.0.6



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE SECUENCIA 3.0.5



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE SECUENCIA 3.0.4



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE SECUENCIA 3.0.3



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE SECUENCIA 3.0.2



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE SECUENCIA 3.0.1



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE SECUENCIA 3.0.1

PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE SECUENCIA 3.9



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE SECUENCIA 3.8



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE SECUENCIA 3.7



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE SECUENCIA 3.6




PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE SECUENCIA 3.5




PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE SECUENCIA 3.4



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE SECUENCIA 3.3




PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE SECUENCIA 3.2




PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE SECUENCIA 3.1



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE SECUENCIA 3.0



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE SECUENCIA 3.0

PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

TUPLAS DE ENTIDAD RELACCION 2.4



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

TUPLAS DE ENTIDAD RELACCION 2.3




PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

TUPLAS DE ENTIDAD RELACCION 2.2




PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

TUPLAS DE ENTIDAD RELACCION 2.1



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

TUPLAS DE ENTIDAD RELACCION 2.0




PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA ENTIDAD RELACCION



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA CASO DE USO 1.1.0



PUBLICADO POR : LUIS SIERRA
SINCE
SENA REGIONAL SUCRE

DIAGRAMA CASO DE USO 1.9



PUBLICADO POR : LUIS SIERRA
SINCE
SENA REGIONAL SUCRE

DIAGRAMA CASO DE USO 1.9




PUBLICADO POR : LUIS SIERRA
SINCE
SENA REGIONAL SUCRE

DIAGRAMA CASO DE USO 1.8



PUBLICADO POR : LUIS SIERRA
SINCE
SENA REGIONAL SUCRE

DIAGRAMA CASO DE USO 1.7



PUBLICADO POR : LUIS SIERRA
SINCE
SENA REGIONAL SUCRE

DIAGRAMA CASO DE USO 1.6



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA CASO DE USO 1.5



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA CASO DE USO 1.4



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA CASO DE USO 1.3



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA CASO DE USO 1.2




PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA CASO DE USO 1.1



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA CASO DE USO 1.0



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA CASO DE USO



PUBLICADO POR. LUIS SIERRA
SINCÉ
SENA REGIONA SUCRE

DIAGRAMA DE CASOS DE USO



PUBLICADO POR. LUIS SIERRA
SINCÉ
SENA REGIONA SUCRE

DIAGRAMA DE CLASE



PUBLICADO POR. LUIS SIERRA
SINCÉ
SENA REGIONA SUCRE

DIAGRAMA DE FLUJO 1.2



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE FLUJO 1.1



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE FLUJO 1.0



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

DIAGRAMA DE FLUJO



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

REVISION DE INFORME



PUBLICADO POR: LUIS SIERRA
SINCÉ
SENA REGIONAL SUCRE

CREACION DE PAGINAS WEB

DISEÑO



menu principal



La imaginacion es el consuelo de los pobres





FORMULARIO



Ejemplo 15





Formularios




Texto:

Password:

Sexo: Hombre
Mujer

Vehiculo:Moto
Coche












MENU



modulo de desarrollo




modulo de dsarrollo

objetivos:

programacion en java

programacion en .net

programacion en html


duracion :600 horas






PAGINA


CHRISTH



IR A GOOGLE   IR A MOZILA   IR A CARACOLTV





LA PAGINA WEB DEL MOMENTO






TODO BIEN






LUIS ALBERTO SIERRA RODRIGUEZ






LUCHO





PRINCIPAL



[ HOLA MUNDO ] <br />



MENU PRINCIPAL


ir a google


ir a sena virtual


ir a desarrollo


ir a diseño





REFLEXION

HTML>

UNA SONRISA <br />


UNA SONRISA

Una sonrisa no cuesta nada y produce mucho.

Enriquece a quienes la reciben,

sin empobrecer a quienes la dan.

No dura mas que u instante.

Pero su recuerdo a veces es eterno.

Nadie es demasiado pobre

para no merecerla.

Da felicidad en el trabajo.

Es el simbolo de amistad.


Una sonrisa da reposo al cansado.

Anima a los mas deprimidos.

No se puede comprar, ni prestar, ni robar

Pues es una cosa que no tiene valor,

hasta el momento en que se da.

y si alguna vez se tropieza con alguien

que no sabe dar una sonrisa mas,

sea generoso, dele la suya.

Porque nadie tiene tanta necesidad de una sonrisa

como el que no puede darsela a los demas.




REGISTROS



FORMULARIOS EN HTML <br />


SENA 2010



REGISTRO DE APRENDICES





























               


CEDULA:
NOMBRES:
APELLIDOS:
SEXO: F    M
               
               








SUMA



PAGINA DE RECIBIDO







SUMAS DE DOS NUMEROS














NUMERO 1
NUMERO 2
NUMERO 3







BUSQUEDA EN .NET

DESCARGAR PROYECTO EN .NET
DESCARGAR PROYECTO EN .NET

'BUSCAR
Dim dbConnection As Data.SqlClient.SqlConnection
Dim CadenaConexion As String
Try
CadenaConexion = ""
dbConnection = New Data.SqlClient.SqlConnection(CadenaConexion)
dbConnection.Open()
Catch e1 As Exception
MsgBox("Error al crear la conexión:" & vbCrLf & e1.Message)
Exit Sub
End Try


Dim resultado As Data.DataSet = New Data.DataSet()
Dim sentencia As Data.SqlClient.SqlDataAdapter
Dim fila As Data.DataRow
Dim instruccion, NombreTabla As String
NombreTabla = "aprendices"
instruccion = "select * from aprendices where cedula='" & TextBox1.Text & "'"
sentencia = New Data.SqlClient.SqlDataAdapter(instruccion, dbConnection)
Try
sentencia.Fill(resultado, NombreTabla)
Catch ex As Exception
MsgBox("error de busqueda" & ex.Message)

End Try
For Each fila In resultado.Tables(NombreTabla).Rows
TextBox2.Text = fila(1).ToString
TextBox3.Text = fila(2).ToString
Next

DISEÑO DE HUELLERO DIGITAL

import com.digitalpersona.onetouch.DPFPTemplate;
private DPFPTemplate plantilla;
private void GuardHuella (String cod) {
while (true) {
try {
File file = new File("huellas/"+cod);
if (!file.toString().toLowerCase().endsWith(".fpt"))
file = new File(file.toString() + ".fpt");
if (file.exists()) {
int choice = JOptionPane.showConfirmDialog(this,
String.format("El Archivo ya Existe ¿Quiere Sustituirlo?", file.toString()),
"Guardando Huella Digital",
JOptionPane.YES_NO_CANCEL_OPTION);
if (choice == JOptionPane.NO_OPTION)
continue;
else if (choice == JOptionPane.CANCEL_OPTION)
break;
}
FileOutputStream stream = new FileOutputStream(file);
stream.write(getTemplate().serialize());
stream.close();
} catch (Exception ex) {
JOptionPane.showMessageDialog(this, ex.getLocalizedMessage(), "Guardando Huella Digital", JOptionPane.ERROR_MESSAGE);
}
break;
}
}

public DPFPTemplate getTemplate() {
return plantilla;
}
public void setTemplate(DPFPTemplate template) {
DPFPTemplate old = this.plantilla;
this.plantilla = template;
firePropertyChange(PROPIEDAD_DE_PLANTILLA, old, template);
}
package panaderia;



import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.digitalpersona.onetouch.*;
import com.digitalpersona.onetouch.capture.*;
import com.digitalpersona.onetouch.capture.event.*;
import com.digitalpersona.onetouch.processing.*;


public class CaptureForm extends JDialog
{
private DPFPCapture capturer = DPFPGlobal.getCaptureFactory().createCapture();
private JLabel jLabel2 = new JLabel();
private JTextField jtextField1 = new JTextField();
private JTextArea jTextArea1 = new JTextArea();
private JTextField status = new JTextField("[status line]");

public CaptureForm(Frame owner) {
super (owner, true);
setTitle("raul CAPTURANDO HUELLA ");

setLayout(new BorderLayout());
rootPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

jLabel2.setPreferredSize(new Dimension(240, 280));
jLabel2.setBorder(BorderFactory.createLoweredBevelBorder());
jtextField1.setFont(UIManager.getFont("Panel.font"));
jtextField1.setEditable(false);
jtextField1.setColumns(40);
jtextField1.setMaximumSize(jtextField1.getPreferredSize());
jtextField1.setBorder(
BorderFactory.createCompoundBorder(
BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0), "Escaneo rapido:"),
BorderFactory.createLoweredBevelBorder()
));
jTextArea1.setColumns(40);
jTextArea1.setEditable(false);
jTextArea1.setFont(UIManager.getFont("Panel.font"));
JScrollPane logpane = new JScrollPane(jTextArea1);
logpane.setBorder(
BorderFactory.createCompoundBorder(
BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0), "Status:"),
BorderFactory.createLoweredBevelBorder()
));

status.setEditable(false);
status.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
status.setFont(UIManager.getFont("Panel.font"));

JButton quit = new JButton("Cerrar ventana");
quit.setForeground(Color.red);
quit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { setVisible(false); }});
JPanel right = new JPanel(new BorderLayout());
right.setBackground(Color.getColor("control"));
right.add(jtextField1, BorderLayout.PAGE_START);
right.add(logpane, BorderLayout.CENTER);
JPanel center = new JPanel(new BorderLayout());
center.setBackground(Color.white);
center.add(right, BorderLayout.CENTER);
center.add(jLabel2, BorderLayout.LINE_START);
center.add(status, BorderLayout.PAGE_END);

JPanel bottom = new JPanel(new FlowLayout(FlowLayout.LEFT));
bottom.setBackground(Color.cyan);

bottom.add(quit);
setLayout(new BorderLayout());
add(center, BorderLayout.CENTER);
add(bottom, BorderLayout.PAGE_END);

this.addComponentListener(new ComponentAdapter() {
@Override public void componentShown(ComponentEvent e) {
init();
start();
}
@Override public void componentHidden(ComponentEvent e) {
stop();
}
});

pack();
setLocationRelativeTo(null);
}

protected void init()
{
capturer.addDataListener(new DPFPDataAdapter() {
@Override public void dataAcquired(final DPFPDataEvent e) {
SwingUtilities.invokeLater(new Runnable() { public void run() {
makeReport("LA HUELLA HA SIDO CAPTURADA.");
setPrompt("ESCANEE EL MISMO DEDO OTRA VEZ.");
process(e.getSample());
}});
}
});
capturer.addReaderStatusListener(new DPFPReaderStatusAdapter() {
@Override public void readerConnected(final DPFPReaderStatusEvent e) {
SwingUtilities.invokeLater(new Runnable() { public void run() {
makeReport("ok EL HUELLERO ESTA CONECTADO.");
}});
}
@Override public void readerDisconnected(final DPFPReaderStatusEvent e) {
SwingUtilities.invokeLater(new Runnable() { public void run() {
makeReport("EL HUELLERO HA SIDO O ESTA DESCONECTADO.");
}});
}
});
capturer.addSensorListener(new DPFPSensorAdapter() {
@Override public void fingerTouched(final DPFPSensorEvent e) {
SwingUtilities.invokeLater(new Runnable() { public void run() {
makeReport("HA TOCADO.");
}});
}
@Override public void fingerGone(final DPFPSensorEvent e) {
SwingUtilities.invokeLater(new Runnable() { public void run() {
makeReport("HA QUITADO EL DEDO.");

}});
}
});
capturer.addImageQualityListener(new DPFPImageQualityAdapter() {
@Override public void onImageQuality(final DPFPImageQualityEvent e) {
SwingUtilities.invokeLater(new Runnable() { public void run() {
if (e.getFeedback().equals(DPFPCaptureFeedback.CAPTURE_FEEDBACK_GOOD))
makeReport("La calidad de la huella es excelente.");
else
makeReport("La calidad de la huella es mala.");
}});}});
}

protected void process(DPFPSample sample)
{
// Draw fingerprint sample image.
drawPicture(convertSampleToBitmap(sample));
}

protected void start()
{
capturer.startCapture();
setPrompt("Usar el huellero para Escanear la Huella");
}

protected void stop()
{
capturer.stopCapture();
}

public void setStatus(String string) {
status.setText(string);
}
public void setPrompt(String string) {
jtextField1.setText(string);
}
public void makeReport(String string) {
jTextArea1.append(string + "\n ");
}

public void drawPicture(Image image) {
jLabel2.setIcon(new ImageIcon(
image.getScaledInstance(jLabel2.getWidth(), jLabel2.getHeight(), Image.SCALE_DEFAULT)));
}

protected Image convertSampleToBitmap(DPFPSample sample) {
return DPFPGlobal.getSampleConversionFactory().createImage(sample);
}

protected DPFPFeatureSet extractFeatures(DPFPSample sample, DPFPDataPurpose purpose)
{
DPFPFeatureExtraction extractor = DPFPGlobal.getFeatureExtractionFactory().createFeatureExtraction();
try {
return extractor.createFeatureSet(sample, purpose);
} catch (DPFPImageQualityException e) {
return null;
}}}
package panaderia;

import com.digitalpersona.onetouch.*;
import com.digitalpersona.onetouch.processing.*;
import java.awt.*;
import javax.swing.JOptionPane;

public class CargarHuella1 extends CaptureForm
{
private DPFPEnrollment enroller = DPFPGlobal.getEnrollmentFactory().createEnrollment();

CargarHuella1(Frame owner) {
super(owner);
}

@Override protected void init()
{
super.init();
this.setTitle("CAPTURANDO HUELLA");
updateStatus();
}

@Override protected void process(DPFPSample sample) {
super.process(sample);

// Process the sample and create a feature set for the enrollment purpose.
DPFPFeatureSet features = extractFeatures(sample, DPFPDataPurpose.DATA_PURPOSE_ENROLLMENT);

// Check quality of the sample and add to enroller if it's good
if (features != null) try
{
makeReport("The fingerprint feature set was created.");
enroller.addFeatures(features); // Add feature set to template.
}
catch (DPFPImageQualityException ex) { }
finally {
updateStatus();

// Check if template has been created.
switch(enroller.getTemplateStatus())
{
case TEMPLATE_STATUS_READY: // report success and stop capturing
stop();
((Administrador)getOwner()).setTemplate(enroller.getTemplate());
hide();
setPrompt("Click Close, and then click Fingerprint Verification.");
break;

case TEMPLATE_STATUS_FAILED: // report failure and restart capturing
enroller.clear();
stop();
updateStatus();
((Administrador)getOwner()).setTemplate(null);
JOptionPane.showMessageDialog(CargarHuella1.this, "The fingerprint template is not valid. Repeat fingerprint enrollment.", "Fingerprint Enrollment", JOptionPane.ERROR_MESSAGE);
start();
break;
}
}
}

private void updateStatus()
{
// Show number of samples needed.
setStatus(String.format("Fingerprint samples needed: %1$s", enroller.getFeaturesNeeded()));
}

}
package panaderia;
import com.digitalpersona.onetouch.verification.*;
import java.awt.*;
import java.sql.*;
import java.io.*;
import javax.swing.*;
import com.digitalpersona.onetouch.*;

public class VerificarHuella extends CaptureForm
{
conexion c=new conexion();

Connection conn;
private DPFPVerification verificator = DPFPGlobal.getVerificationFactory().createVerification();

VerificarHuella(Frame owner) {
super(owner);
}

@Override protected void init()
{
super.init();
this.setTitle("Escaneo de huella");
updateStatus(0);
}

@Override protected void process(DPFPSample sample) {
ResultSet resultado=null;
DPFPTemplate t=null;
int val,sw=0;
String cedula;
super.process(sample);
try
{
resultado=buscar();
while(resultado.next())
{
// JOptionPane.showMessageDialog(VerificarHuella.this, "entre al while ");
cedula=resultado.getString("cedula");
t=onLoad(cedula);

val=verificar(sample,t);
if (val==1)
{
sw=1;
this.hide();
Principal1 p=new Principal1();
p.setVisible(true);
this.hide();

break;
}}
if(sw==0)
JOptionPane.showMessageDialog(VerificarHuella.this, "Usted no esta autorizado");
}
catch(Exception e)

{
JOptionPane.showMessageDialog(null," ERROR: NO SE PUEDE CONECTAR: "+e);
}

}


public int verificar(DPFPSample sample, DPFPTemplate template)
{
DPFPFeatureSet features = extractFeatures(sample, DPFPDataPurpose.DATA_PURPOSE_VERIFICATION);


// Check quality of the sample and start verification if it's good
if (features != null)
{
// Compare the feature set with our template
DPFPVerificationResult result =
verificator.verify(features, template);
updateStatus(result.getFalseAcceptRate());
if (result.isVerified())
{
makeReport("***VALIDACION HA SIDO CORRECTA****.");
return 1;
}

else
{makeReport("???? VALIDACION INCORRETA???.");
return 0;
}}

return 0;
}


private void updateStatus(int FAR)
{
// Show "False accept rate" value
setStatus(String.format("False Accept Rate (FAR) = %1$s", FAR));
}
public ResultSet buscar()
{
ResultSet resultado=null;
String instruccion;
try{
c.Conex("panaderia", "0000");
instruccion="SELECT CEDULA FROM administradores where huella= 's' ";
resultado = c.consulta(instruccion);
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, "error" + e);
}
return resultado;
}

private DPFPTemplate onLoad(String cod) {
/*JFileChooser chooser = new JFileChooser();
chooser.addChoosableFileFilter(new TemplateFileFilter());
if(chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)*/ {
try {
// FileInputStream stream = new FileInputStream(chooser.getSelectedFile());
FileInputStream stream = new FileInputStream("bancodehuellas/"+cod+".fpt");
byte[] data = new byte[stream.available()];
stream.read(data);
stream.close();
DPFPTemplate t = DPFPGlobal.getTemplateFactory().createTemplate();
t.deserialize(data);
return t;
//setTemplate(t);
} catch (Exception ex) {
JOptionPane.showMessageDialog(this,"Error: "+ex, "Cargando Huella", JOptionPane.ERROR_MESSAGE);
}
}
return null;
}}

VALIDACIONES

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;
}
}

}

CONEXION A LA BASE DE DATOS

CONEXIÓN A LA BASE DE DATOS

public class AccesoBD {
Connection Conexion;
Statement sentencia;
ResultSet resultado;

public AccesoBD () {
try {
Class.forName("com.mysql.jdbc.Driver");
}
catch(Exception e){
JOptionPane.showMessageDialog (null,"Error en el Driver: "+e);
}
//se conecta con la base de datos....
try{String url="jdbc:mysql://localhost/prueva";
Conexion= DriverManager.getConnection (url,"root","");
sentencia= Conexion.createStatement ();
//System.out.print ("Conexion.");
}
catch(Exception e){
JOptionPane.showMessageDialog (null,"Error al abrir la conexion 1 : "+e);
}
}
public AccesoBD (String BD, String IP, String user, String psw) {
try {
Class.forName("com.mysql.jdbc.Driver");
}
catch(Exception e){
JOptionPane.showMessageDialog (null,"Error en el Driver: "+e);
}
//se conecta con la base de datos...
try{String url="jdbc:mysql://"+ IP +"/"+BD;
Conexion= DriverManager.getConnection (url,user,psw);
sentencia= Conexion.createStatement();
//System.out.print("Conexion.");
}
catch(Exception e){
JOptionPane.showMessageDialog (null,"Error al abrir la conexion 2 : "+e);
}
}
public void Desconecty(){
try{
Conexion.close();
sentencia.close();
resultado.close ();
JOptionPane.showMessageDialog (null,"Base de Datos Cerrada. ");
}
catch(Exception e){
JOptionPane.showMessageDialog (null,"No se pudo Cerrar la Base de Datos. ");
}
}
public void Desconectar(){
try{
sentencia.close ();
//JOptionPane.showMessageDialog(null,"Base de Datos Cerrada. ");
}
catch(Exception e){
JOptionPane.showMessageDialog (null,"No se pudo Cerrar la Base de Datos. ");
}
}
// obtener puerto IP dede la red....
public String GetIP(){
String Ip= "";
try{
Ip= InetAddress.getLocalHost ().toString ();
System.out.print ("localhost = "+Ip);
}
catch(UnknownHostException err){
System.err.print("No puedo saber la dirección IP local: "+err);
}
return Ip;
}


}

CONSULTAS A LA BASE DE DATOS

CONSULTAS A LA BASE DE DATOS (SELECT)

Consulta de artículos existentes en el inventario.
Select * from Artículos.

Consultar los datos de los deudores que están en la base de datos.
Select * from Deudores.

Consultar los datos de los proveedores que están la base de datos.
Select * from Proveedores.

Buscar el documento de identidad de los deudores que tienen ventas a crédito activa.
SELECT distinct numdoc FROM Ventas_creditos vcr, deudores d where vcr.coddeudor=d.numdoc and vcr.estado='credito'

Buscar el documento de identidad de un encargado donde el tipo de encargado sea vendedor.
SELECT numdoc, tipo from encargados where tipo='vendedor'";

Buscar un abono por código.
SELECT * FROM Abonos where código='" + jTextField6.getText () + "'";

Esta consulta traerá los códigos de todas las ventas a créditos que tiene un deudor que todavía no han sido canceladas.
Select distinct código from ventas_creditos vcr, deudores d where vcr.coddeudor=d.numdoc and coddeudor='"+jComboBox1.getSelectedItem () +"' and vcr.valortotal>'0.0'";

Buscar código, nombre, marca, cantidad de artículos donde la cantidad del artículo sea igual a 0.
Select a.codigo, a.nombre, a.marca, a.cantidad from artículos a where a.cantidad = 0;

Consultar el nombre, cantidad de un artículo por el código.
Select nombre, cantidad from Artículos where código='" + jTextField8.getText () +;

Buscar la cantidad de un artículo.
Select cantidad from artículos where código='"+jTextField8.getText ()+"'";


Select a.nombre,am.fecha,am.codencargado,dm.codarticulo,dm.cantidad from artículos a,articulos_enmalestado am,detalle_malestado dm,encargados e where a.codigo=dm.codarticulo and dm.codmalestado=am.codigo and e.numdoc=am.codencargado and am.codigo='"+jTextField6.getText()+"'and am.fecha='"+jTextField7.getText()+"' and am.codencargado='"+jComboBox1.getSelectedItem()+"'";.





Buscar todos los artículos que han sido registrados en un mal estado.
Select * from articulos_enmalestado where código='"+jTextField6.getText ()+"'";

Este Select va incrementando en 1 el código del mal estado al ser registrado.
Select Max (código)+1 as maxi from Articulos_enmalestado";

Esta consulta muestra en orden descendente el código, nombre, marca y la cantidad total de todos los artículos vendidos en ventas de contado en una fecha específica.

Select a.codigo, a.nombre, a.marca, sum (dvc.cantidad) as cantidadtotal from venta_contados vc, articulos a, detalle_venta dvc where vc.codigo=dvc.codventa and a.codigo=dvc.codarticulo and vc.fecha='"+jTextField7.getText ()+"' group by a.codigo order by sum (dvc.cantidad) desc";

Esta consulta muestra en orden descendente el código, nombre, marca y la cantidad total de todos los artículos vendidos en ventas ha crédito en una fecha específica.

Select a.codigo,a.nombre,a.marca,sum(dvcr.cantidad) as cantidadtotal from ventas_creditos vcr,articulos a,detalle_ventacredito dvcr where a.codigo=dvcr.codarticulo and vcr.codigo=dvcr.codventacred and vcr.fecha='"+ jTextField7.getText()+"' group by a.codigo order by sum(dvcr.cantidad) desc";

Esta consulta muestra todos los detalles de un mal estado.
Select a.nombre, dm.codarticulo, dm.cantidad from articulos a, articulos_enmalestado am, detalle_malestado dm where a.codigo=dm.codarticulo and dm.codmalestado=am.codigo and am.codigo='"+jTextField6.getText ()+"'";

Buscar articulos por código.
SELECT * FROM Articulos where código='" + jTextField1.getText () + "'";

Busca un proveedor por el nit.
SELECT nit FROM Proveedores where nit='" + jComboBox1.getSelectedItem () + "'";

Buscar compras por código.
SELECT * FROM Compras where código='" + jTextField1.getText () + "'";

Consultar la cantidad de un artículo por el código.
SELECT cantidad FROM articulos where código='"+canti+"'";

Consultar todos los detalles de una compra.
select a.nombre,dc.codarticulo,dc.cantidad,dc.vunitario,c.valortotal from articulos à, compras c,detalle_compra dc where a.codigo=dc.codarticulo and dc.codcompra=c.codigo and c.codigo='"+jTextField1.getText()+"'";

Este Select va incrementando en 1 el código de un daño al ser registrado uno nuevamente.
Select Max (código) +1 as maxi from Danos";



Buscar un daño por un código específico.
Select * from Danos where código='"+jTextField6.getText ()+"'";

Esta consulta muestra un deudor de un documento específico.
SELECT * FROM Deudores where numdoc='" + jTextField1.getText () + "'";

Este Select va incrementando en 1 el código de una devolución de un proveedor al ser registrado uno nuevamente.
"select Max (codigo)+1 as maxi from Devoluciones_de_proveedor";

Mostrar los códigos de préstamos de artículos para un proveedor de un proveedor específico.
Select distinct código from Prestamo_paraProveedor where codproveedor='"+jComboBox1.getSelectedItem ()+"'";

Mostrar los detalles de una devolución de un proveedor.
Select a.nombre, ddp.codarticulo, ddp.cantidad from articulos a, devoluciones_de_proveedor dp, detalle_devolucion ddp where ddp.coddevolucion=dp.codigo and a.nombre=ddp.codarticulo and dp.codigo='"+jTextField6.getText ()+"'";

Mostrar préstamo para proveedor de un código específico.
"SELECT código FROM Prestamo_paraProveedor";

Este Select va incrementando en 1 el código de una devolución para un proveedor al ser registrado uno nuevamente.
"Select Max (código)+1 as maxi from Devoluciones_paraProveedor";

Buscar la cantidad, nombre de un artículo de un codigo especifico.
"Select cantidad, nombre from Artículos where código='" + jTextField4.getText () + "'";

Este Select va incrementando en 1 el código de una donación de artículo al ser registrado uno nuevamente.
"select max (codigo)+1 as maxi from Donación _ artículos";

Mostrar una donación de artículo de un código específico.
"select * from Donación _ artículos where código='"+jTextField1.getText ()+"'";

Mostrar los detalles de una donación de artículos.
"select a.nombre, dda.codarticulo, dda.cantidad from articulos a, donacion_articulos dn, detalle_donacionarticulos dda where a.codigo=dda.codarticulo and dda.coddonacion=dn.codigo and dn.codigo='"+jTextField1.getText ()+"'";

Mostrar una donación de dinero de un código específico.
"SELECT * FROM Donación _ dinero where código='" + jTextField6.getText () + "'";






Mostrar un gasto de dinero de un código específico
"SELECT * FROM Gasto _ dinero where código='" + jTextField10.getText () + "'";

Mostrar una perdida de dinero de un código específico
SELECT * FROM Pérdida _ dinero where código='" + jTextField10.getText () + "'";

Este Select va incrementando en 1 el código de una perdida de dinero al ser registrado una nuevamente.
"Select Max (código)+1 as maxi from Perdidas _ dinero";

Este Select va incrementando en 1 el código de una pérdida de artículo al ser registrado una nuevamente.
Select max (código) +1 as maxi from Perdidas_articulo";

Mostrar una pérdida de artículo de un código específico
Select * from Perdidas_articulo where código='"+jTextField6.getText ()+"'";

Consultar todos los detalles de una pérdida de artículo.
Select a.nombre,pda.codigo, dpa.codarticulo, dpa.cantidad, dpa.vunitario from articulos a, perdidas_articulo pda, detalle_perdida dpa where pda.codigo=dpa.codperdida and a.codigo=dpa.codarticulo and pda.codigo='"+jTextField6.getText ()+"'";

Mostar el nombre, apellidos, valor total de un deudor al escoger un código de venta a crédito.
Select distinct d.nombres, d.apellidos, vc.valortotal from deudores d, ventas_creditos vc where d.numdoc=vc.coddeudor and vc.codigo='"+ jComboBox2.getSelectedItem ()+"'";

Esta consulta muestra el valor total de todas las ventas de contado en una fecha específica.
Select sum (valortotal) as valortotal from venta_contados where fecha='"+jTextField1.getText ()+"' group by fecha; ";

Esta consulta muestra el valor total de todas las ventas de servicios en una fecha específica.
Select sum (valortotal) as valortotal from ventas_servicios where fecha='"+jTextField1.getText ()+"' group by fecha; ";

Esta consulta muestra el valor total de todos los abonos en una fecha específica.
Select sum (valorabono) as valortotal from abonos where fecha='"+jTextField1.getText ()+"' group by fecha; ";

Esta consulta muestra el valor total de todas las ventas de menudeo en una fecha específica.
Select sum (valortotal) as valortotal from venta_menudeo where fecha='"+jTextField1.getText ()+"' group by fecha; ";



Buscar un login de un administrador.
SELECT login FROM Administradores where login='"+jTextField1.getText ()+"'";

Mostrar la utilidad de todos los articulos de una venta de contado en una fecha específica en orden ascendente.
Select distinct a.codigo, a.nombre, a.marca, ((sum (dvc.vunitario-a.valorcosto)*dvc.cantidad)-descuento) as utilidad from articulos a, venta_contados vc, detalle_venta dvc where a.codigo=dvc.codarticulo and vc.codigo=dvc.codventa and vc.fecha='"+jTextField2.getText ()+"' and vc.codigo='"+jComboBox1.getSelectedItem ()+"' group by a.codigo asc";

Mostrar la utilidad de todos los articulos de una venta crédito en una fecha específica en orden ascendente.
Select a.codigo, a.nombre, a.marca, (sum (dvcr.vunitario-a.valorcosto)*dvcr.cantidad) as utilidad from articulos d, ventas_creditos vcr, detalle_ventacredito dvcr where a.codigo=dvcr.codarticulo and vcr.codigo=dvcr.codventacred and vcr.fecha='"+jTextField2.getText ()+"' and vcr.codigo='"+jComboBox2.getSelectedItem ()+"' group by a.codigo asc";

Mostrar los códigos de ventas de contado de una fecha específica.
SELECT código FROM Venta_contados where fecha='"+jTextField2.getText () +"'";

Mostrar los códigos de ventas crédito de una fecha específica.
SELECT código FROM Ventas_creditos where fecha='"+jTextField2.getText () +"'";

Consultar todos los detalles de una utilización de artículo
Select a.nombre, dua.codarticulo, dua.cantidad, dua.vunitario, ua.valortotal from articulos a, utilizacion_articulos ua, detalle_utilizacion dua where a.codigo=dua.codarticulo and dua.codutilizac=ua.codigo and ua.codigo='"+jTextField1.getText ()+"'";