cette source traite du calcul d heures de nuit elle n est pas encore
fini mais peut servir a un débutant
je reste a l écoute des experts pour avoir des conseilles pour enfin finir ma source
tous reproche ou info est bonne a prendre
Source / Exemple :
Private Sub apercu_Click()
Printer.TrackDefault = True
Printer.ScaleMode = 6
Printer.Orientation = 1
Printer.PaperSize = 9
Printer.PrintQuality = -4
Printer.ColorMode = 1
Printer.FontSize = 20 'taille de la police
DecalX = 20 - (Printer.Width - Printer.ScaleWidth) / 2
DecalY = 15 - (Printer.Height - Printer.ScaleHeight) / 2
Printer.PaintPicture MSFlexGrid1.Picture, 30, 60
Printer.EndDoc
End Sub
Private Sub Command1_Click()
Dim i As Integer
i = Row + 2
MSFlexGrid1.AddItem Calendar1, 2
MSFlexGrid1.TextMatrix(i, 1) = TxtHeureDebut.Text & " h " & TxtMinuteDebut.Text
MSFlexGrid1.TextMatrix(i, 2) = TxtHeureFin.Text & " h " & TxtMinuteFin.Text
MSFlexGrid1.TextMatrix(i, 3) = TxtHeureResultat.Text & " h " & TxtMinuteResultat.Text
MSFlexGrid1.TextMatrix(i, 4) = Txtohsupp.Text & " h " & Txtomsupp.Text
MSFlexGrid1.TextMatrix(i, 5) = Textheurenuit.Text & " h " & Textminnuit.Text
On Error Resume Next
Text5.Text = Text5.Text
Texthnorm.Text = CSng(TxtHeureResultat.Text) + CSng(Texthnorm.Text)
Text5.Text = CSng(Text5.Text) + CSng(TxtMinuteResultat.Text)
Text8.Text = CSng(Textheurenuit.Text) + CSng(Text8.Text)
Text9.Text = CSng(Textminnuit.Text) + CSng(Text9.Text)
Text6.Text = CSng(Txtohsupp.Text) + CSng(Text6.Text)
Text7.Text = CSng(Txtomsupp.Text) + CSng(Text7.Text)
If Text5.Text > 60 Then Texthnorm.Text = Texthnorm.Text + 1
If Text5.Text > 59 Then Text5.Text = Text5.Text - 60
If Text7.Text > 60 Then Text6.Text = Text6.Text + 1
If Text7.Text > 59 Then Text7.Text = Text7.Text - 60
If Text7.Text < 0 Then Text6.Text = Text6.Text - 1
If Text7.Text < 0 Then Text7.Text = Text7.Text + 60
If Text6.Text < 0 Then Text6.Text = 0
End Sub
Private Sub Command2_Click()
CalculMinuteFin = TxtMinuteFin
CalculHeureFin = TxtHeureFin
If TxtMinuteFin < TxtMinuteDebut Then
CalculMinuteFin = TxtMinuteFin + 60
End If
If TxtHeureFin < TxtHeureDebut Then
CalculHeureFin = TxtHeureFin + 24
End If
TxtHeureResultat = CalculHeureFin - TxtHeureDebut
TxtMinuteResultat = CalculMinuteFin - TxtMinuteDebut
Txtohsupp = TxtHeureResultat - 6
Txtomsupp = TxtMinuteResultat - 30
Textheurenuit = H2 - TxtHeureDebut
Textminnuit = M2 - TxtMinuteDebut
End Sub
Private Sub Command3_Click()
Dim f As Integer
f = FreeFile
Open "apercu.txt" For Output As #f
Print #f, Texthnorm.Text
Close #f
Dim a As Integer
a = FreeFile
Open "1.txt" For Output As #a
Print #a, Text5.Text
Close #a
Dim b As Integer
b = FreeFile
Open "2.txt" For Output As #b
Print #b, Text6.Text
Close #b
Dim c As Integer
c = FreeFile
Open "3.txt" For Output As #c
Print #c, Text7.Text
Close #c
Dim d As Integer
d = FreeFile
Open "4.txt" For Output As #d
Print #d, Text8.Text
Close #d
Dim e As Integer
e = FreeFile
Open "5.txt" For Output As #e
Print #e, Text9.Text
Close #e
Dim file_name As String
Dim fnum As Integer
Dim max_row As Integer
Dim max_col As Integer
Dim R As Integer
Dim yy As Integer
file_name = App.Path
If Right$(file_name, 1) <> "\" Then file_name = file_name & "\"
file_name = file_name & "FlexGrid1.dat"
fnum = FreeFile
Open file_name For Output As fnum
' Save the maximum row and column.
max_row = MSFlexGrid1.Rows - 1
max_col = MSFlexGrid1.Cols - 1
Write #fnum, max_row, max_col
For R = 0 To max_row
For yy = 0 To max_col
Write #fnum, MSFlexGrid1.TextMatrix(R, yy);
Next yy
Write #fnum,
Next R
Close fnum
End Sub
Private Sub Command4_Click()
MSFlexGrid1.Clear
MSFlexGrid1.Rows = 1
MSFlexGrid1.Row = 0
MSFlexGrid1.Col = 0
End Sub
Private Sub Command7_Click()
Texthnorm.Text = "00"
Text5.Text = "00"
Text6.Text = "00"
Text7.Text = "00"
Text8.Text = "00"
Text9.Text = "00"
TxtHeureDebut = "00"
TxtMinuteDebut = "00"
TxtHeureFin = "00"
TxtMinuteFin = "00"
End Sub
Private Sub Form_Load()
Open App.Path & "\apercu.TXT" For Input As #1
Texthnorm.Text = Input(LOF(1), #1)
Close #1
Open App.Path & "\1.txt" For Input As #1
Text5.Text = Input(LOF(1), #1)
Close #1
Open App.Path & "\2.txt" For Input As #1
Text6.Text = Input(LOF(1), #1)
Close #1
Open App.Path & "\3.txt" For Input As #1
Text7.Text = Input(LOF(1), #1)
Close #1
Open App.Path & "\4.txt" For Input As #1
Text8.Text = Input(LOF(1), #1)
Close #1
Open App.Path & "\5.txt" For Input As #1
Text9.Text = Input(LOF(1), #1)
Close #1
With MSFlexGrid1
.MergeCells = 1
MSFlexGrid1.MergeRow(1) = True
.Rows = 2
.Cols = 6
.MergeCells = 0
.MergeRow(0) = True
.ColWidth(0) = 1100
.ColWidth(1) = 1400
.ColWidth(2) = 1400
.ColWidth(3) = 1400
.ColWidth(4) = 1400
.ColWidth(5) = 1400
.TabStop = False
'Ajouter filds
.TextMatrix(0, 0) = "date "
.TextMatrix(0, 1) = "heure embauche "
.TextMatrix(0, 2) = "fin de service "
.TextMatrix(0, 3) = "total jour "
.TextMatrix(0, 4) = "heure supp "
.TextMatrix(0, 5) = "heure nuit "
End With
Dim file_name As String
Dim fnum As Integer
Dim max_row As Integer
Dim max_col As Integer
Dim R As Integer
Dim c As Integer
Dim txt As String
Dim max_len As Single
Dim new_len As Single
file_name = App.Path
If Right$(file_name, 1) <> "\" Then file_name = file_name & "\"
file_name = file_name & "FlexGrid1.dat"
fnum = FreeFile
Open file_name For Input As fnum
' Hide the control until it's loaded.
MSFlexGrid1.Visible = False
DoEvents
' Get the maximum row and column.
Input #fnum, max_row, max_col
MSFlexGrid1.FixedCols = 0
MSFlexGrid1.Cols = max_col + 1
MSFlexGrid1.FixedRows = 1
MSFlexGrid1.Rows = max_row + 1
' Load the cell entries.
For R = 0 To max_row
For c = 0 To max_col
Input #fnum, txt
MSFlexGrid1.TextMatrix(R, c) = txt
Next c
' Read the last blank entry.
Input #fnum, txt
Next R
Close #fnum
' Size the columns.
Font.Name = MSFlexGrid1.Font.Name
Font.Size = MSFlexGrid1.Font.Size
For c = 0 To max_col
max_len = 0
For R = 0 To max_row
new_len = TextWidth(MSFlexGrid1.TextMatrix(R, c))
If max_len < new_len Then max_len = new_len
Next R
MSFlexGrid1.ColWidth(c) = max_len + 240
MSFlexGrid1.ColAlignment(c) = flexAlignLeftCenter
Next c
' Display the control.
MSFlexGrid1.Visible = True
End Sub
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.