<?xml version="1.0" encoding="UTF-8"?>
<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="null" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="99fd3f1d-19d8-41e0-a904-8b775dbee3f0">
	<property name="ireport.zoom" value="1.4641000000000008"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<parameter name="DataStart" class="java.sql.Timestamp">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="DataFinish" class="java.sql.Timestamp">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<queryString>
		<![CDATA[SELECT inc .`create_time` AS Data
,cl.name as Solicitant
,usr.name as Operator
,thm.name AS Tema
,br.name AS Brigada
,lif.stare as LifeCycle 
,statinc.stare as StatusInc

FROM `tbl_incident` as inc

INNER JOIN  tbl_client as cl
ON inc.`client_id` = cl.id

INNER JOIN `tbl_user` as usr
ON inc.user_id = usr.id 

INNER JOIN tbl_theme as thm
ON inc.theme_id = thm.id

INNER JOIN tbl_brigade as br
ON inc.brigade_id = br.id

INNER JOIN tbl_lifecycle as lif
ON inc.life_cycle_id = lif.id
INNER JOIN tbl_statusincident as statinc
ON inc.status_id = statinc.id

WHERE inc.create_time >= DATE_FORMAT( $P{DataStart}, GET_FORMAT( DATETIME,  'EUR' )) AND inc.create_time <= DATE_FORMAT( $P{DataFinish}, GET_FORMAT( DATETIME,  'EUR' ))
union
SELECT max(inc .`create_time`) AS Data
,'Total' as Solicitant
,' ' as Operator
,Count(distinct (thm.name)) AS Tema
,' ' AS Brigada
,count(lif.stare) as LifeCycle 
,' ' as StatusInc

FROM `tbl_incident` as inc

INNER JOIN  tbl_client as cl
ON inc.`client_id` = cl.id

INNER JOIN `tbl_user` as usr
ON inc.user_id = usr.id 

INNER JOIN tbl_theme as thm
ON inc.theme_id = thm.id

INNER JOIN tbl_brigade as br
ON inc.brigade_id = br.id

INNER JOIN tbl_lifecycle as lif
ON inc.life_cycle_id = lif.id
INNER JOIN tbl_statusincident as statinc
ON inc.status_id = statinc.id

WHERE inc.create_time >= DATE_FORMAT( $P{DataStart}, GET_FORMAT( DATETIME,  'EUR' )) AND inc.create_time <= DATE_FORMAT( $P{DataFinish}, GET_FORMAT( DATETIME,  'EUR' ))]]>
	</queryString>
	<field name="Data" class="java.sql.Timestamp"/>
	<field name="Solicitant" class="java.lang.String"/>
	<field name="Operator" class="java.lang.String"/>
	<field name="Tema" class="java.lang.String"/>
	<field name="Brigada" class="java.lang.String"/>
	<field name="LifeCycle" class="java.lang.String"/>
	<field name="StatusInc" class="java.lang.String"/>
	<background>
		<band splitType="Stretch"/>
	</background>
	<pageHeader>
		<band height="129" splitType="Stretch">
			<staticText>
				<reportElement uuid="3b9fb30c-8cc9-4a86-88f6-76e245b34dec" x="423" y="11" width="118" height="20"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
					<font fontName="DejaVu Sans" pdfFontName="DejaVuSans" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
				</textElement>
				<text><![CDATA[ООО "Кишинев-Газ"
                ]]></text>
			</staticText>
			<staticText>
				<reportElement uuid="a760ef4e-90d4-48ea-9aea-9a63e300c2bf" x="188" y="38" width="210" height="20"/>
				<textElement>
					<font fontName="DejaVu Sans" size="12" pdfFontName="DejaVuSans" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
				</textElement>
				<text><![CDATA[Журнал регистрации заявок]]></text>
			</staticText>
			<staticText>
				<reportElement uuid="88f3a81c-4f1e-4cbf-a7f5-52e65131c4a7" x="156" y="69" width="15" height="20"/>
				<textElement>
					<font fontName="DejaVu Sans" isBold="false" pdfFontName="DejaVuSans" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
				</textElement>
				<text><![CDATA[С ]]></text>
			</staticText>
			<staticText>
				<reportElement uuid="fb70621a-044d-44f0-b779-6bb6292d2ea7" x="284" y="69" width="28" height="20"/>
				<textElement textAlignment="Center">
					<font fontName="DejaVu Sans" isBold="false" pdfFontName="DejaVuSans" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
				</textElement>
				<text><![CDATA[По]]></text>
			</staticText>
			<staticText>
				<reportElement uuid="5c006662-37f9-4d1a-aaa3-75fb8f831e85" x="0" y="109" width="83" height="20" forecolor="#000000"/>
				<textElement textAlignment="Center">
					<font fontName="DejaVu Sans" size="9" isBold="true" pdfFontName="DejaVuSans" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
				</textElement>
				<text><![CDATA[Дата/Время]]></text>
			</staticText>
			<staticText>
				<reportElement uuid="07904466-a840-42b3-b7e1-024618c79755" x="83" y="109" width="105" height="20"/>
				<textElement textAlignment="Center">
					<font fontName="DejaVu Sans" size="9" isBold="true" pdfFontName="DejaVuSans" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
				</textElement>
				<text><![CDATA[Заявитель]]></text>
			</staticText>
			<staticText>
				<reportElement uuid="8a8ce7fe-6c47-42bf-971d-f9173b6aeaac" x="188" y="109" width="73" height="20"/>
				<textElement textAlignment="Center">
					<font fontName="DejaVu Sans" size="9" isBold="true" pdfFontName="DejaVuSans" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
				</textElement>
				<text><![CDATA[Оператор]]></text>
			</staticText>
			<staticText>
				<reportElement uuid="d746adad-378b-4edf-8a0d-8c685f667890" x="261" y="109" width="132" height="20"/>
				<textElement textAlignment="Center">
					<font fontName="DejaVu Sans" size="9" isBold="true" pdfFontName="DejaVuSans" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
				</textElement>
				<text><![CDATA[Тема]]></text>
			</staticText>
			<staticText>
				<reportElement uuid="f420088b-0f27-4ba8-83c8-1c547d4ea383" x="393" y="109" width="54" height="20"/>
				<textElement textAlignment="Center">
					<font fontName="DejaVu Sans" size="9" isBold="true" pdfFontName="DejaVuSans" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
				</textElement>
				<text><![CDATA[Бригада]]></text>
			</staticText>
			<staticText>
				<reportElement uuid="df3aa5bb-897f-4266-8f33-a7281cf3c79a" x="447" y="109" width="52" height="20"/>
				<textElement textAlignment="Center">
					<font fontName="DejaVu Sans" size="9" isBold="true" isStrikeThrough="false" pdfFontName="DejaVuSans" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
					<paragraph lineSpacing="Single"/>
				</textElement>
				<text><![CDATA[Ж.цикл]]></text>
			</staticText>
			<staticText>
				<reportElement uuid="9fa63c6f-d670-4c0b-9a96-f8bf71b81a66" x="499" y="109" width="56" height="20"/>
				<textElement textAlignment="Center">
					<font fontName="DejaVu Sans" size="9" isBold="true" pdfFontName="DejaVuSans" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
				</textElement>
				<text><![CDATA[Статус]]></text>
			</staticText>
			<line>
				<reportElement uuid="5cfb536f-c901-4c8a-9fc9-bf3264c7d5b0" x="0" y="109" width="555" height="1"/>
			</line>
			<line>
				<reportElement uuid="e90384e6-91a8-412d-87ab-99b20d6327c9" x="0" y="128" width="555" height="1"/>
			</line>
			<textField pattern="dd/MM/yyyy HH.mm">
				<reportElement uuid="adc8498b-e8cc-49f2-ad50-7cc807edc1b4" x="171" y="65" width="113" height="22"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
					<font fontName="DejaVu Sans" pdfFontName="DejaVuSans" pdfEncoding="Cp1251"/>
				</textElement>
				<textFieldExpression><![CDATA[$P{DataStart}]]></textFieldExpression>
			</textField>
			<textField pattern="dd/MM/yyyy HH.mm">
				<reportElement uuid="adc8498b-e8cc-49f2-ad50-7cc807edc1b4" x="312" y="65" width="107" height="22"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
					<font fontName="DejaVu Sans" pdfFontName="DejaVuSans" pdfEncoding="Cp1251"/>
				</textElement>
				<textFieldExpression><![CDATA[$P{DataFinish}]]></textFieldExpression>
			</textField>
		</band>
	</pageHeader>
	<detail>
		<band height="40" splitType="Stretch">
			<textField isStretchWithOverflow="true">
				<reportElement uuid="3ac123e2-4d18-4618-937a-df06694eadf0" mode="Transparent" x="0" y="0" width="83" height="38"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
					<font size="9" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{Data}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true">
				<reportElement uuid="181b54f6-1aca-4a16-98cd-aab4c7a3e55a" mode="Transparent" x="83" y="0" width="105" height="38"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
					<font fontName="DejaVu Sans" size="9" pdfFontName="DejaVuSans" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{Solicitant}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true">
				<reportElement uuid="9c81949c-9c6c-476c-a94d-2555ee964598" mode="Transparent" x="188" y="0" width="73" height="38"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
					<font fontName="DejaVu Sans" size="9" pdfFontName="DejaVuSans" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{Operator}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true">
				<reportElement uuid="15f46da0-b89f-4599-8ce0-0c6d0c171776" mode="Transparent" x="261" y="1" width="132" height="38"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
					<font fontName="DejaVu Sans" size="9" pdfFontName="DejaVuSans" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{Tema}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true">
				<reportElement uuid="7babe74a-5179-4085-9157-3c4477a87b9a" x="447" y="0" width="52" height="38"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" markup="html">
					<font fontName="DejaVu Sans" size="9" pdfFontName="DejaVuSans" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{LifeCycle}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement uuid="4e0f8f95-a5de-4211-bf82-84eca7700c57" x="499" y="0" width="56" height="38"/>
				<textElement textAlignment="Center" markup="html">
					<font fontName="DejaVu Sans" size="9" pdfFontName="DejaVuSans" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{StatusInc}]]></textFieldExpression>
			</textField>
			<line>
				<reportElement uuid="df179060-1537-4efd-a62a-ebac6a8f9b1f" x="0" y="38" width="555" height="1"/>
			</line>
			<textField>
				<reportElement uuid="9b1ae580-bd3c-4f76-8a9b-0d319568adac" x="393" y="0" width="54" height="38"/>
				<textElement textAlignment="Center" markup="html">
					<font fontName="DejaVu Sans" size="9" pdfFontName="DejaVuSans" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{Brigada}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<pageFooter>
		<band height="23" splitType="Stretch"/>
	</pageFooter>
</jasperReport>
