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
|
procedure TForm1.MiseAJourStock();
var
Result:Double;
QuantiteDisponible,QuantiteDemandee:Double;
begin
QuantiteDisponible := Q_stockSTOCK.value;
QuantiteDemandee:=T_TempVQte_VT.Value;
if (Q_stock.recordcount> 0) then
begin
case CompareValue(QuantiteDemandee, QuantiteDisponible) of
// Quantité demandée inférieure à celle disponible
LessThanValue: begin
Result := 0;
Edit1.text := FloatToStr(Result);
end;
EqualsValue: begin
// Quantité demandée égale à celle disponible
Result := 0;
end;
GreaterThanValue: begin
// Quantité demandée supérieure à celle disponible
Result := QuantiteDemandee-QuantiteDisponible;
Q_Stock.Filtered:=False;
ListBox1.Clear;
T_TempV.DisableControls;
Q_Stock.DisableControls;
try
Q_Stock.First;
while not Q_Stock.eof do
begin
T_TempV.First;
while not T_TempV.eof do
begin
if (T_TempV.fieldbyname('Prod_VT').asstring=
Q_Stock.FieldByName('Produits').asstring) AND
(T_TempV.fieldbyname('Qte_VT').Value>
Q_Stock.FieldByName('STOCK').Value)
then
begin
ListBox1.Clear;
ListBox1.Items.Add(Form1.T_TempVProd_VT.Value);
Break;
T_TempV.Next;
end;
T_TempV.Next;
end;
Q_Stock.Next;
end;
finally
T_TempV.EnableControls;
Q_Stock.EnableControls;
end;
end;
end;
end;
end; |