033 improvements

This commit is contained in:
2026-04-02 18:31:08 +03:00
parent 997813d115
commit 353f5ce5c2
5 changed files with 407 additions and 47 deletions
+50 -37
View File
@@ -5,12 +5,10 @@
<cfimport prefix="layout" taglib="layout"/>
</cfsilent>
<m:prepare_ls entity="crm2cloud" accessObject="" pageInfoOut="pageInfo" trackOut="tr"/>
<m:prepare_ls entity="crm2cloud" settingsKey="crm2cloud" accessObject="" pageInfoOut="pageInfo" trackOut="tr"/>
<cfquery name="qReconciliation">
<cfquery name="qRead">
WITH
status(status, status_id, probability_pc) as (VALUES
('Закрыта неуспешно',7,0),('Закрыта успешно',6,100),('Договор подписан',5,100),('Договор на подписании',15,90),('Договор на согласовании',12,70),
@@ -56,7 +54,7 @@ stair as ( -- рабочая лесенка (инстансы строк, име
select * FROM (
SELECT *,
MIN(dt_from) OVER (PARTITION BY line_key ORDER BY deal_index desc) running_min_dt
FROM line --WHERE probability_pc > 0
FROM line WHERE probability_pc > 0
) t
WHERE t.dt_from = t.running_min_dt
AND t.dt_to > CURRENT_TIMESTAMP OR t.dt_to IS NULL
@@ -128,9 +126,12 @@ select
<d:field title="CPU Elma">c.quantity as cpu_sold</d:field>
<d:field title="CPU Cloud">a.cpu as cpu_alloc</d:field>
<d:field title="CPU Cloud ON">a.cpu_on as cpu_alloc_on</d:field>
<d:field title="Коды Дисков">d.quantity as disk_sold</d:field>
<d:field title="Диски GB Elma">da.disk_alloc</d:field>
<d:field title="Диски Cloud">d.codes as disk_codes</d:field>
<d:field title="Коды Дисков">d.codes as disk_codes</d:field>
<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_set>
from sold_ram r
join deal_stat ds on (r.wz=ds.wz)
@@ -138,18 +139,20 @@ 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)
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
</cfquery>
<!--- QoQ does not support join syntax, at least of Lucee 5.4--->
<cfif isDefined("output_xls")>
<layout:xml qRead=#qReconciliation# 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=#qReconciliation# titleMap=#titleMap# filename="#pageInfo.entity#.json"/>
<layout:json qRead=#qRead# titleMap=#titleMap# filename="#pageInfo.entity#.json"/>
<cfabort/>
</cfif><!---
---><layout:page section="header" pageInfo=#pageInfo#>
@@ -157,16 +160,13 @@ order by 1,3
<layout:attribute name="title">
<cfoutput><b>Сверка CRM - Cloud</b></cfoutput>
</layout:attribute>
<layout:attribute name="controls">
<!---skip filter link, filter is not implemented--->
<!---<layout:language_switch/>--->
</layout:attribute>
</layout:page>
<!--- <cfdump var=#qReconciliation# abort=true/> --->
<!--- <cfdump var=#qRead# abort=true/> --->
<cfoutput>
<!--- <form method="post" action="">
<!---<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')#"/>
<input type="submit" style="cursor:pointer;"/>
@@ -179,30 +179,37 @@ VCD Storage: <b>#dateFormat(qStorageAge.dt_load,'YYYY-MM-DD')# #timeFormat(qStor
S3 хранение: <b>#dateFormat(qS3VolAge.dt_load,'YYYY-MM-DD')# #timeFormat(qS3VolAge.dt_load,'HH:MM:SS')#</b>
S3 операции и трафик: <b>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-MM-DD')# #timeFormat(qS3OpsTrfAge.dt_load,'HH:MM:SS')#</b>
--->
<br/>
<!--- <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_json" title="экспорт в json" style="margin-left:.5em; height:100%;" target="_blank"><img src="img/json.svg" style="vertical-align:text-bottom;" width="13" height="13"/></a>
</cfoutput>
<a href="#request.thisPage#?output_json" title="экспорт в json" style="margin-left:.5em; height:100%;" target="_blank"><img src="img/json.svg" style="vertical-align:text-bottom;" width="13" height="13"/></a></cfoutput>
<br/> --->
<layout:grid_summary
recordCount=#qRead.recordCount#
footerOut="gridFooter"
excelLink="Yes"
jsonLink="Yes"
/>
<table class="worktable">
<thead>
<layout:grid_head titleMap=#titleMap# sortArray=#pageInfo.settings.sort.sortArray#>
<th width="7%"><layout:column_head name="wz_sold"/></th>
<th width="5%"><layout:column_head name="wz_sold"/></th>
<th width="10%"><layout:column_head name="client_sold"/></th>
<th width="7%"><layout:column_head name="wz_alloc"/></th>
<th width="5%"><layout:column_head name="wz_alloc"/></th>
<th width="3%"><layout:column_head name="status_ids"/></th>
<th width="15%"><layout:column_head name="ram_codes"/></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="15%"><layout:column_head name="cpu_codes"/></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="15%"><layout:column_head name="disk_codes"/></th>
<th width="10%"><layout:column_head name="disk_codes"/></th>
<th width="3%"><layout:column_head name="disk_sold"/></th>
<th width="3%"><layout:column_head name="disk_alloc"/></th>
@@ -211,28 +218,34 @@ S3 операции и трафик: <b>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-M
<cfflush/>
<cfoutput query="qReconciliation">
<cfoutput query="qRead">
<tr>
<td>#wz_sold#</td>
<td><a href="contragent.cfm?__id=#company_uid#&#tr.fwx#">#client_sold#</a></td>
<td>
<cfif len(wz_sold)>
<a href="contragent_rpt.cfm?__id=#company_uid#&#tr.fwx#">#client_sold#</a>
<cfelse>
<a href="contragent_rpt.cfm?__id=#alloc_company_uid#&#tr.fwx#">#alloc_company#</a>
</cfif>
</td>
<td>#wz_alloc#</td>
<td>#status_ids#</td>
<td>#ram_codes#</td>
<td>#ram_sold#</td>
<td>#ram_alloc#</td>
<td>#ram_alloc_on#</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>#cpu_sold#</td>
<td>#cpu_alloc#</td>
<td>#cpu_alloc_on#</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>#disk_sold#</td>
<td>#disk_alloc#</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>
</tr>