Gestion magasin

Description

cette source a pour but de determiner pour une operation d'achat le prix total en fonction du prix unitaire,de la quantité de chaque produitet de remise et le net payer l'utilisateur choisit le produit a acheter a partir de deux listes presentant les produit disponibles et le prix unitaire correspendants.

Source / Exemple :


Private Sub Cmdcalcul_Click()
Dim tot As Integer
Dim r As Variant
r = 0
tot = 0
For i = 0 To Lstachat.ListCount - 1
Lstachat.ListIndex = i
Lblproduit(i).Caption = Lstachat.Text
Lblproduit(i).Visible = True
Txtqte(i).Visible = True
lblpu(i).Caption = Lstpu2.Text
lblpu(i).Visible = True
tot = Val(Txtqte(i)) * Val(lblpu(i).Caption) + tot
lbltotal.Caption = Val(tot)
Next
If Optr(1).Value = True Then
r = tot * 0.1
lblremise.Caption = r
Else
If Optr(2).Value = True Then
r = tot * 0.2
lblremise.Caption = r
Else
lblremise.Caption = Val(tot)
End If
End If
lblnet.Caption = tot - r
End Sub

Private Sub cmddroit_Click()
Dim k As Integer
If Lststock.ListCount = 0 Then Exit Sub
Lstachat.AddItem (Lststock.Text)
Lstpu2.AddItem (lstpu1.Text)

i = Lststock.ListIndex
Lststock.RemoveItem (Lststock.ListIndex)
lstpu1.RemoveItem (lstpu1.ListIndex)
If Lstachat.ListCount > 0 Then
   If i > Lststock.ListIndex - 1 Then
   Lststock.ListIndex = i - 1
   lstpu1.ListIndex = i - 1
  Else
  Lststock.ListIndex = i
  lstpu1.ListIndex = i
  End If
  End If
  Lststock.ListIndex = Lststock.NewIndex
  lstpu1.ListIndex = lstpu1.NewIndex
End Sub

Private Sub cmdgauche_Click()
If Lstachat.ListCount = 0 Then Exit Sub

Lststock.AddItem (Lstachat.Text)
lstpu1.AddItem (Lstpu2.Text)
i = Lstachat.ListIndex
Lstachat.RemoveItem (i)
Lstpu2.RemoveItem (i)
Lststock.ListIndex = Lststock.NewIndex
lstpu1.ListIndex = lstpu1.NewIndex
 If Lstachat.ListCount > 0 Then
    If i > Lstachat.ListCount - 1 Then
      Lstachat.ListIndex = i - 1
      Lstpu2.ListIndex = i - 1
    Else
      Lstachat.ListIndex = i
      Lstpu2.ListIndex = i
    End If
  End If
 
End Sub

Private Sub cmdtoutdroit_Click()

 Dim i As Integer
  For i = 0 To Lststock.ListCount - 1
    Lstachat.AddItem Lststock.List(i)
    Lstpu2.AddItem lstpu1.List(i)
  Next
  Lststock.Clear
  lstpu1.Clear
  Lstachat.ListIndex = 0
End Sub

Private Sub cmdtoutgauche_Click()
On Error Resume Next
 Dim i As Integer
  For i = 0 To Lstachat.ListCount - 1
    Lststock.AddItem Lstachat.List(i)
    lstpu1.AddItem Lstpu2.List(i)
  Next
  Lstachat.Clear
  Lstpu2.Clear
  Lststock.ListIndex = Lststock.NewIndex
  lstpu1.ListIndex = lstpu1.NewIndex
End Sub

Private Sub Form_Load()
Lststock.AddItem ("chausures")
lstpu1.AddItem (42)
Lststock.AddItem ("veste")
lstpu1.AddItem (89)
Lststock.AddItem ("caravate")
lstpu1.AddItem (18)
Lststock.AddItem ("pantalon")
lstpu1.AddItem (45)
Lststock.AddItem ("pull")
lstpu1.AddItem (38)
Lststock.AddItem ("chemise")
lstpu1.AddItem (30)
lstpu1.ListIndex = 0
Lststock.ListIndex = 0
For i = 0 To 5
Lblproduit(i).Visible = False
lblpu(i).Visible = False
Txtqte(i).Visible = False
Next i
End Sub

Private Sub Lstachat_Click()
Lstpu2.ListIndex = Lstachat.ListIndex

End Sub

Private Sub lstpu1_Click()
Lststock.ListIndex = lstpu1.ListIndex
End Sub

Private Sub Lstpu2_Click()
Lstachat.ListIndex = Lstpu2.ListIndex
End Sub

Private Sub Lststock_Click()
lstpu1.ListIndex = Lststock.ListIndex
End Sub

Private Sub quitter_Click()
End
End Sub

Codes Sources

A voir également

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.