fixes bug#19616
dev: Thiago Veloso qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@102423 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
a4c21c8e0b
commit
dc713f4bb0
|
@ -0,0 +1,15 @@
|
|||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.vo.exportacao.QdmpDerLinhaVo;
|
||||
|
||||
public interface IntegracaoDerPrDAO extends GenericDAO<QdmpDerLinhaVo, Integer> {
|
||||
|
||||
public String buscarDadosImportacaoCabeca(Date inicio, Date fim, Empresa empresa, Integer linhaId);
|
||||
public List<QdmpDerLinhaVo> buscarDadosImportacaoLinha(Date inicio, Date fim, Empresa empresa, Integer linhaId);
|
||||
public String buscarDadosImportacaoRodape(Date inicio, Date fim, Empresa empresa, Integer linhaId);
|
||||
|
||||
}
|
|
@ -15,6 +15,7 @@ import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria;
|
|||
import com.rjconsultores.ventaboletos.entidad.InstiFinanceira;
|
||||
|
||||
@Repository("ptovtaBancoDAO")
|
||||
@SuppressWarnings("unchecked")
|
||||
public class InstiFinanceiraHibernateDAO extends GenericHibernateDAO<InstiFinanceira, Integer>
|
||||
implements InstiFinanceiraDAO {
|
||||
|
||||
|
|
|
@ -0,0 +1,286 @@
|
|||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.SQLQuery;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.type.BigDecimalType;
|
||||
import org.hibernate.type.DateType;
|
||||
import org.hibernate.type.IntegerType;
|
||||
import org.hibernate.type.StringType;
|
||||
import org.hibernate.type.TimestampType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.IntegracaoDerPrDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||
import com.rjconsultores.ventaboletos.vo.exportacao.QdmpDerCabecaVo;
|
||||
import com.rjconsultores.ventaboletos.vo.exportacao.QdmpDerLinhaVo;
|
||||
import com.rjconsultores.ventaboletos.vo.exportacao.QdmpDerRodapeVo;
|
||||
|
||||
@Repository("integracaoDerPrDAO")
|
||||
@SuppressWarnings("unchecked")
|
||||
public class IntegracaoDerPrHibernateDAO extends GenericHibernateDAO<QdmpDerLinhaVo, Integer> implements IntegracaoDerPrDAO {
|
||||
|
||||
@Autowired
|
||||
public IntegracaoDerPrHibernateDAO(
|
||||
@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QdmpDerLinhaVo> buscarDadosImportacaoLinha(Date inicio, Date fim, Empresa empresa, Integer linhaId) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(" SELECT * ");
|
||||
sb.append(" FROM ");
|
||||
sb.append(" ( ");
|
||||
sb.append(" SELECT ");
|
||||
sb.append(" e.codder as codemp, ");
|
||||
sb.append(" r.prefixo as linha, ");
|
||||
sb.append(" rc.codigoderpr as secao, ");
|
||||
sb.append(" count( distinct b.boleto_id) AS bilhete, ");
|
||||
sb.append(" ( CASE ");
|
||||
sb.append(" WHEN r.indsentidoida = 0 THEN ");
|
||||
sb.append(" 'VOLTA' ");
|
||||
sb.append(" ELSE ");
|
||||
sb.append(" 'IDA' ");
|
||||
sb.append(" END ) AS sentido, ");
|
||||
sb.append(" count( distinct CASE ");
|
||||
sb.append(" WHEN (co.tiposervicio_id = 1 ) THEN ");
|
||||
sb.append(" b.boleto_id ");
|
||||
sb.append(" ELSE ");
|
||||
sb.append(" null ");
|
||||
sb.append(" END ) AS ord, ");
|
||||
sb.append(" count( distinct CASE ");
|
||||
sb.append(" WHEN ((b.origen_id = co.origen_id and b.destino_id = co.destino_id) and co.tiposervicio_id = 2 ) THEN ");
|
||||
sb.append(" b.boleto_id ");
|
||||
sb.append(" ELSE ");
|
||||
sb.append(" null ");
|
||||
sb.append(" END ) AS rft, ");
|
||||
sb.append(" count( distinct CASE ");
|
||||
sb.append(" WHEN ((b.origen_id <> co.origen_id or b.destino_id <> co.destino_id) and co.tiposervicio_id = 2 ) THEN ");
|
||||
sb.append(" b.boleto_id ");
|
||||
sb.append(" ELSE ");
|
||||
sb.append(" null ");
|
||||
sb.append(" END ) AS rfp, ");
|
||||
sb.append(" count( distinct CASE ");
|
||||
sb.append(" WHEN ((b.origen_id <> co.origen_id or b.destino_id <> co.destino_id) and co.tiposervicio_id = 2 ) THEN ");
|
||||
sb.append(" b.corrida_id ");
|
||||
sb.append(" ELSE ");
|
||||
sb.append(" null ");
|
||||
sb.append(" END ) AS viagRfp ");
|
||||
|
||||
preencheFrom(sb);
|
||||
preencheWhere(linhaId, sb);
|
||||
|
||||
sb.append(" GROUP BY ");
|
||||
sb.append(" r.prefixo, ");
|
||||
sb.append(" e.codder, ");
|
||||
sb.append(" rc.codigoderpr, ");
|
||||
sb.append(" r.indsentidoida ");
|
||||
sb.append(" ) PIVOT ( ");
|
||||
sb.append(" sum ( bilhete ) tot, sum( ord) ord, sum( rft ) rft, sum(rfp) rfp ");
|
||||
sb.append(" FOR sentido IN ( 'IDA', 'VOLTA' ) ");
|
||||
sb.append(" ) ");
|
||||
sb.append(" ORDER BY ");
|
||||
sb.append(" linha, secao ");
|
||||
|
||||
SQLQuery qry = getSession().createSQLQuery(sb.toString())
|
||||
.addScalar("codemp", IntegerType.INSTANCE)
|
||||
.addScalar("linha", StringType.INSTANCE)
|
||||
.addScalar("secao", StringType.INSTANCE)
|
||||
.addScalar("'IDA'_TOT", IntegerType.INSTANCE)
|
||||
.addScalar("'VOLTA'_TOT", IntegerType.INSTANCE)
|
||||
.addScalar("'IDA'_ORD", IntegerType.INSTANCE)
|
||||
.addScalar("'VOLTA'_ORD", IntegerType.INSTANCE)
|
||||
.addScalar("'IDA'_RFT", IntegerType.INSTANCE)
|
||||
.addScalar("'VOLTA'_RFT", IntegerType.INSTANCE)
|
||||
.addScalar("'IDA'_RFP", IntegerType.INSTANCE)
|
||||
.addScalar("'VOLTA'_RFP", IntegerType.INSTANCE)
|
||||
.addScalar("viagRfp", IntegerType.INSTANCE);
|
||||
|
||||
qry.setParameter("EMPRESA_ID", empresa.getEmpresaId(), IntegerType.INSTANCE);
|
||||
qry.setParameter("DATA_INICIAL", DateUtil.inicioFecha(inicio), DateType.INSTANCE);
|
||||
qry.setParameter("DATA_FINAL", DateUtil.inicioFecha(fim), DateType.INSTANCE);
|
||||
|
||||
List<QdmpDerLinhaVo> retorno = new ArrayList<QdmpDerLinhaVo>();
|
||||
List<Object[]> dados = qry.list();
|
||||
|
||||
for (Object[] object : dados) {
|
||||
QdmpDerLinhaVo vo = new QdmpDerLinhaVo(object);
|
||||
retorno.add(vo);
|
||||
}
|
||||
|
||||
return retorno;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String buscarDadosImportacaoCabeca(Date inicio, Date fim, Empresa empresa, Integer linhaId) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(" SELECT ");
|
||||
sb.append(" e.codder as codemp, ");
|
||||
sb.append(" r.prefixo as linha, ");
|
||||
sb.append(" count(distinct CASE ");
|
||||
sb.append(" WHEN ((b.origen_id = co.origen_id or b.destino_id = co.destino_id) and co.tiposervicio_id = 1 ) THEN ");
|
||||
sb.append(" b.corrida_id+ to_char(b.feccorrida, 'ddMMyyyy') ");
|
||||
sb.append(" ELSE ");
|
||||
sb.append(" null ");
|
||||
sb.append(" END ) AS viagOrd, ");
|
||||
sb.append(" sum(distinct CASE ");
|
||||
sb.append(" WHEN ((b.origen_id = co.origen_id or b.destino_id = co.destino_id) and co.tiposervicio_id = 1 ) THEN ");
|
||||
sb.append(" da.cantasientos ");
|
||||
sb.append(" ELSE ");
|
||||
sb.append(" null ");
|
||||
sb.append(" END ) AS lugOrd, ");
|
||||
sb.append(" count(distinct CASE ");
|
||||
sb.append(" WHEN ((b.origen_id = co.origen_id and b.destino_id = co.destino_id) and co.tiposervicio_id = 2 ) THEN ");
|
||||
sb.append(" b.corrida_id+ to_char(b.feccorrida, 'ddMMyyyy') ");
|
||||
sb.append(" ELSE ");
|
||||
sb.append(" null ");
|
||||
sb.append(" END ) AS viagRft, ");
|
||||
sb.append(" sum(distinct CASE ");
|
||||
sb.append(" WHEN ((b.origen_id = co.origen_id and b.destino_id = co.destino_id) and co.tiposervicio_id = 2 ) THEN ");
|
||||
sb.append(" da.cantasientos ");
|
||||
sb.append(" ELSE ");
|
||||
sb.append(" null ");
|
||||
sb.append(" END ) AS lugRft, ");
|
||||
sb.append(" count(distinct CASE ");
|
||||
sb.append(" WHEN ((b.origen_id <> co.origen_id or b.destino_id <> co.destino_id) and co.tiposervicio_id = 2 ) THEN ");
|
||||
sb.append(" b.corrida_id+ to_char(b.feccorrida, 'ddMMyyyy') ");
|
||||
sb.append(" ELSE ");
|
||||
sb.append(" null ");
|
||||
sb.append(" END ) AS viagRfp, ");
|
||||
sb.append(" sum(distinct CASE ");
|
||||
sb.append(" WHEN ((b.origen_id <> co.origen_id or b.destino_id <> co.destino_id) and co.tiposervicio_id = 2 ) THEN ");
|
||||
sb.append(" da.cantasientos ");
|
||||
sb.append(" ELSE ");
|
||||
sb.append(" null ");
|
||||
sb.append(" END ) AS lugRfp ");
|
||||
|
||||
preencheFrom(sb);
|
||||
preencheWhere(linhaId, sb);
|
||||
|
||||
sb.append(" GROUP BY ");
|
||||
sb.append(" r.prefixo, ");
|
||||
sb.append(" e.codder ");
|
||||
|
||||
SQLQuery qry = getSession().createSQLQuery(sb.toString())
|
||||
.addScalar("codEmp", IntegerType.INSTANCE)
|
||||
.addScalar("linha", StringType.INSTANCE)
|
||||
.addScalar("viagOrd", IntegerType.INSTANCE)
|
||||
.addScalar("lugOrd", IntegerType.INSTANCE)
|
||||
.addScalar("viagRft", IntegerType.INSTANCE)
|
||||
.addScalar("lugRft", IntegerType.INSTANCE)
|
||||
.addScalar("viagRfp", IntegerType.INSTANCE)
|
||||
.addScalar("lugRfp", IntegerType.INSTANCE);
|
||||
|
||||
qry.setParameter("EMPRESA_ID", empresa.getEmpresaId(), IntegerType.INSTANCE);
|
||||
qry.setParameter("DATA_INICIAL", new Timestamp(DateUtil.inicioFecha(inicio).getTime()), TimestampType.INSTANCE);
|
||||
qry.setParameter("DATA_FINAL", new Timestamp(DateUtil.inicioFecha(fim).getTime()), TimestampType.INSTANCE);
|
||||
|
||||
Object[] dados = (Object[])qry.uniqueResult();
|
||||
QdmpDerCabecaVo cabeca = new QdmpDerCabecaVo(dados);
|
||||
|
||||
return cabeca.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String buscarDadosImportacaoRodape(Date inicio, Date fim, Empresa empresa, Integer linhaId) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(" SELECT ");
|
||||
sb.append(" e.codder as codemp, ");
|
||||
sb.append(" r.prefixo as linha, ");
|
||||
sb.append(" count( distinct b.boleto_id) AS totMov, ");
|
||||
sb.append(" sum( b.preciopagado ) AS receita, ");
|
||||
sb.append(" sum((b.preciopagado - (b.preciopagado * coalesce(ei.porcredbaseicms / 100,0))) * est.icms) / 100 AS icms, ");
|
||||
sb.append(" 0 as iasp ");
|
||||
|
||||
preencheFrom(sb);
|
||||
preencheWhere(linhaId, sb);
|
||||
|
||||
sb.append(" GROUP BY ");
|
||||
sb.append(" r.prefixo, ");
|
||||
sb.append(" e.codder ");
|
||||
|
||||
SQLQuery qry = getSession().createSQLQuery(sb.toString())
|
||||
.addScalar("codEmp", IntegerType.INSTANCE)
|
||||
.addScalar("linha", StringType.INSTANCE)
|
||||
.addScalar("totMov", IntegerType.INSTANCE)
|
||||
.addScalar("receita", BigDecimalType.INSTANCE)
|
||||
.addScalar("icms", BigDecimalType.INSTANCE)
|
||||
.addScalar("iasp", BigDecimalType.INSTANCE);
|
||||
|
||||
qry.setParameter("EMPRESA_ID", empresa.getEmpresaId(), IntegerType.INSTANCE);
|
||||
qry.setParameter("DATA_INICIAL", new Timestamp(DateUtil.inicioFecha(inicio).getTime()), TimestampType.INSTANCE);
|
||||
qry.setParameter("DATA_FINAL", new Timestamp(DateUtil.inicioFecha(fim).getTime()), TimestampType.INSTANCE);
|
||||
|
||||
Object[] dados = (Object[])qry.uniqueResult();
|
||||
QdmpDerRodapeVo rodape = new QdmpDerRodapeVo(dados);
|
||||
|
||||
return rodape.toString();
|
||||
}
|
||||
|
||||
private void preencheFrom(StringBuilder sb) {
|
||||
sb.append(" FROM ");
|
||||
sb.append(" boleto b ");
|
||||
sb.append(" INNER JOIN corrida co ");
|
||||
sb.append(" ON b.corrida_id = co.corrida_id ");
|
||||
sb.append(" AND b.feccorrida = co.feccorrida ");
|
||||
sb.append(" AND co.activo = 1 ");
|
||||
sb.append(" INNER JOIN ruta r ");
|
||||
sb.append(" ON b.ruta_id = r.ruta_id ");
|
||||
sb.append(" AND r.activo = 1 ");
|
||||
sb.append(" INNER JOIN marca m ");
|
||||
sb.append(" ON m.marca_id = b.marca_id ");
|
||||
sb.append(" AND m.activo = 1 ");
|
||||
sb.append(" INNER JOIN empresa e ");
|
||||
sb.append(" ON m.empresa_id = e.empresa_id ");
|
||||
sb.append(" AND e.activo = 1 ");
|
||||
sb.append(" LEFT JOIN rol_operativo ro ");
|
||||
sb.append(" ON ro.roloperativo_id = co.roloperativo_id ");
|
||||
sb.append(" LEFT JOIN diagrama_autobus da ");
|
||||
sb.append(" ON ro.diagramaautobus_id = da.diagramaautobus_id ");
|
||||
sb.append(" LEFT JOIN corrida_tramo ct ");
|
||||
sb.append(" ON b.corrida_id = ct.corrida_id ");
|
||||
sb.append(" AND b.feccorrida = ct.feccorrida ");
|
||||
sb.append(" and b.origen_id = ct.origen_id ");
|
||||
sb.append(" LEFT JOIN ruta_combinacion rc ");
|
||||
sb.append(" on rc.tramo_id = ct.tramo_id ");
|
||||
sb.append(" and rc.ruta_id = b.ruta_id ");
|
||||
sb.append(" and rc.activo = 1 ");
|
||||
sb.append(" inner join parada po ");
|
||||
sb.append(" on po.parada_id = b.origen_id ");
|
||||
sb.append(" and po.activo = 1 ");
|
||||
sb.append(" inner join ciudad ciu ");
|
||||
sb.append(" on ciu.ciudad_id = po.ciudad_id ");
|
||||
sb.append(" and ciu.activo = 1 ");
|
||||
sb.append(" inner join estado est ");
|
||||
sb.append(" on est.estado_id = ciu.estado_id ");
|
||||
sb.append(" and est.activo = 1 ");
|
||||
sb.append(" inner join empresa_imposto ei ");
|
||||
sb.append(" on ei.empresa_id = e.empresa_id ");
|
||||
sb.append(" and ei.estado_id = est.estado_id ");
|
||||
sb.append(" and ei.activo = 1 ");
|
||||
}
|
||||
|
||||
private void preencheWhere(Integer linhaId, StringBuilder sb) {
|
||||
sb.append(" WHERE b.activo = 1 ");
|
||||
sb.append(" and m.empresa_id = :EMPRESA_ID ");
|
||||
sb.append(" and b.feccorrida BETWEEN :DATA_INICIAL AND :DATA_FINAL ");
|
||||
|
||||
if (linhaId != null) {
|
||||
sb.append(" and b.ruta_id = " + linhaId );
|
||||
}
|
||||
|
||||
sb.append(" and b.MOTIVOCANCELACION_ID is null ");
|
||||
sb.append(" and b.INDSTATUSBOLETO = 'V' ");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -54,6 +54,8 @@ public class RutaCombinacion implements Serializable, Cloneable {
|
|||
private Ruta ruta;
|
||||
@Column(name = "INDUSAPRICING")
|
||||
private Boolean indUsaPricing;
|
||||
@Column(name = "CODIGODERPR")
|
||||
private String codigoDerPr;
|
||||
|
||||
public RutaCombinacion() {
|
||||
}
|
||||
|
@ -156,4 +158,12 @@ public class RutaCombinacion implements Serializable, Cloneable {
|
|||
public void setIndUsaPricing(Boolean indUsaPricing) {
|
||||
this.indUsaPricing = indUsaPricing;
|
||||
}
|
||||
|
||||
public String getCodigoDerPr() {
|
||||
return codigoDerPr;
|
||||
}
|
||||
|
||||
public void setCodigoDerPr(String codigoDerPr) {
|
||||
this.codigoDerPr = codigoDerPr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||
|
||||
public interface IntegracaoService {
|
||||
|
||||
public File importacaoQdmpDer(Date inicio, Date fim, Empresa empresa, List<Ruta> lslinhas);
|
||||
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package com.rjconsultores.ventaboletos.service.impl;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.rjconsultores.ventaboletos.constantes.Constantes;
|
||||
import com.rjconsultores.ventaboletos.dao.IntegracaoDerPrDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||
import com.rjconsultores.ventaboletos.service.IntegracaoService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||
import com.rjconsultores.ventaboletos.vo.exportacao.QdmpDerLinhaVo;
|
||||
|
||||
@Service("integracaoService")
|
||||
public class IntegracaoServiceImpl implements IntegracaoService {
|
||||
private static Logger log = Logger.getLogger(IntegracaoServiceImpl.class);
|
||||
|
||||
public static final String DATE_FORMAT_FISCAL = "yyyyMMdd";
|
||||
public static final String QUEBRA_LINHA = "\r\n";
|
||||
|
||||
@Autowired
|
||||
private IntegracaoDerPrDAO integracaoDerPrDAO;
|
||||
|
||||
@Override
|
||||
public File importacaoQdmpDer(Date inicio, Date fim, Empresa empresa, List<Ruta> lslinhas) {
|
||||
try {
|
||||
String nomeArquivo = "QDMP_DER" + DateUtil.getStringDate(Calendar.getInstance().getTime(), "yyyyMMddhhmmss");
|
||||
|
||||
File arquivoQdmp = File.createTempFile(nomeArquivo + "-", ".txt");
|
||||
|
||||
PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(arquivoQdmp), Constantes.UTF_8));
|
||||
|
||||
for (Ruta ruta : lslinhas) {
|
||||
String cabeca = integracaoDerPrDAO.buscarDadosImportacaoCabeca(inicio, fim, empresa, ruta.getRutaId());
|
||||
List<QdmpDerLinhaVo> listaQdmpLinha = integracaoDerPrDAO.buscarDadosImportacaoLinha(inicio, fim, empresa, ruta.getRutaId());
|
||||
String rodape = integracaoDerPrDAO.buscarDadosImportacaoRodape(inicio, fim, empresa, ruta.getRutaId());
|
||||
|
||||
writer.print(cabeca);
|
||||
writer.print(QUEBRA_LINHA);
|
||||
|
||||
for (QdmpDerLinhaVo qdmpDerLinhaVo : listaQdmpLinha) {
|
||||
writer.print(qdmpDerLinhaVo.toString());
|
||||
writer.print(QUEBRA_LINHA);
|
||||
}
|
||||
|
||||
writer.print(rodape);
|
||||
writer.print(QUEBRA_LINHA);
|
||||
}
|
||||
|
||||
writer.close();
|
||||
return arquivoQdmp;
|
||||
|
||||
} catch (IOException e) {
|
||||
log.error( e.getMessage(), e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -80,6 +80,12 @@ public class StringHelper {
|
|||
return preencherStringEsquerda(str, tamanho, "0");
|
||||
}
|
||||
|
||||
public static String preencherZeroEsquerda(Integer val, int tamanho) {
|
||||
String value = val == null ? "" : val.toString();
|
||||
|
||||
return preencherStringEsquerda(value, tamanho, "0");
|
||||
}
|
||||
|
||||
public static String preencherStringDireita(String str, int tamanho, String preenchimento) {
|
||||
if (str != null) {
|
||||
if (str.length() > tamanho) {
|
||||
|
|
|
@ -83,9 +83,9 @@ public class ArchivoIntegracionECF {
|
|||
String filialCliente = StringHelper.preencherStringEsquerda(null, 2, "9");
|
||||
String condicaoPagamento = StringHelper.preencherStringEsquerda(null, 3, "9");
|
||||
|
||||
String valorPIS = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
String valorCofins = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
String valorCSLL = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
String valorPIS = StringHelper.preencherZeroEsquerda("", 14);
|
||||
String valorCofins = StringHelper.preencherZeroEsquerda("", 14);
|
||||
String valorCSLL = StringHelper.preencherZeroEsquerda("", 14);
|
||||
|
||||
String coo = StringHelper.preencherStringEspacoDireita(item.getCoo(), 9);
|
||||
|
||||
|
@ -279,16 +279,16 @@ public class ArchivoIntegracionECF {
|
|||
|
||||
}
|
||||
if (StringUtils.isBlank(aliquota))
|
||||
aliquota = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
aliquota = StringHelper.preencherZeroEsquerda("", 14);
|
||||
|
||||
if (StringUtils.isBlank(imposto))
|
||||
imposto = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
imposto = StringHelper.preencherZeroEsquerda("", 14);
|
||||
|
||||
if (StringUtils.isBlank(totalICMSIsento))
|
||||
totalICMSIsento = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
totalICMSIsento = StringHelper.preencherZeroEsquerda("", 14);
|
||||
|
||||
if (StringUtils.isBlank(totalICMSNaotributado))
|
||||
totalICMSNaotributado = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
totalICMSNaotributado = StringHelper.preencherZeroEsquerda("", 14);
|
||||
|
||||
resp.put("aliquota", aliquota);
|
||||
resp.put("imposto", imposto);
|
||||
|
@ -360,10 +360,10 @@ public class ArchivoIntegracionECF {
|
|||
}
|
||||
|
||||
String valorTotal = valorUnitario;
|
||||
String aliquotaItem = StringHelper.preencherZeroEsquerda(null, 7);
|
||||
String impostoItem = StringHelper.preencherZeroEsquerda(null, 15);
|
||||
String totalICMSIsentoItem = StringHelper.preencherZeroEsquerda(null, 15);
|
||||
String totalICMSNaotributadoItem = StringHelper.preencherZeroEsquerda(null, 15);
|
||||
String aliquotaItem = StringHelper.preencherZeroEsquerda("", 7);
|
||||
String impostoItem = StringHelper.preencherZeroEsquerda("", 15);
|
||||
String totalICMSIsentoItem = StringHelper.preencherZeroEsquerda("", 15);
|
||||
String totalICMSNaotributadoItem = StringHelper.preencherZeroEsquerda("", 15);
|
||||
|
||||
HashMap<String, BigDecimal> aliquotaItens = new HashMap<String, BigDecimal>(0);
|
||||
|
||||
|
@ -415,18 +415,18 @@ public class ArchivoIntegracionECF {
|
|||
|
||||
impostoItem = UtiliteriasFiscal.formataZeroDecimal(valorImposto, 15);
|
||||
aliquotaItem = UtiliteriasFiscal.formataZeroDecimal(null, 7);
|
||||
totalICMSNaotributadoItem = StringHelper.preencherZeroEsquerda(null, 15);
|
||||
totalICMSNaotributadoItem = StringHelper.preencherZeroEsquerda("", 15);
|
||||
}
|
||||
}
|
||||
|
||||
String aliquotaPIS = StringHelper.preencherZeroEsquerda(null, 7);
|
||||
String valorPIS = StringHelper.preencherZeroEsquerda(null, 15);
|
||||
String aliquotaCofins = StringHelper.preencherZeroEsquerda(null, 7);
|
||||
String valorCofins = StringHelper.preencherZeroEsquerda(null, 15);
|
||||
String aliquotaCSLL = StringHelper.preencherZeroEsquerda(null, 7);
|
||||
String valorCSLL = StringHelper.preencherZeroEsquerda(null, 15);
|
||||
String aliquotaISS = StringHelper.preencherZeroEsquerda(null, 7);
|
||||
String valorISS = StringHelper.preencherZeroEsquerda(null, 15);
|
||||
String aliquotaPIS = StringHelper.preencherZeroEsquerda("", 7);
|
||||
String valorPIS = StringHelper.preencherZeroEsquerda("", 15);
|
||||
String aliquotaCofins = StringHelper.preencherZeroEsquerda("", 7);
|
||||
String valorCofins = StringHelper.preencherZeroEsquerda("", 15);
|
||||
String aliquotaCSLL = StringHelper.preencherZeroEsquerda("", 7);
|
||||
String valorCSLL = StringHelper.preencherZeroEsquerda("", 15);
|
||||
String aliquotaISS = StringHelper.preencherZeroEsquerda("", 7);
|
||||
String valorISS = StringHelper.preencherZeroEsquerda("", 15);
|
||||
|
||||
String numeroPDV = StringHelper.preencherStringEspacoDireita(item.getNumpdv(), 10);
|
||||
String numeroSeriePDV = StringHelper.preencherStringEspacoDireita(item.getNumImpressora(), 20);
|
||||
|
|
|
@ -76,11 +76,11 @@ public class ArchivoIntegracionECFManual {
|
|||
BigDecimal valorImposto = UtiliteriasFiscal.arredondar(baseCalculo.multiply(aliquotaCalc.divide(UtiliteriasFiscal.CEM)));
|
||||
String valorTotalICMS = UtiliteriasFiscal.formataZeroDecimal(valorImposto, 14);
|
||||
|
||||
String valorPIS = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
String valorCofins = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
String valorCSLL = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
String totalICMSIsento = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
String totalICMSNaotributado = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
String valorPIS = StringHelper.preencherZeroEsquerda("", 14);
|
||||
String valorCofins = StringHelper.preencherZeroEsquerda("", 14);
|
||||
String valorCSLL = StringHelper.preencherZeroEsquerda("", 14);
|
||||
String totalICMSIsento = StringHelper.preencherZeroEsquerda("", 14);
|
||||
String totalICMSNaotributado = StringHelper.preencherZeroEsquerda("", 14);
|
||||
|
||||
String origenUf = StringHelper.preencherStringEspacoEsquerda(imf.getOrigenUf(), 2);
|
||||
String origen = imf.getOrigenId().toString();
|
||||
|
@ -184,8 +184,8 @@ public class ArchivoIntegracionECFManual {
|
|||
|
||||
String aliquotaItem = UtiliteriasFiscal.formataZeroDecimal(null, 7);
|
||||
String impostoItem = UtiliteriasFiscal.formataZeroDecimal(null, 15);
|
||||
String totalICMSIsentoItem = StringHelper.preencherZeroEsquerda(null, 15);
|
||||
String totalICMSNaotributadoItem = StringHelper.preencherZeroEsquerda(null, 15);
|
||||
String totalICMSIsentoItem = StringHelper.preencherZeroEsquerda("", 15);
|
||||
String totalICMSNaotributadoItem = StringHelper.preencherZeroEsquerda("", 15);
|
||||
|
||||
if (codProduto.indexOf("TA") >= 0) {
|
||||
BigDecimal aliquotaCalc = UtiliteriasFiscal.arredondar(imf.getIcms() == null ? BigDecimal.ZERO : imf.getIcms());
|
||||
|
@ -196,14 +196,14 @@ public class ArchivoIntegracionECFManual {
|
|||
totalICMSNaotributadoItem = StringHelper.preencherZeroEsquerda(valorTotal, 15);
|
||||
}
|
||||
|
||||
String aliquotaPIS = StringHelper.preencherZeroEsquerda(null, 7);
|
||||
String valorPIS = StringHelper.preencherZeroEsquerda(null, 15);
|
||||
String aliquotaCofins = StringHelper.preencherZeroEsquerda(null, 7);
|
||||
String valorCofins = StringHelper.preencherZeroEsquerda(null, 15);
|
||||
String aliquotaCSLL = StringHelper.preencherZeroEsquerda(null, 7);
|
||||
String valorCSLL = StringHelper.preencherZeroEsquerda(null, 15);
|
||||
String aliquotaISS = StringHelper.preencherZeroEsquerda(null, 7);
|
||||
String valorISS = StringHelper.preencherZeroEsquerda(null, 15);
|
||||
String aliquotaPIS = StringHelper.preencherZeroEsquerda("", 7);
|
||||
String valorPIS = StringHelper.preencherZeroEsquerda("", 15);
|
||||
String aliquotaCofins = StringHelper.preencherZeroEsquerda("", 7);
|
||||
String valorCofins = StringHelper.preencherZeroEsquerda("", 15);
|
||||
String aliquotaCSLL = StringHelper.preencherZeroEsquerda("", 7);
|
||||
String valorCSLL = StringHelper.preencherZeroEsquerda("", 15);
|
||||
String aliquotaISS = StringHelper.preencherZeroEsquerda("", 7);
|
||||
String valorISS = StringHelper.preencherZeroEsquerda("", 15);
|
||||
|
||||
String numeroPDV = StringHelper.preencherStringEspacoDireita(imf.getNumpdv(), 10);
|
||||
String numeroSeriePDV = StringHelper.preencherStringEspacoDireita(imf.getNumImpressora(), 20);
|
||||
|
|
|
@ -71,28 +71,28 @@ public class ArchivoIntegracionReducaoZ {
|
|||
String docFiscalInic = StringHelper.preencherStringEspacoEsquerda(ifrZ.getCooinicial(), 9);
|
||||
String docFiscalFinal = StringHelper.preencherStringEspacoEsquerda(ifrZ.getCoofinal(), 9);
|
||||
|
||||
String valorCancel = StringHelper.preencherZeroEsquerda(null, 8);
|
||||
String valorCancel = StringHelper.preencherZeroEsquerda("", 8);
|
||||
String valorContabil = StringHelper.preencherZeroEsquerda(ifrZ.getVendabrutadiaria().toString(), 14);
|
||||
|
||||
String subtributaria = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
String descontos = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
String isento = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
String subtributaria = StringHelper.preencherZeroEsquerda("", 14);
|
||||
String descontos = StringHelper.preencherZeroEsquerda("", 14);
|
||||
String isento = StringHelper.preencherZeroEsquerda("", 14);
|
||||
|
||||
String valorNaoTributado = ifrZ.getValorNaoTributado() == null ? "" : ifrZ.getValorNaoTributado().toString();
|
||||
String naoTributado = StringHelper.preencherZeroEsquerda(valorNaoTributado, 14);
|
||||
|
||||
String aliquota = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
String aliquota = StringHelper.preencherZeroEsquerda("", 14);
|
||||
if (ifrZ.getAliquota().length() == 7 && ifrZ.getAliquota().substring(2, 3).equals(SituacaoTributaria.TRIBUTADO.getValue())) {
|
||||
aliquota = ifrZ.getAliquota().substring(3, 7);
|
||||
aliquota = StringHelper.preencherZeroEsquerda(aliquota, 14);
|
||||
}
|
||||
|
||||
String aliquota2 = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
String aliquota3 = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
String aliquota4 = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
String aliquota2 = StringHelper.preencherZeroEsquerda("", 14);
|
||||
String aliquota3 = StringHelper.preencherZeroEsquerda("", 14);
|
||||
String aliquota4 = StringHelper.preencherZeroEsquerda("", 14);
|
||||
|
||||
String coo = StringHelper.preencherStringEspacoEsquerda(ifrZ.getCoo(), 6);
|
||||
String outrosRecebimentos = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
String outrosRecebimentos = StringHelper.preencherZeroEsquerda("", 14);
|
||||
|
||||
BigDecimal aliquotaCalc = BigDecimal.valueOf(Double.valueOf(aliquota) / UtiliteriasFiscal.CEM.doubleValue());
|
||||
aliquotaCalc = UtiliteriasFiscal.arredondar(aliquotaCalc);
|
||||
|
|
|
@ -0,0 +1,168 @@
|
|||
package com.rjconsultores.ventaboletos.vo.exportacao;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||
import com.rjconsultores.ventaboletos.utilerias.StringHelper;
|
||||
|
||||
public class QdmpDerCabecaVo {
|
||||
|
||||
private Integer codEmp;
|
||||
private String linha;
|
||||
private String secao;
|
||||
private Integer digVer;
|
||||
private Integer viagOrd;
|
||||
private Integer lugOrd;
|
||||
private Integer viagMul;
|
||||
private Integer lugMul;
|
||||
private Integer viagRft;
|
||||
private Integer lugRft;
|
||||
private Integer viagRfp;
|
||||
private Integer lugRfp;
|
||||
private Integer totViag;
|
||||
private Integer totLug;
|
||||
private Calendar dataHora;
|
||||
private String codOper;
|
||||
|
||||
public QdmpDerCabecaVo(Object[] obj) {
|
||||
this.codEmp = obj[0]==null?0:(Integer)obj[0];
|
||||
this.linha = obj[1]==null?"":(String)obj[1];
|
||||
this.viagOrd = obj[2]==null?0:(Integer)obj[2];
|
||||
this.lugOrd = obj[3]==null?0:(Integer)obj[3];
|
||||
this.viagRft = obj[4]==null?0:(Integer)obj[4];
|
||||
this.lugRft = obj[5]==null?0:(Integer)obj[5];
|
||||
this.viagRfp = obj[6]==null?0:(Integer)obj[6];
|
||||
this.lugRfp = obj[7]==null?0:(Integer)obj[7];
|
||||
this.viagMul = 0;
|
||||
this.lugMul = 0;
|
||||
this.totViag = viagOrd+viagMul+viagRft+viagRfp;
|
||||
this.totLug = lugOrd+lugMul+lugRft+lugRfp;
|
||||
this.secao = "0000";
|
||||
this.digVer = 0;
|
||||
this.codOper = "I";
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder retorno = new StringBuilder();
|
||||
retorno.append("J")
|
||||
.append(codEmp)
|
||||
.append(StringHelper.preencherStringEspacoEsquerda(linha, 10))
|
||||
.append(secao)
|
||||
.append(digVer)
|
||||
.append( StringHelper.preencherZeroEsquerda(viagOrd, 5) )
|
||||
.append( StringHelper.preencherZeroEsquerda(lugOrd, 7) )
|
||||
.append( StringHelper.preencherZeroEsquerda(viagMul, 5) )
|
||||
.append( StringHelper.preencherZeroEsquerda(lugMul, 7) )
|
||||
.append( StringHelper.preencherZeroEsquerda(viagRft, 5) )
|
||||
.append( StringHelper.preencherZeroEsquerda(lugRft, 7) )
|
||||
.append( StringHelper.preencherZeroEsquerda(viagRfp, 5) )
|
||||
.append( StringHelper.preencherZeroEsquerda(lugRfp, 7) )
|
||||
.append( StringHelper.preencherZeroEsquerda(totViag, 6) )
|
||||
.append( StringHelper.preencherZeroEsquerda(totLug, 8) )
|
||||
.append( DateUtil.getStringCurrentDate("yyyyMMddHHmm") )
|
||||
.append(codOper);
|
||||
|
||||
return retorno.toString();
|
||||
}
|
||||
|
||||
public Integer getCodEmp() {
|
||||
return codEmp;
|
||||
}
|
||||
public void setCodEmp(Integer codEmp) {
|
||||
this.codEmp = codEmp;
|
||||
}
|
||||
public String getLinha() {
|
||||
return linha;
|
||||
}
|
||||
public void setLinha(String linha) {
|
||||
this.linha = linha;
|
||||
}
|
||||
public String getSecao() {
|
||||
return secao;
|
||||
}
|
||||
public void setSecao(String secao) {
|
||||
this.secao = secao;
|
||||
}
|
||||
public Integer getDigVer() {
|
||||
return digVer;
|
||||
}
|
||||
public void setDigVer(Integer digVer) {
|
||||
this.digVer = digVer;
|
||||
}
|
||||
public Integer getViagOrd() {
|
||||
return viagOrd;
|
||||
}
|
||||
public void setViagOrd(Integer viagOrd) {
|
||||
this.viagOrd = viagOrd;
|
||||
}
|
||||
public Integer getLugOrd() {
|
||||
return lugOrd;
|
||||
}
|
||||
public void setLugOrd(Integer lugOrd) {
|
||||
this.lugOrd = lugOrd;
|
||||
}
|
||||
public Integer getViagMul() {
|
||||
return viagMul;
|
||||
}
|
||||
public void setViagMul(Integer viagMul) {
|
||||
this.viagMul = viagMul;
|
||||
}
|
||||
public Integer getLugMul() {
|
||||
return lugMul;
|
||||
}
|
||||
public void setLugMul(Integer lugMul) {
|
||||
this.lugMul = lugMul;
|
||||
}
|
||||
public Integer getViagRft() {
|
||||
return viagRft;
|
||||
}
|
||||
public void setViagRft(Integer viagRft) {
|
||||
this.viagRft = viagRft;
|
||||
}
|
||||
public Integer getLugRft() {
|
||||
return lugRft;
|
||||
}
|
||||
public void setLugRft(Integer lugRft) {
|
||||
this.lugRft = lugRft;
|
||||
}
|
||||
public Integer getViagRfp() {
|
||||
return viagRfp;
|
||||
}
|
||||
public void setViagRfp(Integer viagRfp) {
|
||||
this.viagRfp = viagRfp;
|
||||
}
|
||||
public Integer getLugRfp() {
|
||||
return lugRfp;
|
||||
}
|
||||
public void setLugRfp(Integer lugRfp) {
|
||||
this.lugRfp = lugRfp;
|
||||
}
|
||||
public Integer getTotViag() {
|
||||
return totViag;
|
||||
}
|
||||
|
||||
public void setTotViag(Integer totViag) {
|
||||
this.totViag = totViag;
|
||||
}
|
||||
|
||||
public Integer getTotLug() {
|
||||
return totLug;
|
||||
}
|
||||
public void setTotLug(Integer totLug) {
|
||||
this.totLug = totLug;
|
||||
}
|
||||
public Calendar getDataHora() {
|
||||
return dataHora;
|
||||
}
|
||||
public void setDataHora(Calendar dataHora) {
|
||||
this.dataHora = dataHora;
|
||||
}
|
||||
public String getCodOper() {
|
||||
return codOper;
|
||||
}
|
||||
public void setCodOper(String codOper) {
|
||||
this.codOper = codOper;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,173 @@
|
|||
package com.rjconsultores.ventaboletos.vo.exportacao;
|
||||
|
||||
import com.rjconsultores.ventaboletos.utilerias.StringHelper;
|
||||
|
||||
public class QdmpDerLinhaVo {
|
||||
|
||||
private Integer codEmp;
|
||||
private String linha;
|
||||
private String secao;
|
||||
private Integer digVer;
|
||||
private Integer idaOrd;
|
||||
private Integer volOrd;
|
||||
private Integer idaMul;
|
||||
private Integer volMul;
|
||||
private Integer idaRft;
|
||||
private Integer volRft;
|
||||
private Integer idaRfp;
|
||||
private Integer volRfp;
|
||||
private Integer viagRfp;
|
||||
private Integer totMov1;
|
||||
private Integer totMov2;
|
||||
private Integer totMov3;
|
||||
private String codOper;
|
||||
|
||||
public QdmpDerLinhaVo(Object[] obj) {
|
||||
this.codEmp = obj[0]==null?0:(Integer)obj[0];
|
||||
this.linha = obj[1]==null?"":(String)obj[1];
|
||||
this.secao = obj[2]==null?"":(String)obj[2];
|
||||
this.totMov1 = obj[3]==null?0:(Integer)obj[3];
|
||||
this.totMov1 += obj[4]==null?0:(Integer)obj[4];
|
||||
this.idaOrd = obj[5]==null?0:(Integer)obj[5];
|
||||
this.volOrd = obj[6]==null?0:(Integer)obj[6];
|
||||
this.idaRft = obj[7]==null?0:(Integer)obj[7];
|
||||
this.viagRfp = obj[8]==null?0:(Integer)obj[8];
|
||||
this.idaRfp = obj[9]==null?0:(Integer)obj[9];
|
||||
this.volRfp = obj[10]==null?0:(Integer)obj[10];
|
||||
this.viagRfp = obj[11]==null?0:(Integer)obj[11];
|
||||
this.totMov2 = 0;
|
||||
this.totMov3 = 0;
|
||||
this.digVer = 0;
|
||||
this.codOper = "I";
|
||||
|
||||
}
|
||||
|
||||
public Integer getCodEmp() {
|
||||
return codEmp;
|
||||
}
|
||||
public void setCodEmp(Integer codEmp) {
|
||||
this.codEmp = codEmp;
|
||||
}
|
||||
public String getLinha() {
|
||||
return linha;
|
||||
}
|
||||
public void setLinha(String linha) {
|
||||
this.linha = linha;
|
||||
}
|
||||
public String getSecao() {
|
||||
return secao;
|
||||
}
|
||||
public void setSecao(String secao) {
|
||||
this.secao = secao;
|
||||
}
|
||||
public Integer getDigVer() {
|
||||
return digVer;
|
||||
}
|
||||
public void setDigVer(Integer digVer) {
|
||||
this.digVer = digVer;
|
||||
}
|
||||
public Integer getIdaOrd() {
|
||||
return idaOrd;
|
||||
}
|
||||
public void setIdaOrd(Integer idaOrd) {
|
||||
this.idaOrd = idaOrd;
|
||||
}
|
||||
public Integer getVolOrd() {
|
||||
return volOrd;
|
||||
}
|
||||
public void setVolOrd(Integer volOrd) {
|
||||
this.volOrd = volOrd;
|
||||
}
|
||||
public Integer getIdaMul() {
|
||||
return idaMul;
|
||||
}
|
||||
public void setIdaMul(Integer idaMul) {
|
||||
this.idaMul = idaMul;
|
||||
}
|
||||
public Integer getVolMul() {
|
||||
return volMul;
|
||||
}
|
||||
public void setVolMul(Integer volMul) {
|
||||
this.volMul = volMul;
|
||||
}
|
||||
public Integer getIdaRft() {
|
||||
return idaRft;
|
||||
}
|
||||
public void setIdaRft(Integer idaRft) {
|
||||
this.idaRft = idaRft;
|
||||
}
|
||||
public Integer getVolRft() {
|
||||
return volRft;
|
||||
}
|
||||
public void setVolRft(Integer volRft) {
|
||||
this.volRft = volRft;
|
||||
}
|
||||
public Integer getViagRfp() {
|
||||
return viagRfp;
|
||||
}
|
||||
public void setViagRfp(Integer viagRfp) {
|
||||
this.viagRfp = viagRfp;
|
||||
}
|
||||
public Integer getIdaRftPar() {
|
||||
return idaRfp;
|
||||
}
|
||||
public void setIdaRftPar(Integer idaRftPar) {
|
||||
this.idaRfp = idaRftPar;
|
||||
}
|
||||
public Integer getVolRftPar() {
|
||||
return volRfp;
|
||||
}
|
||||
public void setVolRftPar(Integer volRftPar) {
|
||||
this.volRfp = volRftPar;
|
||||
}
|
||||
public Integer getTotMov1() {
|
||||
return totMov1;
|
||||
}
|
||||
public void setTotMov1(Integer totMov1) {
|
||||
this.totMov1 = totMov1;
|
||||
}
|
||||
public Integer getTotMov2() {
|
||||
return totMov2;
|
||||
}
|
||||
public void setTotMov2(Integer totMov2) {
|
||||
this.totMov2 = totMov2;
|
||||
}
|
||||
public Integer getTotMov3() {
|
||||
return totMov3;
|
||||
}
|
||||
public void setTotMov3(Integer totMov3) {
|
||||
this.totMov3 = totMov3;
|
||||
}
|
||||
public String getCodOper() {
|
||||
return codOper;
|
||||
}
|
||||
public void setCodOper(String codOper) {
|
||||
this.codOper = codOper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder retorno = new StringBuilder();
|
||||
retorno.append("P")
|
||||
.append(codEmp)
|
||||
.append(StringHelper.preencherStringEspacoEsquerda(linha, 10))
|
||||
.append(secao)
|
||||
.append(digVer)
|
||||
.append( StringHelper.preencherZeroEsquerda(idaOrd, 6) )
|
||||
.append( StringHelper.preencherZeroEsquerda(volOrd, 6) )
|
||||
.append( StringHelper.preencherZeroEsquerda(idaMul, 6) )
|
||||
.append( StringHelper.preencherZeroEsquerda(volMul, 6) )
|
||||
.append( StringHelper.preencherZeroEsquerda(idaRft, 6) )
|
||||
.append( StringHelper.preencherZeroEsquerda(volRft, 6) )
|
||||
.append( StringHelper.preencherZeroEsquerda(idaRfp, 6) )
|
||||
.append( StringHelper.preencherZeroEsquerda(volRfp, 6) )
|
||||
.append( StringHelper.preencherZeroEsquerda(viagRfp, 5) )
|
||||
.append( StringHelper.preencherZeroEsquerda(totMov1, 7) )
|
||||
.append( StringHelper.preencherZeroEsquerda(totMov2, 7) )
|
||||
.append( StringHelper.preencherZeroEsquerda(totMov3, 7) )
|
||||
.append(codOper);
|
||||
|
||||
return retorno.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
package com.rjconsultores.ventaboletos.vo.exportacao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.rjconsultores.ventaboletos.utilerias.StringHelper;
|
||||
|
||||
public class QdmpDerRodapeVo {
|
||||
|
||||
private Integer codEmp;
|
||||
private String linha;
|
||||
private String secao;
|
||||
private Integer digVer;
|
||||
private Integer totMov1;
|
||||
private Integer totMov2;
|
||||
private Integer totMov3;
|
||||
private BigDecimal receita;
|
||||
private BigDecimal icms;
|
||||
private BigDecimal iasp;
|
||||
private String codOper;
|
||||
|
||||
public QdmpDerRodapeVo(Object[] obj) {
|
||||
this.codEmp = obj[0]==null?0:(Integer)obj[0];
|
||||
this.linha = obj[1]==null?"":(String)obj[1];
|
||||
this.totMov1 = obj[2]==null?0:(Integer)obj[2];
|
||||
this.receita = obj[3]==null?BigDecimal.ZERO:(BigDecimal)obj[3];
|
||||
this.icms = obj[4]==null?BigDecimal.ZERO:(BigDecimal)obj[4];
|
||||
this.iasp = obj[5]==null?BigDecimal.ZERO:(BigDecimal)obj[5];
|
||||
this.secao = "9999";
|
||||
this.totMov2 = 0;
|
||||
this.totMov3 = 0;
|
||||
this.digVer = 9;
|
||||
this.codOper = "I";
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
this.receita= this.receita.setScale(2, BigDecimal.ROUND_CEILING);
|
||||
this.icms = this.icms.setScale(2, BigDecimal.ROUND_CEILING);
|
||||
this.iasp = this.iasp.setScale(2, BigDecimal.ROUND_CEILING);
|
||||
|
||||
StringBuilder retorno = new StringBuilder();
|
||||
retorno.append("P")
|
||||
.append(codEmp)
|
||||
.append(StringHelper.preencherStringEspacoEsquerda(linha, 10))
|
||||
.append(secao)
|
||||
.append(digVer)
|
||||
.append( StringHelper.preencherStringEspacoEsquerda("", 20) )
|
||||
.append( StringHelper.preencherZeroEsquerda(totMov1, 7) )
|
||||
.append( StringHelper.preencherZeroEsquerda(totMov2, 7) )
|
||||
.append( StringHelper.preencherZeroEsquerda(totMov3, 7) )
|
||||
.append( StringHelper.preencherZeroEsquerda(receita.toString().replace(".", ""), 11) )
|
||||
.append( StringHelper.preencherZeroEsquerda(icms.toString().replace(".", ""), 11) )
|
||||
.append( StringHelper.preencherZeroEsquerda(iasp.toString().replace(".", ""), 11) )
|
||||
.append(codOper);
|
||||
|
||||
return retorno.toString();
|
||||
}
|
||||
|
||||
public Integer getCodEmp() {
|
||||
return codEmp;
|
||||
}
|
||||
public void setCodEmp(Integer codEmp) {
|
||||
this.codEmp = codEmp;
|
||||
}
|
||||
public String getLinha() {
|
||||
return linha;
|
||||
}
|
||||
public void setLinha(String linha) {
|
||||
this.linha = linha;
|
||||
}
|
||||
public String getSecao() {
|
||||
return secao;
|
||||
}
|
||||
public void setSecao(String secao) {
|
||||
this.secao = secao;
|
||||
}
|
||||
public Integer getDigVer() {
|
||||
return digVer;
|
||||
}
|
||||
public void setDigVer(Integer digVer) {
|
||||
this.digVer = digVer;
|
||||
}
|
||||
public Integer getTotMov1() {
|
||||
return totMov1;
|
||||
}
|
||||
public void setTotMov1(Integer totMov1) {
|
||||
this.totMov1 = totMov1;
|
||||
}
|
||||
public Integer getTotMov2() {
|
||||
return totMov2;
|
||||
}
|
||||
public void setTotMov2(Integer totMov2) {
|
||||
this.totMov2 = totMov2;
|
||||
}
|
||||
public Integer getTotMov3() {
|
||||
return totMov3;
|
||||
}
|
||||
public void setTotMov3(Integer totMov3) {
|
||||
this.totMov3 = totMov3;
|
||||
}
|
||||
public BigDecimal getReceita() {
|
||||
return receita;
|
||||
}
|
||||
public void setReceita(BigDecimal receita) {
|
||||
this.receita = receita;
|
||||
}
|
||||
public BigDecimal getIcms() {
|
||||
return icms;
|
||||
}
|
||||
public void setIcms(BigDecimal icms) {
|
||||
this.icms = icms;
|
||||
}
|
||||
public BigDecimal getIasp() {
|
||||
return iasp;
|
||||
}
|
||||
public void setIasp(BigDecimal iasp) {
|
||||
this.iasp = iasp;
|
||||
}
|
||||
public String getCodOper() {
|
||||
return codOper;
|
||||
}
|
||||
public void setCodOper(String codOper) {
|
||||
this.codOper = codOper;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue