Commit ceef4f53 authored by Rafael de Lima Prado's avatar Rafael de Lima Prado

pentahofiles: Update some more graphics to work with the new database model

Signed-off-by: default avatarRafael de Lima Prado <rlp09@c3sl.ufpr.br>
parent 57d17fe2
......@@ -34,14 +34,9 @@
<password><![CDATA[]]></password>
<query>
<![CDATA[
SELECT
to_char((SELECT MAX(end_time) FROM control), 'DD/MM/YYYY') AS Brasil,
SUM(hd_amount) AS "Máquinas com HD modificado",
SUM(memory_amount) AS "Máquinas com memória modificada"
FROM
dm_alert_state
WHERE
project = 'proinfo'::project_enum
select to_char((select MAX(end_time) FROM control), 'DD/MM/YYYY') AS Brasil, sum(hd_amount) AS "Máquinas com HD modificado", sum(memory_amount) AS "Máquinas com memória modificada"
from dm_alert_state
where project = 'proinfo'
]]>
</query>
</component-definition>
......
......@@ -53,18 +53,10 @@
<password><![CDATA[]]></password>
<query>
<![CDATA[
SELECT
city AS Cidade,
hd_amount AS "Máquinas com HD modificado",
memory_amount AS "Máquinas com memória modificada"
FROM
dm_alert_city
WHERE
region = '{REGIAO}' AND
state = '{ESTADO}' AND
project = 'proinfo'::project_enum
ORDER BY
city
select city AS Cidade, hd_amount AS "Máquinas com HD modificado", memory_amount AS "Máquinas com memória modificada"
from dm_alert_city
where region = '{REGIAO}' AND state = '{ESTADO}' AND project = 'proinfo'
order by city
]]>
</query>
</component-definition>
......
......@@ -44,17 +44,10 @@
<password><![CDATA[]]></password>
<query>
<![CDATA[
SELECT
state AS Estado,
hd_amount AS "Máquinas com HD modificado",
memory_amount AS "Máquinas com memória modificada"
FROM
dm_alert_state
WHERE
region = '{REGIAO}' AND
project = 'proinfo'::project_enum
ORDER BY
state ASC
select state AS Estado, hd_amount AS "Máquinas com HD modificado", memory_amount AS "Máquinas com memória modificada"
from dm_alert_state
where region = '{REGIAO}' AND project = 'proinfo'
order by state ASC
]]>
</query>
</component-definition>
......
......@@ -34,18 +34,11 @@
<password><![CDATA[]]></password>
<query>
<![CDATA[
SELECT
region AS Regiao,
SUM(hd_amount) AS "Máquinas com HD modificado",
SUM(memory_amount) AS "Máquinas com memória modificada"
FROM
dm_alert_state
WHERE
project = 'proinfo'::project_enum
GROUP BY
region
ORDER BY
region ASC
select region AS Regiao, sum(hd_amount) AS "Máquinas com HD modificado", sum(memory_amount) AS "Máquinas com memória modificada"
from dm_alert_state
where project = 'proinfo'
group by region
order by region ASC
]]>
</query>
</component-definition>
......
......@@ -34,19 +34,11 @@
<password><![CDATA[]]></password>
<query>
<![CDATA[
SELECT
to_char(contact_date, 'Month') AS mes,
to_char(contact_date, 'MM') AS dis_mes,
sum(hd_amount) AS "Máquinas com HD modificado",
sum(memory_amount) AS "Máquinas com memória modificada"
FROM
dm_alert_state_history
WHERE
project = 'proinfo'::project_enum
GROUP BY
contact_date
ORDER BY
contact_date ASC
select to_char(contact_date, 'Month') AS mes, to_char(contact_date, 'MM') AS dis_mes, sum(hd_amount) AS "Máquinas com HD modificado", sum(memory_amount) AS "Máquinas com memória modificada"
from dm_alert_state_history
where project = 'proinfo'
group by contact_date
order by contact_date ASC
]]>
</query>
</component-definition>
......
......@@ -51,19 +51,10 @@
<password><![CDATA[]]></password>
<query>
<![CDATA[
SELECT
to_char(contact_date, 'Month') AS mes,
to_char(contact_date, 'MM') AS dis_mes,
hd_amount AS "Máquinas com HD modificado",
memory_amount AS "Máquinas com memória modificada"
FROM
dm_alert_city_history
WHERE
region = '{REGIAO}' AND
state = '{ESTADO}' AND
project = 'proinfo'::project_enum
ORDER BY
contact_date ASC
select to_char(contact_date, 'Month') AS mes, to_char(contact_date, 'MM') AS dis_mes, hd_amount AS "Máquinas com HD modificado", memory_amount AS "Máquinas com memória modificada"
from dm_alert_city_history
where region = '{REGIAO}' AND state = '{ESTADO}' AND project = 'proinfo'
order by contact_date ASC
]]>
</query>
</component-definition>
......
......@@ -44,18 +44,10 @@
<password><![CDATA[]]></password>
<query>
<![CDATA[
SELECT
to_char(contact_date, 'Month') AS mes,
to_char(contact_date, 'MM') AS dis_mes,
hd_amount AS "Máquinas com HD modificado",
memory_amount AS "Máquinas com memória modificada"
FROM
dm_alert_state_history
WHERE
region = '{REGIAO}' AND
project = 'proinfo'::project_enum
ORDER BY
contact_date ASC
select to_char(contact_date, 'Month') AS mes, to_char(contact_date, 'MM') AS dis_mes, hd_amount AS "Máquinas com HD modificado", memory_amount AS "Máquinas com memória modificada"
from dm_alert_state_history
where region = '{REGIAO}' AND project = 'proinfo'
order by contact_date ASC
]]>
</query>
</component-definition>
......
......@@ -34,19 +34,11 @@
<password><![CDATA[]]></password>
<query>
<![CDATA[
SELECT
to_char(contact_date, 'Month') AS mes,
to_char(contact_date, 'MM') AS dis_mes,
sum(hd_amount) AS "Máquinas com HD modificado",
sum(memory_amount) AS "Máquinas com memória modificada"
FROM
dm_alert_state_history
WHERE
project = 'proinfo'::project_enum
GROUP BY
contact_date
ORDER BY
contact_date ASC
select to_char(contact_date, 'Month') AS mes, to_char(contact_date, 'MM') AS dis_mes, sum(hd_amount) AS "Máquinas com HD modificado", sum(memory_amount) AS "Máquinas com memória modificada"
from dm_alert_state_history
where project = 'proinfo'
group by contact_date
order by contact_date ASC
]]>
</query>
</component-definition>
......
......@@ -34,20 +34,9 @@
<password><![CDATA[]]></password>
<query>
<![CDATA[
SELECT SUM(ok) AS "OK", SUM(hd) AS "HD", SUM(mm) AS "MM"
FROM
( SELECT
CASE WHEN inv_alerta_hd = 'B0' AND inv_alerta_mem = 'B0' THEN 1 ELSE 0 END AS ok,
CASE WHEN inv_alerta_hd = 'B1' THEN 1 ELSE 0 END AS hd,
CASE WHEN inv_alerta_mem = 'B1' THEN 1 ELSE 0 END AS mm
FROM mectb10_dm_inventario AS inn INNER JOIN
( SELECT MAX(inv_data) AS mdata, inv_inep, inv_maquina
FROM mectb10_dm_inventario
WHERE inv_projeto = 0
GROUP BY inv_inep, inv_maquina) AS temp ON
temp.inv_inep = inn.inv_inep AND
temp.mdata = inn.inv_data AND
temp.inv_maquina = inn.inv_maquina) AS temp2
select ((select sum(total) from dm_avail_state) - (sum(alert.memory_amount) + sum(alert.hd_amount))) AS "OK", sum(alert.hd_amount) AS "HD", sum(alert.memory_amount) AS "MM"
from dm_alert_state alert
where alert.project = 'proinfo'
]]>
</query>
</component-definition>
......
......@@ -51,59 +51,9 @@
<password><![CDATA[]]></password>
<query>
<![CDATA[
SELECT
( SELECT count(inv_maquina)
FROM
( SELECT
MAX(inv_data) as data,
inv_maquina as maquina,
inv_escola as escola
FROM mectb10_dm_inventario
GROUP BY escola, maquina ) as temp,
mectb10_dm_inventario
WHERE
mectb10_dm_inventario.inv_data = data AND
mectb10_dm_inventario.inv_maquina = maquina AND
mectb10_dm_inventario.inv_escola = escola AND
inv_regiao = '{REGIAO}' AND
inv_estado = '{ESTADO}' AND
inv_alerta_hd = 'B0' AND
inv_alerta_mem = 'B0' AND
mectb10_dm_inventario.inv_projeto = 0 ) AS "OK",
( SELECT count(inv_maquina)
FROM
( SELECT
MAX(inv_data) as data,
inv_maquina as maquina,
inv_escola as escola
FROM mectb10_dm_inventario
GROUP BY escola, maquina ) as temp,
mectb10_dm_inventario
WHERE
mectb10_dm_inventario.inv_data = data AND
mectb10_dm_inventario.inv_maquina = maquina AND
mectb10_dm_inventario.inv_escola = escola AND
inv_regiao = '{REGIAO}' AND
inv_estado = '{ESTADO}' AND
inv_alerta_hd = 'B1' AND
mectb10_dm_inventario.inv_projeto = 0 ) AS "HD",
( SELECT count(inv_maquina)
FROM
( SELECT
MAX(inv_data) as data,
inv_maquina as maquina,
inv_escola as escola
FROM mectb10_dm_inventario
GROUP BY escola, maquina ) as temp,
mectb10_dm_inventario
WHERE
mectb10_dm_inventario.inv_data = data AND
mectb10_dm_inventario.inv_maquina = maquina AND
mectb10_dm_inventario.inv_escola = escola AND
inv_regiao = '{REGIAO}' AND
inv_estado = '{ESTADO}' AND
inv_alerta_mem = 'B1' AND
mectb10_dm_inventario.inv_projeto = 0 ) AS "MM"
select ((select sum(total) from dm_avail_state) - (sum(alert.memory_amount) + sum(alert.hd_amount))) AS "OK", sum(alert.hd_amount) AS "HD", sum(alert.memory_amount) AS "MM"
from dm_alert_state alert
where alert.region = '{REGIAO}' AND alert.region = '{ESTADO}' AND alert.project = 'proinfo'
]]>
</query>
</component-definition>
......
......@@ -44,56 +44,9 @@
<password><![CDATA[]]></password>
<query>
<![CDATA[
SELECT
( SELECT count(inv_maquina)
FROM
( SELECT
MAX(inv_data) as data,
inv_maquina as maquina,
inv_escola as escola
FROM mectb10_dm_inventario
GROUP BY escola, maquina ) as temp,
mectb10_dm_inventario
WHERE
mectb10_dm_inventario.inv_data = data AND
mectb10_dm_inventario.inv_maquina = maquina AND
mectb10_dm_inventario.inv_escola = escola AND
inv_regiao = '{REGIAO}' AND
inv_alerta_hd = 'B0' AND
inv_alerta_mem = 'B0' AND
mectb10_dm_inventario.inv_projeto = 0 ) AS "OK",
( SELECT count(inv_maquina)
FROM
( SELECT
MAX(inv_data) as data,
inv_maquina as maquina,
inv_escola as escola
FROM mectb10_dm_inventario
GROUP BY escola, maquina ) as temp,
mectb10_dm_inventario
WHERE
mectb10_dm_inventario.inv_data = data AND
mectb10_dm_inventario.inv_maquina = maquina AND
mectb10_dm_inventario.inv_escola = escola AND
inv_regiao = '{REGIAO}' AND
inv_alerta_hd = 'B1' AND
mectb10_dm_inventario.inv_projeto = 0 ) AS "HD",
( SELECT count(inv_maquina)
FROM
( SELECT
MAX(inv_data) as data,
inv_maquina as maquina,
inv_escola as escola
FROM mectb10_dm_inventario
GROUP BY escola, maquina ) as temp,
mectb10_dm_inventario
WHERE
mectb10_dm_inventario.inv_data = data AND
mectb10_dm_inventario.inv_maquina = maquina AND
mectb10_dm_inventario.inv_escola = escola AND
inv_regiao = '{REGIAO}' AND
inv_alerta_mem = 'B1' AND
mectb10_dm_inventario.inv_projeto = 0 ) AS "MM"
select ((select sum(total) from dm_avail_state) - (sum(alert.memory_amount) + sum(alert.hd_amount))) AS "OK", sum(alert.hd_amount) AS "HD", sum(alert.memory_amount) AS "MM"
from dm_alert_state alert
where alert.region = '{REGIAO}' AND alert.project = 'proinfo'
]]>
</query>
</component-definition>
......
......@@ -34,53 +34,9 @@
<password><![CDATA[]]></password>
<query>
<![CDATA[
SELECT
( SELECT count(inv_maquina)
FROM
( SELECT
MAX(inv_data) as data,
inv_maquina as maquina,
inv_escola as escola
FROM mectb10_dm_inventario
GROUP BY escola, maquina ) as temp,
mectb10_dm_inventario
WHERE
mectb10_dm_inventario.inv_data = data AND
mectb10_dm_inventario.inv_maquina = maquina AND
mectb10_dm_inventario.inv_escola = escola AND
inv_alerta_hd = 'B0' AND
inv_alerta_mem = 'B0' AND
mectb10_dm_inventario.inv_projeto = 0 ) AS "OK",
( SELECT count(inv_maquina)
FROM
( SELECT
MAX(inv_data) as data,
inv_maquina as maquina,
inv_escola as escola
FROM mectb10_dm_inventario
GROUP BY escola, maquina ) as temp,
mectb10_dm_inventario
WHERE
mectb10_dm_inventario.inv_data = data AND
mectb10_dm_inventario.inv_maquina = maquina AND
mectb10_dm_inventario.inv_escola = escola AND
inv_alerta_hd = 'B1' AND
mectb10_dm_inventario.inv_projeto = 0 ) AS "HD",
( SELECT count(inv_maquina)
FROM
( SELECT
MAX(inv_data) as data,
inv_maquina as maquina,
inv_escola as escola
FROM mectb10_dm_inventario
GROUP BY escola, maquina ) as temp,
mectb10_dm_inventario
WHERE
mectb10_dm_inventario.inv_data = data AND
mectb10_dm_inventario.inv_maquina = maquina AND
mectb10_dm_inventario.inv_escola = escola AND
inv_alerta_mem = 'B1' AND
mectb10_dm_inventario.inv_projeto = 0 ) AS "MM"
select ((select sum(total) from dm_avail_state) - (sum(alert.memory_amount) + sum(alert.hd_amount))) AS "OK", sum(alert.hd_amount) AS "HD", sum(alert.memory_amount) AS "MM"
from dm_alert_state alert
where alert.project = 'proinfo'
]]>
</query>
</component-definition>
......
......@@ -72,110 +72,9 @@
<output-type>pdf</output-type>
<query>
<![CDATA[
SELECT
ORIGINAL.data_atual AS data_atual,
ORIGINAL.regiao AS regiao,
ORIGINAL.estado AS estado,
ORIGINAL.cidade AS cidade,
ORIGINAL.escola AS escola,
ORIGINAL.maquina AS maquina,
ORIGINAL.so AS so,
ORIGINAL.processador AS processador,
ORIGINAL.data AS data_original,
CASE WHEN ORIGINAL.memoria < 1024
THEN ORIGINAL.memoria || ' KiB'
ELSE CASE WHEN ORIGINAL.memoria < 1048576
THEN ORIGINAL.memoria / 1024 || ' MiB'
ELSE CASE WHEN ORIGINAL.memoria < 1073741824
THEN ORIGINAL.memoria / 1048576 || ' GiB'
ELSE ORIGINAL.memoria / 1073741824 || ' TiB'
END END END AS memoria_original,
CASE WHEN ORIGINAL.hd < 1000
THEN ORIGINAL.hd || ' GB'
ELSE CASE WHEN ORIGINAL.hd < 1000000
THEN ORIGINAL.hd / 1000 || ' TB'
ELSE ORIGINAL.hd / 1000000 || ' PB'
END END AS hd_original,
CASE WHEN MODIFICADO.memoria < 1024
THEN MODIFICADO.memoria || ' KiB'
ELSE CASE WHEN MODIFICADO.memoria < 1048576
THEN MODIFICADO.memoria / 1024 || ' MiB'
ELSE CASE WHEN MODIFICADO.memoria < 1073741824
THEN MODIFICADO.memoria / 1048576 || ' GiB'
ELSE MODIFICADO.memoria / 1073741824 || ' TiB'
END END END AS memoria_modificado,
CASE WHEN MODIFICADO.hd < 1000
THEN MODIFICADO.hd || ' GB'
ELSE CASE WHEN MODIFICADO.hd < 1000000
THEN MODIFICADO.hd / 1000 || ' TB'
ELSE MODIFICADO.hd / 1000000 || ' PB'
END END AS hd_modificado,
MODIFICADO.data AS data_modificado,
MODIFICADO.alerta_hd AS alerta_hd,
MODIFICADO.alerta_mem AS alerta_mem
FROM
(SELECT
to_char((SELECT MAX(dis_data) FROM mectb09_dm_disp_ag), 'DD/MM/YYYY') AS data_atual,
initcap(inv_regiao) AS regiao,
inv_estado AS estado,
initcap(inv_cidade) AS cidade,
initcap(inv_escola) AS escola,
inv_maquina AS maquina,
inv_so AS so,
inv_modelo_proc AS processador,
min(inv_data) AS data,
inv_qtde_mem AS memoria,
inv_tam_disco AS hd
FROM mectb10_dm_inventario
WHERE
inv_regiao = '{REGIAO}'
AND inv_estado = '{ESTADO}'
AND inv_cidade = '{CIDADE}'
AND mectb10_dm_inventario.inv_projeto = 0
GROUP BY
inv_regiao,
inv_estado,
inv_cidade,
inv_escola,
maquina,
so,
processador,
memoria,
hd
) ORIGINAL
RIGHT OUTER JOIN
(SELECT
max(inv_data) AS data,
inv_maquina AS maquina,
inv_qtde_mem AS memoria,
inv_tam_disco AS hd,
inv_alerta_hd AS alerta_hd,
inv_alerta_mem AS alerta_mem
FROM mectb10_dm_inventario
WHERE
inv_regiao = '{REGIAO}'
AND inv_estado = '{ESTADO}'
AND inv_cidade = '{CIDADE}'
AND (inv_alerta_hd = 'B1' OR inv_alerta_mem = 'B1')
AND mectb10_dm_inventario.inv_projeto = 0
GROUP BY
maquina,
memoria,
hd,
alerta_hd,
alerta_mem
) MODIFICADO
ON ORIGINAL.maquina = MODIFICADO.maquina AND
ORIGINAL.data <> MODIFICADO.data
ORDER BY
escola ASC
select to_char((select max(end_time) from control), 'DD/MM/YYYY') AS load_date, region, state, city, school, machine, os_distro, processor, old_date, simplify_mem(old_memory_size) AS old_memory_size, simplify_hd(old_hd_size) AS old_hd_size, simplify_mem(new_memory_size) AS new_memory_size, simplify_hd(new_hd_size) AS new_hd_size, new_date, hd_alert, memory_alert
from dm_alert_machine
where region = '{REGIAO}' AND state = '{ESTADO}' AND city = '{CIDADE}' AND project = 'proinfo' AND (hd_alert = true OR memory_alert = true)
]]>
</query>
</component-definition>
......
......@@ -34,23 +34,10 @@
<password><![CDATA[]]></password>
<query>
<![CDATA[
SELECT
to_char(aud_data, 'DD/MM/YYYY') AS Brasil,
instaladas as "Instaladas",
CASE WHEN previstas IS NULL THEN 0
WHEN previstas - instaladas < 0 THEN 0
ELSE previstas - instaladas
END AS "Não instaladas"
FROM
(SELECT aud.aud_data, sum(aud_instaladas) AS instaladas, sum(aud_instaladas) AS previstas
FROM
(SELECT MAX(aud_data) AS aud_data, aud_inep FROM mectb11_dm_auditoria GROUP BY aud_inep) AS temp
NATURAL JOIN mectb11_dm_auditoria AS aud
WHERE aud_projeto = 0
GROUP BY aud.aud_data)
AS temp2
ORDER BY brasil DESC
LIMIT 1
select to_char((select max(end_time) from control), 'DD/MM/YYYY') as
Brasil, sum(total), 0
from dm_avail_state
where project = 'proinfo'
]]>
</query>
</component-definition>
......
......@@ -36,13 +36,10 @@
<action-definition>
<component-name>SQLLookupRule</component-name>
<action-type>Relational</action-type>
<action-inputs>
<ESTADO type="string"/>
</action-inputs>
<action-inputs>
<REGIAO type="string"/>
<ESTADO type="string"/>
</action-inputs>
<action-outputs>
<query-result type="result-set" mapping="swresult"/>
</action-outputs>
......@@ -54,50 +51,14 @@
<password><![CDATA[]]></password>
<query>
<![CDATA[
SELECT
aud_cidade AS Cidade,
to_char(CURRENT_DATE, 'DD/MM/YYYY') AS Brasil,
sum(mectb11_dm_auditoria.aud_instaladas) as "Instaladas",
CASE WHEN sum("mectb11_dm_auditoria"."aud_previstas") -
sum("mectb11_dm_auditoria"."aud_instaladas") < 0 THEN 0 ELSE
sum("mectb11_dm_auditoria"."aud_previstas") -
sum("mectb11_dm_auditoria"."aud_instaladas") END AS "Não instaladas"
FROM
(select max(aud_data) as data, aud_inep as inep from mectb11_dm_auditoria WHERE aud_regiao = '{REGIAO}' AND aud_estado = '{ESTADO}' group by inep) temp,
mectb11_dm_auditoria
WHERE
temp.data = mectb11_dm_auditoria.aud_data AND
temp.inep = mectb11_dm_auditoria.aud_inep AND
mectb11_dm_auditoria.aud_projeto = 0
GROUP BY
Cidade
ORDER BY
Cidade ASC
select initcap(city), total, 0
from dm_avail_city
where project = 'proinfo' and region = '{REGIAO}' and state =
'{ESTADO}'
order by city
]]>
</query>
</component-definition>
</action-definition>
</actions>
</action-sequence>
<!--
SELECT
aud_cidade AS Cidade,
sum("mectb11_dm_auditoria"."aud_instaladas") AS instaladas,
CASE WHEN sum("mectb11_dm_auditoria"."aud_previstas") -
sum("mectb11_dm_auditoria"."aud_instaladas") < 0 THEN 0 ELSE
sum("mectb11_dm_auditoria"."aud_previstas") -
sum("mectb11_dm_auditoria"."aud_instaladas") END AS nao_instaladas
FROM
"mectb11_dm_auditoria"
WHERE
aud_regiao = '{REGIAO}' AND
aud_estado = '{ESTADO}' AND
aud_data = (SELECT max(aud_data) FROM "mectb11_dm_auditoria")
GROUP BY
aud_regiao,
aud_estado,
Cidade,
aud_data
ORDER BY
Cidade ASC
-->
......@@ -44,48 +44,13 @@
<password><![CDATA[]]></password>
<query>
<![CDATA[
SELECT
aud_estado AS Estado,
to_char(CURRENT_DATE, 'DD/MM/YYYY') AS Brasil,
sum(mectb11_dm_auditoria.aud_instaladas) as "Instaladas",
CASE WHEN sum("mectb11_dm_auditoria"."aud_previstas") -
sum("mectb11_dm_auditoria"."aud_instaladas") < 0 THEN 0 ELSE
sum("mectb11_dm_auditoria"."aud_previstas") -
sum("mectb11_dm_auditoria"."aud_instaladas") END AS "Não instaladas"
FROM
(select max(aud_data) as data, aud_inep as inep from mectb11_dm_auditoria WHERE aud_regiao = '{REGIAO}' group by inep) temp,
mectb11_dm_auditoria
WHERE
temp.data = mectb11_dm_auditoria.aud_data AND
temp.inep = mectb11_dm_auditoria.aud_inep AND
mectb11_dm_auditoria.aud_projeto = 0
GROUP BY
Estado
ORDER BY
Estado ASC
select state, total, 0
from dm_avail_state
where project = 'proinfo' and region = '{REGIAO}'
order by state
]]>
</query>
</component-definition>
</action-definition>
</actions>
</action-sequence>
<!--
SELECT
aud_estado AS Estado,
sum("mectb11_dm_auditoria"."aud_instaladas") AS instaladas,
CASE WHEN sum("mectb11_dm_auditoria"."aud_previstas") -
sum("mectb11_dm_auditoria"."aud_instaladas") < 0 THEN 0 ELSE
sum("mectb11_dm_auditoria"."aud_previstas") -
sum("mectb11_dm_auditoria"."aud_instaladas") END AS nao_instaladas
FROM
"mectb11_dm_auditoria"
WHERE
aud_regiao = '{REGIAO}' AND
aud_data = (SELECT max(aud_data) FROM "mectb11_dm_auditoria")
GROUP BY
aud_regiao,
Estado,
aud_data
ORDER BY
Estado ASC
-->
......@@ -34,47 +34,14 @@
<password><![CDATA[]]></password>
<query>
<![CDATA[
SELECT
aud_regiao AS Regiao,
sum(mectb11_dm_auditoria.aud_instaladas) as "Instaladas",
CASE WHEN sum("mectb11_dm_auditoria"."aud_previstas") -
sum("mectb11_dm_auditoria"."aud_instaladas") < 0 THEN 0 ELSE
sum("mectb11_dm_auditoria"."aud_previstas") -
sum("mectb11_dm_auditoria"."aud_instaladas") END AS "Não instaladas"