You are on page 1of 80

Departamento de Ciencias de la Computacin

Programacin II

Proyecto:
Proyecto de fin de semestre- Aplicacin Coma Rico

Integrantes:
Edgar Meneses
Steven Palacios
Paulette Parra

NRC:
4187

Profesora:
Ing. Margarita Zambrano

Fecha de entrega:
24/02/2017

Sangolqu-Ecuador
CONTENIDO:
1. Objetivos
1.1 General
1.2 Especficos
2. Antecedentes
3. Problema
4. Diseo
5. Cdigo y explicacin
6. Implementacin
7. Conclusiones

OBJETIVOS:
General:
Crear una aplicacin ptima en Java con el uso de Interfaz Grfica mediante el uso de
clases, objetos, GUI, arrays y con la construccin de un cdigo validado, verificado y
ejecutable para cumplir las especificaciones necesarias y otorgar una solucin a la
problemtica planteada por el grupo, con el fin de fortalecer conocimientos adquiridos
durante el semestre I 2017 en Programacin II.
Especficos:
I. Identificar y desglosar las clases participantes y necesarias que formarn parte
en el programa, demostrando la relacin de las mismas con el cdigo UML.
II. Determinar los atributos comprendidos en cada clase y el tipo al que pertenece
cada uno.
III. Construir un cdigo ejecutable sin errores para cumplir las funciones necesarias
en la solucin de un problema planteado.
IV. Detallar los mtodos primordiales que usamos y cul fue la funcin que
determinamos para cada uno de ellos.
V. Exponer nuestro programa o aplicacin resultante a nuestros compaeros de
clase demostrando conocimientos aplicados y las validaciones realizadas.
ANTECEDENTES
Muchas veces nos hemos cuestionado el uso de programas pues requieren de un rduo
trabajo tras la construccin de los mismos, pues la interfaz grafica de usuario
prcticamente se ha ido puliendo con el tiempo hasta nuestros das, mucho tiempo atrs
esto no era real y programar significaba verlo solo desde consola.
En Ecuador, muchos locales de comida y negocios como restaurantes pequeos no
llevaban o siguen sin llevar un registro de clientes, productos y otras variedades, para
dichos lugares basta con un papel en el cual tomar la orden o simplemente la memoria,
prcticamente este ha sido su base para sobrellevar su negocio y lo han permanecido as
por muchos aos.
Si nos ponemos a recordar situaciones de salidas con la familia en el momento de
almorzar o cenar en lugares externos al hogar, podramos habernos percatado de lo difcil
que es adaptar la tecnologa con el trabajo de meseros o los dueos de locales de comida
rpida, con el tiempo las normas de venta se han ido reformando en nuestro pas con las
leyes Tributarias, tanto as que hace un par de aos el SRI reform sus artculos haciendo
hincapi en el trmino 10 del Art. 56 de la Ley de Rgimen Tributario Interno donde
manifiesta la generacin de un comprobante en consumos superiores a $4 sin necesidad
de que se lo solicite previamente por el usuario o cliente, poniendo de manifiesto la
necesidad de nuestro programa a realizar.

DISEO DEL PROGRAMA


CDIGO DEL PROGRAMA
PERSONA CLIENTE
USUARIO
ADMINISTRADOR

MESA
MESERO
CAJERO
PRODUCTO
FACTURA
FONDO MAIN
EN EL FRAME private ArrayList<Producto> misProductos = new ArrayList<>();
private ArrayList<Factura> misFacturas = new ArrayList<>();
frmEntrada
Design
public void setFacturas(ArrayList<Factura> misFacturas) {
this.misFacturas = misFacturas;
}
public void setProductos(ArrayList<Producto> misProductos) {
this.misProductos = misProductos;
}
public void setUsuarios(ArrayList<Usuario> misUsuarios) {
this.misUsuarios = misUsuarios;
}
public void setClientes(ArrayList<Cliente> misClientes) {
this.misClientes = misClientes;
}
Source public frmEntrada() {

package Formularios; initComponents();

import Clases.*; }

import java.util.ArrayList; @SuppressWarnings("unchecked")

import javax.swing.JOptionPane; private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {

public class frmEntrada extends javax.swing.JFrame { System.exit(0);

private ArrayList<Usuario> misUsuarios = new ArrayList<>(); }

private ArrayList<Cliente> misClientes = new ArrayList<>(); private void btnAceptarActionPerformed(java.awt.event.ActionEvent evt) {


String clave = new String(txtClave.getPassword()); txtUsuario.requestFocusInWindow();
int a = 0; return;

for (int i = 0; i < misUsuarios.size(); i++) { }

if (txtUsuario.getText().equals(misUsuarios.get(i).getIdUsuario()) }

&& clave.equals(misUsuarios.get(i).getClave())) { private void btnAceptarMouseEntered(java.awt.event.MouseEvent evt) {

frmPrincipal principal = new frmPrincipal(); // TODO add your handling code here:

principal.setUsuarios(misUsuarios); }

principal.setClientes(misClientes);
principal.setProductos(misProductos); private void btnAceptarMouseClicked(java.awt.event.MouseEvent evt) {

principal.setFacturas(misFacturas); // TODO add your handling code here:

principal.setPerfil(misUsuarios.get(i).getPerfil()); }

principal.setClave(misUsuarios.get(i).getClave()); private void btnAceptarKeyPressed(java.awt.event.KeyEvent evt) {

principal.setID(misUsuarios.get(i).getIdUsuario()); }

principal.setLocationRelativeTo(null); private void btnCancelarKeyPressed(java.awt.event.KeyEvent evt) {

principal.setVisible(true); }

setVisible(false); public static void main(String args[]) {

a = 1; java.awt.EventQueue.invokeLater(new Runnable() {

} public void run() {

} new frmEntrada().setVisible(true);

if (a == 0) { }

JOptionPane.showMessageDialog(rootPane, "Usuario o clave incorrecto"); });

txtUsuario.setText(""); }

txtClave.setText(""); // Variables declaration - do not modify


private javax.swing.JButton btnAceptar; package Formularios;
private javax.swing.JButton btnCancelar; import Clases.*;
private javax.swing.JLabel jLabel1; import java.util.ArrayList;
private javax.swing.JLabel jLabel2; import static Archivos.ArchivosPlanos.*;
private javax.swing.JLabel jlabel1; public class frmPrincipal extends javax.swing.JFrame {
private javax.swing.JPasswordField txtClave; private int perfil;
private javax.swing.JTextField txtUsuario; private String clave, id;
// End of variables declaration private ArrayList<Usuario> misUsuarios = new ArrayList<>();
} private ArrayList<Cliente> misClientes = new ArrayList<>();

frmPrincipal private ArrayList<Producto> misProductos = new ArrayList<>();


private ArrayList<Factura> misFacturas = new ArrayList<>();
Design
private frmPedido pedido[] = new frmPedido[15];
private Mesa mesa1 = new Mesa();
public void setFacturas(ArrayList<Factura> misFacturas) {
this.misFacturas = misFacturas;
}
public void setProductos(ArrayList<Producto> misProductos) {
this.misProductos = misProductos;
}
public void setUsuarios(ArrayList<Usuario> misUsuarios) {
this.misUsuarios = misUsuarios;
}

Source public void setClientes(ArrayList<Cliente> misClientes) {


this.misClientes = misClientes; private void mnuArchivoClientesActionPerformed(java.awt.event.ActionEvent evt) {
} frmClientes cliente = new frmClientes();

public void setPerfil(int perfil) { cliente.setClientes(misClientes);

this.perfil = perfil; dpnEscritorio.add(cliente);

} cliente.show();

public void setClave(String clave) { }

this.clave = clave; private void mnuArchivoUsuarioActionPerformed(java.awt.event.ActionEvent evt)


{
}
frmUsuarios usuarios = new frmUsuarios();
public void setID(String id) {
usuarios.setUsuarios(misUsuarios);
this.id = id;
dpnEscritorio.add(usuarios);
}
usuarios.show();
public frmPrincipal() {
}
for (int i = 0; i < 15; i++) {
private void
pedido[i] = new frmPedido(); mnuArchivoCAmbioClaveActionPerformed(java.awt.event.ActionEvent evt) {
} frmCambio nuevo = new frmCambio(this, rootPaneCheckingEnabled);
initComponents(); nuevo.setID(id);
} nuevo.setUsuarios(misUsuarios);
public void abrirMesas() { nuevo.setClave(clave);
for (int i = 0; i < 15; i++) { nuevo.setLocationRelativeTo(this);
dpnEscritorio.add(pedido[i]); nuevo.setVisible(true);
} }
} private void
mnuArchivoCambioUsuarioActionPerformed(java.awt.event.ActionEvent evt) {
@SuppressWarnings("unchecked")
this.setVisible(false); frmRegistroFacturas miRegistro = new frmRegistroFacturas();
frmEntrada milogin = new frmEntrada(); miRegistro.setFacturas(misFacturas);

milogin.setUsuarios(misUsuarios); dpnEscritorio.add(miRegistro);

milogin.setClientes(misClientes); miRegistro.show();

milogin.setProductos(misProductos); }

milogin.setLocationRelativeTo(null); private void mnuAyudaAcercadeActionPerformed(java.awt.event.ActionEvent evt)


{
milogin.setVisible(true);
frmAcercaDe inf = new frmAcercaDe();
}
dpnEscritorio.add(inf);
private void mnuArchivoSalirActionPerformed(java.awt.event.ActionEvent evt) {
inf.show();
//guardar datos en archivos planos
}
guardarClientes(misClientes);
private void formWindowOpened(java.awt.event.WindowEvent evt) {
guardarProducto(misProductos);
//para poner la imagen de fondo
guardarUsuario(misUsuarios);
((DesktopConFondo) dpnEscritorio).setImagen("/Imagenes/escritorio.jpg");
System.exit(0);
abrirMesas();
}
switch (perfil) {
private void mnuAlmacenProductosActionPerformed(java.awt.event.ActionEvent
evt) { case 1:

frmProductos productos = new frmProductos(); break;

productos.setProductos(misProductos); case 2:

dpnEscritorio.add(productos); mnuArchivoUsuario.setEnabled(false);

productos.show(); mnuArchivoClientes.setEnabled(false);

} mnuAlmacenProductos.setEnabled(false);

private void mnuRegistroFacturaActionPerformed(java.awt.event.ActionEvent evt) { mnuRegistroFactura.setEnabled(false);


break; pedido[1].setClientes(misClientes);
case 3: pedido[1].show();

mnuArchivoUsuario.setEnabled(false); }

mnuArchivoClientes.setEnabled(false); private void btnMesa3ActionPerformed(java.awt.event.ActionEvent evt) {

mnuAlmacenProductos.setEnabled(false); pedido[2].setMesa(3);

mnuRegistroFactura.setEnabled(false); pedido[2].setUsuarios(misUsuarios);

break; pedido[2].setProductos(misProductos);

} pedido[2].setFacturas(misFacturas);

} pedido[2].setClientes(misClientes);

private void btnMesa1ActionPerformed(java.awt.event.ActionEvent evt) { pedido[2].show();

pedido[0].setMesa(1); }

pedido[0].setStado(mesa1); private void btnMesa4ActionPerformed(java.awt.event.ActionEvent evt) {

pedido[0].setUsuarios(misUsuarios); pedido[3].setMesa(4);

pedido[0].setProductos(misProductos); pedido[3].setUsuarios(misUsuarios);

pedido[0].setFacturas(misFacturas); pedido[3].setProductos(misProductos);

pedido[0].setClientes(misClientes); pedido[3].setFacturas(misFacturas);

pedido[0].show(); pedido[3].setClientes(misClientes);

} pedido[3].show();

private void btnMesa2ActionPerformed(java.awt.event.ActionEvent evt) { }

pedido[1].setMesa(2); private void btnMesa5ActionPerformed(java.awt.event.ActionEvent evt) {

pedido[1].setUsuarios(misUsuarios); pedido[4].setMesa(5);

pedido[1].setProductos(misProductos); pedido[4].setUsuarios(misUsuarios);

pedido[1].setFacturas(misFacturas); pedido[4].setProductos(misProductos);
pedido[4].setFacturas(misFacturas); pedido[7].setProductos(misProductos);
pedido[4].setClientes(misClientes); pedido[7].setFacturas(misFacturas);

pedido[4].show(); pedido[7].setClientes(misClientes);

} pedido[7].show();

private void btnMesa6ActionPerformed(java.awt.event.ActionEvent evt) { }

pedido[5].setMesa(6); private void btnMesa9ActionPerformed(java.awt.event.ActionEvent evt) {

pedido[5].setUsuarios(misUsuarios); pedido[8].setMesa(9);

pedido[5].setProductos(misProductos); pedido[8].setUsuarios(misUsuarios);

pedido[5].setFacturas(misFacturas); pedido[8].setProductos(misProductos);

pedido[5].setClientes(misClientes); pedido[8].setFacturas(misFacturas);

pedido[5].show(); pedido[8].setClientes(misClientes);

} pedido[8].show();

private void btnMesa7ActionPerformed(java.awt.event.ActionEvent evt) { }

pedido[6].setMesa(7); private void btnMesa10ActionPerformed(java.awt.event.ActionEvent evt) {

pedido[6].setUsuarios(misUsuarios); pedido[9].setMesa(10);

pedido[6].setProductos(misProductos); pedido[9].setUsuarios(misUsuarios);

pedido[6].setFacturas(misFacturas); pedido[9].setProductos(misProductos);

pedido[6].setClientes(misClientes); pedido[9].setFacturas(misFacturas);

pedido[6].show(); pedido[9].setClientes(misClientes);

} pedido[9].show();

private void btnMesa8ActionPerformed(java.awt.event.ActionEvent evt) { }

pedido[7].setMesa(8); private void btnMesa11ActionPerformed(java.awt.event.ActionEvent evt) {

pedido[7].setUsuarios(misUsuarios); pedido[10].setMesa(11);
pedido[10].setUsuarios(misUsuarios); pedido[13].setMesa(14);
pedido[10].setProductos(misProductos); pedido[13].setUsuarios(misUsuarios);

pedido[10].setFacturas(misFacturas); pedido[13].setProductos(misProductos);

pedido[10].setClientes(misClientes); pedido[13].setFacturas(misFacturas);

pedido[10].show(); pedido[13].setClientes(misClientes);

} pedido[13].show();

private void btnMesa12ActionPerformed(java.awt.event.ActionEvent evt) { }

pedido[11].setMesa(12); private void btnMesa15ActionPerformed(java.awt.event.ActionEvent evt) {

pedido[11].setUsuarios(misUsuarios); pedido[14].setMesa(15);

pedido[11].setProductos(misProductos); pedido[14].setUsuarios(misUsuarios);

pedido[11].setFacturas(misFacturas); pedido[14].setProductos(misProductos);

pedido[11].setClientes(misClientes); pedido[14].setFacturas(misFacturas);

pedido[11].show(); pedido[14].setClientes(misClientes);

} pedido[14].show();

private void btnMesa13ActionPerformed(java.awt.event.ActionEvent evt) { }

pedido[12].setMesa(13); public static void main(String args[]) {

pedido[12].setUsuarios(misUsuarios); java.awt.EventQueue.invokeLater(new Runnable() {

pedido[12].setProductos(misProductos); public void run() {

pedido[12].setFacturas(misFacturas); new frmPrincipal().setVisible(true);

pedido[12].setClientes(misClientes); }

pedido[12].show(); });

} }

