413 lines
13 KiB
Plaintext
413 lines
13 KiB
Plaintext
<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:silent silent="No">
|
|
|
|
<cffunction name="plain2HtmClean">
|
|
<cfargument name="s" type="string"/>
|
|
<cfreturn request.plain2htm(request.cleanHtm(s))/>
|
|
</cffunction>
|
|
|
|
<cffunction name="cleanInput">
|
|
<cfargument name="s" type="string"/>
|
|
<cfreturn htmlEditFormat(s)/>
|
|
</cffunction>
|
|
|
|
<m:prepare_detail entity="contragent" accessObject="" key="__id" pageInfoOut="pageInfo"/>
|
|
|
|
<d:bean readonly=true table="elma.companies" datasource="#request.DS#" output="d" status="status">
|
|
<d:param field="__id" type="uuid" key/>
|
|
<d:param field="__name" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/>
|
|
<d:param field="_inn" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/>
|
|
<d:param field="_kpp" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/>
|
|
<d:param field="id_klienta" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/>
|
|
<!--- *** билдер показывает... <d:param field="wz_id" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/> --->
|
|
<!--- <d:param field="code_inn" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/>
|
|
<d:param field="code_kpp" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/> --->
|
|
</d:bean>
|
|
|
|
|
|
<m:dispatch_detail
|
|
usePRG="No"<!---*** --->
|
|
pageInfo=#pageInfo#
|
|
id="#d.__id#"
|
|
status=#pageInfo.status#
|
|
trackOut="tr"
|
|
idAttributesOut="id"
|
|
/>
|
|
|
|
<!--- decoration --->
|
|
<!--- <cfquery name="qDecoration" datasource="#request.DS#">
|
|
select
|
|
a.login as creator, a.shortname as creator_shortname, m.login as updater, m.shortname as updater_shortname
|
|
from contragent g
|
|
left outer join usr a on (g.creator_id=a.usr_id)
|
|
left outer join usr m on (g.updater_id=m.usr_id)
|
|
where g.contragent_id=<cfqueryparam attributeCollection=#id#/>
|
|
</cfquery> --->
|
|
|
|
|
|
</m:silent><!---
|
|
------------------------------------------------------------------------------------------------------------------------
|
|
------------------------------------------------------------------------------------------------------------------------
|
|
------------------------------------------------------------------------------------------------------------------------
|
|
------------------------------------------------------------------------------------------------------------------------
|
|
------------------------------------------------------------------------------------------------------------------------
|
|
---><layout:page section="header" pageInfo=#pageInfo#>
|
|
<layout:attribute name="title">
|
|
<cfoutput>
|
|
Отчет по контрагенту
|
|
<cfif len(d.__id)>
|
|
<b>#d.__name#</b>
|
|
[#d.__id#]
|
|
</cfif>
|
|
</cfoutput>
|
|
</layout:attribute>
|
|
</layout:page>
|
|
|
|
<!--- <cfif status.errorState GT 0>
|
|
<cfoutput><div class="err">#status.errorMessage#</div></cfoutput>
|
|
</cfif>
|
|
--->
|
|
<cfoutput>
|
|
<input type="hidden" name="__id" value="#d.__id#"/>
|
|
<input type="hidden" name="track" value="#tr.self#"/>
|
|
<input type="hidden" name="pass" value=""/><!--- pass marker to prevent save on submit --->
|
|
|
|
<div class="detail">
|
|
|
|
<div class="tr">
|
|
<div class="th">ID</div>
|
|
<div class="td">#d.__id#</div>
|
|
</div>
|
|
|
|
<div class="tr">
|
|
<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">ИНН</div>
|
|
<div class="td">#d._inn#</div>
|
|
</div>
|
|
|
|
<div class="tr">
|
|
<div class="th">КПП</div>
|
|
<div class="td">#d._kpp#</div>
|
|
</div>
|
|
|
|
<div class="tr">
|
|
<div class="th">WZ</div>
|
|
<div class="td">#d.id_klienta#</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</cfoutput>
|
|
|
|
<layout:page section="extension" closeForm="Yes"/>
|
|
|
|
<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
|
|
,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
|
|
AND s.probability_pc >=50
|
|
ORDER BY __index --, version::int
|
|
</cfquery>
|
|
|
|
|
|
|
|
<cfoutput>
|
|
<h3>Услуги по данным CRM (версии строк спецификации, только актуальные на сегодня, сделки с вероятностью от 50% (начиная с тестирования) <!--- (#qService.recordCount#) ---></h3>
|
|
</cfoutput>
|
|
|
|
|
|
<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="5%">Вер.%</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#<cfif len(modifier_code)>.#modifier_code#</cfif></td>
|
|
<td class="l">#user_description#</td>
|
|
<td style="padding:0; vertical-align:bottom;">
|
|
<table class="wide" style="height:100%">
|
|
<cfset cost=0/>
|
|
<cfoutput group="p_uid">
|
|
<cfif p_cnt NEQ 0>
|
|
<tr>
|
|
<td class="nw">#code#</td>
|
|
<td>#name#</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>
|
|
</cfoutput>
|
|
</table>
|
|
</td>
|
|
<td class="c">#cnt#</td>
|
|
<td class="r">#nFmt(cost*cnt*(100-(isNumeric(discount)?discount:0))/100)#</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">#probability_pc#</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>
|
|
<!--- <i>отображаются позиции сделок, начиная с тестирования</i> --->
|
|
|
|
<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%">Статус организации</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>
|
|
|
|
|
|
<cfquery name="qGpu">
|
|
select
|
|
"Object_UUID"::text
|
|
,"Org"
|
|
,"OrgStatus"
|
|
,"OrgVDC"
|
|
,(select STRING_AGG(DISTINCT "Cluster",',') FROM vmreports.compute c
|
|
WHERE ts=(select max(ts) from vmreports.compute)
|
|
AND g."Org"=c."Organization") as org_cluster
|
|
,"Name"
|
|
,"GPU"
|
|
FROM vmreports.vm_gpu g
|
|
WHERE ts=(select max(ts) from vmreports.vm_gpu)
|
|
AND lower(g."ClientID")=lower(<cfqueryparam cfsqltype="cf_sql_varchar" value="#d.id_klienta#"/>)
|
|
|
|
</cfquery>
|
|
|
|
|
|
<h3>GPU факт</h3>
|
|
<table class="worktable">
|
|
<thead>
|
|
<tr>
|
|
<th width="10%">Организация</th>
|
|
<th width="10%">Статус организации</th>
|
|
<th width="10%">VDC</th>
|
|
<th width="10%">Кластер</th>
|
|
<th width="10%">VM</th>
|
|
<th width="5%">GPU</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<cfoutput query="qGpu">
|
|
<tr>
|
|
<td>#Org#</td>
|
|
<td>#OrgStatus#</td>
|
|
<td>#OrgVDC#</td>
|
|
<td>#org_cluster#</td>
|
|
<td>#Name#</td>
|
|
<td>#GPU#</td>
|
|
</tr>
|
|
</cfoutput>
|
|
|
|
</table>
|
|
|
|
<!--- ----------------------------------------------------------------- --->
|
|
<!--- ----------------------------------------------------------------- --->
|
|
<!--- ----------------------------------------------------------------- --->
|
|
<!--- <cfdump var=#qCompute#/>
|
|
<cfdump var=#qStorage#/> --->
|
|
|
|
</cfif><!--- len(d.__id) --->
|
|
<layout:page section="footer"/> |