034 alpha

This commit is contained in:
2026-04-03 09:58:39 +03:00
parent 353f5ce5c2
commit 77bbc60fed
4 changed files with 308 additions and 147 deletions
+25 -21
View File
@@ -7,7 +7,7 @@
<m:prepare_ls entity="crm2cloud" settingsKey="crm2cloud" accessObject="" pageInfoOut="pageInfo" trackOut="tr"/>
<!--- *** нуждается в оптимизации, чтобы фильтр по контрагенту ускорял селект --->
<cfquery name="qRead">
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
<d:field>r.company_uid</d:field>
<d:field title="WZ Cloud">a.wz as wz_alloc</d:field>
<d:field title="Статусы">ds.status_ids</d:field>
<d:field title="Модели оплаты">ds.line_pricing_model_ids</d:field>
<d:field title="Коды RAM">r.codes as ram_codes</d:field>
<d:field title="RAM GB Elma">r.quantity as ram_sold</d:field>
<d:field title="RAM Cloud">a.ram as ram_alloc</d:field>
@@ -130,18 +133,17 @@ select
<d:field title="Диски GB Elma">d.quantity as disk_sold</d:field>
<d:field title="Диски Cloud">da.disk_alloc</d:field>
<d:field>z.__name as alloc_company</d:field>
<d:field>z.__id as alloc_company_uid</d:field>
<d:field>z.__id as alloc_company_uid</d:field>
</d:field_set>
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 <m:filter_build filter=#pageInfo.settings.filter#/>
order by 1,3
order by <m:order_build sortArray=#pageInfo.settings.sort.sortArray# fieldCount=#fieldCount#/>
</cfquery>
@@ -198,16 +200,17 @@ S3 операции и трафик: <b>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-M
<th width="10%"><layout:column_head name="client_sold"/></th>
<th width="5%"><layout:column_head name="wz_alloc"/></th>
<th width="3%"><layout:column_head name="status_ids"/></th>
<th width="10%"><layout:column_head name="ram_codes"/></th>
<th width="3%"><layout:column_head name="ram_sold"/></th>
<th width="3%"><layout:column_head name="ram_alloc"/></th>
<th width="3%"><layout:column_head name="ram_alloc_on"/></th>
<th width="3%"><layout:column_head name="line_pricing_model_ids"/></th>
<th width="10%"><layout:column_head name="cpu_codes"/></th>
<th width="3%"><layout:column_head name="cpu_sold"/></th>
<th width="3%"><layout:column_head name="cpu_alloc"/></th>
<th width="3%"><layout:column_head name="cpu_alloc_on"/></th>
<th width="3%"><layout:column_head name="cpu_alloc_on"/></th>
<th width="10%"><layout:column_head name="ram_codes"/></th>
<th width="3%"><layout:column_head name="ram_sold"/></th>
<th width="3%"><layout:column_head name="ram_alloc"/></th>
<th width="3%"><layout:column_head name="ram_alloc_on"/></th>
<th width="10%"><layout:column_head name="disk_codes"/></th>
<th width="3%"><layout:column_head name="disk_sold"/></th>
@@ -232,17 +235,18 @@ S3 операции и трафик: <b>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-M
</td>
<td>#wz_alloc#</td>
<td>#status_ids#</td>
<td>#line_pricing_model_ids#</td>
<td>#cpu_codes#</td>
<td class="r"<cfif cpu_sold GT ram_alloc> style="background:lightgreen;"</cfif>>#cpu_sold#</td>
<td class="r"<cfif cpu_sold LT cpu_alloc> style="background:lightcoral;"</cfif>>#cpu_alloc#</td>
<td class="r"<cfif cpu_sold LT cpu_alloc_on> style="background:lightcoral;"</cfif>>#cpu_alloc_on#</td>
<td>#ram_codes#</td>
<td class="r"<cfif ram_sold GT ram_alloc> style="background:lightgreen;"</cfif>>#ram_sold#</td>
<td class="r"<cfif ram_sold LT ram_alloc> style="background:lightcoral;"</cfif>>#ram_alloc#</td>
<td class="r"<cfif ram_sold LT ram_alloc_on> style="background:lightcoral;"</cfif>>#ram_alloc_on#</td>
<td>#cpu_codes#</td>
<td class="r"<cfif cpu_sold GT ram_alloc> style="background:lightgreen;"</cfif>>#cpu_sold#</td>
<td class="r"<cfif cpu_sold LT cpu_alloc> style="background:lightcoral;"</cfif>>#cpu_alloc#</td>
<td class="r"<cfif cpu_sold LT cpu_alloc_on> style="background:lightcoral;"</cfif>>#cpu_alloc_on#</td>
<td>#disk_codes#</td>
<td class="r"<cfif disk_sold GT disk_alloc> style="background:lightgreen;"</cfif>>#disk_sold#</td>
<td class="r"<cfif disk_sold LT disk_alloc> style="background:lightcoral;"</cfif>>#disk_alloc#</td>