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

156 lines
7.6 KiB
Plaintext
Raw Permalink 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="service" pageInfoOut="pageInfo" trackOut="tr"/>
<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.service_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="titleMap" lengthOut="fieldCount">
<d:field title="ID" cfSqlType="CF_SQL_INTEGER">s.service_id</d:field>
<d:field cfSqlType="CF_SQL_INTEGER">s.abstract_service_id</d:field>
<d:field title="Абстрактная услуга">a.abstract_service</d:field>
<d:field title="Вариант услуги">CONCAT_WS(' - ', a.abstract_service, m.modifier) as service</d:field><!--- не хотелось использовать функцию, специфичную для Postgre, но поле понадобилось в резалтсете, а так сильно проще --->
<d:field title="Группа">g.analytic_code</d:field>
<d:field title="area">g.area</d:field>
<d:field title="Код">g.area_code</d:field>
<d:field title="Код">a.code as abstract_service_code</d:field>
<d:field title="Код">m.code as modifier_code</d:field>
<d:field title="Класс характеристики">c.modifier_class</d:field>
<d:field>c.modifier_class_id</d:field>
<d:field title="Характеристика">m.modifier</d:field>
<d:field>m.modifier_id</d:field>
<d:field title="Ответственный">s.manager_id</d:field>
<d:field title="">u.login</d:field>
<d:field title="">u.firstname</d:field>
<d:field title="">u.middlename</d:field>
<d:field title="Ответственный">u.lastname</d:field>
<d:field title="">u.email</d:field>
<d:field title="">s.descr</d:field>
<d:field title="Коммерческие примечания">s.commercial_note</d:field>
<d:field title="Внутренняя">s.is_internal</d:field>
<d:field title="Статус">a.status_id</d:field>
<d:field title="Статус">st.status</d:field>
<d:field title="measure_id">s.measure_id</d:field>
<d:field title="Ед.изм.">n.measure</d:field>
<d:field title="НДС%">s.vat_perc</d:field>
<d:field title="НДС не обл.">s.vat_free</d:field>
<d:field title="Вар. комп.">(select count(*) from service_param sp where sp.service_id=s.service_id) as param_count</d:field>
<d:field title="Комп-в">(select count(*) from abstract_service_param_class ac where ac.abstract_service_id=a.abstract_service_id) as abstract_param_count</d:field>
</d:field_set>
from service s
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 c on (a.modifier_class_id=c.modifier_class_id)
left outer join area g on (a.area_id=g.area_id)
left outer join status st on (s.status_id=st.status_id)
left outer join measure n on (s.measure_id=n.measure_id)
left outer join usr u on (s.manager_id=u.usr_id)
where 1=1 <m:filter_build filter=#pageInfo.settings.filter#/>
order by <m:order_build sortArray=#pageInfo.settings.sort.sortArray# fieldCount=#fieldCount#/>
</cfquery>
<cfcatch type="database">
<m:ls_catch catch=#cfcatch# status=#pageInfo.status#/>
</cfcatch>
</cftry>
<cfquery name="qCountTotal" datasource="#request.DS#">
select count(*) as cnt from service where 1=1
</cfquery>
</m:silent><!---
-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------
---><cfif isDefined("output_xls")>
<layout:xml qRead=#qRead# titleMap=#titleMap# filename="#pageInfo.entity#.xml"/>
<cfabort/>
</cfif><cfif isDefined("output_json")>
<layout:json qRead=#qRead# titleMap=#titleMap# filename="#pageInfo.entity#.json"/>
<cfabort/>
</cfif><!---
---><layout:page section="header" pageInfo=#pageInfo#>
<layout:attribute name="title">
<cfoutput><b>Варианты услуг</b> (список конкретных услуг с характеристиками)</cfoutput>
</layout:attribute>
</layout:page>
<cfif pageInfo.readPermitted() AND !pageInfo.status.errorState>
<layout:grid_summary
recordCount=#qRead.recordCount#
totalCount=#qCountTotal.cnt#
footerOut="gridFooter"
excelLink="Yes"
jsonLink="Yes"
/>
<table class="worktable">
<thead>
<layout:grid_head titleMap=#titleMap# sortArray=#pageInfo.settings.sort.sortArray#>
<th width="1%">
<c:link_add canWrite=#pageInfo.writePermitted()# entity=#pageInfo.entity# fwx=#tr.fwx#/>
</th>
<th width="7%"><layout:column_head name="analytic_code"/></th>
<th width="5%"><layout:column_head name="abstract_service_code"/></th>
<th width="15%"><layout:column_head name="service"/></th>
<!--- <th width="15%">Полное наименование</th> --->
<th width="15%"><layout:column_head name="abstract_service"/></th>
<th width="10%"><layout:column_head name="modifier_class"/></th>
<th width="10%"><layout:column_head name="modifier"/></th>
<th width="2%"><layout:column_head name="abstract_param_count"/></th>
<th width="2%"><layout:column_head name="param_count"/></th>
<th width="5%"><layout:column_head name="lastname"/></th>
<th width="3%"><layout:column_head name="status"/></th>
<th width="3%"><layout:column_head name="measure"/></th>
<th width="3%"><layout:column_head name="vat_free"/></th>
<th width="3%"><layout:column_head name="vat_perc"/></th>
<th width="1%"></th>
</layout:grid_head>
</thead>
<cfoutput query="qRead" maxrows=#pageInfo.recordsPerPage# startrow=#pageInfo.nStart#>
<tr>
<td class="c">
<c:link_view_edit canWrite=#pageInfo.writePermitted()# entity=#pageInfo.entity# id=#qRead[pageInfo.entity&'_id'][currentRow]# fwx=#tr.fwx#/>
</td>
<td>#analytic_code# #area#</td>
<td>#request.skuCode(area_code,abstract_service_code,modifier_code)#</td>
<td>#service#</td>
<!--- <td>#abstract_service#<cfif len(modifier)> - #modifier#</cfif></td> --->
<td><a href="abstract_service.cfm?abstract_service_id=#abstract_service_id#&#tr.fwx#">#abstract_service#</a></td>
<td class="r"><a href="modifier_class.cfm?modifier_class_id=#modifier_class_id#&#tr.fwx#">#modifier_class#</td>
<td><a href="modifier.cfm?modifier_id=#modifier_id#&#tr.fwx#">#modifier#</a></td>
<td class="c"><cfif abstract_param_count GT 0>#abstract_param_count#</cfif></td>
<td class="c"><cfif param_count GT 0>#param_count#</cfif></td>
<td><cfif manager_id GT 0><a href="mailto:#email#">#lastname# #firstname# #middlename#</a></cfif></td>
<td>#status#</td>
<td>#measure#</td>
<td class="c"><cfif vat_free GT 0>Не облагается</cfif></td>
<td class="c">#vat_perc#</td>
<td class="c">
<c:link_del canWrite=#pageInfo.writePermitted()# entity=#pageInfo.entity# id=#qRead[pageInfo.entity&'_id'][currentRow]# fwx=#tr.fwx#/>
</td>
</tr>
</cfoutput>
</table>
<cfoutput>#gridFooter#</cfoutput>
</cfif>
<layout:page section="footer"/>