Gestion De Stock Windev Pdf -
// Après une sortie de stock PROCÉDURE Gerer_Reapprovisionnement(RefP, QuantiteRestante) SI QuantiteRestante < Produit.Seuil ALORS // Créer commande Commande.Numero = N°Auto() Commande.Fournisseur = Produit.FournisseurRef Commande.Date = DateSys() HAjoute(Commande)// Lier les lignes LigneCmd.CommandeNum = Commande.Numero LigneCmd.ProduitRef = RefP LigneCmd.Quantite = Produit.QuantiteReappro HAjoute(LigneCmd) // Générer PDF de la commande sPDF = "BC_" + Commande.Numero + ".pdf" iDestinationPDF(État_BonCommande, sPDF, Commande.Numero) // Envoyer au fournisseur MaBdEmail.Nom = Produit.Fournisseur.MailCommande MaBdEmail.Sujet = "Bon de commande #" + Commande.Numero MaBdEmail.PieceJointe = sPDF MailEnvoye(MaBdEmail) FIN
FIN
WinDEV ne se limite pas à HyperFile SQL. Vous pouvez générer des PDF de gestion de stock depuis :
Exemple avec MySQL :
HConnect("MaBDMySQL", "Driver=MySQL ODBC 8.0;Server=localhost;Database=stock;")
Requête("SELECT * FROM produits WHERE qte < seuil", "rqAlerte")
État_Alerte.Source = rqAlerte
iDestinationPDF(État_Alerte, "Alertes.pdf")
Avant de dessiner les fenêtres, il est crucial de structurer les données. Sous WinDev, cela se fait via l'Analyse (le dictionnaire des données).
Protégez vos inventaires sensibles par mot de passe :
iDestinationPDF(Etat_Stock, "Confidentiel.pdf")
// Après génération
PDFProtège("Confidentiel.pdf", "MotDePasseAdmin", "", "owner")
Seul le mot de passe permettra l’impression ou la modification. gestion de stock windev pdf
WINDEV provides a complete environment for building professional stock management applications:
Next steps:
Use a Window with input fields for Product, Quantity, and Type (Combo box: "IN" or "OUT"). WinDEV ne se limite pas à HyperFile SQL
Sample Code for Adding a Movement (in the "Validate" button):
// Add movement record MovementID = HMax("STOCK_MOVEMENT", "MovementID") + 1 HAdd("STOCK_MOVEMENT", MovementID, ProductID, Quantity, Type, CurrentDate(), Reason)// Update product stock IF Type = "IN" THEN HModify("PRODUCT", ProductID, "CurrentStock", CurrentStock + Quantity) ELSE HModify("PRODUCT", ProductID, "CurrentStock", CurrentStock - Quantity) END
// Refresh display TableDisplay(TABLE_Products)"MovementID") + 1 HAdd("STOCK_MOVEMENT"
Best practice: Wrap the two writes (movement + product update) in a transaction:
HTransactionStart() ... (HAdd, HModify) ... IF HTransactionEnd() = False THEN Error("Transaction failed")