Показать сообщение отдельно
  #10  
Старый 14.12.2011, 12:42
AntiMag AntiMag вне форума
Прохожий
 
Регистрация: 24.06.2010
Сообщения: 7
Репутация: 10
По умолчанию

Короче сделал)))))) не честно там всё норм просто это дипломная программа )))))
Воот код который работает с 3бя таблицами и они связаты как и говарилось выше.....
Надеюсь кому нить поможет))))
PHP код:
procedure TForm14.tovarobshie;
var
i,a:integer;
begin
a
:=0;
i:=0;
ListBox1.Clear;
ListBox2.Clear;
if 
Tovari12.Active=false then Tovari12.Active := true;
if 
ADOTable12.Active false then ADOTable12.Active := true;
begin
  Tovari12
.First;
  While 
not Tovari12.Eof do
    
begin
    ListBox1
.Items.Add((Tovari12.fieldByName('Kod_tovara').Value));
    
Tovari12.Next;
    
end;
  
end;
////////////////////////////////////////////////////////////////////////////////
  
for i:=0 to listbox1.Items.Count -do
  
begin
  ADOTable12
.First;
  While 
not ADOTable12.Eof do
    
begin
  
if (ListBox1.Items[i]=(ADOTable12.fieldByName('kod_tov').Value)) then
  a
:=a+((ADOTable12.fieldByName('kol_vo').Value));
    
ADOTable12.Next;
    
end;
  
ListBox2.Items.Add(inttostr(a));
  
a:=0;
  
end;
////////////////////////////////////////////////////////////////////////////////
begin
  Tovari12
.First;
  
i:=0;
  While 
not Tovari12.Eof do
    
begin
      
if i<=listbox1.Items.Count-1 then
      begin
        
if ((ListBox1.Items[i])=(Tovari12.fieldByName('Kod_tovara').Value)) then
        begin
        Tovari12
.Edit;
        
Tovari12['Sum_kol_tov']:=(strtoint(ListBox2.Items[i]));
        
Tovari12.post;
        
Tovari12.Active:=false;
        
Tovari12.Active:=true;
        
i:=i+1;
        
end;
       
Tovari12.Next;
      
end
  
else
  
Tovari12.Next;
  
end;
end;
end;

procedure TForm14.tiptavodshie;
var
i,a:integer;
begin
a
:=0;
ListBox1.Clear;
ListBox2.Clear;
if 
Tovari12.Active=false then Tovari12.Active := true;
if 
ADOTable1.Active false then ADOTable1.Active := true;
begin
  ADOTable1
.First;
  While 
not ADOTable1.Eof do
    
begin
    ListBox1
.Items.Add((ADOTable1.fieldByName('Kod_tip').Value));
    
ADOTable1.Next;
    
end;
  
end;
////////////////////////////////////////////////////////////////////////////////
begin
  
for i:=0 to listbox1.Items.Count -do
  
begin
  Tovari12
.First;
  While 
not Tovari12.Eof do
    
begin
  
if (ListBox1.Items[i]=(Tovari12.fieldByName('Kod_tip').Value)) then
  a
:=a+((Tovari12.fieldByName('Sum_kol_tov').Value));
    
Tovari12.Next;
    
end;
  
ListBox2.Items.Add(inttostr(a));
  
a:=0;
  
end;
end;
////////////////////////////////////////////////////////////////////////////////
begin
  ADOTable1
.First;
  
i:=0;
  While 
not ADOTable1.Eof do
    
begin
      
if i<=listbox1.Items.Count-1 then
      begin
        
if ((ListBox1.Items[i])=(ADOTable1.fieldByName('Kod_tip').Value)) then
        begin
          ADOTable1
.Edit;
          
ADOTable1['Sum_kol_tip']:=(strtoint(ListBox2.Items[i]));
          
ADOTable1.post;
          
ADOTable1.Active:=false;
          
ADOTable1.Active:=true;
          
i:=i+1;
        
end;
        
ADOTable1.Next;
      
end
  
else
  
ADOTable1.Next;
  
end;
end;
end


Форма 14 она не видна не кому и используется как буферный ресурс для всяких расчётов ))))
Ответить с цитированием