Files
ReportJasper/IntegryReports/GRAMM/Ordinato_settimanale.jrxml

409 lines
19 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.21.3.final using JasperReports Library version 6.21.3-4a3078d20785ebe464f18037d738d12fc98c13cf -->
<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="Ordinato_settimanale" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="c66865ef-14cf-4b00-8b43-ee92ad540703">
<property name="ireport.zoom" value="3.0"/>
<property name="ireport.x" value="997"/>
<property name="ireport.y" value="0"/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="GRAMM\DataAdapter.xml"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<parameter name="report_progressivo_annuo" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="settimana" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="anno" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="anno_da_confrontare" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[SELECT nazionalita,
marchio,
sottogruppo,
sottofamiglia,
cod_mart,
Articolo,
sum(val_vend_ac) as venduto_ac,
sum(val_vend_ap) as venduto_ap,
azienda.nome_ditta
FROM (SELECT nazionalita,
sottogruppo,
marchio,
sottofamiglia,
cod_mart,
Articolo,
sum(val_vend) as val_vend_ac,
CONVERT(numeric(20, 5), 0) as val_vend_ap
FROM (SELECT CASE left(OlapVendutoOrd.cod_vzon, 1) WHEN 'I' THEN 'ITALIA' ELSE 'ESTERO' END as nazionalita,
OlapArticoli.marchio,
OlapArticoli.Sottofamiglia,
OlapArticoli.sottogruppo,
OlapArticoli.cod_mart,
OlapArticoli.Articolo,
sum(OlapVendutoOrd.val_vend) as val_vend
FROM OlapArticoli,
OlapVendutoOrd,
mtb_aart
WHERE OlapVendutoOrd.cod_mart = OlapArticoli.cod_mart AND
OlapArticoli.cod_mart = mtb_aart.cod_mart AND
($P{report_progressivo_annuo}='si' and DATEPART(week, OlapVendutoOrd.data_ord) <= (datepart(week, cast($P{settimana} as date))) or ($P{report_progressivo_annuo} = 'no' AND DATEPART(week, OlapVendutoOrd.data_ord) = (datepart(week, cast($P{settimana} as date))))) and
DATEPART(year, OlapVendutoOrd.data_ord) = $P{anno} and
OlapVendutoOrd.val_vend <> 0 AND
mtb_aart.cod_mgrp in ('PFP','PFC')
GROUP BY OlapArticoli.marchio,
OlapArticoli.sottogruppo,
OlapArticoli.Sottofamiglia,
OlapArticoli.cod_mart,
OlapArticoli.Articolo,
OlapVendutoOrd.cod_vzon
) venduto
GROUP BY nazionalita,
sottogruppo,
marchio,
sottofamiglia,
cod_mart,
Articolo
UNION ALL
SELECT nazionalita,
sottogruppo,
marchio,
sottofamiglia,
cod_mart,
Articolo,
CONVERT(numeric(20, 5), 0) as val_vend_ac,
sum(val_vend) as val_vend_ap
FROM (SELECT CASE left(OlapVendutoOrd.cod_vzon, 1) WHEN 'I' THEN 'ITALIA' ELSE 'ESTERO' END as nazionalita,
OlapArticoli.marchio,
OlapArticoli.Sottofamiglia,
OlapArticoli.sottogruppo,
OlapArticoli.cod_mart,
OlapArticoli.Articolo,
sum(OlapVendutoOrd.val_vend) as val_vend
FROM OlapArticoli,
OlapVendutoOrd,
mtb_aart
WHERE OlapVendutoOrd.cod_mart = OlapArticoli.cod_mart AND
OlapArticoli.cod_mart = mtb_aart.cod_mart AND
($P{report_progressivo_annuo}='si' and DATEPART(week, OlapVendutoOrd.data_ord) <= (datepart(week, cast($P{settimana} as date))) or ($P{report_progressivo_annuo} = 'no' AND DATEPART(week, OlapVendutoOrd.data_ord) = (datepart(week, cast($P{settimana} as date))))) and
DATEPART(year, OlapVendutoOrd.data_ord) = $P{anno_da_confrontare} AND
OlapVendutoOrd.val_vend <> 0 AND
mtb_aart.cod_mgrp in ('PFP','PFC')
GROUP BY OlapArticoli.marchio,
OlapArticoli.sottogruppo,
OlapArticoli.Sottofamiglia,
OlapArticoli.cod_mart,
OlapArticoli.Articolo,
OlapVendutoOrd.cod_vzon
) venduto
GROUP BY nazionalita,
sottogruppo,
marchio,
sottofamiglia,
cod_mart,
Articolo
) venduto_comparato,
azienda
GROUP BY nazionalita,
sottogruppo,
marchio,
sottofamiglia,
cod_mart,
Articolo,
azienda.nome_ditta
ORDER BY 1, 2, 3, 4]]>
</queryString>
<field name="nazionalita" class="java.lang.String"/>
<field name="marchio" class="java.lang.String"/>
<field name="sottogruppo" class="java.lang.String"/>
<field name="sottofamiglia" class="java.lang.String"/>
<field name="cod_mart" class="java.lang.String"/>
<field name="Articolo" class="java.lang.String"/>
<field name="venduto_ac" class="java.math.BigDecimal"/>
<field name="venduto_ap" class="java.math.BigDecimal"/>
<field name="nome_ditta" class="java.lang.String"/>
<variable name="venduto_ac_SUM" class="java.math.BigDecimal" resetType="Group" resetGroup="sottogruppo" calculation="Sum">
<variableExpression><![CDATA[$F{venduto_ac}]]></variableExpression>
</variable>
<variable name="venduto_ac_COUNT" class="java.lang.String" resetType="Group" resetGroup="marchio">
<variableExpression><![CDATA[$F{venduto_ap}*100]]></variableExpression>
<initialValueExpression><![CDATA[]]></initialValueExpression>
</variable>
<variable name="venduto_ap_COUNT" class="java.lang.String" resetType="Group" resetGroup="marchio">
<variableExpression><![CDATA[$F{venduto_ac}-$F{venduto_ap}]]></variableExpression>
<initialValueExpression><![CDATA[]]></initialValueExpression>
</variable>
<variable name="venduto_ap_SUM" class="java.math.BigDecimal" resetType="Group" resetGroup="sottogruppo" calculation="Sum">
<variableExpression><![CDATA[$F{venduto_ap}]]></variableExpression>
</variable>
<variable name="somma_gruppo1" class="java.math.BigDecimal" resetType="Group" resetGroup="marchio" calculation="Sum">
<variableExpression><![CDATA[$F{venduto_ac}]]></variableExpression>
</variable>
<variable name="somma_gruppo2" class="java.math.BigDecimal" resetType="Group" resetGroup="marchio" calculation="Sum">
<variableExpression><![CDATA[$F{venduto_ap}]]></variableExpression>
</variable>
<variable name="somma_gruppo3" class="java.math.BigDecimal" resetType="Group" resetGroup="nazionalità" calculation="Sum">
<variableExpression><![CDATA[$F{venduto_ac}]]></variableExpression>
</variable>
<variable name="somma_gruppo4" class="java.math.BigDecimal" resetType="Group" resetGroup="nazionalità" calculation="Sum">
<variableExpression><![CDATA[$F{venduto_ap}]]></variableExpression>
</variable>
<group name="nazionalità" isStartNewPage="true" isReprintHeaderOnEachPage="true">
<groupExpression><![CDATA[$F{nazionalita}]]></groupExpression>
<groupHeader>
<band height="69">
<textField>
<reportElement x="219" y="46" width="114" height="20" uuid="657e0a6b-cbf2-43b8-b3d3-a34cd5932e07"/>
<textElement textAlignment="Center">
<font fontName="Arial Black" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{nazionalita}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="0" width="555" height="46" forecolor="#46A0C9" uuid="79d94f94-dccb-4afa-b835-af15265bfcc9"/>
<textElement textAlignment="Center">
<font fontName="Arial Black" size="16"/>
</textElement>
<textFieldExpression><![CDATA[$P{report_progressivo_annuo}.equals("si")
? "ORDINATO SETTIMANALE COMPARATO " + $P{anno} + "-" + $P{anno_da_confrontare} + " PROGRESSIVO DELLA SETTIMANA "+ new SimpleDateFormat(" dd/MM/yyyy").format(new SimpleDateFormat("yyyy-MM-dd").parse($P{settimana}.replace("/", "-")))
: "ORDINATO SETTIMANALE COMPARATO " + $P{anno} + "-" + $P{anno_da_confrontare} + " DELLA SETTIMANA " + new SimpleDateFormat(" dd/MM/yyyy").format(new SimpleDateFormat("yyyy-MM-dd").parse($P{settimana}.replace("/", "-")))]]></textFieldExpression>
</textField>
</band>
</groupHeader>
<groupFooter>
<band height="30">
<textField>
<reportElement x="0" y="0" width="371" height="15" uuid="8c71a675-a552-4030-83bc-883caa05784f"/>
<textElement textAlignment="Right">
<font fontName="Arial Black"/>
</textElement>
<textFieldExpression><![CDATA['Totale ' + $F{nazionalita}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00">
<reportElement x="374" y="0" width="65" height="15" uuid="c2506003-87a9-4acd-b51f-c9d9e681d6ab"/>
<textElement textAlignment="Right">
<font fontName="Arial Black"/>
</textElement>
<textFieldExpression><![CDATA[$V{somma_gruppo3}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00">
<reportElement x="442" y="0" width="65" height="15" uuid="2412d5e2-843f-489a-82aa-dd7747b13a3f"/>
<textElement textAlignment="Right">
<font fontName="Arial Black"/>
</textElement>
<textFieldExpression><![CDATA[$V{somma_gruppo4}]]></textFieldExpression>
</textField>
<textField pattern="#,##0 %">
<reportElement x="510" y="0" width="45" height="15" uuid="ef6ec58f-5fec-4958-97c3-b3189a0e0225"/>
<textElement textAlignment="Right">
<font fontName="Arial Black"/>
</textElement>
<textFieldExpression><![CDATA[$V{somma_gruppo4} == 0.00 ? 1 : new Double ($V{somma_gruppo3}-$V{somma_gruppo4}).doubleValue()/$V{somma_gruppo4}.doubleValue()]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
<group name="marchio" isReprintHeaderOnEachPage="true">
<groupExpression><![CDATA[$F{marchio}]]></groupExpression>
<groupHeader>
<band height="40">
<textField>
<reportElement x="0" y="0" width="322" height="15" uuid="1a0c7d06-cabc-475c-b1ba-a0d8e377df6a"/>
<textElement>
<font fontName="Arial Black"/>
</textElement>
<textFieldExpression><![CDATA[$F{marchio} == null ? ' Articolo senza marchio' : $F{marchio}]]></textFieldExpression>
</textField>
<staticText>
<reportElement mode="Opaque" x="0" y="19" width="159" height="20" backcolor="#DAECF4" uuid="96a90c1a-b69f-4eca-8004-a8c0b1b97379"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Sottogruppo]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="162" y="19" width="209" height="20" backcolor="#DAECF4" uuid="16c4606e-e1e8-4c20-a395-ecb3d5528e56"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Articolo]]></text>
</staticText>
<textField>
<reportElement mode="Opaque" x="374" y="19" width="65" height="20" backcolor="#DAECF4" uuid="663af7a4-135d-4b21-85db-77f71f97a588"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA['Venduto € ' + $P{anno}]]></textFieldExpression>
</textField>
<textField>
<reportElement mode="Opaque" x="442" y="19" width="65" height="20" backcolor="#DAECF4" uuid="47643a74-6a87-49ea-931e-111379a92e07"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA['Venduto € ' +$P{anno_da_confrontare}]]></textFieldExpression>
</textField>
<staticText>
<reportElement mode="Opaque" x="510" y="19" width="45" height="20" backcolor="#DAECF4" uuid="124756a4-ae9c-43d4-bd2f-8c9d9c8956b5"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[%]]></text>
</staticText>
</band>
</groupHeader>
<groupFooter>
<band height="30">
<textField>
<reportElement x="0" y="0" width="371" height="15" uuid="aca1bc74-34b4-492e-bba7-b9a28cb62606"/>
<textElement textAlignment="Right">
<font size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{marchio} == null ? 'Totale Articolo senza marchio' :'Totale ' + $F{marchio}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00">
<reportElement x="374" y="0" width="65" height="15" uuid="dcab3418-405f-405c-9ef4-039f374e9c81"/>
<textElement textAlignment="Right">
<font size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{somma_gruppo1}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00">
<reportElement x="439" y="0" width="68" height="15" uuid="6d204d88-0d31-41bb-b6e9-dc47fea47a8d"/>
<textElement textAlignment="Right">
<font size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{somma_gruppo2}]]></textFieldExpression>
</textField>
<textField pattern="###0 %">
<reportElement x="507" y="0" width="48" height="15" uuid="837ba145-2dcc-42d7-93dd-ea2b50e34115"/>
<textElement textAlignment="Right">
<font size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{somma_gruppo2} == 0.00 ? 1 : new Double ($V{somma_gruppo1}-$V{somma_gruppo2}).doubleValue()/$V{somma_gruppo2}.doubleValue()]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
<group name="sottogruppo" isReprintHeaderOnEachPage="true">
<groupExpression><![CDATA[$F{sottogruppo}]]></groupExpression>
<groupHeader>
<band/>
</groupHeader>
<groupFooter>
<band height="18">
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="371" height="15" uuid="3d416e5d-6397-4d1c-9df4-422abcf4c65d"/>
<textElement textAlignment="Right">
<font size="8" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA['Totale ' + $F{sottogruppo}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00">
<reportElement x="374" y="0" width="65" height="15" uuid="59533014-22e1-45ba-9e48-16128a6539b4"/>
<textElement textAlignment="Right">
<font size="8" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{venduto_ac_SUM}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00">
<reportElement x="442" y="0" width="65" height="15" uuid="1bdf7128-6807-4d69-8e0d-93ebc3f484ad"/>
<textElement textAlignment="Right">
<font size="8" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{venduto_ap_SUM}]]></textFieldExpression>
</textField>
<textField pattern="###0 %">
<reportElement x="510" y="0" width="45" height="15" uuid="d80a6d19-8240-409e-a6b8-34de7149a5e2"/>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$V{venduto_ap_SUM} == 0.00 ? 1 : new Double ($V{venduto_ac_SUM}-$V{venduto_ap_SUM}).doubleValue()/$V{venduto_ap_SUM}.doubleValue()]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="3" splitType="Stretch"/>
</title>
<pageHeader>
<band splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band splitType="Stretch"/>
</columnHeader>
<detail>
<band height="12" splitType="Stretch">
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="159" height="11" uuid="a7097914-d486-4649-b993-71717cda62e6"/>
<box>
<bottomPen lineWidth="0.25"/>
</box>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{sottogruppo}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="162" y="0" width="209" height="11" uuid="e334631f-65ec-4d90-a0c9-fde9d061a2db"/>
<box>
<bottomPen lineWidth="0.25"/>
</box>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Articolo} == null ? 'Non definito' :$F{Articolo}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="374" y="0" width="65" height="11" uuid="041cb1db-e49e-48b9-8b89-95f54c21df44"/>
<box>
<bottomPen lineWidth="0.25"/>
</box>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{venduto_ac}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="442" y="0" width="65" height="11" uuid="a79ffa00-5141-4be3-902c-8eee89e02bd9"/>
<box>
<bottomPen lineWidth="0.25"/>
</box>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{venduto_ap}]]></textFieldExpression>
</textField>
<textField pattern="###0 %" isBlankWhenNull="true">
<reportElement x="510" y="0" width="45" height="11" uuid="f015817e-59bc-4472-a330-b666c9fdf1c7"/>
<box>
<bottomPen lineWidth="0.25"/>
</box>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{venduto_ap} == 0.00 ? 1 : new Double ($F{venduto_ac}-$F{venduto_ap}).doubleValue()/$F{venduto_ap}.doubleValue()]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="59" splitType="Stretch">
<textField>
<reportElement x="432" y="34" width="80" height="20" uuid="a57174b6-6633-476e-97a9-1cb301ffe99b"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA["Pagina "+$V{PAGE_NUMBER}+" di"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="512" y="34" width="40" height="20" uuid="cced5d2e-abe0-4637-b634-ebcb52d06900"/>
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band splitType="Stretch"/>
</summary>
</jasperReport>