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
|
'FORMULAIRE GESTION FACTURES
Private Sub CommandButton_Reset_Click()
Unload Me
UserForm_Factures.Show
'Pour réinitialisation personnalisée de l'UserForm_Factures
'TextBox_IDFacture.Text = ""
'TextBox_DateFacture.Text = ""
'ComboBox_IDClientFacture.ListIndex = -1
'ComboBox_NomClientFacture.ListIndex = -1
'LabelChange_DataClientNom.Caption = "Nom, Prénom, Naissance"
'LabelChange_DataClientAdresse.Caption = "Adresse"
'LabelChange_DataClientTelMail.Caption = "Téléphone, e-mail"
'LabelChange_DataClientNotes.Caption = "Notes"
'ComboBox_P1.ListIndex = -1
'TextBox_DateP1.Text = ""
'TextBox_QteP1.Text = ""
'ComboBox_P2.ListIndex = -1
'TextBox_DateP2.Text = ""
'TextBox_QteP2.Text = ""
'TextBox_Remise.Text = ""
'LabelChange_TotalP1.Caption = "Total P1 (chf)"
'LabelChange_TotalP2.Caption = "Total P2 (chf)"
'LabelChange_TotalRemise.Caption = "Total remise (chf)"
'LabelChange_FTotal.Caption = "Total (chf)"
'TextBox_DateReglementFacture.Text = ""
'TextBox_NotesFacture.Text = ""
End Sub
'Bouton Fermer
Private Sub CommandButton_FermerGestionFactures_Click()
Unload Me
Sheets("Print").Activate
End Sub
'Ouverture de l'UserForm
Private Sub UserForm_Initialize()
Dim i As Integer
'Boucle pour ajouter les NomClient dans la liste déroulante
For i = 2 To 10000
ComboBox_NomClientFacture.AddItem Sheets("CLIENTS").Cells(i, 3)
Next
'Boucle pour ajouter les IDClient dans la liste déroulante
For i = 2 To 10000
ComboBox_IDClientFacture.AddItem Sheets("CLIENTS").Cells(i, 1)
Next
End Sub
'remplissage automatique selon NomClient
Private Sub ComboBox_NomClientFacture_Change()
Dim i As Integer
Dim Nomclient As String
Nomclient = Me.ComboBox_NomClientFacture.Value
' Trouve dans la feuille "CLIENTS" la ligne qui concorde avec NomClient et restitue les data
For i = 2 To 10000
If Sheets("CLIENTS").Cells(i, 3).Value = Nomclient Then
' Populate the other fields with the corresponding values from the "CLIENTS" sheet
Me.ComboBox_IDClientFacture.Value = Sheets("CLIENTS").Cells(i, 1).Value
Me.LabelChange_DataClientNom.Caption = Sheets("CLIENTS").Cells(i, 3).Value & " " & Sheets("CLIENTS").Cells(i, 4).Value & " - " & Sheets("CLIENTS").Cells(i, 5).Value
Me.LabelChange_DataClientAdresse.Caption = Sheets("CLIENTS").Cells(i, 6).Value & " - " & Sheets("CLIENTS").Cells(i, 7).Value & " " & Sheets("CLIENTS").Cells(i, 8).Value
Me.LabelChange_DataClientTelMail.Caption = "+" & Sheets("CLIENTS").Cells(i, 11).Value & " - " & Sheets("CLIENTS").Cells(i, 12).Value
Me.LabelChange_DataClientNotes.Caption = Sheets("CLIENTS").Cells(i, 13).Value
Exit For
End If
Next
End Sub
'remplissage automatique selon IDClient
Private Sub ComboBox_IDClientFacture_Change()
Dim i As Integer
Dim idclient As String
idclient = Me.ComboBox_IDClientFacture.Value
' Trouve dans la feuille "CLIENTS" la ligne qui concorde avec IDClient et restitue les data
For i = 2 To 10000
If Sheets("CLIENTS").Cells(i, 1).Value = idclient Then
' Populate the other fields with the corresponding values from the "CLIENTS" sheet
Me.ComboBox_NomClientFacture.Value = Sheets("CLIENTS").Cells(i, 3).Value
Me.LabelChange_DataClientNom.Caption = Sheets("CLIENTS").Cells(i, 3).Value & " " & Sheets("CLIENTS").Cells(i, 4).Value & " - " & Sheets("CLIENTS").Cells(i, 5).Value
Me.LabelChange_DataClientAdresse.Caption = Sheets("CLIENTS").Cells(i, 6).Value & " - " & Sheets("CLIENTS").Cells(i, 7).Value & " " & Sheets("CLIENTS").Cells(i, 8).Value
Me.LabelChange_DataClientTelMail.Caption = "+" & Sheets("CLIENTS").Cells(i, 11).Value & " - " & Sheets("CLIENTS").Cells(i, 12).Value
Me.LabelChange_DataClientNotes.Caption = Sheets("CLIENTS").Cells(i, 13).Value
Exit For
End If
Next
End Sub |
Partager