rodrigo 2013-08-19 22:08:37 +00:00
parent 0a989a92ad
commit 51394ca702
3 changed files with 70 additions and 44 deletions

View File

@ -183,12 +183,32 @@ public class RelatorioOrigemDestino extends Relatorio {
sql.append(" AND CA.FECCORRIDA BETWEEN to_date('").append(dataDe).append("','dd/mm/yyyy HH24:mi:ss') AND to_date('").append(dataAte).append("','dd/mm/yyyy HH24:mi:ss') ");
sql.append(" AND ca.indreimpresion = 0 ");
sql.append(" AND CA.PRECIOBASE IS NOT NULL ");
sql.append(" AND CO.ACTIVO = 1 ");
if (bilhetesGratuitos) {
sql.append(" AND CA.PRECIOBASE >= 0 ");
} else {
sql.append(" AND CA.PRECIOBASE > 0 ");
}
sql.append(" ) ABSOLUTO_TOTAL_CORRIDA ");
sql.append(" ) ABSOLUTO_TOTAL_CORRIDA, ");
sql.append(" (RESULTADO.KM_TRAMO/SUM(TR.CANTKMREAL))*");
sql.append(" ( SELECT COUNT(*) ");
sql.append(" FROM caja ca ");
sql.append(" INNER JOIN CORRIDA CO ON (CO.CORRIDA_ID = CA.CORRIDA_ID AND CO.FECCORRIDA = CA.FECCORRIDA) ");
sql.append(" WHERE CA.ACTIVO = 1 ");
sql.append(" AND CO.EMPRESACORRIDA_ID IN (").append(empresaIds).append(") ");
sql.append(" AND CA.CORRIDA_ID = RESULTADO.CORRIDA_ID ");
sql.append(" AND CA.FECCORRIDA BETWEEN to_date('").append(dataDe).append("','dd/mm/yyyy HH24:mi:ss') AND to_date('").append(dataAte).append("','dd/mm/yyyy HH24:mi:ss') ");
sql.append(" AND ca.indreimpresion = 0 ");
sql.append(" AND CA.PRECIOBASE IS NOT NULL ");
sql.append(" AND CO.ACTIVO = 1 ");
if (bilhetesGratuitos) {
sql.append(" AND CA.PRECIOBASE >= 0 ");
} else {
sql.append(" AND CA.PRECIOBASE > 0 ");
}
sql.append(" ) EQUIVALENTE_TOTAL_CORRIDA ");
sql.append(" FROM ");
sql.append(" ( ");
sql.append(" SELECT ");

View File

@ -34,6 +34,7 @@
<field name="RECEITA" class="java.math.BigDecimal"/>
<field name="PRECIOBASE" class="java.math.BigDecimal"/>
<field name="ABSOLUTO_TOTAL_CORRIDA" class="java.lang.Integer"/>
<field name="EQUIVALENTE_TOTAL_CORRIDA" class="java.math.BigDecimal"/>
<variable name="RECEITA_1" class="java.math.BigDecimal" resetType="Group" resetGroup="group_corrida_id" calculation="Sum">
<variableExpression><![CDATA[$F{RECEITA}]]></variableExpression>
</variable>
@ -56,7 +57,7 @@
<variableExpression><![CDATA[$F{PRECIOBASE}]]></variableExpression>
</variable>
<variable name="por_equivalente" class="java.math.BigDecimal" resetType="Group" resetGroup="group_corrida_id">
<variableExpression><![CDATA[$V{equivalente}.divide( $V{sum_equivalente}, 2, 2 )]]></variableExpression>
<variableExpression><![CDATA[$V{equivalente}.divide( $F{EQUIVALENTE_TOTAL_CORRIDA}, 2, 2 )]]></variableExpression>
</variable>
<variable name="sum_por_equivalente" class="java.math.BigDecimal" resetType="Group" resetGroup="group_corrida_id" calculation="Sum">
<variableExpression><![CDATA[$V{por_equivalente}]]></variableExpression>
@ -70,9 +71,6 @@
<variable name="CORRIDA_ID_2" class="java.lang.Integer" resetType="Group" resetGroup="group_corrida_id" calculation="Count">
<variableExpression><![CDATA[$F{CORRIDA_ID}]]></variableExpression>
</variable>
<variable name="KM_CORRIDA_1" class="java.math.BigDecimal" resetType="Group" resetGroup="group_corrida_id" calculation="Sum">
<variableExpression><![CDATA[$F{KM_CORRIDA}]]></variableExpression>
</variable>
<variable name="porc_abs" class="java.math.BigDecimal" resetType="Group" resetGroup="group_corrida_id">
<variableExpression><![CDATA[$F{ABSOLUTOS}.divide( new BigDecimal($F{ABSOLUTO_TOTAL_CORRIDA}.toString()), 2,2 )]]></variableExpression>
</variable>
@ -82,6 +80,9 @@
<variable name="sum_porc_abs" class="java.math.BigDecimal" resetType="Group" resetGroup="group_corrida_id" calculation="Sum">
<variableExpression><![CDATA[$V{porc_abs}]]></variableExpression>
</variable>
<variable name="KM_CORRIDA_1" class="java.math.BigDecimal" resetType="Group" resetGroup="group_corrida_id" calculation="Sum">
<variableExpression><![CDATA[$F{KM_CORRIDA}]]></variableExpression>
</variable>
<group name="group_corrida_id">
<groupExpression><![CDATA[$F{CORRIDA_ID}]]></groupExpression>
<groupHeader>
@ -164,45 +165,45 @@
<text><![CDATA[%Equi]]></text>
</staticText>
<staticText>
<reportElement uuid="36aaad04-9c5f-40f3-a75a-b1702c09094f" x="130" y="0" width="74" height="20"/>
<reportElement uuid="36aaad04-9c5f-40f3-a75a-b1702c09094f" x="130" y="0" width="61" height="20"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[Serviço]]></text>
</staticText>
<staticText>
<reportElement uuid="c0095aaf-98df-4c84-a162-73e7f5fd2fa2" x="204" y="0" width="175" height="20"/>
<reportElement uuid="c0095aaf-98df-4c84-a162-73e7f5fd2fa2" x="191" y="0" width="212" height="20"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[Linha]]></text>
</staticText>
<staticText>
<reportElement uuid="c2ca7785-7d17-4ed3-aba1-6dc0324c27ab" x="429" y="0" width="48" height="20"/>
<reportElement uuid="c2ca7785-7d17-4ed3-aba1-6dc0324c27ab" x="453" y="0" width="48" height="20"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[Horário]]></text>
</staticText>
<staticText>
<reportElement uuid="b73636f9-9b1b-4538-9364-6abf618779da" x="477" y="0" width="54" height="20"/>
<reportElement uuid="b73636f9-9b1b-4538-9364-6abf618779da" x="501" y="0" width="54" height="20"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[Tar. Max.]]></text>
</staticText>
<textField>
<reportElement uuid="523ac3ad-3918-41f8-9a59-a89ae6bbc9ca" x="130" y="20" width="74" height="20"/>
<reportElement uuid="523ac3ad-3918-41f8-9a59-a89ae6bbc9ca" x="130" y="20" width="61" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{CORRIDA_ID}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="d4373b5b-172d-44fb-b2aa-5ab7cb02137e" x="204" y="20" width="175" height="20"/>
<reportElement uuid="d4373b5b-172d-44fb-b2aa-5ab7cb02137e" x="191" y="20" width="212" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{DESCRUTA}]]></textFieldExpression>
</textField>
<textField pattern="HH:mm">
<reportElement uuid="933f2533-0f1e-4359-a70b-71f39018068d" x="429" y="19" width="48" height="20"/>
<reportElement uuid="933f2533-0f1e-4359-a70b-71f39018068d" x="453" y="19" width="48" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{FECHORSALIDA}]]></textFieldExpression>
</textField>
@ -228,19 +229,19 @@
<textFieldExpression><![CDATA[$F{NOMBEMPRESA}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="7e4b01fa-7ae7-4e9d-b67e-e215a7cd847f" x="379" y="1" width="50" height="20"/>
<reportElement uuid="7e4b01fa-7ae7-4e9d-b67e-e215a7cd847f" x="403" y="1" width="50" height="20"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[Sentido]]></text>
</staticText>
<textField isBlankWhenNull="true">
<reportElement uuid="a24cf606-d6da-4c49-bbc6-1f4df6d625c9" x="379" y="19" width="50" height="20"/>
<reportElement uuid="a24cf606-d6da-4c49-bbc6-1f4df6d625c9" x="403" y="19" width="50" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{INDSENTIDOIDA}==1?"Ida":$F{INDSENTIDOIDA}==0?"Volta":""]]></textFieldExpression>
</textField>
<textField evaluationTime="Group" evaluationGroup="group_corrida_id">
<reportElement uuid="6b5e70f2-4dea-4f8e-a912-f06af74d8053" x="477" y="20" width="54" height="20"/>
<reportElement uuid="6b5e70f2-4dea-4f8e-a912-f06af74d8053" x="501" y="20" width="54" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$V{PRECIOBASE_1}]]></textFieldExpression>
</textField>
@ -258,35 +259,35 @@
<line>
<reportElement uuid="e9c629c4-15d0-4aee-ae29-082da09a8fb0" x="0" y="0" width="555" height="1"/>
</line>
<textField>
<textField pattern="#,##0.00">
<reportElement uuid="90793b40-e058-4031-995e-fc5c38d2e0f8" x="286" y="1" width="48" height="20"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{sum_rec_abs}]]></textFieldExpression>
</textField>
<textField>
<textField pattern="#,##0.00">
<reportElement uuid="f5b5d4fa-4dd5-4a16-ad32-b401a3a36c08" x="394" y="1" width="69" height="20"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{sum_pax_km}]]></textFieldExpression>
</textField>
<textField>
<textField pattern="#,##0.00">
<reportElement uuid="ae2ce014-7ac9-431e-8200-3954a90b61e8" x="334" y="1" width="60" height="20"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{sum_equivalente}]]></textFieldExpression>
</textField>
<textField>
<textField pattern="#,##0.00">
<reportElement uuid="ae118f4b-99af-4420-9086-f53850abba8b" x="507" y="1" width="48" height="20"/>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{sum_por_equivalente}]]></textFieldExpression>
</textField>
<textField>
<textField pattern="#,##0.00">
<reportElement uuid="186bc0ae-ff2b-404c-ab57-7c9144108e72" x="463" y="1" width="44" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{sum_porc_abs}]]></textFieldExpression>
@ -366,17 +367,12 @@
</textElement>
<text><![CDATA[IAP%:]]></text>
</staticText>
<textField>
<reportElement uuid="bc55a1d6-b93d-45d4-807b-5a953743423e" x="74" y="101" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$V{KM_CORRIDA_1}.multiply(new BigDecimal($V{CORRIDA_ID_2}.toString()))]]></textFieldExpression>
</textField>
<textField pattern="###0.0000">
<textField pattern="#,##0.00">
<reportElement uuid="260d5364-9582-4f45-ae01-94dfd2781677" x="291" y="61" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$V{RECEITA_2}.divide( new BigDecimal($V{KM_CORRIDA_1}.toString()),4,2 )]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{RECEITA_2}.divide( new BigDecimal($F{KM_CORRIDA}.toString()),4,2 )]]></textFieldExpression>
</textField>
<textField>
<textField pattern="#,##0.00">
<reportElement uuid="5756db85-1209-46de-90eb-0097958f8e9c" x="291" y="81" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$V{RECEITA_3}.divide(new BigDecimal($V{CORRIDA_ID_2}.toString()),2,2 )]]></textFieldExpression>
@ -386,19 +382,14 @@
<textElement/>
<textFieldExpression><![CDATA[$V{CORRIDA_ID_2}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="d30da8da-fec1-4806-9405-75285003223a" x="74" y="61" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$V{KM_CORRIDA_1}]]></textFieldExpression>
</textField>
<textField>
<textField pattern="#,##0.00">
<reportElement uuid="1b9f5961-347c-4afe-94a8-8a221be656cb" x="74" y="121" width="100" height="20"/>
<textElement textAlignment="Left">
<font isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$V{sum_pax_km}]]></textFieldExpression>
</textField>
<textField>
<textField pattern="#,##0.00">
<reportElement uuid="baa10eb2-baf4-49ae-83cd-c06104a06d75" x="291" y="101" width="100" height="20"/>
<textElement textAlignment="Left">
<font isBold="false"/>
@ -460,28 +451,28 @@
<textElement/>
<textFieldExpression><![CDATA[$F{localidade}]]></textFieldExpression>
</textField>
<textField>
<textField pattern="#,##0.00">
<reportElement uuid="06fc754c-d01f-4a92-bd76-7e900d93a69a" x="140" y="0" width="74" height="20" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$P{corrida_id_relatorio}.equals(new BigDecimal($F{corridaId}.toString()))]]></printWhenExpression>
</reportElement>
<textElement/>
<textFieldExpression><![CDATA[$F{receitaSaida}]]></textFieldExpression>
</textField>
<textField>
<textField pattern="#,##0.00">
<reportElement uuid="ceb27078-6808-4d71-882d-c22332c3e5a3" x="214" y="0" width="74" height="20" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$P{corrida_id_relatorio}.equals(new BigDecimal($F{corridaId}.toString()))]]></printWhenExpression>
</reportElement>
<textElement/>
<textFieldExpression><![CDATA[$F{receitaChegada}]]></textFieldExpression>
</textField>
<textField>
<textField pattern="#,##0.00">
<reportElement uuid="d75fc1b6-95f3-453a-8d09-40e9bc7959b8" x="288" y="0" width="74" height="20" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$P{corrida_id_relatorio}.equals(new BigDecimal($F{corridaId}.toString()))]]></printWhenExpression>
</reportElement>
<textElement/>
<textFieldExpression><![CDATA[$F{soma}]]></textFieldExpression>
</textField>
<textField>
<textField pattern="#,##0.00">
<reportElement uuid="fd0a475e-2147-498c-8363-04a4af4031c4" x="362" y="0" width="74" height="20" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$P{corrida_id_relatorio}.equals(new BigDecimal($F{corridaId}.toString()))]]></printWhenExpression>
</reportElement>
@ -498,6 +489,21 @@
</textElement>
<text><![CDATA[Peso Operacional]]></text>
</staticText>
<textField pattern="#,##0.00">
<reportElement uuid="2e9a3a57-4989-4418-83d5-6a389f91f1b7" x="74" y="61" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{KM_CORRIDA}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00">
<reportElement uuid="9d44eaed-c896-4000-a73d-2443760ede53" x="74" y="101" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$V{KM_CORRIDA_1}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="100f3e8f-adf0-4ef9-879f-40112d482e13" x="0" y="1" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{EQUIVALENTE_TOTAL_CORRIDA}]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
@ -605,27 +611,27 @@
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{KM_TRAMO}]]></textFieldExpression>
</textField>
<textField>
<textField pattern="#,##0.00">
<reportElement uuid="5ad372c0-5127-4441-aae3-be6ca2949a93" x="334" y="1" width="60" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{equivalente}]]></textFieldExpression>
</textField>
<textField>
<textField pattern="#,##0.00">
<reportElement uuid="edc8f07c-0a7b-45c2-8280-ebd8584e60c6" x="394" y="1" width="69" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{pax_km}]]></textFieldExpression>
</textField>
<textField>
<textField pattern="#,##0.00">
<reportElement uuid="0fe8352f-f787-46b6-adcb-e8dda60b4d9d" x="286" y="1" width="48" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{rec_abs}]]></textFieldExpression>
</textField>
<textField>
<textField pattern="#,##0.00">
<reportElement uuid="22d22d0b-ed49-44a7-8725-c4a62b7fbb41" x="463" y="1" width="44" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{porc_abs}]]></textFieldExpression>
</textField>
<textField>
<textField pattern="#,##0.00">
<reportElement uuid="5ecd33c0-2648-482f-b87a-d5197d2f193e" x="507" y="1" width="48" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{por_equivalente}]]></textFieldExpression>