spec/specification_ls.cfm
2025-06-14 12:32:09 +03:00

111 lines
4.4 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="specification" acessObject="" 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.specification_type like ?) OR (p.division like ?) OR (p.performer_short like ?))" default=""/>
</m:filter_settings>
<cfset pageInfo.settings.filter=#filter#/>
<cfquery name="qRead" datasource="#request.DS#">
select
<d:field_set titleMapOut="titleMap" lengthOut="fieldCount">
<d:field title="ID" cfSqlType="CF_SQL_INTEGER">s.specification_id</d:field>
<d:field title="Контрагент">k.contragent</d:field>
<d:field>d.contragent_id</d:field>
<d:field title="Договор">d.contract</d:field>
<d:field title="Дата договора">d.dt_contract</d:field>
<d:field>s.contract_id</d:field>
<d:field title="Спецификация">s.specification</d:field>
<d:field title="Строк">(select count(*) from specification_item i where i.specification_id=s.specification_id) as item_count</d:field>
<d:field title="Соглашений">(select count(*) from agreement a where a.contract_id=s.contract_id) as agreement_count</d:field>
</d:field_set>
from specification s
left outer join contract d on (s.contract_id=d.contract_id)
left outer join contragent k on (d.contragent_id=k.contragent_id)
where 1=1 <m:filter_build filter=#pageInfo.settings.filter#/>
order by <m:order_build sortArray=#pageInfo.settings.sort.sortArray# fieldCount=#fieldCount#/>
</cfquery>
<cfquery name="qCountTotal" datasource="#request.DS#">
select count(*) as cnt from specification 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.status.errorState GT 0>
<cfoutput><div class="err">#status.errorMessage#</div></cfoutput>
</cfif>--->
<!--- <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="15%"><layout:column_head name="specification"/></th>
<th width="5%"><layout:column_head name="item_count"/></th>
<th width="15%"><layout:column_head name="contract"/></th>
<th width="5%"><layout:column_head name="agreement_count"/></th>
<th width="15%"><layout:column_head name="contragent"/></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>#specification#</td>
<td class="c">#item_count#</td>
<td>#contract# #dateFormat(dt_contract,'DD.MM.YYYY')#</td>
<td class="c">#agreement_count#</td>
<td>#contragent#</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"/>