(23-02-2018, 01:41 AM)Ben.Ja كتب : اظن ان الاستعلام الثاني الذي تريد منه ان يأخذ النتائج من الاول ووضعها في جدول المبيعات لا فائدة منه, يمكنك اختصار الكل في استعلام واحد
هل جربت الكود؟ لان لدي نفس الجداول واشتغل معي الاستعلام
PHP كود :
begin
ABSQuery3.Close;
ABSQuery3.SQL.Clear;
ABSQuery3.SQL.Add('select vente.numero,vente.vendeur,vente.article,vente.categorie,vente.quantite,affectation.tranche,affectation.tarif_commission');
ABSQuery3.SQL.Add('from vente,affectation');
ABSQuery3.SQL.Add('where affectation.categorie = vente.categorie and vente.article = affectation.article and vente.quantite between affectation.de and affectation.jusqu_au ORDER by vente.vendeur asc ');
ABSQuery3.Open;
ABSQuery3.First;
while not ABSQuery3.Eof do
begin
absVente.Locate('numero',ABSQuery3.FieldByName('numero').Value,[]);
absVente.edit;
absVente.FieldByName('commission').value := ABSQuery3.FieldByName('tarif_commission').Value * ABSQuery3.FieldByName('quantite').Value;
absVente.post;
ABSQuery3.Next;
end;
end;
الكيري الثاني مهم جدا لانه هو الذي يقوم بفلترة البيانات وعملية حساب العمولة
غدا ان شاء الله ساقوم بعمل مشروع صغير
وارفقه في المرفقات
لتفهم المشكلة
if someone offers you an amazing opportunity
and you are not sure you can do it
say yes - then learn how to do it later