diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioSegundaVia.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioSegundaVia.java index 768c918bd..5d482a6a4 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioSegundaVia.java +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioSegundaVia.java @@ -118,14 +118,15 @@ public class RelatorioSegundaVia extends Relatorio { sql.append("boleto.IMPORTETAXAEMBARQUE AS taxa, "); sql.append("boleto.IMPORTESEGURO AS seguro, "); sql.append("boleto.IMPORTEPEDAGIO AS pedagio, "); - sql.append("boleto.COO AS coo, "); + sql.append("r4.COO AS coo, "); sql.append("boleto.NUMFOLIOPREIMPRESO AS preimpresso, "); sql.append("boleto.NUMSERIEPREIMPRESA AS seriePreImpresso, "); sql.append("boleto.SERIEIMPFISCAL AS serieImpFiscal "); sql.append("FROM BOLETO boleto "); sql.append("INNER JOIN USUARIO usuario ON boleto.USUARIO_ID = usuario.USUARIO_ID "); - + sql.append("inner join fiscal_impressora fi on fi.numserie = boleto.SERIEIMPFISCALORIGINAL "); + sql.append("inner join fiscal_r4 r4 on r4.NUMSERIE20 = fi.NUMSERIE20 and r4.CONTADOR = boleto.CCF "); sql.append("WHERE boleto.INDSEGUNDAVIAIMPRESSA = 1 "); if (dataInicial != null && dataFinal != null) { sql.append(" AND boleto.FECSEGUNDAVIA BETWEEN :dataInicial AND :dataFinal");