Sim, eles são tabelados na hora do cadastro como pode ver
e no "ComboBox" eu faço a alteração de acordo com a tabela selecionada
procedure TfmCadOrcamento.ComboBox1Change(Sender: TObject);
begin
if (ComboBox1.ItemIndex = 0) then
begin
if (tbOrcaProd.Locate('CODIGO', tbOrcaFilhoCODIGO.AsInteger,[])) then
begin
tbOrcaFilho.Edit;
tbOrcaFilhoVALOR_UNIT.AsString := tbOrcaProdPRECO_CUSTO.AsString;
tbOrcaFilhoVALOR_TOTAL.AsString := tbOrcaFilhoQTDA.AsString * tbOrcaFilhoVALOR_UNIT.NewValue;
tbOrcaFilhoVALOR_TOTAL.AsString := FloatToStrF(StrToFloat(tbOrcaFilhoVALOR_TOTAL.AsString), ffNumber, 12, 2);
tbOrcaFilho.Post;
end;
end;
if (ComboBox1.ItemIndex = 1) then
begin
if (tbOrcaProd.Locate('CODIGO', tbOrcaFilhoCODIGO.Value,[])) then
begin
tbOrcaFilho.Edit;
tbOrcaFilhoVALOR_UNIT.AsString := tbOrcaProdPRECO_VAREJO.AsString;
tbOrcaFilhoVALOR_TOTAL.AsString := tbOrcaFilhoQTDA.AsString * tbOrcaFilhoVALOR_UNIT.NewValue;
tbOrcaFilhoVALOR_TOTAL.AsString := FloatToStrF(StrToFloat(tbOrcaFilhoVALOR_TOTAL.AsString), ffNumber, 12, 2);
tbOrcaFilho.Post;
end;
end;
if (ComboBox1.ItemIndex = 2) then
begin
if (tbOrcaProd.Locate('CODIGO', tbOrcaFilhoCODIGO.Value,[])) then
begin
tbOrcaFilho.Edit;
tbOrcaFilhoVALOR_UNIT.AsString := tbOrcaProdPRECO_ATACADO.AsString;
tbOrcaFilhoVALOR_TOTAL.AsString := tbOrcaFilhoQTDA.AsString * tbOrcaFilhoVALOR_UNIT.NewValue;
tbOrcaFilhoVALOR_TOTAL.AsString := FloatToStrF(StrToFloat(tbOrcaFilhoVALOR_TOTAL.AsString), ffNumber, 12, 2);
tbOrcaFilho.Post;
end;
end;
if (ComboBox1.ItemIndex = 3) then
begin
if (tbOrcaProd.Locate('CODIGO', tbOrcaFilhoCODIGO.Value,[])) then
begin
tbOrcaFilho.Edit;
tbOrcaFilhoVALOR_UNIT.AsString := tbOrcaProdPRECO_PROMOCAO.AsString;
tbOrcaFilhoVALOR_TOTAL.AsString := tbOrcaFilhoQTDA.AsString * tbOrcaFilhoVALOR_UNIT.NewValue;
tbOrcaFilhoVALOR_TOTAL.AsString := FloatToStrF(StrToFloat(tbOrcaFilhoVALOR_TOTAL.AsString), ffNumber, 12, 2);
tbOrcaFilho.Post;
end;
end;
end;