![]()  | 
	
 
  | 
		
			
  | 	
	
	
		
		|||||||
| Регистрация | << Правила форума >> | FAQ | Пользователи | Календарь | Поиск | Сообщения за сегодня | Все разделы прочитаны | 
![]()  | 
	
	
| 
		 | 
	Опции темы | Поиск в этой теме | Опции просмотра | 
| 
	 | 
| 
		 
			 
			#1  
			
			
			
			
		 
		
		
	 | 
|||
		
		
  | 
|||
| 
	
	
		
			
			 Добрый день ребят. В программке есть такая процедура. 
		
	
		
		
		
		
		
	
		
		
	
	
	Вся эта процедура выводит расчеты в таблицу. Как мне реализовать чтобы в конце таблицы добавлялась строка "Итого" и суммировала все строки из столбца Код: 
	procedure Dif(summa, stavka, mesplatej: real; month: integer);
var
 i: integer;
 ostn, ostk, vplpr, pgdolg: real;
begin
  FCalc.SG.RowCount := month + 1;
  for i := 1 to month do begin
    if i = 1 then ostn := summa else ostn := ostk; 
    vplpr := ostn * stavka / 12;
    pgdolg := summa/month;
    ostk := ostn - pgdolg;
    mesplatej:=vplpr+pgdolg;
    FCalc.SG.Cells[0,i]:= inttostr(i); 
    FCalc.SG.Cells[1,i]:= floattostrf(vplpr,ffFixed,6,2);
    FCalc.SG.Cells[2,i]:= floattostrf(pgdolg,ffFixed,6,2);
    FCalc.SG.Cells[3,i]:= floattostrf(mesplatej,ffFixed,6,2);
    FCalc.SG.Cells[4,i]:= floattostrf(ostn,ffFixed,8,2);
    FCalc.SG.Cells[5,i]:= floattostrf(ostk,ffFixed,8,2);
  end;
end;
procedure TFCalc.BRaschClick(Sender: TObject);
   function PMT(IR, NP, PV: real): real;
   begin
   result := (PV * IR) / (1 - power(1 + IR, -NP));
  end;
 var
  sum, stavka: extended;
  month: integer;
  Ejrasch: extended;
 begin
if (EMonth.Text='') or (EStavka.Text='') or  (Esum.Text='') then ShowMessage ('Íåîáõîäèìî çàïîëíèòü âñå ïîëÿ')
else
begin  SG.visible:=True ;
  sum := StrToFloat(ESum.Text);
  stavka := StrToFloat(EStavka.Text) * 0.01;
  month := StrToInt(Emonth.Text);
    if RBAn.Checked=true then begin  
    Ejrasch := Pmt(stavka / 12, month, sum);
    Annuite(sum, stavka, Ejrasch, month);
  end
  else begin   
  Ejrasch := Pmt(stavka / 12, month, sum);
    Dif(sum, stavka, Ejrasch, month);
  end;
  end;
end;![]()  | 
| 
		 
			 
			#2  
			
			
			
			
		 
		
		
	 | 
||||
		
		
  | 
||||
| 
	
	
		
			
			 Код: 
	  sum1 ;= 0;
  for i := 1 to month do begin
    if i = 1 then ostn := summa else ostn := ostk; 
    vplpr := ostn * stavka / 12;
    pgdolg := summa/month;
    ostk := ostn - pgdolg;
    mesplatej:=vplpr+pgdolg;
    FCalc.SG.Cells[0,i]:= inttostr(i); 
    FCalc.SG.Cells[1,i]:= floattostrf(vplpr,ffFixed,6,2);
    sum1 := sum1 + vplpr;
    FCalc.SG.Cells[2,i]:= floattostrf(pgdolg,ffFixed,6,2);
    FCalc.SG.Cells[3,i]:= floattostrf(mesplatej,ffFixed,6,2);
    FCalc.SG.Cells[4,i]:= floattostrf(ostn,ffFixed,8,2);
    FCalc.SG.Cells[5,i]:= floattostrf(ostk,ffFixed,8,2);
  end; | 
| 
		 
			 
			#3  
			
			
			
			
		 
		
		
	 | 
|||
		
		
  | 
|||
| 
	
	
		
			
			 А как выводить sum1? 
		
	
		
		
		
		
		
	
		
		
	
	
	 | 
| 
		 
			 
			#4  
			
			
			
			
		 
		
		
	 | 
||||
		
		
  | 
||||
| 
	
	
		
			
			 "ИТОГ" - это строка таблицы, или что? 
		
	
		
		
		
		
			
		
		
		
		
	
		
		
	
	
	Если строка, то так же как и все остальные данные выводишь.  | 
| 
		 
			 
			#5  
			
			
			
			
		 
		
		
	 | 
|||
		
		
  | 
|||
| 
	
	
		
			
			 первый столбец "Месяц" непостоянен зависит от "Срока кредита" т.е если вводимый срок 6 месяцев то и строк будет 6 , 24 месяца = 24 строки. но Строка "Итого" должна быть постоянной в конце и в этой строке должна выводиться сумма столбца. вот 
		
	
		
		
		
		
		
	
		
		
	
	
	 | 
| 
		 
			 
			#6  
			
			
			
			
		 
		
		
	 | 
||||
		
		
  | 
||||
| 
	
	
		
			
			 Я показал как суммировать, на твой вопрос ответил, как вывести - уже думаем сами, или ждем Alegun или Freeman, они на пальцах объяснят. 
		
	
		
		
		
		
			
		
		
		
		
	
		
		
	
	
	 |