ocejade
Messages postés55Date d'inscriptionjeudi 26 avril 2007StatutMembreDernière intervention 6 avril 2015
-
4 mai 2008 à 10:59
ocejade
Messages postés55Date d'inscriptionjeudi 26 avril 2007StatutMembreDernière intervention 6 avril 2015
-
4 mai 2008 à 18:15
bonjour a vous les dieux
bon je suis a la recherche d une personne qui peut m expliquer comment calculer des heures de nuit
voila ma question quel code en vb6 utiliser pour calculer le nombre d heure ecoulé entre par exemple
22 h 00 a 10 h30 en sachant que les heures de nuit sont entre 22 h 00 et 6 h 30 . j ai dejat un peut de code voir la suite
Dim intheures As Integer
Dim intmintes As Integer
Dim intchiffreerreur As String
Dim strphoto As String
Private Sub ?_Click()
frmrelever.Show
End Sub
Private Sub cdmajouter_Click()
On Error GoTo erreur
Adodc1.Recordset.AddNew
txtheurestotal.Text = 0
txtminutestotal.Text = 0
strphoto = txtphoto.Text
imgphoto.Picture = LoadPicture(strphoto)
Exit Sub
erreur:
End Sub
Private Sub cdmconfirmer_Click()
On Error GoTo TrErreur
Dim intcompteur As Integer
For intcompteur = Me.Controls.Count - 1 To 0 Step -1
Next intcompteur
Adodc1.Recordset.Update
Adodc1.Recordset!datene = DTPnee.Value
Adodc1.Recordset.Update
Exit Sub
TrErreur:
End Sub
Private Sub cmdajouterheure_Click()
Dim intheurearr As Integer
Dim intheuredepart As Integer
Dim intheurefait As Integer
Dim intminarr As Integer
Dim intmindepart As Integer
Dim intminfait As Integer
Dim intmintemp As Integer
On Error GoTo erreur
'Verification des heure
If txtheurearr.Text "" Or txtheuredepart.Text "" Or txtminarr.Text = "" Or txtmindepart.Text = "" Then
MsgBox "Une ou des cases Son vide", vbCritical, "ERREUR"
Exit Sub
Else
intheurearr = txtheurearr.Text
intheuredepart = txtheuredepart.Text
intheurearr = intheurearr * 60
intheuredepart = intheuredepart * 60
If intheurearr < 0 Then
MsgBox "Le chiffre entrer est négatif. Le programme va le remplacer par un chiffre positif!!!!"
intheurearr = -intheurearr
txtheurearr.Text = intheurearr / 60
End If
If intheurearr >= intheuredepart Then
If intheurearr = intheuredepart Then
If txtminarr.Text <> txtmindepart.Text Then
intminarr = txtminarr.Text
intmindepart = txtmindepart.Text
txtheurea.Text = 0
Else
intheurefait = 1440
txtheurea.Text = intheurefait / 60
End If
Else
intheurefait = intheurearr - intheuredepart
intheurefait = 1440 - intheurefait
txtheurea.Text = intheurefait / 60
End If
Else
intheurefait = intheuredepart - intheurearr
txtheurea.Text = intheurefait / 60
End If
Else
intminfait = intmindepart - intminarr
End If
End If
If intminfait < 0 Then
intminfait = -intminfait
End If
If intminfait >= 60 Then
intminfait = intminfait - 60
txtheurea.Text = txtheurea.Text + 1
End If
If txtminutestotal.Text >= 60 Then
txtminutestotal.Text = txtminutestotal.Text - 60
txtheurestotal.Text = txtheurestotal.Text + 1
End If
' Ici le programme vérifie le nombre d'heure total et si sa
' dépasse 35 heure le programe ajoute les heure de plus dans la case
' temp et demi et si c'est plus que 50 heure dans la case temp double
End Sub
Private Sub cmdCalcul_Click()
On Error GoTo erreur
Dim inttauxhoraire As Single
Dim intheure As Single
Dim intregulier As Single
Dim intdemi As Single
Dim sgldouble As Single
Dim sglheuremin As Single
Dim sglreguliermin As Single
Dim sgldemimin As Single
Dim sgldoublemin As Single
Dim sglbrutregulier As Single
Dim sglbrutdemi As Single
Dim sglbrutdouble As Single
Dim sglbrut As Single
Dim sglheuretotal As Single
Dim sgldeducimpot As Single
Dim sgldeducrrq As Single
Dim sgldeducsyndicat As Single
Dim sgldeductotal As Single
Dim sglsalairenet As Single
Dim sglmintravailler As Single
Dim sglheuretravailler As SingleIf txtheureregulier.Text "" Or txtminutesreg.Text "" Or txtheuredemi.Text = "" Or txtminutesdemi.Text = "" Or txtminutesdouble.Text = "" Or txtheuredouble.Text = "" Then
MsgBox "Une ou des cases Son vide", vbCritical, "ERREUR"
Exit Sub
Else
sglregulier = 0
sgldouble = 0
sgldemi = 0
sglbrut = 0
txtsalairebrut.Text = 0
If txtheurestotal "0" And txtminutestotal "0" Then
MsgBox "Vous devez entrer le nombre d'heure travailler", vbCritical, "ERREUR"
Else
sglregulier = txtheureregulier.Text * 60
sgldemi = txtheuredemi.Text * 60
sgldouble = txtheuredouble.Text * 60
sglreguliermin = txtminutesreg.Text
sgldemimin = txtminutesdemi.Text
sgldoublemin = txtminutesdouble.Text
sglheuretravailler = txtheurestotal.Text * 60
sglmintravailler = txtminutestotal.Text
sglheure = sglmintravailler + sglheuretravailler
sglheuretotal = sglregulier + sgldemi + sgldouble + sglreguliermin + sgldemimin + sgldoublemin
If sglheuretotal = sglheure Then
sgltauxhoraire = txttauxhoraire.Text
Private Sub cmdDelete_Click()
On Error GoTo erreur
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveLast
strphoto = txtphoto.Text
imgphoto.Picture = LoadPicture(strphoto)
Exit Sub
erreur:
Unload frmpay
frmpay.Show
End Sub
Private Sub cmddernier_Click()
On Error GoTo erreur
Adodc1.Recordset.MoveLast
strphoto = txtphoto.Text
imgphoto.Picture = LoadPicture(strphoto)
Exit Sub
erreur:
End Sub
Private Sub cmdeffacer_Click()
On Error GoTo TrErreur
txtheureregulier.Text = "0"
txtheuredemi.Text = "0"
Private Sub cmdprecedent_Click()
On Error GoTo erreur
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF And Adodc1.Recordset.RecordCount > 0 Then Adodc1.Recordset.MoveNext
strphoto = txtphoto.Text
imgphoto.Picture = LoadPicture(strphoto)
Exit Sub
erreur:
End Sub
Private Sub cmdpremierenr_Click()
On Error GoTo erreur
Adodc1.Recordset.MoveFirst
strphoto = txtphoto.Text
imgphoto.Picture = LoadPicture(strphoto)
Exit Sub
erreur:
End Sub
Private Sub cmdsuivant_Click()
On Error GoTo erreur
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF And Adodc1.Recordset.RecordCount > 0 Then Adodc1.Recordset.MoveLast
strphoto = txtphoto.Text
imgphoto.Picture = LoadPicture(strphoto)
Exit Sub
erreur:
End Sub
Private Sub mnufichieroption_Click()
frmoption.Show
End Sub
Private Sub fracalculsalaire_DragDrop(Source As Control, X As Single, Y As Single)
End Sub
Private Sub mnufichierprint_Click()
'frabouton.Visible = False
fraoption.Visible = False
Printer.Orientation = vbPRORLandscape
frmpay.PrintForm
'frabouton.Visible = True
fraoption.Visible = True
End Sub
Private Sub mnufichierquitter_Click()
End
End Sub
Private Sub mnuinfoAbout_Click()
frmabout.Show
End Sub
Private Sub tmrtime_Timer()
lbltime.Caption = Time
End Sub
Private Sub txtheurearr_Change()
intchiffreerreur = txtheurearr.TextIf intchiffreerreur "" Or IsNumeric(intchiffreerreur) False Then
intchiffreerreur = ""
ElseIf intchiffreerreur > 24 Then
MsgBox "Dans une journée il n'y a que 24 heure"
intchiffreerreur = 0
End If
txtheurearr.Text = intchiffreerreur
End Sub
Private Sub txtheurearr_KeyPress(KeyAscii As Integer)
If KeyAscii = 44 Then
MsgBox "Les virgule son interdit dans cette partie", vbCritical, "ERREUR!!!!!!!!!!!!!"
txtheurearr.Text = ""
End If
End Sub
Private Sub txtheuredepart_Change()
intchiffreerreur = txtheuredepart.TextIf intchiffreerreur "" Or IsNumeric(intchiffreerreur) False Then
intchiffreerreur = ""
ElseIf intchiffreerreur > 24 Then
MsgBox "Dans une journée il n'y a que 24 heure"
intchiffreerreur = 0
End If
txtheuredepart.Text = intchiffreerreur
End Sub
Private Sub txtheuredepart_KeyPress(KeyAscii As Integer)
If KeyAscii = 44 Then
MsgBox "Les virgule son interdit dans cette partie", vbCritical, "ERREUR!!!!!!!!!!!!!"
txtheuredepart.Text = ""
End If
End Sub
Private Sub txtimpot_Change()
intchiffreerreur = txtimpot.Text
If IsNumeric(intchiffreerreur) = False Then
intchiffreerreur = ""
End If
txtimpot.Text = intchiffreerreur
End Sub
Private Sub txtminarr_Change()
intchiffreerreur = txtminarr.Text
erreur
txtminarr.Text = intchiffreerreur
End Sub
Private Sub txtminarr_KeyPress(KeyAscii As Integer)
If KeyAscii = 44 Then
MsgBox "Les virgule son interdit dans cette partie", vbCritical, "ERREUR!!!!!!!!!!!!!"
txtminarr.Text = ""
End If
End Sub
Private Sub txtmindepart_Change()
intchiffreerreur = txtmindepart.Text
erreur
txtmindepart.Text = intchiffreerreur
End Sub
Function erreur()If intchiffreerreur "" Or IsNumeric(intchiffreerreur) False Then
intchiffreerreur = ""
Else
If intchiffreerreur > 59 Then
MsgBox "Dans un heure il y a que 60 minute"
intchiffreerreur = ""
End If
End If
End Function
Private Sub txtmindepart_KeyPress(KeyAscii As Integer)
If KeyAscii = 44 Then
MsgBox "Les virgule son interdit dans cette partie", vbCritical, "ERREUR!!!!!!!!!!!!!"
txtmindepart.Text = ""
End If
End Sub
Private Sub txtRRQ_Change()
intchiffreerreur = txtRRQ.Text
If IsNumeric(intchiffreerreur) = False Then
intchiffreerreur = ""
End If
txtRRQ.Text = intchiffreerreur
End Sub
Private Sub txtsyndicat_Change()
intchiffreerreur = txtsyndicat.Text
If IsNumeric(intchiffreerreur) = False Then
intchiffreerreur = ""
End If
txtsyndicat.Text = intchiffreerreur
End Sub
Private Sub txttauxhoraire_Change()
intchiffreerreur = txttauxhoraire.Text
If IsNumeric(intchiffreerreur) = False Then
intchiffreerreur = ""
End If
txttauxhoraire.Text = intchiffreerreur
End Sub
je vous attend pour progresser en vous remercien d avance
cs_JMO
Messages postés1854Date d'inscriptionjeudi 23 mai 2002StatutMembreDernière intervention24 juin 201827 4 mai 2008 à 13:48
Bonjour,
Cette source n'est pas en vb6, mais utilise les fonctions FormatDateTime, TimeSerial, DateDiff,
Hour et Minute
pour calculer les heures de travail de nuit (de 22h00 à
06h00).
ocejade
Messages postés55Date d'inscriptionjeudi 26 avril 2007StatutMembreDernière intervention 6 avril 2015 4 mai 2008 à 18:15
MERCI JEAN MARC
COMME TU A PUS LE VOIR MON PROG EST DEJA PAS MAL
MAIS LE CODAGE D HEURE C EST PAS MON TRUC ALORS LA FONCTION AUTOMATIQUE JE VEUT METTRE EN PLACE SERVIRAS A CALCULER LES HEURES DE NUIT PAR EXEMPLE 23 H 00 A 10 H 00 11H 00 DE TRAVAIL NORMAL ET LES HEURES ENTRE 22 H 00 ET 6 H 00 7 H 00 DE NUIT
TA SOURCE NE M EXPLIQUE PAS GRAND CHOSE
SA NE SERT A RIEN QUE JE RECOPIE UNE SOURCE QUE JE NE COMPREND PAS