diff --git a/Application.cfc b/Application.cfc index c9c04c7..246d4c2 100644 --- a/Application.cfc +++ b/Application.cfc @@ -76,7 +76,7 @@ - + diff --git a/contragent_rpt.cfm b/contragent_rpt.cfm index 5b412aa..08871e4 100644 --- a/contragent_rpt.cfm +++ b/contragent_rpt.cfm @@ -79,45 +79,30 @@
-
__id
+
ID
#d.__id#
-
__name
- +
Контрагент
+
-
_inn
+
ИНН
#d._inn#
-
_kpp
+
КПП
#d._kpp#
-
id_klienta
+
WZ
#d.id_klienta#
- - - -
@@ -127,87 +112,132 @@ - - 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= - 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 - + + 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= + 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 + + + + + + + +

Услуги по данным CRM (версии строк спецификации, только актуальные на сегодня)

+
- -

Услуги (версии строк спецификации, только актуальные)

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - + + ---> + + + + + +
__indexuser_descriptionКомпонентыКол-воСуммаКодtypedate_nopdate_endadditional_agreement
#__index##user_description# + + + + + + + + + + + + + + + + + + + class="gray"> + + + + + - - - + + - - - - - -
__indexКодПользовательское наименованиеКомпонентыКол-воСуммаМодель оплатыДата НОУdate_endДополнительное соглашение
#__index##abstractive_service_code#.#modifier_code##user_description# @@ -215,10 +245,9 @@ - - - - + + + @@ -226,29 +255,155 @@
#code# #name##p_cnt##ed_izm##nFmt(price,3)##p_discount#%#p_cnt##ed_izm##nFmt(price*p_cnt*(100-(isNumeric(p_discount)?p_discount:0))/100, 2)#
#cnt# #nFmt(cost*cnt*(100-(isNumeric(discount)?discount:0))/100)# - #abstractive_service_code#.#modifier_code# - #type# + + install + fix + payg + (#type#) + #dateFormat(date_nop,'YYYY-MM-DD')##dateFormat(date_end,'YYYY-MM-DD')##additional_agreement#
- - - - - - +
#hash##version##__index##dateFormat(date_nop,'YYYY-MM-DD')##dateFormat(date_end,'YYYY-MM-DD')##additional_agreement# (#status_id# #status#)
+ + 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() + GROUP BY c."Organization_UUID", c."Organization", c."VDC", c."VDC_CPU_Reserv", c."Cluster" + + + + select + sum(ram) as ram + ,sum(ram_on) as ram_on + ,sum(cpu) as cpu + ,sum(cpu_on) as cpu_on + FROM qCompute + + +

Compute факт

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ОрганизацияVDCРезерв %КластерGHzCPU coresCPU_ON coresRAM GBRAM_ON GB
#Organization##VDC##VDC_CPU_Reserv##qCompute.Cluster##ghz##cpu##cpu_on##ram##ram_on#
Итого:#cpu##cpu_on##ram##ram_on#
+ + + + + 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() + GROUP BY c."Organization_UUID",c."Organization",c."VDC",c."Cluster",c."Storage_Policy" + + + + select + sum(disk_alloc) as disk_alloc + ,sum(disk_used) as disk_used + FROM qStorage + + +

Storage факт

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ОрганизацияVDCКластерПолитика храненияВыделено GBИспользуется GB
#Organization##VDC##qCompute.Cluster##Storage_Policy##disk_alloc##disk_used#
Итого:#disk_alloc##disk_used#
+ + + + +
\ No newline at end of file diff --git a/crm2cloud.cfm b/crm2cloud.cfm index 898fda3..373fc32 100644 --- a/crm2cloud.cfm +++ b/crm2cloud.cfm @@ -7,7 +7,7 @@ - + WITH status(status, status_id, probability_pc) as (VALUES @@ -105,8 +105,10 @@ WHERE c.code SIMILAR TO 'iaas.ngc.%.(ssd|fstssd|sata)-_' AND c.cnt <> 0 AND o.cn GROUP BY z.id_klienta, z.__id, z.__name ), deal_stat as ( -select STRING_AGG(distinct deal_status_id::text,', ') as status_ids -, z.id_klienta as WZ +select +STRING_AGG(distinct deal_status_id::text,', ') as status_ids +,STRING_AGG(distinct 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 ) @@ -118,6 +120,7 @@ select 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 @@ -130,18 +133,17 @@ select d.quantity as disk_sold da.disk_alloc z.__name as alloc_company - z.__id as alloc_company_uid - + z.__id as alloc_company_uid from sold_ram r -join deal_stat ds on (r.wz=ds.wz) -join sold_cpu c on (r.wz=c.wz) -left join sold_disk d on (r.wz=d.wz) -full join alloc a on (r.wz=a.wz) +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)) where 1=1 -order by 1,3 +order by @@ -198,16 +200,17 @@ S3 операции и трафик: #dateFormat(qS3OpsTrfAge.dt_load,'YYYY-M - - - - - + - + + + + + + @@ -232,17 +235,18 @@ S3 операции и трафик: #dateFormat(qS3OpsTrfAge.dt_load,'YYYY-M #wz_alloc# #status_ids# + #line_pricing_model_ids# + + #cpu_codes# + style="background:lightgreen;">#cpu_sold# + style="background:lightcoral;">#cpu_alloc# + style="background:lightcoral;">#cpu_alloc_on# #ram_codes# style="background:lightgreen;">#ram_sold# style="background:lightcoral;">#ram_alloc# style="background:lightcoral;">#ram_alloc_on# - #cpu_codes# - style="background:lightgreen;">#cpu_sold# - style="background:lightcoral;">#cpu_alloc# - style="background:lightcoral;">#cpu_alloc_on# - #disk_codes# style="background:lightgreen;">#disk_sold# style="background:lightcoral;">#disk_alloc# diff --git a/style/web.css b/style/web.css index 3463337..6e29af4 100644 --- a/style/web.css +++ b/style/web.css @@ -246,6 +246,8 @@ button.maincontrol:hover { .err {color: red;} .warn {color: #f80;} +.gray, tr.gray td {color:lightgray;} +.gray a, tr.gray td a, tr.gray td a:link, tr.gray td a:visited {color: #aad;} a.up {background: url('../img/up.gif') center right no-repeat; padding-right: 7px;} a.add {background: url('../img/add.gif') center right no-repeat; width:13px; height:13px; display:inline-block;}