jueves, 3 de mayo de 2012

RETO 4 –Venta de Partes de Pcs



Public Class frmventa_partes_pc

    Private Sub btncalcular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncalcular.Click
        Dim m0, m1, m2, m3, d0, d1, d2, d3, sumdiscos, summemorias, mouse, joystick, pantalla, agb, bgb, cgb, subtotal, igv, neto As Double
        Dim cero As Integer = 0
        Dim cero2 As Integer = 0
        If chklmemoria.GetItemCheckState(0) = CheckState.Checked Then
            m0 = 5
        Else
            m0 = 0
        End If
        If chklmemoria.GetItemCheckState(1) = CheckState.Checked Then
            m1 = 10
        Else
            m1 = 0
        End If
        If chklmemoria.GetItemCheckState(2) = CheckState.Checked Then
            m2 = 12
        Else
            m2 = 0
        End If
        If chklmemoria.GetItemCheckState(3) = CheckState.Checked Then
            m3 = 13
        Else
            m3 = 0
        End If
        summemorias = m0 + m1 + m2 + m3
        lblmemoria.Text = "$ " & summemorias
        If chkldiscoduro.GetItemCheckState(0) = CheckState.Checked Then
            d0 = 90
        Else
            d0 = 0
        End If
        If chkldiscoduro.GetItemCheckState(1) = CheckState.Checked Then
            d1 = 115
        Else
            d1 = 0
        End If
        If chkldiscoduro.GetItemCheckState(2) = CheckState.Checked Then
            d2 = 130
        Else
            d2 = 0
        End If
        If chkldiscoduro.GetItemCheckState(3) = CheckState.Checked Then
            d3 = 170
        Else
            d3 = 0
        End If
        sumdiscos = d0 + d1 + d2 + d3
        lbldiscoduro.Text = "$ " & sumdiscos

        If rbo512.Checked Then
            agb = 10
            lblusb.Text = "$" & agb
        ElseIf rbo1gb.Checked Then
            bgb = 20
            lblusb.Text = "$ " & bgb
        ElseIf rbo2gb.Checked Then
            cgb = 30
            lblusb.Text = "$ " & cgb
        Else
            lblusb.Text = "$ " & cero
        End If
        If chkmouse.Checked Then
            mouse = 5
            lblmouse.Text = "$ " & mouse
        Else
            lblmouse.Text = "$ " & cero2
        End If
        If chkjoystick.Checked Then
            joystick = 12
            lbljoystick.Text = "$ " & joystick
        Else
            lbljoystick.Text = "$" & cero2
        End If
        If chkpantalla.Checked Then
            pantalla = 14
            lblpantalla.Text = "$ " & pantalla
        Else
            lblpantalla.Text = "$ " & cero2
        End If
        subtotal = sumdiscos + summemorias + mouse + joystick + pantalla + agb + bgb + cgb
        lblsubtotal.Text = "$ " & subtotal
        igv = subtotal * 0.18
        lbligv.Text = "$ " & igv
        neto = subtotal + igv
        lblneto.Text = "$ " & neto
    End Sub

    Private Sub btnnuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnuevo.Click
        Dim i As Integer
        For i = 0 To chklmemoria.Items.Count - 1
            chklmemoria.SetItemChecked(i, False)
        Next
        For i = 0 To chkldiscoduro.Items.Count - 1
            chkldiscoduro.SetItemChecked(i, False)
        Next
        rbo1gb.Checked = False
        rbo2gb.Checked = False
        rbo512.Checked = False
        chkjoystick.Checked = False
        chkmouse.Checked = False
        chkpantalla.Checked = False
        lblmemoria.Text = ""
        lbldiscoduro.Text = ""
        lblusb.Text = ""
        lbljoystick.Text = ""
        lblmouse.Text = ""
        lblpantalla.Text = ""
        lblsubtotal.Text = ""
        lbligv.Text = ""
        lblneto.Text = ""
    End Sub

    Private Sub btnsalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsalir.Click
        Dim salida As Integer = MsgBox("Desea Salir de verdad?", MsgBoxStyle.YesNo + 32, "Mensaje")
        If salida = 6 Then
            End
        End If
    End Sub
End Class

No hay comentarios:

Publicar un comentario