diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioFinanceiroGrupoLinhas.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioFinanceiroGrupoLinhas.java new file mode 100644 index 000000000..3e0c92351 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioFinanceiroGrupoLinhas.java @@ -0,0 +1,97 @@ +/** + * + */ +package com.rjconsultores.ventaboletos.relatorios.impl; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import com.rjconsultores.ventaboletos.relatorios.utilitarios.ArrayDataSource; +import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; + +/** + * @author Thiago + * + */ +public class RelatorioFinanceiroGrupoLinhas extends RelatorioDemandas { + public RelatorioFinanceiroGrupoLinhas(Map parametros, Connection conexao) throws Exception { + super(parametros, conexao); + this.setCustomDataSource(new ArrayDataSource(this) { + @Override + public void initDados() throws Exception { + SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy"); + Connection conexao = this.relatorio.getConexao(); + Map parametros = this.relatorio.getParametros(); + + Date dataIncial = (Date) parametros.get("DATA_INICIAL"); + + Date dataFinal = (Date) parametros.get("DATA_FINAL"); + + Integer empresa = (Integer) parametros.get("EMPRESA"); + + Integer agencia = (Integer) parametros.get("AGENCIA"); + + Boolean somenteCancelados = (Boolean) parametros.get("SOMENTE_CANCELADOS"); + + StringBuilder where = new StringBuilder(); + where.append(" WHERE 1 = 1 "); + + if (dataIncial != null) { + where.append(" AND caja.fechorventa >= to_date('" + format.format(dataIncial) + "','dd/MM/yyyy') "); + } + + if (dataFinal != null) { + where.append(" AND caja.fechorventa <= to_date('" + format.format(dataFinal) + "','dd/MM/yyyy') "); + } + + if (empresa != null) { + where.append(" AND caja.EMPRESAPUNTOVENTA_ID = " + empresa + " "); + } + + if (agencia != null) { + where.append(" AND pv.PUNTOVENTA_ID = " + agencia + " "); + } + + if (somenteCancelados) { + where.append(" AND caja.MOTIVOCANCELACION_ID is not null "); + } + + StringBuilder sql = new StringBuilder(); + sql.append(" select to_date(caja.FECHORVENTA, 'dd/MM/yyyy') as FECHORVENTA,MC.DESCMOTIVO,pv.NOMBPUNTOVENTA,EMPRESA.NOMBEMPRESA,gr.DESCGRUPO,sum(caja.PRECIOPAGADO) as PRECIOPAGADO "); + sql.append(" from caja join ruta on caja.RUTA_ID = ruta.RUTA_ID "); + sql.append(" join grupo_ruta gr on ruta.GRUPORUTA_ID = gr.GRUPORUTA_ID "); + sql.append(" join PUNTO_VENTA pv on pv.PUNTOVENTA_ID = caja.PUNTOVENTA_ID "); + sql.append(" join MARCA on caja.MARCA_ID = MARCA.MARCA_ID "); + sql.append(" join EMPRESA on EMPRESA.EMPRESA_ID = MARCA.EMPRESA_ID "); + sql.append(" LEFT JOIN MOTIVO_CANCELACION MC ON MC.MOTIVOCANCELACION_ID = caja.MOTIVOCANCELACION_ID "); + sql.append(where); + sql.append(" group by to_date(caja.FECHORVENTA, 'dd/MM/yyyy'),MC.DESCMOTIVO,pv.NOMBPUNTOVENTA,EMPRESA.NOMBEMPRESA,gr.DESCGRUPO "); + sql.append(" order by pv.NOMBPUNTOVENTA, to_date(caja.FECHORVENTA,'dd/MM/yyyy') "); + + NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql.toString()); + + ResultSet rset = stmt.executeQuery(); + + while (rset.next()) { + Map dataResult = new HashMap(); + + dataResult.put("FECHORVENTA", format.format(rset.getDate("FECHORVENTA"))); + dataResult.put("DESCMOTIVO", rset.getString("DESCMOTIVO")); + dataResult.put("NOMBPUNTOVENTA", rset.getString("NOMBPUNTOVENTA")); + dataResult.put("NOMBEMPRESA", rset.getString("NOMBEMPRESA")); + dataResult.put("DESCGRUPO", rset.getString("DESCGRUPO")); + dataResult.put("NOMBEMPRESA", rset.getString("NOMBEMPRESA")); + dataResult.put("PRECIOPAGADO", rset.getDouble("PRECIOPAGADO")); + + this.dados.add(dataResult); + } + + this.resultSet = rset; + } + }); + } +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioFinanceiroGrupoLinhas_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioFinanceiroGrupoLinhas_pt_BR.properties new file mode 100644 index 000000000..4c7dfdb6a --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioFinanceiroGrupoLinhas_pt_BR.properties @@ -0,0 +1 @@ +msg.noData=Năo foi possivel obter dados com os parâmetros informados. \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFinanceiroGrupoLinhas.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFinanceiroGrupoLinhas.jasper new file mode 100644 index 000000000..7f7097aab Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFinanceiroGrupoLinhas.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFinanceiroGrupoLinhas.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFinanceiroGrupoLinhas.jrxml new file mode 100644 index 000000000..c3813f08d --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFinanceiroGrupoLinhas.jrxml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <band height="62" splitType="Stretch"> + <staticText> + <reportElement uuid="7f9cea32-d0e7-4c05-9efc-233cdd5137ab" x="0" y="39" width="66" height="20"/> + <textElement> + <font isBold="true"/> + </textElement> + <text><![CDATA[PERÍODO:]]></text> + </staticText> + <staticText> + <reportElement uuid="367cee8b-2874-4078-b9c4-90285e81ec06" x="0" y="0" width="802" height="20"/> + <textElement textAlignment="Center"> + <font size="14" isBold="true"/> + </textElement> + <text><![CDATA[RelatĂłrio Financeiro por Grupo de Linhas]]></text> + </staticText> + <staticText> + <reportElement uuid="c45a1ecd-8b5e-4bd7-9139-56e0844cea7e" x="127" y="39" width="10" height="20"/> + <textElement> + <font isBold="true"/> + </textElement> + <text><![CDATA[ - ]]></text> + </staticText> + <textField pattern="dd/MM/yyyy"> + <reportElement uuid="07dfa225-148c-4de6-a428-3c91f83c4081" x="67" y="39" width="60" height="20"/> + <textElement/> + <textFieldExpression><![CDATA[$P{DATA_INICIAL}]]></textFieldExpression> + </textField> + <textField pattern="dd/MM/yyyy"> + <reportElement uuid="3948e59f-21d8-47c8-8077-a57af30605c5" x="137" y="39" width="60" height="20"/> + <textElement/> + <textFieldExpression><![CDATA[$P{DATA_FINAL}]]></textFieldExpression> + </textField> + </band> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFormaPagamentoAgencia.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFormaPagamentoAgencia.jasper index 3b8d9ded5..a7e233ea3 100644 Binary files a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFormaPagamentoAgencia.jasper and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFormaPagamentoAgencia.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFormaPagamentoAgencia.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFormaPagamentoAgencia.jrxml index e10313bd5..08a6330f2 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFormaPagamentoAgencia.jrxml +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioFormaPagamentoAgencia.jrxml @@ -1,8 +1,8 @@ - - - + + + @@ -36,9 +36,9 @@ - <band height="102" splitType="Stretch"> + <band height="68" splitType="Stretch"> <staticText> - <reportElement uuid="7f9cea32-d0e7-4c05-9efc-233cdd5137ab" x="1" y="39" width="51" height="20"/> + <reportElement uuid="7f9cea32-d0e7-4c05-9efc-233cdd5137ab" x="1" y="39" width="65" height="20"/> <textElement> <font isBold="true"/> </textElement> @@ -52,91 +52,91 @@ <text><![CDATA[RelatĂłrio de Forma de Pagamento por AgĂȘncia]]></text> </staticText> <staticText> - <reportElement uuid="c45a1ecd-8b5e-4bd7-9139-56e0844cea7e" x="165" y="39" width="10" height="20"/> + <reportElement uuid="c45a1ecd-8b5e-4bd7-9139-56e0844cea7e" x="125" y="39" width="10" height="20"/> <textElement> <font isBold="true"/> </textElement> <text><![CDATA[ - ]]></text> </staticText> <textField pattern="dd/MM/yyyy"> - <reportElement uuid="07dfa225-148c-4de6-a428-3c91f83c4081" x="80" y="39" width="85" height="20"/> + <reportElement uuid="07dfa225-148c-4de6-a428-3c91f83c4081" x="66" y="39" width="59" height="20"/> <textElement/> <textFieldExpression><![CDATA[$P{DATA_INICIAL}]]></textFieldExpression> </textField> <textField pattern="dd/MM/yyyy"> - <reportElement uuid="3948e59f-21d8-47c8-8077-a57af30605c5" x="175" y="39" width="100" height="20"/> + <reportElement uuid="3948e59f-21d8-47c8-8077-a57af30605c5" x="135" y="39" width="63" height="20"/> <textElement/> <textFieldExpression><![CDATA[$P{DATA_FINAL}]]></textFieldExpression> </textField> </band> - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + @@ -149,7 +149,7 @@ - + @@ -159,7 +159,7 @@ - + @@ -190,7 +190,7 @@ - + @@ -198,21 +198,21 @@ - - + + - + - + diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/financeiro/FinanceiroGrupoLinhasController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/financeiro/FinanceiroGrupoLinhasController.java new file mode 100644 index 000000000..0b4f947ed --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/financeiro/FinanceiroGrupoLinhasController.java @@ -0,0 +1,161 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.web.gui.controladores.financeiro; + +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Controller; +import org.zkoss.util.resource.Labels; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zul.Checkbox; +import org.zkoss.zul.Datebox; + +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioFinanceiroGrupoLinhas; +import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioFormaPagamentoAgencia; +import com.rjconsultores.ventaboletos.service.FormaPagamentoAgenciaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar; +import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta; +import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; + +/** + * + * @author Administrador + */ +@Controller("financeiroGrupoLinhasController") +@Scope("prototype") +public class FinanceiroGrupoLinhasController extends MyGenericForwardComposer { + + @Autowired + private FormaPagamentoAgenciaService financeiroService; + + @Autowired + private DataSource dataSourceRead; + + private Datebox fecInicio; + private Datebox fecFinal; + private Checkbox somenteCancelados; + + private MyComboboxEstandar cmbEmpresa; + private List lsEmpresas; + + private MyComboboxPuntoVenta cmbAgencia; + + @Override + public void doAfterCompose(Component comp) throws Exception { + + lsEmpresas = UsuarioLogado.getUsuarioLogado().getEmpresa(); + + super.doAfterCompose(comp); + } + + + public Checkbox getSomenteCancelados() { + return somenteCancelados; + } + + + public void setSomenteCancelados(Checkbox somenteCancelados) { + this.somenteCancelados = somenteCancelados; + } + + + public MyComboboxPuntoVenta getCmbAgencia() { + return cmbAgencia; + } + + + public void setCmbAgencia(MyComboboxPuntoVenta cmbAgencia) { + this.cmbAgencia = cmbAgencia; + } + + + public FormaPagamentoAgenciaService getFinanceiroService() { + return financeiroService; + } + + public void setFinanceiroService(FormaPagamentoAgenciaService financeiroService) { + this.financeiroService = financeiroService; + } + + public DataSource getDataSourceRead() { + return dataSourceRead; + } + + public void setDataSourceRead(DataSource dataSourceRead) { + this.dataSourceRead = dataSourceRead; + } + + public MyComboboxEstandar getCmbEmpresa() { + return cmbEmpresa; + } + + public void setCmbEmpresa(MyComboboxEstandar cmbEmpresa) { + this.cmbEmpresa = cmbEmpresa; + } + + public List getLsEmpresas() { + return lsEmpresas; + } + + public void setLsEmpresas(List lsEmpresas) { + this.lsEmpresas = lsEmpresas; + } + + public Datebox getFecFinal() { + return fecFinal; + } + + public void setFecFinal(Datebox fecFinal) { + this.fecFinal = fecFinal; + } + + public Datebox getFecInicio() { + return fecInicio; + } + + public void setFecInicio(Datebox fecInicio) { + this.fecInicio = fecInicio; + } + + public void onClick$btnInforme(Event e) throws Exception { + Date dataInicio = fecInicio.getValue(); + Date dataFinal = fecFinal.getValue(); + + Map argsInforme = new HashMap(); + argsInforme.put("DATA_INICIAL", dataInicio); + argsInforme.put("DATA_FINAL", dataFinal); + argsInforme.put("SOMENTE_CANCELADOS", somenteCancelados.isChecked()); + + if (cmbEmpresa.isValid() && cmbEmpresa.getSelectedItem() != null) { + Integer empresaId = ((Empresa)cmbEmpresa.getSelectedItem().getValue()).getEmpresaId(); + argsInforme.put("EMPRESA", empresaId); + } + + if (cmbAgencia.getSelectedItem() != null) { + Integer agencia = ((PuntoVenta) cmbAgencia.getSelectedItem().getValue()).getPuntoventaId(); + argsInforme.put("AGENCIA", agencia); + } + + RelatorioFinanceiroGrupoLinhas relatorio = new RelatorioFinanceiroGrupoLinhas(argsInforme, dataSourceRead.getConnection()); + + Map args = new HashMap(); + args.put("relatorio", relatorio); + + openWindow("/component/reportView.zul", + Labels.getLabel("financeiroGrupoLinhasController.window.title"), args, MODAL); + + } +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioFinanceiroGrupoLinhas.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioFinanceiroGrupoLinhas.java new file mode 100644 index 000000000..5204567ac --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioFinanceiroGrupoLinhas.java @@ -0,0 +1,25 @@ +package com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios; + +import org.zkoss.util.resource.Labels; + +import com.rjconsultores.ventaboletos.web.utilerias.PantallaUtileria; +import com.rjconsultores.ventaboletos.web.utilerias.menu.DefaultItemMenuSistema; + +public class ItemMenuRelatorioFinanceiroGrupoLinhas extends DefaultItemMenuSistema { + + public ItemMenuRelatorioFinanceiroGrupoLinhas() { + super("financeiroGrupoLinhasController.mniRelatorioFinanceiro.label"); + } + + @Override + public String getClaveMenu() { + return "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.MENU.RELATORIOFINANCEIROGRUPOLINHASCONTROLLER"; + } + + @Override + public void ejecutar() { + PantallaUtileria.openWindow("/gui/informes/formaPagamentoAgencia/financeiroGrupoLinhas.zul", + Labels.getLabel("financeiroGrupoLinhasController.mniRelatorioFinanceiro.label"), getArgs(), desktop); + } + +} \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/menu_original.properties b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/menu_original.properties index 41c3229b9..05964d445 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/menu_original.properties +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/menu_original.properties @@ -170,7 +170,8 @@ analitico.gerenciais.financeiro.relatorioFinanceiroReceitasDespesas=com.rjconsul analitico.gerenciais.financeiro.relatorioDepositos=com.rjconsultores.ventaboletos.web.utilerias.menu.item.contacorrente.ItemMenuRelatorioDepositos analitico.gerenciais.financeiro.relatorioDepositosDetalhados=com.rjconsultores.ventaboletos.web.utilerias.menu.item.contacorrente.ItemMenuRelatorioDepositosDetalhados analitico.gerenciais.financeiro.relatorioPosicaoCaixaAnalitico=com.rjconsultores.ventaboletos.web.utilerias.menu.item.contacorrente.ItemMenuRelatorioPosicaoCaixaAnalitico -analitico.gerenciais.financeiro.relatorioPosicaoCaixaAnalitico=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioFormaPagamentoAgencia +analitico.gerenciais.financeiro.relatorioFormaPagamentoAgencia=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioFormaPagamentoAgencia +analitico.gerenciais.financeiro.relatorioFinanceiroGrupoLinhas=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioFinanceiroGrupoLinhas analitico.gerenciais.pacote=com.rjconsultores.ventaboletos.web.utilerias.menu.item.analitico.gerenciais.pacote.SubMenuRelatorioPacote analitico.gerenciais.pacote.boletos=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioVendasPacotesBoletos analitico.gerenciais.pacote.detalhado=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioVendasPacotesDetalhado diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index d4fa6667b..364b1e589 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -374,6 +374,15 @@ formaPagamentoAgenciaController.lbDataIni.value = Data InĂ­cio formaPagamentoAgenciaController.lbDataFin.value = Data Fim formaPagamentoAgenciaController.lbEmpresa.value = Empresa +# RelatĂłrio Financeiro por Grupo de Linhas +financeiroGrupoLinhasController.mniRelatorioFinanceiro.label = Financeiro por Grupo de Linhas +financeiroGrupoLinhasController.window.title = Financeiro por Grupo de Linhas +financeiroGrupoLinhasController.lbAgencia.value = AgĂȘncia +financeiroGrupoLinhasController.lbDataIni.value = Data InĂ­cio +financeiroGrupoLinhasController.lbDataFin.value = Data Fim +financeiroGrupoLinhasController.lbEmpresa.value = Empresa +financeiroGrupoLinhasController.label.somenteCancelados = Somente Cancelados + # Muestra a Pesquisa Tipo Classe busquedaClaseServicioController.window.title = Tipo de Classe busquedaClaseServicioController.btnRefresh.tooltiptext = Atualizar