Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Wilke1

Imprimir relatório com os itens de cada numero de pedido

Recommended Posts

ola pessoal eu tó fazendo assim, mas o relatorio pega todos os itens de varios pedidos, sendo que eu quero que ele imprima somente os pedidos que selecionei numa determinada data , trazendo os itens do numero do pedido e se haver mas pedidos nessa mesma data, trazer os itens eo numero do pedido na proxima pagina. voces entenderam?RLRomaneioConfTransf := TRLRomaneioConfTransf.Create(self); RLRomaneioConfTransf.QueryLojasTitle.close; RLRomaneioConfTransf.QryLojaOrigem.Close; RLRomaneioConfTransf.QueryPrintPedido.Close; RLRomaneioConfTransf.QryReferencia.Close; RLRomaneioConfTransf.QueryPrintPedido.Open; if edit9.Text='' then begin RLRomaneioConfTransf.QueryLojasTitle.ParamByName('CD_LOJA_').Value := QryEntregaPedidoTransf.FieldByName('CD_LOJA_DESTINO').AsString; RLRomaneioConfTransf.QryLojaOrigem.ParamByName('CD_LOJA_').Value := QryEntregaPedidoTransf.FieldByName('CD_LOJA_ORIGEM').AsString; end else RLRomaneioConfTransf.QueryLojasTitle.ParamByName('CD_LOJA_').Value := Edit9.Text; RLRomaneioConfTransf.QryLojaOrigem.ParamByName('CD_LOJA_').Value :=RLRomaneioconftransf.QueryPrintPedido.FieldByName('CD_LOJA_ORIGEM').AsString; RLRomaneioConfTransf.QueryLojasTitle.Open; RLRomaneioConfTransf.QryLojaOrigem.Open; RLRomaneioConfTransf.QueryPrintItem.Close; RLRomaneioConfTransf.QueryPrintItem.SQL.Clear; RLRomaneioConfTransf.QueryPrintItem.SQL.Add('SELECT IP.*,P.NM_PRODUTO, P.QT_POR_EMBALAGEM,PT.DT_PEDIDO_TRANSFERENCIA,'); RLRomaneioConfTransf.QueryPrintItem.SQL.Add('PE.CD_EAN, U.DS_REDUZIDA_UNIDADE,'); RLRomaneioConfTransf.QueryPrintItem.SQL.Add('PL1.CD_PRATELEIRA, tp.ds_prateleira, ed.ds_rua'); RLRomaneioConfTransf.QueryPrintItem.SQL.Add('FROM TB_UNIDADE U, TB_PRODUTO P,'); RLRomaneioConfTransf.QueryPrintItem.SQL.Add('TB_PEDIDO_TRANSFERENCIA PT,TB_ITEM_PEDIDO_TRANSFERENCIA IP,'); RLRomaneioConfTransf.QueryPrintItem.SQL.Add('TB_PRODUTO_EAN PE,tb_pro_end_prateleira tp,tb_produto_endereco ed,TB_PRODUTO_LOJA PL1'); RLRomaneioConfTransf.QueryPrintItem.SQL.Add('WHERE PE.CD_PRODUTO(+) = IP.CD_PRODUTO AND IP.FL_SITUACAO = ''T'' AND'); if EDIT2.Text <>'' then RLRomaneioConfTransf.QueryPrintItem.SQL.Add('IP.NU_PEDIDO_TRANSFERENCIA='+''''+EDIT2.Text+''' AND'); RLRomaneioConfTransf.QueryPrintItem.SQL.Add('IP.NU_PEDIDO_TRANSFERENCIA=PT.NU_PEDIDO_TRANSFERENCIA AND'); RLRomaneioConfTransf.QueryPrintItem.SQL.Add('P.CD_PRODUTO = IP.CD_PRODUTO AND'); if edit9.Text <>'' then RLRomaneioConfTransf.QueryPrintItem.SQL.ADD('PT.CD_LOJA_DESTINO='+''''+EDIT9.Text+'''AND'); RLRomaneioConfTransf.QueryPrintItem.SQL.ADD('PT.CD_LOJA_ORIGEM='+''''+EDIT12.Text+'''AND'); if (Maskedit6.Text <> (' / / ')) and (Maskedit7.Text <> (' / / ')) then begin RLRomaneioConfTransf.QueryPrintItem.SQL.Add('PT.DT_PEDIDO_TRANSFERENCIA BETWEEN FN_CONV_DATA('+''''+MASKEDIT6.Text+''')AND FN_CONV_DATA('+''''+MASKEDIT7.Text+''')AND'); end else RLRomaneioConfTransf.QueryPrintItem.SQL.Add('PT.DT_PEDIDO_TRANSFERENCIA LIKE ''%''AND'); RLRomaneioConfTransf.QueryPrintItem.SQL.Add('U.CD_UNIDADE = IP.CD_UNIDADE and IP.CD_PRODUTO = PL1.CD_PRODUTO AND'); RLRomaneioConfTransf.QueryPrintItem.SQL.Add('IP.CD_LOJA_DESTINO = PL1.CD_LOJA AND tp.cd_prateleira(+) = pl1.cd_prateleira and'); RLRomaneioConfTransf.QueryPrintItem.SQL.Add('IP.CD_PRODUTO = P.CD_PRODUTO AND ed.cd_rua(+) = tp.cd_rua'); RLRomaneioConfTransf.QueryPrintItem.SQL.Add('ORDER BY ed.ds_rua, LPAD(LTRIM(RTRIM(tp.ds_prateleira)),6,''0''), p.nm_produto '); RLRomaneioConfTransf.QueryPrintItem.Open; RLRomaneioconfTransf.QueryPrintItem.DataSource:=RLRomaneioconfTransf.DsPrintPedido; If RLRomaneioconftransf.QueryPrintItem.RecordCount= 0 then begin showmessage('Pedidos com Essas Condições Não Foram Encontrados!,Verifique Novamente.'); RLRomaneioconftransf.Close; end else RLRomaneioConfTransf.Run(RadioGroup.ItemIndex = 0); // RLRomaneioConfTransf.QuickRep1.Preview; RLRomaneioConfTransf.QuickRep.Free;

Compartilhar este post


Link para o post
Compartilhar em outros sites

A forma mais fácil seria usar mestre/detalhe, colocando um detail e sub-detail no relatório, sendo que o sub-detail teria de ser ligado com a tabela detalhe, que neste caso seria a de itens.

Compartilhar este post


Link para o post
Compartilhar em outros sites

A forma mais fácil seria usar mestre/detalhe, colocando um detail e sub-detail no relatório, sendo que o sub-detail teria de ser ligado com a tabela detalhe, que neste caso seria a de itens.

e que na verdade marcio esse relatorio e tipo de romaneio que acompaha anota fiscalpor isso que ele tem que imprimir todos os pedidos que foram selecionados em uma data pra imprimir eu to fazendo assim, usando um while mas eu tó apanhadoRLRomaneioConfTransf := TRLRomaneioConfTransf.Create(self); RLRomaneioConfTransf.QueryLojasTitle.close; RLRomaneioConfTransf.QryLojaOrigem.Close; RLRomaneioConfTransf.QueryLojasTitle.ParamByName('CD_LOJA_').Value := QryEntregaPedidoTransf.FieldByName('CD_LOJA_DESTINO').AsString; RLRomaneioConfTransf.QryLojaOrigem.ParamByName('CD_LOJA_').Value := QryEntregaPedidoTransf.FieldByName('CD_LOJA_ORIGEM').AsString; RLRomaneioConfTransf.QueryLojasTitle.Open; RLRomaneioConfTransf.QryLojaOrigem.Open; RLRomaneioConfTransf.QueryPrintItem.Close; RLRomaneioConfTransf.QueryPrintPedido.Close; RlRomaneioconftransf.QueryPrintPedido.Open; RLRomaneioConfTransf.QueryPrintPedido.First; while NOT RLRomaneioConfTransf.QueryPrintPedido.Eof do begin RlRomaneioconftransf.QueryPrintPedido.ParamByName('CD_LOJA_ORIGEM').Value:= Edit12.Text; RlRomaneioconftransf.QueryPrintPedido.ParamByName('CD_LOJA_DESTINO').Value:= Edit9.Text; RlRomaneioconftransf.QueryPrintPedido.ParamByName('DT_PEDIDO_TRANSFERENCIA').AsString:= MaskEdit6.Text; RlRomaneioconftransf.QueryPrintPedido.ParamByName('DT_SAIDA').AsString:= MaskEdit7.Text; RLRomaneioConfTransf.QueryPrintPedido.Next; end; RlRomaneioconftransf.QueryPrintPedido.RecordCount; RLRomaneioConfTransf.QueryPrintItem.Open; RLRomaneioConfTransf.QueryPrintItem.RecordCount; RLRomaneioConfTransf.QryReferencia.Close; RLRomaneioConfTransf.Run(RadioGroup.ItemIndex = 0);

Compartilhar este post


Link para o post
Compartilhar em outros sites

A forma mais fácil seria usar mestre/detalhe, colocando um detail e sub-detail no relatório, sendo que o sub-detail teria de ser ligado com a tabela detalhe, que neste caso seria a de itens.

e que na verdade marcio esse relatorio e tipo de romaneio que acompaha anota fiscalpor isso que ele tem que imprimir todos os pedidos que foram selecionados em uma data pra imprimir eu to fazendo assim, usando um while mas eu tó apanhadoRLRomaneioConfTransf := TRLRomaneioConfTransf.Create(self); RLRomaneioConfTransf.QueryLojasTitle.close; RLRomaneioConfTransf.QryLojaOrigem.Close; RLRomaneioConfTransf.QueryLojasTitle.ParamByName('CD_LOJA_').Value := QryEntregaPedidoTransf.FieldByName('CD_LOJA_DESTINO').AsString; RLRomaneioConfTransf.QryLojaOrigem.ParamByName('CD_LOJA_').Value := QryEntregaPedidoTransf.FieldByName('CD_LOJA_ORIGEM').AsString; RLRomaneioConfTransf.QueryLojasTitle.Open; RLRomaneioConfTransf.QryLojaOrigem.Open; RLRomaneioConfTransf.QueryPrintItem.Close; RLRomaneioConfTransf.QueryPrintPedido.Close; RlRomaneioconftransf.QueryPrintPedido.Open; RLRomaneioConfTransf.QueryPrintPedido.First; while NOT RLRomaneioConfTransf.QueryPrintPedido.Eof do begin RlRomaneioconftransf.QueryPrintPedido.ParamByName('CD_LOJA_ORIGEM').Value:= Edit12.Text; RlRomaneioconftransf.QueryPrintPedido.ParamByName('CD_LOJA_DESTINO').Value:= Edit9.Text; RlRomaneioconftransf.QueryPrintPedido.ParamByName('DT_PEDIDO_TRANSFERENCIA').AsString:= MaskEdit6.Text; RlRomaneioconftransf.QueryPrintPedido.ParamByName('DT_SAIDA').AsString:= MaskEdit7.Text; RLRomaneioConfTransf.QueryPrintPedido.Next; end; RlRomaneioconftransf.QueryPrintPedido.RecordCount; RLRomaneioConfTransf.QueryPrintItem.Open; RLRomaneioConfTransf.QueryPrintItem.RecordCount; RLRomaneioConfTransf.QryReferencia.Close; RLRomaneioConfTransf.Run(RadioGroup.ItemIndex = 0);
Resolvidoeu fiz asimpessoal e deu certoaté mas valeu pela ajuda de voces QryPedidoPrint.Close; QryPedidoPrint.SQL.Clear; QryPedidoPrint.SQL.add('SELECT PT. * FROM TB_PEDIDO_TRANSFERENCIA PT'); QrypedidoPrint.sql.Add('WHERE PT.FL_SITUACAO = ''T'' AND'); If (Edit12.Text <> '')and (edit9.Text <>'') then QryPedidoPrint.sql.Add('PT.CD_LOJA_ORIGEM='+''''+Edit12.Text+''' AND'); QryPedidoPrint.SQL.add('PT.CD_LOJA_DESTINO='+''''+Edit9.Text+'''AND'); If (Maskedit6.Text <>(' / / '))and (Maskedit7.Text <>(' / / ')) Then QryPedidoPrint.SQL.add('PT.DT_PEDIDO_TRANSFERENCIA BETWEEN FN_CONV_DATA('+''''+Maskedit6.Text+''') AND FN_CONV_DATA('+''''+Maskedit7.Text+''')'); QryPedidoPrint.SQL.SaveToFile('c:\pedidoprintwilkenovo.txt'); QryPedidoPrint.Open; QryPedidoPrint.First; While not QryPedidoPrint.EOF do Begin RLRomaneioConfTransf := TRLRomaneioConfTransf.Create(self); RLRomaneioConfTransf.QueryLojasTitle.close; RLRomaneioConfTransf.QryLojaOrigem.Close; RLRomaneioConfTransf.QueryLojasTitle.ParamByName('CD_LOJA_').Value := QrypedidoPrint.FieldByName('CD_LOJA_DESTINO').AsString; RLRomaneioConfTransf.QryLojaOrigem.ParamByName('CD_LOJA_').Value := QrypedidoPrint.FieldByName('CD_LOJA_ORIGEM').AsString; RLRomaneioConfTransf.QueryLojasTitle.Open; RLRomaneioConfTransf.QryLojaOrigem.Open; RLRomaneioConfTransf.QueryPrintItem.Close; RLRomaneioConfTransf.QueryPrintPedido.Close; RlRomaneioconfTransf.QueryPrintPedido.ParamByName('NU_PEDIDO_TRANSF').AsString := QryPedidoPrint.FieldByName('NU_PEDIDO_TRANSFERENCIA').AsString; RlRomaneioconftransf.QueryPrintPedido.Open; RLRomaneioConfTransf.QueryPrintItem.Open; RlRomaneioconftransf.QueryPrintPedido.RecordCount; RLRomaneioConfTransf.QueryPrintItem.RecordCount; RLRomaneioConfTransf.QryReferencia.Close; RLRomaneioConfTransf.Run(RadioGroup.ItemIndex = 0);

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.