018 select fix dt_to

This commit is contained in:
2026-03-30 09:05:59 +03:00
parent 8187db1ea3
commit e303bbdd03
2 changed files with 23 additions and 19 deletions
+1 -1
View File
@@ -489,7 +489,7 @@
<td class="c">#date_accept#</td> <td class="c">#date_accept#</td>
<td class="c">#__index#</td> <td class="c">#__index#</td>
<td class="c">#dateFormat(date_nop,'YYYY-MM-DD')#</td> <td class="c">#dateFormat(date_nop,'YYYY-MM-DD')#</td>
<td class="c">#dateFormat(date_end,'YYYY-MM-DD')#</td> <td class="c<cfif isDate(date_end) AND date_end LT Now()> err</cfif>">#dateFormat(date_end,'YYYY-MM-DD')#</td>
<td class="c">#is_easy#</td> <td class="c">#is_easy#</td>
<!--- <td class="c">#additional_agreement_uid#</td> ---> <!--- <td class="c">#additional_agreement_uid#</td> --->
+22 -18
View File
@@ -59,6 +59,7 @@ stair as ( -- рабочая лесенка (инстансы строк, име
FROM line --WHERE probability_pc > 0 FROM line --WHERE probability_pc > 0
) t ) t
WHERE t.dt_from = t.running_min_dt WHERE t.dt_from = t.running_min_dt
AND t.dt_to > CURRENT_TIMESTAMP OR t.dt_to IS NULL
), ),
alloc as (select c."WZ" as wz alloc as (select c."WZ" as wz
, round(sum(c."VM_RAM_Allocated")) as ram , round(sum(c."VM_RAM_Allocated")) as ram
@@ -92,7 +93,7 @@ z.id_klienta as WZ, z.__name as client, z.__id as company_uid, round(sum(c.cnt*o
FROM stair o FROM stair o
JOIN elma.companies z on (o._companies=z.__id) JOIN elma.companies z on (o._companies=z.__id)
LEFT OUTER JOIN component c on (c.__id = ANY (o.params)) LEFT OUTER JOIN component c on (c.__id = ANY (o.params))
WHERE c.code LIKE 'iaas.ngc.%.vcpu-_' WHERE c.code LIKE 'iaas.ngc.%.vcpu%-_'
GROUP BY z.id_klienta, z.__id, z.__name GROUP BY z.id_klienta, z.__id, z.__name
), ),
sold_disk as (SELECT sold_disk as (SELECT
@@ -113,21 +114,24 @@ GROUP BY z.id_klienta
) )
select select
r.wz as wz_sold, <d:field_set titleMapOut="titleMap" lengthOut="fieldCount">
r.client as client_sold, r.company_uid, <d:field title="WZ Elma">r.wz as wz_sold</d:field>
a.wz as wz_alloc, <d:field title="Клиент">r.client as client_sold</d:field>
ds.status_ids, <d:field title="WZ Cloud">r.company_uid</d:field>
r.codes as ram_codes, <d:field title="Статусы">a.wz as wz_alloc</d:field>
r.quantity as ram_sold, <d:field title="Коды RAM">ds.status_ids</d:field>
a.ram as ram_alloc, <d:field title="RAM GB Elma">r.codes as ram_codes</d:field>
a.ram_on as ram_alloc_on, <d:field title="RAM Cloud">r.quantity as ram_sold</d:field>
c.codes as cpu_codes, <d:field title="RAM Cloud ON">a.ram as ram_alloc</d:field>
c.quantity as cpu_sold, <d:field title="">a.ram_on as ram_alloc_on</d:field>
a.cpu as cpu_alloc, <d:field title="Коды CPU">c.codes as cpu_codes</d:field>
a.cpu_on as cpu_alloc_on, <d:field title="CPU Elma">c.quantity as cpu_sold</d:field>
d.quantity as disk_sold, <d:field title="CPU Cloud">a.cpu as cpu_alloc</d:field>
da.disk_alloc, <d:field title="CPU Cloud ON">a.cpu_on as cpu_alloc_on</d:field>
d.codes as disk_codes <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_set>
from sold_ram r from sold_ram r
join deal_stat ds on (r.wz=ds.wz) join deal_stat ds on (r.wz=ds.wz)
join sold_cpu c on (r.wz=c.wz) join sold_cpu c on (r.wz=c.wz)
@@ -142,10 +146,10 @@ order by 1,3
<cfif isDefined("output_xls")> <cfif isDefined("output_xls")>
<layout:xml qRead=#qCharge# titleMap=#titleMap# filename="#pageInfo.entity#.xml"/> <layout:xml qRead=#qReconciliation# titleMap=#titleMap# filename="#pageInfo.entity#.xml"/>
<cfabort/> <cfabort/>
</cfif><cfif isDefined("output_json")> </cfif><cfif isDefined("output_json")>
<layout:json qRead=#qCharge# titleMap=#titleMap# filename="#pageInfo.entity#.json"/> <layout:json qRead=#qReconciliation# titleMap=#titleMap# filename="#pageInfo.entity#.json"/>
<cfabort/> <cfabort/>
</cfif><!--- </cfif><!---
---><layout:page section="header" pageInfo=#pageInfo#> ---><layout:page section="header" pageInfo=#pageInfo#>