Detalle.Cells[0,indiceGrid]:=Cant.Text;
Detalle.Cells[1,indiceGrid]:=CodProducto.Text;
Detalle.Cells[2,indiceGrid]:=DbGrid.DataSource.DataSet.Fields[1].AsString; //descripcion
Detalle.Cells[3,indiceGrid]:=DbGrid.DataSource.DataSet.Fields[2].AsString; //precio unitario
Detalle.Cells[4,indiceGrid]:=FloatToStr(StrToFloat(Cant.Text)*StrToFloat(DbGrid.datasource.DataSet.Fields[2].AsString)); //subtotal
total.Text:=FloatToStr(StrToFloat(total.Text) + StrToFloat(Detalle.Cells[4,indiceGrid]));
indiceGrid:=indiceGrid+1;
Detalle.RowCount:=indiceGrid;
donde indiceGrid es una variable global que lleva el indice en donde debo insertar el nuevo elemento..
|