leonardo 2016-03-28 19:59:30 +00:00
parent 38e10c28f9
commit 525d2b0c2e
4 changed files with 19 additions and 5 deletions

View File

@ -20,6 +20,8 @@ import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.zkoss.util.resource.Labels;
import org.zkoss.zhtml.Messagebox;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zul.Datebox; import org.zkoss.zul.Datebox;
@ -57,6 +59,12 @@ public class RelatorioArquivoBGMController extends MyGenericForwardComposer {
} }
public void onClick$btnExecutarRelatorio(Event ev) throws Exception { public void onClick$btnExecutarRelatorio(Event ev) throws Exception {
if (cmbPuntoVenta.getSelectedItem() == null){
Messagebox.show(Labels.getLabel("relatorioArquivoBGMController.msg.erro.puntoventa"),
Labels.getLabel("relatorioArquivoBGMController.window.title"),
Messagebox.OK, Messagebox.INFORMATION);
return;
}
executarRelatorio(); executarRelatorio();
} }
@ -72,6 +80,10 @@ public class RelatorioArquivoBGMController extends MyGenericForwardComposer {
cal.setTime(datInicial.getValue()); cal.setTime(datInicial.getValue());
Calendar calFinal = Calendar.getInstance(); Calendar calFinal = Calendar.getInstance();
calFinal.setTime(datFinal.getValue()); calFinal.setTime(datFinal.getValue());
Calendar cf = Calendar.getInstance();
cf.setTime(datFinal.getValue());
cf.add(Calendar.DATE, 1);
// seta dia e mês finais para limite da iteração // seta dia e mês finais para limite da iteração
int diaFinal = calFinal.get(Calendar.DAY_OF_MONTH); int diaFinal = calFinal.get(Calendar.DAY_OF_MONTH);
int mesFinal = calFinal.get(Calendar.MONTH); int mesFinal = calFinal.get(Calendar.MONTH);
@ -79,8 +91,8 @@ public class RelatorioArquivoBGMController extends MyGenericForwardComposer {
try{ try{
con = dataSource.getConnection(); con = dataSource.getConnection();
while (cal.get(Calendar.DAY_OF_MONTH) <= diaFinal && cal.get(Calendar.MONTH) <= mesFinal) { while (cal.before(cf)) {
String fileName = System.getProperty("jboss.server.log.dir") + "/BGM-" + cal.get(Calendar.YEAR) + "" + DespesaReceita.lpad(Integer.toString(cal.get(Calendar.MONTH) + 1), "0", 2) + "" + DespesaReceita.lpad(Integer.toString(cal.get(Calendar.DAY_OF_MONTH)), "0", 2) + ".txt"; String fileName = System.getProperty("jboss.server.log.dir") + File.separator + "BGM-" + cal.get(Calendar.YEAR) + "" + DespesaReceita.lpad(Integer.toString(cal.get(Calendar.MONTH) + 1), "0", 2) + "" + DespesaReceita.lpad(Integer.toString(cal.get(Calendar.DAY_OF_MONTH)), "0", 2) + ".txt";
File file = new File(fileName); File file = new File(fileName);
Totalbus totalbus = new Totalbus(con); Totalbus totalbus = new Totalbus(con);
@ -96,7 +108,7 @@ public class RelatorioArquivoBGMController extends MyGenericForwardComposer {
} }
String fileZip = System.getProperty("jboss.server.log.dir") + "/ArquivosBGM.zip"; String fileZip = System.getProperty("jboss.server.log.dir") + File.separator + "ArquivosBGM.zip";
log.debug("nome arquivo: " + fileZip); log.debug("nome arquivo: " + fileZip);
FileInputStream inputStream; FileInputStream inputStream;

View File

@ -6245,6 +6245,7 @@ relatorioArquivoBGMController.lbDataIni.value = Data Inicial
relatorioArquivoBGMController.lbDataFin.value = Data Final relatorioArquivoBGMController.lbDataFin.value = Data Final
relatorioArquivoBGMController.lbEmpresa.value = Empresa relatorioArquivoBGMController.lbEmpresa.value = Empresa
relatorioArquivoBGMController.lbPuntoVenta.value = Agência relatorioArquivoBGMController.lbPuntoVenta.value = Agência
relatorioArquivoBGMController.msg.erro.puntoventa = O Campo Agência é obrigatório!
# Recebimento Malote # Recebimento Malote
recebimentoMaloteController.window.title = Recebimento Malote recebimentoMaloteController.window.title = Recebimento Malote

View File

@ -6372,6 +6372,7 @@ relatorioArquivoBGMController.lbDataIni.value = Data Inicial
relatorioArquivoBGMController.lbDataFin.value = Data Final relatorioArquivoBGMController.lbDataFin.value = Data Final
relatorioArquivoBGMController.lbEmpresa.value = Empresa relatorioArquivoBGMController.lbEmpresa.value = Empresa
relatorioArquivoBGMController.lbPuntoVenta.value = Agência relatorioArquivoBGMController.lbPuntoVenta.value = Agência
relatorioArquivoBGMController.msg.erro.puntoventa = O Campo Agência é obrigatório!
# Recebimento Malote # Recebimento Malote
recebimentoMaloteController.window.title = Recebimento Malote recebimentoMaloteController.window.title = Recebimento Malote

View File

@ -35,7 +35,7 @@
value="${c:l('relatorioArquivoBGMController.lbEmpresa.value')}" /> value="${c:l('relatorioArquivoBGMController.lbEmpresa.value')}" />
<combobox id="cmbEmpresa" <combobox id="cmbEmpresa"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEmpresa" use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEmpresa"
mold="rounded" buttonVisible="true" mold="rounded" buttonVisible="true" constraint="no empty"
width="70%" /> width="70%" />
</row> </row>
<row> <row>
@ -43,7 +43,7 @@
value="${c:l('relatorioArquivoBGMController.lbPuntoVenta.value')}" /> value="${c:l('relatorioArquivoBGMController.lbPuntoVenta.value')}" />
<combobox id="cmbPuntoVenta" <combobox id="cmbPuntoVenta"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta" use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta"
mold="rounded" buttonVisible="true" mold="rounded" buttonVisible="true" constraint="no empty"
width="70%" /> width="70%" />
</row> </row>
</rows> </rows>