julio 2016-03-02 14:54:13 +00:00
parent dd35b3e6e1
commit 2490c6a074
2 changed files with 15 additions and 3 deletions

View File

@ -75,7 +75,7 @@ public class FiscalHibernateDAO extends GenericHibernateDAO<String, String> impl
sql.append(" end as importeoutros, "); sql.append(" end as importeoutros, ");
sql.append(" case b.importeseguro when 0 then null else b.importeseguro "); sql.append(" case b.importeseguro when 0 then null else b.importeseguro ");
sql.append(" end as importeseguro, "); sql.append(" end as importeseguro, ");
sql.append(" case when b.motivocancelacion_id is null then 'N' else 'C' end status "); sql.append(" case when b.indstatusboleto = 'V' or b.motivocancelacion_id is null THEN 'N' ELSE 'C' END status ");
sql.append("from boleto b "); sql.append("from boleto b ");
sql.append(" left join fiscal_r4 r4 on b.boleto_id = r4.boleto_id "); sql.append(" left join fiscal_r4 r4 on b.boleto_id = r4.boleto_id ");
sql.append(" left outer join fiscal_r5 r5 on r4.numserie20 = r5.numserie20 "); sql.append(" left outer join fiscal_r5 r5 on r4.numserie20 = r5.numserie20 ");
@ -129,7 +129,8 @@ public class FiscalHibernateDAO extends GenericHibernateDAO<String, String> impl
sql.append(" r4.usuario_id, "); sql.append(" r4.usuario_id, ");
sql.append(" eo.cveestado, "); sql.append(" eo.cveestado, ");
sql.append(" ed.cveestado, "); sql.append(" ed.cveestado, ");
sql.append(" b.motivocancelacion_id "); sql.append(" b.motivocancelacion_id, ");
sql.append(" b.indstatusboleto ");
List<ImportacionManualFiscalVO> listManuais = new ArrayList<ImportacionManualFiscalVO>(); List<ImportacionManualFiscalVO> listManuais = new ArrayList<ImportacionManualFiscalVO>();

View File

@ -533,7 +533,7 @@ public class FiscalServiceImpl implements FiscalService {
String coo = StringHelper.preencherStringEspacoDireita(fiscal.getCoo(), 9); String coo = StringHelper.preencherStringEspacoDireita(fiscal.getCoo(), 9);
BigDecimal valorTotal = fiscal.getValorTotal() == null ? BigDecimal.ZERO : fiscal.getValorTotal(); BigDecimal valorTotal = valorTotalItensECF(item);
String valorTotalDocumanto = StringHelper.preencherStringEspacoDireita(valorTotal.toString(), 14); String valorTotalDocumanto = StringHelper.preencherStringEspacoDireita(valorTotal.toString(), 14);
String valorItens = StringHelper.preencherStringEspacoDireita(valorTotal.toString(), 14); String valorItens = StringHelper.preencherStringEspacoDireita(valorTotal.toString(), 14);
@ -614,6 +614,17 @@ public class FiscalServiceImpl implements FiscalService {
return null; return null;
} }
private BigDecimal valorTotalItensECF(ItemFiscalVO item) {
BigDecimal valorTotal = item.getValorTotal() == null ? BigDecimal.ZERO : item.getValorTotal();
if (valorTotal.equals(BigDecimal.ZERO)) {
BigDecimal valorTarifa = item.getValorTarifa() == null ? BigDecimal.ZERO : item.getValorTarifa();
BigDecimal valorPedagio = item.getValorPedagio() == null ? BigDecimal.ZERO : item.getValorPedagio();
BigDecimal valorEmbarque = item.getValorEmbarque() == null ? BigDecimal.ZERO : item.getValorEmbarque();
valorTotal = valorTotal.add(valorTarifa).add(valorPedagio).add(valorEmbarque);
}
return valorTotal;
}
private void grabarHeaderItens(PrintWriter gravarArq, String header, List<String> itensDocs) { private void grabarHeaderItens(PrintWriter gravarArq, String header, List<String> itensDocs) {
gravarArq.print(header + QUEBRA_LINHA); gravarArq.print(header + QUEBRA_LINHA);