I have one table name "prenotazioni" this is the add module:
foto
and another table called "posti" this is the structure:
posti
What is the code for prevent in the function "Before Add" for to control, if in the date request, they are available, in comparison to the total seat memorized in the table "posti".
One code type:
[codebox] SELECT PO.Posizione, PO.PostiTotali, SUM(PR.Coperti)
FROM Prenotazioni PR
INNER JOIN Posti PO ON PR.IDPosto = PO.IDPosto
WHERE PR.Data = '2008-09-24'
GROUP BY PR.IDPosto [/codebox]
With message not seat, or only 5 seat available etc.....