miércoles, 14 de diciembre de 2011

RETO 3 -Logistica Asignacion de Productos

LOGISTICA – ASIGNACION DE PRODUCTOS

Public Class Form1
    Dim prod As Integer = 0
    Dim adm As Integer = 0
    Dim cont As Integer = 0
    Dim venta As Integer = 0
    Dim acum, restante2 As Integer
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        lblreloj.Text = Date.Now().ToLongTimeString
    End Sub

    Private Sub btnseleccionar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnseleccionar.Click
        Dim cero As Object = chkldepartamentos.GetItemChecked(0)
        Dim uno As Object = chkldepartamentos.GetItemChecked(1)
        Dim dos As Object = chkldepartamentos.GetItemChecked(2)
        Dim tres As Object = chkldepartamentos.GetItemChecked(3)
        cbodepartamento.Items.Clear()
        If chkldepartamentos.CheckedItems.Count < 2 Then
            MessageBox.Show("Seleccione al menos 2 departamentos", "Mensaje al usuario")
        Else
            If cero = True Then
                cbodepartamento.Items.Add(chkldepartamentos.Items(0))
            End If
            If uno = True Then
                cbodepartamento.Items.Add(chkldepartamentos.Items(1))
            End If
            If dos = True Then
                cbodepartamento.Items.Add(chkldepartamentos.Items(2))
            End If
            If tres = True Then
                cbodepartamento.Items.Add(chkldepartamentos.Items(3))
            End If
        End If
    End Sub

    Private Sub btnasignar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnasignar.Click

        If txtcantidad.Text = "" Then
            MessageBox.Show("Intruduzca cantidad", "Mensaje")
        End If
        lstmostrar.Items.Clear()
        Select Case cbodepartamento.SelectedItem
            Case "Administracion"
                adm = Val(txtcantasignada.Text)
            Case "Contabilidad"
                cont = Val(txtcantasignada.Text)
            Case "Produccion"
                prod = Val(txtcantasignada.Text)
            Case "Ventas"
                venta = Val(txtcantasignada.Text)
        End Select

        acum = adm + cont + prod + venta
        restante2 = txtcantidad.Text - acum
       
        lblrestante.Text = "Restantes: " & restante2
        If restante2 < 0 Then
            MessageBox.Show("Seleccione mas productos", "Mensaje")
            lblrestante.Text = "Restantes: "
            Select Case cbodepartamento.SelectedItem
                Case "Administracion"
                    adm = 0
                Case "Contabilidad"
                    cont = 0
                Case "Produccion"
                    prod = 0
                Case "Ventas"
                    venta = 0
            End Select
            restante2 = restante2 + Val(txtcantasignada.Text)
        End If
    End Sub

    Private Sub btnmostrar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnmostrar.Click
        Dim n As Integer
        lstmostrar.Items.Clear()
       
        lstmostrar.Items.Add("Administracion " & adm)
        lstmostrar.Items.Add("Contabilidad " & cont)
        lstmostrar.Items.Add("Produccion " & prod)
        lstmostrar.Items.Add("Ventas " & venta)
        lblnoasignadas.Text = "No fueron Asignados: " & restante2 & " Productos"

    End Sub
End Class

RETO 3 - PRODUCTOS (diseño y código)




Public Class Form1


    Private Sub btnagregar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnagregar.Click
        lstagregados.Items.Add(txtproducto.Text)
        txtproducto.Focus()
        txtproducto.SelectAll()
    End Sub

    Private Sub btnpasar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnpasar.Click
        lstpasados.Items.Add(lstagregados.SelectedItem)
        lstagregados.Items.RemoveAt(lstagregados.SelectedIndex)
    End Sub

    Private Sub btnquitar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnquitar.Click
        lstagregados.Items.RemoveAt(lstagregados.SelectedIndex)
    End Sub

    Private Sub btnquitartodo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnquitartodo.Click
        lstagregados.Items.Clear()
        lstpasados.Items.Clear()
    End Sub

    Private Sub btnsalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsalir.Click
        End
    End Sub
End Class

RETO 3 - Numeros (diseño y código)


Public Class Form1

    Private Sub btnagregar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnagregar.Click
        Me.lstnumeros.Items.Add(txtnumero.Text)
        txtnumero.Focus()
        txtnumero.SelectAll()
    End Sub

    Private Sub btnborrar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnborrar.Click
        Dim i As Integer
        i = Me.lstnumeros.FindString(Me.txtelminar.Text)
        If i = ListBox.NoMatches Then
            MessageBox.Show("No existe el número buscado", "Mensaje",  )
        Else
            Me.lstnumeros.Items.RemoveAt(i)

        End If
    End Sub
End Class

RETO 3 - INSCRIPCIONES(diseño y codigo)


Public Class Form1

    Private Sub btnagregar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnagregar.Click
        Me.lstinscritos.Items.Add(txtnombres.Text)
        txtnombres.Focus()
        txtnombres.SelectAll()
        txtcantidad.Text = lstinscritos.Items.Count
    End Sub

    Private Sub btnquitar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnquitar.Click
        lstinscritos.Items.RemoveAt(lstinscritos.SelectedIndex)
        txtcantidad.Text = lstinscritos.Items.Count
    End Sub

    Private Sub btnquitartodo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnquitartodo.Click
        lstinscritos.Items.Clear()
    End Sub

    Private Sub btnsalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsalir.Click
        End
    End Sub
End Class

RETO 2 - CONTROL DE PAGOS(Codigo)

CONTROL DE PAGOS(diseño)


CONTROL DE PAGOS(Codigo)

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnaceptar.Click
        If txtuser.Text = "jhonny" And txtpassword.Text = "password" Then
            MessageBox.Show("Bienvenido Señor Jhonny Al Sistema...", "Mensaje al Usuario")
            Me.Hide()
            Form2.Show()
        Else
            MessageBox.Show()
        End If

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncancelar.Click
        End
    End Sub
End Class
----------------------------------------------------------------------------------------------------
Public Class Form2
    Private Sub btncalcular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncalcular.Click
        If rboejecutivo.Checked Then
            txtsalarioxdtrab.Text = 70 * txtdiastrabajados.Text
        ElseIf rboempleado.Checked Then
            txtsalarioxdtrab.Text = 35 * txtdiastrabajados.Text
        ElseIf rboobrero.Checked Then
            txtsalarioxdtrab.Text = 20 * txtdiastrabajados.Text
        End If
        If rboejecutivo.Checked Then
            txtpagoxhora.Text = 20 * txthorasextras.Text
        ElseIf rboempleado.Checked Then
            txtpagoxhora.Text = 10 * txthorasextras.Text
        ElseIf rboobrero.Checked Then
            txtpagoxhora.Text = 5 * txthorasextras.Text
        End If
        If Val(txthorasextras.Text) > 8 Then
            MessageBox.Show("Maximo de horas extras es 8", "Mensaje")
        End If
lblresultado.Text = "El Sr " + txtname.Text + " ha trabajado " + txtdiastrabajados.Text + " dias y tiene " + txthorasextras.Text + " horas extras"
txttotalpago.Text = txtdiastrabajados.Text + txthorasextras.Text
    End Sub

Private Sub btnnuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnuevo.Click
        Dim ctl As Object
        For Each ctl In Me.Controls
            If TypeOf ctl Is CheckBox Then
                ctl.Value = False
            ElseIf TypeOf ctl Is TextBox Then
                ctl.Text = ""
            ElseIf TypeOf ctl Is ComboBox Then
                ctl.Text = ""
                ctl.Clear()
            End If
        Next
    End Sub

Private Sub btnsalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsalir.Click
        End
    End Sub
End Class