domingo, 24 de abril de 2011

 

Factura en JAVA



Factura en JAVA
1: Diseñe el siguiente Formulario
2:Codigo Fuente
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:

           //Agregamos a la lista

        lbcantidad.add(txtcantidad.getText());
        lbunitario.add(txtpunitario.getText());
        lbdescripcion.add(txtdescripcion.getText());
      
    //  Variables:
     
   Double precio,a,cantidad,st,i,t,y,ig,f;

         cantidad=Double.parseDouble(txtcantidad.getText());
         precio=Double.parseDouble(txtpunitario.getText());
         a=cantidad*precio;
        lbtotal.add(String.valueOf(a));
         st=Double.parseDouble(txtstotal.getText());
   txtstotal.setText(String.valueOf(a+st));
   f=Double.parseDouble(txtstotal.getText());
ig=f*0.19;
txtigv.setText(String.valueOf(ig));
 t=Double.parseDouble(txtstotal.getText());
i=Double.parseDouble(txtigv.getText());
y=i+t;
txttotal.setText(String.valueOf(y))

formWindowActivated:(Recuerda Dento del evento de Window)
private void formWindowActivated(java.awt.event.WindowEvent evt) {                                    
        // TODO add your handling code here:
        //Agregamos al Combo Box
         cbocodigo.add("00002");
         cbocodigo.add("00003");
         cbocodigo.add("00004");
         cbocodigo.add("00005");
         cbocodigo.add("00006");
         cbocodigo.add("00007");
         cbocodigo.add("00008");
     
    }       

 
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
    //Genera Codigo:
      
            lbnro.setText(String.valueOf(lbnro.getText()+1));

        //Limpia los texbox.
             txtcantidad.setText("0");
                txtpunitario.setText("0");
                        txtdescripcion.setText("");
                        txtstotal.setText("0");
                        txtigv.setText("0");
                        txttotal.setText("0");
                        lbcantidad.clear();
                        lbdescripcion.clear();
                       lbunitario.clear();
                     lbtotal.clear();
***********************************************************
*Recuerda si no entiendes deja tu mensaje en este link



Share: