024 improvements

This commit is contained in:
2026-07-26 23:04:05 +03:00
parent f7421c1155
commit 849a4c2796
4 changed files with 160 additions and 60 deletions
+73 -11
View File
@@ -6,19 +6,20 @@
</cfsilent>
<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_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))#/>
<cfparam name="dt_start" default=#dateAdd('m',-1,createDateTime(year(Now()),month(Now()),1,0,0,0))#/> --->
<cfset hours=dateDiff('h', dt_start, dateAdd('d', 1, dt_finish))/>
<cfset hours=dateDiff('h', dt_start, dt_finish)/>
<!--- <cfdump var=#variables#/> --->
<cfset tenant_wz_index=val(mid(request.auth.wz,3,5))/><!--- cut off WZ --->
<cfset restrict_to_own_instances = true>
<cfparam name="WZ" default=#request.auth.wz#/>
<cfif request.auth.wz EQ 'WZ01112'><!--- грубо --->
<cfset restrict_to_own_instances = false>
<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"
@@ -27,6 +28,7 @@
tenant_wz_index=#tenant_wz_index#
output="report"
debug=#isDefined("DEBUG")#
restrict_to_own_instances=#restrict_to_own_instances#
/><layout:xml qRead=#report.qCharge# titleMap=#report.chargeTitleMap# filename="#pageInfo.entity#.xml"/>
<cfabort/>
</cfif><cfif isDefined("output_json")><cfmodule template="mod/compute_payg.cfm"
@@ -35,13 +37,14 @@
tenant_wz_index=#tenant_wz_index#
output="report"
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"/>
<cfabort/>
</cfif><!---
---><layout:page section="header" pageInfo=#pageInfo#>
<layout:attribute name="title">
<cfoutput><b>Отчет по PAYG</b> #request.auth.wz#</cfoutput>
<cfoutput><b>Отчет по PAYG</b> #WZ#</cfoutput>
</layout:attribute>
<layout:attribute name="controls">
<!---skip filter link, filter is not implemented--->
@@ -56,11 +59,23 @@
<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_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" name="DEBUG" value="DEBUG" style="cursor:pointer;"/><!--- ********* --->
</form>
<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/>
<!--- <cfflush/> --->
@@ -71,6 +86,7 @@
tenant_wz_index=#tenant_wz_index#
output="report"
debug=#structKeyExists(Form,"DEBUG")#
restrict_to_own_instances=#restrict_to_own_instances#
/>
Часов в периоде: <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')#
</b>
<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>
@@ -94,7 +113,7 @@ S3 операции и трафик: <b<cfif datediff("h",report.qS3OpsTrfAge.dt
</cfoutput>
<table class="worktable">
<thead>
<td width="1%"></td>
<th width="1%"></th>
<th width="7%" colspan="2">Артикул</th>
<th width="3%">С</td>
<th width="3%">По</td>
@@ -223,6 +242,49 @@ S3 операции и трафик: <b<cfif datediff("h",report.qS3OpsTrfAge.dt
</cfoutput>
</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=#this.datasources[request.ds].connectionString#/> --->