046 versioning fixes
This commit is contained in:
+1
-1
@@ -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.045"/>
|
<cfset request.APP_VERSION="0.00.046"/>
|
||||||
<cfset request.STAND=getStand()/>
|
<cfset request.STAND=getStand()/>
|
||||||
|
|
||||||
<cflock scope="application" type="readonly" timeout=3>
|
<cflock scope="application" type="readonly" timeout=3>
|
||||||
|
|||||||
+125
-56
@@ -111,60 +111,127 @@
|
|||||||
|
|
||||||
<cfif len(d.__id)>
|
<cfif len(d.__id)>
|
||||||
|
|
||||||
|
|
||||||
<cfquery name="qService">
|
<cfquery name="qService">
|
||||||
with
|
with
|
||||||
status(status, status_id, probability_pc) as (VALUES
|
status(status, status_id, probability_pc) as (VALUES
|
||||||
('Закрыта неуспешно',7,0),('Закрыта успешно',6,100),('Договор подписан',5,100),('Договор на подписании',15,90),('Договор на согласовании',12,70),
|
('Закрыта неуспешно',7,0),('Закрыта успешно',6,100),('Договор подписан',5,100),('Договор на подписании',15,90),('Договор на согласовании',12,70),
|
||||||
('Тестирование',8,50),('Отправлено ТКП',10,20),('Внутреннее согласование',37,10),('Проработка решения',4,10),('Сбор потребностей',1,0)
|
('Тестирование',8,50),('Отправлено ТКП',10,20),('Внутреннее согласование',37,10),('Проработка решения',4,10),('Сбор потребностей',1,0)
|
||||||
)
|
)
|
||||||
select
|
,line_expanded
|
||||||
siv.__id
|
AS (
|
||||||
,siv.__name
|
SELECT siv.__id AS siv_uid
|
||||||
,siv.user_description
|
,siv.discount
|
||||||
,siv.discount
|
,siv.type AS line_pricing_model_id
|
||||||
,siv.cnt
|
,siv.hash AS line_key
|
||||||
,siv.modifier_code
|
,siv.is_actual AS siv_is_actual
|
||||||
,siv.abstractive_service_code
|
,siv.version::NUMERIC AS line_version
|
||||||
,siv.is_actual
|
,siv.modifier_code
|
||||||
,siv.type
|
,siv.abstractive_service_code
|
||||||
,siv.hash
|
,siv.__index AS siv_index
|
||||||
,siv.version
|
,d.__index AS deal_index
|
||||||
,siv.__index
|
,d._companies
|
||||||
,siv.date_nop
|
,a.index AS agreement_version
|
||||||
,siv.date_end
|
,siv.date_nop::DATE AS dt_from
|
||||||
,siv.is_easy
|
,siv.date_end::DATE AS dt_to
|
||||||
,siv.params::text
|
,siv.is_easy AS is_simple
|
||||||
,a.__id::text as additional_agreement_uid
|
,siv.cnt
|
||||||
,a.__name as additional_agreement
|
,s.probability_pc
|
||||||
,p.price
|
,a.__id AS additional_agreement_uid
|
||||||
,p.cnt as p_cnt
|
,a.contract_uid
|
||||||
,p.ed_izm
|
,a.is_actual AS additional_agreement_is_actual
|
||||||
,p.code
|
,a.deal_uid
|
||||||
,p.discount as p_discount
|
,a.__name AS additional_agreement
|
||||||
,p.__id as p_uid
|
,d.__name AS deal
|
||||||
,p.name
|
,d.__status_status AS deal_status_id
|
||||||
,s.probability_pc
|
,siv.user_description --
|
||||||
,s.status_id
|
,siv.params
|
||||||
,s.status
|
FROM elma.deals_services siv
|
||||||
,d.__index as deal_index
|
JOIN elma.deals d ON (d.__id = ANY (siv.deal))
|
||||||
,d.__id as deal_uid
|
JOIN STATUS s ON (d.__status_status = s.status_id)
|
||||||
from elma.deals_services siv
|
LEFT JOIN elma.additional_agreements a ON (a.__id = ANY (siv.additional_agreement))
|
||||||
join elma.deals d on d.__id=ANY(siv.deal)
|
WHERE siv.is_actual
|
||||||
join status s on (d.__status_status=s.status_id)
|
AND siv."__deletedAt" IS NULL
|
||||||
join elma.service_parametrs p ON (p.__id = ANY (siv.params) AND p."__deletedAt" IS NULL)
|
AND d."__deletedAt" IS NULL
|
||||||
left outer join elma.additional_agreements a on (a.__id=ANY(siv.additional_agreement))
|
AND a."__deletedAt" IS NULL
|
||||||
where d._companies=<cfqueryparam cfsqltype="cf_sql_other" value="#d.__id#" null=#!isValid("guid",d.__id)#/>
|
AND s.probability_pc >= 50
|
||||||
AND siv.is_actual
|
--and a.is_actual *** возможно схема версионности противоречива
|
||||||
--AND a.is_actual
|
AND siv.type IN (2, 3)
|
||||||
--AND date_nop <= CURRENT_TIMESTAMP
|
AND d._companies = <cfqueryparam cfsqltype="cf_sql_other" value=#d.__id#/><!--- '019503f2-5774-7768-b5c9-566a71daedaa' --->
|
||||||
AND COALESCE(date_end,CURRENT_TIMESTAMP) >= CURRENT_TIMESTAMP
|
)
|
||||||
AND s.probability_pc >=50
|
,component
|
||||||
ORDER BY __index --, version::int
|
AS (
|
||||||
|
SELECT cnt
|
||||||
|
,code
|
||||||
|
,__id
|
||||||
|
,price
|
||||||
|
,ed_izm
|
||||||
|
,discount
|
||||||
|
,name
|
||||||
|
FROM elma.service_parametrs
|
||||||
|
WHERE "__deletedAt" IS NULL
|
||||||
|
)
|
||||||
|
,stair
|
||||||
|
AS (
|
||||||
|
SELECT *
|
||||||
|
FROM (
|
||||||
|
SELECT *
|
||||||
|
,MIN(dt_from) OVER (
|
||||||
|
PARTITION BY line_key ORDER BY deal_index DESC
|
||||||
|
) running_min_dt
|
||||||
|
,COALESCE((
|
||||||
|
LEAD(dt_from) OVER (
|
||||||
|
PARTITION BY line_key ORDER BY dt_from
|
||||||
|
,deal_index
|
||||||
|
)
|
||||||
|
), (
|
||||||
|
SELECT CURRENT_TIMESTAMP + INTERVAL '1 day'
|
||||||
|
)) dt_next
|
||||||
|
FROM line_expanded
|
||||||
|
WHERE probability_pc > 0
|
||||||
|
) t
|
||||||
|
WHERE t.dt_from = t.running_min_dt
|
||||||
|
--AND ( t.dt_to > CURRENT_TIMESTAMP OR t.dt_to IS NULL )
|
||||||
|
)
|
||||||
|
SELECT d.siv_uid::text as siv_uid
|
||||||
|
,d.siv_index
|
||||||
|
,d.deal
|
||||||
|
,d.user_description
|
||||||
|
,d.discount
|
||||||
|
,d.cnt
|
||||||
|
,d.modifier_code
|
||||||
|
,d.abstractive_service_code
|
||||||
|
,d.additional_agreement_is_actual
|
||||||
|
,d.line_pricing_model_id
|
||||||
|
,d.line_key
|
||||||
|
,d.deal_index
|
||||||
|
,d.dt_from
|
||||||
|
,d.dt_to
|
||||||
|
,d.dt_next
|
||||||
|
,d.is_simple
|
||||||
|
,d.additional_agreement_uid::text as additional_agreement_uid
|
||||||
|
,d.additional_agreement
|
||||||
|
,d.deal_index
|
||||||
|
,d.deal_uid::text as deal_uid
|
||||||
|
|
||||||
|
,s.probability_pc
|
||||||
|
,s.status_id
|
||||||
|
,s.STATUS
|
||||||
|
|
||||||
|
,p.price
|
||||||
|
,p.cnt as p_cnt
|
||||||
|
,p.ed_izm
|
||||||
|
,p.code
|
||||||
|
,p.discount as p_discount
|
||||||
|
,p.__id::text as p_uid
|
||||||
|
,p.name
|
||||||
|
FROM stair d
|
||||||
|
JOIN status s ON (d.deal_status_id = s.status_id)
|
||||||
|
LEFT JOIN LATERAL unnest(d.params) AS arr(param_id) ON TRUE
|
||||||
|
JOIN component p ON (p.__id = arr.param_id)
|
||||||
|
WHERE d.dt_from <= CURRENT_TIMESTAMP AND (CURRENT_TIMESTAMP < d.dt_next)
|
||||||
</cfquery>
|
</cfquery>
|
||||||
|
|
||||||
|
<!--- <cfdump var=#qService#/> --->
|
||||||
|
|
||||||
<cfoutput>
|
<cfoutput>
|
||||||
<h3>Услуги по данным CRM (версии строк спецификации, только актуальные на сегодня, сделки с вероятностью от 50% (начиная с тестирования) <!--- (#qService.recordCount#) ---></h3>
|
<h3>Услуги по данным CRM (версии строк спецификации, только актуальные на сегодня, сделки с вероятностью от 50% (начиная с тестирования) <!--- (#qService.recordCount#) ---></h3>
|
||||||
</cfoutput>
|
</cfoutput>
|
||||||
@@ -173,6 +240,7 @@
|
|||||||
<table class="worktable">
|
<table class="worktable">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
<th width="3%">__index</th>
|
<th width="3%">__index</th>
|
||||||
<th width="5%">Код</th>
|
<th width="5%">Код</th>
|
||||||
<th width="20%">Пользовательское наименование</th>
|
<th width="20%">Пользовательское наименование</th>
|
||||||
@@ -184,13 +252,13 @@
|
|||||||
<th width="5%">date_end</th>
|
<th width="5%">date_end</th>
|
||||||
<th width="5%">Вер.%</th>
|
<th width="5%">Вер.%</th>
|
||||||
<th width="10%">Дополнительное соглашение</th>
|
<th width="10%">Дополнительное соглашение</th>
|
||||||
|
<th width="5%">Ключ строки</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<cfoutput query="qService" group="__index">
|
<cfoutput query="qService" group="siv_uid">
|
||||||
<tr<cfif NOT left(abstractive_service_code,4) EQ "iaas"> class="gray"</cfif>>
|
<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"><a href="deal_service.cfm?__id=#siv_uid#&#tr.fwx#">#siv_index#</a></td>
|
||||||
<!--- <td class="c">#__name#</td> --->
|
|
||||||
<td class="l">#abstractive_service_code#<cfif len(modifier_code)>.#modifier_code#</cfif></td>
|
<td class="l">#abstractive_service_code#<cfif len(modifier_code)>.#modifier_code#</cfif></td>
|
||||||
<td class="l">#user_description#</td>
|
<td class="l">#user_description#</td>
|
||||||
<td style="padding:0; vertical-align:bottom;">
|
<td style="padding:0; vertical-align:bottom;">
|
||||||
@@ -214,20 +282,19 @@
|
|||||||
<td class="r">#nFmt(cost*cnt*(100-(isNumeric(discount)?discount:0))/100)#</td>
|
<td class="r">#nFmt(cost*cnt*(100-(isNumeric(discount)?discount:0))/100)#</td>
|
||||||
|
|
||||||
<td class="c">
|
<td class="c">
|
||||||
<cfswitch expression=#type#>
|
<cfswitch expression=#line_pricing_model_id#>
|
||||||
<cfcase value=1>install</cfcase>
|
<cfcase value=1>install</cfcase>
|
||||||
<cfcase value=2>fix</cfcase>
|
<cfcase value=2>fix</cfcase>
|
||||||
<cfcase value=3>payg</cfcase>
|
<cfcase value=3>payg</cfcase>
|
||||||
</cfswitch> (#type#)
|
</cfswitch> (#line_pricing_model_id#)
|
||||||
</td>
|
</td>
|
||||||
<!--- <td class="c">#is_actual#</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">#__index#</td> --->
|
||||||
<td class="c">#dateFormat(date_nop,'YYYY-MM-DD')#</td>
|
<td class="c">#dateFormat(dt_from,'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(dt_to) AND dt_to LT Now()> err</cfif>">#dateFormat(dt_to,'YYYY-MM-DD')#</td>
|
||||||
<td class="c">#probability_pc#</td>
|
<td class="c">#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>
|
||||||
|
<td class="c">#line_key#</td>
|
||||||
</tr>
|
</tr>
|
||||||
</cfoutput>
|
</cfoutput>
|
||||||
</table>
|
</table>
|
||||||
@@ -330,7 +397,7 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="10%">Организация</th>
|
<th width="10%">Организация</th>
|
||||||
<th width="10%">Статус организации</th>
|
<!--- <th width="10%">Статус организации</th> --->
|
||||||
<th width="10%">VDC</th>
|
<th width="10%">VDC</th>
|
||||||
<th width="10%">Кластер</th>
|
<th width="10%">Кластер</th>
|
||||||
<th width="10%">Политика хранения</th>
|
<th width="10%">Политика хранения</th>
|
||||||
@@ -410,4 +477,6 @@
|
|||||||
<cfdump var=#qStorage#/> --->
|
<cfdump var=#qStorage#/> --->
|
||||||
|
|
||||||
</cfif><!--- len(d.__id) --->
|
</cfif><!--- len(d.__id) --->
|
||||||
|
<br/><br/>
|
||||||
|
добавить реестр GPU и VDC для поиска потеряшек
|
||||||
<layout:page section="footer"/>
|
<layout:page section="footer"/>
|
||||||
+240
-229
@@ -24,234 +24,246 @@ WITH
|
|||||||
('Внутреннее согласование',37,10),
|
('Внутреннее согласование',37,10),
|
||||||
('Проработка решения',4,10) ,
|
('Проработка решения',4,10) ,
|
||||||
('Сбор потребностей',1,0)
|
('Сбор потребностей',1,0)
|
||||||
),
|
)
|
||||||
line_expanded as
|
,line
|
||||||
(
|
AS (
|
||||||
SELECT
|
SELECT siv.__id AS siv_uid
|
||||||
siv.__id as siv_uid ,
|
,siv.discount
|
||||||
siv.discount ,
|
,siv.type AS line_pricing_model_id
|
||||||
siv.type as line_pricing_model_id ,
|
,siv.HASH AS line_key
|
||||||
siv.hash as line_key ,
|
,siv.is_actual AS siv_is_actual
|
||||||
siv.is_actual as siv_is_actual ,
|
,siv.version::NUMERIC AS line_version
|
||||||
siv.version::numeric as line_version ,
|
,d.__index AS deal_index
|
||||||
d.__index as deal_index ,
|
,d._companies
|
||||||
d._companies ,
|
,a.INDEX AS agreement_version
|
||||||
a.index as agreement_version ,
|
,siv.date_nop::DATE AS dt_from
|
||||||
siv.date_nop::date as dt_from ,
|
,siv.date_end::DATE AS dt_to
|
||||||
siv.date_end::date as dt_to ,
|
,siv.is_easy AS is_simple
|
||||||
siv.is_easy as is_simple ,
|
,siv.cnt
|
||||||
siv.cnt ,
|
,s.probability_pc
|
||||||
s.probability_pc ,
|
,a.__id AS agreement_uid
|
||||||
a.__id as agreement_uid ,
|
,a.contract_uid
|
||||||
a.contract_uid ,
|
,a.is_actual AS agreement_is_actual
|
||||||
a.is_actual as agreement_is_actual ,
|
,a.deal_uid
|
||||||
a.deal_uid ,
|
,d.__name AS deal
|
||||||
d.__name as deal ,
|
,d.__status_status AS deal_status_id
|
||||||
d.__status_status as deal_status_id ,
|
,siv.user_description
|
||||||
siv.user_description ,
|
,siv.params
|
||||||
unnest(siv.params) as param_id
|
FROM elma.deals_services siv
|
||||||
FROM
|
JOIN elma.deals d ON (d.__id = ANY (siv.deal))
|
||||||
elma.deals_services siv
|
JOIN STATUS s ON (d.__status_status = s.status_id)
|
||||||
JOIN elma.deals d on (d.__id = ANY(siv.deal))
|
LEFT JOIN elma.additional_agreements a ON (a.__id = ANY (siv.additional_agreement))
|
||||||
JOIN status s on (d.__status_status=s.status_id)
|
WHERE siv.is_actual
|
||||||
LEFT JOIN elma.additional_agreements a on (a.__id = ANY(siv.additional_agreement))
|
AND siv."__deletedAt" IS NULL
|
||||||
WHERE
|
AND d."__deletedAt" IS NULL
|
||||||
siv.is_actual
|
AND a."__deletedAt" IS NULL
|
||||||
AND siv."__deletedAt" IS NULL
|
AND s.probability_pc >= 50
|
||||||
and d."__deletedAt" IS NULL
|
--and a.is_actual
|
||||||
and a."__deletedAt" IS NULL
|
AND siv.type IN (2, 3)
|
||||||
and s.probability_pc >= 50
|
)
|
||||||
--and a.is_actual
|
,component
|
||||||
and siv.type IN (2,3)
|
AS (
|
||||||
),
|
SELECT
|
||||||
component as
|
-- price*cnt*(100.0-COALESCE(discount,0))/100.0 as cost ,
|
||||||
(
|
-- price ,
|
||||||
SELECT
|
cnt
|
||||||
-- price*cnt*(100.0-COALESCE(discount,0))/100.0 as cost ,
|
,code
|
||||||
-- price ,
|
,__id
|
||||||
cnt ,
|
FROM elma.service_parametrs
|
||||||
code ,
|
WHERE "__deletedAt" IS NULL
|
||||||
__id
|
)
|
||||||
FROM
|
,stair
|
||||||
elma.service_parametrs
|
AS (
|
||||||
where
|
SELECT *
|
||||||
"__deletedAt" IS NULL
|
FROM (
|
||||||
),
|
SELECT *
|
||||||
stair as
|
,MIN(dt_from) OVER (
|
||||||
(
|
PARTITION BY line_key ORDER BY deal_index DESC
|
||||||
select
|
) running_min_dt
|
||||||
*
|
,COALESCE((
|
||||||
FROM
|
LEAD(dt_from) OVER (
|
||||||
(
|
PARTITION BY line_key ORDER BY dt_from
|
||||||
SELECT
|
,deal_index
|
||||||
*,
|
)
|
||||||
MIN(dt_from) OVER (PARTITION BY line_key ORDER BY deal_index desc) running_min_dt
|
), (
|
||||||
FROM
|
SELECT CURRENT_TIMESTAMP + INTERVAL '1 day'
|
||||||
line_expanded
|
)) dt_next
|
||||||
--line
|
FROM line
|
||||||
WHERE
|
WHERE probability_pc > 0
|
||||||
probability_pc > 0
|
) t
|
||||||
) t
|
WHERE t.dt_from = t.running_min_dt
|
||||||
WHERE
|
AND (
|
||||||
t.dt_from = t.running_min_dt
|
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
|
)
|
||||||
(
|
,line_expanded
|
||||||
select
|
AS (
|
||||||
c."WZ" as wz ,
|
SELECT line.*
|
||||||
round(sum(c."VM_RAM_Allocated")) as ram ,
|
,unnest(line.params) AS param_id
|
||||||
round(sum(CASE WHEN "VM_is_ON" > 0 THEN c."VM_RAM_Allocated" ELSE 0 END)) as ram_on ,
|
FROM line
|
||||||
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
|
,alloc
|
||||||
from
|
AS (
|
||||||
vmreports.compute c
|
SELECT c."WZ" AS wz
|
||||||
where
|
,round(sum(c."VM_RAM_Allocated")) AS ram
|
||||||
ts= (select max(ts) from vmreports.compute)
|
,round(sum(CASE WHEN "VM_is_ON" > 0 THEN c."VM_RAM_Allocated" ELSE 0 END)) AS ram_on
|
||||||
group by c."WZ"
|
,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
|
||||||
disk_alloc as
|
FROM vmreports.COMPUTE c
|
||||||
(
|
WHERE ts = (
|
||||||
select
|
SELECT max(ts)
|
||||||
c."WZ" as wz ,
|
FROM vmreports.COMPUTE
|
||||||
round(sum(c."Disk_Allocated")) as disk_alloc
|
)
|
||||||
from
|
GROUP BY c."WZ"
|
||||||
vmreports.storage c
|
)
|
||||||
where
|
,disk_alloc
|
||||||
ts= (select max(ts) from vmreports.compute)
|
AS (
|
||||||
group by
|
SELECT c."WZ" AS wz
|
||||||
c."WZ" ),
|
,round(sum(c."Disk_Allocated")) AS disk_alloc
|
||||||
sold_ram as
|
FROM vmreports.storage c
|
||||||
(
|
WHERE ts = (
|
||||||
SELECT
|
SELECT max(ts)
|
||||||
z.id_klienta as WZ ,
|
FROM vmreports.COMPUTE
|
||||||
z.__name as client ,
|
)
|
||||||
z.__id as company_uid,
|
GROUP BY c."WZ"
|
||||||
round(sum(c.cnt*o.cnt)) as quantity ,
|
)
|
||||||
count(*) as lines ,
|
,sold_ram
|
||||||
STRING_AGG(distinct c.code,', ' order by c.code) as codes
|
AS (
|
||||||
FROM
|
SELECT z.id_klienta AS WZ
|
||||||
stair o
|
,z.__name AS client
|
||||||
JOIN elma.companies z on o._companies=z.__id
|
,z.__id AS company_uid
|
||||||
LEFT JOIN component c on c.__id = o.param_id
|
,round(sum(c.cnt * o.cnt)) AS quantity
|
||||||
--LEFT JOIN component c on (c.__id = ANY (o.params))
|
,count(*) AS lines
|
||||||
WHERE
|
,STRING_AGG(DISTINCT c.code, ', ' ORDER BY c.code) AS codes
|
||||||
--c.code SIMILAR TO 'iaas.(ngc|dcp).%.ram-_'
|
FROM stair o
|
||||||
(c.code LIKE 'iaas.ngc.%.ram-_' OR c.code LIKE 'iaas.dcp.%.ram-_')
|
JOIN elma.companies z ON o._companies = z.__id
|
||||||
AND c.cnt <> 0
|
--LEFT JOIN component c on (c.__id = ANY (o.params))
|
||||||
AND o.cnt <> 0
|
LEFT JOIN line_expanded e ON o.siv_uid = e.siv_uid
|
||||||
GROUP BY
|
LEFT JOIN component c ON c.__id = e.param_id
|
||||||
z.id_klienta,
|
WHERE
|
||||||
z.__id ,
|
--c.code SIMILAR TO 'iaas.(ngc|dcp).%.ram-_'
|
||||||
z.__name
|
(
|
||||||
),
|
c.code LIKE 'iaas.ngc.%.ram-_'
|
||||||
sold_cpu as
|
OR c.code LIKE 'iaas.dcp.%.ram-_'
|
||||||
(
|
)
|
||||||
SELECT
|
AND c.cnt <> 0
|
||||||
z.id_klienta as WZ ,
|
AND o.cnt <> 0
|
||||||
z.__name as client ,
|
GROUP BY z.id_klienta
|
||||||
z.__id as company_uid,
|
,z.__id
|
||||||
round(sum(c.cnt*o.cnt)) as quantity ,
|
,z.__name
|
||||||
count(*) as lines ,
|
)
|
||||||
STRING_AGG(distinct c.code,', ' order by c.code) as codes
|
,sold_cpu
|
||||||
FROM
|
AS (
|
||||||
stair o
|
SELECT z.id_klienta AS WZ
|
||||||
JOIN
|
,z.__name AS client
|
||||||
elma.companies z on (o._companies=z.__id)
|
,z.__id AS company_uid
|
||||||
LEFT JOIN component c on c.__id = o.param_id
|
,round(sum(c.cnt * o.cnt)) AS quantity
|
||||||
--LEFT JOIN component c on (c.__id = ANY (o.params))
|
,count(*) AS lines
|
||||||
WHERE
|
,STRING_AGG(DISTINCT c.code, ', ' ORDER BY c.code) AS codes
|
||||||
--c.code SIMILAR TO 'iaas.(ngc|dcp).%.vcpu%-_'
|
FROM stair o
|
||||||
(c.code LIKE 'iaas.ngc.%.vcpu%-_' OR c.code LIKE 'iaas.dcp.%.vcpu%-_')
|
JOIN elma.companies z ON (o._companies = z.__id)
|
||||||
AND c.cnt <> 0
|
--LEFT JOIN component c ON c.__id = o.param_id
|
||||||
AND o.cnt <> 0
|
--LEFT JOIN component c on (c.__id = ANY (o.params))
|
||||||
GROUP BY
|
LEFT JOIN line_expanded e ON o.siv_uid = e.siv_uid
|
||||||
z.id_klienta,
|
LEFT JOIN component c ON c.__id = e.param_id
|
||||||
z.__id ,
|
WHERE
|
||||||
z.__name
|
--c.code SIMILAR TO 'iaas.(ngc|dcp).%.vcpu%-_'
|
||||||
),
|
(
|
||||||
sold_disk as
|
c.code LIKE 'iaas.ngc.%.vcpu%-_'
|
||||||
(
|
OR c.code LIKE 'iaas.dcp.%.vcpu%-_'
|
||||||
SELECT
|
)
|
||||||
z.id_klienta as WZ ,
|
AND c.cnt <> 0
|
||||||
z.__name as client ,
|
AND o.cnt <> 0
|
||||||
z.__id as company_uid,
|
GROUP BY z.id_klienta
|
||||||
round(sum(c.cnt*o.cnt)) as quantity ,
|
,z.__id
|
||||||
count(*) as lines ,
|
,z.__name
|
||||||
STRING_AGG(distinct c.code,', ' order by c.code) as codes
|
)
|
||||||
FROM
|
,sold_disk
|
||||||
stair o
|
AS (
|
||||||
JOIN elma.companies z on (o._companies=z.__id)
|
SELECT z.id_klienta AS WZ
|
||||||
LEFT JOIN component c on c.__id = o.param_id
|
,z.__name AS client
|
||||||
--LEFT JOIN component c on (c.__id = ANY (o.params))
|
,z.__id AS company_uid
|
||||||
WHERE
|
,round(sum(c.cnt * o.cnt)) AS quantity
|
||||||
--c.code SIMILAR TO 'iaas.(ngc|dcp).%.(ssd|fstssd|sata)-_'
|
,count(*) AS lines
|
||||||
(c.code LIKE 'iaas.ngc.%.ssd-_' OR c.code LIKE 'iaas.dcp.%.ssd-_'
|
,STRING_AGG(DISTINCT c.code, ', ' ORDER BY c.code) AS codes
|
||||||
or c.code LIKE 'iaas.ngc.%.fstssd-_' OR c.code LIKE 'iaas.dcp.%.fstssd-_'
|
FROM stair o
|
||||||
or c.code LIKE 'iaas.ngc.%.sata-_' OR c.code LIKE 'iaas.dcp.%.sata-_'
|
JOIN elma.companies z ON (o._companies = z.__id)
|
||||||
)
|
--LEFT JOIN component c ON c.__id = o.param_id
|
||||||
AND c.cnt <> 0
|
--LEFT JOIN component c on (c.__id = ANY (o.params))
|
||||||
AND o.cnt <> 0
|
LEFT JOIN line_expanded e ON o.siv_uid = e.siv_uid
|
||||||
GROUP BY
|
LEFT JOIN component c ON c.__id = e.param_id
|
||||||
z.id_klienta,
|
WHERE
|
||||||
z.__id ,
|
--c.code SIMILAR TO 'iaas.(ngc|dcp).%.(ssd|fstssd|sata)-_'
|
||||||
z.__name
|
(
|
||||||
),
|
c.code LIKE 'iaas.ngc.%.ssd-_'
|
||||||
sold_gpu as
|
OR c.code LIKE 'iaas.dcp.%.ssd-_'
|
||||||
(
|
OR c.code LIKE 'iaas.ngc.%.fstssd-_'
|
||||||
SELECT
|
OR c.code LIKE 'iaas.dcp.%.fstssd-_'
|
||||||
z.id_klienta as WZ ,
|
OR c.code LIKE 'iaas.ngc.%.sata-_'
|
||||||
z.__name as client ,
|
OR c.code LIKE 'iaas.dcp.%.sata-_'
|
||||||
z.__id as company_uid,
|
)
|
||||||
round(sum(c.cnt*o.cnt)) as quantity ,
|
AND c.cnt <> 0
|
||||||
count(*) as lines ,
|
AND o.cnt <> 0
|
||||||
STRING_AGG(distinct c.code,', ' order by c.code) as codes
|
GROUP BY z.id_klienta
|
||||||
FROM
|
,z.__id
|
||||||
stair o
|
,z.__name
|
||||||
JOIN
|
)
|
||||||
elma.companies z on (o._companies=z.__id)
|
,sold_gpu
|
||||||
LEFT JOIN component c on c.__id = o.param_id
|
AS (
|
||||||
WHERE
|
SELECT z.id_klienta AS WZ
|
||||||
--c.code SIMILAR TO 'iaas.(ngc|dcp).%.vcpu%-_'
|
,z.__name AS client
|
||||||
(c.code LIKE 'iaas.ngc.%.gpu%-_' OR c.code LIKE 'iaas.dcp.%.gpu%-_')
|
,z.__id AS company_uid
|
||||||
AND c.cnt <> 0
|
,round(sum(c.cnt * o.cnt)) AS quantity
|
||||||
AND o.cnt <> 0
|
,count(*) AS lines
|
||||||
GROUP BY
|
,STRING_AGG(DISTINCT c.code, ', ' ORDER BY c.code) AS codes
|
||||||
z.id_klienta,
|
FROM stair o
|
||||||
z.__id ,
|
JOIN elma.companies z ON (o._companies = z.__id)
|
||||||
z.__name
|
--LEFT JOIN component c ON c.__id = o.param_id
|
||||||
),
|
--LEFT JOIN component c on (c.__id = ANY (o.params))
|
||||||
gpu_alloc as
|
LEFT JOIN line_expanded e ON o.siv_uid = e.siv_uid
|
||||||
(
|
LEFT JOIN component c ON c.__id = e.param_id
|
||||||
select
|
WHERE
|
||||||
c."ClientID" as wz ,
|
--c.code SIMILAR TO 'iaas.(ngc|dcp).%.vcpu%-_'
|
||||||
-- json_agg("GPU") as gpu,
|
(
|
||||||
string_agg("GPU"::text||' '||"OrgStatus",', ') as gpu,
|
c.code LIKE 'iaas.ngc.%.gpu%-_'
|
||||||
count(*) as gpu_alloc
|
OR c.code LIKE 'iaas.dcp.%.gpu%-_'
|
||||||
from
|
)
|
||||||
vmreports.vm_gpu c
|
AND c.cnt <> 0
|
||||||
where
|
AND o.cnt <> 0
|
||||||
ts= (select max(ts) from vmreports.vm_gpu)
|
GROUP BY z.id_klienta
|
||||||
group by
|
,z.__id
|
||||||
c."ClientID" ),
|
,z.__name
|
||||||
deal_stat as
|
)
|
||||||
(
|
,gpu_alloc
|
||||||
select
|
AS (
|
||||||
STRING_AGG(distinct deal_status_id::text,', ' order by deal_status_id::text) as status_ids,
|
SELECT c."ClientID" AS wz
|
||||||
ARRAY_AGG(distinct deal_status_id order by deal_status_id) as ar_status_ids,
|
,
|
||||||
STRING_AGG(distinct line_pricing_model_id::text,', ' order by line_pricing_model_id::text) as line_pricing_model_ids ,
|
-- json_agg("GPU") as gpu,
|
||||||
ARRAY_AGG(distinct line_pricing_model_id order by line_pricing_model_id) as ar_line_pricing_model_id,
|
string_agg("GPU"::TEXT || ' ' || "OrgStatus", ', ') AS gpu
|
||||||
z.id_klienta as WZ
|
,count(*) AS gpu_alloc
|
||||||
from
|
FROM vmreports.vm_gpu c
|
||||||
line_expanded o
|
WHERE ts = (
|
||||||
--line o
|
SELECT max(ts)
|
||||||
join elma.companies z on (o._companies=z.__id)
|
FROM vmreports.vm_gpu
|
||||||
GROUP BY
|
)
|
||||||
z.id_klienta
|
GROUP BY c."ClientID"
|
||||||
)
|
)
|
||||||
|
,deal_stat
|
||||||
|
AS (
|
||||||
|
SELECT STRING_AGG(DISTINCT deal_status_id::TEXT, ', ' ORDER BY deal_status_id::TEXT) AS status_ids
|
||||||
|
,ARRAY_AGG(DISTINCT deal_status_id ORDER BY deal_status_id) AS ar_status_ids
|
||||||
|
,STRING_AGG(DISTINCT line_pricing_model_id::TEXT, ', ' ORDER BY line_pricing_model_id::TEXT) AS line_pricing_model_ids
|
||||||
|
,ARRAY_AGG(DISTINCT line_pricing_model_id ORDER BY line_pricing_model_id) AS ar_line_pricing_model_id
|
||||||
|
,z.id_klienta AS WZ
|
||||||
|
FROM stair d
|
||||||
|
--LEFT JOIN LATERAL unnest(d.params) AS arr(param_id) ON TRUE
|
||||||
|
--JOIN component p ON (p.__id = arr.param_id)
|
||||||
|
JOIN elma.companies z ON (d._companies = z.__id)
|
||||||
|
WHERE d.dt_from <= CURRENT_TIMESTAMP
|
||||||
|
AND (CURRENT_TIMESTAMP < d.dt_next)
|
||||||
|
GROUP BY z.id_klienta
|
||||||
|
)
|
||||||
select
|
select
|
||||||
<d:field_set titleMapOut="titleMap" lengthOut="fieldCount">
|
<d:field_set titleMapOut="titleMap" lengthOut="fieldCount">
|
||||||
<d:field title="WZ Elma">r.wz as wz_sold</d:field>
|
<d:field title="WZ Elma">r.wz as wz_sold</d:field>
|
||||||
@@ -368,7 +380,6 @@ S3 операции и трафик: <b>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-M
|
|||||||
<th width="10%"><layout:column_head name="gpu"/></th>
|
<th width="10%"><layout:column_head name="gpu"/></th>
|
||||||
<!--- <th width="3%"><layout:column_head name="disk_sold"/></th> --->
|
<!--- <th width="3%"><layout:column_head name="disk_sold"/></th> --->
|
||||||
|
|
||||||
|
|
||||||
</layout:grid_head>
|
</layout:grid_head>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
|
|||||||
+35
-15
@@ -13,7 +13,8 @@
|
|||||||
<m:filterparam filter=#filter# param="wz" ftype="string" compare="LIKE%" field="z.id_klienta" default=""/>
|
<m:filterparam filter=#filter# param="wz" ftype="string" compare="LIKE%" field="z.id_klienta" default=""/>
|
||||||
<m:filterparam filter=#filter# param="code" ftype="string" expression="(r.codes like ? OR r.codes like ? OR d.codes like ?)" suffix="%" prefix="%" default=""/>
|
<m:filterparam filter=#filter# param="code" ftype="string" expression="(r.codes like ? OR r.codes like ? OR d.codes like ?)" suffix="%" prefix="%" default=""/>
|
||||||
<!--- <m:filterparam filter=#filter# param="status_id" ftype="numeric" expression="ds.ar_status_ids = ?" suffix="" prefix="" default=""/> --->
|
<!--- <m:filterparam filter=#filter# param="status_id" ftype="numeric" expression="ds.ar_status_ids = ?" suffix="" prefix="" default=""/> --->
|
||||||
<m:filterparam filter=#filter# param="status_id" ftype="numeric" expression="(?=ANY(ds.ar_status_ids))" suffix="" prefix="" default=""/>
|
<!--- <m:filterparam filter=#filter# param="status_id" ftype="numeric" expression="(?=ANY(ds.ar_status_ids))" suffix="" prefix="" default=""/> --->
|
||||||
|
<m:filterparam filter=#filter# param="status_id_list" ftype="integer" list="Yes" expression="(ds.ar_status_ids && ARRAY[?])" suffix="" prefix="" default=""/>
|
||||||
<m:filterparam filter=#filter# param="line_pricing_model_id" ftype="numeric" expression="(?=ANY(ds.ar_line_pricing_model_id))" suffix="" prefix="" default=""/>
|
<m:filterparam filter=#filter# param="line_pricing_model_id" ftype="numeric" expression="(?=ANY(ds.ar_line_pricing_model_id))" suffix="" prefix="" default=""/>
|
||||||
</m:filter_settings>
|
</m:filter_settings>
|
||||||
|
|
||||||
@@ -57,20 +58,39 @@ $(document).ready(function() {
|
|||||||
<div class="tr">
|
<div class="tr">
|
||||||
<div class="th">Статус</div>
|
<div class="th">Статус</div>
|
||||||
<div class="td">
|
<div class="td">
|
||||||
<select name="status_id">
|
|
||||||
<option></option>
|
|
||||||
<option value="1"<cfif status_id EQ 1> selected</cfif>>Сбор потребностей</option>
|
|
||||||
<option value="4"<cfif status_id EQ 4> selected</cfif>>Проработка решения</option>
|
<!--- *** костыль --->
|
||||||
<option value="5"<cfif status_id EQ 5> selected</cfif>>Договор подписан</option>
|
<cfquery name="qStatus">
|
||||||
<option value=6""<cfif status_id EQ 6> selected</cfif>>Закрыта успешно</option>
|
SELECT * from (
|
||||||
<option value="7"<cfif status_id EQ 7> selected</cfif>>Закрыта неуспешно</option>
|
VALUES
|
||||||
<option value="8"<cfif status_id EQ 8> selected</cfif>>Тестирование</option>
|
--('Закрыта неуспешно',7,0) ,
|
||||||
<option value="10"<cfif status_id EQ 10> selected</cfif>>Отправлено ТКП</option>
|
('Закрыта успешно',6,100) ,
|
||||||
<option value="12"<cfif status_id EQ 12> selected</cfif>>Договор на согласовании</option>
|
('Договор подписан',5,100) ,
|
||||||
<option value="15"<cfif status_id EQ 15> selected</cfif>>Договор на подписании</option>
|
('Договор на подписании',15,90) ,
|
||||||
<option value="37"<cfif status_id EQ 37> selected</cfif>>Внутреннее согласование</option>
|
('Договор на согласовании',12,70),
|
||||||
</select>
|
('Тестирование',8,50)
|
||||||
<i>по вхождению в список</i>
|
--('Отправлено ТКП',10,20) ,
|
||||||
|
--('Внутреннее согласование',37,10),
|
||||||
|
--('Проработка решения',4,10),
|
||||||
|
--('Сбор потребностей',1,0)
|
||||||
|
) as status (status, status_id, probability_pc)
|
||||||
|
ORDER BY probability_pc, status_id
|
||||||
|
</cfquery>
|
||||||
|
|
||||||
|
<c:combo
|
||||||
|
query=#qStatus#
|
||||||
|
combo="status_id_list"
|
||||||
|
id="status_id"
|
||||||
|
key="status_id"
|
||||||
|
displayf="##status## (##status_id##: ##probability_pc##%)"
|
||||||
|
selected=#status_id_list#
|
||||||
|
empty=""
|
||||||
|
multiple="multiple"
|
||||||
|
size="6"
|
||||||
|
/>
|
||||||
|
<i>для выбора нескольких значений используйте CTRL или SHIFT (для диапазона)</i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
+114
@@ -0,0 +1,114 @@
|
|||||||
|
with
|
||||||
|
status(status, status_id, probability_pc) as (VALUES
|
||||||
|
('Закрыта неуспешно',7,0),('Закрыта успешно',6,100),('Договор подписан',5,100),('Договор на подписании',15,90),('Договор на согласовании',12,70),
|
||||||
|
('Тестирование',8,50),('Отправлено ТКП',10,20),('Внутреннее согласование',37,10),('Проработка решения',4,10),('Сбор потребностей',1,0)
|
||||||
|
)
|
||||||
|
|
||||||
|
,line_expanded as
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
siv.__id as siv_uid ,
|
||||||
|
siv.discount ,
|
||||||
|
siv.type as line_pricing_model_id ,
|
||||||
|
siv.hash as line_key ,
|
||||||
|
siv.is_actual as siv_is_actual ,
|
||||||
|
siv.version::numeric as line_version ,
|
||||||
|
siv.modifier_code ,
|
||||||
|
siv.abstractive_service_code ,
|
||||||
|
d.__index as deal_index ,
|
||||||
|
d._companies ,
|
||||||
|
a.index as agreement_version ,
|
||||||
|
siv.date_nop::date as dt_from ,
|
||||||
|
siv.date_end::date as dt_to ,
|
||||||
|
siv.is_easy as is_simple ,
|
||||||
|
siv.cnt ,
|
||||||
|
s.probability_pc ,
|
||||||
|
a.__id as additional_agreement_uid ,
|
||||||
|
a.__name as additional_agreement ,
|
||||||
|
a.contract_uid ,
|
||||||
|
a.is_actual as additional_agreement_is_actual ,
|
||||||
|
a.deal_uid ,
|
||||||
|
d.__name as deal ,
|
||||||
|
d.__status_status as deal_status_id ,
|
||||||
|
siv.user_description
|
||||||
|
--,unnest(siv.params) as param_id
|
||||||
|
FROM elma.deals_services siv
|
||||||
|
JOIN elma.deals d on (d.__id = ANY(siv.deal))
|
||||||
|
JOIN status s on (d.__status_status=s.status_id)
|
||||||
|
LEFT JOIN elma.additional_agreements a on (a.__id = ANY(siv.additional_agreement))
|
||||||
|
WHERE
|
||||||
|
siv.is_actual
|
||||||
|
AND siv."__deletedAt" IS NULL
|
||||||
|
and d."__deletedAt" IS NULL
|
||||||
|
and a."__deletedAt" IS NULL
|
||||||
|
and s.probability_pc >= 50
|
||||||
|
and siv.type IN (2,3)
|
||||||
|
),
|
||||||
|
component as
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
cnt ,
|
||||||
|
code ,
|
||||||
|
__id,
|
||||||
|
price,
|
||||||
|
ed_izm,
|
||||||
|
discount,
|
||||||
|
name
|
||||||
|
FROM
|
||||||
|
elma.service_parametrs
|
||||||
|
where
|
||||||
|
"__deletedAt" IS NULL
|
||||||
|
),
|
||||||
|
stair as
|
||||||
|
(
|
||||||
|
select
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
*,
|
||||||
|
MIN(dt_from) OVER (PARTITION BY line_key ORDER BY deal_index desc) running_min_dt
|
||||||
|
FROM
|
||||||
|
line_expanded
|
||||||
|
WHERE
|
||||||
|
probability_pc > 0
|
||||||
|
) t
|
||||||
|
WHERE
|
||||||
|
t.dt_from = t.running_min_dt
|
||||||
|
AND ( t.dt_to > CURRENT_TIMESTAMP OR t.dt_to IS NULL )
|
||||||
|
)
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
d.siv_uid
|
||||||
|
,d.deal
|
||||||
|
,d.user_description
|
||||||
|
,d.discount
|
||||||
|
,d.cnt
|
||||||
|
,d.modifier_code
|
||||||
|
,d.abstractive_service_code
|
||||||
|
,d.siv_is_actual --
|
||||||
|
,d.line_pricing_model_id --
|
||||||
|
,d.line_key
|
||||||
|
,d.deal_index --
|
||||||
|
,d.dt_from --
|
||||||
|
,d.dt_to --
|
||||||
|
,d.is_simple --
|
||||||
|
--,d.params::text
|
||||||
|
,d.additional_agreement_uid
|
||||||
|
,d.additional_agreement
|
||||||
|
/*,p.price
|
||||||
|
,p.cnt as p_cnt
|
||||||
|
,p.ed_izm
|
||||||
|
,p.code
|
||||||
|
,p.discount as p_discount
|
||||||
|
,p.__id as p_uid
|
||||||
|
,p.name*/
|
||||||
|
,s.probability_pc
|
||||||
|
,s.status_id
|
||||||
|
,s.status
|
||||||
|
,d.deal_index
|
||||||
|
,d.deal_uid
|
||||||
|
FROM stair d
|
||||||
|
--left outer join component p on (d.param_id=p.__id)
|
||||||
|
JOIN status s on (d.deal_status_id=s.status_id)
|
||||||
|
where d._companies='019503f2-5774-7768-b5c9-566a71daedaa'
|
||||||
+455
@@ -0,0 +1,455 @@
|
|||||||
|
select * from
|
||||||
|
(
|
||||||
|
with
|
||||||
|
status(status, status_id, probability_pc) as
|
||||||
|
(
|
||||||
|
VALUES
|
||||||
|
('Закрыта неуспешно',7,0) ,
|
||||||
|
('Закрыта успешно',6,100) ,
|
||||||
|
('Договор подписан',5,100) ,
|
||||||
|
('Договор на подписании',15,90) ,
|
||||||
|
('Договор на согласовании',12,70),
|
||||||
|
('Тестирование',8,50) ,
|
||||||
|
('Отправлено ТКП',10,20) ,
|
||||||
|
('Внутреннее согласование',37,10),
|
||||||
|
('Проработка решения',4,10) ,
|
||||||
|
('Сбор потребностей',1,0)
|
||||||
|
),
|
||||||
|
line as
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
siv.__id as siv_uid ,
|
||||||
|
siv.discount ,
|
||||||
|
siv.type as line_pricing_model_id ,
|
||||||
|
siv.hash as line_key ,
|
||||||
|
siv.is_actual as siv_is_actual ,
|
||||||
|
siv.version::numeric as line_version ,
|
||||||
|
d.__index as deal_index ,
|
||||||
|
d._companies ,
|
||||||
|
a.index as agreement_version ,
|
||||||
|
siv.date_nop::date as dt_from ,
|
||||||
|
siv.date_end::date as dt_to ,
|
||||||
|
siv.is_easy as is_simple ,
|
||||||
|
siv.cnt ,
|
||||||
|
s.probability_pc ,
|
||||||
|
a.__id as agreement_uid ,
|
||||||
|
a.contract_uid ,
|
||||||
|
a.is_actual as agreement_is_actual ,
|
||||||
|
a.deal_uid ,
|
||||||
|
d.__name as deal ,
|
||||||
|
d.__status_status as deal_status_id ,
|
||||||
|
siv.user_description ,
|
||||||
|
siv.params
|
||||||
|
FROM
|
||||||
|
elma.deals_services siv
|
||||||
|
JOIN elma.deals d on (d.__id = ANY(siv.deal))
|
||||||
|
JOIN status s on (d.__status_status=s.status_id)
|
||||||
|
LEFT JOIN elma.additional_agreements a on (a.__id = ANY(siv.additional_agreement))
|
||||||
|
WHERE
|
||||||
|
siv.is_actual
|
||||||
|
AND siv."__deletedAt" IS NULL
|
||||||
|
and d."__deletedAt" IS NULL
|
||||||
|
and a."__deletedAt" IS NULL
|
||||||
|
and a.is_actual
|
||||||
|
and siv.type IN (2,3)
|
||||||
|
),
|
||||||
|
component as
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
price*cnt*(100.0-COALESCE(discount,0))/100.0 as cost ,
|
||||||
|
price ,
|
||||||
|
cnt ,
|
||||||
|
code ,
|
||||||
|
__id
|
||||||
|
FROM
|
||||||
|
elma.service_parametrs
|
||||||
|
where
|
||||||
|
"__deletedAt" IS NULL
|
||||||
|
),
|
||||||
|
stair as
|
||||||
|
(
|
||||||
|
select
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
*,
|
||||||
|
MIN(dt_from) OVER (PARTITION BY line_key ORDER BY deal_index desc) running_min_dt
|
||||||
|
FROM
|
||||||
|
line
|
||||||
|
WHERE
|
||||||
|
probability_pc > 0
|
||||||
|
) t
|
||||||
|
WHERE
|
||||||
|
t.dt_from = t.running_min_dt
|
||||||
|
AND t.dt_to > CURRENT_TIMESTAMP
|
||||||
|
OR t.dt_to IS NULL
|
||||||
|
),
|
||||||
|
alloc as
|
||||||
|
(
|
||||||
|
select
|
||||||
|
c."WZ" as wz ,
|
||||||
|
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
|
||||||
|
from
|
||||||
|
vmreports.compute c
|
||||||
|
where
|
||||||
|
ts= (select max(ts) from vmreports.compute)
|
||||||
|
group by c."WZ"
|
||||||
|
),
|
||||||
|
disk_alloc as
|
||||||
|
(
|
||||||
|
select
|
||||||
|
c."WZ" as wz ,
|
||||||
|
round(sum(c."Disk_Allocated")) as disk_alloc
|
||||||
|
from
|
||||||
|
vmreports.storage c
|
||||||
|
where
|
||||||
|
ts= (select max(ts) from vmreports.compute)
|
||||||
|
group by
|
||||||
|
c."WZ"
|
||||||
|
),
|
||||||
|
sold_ram as
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
z.id_klienta as WZ ,
|
||||||
|
z.__name as client ,
|
||||||
|
z.__id as company_uid,
|
||||||
|
round(sum(c.cnt*o.cnt)) as quantity ,
|
||||||
|
count(*) as lines ,
|
||||||
|
STRING_AGG(c.code,', ' order by c.code) as codes
|
||||||
|
FROM
|
||||||
|
stair o
|
||||||
|
JOIN elma.companies z on (o._companies=z.__id)
|
||||||
|
LEFT JOIN component c on (c.__id = ANY (o.params))
|
||||||
|
WHERE
|
||||||
|
c.code SIMILAR TO 'iaas.(ngc|dcp).%.ram-_'
|
||||||
|
AND c.cnt <> 0
|
||||||
|
AND o.cnt <> 0
|
||||||
|
GROUP BY
|
||||||
|
z.id_klienta,
|
||||||
|
z.__id ,
|
||||||
|
z.__name
|
||||||
|
),
|
||||||
|
sold_cpu as
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
z.id_klienta as WZ ,
|
||||||
|
z.__name as client ,
|
||||||
|
z.__id as company_uid,
|
||||||
|
round(sum(c.cnt*o.cnt)) as quantity ,
|
||||||
|
count(*) as lines ,
|
||||||
|
STRING_AGG(c.code,', ' order by c.code) as codes
|
||||||
|
FROM
|
||||||
|
stair o
|
||||||
|
JOIN
|
||||||
|
elma.companies z on (o._companies=z.__id)
|
||||||
|
LEFT JOIN component c on (c.__id = ANY (o.params))
|
||||||
|
WHERE
|
||||||
|
c.code SIMILAR TO 'iaas.(ngc|dcp).%.vcpu%-_'
|
||||||
|
AND c.cnt <> 0
|
||||||
|
AND o.cnt <> 0
|
||||||
|
GROUP BY
|
||||||
|
z.id_klienta,
|
||||||
|
z.__id ,
|
||||||
|
z.__name
|
||||||
|
),
|
||||||
|
sold_disk as
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
z.id_klienta as WZ ,
|
||||||
|
z.__name as client ,
|
||||||
|
z.__id as company_uid,
|
||||||
|
round(sum(c.cnt*o.cnt)) as quantity ,
|
||||||
|
count(*) as lines ,
|
||||||
|
STRING_AGG(c.code,', ' order by c.code) as codes
|
||||||
|
FROM
|
||||||
|
stair o
|
||||||
|
JOIN elma.companies z on (o._companies=z.__id)
|
||||||
|
LEFT JOIN component c on (c.__id = ANY (o.params))
|
||||||
|
WHERE
|
||||||
|
c.code SIMILAR TO 'iaas.(ngc|dcp).%.(ssd|fstssd|sata)-_'
|
||||||
|
AND c.cnt <> 0
|
||||||
|
AND o.cnt <> 0
|
||||||
|
GROUP BY
|
||||||
|
z.id_klienta,
|
||||||
|
z.__id ,
|
||||||
|
z.__name
|
||||||
|
),
|
||||||
|
deal_stat as
|
||||||
|
(
|
||||||
|
select
|
||||||
|
STRING_AGG(distinct deal_status_id::text,', ' order by deal_status_id::text) as status_ids ,
|
||||||
|
STRING_AGG(distinct line_pricing_model_id::text,', ' order by 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
|
||||||
|
)
|
||||||
|
select
|
||||||
|
r.wz as wz_sold ,
|
||||||
|
r.client as client_sold ,
|
||||||
|
r.company_uid ,
|
||||||
|
a.wz as wz_alloc ,
|
||||||
|
ds.status_ids ,
|
||||||
|
ds.line_pricing_model_ids ,
|
||||||
|
r.codes as ram_codes ,
|
||||||
|
r.quantity as ram_sold ,
|
||||||
|
a.ram as ram_alloc ,
|
||||||
|
a.ram_on as ram_alloc_on ,
|
||||||
|
c.codes as cpu_codes ,
|
||||||
|
c.quantity as cpu_sold ,
|
||||||
|
a.cpu as cpu_alloc ,
|
||||||
|
a.cpu_on as cpu_alloc_on ,
|
||||||
|
d.codes as disk_codes ,
|
||||||
|
d.quantity as disk_sold ,
|
||||||
|
da.disk_alloc ,
|
||||||
|
z.__name as alloc_company,
|
||||||
|
z.__id as alloc_company_uid
|
||||||
|
from
|
||||||
|
sold_ram r
|
||||||
|
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))
|
||||||
|
)
|
||||||
|
|
||||||
|
intersect all
|
||||||
|
|
||||||
|
select * from
|
||||||
|
(
|
||||||
|
WITH
|
||||||
|
status(status, status_id, probability_pc) as
|
||||||
|
(
|
||||||
|
VALUES
|
||||||
|
('Закрыта неуспешно',7,0) ,
|
||||||
|
('Закрыта успешно',6,100) ,
|
||||||
|
('Договор подписан',5,100) ,
|
||||||
|
('Договор на подписании',15,90) ,
|
||||||
|
('Договор на согласовании',12,70),
|
||||||
|
('Тестирование',8,50) ,
|
||||||
|
('Отправлено ТКП',10,20) ,
|
||||||
|
('Внутреннее согласование',37,10),
|
||||||
|
('Проработка решения',4,10) ,
|
||||||
|
('Сбор потребностей',1,0)
|
||||||
|
),
|
||||||
|
line_expanded as
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
siv.__id as siv_uid ,
|
||||||
|
siv.discount ,
|
||||||
|
siv.type as line_pricing_model_id ,
|
||||||
|
siv.hash as line_key ,
|
||||||
|
siv.is_actual as siv_is_actual ,
|
||||||
|
siv.version::numeric as line_version ,
|
||||||
|
d.__index as deal_index ,
|
||||||
|
d._companies ,
|
||||||
|
a.index as agreement_version ,
|
||||||
|
siv.date_nop::date as dt_from ,
|
||||||
|
siv.date_end::date as dt_to ,
|
||||||
|
siv.is_easy as is_simple ,
|
||||||
|
siv.cnt ,
|
||||||
|
s.probability_pc ,
|
||||||
|
a.__id as agreement_uid ,
|
||||||
|
a.contract_uid ,
|
||||||
|
a.is_actual as agreement_is_actual ,
|
||||||
|
a.deal_uid ,
|
||||||
|
d.__name as deal ,
|
||||||
|
d.__status_status as deal_status_id ,
|
||||||
|
siv.user_description ,
|
||||||
|
unnest(siv.params) as param_id
|
||||||
|
FROM
|
||||||
|
elma.deals_services siv
|
||||||
|
JOIN elma.deals d on (d.__id = ANY(siv.deal))
|
||||||
|
JOIN status s on (d.__status_status=s.status_id)
|
||||||
|
LEFT JOIN elma.additional_agreements a on (a.__id = ANY(siv.additional_agreement))
|
||||||
|
WHERE
|
||||||
|
siv.is_actual
|
||||||
|
AND siv."__deletedAt" IS NULL
|
||||||
|
and d."__deletedAt" IS NULL
|
||||||
|
and a."__deletedAt" IS NULL
|
||||||
|
and a.is_actual
|
||||||
|
and siv.type IN (2,3)
|
||||||
|
),
|
||||||
|
component as
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
price*cnt*(100.0-COALESCE(discount,0))/100.0 as cost ,
|
||||||
|
price ,
|
||||||
|
cnt ,
|
||||||
|
code ,
|
||||||
|
__id
|
||||||
|
FROM
|
||||||
|
elma.service_parametrs
|
||||||
|
where
|
||||||
|
"__deletedAt" IS NULL
|
||||||
|
),
|
||||||
|
stair as
|
||||||
|
(
|
||||||
|
select
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
*,
|
||||||
|
MIN(dt_from) OVER (PARTITION BY line_key ORDER BY deal_index desc) running_min_dt
|
||||||
|
FROM
|
||||||
|
line_expanded
|
||||||
|
--line
|
||||||
|
WHERE
|
||||||
|
probability_pc > 0
|
||||||
|
) t
|
||||||
|
WHERE
|
||||||
|
t.dt_from = t.running_min_dt
|
||||||
|
AND t.dt_to > CURRENT_TIMESTAMP
|
||||||
|
OR t.dt_to IS NULL
|
||||||
|
),
|
||||||
|
alloc as
|
||||||
|
(
|
||||||
|
select
|
||||||
|
c."WZ" as wz ,
|
||||||
|
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
|
||||||
|
from
|
||||||
|
vmreports.compute c
|
||||||
|
where
|
||||||
|
ts= (select max(ts) from vmreports.compute)
|
||||||
|
group by c."WZ"
|
||||||
|
),
|
||||||
|
disk_alloc as
|
||||||
|
(
|
||||||
|
select
|
||||||
|
c."WZ" as wz ,
|
||||||
|
round(sum(c."Disk_Allocated")) as disk_alloc
|
||||||
|
from
|
||||||
|
vmreports.storage c
|
||||||
|
where
|
||||||
|
ts= (select max(ts) from vmreports.compute)
|
||||||
|
group by
|
||||||
|
c."WZ" ),
|
||||||
|
sold_ram as
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
z.id_klienta as WZ ,
|
||||||
|
z.__name as client ,
|
||||||
|
z.__id as company_uid,
|
||||||
|
round(sum(c.cnt*o.cnt)) as quantity ,
|
||||||
|
count(*) as lines ,
|
||||||
|
STRING_AGG(c.code,', ' order by c.code) as codes
|
||||||
|
FROM
|
||||||
|
stair o
|
||||||
|
JOIN elma.companies z on o._companies=z.__id
|
||||||
|
LEFT JOIN component c on c.__id = o.param_id
|
||||||
|
--LEFT JOIN component c on (c.__id = ANY (o.params))
|
||||||
|
WHERE
|
||||||
|
--c.code SIMILAR TO 'iaas.(ngc|dcp).%.ram-_'
|
||||||
|
(c.code LIKE 'iaas.ngc.%.ram-_' OR c.code LIKE 'iaas.dcp.%.ram-_')
|
||||||
|
AND c.cnt <> 0
|
||||||
|
AND o.cnt <> 0
|
||||||
|
GROUP BY
|
||||||
|
z.id_klienta,
|
||||||
|
z.__id ,
|
||||||
|
z.__name
|
||||||
|
),
|
||||||
|
sold_cpu as
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
z.id_klienta as WZ ,
|
||||||
|
z.__name as client ,
|
||||||
|
z.__id as company_uid,
|
||||||
|
round(sum(c.cnt*o.cnt)) as quantity ,
|
||||||
|
count(*) as lines ,
|
||||||
|
STRING_AGG(c.code,', ' order by c.code) as codes
|
||||||
|
FROM
|
||||||
|
stair o
|
||||||
|
JOIN
|
||||||
|
elma.companies z on (o._companies=z.__id)
|
||||||
|
LEFT JOIN component c on c.__id = o.param_id
|
||||||
|
--LEFT JOIN component c on (c.__id = ANY (o.params))
|
||||||
|
WHERE
|
||||||
|
--c.code SIMILAR TO 'iaas.(ngc|dcp).%.vcpu%-_'
|
||||||
|
(c.code LIKE 'iaas.ngc.%.vcpu%-_' OR c.code LIKE 'iaas.dcp.%.vcpu%-_')
|
||||||
|
AND c.cnt <> 0
|
||||||
|
AND o.cnt <> 0
|
||||||
|
GROUP BY
|
||||||
|
z.id_klienta,
|
||||||
|
z.__id ,
|
||||||
|
z.__name
|
||||||
|
),
|
||||||
|
sold_disk as
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
z.id_klienta as WZ ,
|
||||||
|
z.__name as client ,
|
||||||
|
z.__id as company_uid,
|
||||||
|
round(sum(c.cnt*o.cnt)) as quantity ,
|
||||||
|
count(*) as lines ,
|
||||||
|
STRING_AGG(c.code,', ' order by c.code) as codes
|
||||||
|
FROM
|
||||||
|
stair o
|
||||||
|
JOIN elma.companies z on (o._companies=z.__id)
|
||||||
|
LEFT JOIN component c on c.__id = o.param_id
|
||||||
|
--LEFT JOIN component c on (c.__id = ANY (o.params))
|
||||||
|
WHERE
|
||||||
|
--c.code SIMILAR TO 'iaas.(ngc|dcp).%.(ssd|fstssd|sata)-_'
|
||||||
|
(c.code LIKE 'iaas.ngc.%.ssd-_' OR c.code LIKE 'iaas.dcp.%.ssd-_'
|
||||||
|
or c.code LIKE 'iaas.ngc.%.fstssd-_' OR c.code LIKE 'iaas.dcp.%.fstssd-_'
|
||||||
|
or c.code LIKE 'iaas.ngc.%.sata-_' OR c.code LIKE 'iaas.dcp.%.sata-_'
|
||||||
|
)
|
||||||
|
AND c.cnt <> 0
|
||||||
|
AND o.cnt <> 0
|
||||||
|
GROUP BY
|
||||||
|
z.id_klienta,
|
||||||
|
z.__id ,
|
||||||
|
z.__name
|
||||||
|
),
|
||||||
|
deal_stat as
|
||||||
|
(
|
||||||
|
select
|
||||||
|
STRING_AGG(distinct deal_status_id::text,', ' order by deal_status_id::text) as status_ids ,
|
||||||
|
STRING_AGG(distinct line_pricing_model_id::text,', ' order by line_pricing_model_id::text) as line_pricing_model_ids ,
|
||||||
|
z.id_klienta as WZ
|
||||||
|
from
|
||||||
|
line_expanded o
|
||||||
|
--line o
|
||||||
|
join elma.companies z on (o._companies=z.__id)
|
||||||
|
GROUP BY
|
||||||
|
z.id_klienta
|
||||||
|
)
|
||||||
|
select
|
||||||
|
r.wz as wz_sold ,
|
||||||
|
r.client as client_sold ,
|
||||||
|
r.company_uid ,
|
||||||
|
a.wz as wz_alloc ,
|
||||||
|
ds.status_ids ,
|
||||||
|
ds.line_pricing_model_ids ,
|
||||||
|
r.codes as ram_codes ,
|
||||||
|
r.quantity as ram_sold ,
|
||||||
|
a.ram as ram_alloc ,
|
||||||
|
a.ram_on as ram_alloc_on ,
|
||||||
|
c.codes as cpu_codes ,
|
||||||
|
c.quantity as cpu_sold ,
|
||||||
|
a.cpu as cpu_alloc ,
|
||||||
|
a.cpu_on as cpu_alloc_on ,
|
||||||
|
d.codes as disk_codes ,
|
||||||
|
d.quantity as disk_sold ,
|
||||||
|
da.disk_alloc ,
|
||||||
|
z.__name as alloc_company,
|
||||||
|
z.__id as alloc_company_uid
|
||||||
|
from
|
||||||
|
sold_ram r
|
||||||
|
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))
|
||||||
|
)
|
||||||
+164
@@ -0,0 +1,164 @@
|
|||||||
|
<cfsilent>
|
||||||
|
<cfimport prefix="m" taglib="lib"/>
|
||||||
|
<cfimport prefix="c" taglib="lib/controls"/>
|
||||||
|
<cfimport prefix="d" taglib="lib/data"/>
|
||||||
|
<cfimport prefix="layout" taglib="layout"/>
|
||||||
|
</cfsilent>
|
||||||
|
|
||||||
|
<m:prepare_ls entity="crm2cloud" accessObject="" pageInfoOut="pageInfo" trackOut="tr"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<cfquery name="qVM" cachedWithin=#createTimeSpan(0, 0, 25, 0)#>
|
||||||
|
select "Name", "Object_UUID", "UUID_VM",
|
||||||
|
"VDC", "Organization_UUID", "Organization", "WZ", "Cluster", "Host",
|
||||||
|
"Host_Model", "CPU_Model", "Host_CPU_Cores", "Host_CPU_Sockets", "Host_CPU_Speed", "Host_RAM",
|
||||||
|
"Host_CPU_Used", "Host_CPU_Used_Avg",
|
||||||
|
"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_RAM_Allocated", "VM_RAM_Used",
|
||||||
|
"VM_is_ON",
|
||||||
|
k.__id as company_uid
|
||||||
|
from vmreports.compute c
|
||||||
|
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>
|
||||||
|
|
||||||
|
<!--- <cfdump var=#qVM# abort=true/> --->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<cfif isDefined("output_xls")>
|
||||||
|
<layout:xml qRead=#qCharge# titleMap=#titleMap# filename="#pageInfo.entity#.xml"/>
|
||||||
|
<cfabort/>
|
||||||
|
</cfif><cfif isDefined("output_json")>
|
||||||
|
<layout:json qRead=#qCharge# titleMap=#titleMap# filename="#pageInfo.entity#.json"/>
|
||||||
|
<cfabort/>
|
||||||
|
</cfif><!---
|
||||||
|
---><layout:page section="header" pageInfo=#pageInfo#>
|
||||||
|
|
||||||
|
<layout:attribute name="title">
|
||||||
|
<cfoutput><b>Сверка CRM - Cloud</b></cfoutput>
|
||||||
|
</layout:attribute>
|
||||||
|
<layout:attribute name="controls">
|
||||||
|
<!---skip filter link, filter is not implemented--->
|
||||||
|
<!---<layout:language_switch/>--->
|
||||||
|
</layout:attribute>
|
||||||
|
</layout:page>
|
||||||
|
|
||||||
|
<!--- <cfdump var=#qReconciliation# abort=true/> --->
|
||||||
|
|
||||||
|
<cfoutput>
|
||||||
|
<!--- <form method="post" action="">
|
||||||
|
Период с <input type="text" name="dt_start" value="#dateFormat(dt_start,'YYYY-MM-DD')#"/>
|
||||||
|
по <input type="text" name="dt_finish" value="#dateFormat(dt_finish,'YYYY-MM-DD')#"/>
|
||||||
|
<input type="submit" style="cursor:pointer;"/>
|
||||||
|
<input type="submit" name="DEBUG" value="DEBUG" style="cursor:pointer;"/>
|
||||||
|
</form> --->
|
||||||
|
<!--- Часов в периоде: <b>#hours#</b> Строк в отчете: <b>#qCharge.recordCount#</b><br/>
|
||||||
|
Актуальность данных:
|
||||||
|
VCD Computing: <b>#dateFormat(qComputingAge.dt_load,'YYYY-MM-DD')# #timeFormat(qComputingAge.dt_load,'HH:MM:SS')#</b>
|
||||||
|
VCD Storage: <b>#dateFormat(qStorageAge.dt_load,'YYYY-MM-DD')# #timeFormat(qStorageAge.dt_load,'HH:MM:SS')#</b>
|
||||||
|
S3 хранение: <b>#dateFormat(qS3VolAge.dt_load,'YYYY-MM-DD')# #timeFormat(qS3VolAge.dt_load,'HH:MM:SS')#</b>
|
||||||
|
S3 операции и трафик: <b>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-MM-DD')# #timeFormat(qS3OpsTrfAge.dt_load,'HH:MM:SS')#</b>
|
||||||
|
--->
|
||||||
|
<br/>
|
||||||
|
<a href="#request.thisPage#?output_xls" title="экспорт в Excel" style="margin-left:.5em; height:100%;" target="_blank"><img src="img/xls.gif" style="vertical-align:text-bottom;"/></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><b>#qVM.recordCount#</b></cfoutput>
|
||||||
|
<table class="worktable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="5%">WZ</th>
|
||||||
|
<th width="5%">Имя</th>
|
||||||
|
<th width="5%">Уникальное имя</th>
|
||||||
|
|
||||||
|
<th width="3%">Organization</th>
|
||||||
|
|
||||||
|
<th width="3%">VDC</th>
|
||||||
|
<th width="3%">VDC CPU Reserv</th>
|
||||||
|
<th width="3%">VDC CPU Speed GHz</th>
|
||||||
|
|
||||||
|
<th width="3%">Cluster</th>
|
||||||
|
|
||||||
|
<th width="3%">Host</th>
|
||||||
|
<th width="7%">Host Model</th>
|
||||||
|
<th width="7%">CPU Model</th>
|
||||||
|
<th width="3%">Host CPU Cores</th>
|
||||||
|
<th width="3%">Host CPU Sockets</th>
|
||||||
|
<th width="3%">Host CPU Speed GHz</th>
|
||||||
|
<th width="3%">Host RAM GB</th>
|
||||||
|
<th width="3%">Host CPU Used</th>
|
||||||
|
<th width="3%">Host CPU Used_Avg</th>
|
||||||
|
|
||||||
|
<th width="3%">VM vCPU count</th>
|
||||||
|
<th width="3%">VM CPU Used</th>
|
||||||
|
<th width="3%">VM CPU Used AVG</th>
|
||||||
|
<th width="3%">VM CPU Reserv GHz</th>
|
||||||
|
<th width="3%">VM CPU Reserv perc</th>
|
||||||
|
|
||||||
|
<th width="3%">VM RAM Allocated GB</th>
|
||||||
|
<th width="3%">VM RAM Used GB</th>
|
||||||
|
|
||||||
|
<th width="3%">VM is ON</th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<cfoutput query="qVM">
|
||||||
|
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
|
||||||
|
<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>#UUID_VM#</td>
|
||||||
|
<td>#Organization#</td>
|
||||||
|
|
||||||
|
<td>#VDC#</td>
|
||||||
|
<td><cftry>#round(VDC_CPU_Reserv,3)#<cfcatch></cfcatch></cftry></td>
|
||||||
|
<td><cftry>#round(VDC_CPU_Speed,3)#<cfcatch></cfcatch></cftry></td>
|
||||||
|
|
||||||
|
<td>#qVM.Cluster#</td>
|
||||||
|
|
||||||
|
<td>#Host#</td>
|
||||||
|
<td>#Host_Model#</td>
|
||||||
|
<td>#CPU_Model#</td>
|
||||||
|
<td>#Host_CPU_Cores#</td>
|
||||||
|
<td>#Host_CPU_Sockets#</td>
|
||||||
|
<td>#round(Host_CPU_Speed,3)#</td>
|
||||||
|
<td>#round(Host_RAM)#</td>
|
||||||
|
<td><cftry>#round(Host_CPU_Used,1)#<cfcatch></cfcatch></cftry></td>
|
||||||
|
<td><cftry>#round(Host_CPU_Used_Avg,1)#<cfcatch></cfcatch></cftry></td>
|
||||||
|
|
||||||
|
<td>#VM_vCPU_count#</td>
|
||||||
|
<td><cftry>#round(VM_CPU_Used,1)#<cfcatch></cfcatch></cftry></td>
|
||||||
|
<td><cftry>#round(VM_CPU_Used_AVG,1)#<cfcatch></cfcatch></cftry></td>
|
||||||
|
<td><cftry>#round(VM_CPU_Reserv_GHz,1)#<cfcatch></cfcatch></cftry></td>
|
||||||
|
<td>#VM_CPU_Reserv_perc#</td>
|
||||||
|
|
||||||
|
<td>#VM_RAM_Allocated#</td>
|
||||||
|
<td><cftry>#round(VM_RAM_Used)#<cfcatch></cfcatch></cftry></td>
|
||||||
|
|
||||||
|
<td>#VM_is_ON#</td>
|
||||||
|
|
||||||
|
|
||||||
|
<!--- <td><a href="contragent.cfm?__id=#company_uid#&#tr.fwx#">#client_sold#</a></td> --->
|
||||||
|
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</cfoutput>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
<!--- <cfdump var=#qCharge#/> --->
|
||||||
|
|
||||||
|
|
||||||
|
<layout:page section="footer"/>
|
||||||
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<!--- version 2.01---><!---15:25 31.01.2019--->
|
<!--- version 2.01---><!---15:25 31.01.2019--->
|
||||||
<!--- version 2.02---><!---2025-08-04 15:19:34 postgre specific ilike instead of like--->
|
<!--- version 2.02---><!---2025-08-04 15:19:34 postgre specific ilike instead of like--->
|
||||||
|
<!--- version 2.03---><!---2026-04-27 ftype=integer support--->
|
||||||
<!--- build query filter string --->
|
<!--- build query filter string --->
|
||||||
<!--- пустые и некорректные значения параметров вызвыают пропуск параметра --->
|
<!--- пустые и некорректные значения параметров вызвыают пропуск параметра --->
|
||||||
<cfparam name="ATTRIBUTES.filter" type="struct"/>
|
<cfparam name="ATTRIBUTES.filter" type="struct"/>
|
||||||
@@ -34,6 +35,9 @@
|
|||||||
<cfcase value="numeric">
|
<cfcase value="numeric">
|
||||||
<cfreturn "CF_SQL_NUMERIC"/>
|
<cfreturn "CF_SQL_NUMERIC"/>
|
||||||
</cfcase>
|
</cfcase>
|
||||||
|
<cfcase value="integer">
|
||||||
|
<cfreturn "CF_SQL_INTEGER"/>
|
||||||
|
</cfcase>
|
||||||
<cfcase value="date,time,datetime">
|
<cfcase value="date,time,datetime">
|
||||||
<cfreturn "CF_SQL_TIMESTAMP"/>
|
<cfreturn "CF_SQL_TIMESTAMP"/>
|
||||||
</cfcase>
|
</cfcase>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<!--- version 2.01---><!---15:25 31.01.2019--->
|
<!--- version 2.01---><!---15:25 31.01.2019--->
|
||||||
<!--- 2017.06.16 исправлен баг с очисткой при числовом значении по умолчанию --->
|
<!--- 2017.06.16 исправлен баг с очисткой при числовом значении по умолчанию --->
|
||||||
<!---v0.5 10:02 02.01.2019--->
|
<!---v0.5 10:02 02.01.2019--->
|
||||||
|
<!---v0.6 2026-04-27 integer type support --->
|
||||||
<cfassociate basetag="cf_filter_settings"/>
|
<cfassociate basetag="cf_filter_settings"/>
|
||||||
<cfparam name="ATTRIBUTES.filter" type="struct" default=#getBaseTagData("CF_FILTER_SETTINGS",1).filter#/><!--- *** possible Railo bug, getBaseTagData works only with second parameter --->
|
<cfparam name="ATTRIBUTES.filter" type="struct" default=#getBaseTagData("CF_FILTER_SETTINGS",1).filter#/><!--- *** possible Railo bug, getBaseTagData works only with second parameter --->
|
||||||
<cfparam name="ATTRIBUTES.param" type="string"/>
|
<cfparam name="ATTRIBUTES.param" type="string"/>
|
||||||
@@ -74,6 +75,13 @@ arrayAppend(array,item) механически заменил на listAppend(li
|
|||||||
</cfif>
|
</cfif>
|
||||||
</cfcase>
|
</cfcase>
|
||||||
|
|
||||||
|
<cfcase value="integer">
|
||||||
|
<cfset element=trim(element)>
|
||||||
|
<cfif NOT isValid("integer", element)>
|
||||||
|
<cfset element=def/>
|
||||||
|
</cfif>
|
||||||
|
</cfcase>
|
||||||
|
|
||||||
<cfcase value="guid">
|
<cfcase value="guid">
|
||||||
<cfset element=trim(element)>
|
<cfset element=trim(element)>
|
||||||
<cfif NOT isValid('guid',element)>
|
<cfif NOT isValid('guid',element)>
|
||||||
|
|||||||
Reference in New Issue
Block a user