tests found

This commit is contained in:
2026-04-15 14:07:39 +03:00
parent ade4071eb8
commit 2e0b71cf3f
11 changed files with 69 additions and 111 deletions
+1 -1
View File
@@ -76,7 +76,7 @@
<!--- global settings ---> <!--- global settings --->
<cfset request.RECORDS_PER_PAGE=500/> <cfset request.RECORDS_PER_PAGE=500/>
<cfset request.APP_VERSION="0.00.043"/> <cfset request.APP_VERSION="0.00.044"/>
<cfset request.STAND=getStand()/> <cfset request.STAND=getStand()/>
<cflock scope="application" type="readonly" timeout=3> <cflock scope="application" type="readonly" timeout=3>
+4 -3
View File
@@ -114,6 +114,7 @@ select count(*) as cnt from elma.additional_agreements d where 1=1
<cfsavecontent variable="qRead.f_contragent"> <cfsavecontent variable="qRead.f_contragent">
<a href="contragent.cfm?__id=#company_uid#&#tr.fwx#">#contragent#</a> <a href="contragent.cfm?__id=#company_uid#&#tr.fwx#">#contragent#</a>
<a href="contragent_rpt.cfm?__id=#company_uid#&#tr.fwx#" style="float:right"><img src="img/view.gif" title="сводка по контрагенту"/></a>
</cfsavecontent> </cfsavecontent>
<cfsavecontent variable="qRead.f_deal"> <cfsavecontent variable="qRead.f_deal">
@@ -136,9 +137,9 @@ select count(*) as cnt from elma.additional_agreements d where 1=1
<c:column width="10%" field="f_deal"/> <c:column width="10%" field="f_deal"/>
<c:column width="15%" field="f_contragent"/> <c:column width="15%" field="f_contragent"/>
<c:column width="5%" field="wz"/> <c:column width="5%" field="wz"/>
<c:column width="10%" field="date_of_aggrement" formatter=#function(dt){return dateformat(dt,"YYYY-MM-DD");}#><c:td class="c"/></c:column> <c:column width="5%" field="date_of_aggrement" formatter=#function(dt){return dateformat(dt,"YYYY-MM-DD");}#><c:td class="c"/></c:column>
<c:column width="10%" field="date_end_aggrement" formatter=#function(dt){return dateformat(dt,"YYYY-MM-DD");}#><c:td class="c"/></c:column> <c:column width="5%" field="date_end_aggrement" formatter=#function(dt){return dateformat(dt,"YYYY-MM-DD");}#><c:td class="c"/></c:column>
<c:column width="10%" field="type_of_agreement"><c:td class="l"/></c:column> <c:column width="7%" field="type_of_agreement"><c:td class="l"/></c:column>
</c:table> </c:table>
+12 -7
View File
@@ -60,6 +60,8 @@ SELECT
,sum("CPU_Used_AVG") as host_ghz_usage ,sum("CPU_Used_AVG") as host_ghz_usage
,(sum(CASE WHEN "Maintenance"='notInMaintenance' THEN "RAM_Total" ELSE 0 END)) as ram_in_service ,(sum(CASE WHEN "Maintenance"='notInMaintenance' THEN "RAM_Total" ELSE 0 END)) as ram_in_service
,(avg(CASE WHEN "Maintenance"='notInMaintenance' THEN "CPU_Speed" ELSE 0 END)) as ghz ,(avg(CASE WHEN "Maintenance"='notInMaintenance' THEN "CPU_Speed" ELSE 0 END)) as ghz
,max("CPUtoVM") as ghz_subtract_ha
,max("RAMtoVM") as gb_subtract_ha
,CASE WHEN sum("CPU_Cores"*"CPU_Speed") > 0 THEN sum("CPU_Used_AVG")/sum("CPU_Cores"*"CPU_Speed")*100 ELSE NULL END as cpu_usage_perc ,CASE WHEN sum("CPU_Cores"*"CPU_Speed") > 0 THEN sum("CPU_Used_AVG")/sum("CPU_Cores"*"CPU_Speed")*100 ELSE NULL END as cpu_usage_perc
FROM vmreports.host h FROM vmreports.host h
LEFT OUTER JOIN ( LEFT OUTER JOIN (
@@ -107,8 +109,8 @@ select
<!--- <d:field title="Hosts in use">h.hosts</d:field> ---> <!--- <d:field title="Hosts in use">h.hosts</d:field> --->
<d:field title="Cores Capacity">h.cores as Cores_Capacity</d:field> <d:field title="Cores Capacity">h.cores as Cores_Capacity</d:field>
<!--- <d:field title="GHz Capacity">c.ghz as GHz_Capacity</d:field> ---> <!--- <d:field title="GHz Capacity">c.ghz as GHz_Capacity</d:field> --->
<d:field title="GHz Provisioned">h.ghz_provisioned as GHz_Provisioned</d:field><!--- за вычетом согласованных резервов ---> <d:field title="GHz Provisioned">h.ghz_provisioned - CASE WHEN hosts_in_maintenance > 0 THEN 0 ELSE h.ghz_subtract_ha END as GHz_Provisioned</d:field><!--- за вычетом согласованных резервов на хосте и на HA --->
<d:field title="GB Provisioned">h.gb_provisioned as GB_Provisioned</d:field><!--- за вычетом согласованных резервов ---> <d:field title="GB Provisioned">h.gb_provisioned - CASE WHEN hosts_in_maintenance > 0 THEN 0 ELSE h.gb_subtract_ha END as GB_Provisioned</d:field><!--- за вычетом согласованных резервов на хосте и на HA --->
<d:field title="VM GHz reserved">u.vm_ghz_reserved</d:field> <d:field title="VM GHz reserved">u.vm_ghz_reserved</d:field>
<d:field title="VM GHz обещанные">u.vm_ghz_promised</d:field> <d:field title="VM GHz обещанные">u.vm_ghz_promised</d:field>
<d:field title="CPU GHz provision rate %">round((u.vm_ghz_promised/h.ghz_provisioned)::numeric,2)*100 as GHz_provision_rate</d:field> <d:field title="CPU GHz provision rate %">round((u.vm_ghz_promised/h.ghz_provisioned)::numeric,2)*100 as GHz_provision_rate</d:field>
@@ -185,7 +187,8 @@ from qRead
<!--- <th width="3%"><layout:column_head name="ghz"/></th> ---> <!--- <th width="3%"><layout:column_head name="ghz"/></th> --->
<th width="3%"><layout:column_head name="hosts_total"/></th> <th width="3%"><layout:column_head name="hosts_total"/></th>
<th width="5%">RAM GB</th> <th width="5%">RAM GB by alloc</th>
<th width="5%">RAM GB by usage</th>
<th width="5%">CPU GHz (текущий резерв)</th> <th width="5%">CPU GHz (текущий резерв)</th>
<th width="5%">Ядра 20% (текущий резерв)</th> <th width="5%">Ядра 20% (текущий резерв)</th>
@@ -211,6 +214,7 @@ from qRead
<td class="r">#hosts_total#</td> <td class="r">#hosts_total#</td>
<td class="r<cfif gb_provisioned-vm_ram_alloc LE 0> err</cfif>" style="font-size:130%">#numberFormat(gb_provisioned-vm_ram_alloc,"0")#</td> <td class="r<cfif gb_provisioned-vm_ram_alloc LE 0> err</cfif>" style="font-size:130%">#numberFormat(gb_provisioned-vm_ram_alloc,"0")#</td>
<td class="r<cfif gb_provisioned-vm_ram_used LE 0> err</cfif>" style="font-size:130%">#numberFormat(gb_provisioned-vm_ram_used,"0")#</td>
<td class="r<cfif ghz_provisioned-vm_ghz_reserved LE 0> err</cfif>" style="font-size:130%">#numberFormat(ghz_provisioned-vm_ghz_reserved,".0")#</td> <td class="r<cfif ghz_provisioned-vm_ghz_reserved LE 0> err</cfif>" style="font-size:130%">#numberFormat(ghz_provisioned-vm_ghz_reserved,".0")#</td>
<td class="r<cfif ghz_provisioned-vm_ghz_reserved LE 0> err</cfif>" style="font-size:130%">#numberFormat((ghz_provisioned-vm_ghz_reserved)/ghz/0.2,"0")#</td> <td class="r<cfif ghz_provisioned-vm_ghz_reserved LE 0> err</cfif>" style="font-size:130%">#numberFormat((ghz_provisioned-vm_ghz_reserved)/ghz/0.2,"0")#</td>
@@ -228,7 +232,8 @@ from qRead
</cfoutput> </cfoutput>
</table> </table>
<i>Жесткий резерв - если включим минимальное резервирование 20%</i><br/> <i>Жесткий резерв - если включим минимальное резервирование 20%</i><br/>
<i>Доступная память указана по выделенному объему (используется меньше, доступно больше)</i> <i>Доступная память указана по выделенному объему (используется меньше, доступно больше)</i><br/>
<i>Емкость HA вычитается из Capacity, если нет хостов в Maintenance, в противном случае вычитается ресурс хостов в Maintenance. За объем для HA принимается размер наибольшего хоста в кластере по каждому ресурсу (поэтому при выводе в Maintenance расчетная емкость может временно увеличиться)</i>
<h3>Использование подробно</h3> <h3>Использование подробно</h3>
@@ -306,7 +311,7 @@ from qRead
<td class="r">#numberFormat(GB_alloc_perc,"0")#</td> <td class="r">#numberFormat(GB_alloc_perc,"0")#</td>
<td class="r">#numberFormat(GB_usage_perc,"0")#</td> <td class="r">#numberFormat(GB_usage_perc,"0")#</td>
<td class="r">#vms#</td> <td class="r">#vms#</td>
<td class="r"><cftry>#numberFormat(vm_cores/vms,".0")#&nbsp;core #numberFormat(vm_ghz_usage/vms,".0")#&nbsp;GHz #numberFormat(vm_ghz_usage/vm_cores/ghz*100,"0")#% #numberFormat(vm_ram_alloc/vms,".0")#&nbsp;GB <cfcatch></cfcatch></cftry></td> <td class="r"><cftry>#numberFormat(vm_cores/vms,".0")#&nbsp;core #numberFormat(vm_ghz_usage/vms,".0")#&nbsp;GHz #numberFormat(vm_ghz_usage/vm_cores/ghz*100,"0")#% #numberFormat(vm_ram_alloc/vms,".0")#(#numberFormat(vm_ram_used/vms,".0")#)&nbsp;GB <cfcatch></cfcatch></cftry></td>
</tr> </tr>
</cfoutput> </cfoutput>
<cfoutput query="qTotal"> <cfoutput query="qTotal">
@@ -342,7 +347,7 @@ from qRead
#numberFormat(vm_cores/vms,".0")#&nbsp;core #numberFormat(vm_cores/vms,".0")#&nbsp;core
#numberFormat(vm_ghz_usage/vms,".0")#&nbsp;GHz #numberFormat(vm_ghz_usage/vms,".0")#&nbsp;GHz
#numberFormat(vm_ghz_usage/vm_cores/ghz*100,"0")#% <!--- *** тут не уверен ---> #numberFormat(vm_ghz_usage/vm_cores/ghz*100,"0")#% <!--- *** тут не уверен --->
#numberFormat(vm_ram_alloc/vms,".0")#&nbsp;GB #numberFormat(vm_ram_alloc/vms,".0")#(#numberFormat(vm_ram_used/vms,".0")#)&nbsp;GB
<cfcatch></cfcatch></cftry> <cfcatch></cfcatch></cftry>
</td> </td>
</tr> </tr>
@@ -354,7 +359,7 @@ from qRead
<br/> <br/>
<i>* CPU GHz provision rate % - отношение зарезервированной частоты (с учетом 20% резерва по умолчанию) к наличной частоте процессоров</i> <i>* CPU GHz provision rate % - отношение зарезервированной частоты (с учетом 20% резерва по умолчанию) к наличной частоте процессоров</i>
<br/> <br/>
<i>* Расхождения в оценке объема RAM частично связаны с разной оценкой затрат памяти на собственные нужды гипервизора</i> <i>* Для средней ВМ указана аллоцированная память, а в скобках - используемая </i>
<br/> <br/>
<!--- <cfchart <!--- <cfchart
format="png" format="png"
+5 -12
View File
@@ -241,17 +241,7 @@
,p.discount as p_discount ,p.discount as p_discount
,p.__id as p_uid ,p.__id as p_uid
,p.name ,p.name
/*,(select
sum(siv.cnt*(100-COALESCE(siv.discount,0))/100*p.price*p.cnt*(100-COALESCE(p.discount,0))/100)
from elma.service_parametrs p
where p.__id = ANY (siv.params)
AND p."__deletedAt" IS NULL
) as line_cost
,(select count(*)
from elma.service_parametrs p
where p.__id = ANY (siv.params)
AND p."__deletedAt" IS NULL
) as param_cnt*/
,s.probability_pc ,s.probability_pc
,d.__index ,d.__index
,d.__id as deal_uid ,d.__id as deal_uid
@@ -262,7 +252,8 @@
left outer join elma.additional_agreements a on (a.__id=ANY(siv.additional_agreement)) left outer join elma.additional_agreements a on (a.__id=ANY(siv.additional_agreement))
where a.contract_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#d.__id#" null=#!isValid('guid',d.__id)#/> where a.contract_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#d.__id#" null=#!isValid('guid',d.__id)#/>
and siv.is_actual and siv.is_actual
and a.is_actual --and a.is_actual
and s.probability_pc > 0
order by siv.version::int order by siv.version::int
</cfquery> </cfquery>
@@ -292,6 +283,7 @@
<th width="5%">date_nop</th> <th width="5%">date_nop</th>
<th width="5%">date_end</th> <th width="5%">date_end</th>
<th>is_easy</th> <th>is_easy</th>
<th>Вер.%</th>
<th width="7%">additional_agreement</th> <th width="7%">additional_agreement</th>
</tr> </tr>
@@ -341,6 +333,7 @@
<td class="c">#dateFormat(date_nop,'YYYY-MM-DD')#</td> <td class="c">#dateFormat(date_nop,'YYYY-MM-DD')#</td>
<td class="c">#dateFormat(date_end,'YYYY-MM-DD')#</td> <td class="c">#dateFormat(date_end,'YYYY-MM-DD')#</td>
<td class="c">#is_easy#</td> <td class="c">#is_easy#</td>
<td class="c">#probability_pc#</td>
<!--- <td class="c">#additional_agreement_uid#</td> ---> <!--- <td class="c">#additional_agreement_uid#</td> --->
<td><a href="additional_agreement.cfm?__id=#additional_agreement_uid#&#tr.fwx#">#additional_agreement#</a></td> <td><a href="additional_agreement.cfm?__id=#additional_agreement_uid#&#tr.fwx#">#additional_agreement#</a></td>
+1 -1
View File
@@ -103,7 +103,7 @@ select count(*) as cnt from elma.aggrements d where 1=1
</cfsavecontent> </cfsavecontent>
<cfsavecontent variable="qRead.f_contragent"> <cfsavecontent variable="qRead.f_contragent">
<a href="contragent.cfm?__id=#company_uid#&#tr.fwx#">#contragent#</a> <a href="contragent.cfm?__id=#company_uid#&#tr.fwx#">#contragent#</a> <a href="contragent_rpt.cfm?__id=#company_uid#&#tr.fwx#" style="float:right"><img src="img/view.gif" title="сводка по контрагенту"/></a>
</cfsavecontent> </cfsavecontent>
</cfoutput> </cfoutput>
+4 -2
View File
@@ -177,7 +177,8 @@
left outer join elma.additional_agreements a on (a.__id=ANY(siv.additional_agreement)) left outer join elma.additional_agreements a on (a.__id=ANY(siv.additional_agreement))
where d._companies=<cfqueryparam cfsqltype="cf_sql_other" value="#d.__id#" null=#!isValid("guid",d.__id)#/> where d._companies=<cfqueryparam cfsqltype="cf_sql_other" value="#d.__id#" null=#!isValid("guid",d.__id)#/>
AND siv.is_actual AND siv.is_actual
AND a.is_actual --AND a.is_actual
AND s.probability_pc > 0
order by version::int order by version::int
</cfquery> </cfquery>
@@ -207,6 +208,7 @@
<th width="5%">date_nop</th> <th width="5%">date_nop</th>
<th width="5%">date_end</th> <th width="5%">date_end</th>
<th>is_easy</th> <th>is_easy</th>
<th width="5%">Вер.%</th>
<th width="7%">additional_agreement</th> <th width="7%">additional_agreement</th>
</tr> </tr>
</thead> </thead>
@@ -254,7 +256,7 @@
<td class="c">#dateFormat(date_nop,'YYYY-MM-DD')#</td> <td class="c">#dateFormat(date_nop,'YYYY-MM-DD')#</td>
<td class="c<cfif isDate(date_end) AND date_end LT Now()> err</cfif>">#dateFormat(date_end,'YYYY-MM-DD')#</td> <td class="c<cfif isDate(date_end) AND date_end LT Now()> err</cfif>">#dateFormat(date_end,'YYYY-MM-DD')#</td>
<td class="c">#is_easy#</td> <td class="c">#is_easy#</td>
<td class="c">#probability_pc#</td>
<!--- <td class="c">#additional_agreement_uid#</td> ---> <!--- <td class="c">#additional_agreement_uid#</td> --->
<td class="c"><a href="additional_agreement.cfm?__id=#additional_agreement_uid#&#tr.fwx#">#additional_agreement#</a></td> <td class="c"><a href="additional_agreement.cfm?__id=#additional_agreement_uid#&#tr.fwx#">#additional_agreement#</a></td>
</tr> </tr>
+1 -1
View File
@@ -96,7 +96,7 @@ select count(*) as cnt from elma.companies where 1=1
</cfsavecontent> </cfsavecontent>
<cfsavecontent variable="qRead.f_contragent"> <cfsavecontent variable="qRead.f_contragent">
<a href="contragent.cfm?__id=#__id#&#tr.fwx#">#__name#</a> <a href="contragent.cfm?__id=#__id#&#tr.fwx#">#__name#</a> <a href="contragent_rpt.cfm?__id=#__id#&#tr.fwx#" style="float:right"><img src="img/view.gif" title="сводка по контрагенту"/></a>
</cfsavecontent> </cfsavecontent>
</cfoutput> </cfoutput>
+4 -48
View File
@@ -156,60 +156,14 @@
left outer join elma.additional_agreements a on (a.__id=ANY(siv.additional_agreement)) left outer join elma.additional_agreements a on (a.__id=ANY(siv.additional_agreement))
where d._companies=<cfqueryparam cfsqltype="cf_sql_other" value="#d.__id#" null=#!isValid("guid",d.__id)#/> where d._companies=<cfqueryparam cfsqltype="cf_sql_other" value="#d.__id#" null=#!isValid("guid",d.__id)#/>
AND siv.is_actual AND siv.is_actual
AND a.is_actual --AND a.is_actual
AND date_nop <= CURRENT_TIMESTAMP --AND date_nop <= CURRENT_TIMESTAMP
AND COALESCE(date_end,CURRENT_TIMESTAMP) >= CURRENT_TIMESTAMP AND COALESCE(date_end,CURRENT_TIMESTAMP) >= CURRENT_TIMESTAMP
ORDER BY __index --, version::int ORDER BY __index --, version::int
</cfquery> </cfquery>
<!--- <cfquery name="qCompute"> Это неправильно, джойн надо делать на ВМ
WITH
compute as (select
c."Organization_UUID"
,c."Organization"
,c."VDC"
,c."VDC_CPU_Reserv"
,"Cluster"
, round(sum(c."VM_RAM_Allocated")) as ram
, round(sum(CASE WHEN c."VM_is_ON" > 0 THEN c."VM_RAM_Allocated" ELSE 0 END)) as ram_on
, round(sum(c."VM_vCPU_count")) as cpu
, round(sum(CASE WHEN c."VM_is_ON" > 0 THEN c."VM_vCPU_count" ELSE 0 END)) as cpu_on
FROM vmreports.compute c
WHERE ts=(select max(ts) from vmreports.compute)
AND lower(c."WZ")=lower(<cfqueryparam cfsqltype="cf_sql_varchar" value="#d.id_klienta#"/>)
GROUP BY c."Organization_UUID", c."Organization", c."VDC", c."VDC_CPU_Reserv", c."Cluster"
),
storage as (select
"Organization_UUID"
,"Organization"
,"VDC"
,"Cluster"
,"Storage_Policy"
, round(sum(c."Disk_Allocated")) as disk_alloc
, round(sum(c."Disk_Used")) as disk_used
FROM vmreports.storage c
WHERE ts=(select max(ts) from vmreports.storage)
AND lower(c."WZ")=lower(<cfqueryparam cfsqltype="cf_sql_varchar" value="#d.id_klienta#"/>)
GROUP BY c."Organization_UUID",c."Organization",c."VDC",c."Cluster",c."Storage_Policy"
)
select
c."Organization"
,c."VDC"
,c."VDC_CPU_Reserv"
,c."Cluster"
,c.ram
,c.ram_on
,c.cpu
,c.cpu_on
,s."Storage_Policy"
,s.disk_alloc
,s.disk_used
from compute c
full outer join storage s on (c."Organization_UUID"=s."Organization_UUID" AND c."VDC"=s."VDC")
</cfquery> --->
<cfoutput> <cfoutput>
<h3>Услуги по данным CRM (версии строк спецификации, только актуальные на сегодня) <!--- (#qService.recordCount#) ---></h3> <h3>Услуги по данным CRM (версии строк спецификации, только актуальные на сегодня) <!--- (#qService.recordCount#) ---></h3>
</cfoutput> </cfoutput>
@@ -227,6 +181,7 @@
<th width="3%">Модель оплаты</th> <th width="3%">Модель оплаты</th>
<th width="5%">Дата НОУ</th> <th width="5%">Дата НОУ</th>
<th width="5%">date_end</th> <th width="5%">date_end</th>
<th width="5%">Вер.%</th>
<th width="10%">Дополнительное соглашение</th> <th width="10%">Дополнительное соглашение</th>
</tr> </tr>
</thead> </thead>
@@ -270,6 +225,7 @@
<td class="c">#__index#</td> ---> <td class="c">#__index#</td> --->
<td class="c">#dateFormat(date_nop,'YYYY-MM-DD')#</td> <td class="c">#dateFormat(date_nop,'YYYY-MM-DD')#</td>
<td class="c<cfif isDate(date_end) AND date_end LT Now()> err</cfif>">#dateFormat(date_end,'YYYY-MM-DD')#</td> <td class="c<cfif isDate(date_end) AND date_end LT Now()> err</cfif>">#dateFormat(date_end,'YYYY-MM-DD')#</td>
<td class="#probability_pc#</td>
<td class="c"><a href="additional_agreement.cfm?__id=#additional_agreement_uid#&#tr.fwx#">#additional_agreement#</a> (#status_id# #status#)</td> <td class="c"><a href="additional_agreement.cfm?__id=#additional_agreement_uid#&#tr.fwx#">#additional_agreement#</a> (#status_id# #status#)</td>
</tr> </tr>
</cfoutput> </cfoutput>
+10 -11
View File
@@ -60,15 +60,15 @@ WITH
AND siv."__deletedAt" IS NULL AND siv."__deletedAt" IS NULL
and d."__deletedAt" IS NULL and d."__deletedAt" IS NULL
and a."__deletedAt" IS NULL and a."__deletedAt" IS NULL
and a.is_actual --and a.is_actual
and siv.type IN (2,3) and siv.type IN (2,3)
), ),
component as component as
( (
SELECT SELECT
price*cnt*(100.0-COALESCE(discount,0))/100.0 as cost , -- price*cnt*(100.0-COALESCE(discount,0))/100.0 as cost ,
price , -- price ,
cnt , cnt ,
code , code ,
__id __id
FROM FROM
@@ -93,8 +93,7 @@ WITH
) t ) t
WHERE WHERE
t.dt_from = t.running_min_dt t.dt_from = t.running_min_dt
AND t.dt_to > CURRENT_TIMESTAMP AND ( t.dt_to > CURRENT_TIMESTAMP OR t.dt_to IS NULL )
OR t.dt_to IS NULL
), ),
alloc as alloc as
( (
@@ -129,7 +128,7 @@ WITH
z.__id as company_uid, z.__id as company_uid,
round(sum(c.cnt*o.cnt)) as quantity , round(sum(c.cnt*o.cnt)) as quantity ,
count(*) as lines , count(*) as lines ,
STRING_AGG( distinct c.code,', ' order by c.code) as codes STRING_AGG(distinct c.code,', ' order by c.code) as codes
FROM FROM
stair o stair o
JOIN elma.companies z on o._companies=z.__id JOIN elma.companies z on o._companies=z.__id
@@ -153,7 +152,7 @@ WITH
z.__id as company_uid, z.__id as company_uid,
round(sum(c.cnt*o.cnt)) as quantity , round(sum(c.cnt*o.cnt)) as quantity ,
count(*) as lines , count(*) as lines ,
STRING_AGG(c.code,', ' order by c.code) as codes STRING_AGG(distinct c.code,', ' order by c.code) as codes
FROM FROM
stair o stair o
JOIN JOIN
@@ -161,8 +160,8 @@ WITH
LEFT JOIN component c on c.__id = o.param_id LEFT JOIN component c on c.__id = o.param_id
--LEFT JOIN component c on (c.__id = ANY (o.params)) --LEFT JOIN component c on (c.__id = ANY (o.params))
WHERE WHERE
c.code SIMILAR TO 'iaas.(ngc|dcp).%.vcpu%-_' --c.code SIMILAR TO 'iaas.(ngc|dcp).%.vcpu%-_'
--(c.code LIKE 'iaas.ngc.%.vcpu%-_' OR c.code LIKE 'iaas.dcp.%.vcpu%-_') (c.code LIKE 'iaas.ngc.%.vcpu%-_' OR c.code LIKE 'iaas.dcp.%.vcpu%-_')
AND c.cnt <> 0 AND c.cnt <> 0
AND o.cnt <> 0 AND o.cnt <> 0
GROUP BY GROUP BY
@@ -178,7 +177,7 @@ WITH
z.__id as company_uid, z.__id as company_uid,
round(sum(c.cnt*o.cnt)) as quantity , round(sum(c.cnt*o.cnt)) as quantity ,
count(*) as lines , count(*) as lines ,
STRING_AGG(c.code,', ' order by c.code) as codes STRING_AGG(distinct c.code,', ' order by c.code) as codes
FROM FROM
stair o stair o
JOIN elma.companies z on (o._companies=z.__id) JOIN elma.companies z on (o._companies=z.__id)
+1 -1
View File
@@ -157,7 +157,7 @@ select count(*) as cnt from elma.deals d where 1=1
</cfsavecontent> </cfsavecontent>
<cfsavecontent variable="qRead.f_contragent"> <cfsavecontent variable="qRead.f_contragent">
<a href="contragent.cfm?__id=#contragent_uid#&#tr.fwx#">#contragent#</a> <a href="contragent.cfm?__id=#contragent_uid#&#tr.fwx#">#contragent#</a> <a href="contragent_rpt.cfm?__id=#contragent_uid#&#tr.fwx#" style="float:right"><img src="img/view.gif" title="сводка по контрагенту"/></a>
</cfsavecontent> </cfsavecontent>
</cfoutput> </cfoutput>
+23 -21
View File
@@ -10,7 +10,7 @@
<cfquery name="qVM"> <cfquery name="qVM" cachedWithin=#createTimeSpan(0, 0, 25, 0)#>
select "Name", "Object_UUID", "UUID_VM", select "Name", "Object_UUID", "UUID_VM",
"VDC", "Organization_UUID", "Organization", "WZ", "Cluster", "Host", "VDC", "Organization_UUID", "Organization", "WZ", "Cluster", "Host",
"Host_Model", "CPU_Model", "Host_CPU_Cores", "Host_CPU_Sockets", "Host_CPU_Speed", "Host_RAM", "Host_Model", "CPU_Model", "Host_CPU_Cores", "Host_CPU_Sockets", "Host_CPU_Speed", "Host_RAM",
@@ -18,10 +18,12 @@ select "Name", "Object_UUID", "UUID_VM",
"VDC_CPU_Reserv", "VDC_CPU_Speed", "VDC_CPU_Reserv", "VDC_CPU_Speed",
"VM_vCPU_count", "VM_CPU_Used", "VM_CPU_Used_AVG", "VM_CPU_Reserv_GHz", "VM_CPU_Reserv_perc", "VM_vCPU_count", "VM_CPU_Used", "VM_CPU_Used_AVG", "VM_CPU_Reserv_GHz", "VM_CPU_Reserv_perc",
"VM_RAM_Allocated", "VM_RAM_Used", "VM_RAM_Allocated", "VM_RAM_Used",
"VM_is_ON" "VM_is_ON",
from vmreports.compute k.__id as company_uid
where ts=(select max(ts) from vmreports.compute) from vmreports.compute c
order by "WZ" left outer join elma.companies k ON (lower(k.id_klienta)=lower(c."WZ"))
where c.ts=(select max(ts) from vmreports.compute)
--order by "WZ"
</cfquery> </cfquery>
<!--- <cfdump var=#qVM# abort=true/> ---> <!--- <cfdump var=#qVM# abort=true/> --->
@@ -67,12 +69,13 @@ S3 операции и трафик: <b>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-M
<a href="#request.thisPage#?output_json" title="экспорт в json" style="margin-left:.5em; height:100%;" target="_blank"><img src="img/json.svg" style="vertical-align:text-bottom;" width="13" height="13"/></a> <a href="#request.thisPage#?output_json" title="экспорт в json" style="margin-left:.5em; height:100%;" target="_blank"><img src="img/json.svg" style="vertical-align:text-bottom;" width="13" height="13"/></a>
</cfoutput> </cfoutput>
<cfoutput><b>#qVM.recordCount#</b></cfoutput>
<table class="worktable"> <table class="worktable">
<thead> <thead>
<tr> <tr>
<th width="7%">WZ</th> <th width="5%">WZ</th>
<th width="10%">Имя</th> <th width="5%">Имя</th>
<th width="7%">Уникальное имя</th> <th width="5%">Уникальное имя</th>
<th width="3%">Organization</th> <th width="3%">Organization</th>
@@ -83,8 +86,8 @@ S3 операции и трафик: <b>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-M
<th width="3%">Cluster</th> <th width="3%">Cluster</th>
<th width="3%">Host</th> <th width="3%">Host</th>
<th width="3%">Host Model</th> <th width="7%">Host Model</th>
<th width="3%">CPU Model</th> <th width="7%">CPU Model</th>
<th width="3%">Host CPU Cores</th> <th width="3%">Host CPU Cores</th>
<th width="3%">Host CPU Sockets</th> <th width="3%">Host CPU Sockets</th>
<th width="3%">Host CPU Speed GHz</th> <th width="3%">Host CPU Speed GHz</th>
@@ -111,14 +114,14 @@ S3 операции и трафик: <b>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-M
<tr> <tr>
<td>#WZ#</td> <td><a href="contragent.cfm?__id=#company_uid#&#tr.fwx#">#WZ#</a><a href="contragent_rpt.cfm?__id=#company_uid#&#tr.fwx#" style="float:right"><img src="img/view.gif" title="сводка по контрагенту"/></a></td>
<td>#Name#</td> <td>#Name#</td>
<td>#UUID_VM#</td> <td>#UUID_VM#</td>
<td>#Organization#</td> <td>#Organization#</td>
<td>#VDC#</td> <td>#VDC#</td>
<td>#VDC_CPU_Reserv#</td> <td><cftry>#round(VDC_CPU_Reserv,3)#<cfcatch></cfcatch></cftry></td>
<td>#VDC_CPU_Speed#</td> <td><cftry>#round(VDC_CPU_Speed,3)#<cfcatch></cfcatch></cftry></td>
<td>#qVM.Cluster#</td> <td>#qVM.Cluster#</td>
@@ -128,19 +131,18 @@ S3 операции и трафик: <b>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-M
<td>#Host_CPU_Cores#</td> <td>#Host_CPU_Cores#</td>
<td>#Host_CPU_Sockets#</td> <td>#Host_CPU_Sockets#</td>
<td>#round(Host_CPU_Speed,3)#</td> <td>#round(Host_CPU_Speed,3)#</td>
<td>#Host_RAM#</td> <td>#round(Host_RAM)#</td>
<td>#Host_CPU_Used#</td> <td><cftry>#round(Host_CPU_Used,1)#<cfcatch></cfcatch></cftry></td>
<td>#Host_CPU_Used_Avg#</td> <td><cftry>#round(Host_CPU_Used_Avg,1)#<cfcatch></cfcatch></cftry></td>
<td>#VM_vCPU_count#</td> <td>#VM_vCPU_count#</td>
<td>#VM_CPU_Used#</td> <td><cftry>#round(VM_CPU_Used,1)#<cfcatch></cfcatch></cftry></td>
<td>#VM_CPU_Used_AVG#</td> <td><cftry>#round(VM_CPU_Used_AVG,1)#<cfcatch></cfcatch></cftry></td>
<td>#VM_CPU_Reserv_GHz#</td> <td><cftry>#round(VM_CPU_Reserv_GHz,1)#<cfcatch></cfcatch></cftry></td>
<td>#VM_CPU_Reserv_GHz#</td>
<td>#VM_CPU_Reserv_perc#</td> <td>#VM_CPU_Reserv_perc#</td>
<td>#VM_RAM_Allocated#</td> <td>#VM_RAM_Allocated#</td>
<td>#VM_RAM_Used#</td> <td><cftry>#round(VM_RAM_Used)#<cfcatch></cfcatch></cftry></td>
<td>#VM_is_ON#</td> <td>#VM_is_ON#</td>