Public Class Form2
'DECLARACIÓN DE VARIABLES.
Dim tarifa_coche As Decimal = 0.5
Dim tarifa_camion As Decimal = 0.5
Dim tarifa_moto As Decimal = 2.5
Dim tarifa_bus As Decimal = 0.75
Dim descuento As Decimal = 0.5
Dim aux_descuento As Decimal = 0
Dim tara As Decimal = 0.25
Public toneladas As Decimal
Dim aux As Decimal
Public km As Decimal
Public total As Decimal
Dim tipo As Integer
'EVENTOS BOTONES TIPO DE VEHÍCULO
Private Sub boton_coche_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles boton_coche.Click
Me.boton_coche.Image = PEAJE.My.Resources.Resources.ICO_COCHE_ON
Me.boton_camion.Image = PEAJE.My.Resources.Resources.ICO_CAMION
Me.boton_moto.Image = PEAJE.My.Resources.Resources.ICO_MOTO
Me.boton_bus.Image = PEAJE.My.Resources.Resources.ICO_BUS
Me.caja_tara.Enabled = "False"
Me.boton_descuento.Enabled = "True"
aux = tarifa_coche
tipo = 1
End Sub
Private Sub boton_camion_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles boton_camion.Click
Me.boton_camion.Image = PEAJE.My.Resources.Resources.ICO_CAMION_ON
Me.boton_coche.Image = PEAJE.My.Resources.Resources.ICO_COCHE
Me.boton_moto.Image = PEAJE.My.Resources.Resources.ICO_MOTO
Me.boton_bus.Image = PEAJE.My.Resources.Resources.ICO_BUS
Me.caja_tara.Enabled = "True"
Me.boton_descuento.Enabled = "False"
aux = tarifa_camion
tipo = 2
End Sub
Private Sub boton_moto_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles boton_moto.Click
Me.boton_moto.Image = PEAJE.My.Resources.Resources.ICO_MOTO_ON
Me.boton_camion.Image = PEAJE.My.Resources.Resources.ICO_CAMION
Me.boton_coche.Image = PEAJE.My.Resources.Resources.ICO_COCHE
Me.boton_bus.Image = PEAJE.My.Resources.Resources.ICO_BUS
Me.caja_tara.Enabled = "False"
Me.boton_descuento.Enabled = "False"
km = 1
aux = tarifa_moto
tipo = 3
End Sub
Private Sub boton_bus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles boton_bus.Click
Me.boton_bus.Image = PEAJE.My.Resources.Resources.ICO_BUS_ON
Me.boton_camion.Image = PEAJE.My.Resources.Resources.ICO_CAMION
Me.boton_moto.Image = PEAJE.My.Resources.Resources.ICO_MOTO
Me.boton_coche.Image = PEAJE.My.Resources.Resources.ICO_COCHE
Me.caja_tara.Enabled = "False"
Me.boton_descuento.Enabled = "False"
aux = tarifa_bus
tipo = 4
End Sub
'EVENTO DEL BOTÓN DESCUENTO
Private Sub boton_descuento_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles boton_descuento.Click
Me.boton_descuento.Image = PEAJE.My.Resources.Resources.DESCUENTO_ON
If tipo = 1 Then
aux_descuento = descuento
End If
End Sub
'CAJAS DE TEXTO (DATOS)
Private Sub caja_km_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles caja_km.TextChanged
km = Val(Me.caja_km.Text)
Form3.caja_km_total.Text = Me.caja_km.Text
End Sub
Private Sub caja_tara_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles caja_tara.TextChanged
toneladas = Val(Me.caja_tara.Text)
Form3.caja_tara_total.Text = Me.caja_tara.Text
End Sub
'EVENTO DEL BOTÓN CALCULAR IMPORTE
Public Sub boton_calcular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles boton_calcular.Click
Select Case tipo
Case 1
total = (aux * km) - aux_descuento
Me.importe_euros.Text = Format(total, "0.00")
Me.importe_pesetas.Text = Format(total * 166.386, "0.00")
Form3.importe_euros_total.Text = Format(total, "0.00")
Form3.importe_pesetas_total.Text = Format(total * 166.386, "0.00")
Form3.tipo_vehiculo.Image = PEAJE.My.Resources.Resources.ICO_COCHE_MINI
Case 2
total = (aux * km) + (toneladas * tara)
Me.importe_euros.Text = Format(total, "0.00")
Me.importe_pesetas.Text = Format(total * 166.386, "0.00")
Form3.importe_euros_total.Text = Format(total, "0.00")
Form3.importe_pesetas_total.Text = Format(total * 166.386, "0.00")
Form3.tipo_vehiculo.Image = PEAJE.My.Resources.Resources.ICO_CAMION_MINI
Case 3
total = aux * km
Me.importe_euros.Text = Format(total, "0.00")
Me.importe_pesetas.Text = Format(total * 166.386, "0.00")
Form3.importe_euros_total.Text = Format(total, "0.00")
Form3.importe_pesetas_total.Text = Format(total * 166.386, "0.00")
Form3.tipo_vehiculo.Image = PEAJE.My.Resources.Resources.ICO_MOTO_MINI
Case 4
total = aux * km
Me.importe_euros.Text = Format(total, "0.00")
Me.importe_pesetas.Text = Format(total * 166.386, "0.00")
Form3.importe_euros_total.Text = Format(total, "0.00")
Form3.importe_pesetas_total.Text = Format(total * 166.386, "0.00")
Form3.tipo_vehiculo.Image = PEAJE.My.Resources.Resources.ICO_BUS_MINI
End Select
End Sub
' EVENTO PARA EL BOTÓN DE TICKET
Private Sub boton_ticket_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles boton_ticket.Click
Dim fticket As New Form3
Form3.Show()
Me.Close()
End Sub
End Class