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 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319
| Private Sub Button_Quitter_Click()
Unload Me
End Sub
Private Sub CB_Test_Click()
DateJour = Date
JourDate = Left(DateJour, 2) & "-" & Mid(DateJour, 4, 2) & "-" & Mid(DateJour, 7, 4) ' Converti la Date en Texte pour l'onglet
Worksheets(JourDate).Select
nom = Lab_TTS.Caption
'---------------------Recherche les personne convoquées et leur mot de passe-----------------------
If TB_MDP.Value = Lab_MDP.Caption Then 'Si la valeur est égal au Mot de Passe Ok
With Sheets(JourDate)
'Chercher son nom dans la feuille Conso colonne A
Set c = .Range("A2:A" & .Cells(.Rows.Count, 1).End(xlUp).Row).Find( _
what:=nom, _
After:=.Range("A2"), _
LookIn:=xlValues, _
lookat:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
'-----------------------------------------------------------------
If nom = "" Then
MsgBox "Le Nom n'a pas été trouvé !!"
Exit Sub
Else
c(1, 2) = 2
c(1, 3) = 3
c(1, 4) = 4
c(1, 5) = 5
c(1, 6) = 6
End If
'-------------------------------------------------------------------
End With
End If
End Sub
Private Sub CB_Eteindre_Click()
ActiveWorkbook.Save
Me.Hide
Call Fermer
End Sub
Private Sub CB_Valider_Click() 'Arrivée
DateJour = Date
JourDate = Left(DateJour, 2) & "-" & Mid(DateJour, 4, 2) & "-" & Mid(DateJour, 7, 4) ' Converti la Date en Texte pour l'onglet
Worksheets(JourDate).Select
nom = Lab_TTS.Caption
'---------------------Recherche les personne convoquées et leur mot de passe-----------------------
If TB_MDP.Value = Lab_MDP.Caption Then 'Si la valeur est égal au Mot de Passe Ok
With Sheets(JourDate)
'Chercher son nom dans la feuille Conso colonne A
Set c = .Range("A2:A" & .Cells(.Rows.Count, 1).End(xlUp).Row).Find( _
what:=nom, _
After:=.Range("A2"), _
LookIn:=xlValues, _
lookat:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
'-----------------------------------------------------------------
If nom = "" Then
MsgBox "Le Nom n'a pas été trouvé !!"
Exit Sub
'Else
'HC = c(1, 2) 'Heure de la convocation
'HA = c(1, 3) 'heure d'arrivée
'HD = c(1, 4) 'heure du départ
'Lab_MDP = c(1, 10) 'j'envoie le Mot de Passe dans le Lab Mot de Passe
'Lab_HC = c(1, 2) 'Heure de la convocation
' Lab_HA = c(1, 3) 'heure d'arrivée
'Lab_HD = c(1, 4) 'heure du départ
End If
'-------------------------------------------------------------------
End With
Pointeuse2.Lab_HC = Format(Pointeuse2.Lab_HC, "hh:mm")
HC = Pointeuse2.Lab_HC
Pointeuse2.Lab_HA = Format(Pointeuse2.Lab_HA, "hh:mm")
HA = Pointeuse2.Lab_HA
Pointeuse2.Lab_HD = Format(Pointeuse2.Lab_HD, "hh:mm")
HD = Pointeuse2.Lab_HD
If c(1, 3) = "" Then ' Verifie que l'eure d'arrivée soit inscrit.
'---------------------------- Si l'heures d'arrivée n'est pas encore inscrite -------------------------------
If Pointeuse2.Lab_HC > Time And c(1, 3) = "" Then
MsgBox HC
MsgBox Time
c(1, 3) = Pointeuse2.Lab_HC
'MsgBox HA
Else
c(1, 3) = Pointeuse2.Lab_HA
End If
'---------------------------- Si l'heures d'arrivée est inscrite -------------------------------
Else
'---------------------------- Inscrit l'heure de départ---------------------------------------------
'HD = Time
'HD = Format(HD, "hh:mm:ss")
'Pointeuse2.Lab_HD = Time
'Pointeuse2.Lab_HD.Caption = Format(Pointeuse2.Lab_HD.Caption, "hh:mm:ss")
If c(1, 4) = "" Then
c(1, 4) = Pointeuse2.Lab_HD
'c(1, 4) = Format(c(1, 4), "hh:mm")
'c(1, 5).FormulaR1C1 = "=IF(RC4-RC3>Constante!R1C13,(RC4-RC3)-Constante!R1C11,RC4-RC3)"
End If
'------------------------------------Rempli la feuil Base de Donnée------------------------------------------------
'HA = Frame1.Lab_HA
HD = Time
JMA = DTPicker_Date
JMA = Format(JMA, "mm/dd/yyyy")
Sheets("BD").Select
With Sheets("BD")
Set c = .Range("A" & .Cells(.Rows.Count, 1).End(xlUp).Row)(2)
'y mettre le nom
c.Value = JMA
c(1, 2).FormulaR1C1 = "=CHOOSE(MONTH(RC[-1]),""janvier"",""février"",""mars"",""avril"",""mai"",""juin"",""juillet"",""aout"",""septembre"",""octobre"",""novembre"",""décembre"")"
c(1, 3).FormulaR1C1 = "=YEAR(RC[-2])"
c(1, 4).FormulaR1C1 = "=IF(WEEKDAY(RC[-3],2)=7,""Dimanche"",IF(ISNA(VLOOKUP(RC[-3],JoursFerie,1,FALSE)),""Normal"",""Férié""))"
If Lab_TTS = "" Then
MsgBox "Veuillez sélectionner un Nom"
Else
c(1, 5) = Lab_TTS
End If
c(1, 6) = HA
c(1, 7) = HD
c(1, 8).FormulaR1C1 = "=IF(RC[-1]-RC[-2]>Constante!R1C13,Constante!R1C11,0)" 'Pause
c(1, 9).FormulaR1C1 = "=IF(OR(WEEKDAY(RC[-8],2)=7,RC[-5]=""Férié""),RC[1],IF(RC[-2]>Constante!R1C15,MOD(MIN(RC[-2],Constante!R1C17)-MAX(RC[-3],Constante!R1C15),1),""""))"
c(1, 10).FormulaR1C1 = "=IF(RC[-3]="""","""",MOD(RC[-3]-RC[-4],1)-RC[-2])"
c(1, 11).FormulaR1C1 = "=IF(RC[-2]="""",RC[-1],RC[-2]+RC[-1])"
c(1, 12).FormulaR1C1 = "=RC[-1]/Constante!R1C[-7]"
Range(c(1, 1), c(1, 12)).Select
Call Cadre
Sheets("Personnel").Select
End With
End If
'--------------------------- Fin du Pointage des heures --------------------------------------------------
Else
MsgBox "Mauvais Mot de passe"
TB_MDP = ""
Exit Sub
End If
Frame_MDP.Visible = False
ActiveWorkbook.Save
Unload Pointeuse2
LB_Convoc.Visible = True
TextBox_Mot_de_passe = ""
Pointeuse2.Show
End Sub
Private Sub LB_Convoc_Click()
Sheets("Personnel").Select
nom = LB_Convoc
'---------------------Recherche les personne convoquées et leur mot de passe-----------------------
With Sheets("Personnel")
'Chercher son nom dans la feuille Conso colonne A
Set c = .Range("B5:B" & .Cells(.Rows.Count, 2).End(xlUp).Row).Find( _
what:=nom, _
After:=.Range("B5"), _
LookIn:=xlValues, _
lookat:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If nom = "" Then
Exit Sub
Else
Lab_TTS = c 'j'envoie le Nom du TTS dans le Lab du Mot de passe
Lab_MDP = c(1, 10) 'j'envoie le Mot de Passe dans le Lab Mot de Passe
End If
'End With
DateJour = Date
JourDate = Left(DateJour, 2) & "-" & Mid(DateJour, 4, 2) & "-" & Mid(DateJour, 7, 4) ' Converti la Date en Texte pour l'onglet
Worksheets(JourDate).Select
nom = Lab_TTS.Caption
'---------------------Recherche les personne convoquées et leur mot de passe-----------------------
'If TB_MDP.Value = Lab_MDP.Caption Then 'Si la valeur est égal au Mot de Passe Ok
With Sheets(JourDate)
'Chercher son nom dans la feuille Conso colonne A
Set c = .Range("A2:A" & .Cells(.Rows.Count, 1).End(xlUp).Row).Find( _
what:=nom, _
After:=.Range("A2"), _
LookIn:=xlValues, _
lookat:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
'-----------------------------------------------------------------
If nom = "" Then
MsgBox "Le Nom n'a pas été trouvé !!"
Exit Sub
Else
Pointeuse2.Lab_HC = c(1, 2)
Pointeuse2.Lab_HC = Format(Pointeuse2.Lab_HC, "hh:mm:ss")
'Pointeuse2.Lab_HC = c(1, 2)
If c(1, 3) = "" Then
Pointeuse2.Lab_HA = Format(Pointeuse2.Lab_HA, "hh:mm:ss")
Pointeuse2.Lab_HA = Time
Else
Pointeuse2.Lab_HA = Format(Pointeuse2.Lab_HA, "hh:mm:ss")
Pointeuse2.Lab_HA = c(1, 3)
End If
If c(1, 4) = "" Then
Pointeuse2.Lab_HD = Format(Pointeuse2.Lab_HD, "hh:mm:ss")
Pointeuse2.Lab_HD = Time
Else
Pointeuse2.Lab_HD = Format(Pointeuse2.Lab_HD, "hh:mm:ss")
Pointeuse2.Lab_HD = c(1, 4)
End If
End If
'-------------------------------------------------------------------
End With
'End If
End With
'If c(1, 3) = "" Then
' CB_Valider.Visible = True
'CB_Depart.Visible = False
'Else
'CB_Valider.Visible = False
'CB_Depart.Visible = True
'End If
'If c(1, 4) = "" Then
'Frame_MDP.Visible = True
'Else
'Fr_Message.Visible = True
'Lab_message.Caption = c(1, 5)
'c(1, 5).Select
'End If
'LB_TTS = ""
'LB_TTS.Visible = False
LB_Convoc.Visible = False
Frame_MDP.Visible = True
End Sub
Private Sub UserForm_Initialize()
MessageCommun = ThisWorkbook.Worksheets("Constante").Range("A14").Value
If MessageCommun = "" Then
LB_Convoc.Height = 357
Else
LB_Convoc.Height = 224
Lab_MessageCom.Caption = MessageCommun
Lab_MessageCom.Visible = True
End If
DateJour = Date
JourDate = Left(DateJour, 2) & "-" & Mid(DateJour, 4, 2) & "-" & Mid(DateJour, 7, 4) ' Converti la Date en Texte pour l'onglet
Set ws = Worksheets(JourDate)
With LB_Convoc
.List() = ws.Range("A1:D20").Value
'.ColumnHeads = True ' Affiche les étiquettes de colonnes
.ColumnWidths = "220;100;100" ' Largeur des colonnes
'.BoundColumn(2) = Format("[hh]:mm") 'Selection.NumberFormat = "mmm-yy"
End With
DTPicker_Date = Date
Lab_DateJour.Caption = Date
Lab_DateJour.Caption = Format(Lab_DateJour.Caption, "dddd dd mmmm yyyy")
CB_Eteindre.Caption = "Si vous êtes le dernier à Pointer" & vbCrLf & "CLIQUEZ ICI"
'Frame1.Visible = False 'Frame Mot de Passe
End Sub
Private Sub CB_Admin_Click()
MDP_Admi.Show
End Sub
Private Sub CB_Confirmation_Click()
ActiveCell.ClearContents
Frame2.Visible = False
Frame1.Visible = True
End Sub
Private Sub CB_Quitter_Click()
Frame1.Visible = False
Unload Pointeuse
Pointeuse.Show
LB_TTS.Visible = True
LB_TTS = ""
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then Cancel = True 'Permet d'annuler le fonctionnement de la croix fermé
End Sub |
Partager