spec/price_rpt1.cfm
2025-06-02 16:16:51 +03:00

239 lines
10 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<cfsilent>
<cfimport prefix="m" taglib="lib"/>
<cfimport prefix="c" taglib="lib/controls"/>
<cfimport prefix="d" taglib="lib/data"/>
<cfimport prefix="layout" taglib="layout"/>
</cfsilent><m:silent silent="No">
<m:prepare_ls entity="price" accessObject="price_rpt" pageInfoOut="pageInfo" trackOut="tr"/><!---synthetic entity, not a table--->
<m:filter_settings target="#pageInfo.entity#_ls">
<m:filterparam filter=#filter# param="quickfilter" ftype="string" prefix="%" suffix="%" expression="((p.project like ?) OR (p.customer like ?) OR (p.customer_alias like ?) OR (p.param_class_type like ?) OR (p.division like ?) OR (p.performer_short like ?))" default=""/>
</m:filter_settings>
<cfset pageInfo.settings.filter=#filter#/>
<!---<cftry>--->
<cfquery name="qRead" datasource="#request.DS#">
select
<d:field_set titleMapOut="qReadTitleMap" lengthOut="qReadFieldCount">
<d:field title="service_price_id" cfSqlType="CF_SQL_VARCHAR">prc.service_price_id</d:field>
<d:field title="service_param_price_id" cfSqlType="CF_SQL_VARCHAR">prc.service_param_price_id</d:field>
<d:field title="Модель цены">prm.pricing_model</d:field>
<d:field title="Модель цены">prm.pricing_model_short</d:field>
<d:field title="Модель цены">prm.pricing_model_code</d:field>
<d:field title="Модель цены">prm.pricing_model_id</d:field>
<d:field title="Период цены">prc.pricing_period</d:field>
<d:field title="Период опроса">prc.rating_period</d:field>
<d:field title="GPL, ₽" cfSqlType="CF_SQL_DECIMAL">prc.price</d:field>
<d:field title="Цена со ск., ₽" cfSqlType="CF_SQL_DECIMAL">case when price*.95 > coalesce(min_price,0) then price*.95 else min_price end as discount_price</d:field>/***/
<d:field title="Дно" cfSqlType="CF_SQL_DECIMAL">min_price</d:field>
<d:field title="abstract_service_id" cfSqlType="CF_SQL_INTEGER">a.abstract_service_id</d:field>
<d:field title="service_id" cfSqlType="CF_SQL_INTEGER">s.service_id</d:field>
<d:field title=#i18("Код группы","Group Code")#>g.area_code</d:field>
<d:field title="Группа">g.area</d:field>
<d:field title="Группа">g.analytic_code</d:field>
<d:field title="Catalog Group">g.area_en</d:field>
<d:field title="Статус">u.status</d:field>
<d:field title="Status">u.status_en</d:field>
<d:field>a.code</d:field>
<d:field>m.code as modifier_code</d:field>
<d:field>p.code as param_code</d:field>
<d:field title="Абстрактная услуга">a.abstract_service</d:field>
<d:field title="Abstract Service">a.abstract_service_en</d:field>
<d:field title="modifier_id" cfSqlType="CF_SQL_INTEGER">m.modifier_id</d:field>
<d:field title="Класс модификатора">mc.modifier_class</d:field>
<d:field title="Модификатор">m.modifier</d:field>
<d:field title="Modifier class">mc.modifier_class_en</d:field>
<d:field title="Modifier">m.modifier_en</d:field>
<d:field title="service_param_id" cfSqlType="CF_SQL_INTEGER">sp.service_param_id</d:field>
<d:field title="param_class_id" cfSqlType="CF_SQL_INTEGER">pc.param_class_id</d:field>
<d:field title="param_class">pc.param_class</d:field>
<d:field title="Компонент">p.param</d:field>
<d:field title="param_id" cfSqlType="CF_SQL_INTEGER">p.param_id</d:field>
<d:field title="Ед.изм.">case when p.param_id IS NULL then se.measure_short else e.measure_short end as measure_short</d:field>
<d:field title="Measure">case when p.param_id IS NULL then se.measure_short_en else e.measure_short_en end as measure_short_en</d:field>
</d:field_set>
from (
select
t.service_param_price_id, t.price, t.min_price, t.service_param_id, t.pricing_model_id
, null as service_price_id, sp.service_id, t.pricing_period, t.rating_period
from service_param_price t join service_param sp on (t.service_param_id=sp.service_param_id)
union all
select
null, st.price, st.min_price, null, st.pricing_model_id, st.service_price_id, st.service_id, st.pricing_period, st.rating_period
from service_price st
) prc
left outer join service s on (prc.service_id=s.service_id)
left outer join service_param sp on (prc.service_param_id=sp.service_param_id)
left outer join abstract_service a on (s.abstract_service_id=a.abstract_service_id)
left outer join modifier m on (s.modifier_id=m.modifier_id)
left outer join modifier_class mc on (m.modifier_class_id=mc.modifier_class_id)
left outer join abstract_service_param_class ac on (sp.abstract_service_param_class_id=ac.abstract_service_param_class_id)
left outer join param_class pc on (ac.param_class_id=pc.param_class_id)
left outer join param p on (sp.param_id=p.param_id)
left outer join measure e on (p.measure_id=e.measure_id)
left outer join measure se on (s.measure_id=se.measure_id)
left outer join area g on (a.area_id=g.area_id)
left outer join status u on (a.status_id=u.status_id)
left outer join pricing_model prm on (prc.pricing_model_id=prm.pricing_model_id)
where 1=1 <m:filter_build filter=#pageInfo.settings.filter#/>
order by g.analytic_code,a.abstract_service, s.service_id, m.sort, m.modifier_id, prc.pricing_model_id, ac.sort, coalesce(p.sort,0), p.param_id
</cfquery>
<!---
<cfcatch type="database">
<m:ls_catch catch=#cfcatch# status=#pageInfo.status#/>
</cfcatch>
</cftry>--->
<cfquery name="qCountTotal" datasource="#request.DS#">
select (select count(*) from service_param_price) + (select count(*) from service_price) as cnt;
</cfquery>
</m:silent><!---
-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------
---><cfif isDefined("output_xls")>
<layout:xml qRead=#qRead# titleMap=#qReadTitleMap# filename="#pageInfo.entity#.xml"/>
<cfabort/>
</cfif><cfif isDefined("output_json")>
<layout:json qRead=#qRead# filename="#pageInfo.entity#.json"/>
<cfabort/>
</cfif><!---
---><layout:page section="header" pageInfo=#pageInfo#>
<layout:attribute name="title">
<cfoutput><b>#i18("Прайс-лист на компоненты","Resource Price List")#</b></cfoutput>
</layout:attribute>
</layout:page>
<!---<cfdump var=#qRead#/>--->
<cfif pageInfo.readPermitted() AND !pageInfo.status.errorState>
<layout:grid_summary
recordCount=#qRead.recordCount#
totalCount=#qCountTotal.cnt#
footerOut="gridFooter"
excelLink=#pageInfo.writePermitted()#
jsonLink=#pageInfo.writePermitted()#
/>
<cffunction name="formatPrice" output="true">
<cfargument name="price"/>
<cfif isNumeric(price)><cfreturn numberFormat(price,'.00')/><cfelse><cfreturn "(по запросу)"></cfif>
</cffunction>
<cfset request.formatPrice=formatPrice/>
<table class="worktable wide">
<thead>
<layout:grid_head titleMap=#qReadTitleMap# sortArray=#pageInfo.settings.sort.sortArray#>
<th width="5%">Группа услуг</th>
<th width="5%">Код</th>
<th width="5%">Услуга</th>
<th width="15%">Компонент</th>
<th width="3%">Единица измерения</th>
<th width="3%">Модель ц-обр.</th>
<th width="3%">Период цены</th>
<th width="3%">Период опроса</th>
<th width="7%">Цена GPL, ₽ с НДС</th>
<th width="7%">GPL-5%, ₽ с НДС</th>
</layout:grid_head>
</thead>
<cfoutput query="qRead" group="service_id">
<cfoutput group="pricing_model_id">
<tr>
<td>#analytic_code# #area#</td>
<td><a href="service.cfm?service_id=#service_id#&#tr.fwx#">#request.skuCode(area_code,code,modifier_code)#</a></td>
<td colspan="8"><a href="abstract_service.cfm?abstract_service_id=#abstract_service_id#&#tr.fwx#">#abstract_service#</a> #modifier#</td>
<!--- <td><cfif service_price_id GT 0>#measure_short#</cfif></td>
<td class="c"><cfif service_price_id GT 0>#pricing_model_short#</cfif></td>
<td class="c"><cfif service_price_id GT 0>#pricing_period#</cfif></td>
<td class="c"><cfif service_price_id GT 0>#rating_period#</cfif></td>
<td class="r">
<cftry>
<cfif service_price_id GT 0>
<a href="service_price.cfm?service_price_id=#service_price_id#&#tr.fwx#">
<cfif isNumeric(price)>
#request.numFmt(price*(1+request.VAT),2)#
<cfelse>
<i>по запросу</i>
</cfif>
</a>
</cfif>
<cfcatch type="ANY">?</cfcatch>
</cftry>
</td>
<td class="r">
<cftry>
<cfif service_price_id GT 0>
<cfif isNumeric(discount_price)>
#request.numFmt(discount_price*(1+request.VAT),2)#
<cfelse>
<i>по запросу</i>
</cfif>
</cfif>
<cfcatch type="ANY">?</cfcatch>
</cftry>
</td> --->
</tr>
<cfoutput>
<tr>
<td>#analytic_code# #area#</td>
<td><a href="service_param.cfm?service_param_id=#service_param_id#&#tr.fwx#">#request.skuCode(area_code,code,modifier_code,param_code,pricing_model_code)#</a></td>
<td><!--- <a href="abstract_service.cfm?abstract_service_id=#abstract_service_id#&#tr.fwx#">#abstract_service#</a> #modifier# ---></td>
<td>#param_class#<cfif len(param)>: #param#</cfif></td>
<td>#measure_short#</td>
<td class="c">#pricing_model_short#</td>
<td class="c">#pricing_period#</td>
<td class="c">#rating_period#</td>
<td class="r">
<cftry>
<a href="service_param_price.cfm?service_param_price_id=#service_param_price_id#&#tr.fwx#">
<cfif isNumeric(price)>
#request.numFmt(price*(1+request.VAT),2)#
<cfelse>
<i>по запросу</i>
</cfif>
</a>
<cfcatch type="ANY">?</cfcatch>
</cftry>
</td>
<td class="r">
<cftry>
<cfif isNumeric(discount_price)>
#request.numFmt(discount_price*(1+request.VAT),2)#
<cfelse>
<i>по запросу</i>
</cfif>
<cfcatch type="ANY">?</cfcatch>
</cftry>
</td>
</tr>
</cfoutput>
</cfoutput>
</cfoutput>
</table>
<cfoutput>#gridFooter#</cfoutput>
</cfif>
<layout:page section="footer"/>