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
|
Private Sub CommandButton1_Click()
Unload UserForm1
userformparametrage.Show
End Sub
Option Explicit
Dim VarSelectedArticle As Integer
Private Sub ComboBox1_Change()
End Sub
Private Sub finalisercomande_Click()
End Sub
Private Sub llstock_Click()
End Sub
Private Sub UserForm_Initialize()
Sheets("commandetraitee").Activate
Dim VarDerLigne As Integer
Dim VarPlageList As String
VarDerLigne = Sheets("etatdustock").Range("A65536").End(xlUp).Row
VarPlageList = Sheets("etatdustock").Range("B2:B" & VarDerLigne).Address
llselectionarticle.RowSource = "etatdustock!" & VarPlageList
End Sub
Private Sub llselectionarticle_Click()
VarSelectedArticle = UserForm1.llselectionarticle.ListIndex + 2
llstock = Sheets("etatdustock").Range("D" & VarSelectedArticle).Value
If llstock = 0 Then
llreference = "Article non Dispo"
llprix.Visible = False
llquantite.Visible = False
llprixtotal.Visible = False
Else
llprix.Visible = True
llquantite.Visible = True
llprixtotal.Visible = True
llreference = Sheets("etatdustock").Range("A" & VarSelectedArticle).Value
llprix = Format(Sheets("etatdustock").Range("C" & VarSelectedArticle).Value, "#,##0.00")
llprixtotal = ""
llquantite = ""
llquantite.SetFocus
End If
End Sub
Private Sub llquantite_change()
Dim Chiffre As Integer
If llquantite = "" Then Exit Sub
On Error GoTo Sortie
Chiffre = llquantite
llprixtotal = Format(llprix * llquantite, 0#)
ajouterarticleboutton.Visible = True
Exit Sub
Sortie:
MsgBox "Saisir Uniquement un Entier Numérique"
End Sub
Private Sub ajouterarticleboutton_Click()
Dim VarDerL As Integer
Dim Quantite As Integer
Dim Stock As Integer
VarDerL = Sheets("commandetraitee").Range("B42").End(xlUp).Row + 1
If llquantite = "" Then
MsgBox "Vous Devez Saisir Une Quantité", vbCritical, "Erreur => Invalide"
llquantite.Visible = True
llquantite.SetFocus
Exit Sub
End If
If llquantite <= 0 Then
MsgBox "Vous Devez Saisir Une Valeur Positive ", vbCritical, "Invalide"
llquantite.Visible = True
llquantite = ""
llquantite.SetFocus
Exit Sub
End If
On Error GoTo Sortie
Quantite = llquantite
Stock = llstock
If Quantite > Stock Then
MsgBox "La quantité demandée " & llquantite & " est supérieur au stock " _
& llstock, vbCritical, "Aie=> Stock Insuffisant"
llquantite.Visible = True
llquantite = llstock
llquantite.SetFocus
Exit Sub
End If
If VarDerL = 1000 Then
MsgBox "Vous êtes arrivé à la dernière ligne de cette facture", vbCritical, "Thierry's Démo => Fin de Facture"
Exit Sub
End If
With Sheets("commandetraitee")
.Range("A" & VarDerL) = ComboBox1
.Range("B" & VarDerL) = llreference
.Range("C" & VarDerL) = llselectionarticle
.Range("E" & VarDerL) = llquantite
.Range("D" & VarDerL) = Format(llprix, 0#)
.Range("F" & VarDerL) = Format(llprixtotal, 0#)
End With
Sheets("etatdustock").Range("D" & VarSelectedArticle).Value = _
Sheets("etatdustock").Range("D" & VarSelectedArticle).Value - llstock
Exit Sub
Sortie:
MsgBox "Article mis dans le panier !", vbOKOnly, "Parfait"
End Sub
Private Sub retourparametrageee_Click()
UserForm1.Hide
userformparametrage.Show
End Sub
Private Sub UserForm_Click()
End Sub |
Partager