After generating PDF, use external command or WINDEV's fOpen/PDF functions? WINDEV does not natively password-protect PDFs, but you can call a third-party tool (e.g., QPDF) using ShellExecute().
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.
Similaire à l'entrée, mais avec une logique inverse.
Exemple de Contrôle (Sortie) :
// Vérification du stock disponible
HLitRecherchePremier(Produit, IDProduit, Table_LigneSortie.COL_IDProduit)
SI Produit.QuantiteStock < Table_LigneSortie.COL_Quantite ALORS
Erreur("Stock insuffisant pour le produit : " + Produit.Designation)
RETOUR // On annule l'opération
SINON
Produit.QuantiteStock -= Table_LigneSortie.COL_Quantite
HModifie(Produit)
FIN
The most practical example: When a sale is recorded (stock decreases), automatically generate and email a PDF invoice.
Process in the "Validate Sale" button:
// 1. Record the sale transaction Transaction.PRODUCT_ID = nSelectedProduct Transaction.QUANTITY = -nQuantitySold Transaction.TRANSACTION_TYPE = "Sale" Transaction.DOCUMENT_REF = sInvoiceNumber HAdd(Transaction)// 2. Update current stock UpdateStock(nSelectedProduct, -nQuantitySold)
// 3. Generate PDF Invoice iDestination = iPDF iMerge = iNoMerge PDF_Path = "C:\Invoices\INV_" + sInvoiceNumber + ".pdf" iPrintReport(RPT_Invoice, iPDF, PDF_Path) gestion de stock windev pdf
// 4. (Optional) Send via email with WINDEV's Email management EmailStartSession("smtp.yourcompany.com") EmailSend("stock@company.com", Customer.Email, "Your Invoice " + sInvoiceNumber, "Please find attached PDF", PDF_Path)
Stock management PDFs are legal documents. WINDEV allows you to:
Create a window (WIN_MainStock). Drop a Table control bound to the PRODUCT file. After generating PDF, use external command or WINDEV's
WLanguage code in the table display:
// Colorize low stock rows
IF TABLE_PRODUCT.CURRENT_STOCK < TABLE_PRODUCT.MIN_STOCK_ALERT THEN
TABLE_PRODUCT[MyRow].Color = LightRed
TABLE_PRODUCT[MyRow].FontColor = DarkRed
ELSE
TABLE_PRODUCT[MyRow].Color = White
END
In the report editor:
Add UserID and Timestamp to STOCK_MOVEMENT to track who changed stock.
You are about to leave www.natgeotv.com/za. The page you are about to visit is not on The Walt Disney Company Limited control. Terms of Use and Privacy Policy of the owner of the site will be applied.
Accept