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
|
Private Sub Report_Activate()
Dim dbBaseDonnées As Database, dtNomsTab3 As Recordset
Set dbBaseDonnées = DBEngine.Workspaces(0).Databases(0)
Set dtNomsTab3 = dbBaseDonnées.OpenRecordset("Travaux par jours", DB_OPEN_TABLE)
Dim i As Integer
Dim j As Integer
Dim nbjours As Integer
Dim Férié(11) As Date
Dim Calculée As Date
Période = Format(Month(Forms!Calendrier.DateEnCours), "00") & "/" & Year(Forms!Calendrier.DateEnCours)
Select Case left(Période, 2)
Case "02"
If Day(DateSerial(right(Période, 4), 2, 28) + 1) = 29 Then
JourSem29.Visible = True
nbjours = 29
Else
JourSem29.Visible = False
Jour29.Visible = False
nbjours = 28
End If
JourSem30.Visible = False
Jour30.Visible = False
JourSem31.Visible = False
Jour31.Visible = False
Case "04", "06", "09", "11"
JourSem31.Visible = False
Jour31.Visible = False
nbjours = 30
Case Else
nbjours = 31
End Select
'Détermination des jours fériés
Férié(1) = "01/01/" & right(Période, 2)
Férié(2) = "01/05/" & right(Période, 2)
Férié(3) = "08/05/" & right(Période, 2)
Férié(4) = "14/07/" & right(Période, 2)
Férié(5) = "15/08/" & right(Période, 2)
Férié(6) = "01/11/" & right(Période, 2)
Férié(7) = "11/11/" & right(Période, 2)
Férié(8) = "25/12/" & right(Période, 2)
Calculée = Pâques(right(Période, 2))
'lundi de pâques = pâques + 1
Férié(9) = DateAdd("d", 1, Calculée)
'jeudi de l'ascension = pâques + 39
Férié(10) = DateAdd("d", 39, Calculée)
'lundi de pentecote = pâques + 50
Férié(11) = DateAdd("d", 50, Calculée)
For i = 1 To nbjours
Select Case Weekday((i & "/" & Période), 2)
Case 2, 3, 6, 7
Reports!Planning("JourSem" & i).FontSize = 8
Case Else
Reports!Planning("JourSem" & i).FontSize = 9
End Select
Reports!Planning("JourSem" & i) = left((Format((i & "/" & Période), "ddd")), 3) & i
For j = 1 To 11
'If (i & "/" & Month(Calendrier.DateEnCours)) = Férié(j) Then
If (i & "/" & left(Période, 2) = Férié(j)) Then
Reports!Planning("JourSem" & i).BackColor = 5279935
Reports!Planning("Jour" & i).BackColor = 5279935
End If
Next j
If (dtNomsTab3.EOF And dtNomsTab3.BOF) <> True Then
dtNomsTab3.MoveFirst
Do While Not dtNomsTab3.EOF
Select Case dtNomsTab3.Fields(i)
Case 0
Forms!Calendrier("Texte" & i).BackColor = RGB(0, 255, 255)
Case 1
Forms!Calendrier("Texte" & i).BackColor = RGB(191, 144, 80)
End Select
dtNomsTab3.MoveNext
Loop
dtNomsTab3.Close
Set dtNomsTab3 = Nothing
End If
If Weekday((i & "/" & Période), 2) >= 6 Then
Reports!Planning("JourSem" & i).BackColor = 8421504
Reports!Planning("Jour" & i).BackColor = 8421504
End If
Next i
End Sub |
Partager