isto teria de acontecer na hora em que aperto o botão OK
begin
inherited;
if edBenificiario.Text <> '' then
begin
qryResult.Close;
qryResult.SQL.Clear;
qryResult.SQL.Add(' SELECT clifor.CF_IDVendedor,vendedor.VE_NOME,vendedor.VE_COMISSAO,
notafiscal.NF_NOTA,notafiscal.NF_DMAEMISSAO,notafiscal.NF_DMAEMISSAO,
clifor.CF_NOMEFANTASIA,notafiscal.NF_Valor,notafiscal.NF_IPIBASE');
qryResult.SQL.Add(' FROM clifor, notafiscal, vendedor');
qryResult.SQL.Add(' WHERE notafiscal.NF_TIPOES=' + #39 + ' S '+#39);
if edDataDe.text <> ' / / ' then
qryResult.sql.Add(' AND notafiscal.NF_DMAEMISSAO >= '+ App.DeliData
+ FormatDateTime('MM/DD/YYYY', strToDateTime(edDataDe.text))+ app.DeliData
);
if edDataAte.text <> ' / / ' then
qryResult.sql.Add(' AND notafiscal.NF_DMAEMISSAO <= '+ App.DeliData
+ FormatDateTime('MM/DD/YYYY', strToDateTime(edDataAte.text))+ app.DeliData);
if edBenificiario.Text <> '' then
qryResult.SQL.Add(' AND clifor.CF_IDVendedor='+ #39 +
edBenificiario.Text + #39);
qryResult.SQL.Add(' AND notafiscal.nf_idclifor = clifor.id');
qryResult.SQL.Add(' AND clifor.CF_IDVendedor=vendedor.ID');
qryResult.SQL.Add(' ORDER BY clifor.CF_IDVendedor');
qryResult.Open;
relVendedor := TrelVendedor.create(self);
if edDataDe.text <> ' / / ' then
begin
relVendedor.qrltitulo.Caption :='RELATORIO DE VENDAS POR VENDEDORES POR PERÌODO '+edDataDe.Text+' A '+edDataAte.Text;
relVendedor.Seq := True;
relVendedor.qr.DataSet:=qryresult;
Setlength(RelPadrao.afield,7);
relVendedor.aField[0]:=' vendedor.VE_NOME';
relVendedor.aField[1]:=' notafiscal.NF_NOTA';
relVendedor.aField[2]:=' notafiscal.NF_DMAEMISSAO';
relVendedor.aField[3]:=' notafiscal.NF_DMAEMISSAO';
relVendedor.aField[4]:=' clifor.CF_NOMEFANTASIA';
relVendedor.aField[5]:=' notafiscal.NF_Valor';
relVendedor.aField[6]:=' notafiscal.NF_IPIBASE';
{ with qryresult.fieldByName('VE_NOME') do
begin
displaylabel:='Nome Vendedor';
DisplayWidth:=5;
end;
with qryresult.fieldByName('NF_NOTA') do
begin
displaylabel:='Nº. Nota Fiscal';
DisplayWidth:=10;
end;
with qryresult.fieldByName('NF_DMAEMISSAO') do
begin
displaylabel:='Data Emissão';
DisplayWidth:=10;
end;
with qryresult.fieldByName('NF_DMAEMISSAO') do
begin
displaylabel:='Data Vencimento';
DisplayWidth:=10;
end;
with qryresult.fieldByName('CF_NOMEFANTASIA') do
begin
displaylabel:='Cliente';
DisplayWidth:=40;
end;
with qryresult.fieldByName('NF_Valor') do
begin
displaylabel:='Valor';
DisplayWidth:=15;
end;
with qryresult.fieldByName('NF_IPIBASE') do
begin
displaylabel:='Báse de Calculo';
DisplayWidth:=15;
end; }
end;
relVendedor.qr.PreviewModal;
relVendedor.Free;
end
else
MessageDlg('O Benificiário está em branco não podendo fazer a consulta !!',mtInformation,[mbok],0);
end;
Pergunta
Guilherme014
Tenho esta form
begin inherited; if edBenificiario.Text <> '' then begin qryResult.Close; qryResult.SQL.Clear; qryResult.SQL.Add(' SELECT clifor.CF_IDVendedor,vendedor.VE_NOME,vendedor.VE_COMISSAO, notafiscal.NF_NOTA,notafiscal.NF_DMAEMISSAO,notafiscal.NF_DMAEMISSAO, clifor.CF_NOMEFANTASIA,notafiscal.NF_Valor,notafiscal.NF_IPIBASE'); qryResult.SQL.Add(' FROM clifor, notafiscal, vendedor'); qryResult.SQL.Add(' WHERE notafiscal.NF_TIPOES=' + #39 + ' S '+#39); if edDataDe.text <> ' / / ' then qryResult.sql.Add(' AND notafiscal.NF_DMAEMISSAO >= '+ App.DeliData + FormatDateTime('MM/DD/YYYY', strToDateTime(edDataDe.text))+ app.DeliData ); if edDataAte.text <> ' / / ' then qryResult.sql.Add(' AND notafiscal.NF_DMAEMISSAO <= '+ App.DeliData + FormatDateTime('MM/DD/YYYY', strToDateTime(edDataAte.text))+ app.DeliData); if edBenificiario.Text <> '' then qryResult.SQL.Add(' AND clifor.CF_IDVendedor='+ #39 + edBenificiario.Text + #39); qryResult.SQL.Add(' AND notafiscal.nf_idclifor = clifor.id'); qryResult.SQL.Add(' AND clifor.CF_IDVendedor=vendedor.ID'); qryResult.SQL.Add(' ORDER BY clifor.CF_IDVendedor'); qryResult.Open; relVendedor := TrelVendedor.create(self); if edDataDe.text <> ' / / ' then begin relVendedor.qrltitulo.Caption :='RELATORIO DE VENDAS POR VENDEDORES POR PERÌODO '+edDataDe.Text+' A '+edDataAte.Text; relVendedor.Seq := True; relVendedor.qr.DataSet:=qryresult; Setlength(RelPadrao.afield,7); relVendedor.aField[0]:=' vendedor.VE_NOME'; relVendedor.aField[1]:=' notafiscal.NF_NOTA'; relVendedor.aField[2]:=' notafiscal.NF_DMAEMISSAO'; relVendedor.aField[3]:=' notafiscal.NF_DMAEMISSAO'; relVendedor.aField[4]:=' clifor.CF_NOMEFANTASIA'; relVendedor.aField[5]:=' notafiscal.NF_Valor'; relVendedor.aField[6]:=' notafiscal.NF_IPIBASE'; { with qryresult.fieldByName('VE_NOME') do begin displaylabel:='Nome Vendedor'; DisplayWidth:=5; end; with qryresult.fieldByName('NF_NOTA') do begin displaylabel:='Nº. Nota Fiscal'; DisplayWidth:=10; end; with qryresult.fieldByName('NF_DMAEMISSAO') do begin displaylabel:='Data Emissão'; DisplayWidth:=10; end; with qryresult.fieldByName('NF_DMAEMISSAO') do begin displaylabel:='Data Vencimento'; DisplayWidth:=10; end; with qryresult.fieldByName('CF_NOMEFANTASIA') do begin displaylabel:='Cliente'; DisplayWidth:=40; end; with qryresult.fieldByName('NF_Valor') do begin displaylabel:='Valor'; DisplayWidth:=15; end; with qryresult.fieldByName('NF_IPIBASE') do begin displaylabel:='Báse de Calculo'; DisplayWidth:=15; end; } end; relVendedor.qr.PreviewModal; relVendedor.Free; end else MessageDlg('O Benificiário está em branco não podendo fazer a consulta !!',mtInformation,[mbok],0); end;Teria que sair nesta página que é um formulário.o problema é que não busca nada de jeito nenhum
Link para o comentário
Compartilhar em outros sites
1 resposta a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.