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
| 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
HA = c(1, 3) 'Je récupère l'heure d'arrivée
'Lab_MDP = c(1, 10) 'j'envoie le Mot de Passe dans le Lab Mot de Passe
End If
'-------------------------------------------------------------------
End With
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 c(1, 2) > Time And c(1, 3) = "" Then
c(1, 3) = c(1, 2)
Else
c(1, 3) = Time
End If
'---------------------------- Si l'heures d'arrivée est inscrite -------------------------------
Else
'---------------------------- Inscrit l'heure de départ---------------------------------------------
HD = Time
HD = Format(HD, "hh:mm")
If c(1, 4) = "" Then
c(1, 4) = 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"
Frame.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 |
Partager