I have 2 dbgrids in different places.
However, the first DBGrid contains all the information (all the titles I've searched for). And in the second DBGrid, it contains the specific information about that title (number of parcels).
DBGrid1:
DBGrid2:
Follow sample code:
DMRetaguarda.zqConTitulos.Close;
DMRetaguarda.zqConTitulos.SQL.Clear;
DMRetaguarda.zqConTitulos.SQL.Add('SELECT t707tit.CD_LOTE as lote, t707tit.NR_TIT AS tit, ' +
't707tit.NR_SEU as numdoc, t707tit.CD_CED as codced, t707tit.vr_jrs_dd as ' +
'jurosaodia, t707tit.mt_am as multaaomes, t707tit.de_msg_1 as msg1, t707tit.vr_ioc as valorioc, t707tit.vr_abt as valorabat, t707tit.vr_dct as valordesc1, t707tit.vr_dct2 as valordesc2, t707tit.dt_dct as datadesc1, t707tit.dt_dct2 as datadesc2, ' +
't707tit.de_msg_2 as msg2, t707tit.de_msg_3 as msg3, t707tit.id_pre_ipr as preimpresso, t707tit.DT_PAG as dtpag, t707tit.VR_PAG as valorpago, t707tit.STATUS_canc as status,');
DMRetaguarda.zqConTitulos.SQL.Add('t707tit.NR_NOS as nossonum, t707tit.DT_EMS ' +
'as dtemi, t707tit.PZ_PRT as prazopro, t707tit.motivo_canc as motivocanc,');
DMRetaguarda.zqConTitulos.SQL.Add('t707tit.DT_VEN as dtven, ' +
't707tit.DV_NR_NOSS as dv, t707tit.cd_ag as codag, t707tit.cd_bco as codbanco, ');
DMRetaguarda.zqConTitulos.SQL.Add('t707tit.VR_TIT as vltit, ' +
't707cli.CD_IDT_CLI as codcli, t707tit.id_pre_ipr as preimpresso , t707tit.COD_CDC as codcentrocusto,');
DMRetaguarda.zqConTitulos.SQL.Add('t707cli.TP_CLI as tipocli, t707cli.NM_CLI ' +
'as nomecli, ');
DMRetaguarda.zqConTitulos.SQL.Add('t707cli.CD_CAR as codcart, t707tcar.DE_CAR ' +
'as descCart');
DMRetaguarda.zqConTitulos.SQL.Add('FROM t707tit, t707cli, t707tcar WHERE ' +
't707tit.CD_CAR = t707tcar.CD_CAR AND t707cli.CD_CAR = t707tit.CD_CAR AND t707tit.CD_IDT_CLI = ' +
't707cli.CD_IDT_CLI '+campo+' ORDER BY t707tit.NR_TIT,t707tit.NR_SEU LIMIT '+IntToStr(inicio)+', '+IntToStr(fim));
if maskEmi.Text <> ' / / ' then
begin
DMRetaguarda.zqConTitulos.ParamByName('pdataemi').AsDate := StrToDate(maskEmi.Text);
end;
if maskDataVenc.Text <> ' / / ' then
begin
DMRetaguarda.zqConTitulos.ParamByName('pdataven').AsDate := StrToDate(maskDataVenc.Text);
end;
DMRetaguarda.zqConTitulos.Open;
Code that captures the document selected above:
//selecionando todas as parcelas daquele título
DMRetaguarda.zqConParcelas.Close;
DMRetaguarda.zqConParcelas.SQL.Clear;
DMRetaguarda.zqConParcelas.SQL.Add('SELECT * FROM t707tit WHERE cd_idt_cli = ' +
':pcpfcnpj AND nr_seu like :pnumdoc ORDER BY nr_nos');
DMRetaguarda.zqConParcelas.ParamByname('pcpfcnpj').AsString := DMRetaguarda.zqConTitulos.FieldByName('codcli').AsString;
DMRetaguarda.zqConParcelas.ParamByname('pnumdoc').AsString := edtNumDoc.Text+'%';
DMRetaguarda.zqConParcelas.Open;
The difference between 1 and another one is that there in the first one, I selected the 3/4 part, but in my second DBGrid, it continued in the 1/4 part, how do I match them?