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

125 lines
5.1 KiB
Plaintext

<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="param" 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.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="titleMap" lengthOut="fieldCount">
<d:field title="param_id" cfSqlType="CF_SQL_INTEGER">p.param_id</d:field>
<d:field title="param_class_id" cfSqlType="CF_SQL_INTEGER">c.param_class_id</d:field>
<d:field title="Вариант">p.param</d:field>
<d:field title="Сокращение для спецификации">p.param_short</d:field>
<d:field title="Компонент">c.param_class</d:field>
<d:field title="Ед.изм.">m.measure_short</d:field>
<d:field title="Код">p.code</d:field>
<d:field title="Сортировка">p.sort</d:field>
<!--- <d:field title="Базовая цена без НДС, ₽">p.base_price</d:field> --->
<d:field title="Точность">p.precision</d:field>
<d:field title="Использует&shy;ся услугами">(select count(*) from service_param sp where sp.param_id=p.param_id) as svc_count</d:field>
</d:field_set>
from param p
left outer join param_class c on (p.param_class_id=c.param_class_id)
left outer join measure m on (p.measure_id=m.measure_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 param 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:attribute name="controls">
<!---skip filter link, filter is not implemented--->
<!---<layout:language_switch/>--->
</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="10%"><layout:column_head name="param_class"/></th>
<th width="10%"><layout:column_head name="param"/></th>
<th width="10%"><layout:column_head name="param_short"/></th>
<!--- <th width="10%">Полное название</th> --->
<th width="3%"><layout:column_head name="code"/></th>
<th width="3%"><layout:column_head name="measure_short"/></th>
<th width="3%"><layout:column_head name="precision"/></th>
<th width="3%"><layout:column_head name="sort"/></th>
<th width="3%"><layout:column_head name="svc_count"/></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><a href="param_class.cfm?param_class_id=#param_class_id#&#tr.fwx#">#param_class#</a></td>
<td>#param#</td>
<td>#param_short#</td>
<!--- <td>#param_class# #param#</td> --->
<td class="c">#code#</td>
<td class="c">#measure_short#</td>
<td class="c">#precision#</td>
<td class="r">#sort#</td>
<td class="c"><cfif svc_count GT 0>#svc_count#</cfif></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"/>