034 alpha
This commit is contained in:
+1
-1
@@ -76,7 +76,7 @@
|
||||
<!--- global settings --->
|
||||
|
||||
<cfset request.RECORDS_PER_PAGE=500/>
|
||||
<cfset request.APP_VERSION="0.00.033"/>
|
||||
<cfset request.APP_VERSION="0.00.034"/>
|
||||
<cfset request.STAND=getStand()/>
|
||||
|
||||
<cflock scope="application" type="readonly" timeout=3>
|
||||
|
||||
+207
-52
@@ -79,45 +79,30 @@
|
||||
<div class="detail">
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">__id</div>
|
||||
<div class="th">ID</div>
|
||||
<div class="td">#d.__id#</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">__name</div>
|
||||
<div class="td">#d.__name# <a href="contragent.cfm?__id=#d.__id#&#tr.fwx#">подробнее...</a></div>
|
||||
<div class="th">Контрагент</div>
|
||||
<div class="td">#d.__name# <a href="contragent.cfm?__id=#d.__id#&#tr.fwx#">подробнее (из Элмы)...</a></div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">_inn</div>
|
||||
<div class="th">ИНН</div>
|
||||
<div class="td">#d._inn#</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">_kpp</div>
|
||||
<div class="th">КПП</div>
|
||||
<div class="td">#d._kpp#</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">id_klienta</div>
|
||||
<div class="th">WZ</div>
|
||||
<div class="td">#d.id_klienta#</div>
|
||||
</div>
|
||||
|
||||
<!--- <div class="tr">
|
||||
<div class="th">wz_id</div>
|
||||
<div class="td">#d.wz_id#"/></div>
|
||||
</div> --->
|
||||
|
||||
<!--- <div class="tr">
|
||||
<div class="th">code_inn</div>
|
||||
<div class="td">#d.code_inn#"/></div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">code_kpp</div>
|
||||
<div class="td">#d.code_kpp#"/></div>
|
||||
</div> --->
|
||||
|
||||
</div>
|
||||
|
||||
</cfoutput>
|
||||
@@ -160,7 +145,9 @@
|
||||
,p.__id as p_uid
|
||||
,p.name
|
||||
,s.probability_pc
|
||||
,d.__index
|
||||
,s.status_id
|
||||
,s.status
|
||||
,d.__index as deal_index
|
||||
,d.__id as deal_uid
|
||||
from elma.deals_services siv
|
||||
join elma.deals d on d.__id=ANY(siv.deal)
|
||||
@@ -172,40 +159,83 @@
|
||||
AND a.is_actual
|
||||
AND date_nop <= CURRENT_TIMESTAMP
|
||||
AND COALESCE(date_end,CURRENT_TIMESTAMP) >= CURRENT_TIMESTAMP
|
||||
order by version::int
|
||||
ORDER BY __index --, version::int
|
||||
</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>
|
||||
<h4>Услуги (версии строк спецификации, только актуальные) <!--- (#qService.recordCount#) ---></h4>
|
||||
<h3>Услуги по данным CRM (версии строк спецификации, только актуальные на сегодня) <!--- (#qService.recordCount#) ---></h3>
|
||||
</cfoutput>
|
||||
|
||||
<!--- <layout:render_query query=#qService#/> --->
|
||||
|
||||
<table class="worktable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>__index</th>
|
||||
<!--- <th>__name</th> --->
|
||||
<th width="20%">user_description</th>
|
||||
<th width="25%">Компоненты</th>
|
||||
<th>Кол-во</th>
|
||||
<!--- <th>Скидка%</th> --->
|
||||
<th width="3%">__index</th>
|
||||
<th width="5%">Код</th>
|
||||
<th width="20%">Пользовательское наименование</th>
|
||||
<th width="30%">Компоненты</th>
|
||||
<th width="3%">Кол-во</th>
|
||||
<th width="5%">Сумма</th>
|
||||
<th>Код</th>
|
||||
<th>type</th>
|
||||
<!--- <th>is_actual</th>
|
||||
<th>hash</th>
|
||||
<th>version</th>
|
||||
<th>__index</th> --->
|
||||
<th width="5%">date_nop</th>
|
||||
<th width="3%">Модель оплаты</th>
|
||||
<th width="5%">Дата НОУ</th>
|
||||
<th width="5%">date_end</th>
|
||||
<th width="7%">additional_agreement</th>
|
||||
<th width="10%">Дополнительное соглашение</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<cfoutput query="qService" group="__index">
|
||||
<tr>
|
||||
<tr<cfif NOT left(abstractive_service_code,4) EQ "iaas"> class="gray"</cfif>>
|
||||
<td class="c"><a href="deal_service.cfm?__id=#__id#&#tr.fwx#" title="__id">#__index#</a></td>
|
||||
<!--- <td class="c">#__name#</td> --->
|
||||
<td class="l">#abstractive_service_code#.#modifier_code#</td>
|
||||
<td class="l">#user_description#</td>
|
||||
<td>
|
||||
<table class="wide">
|
||||
@@ -215,10 +245,9 @@
|
||||
<tr>
|
||||
<td class="nw">#code#</td>
|
||||
<td>#name#</td>
|
||||
<td>#p_cnt#</td>
|
||||
<td>#ed_izm#</td>
|
||||
<td class="r nw">#nFmt(price,3)#</td>
|
||||
<td class="r">#p_discount#%</td>
|
||||
<td class="r">#p_cnt#</td>
|
||||
<td class="c">#ed_izm#</td>
|
||||
<td class="r">#nFmt(price*p_cnt*(100-(isNumeric(p_discount)?p_discount:0))/100, 2)#</td>
|
||||
</tr>
|
||||
<cfset cost+=price*p_cnt*(100-(isNumeric(p_discount)?p_discount:0))/100 />
|
||||
</cfif>
|
||||
@@ -226,29 +255,155 @@
|
||||
</table>
|
||||
</td>
|
||||
<td class="c">#cnt#</td>
|
||||
<!--- <td class="c">#discount#%</td> --->
|
||||
<td class="r">#nFmt(cost*cnt*(100-(isNumeric(discount)?discount:0))/100)#</td>
|
||||
<td class="l">
|
||||
#abstractive_service_code#.#modifier_code#
|
||||
|
||||
<td class="c">
|
||||
<cfswitch expression=#type#>
|
||||
<cfcase value=1>install</cfcase>
|
||||
<cfcase value=2>fix</cfcase>
|
||||
<cfcase value=3>payg</cfcase>
|
||||
</cfswitch> (#type#)
|
||||
</td>
|
||||
<td class="c">#type#</td>
|
||||
<!--- <td class="c">#is_actual#</td>
|
||||
<td class="c">#hash#</td>
|
||||
<td class="c">#version#</td>
|
||||
<td class="c">#__index#</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"><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> (#status_id# #status#)</td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
</table>
|
||||
|
||||
<cfquery name="qCompute">
|
||||
select
|
||||
c."Organization_UUID"::text
|
||||
,c."Organization"
|
||||
,c."VDC"
|
||||
,c."VDC_CPU_Reserv"
|
||||
,"Cluster"
|
||||
, round(sum(c."VM_RAM_Allocated")) as ram
|
||||
, round(sum(CASE WHEN "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 "VM_is_ON" > 0 THEN c."VM_vCPU_count" ELSE 0 END)) as cpu_on
|
||||
, round(avg(c."VDC_CPU_Speed")::numeric,1) as ghz
|
||||
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"
|
||||
</cfquery>
|
||||
|
||||
<cfquery name="qCompute_total" dbtype="query">
|
||||
select
|
||||
sum(ram) as ram
|
||||
,sum(ram_on) as ram_on
|
||||
,sum(cpu) as cpu
|
||||
,sum(cpu_on) as cpu_on
|
||||
FROM qCompute
|
||||
</cfquery>
|
||||
|
||||
<h3>Compute факт</h3>
|
||||
<table class="worktable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="10%">Организация</th>
|
||||
<th width="10%">VDC</th>
|
||||
<th width="3%">Резерв %</th>
|
||||
<th width="10%">Кластер</th>
|
||||
<th width="3%">GHz</th>
|
||||
<th width="5%">CPU cores</th>
|
||||
<th width="5%">CPU_ON cores</th>
|
||||
<th width="5%">RAM GB</th>
|
||||
<th width="5%">RAM_ON GB</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<cfoutput query="qCompute">
|
||||
<tr>
|
||||
<td>#Organization#</td>
|
||||
<td>#VDC#</td>
|
||||
<td class="c">#VDC_CPU_Reserv#</td>
|
||||
<td>#qCompute.Cluster#</td>
|
||||
<td class="c">#ghz#</td>
|
||||
<td class="r">#cpu#</td>
|
||||
<td class="r">#cpu_on#</td>
|
||||
<td class="r">#ram#</td>
|
||||
<td class="r">#ram_on#</td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
|
||||
<cfoutput query="qCompute_total">
|
||||
<tr>
|
||||
<td colspan="5" class="r b">Итого:</td>
|
||||
<td class="r b">#cpu#</td>
|
||||
<td class="r b">#cpu_on#</td>
|
||||
<td class="r b">#ram#</td>
|
||||
<td class="r b">#ram_on#</td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
</table>
|
||||
|
||||
|
||||
<!--- ----------------------------------------------------------------- --->
|
||||
<!--- ----------------------------------------------------------------- --->
|
||||
<!--- ----------------------------------------------------------------- --->
|
||||
|
||||
<cfquery name="qStorage">
|
||||
select
|
||||
"Organization_UUID"::text
|
||||
,"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"
|
||||
</cfquery>
|
||||
|
||||
<cfquery name="qStorage_total" dbtype="query">
|
||||
select
|
||||
sum(disk_alloc) as disk_alloc
|
||||
,sum(disk_used) as disk_used
|
||||
FROM qStorage
|
||||
</cfquery>
|
||||
|
||||
<h3>Storage факт</h3>
|
||||
<table class="worktable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="10%">Организация</th>
|
||||
<th width="10%">VDC</th>
|
||||
<th width="10%">Кластер</th>
|
||||
<th width="10%">Политика хранения</th>
|
||||
<th width="5%">Выделено GB</th>
|
||||
<th width="5%">Используется GB</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<cfoutput query="qStorage">
|
||||
<tr>
|
||||
<td>#Organization#</td>
|
||||
<td>#VDC#</td>
|
||||
<td>#qCompute.Cluster#</td>
|
||||
<td>#Storage_Policy#</td>
|
||||
<td class="r">#disk_alloc#</td>
|
||||
<td class="r">#disk_used#</td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
<cfoutput query="qStorage_total">
|
||||
<tr>
|
||||
<td colspan="4" class="r b">Итого:</td>
|
||||
<td class="r b">#disk_alloc#</td>
|
||||
<td class="r b">#disk_used#</td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
</table>
|
||||
|
||||
<!--- ----------------------------------------------------------------- --->
|
||||
<!--- ----------------------------------------------------------------- --->
|
||||
<!--- ----------------------------------------------------------------- --->
|
||||
<!--- <cfdump var=#qCompute#/>
|
||||
<cfdump var=#qStorage#/> --->
|
||||
|
||||
</cfif><!--- len(d.__id) --->
|
||||
<layout:page section="footer"/>
|
||||
+22
-18
@@ -7,7 +7,7 @@
|
||||
|
||||
<m:prepare_ls entity="crm2cloud" settingsKey="crm2cloud" accessObject="" pageInfoOut="pageInfo" trackOut="tr"/>
|
||||
|
||||
|
||||
<!--- *** нуждается в оптимизации, чтобы фильтр по контрагенту ускорял селект --->
|
||||
<cfquery name="qRead">
|
||||
WITH
|
||||
status(status, status_id, probability_pc) as (VALUES
|
||||
@@ -105,7 +105,9 @@ WHERE c.code SIMILAR TO 'iaas.ngc.%.(ssd|fstssd|sata)-_' AND c.cnt <> 0 AND o.cn
|
||||
GROUP BY z.id_klienta, z.__id, z.__name
|
||||
),
|
||||
deal_stat as (
|
||||
select STRING_AGG(distinct deal_status_id::text,', ') as status_ids
|
||||
select
|
||||
STRING_AGG(distinct deal_status_id::text,', ') as status_ids
|
||||
,STRING_AGG(distinct line_pricing_model_id::text,', ') as line_pricing_model_ids
|
||||
,z.id_klienta as WZ
|
||||
from line o join elma.companies z on (o._companies=z.__id)
|
||||
GROUP BY z.id_klienta
|
||||
@@ -118,6 +120,7 @@ select
|
||||
<d:field>r.company_uid</d:field>
|
||||
<d:field title="WZ Cloud">a.wz as wz_alloc</d:field>
|
||||
<d:field title="Статусы">ds.status_ids</d:field>
|
||||
<d:field title="Модели оплаты">ds.line_pricing_model_ids</d:field>
|
||||
<d:field title="Коды RAM">r.codes as ram_codes</d:field>
|
||||
<d:field title="RAM GB Elma">r.quantity as ram_sold</d:field>
|
||||
<d:field title="RAM Cloud">a.ram as ram_alloc</d:field>
|
||||
@@ -131,17 +134,16 @@ select
|
||||
<d:field title="Диски Cloud">da.disk_alloc</d:field>
|
||||
<d:field>z.__name as alloc_company</d:field>
|
||||
<d:field>z.__id as alloc_company_uid</d:field>
|
||||
|
||||
</d:field_set>
|
||||
from sold_ram r
|
||||
join deal_stat ds on (r.wz=ds.wz)
|
||||
join sold_cpu c on (r.wz=c.wz)
|
||||
left join sold_disk d on (r.wz=d.wz)
|
||||
full join alloc a on (r.wz=a.wz)
|
||||
join deal_stat ds on (lower(r.wz)=lower(ds.wz))
|
||||
join sold_cpu c on (lower(r.wz)=lower(c.wz))
|
||||
left join sold_disk d on (lower(r.wz)=lower(d.wz))
|
||||
full join alloc a on (lower(r.wz)=lower(a.wz))
|
||||
left join disk_alloc da on (a.wz=da.wz)
|
||||
left join elma.companies z on (lower(a.wz)=lower(z.id_klienta))
|
||||
where 1=1 <m:filter_build filter=#pageInfo.settings.filter#/>
|
||||
order by 1,3
|
||||
order by <m:order_build sortArray=#pageInfo.settings.sort.sortArray# fieldCount=#fieldCount#/>
|
||||
</cfquery>
|
||||
|
||||
|
||||
@@ -198,17 +200,18 @@ S3 операции и трафик: <b>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-M
|
||||
<th width="10%"><layout:column_head name="client_sold"/></th>
|
||||
<th width="5%"><layout:column_head name="wz_alloc"/></th>
|
||||
<th width="3%"><layout:column_head name="status_ids"/></th>
|
||||
|
||||
<th width="10%"><layout:column_head name="ram_codes"/></th>
|
||||
<th width="3%"><layout:column_head name="ram_sold"/></th>
|
||||
<th width="3%"><layout:column_head name="ram_alloc"/></th>
|
||||
<th width="3%"><layout:column_head name="ram_alloc_on"/></th>
|
||||
<th width="3%"><layout:column_head name="line_pricing_model_ids"/></th>
|
||||
|
||||
<th width="10%"><layout:column_head name="cpu_codes"/></th>
|
||||
<th width="3%"><layout:column_head name="cpu_sold"/></th>
|
||||
<th width="3%"><layout:column_head name="cpu_alloc"/></th>
|
||||
<th width="3%"><layout:column_head name="cpu_alloc_on"/></th>
|
||||
|
||||
<th width="10%"><layout:column_head name="ram_codes"/></th>
|
||||
<th width="3%"><layout:column_head name="ram_sold"/></th>
|
||||
<th width="3%"><layout:column_head name="ram_alloc"/></th>
|
||||
<th width="3%"><layout:column_head name="ram_alloc_on"/></th>
|
||||
|
||||
<th width="10%"><layout:column_head name="disk_codes"/></th>
|
||||
<th width="3%"><layout:column_head name="disk_sold"/></th>
|
||||
<th width="3%"><layout:column_head name="disk_alloc"/></th>
|
||||
@@ -232,17 +235,18 @@ S3 операции и трафик: <b>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-M
|
||||
</td>
|
||||
<td>#wz_alloc#</td>
|
||||
<td>#status_ids#</td>
|
||||
|
||||
<td>#ram_codes#</td>
|
||||
<td class="r"<cfif ram_sold GT ram_alloc> style="background:lightgreen;"</cfif>>#ram_sold#</td>
|
||||
<td class="r"<cfif ram_sold LT ram_alloc> style="background:lightcoral;"</cfif>>#ram_alloc#</td>
|
||||
<td class="r"<cfif ram_sold LT ram_alloc_on> style="background:lightcoral;"</cfif>>#ram_alloc_on#</td>
|
||||
<td>#line_pricing_model_ids#</td>
|
||||
|
||||
<td>#cpu_codes#</td>
|
||||
<td class="r"<cfif cpu_sold GT ram_alloc> style="background:lightgreen;"</cfif>>#cpu_sold#</td>
|
||||
<td class="r"<cfif cpu_sold LT cpu_alloc> style="background:lightcoral;"</cfif>>#cpu_alloc#</td>
|
||||
<td class="r"<cfif cpu_sold LT cpu_alloc_on> style="background:lightcoral;"</cfif>>#cpu_alloc_on#</td>
|
||||
|
||||
<td>#ram_codes#</td>
|
||||
<td class="r"<cfif ram_sold GT ram_alloc> style="background:lightgreen;"</cfif>>#ram_sold#</td>
|
||||
<td class="r"<cfif ram_sold LT ram_alloc> style="background:lightcoral;"</cfif>>#ram_alloc#</td>
|
||||
<td class="r"<cfif ram_sold LT ram_alloc_on> style="background:lightcoral;"</cfif>>#ram_alloc_on#</td>
|
||||
|
||||
<td>#disk_codes#</td>
|
||||
<td class="r"<cfif disk_sold GT disk_alloc> style="background:lightgreen;"</cfif>>#disk_sold#</td>
|
||||
<td class="r"<cfif disk_sold LT disk_alloc> style="background:lightcoral;"</cfif>>#disk_alloc#</td>
|
||||
|
||||
@@ -246,6 +246,8 @@ button.maincontrol:hover {
|
||||
|
||||
.err {color: red;}
|
||||
.warn {color: #f80;}
|
||||
.gray, tr.gray td {color:lightgray;}
|
||||
.gray a, tr.gray td a, tr.gray td a:link, tr.gray td a:visited {color: #aad;}
|
||||
|
||||
a.up {background: url('../img/up.gif') center right no-repeat; padding-right: 7px;}
|
||||
a.add {background: url('../img/add.gif') center right no-repeat; width:13px; height:13px; display:inline-block;}
|
||||
|
||||
Reference in New Issue
Block a user