Probe con esto(en el boton agregar del form agregar producto):
procedure TForm4.Button1Click(Sender: TObject); var total:Double; preciou:Double; s:integer; suma:Double; begin if (GrillaProd.SelectedRows.Count=1) then begin ShowMessage('seleccione al menos un producto'); end else if (Edit2.Text='') then begin ShowMessage('Especifique la cantidad a vender'); end else begin with Form3.Grillaticket do begin RowCount:=RowCount + 1; Row:=RowCount - 1; Cells[0,Row]:=queryprod.FieldByName('idproducto').AsString; Cells[1,Row]:=Edit2.Text; Cells[2,Row]:=queryprod.FieldByName('nombre').AsString; Cells[3,Row]:=queryprod.FieldByName('preciou').AsString; preciou:=StrToFloatDef(Cells[3,Row],0); total:=preciou * StrToFloatDef(Edit1.Text,0); Cells[4,Row]:=FloatToStr(total); end; for s:=0 to Form3.Grillaticket.RowCount - 1 do begin suma:=suma + StrToFloatDef(Form3.Grillaticket.Cells[4,Form3.Grillaticket.Row],0) end; Form3.StringGrid1.Cells[1,2]:=FloatToStr(suma); end; end;
Desde ya muchas gracias...