024 improvements
This commit is contained in:
+16
-7
@@ -28,6 +28,8 @@
|
|||||||
<!--- <cfset this.iam_url = "https://auth-api.ngcloud.ru/api/v1/auth/user"/> --->
|
<!--- <cfset this.iam_url = "https://auth-api.ngcloud.ru/api/v1/auth/user"/> --->
|
||||||
<cfset this.iamServiceUrl = "https://auth-api-dev.ngcloud.ru/api/v1/auth/user "/>
|
<cfset this.iamServiceUrl = "https://auth-api-dev.ngcloud.ru/api/v1/auth/user "/>
|
||||||
<cfset this.redirect_uri = "https://#CGI.SERVER_NAME##CGI.SCRIPT_NAME#"/><!--- куда возвращаться от IDP --->
|
<cfset this.redirect_uri = "https://#CGI.SERVER_NAME##CGI.SCRIPT_NAME#"/><!--- куда возвращаться от IDP --->
|
||||||
|
<cfset this.crm_cache_host = "elma-cache.adl.nubes.ru"/><!--- *** почему-то приходится устанавливать серт sslCertificateInstall, иначе не коннектится --->
|
||||||
|
<cfset request.crm_cache_base = "https://#this.crm_cache_host#/contract_ls.cfm"/>
|
||||||
|
|
||||||
<cfset this.datasource = "rpt"/><!--- к буферной базе --->
|
<cfset this.datasource = "rpt"/><!--- к буферной базе --->
|
||||||
<cfset this.defaultdatasource = this.datasource/>
|
<cfset this.defaultdatasource = this.datasource/>
|
||||||
@@ -92,7 +94,7 @@
|
|||||||
|
|
||||||
<!--- global settings --->
|
<!--- global settings --->
|
||||||
<cfset request.RECORDS_PER_PAGE=500/>
|
<cfset request.RECORDS_PER_PAGE=500/>
|
||||||
<cfset request.APP_VERSION="0.00.023"/>
|
<cfset request.APP_VERSION="0.00.024"/>
|
||||||
<cfheader name="X-Application-Version" value=#request.APP_VERSION#/>
|
<cfheader name="X-Application-Version" value=#request.APP_VERSION#/>
|
||||||
<cfset request.STAND=getStand()/>
|
<cfset request.STAND=getStand()/>
|
||||||
|
|
||||||
@@ -241,7 +243,9 @@
|
|||||||
}
|
}
|
||||||
result = prefix.filecontent;
|
result = prefix.filecontent;
|
||||||
var idpUserData=deserializeJson(result);
|
var idpUserData=deserializeJson(result);
|
||||||
//request.auth.wz=idpUserData.userInfo.ClientId;//GUID!
|
request.auth.wz=idpUserData.userInfo.ClientId;
|
||||||
|
|
||||||
|
//writeDump(idpUserData);
|
||||||
|
|
||||||
|
|
||||||
request.auth.login = idpUserData.userInfo.login;
|
request.auth.login = idpUserData.userInfo.login;
|
||||||
@@ -342,11 +346,16 @@
|
|||||||
// после возвращения от IDP нам нужно будет зачистить сессию SSO, сделаем это по слову logout
|
// после возвращения от IDP нам нужно будет зачистить сессию SSO, сделаем это по слову logout
|
||||||
}
|
}
|
||||||
|
|
||||||
request.auth.wz='WZ01348'; //*******************
|
//request.auth.wz='WZ01348'; //*******************
|
||||||
request.auth.wz='WZ01005'; //*******************
|
//request.auth.wz='WZ01005'; //*******************
|
||||||
request.auth.wz='WZ01653'; //*******************
|
//request.auth.wz='WZ01653'; //*******************
|
||||||
request.auth.wz='WZ02319'; //*******************
|
//request.auth.wz='WZ02319'; //*******************
|
||||||
request.auth.wz='WZ01762'; //*******************
|
//request.auth.wz='WZ01762'; //*******************
|
||||||
|
//writedump(request.auth);abort;
|
||||||
|
//********************
|
||||||
|
//костыль
|
||||||
|
if (structKeyExists(URL,"wz")) { request.auth.wz=URL.wz }
|
||||||
|
//*********************
|
||||||
</cfscript>
|
</cfscript>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+69
-40
@@ -6,6 +6,7 @@
|
|||||||
<cfparam name="ATTRIBUTES.output" type="string" default="report"/>
|
<cfparam name="ATTRIBUTES.output" type="string" default="report"/>
|
||||||
<cfparam name="ATTRIBUTES.debug" type="boolean" default=false/>
|
<cfparam name="ATTRIBUTES.debug" type="boolean" default=false/>
|
||||||
<cfparam name="ATTRIBUTES.tenant_wz_index" type="string"/>
|
<cfparam name="ATTRIBUTES.tenant_wz_index" type="string"/>
|
||||||
|
<cfparam name="ATTRIBUTES.restrict_to_own_instances" type="boolean" default=true/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -102,7 +103,6 @@
|
|||||||
AND s.serviceType = 3
|
AND s.serviceType = 3
|
||||||
</cfquery>
|
</cfquery>
|
||||||
|
|
||||||
<!--- <cfdump var=#qSpec# abort=true/> --->
|
|
||||||
<cfif (ATTRIBUTES.debug)>
|
<cfif (ATTRIBUTES.debug)>
|
||||||
qSpec (Left Outer Join with Free Tier)
|
qSpec (Left Outer Join with Free Tier)
|
||||||
<cfoutput>#getTickCount() - request.startTickCount#</cfoutput>
|
<cfoutput>#getTickCount() - request.startTickCount#</cfoutput>
|
||||||
@@ -110,9 +110,6 @@
|
|||||||
<cfflush/>
|
<cfflush/>
|
||||||
</cfif>
|
</cfif>
|
||||||
|
|
||||||
<!--- <cfloop from=#attributes.dt_start# to=#attributes.dt_finish# step="#CreateTimeSpan( 1, 0, 0, 0 )#" index="local.dt">
|
|
||||||
<cfdump var=#dateFormat(local.dt,"YYYY-MM-DD")#/>--->
|
|
||||||
|
|
||||||
<!--- *** Нужно еще реализовать в модели данных (каталоге) политики бесплатного минимума (free tier), сейчас прибито гвоздями --->
|
<!--- *** Нужно еще реализовать в модели данных (каталоге) политики бесплатного минимума (free tier), сейчас прибито гвоздями --->
|
||||||
<cfquery name="qComputing">
|
<cfquery name="qComputing">
|
||||||
select 'WZ'||to_char(tenant.wzcode,'FM00000') as wz, vdc.name as vdc_name,
|
select 'WZ'||to_char(tenant.wzcode,'FM00000') as wz, vdc.name as vdc_name,
|
||||||
@@ -121,7 +118,7 @@
|
|||||||
WHEN vdc.name LIKE '%-v1cl2%' THEN 'iaas.ngc.i31'
|
WHEN vdc.name LIKE '%-v1cl2%' THEN 'iaas.ngc.i31'
|
||||||
WHEN vdc.name LIKE '%-v1cl4%' THEN 'iaas.ngc.a28'
|
WHEN vdc.name LIKE '%-v1cl4%' THEN 'iaas.ngc.a28'
|
||||||
WHEN vdc.name LIKE '%-v1cl5%' THEN 'iaas.ngc.a45'
|
WHEN vdc.name LIKE '%-v1cl5%' THEN 'iaas.ngc.a45'
|
||||||
WHEN vdc.name LIKE '%-v1cl6%' THEN 'iaas.ngc.i28' -- *** смапить все кластера
|
WHEN vdc.name LIKE '%-v1cl6%' THEN 'iaas.ngc.i28'
|
||||||
WHEN vdc.name LIKE '%-v1cl7%' THEN 'iaas.ngc.a40' -- *** смапить все кластера
|
WHEN vdc.name LIKE '%-v1cl7%' THEN 'iaas.ngc.a40' -- *** смапить все кластера
|
||||||
ELSE '['||vdc.name||']' end as code,
|
ELSE '['||vdc.name||']' end as code,
|
||||||
sum(cpu_used/cpu_speed)/4. as core_h,
|
sum(cpu_used/cpu_speed)/4. as core_h,
|
||||||
@@ -146,6 +143,20 @@
|
|||||||
<cfflush/>
|
<cfflush/>
|
||||||
</cfif>
|
</cfif>
|
||||||
|
|
||||||
|
<!--- если захочется сгенерить литерал таблицы соответствия
|
||||||
|
with a as (
|
||||||
|
select * from ngcloud_ru.storage_profile_types
|
||||||
|
)
|
||||||
|
select '('||id||', '''|| name||''', '''||
|
||||||
|
|
||||||
|
case
|
||||||
|
when name ilike '%fastssd%' then 'fstssd'
|
||||||
|
when name ilike '%ssd%' then 'ssd'
|
||||||
|
when name ilike '%sata%' then 'sata'
|
||||||
|
else '' end
|
||||||
|
||''''||')'
|
||||||
|
from a
|
||||||
|
--->
|
||||||
<!--- переделать storage_profile_types с расшифровкой ssd, sata, можно прямо до каталожного кода --->
|
<!--- переделать storage_profile_types с расшифровкой ssd, sata, можно прямо до каталожного кода --->
|
||||||
<!--- очень долго исполняется --->
|
<!--- очень долго исполняется --->
|
||||||
<cfquery name="qStorage">
|
<cfquery name="qStorage">
|
||||||
@@ -159,9 +170,10 @@
|
|||||||
WHEN vdc.name LIKE '%-v1cl7%' THEN 'iaas.ngc.a40'
|
WHEN vdc.name LIKE '%-v1cl7%' THEN 'iaas.ngc.a40'
|
||||||
ELSE '['||vdc.name||']' END
|
ELSE '['||vdc.name||']' END
|
||||||
|| CASE
|
|| CASE
|
||||||
WHEN storage_profile_types.name ILIKE '%-SSD%' THEN '.ssd-m'
|
WHEN storage_profile_types.name ILIKE '%FASTSSD%' THEN '.fstssd-m'
|
||||||
WHEN storage_profile_types.name ILIKE '%-SAS' THEN '.sas-m'
|
WHEN storage_profile_types.name ILIKE '%SSD%' THEN '.ssd-m'
|
||||||
WHEN storage_profile_types.name ILIKE '%-SATA' THEN '.sata-m'
|
WHEN storage_profile_types.name ILIKE '%SAS%' THEN '.sas-m'
|
||||||
|
WHEN storage_profile_types.name ILIKE '%SATA%' THEN '.sata-m'
|
||||||
ELSE '.['|| storage_profile_types.name ||']' END
|
ELSE '.['|| storage_profile_types.name ||']' END
|
||||||
as code,
|
as code,
|
||||||
storage_profile_types.name, -- *** это не тип, а профайл
|
storage_profile_types.name, -- *** это не тип, а профайл
|
||||||
@@ -201,8 +213,12 @@
|
|||||||
--,bucket_stat.placement_id
|
--,bucket_stat.placement_id
|
||||||
,'WZ'||lpad(bucket_stat.owner, 5, '0') as wz -- *** здесь не число, а строка, поэтому другая формула обратной сборки WZ
|
,'WZ'||lpad(bucket_stat.owner, 5, '0') as wz -- *** здесь не число, а строка, поэтому другая формула обратной сборки WZ
|
||||||
,bucket_stat.timestamp_addition::date as dt
|
,bucket_stat.timestamp_addition::date as dt
|
||||||
,bucket_info.name as dimension_1,
|
,bucket_info.name || ' - ' || case
|
||||||
null as dimension_2
|
when bucket_stat.placement_id = 1 then 'paas.s3.ceph'
|
||||||
|
when bucket_stat.placement_id = 2 then 'paas.s3.cphc'
|
||||||
|
else '['|| TO_CHAR(bucket_stat.placement_id,'FM9') ||']' end
|
||||||
|
as dimension_1
|
||||||
|
,null as dimension_2
|
||||||
from s3billing.bucket_stat
|
from s3billing.bucket_stat
|
||||||
join s3billing.placement ON s3billing.placement.id=bucket_stat.placement_id
|
join s3billing.placement ON s3billing.placement.id=bucket_stat.placement_id
|
||||||
join s3billing.bucket_info ON bucket_info.id=bucket_stat.bucket_id
|
join s3billing.bucket_info ON bucket_info.id=bucket_stat.bucket_id
|
||||||
@@ -285,7 +301,11 @@
|
|||||||
--category.name, bucket_info.name
|
--category.name, bucket_info.name
|
||||||
,'WZ'||lpad(user_info.name, 5, '0') as wz
|
,'WZ'||lpad(user_info.name, 5, '0') as wz
|
||||||
,usage_bucket_by_user.time::date as dt
|
,usage_bucket_by_user.time::date as dt
|
||||||
,bucket_info.name as dimension_1
|
,bucket_info.name || ' - ' || case
|
||||||
|
when bucket_info.placement_id = 1 then 'paas.s3.ceph'
|
||||||
|
when bucket_info.placement_id = 2 then 'paas.s3.cphc'
|
||||||
|
else '['|| TO_CHAR(bucket_info.placement_id,'FM9') ||']' end
|
||||||
|
as dimension_1
|
||||||
,null as dimension_2
|
,null as dimension_2
|
||||||
from s3billing.usage_bucket_by_user
|
from s3billing.usage_bucket_by_user
|
||||||
join s3billing.user_info on usage_bucket_by_user.user_id=user_info.id
|
join s3billing.user_info on usage_bucket_by_user.user_id=user_info.id
|
||||||
@@ -310,39 +330,40 @@
|
|||||||
</cfif>
|
</cfif>
|
||||||
|
|
||||||
<!--- собрали все метрики в один резалтсет --->
|
<!--- собрали все метрики в один резалтсет --->
|
||||||
|
<!--- Здесь мы знаем единицы измерения, причем надежнее, чем в спецификации --->
|
||||||
<cfquery name="qUnifiedMetric" dbType="query">
|
<cfquery name="qUnifiedMetric" dbType="query">
|
||||||
select dt, wz, code || '.vcpu-m' as code, core_h as raw_metric, core_h as metric,
|
select dt, wz, code + '.vcpu-m' as code, core_h as raw_metric, core_h as metric,
|
||||||
dimension_1, 'vdc' as dimension_1_name, dimension_2, NULL as dimension_2_name
|
dimension_1, 'vdc' as dimension_1_name, dimension_2, NULL as dimension_2_name, 'ядро-ч' as unit
|
||||||
from qComputing
|
from qComputing
|
||||||
|
|
||||||
union all
|
union all
|
||||||
select dt, wz, code || '.ram-m' as code, gb_h as raw_metric, gb_h as metric,
|
select dt, wz, code + '.ram-m' as code, gb_h as raw_metric, gb_h as metric,
|
||||||
dimension_1, 'vdc' as dimension_1_name, dimension_2, NULL as dimension_2_name
|
dimension_1, 'vdc' as dimension_1_name, dimension_2, NULL as dimension_2_name, 'ГБайт-ч' as unit
|
||||||
from qComputing
|
from qComputing
|
||||||
|
|
||||||
union all
|
union all
|
||||||
select dt, wz, code, gb_m_used as raw_metric, gb_m_used as metric,
|
select dt, wz, code, gb_m_used as raw_metric, gb_m_used as metric,
|
||||||
dimension_1, 'vdc' as dimension_1_name, dimension_2, 'storage policy' as dimension_2_name
|
dimension_1, 'vdc' as dimension_1_name, dimension_2, 'storage policy' as dimension_2_name, 'ГБайт-м' as unit
|
||||||
from qStorage
|
from qStorage
|
||||||
|
|
||||||
union all
|
union all
|
||||||
select dt, wz, code || '.vol-m', vol_b as raw_metric, vol_gb as metric,
|
select dt, wz, code + '.vol-m', vol_b as raw_metric, vol_gb as metric,
|
||||||
dimension_1, 'bucket' as dimension_1_name, dimension_2, NULL as dimension_2_name
|
dimension_1, 'bucket' as dimension_1_name, dimension_2, NULL as dimension_2_name, 'ГБайт-м' as unit
|
||||||
from qS3Vol
|
from qS3Vol
|
||||||
|
|
||||||
union all
|
union all
|
||||||
select dt, wz, code || '.get-m', get as raw_metric, get_10k as metric,
|
select dt, wz, code + '.get-m', get as raw_metric, get_10k as metric,
|
||||||
dimension_1, 'bucket' as dimension_1_name, dimension_2, NULL as dimension_2_name
|
dimension_1, 'bucket' as dimension_1_name, dimension_2, NULL as dimension_2_name, '10тыс.шт.' as unit
|
||||||
from qS3OpsTrf
|
from qS3OpsTrf
|
||||||
|
|
||||||
union all
|
union all
|
||||||
select dt, wz, code || '.put-m', put as raw_metric, put_10k as metric,
|
select dt, wz, code + '.put-m', put as raw_metric, put_10k as metric,
|
||||||
dimension_1, 'bucket' as dimension_1_name, dimension_2, NULL as dimension_2_name
|
dimension_1, 'bucket' as dimension_1_name, dimension_2, NULL as dimension_2_name, '10тыс.шт.' as unit
|
||||||
from qS3OpsTrf
|
from qS3OpsTrf
|
||||||
|
|
||||||
union all
|
union all
|
||||||
select dt, wz, code || '.trf-m', bytes_sent as raw_metric, bytes_sent_gb as metric,
|
select dt, wz, code + '.trf-m', bytes_sent as raw_metric, bytes_sent_gb as metric,
|
||||||
dimension_1, 'bucket' as dimension_1_name, dimension_2, NULL as dimension_2_name
|
dimension_1, 'bucket' as dimension_1_name, dimension_2, NULL as dimension_2_name, 'ГБайт' as unit
|
||||||
from qS3OpsTrf
|
from qS3OpsTrf
|
||||||
|
|
||||||
order by dt, code, dimension_1, dimension_2 <!--- /*dimension_*_name нужно только в качестве заголовка *** потом оптимизировать */ --->
|
order by dt, code, dimension_1, dimension_2 <!--- /*dimension_*_name нужно только в качестве заголовка *** потом оптимизировать */ --->
|
||||||
@@ -383,12 +404,12 @@
|
|||||||
<cfquery name="qChargeDaily" dbType="query">
|
<cfquery name="qChargeDaily" dbType="query">
|
||||||
SELECT
|
SELECT
|
||||||
<d:field_set titleMapOut="titleMap" lengthOut="fieldCount">
|
<d:field_set titleMapOut="titleMap" lengthOut="fieldCount">
|
||||||
<d:field title="Код компонента">s.code</d:field>
|
<d:field title="Код компонента">s.code as s_code</d:field>
|
||||||
<d:field title="Код метрики">m.code as m_code</d:field>
|
<d:field title="Код метрики">m.code as m_code</d:field>
|
||||||
<d:field title="Код услуги">s.service_code as service_code</d:field>
|
<d:field title="Код услуги">s.service_code as service_code</d:field>
|
||||||
<d:field title="Услуга">s.svc</d:field>
|
<d:field title="Услуга">s.svc</d:field>
|
||||||
<d:field title="Компонент">s.component</d:field>
|
<d:field title="Компонент">s.component</d:field>
|
||||||
<d:field title="Ед.изм.">s.unit</d:field>
|
<d:field title="Ед.изм.">m.unit</d:field>
|
||||||
<d:field title="Цена &##8381; с НДС" cfSqlType="CF_SQL_NUMERIC">
|
<d:field title="Цена &##8381; с НДС" cfSqlType="CF_SQL_NUMERIC">
|
||||||
s.price*(100-s.discount)/100 as discounted_price
|
s.price*(100-s.discount)/100 as discounted_price
|
||||||
</d:field>
|
</d:field>
|
||||||
@@ -408,22 +429,28 @@
|
|||||||
<d:field>m.dimension_2_name</d:field>
|
<d:field>m.dimension_2_name</d:field>
|
||||||
</d:field_set>
|
</d:field_set>
|
||||||
FROM qSpec as s, qUnifiedMetric as m
|
FROM qSpec as s, qUnifiedMetric as m
|
||||||
WHERE m.wz=<cfqueryparam cfsqltype="cf_sql_varchar" value=#request.auth.wz#/>
|
WHERE s.code=m.code
|
||||||
AND s.code=m.code
|
|
||||||
AND s.serviceStart <= m.dt
|
AND s.serviceStart <= m.dt
|
||||||
AND (m.dt <= s.serviceEnd OR s.serviceEnd IS NULL)
|
AND (m.dt <= s.serviceEnd OR s.serviceEnd IS NULL)
|
||||||
|
<cfif #attributes.restrict_to_own_instances#>
|
||||||
|
AND m.wz=<cfqueryparam cfsqltype="cf_sql_varchar" value=#request.auth.wz#/>
|
||||||
|
</cfif>
|
||||||
<!--- таким замысловатым способом мы реализуем FULL JOIN --->
|
<!--- таким замысловатым способом мы реализуем FULL JOIN --->
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
SELECT NULL, m.code, NULL, NULL, NULL, NULL, 0,
|
SELECT NULL, m.code, NULL, NULL, NULL, NULL, 0,
|
||||||
NULL, NULL, m.raw_metric, m.metric, NULL, NULL, NULL, NULL, m.dt, 0, m.dimension_1, m.dimension_1_name, m.dimension_2, m.dimension_2_name
|
NULL, NULL, m.raw_metric, m.metric, NULL, NULL, NULL, NULL, m.dt, 0, m.dimension_1, m.dimension_1_name, m.dimension_2, m.dimension_2_name
|
||||||
FROM qUnifiedMetric as m where m.code NOT IN (<cfqueryparam value="#ValueList(qSpec.code)#" cfsqltype="cf_sql_varchar" list="true">)
|
FROM qUnifiedMetric as m
|
||||||
|
WHERE m.code NOT IN (<cfqueryparam value="#ValueList(qSpec.code)#" cfsqltype="cf_sql_varchar" list="true">)
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
SELECT s.code, NULL, s.service_code, s.svc, s.component, s.unit, s.price*(100-s.discount)/100 as discounted_price,
|
SELECT s.code, NULL, s.service_code, s.svc, s.component, s.unit, s.price*(100-s.discount)/100 as discounted_price,
|
||||||
s.price, s.discount, NULL, NULL, s.serviceStart, s.serviceEnd, s.serviceHash, s.serviceCustomName, NULL, 0, NULL, NULL, NULL, NULL
|
s.price, s.discount, NULL, NULL, s.serviceStart, s.serviceEnd, s.serviceHash, s.serviceCustomName, NULL, 0, NULL, NULL, NULL, NULL
|
||||||
FROM qSpec as s where s.code NOT IN (<cfqueryparam value="#listRemoveDuplicates(ValueList(qUnifiedMetric.code))#" cfsqltype="cf_sql_varchar" list="true">)
|
FROM qSpec as s
|
||||||
order by dt, code, dimension_1, dimension_2
|
WHERE s.code NOT IN (<cfqueryparam value="#listRemoveDuplicates(ValueList(qUnifiedMetric.code))#" cfsqltype="cf_sql_varchar" list="true">)
|
||||||
|
|
||||||
|
ORDER by dt, s_code, m_code, dimension_1, dimension_2
|
||||||
</cfquery>
|
</cfquery>
|
||||||
<!--- диагностика ошибок в QoQ крайне невнятна и вводит в заблуждение --->
|
<!--- диагностика ошибок в QoQ крайне невнятна и вводит в заблуждение --->
|
||||||
|
|
||||||
@@ -440,8 +467,9 @@
|
|||||||
<cfquery name="qChargeMonthly" dbType="query">
|
<cfquery name="qChargeMonthly" dbType="query">
|
||||||
SELECT
|
SELECT
|
||||||
<d:field_set titleMapOut="titleMap" lengthOut="fieldCount">
|
<d:field_set titleMapOut="titleMap" lengthOut="fieldCount">
|
||||||
<d:field title="Артикул по договору">code</d:field>
|
<d:field title="Артикул по договору">s_code</d:field>
|
||||||
<d:field title="Артикул по системам">m_code</d:field>
|
<d:field title="Артикул по системам">m_code</d:field>
|
||||||
|
<d:field title="Артикул">s_code as code</d:field>
|
||||||
<d:field title="Код услуги">service_code</d:field>
|
<d:field title="Код услуги">service_code</d:field>
|
||||||
<d:field title="Услуга по каталогу">svc</d:field>
|
<d:field title="Услуга по каталогу">svc</d:field>
|
||||||
<d:field title="serviceCustomName">serviceCustomName</d:field>
|
<d:field title="serviceCustomName">serviceCustomName</d:field>
|
||||||
@@ -464,15 +492,14 @@
|
|||||||
<d:field title="Месяц" cfSqlType="CF_SQL_INTEGER">month(dt) as month</d:field>
|
<d:field title="Месяц" cfSqlType="CF_SQL_INTEGER">month(dt) as month</d:field>
|
||||||
</d:field_set>
|
</d:field_set>
|
||||||
from qChargeDaily
|
from qChargeDaily
|
||||||
group by m_code, code, svc, service_code, serviceCustomName, component, unit, discounted_price, serviceStart, ServiceEnd, serviceHash, free_tier, year(dt), month(dt),
|
group by s_code, m_code, svc, service_code, serviceCustomName, component, unit, discounted_price, serviceStart, ServiceEnd, serviceHash, free_tier, year(dt), month(dt),
|
||||||
dimension_1_name, dimension_1, dimension_2_name, dimension_2
|
dimension_1_name, dimension_1, dimension_2_name, dimension_2
|
||||||
order by year(dt), month(dt), m_code, code, serviceStart, dimension_1, dimension_2
|
order by year(dt), month(dt), m_code, code, serviceStart, dimension_1, dimension_2
|
||||||
</cfquery>
|
</cfquery>
|
||||||
<!--- в связи с бедностью языка QoQ (нет CASE) грубо патчим резалтсет --->
|
<!--- в связи с бедностью языка QoQ (нет CASE) грубо патчим резалтсет --->
|
||||||
<!--- <cfloop query="qChargeMonthly">
|
<cfloop query="qChargeMonthly">
|
||||||
<cfset qChargeMonthly.chargeable_metric = (chargeable_metric GT 0) ? chargeable_metric : 0/> <!--- имя в левой части должно быть квалифицировано запросом (резалтсетом) --->
|
<cfset qChargeMonthly.code = (len(code) GT 0) ? code : m_code/><!--- имя в левой части должно быть квалифицировано запросом (резалтсетом) --->
|
||||||
<cfset qChargeMonthly.charge = (charge GT 0) ? charge : 0/>
|
</cfloop>
|
||||||
</cfloop> --->
|
|
||||||
|
|
||||||
|
|
||||||
<!--- тут могут быть подводные камни с копированием и переиспользованием объектов --->
|
<!--- тут могут быть подводные камни с копированием и переиспользованием объектов --->
|
||||||
@@ -491,6 +518,7 @@
|
|||||||
<!--- <cfdump var=#qChargeMonthly#/> --->
|
<!--- <cfdump var=#qChargeMonthly#/> --->
|
||||||
<!--- *** проверить краевые даты --->
|
<!--- *** проверить краевые даты --->
|
||||||
<cfif (ATTRIBUTES.debug)>
|
<cfif (ATTRIBUTES.debug)>
|
||||||
|
qChargeMonthly
|
||||||
<cfoutput>#getTickCount() - request.startTickCount#</cfoutput>
|
<cfoutput>#getTickCount() - request.startTickCount#</cfoutput>
|
||||||
<cfdump var=#qChargeMonthly#/>
|
<cfdump var=#qChargeMonthly#/>
|
||||||
<cfflush/>
|
<cfflush/>
|
||||||
@@ -507,10 +535,11 @@
|
|||||||
<cfset report.qStorageAge = qStorageAge/>
|
<cfset report.qStorageAge = qStorageAge/>
|
||||||
<cfset report.qS3VolAge = qS3VolAge/>
|
<cfset report.qS3VolAge = qS3VolAge/>
|
||||||
<cfset report.qS3OpsTrfAge = qS3OpsTrfAge/>
|
<cfset report.qS3OpsTrfAge = qS3OpsTrfAge/>
|
||||||
|
<cfset report.qSpecification = qSpecification/>
|
||||||
<cfset report.qCharge = qChargeMonthly/>
|
<cfset report.qCharge = qChargeMonthly/>
|
||||||
<cfset report.qFreeTier = qFreeTier/><!--- мы не применяем скидку на уровне детализации, а только после агрегации. На самом деле правильно было бы агрегировать натуральные метрики, а умножать на цену уже агрегаты --->
|
<cfset report.qFreeTier = qFreeTier/><!--- мы не применяем скидку на уровне детализации, а только после агрегации. На самом деле правильно было бы агрегировать натуральные метрики, а умножать на цену уже агрегаты --->
|
||||||
<cfset report.chargeTitleMap = titleMap/>
|
<!--- <cfset report.chargeTitleMap = titleMap/>
|
||||||
<cfset report.chargeFieldCount = fieldCount/>
|
<cfset report.chargeFieldCount = fieldCount/> --->
|
||||||
|
|
||||||
<cfset "CALLER.#ATTRIBUTES.output#" = report/>
|
<cfset "CALLER.#ATTRIBUTES.output#" = report/>
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
<cfimport prefix="d" taglib="../lib/data"/>
|
<cfimport prefix="d" taglib="../lib/data"/>
|
||||||
|
|
||||||
<cfparam name="ATTRIBUTES.wz"/>
|
<cfparam name="ATTRIBUTES.wz"/>
|
||||||
<cfparam name="ATTRIBUTES.crm_cache_base" default="https://elma-cache.adl.nubes.ru/contract_ls.cfm"/>
|
<!--- <cfparam name="ATTRIBUTES.crm_cache_base" default="https://elma-cache.adl.nubes.ru/contract_ls.cfm"/> --->
|
||||||
<cfparam name="ATTRIBUTES.out" default="qComponent"/>
|
<cfparam name="ATTRIBUTES.out" default="qComponent"/>
|
||||||
|
|
||||||
<cfhttp method="get"
|
<cfhttp method="get"
|
||||||
url="#ATTRIBUTES.crm_cache_base#?wz=#ATTRIBUTES.wz#"
|
url="#request.crm_cache_base#?wz=#ATTRIBUTES.wz#"
|
||||||
timeout=10
|
timeout=10
|
||||||
charset="utf-8"
|
charset="utf-8"
|
||||||
result="res"
|
result="res"
|
||||||
|
|||||||
@@ -6,19 +6,20 @@
|
|||||||
</cfsilent>
|
</cfsilent>
|
||||||
|
|
||||||
<m:prepare_ls entity="payg" accessObject="" pageInfoOut="pageInfo" trackOut="tr"/>
|
<m:prepare_ls entity="payg" accessObject="" pageInfoOut="pageInfo" trackOut="tr"/>
|
||||||
<!--- <cfdump var=#form#/> --->
|
|
||||||
|
|
||||||
<cfparam name="dt_finish" type="date" default=#dateAdd('d',-1,createDateTime(year(Now()),month(Now()),1,0,0,0))#/>
|
<cfparam name="dt_finish" type="date" default=#dateAdd('d',-1,createDateTime(year(Now()),month(Now()),1,0,0,0))#/>
|
||||||
<cfparam name="dt_start" type="date" default=#dateAdd('m',-1,createDateTime(year(Now()),month(Now()),1,0,0,0))#/>
|
<cfparam name="dt_start" type="date" default=#dateAdd('m',-1,createDateTime(year(Now()),month(Now()),1,0,0,0))#/>
|
||||||
|
|
||||||
<!--- <cfparam name="dt_finish" default=#dateAdd('d',-1,createDateTime(year(Now()),month(Now()),1,0,0,0))#/>
|
<cfset hours=dateDiff('h', dt_start, dateAdd('d', 1, dt_finish))/>
|
||||||
<cfparam name="dt_start" default=#dateAdd('m',-1,createDateTime(year(Now()),month(Now()),1,0,0,0))#/> --->
|
|
||||||
|
|
||||||
|
<cfset restrict_to_own_instances = true>
|
||||||
<cfset hours=dateDiff('h', dt_start, dt_finish)/>
|
<cfparam name="WZ" default=#request.auth.wz#/>
|
||||||
<!--- <cfdump var=#variables#/> --->
|
<cfif request.auth.wz EQ 'WZ01112'><!--- грубо --->
|
||||||
|
<cfset restrict_to_own_instances = false>
|
||||||
<cfset tenant_wz_index=val(mid(request.auth.wz,3,5))/><!--- cut off WZ --->
|
<cfelse>
|
||||||
|
<cfset WZ=request.auth.wz/><!--- без баловства --->
|
||||||
|
</cfif>
|
||||||
|
<cfset tenant_wz_index=val(mid(WZ,3,5))/><!--- cut off WZ --->
|
||||||
|
|
||||||
|
|
||||||
<cfif isDefined("output_xls")><cfmodule template="mod/compute_payg.cfm"
|
<cfif isDefined("output_xls")><cfmodule template="mod/compute_payg.cfm"
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
tenant_wz_index=#tenant_wz_index#
|
tenant_wz_index=#tenant_wz_index#
|
||||||
output="report"
|
output="report"
|
||||||
debug=#isDefined("DEBUG")#
|
debug=#isDefined("DEBUG")#
|
||||||
|
restrict_to_own_instances=#restrict_to_own_instances#
|
||||||
/><layout:xml qRead=#report.qCharge# titleMap=#report.chargeTitleMap# filename="#pageInfo.entity#.xml"/>
|
/><layout:xml qRead=#report.qCharge# titleMap=#report.chargeTitleMap# filename="#pageInfo.entity#.xml"/>
|
||||||
<cfabort/>
|
<cfabort/>
|
||||||
</cfif><cfif isDefined("output_json")><cfmodule template="mod/compute_payg.cfm"
|
</cfif><cfif isDefined("output_json")><cfmodule template="mod/compute_payg.cfm"
|
||||||
@@ -35,13 +37,14 @@
|
|||||||
tenant_wz_index=#tenant_wz_index#
|
tenant_wz_index=#tenant_wz_index#
|
||||||
output="report"
|
output="report"
|
||||||
debug=#isDefined("DEBUG")#
|
debug=#isDefined("DEBUG")#
|
||||||
|
restrict_to_own_instances=#restrict_to_own_instances#
|
||||||
/><!--- <cfdump var=#report#/><cfabort/> ---><layout:json qRead=#report.qCharge# titleMap=#report.chargeTitleMap# filename="#pageInfo.entity#.json"/>
|
/><!--- <cfdump var=#report#/><cfabort/> ---><layout:json qRead=#report.qCharge# titleMap=#report.chargeTitleMap# filename="#pageInfo.entity#.json"/>
|
||||||
<cfabort/>
|
<cfabort/>
|
||||||
</cfif><!---
|
</cfif><!---
|
||||||
---><layout:page section="header" pageInfo=#pageInfo#>
|
---><layout:page section="header" pageInfo=#pageInfo#>
|
||||||
|
|
||||||
<layout:attribute name="title">
|
<layout:attribute name="title">
|
||||||
<cfoutput><b>Отчет по PAYG</b> #request.auth.wz#</cfoutput>
|
<cfoutput><b>Отчет по PAYG</b> #WZ#</cfoutput>
|
||||||
</layout:attribute>
|
</layout:attribute>
|
||||||
<layout:attribute name="controls">
|
<layout:attribute name="controls">
|
||||||
<!---skip filter link, filter is not implemented--->
|
<!---skip filter link, filter is not implemented--->
|
||||||
@@ -56,11 +59,23 @@
|
|||||||
<form method="post" action="#request.thisPage#" style="display:inline"><!--- не надо делать action="" - параметр, затесавшийся в URL будет затирать параметр формы, и заметить это трудно --->
|
<form method="post" action="#request.thisPage#" style="display:inline"><!--- не надо делать action="" - параметр, затесавшийся в URL будет затирать параметр формы, и заметить это трудно --->
|
||||||
Период с <input type="text" name="dt_start" value="#dateFormat(dt_start,'YYYY-MM-DD')#"/>
|
Период с <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="text" name="dt_finish" value="#dateFormat(dt_finish,'YYYY-MM-DD')#"/>
|
||||||
|
|
||||||
|
<cfif request.auth.wz EQ 'WZ01112'><!--- очень грубо --->
|
||||||
|
WZ <input type="text" name="wz" value="#WZ#"/>
|
||||||
|
</cfif>
|
||||||
|
|
||||||
<input type="submit" style="cursor:pointer;"/>
|
<input type="submit" style="cursor:pointer;"/>
|
||||||
<input type="submit" name="DEBUG" value="DEBUG" style="cursor:pointer;"/><!--- ********* --->
|
<input type="submit" name="DEBUG" value="DEBUG" style="cursor:pointer;"/><!--- ********* --->
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
<cfset month_start = createDate(year(now()), month(now()), 1)/>
|
<cfset month_start = createDate(year(now()), month(now()), 1)/>
|
||||||
<a href="?dt_start=#dateFormat(dateAdd('m', -1, month_start),'YYYY-MM-DD')#&dt_finish=#dateFormat(dateAdd('d', -1, month_start),'YYYY-MM-DD')#">прошлый месяц</a>
|
<a href="?dt_start=#dateFormat(dateAdd('m', -1, month_start),'YYYY-MM-DD')#&dt_finish=#dateFormat(dateAdd('d', -1, month_start),'YYYY-MM-DD')#&wz=#WZ#">
|
||||||
|
прошлый месяц
|
||||||
|
</a>
|
||||||
|
<a href="?dt_start=#dateFormat(createDate(year(now()), month(now()), 1),'YYYY-MM-DD')#&dt_finish=#dateFormat(createDate(year(now()), month(now()), daysInMonth(now())),'YYYY-MM-DD')#&wz=#WZ#">
|
||||||
|
текущий месяц
|
||||||
|
</a>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<!--- <cfflush/> --->
|
<!--- <cfflush/> --->
|
||||||
@@ -71,6 +86,7 @@
|
|||||||
tenant_wz_index=#tenant_wz_index#
|
tenant_wz_index=#tenant_wz_index#
|
||||||
output="report"
|
output="report"
|
||||||
debug=#structKeyExists(Form,"DEBUG")#
|
debug=#structKeyExists(Form,"DEBUG")#
|
||||||
|
restrict_to_own_instances=#restrict_to_own_instances#
|
||||||
/>
|
/>
|
||||||
|
|
||||||
Часов в периоде: <b>#hours#</b> Строк в отчете: <b>#report.qCharge.recordCount#</b><br/>
|
Часов в периоде: <b>#hours#</b> Строк в отчете: <b>#report.qCharge.recordCount#</b><br/>
|
||||||
@@ -87,6 +103,9 @@ S3 операции и трафик: <b<cfif datediff("h",report.qS3OpsTrfAge.dt
|
|||||||
#dateFormat(report.qS3OpsTrfAge.dt_load,'YYYY-MM-DD')# #timeFormat(report.qS3OpsTrfAge.dt_load,'HH:MM:SS')#
|
#dateFormat(report.qS3OpsTrfAge.dt_load,'YYYY-MM-DD')# #timeFormat(report.qS3OpsTrfAge.dt_load,'HH:MM:SS')#
|
||||||
</b>
|
</b>
|
||||||
<br/>
|
<br/>
|
||||||
|
Цены по данным договора из CRM (через elma-cache). Учитываются метрики по S3, vCloud (кроме GPU)
|
||||||
|
<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_xls" title="экспорт в Excel" style="margin-left:.5em; height:100%;" target="_blank"><img src="img/xls.gif" style="vertical-align:text-bottom;"/></a>
|
||||||
|
|
||||||
@@ -94,7 +113,7 @@ S3 операции и трафик: <b<cfif datediff("h",report.qS3OpsTrfAge.dt
|
|||||||
</cfoutput>
|
</cfoutput>
|
||||||
<table class="worktable">
|
<table class="worktable">
|
||||||
<thead>
|
<thead>
|
||||||
<td width="1%"></td>
|
<th width="1%"></th>
|
||||||
<th width="7%" colspan="2">Артикул</th>
|
<th width="7%" colspan="2">Артикул</th>
|
||||||
<th width="3%">С</td>
|
<th width="3%">С</td>
|
||||||
<th width="3%">По</td>
|
<th width="3%">По</td>
|
||||||
@@ -223,6 +242,49 @@ S3 операции и трафик: <b<cfif datediff("h",report.qS3OpsTrfAge.dt
|
|||||||
</cfoutput>
|
</cfoutput>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<!--- <cfdump var=#report.qSpecification#/> --->
|
||||||
|
<h3>Спецификация</h3>
|
||||||
|
<table class="worktable">
|
||||||
|
<tr>
|
||||||
|
<th width="5%">Договор</th>
|
||||||
|
<th width="15%">Доп. соглашение</th>
|
||||||
|
<th width="3%">Тип оплаты</th>
|
||||||
|
<th width="20%">Пользовательское наименование</th>
|
||||||
|
<th width="3%">Кол-во по строке</th>
|
||||||
|
<th width="3%">Скидка по строке</th>
|
||||||
|
<th width="5%">НОУ</th>
|
||||||
|
<th width="5%">КОУ</th>
|
||||||
|
<th width="10%">Компонент</th>
|
||||||
|
<th width="5%">Артикул</th>
|
||||||
|
<th width="5%">Кол-во</th>
|
||||||
|
<th width="5%">Ед.изм.</th>
|
||||||
|
<th width="5%">Цена с НДС</th>
|
||||||
|
<th width="5%">Скидка %</th>
|
||||||
|
<th width="5%">Цена со скидкой с НДС</th>
|
||||||
|
</tr>
|
||||||
|
<cfoutput query="report.qSpecification">
|
||||||
|
<tr>
|
||||||
|
<td>#contractOutsideId#</td>
|
||||||
|
<td>#additionalAgreementName#</td>
|
||||||
|
<td class="c">#serviceType#</td>
|
||||||
|
<td>#serviceCustomName#</td>
|
||||||
|
<td class="c">#serviceQuantity#</td>
|
||||||
|
<td class="r">#serviceDiscount#</td>
|
||||||
|
<td class="c">#dateFormat(serviceStart, "YYYY-MM-DD")#</td>
|
||||||
|
<td class="c">#dateFormat(serviceEnd, "YYYY-MM-DD")#</td>
|
||||||
|
<td>#component#</td>
|
||||||
|
<td>#componentCode#</td>
|
||||||
|
<td class="r">#quantity#</td>
|
||||||
|
<td class="c">#measureShort#</td>
|
||||||
|
<td class="r">#gaussianRound(priceWVat,2)#</td>
|
||||||
|
<td class="r">#discount#</td>
|
||||||
|
<td class="r">#gaussianRound((100-serviceDiscount)/100*(100-discount)/100*priceWVat,4)#</td>
|
||||||
|
</tr>
|
||||||
|
</cfoutput>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
<!---<cfdump var=#report.qCharge#/> --->
|
<!---<cfdump var=#report.qCharge#/> --->
|
||||||
<!--- <cfdump var=#this.datasources[request.ds].connectionString#/> --->
|
<!--- <cfdump var=#this.datasources[request.ds].connectionString#/> --->
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user