1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
| Imports System.Text.RegularExpressions
Imports System.IO
Imports System.Math
Public Class Planning1
Public Property FirstDisplayedScrollingRowIndex As Integer
Public an As Integer = System.DateTime.Now.Year
Dim tjour As Integer = System.DateTime.Now.Day
Dim tmois As Integer = System.DateTime.Now.Month
Dim tan As Integer = System.DateTime.Now.Year
Dim curseur As Integer = 0
Public Anneeb(12, 31, 10) As String
Public semaine(7)
Public moisc As Integer = System.DateTime.Now.Month
Public mois(12) As Integer
Public moisn(12) As String
Dim couleur As Color = Color.Bisque
Dim Anneecourante As Integer = 2013
Dim moiscourant As Integer = 11
Dim jourcourant As Integer = System.DateTime.Now.Day
Dim datetext As String = jourcourant & "/" & moiscourant & "/" & Anneecourante
Private Sub TabPage1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Click
End Sub
Private Sub Planning1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dte As String = DateTimePicker1.Value
mois(1) = 31
mois(2) = 28
mois(3) = 31
mois(4) = 30
mois(5) = 31
mois(6) = 30
mois(7) = 31
mois(8) = 31
mois(9) = 30
mois(10) = 31
mois(11) = 30
mois(12) = 31
moisn(1) = "janvier"
moisn(2) = "fevrier"
moisn(3) = "mars"
moisn(4) = "avril"
moisn(5) = "mai"
moisn(6) = "juin"
moisn(7) = "juillet"
moisn(8) = "aout"
moisn(9) = "septembre"
moisn(10) = "octobre"
moisn(11) = "novembre"
moisn(12) = "decembre"
semaine(1) = "dimanche"
semaine(2) = "lundi"
semaine(3) = "mardi"
semaine(4) = "mercredi"
semaine(5) = "jeudi"
semaine(6) = "vendredi"
semaine(7) = "samedi"
charge_annee()
charge_trimestre()
charge_mois()
End Sub
Private Sub charge_annee()
DataGridView1.Rows.Clear()
Dim i As Integer = 0
Dim lig(31, 13) As String
Dim lige(13)
Dim dte As Date
Dim jj1 As Integer = 1
Dim jj2 As Integer = 1
Dim jj3 As Integer = 1
Dim jj4 As Integer = 1
annee.Text = DatePart("yyyy", DateTimePicker1.Value)
DateTimePicker1.Value = datetext
For jj1 = 1 To 12
For jj2 = 1 To mois(jj1)
dte = jj2 & "/" & jj1 & "/" & DatePart("yyyy", DateTimePicker1.Value)
Anneeb(jj1, jj2, 1) = semaine(DatePart("w", dte))
Anneeb(jj1, jj2, 2) = DatePart(DateInterval.WeekOfYear, dte)
Anneeb(jj1, jj2, 3) = dte
Next
Next
For jj2 = 1 To 31
Array.Clear(lige, 0, 13)
lige(0) = jj2
For jj1 = 1 To 12
lige(jj1) = Anneeb(jj1, jj2, 1)
Next
If i = 0 Then
couleur = Color.Cyan
i = 1
Else
couleur = Color.LightCoral
i = 0
End If
With Me.DataGridView1.RowTemplate
.DefaultCellStyle.BackColor = couleur
.Height = 35
.MinimumHeight = 20
End With
If jj2 = DatePart("d", DateTimePicker1.Value) Then
curseur = jj2 - 1
End If
jj4 = jj4 + 1
DataGridView1.Rows.Add(lige)
' MsgBox(lige(1) & " " & jj2)
Next
MsgBox(jj4)
DataGridView1.FirstDisplayedScrollingRowIndex = curseur
DataGridView1.Rows(curseur).Cells(DatePart("m", DateTimePicker1.Value)).Selected = True
End Sub
Private Sub charge_trimestre()
DataGridView2.Rows.Clear()
Dim i As Integer = 0
Dim lig(31, 4) As String
Dim lige(3)
Dim ligm(3)
Dim dte As String = ""
dte = DateTimePicker1.Value
trimestre.Text = (" trimestre " & DatePart("q", dte) & " " & (DatePart("yyyy", dte)))
Dim jj1 As Integer = ((DatePart("q", dte) - 1) * 3) + 1
Dim jj2 As Integer = (DatePart("q", dte) * 3)
Dim jj3 As Integer = 1
Dim jj4 As Integer = 1
dte = jj2 & "/" & DatePart("m", DateTimePicker1.Value) & "/" & DatePart("yyyy", DateTimePicker1.Value)
While jj4 <= 3
lige(jj4) = moisn(jj1)
ligm(jj4) = jj1
DataGridView2.Columns(jj4).HeaderText = moisn(jj1)
jj1 = jj1 + 1
jj4 = jj4 + 1
End While
For jj2 = 1 To 31
Array.Clear(lige, 0, 3)
lige(0) = jj2
For jj1 = 1 To 3
lige(jj1) = Anneeb(ligm(jj1), jj2, 1)
Next
If i = 0 Then
couleur = Color.Cyan
i = 1
Else
couleur = Color.LightCoral
i = 0
End If
With Me.DataGridView2.RowTemplate
.DefaultCellStyle.BackColor = couleur
.Height = 35
.MinimumHeight = 20
End With
DataGridView2.Rows.Add(lige)
Next
DataGridView2.FirstDisplayedScrollingRowIndex = curseur
End Sub
Private Sub charge_mois()
DataGridView3.Rows.Clear()
Dim moiscourant As Integer
Dim i As Integer = 0
Dim lige(13)
Dim dte As String = ""
Dim jj1 As Integer = 1
Dim jj2 As Integer = 1
Dim jj3 As Integer = 1
moiscourant = DatePart("m", DateTimePicker1.Value)
For jj1 = 1 To mois(moiscourant)
lige(0) = jj1
lige(1) = Anneeb(moiscourant, jj1, 1)
lige(2) = Anneeb(moiscourant, jj1, 2)
If i = 0 Then
couleur = Color.Cyan
i = 1
Else
couleur = Color.LightCoral
i = 0
End If
With Me.DataGridView3.RowTemplate
.DefaultCellStyle.BackColor = couleur
.Height = 35
.MinimumHeight = 20
End With
DataGridView3.Rows.Add(lige)
Next
DataGridView3.FirstDisplayedScrollingRowIndex = curseur
End Sub
Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged
datetext = DateTimePicker1.Value
DataGridView1.Rows.Clear()
charge_annee()
charge_trimestre()
charge_mois()
End Sub
Private Sub DataGridView2_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView2.CellContentClick
End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
DataGridView1.Rows.Clear()
datetext = Anneeb(DataGridView1.CurrentCell.ColumnIndex, (DataGridView1.CurrentCell.RowIndex + 1), 3)
MsgBox(Anneeb(DataGridView1.CurrentCell.ColumnIndex, (DataGridView1.CurrentCell.RowIndex + 1), 3))
charge_annee()
charge_trimestre()
charge_mois()
End Sub
Private Sub boutonannee_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles boutonanneemoins.Click
DataGridView1.Rows.Clear()
tan = tan - 1
tjour = 1
tmois = 1
datetext = tjour & "/" & tmois & "/" & tan
charge_annee()
charge_trimestre()
charge_mois()
End Sub
Private Sub boutonanneeplus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles boutonanneeplus.Click
DataGridView1.Rows.Clear()
tan = tan + 1
tjour = 1
tmois = 1
datetext = tjour & "/" & tmois & "/" & tan
charge_annee()
charge_trimestre()
charge_mois()
End Sub
End Class |
Partager