Hola amigos wirelianos, hoy vamos a crear un simple y amigable programa que permitirá obtener el iva de cualquier valor.
Esto tambien es modificable a cualquier porcentaje de IVA, segun corresponda a tu pais.
Comenzamos:
en visual basic 6 debemos crear los siguientes elementos en nuestro formulario:
5 LABEL
3 TEXBOX
2 RADIOBUTTON
los label son para mostrar la información referente a cada textbox.
Deberiamos crear algo así:
ahora vamos a cambiar de nombre a los TextBox, estos deberian quedar con estos nombre como identificador dentro del VB6, en las propiedades podemos cambiar el nombre:
Textbox1 = valor_iva
Textbox2 = txt_neto
Textbox3 = txt_total
Label1 = lb_iva
También definimos los nombres de los radiobutton,
radiobutton1=sacar
radiobutton2=sacar
en visual basic nos hara mension si quiere crear una matriz con estos radios buttons, ponemos que SI, en tonces los nombres identicadores de los radios quedarán así:
sacar(0)
sacar(1)
ya terminado esto vamos a poner el codigo para poder realizar nuetro software:
- Código: Seleccionar todo
Private Sub end_Click()
End
End Sub
Private Sub Form_Load()
If sacar(0).Value = True Then
txt_total.Visible = True
lb_neto.Visible = True
lb_total.Visible = False
txt_neto.Visible = False
End If
End Sub
Private Sub power_Click()
MsgBox ("Hola, Gracias por usar este software, algo que es muy importante NO PAGUES por el uso. Espero que te sea de gran Ayuda. Atte Rafthael - San Fernando - Chile"), vbInformation, "Obtener IVA"
End Sub
Private Sub sacar_Click(Index As Integer)
'sacar IVA
If sacar(0).Value = True Then
lb_total.Visible = False
txt_neto.Visible = False
txt_total.Visible = True
lb_neto.Visible = True
Traspasa = txt_neto.Text
txt_total_Change
End If
'Agregar IVA
If sacar(1).Value = True Then
lb_total.Visible = True
txt_neto.Visible = True
txt_total.Visible = False
lb_neto.Visible = False
Traspasa = txt_total.Text
txt_neto_Change
End If
End Sub
Private Sub txt_neto_Change()
Dim totalx As Long
Dim netox As Long
Dim ivax As Long
Dim banderax As Integer
' para obtener el iva de un valor neto
If txt_neto.Text = "" Then
banderax = 1
End If
If Traspasa <> "" Then
txt_neto.Text = Traspasa
Traspasa = ""
End If
If banderax <> 1 Then
valor_ivax = (Int(valor_iva.Text) / 100)
ivax = Int(txt_neto * valor_ivax)
totalx = Int(txt_neto + ivax)
lb_iva.Caption = ivax
lb_total.Caption = totalx
End If
End Sub
Private Sub txt_neto_KeyPress(KeyAscii As Integer)
If KeyAscii > 57 Or KeyAscii < 48 Then
If KeyAscii <> 8 And KeyAscii <> 13 Then
KeyAscii = 0
End If
End If
End Sub
Private Sub txt_total_Change()
Dim total As Long
Dim neto As Long
Dim iva As Long
Dim bandera As Integer
' para obtener el iva de un valor Total
If txt_total.Text = "" Then
bandera = 1
End If
If Traspasa <> "" Then
txt_total.Text = Traspasa
Traspasa = ""
End If
If bandera <> 1 Then
valor_ivaZ = (valor_iva / 100) + 1
neto = (Int(txt_total.Text) / valor_ivaZ)
iva = Int(txt_total.Text) - neto
lb_iva.Caption = Int(iva)
lb_neto.Caption = Int(neto)
End If
End Sub
Private Sub txt_total_KeyPress(KeyAscii As Integer)
If KeyAscii > 57 Or KeyAscii < 48 Then
If KeyAscii <> 8 And KeyAscii <> 13 Then
KeyAscii = 0
End If
End If
End Sub
Private Sub valor_iva_Change()
txt_neto_Change
txt_neto_Change
End Sub
ya integrando este codigo podras crear tu propia aplicación de calculo de iva para tu negocio.
Descargar Proyecto en VB6

¡LINK OCULTO! - Presiona aquí para VERLO
Descargar Aplicación Compilada como EXE

¡LINK OCULTO! - Presiona aquí para VERLO
Si te ha servido esta aplcación dejanos tu mensaje, saludos.