private void btnMesa14ActionPerformed(java.awt.event.ActionEvent evt) { // Variables declaration - do not modify


private javax.swing.JMenuBar Ayuda; private javax.swing.JLabel jLabel21;
private javax.swing.JButton btnMesa1; private javax.swing.JLabel jLabel22;

private javax.swing.JButton btnMesa10; private javax.swing.JLabel jLabel23;

private javax.swing.JButton btnMesa11; private javax.swing.JLabel jLabel24;

private javax.swing.JButton btnMesa12; private javax.swing.JLabel jLabel25;

private javax.swing.JButton btnMesa13; private javax.swing.JLabel jLabel26;

private javax.swing.JButton btnMesa14; private javax.swing.JLabel jLabel27;

private javax.swing.JButton btnMesa15; private javax.swing.JLabel jLabel28;

private javax.swing.JButton btnMesa2; private javax.swing.JLabel jLabel29;

private javax.swing.JButton btnMesa3; private javax.swing.JPopupMenu.Separator jSeparator1;

private javax.swing.JButton btnMesa4; private javax.swing.JPopupMenu.Separator jSeparator2;

private javax.swing.JButton btnMesa5; private javax.swing.JPopupMenu.Separator jSeparator3;

private javax.swing.JButton btnMesa6; private javax.swing.JMenuItem mnuAlmacenProductos;

private javax.swing.JButton btnMesa7; private javax.swing.JMenu mnuArchivo;

private javax.swing.JButton btnMesa8; private javax.swing.JMenuItem mnuArchivoCAmbioClave;

private javax.swing.JButton btnMesa9; private javax.swing.JMenuItem mnuArchivoCambioUsuario;

private javax.swing.JDesktopPane dpnEscritorio; private javax.swing.JMenuItem mnuArchivoClientes;

private javax.swing.JLabel jLabel1; private javax.swing.JMenuItem mnuArchivoSalir;

private javax.swing.JLabel jLabel16; private javax.swing.JMenuItem mnuArchivoUsuario;

private javax.swing.JLabel jLabel17; private javax.swing.JMenu mnuAyuda;

private javax.swing.JLabel jLabel18; private javax.swing.JMenuItem mnuAyudaAcercade;

private javax.swing.JLabel jLabel19; private javax.swing.JMenu mnuMovimientos;

private javax.swing.JLabel jLabel20; private javax.swing.JMenuItem mnuRegistroFactura;


// End of variables declaration import java.util.ArrayList;
} import javax.swing.JOptionPane;

frmClientes import javax.swing.table.DefaultTableModel;

public class frmClientes extends javax.swing.JInternalFrame {


Design
private int usuAct ;

boolean nuevo;

private DefaultTableModel miTabla;

private ArrayList<Cliente> misClientes = new ArrayList<>();

public void setClientes(ArrayList<Cliente> misClientes) {

this.misClientes = misClientes;

public frmClientes() {

initComponents();

usuAct=0;

nuevo=false;

@SuppressWarnings("unchecked")

private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {

//Validacin de campos vacios


Source
if (txtNombres.getText().equals("")) {
package Formularios;
JOptionPane.showMessageDialog(rootPane, "Debe ingresar el nombre");
import Clases.Cliente;
txtNombres.requestFocusInWindow();
return; txtCedula.setText(null);

} txtCedula.requestFocusInWindow();

if (txtApellidos.getText().equals("")) { return;

JOptionPane.showMessageDialog(rootPane, "Debe ingresar el apellido"); }

txtApellidos.requestFocusInWindow(); if (txtDireccion.getText().equals("")) {

return; JOptionPane.showMessageDialog(rootPane, "Debe ingresar una direccin");

} txtDireccion.requestFocusInWindow();

if (txtCedula.getText().equals("")){ return;

JOptionPane.showMessageDialog(rootPane, "Debe ingresar el nmero de }


cdula");
if (txtTelefono.getText().equals("")) {
txtCedula.requestFocusInWindow();
JOptionPane.showMessageDialog(rootPane, "Debe ingresar un nmero de
return; telfono");

} txtTelefono.requestFocusInWindow();

if(!misClientes.get(0).esLong(txtCedula.getText())){ return;

JOptionPane.showMessageDialog(rootPane, "Debe ingresar una cadena de }


nmeros");
if(!misClientes.get(0).esLong(txtTelefono.getText())){
txtCedula.setText(null);
JOptionPane.showMessageDialog(rootPane, "Debe ingresar una cadena de
txtCedula.requestFocusInWindow(); nmeros");

return; txtTelefono.setText(null);

} txtTelefono.requestFocusInWindow();

if return;
(misClientes.get(0).validarCedula(Long.parseLong(txtCedula.getText()))==false){
}
JOptionPane.showMessageDialog(rootPane, "Nmero de cdula incorrecto");
//Validacin que el cliente no exista
int pos = posicionCliiente(txtCedula.getText()); String mns;

if (nuevo) { if (nuevo) {

if (pos != -1) { misClientes.add(miCliente);

JOptionPane.showMessageDialog(rootPane, "Cliente ya existe"); JOptionPane.showMessageDialog(rootPane, "Cliente agregado


correctamente");
txtCedula.requestFocusInWindow();
} else {
return;
mns=modificarCliente(miCliente, pos);
}
JOptionPane.showMessageDialog(rootPane, mns);
} else if (pos == -1) {
}
JOptionPane.showMessageDialog(rootPane, "Cliente no existe");
//habilitar botones
txtCedula.requestFocusInWindow();
btnPrimero.setEnabled(true);
return;
btnAnterior.setEnabled(true);
}
btnSiguiente.setEnabled(true);
//Creamos el objeto usuario y los agregamos a datos
btnUltimo.setEnabled(true);
long cedula;
btnNuevo.setEnabled(true);
cedula=Long.parseLong(txtCedula.getText());
btnModificar.setEnabled(true);
Cliente miCliente = new Cliente(
btnBorrar.setEnabled(true);
cedula,
btnBuscar.setEnabled(true);
txtNombres.getText(),
btnGuardar.setEnabled(false);
txtApellidos.getText(),
btnCancelar.setEnabled(false);
txtDireccion.getText(),
//Deshabilita los campos
txtTelefono.getText());
txtNombres.setEnabled(false);
txtApellidos.setEnabled(false); btnPrimero.setEnabled(true);

txtCedula.setEnabled(false); btnAnterior.setEnabled(true);

txtDireccion.setEnabled(false); btnSiguiente.setEnabled(true);

txtTelefono.setEnabled(false); btnUltimo.setEnabled(true);

//actualizamos tabla btnNuevo.setEnabled(true);

llenarTabla(); btnModificar.setEnabled(true);

} btnBorrar.setEnabled(true);

private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) { btnBuscar.setEnabled(true);

String cliente = JOptionPane.showInputDialog("Ingrese la cdula del cliente"); btnGuardar.setEnabled(false);

if (cliente.equals("")) { btnCancelar.setEnabled(false);

return; //Deshabilita los campos

} txtNombres.setEnabled(false);

int pos = posicionCliiente(cliente); txtApellidos.setEnabled(false);

if (pos == -1) { txtCedula.setEnabled(false);

JOptionPane.showMessageDialog(rootPane, "El cliente no existe"); txtDireccion.setEnabled(false);

return; txtTelefono.setEnabled(false);

} usuAct = 0;

usuAct = pos; mostrarRegistro();

mostrarRegistro(); }

} private void btnPrimeroActionPerformed(java.awt.event.ActionEvent evt) {

private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) { usuAct = 0;

//Habilita los botones mostrarRegistro();


} btnAnterior.setEnabled(false);

private void btnUltimoActionPerformed(java.awt.event.ActionEvent evt) { btnSiguiente.setEnabled(false);

usuAct = misClientes.size()-1; btnUltimo.setEnabled(false);

mostrarRegistro(); btnNuevo.setEnabled(false);

} btnModificar.setEnabled(false);

private void btnAnteriorActionPerformed(java.awt.event.ActionEvent evt) { btnBorrar.setEnabled(false);

usuAct--; btnBuscar.setEnabled(false);

if (usuAct == -1) { btnGuardar.setEnabled(true);

usuAct = misClientes.size()- 1; btnCancelar.setEnabled(true);

} //Habilita los campos

mostrarRegistro(); txtNombres.setEnabled(true);

} txtApellidos.setEnabled(true);

private void btnSiguienteActionPerformed(java.awt.event.ActionEvent evt) { txtCedula.setEnabled(true);

usuAct++; txtDireccion.setEnabled(true);

if (usuAct == misClientes.size()) { txtTelefono.setEnabled(true);

usuAct = 0; //Limpiar Campos

} txtNombres.setText(null);

mostrarRegistro(); txtApellidos.setText(null);

} txtCedula.setText(null);

private void btnNuevoActionPerformed(java.awt.event.ActionEvent evt) { txtDireccion.setText(null);

//Habilitar deshabilitar botones txtTelefono.setText(null);

btnPrimero.setEnabled(false); //Activar el flag de registro nuevo


nuevo = true; btnNuevo.setEnabled(false);

//Damos Foco al campo ID btnModificar.setEnabled(false);

txtCedula.requestFocusInWindow(); btnBorrar.setEnabled(false);

} btnBuscar.setEnabled(false);

private void btnBorrarActionPerformed(java.awt.event.ActionEvent evt) { btnGuardar.setEnabled(true);

int rpta = JOptionPane.showConfirmDialog(rootPane, "Est seguro que desea btnCancelar.setEnabled(true);


borrar el registro?");
//Habilita los campos
if (rpta != 0) {
txtNombres.setEnabled(true);
return;
txtApellidos.setEnabled(true);
}
txtCedula.setEnabled(true);
misClientes.remove(usuAct);
txtDireccion.setEnabled(true);
usuAct = 0;
txtTelefono.setEnabled(true);
mostrarRegistro();
//Desactivar el flag de registro nuevo
//actualizamos tabla
nuevo = false;
llenarTabla();
//Damos Foco al campo ID
}
txtNombres.requestFocusInWindow();
private void btnModificarActionPerformed(java.awt.event.ActionEvent evt) {
}
//Habilita los botones
private void formInternalFrameOpened(javax.swing.event.InternalFrameEvent evt) {
btnPrimero.setEnabled(false);
mostrarRegistro();
btnAnterior.setEnabled(false);
llenarTabla();
btnSiguiente.setEnabled(false);
}
btnUltimo.setEnabled(false);
private void mostrarRegistro() {
txtNombres.setText(misClientes.get(usuAct).getNombres()); }

txtApellidos.setText(misClientes.get(usuAct).getApellidos()); //devuelve la posicion en el arreglo de usuarios

txtDireccion.setText(misClientes.get(usuAct).getDireccion()); public int posicionCliiente(String cliente){

txtTelefono.setText(misClientes.get(usuAct).getTelefono()); for(int i=0;i<misClientes.size(); i++){

txtCedula.setText(""+misClientes.get(usuAct).getCi()); if (misClientes.get(i).getCi()==(Long.parseLong(cliente))){

} return i;

private void llenarTabla() { }

//titulos de la tabla }

String titulos[] = {"Cdula", "Nombres", "Apellidos", "Direccin", "Telfono"}; return -1;

//registramos el nmero de columnas }

String registro[] = new String[5]; //modifica un usuario en el arrayList

//pasamos los titulos a la tabla public String modificarCliente(Cliente miCliente, int posicion){

miTabla = new DefaultTableModel(null, titulos); misClientes.get(posicion).setNombres(miCliente.getNombres());

for (int i = 0; i < misClientes.size(); i++) { misClientes.get(posicion).setApellidos(miCliente.getApellidos());

registro[0] = ""+misClientes.get(i).getCi(); misClientes.get(posicion).setCi(miCliente.getCi());

registro[1] = misClientes.get(i).getNombres(); misClientes.get(posicion).setDireccion(miCliente.getDireccion());

registro[2] = misClientes.get(i).getApellidos(); misClientes.get(posicion).setTelefono(miCliente.getTelefono());

registro[3] = misClientes.get(i).getDireccion();

registro[4] = misClientes.get(i).getTelefono(); return "Usuario modificado correctamente";

miTabla.addRow(registro); }

} //para validar que la cedula sea un long

tblTablaClientes.setModel(miTabla); // Variables declaration - do not modify


private javax.swing.JButton btnAnterior; private javax.swing.JTextField txtTelefono;

private javax.swing.JButton btnBorrar; // End of variables declaration

private javax.swing.JButton btnBuscar; }

private javax.swing.JButton btnCancelar; frmUsuarios


private javax.swing.JButton btnGuardar; Design
private javax.swing.JButton btnModificar;

private javax.swing.JButton btnNuevo;

private javax.swing.JButton btnPrimero;

private javax.swing.JButton btnSiguiente;

private javax.swing.JButton btnUltimo;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JLabel jLabel4;

private javax.swing.JLabel jLabel5;

private javax.swing.JLabel jLabel7;

private javax.swing.JLabel jLabel9;

private javax.swing.JScrollPane jScrollPane1;

private javax.swing.JTable tblTablaClientes;

private javax.swing.JTextField txtApellidos; Source


private javax.swing.JTextField txtCedula;
package Formularios;
private javax.swing.JTextField txtDireccion;
import Clases.Usuario;
private javax.swing.JTextField txtNombres; import java.util.ArrayList;
import java.util.Date; }
import javax.swing.JOptionPane; if (txtNombres.getText().equals("")) {

import javax.swing.table.DefaultTableModel; JOptionPane.showMessageDialog(rootPane, "Debe ingresar el nombre");

public class frmUsuarios extends javax.swing.JInternalFrame { txtNombres.requestFocusInWindow();

private int usuAct ; return;

boolean nuevo; }

private DefaultTableModel miTabla; if (txtApellidos.getText().equals("")) {

ArrayList<Usuario> misUsuarios = new ArrayList<>(); JOptionPane.showMessageDialog(rootPane, "Debe ingresar el apellido");

public void setUsuarios(ArrayList<Usuario> misUsuarios) { txtApellidos.requestFocusInWindow();

this.misUsuarios = misUsuarios; return;

} }

public frmUsuarios() { if (txtCedula.getText().equals("")){

initComponents(); JOptionPane.showMessageDialog(rootPane, "Debe ingresar el nmero de


cdula");
usuAct=0;
txtCedula.requestFocusInWindow();
nuevo=false;
return;
}
}
@SuppressWarnings("unchecked")
if(!misUsuarios.get(0).esLong(txtCedula.getText())){
private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {
JOptionPane.showMessageDialog(rootPane, "Debe ingresar una cadena de
//Validacin de campos vacios nmeros");
if (txtIDUsuario.getText().equals("")) { txtCedula.setText(null);
JOptionPane.showMessageDialog(rootPane, "Debe digitar un Id"); txtCedula.requestFocusInWindow();
txtIDUsuario.requestFocusInWindow(); return;
return; }
if txtConfirmacion.requestFocusInWindow();
(misUsuarios.get(0).validarCedula(Long.parseLong(txtCedula.getText()))==false){
return;
JOptionPane.showMessageDialog(rootPane, "Nmero de cdula incorrecto");
}
txtCedula.setText(null);
//validacion de clave y confirmacin
txtCedula.requestFocusInWindow();
if (!clave.equals(confirmacion)) {
return;
JOptionPane.showMessageDialog(rootPane, "La clave y la confirmacn no
} coinciden");

if (cmbPerfil.getSelectedIndex() == 0) { txtConfirmacion.setText(null);

JOptionPane.showMessageDialog(rootPane, "Debe seleccionar un perfil"); txtClave.setText(null);

cmbPerfil.requestFocusInWindow(); txtClave.requestFocusInWindow();

return; return;

} }

String clave = new String(txtClave.getPassword()); //validacion de edad >18

String confirmacion = new String(txtConfirmacion.getPassword()); //validacin de fechas

if (clave.equals("")) { if (txtFechaNac.getDate().equals(txtFechaIngreso.getDate())) {

JOptionPane.showMessageDialog(rootPane, "Debe digitar una clave"); JOptionPane.showMessageDialog(rootPane,"La fecha de nacimiento "

txtClave.requestFocusInWindow(); + "debe ser anterior a la fecha de ingreso");

return; txtFechaNac.requestFocusInWindow();

} return;

if (confirmacion.equals("")) { }

JOptionPane.showMessageDialog(rootPane, "Debe confirmar su clave"); if (txtFechaNac.getDate().after(new Date())) {

txtClave.setText(null); JOptionPane.showMessageDialog(rootPane, "La fecha de nacimiento "

txtConfirmacion.setText(null); + "debe ser anterior a la fecha actual");


txtFechaNac.requestFocusInWindow(); clave,
return; cmbPerfil.getSelectedIndex(),

} txtFechaNac.getDate(),

//Validacin que el usuario no exista txtFechaIngreso.getDate());

int pos = posicionUsuario(txtIDUsuario.getText()); String mns;

if (nuevo) { if (nuevo==true) {

if (pos != -1) { misUsuarios.add(miUsuario);

JOptionPane.showMessageDialog(rootPane, "Usuario ya existe"); JOptionPane.showMessageDialog(rootPane, "Usuario agregado


correctamente");
txtIDUsuario.requestFocusInWindow();
} else {
return;
mns=modificarUsuario(miUsuario, pos);
}
JOptionPane.showMessageDialog(rootPane, mns);
} else if (pos == -1) {
}
JOptionPane.showMessageDialog(rootPane, "Usuario no existe");
//habilitar botones
txtIDUsuario.requestFocusInWindow();
btnPrimero.setEnabled(true);
return;
btnAnterior.setEnabled(true);
}
btnSiguiente.setEnabled(true);
//Creamos el objeto usuario y los agregamos a datos
btnUltimo.setEnabled(true);
long cedula;
btnNuevo.setEnabled(true);
cedula=Long.parseLong(txtCedula.getText());
btnModificar.setEnabled(true);
Usuario miUsuario = new Usuario(cedula,
btnBorrar.setEnabled(true);
txtNombres.getText(),
btnBuscar.setEnabled(true);
txtApellidos.getText(),
btnGuardar.setEnabled(false);
txtIDUsuario.getText(),
btnCancelar.setEnabled(false); }
//Deshabilita los campos usuAct = pos;

txtIDUsuario.setEnabled(false); mostrarRegistro();

txtNombres.setEnabled(false); }

txtApellidos.setEnabled(false); private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {

txtClave.setEnabled(false); //Habilita los botones

txtConfirmacion.setEnabled(false); btnPrimero.setEnabled(true);

cmbPerfil.setEnabled(false); btnAnterior.setEnabled(true);

txtFechaNac.setEnabled(false); btnSiguiente.setEnabled(true);

txtFechaIngreso.setEnabled(false); btnUltimo.setEnabled(true);

txtCedula.setEnabled(false); btnNuevo.setEnabled(true);

//actualizamos tabla btnModificar.setEnabled(true);

llenarTabla(); btnBorrar.setEnabled(true);

} btnBuscar.setEnabled(true);

private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) { btnGuardar.setEnabled(false);

String usuario = JOptionPane.showInputDialog("Ingrese cdigo de usuario"); btnCancelar.setEnabled(false);

if (usuario.equals("")) { //Deshabilita los campos

return; txtIDUsuario.setEnabled(false);

} txtNombres.setEnabled(false);

int pos = posicionUsuario(usuario); txtApellidos.setEnabled(false);

if (pos == -1) { txtClave.setEnabled(false);

JOptionPane.showMessageDialog(rootPane, "El usuario no existe"); txtConfirmacion.setEnabled(false);

return; cmbPerfil.setEnabled(false);
txtFechaNac.setEnabled(false); if (usuAct == misUsuarios.size()) {
txtFechaIngreso.setEnabled(false); usuAct = 0;

txtCedula.setEnabled(false); }

usuAct = 0; mostrarRegistro();

mostrarRegistro(); }

} private void btnNuevoActionPerformed(java.awt.event.ActionEvent evt) {

private void btnPrimeroActionPerformed(java.awt.event.ActionEvent evt) { //Habilitar deshabilitar botones

usuAct = 0; btnPrimero.setEnabled(false);

mostrarRegistro(); btnAnterior.setEnabled(false);

} btnSiguiente.setEnabled(false);

private void btnUltimoActionPerformed(java.awt.event.ActionEvent evt) { btnUltimo.setEnabled(false);

usuAct = misUsuarios.size()-1; btnNuevo.setEnabled(false);

mostrarRegistro(); btnModificar.setEnabled(false);

} btnBorrar.setEnabled(false);

private void btnAnteriorActionPerformed(java.awt.event.ActionEvent evt) { btnBuscar.setEnabled(false);

usuAct--; btnGuardar.setEnabled(true);

if (usuAct == -1) { btnCancelar.setEnabled(true);

usuAct = misUsuarios.size()- 1; //Habilita los campos

} txtIDUsuario.setEnabled(true);

mostrarRegistro(); txtNombres.setEnabled(true);

} txtApellidos.setEnabled(true);

private void btnSiguienteActionPerformed(java.awt.event.ActionEvent evt) { txtClave.setEnabled(true);

usuAct++; txtConfirmacion.setEnabled(true);
cmbPerfil.setEnabled(true); return;
cmbPerfil.setSelectedIndex(0); }

txtFechaNac.setEnabled(true); misUsuarios.remove(usuAct);

txtFechaIngreso.setEnabled(true); usuAct = 0;

txtCedula.setEnabled(true); mostrarRegistro();

//Limpiar Campos //actualizamos tabla

txtIDUsuario.setText(null); llenarTabla();

txtNombres.setText(null); }

txtApellidos.setText(null); private void btnModificarActionPerformed(java.awt.event.ActionEvent evt) {

txtClave.setText(null); //Habilita los botones

txtConfirmacion.setText(null); btnPrimero.setEnabled(false);

txtFechaNac.setDate(new Date()); btnAnterior.setEnabled(false);

txtFechaIngreso.setDate(new Date()); btnSiguiente.setEnabled(false);

txtCedula.setText(null); btnUltimo.setEnabled(false);

//Activar el flag de registro nuevo btnNuevo.setEnabled(false);

nuevo = true; btnModificar.setEnabled(false);

//Damos Foco al campo ID btnBorrar.setEnabled(false);

txtIDUsuario.requestFocusInWindow(); btnBuscar.setEnabled(false);

} btnGuardar.setEnabled(true);

private void btnBorrarActionPerformed(java.awt.event.ActionEvent evt) { btnCancelar.setEnabled(true);

int rpta = JOptionPane.showConfirmDialog(rootPane, "Est seguro que desea //Habilita los campos
borrar el registro?");
txtNombres.setEnabled(true);
if (rpta != 0) {
txtApellidos.setEnabled(true);
txtClave.setEnabled(true); txtNombres.setText(misUsuarios.get(usuAct).getNombres());
txtConfirmacion.setEnabled(true); txtApellidos.setText(misUsuarios.get(usuAct).getApellidos());

cmbPerfil.setEnabled(true); txtClave.setText(misUsuarios.get(usuAct).getClave());

txtFechaNac.setEnabled(true); txtConfirmacion.setText(misUsuarios.get(usuAct).getClave());

txtFechaIngreso.setEnabled(false); cmbPerfil.setSelectedIndex(misUsuarios.get(usuAct).getPerfil());

txtCedula.setEnabled(true); txtFechaNac.setDate(misUsuarios.get(usuAct).getFechaNac());

//Desactivar el flag de registro nuevo txtFechaIngreso.setDate(misUsuarios.get(usuAct).getFechaIngreso());

nuevo = false; txtCedula.setText(""+misUsuarios.get(usuAct).getCi());

//Damos Foco al campo ID }

txtNombres.requestFocusInWindow(); private void llenarTabla() {

} //titulos de la tabla

private void formInternalFrameOpened(javax.swing.event.InternalFrameEvent evt) { String titulos[] = {"ID Usuario","Cdula", "Nombres", "Apellidos", "Perfil", "F.
Ingreso"};
mostrarRegistro();
//registramos el nmero de columnas
llenarTabla();
String registro[] = new String[6];
}
//pasamos los titulos a la tabla
private void txtApellidosActionPerformed(java.awt.event.ActionEvent evt) {
miTabla = new DefaultTableModel(null, titulos);
// TODO add your handling code here:
for (int i = 0; i < misUsuarios.size(); i++) {
}
registro[0] = misUsuarios.get(i).getIdUsuario();
private void cmbPerfilActionPerformed(java.awt.event.ActionEvent evt) {
registro[1] = ""+misUsuarios.get(i).getCi();
// TODO add your handling code here:
registro[2] = misUsuarios.get(i).getNombres();
}
registro[3] = misUsuarios.get(i).getApellidos();
private void mostrarRegistro() {
registro[4] = perfil(misUsuarios.get(i).getPerfil());
txtIDUsuario.setText(misUsuarios.get(usuAct).getIdUsuario());
registro[5] = }
misUsuarios.get(i).DateToString(misUsuarios.get(i).getFechaIngreso());
return -1;
miTabla.addRow(registro);
}
}
//devuelve un usuario modificado
tblTabla.setModel(miTabla);
public String modificarUsuario(Usuario miUsuario, int posicion){
}
misUsuarios.get(posicion).setNombres(miUsuario.getNombres());
private String perfil(int idPerfil) {
misUsuarios.get(posicion).setApellidos(miUsuario.getApellidos());
switch (idPerfil) {
misUsuarios.get(posicion).setPerfil(miUsuario.getPerfil());
case 1:
misUsuarios.get(posicion).setCi(miUsuario.getCi());
return "Administrador";
misUsuarios.get(posicion).setClave(miUsuario.getClave());
case 2:
misUsuarios.get(posicion).setFechaNac(miUsuario.getFechaNac());
return "Cajero";
misUsuarios.get(posicion).setFechaIngreso(miUsuario.getFechaIngreso());
case 3:
return "Usuario modificado correctamente";
return "Mesero";
}
}
// Variables declaration - do not modify
return "perfil no definido";
private javax.swing.JButton btnAnterior;
}
private javax.swing.JButton btnBorrar;
//devuelve la posicion en el arreglo de usuarios
private javax.swing.JButton btnBuscar;
public int posicionUsuario(String usuario){
private javax.swing.JButton btnCancelar;
for(int i=0;i<misUsuarios.size(); i++){
private javax.swing.JButton btnGuardar;
if (misUsuarios.get(i).getIdUsuario().equals(usuario)){
private javax.swing.JButton btnModificar;
return i;
private javax.swing.JButton btnNuevo;
}
private javax.swing.JButton btnPrimero;
private javax.swing.JButton btnSiguiente; // End of variables declaration
private javax.swing.JButton btnUltimo; }

private javax.swing.JComboBox<String> cmbPerfil; frmCambio


private javax.swing.JLabel jLabel1;
Design
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable tblTabla;
private javax.swing.JTextField txtApellidos;
private javax.swing.JTextField txtCedula;
private javax.swing.JPasswordField txtClave;
private javax.swing.JPasswordField txtConfirmacion; Source

private com.toedter.calendar.JDateChooser txtFechaIngreso; package Formularios;

private com.toedter.calendar.JDateChooser txtFechaNac; import Clases.Usuario;

private javax.swing.JTextField txtIDUsuario; import java.util.ArrayList;

private javax.swing.JTextField txtNombres; import javax.swing.JOptionPane;


//Validaciones de campos vacios
public class frmCambio extends javax.swing.JDialog { if(actual.equals("")){

private String clave,id; JOptionPane.showMessageDialog(rootPane, "Debe ingresar la clave "

private static ArrayList<Usuario> misUsuarios = new ArrayList<>(); + "actual");

public void setUsuarios(ArrayList<Usuario> misUsuarios) { txtActual.setText(null);

this.misUsuarios = misUsuarios; txtNuevo.setText(null);

} txtConfirmacion.setText(null);

public void setClave(String clave){ txtActual.requestFocusInWindow();

this.clave=clave; return;

} }

public void setID(String id){ if(nuevo.equals("")){

this.id=id; JOptionPane.showMessageDialog(rootPane, "Ingrese una nueva clave");

} txtNuevo.requestFocusInWindow();

public frmCambio(java.awt.Frame parent, boolean modal) { return;

super(parent, modal); }

initComponents(); if(confirmacion.equals("")){

} JOptionPane.showMessageDialog(rootPane, "Debe confirmar "

@SuppressWarnings("unchecked") + "su nueva clave");

private void btnAceptarActionPerformed(java.awt.event.ActionEvent evt) { txtConfirmacion.requestFocusInWindow();

String actual,nuevo,confirmacion; return;

actual=new String(txtActual.getPassword()); }

nuevo=new String(txtNuevo.getPassword()); int pos=posicionUsuario(id);

confirmacion=new String(txtConfirmacion.getPassword()); if(misUsuarios.get(pos).cambioClave(actual, nuevo, confirmacion)==-1){


JOptionPane.showMessageDialog(rootPane, "La clave original no " return i;
+ "corresponde al usuario actual"); }

txtActual.setText(null); }

txtActual.requestFocusInWindow(); return -1;

txtNuevo.setText(null); }

txtConfirmacion.setText(null); private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {

return; this.dispose();

}else{ }

if(misUsuarios.get(pos).cambioClave(actual, nuevo, confirmacion)==1){ public static void main(String args[]) {

JOptionPane.showMessageDialog(rootPane, "La clave y la " java.awt.EventQueue.invokeLater(new Runnable() {

+ "confirmacin no coinciden"); public void run() {

txtNuevo.setText(null); frmCambio dialog = new frmCambio(new javax.swing.JFrame(), true);

txtConfirmacion.setText(null); dialog.addWindowListener(new java.awt.event.WindowAdapter() {

return; @Override

}else{ public void windowClosing(java.awt.event.WindowEvent e) {

JOptionPane.showMessageDialog(rootPane, "Clave modificada con xito"); System.exit(0);

this.setVisible(false); }

} });

} dialog.setVisible(true);

} }

public int posicionUsuario(String usuario){ });

for(int i=0;i<misUsuarios.size(); i++){ }

if (misUsuarios.get(i).getIdUsuario().equals(usuario)){ // Variables declaration - do not modify


private javax.swing.JButton btnAceptar;
private javax.swing.JButton btnCancelar;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JPasswordField txtActual;
private javax.swing.JPasswordField txtConfirmacion;
private javax.swing.JPasswordField txtNuevo;
// End of variables declaration
}

frmProductos
Design
Source
package Formularios;
import Clases.Producto;
import java.util.ArrayList;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
public class frmProductos extends javax.swing.JInternalFrame {
private int proAct ;
boolean nuevo;
private DefaultTableModel miTabla;
ArrayList<Producto> misProductos=new ArrayList<>();
public void setProductos(ArrayList<Producto> misProductos) { if (cmbCategoria.getSelectedIndex() == 0) {

this.misProductos = misProductos; JOptionPane.showMessageDialog(rootPane, "Debe seleccionar una categora");

} cmbCategoria.requestFocusInWindow();

public frmProductos() { return;

initComponents(); }

proAct=0; //validacin de precio

nuevo=false; if(txtPrecio.getText().equals("")){

} JOptionPane.showMessageDialog(rootPane, "Debe ingresar un precio");

@SuppressWarnings("unchecked") txtPrecio.requestFocusInWindow();

private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) { return;

//Validacin de campos vacios }

if (txtIDProducto.getText().equals("")) { if(misProductos.get(0).validarPrecio(txtPrecio.getText())==1){

JOptionPane.showMessageDialog(rootPane, "Debe digitar un Id"); JOptionPane.showMessageDialog(rootPane, "Debe ingresar un valor


nmerico");
txtIDProducto.requestFocusInWindow();
txtPrecio.setText(null);
return;
txtPrecio.requestFocusInWindow();
}
return;
if (txtDescripcion.getText().equals("")) {
}else{
JOptionPane.showMessageDialog(rootPane, "Debe la descripcin del
producto"); if(misProductos.get(0).validarPrecio(txtPrecio.getText())==-1){

txtDescripcion.requestFocusInWindow(); JOptionPane.showMessageDialog(rootPane, "Debe ingresar un valor mayor


que cero");
return;
txtPrecio.setText(null);
}
txtPrecio.requestFocusInWindow();
return; }
} } else if (pos == -1) {

} JOptionPane.showMessageDialog(rootPane, "Producto no existe");

//validacin de stock txtIDProducto.requestFocusInWindow();

if (txtStock.getText().equals("")) { return;

JOptionPane.showMessageDialog(rootPane, "Debe ingresar la cantidad en }


stock");
//Creamnos el objeto product y los agregamos a datos
txtStock.requestFocusInWindow();
Producto miProducto = new Producto(
return;
txtIDProducto.getText(),
}
txtDescripcion.getText(),
if(!misProductos.get(0).validarcantidad(txtStock.getText())){
Float.parseFloat(txtPrecio.getText()),
JOptionPane.showMessageDialog(rootPane, "Digite una cantidad mayor que
txtNota.getText(),
cero");
txtStock.setText(null); cmbCategoria.getSelectedIndex(),
Integer.parseInt(txtStock.getText()));
txtStock.requestFocusInWindow();
return; String mns;
if (nuevo) {
}
//Validacin que el producto no exista misProductos.add(miProducto);
JOptionPane.showMessageDialog(rootPane, "Producto agregado
int pos = posicionProducto(txtIDProducto.getText());
correctamente");
if (nuevo) {
} else {
if (pos != -1) {
mns =modificarProducto(miProducto, pos);
JOptionPane.showMessageDialog(rootPane, "Producto ya existe");
JOptionPane.showMessageDialog(rootPane, mns);
txtIDProducto.requestFocusInWindow();
}
return;
//habilitar botones if (producto.equals("")) {
btnPrimero.setEnabled(true); return;

btnAnterior.setEnabled(true); }

btnSiguiente.setEnabled(true); int pos = posicionProducto(producto);

btnUltimo.setEnabled(true); if (pos == -1) {

btnNuevo.setEnabled(true); JOptionPane.showMessageDialog(rootPane, "El producto no existe");

btnModificar.setEnabled(true); return;

btnBorrar.setEnabled(true); }

btnBuscar.setEnabled(true); proAct = pos;

btnGuardar.setEnabled(false); mostrarRegistro();

btnCancelar.setEnabled(false); }

//Deshabilita los campos


txtIDProducto.setEnabled(false); private void cmbCategoriaActionPerformed(java.awt.event.ActionEvent evt) {

txtDescripcion.setEnabled(false); // TODO add your handling code here:

txtPrecio.setEnabled(false); }

txtNota.setEnabled(false); private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {

cmbCategoria.setEnabled(false); //Habilita los botones

txtStock.setEnabled(false); btnPrimero.setEnabled(true);

//Se actualiza los datos de la tabla btnAnterior.setEnabled(true);

llenarTabla(); btnSiguiente.setEnabled(true);

} btnUltimo.setEnabled(true);

private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) { btnNuevo.setEnabled(true);

String producto = JOptionPane.showInputDialog("Ingrese cdigo del producto"); btnModificar.setEnabled(true);


btnBorrar.setEnabled(true); if (proAct == -1) {
btnBuscar.setEnabled(true); proAct = misProductos.size()- 1;

btnGuardar.setEnabled(false); }

btnCancelar.setEnabled(false); mostrarRegistro();

//Deshabilita los campos }

//Deshabilita los campos private void btnSiguienteActionPerformed(java.awt.event.ActionEvent evt) {

txtIDProducto.setEnabled(false); proAct++;

txtDescripcion.setEnabled(false); if (proAct == misProductos.size()) {

txtPrecio.setEnabled(false); proAct = 0;

txtNota.setEnabled(false); }

cmbCategoria.setEnabled(false); mostrarRegistro();

txtStock.setEnabled(false); }

} private void btnNuevoActionPerformed(java.awt.event.ActionEvent evt) {

private void btnPrimeroActionPerformed(java.awt.event.ActionEvent evt) { //Habilitar deshabilitar los botones

proAct = 0; btnPrimero.setEnabled(false);

mostrarRegistro(); btnAnterior.setEnabled(false);

} btnSiguiente.setEnabled(false);

private void btnUltimoActionPerformed(java.awt.event.ActionEvent evt) { btnUltimo.setEnabled(false);

proAct = misProductos.size()- 1; btnNuevo.setEnabled(false);

mostrarRegistro(); btnModificar.setEnabled(false);

} btnBorrar.setEnabled(false);

private void btnAnteriorActionPerformed(java.awt.event.ActionEvent evt) { btnBuscar.setEnabled(false);

proAct--; btnGuardar.setEnabled(true);
btnCancelar.setEnabled(true); if (rpta != 0) {
//Habilita los campos return;

txtIDProducto.setEnabled(true); }

txtDescripcion.setEnabled(true); misProductos.remove(proAct);

txtStock.setEnabled(true); JOptionPane.showMessageDialog(rootPane, "Producto borrado correctamente");

txtNota.setEnabled(true); proAct = 0;

txtPrecio.setEnabled(true); mostrarRegistro();

cmbCategoria.setEnabled(true); //actualizamos tabla

cmbCategoria.setSelectedIndex(0); llenarTabla();

//Limpiar Campos }

txtIDProducto.setText(null); private void btnModificarActionPerformed(java.awt.event.ActionEvent evt) {

txtDescripcion.setText(null); //Habilitar deshabilitar los botones

txtStock.setText(null); btnPrimero.setEnabled(false);

txtNota.setText(null); btnAnterior.setEnabled(false);

txtPrecio.setText(null); btnSiguiente.setEnabled(false);

//Activar el flag de registro nuevo btnUltimo.setEnabled(false);

nuevo = true; btnNuevo.setEnabled(false);

//Damos Foco al campo ID btnModificar.setEnabled(false);

txtIDProducto.requestFocusInWindow(); btnBorrar.setEnabled(false);

} btnBuscar.setEnabled(false);

private void btnBorrarActionPerformed(java.awt.event.ActionEvent evt) { btnGuardar.setEnabled(true);

int rpta = JOptionPane.showConfirmDialog(rootPane, "Est seguro que desea btnCancelar.setEnabled(true);


borrar el registro?");
//Habilita los campos
txtIDProducto.setEnabled(false); private void llenarTabla(){
txtDescripcion.setEnabled(true); //titulos de la tabla

txtStock.setEnabled(true); String titulos[]={"ID


Producto","Descripcin","Precio","Categora","Stock","Nota"};
txtNota.setEnabled(true);
//registramos el nmero de columnas
txtPrecio.setEnabled(true);
String registro[]=new String[6];
cmbCategoria.setEnabled(true);
//pasamos los titulos a la tabla
//Desactivar el flag de registro nuevo
miTabla=new DefaultTableModel(null,titulos);
nuevo = false;
for(int i=0;i<misProductos.size();i++)
//Damos Foco al campo ID
{
txtDescripcion.requestFocusInWindow();
registro[0]=misProductos.get(i).getIdProducto();
}
registro[1]=misProductos.get(i).getDescripcion();
private void formInternalFrameOpened(javax.swing.event.InternalFrameEvent evt) {
registro[2]=""+misProductos.get(i).getPrecio();
mostrarRegistro();
registro[3]=perfil(misProductos.get(i).getCategoria());
llenarTabla();
registro[4]=""+misProductos.get(i).getStock();
}
registro[5]=misProductos.get(i).getNota();
private void mostrarRegistro() {
miTabla.addRow(registro);
txtIDProducto.setText(misProductos.get(proAct).getIdProducto());
}
txtDescripcion.setText(misProductos.get(proAct).getDescripcion());
tblTabla.setModel(miTabla);
txtPrecio.setText(String.valueOf(misProductos.get(proAct).getPrecio()));
}
txtNota.setText(misProductos.get(proAct).getNota());
private String perfil(int idPerfil){
txtStock.setText(String.valueOf(misProductos.get(proAct).getStock()));
switch (idPerfil) {
cmbCategoria.setSelectedIndex(misProductos.get(proAct).getCategoria());
case 1:
}
return "Entrada"; misProductos.get(pos).setPrecio(miProducto.getPrecio());
case 2: misProductos.get(pos).setNota(miProducto.getNota());

return "Sopa"; misProductos.get(pos).setCategoria(miProducto.getCategoria());

case 3: misProductos.get(pos).setStock(miProducto.getStock());

return "Bebida"; return "Producto modificado corecctamente";

case 4: }

return "Ensalada"; // Variables declaration - do not modify

case 5: private javax.swing.JButton btnAnterior;

return "Licor"; private javax.swing.JButton btnBorrar;

} private javax.swing.JButton btnBuscar;

return "Categora no definida"; private javax.swing.JButton btnCancelar;

} private javax.swing.JButton btnGuardar;

public int posicionProducto(String producto){ private javax.swing.JButton btnModificar;

for(int i=0;i<misProductos.size(); i++){ private javax.swing.JButton btnNuevo;

if (misProductos.get(i).getIdProducto().equals(producto)){ private javax.swing.JButton btnPrimero;

return i; private javax.swing.JButton btnSiguiente;

} private javax.swing.JButton btnUltimo;

} private javax.swing.JComboBox<String> cmbCategoria;

return -1; private javax.swing.JLabel jLabel1;

} private javax.swing.JLabel jLabel2;

public String modificarProducto(Producto miProducto, int pos) { private javax.swing.JLabel jLabel3;

// misProductos[pos].setIdProducto(miProducto.getIdProducto()); private javax.swing.JLabel jLabel4;

misProductos.get(pos).setDescripcion(miProducto.getDescripcion()); private javax.swing.JLabel jLabel5;


private javax.swing.JLabel jLabel6; Source
private javax.swing.JLabel jLabel7; package Formularios;
private javax.swing.JScrollPane jScrollPane1; import Clases.*;
private javax.swing.JScrollPane jScrollPane2; import java.util.ArrayList;
private javax.swing.JTable tblTabla; import java.util.Date;
private javax.swing.JTextField txtDescripcion; import javax.swing.*;
private javax.swing.JTextField txtIDProducto; import javax.swing.table.DefaultTableCellRenderer;
private javax.swing.JTextArea txtNota; import javax.swing.table.DefaultTableModel;
private javax.swing.JTextField txtPrecio; import sun.swing.table.DefaultTableCellHeaderRenderer;
private javax.swing.JTextField txtStock; public class frmPedido extends javax.swing.JInternalFrame {
// End of variables declaration private DefaultTableModel miTablaMenu, miTablaPedido, aux;
} private ArrayList<Usuario> misUsuarios = new ArrayList<>();
frmPedido private ArrayList<Cliente> misClientes = new ArrayList<>();

Design private ArrayList<Producto> misProductos = new ArrayList<>();


private ArrayList<Factura> misFacturas = new ArrayList<>();
private Mesa mesa1=new Mesa();
private int mesa, fila;
private double sub, iva, total;
public void setMesa(int mesa) {
this.mesa = mesa;
}
public void setStado(Mesa a){
this.mesa1=a;
} private void cmbMenuActionPerformed(java.awt.event.ActionEvent evt) {
public void setFacturas(ArrayList<Factura> misFacturas) { }

this.misFacturas = misFacturas; private void btnMuestreActionPerformed(java.awt.event.ActionEvent evt) {

} ArrayList<Producto> aux = new ArrayList<>();

public void setProductos(ArrayList<Producto> misProductos) { for (int i = 0; i < misProductos.size(); i++) {

this.misProductos = misProductos; if (misProductos.get(i).getCategoria() == cmbMenu.getSelectedIndex()) {

} Producto ab = new Producto(

public void setUsuarios(ArrayList<Usuario> misUsuarios) { misProductos.get(i).getIdProducto(),

this.misUsuarios = misUsuarios; misProductos.get(i).getDescripcion(),

} misProductos.get(i).getPrecio(),

public void setClientes(ArrayList<Cliente> misClientes) { misProductos.get(i).getNota(),

this.misClientes = misClientes; misProductos.get(i).getCategoria(),

} misProductos.get(i).getStock());

public frmPedido() { aux.add(ab);

sub = total = fila = 0; } }

iva = 0; llenarTablaProdutos(aux);

initComponents(); }

} private void txtTotalActionPerformed(java.awt.event.ActionEvent evt) {

@SuppressWarnings("unchecked") // TODO add your handling code here:

private void cmbMenuMouseClicked(java.awt.event.MouseEvent evt) { }

} private void formInternalFrameOpened(javax.swing.event.InternalFrameEvent evt) {

private void cmbMenuMouseExited(java.awt.event.MouseEvent evt) { reiniciar();

} }
private void txtFechaActionPerformed(java.awt.event.ActionEvent evt) { Producto ab = new Producto(
} misProductos.get(i).getIdProducto(),

private void btnLicoresActionPerformed(java.awt.event.ActionEvent evt) { misProductos.get(i).getDescripcion(),

ArrayList<Producto> aux = new ArrayList<>(); misProductos.get(i).getPrecio(),

for (int i = 0; i < misProductos.size(); i++) { misProductos.get(i).getNota(),

if (misProductos.get(i).getCategoria() == 5) { misProductos.get(i).getCategoria(),

Producto ab = new Producto( misProductos.get(i).getStock());

misProductos.get(i).getIdProducto(), aux.add(ab);

misProductos.get(i).getDescripcion(), } }

misProductos.get(i).getPrecio(), llenarTablaProdutos(aux);

misProductos.get(i).getNota(), }

misProductos.get(i).getCategoria(), private void btnEnsaladasActionPerformed(java.awt.event.ActionEvent evt) {

misProductos.get(i).getStock()); ArrayList<Producto> aux = new ArrayList<>();

aux.add(ab); for (int i = 0; i < misProductos.size(); i++) {

} if (misProductos.get(i).getCategoria() == 4) {

} Producto ab = new Producto(

llenarTablaProdutos(aux); misProductos.get(i).getIdProducto(),

} misProductos.get(i).getDescripcion(),

private void btnSopasActionPerformed(java.awt.event.ActionEvent evt) { misProductos.get(i).getPrecio(),

ArrayList<Producto> aux = new ArrayList<>(); misProductos.get(i).getNota(),


misProductos.get(i).getCategoria(),

for (int i = 0; i < misProductos.size(); i++) { misProductos.get(i).getStock());

if (misProductos.get(i).getCategoria() == 2) { aux.add(ab);
} for (int i = 0; i < misProductos.size(); i++) {
} if (misProductos.get(i).getCategoria() == 1) {

llenarTablaProdutos(aux); Producto ab = new Producto(

} misProductos.get(i).getIdProducto(),

private void btnBebidasActionPerformed(java.awt.event.ActionEvent evt) { misProductos.get(i).getDescripcion(),

ArrayList<Producto> aux = new ArrayList<>(); misProductos.get(i).getPrecio(),

for (int i = 0; i < misProductos.size(); i++) { misProductos.get(i).getNota(),

if (misProductos.get(i).getCategoria() == 3) { misProductos.get(i).getCategoria(),

Producto ab = new Producto( misProductos.get(i).getStock());

misProductos.get(i).getIdProducto(), aux.add(ab);

misProductos.get(i).getDescripcion(), }

misProductos.get(i).getPrecio(), }

misProductos.get(i).getNota(), llenarTablaProdutos(aux);

misProductos.get(i).getCategoria(), }

misProductos.get(i).getStock()); private void btnAumentarActionPerformed(java.awt.event.ActionEvent evt) {

aux.add(ab); int seleccion = tblMenu.getSelectedRow();

} if (cmbMesero.getSelectedIndex() == 0) {

} JOptionPane.showMessageDialog(rootPane, "Debe seleccionar un Mesero");

llenarTablaProdutos(aux); cmbMesero.requestFocusInWindow();

} return;

private void btnEntradaActionPerformed(java.awt.event.ActionEvent evt) { }

ArrayList<Producto> aux = new ArrayList<>(); if (seleccion == -1) {


JOptionPane.showMessageDialog(rootPane, "Debe seleccionar un plato");
tblMenu.requestFocusInWindow(); //Buscamos el producto
return; int sel = tblMenu.getSelectedRow();

} String idSeleccion = tblMenu.getValueAt(sel, 0).toString();

if (txtCantidad.getText().equals("")) { int pos = posicionProducto(idSeleccion);

JOptionPane.showMessageDialog(rootPane, "Debe digitar una cantidad"); int StockAct = misProductos.get(pos).getStock();

txtCantidad.setText(null); //Verificar el Stock

txtCantidad.requestFocusInWindow(); if (StockAct <= 0) {

return; JOptionPane.showMessageDialog(rootPane, "Producto agotado: "

} + misProductos.get(pos).getDescripcion());

if (!misFacturas.get(0).esNumero(txtCantidad.getText())) { return;

JOptionPane.showMessageDialog(rootPane, "Debe ingresar un dato numrico }


en cantidad");
if (StockAct >= cantidad) {
txtCantidad.setText(null);
misProductos.get(pos).setStock(StockAct - cantidad);
txtCantidad.requestFocusInWindow();
} else {
return;
JOptionPane.showMessageDialog(rootPane, "No hay suficiente "
}
+ misProductos.get(pos).getDescripcion());
int cantidad = Integer.parseInt(txtCantidad.getText());
txtCantidad.setText("1");
if (cantidad <= 0) {
return;
JOptionPane.showMessageDialog(rootPane, "Digite una cantidad mayor que
cero"); }
String registro[] = new String[4];
txtCantidad.setText("1");
txtCantidad.requestFocusInWindow(); registro[0] = "" + (cantidad);
registro[1] = misProductos.get(pos).getDescripcion();
return;
} registro[2] = "" + misProductos.get(pos).getPrecio();
registro[3] = "" + (cantidad * misProductos.get(pos).getPrecio()); mod.removeRow(seleccion);
//aadimos prodcuto a la tabla actualizarTotales();

miTablaPedido.addRow(registro); } else {

//Inicializamos campos JOptionPane.showMessageDialog(rootPane, "No se ha seleccionado ningun


elemento");
cmbMenu.setSelectedIndex(0);
}
txtCantidad.setText("1");
} else {
llenarTablaProdutos(misProductos);
JOptionPane.showMessageDialog(rootPane, "No hay elementos para borrar");
cmbMesero.setEnabled(false);
}
//Actualizamos totales
}
actualizarTotales();
private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {
}
int numFilas = tblPedido.getRowCount();
private void btnBackActionPerformed(java.awt.event.ActionEvent evt) {
if (numFilas > 0) {
if (tblPedido.getRowCount()!=0) {
int rpta = JOptionPane.showConfirmDialog(rootPane, "Est seguro de que
mesa1.setEstado(true); Borrar el pedido");
} if (rpta != 0) {
this.setVisible(false); return;
} }
private void btnBorrarActionPerformed(java.awt.event.ActionEvent evt) { llenarTablaPedido();
int seleccion = tblPedido.getSelectedRow(); actualizarTotales();
int numFilas = tblPedido.getRowCount(); cmbMesero.setSelectedIndex(0);
if (numFilas > 0) { cmbMesero.setEnabled(true);
if (seleccion >= 0) { } else {
DefaultTableModel mod = (DefaultTableModel) tblPedido.getModel(); JOptionPane.showMessageDialog(rootPane, "No hay elementos para borrar");
} }
} private void btnPagarActionPerformed(java.awt.event.ActionEvent evt) {

private void btnLiberarMesaActionPerformed(java.awt.event.ActionEvent evt) { Mesero mozo=null;

jlabelMesa.setText("MESA " + mesa); for (int i = 0; i < misUsuarios.size(); i++) {

txtFecha.setText(misFacturas.get(0).formatDate(new Date())); if
(cmbMesero.getItemAt(cmbMesero.getSelectedIndex()).equals(misUsuarios.get(i).get
llenarTablaProdutos(misProductos); Nombres())) {
llenarTablaPedido(); mozo=new Mesero(misUsuarios.get(i).getCi(),
actualizarTotales(); misUsuarios.get(i).getNombres(),
cmbMesero.setEnabled(true); misUsuarios.get(i).getApellidos(),
cmbMesero.setSelectedIndex(0); misUsuarios.get(i).getIdUsuario(),
this.setVisible(false); misUsuarios.get(i).getClave(),
} misUsuarios.get(i).getPerfil(),
private void reiniciar(){ misUsuarios.get(i).getFechaNac(),
jlabelMesa.setText("MESA " + mesa); misUsuarios.get(i).getFechaIngreso());
txtFecha.setText(misFacturas.get(0).formatDate(new Date())); } }
llenarTablaProdutos(misProductos); if (tblPedido.getRowCount() != 0) {
cmbMesero.addItem("Seleccione un mesero"); frmFactura fact = new frmFactura(null, closable);
for (int i = 0; i < misUsuarios.size(); i++) { fact.setDetalle(miTablaPedido);
if (misUsuarios.get(i).getPerfil() == 3) { fact.setMesero(mozo);
cmbMesero.addItem(misUsuarios.get(i).getNombres()); fact.setClientes(misClientes);
} fact.setProductos(misProductos);
} fact.setFacturas(misFacturas);
llenarTablaPedido(); fact.setLocationRelativeTo(null);
fact.setVisible(true); //pasamos los titulos a la tabla
} else { miTablaMenu = new DefaultTableModel(null, titulos);

JOptionPane.showMessageDialog(rootPane, "No se puede generar una factura, for (int i = 0; i < misProductos.size(); i++) {
si no hay pedidos");
registro[0] = misProductos.get(i).getIdProducto();
}
registro[1] = misProductos.get(i).getDescripcion();
}
registro[2] = perfil(misProductos.get(i).getCategoria());
private void llenarTablaPedido() {
registro[3] = "" + misProductos.get(i).getPrecio();
//titulos de la tabla
registro[4] = "" + misProductos.get(i).getStock();
String titulos[] = {"Cantidad", "Descripcin", "Valor unitario", "Importe"};
miTablaMenu.addRow(registro);
String registro[] = new String[4];
}
miTablaPedido = new DefaultTableModel(null, titulos);
tblMenu.setModel(miTablaMenu);
tblPedido.setModel(miTablaPedido);
//alinear campos a la derecha
//alinear campos a la derecha
DefaultTableCellRenderer aux = new DefaultTableCellHeaderRenderer();
DefaultTableCellRenderer aux = new DefaultTableCellHeaderRenderer();
aux.setHorizontalAlignment(SwingConstants.RIGHT);
aux.setHorizontalAlignment(SwingConstants.RIGHT);
tblMenu.getColumnModel().getColumn(3).setCellRenderer(aux);
tblPedido.getColumnModel().getColumn(2).setCellRenderer(aux);
tblMenu.getColumnModel().getColumn(4).setCellRenderer(aux);
tblPedido.getColumnModel().getColumn(3).setCellRenderer(aux);
}
}
private String perfil(int idPerfil) {
private void llenarTablaProdutos(ArrayList<Producto> misProductos) {
switch (idPerfil) {
//titulos de la tabla
case 1:
String titulos[] = {"ID Producto", "Descripcin", "Categora", "Precio", "Stock"};
return "Entrada";
//registramos el nmero de columnas
case 2:
String registro[] = new String[5];
return "Sopa";
case 3: sub = (double) Math.round(sub * 100) / 100;
return "Bebida"; iva = ((sub * 14) / 100);

case 4: iva = (double) Math.round(iva * 100) / 100;

return "Ensalada"; total = sub + iva;

case 5: total = (double) Math.round(total * 100) / 100;

return "Licor"; txtSubTotal.setText(String.valueOf(sub));

} txtIva.setText(String.valueOf(iva));

return "Categora no definida"; txtTotal.setText(String.valueOf(total));

} }

public int posicionProducto(String producto) { // Variables declaration - do not modify

for (int i = 0; i < misProductos.size(); i++) { private javax.swing.JButton btnAumentar;

if (misProductos.get(i).getIdProducto().equals(producto)) { private javax.swing.JButton btnBack;

return i; private javax.swing.JButton btnBebidas;

} private javax.swing.JButton btnBorrar;

} private javax.swing.JButton btnEliminar;

return -1; private javax.swing.JButton btnEnsaladas;

} private javax.swing.JButton btnEntrada;

private void actualizarTotales() { private javax.swing.JButton btnLiberarMesa;

int a = tblPedido.getRowCount(); private javax.swing.JButton btnLicores;

sub = 0; private javax.swing.JButton btnMuestre;

for (int i = 0; i < a; i++) { private javax.swing.JButton btnPagar;

sub += Float.parseFloat(miTablaPedido.getValueAt(i, 3).toString()); private javax.swing.JButton btnSopas;

} private javax.swing.JComboBox<String> cmbMenu;


private javax.swing.JComboBox<String> cmbMesero; Design
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JLabel jlabelMesa;
private javax.swing.JLabel jlabelMesa1;
private javax.swing.JTable tblMenu;
private javax.swing.JTable tblPedido;
private javax.swing.JTextField txtCantidad;
private javax.swing.JTextField txtFecha;
private javax.swing.JTextField txtIva;
private javax.swing.JTextField txtSubTotal;
private javax.swing.JTextField txtTotal;
// End of variables declaration Source
} package Formularios;

frmFactura import Clases.*;


import java.util.ArrayList; public void setClientes(ArrayList<Cliente> misClientes) {
import java.util.Date; this.misClientes = misClientes;

import javax.swing.JOptionPane; }

import javax.swing.SwingConstants; public void setDetalle(DefaultTableModel pedido) {

import javax.swing.table.DefaultTableCellRenderer; this.pedido = pedido;

import javax.swing.table.DefaultTableModel; }

import sun.swing.table.DefaultTableCellHeaderRenderer; public frmFactura(java.awt.Frame parent, boolean modal) {

public class frmFactura extends javax.swing.JDialog { super(parent, modal);

private DefaultTableModel pedido, miDetalle; initComponents();

private ArrayList<Cliente> misClientes; pedido = new DefaultTableModel();

private ArrayList<Producto> misProductos = new ArrayList<>(); caserito = new Cliente(0, null, null, null, null);

private ArrayList<Factura> misFacturas = new ArrayList<>(); }

private Cliente caserito; @SuppressWarnings("unchecked")

private Mesero mozo; private void btnPagarFacturaActionPerformed(java.awt.event.ActionEvent evt) {

public void setMesero(Mesero mesero) { if (txtNombres.getText().equals("")) {

this.mozo = mesero; JOptionPane.showMessageDialog(rootPane, "Debe ingresar el nombre del


cliente");
}
txtNombres.requestFocusInWindow();
public void setFacturas(ArrayList<Factura> misFacturas) {
} else if (txtCedula.getText().equals("")) {
this.misFacturas = misFacturas;
JOptionPane.showMessageDialog(rootPane, "Debe ingresar el nmero de
} cdula");
public void setProductos(ArrayList<Producto> misProductos) { txtCedula.requestFocusInWindow();
this.misProductos = misProductos; } else if (!misFacturas.get(0).esLong(txtCedula.getText())) {
}
JOptionPane.showMessageDialog(rootPane, "Debe ingresar una cadena de if (tblDetalle.getValueAt(j,
nmeros"); 1).equals(misProductos.get(pos).getDescripcion())) {
txtCedula.setText(""); prod.add(misProductos.get(pos));

txtCedula.requestFocusInWindow(); encontro=true;

} else if (txtTelefono.getText().equals("")) { }else{

JOptionPane.showMessageDialog(rootPane, "Debe ingresar un nmero pos++;


telefnico");
}
txtTelefono.requestFocusInWindow();
} while (encontro==false);
} else if (txtDireccion.getText().equals("")) {
}
JOptionPane.showMessageDialog(rootPane, "Debe ingresar una direccin");
///registrar el nuevo cliente desd la factura
txtDireccion.requestFocusInWindow();
encontro=false;
} else if
for (int i = 0; i < misClientes.size(); i++) {
(!misClientes.get(0).validarCedula(Long.parseLong(txtCedula.getText()))) {
if (Long.parseLong(txtCedula.getText())==misClientes.get(i).getCi()) {
JOptionPane.showMessageDialog(rootPane, "El nmero de cdula no es
correcto"); encontro=true;
txtCedula.setText(""); }
txtCedula.requestFocusInWindow(); }
} else { if(encontro==false){
boolean encontro; caserito.setCi(Long.parseLong(txtCedula.getText()));
ArrayList<Producto> prod = new ArrayList<>(); caserito.setNombres(txtNombres.getText());
for (int j = 0; j < tblDetalle.getRowCount(); j++) { caserito.setApellidos(txtApellidos.getText());
encontro=false; caserito.setDireccion(txtDireccion.getText());
int pos=0; caserito.setTelefono(txtTelefono.getText());
do { misClientes.add(caserito);
} txtTelefono.setText(null);
frmPago miPago = new frmPago(null, rootPaneCheckingEnabled); txtNombres.requestFocusInWindow();

miPago.setCliente(caserito); return;

miPago.setProductos(prod); } else {

miPago.setMesero(mozo); caserito = misClientes.get(pos);

miPago.setTotal(txtTotal.getText()); txtCedula.setText("" + misClientes.get(pos).getCi());

miPago.setFacturas(misFacturas); txtNombres.setText(misClientes.get(pos).getNombres());

miPago.setLocationRelativeTo(null); txtApellidos.setText(misClientes.get(pos).getApellidos());

miPago.setVisible(true); txtDireccion.setText(misClientes.get(pos).getDireccion());

btnPagarFactura.setEnabled(false); txtTelefono.setText(misClientes.get(pos).getTelefono());

} }

} }

private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {


String ciCliente = JOptionPane.showInputDialog("Ingrese la cdula del cliente"); private void txtTelefonoActionPerformed(java.awt.event.ActionEvent evt) {

if (ciCliente.equals("")) { // TODO add your handling code here:

return; }

} private void formWindowOpened(java.awt.event.WindowEvent evt) {

int pos = posicionCliente(ciCliente); llenarDetalle();

if (pos == -1) { actualizarTotales();

JOptionPane.showMessageDialog(rootPane, "El cliente no existe"); int a;

txtCedula.setText(null); a =misFacturas.size()+1;

txtNombres.setText(null); txtNumFactura.setText("" + a);

txtDireccion.setText(null); txtfecha.setText(misFacturas.get(0).formatDate(new Date()));


txtNombres.requestFocusInWindow(); double sub, iva, total;
} sub = 0;

private void llenarDetalle() { for (int i = 0; i < a; i++) {

//titulos de la tabla sub += Float.parseFloat(miDetalle.getValueAt(i, 3).toString());

String titulos[] = {"Cantidad", "Descripcin", "Valor unitario", "Importe"}; }

String registro[] = new String[4]; sub = (double) Math.round(sub * 100) / 100;

miDetalle = new DefaultTableModel(null, titulos); iva = ((sub * 14) / 100);

for (int i = 0; i < pedido.getRowCount(); i++) { iva = (double) Math.round(iva * 100) / 100;

registro[0] = "" + pedido.getValueAt(i, 0); total = sub + iva;

registro[1] = "" + pedido.getValueAt(i, 1); total = (double) Math.round(total * 100) / 100;

registro[2] = "" + pedido.getValueAt(i, 2); txtSubTotal.setText(String.valueOf(sub));

registro[3] = "" + pedido.getValueAt(i, 3); txtIva.setText(String.valueOf(iva));

miDetalle.addRow(registro); txtTotal.setText(String.valueOf(total));

} }

tblDetalle.setModel(miDetalle); public int posicionCliente(String ciCliente) {

//alinear campos a la derecha for (int i = 0; i < misClientes.size(); i++) {

DefaultTableCellRenderer aux = new DefaultTableCellHeaderRenderer(); if (misClientes.get(i).getCi() == (Long.parseLong(ciCliente))) {

aux.setHorizontalAlignment(SwingConstants.RIGHT); return i;

tblDetalle.getColumnModel().getColumn(2).setCellRenderer(aux); }

tblDetalle.getColumnModel().getColumn(3).setCellRenderer(aux); }

} return -1;

private void actualizarTotales() { }

int a = tblDetalle.getRowCount(); public static void main(String args[]) {


java.awt.EventQueue.invokeLater(new Runnable() { private javax.swing.JLabel jLabel7;
public void run() { private javax.swing.JLabel jLabel8;

frmFactura dialog = new frmFactura(new javax.swing.JFrame(), true); private javax.swing.JLabel jLabel9;

dialog.addWindowListener(new java.awt.event.WindowAdapter() { private javax.swing.JPanel jPanel1;

@Override private javax.swing.JScrollPane jScrollPane1;

public void windowClosing(java.awt.event.WindowEvent e) { private javax.swing.JTable tblDetalle;

System.exit(0); private javax.swing.JTextField txtApellidos;

} private javax.swing.JTextField txtCedula;

}); private javax.swing.JTextField txtDireccion;

dialog.setVisible(true); private javax.swing.JTextField txtIva;

} private javax.swing.JTextField txtNombres;

}); private javax.swing.JTextField txtNumFactura;

} private javax.swing.JTextField txtSubTotal;

// Variables declaration - do not modify private javax.swing.JTextField txtTelefono;

private javax.swing.JButton btnBuscar; private javax.swing.JTextField txtTotal;

private javax.swing.JButton btnPagarFactura; private javax.swing.JTextField txtfecha;

private javax.swing.JLabel jLabel1; // End of variables declaration

private javax.swing.JLabel jLabel10; }

private javax.swing.JLabel jLabel2;


private javax.swing.JLabel jLabel3;
frmPago
private javax.swing.JLabel jLabel4;
Design
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private Mesero mozo;
public void setMesero(Mesero mesero) {
this.mozo = mesero;
}
public void setFacturas(ArrayList<Factura> misFacturas) {
this.misFacturas = misFacturas;
}
public void setProductos(ArrayList<Producto> misProductos) {
this.misProductos = misProductos;
}
public void setTotal(String total){
this.Total=total;

Source }
public void setCliente(Cliente a){
package Formularios;
this.caserito=a;
import Clases.*;
}
import java.util.ArrayList;
public frmPago(java.awt.Frame parent, boolean modal) {
import javax.swing.JOptionPane;
super(parent, modal);
import static Archivos.ArchivosPlanos.guardarFactura;
initComponents();
public class frmPago extends javax.swing.JDialog {
}
private String Total;
@SuppressWarnings("unchecked")
private Cliente caserito;
private void txtIngresoActionPerformed(java.awt.event.ActionEvent evt) {
private ArrayList<Producto> misProductos = new ArrayList<>();
// TODO add your handling code here:
private ArrayList<Factura> misFacturas = new ArrayList<>();
} JOptionPane.showMessageDialog(rootPane, "Debe ingresar un monto");
private void formWindowOpened(java.awt.event.WindowEvent evt) { txtIngreso.setText(null);

txtTotal.setText(Total); txtCambio.setText(null);

} txtIngreso.requestFocusInWindow();

private void btnAceptarActionPerformed(java.awt.event.ActionEvent evt) { return;

guardarFactura(misFacturas, txtTotal.getText(), caserito, mozo, misProductos); }

JOptionPane.showMessageDialog(rootPane, "Factura agregada"); if(!esFloat(txtIngreso.getText())){

dispose(); JOptionPane.showMessageDialog(rootPane, "Debe ingresar un valor


numerico");
}
txtIngreso.requestFocusInWindow();
private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {
return;}
dispose();
float ingreso =Float.parseFloat(txtIngreso.getText());
}
float monto=Float.parseFloat(Total);
private void txtIngresoFocusLost(java.awt.event.FocusEvent evt) {
if(monto>ingreso){
}
JOptionPane.showMessageDialog(rootPane, "El monto no es suficiente");
private void txtIngresoKeyPressed(java.awt.event.KeyEvent evt) {
txtIngreso.setText(null);
}
txtIngreso.requestFocusInWindow();
private void btnCambioActionPerformed(java.awt.event.ActionEvent evt) {
txtCambio.setText("");
cambio();
return;
btnAceptar.setEnabled(true);
}
}
//Calculamos el vuelto
private void cambio(){
float cambio=ingreso-monto;
//Validaciones
cambio= (float) Math.round(cambio * 100) / 100;
if(txtIngreso.getText().equals("")){
txtCambio.setText(String.valueOf(cambio)); }
} // Variables declaration - do not modify

private boolean esFloat(String cadena) { private javax.swing.JButton btnAceptar;

try { private javax.swing.JButton btnCambio;

Float.parseFloat(cadena); private javax.swing.JButton btnCancelar;

return true; private javax.swing.JLabel jLabel1;

} catch (NumberFormatException ex) { private javax.swing.JLabel jLabel2;

return false; private javax.swing.JLabel jLabel3;

} } private javax.swing.JPanel jPanel1;


private javax.swing.JTextField txtCambio;

public static void main(String args[]) { private javax.swing.JTextField txtIngreso;

java.awt.EventQueue.invokeLater(new Runnable() { private javax.swing.JTextField txtTotal;

public void run() { // End of variables declaration

frmPago dialog = new frmPago(new javax.swing.JFrame(), true); }

dialog.addWindowListener(new java.awt.event.WindowAdapter() { frmAcercaDe


@Override
Design
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
frmRegistroFacturas
Design

Source
package Formularios;

public class frmAcercaDe extends javax.swing.JInternalFrame {

public frmAcercaDe() {

initComponents(); Source
}

@SuppressWarnings("unchecked") package Formularios;


// Variables declaration - do not modify import Clases.Factura;
private javax.swing.JLabel jLabel1; import java.text.SimpleDateFormat;

private javax.swing.JScrollPane jScrollPane1; import java.util.*;

private javax.swing.JTextArea jTextArea1; import javax.swing.*;

// End of variables declaration } import javax.swing.table.DefaultTableCellRenderer;


import javax.swing.table.DefaultTableModel;
import sun.swing.table.DefaultTableCellHeaderRenderer; if (numFactura == misFacturas.get(i).getNumeroFac()) {
import static Archivos.ArchivosPlanos.guardarModifyFact; misFacturas.remove(i);

public class frmRegistroFacturas extends javax.swing.JInternalFrame { }

private ArrayList<Factura> misFacturas = new ArrayList<>(); }

private DefaultTableModel miTablaFactura; DefaultTableModel mod = (DefaultTableModel) tblFacturas.getModel();

public void setFacturas(ArrayList<Factura> misFacturas) { mod.removeRow(seleccion);

this.misFacturas = misFacturas; guardarModifyFact(misFacturas);

} } else {

public frmRegistroFacturas() { JOptionPane.showMessageDialog(rootPane, "No se ha seleccionado ningun


elemento");
initComponents();
}
}
} else {
@SuppressWarnings("unchecked")
JOptionPane.showMessageDialog(rootPane, "No hay elementos para borrar");
private void formInternalFrameOpened(javax.swing.event.InternalFrameEvent evt) {
}
llenarTablaFacturas(misFacturas);
llenarTablaFacturas(misFacturas);
}
}
private void btnBorrarActionPerformed(java.awt.event.ActionEvent evt) {
int seleccion = tblFacturas.getSelectedRow();
private void btnFechaActionPerformed(java.awt.event.ActionEvent evt) {
int numFilas = tblFacturas.getRowCount();
ArrayList<Factura> aux = new ArrayList<>();
if (numFilas > 0) {
Date fecha = StringDate(JOptionPane.showInputDialog("Ingrese una fecha
if (seleccion >= 0) { (dd/mm/yyyy)"));
int numFactura = Integer.parseInt(tblFacturas.getValueAt(seleccion, if (fecha==null){
0).toString());
return;
for (int i = 0; i < misFacturas.size(); i++) {
}
for (int i = 0; i < misFacturas.size(); i++) { misFacturas.get(i).getFecha(),
if (misFacturas.get(i).getFecha().equals(fecha)) { misFacturas.get(i).getMesero(),

Factura ab = new Factura( misFacturas.get(i).getMisProductos());

misFacturas.get(i).getNumeroFac(), aux.add(ab);

misFacturas.get(i).getTotal(), }

misFacturas.get(i).getCliente(), }

misFacturas.get(i).getFecha(), llenarTablaFacturas(aux);

misFacturas.get(i).getMesero(), }

misFacturas.get(i).getMisProductos()); private void btnMeseroActionPerformed(java.awt.event.ActionEvent evt) {

aux.add(ab); ArrayList<Factura> aux = new ArrayList<>();

} String nombre=JOptionPane.showInputDialog("Ingrese el nombre del mesero");

} for (int i = 0; i < misFacturas.size(); i++) {

llenarTablaFacturas(aux); if (misFacturas.get(i).getMesero().getNombres().equalsIgnoreCase(nombre)) {

} Factura ab = new Factura(

private void btnClienteActionPerformed(java.awt.event.ActionEvent evt) { misFacturas.get(i).getNumeroFac(),

ArrayList<Factura> aux = new ArrayList<>(); misFacturas.get(i).getTotal(),

String nombre=JOptionPane.showInputDialog("Ingrese el nombre del cliente"); misFacturas.get(i).getCliente(),

for (int i = 0; i < misFacturas.size(); i++) { misFacturas.get(i).getFecha(),

if (misFacturas.get(i).getCliente().getNombres().equalsIgnoreCase(nombre)) { misFacturas.get(i).getMesero(),

Factura ab = new Factura( misFacturas.get(i).getMisProductos());

misFacturas.get(i).getNumeroFac(), aux.add(ab);

misFacturas.get(i).getTotal(), }

misFacturas.get(i).getCliente(), }
llenarTablaFacturas(aux); miTablaFactura = new DefaultTableModel(null, titulos);
} for (int i = 0; i < misFacturas.size(); i++) {

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { registro[0] = "" + misFacturas.get(i).getNumeroFac();

llenarTablaFacturas(misFacturas); registro[1] = DateToString(misFacturas.get(i).getFecha());

} registro[2] = "" + misFacturas.get(i).getTotal();

//Mtodo para convertir String en fecha registro[3] = "" + misFacturas.get(i).getCliente().getNombres();

public Date StringDate(String fecha) { registro[4] = "" + misFacturas.get(i).getMesero().getNombres();

SimpleDateFormat formaDelTexto = new SimpleDateFormat("dd/MM/yyyy"); miTablaFactura.addRow(registro);

Date aux = null; }

try { tblFacturas.setModel(miTablaFactura);

aux = formaDelTexto.parse(fecha);
} catch (Exception ex) { //alinear campos a la derecha
DefaultTableCellRenderer aux = new DefaultTableCellHeaderRenderer();

} aux.setHorizontalAlignment(SwingConstants.RIGHT);

return aux; tblFacturas.getColumnModel().getColumn(2).setCellRenderer(aux);

} }
//Mtodo para cambiar el formato de fecha a string

private void llenarTablaFacturas(ArrayList<Factura> misFacturas) { public String DateToString(Date fecha) {

//titulos de la tabla SimpleDateFormat formatodeltexto = new SimpleDateFormat("dd/MM/yyyy");

String titulos[] = {"N Factura", "Fecha", "Aporte", "Cliente", "Mesero"}; return formatodeltexto.format(fecha);

//registramos el nmero de columnas }

String registro[] = new String[5]; // Variables declaration - do not modify

//pasamos los titulos a la tabla private javax.swing.JButton btnBorrar;


private javax.swing.JButton btnCliente;
private javax.swing.JButton btnFecha;
private javax.swing.JButton btnMesero;
private javax.swing.JButton jButton1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable tblFacturas;
// End of variables declaration
}
EXPLICACIONES
Explicaciones de los mtodos ms importantes y cdigos que usamos:

Este mtodo permite validar la cdula del modo que se separa el ltimo dgito, de todos los
dgitos pares se comienza a sumar y si excede de 9 se le resta nueve y as sucesivamente, por
otra parte los impares se suman, al final sumo los valores resultantes de los pares e impares,
de esta suma saco su mdulo en base de 10, el resultado resto de 10 y la cantidad que sale
debe coincidir con el ltimo digito que separ.
Este mtodo permite que validemos un precio, el cual no puede ser negativo, usamos el
parseFloat porque recibe un String, este String requerimos trabajarlo como nmero decimal y
por ello la conversin, usando el try y catch para excepciones y la accin a hacer en caso de
que no pase, como el mtodo lo declaramos de tipo int nos retorna un entero, en tres casos: -
1, 0 y 1 de acuerdo a la parte que cumpli.

Este mtodo va a hacer que validemos que cantidad sea un entero, al estar con parmetro le
vamos a enviar un String, y se va a proceder a convertir un dato numrico almacenado en un
String usando el mtodo "parse".

En vista que vamos a trabajar con archivos necesitamos que nuestra informacin se guarde,
para ello utilizamos este mtodo que permitir que guardemos los usuarios en archivos planos,
con el uso del FileWritter que nos permite escribir en ficheros, y PrintWritter, el PrintWriter
te permite escribir cosas, por ejemplo en archivos, te genera el archivo nuevo, y en caso de
que exista te lo sustituye. Para Clientes y Productos se procedi con las mismas lneas de
cdigo pero con unos pequeos cambios en los atributos y objetos con los que se trabaj.
Estos condicionales se encuentran en el botn Guardar cuando agregamos un cliente,
prcticamente son validaciones de que no existan campos vacos, pues para su registro
necesitamos que de manera obligatoria complete todos los campos de informacin del registro
de Clientes.

Esta seccin de cdigo tambin se encuentra implementada en el botn Guardar al crear un


cliente y es para Validar que el cliente no exista, es decir que no podemos poner dos clientes
con los mismos datos porque eso no nos conviene en ningn aspecto y es ms, nos podra
confundir en los procesos del restaurante.
Al momento de llenar una tabla con los datos del cliente es necesario que desactivemos los
campos de informacin puesto que ya los complet, y activemos los botones pertenecientes a
la parte del registro de clientes donde podr realizar ms acciones como observar el primer
cliente del registro, el siguiente, anterior, ltimo, buscar a algn cliente, borrarlo o
modificarlo, aqu desactivamos el botn guardar porque no es necesario ya que no estamos
modificando nada por el momento hasta que escoja esa opcin.

Limpia los campos haciendo que las partes de TextField para solicitar informacin como
nombres, apellidos, cdula, etc, se vacen al completar una accin y para ello le mandamos un
null.

Este mtodo va a permitir que llenemos la tabla, primero establecemos ttulos, procedemos a
declarar el nmero de columnas que se va a tener y pasamos dichos ttulos a la tabla.
Esta seccin del cdigo al momento de guardar un usuario debe confirmar su clave
volvindola a ingresar, por ello esto permite validar que la clave y su confirmacin coincidan
para otorgar seguridad a la cuenta de dicho usuario.

Mtodo para establecer el perfil de la persona, catalogndolo en tres tipos de usuario con
diferentes acceso cada uno, dependiendo del rango que tiene, este mtodo permite identificarlo
y conocer si existe o no.

Permite modificar a un Usuario, este se emplea tambin para clientes y productos o de manera
muy similar, pues mandamos los nuevos datos con el uso de get y set, con el get obtenemos
lo que acaba de ingresar y el set es para prcticamente reemplazar la informacin del mismo.
Al trabajar con fechas es importante conocer que dicho formato es diferente, para ello hacemos
el uso de dos mtodos, el primero nos va a permitir transformar un String a Fecha y el segundo
transformar un formato de Fecha a String, ambos para el uso de fechas como mencionamos.
Es importante recalcar que solo trabajos en da, mes y ao, por ello existe esa especificacin
en el cdigo.

Seccin del cdigo que nos permitir buscar el producto que el cliente desea de acuerdo a los
productos que tenemos disponibles, y de acuerdo al idSeleccion que bsicamente es el cdigo
del producto con el que lo denominamos y establecimos en nuestro inventario.

Esta seccin de cdigo permite verificar el Stock, es decir validar que la cantidad que quiere
adquirir no sea superior a la que tenemos disponible en un restaurante, pues esto es importante
para la atencin de un lugar de comida.
Ojo:
Existen muchos otros mtodos y cdigo desarrollado pero eso se encuentra especificado en la
parte de cdigo con comentarios que dan una corta explicacin de su funcionamiento.
CONCLUSIONES:
- La interfaz grfica de usuario permite que las aplicaciones que desarrollemos puedan
interactuar con las personas que la utilizan y puedan ser optimizadas las funciones para
las que se la desarroll, satisfaciendo al consumidor y permitindolo entender sin
necesidad de conocer acerca de programacin.

- En los sucesos cotidianos se presentan diversos problemas en diferentes mbitos que


forman parte de nuestro desarrollo de vida, por ello es importante que si tenemos a
disposicin el uso e implementacin de la programacin para suplir soluciones lo
hagamos, aplicando nuestros conocimientos para el bien ptimo de la sociedad, java
permite el desarrollo de diversas funciones en su API y debemos entenderlas para que
todo esto se pueda evitar o solventar dichas situaciones.

- El uso de archivos es importante en las aplicaciones que generamos para guardar la


infomacin que desarrollamos, porque en las situaciones reales requerimos que la
informacin sea guardada y no solo mostrada en consola por un instante.

- Validar se puede realizar con if y else, sin embargo para proyectos o aplicaciones
usamos tambin el try y catch porque esto va a permitirnos que cualquier error
involuntario pueda no generar un error en el programa.

- Es importante que integremos todos los conocimientos para realizar programas que
produzcan un beneficio y no solo contener dichos conocimientos para nosotros, pues
en ello se basa el futuro de una sociedad y el desarrollo de la misma.

- El uso de Paneles, Ventanas, Label, TextField, PaswwordField, entre otros


componentes de la interfaz grfica es recomendable manejarla desde las herramientas
del Frame para un mayor ajuste y que no se complique el desarrollo de la aplicacin
con generacin del cdigo, para ello debemos analizar que caminos son ms
convenientes.

- La mejor forma de aprender es primero leer, luego realizar y por ltimo exponer, al
realizar esta aplicacin cumplimos dicho proceso y permitir que estos conocimientos
de Programacin II se impregnen en nosotros.

RECOMENDACIONES:
Es importante que analizemos los mejores procesos y ms cortos que cumplan con las
especificaciones necesarias, por ello debemos desarrollar la lgica y el conocimiento de los
procesos que se desarrollan en Java.

You might also like