084 airplane
This commit is contained in:
+4
-4
@@ -13,10 +13,10 @@
|
||||
<cfset this.setclientcookies="No"/>
|
||||
<cfset this.mappings = structNew() />
|
||||
<cfset this.mappings["/mod"] = getDirectoryFromPath(getCurrentTemplatePath()) & "mod/" />
|
||||
<cfset this.customTagPaths = expandPath(getDirectoryFromPath(getCurrentTemplatePath())&'mod')/>
|
||||
<cfset this.datasource = "dwh"/>
|
||||
<cfset this.customTagPaths = expandPath(getDirectoryFromPath(getCurrentTemplatePath())&'mod')/>
|
||||
<cfset this.timeZone = "Europe/Moscow"/><!--- для биллинга очень важен часовой пояс, поэтому ставим вручную в коде --->
|
||||
|
||||
<cfset this.datasource = "dwh"/>
|
||||
|
||||
<cfset this.defaultdatasource = this.datasource/>
|
||||
<cfset request.DS = "#this.datasource#">
|
||||
<!--- кажется, нужно инициализировать датасорцы в псевдоконструкторе - onRequest не получается --->
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
<!--- global settings --->
|
||||
<!--- *************************************************************************************************** --->
|
||||
<cfset request.APP_VERSION="0.00.083"/> <!--- *********************************************************** --->
|
||||
<cfset request.APP_VERSION="0.00.084"/> <!--- *********************************************************** --->
|
||||
<!--- *************************************************************************************************** --->
|
||||
<cfset request.STAND=getStand()/>
|
||||
<cfset request.RECORDS_PER_PAGE=500/>
|
||||
|
||||
+2
-80
@@ -44,91 +44,13 @@
|
||||
|
||||
|
||||
select
|
||||
count(distinct obj_id) as unique_vm_cnt,
|
||||
sum(p.value)/12. as vm_h, -- 5 minute sampling
|
||||
sum(p.value)/12.*32.18 as cost,
|
||||
sum(p.value)/12./744 as avg_month_vm -- в августе 744 часа
|
||||
count(distinct obj)
|
||||
sum(p.value)/12. as vm_h -- 5 minute sampling
|
||||
from gpu.vm
|
||||
JOIN gpu.vm_power_state p on (vm.obj_uuid=p.obj_uuid)
|
||||
where 1=1
|
||||
AND p.ts >= '2026-08-01'
|
||||
AND p.ts < '2026-08-31'
|
||||
AND vm.client_id='WZ01516'
|
||||
-- упражнение: посчитать, сколько средних ВМ, включенных круглые сутки, создаст такой же движ за время оказания сервиса
|
||||
|
||||
select
|
||||
p.ts::date,
|
||||
count(distinct obj_id) as unique_vm_cnt,
|
||||
round((sum(p.value)/12.)::numeric,1) as vm_h, -- 5 minute sampling
|
||||
round((sum(p.value)/12.*32.18)::numeric,2) as cost,
|
||||
round((sum(p.value)/12./24)::numeric, 1) as avg_roundclock_vm
|
||||
from gpu.vm
|
||||
JOIN gpu.vm_power_state p on (vm.obj_uuid=p.obj_uuid)
|
||||
where 1=1
|
||||
AND p.ts >= '2026-08-01'
|
||||
AND p.ts < '2026-08-31'
|
||||
AND vm.client_id='WZ01516'
|
||||
GROUP BY p.ts::date
|
||||
ORDER BY 1
|
||||
|
||||
select
|
||||
p.ts::date,
|
||||
count(distinct obj_id) as unique_vm_cnt,
|
||||
round((sum(p.value)/12.)::numeric,1) as vm_h, -- 5 minute sampling
|
||||
round((sum(p.value)/12.*32.18)::numeric,2) as cost,
|
||||
round((sum(p.value)/12.*32.18*(1-0.02*400/32.18))::numeric,2) as cost_wo_disk,
|
||||
round((count(distinct obj_id)*0.02*400*24)::numeric,2) as disk_cost_simplified, -- считаем все ВМ, включавшиеся за данные сутки
|
||||
round((sum(p.value)/12./24)::numeric, 1) as avg_roundclock_vm
|
||||
from gpu.vm
|
||||
JOIN gpu.vm_power_state p on (vm.obj_uuid=p.obj_uuid)
|
||||
where 1=1
|
||||
AND p.ts >= '2026-08-01'
|
||||
AND p.ts < '2026-08-31'
|
||||
AND vm.client_id='WZ01516'
|
||||
GROUP BY p.ts::date
|
||||
ORDER BY 1
|
||||
|
||||
select
|
||||
p.ts::date,
|
||||
count(distinct obj_id) as unique_vm_cnt,
|
||||
(select count(distinct obj_id) from gpu.vm vm1
|
||||
JOIN gpu.vm_power_state p1 on (vm1.obj_uuid=p1.obj_uuid)
|
||||
WHERE vm1.client_id='WZ01516' AND p1.ts <= p.ts::date) as unique_vm_acc,
|
||||
round((sum(p.value)/12.)::numeric,1) as vm_h, -- 5 minute sampling
|
||||
round((sum(p.value)/12.*32.18)::numeric,2) as cost,
|
||||
round((sum(p.value)/12.*32.18*(1-0.02*400/32.18))::numeric,2) as cost_wo_disk,
|
||||
round((count(distinct obj_id)*0.02*400*24)::numeric,2) as disk_cost_simplified, -- считаем все ВМ, включавшиеся за данные сутки
|
||||
round((sum(p.value)/12./24)::numeric, 1) as avg_roundclock_vm
|
||||
from gpu.vm
|
||||
JOIN gpu.vm_power_state p on (vm.obj_uuid=p.obj_uuid)
|
||||
where 1=1
|
||||
AND p.ts >= '2026-08-01'
|
||||
AND p.ts < '2026-08-31'
|
||||
AND vm.client_id='WZ01516'
|
||||
GROUP BY p.ts::date
|
||||
ORDER BY 1
|
||||
|
||||
|
||||
with daily as (
|
||||
select
|
||||
p.ts::date as dt,
|
||||
count(distinct obj_id) as unique_vm_cnt,
|
||||
round((sum(p.value)/12.)::numeric,1) as vm_h, -- 5 minute sampling
|
||||
round((sum(p.value)/12.*32.18)::numeric,2) as cost,
|
||||
round((sum(p.value)/12.*32.18*(1-0.02*400/32.18))::numeric,2) as cost_wo_disk,
|
||||
round((count(distinct obj_id)*0.02*400*24)::numeric,2) as disk_cost_simplified, -- считаем все ВМ, включавшиеся за данные сутки
|
||||
round((sum(p.value)/12./24)::numeric, 1) as avg_roundclock_vm
|
||||
from gpu.vm
|
||||
JOIN gpu.vm_power_state p on (vm.obj_uuid=p.obj_uuid)
|
||||
where 1=1
|
||||
AND p.ts >= '2026-08-01'
|
||||
AND p.ts < '2026-08-31'
|
||||
AND vm.client_id='WZ01516'
|
||||
GROUP BY p.ts::date
|
||||
ORDER BY 1
|
||||
),
|
||||
acc as (select p.ts::date as dt, count(distinct obj_id) as unique_vm_accum from gpu.vm
|
||||
JOIN gpu.vm_power_state p on (vm.obj_uuid=p.obj_uuid)
|
||||
WHERE vm.client_id='WZ01516'
|
||||
group by p.ts::date)
|
||||
select * from daily join acc on daily.dt<=acc.dt
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<c:menu_item acl="" page="cloud_capacity.cfm" label="Cloud Capacity"/>
|
||||
<c:menu_item acl="" page="payg.cfm" label="PAYG"/>
|
||||
<c:menu_item acl="" page="test_storage_rpt.cfm" label="Тесты и хранение"/>
|
||||
<c:menu_item acl="" page="vm_gpu_rpt.cfm" label="Аэроплан"/>
|
||||
|
||||
<li class="menu-title">Справочники</li>
|
||||
|
||||
|
||||
@@ -754,7 +754,7 @@ S3 операции и трафик: <b<cfif datediff("h",qS3OpsTrfAge.dt_load,
|
||||
</cfoutput><!--- code --->
|
||||
|
||||
<tr>
|
||||
<td bgcolor="##eee" style="border-bottom:2px solid gray;"></td>и
|
||||
<td bgcolor="##eee" style="border-bottom:2px solid gray;"></td>
|
||||
<td bgcolor="##eee" colspan="10" class="r b" style="border-bottom:2px solid gray;">Итого <a href="contragent.cfm?__id=#contragent_uid#&#tr.fwx#">#wz#</a> #contragent#:</td>
|
||||
<td bgcolor="##eee" class="r b nw" style="border-bottom:2px solid gray; font-size:130%;">#accum_cost_svc#</td>
|
||||
<td bgcolor="##eee" style="border-bottom:2px solid gray;"></td>
|
||||
|
||||
+49
-291
@@ -5,7 +5,7 @@
|
||||
<cfimport prefix="layout" taglib="layout"/>
|
||||
</cfsilent>
|
||||
|
||||
<m:prepare_ls entity="vm_gpu" accessObject="" pageInfoOut="pageInfo" trackOut="tr"/>
|
||||
<m:prepare_ls entity="vm_gpu_rpt" accessObject="" pageInfoOut="pageInfo" trackOut="tr"/>
|
||||
|
||||
|
||||
<cfparam name="dt_finish" type="date" default=#dateAdd('d',-1,createDateTime(year(Now()),month(Now()),1,0,0,0))#/>
|
||||
@@ -16,165 +16,55 @@
|
||||
<cfparam name="code" default=""/>
|
||||
|
||||
|
||||
<!--- <cfquery name="qCode" datasource="dwh" cachedWithin=#createTimeSpan(0, 0, 20, 0)#>
|
||||
select distinct p.code
|
||||
from elma.deals d
|
||||
join elma.deals_services siv on (d.__id=ANY(siv.deal))
|
||||
join elma.service_parametrs p on (p.__id = ANY(siv.params))
|
||||
join elma.companies k on (d._companies=k.__id)
|
||||
join elma.additional_agreements aa on (aa.__id = ANY(siv.additional_agreement))
|
||||
join elma.aggrements a on (aa.contract_uid = a.__id)
|
||||
where p.type=3 AND aa.is_actual
|
||||
order by p.code
|
||||
</cfquery>
|
||||
<cfoutput>qCode:#getTickCount()-request.startTickCount#</cfoutput>
|
||||
<cfif !isDefined("output_xls") AND !isDefined("output_json")><cfflush/></cfif>
|
||||
|
||||
|
||||
<cfquery name="qContragent" datasource="dwh" cachedWithin=#createTimeSpan(0, 0, 22, 0)#>
|
||||
select upper(trim(k.id_klienta)) as wz, k.__id::text as contragent_uid, k.__name as contragent,
|
||||
c.__name as responsible, c.email as responsible_email, c.__status_status as responsible_status
|
||||
from elma.companies k
|
||||
LEFT OUTER JOIN elma.comp_users_ext c on (k.responsible=c.__id)
|
||||
where k."__deletedAt" IS NULL
|
||||
<cfif len(wz)>
|
||||
AND k.id_klienta like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#wz#%"/>
|
||||
</cfif>
|
||||
</cfquery> --->
|
||||
|
||||
<!--- <cfoutput>qContragent:#getTickCount()-request.startTickCount#</cfoutput>
|
||||
<cfif !isDefined("output_xls") AND !isDefined("output_json")><cfflush/></cfif> --->
|
||||
|
||||
<!--- <cfquery name="qSpec" datasource="dwh" cachedWithin=#createTimeSpan(0, 0, 23, 0)#>
|
||||
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 upper(trim(k.id_klienta)) as wz, k.__id::text as contragent_uid,
|
||||
p.code,
|
||||
SUBSTRING(p.code FROM 1 FOR LENGTH(p.code) - 2) as sku_code,
|
||||
p.price, p.discount as component_discount, k.__name as contragent, a.__name as contract, a.__id::text as contract_uid, d.__name as deal, d.__id::text as deal_uid, siv.abstractive_service as abstract_service, siv.modifier, siv.user_description, siv.hash as line_key
|
||||
,siv.date_nop as serviceStart, siv.date_end as serviceEnd, siv.discount as service_discount, siv.cnt as service_quantity
|
||||
/*,p.__name as line_key*/, p.ed_izm, p.name as component, p.type, p.cnt*coalesce(siv.cnt,1) as component_quantity,
|
||||
aa.__name as additional_agreement, aa.__id::text as additional_agreement_uid
|
||||
--, aa.is_actual
|
||||
,siv.end_customer as end_customer_uid
|
||||
,z.id_klienta as end_customer_wz
|
||||
,z.__name as end_customer_name
|
||||
,ft.free_tier
|
||||
,s.probability_pc
|
||||
,siv.__id::text as siv_uid
|
||||
from elma.deals d
|
||||
JOIN STATUS s ON (d.__status_status = s.status_id)
|
||||
join elma.deals_services siv on (d.__id=ANY(siv.deal))
|
||||
--join elma.service_parametrs p on (p.__id = ANY(siv.params))
|
||||
LEFT JOIN LATERAL unnest(siv.params) AS arr(param_id) ON TRUE
|
||||
JOIN elma.service_parametrs p ON (p.__id = arr.param_id)
|
||||
join elma.companies k on (d._companies=k.__id)
|
||||
join elma.additional_agreements aa on (aa.__id = ANY(siv.additional_agreement))
|
||||
join elma.aggrements a on (aa.contract_uid = a.__id)
|
||||
left outer join elma.companies z on (siv.end_customer=z.__id)
|
||||
left outer join (values ('paas.s3.ceph.vol-m',1),('paas.s3.ceph.get-m',10),('paas.s3.ceph.put-m',1),('paas.s3.ceph.trf-m',100)) as ft(code,free_tier) ON (p.code=ft.code)
|
||||
where p.type IN (2,3) AND aa.is_actual
|
||||
AND siv.date_nop < <cfqueryparam cfsqltype="cf_sql_timestamp" value=#dt_finish#/>
|
||||
AND (siv.date_end > <cfqueryparam cfsqltype="cf_sql_timestamp" value=#dt_start#/> OR siv.date_end IS NULL)/*****/
|
||||
AND aa."__deletedAt" IS NULL
|
||||
AND a."__deletedAt" IS NULL
|
||||
AND d."__deletedAt" IS NULL
|
||||
AND siv."__deletedAt" IS NULL
|
||||
AND p."__deletedAt" IS NULL
|
||||
AND p.cnt <> 0 --похоже, только так можно отфильтровать паразитные строки с нулем
|
||||
<cfif len(wz)>
|
||||
AND k.id_klienta like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#wz#%"/>
|
||||
</cfif>
|
||||
<cfif len(code)>
|
||||
AND p.code like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#code#%"/>
|
||||
</cfif>
|
||||
--AND k.id_klienta='WZ01031'
|
||||
--AND k.id_klienta='WZ01112'
|
||||
order by k.id_klienta, p.code
|
||||
</cfquery> --->
|
||||
<!--- select * from elma.deals_services where __id='019edf9c-c1e8-7acd-8b63-5369e5be5bf5'
|
||||
union all
|
||||
select * from elma.deals_services where __id='019edf9c-c23d-7ad6-a990-643dd09579b8' --->
|
||||
|
||||
<!--- <cfoutput>qSpec:#getTickCount()-request.startTickCount#</cfoutput><cfif !isDefined("output_xls") AND !isDefined("output_json")><cfflush/></cfif>
|
||||
<cfif isDefined("DEBUG")>
|
||||
<cfdump var=#qSpec#/>
|
||||
<cfif !isDefined("output_xls") AND !isDefined("output_json")><cfflush/></cfif>
|
||||
</cfif> --->
|
||||
|
||||
|
||||
|
||||
<cfquery name="qGpu" datasource="billing-vc" cachedWithin=#createTimeSpan(0, 0, 25, 0)#>
|
||||
<cfquery name="qRead" datasource="billing-s3">
|
||||
select
|
||||
p.ts::date,
|
||||
count(distinct p.obj_uuid) as unique_vm_cnt,
|
||||
count(distinct p.obj_uuid) FILTER (WHERE p.value=1) as unique_vm_cnt_on,
|
||||
round((sum(p.value)/12.)::numeric,1) as vm_h, -- 5 minute sampling
|
||||
round((sum(p.value)/12.*32.18)::numeric,2) as cost,
|
||||
<!--- round((sum(p.value)/12.*32.18*(1-0.02*400/32.18))::numeric,2) as cost_wo_disk,
|
||||
round((count(distinct obj_id)*0.02*400*24)::numeric,2) as disk_cost, -- считаем все ВМ, включавшиеся за данные сутки --->
|
||||
round((sum(p.value)/12./24)::numeric, 1) as avg_roundclock_vm
|
||||
<d:field_set titleMapOut="titleMap" lengthOut="fieldCount">
|
||||
<d:field title="Час" cfSqlType="CF_SQL_TIMESTAMP">DATE_TRUNC('hour',p.ts) as ts_hour</d:field>
|
||||
<d:field title="Уникальных ВМ" cfSqlType="CF_SQL_INTEGER">count(distinct p.obj_uuid) as unique_vm_cnt</d:field> <!--- -- все ВМ, существовавшие в данный час --->
|
||||
<d:field title="ВМ вкл." cfSqlType="CF_SQL_INTEGER">count(distinct p.obj_uuid) FILTER (WHERE p.value=1) as unique_vm_cnt_on</d:field> <!--- -- все ВМ, включавшиеся за данный час --->
|
||||
<d:field title="ВМ-часов" cfSqlType="CF_SQL_NUMERIC">round((sum(p.value)/12.)::numeric,1) as vm_h</d:field> <!--- -- 5 minute sampling, so /12 --->
|
||||
<d:field title="Стоимость без диска" cfSqlType="CF_SQL_NUMERIC">round((sum(p.value)/12.*24.19)::numeric,2) as cost_wo_disk</d:field>
|
||||
<d:field title="Стоимость диска" cfSqlType="CF_SQL_NUMERIC">round((count(distinct obj_id)*8.00)::numeric,2) as disk_cost</d:field> <!--- -- считаем все ВМ, существовавшие в данный час --->
|
||||
<d:field title="Круглосуточных ВМ" cfSqlType="CF_SQL_NUMERIC">round((sum(p.value)/12.)::numeric, 1) as avg_roundclock_vm</d:field>
|
||||
</d:field_set>
|
||||
from gpu.vm
|
||||
JOIN gpu.vm_power_state p on (vm.obj_uuid=p.obj_uuid)
|
||||
where 1=1
|
||||
AND p.ts >= <cfqueryparam cfsqltype="cf_sql_timestamp" value=#dt_start#/>
|
||||
AND p.ts < <cfqueryparam cfsqltype="cf_sql_timestamp" value=#dateAdd("d",1,dt_finish)#/>
|
||||
<cfif len(wz)>
|
||||
AND vm.client_id like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#wz#%"/>
|
||||
</cfif>
|
||||
GROUP BY p.ts::date
|
||||
ORDER BY 1
|
||||
/*watch time zone, accounting by MSK*/
|
||||
AND p.ts >= <cfqueryparam cfsqltype="cf_sql_timestamp" value=#dt_start#/>
|
||||
AND p.ts < <cfqueryparam cfsqltype="cf_sql_timestamp" value=#dateAdd("d",1,dt_finish)#/>
|
||||
AND vm.client_id='WZ01516'
|
||||
GROUP BY DATE_TRUNC('hour',p.ts)
|
||||
ORDER BY 1;
|
||||
</cfquery>
|
||||
|
||||
<!--- recommended CREATE INDEX idx_tenant_metadata_tenant_ts_desc ON ngcloud_ru.tenant_metadata (tenant_id, ts DESC, metadata_id DESC); --->
|
||||
|
||||
<cfoutput>qComputing:#getTickCount()-request.startTickCount#</cfoutput><cfif !isDefined("output_xls") AND !isDefined("output_json")><cfflush/></cfif>
|
||||
|
||||
<cfif isDefined("DEBUG")>
|
||||
<cfdump var=#qComputing#/>
|
||||
<cfdump var=#qRead#/>
|
||||
<cfif !isDefined("output_xls") AND !isDefined("output_json")><cfflush/></cfif>
|
||||
</cfif>
|
||||
|
||||
<cfquery name="qComputingAge" datasource="billing-vc" cachedWithin=#createTimeSpan(0, 0, 25, 0)#>
|
||||
select max(capacity_resource.timestamp) as dt_load from ngcloud_ru.capacity_resource
|
||||
<cfquery name="qGpuAge" datasource="billing-s3"><!--- cachedWithin=#createTimeSpan(0, 0, 25, 0)# --->
|
||||
select max(ts) as dt_load from gpu.vm_power_state
|
||||
</cfquery>
|
||||
|
||||
<cfoutput>qComputingAge:#getTickCount()-request.startTickCount#</cfoutput><cfif !isDefined("output_xls") AND !isDefined("output_json")><cfflush/></cfif>
|
||||
|
||||
|
||||
<!---
|
||||
|
||||
<cfset db = new MemoryDbHelper()/>
|
||||
<cfset db.register("qUnifiedMetric", qUnifiedMetric, "inmem")/>
|
||||
<cfset db.register("qContragent", qContragent, "inmem")/>
|
||||
<cfset db.register("qSpec", qSpec, "inmem")/> --->
|
||||
|
||||
|
||||
|
||||
<!--- <cfdump var=#qCharge#/> --->
|
||||
|
||||
<cfoutput>qCharge:#getTickCount()-request.startTickCount#</cfoutput><cfif !isDefined("output_xls") AND !isDefined("output_json")><cfflush/></cfif>
|
||||
<cfif isDefined("DEBUG")>
|
||||
<cfdump var=#qCharge#/>
|
||||
<cfif !isDefined("output_xls") AND !isDefined("output_json")><cfflush/></cfif>
|
||||
</cfif>
|
||||
<cfoutput>qGpuAge:#getTickCount()-request.startTickCount#</cfoutput><cfif !isDefined("output_xls") AND !isDefined("output_json")><cfflush/></cfif>
|
||||
|
||||
|
||||
<cfif isDefined("output_xls")>
|
||||
<layout:xml qRead=#qCharge# titleMap=#titleMap# filename="#pageInfo.entity#.xml"/>
|
||||
<layout:xml qRead=#qRead# titleMap=#titleMap# filename="#pageInfo.entity#.xml"/>
|
||||
<cfabort/>
|
||||
</cfif><cfif isDefined("output_json")>
|
||||
<layout:json qRead=#qCharge# titleMap=#titleMap# filename="#pageInfo.entity#.json"/>
|
||||
<layout:json qRead=#qRead# titleMap=#titleMap# filename="#pageInfo.entity#.json"/>
|
||||
<cfabort/>
|
||||
</cfif><!---
|
||||
---><layout:page section="header" pageInfo=#pageInfo#>
|
||||
|
||||
<layout:attribute name="title">
|
||||
<cfoutput><b>Отчет по PAYG</b></cfoutput>
|
||||
<cfoutput><b>Отчет по включенным ВМ с GPU</b></cfoutput>
|
||||
</layout:attribute>
|
||||
<layout:attribute name="controls">
|
||||
<!---skip filter link, filter is not implemented--->
|
||||
@@ -182,28 +72,21 @@ ORDER BY 1
|
||||
</layout:attribute>
|
||||
</layout:page>
|
||||
|
||||
Факт потребления по основной базе биллинга, спецификации из DWH. Без детализации по бакетам, VDC и т.д.
|
||||
Все запросы кэшированы на 25 минут.<br/>
|
||||
Внимание! округление вверх при расчете метрик get, put S3. Расчетные суммы могут содержать погрешности округления, поэтому окончательный расчет стоимости (количество * цену) должен выполняться в бухгалтерской программе.
|
||||
<b>Если у клиента больше 1 действующего допника с услугами PAYG, то данные в отчете могут быть замножены, в этом случае считать вручную</b>
|
||||
<br/>
|
||||
Даты актуальности пока проверять вручную. Обращать внимание на замножение строк.
|
||||
|
||||
<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')#"/>
|
||||
Только PAYG <input type="checkbox" name="only_articles_in_spec" value="1"<cfif only_articles_in_spec> checked</cfif>/>
|
||||
WZ <input type="text" name="wz" value="#wz#"/>по вхождению, с регистром
|
||||
Код <input type="text" name="code" value="#code#"/>по вхождению
|
||||
|
||||
<!--- WZ <input type="text" name="wz" value="#wz#"/>по вхождению, с регистром
|
||||
Код <input type="text" name="code" value="#code#"/>по вхождению --->
|
||||
<input type="submit" style="cursor:pointer;"/>
|
||||
<input type="submit" name="DEBUG" value="DEBUG" style="cursor:pointer;"/><!--- #dateFormat( input, "yyyy-mm-dd" )#T#timeFormat( input, "HH:mm:ss.lXX" )# --->
|
||||
</form>
|
||||
Часов в периоде: <b>#hours#</b> Строк в отчете: <b>#qCharge.recordCount#</b><br/>
|
||||
Часов в периоде: <b>#hours#</b> Строк в отчете: <b>#qRead.recordCount#</b><br/>
|
||||
Актуальность данных:
|
||||
VCD Computing: <b<cfif datediff("h",qComputingAge.dt_load, Now()) GT 24> class="err"</cfif>>>#dateFormat(qComputingAge.dt_load,'YYYY-MM-DD')# #timeFormat(qComputingAge.dt_load,'HH:mm:ss.lXX')#</b>
|
||||
VCD Storage: <b<cfif datediff("h",qStorageAge.dt_load, Now()) GT 24> class="err"</cfif>>>#dateFormat(qStorageAge.dt_load,'YYYY-MM-DD')# #timeFormat(qStorageAge.dt_load,'HH:mm:ss.lXX')#</b>
|
||||
S3 хранение: <b<cfif datediff("h",qS3VolAge.dt_load, Now()) GT 24> class="err"</cfif>>>#dateFormat(qS3VolAge.dt_load,'YYYY-MM-DD')# #timeFormat(qS3VolAge.dt_load,'HH:mm:ss.lXX')#</b>
|
||||
S3 операции и трафик: <b<cfif datediff("h",qS3OpsTrfAge.dt_load, Now()) GT 24> class="err"</cfif>>>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-MM-DD')# #timeFormat(qS3OpsTrfAge.dt_load,'HH:mm:ss.lXX')#</b>
|
||||
GPU-VM Power State: <b<cfif datediff("h",qGpuAge.dt_load, Now()) GT 24> class="err"</cfif>>#dateFormat(qGpuAge.dt_load,'YYYY-MM-DD')# #timeFormat(qGpuAge.dt_load,'HH:mm:ss.lXX')#</b>
|
||||
</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>
|
||||
@@ -212,156 +95,31 @@ S3 операции и трафик: <b<cfif datediff("h",qS3OpsTrfAge.dt_load,
|
||||
</cfoutput>
|
||||
<table class="worktable">
|
||||
<thead>
|
||||
<td width="1%"></td>
|
||||
<!--- <th width="3%">WZ</th> --->
|
||||
<th width="7%">Услуга</th>
|
||||
<th width="7%">Артикул специф.</th>
|
||||
<th width="5%">Кол-во специф.</th>
|
||||
<th width="5%">Артикул метр.</th>
|
||||
<th width="10%">Детализация</th>
|
||||
<th width="5%">Кол-во метр.</th>
|
||||
<th width="5%">Free Tier.</th>
|
||||
<th width="5%">Опл. объем</th>
|
||||
<th width="3%">Ед.изм.</th>
|
||||
<th width="3%">Цена ₽ со скид., с НДС</th>
|
||||
<th width="3%">Стоимость ₽ с НДС</th>
|
||||
|
||||
<td width="3%"> </td>
|
||||
|
||||
<td width="10%">Компонент</td>
|
||||
<td width="15%">Польз. наим.</td>
|
||||
|
||||
<td width="3%">GPL с НДС</td>
|
||||
<td width="3%">Скидка%</td>
|
||||
|
||||
<td width="3%">Дата НОУ</td>
|
||||
<td width="3%">Дата КОУ</td>
|
||||
|
||||
<td width="5%">Ключ строки</td>
|
||||
<td width="3%">Сырая метрика</td>
|
||||
<td width="3%">Приведен­ная метрика</td>
|
||||
|
||||
<td width="3%">Цена ₽ до ск. с НДС</td>
|
||||
<td width="3%">Цена ₽ co ск. с НДС без окр.</td>
|
||||
<td width="3%">Service Quantity</td>
|
||||
<td width="3%">Service Discount</td>
|
||||
<td width="3%">Component Quantity</td>
|
||||
<td width="3%">Component Discount</td>
|
||||
|
||||
<td width="5%">Договор</td>
|
||||
<td width="10%">Допник</td>
|
||||
<td width="10%">Сделка</td>
|
||||
<td width="3%">Конечник</td>
|
||||
|
||||
<th width="10%">Час</th>
|
||||
<th width="10%">Уникальных ВМ</th>
|
||||
<th width="10%">ВМ вкл</th>
|
||||
<th width="10%">ВМ-часов</th>
|
||||
<th width="10%">Стоимость без диска</th>
|
||||
<th width="10%">Стоимость диска</th>
|
||||
<th width="10%">Круглосуточных ВМ</th>
|
||||
</thead>
|
||||
|
||||
<cfoutput query="qCharge" group="wz">
|
||||
|
||||
<cfset var accum_cost_svc = 0/>
|
||||
<cfset var accum_metric_svc = 0/>
|
||||
<cfset var acc=0/>
|
||||
<cfoutput query="qRead">
|
||||
<tr>
|
||||
<td bgcolor="##ccc"></td>
|
||||
<td bgcolor="##ccc" colspan="99">
|
||||
<b>
|
||||
<a href="contragent.cfm?__id=#contragent_uid#&#tr.fwx#">#wz#</a>
|
||||
#contragent#
|
||||
<a href="contragent_rpt.cfm?__id=#contragent_uid#&#tr.fwx#">(сводка)</a>
|
||||
</b>
|
||||
ответственный:
|
||||
<span <cfif responsible_status NEQ 2> class="err"</cfif>>#responsible# <a href="mailto:#responsible_email#">#responsible_email#</a></span>
|
||||
</td>
|
||||
|
||||
<td class="c">#dateFormat(ts_hour,"YYYY-MM-DD")# #timeFormat(ts_hour,"HH:MM")#</td>
|
||||
<td class="r">#unique_vm_cnt#</td>
|
||||
<td class="r">#unique_vm_cnt_on#</td>
|
||||
<td class="r">#vm_h#</td>
|
||||
<td class="r">#cost_wo_disk#</td>
|
||||
<td class="r">#disk_cost#</td>
|
||||
<td class="r">#avg_roundclock_vm#</td>
|
||||
</tr>
|
||||
<cfoutput group="code">
|
||||
<cfoutput group="serviceStart">
|
||||
|
||||
<cfset accum_metric_svc += isNumeric(metric) ? metric : 0/>
|
||||
<cfset accum_metric_dimension_1 = 0/>
|
||||
<cfset current_price=0/>
|
||||
|
||||
<cfoutput><!--- dimensions --->
|
||||
|
||||
<cfif type EQ 3>
|
||||
<cfset accum_metric_dimension_1 += isNumeric(metric) ? metric : 0/>
|
||||
<cfset current_price=gaussianRound(discounted_price, 2)/>
|
||||
</cfif>
|
||||
<!--- детализация --->
|
||||
<tr<cfif !len(unit)> class="gray"</cfif>>
|
||||
<td>#currentRow#</a></td>
|
||||
<td>#abstract_service#<cfif len(modifier)>: #modifier#</cfif></a></td>
|
||||
<td><div<cfif type EQ 3> style="background:lightgreen;color:black;"</cfif>>#s_code#</div></td>
|
||||
<td class=<cfif type EQ 3 AND component_quantity NEQ 1>"err r"<cfelse>"r"</cfif>>#component_quantity#</td>
|
||||
<td>#m_code#</td>
|
||||
<td>#dimension1#</td>
|
||||
<td class="r" style="font-size:110%; padding:0 1em;">#request.roundSafe(metric,3)#</td>
|
||||
<td class="r">#free_tier#</td>
|
||||
<td></td>
|
||||
<td style="font-size:90%;">#unit# <cfif len(ed_izm)>[#ed_izm#]</cfif></td><!--- #len(unit)?unit:'['& ed_izm &']'# --->
|
||||
<td class="r">#gaussianRound(discounted_price,2)#</td>
|
||||
<td class="r"></td>
|
||||
|
||||
<td></td>
|
||||
|
||||
<td>#component#</td>
|
||||
<td>#user_description#</td>
|
||||
|
||||
<td class="r">#gaussianRoundSafe(price,2)#</td>
|
||||
<td class="r">#component_discount#</td>
|
||||
|
||||
<td class="r">#dateFormat(serviceStart,'YYYY-MM-DD')#</td>
|
||||
<td class="r">#dateFormat(serviceEnd,'YYYY-MM-DD')#</td>
|
||||
|
||||
<td class="r">#line_key#</td>
|
||||
<td class="r" style="color:##bbb">#request.roundSafe(raw_metric,3)#</td>
|
||||
<td class="r">#request.roundSafe(metric,3)#</td>
|
||||
|
||||
<!--- сырые исходные данные без округлений --->
|
||||
<td class="r">#price#</td>
|
||||
<td class="r">#discounted_price#</td><!--- style="word-wrap:break-word" --->
|
||||
<td class="r">#service_quantity#</td>
|
||||
<td class="r">#service_discount#</td>
|
||||
<td class="r">#component_quantity#</td>
|
||||
<td class="r">#component_discount#</td>
|
||||
|
||||
<td><a href="contract.cfm?__id=#contract_uid#&#tr.fwx#">#contract#</a></td>
|
||||
<td><a href="additional_agreement.cfm?__id=#additional_agreement_uid#&#tr.fwx#">#additional_agreement#</a></td>
|
||||
<td><a href="deal.cfm?__id=#deal_uid#&#tr.fwx#">#deal#</a></td>
|
||||
<td>#WZE#</td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
<cfset final_metric_dimension_1 = ceiling(accum_metric_dimension_1)/>
|
||||
<cfset cost_dimension_1 = precisionEvaluate("gaussianRound(max(final_metric_dimension_1 - free_tier, 0)*current_price, 2)")/>
|
||||
<cfset accum_cost_svc = precisionEvaluate("accum_cost_svc + cost_dimension_1")/><!--- простое сложение дает ошибку округления и лишние знаки, но и precisionEvaluate не выглядит слишком надежным --->
|
||||
<tr>
|
||||
<td colspan="4"></td>
|
||||
<td colspan="2" class="b r">Итого #code#:</td>
|
||||
<td class="b r" style="font-size:110%; padding:0 1em;"><cfif final_metric_dimension_1 NEQ 0 AND isNumeric(final_metric_dimension_1)>#round(final_metric_dimension_1,3)#</cfif></td>
|
||||
<td class="b r">#free_tier#</td>
|
||||
<td class="b r" style="font-size:120%; padding:0 1em;"><cfif final_metric_dimension_1 NEQ 0 AND isNumeric(final_metric_dimension_1)>#max(ceiling(final_metric_dimension_1) - free_tier, 0)#</cfif></td>
|
||||
<td class="b c">#unit# <cfif len(ed_izm)>[#ed_izm#]</cfif></td>
|
||||
<td class="b r">#current_price#</td>
|
||||
<td class="b r">#gaussianRoundSafe(cost_dimension_1,2)#</td>
|
||||
<td></td>
|
||||
<td colspan="100"></td>
|
||||
</tr>
|
||||
</cfoutput><!--- serviceStart --->
|
||||
</cfoutput><!--- code --->
|
||||
|
||||
<tr>
|
||||
<td bgcolor="##eee" style="border-bottom:2px solid gray;"></td>
|
||||
<td bgcolor="##eee" colspan="10" class="r b" style="border-bottom:2px solid gray;">Итого <a href="contragent.cfm?__id=#contragent_uid#&#tr.fwx#">#wz#</a> #contragent#:</td>
|
||||
<td bgcolor="##eee" class="r b nw" style="border-bottom:2px solid gray; font-size:130%;">#accum_cost_svc#</td>
|
||||
<td bgcolor="##eee" style="border-bottom:2px solid gray;"></td>
|
||||
<td bgcolor="##eee" colspan="99" style="border-bottom:2px solid gray;"></td>
|
||||
</tr >
|
||||
</cfoutput><!--- wz --->
|
||||
|
||||
</cfoutput>
|
||||
</table>
|
||||
<!--- <cfdump var=#qCharge#/> --->
|
||||
|
||||
<!---
|
||||
<cfdump var=#this.datasources[request.ds].connectionString#/>
|
||||
<cfdump var=#this.datasources["billing-vc"].connectionString#/>
|
||||
<cfdump var=#this.datasources["billing-vc"].connectionString#/> --->
|
||||
<cfdump var=#this.datasources["billing-s3"].connectionString#/>
|
||||
|
||||
<layout:page section="footer"/>
|
||||
|
||||
Reference in New Issue
Block a user