fixes bug #7375
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@55176 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
d9a67778b6
commit
4c24343ded
|
@ -79,7 +79,8 @@ 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.indstatusboleto = 'V' or 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(" cs.descclase as claseServicio ");
|
||||||
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 ");
|
||||||
|
@ -100,6 +101,7 @@ public class FiscalHibernateDAO extends GenericHibernateDAO<String, String> impl
|
||||||
sql.append(" left join aidf a on a.serie = b.numseriepreimpresa ");
|
sql.append(" left join aidf a on a.serie = b.numseriepreimpresa ");
|
||||||
sql.append(" and eo.estado_id = a.estado_id ");
|
sql.append(" and eo.estado_id = a.estado_id ");
|
||||||
sql.append(" and a.empresa_id = e.empresa_id ");
|
sql.append(" and a.empresa_id = e.empresa_id ");
|
||||||
|
sql.append(" inner join clase_servicio cs ON cs.claseservicio_id = b.claseservicio_id ");
|
||||||
sql.append("WHERE b.fechorventa BETWEEN ? AND ? ");
|
sql.append("WHERE b.fechorventa BETWEEN ? AND ? ");
|
||||||
sql.append(" AND b.marca_id = ? ");
|
sql.append(" AND b.marca_id = ? ");
|
||||||
sql.append(" AND b.tipoventa_id = 3 ");
|
sql.append(" AND b.tipoventa_id = 3 ");
|
||||||
|
@ -135,7 +137,8 @@ public class FiscalHibernateDAO extends GenericHibernateDAO<String, String> impl
|
||||||
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 ");
|
sql.append(" b.indstatusboleto, ");
|
||||||
|
sql.append(" cs.descclase ");
|
||||||
sql.append("ORDER BY dataEmissao, coo, modeloImpressora ");
|
sql.append("ORDER BY dataEmissao, coo, modeloImpressora ");
|
||||||
|
|
||||||
List<ImportacionManualFiscalVO> listManuais = new ArrayList<ImportacionManualFiscalVO>();
|
List<ImportacionManualFiscalVO> listManuais = new ArrayList<ImportacionManualFiscalVO>();
|
||||||
|
@ -184,6 +187,7 @@ public class FiscalHibernateDAO extends GenericHibernateDAO<String, String> impl
|
||||||
item.setImporteseguro(rset.getBigDecimal("importeseguro"));
|
item.setImporteseguro(rset.getBigDecimal("importeseguro"));
|
||||||
item.setSubSerie(rset.getString("subSerie"));
|
item.setSubSerie(rset.getString("subSerie"));
|
||||||
item.setAidf(rset.getString("aidf"));
|
item.setAidf(rset.getString("aidf"));
|
||||||
|
item.setClaseServicio(rset.getString("claseServicio"));
|
||||||
|
|
||||||
listManuais.add(item);
|
listManuais.add(item);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,9 @@ import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalVO;
|
||||||
import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionManualFiscalVO;
|
import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionManualFiscalVO;
|
||||||
import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionNaoFiscalVO;
|
import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionNaoFiscalVO;
|
||||||
import com.rjconsultores.ventaboletos.vo.impressaofiscal.ItemFiscalVO;
|
import com.rjconsultores.ventaboletos.vo.impressaofiscal.ItemFiscalVO;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.impressaofiscal.LeitorFiscalReducaoZVO;
|
||||||
import com.rjconsultores.ventaboletos.vo.impressaofiscal.LeitorFiscalVO;
|
import com.rjconsultores.ventaboletos.vo.impressaofiscal.LeitorFiscalVO;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.impressaofiscal.LeitorManualFiscalVO;
|
||||||
import com.rjconsultores.ventaboletos.vo.impressaofiscal.SiglaMotivoCancelacion;
|
import com.rjconsultores.ventaboletos.vo.impressaofiscal.SiglaMotivoCancelacion;
|
||||||
import com.rjconsultores.ventaboletos.vo.impressaofiscal.SituacaoTributaria;
|
import com.rjconsultores.ventaboletos.vo.impressaofiscal.SituacaoTributaria;
|
||||||
import com.rjconsultores.ventaboletos.vo.impressaofiscal.SubItens;
|
import com.rjconsultores.ventaboletos.vo.impressaofiscal.SubItens;
|
||||||
|
@ -927,6 +929,7 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
header.append(valorMulta == null ? "" : valorMulta);
|
header.append(valorMulta == null ? "" : valorMulta);
|
||||||
header.append(brancos);
|
header.append(brancos);
|
||||||
header.replace(226, 256, claseServicio);
|
header.replace(226, 256, claseServicio);
|
||||||
|
|
||||||
header.append(sequencial);
|
header.append(sequencial);
|
||||||
|
|
||||||
return header.toString();
|
return header.toString();
|
||||||
|
@ -1006,14 +1009,164 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File importacionFiscalReducaoZXls(Empresa empresa, File arquivoTxt) {
|
public File importacionFiscalReducaoZXls(Empresa empresa, File arquivoTxt) {
|
||||||
|
try {
|
||||||
|
List<LeitorFiscalReducaoZVO> registros = carregarRegistrosReducaoZ(empresa, arquivoTxt);
|
||||||
|
return gerarArquivoReducaoZXls(registros, arquivoTxt.getName());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<LeitorFiscalReducaoZVO> carregarRegistrosReducaoZ(Empresa empresa, File arquivoTxt) throws Exception {
|
||||||
|
List<LeitorFiscalReducaoZVO> registros = new ArrayList<LeitorFiscalReducaoZVO>();
|
||||||
|
BufferedReader br = new BufferedReader(new FileReader(arquivoTxt));
|
||||||
|
String linha = br.readLine();
|
||||||
|
while (linha != null) {
|
||||||
|
LeitorFiscalReducaoZVO leitorFiscalReducaoZ = null;
|
||||||
|
int indice = -1;
|
||||||
|
if (linha.startsWith("1")) {
|
||||||
|
leitorFiscalReducaoZ = new LeitorFiscalReducaoZVO();
|
||||||
|
leitorFiscalReducaoZ.setEmpresaId(empresa.getEmpresaId());
|
||||||
|
leitorFiscalReducaoZ.setNombempresa(empresa.getNombempresa());
|
||||||
|
leitorFiscalReducaoZ.setDatamov(linha.substring(1, 9).trim());
|
||||||
|
leitorFiscalReducaoZ.setCnpj(linha.substring(9, 23).trim());
|
||||||
|
leitorFiscalReducaoZ.setAliquota(BigDecimalUtil.getStringToBigDecimal(linha.substring(196, 210).trim(), 2, LocaleUtil.getLocale()));
|
||||||
|
|
||||||
|
if(registros.contains(leitorFiscalReducaoZ)) {
|
||||||
|
indice = registros.indexOf(leitorFiscalReducaoZ);
|
||||||
|
leitorFiscalReducaoZ = registros.get(indice);
|
||||||
|
}
|
||||||
|
|
||||||
|
leitorFiscalReducaoZ.setImposto(leitorFiscalReducaoZ.getImposto().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(272, 285).trim(), 2, LocaleUtil.getLocale())));
|
||||||
|
leitorFiscalReducaoZ.setValorNaoTributado(leitorFiscalReducaoZ.getValorNaoTributado().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(182, 196).trim(), 2, LocaleUtil.getLocale())));
|
||||||
|
leitorFiscalReducaoZ.setVendabrutadiaria(leitorFiscalReducaoZ.getVendabrutadiaria().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(126, 140).trim(), 2, LocaleUtil.getLocale())));
|
||||||
|
|
||||||
|
linha = br.readLine();
|
||||||
|
} else {
|
||||||
|
linha = br.readLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(leitorFiscalReducaoZ != null && indice > -1) {
|
||||||
|
registros.set(indice, leitorFiscalReducaoZ);
|
||||||
|
} else if (leitorFiscalReducaoZ != null) {
|
||||||
|
registros.add(leitorFiscalReducaoZ);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
br.close();
|
||||||
|
|
||||||
|
Collections.sort(registros);
|
||||||
|
|
||||||
|
return registros;
|
||||||
|
}
|
||||||
|
|
||||||
|
private File gerarArquivoReducaoZXls(List<LeitorFiscalReducaoZVO> registros, String nomeArquivo) throws IOException {
|
||||||
|
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||||
|
HSSFSheet firstSheet = workbook.createSheet();
|
||||||
|
|
||||||
|
int linha = 0;
|
||||||
|
|
||||||
|
// Cabecalho
|
||||||
|
HSSFRow row = firstSheet.createRow(linha++);
|
||||||
|
row.createCell(0).setCellValue("DATA_MOVIMENTO");
|
||||||
|
row.createCell(1).setCellValue("EMPRESA");
|
||||||
|
row.createCell(2).setCellValue("CNPJ");
|
||||||
|
row.createCell(3).setCellValue("VENDA_BRUTA_DIARIA");
|
||||||
|
row.createCell(4).setCellValue("VALOR_NAO_TRIBUTADO");
|
||||||
|
row.createCell(5).setCellValue("ALIQUOTA");
|
||||||
|
row.createCell(6).setCellValue("VALOR_ICMS");
|
||||||
|
|
||||||
|
for (LeitorFiscalReducaoZVO leitorFiscal : registros) {
|
||||||
|
row = firstSheet.createRow(linha++);
|
||||||
|
row.createCell(0).setCellValue(leitorFiscal.getDatamov());
|
||||||
|
row.createCell(1).setCellValue(leitorFiscal.getNombempresa());
|
||||||
|
row.createCell(2).setCellValue(leitorFiscal.getCnpj());
|
||||||
|
row.createCell(3).setCellValue(leitorFiscal.getVendabrutadiaria().doubleValue());
|
||||||
|
row.createCell(4).setCellValue(leitorFiscal.getValorNaoTributado().doubleValue());
|
||||||
|
row.createCell(5).setCellValue(leitorFiscal.getAliquota().doubleValue());
|
||||||
|
row.createCell(6).setCellValue(leitorFiscal.getImposto().doubleValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||||
|
workbook.write(bos);
|
||||||
|
|
||||||
|
nomeArquivo = "consolidado_" + nomeArquivo.split("\\.")[0];
|
||||||
|
File arquivo = File.createTempFile(nomeArquivo, ".xls");
|
||||||
|
|
||||||
|
FileOutputStream fos = new FileOutputStream(arquivo);
|
||||||
|
fos.write(bos.toByteArray());
|
||||||
|
fos.close();
|
||||||
|
|
||||||
|
return arquivo;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File importacionFiscalECFManualXls(Empresa empresa, File arquivoTxt) {
|
public File importacionFiscalECFManualXls(Empresa empresa, File arquivoTxt) {
|
||||||
|
try {
|
||||||
|
List<LeitorManualFiscalVO> registros = carregarRegistrosManualFiscal(empresa, arquivoTxt);
|
||||||
|
return gerarArquivoEcfManualXls(registros, arquivoTxt.getName());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private File gerarArquivoEcfManualXls(List<LeitorManualFiscalVO> registros, String nomeArquivo) throws Exception {
|
||||||
|
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||||
|
HSSFSheet firstSheet = workbook.createSheet();
|
||||||
|
|
||||||
|
int linha = 0;
|
||||||
|
|
||||||
|
// Cabecalho
|
||||||
|
HSSFRow row = firstSheet.createRow(linha++);
|
||||||
|
row.createCell(0).setCellValue("DATA_EMISSAO");
|
||||||
|
row.createCell(1).setCellValue("EMPRESA");
|
||||||
|
row.createCell(2).setCellValue("UF_ORIGEM");
|
||||||
|
row.createCell(3).setCellValue("UF_DESTINO");
|
||||||
|
row.createCell(4).setCellValue("CLASSE");
|
||||||
|
row.createCell(5).setCellValue("STATUS");
|
||||||
|
row.createCell(6).setCellValue("TARIFA");
|
||||||
|
row.createCell(7).setCellValue("TX_EMBARQUE");
|
||||||
|
row.createCell(8).setCellValue("PEDAGIO");
|
||||||
|
row.createCell(9).setCellValue("SEGURO");
|
||||||
|
row.createCell(10).setCellValue("TOTAL");
|
||||||
|
row.createCell(11).setCellValue("ALIQUOTA");
|
||||||
|
row.createCell(12).setCellValue("VALOR_ICMS");
|
||||||
|
row.createCell(13).setCellValue("QTDE");
|
||||||
|
|
||||||
|
for (LeitorManualFiscalVO leitorFiscal : registros) {
|
||||||
|
row = firstSheet.createRow(linha++);
|
||||||
|
row.createCell(0).setCellValue(leitorFiscal.getDataEmissao());
|
||||||
|
row.createCell(1).setCellValue(leitorFiscal.getNombempresa());
|
||||||
|
row.createCell(2).setCellValue(leitorFiscal.getOrigenUf());
|
||||||
|
row.createCell(3).setCellValue(leitorFiscal.getDestinoUf());
|
||||||
|
row.createCell(4).setCellValue(leitorFiscal.getClaseServicio());
|
||||||
|
row.createCell(5).setCellValue(leitorFiscal.getStatus());
|
||||||
|
row.createCell(6).setCellValue(leitorFiscal.getValorItem().doubleValue());
|
||||||
|
row.createCell(7).setCellValue(leitorFiscal.getImportetaxaembarque().doubleValue());
|
||||||
|
row.createCell(8).setCellValue(leitorFiscal.getImportepedagio().doubleValue());
|
||||||
|
row.createCell(9).setCellValue(leitorFiscal.getImporteseguro().doubleValue());
|
||||||
|
row.createCell(10).setCellValue(leitorFiscal.getValorTotal().doubleValue());
|
||||||
|
row.createCell(11).setCellValue(leitorFiscal.getIcms().doubleValue());
|
||||||
|
row.createCell(12).setCellValue(leitorFiscal.getValorIcms().doubleValue());
|
||||||
|
row.createCell(13).setCellValue(leitorFiscal.getQtdeItens());
|
||||||
|
}
|
||||||
|
|
||||||
|
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||||
|
workbook.write(bos);
|
||||||
|
|
||||||
|
nomeArquivo = "consolidado_" + nomeArquivo.split("\\.")[0];
|
||||||
|
File arquivo = File.createTempFile(nomeArquivo, ".xls");
|
||||||
|
|
||||||
|
FileOutputStream fos = new FileOutputStream(arquivo);
|
||||||
|
fos.write(bos.toByteArray());
|
||||||
|
fos.close();
|
||||||
|
|
||||||
|
return arquivo;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File importacionNaoFiscalXls(Empresa empresa, File arquivoTxt) {
|
public File importacionNaoFiscalXls(Empresa empresa, File arquivoTxt) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -1026,7 +1179,7 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
|
|
||||||
private File gerarArquivoEcfXlsGenerico(Empresa empresa, File arquivoTxt) {
|
private File gerarArquivoEcfXlsGenerico(Empresa empresa, File arquivoTxt) {
|
||||||
try {
|
try {
|
||||||
List<LeitorFiscalVO> registros = carregarRegistros(empresa, arquivoTxt);
|
List<LeitorFiscalVO> registros = carregarRegistrosEcf(empresa, arquivoTxt);
|
||||||
return gerarArquivoEcfXls(registros, arquivoTxt.getName());
|
return gerarArquivoEcfXls(registros, arquivoTxt.getName());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
|
@ -1091,7 +1244,7 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<LeitorFiscalVO> carregarRegistros(Empresa empresa, File arquivoTxt) throws Exception {
|
private List<LeitorFiscalVO> carregarRegistrosEcf(Empresa empresa, File arquivoTxt) throws Exception {
|
||||||
List<LeitorFiscalVO> registros = new ArrayList<LeitorFiscalVO>();
|
List<LeitorFiscalVO> registros = new ArrayList<LeitorFiscalVO>();
|
||||||
BufferedReader br = new BufferedReader(new FileReader(arquivoTxt));
|
BufferedReader br = new BufferedReader(new FileReader(arquivoTxt));
|
||||||
String linha = br.readLine();
|
String linha = br.readLine();
|
||||||
|
@ -1152,5 +1305,70 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
|
|
||||||
return registros;
|
return registros;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<LeitorManualFiscalVO> carregarRegistrosManualFiscal(Empresa empresa, File arquivoTxt) throws Exception {
|
||||||
|
List<LeitorManualFiscalVO> registros = new ArrayList<LeitorManualFiscalVO>();
|
||||||
|
BufferedReader br = new BufferedReader(new FileReader(arquivoTxt));
|
||||||
|
String linha = br.readLine();
|
||||||
|
while (linha != null) {
|
||||||
|
LeitorManualFiscalVO leitorManualFiscal = null;
|
||||||
|
int indice = -1;
|
||||||
|
if (linha.startsWith("1")) {
|
||||||
|
leitorManualFiscal = new LeitorManualFiscalVO();
|
||||||
|
leitorManualFiscal.setEmpresaId(empresa.getEmpresaId());
|
||||||
|
leitorManualFiscal.setNombempresa(empresa.getNombempresa());
|
||||||
|
leitorManualFiscal.setDataEmissao(linha.substring(1, 9).trim());
|
||||||
|
leitorManualFiscal.setOrigenUf(linha.substring(177, 179).trim());
|
||||||
|
leitorManualFiscal.setDestinoUf(linha.substring(184, 186).trim());
|
||||||
|
leitorManualFiscal.setClaseServicio(linha.substring(226, 256).trim());
|
||||||
|
leitorManualFiscal.setStatus(linha.substring(223, 224).trim());
|
||||||
|
leitorManualFiscal.setIcms(BigDecimalUtil.getStringToBigDecimal(linha.substring(79, 93).trim(), 2, LocaleUtil.getLocale()));
|
||||||
|
|
||||||
|
if(registros.contains(leitorManualFiscal)) {
|
||||||
|
indice = registros.indexOf(leitorManualFiscal);
|
||||||
|
leitorManualFiscal = registros.get(indice);
|
||||||
|
}
|
||||||
|
|
||||||
|
leitorManualFiscal.setValorIcms(leitorManualFiscal.getValorIcms().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(93, 107).trim(), 2, LocaleUtil.getLocale())));
|
||||||
|
leitorManualFiscal.setValorTotal(leitorManualFiscal.getValorTotal().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(51, 65).trim(), 2, LocaleUtil.getLocale())));
|
||||||
|
|
||||||
|
leitorManualFiscal.setQtdeItens(leitorManualFiscal.getQtdeItens() + 1);
|
||||||
|
linha = br.readLine();
|
||||||
|
while (linha != null && linha.startsWith("2")) {
|
||||||
|
if (linha.indexOf("TA") >= 0) {
|
||||||
|
leitorManualFiscal.setValorItem(leitorManualFiscal.getValorItem().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(47, 62).trim(), 2, LocaleUtil.getLocale())));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (linha.indexOf("TX") >= 0) {
|
||||||
|
leitorManualFiscal.setImportetaxaembarque(leitorManualFiscal.getImportetaxaembarque().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(47, 62).trim(), 2, LocaleUtil.getLocale())));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (linha.indexOf("PE") >= 0) {
|
||||||
|
leitorManualFiscal.setImportepedagio(leitorManualFiscal.getImportepedagio().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(47, 62).trim(), 2, LocaleUtil.getLocale())));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (linha.indexOf("SE") >= 0) {
|
||||||
|
leitorManualFiscal.setImporteseguro(leitorManualFiscal.getImporteseguro().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(47, 62).trim(), 2, LocaleUtil.getLocale())));
|
||||||
|
}
|
||||||
|
|
||||||
|
linha = br.readLine();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
linha = br.readLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(leitorManualFiscal != null && indice > -1) {
|
||||||
|
registros.set(indice, leitorManualFiscal);
|
||||||
|
} else if (leitorManualFiscal != null) {
|
||||||
|
registros.add(leitorManualFiscal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
br.close();
|
||||||
|
|
||||||
|
Collections.sort(registros);
|
||||||
|
|
||||||
|
return registros;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,149 @@
|
||||||
|
package com.rjconsultores.ventaboletos.vo.impressaofiscal;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class LeitorFiscalReducaoZVO implements Comparable<LeitorFiscalReducaoZVO> {
|
||||||
|
|
||||||
|
private Integer empresaId;
|
||||||
|
private String nombempresa;
|
||||||
|
private String cnpj;
|
||||||
|
private String datamov;
|
||||||
|
private BigDecimal aliquota;
|
||||||
|
private BigDecimal imposto;
|
||||||
|
private BigDecimal valorNaoTributado;
|
||||||
|
private BigDecimal vendabrutadiaria;
|
||||||
|
|
||||||
|
public LeitorFiscalReducaoZVO() {
|
||||||
|
super();
|
||||||
|
setAliquota(BigDecimal.ZERO);
|
||||||
|
setImposto(BigDecimal.ZERO);
|
||||||
|
setValorNaoTributado(BigDecimal.ZERO);
|
||||||
|
setVendabrutadiaria(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(LeitorFiscalReducaoZVO o) {
|
||||||
|
int retorno = getDatamov().compareTo(o.getDatamov());
|
||||||
|
if(retorno == 0) {
|
||||||
|
retorno = getNombempresa().compareTo(o.getNombempresa());
|
||||||
|
}
|
||||||
|
if(retorno == 0) {
|
||||||
|
retorno = getCnpj().compareTo(o.getCnpj());
|
||||||
|
}
|
||||||
|
if(retorno == 0) {
|
||||||
|
retorno = getAliquota().compareTo(o.getAliquota());
|
||||||
|
}
|
||||||
|
return retorno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNombempresa() {
|
||||||
|
return nombempresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNombempresa(String nombempresa) {
|
||||||
|
this.nombempresa = nombempresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((getEmpresaId() == null) ? 0 : getEmpresaId().hashCode());
|
||||||
|
result = prime * result + ((getDatamov() == null) ? 0 : getDatamov().hashCode());
|
||||||
|
result = prime * result + ((getCnpj() == null) ? 0 : getCnpj().hashCode());
|
||||||
|
result = prime * result + ((getAliquota() == null) ? 0 : getAliquota().hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
LeitorFiscalReducaoZVO other = (LeitorFiscalReducaoZVO) obj;
|
||||||
|
if (getEmpresaId() == null) {
|
||||||
|
if (other.getEmpresaId() != null)
|
||||||
|
return false;
|
||||||
|
} else if (!getEmpresaId().equals(other.getEmpresaId()))
|
||||||
|
return false;
|
||||||
|
if (getDatamov() == null) {
|
||||||
|
if (other.getDatamov() != null)
|
||||||
|
return false;
|
||||||
|
} else if (!getDatamov().equals(other.getDatamov()))
|
||||||
|
return false;
|
||||||
|
if (getCnpj() == null) {
|
||||||
|
if (other.getCnpj() != null)
|
||||||
|
return false;
|
||||||
|
} else if (!getCnpj().equals(other.getCnpj()))
|
||||||
|
return false;
|
||||||
|
if (getAliquota() == null) {
|
||||||
|
if (other.getAliquota() != null)
|
||||||
|
return false;
|
||||||
|
} else if (!getAliquota().equals(other.getAliquota()))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getEmpresaId() {
|
||||||
|
return empresaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmpresaId(Integer empresaId) {
|
||||||
|
this.empresaId = empresaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDatamov() {
|
||||||
|
return datamov;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDatamov(String datamov) {
|
||||||
|
this.datamov = datamov;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getAliquota() {
|
||||||
|
return aliquota;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAliquota(BigDecimal aliquota) {
|
||||||
|
this.aliquota = aliquota;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getImposto() {
|
||||||
|
return imposto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImposto(BigDecimal imposto) {
|
||||||
|
this.imposto = imposto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getValorNaoTributado() {
|
||||||
|
return valorNaoTributado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValorNaoTributado(BigDecimal valorNaoTributado) {
|
||||||
|
this.valorNaoTributado = valorNaoTributado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getVendabrutadiaria() {
|
||||||
|
return vendabrutadiaria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVendabrutadiaria(BigDecimal vendabrutadiaria) {
|
||||||
|
this.vendabrutadiaria = vendabrutadiaria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCnpj() {
|
||||||
|
return cnpj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCnpj(String cnpj) {
|
||||||
|
this.cnpj = cnpj;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "LeitorFiscalReducaoZVO [empresaId=" + empresaId + ", nombempresa=" + nombempresa + ", cnpj=" + cnpj + ", datamov=" + datamov + ", aliquota=" + aliquota + ", imposto=" + imposto + ", valorNaoTributado=" + valorNaoTributado + ", vendabrutadiaria=" + vendabrutadiaria + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,7 +1,8 @@
|
||||||
package com.rjconsultores.ventaboletos.vo.impressaofiscal;
|
package com.rjconsultores.ventaboletos.vo.impressaofiscal;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UtileriasFiscal;
|
||||||
|
|
||||||
public class LeitorFiscalVO extends ImportacionFiscalVO implements Comparable<LeitorFiscalVO> {
|
public class LeitorFiscalVO extends ImportacionFiscalVO implements Comparable<LeitorFiscalVO> {
|
||||||
|
|
||||||
|
@ -29,6 +30,9 @@ public class LeitorFiscalVO extends ImportacionFiscalVO implements Comparable<Le
|
||||||
result = prime * result + ((getEmpresaId() == null) ? 0 : getEmpresaId().hashCode());
|
result = prime * result + ((getEmpresaId() == null) ? 0 : getEmpresaId().hashCode());
|
||||||
result = prime * result + ((getOrigenUf() == null) ? 0 : getOrigenUf().hashCode());
|
result = prime * result + ((getOrigenUf() == null) ? 0 : getOrigenUf().hashCode());
|
||||||
result = prime * result + ((getDestinoUf() == null) ? 0 : getDestinoUf().hashCode());
|
result = prime * result + ((getDestinoUf() == null) ? 0 : getDestinoUf().hashCode());
|
||||||
|
result = prime * result + ((getClaseServicio() == null) ? 0 : getClaseServicio().hashCode());
|
||||||
|
result = prime * result + ((getDescmotivocancelamento() == null) ? 0 : getDescmotivocancelamento().hashCode());
|
||||||
|
result = prime * result + ((getAliquota() == null) ? 0 : getAliquota().hashCode());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +139,7 @@ public class LeitorFiscalVO extends ImportacionFiscalVO implements Comparable<Le
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getValorIcms() {
|
public BigDecimal getValorIcms() {
|
||||||
return getValorTarifa().multiply(getAliquota().divide(CEM)).setScale(2, RoundingMode.HALF_UP);
|
return UtileriasFiscal.arredondar(getValorTarifa().multiply(getAliquota().divide(CEM)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,129 @@
|
||||||
|
package com.rjconsultores.ventaboletos.vo.impressaofiscal;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class LeitorManualFiscalVO extends ImportacionManualFiscalVO implements Comparable<LeitorManualFiscalVO> {
|
||||||
|
|
||||||
|
private String nombempresa;
|
||||||
|
private Integer qtdeItens;
|
||||||
|
private BigDecimal valorIcms;
|
||||||
|
|
||||||
|
public LeitorManualFiscalVO() {
|
||||||
|
super();
|
||||||
|
qtdeItens = 0;
|
||||||
|
setImportetaxaembarque(BigDecimal.ZERO);
|
||||||
|
setImporteoutros(BigDecimal.ZERO);
|
||||||
|
setImportepedagio(BigDecimal.ZERO);
|
||||||
|
setImporteseguro(BigDecimal.ZERO);
|
||||||
|
setValorItem(BigDecimal.ZERO);
|
||||||
|
setValorIcms(BigDecimal.ZERO);
|
||||||
|
setValorTotal(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((getDataEmissao() == null) ? 0 : getDataEmissao().hashCode());
|
||||||
|
result = prime * result + ((getEmpresaId() == null) ? 0 : getEmpresaId().hashCode());
|
||||||
|
result = prime * result + ((getOrigenUf() == null) ? 0 : getOrigenUf().hashCode());
|
||||||
|
result = prime * result + ((getDestinoUf() == null) ? 0 : getDestinoUf().hashCode());
|
||||||
|
result = prime * result + ((getClaseServicio() == null) ? 0 : getClaseServicio().hashCode());
|
||||||
|
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
|
||||||
|
result = prime * result + ((getIcms() == null) ? 0 : getIcms().hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (!(obj instanceof LeitorManualFiscalVO))
|
||||||
|
return false;
|
||||||
|
LeitorManualFiscalVO other = (LeitorManualFiscalVO) obj;
|
||||||
|
if (getDataEmissao() == null) {
|
||||||
|
if (other.getDataEmissao() != null)
|
||||||
|
return false;
|
||||||
|
} else if (!getDataEmissao().equals(other.getDataEmissao()))
|
||||||
|
return false;
|
||||||
|
if (getEmpresaId() == null) {
|
||||||
|
if (other.getEmpresaId() != null)
|
||||||
|
return false;
|
||||||
|
} else if (!getEmpresaId().equals(other.getEmpresaId()))
|
||||||
|
return false;
|
||||||
|
if (getOrigenUf() == null) {
|
||||||
|
if (other.getOrigenUf() != null)
|
||||||
|
return false;
|
||||||
|
} else if (!getOrigenUf().equals(other.getOrigenUf()))
|
||||||
|
return false;
|
||||||
|
if (getDestinoUf() == null) {
|
||||||
|
if (other.getDestinoUf() != null)
|
||||||
|
return false;
|
||||||
|
} else if (!getDestinoUf().equals(other.getDestinoUf()))
|
||||||
|
return false;
|
||||||
|
if (getClaseServicio() == null) {
|
||||||
|
if (other.getClaseServicio() != null)
|
||||||
|
return false;
|
||||||
|
} else if (!getClaseServicio().equals(other.getClaseServicio()))
|
||||||
|
return false;
|
||||||
|
if (getStatus() == null) {
|
||||||
|
if (other.getStatus() != null)
|
||||||
|
return false;
|
||||||
|
} else if (!getStatus().equals(other.getStatus()))
|
||||||
|
return false;
|
||||||
|
if (getIcms() == null) {
|
||||||
|
if (other.getIcms() != null)
|
||||||
|
return false;
|
||||||
|
} else if (!getIcms().equals(other.getIcms()))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNombempresa() {
|
||||||
|
return nombempresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNombempresa(String nombempresa) {
|
||||||
|
this.nombempresa = nombempresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getQtdeItens() {
|
||||||
|
return qtdeItens;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQtdeItens(Integer qtdeItens) {
|
||||||
|
this.qtdeItens = qtdeItens;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(LeitorManualFiscalVO o) {
|
||||||
|
int retorno = getDataEmissao().compareTo(o.getDataEmissao());
|
||||||
|
if(retorno == 0) {
|
||||||
|
retorno = getNombempresa().compareTo(o.getNombempresa());
|
||||||
|
}
|
||||||
|
if(retorno == 0) {
|
||||||
|
retorno = getOrigenUf().compareTo(o.getOrigenUf());
|
||||||
|
}
|
||||||
|
if(retorno == 0) {
|
||||||
|
retorno = getDestinoUf().compareTo(o.getDestinoUf());
|
||||||
|
}
|
||||||
|
if(retorno == 0) {
|
||||||
|
retorno = getClaseServicio().compareTo(o.getClaseServicio());
|
||||||
|
}
|
||||||
|
if(retorno == 0) {
|
||||||
|
retorno = getStatus().compareTo(o.getStatus());
|
||||||
|
}
|
||||||
|
return retorno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getValorIcms() {
|
||||||
|
return this.valorIcms;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValorIcms(BigDecimal valorIcms) {
|
||||||
|
this.valorIcms = valorIcms;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue