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
| Private Sub BtEditer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtEditer.Click
Listes = New List(Of String)
Lis = New List(Of String)
A = New List(Of String)
B = New List(Of String)
C = New List(Of String)
D = New List(Of String)
G = New List(Of String)
F = New List(Of String)
G1 = New List(Of String)
G2 = New List(Of String)
G3 = New List(Of String)
G4 = New List(Of String)
C1 = New List(Of String)
C2 = New List(Of String)
C3 = New List(Of String)
C4 = New List(Of String)
Dim Imp As New Imprimer
Dim ic As New Decompte
For Each Utilist As DataGridViewRow In Me.DGV_EtatDesFrais.Rows
If Utilist.Cells(3).Value = "MISSION" Then
Lis.Add(Utilist.Cells(1).Value)
If Utilist.Cells(9).Value <= 0 Then
A.Add(Utilist.Cells(1).Value)
Else
B.Add(Utilist.Cells(1).Value)
If Utilist.Cells(11).Value = "2" Then
C1.Add(Utilist.Cells(11).Value)
C2.Add(Utilist.Cells(1).Value)
ElseIf Utilist.Cells(11).Value = "1" Then
C3.Add(Utilist.Cells(11).Value)
C4.Add(Utilist.Cells(1).Value)
End If
End If
ElseIf Utilist.Cells(3).Value = "DEPLACEMENT" Then
Listes.Add(Utilist.Cells(1).Value)
If Utilist.Cells(9).Value <= 0 Then '<=
D.Add(Utilist.Cells(1).Value)
Else
F.Add(Utilist.Cells(1).Value)
If Utilist.Cells(11).Value = "2" Then
G1.Add(Utilist.Cells(11).Value)
G2.Add(Utilist.Cells(1).Value)
ElseIf Utilist.Cells(11).Value = "1" Then
G3.Add(Utilist.Cells(11).Value)
G4.Add(Utilist.Cells(1).Value)
End If
End If
End If
End If
Next
If Listes.Count > 0 Or Lis.Count > 0 Then
Dim message As String
If Listes.Count = 1 Or Lis.Count = 1 Then
message = "Voulez vous Editer L'Etat des Frais de Mission :" & vbCrLf & Me.DGV_EtatDesFrais.CurrentRow.Cells(1).Value & "?"
Else
message = "Voulez vous Editer L'Etat des Frais de Mission ?"
End If
If MsgBox(message, MsgBoxStyle.OkCancel) = MsgBoxResult.Ok Then
If A.Count > 0 Then
Dim inc As New Decompte
Dim numero As String = inc.IncNumRecapMIss(Year(Today), "3", "MISSION")
For Each util In A
NUtilisateur = util
inc.InsertNumRecap(NUtilisateur, numero, Connexion)
Next
inc.InsertNumRecapTablevalid(numero, Connexion)
Imp.EditerRecapMissRemb(A)
End If
If B.Count > 0 Then
For Each util In C1
Dim inc As New Decompte
numero = inc.IncNumRecapMIss(Year(Today), "2", "MISSION")
Next
For Each util In C2
NUtilisateur = util
ic.InsertNumRecap(NUtilisateur, numero, Connexion)
Next
For Each util In C3
Dim inc As New Decompte
num = inc.IncNumRecapMIss(Year(Today), "1", "MISSION")
numero = num
Next
For Each util In C4
NUtilisateur = util
ic.InsertNumRecap(NUtilisateur, num, Connexion)
Next
Dim Ip As New Imprimer
ic.InsertNumRecapTablevalid(numero, Connexion)
Ip.EditerRecapMiss(B)
End If
If D.Count > 0 Then
Dim inc As New Decompte
Dim numero As String = inc.IncNumRecap(Year(Today), "3", "DEPLACEMENT")
For Each util In D
NUtilisateur = util
inc.InsertNumRecap(NUtilisateur, numero, Connexion)
Next
ic.InsertNumRecapTablevalid(numero, Connexion)
Imp.EditerRecapDepRem(D)
End If
If F.Count > 0 Then
For Each util In G1
Dim inc As New Decompte
numero = inc.IncNumRecap(Year(Today), "2", "DEPLACEMENT")
Next
For Each util In G2
NUtilisateur = util
ic.InsertNumRecap(NUtilisateur, numero, Connexion)
Next
For Each util In G3
Dim inc As New Decompte
numero = inc.IncNumRecap(Year(Today), "1", "DEPLACEMENT")
num = numero
Next
For Each util In G4
NUtilisateur = util
ic.InsertNumRecap(NUtilisateur, num, Connexion)
Next
ic.InsertNumRecapTablevalid(numero, Connexion)
Imp.EditerRecapDep(F)
End If
Dim ListeLigneEdit As New List(Of DataGridViewRow)
For Each Ligne As DataGridViewRow In Me.DGV_EtatDesFrais.Rows
If Ligne.Cells(0).Value Then
ListeLigneEdit.Add(Ligne)
End If
Next
If ListeLigneEdit.Count <> 0 Then
For Each Ligne As DataGridViewRow In ListeLigneEdit
Me.DGV_EtatDesFrais.Rows.Remove(Ligne)
Next
End If
End If
Else
MsgBox("Vous devez sélectionner au moins une Décompte", MsgBoxStyle.Information)
Exit Sub
End If
End Sub |
Partager