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

243 lines
7.6 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">
<cffunction name="plain2HtmClean">
<cfargument name="s" type="string"/>
<cfreturn request.plain2htm(request.cleanHtm(s))/>
</cffunction>
<cffunction name="cleanInput">
<cfargument name="s" type="string"/>
<cfreturn htmlEditFormat(s)/>
</cffunction>
<m:prepare_detail entity="contragent" accessObject="" key="contragent_id" pageInfoOut="pageInfo"/>
<d:bean readonly=#!pageInfo.writePermitted()# table="contragent" datasource="#request.DS#" output="d" status="pageInfo.status">
<d:param field="contragent_id" type="integer" key autoincrement/>
<d:param field="contragent" type="varchar" size="255" preprocessor=#cleanInput#/>
<d:param field="is_provider" type="bool" init="0" default="0"/>
<d:param field="descr" type="varchar" preprocessor=#plain2HtmClean#/>
<d:param field="external_uid" type="guid" forNull=""/>
<d:param field="external_code" type="varchar" size="255"/>
<d:param field="creator_id" type="integer" value="#request.usr_id#" skipUpdate/>
<d:param field="updater_id" type="integer" value="#request.usr_id#" />
<d:param field="dt_created" type="timestamp" value="#Now()#" skipUpdate/>
<d:param field="dt_updated" type="timestamp" value="#Now()#"/>
</d:bean>
<m:dispatch_detail
usePRG="No"<!---*** --->
pageInfo=#pageInfo#
id="#d.contragent_id#"
status=#pageInfo.status#
trackOut="tr"
idAttributesOut="id"
/>
<!--- decoration --->
<cfquery name="qDecoration" datasource="#request.DS#">
select
a.login as creator, a.shortname as creator_shortname, m.login as updater, m.shortname as updater_shortname
from contragent g
left outer join usr a on (g.creator_id=a.usr_id)
left outer join usr m on (g.updater_id=m.usr_id)
where g.contragent_id=<cfqueryparam attributeCollection=#id#/>
</cfquery>
</m:silent><!---
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
---><layout:page section="header" pageInfo=#pageInfo#>
<layout:attribute name="title">
<cfoutput>
Контрагент
<cfif d.contragent_id GT 0>
<b>#d.contragent#</b>
[#d.contragent_id#]
</cfif>
</cfoutput>
</layout:attribute>
</layout:page>
<!--- <cfif status.errorState GT 0>
<cfoutput><div class="err">#status.errorMessage#</div></cfoutput>
</cfif>
--->
<cfoutput>
<input type="hidden" name="contragent_id" value="#d.contragent_id#"/>
<input type="hidden" name="track" value="#tr.self#"/>
<input type="hidden" name="pass" value=""/><!--- pass marker to prevent save on submit --->
<div class="detail">
<div class="tr">
<div class="th">ID</div>
<div class="td">
#d.contragent_id#
</div>
</div>
<div class="tr">
<div class="th">Наименование</div>
<div class="td">
<input type="text" name="contragent" value="#d.contragent#" size="70"/>
</div>
</div>
<div class="tr">
<div class="th">Провайдер</div>
<div class="td">
<input type="checkbox" name="is_provider" value="1"<cfif d.is_provider GT 0> checked</cfif>/>
</div>
</div>
<div class="tr">
<div class="th">Внешний UID</div>
<div class="td">
<input type="text" name="external_uid" value="#d.external_uid#" size="70"/><i>Company UID из Элмы</i>
</div>
</div>
<div class="tr">
<div class="th">WZ</div>
<div class="td">
<input type="text" name="external_code" value="#d.external_code#" size="7"/><i></i>
</div>
</div>
<div class="tr">
<div class="th">Описание</div>
<div class="td">
<textarea name="descr" rows="10" cols="100">#request.htm2plain(d.descr)#</textarea>
</div>
</div>
<div class="tr">
<div class="th">Создано</div>
<div class="td">
#dateFormat(d.dt_created,'YYYY-MM-DD')# #timeFormat(d.dt_created,'HH:MM')#
#qDecoration.creator# <cfif len(qDecoration.creator_shortname)>(#qDecoration.creator_shortname#)</cfif>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Изменено
#dateFormat(d.dt_updated,'YYYY-MM-DD')# #timeFormat(d.dt_updated,'HH:MM')#
#qDecoration.updater# <cfif len(qDecoration.updater_shortname)>(#qDecoration.updater_shortname#)</cfif>
</div>
</div>
</div>
</cfoutput>
<layout:page section="extension" closeForm="Yes"/>
<cfif d.contragent_id GT 0>
<cfquery name="qContract">
select
d.contract_id
,d.contract
,d.dt_contract
,(select count(*) from specification s where s.contract_id=d.contract_id) as spec_cnt
,(select count(distinct resource_realm_id) from resource_realm_access a where a.contract_id=d.contract_id) as res_realm_cnt
from contract d
where d.contragent_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.contragent_id#"/>
order by 1
</cfquery>
<cfoutput>
<h4>Договоры (#qContract.recordCount#)</h4>
</cfoutput>
<table class="worktable">
<thead>
<tr>
<th><c:link_add canWrite=#pageInfo.writePermitted()# entity="contract" id="#contragent_id#" extra="contragent_id=#d.contragent_id#" fwx=#tr.fwx#/></th>
<th>Номер договора</th>
<th>Дата договора</th>
<th>Спецификаций</th>
<th>Ресурсных платформ</th>
<th></th>
</tr>
</thead>
<cfoutput query="qContract">
<tr>
<td>
<c:link_view_edit canWrite=#pageInfo.writePermitted()# entity="contract" id=#contract_id# fwx=#tr.fwx#/>
</td>
<td>#contract#</td>
<td class="c">
#dateFormat(dt_contract,'YYYY-MM-DD')#
</td>
<td class="c">
<cfif spec_cnt GT 0>#spec_cnt#</cfif>
</td>
<td class="c">
<cfif res_realm_cnt GT 0>#res_realm_cnt#</cfif>
</td>
<td class="c">
<c:link_del canWrite=#pageInfo.writePermitted()# entity="contract" id=#contract_id# fwx=#tr.fwx#/>
</td>
</tr>
</cfoutput>
</table>
</cfif>
<i>Доступ к ресурсным платформам предоставляется на уровне договора</i>
<cfif d.contragent_id GT 0>
<cfquery name="qUsr">
select
u.usr_id
,u.login
,u.firstname
,u.lastname
,u.middlename
,u.email
,u.idp_usr_uid
from usr u
where u.contragent_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.contragent_id#"/>
order by 1
</cfquery>
<cfoutput>
<h4>Пользователи (#qContract.recordCount#)</h4>
</cfoutput>
<table class="worktable">
<thead>
<tr>
<th></th>
<th>Логин</th>
<th>Ф.И.О.</th>
<th>e-mail</th>
<th>IDP user UID</th>
<th></th>
</tr>
</thead>
<cfoutput query="qUsr">
<tr>
<td>
<c:link_view_edit canWrite=#pageInfo.writePermitted()# entity="usr" id=#usr_id# fwx=#tr.fwx#/>
</td>
<td>#login#</td>
<td>#lastname# #firstname# #middlename#</td>
<td>#email#</td>
<td>#idp_usr_uid#</td>
<td class="c">
<c:link_del canWrite=#pageInfo.writePermitted()# entity="usr" id=#usr_id# fwx=#tr.fwx#/>
</td>
</tr>
</cfoutput>
</table>
</cfif>
<layout:page section="footer"/>