fixes bug #6046
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@41568 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
11cb84601e
commit
a3e3abc8a6
|
@ -2,11 +2,13 @@ package com.rjconsultores.ventaboletos.relatorios.impl;
|
|||
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
@ -57,7 +59,9 @@ public class RelatorioEmpresaOnibus extends Relatorio {
|
|||
|
||||
rset = stmt.executeQuery();
|
||||
|
||||
Map<String, RelatorioEmpresaOnibusBean> mDadosRelatorio = new HashMap<String, RelatorioEmpresaOnibusBean>();
|
||||
// Soma os kms dos tramos.
|
||||
// HashMap utilizado para identificar os tramos de uma corrida
|
||||
Map<String, RelatorioEmpresaOnibusBean> mDadosRelatorio = new LinkedHashMap<String, RelatorioEmpresaOnibusBean>();
|
||||
lsDadosRelatorio = new ArrayList<RelatorioEmpresaOnibusBean>();
|
||||
|
||||
sdf.applyPattern("dd/MM/yyyy");
|
||||
|
@ -93,12 +97,38 @@ public class RelatorioEmpresaOnibus extends Relatorio {
|
|||
lsDadosRelatorio.add(empresaOnibusBean.getValue());
|
||||
}
|
||||
|
||||
|
||||
if (lsDadosRelatorio.size() > 0) {
|
||||
Collections.sort(lsDadosRelatorio,new Comparator<RelatorioEmpresaOnibusBean>() {
|
||||
@Override
|
||||
public int compare(RelatorioEmpresaOnibusBean o1, RelatorioEmpresaOnibusBean o2) {
|
||||
return o1.getEmpresa().compareToIgnoreCase(o2.getEmpresa());
|
||||
int result = o1.getEmpresa().compareToIgnoreCase(o2.getEmpresa());
|
||||
if (result != 0){
|
||||
return result;
|
||||
}
|
||||
|
||||
result = o1.getCoche().compareTo(o2.getCoche());
|
||||
if (result != 0){
|
||||
return result;
|
||||
}
|
||||
|
||||
result = o1.getDia().compareTo(o2.getDia());
|
||||
if (result != 0){
|
||||
return result;
|
||||
}
|
||||
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm");
|
||||
Date h1;
|
||||
Date h2;
|
||||
try {
|
||||
h1 = formatter.parse(o1.getHora());
|
||||
h2 = formatter.parse(o2.getHora());
|
||||
} catch (ParseException e) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
result = h1.compareTo(h2);
|
||||
return result;
|
||||
}
|
||||
});
|
||||
setLsDadosRelatorio(lsDadosRelatorio);
|
||||
|
@ -115,6 +145,7 @@ public class RelatorioEmpresaOnibus extends Relatorio {
|
|||
|
||||
@Override
|
||||
protected void processaParametros() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
private String getSql(String empresa, String autobus) {
|
||||
|
|
Binary file not shown.
|
@ -2,7 +2,7 @@
|
|||
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="RelatorioEmpresaCorrida" pageWidth="595" pageHeight="842" whenNoDataType="NoDataSection" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" resourceBundle="RelatorioEmpresaCorrida" whenResourceMissingType="Empty" uuid="94834362-0ecc-46da-b0a2-5cdee355da3e">
|
||||
<property name="ireport.zoom" value="1.5"/>
|
||||
<property name="ireport.x" value="0"/>
|
||||
<property name="ireport.y" value="21"/>
|
||||
<property name="ireport.y" value="0"/>
|
||||
<parameter name="fecInicio" class="java.lang.String">
|
||||
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
|
||||
</parameter>
|
||||
|
@ -26,6 +26,12 @@
|
|||
<variable name="sum.kmts" class="java.lang.Integer" resetType="Group" resetGroup="empresa" calculation="Sum">
|
||||
<variableExpression><![CDATA[$F{kmts}]]></variableExpression>
|
||||
</variable>
|
||||
<variable name="total.corridas" class="java.lang.Integer" resetType="Group" resetGroup="autobus" calculation="Count">
|
||||
<variableExpression><![CDATA[$F{corridaId}]]></variableExpression>
|
||||
</variable>
|
||||
<variable name="subtotal.kms" class="java.lang.Integer" resetType="Group" resetGroup="autobus" calculation="Sum">
|
||||
<variableExpression><![CDATA[$F{kmts}]]></variableExpression>
|
||||
</variable>
|
||||
<group name="empresa">
|
||||
<groupExpression><![CDATA[$F{empresa}]]></groupExpression>
|
||||
<groupHeader>
|
||||
|
@ -114,6 +120,29 @@
|
|||
</band>
|
||||
</groupFooter>
|
||||
</group>
|
||||
<group name="autobus">
|
||||
<groupExpression><![CDATA[$F{coche}]]></groupExpression>
|
||||
<groupHeader>
|
||||
<band/>
|
||||
</groupHeader>
|
||||
<groupFooter>
|
||||
<band height="22">
|
||||
<textField>
|
||||
<reportElement uuid="ae64a3e5-8360-417b-8fa4-16d5a66c1b96" x="22" y="1" width="166" height="20"/>
|
||||
<textElement/>
|
||||
<textFieldExpression><![CDATA["Total de corridas: " + $V{total.corridas}]]></textFieldExpression>
|
||||
</textField>
|
||||
<line>
|
||||
<reportElement uuid="6a0541e8-fb81-4e9e-a852-8e09b70a1972" x="0" y="0" width="555" height="1"/>
|
||||
</line>
|
||||
<textField>
|
||||
<reportElement uuid="a6bd723a-1106-4eb0-9140-1ecfff33cfc9" x="367" y="1" width="100" height="20"/>
|
||||
<textElement/>
|
||||
<textFieldExpression><![CDATA["Subtotal Kms: " + $V{subtotal.kms}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</groupFooter>
|
||||
</group>
|
||||
<background>
|
||||
<band splitType="Stretch"/>
|
||||
</background>
|
||||
|
|
Loading…
Reference in New Issue