034 alpha
This commit is contained in:
+280
-125
@@ -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>
|
||||
@@ -127,87 +112,132 @@
|
||||
<cfif len(d.__id)>
|
||||
|
||||
|
||||
<cfquery name="qService">
|
||||
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)
|
||||
)
|
||||
select
|
||||
siv.__id
|
||||
,siv.__name
|
||||
,siv.user_description
|
||||
,siv.discount
|
||||
,siv.cnt
|
||||
,siv.modifier_code
|
||||
,siv.abstractive_service_code
|
||||
,siv.is_actual
|
||||
,siv.type
|
||||
,siv.hash
|
||||
,siv.version
|
||||
,siv.__index
|
||||
,siv.date_nop
|
||||
,siv.date_end
|
||||
,siv.is_easy
|
||||
,siv.params::text
|
||||
,a.__id::text as additional_agreement_uid
|
||||
,a.__name as 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
|
||||
,d.__index
|
||||
,d.__id as deal_uid
|
||||
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)
|
||||
join elma.service_parametrs p ON (p.__id = ANY (siv.params) AND p."__deletedAt" IS NULL)
|
||||
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)#/>
|
||||
AND siv.is_actual
|
||||
AND a.is_actual
|
||||
AND date_nop <= CURRENT_TIMESTAMP
|
||||
AND COALESCE(date_end,CURRENT_TIMESTAMP) >= CURRENT_TIMESTAMP
|
||||
order by version::int
|
||||
</cfquery>
|
||||
<cfquery name="qService">
|
||||
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)
|
||||
)
|
||||
select
|
||||
siv.__id
|
||||
,siv.__name
|
||||
,siv.user_description
|
||||
,siv.discount
|
||||
,siv.cnt
|
||||
,siv.modifier_code
|
||||
,siv.abstractive_service_code
|
||||
,siv.is_actual
|
||||
,siv.type
|
||||
,siv.hash
|
||||
,siv.version
|
||||
,siv.__index
|
||||
,siv.date_nop
|
||||
,siv.date_end
|
||||
,siv.is_easy
|
||||
,siv.params::text
|
||||
,a.__id::text as additional_agreement_uid
|
||||
,a.__name as 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.__index as deal_index
|
||||
,d.__id as deal_uid
|
||||
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)
|
||||
join elma.service_parametrs p ON (p.__id = ANY (siv.params) AND p."__deletedAt" IS NULL)
|
||||
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)#/>
|
||||
AND siv.is_actual
|
||||
AND a.is_actual
|
||||
AND date_nop <= CURRENT_TIMESTAMP
|
||||
AND COALESCE(date_end,CURRENT_TIMESTAMP) >= CURRENT_TIMESTAMP
|
||||
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>
|
||||
<h3>Услуги по данным CRM (версии строк спецификации, только актуальные на сегодня) <!--- (#qService.recordCount#) ---></h3>
|
||||
</cfoutput>
|
||||
|
||||
<cfoutput>
|
||||
<h4>Услуги (версии строк спецификации, только актуальные) <!--- (#qService.recordCount#) ---></h4>
|
||||
</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="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="5%">date_end</th>
|
||||
<th width="7%">additional_agreement</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<cfoutput query="qService" group="__index">
|
||||
<tr>
|
||||
<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">#user_description#</td>
|
||||
<td>
|
||||
|
||||
<table class="worktable">
|
||||
<thead>
|
||||
<tr>
|
||||
<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 width="3%">Модель оплаты</th>
|
||||
<th width="5%">Дата НОУ</th>
|
||||
<th width="5%">date_end</th>
|
||||
<th width="10%">Дополнительное соглашение</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<cfoutput query="qService" group="__index">
|
||||
<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">
|
||||
<cfset cost=0/>
|
||||
<cfoutput group="p_uid">
|
||||
@@ -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>
|
||||
<td class="c">#type#</td>
|
||||
|
||||
<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">#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>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
</table>
|
||||
|
||||
|
||||
<!--- ----------------------------------------------------------------- --->
|
||||
<!--- ----------------------------------------------------------------- --->
|
||||
<!--- ----------------------------------------------------------------- --->
|
||||
|
||||
<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> (#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"/>
|
||||
Reference in New Issue
Block a user