Fórum Impressão de documentos. #529828
26/08/2015
0
Em todo lugar que tenho procurado só tenho visto como imprimir relatórios com registros e em sequencia, tipo, não encontrei nada que diga como selecione um único registro. O que estou precisando é no momento que registro estiver sendo for salvo no banco, ele chame a tela de impressão somente com o registro e as informações que estão sendo armazenadas na quele momento, tenho usado o report builder.
O comando que estou usando é:
ppReport.PrintReport;
Podem me ajudar?
Rodrigo Carlos
Curtir tópico
+ 0Post mais votado
27/08/2015
Valeu mesmo, pela ajuda e a paciência.
Rodrigo Carlos
Gostei + 1
Mais Posts
26/08/2015
Valquiria Silva
O que você quer é imprimir um registro antes de salvar?
Gostei + 0
26/08/2015
Rodrigo Carlos
Necessito que ao clicar no button(Salvar), além de inserir as informações no banco, abra a tela de impressão apenas com o registro que está sendo salvo, ou seja, que ao abrir a tela de impressão, venha apenas o registro salvo.
Gostei + 0
26/08/2015
Raimundo Pereira
1. Grave o registro
2. Na query use um select para retornar o registro selecionado
3. IMP.PREPAREREPORTS();
4. IMP.SHOWREREPORTS();
Gostei + 0
26/08/2015
Rodrigo Carlos
Gostei + 0
26/08/2015
Raimundo Pereira
DBGrid1: TDBGrid; Linkado ao DataSource1 >> LSIT "Somente para visualização dos dados "
ED_NOME: TEdit;
Q_: TADOQuery; >> Usado para realizar o select
CNX: TADOConnection; >> Conexão Principal
BTN_GRAVAR: TButton;
F_REL: TfrxReport;
F_DB: TfrxDBDataset;Linkado Q_: TADOQuery;
LSIT: TADOQuery;
DataSource1: TDataSource;
procedure BTN_GRAVARClick(Sender: TObject);
*****************
Exemplo:
procedure TForm1.BTN_GRAVARClick(Sender: TObject);
begin
if ED_NOME.Text<>'' then
BEGIN
Q_.Close;
Q_.SQL.Text:='SELECT * FROM TS';
Q_.OPEN;
if Q_.Locate('NOME',ED_NOME.Text,[]) then
BEGIN
ShowMessage('Já existe um registro com este nome');
ED_NOME.SetFocus;
ED_NOME.SelectAll;
END
ELSE
BEGIN
Q_.Insert;
Q_.FieldByName('NOME').AsString:=ED_NOME.Text;
Q_.POST;
LSIT.CLOSE;
LSIT.OPEN;
Q_.Close;
Q_.SQL.Text:='SELECT * FROM TS WHERE NOME="'+ED_NOME.Text+'"';
Q_.OPEN;
if Q_.RecordCount=1 then
BEGIN
F_REL.PrepareReport();
F_REL.ShowReport();
END;
END;
END;
end;
Gostei + 0
26/08/2015
Raimundo Pereira
Gostei + 0
27/08/2015
Rodrigo Carlos
Fiz idêntico mais não deu certo.
Gostei + 0
27/08/2015
Rodrigo Carlos
procedure TFrmPrescricao.btnImpressaoClick(Sender: TObject);
begin
FrmImpPresc.qryPrint.SQL.Text:='SELECT * FROM INT_PRESCRICAO WHERE reg="'+edtRegistro.Text+'"';
FrmImpPresc := tFrmImpPresc.Create(Application);
try
FrmImpPresc.QuickRep1.Preview;
finally
FrmImpPresc.Free
end;
end;
end.
Gostei + 0
27/08/2015
Raimundo Pereira
begin
FrmImpPresc.qryPrint.close;
FrmImpPresc.qryPrint.SQL.clear;
FrmImpPresc.qryPrint.SQL.Text:='SELECT * FROM INT_PRESCRICAO WHERE reg="'+edtRegistro.Text+'"';
FrmImpPresc.qryPrint.open;
FrmImpPresc := tFrmImpPresc.Create(Application);
try
FrmImpPresc.QuickRep1.Preview;
finally
FrmImpPresc.Free
end;
end;
Gostei + 0
27/08/2015
Rodrigo Carlos
[img]http://arquivo.devmedia.com.br/forum/imagem/444757-20150827-165052.png[/img]
Gostei + 0
27/08/2015
Raimundo Pereira
FrmImpPres é um form ?
Se sim verifique se ele está no auto creat , se estiver retire ele de lah.
-------------------------------------------------------------------------------------------------------
begin
FrmImpPresc := tFrmImpPresc.Create(Application);
try
FrmImpPresc.qryPrint.close;
FrmImpPresc.qryPrint.SQL.clear;
FrmImpPresc.qryPrint.SQL.Text:='SELECT * FROM INT_PRESCRICAO WHERE reg="'+edtRegistro.Text+'"';
FrmImpPresc.qryPrint.open;
FrmImpPresc.QuickRep1.Preview;
finally
FrmImpPresc.Free
end;
end;
Estou baixo o QuickReport, pois uso o FastReports no Delphi XE8, diante mão teste o código acima.
Gostei + 0
27/08/2015
Raimundo Pereira
Vlw
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)