Dim per() As String = {"Antelmo", "Braian", "Claudia", "Christian", "Eduardo",
"Fernanda", "Giovani", "Hctor", "Jos Antonio", "Katia", "Kevin", "Laura", "Misael", "Omar", "Rodolfo", "Rodolfo Eduardo"} Dim acts() As String = {"Podar pasto A (2h)", "Podar rboles A (3h)", "Podar arbustos A (4h)", "Levantar basura A (1h)", "Regar pasto A (1h)", "Mantenimiento elctrico A (5h)", "Mantenimiento pintura A (4h)", "Mantenimiento hidrulico A (3h)", "Podar pasto B (2h)", "Podar rboles B (3h)", "Podar arbustos B (4h)", "Levantar basura B (1h)", "Regar pasto B (1h)", "Mantenimiento elctrico B (5h)", "Mantenimiento pintura B (4h)", "Mantenimiento hidrulico B (3h)", "Podar pasto C (2h)", "Podar rboles C (3h)", "Podar arbustos C (4h)", "Levantar basura C (1h)", "Regar pasto C (1h)", "Mantenimiento elctrico C (5h)", "Mantenimiento pintura C (4h)", "Mantenimiento hidrulico C (3h)", "Podar pasto D (2h)", "Podar rboles D (3h)", "Podar arbustos D (4h)", "Levantar basura D (1h)", "Regar pasto D (1h)", "Mantenimiento elctrico D (5h)", "Mantenimiento pintura D (4h)", "Mantenimiento hidrulico D (3h)", "Podar pasto E (2h)", "Podar rboles E (3h)", "Podar arbustos E (4h)", "Levantar basura E (1h)", "Regar pasto E (1h)", "Mantenimiento elctrico E (5h)", "Mantenimiento pintura E (4h)", "Mantenimiento hidrulico E (3h)", "Podar pasto F (2h)", "Podar rboles F (3h)", "Podar arbustos F (4h)", "Levantar basura F (1h)", "Regar pasto F (1h)", "Mantenimiento elctrico F (5h)", "Mantenimiento pintura F (4h)", "Mantenimiento hidrulico F (3h)"} Dim zon() As String = {"A (Edif. A, B, C, D y E)", "B (Edif. F, G, H, I y J)", "C (Edif. K, L, M, N y O)", "D (Edif. P, Q, R, S y T)", "E (Edif. U, V, W, X y Y)", "F (Edif. Z, 1, 2, 3 y 4)"}
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.WindowState = FormWindowState.Maximized End Sub
Private Sub Boton1_Click(sender As Object, e As EventArgs) Handles Boton1.Click
dgv1.RowCount = 16 dgv1.ColumnCount = 2 dgv1.Columns(0).HeaderCell.Value = "No." dgv1.Columns(1).HeaderCell.Value = "Nombre" For i = 0 To 15 dgv1.Rows(i).Cells(0).Value = i + 1 dgv1.Rows(i).Cells(1).Value = per(i) Next End Sub
Private Sub Boton2_Click(sender As Object, e As EventArgs) Handles Boton2.Click
dgv1.RowCount = 48 dgv1.ColumnCount = 4 dgv1.Columns(0).HeaderCell.Value = "No." dgv1.Columns(1).HeaderCell.Value = "Actividad" dgv1.Columns(2).HeaderCell.Value = "Zona/Edificios" dgv1.Columns(3).HeaderCell.Value = "Horas" For i = 0 To 47 dgv1.Rows(i).Cells(0).Value = i + 1 dgv1.Rows(i).Cells(1).Value = acts(i) If i <= 7 Then dgv1.Rows(i).Cells(2).Value = zon(0) End If If i > 7 And i <= 15 Then dgv1.Rows(i).Cells(2).Value = zon(1) End If If i > 15 And i <= 23 Then dgv1.Rows(i).Cells(2).Value = zon(2) End If If i > 23 And i <= 31 Then dgv1.Rows(i).Cells(2).Value = zon(3) End If If i > 31 And i <= 39 Then dgv1.Rows(i).Cells(2).Value = zon(4) End If If i > 39 And i <= 47 Then dgv1.Rows(i).Cells(2).Value = zon(5) End If If i = 3 Or i = 4 Or i = 11 Or i = 12 Or i = 19 Or i = 20 Or i = 27 Or i = 28 Or i = 35 Or i = 36 Or i = 43 Or i = 44 Then dgv1.Rows(i).Cells(3).Value = "1" End If If i = 0 Or i = 8 Or i = 16 Or i = 24 Or i = 32 Or i = 40 Then dgv1.Rows(i).Cells(3).Value = "2" End If If i = 1 Or i = 7 Or i = 9 Or i = 15 Or i = 17 Or i = 23 Or i = 25 Or i = 31 Or i = 33 Or i = 39 Or i = 41 Or i = 47 Then dgv1.Rows(i).Cells(3).Value = "3" End If If i = 2 Or i = 6 Or i = 10 Or i = 14 Or i = 18 Or i = 22 Or i = 26 Or i = 30 Or i = 34 Or i = 38 Or i = 42 Or i = 46 Then dgv1.Rows(i).Cells(3).Value = "4" End If If i = 5 Or i = 13 Or i = 21 Or i = 29 Or i = 37 Or i = 45 Then dgv1.Rows(i).Cells(3).Value = "5" End If Next End Sub
Private Sub Boton3_Click(sender As Object, e As EventArgs) Handles Boton3.Click
Dim b, i, j, h, r As Integer Dim c As Integer = 0, horas As Integer = 0 Dim lu(47), ma(47), mi(47), ju(47), vi(47) As Integer dgv1.RowCount = 96 dgv1.ColumnCount = 6 dgv1.Columns(0).HeaderCell.Value = "Nombre" dgv1.Columns(1).HeaderCell.Value = "Lunes" dgv1.Columns(2).HeaderCell.Value = "Martes" dgv1.Columns(3).HeaderCell.Value = "Mircoles" dgv1.Columns(4).HeaderCell.Value = "Jueves" dgv1.Columns(5).HeaderCell.Value = "Viernes" For i = 0 To 47 lu(i) = 0 Next For i = 0 To 47 ma(i) = 0 Next For i = 0 To 47 mi(i) = 0 Next For i = 0 To 47 ju(i) = 0 Next For i = 0 To 47 vi(i) = 0 Next For i = 0 To 15 dgv1.Rows(c).Cells(0).Value = per(i) For j = 1 To 5 b = 0 h = 0 While h < 7 r = Int(Rnd() * 47) + 0 dgv1.Rows(b + c).Cells(j).Value = acts(r) Select Case r Case 3, 4, 11, 12, 19, 20, 27, 28, 35, 36, 43, 44 horas = 1 Case 0, 8, 16, 24, 32, 40 horas = 2 Case 1, 7, 9, 15, 17, 23, 25, 31, 33, 39, 41, 47 horas = 3 Case 2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46 horas = 4 Case 5, 13, 21, 29, 37, 45 horas = 5 End Select If (h + horas) < 8 Then If j = 1 Then If lu(r) < 3 Then h = h + horas b = b + 1 lu(r) = 1 End If End If If j = 2 Then If ma(r) < 3 Then h = h + horas b = b + 1 ma(r) = 1 End If End If If j = 3 Then If mi(r) < 3 Then h = h + horas b = b + 1 mi(r) = 1 End If End If If j = 4 Then If ju(r) < 3 Then h = h + horas b = b + 1 ju(r) = 1 End If End If If j = 5 Then If vi(r) < 3 Then h = h + horas b = b + 1 vi(r) = 1 End If End If End If End While Next c = c + 6 Next End Sub
Private Sub Boton4_Click(sender As Object, e As EventArgs) Handles Boton4.Click
dgv1.Rows.Clear() dgv1.Columns.Clear() End Sub
Private Sub Boton5_Click(sender As Object, e As EventArgs) Handles Boton5.Click