256 lines
9.5 KiB
Plaintext
256 lines
9.5 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">
|
||
|
||
<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="contract" accessObject="" key="contract_id" pageInfoOut="pageInfo"/>
|
||
|
||
<d:bean readonly=#!pageInfo.writePermitted()# table="contract" datasource="#request.DS#" output="d" status="pageInfo.status">
|
||
<d:param field="contract_id" type="integer" key autoincrement/>
|
||
<d:param field="contragent_id" type="integer"/>
|
||
<d:param field="contract" type="varchar" size="255" preprocessor=#cleanInput#/>
|
||
<d:param field="dt_contract" type="timestamp" format="yyyy-MM-dd" preprocessor=#cleanInput# forNull="" init="#Now()#"/><!--- !!! Important yyyy-MM-dd NOT YYYY-MM-DD --->
|
||
<d:param field="descr" type="varchar" preprocessor=#plain2HtmClean#/>
|
||
|
||
<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.contract_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 contract 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.contract_id=<cfqueryparam attributeCollection=#id#/>
|
||
</cfquery>
|
||
|
||
|
||
</m:silent><!---
|
||
------------------------------------------------------------------------------------------------------------------------
|
||
------------------------------------------------------------------------------------------------------------------------
|
||
------------------------------------------------------------------------------------------------------------------------
|
||
------------------------------------------------------------------------------------------------------------------------
|
||
------------------------------------------------------------------------------------------------------------------------
|
||
---><layout:page section="header" pageInfo=#pageInfo#>
|
||
<layout:attribute name="title">
|
||
<cfoutput>
|
||
Договор
|
||
<cfif d.contract_id GT 0>
|
||
<b>#d.contract#</b>
|
||
[#d.contract_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="contract_id" value="#d.contract_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.contract_id#
|
||
</div>
|
||
</div>
|
||
|
||
<div class="tr">
|
||
<div class="th">Номер договора</div>
|
||
<div class="td">
|
||
<input type="text" name="contract" value="#d.contract#" size="70"/>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="tr">
|
||
<div class="th">Дата договора</div>
|
||
<div class="td">
|
||
<input type="date" name="dt_contract" id="dt_contract" value="#dateFormat(d.dt_contract,"YYYY-MM-DD")#"/>
|
||
<button type="button" onclick="document.getElementById('dt_contract').value='#DateFormat(Now(), 'YYYY-MM-DD')#';">Сегодня</button>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="tr">
|
||
<div class="th">Контрагент</div>
|
||
<div class="td">
|
||
<cfquery name="qList">
|
||
select c.contragent_id, c.contragent
|
||
from contragent c
|
||
order by 2
|
||
</cfquery>
|
||
<c:combo
|
||
query=#qList#
|
||
combo="contragent_id" id="contragent_id" key="contragent_id"
|
||
selected="#d.contragent_id#"
|
||
displayf="##contragent##"
|
||
class=""
|
||
/>
|
||
</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>
|
||
|
||
Изменено
|
||
#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="No"/>
|
||
|
||
<cfif d.contract_id GT 0>
|
||
|
||
<cfquery name="qAgreement">
|
||
select
|
||
a.contract_id
|
||
,a.agreement_version
|
||
,a.agreement
|
||
,a.dt_agreement
|
||
,a.is_actual
|
||
from agreement a
|
||
where a.contract_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.contract_id#" null=#!isValid('integer', d.contract_id)#/>
|
||
order by 1
|
||
</cfquery>
|
||
|
||
<cfoutput>
|
||
<h4>Соглашения (#qAgreement.recordCount#)</h4>
|
||
</cfoutput>
|
||
<cfif pageInfo.writePermitted()>
|
||
<cfoutput>
|
||
<cfset addUrl="agreement.cfm?contract_id=#d.contract_id#&#tr.fwx#"/>
|
||
<button type="button" class="maincontrol" onclick="document.location.href='#addUrl#'">
|
||
<a href="#addUrl#">Создать</a>
|
||
</button>
|
||
Соглашение - это пакет изменений спецификации. Базовое соглашение соответствует исходной спецификации договора (переход от несуществующей спецификации). Остальные - дополнительным соглашениям.
|
||
Создание базового соглашения надо автоматизировать, но пока вручную.
|
||
</cfoutput>
|
||
</cfif>
|
||
|
||
<table class="worktable">
|
||
<thead>
|
||
<tr>
|
||
<th></th>
|
||
<th>Номер соглашения (версия)</th>
|
||
<th>Название</th>
|
||
<th>Дата</th>
|
||
<th>Действует</th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<cfoutput query="qAgreement">
|
||
<tr>
|
||
<td>
|
||
<a href="agreement.cfm?contract_id=#contract_id#&agreement_version=#agreement_version#&#tr.fwx#"><img src="img/edit.gif"/></a>
|
||
</td>
|
||
<td class="r">#agreement_version#</td>
|
||
<td>#agreement#</td>
|
||
<td>#dateFormat(dt_agreement,'DD.MM.YYYY')#</td>
|
||
<td class="c"><cfif is_actual GT 0><img src="img/ok.png"/></cfif></td>
|
||
<td class="c">
|
||
<a href="agreement_del.cfm?contract_id=#contract_id#&agreement_version=#agreement_version#&#tr.fwx#"><img src="img/del.gif"/></a>
|
||
</td>
|
||
</tr>
|
||
</cfoutput>
|
||
</table>
|
||
любопытное последствие использования составного ключа: отпадает желание делать для сущности самостоятельный реестр (может быть, только если есть явная сущность-владелец, как договор для соглашения). Это аналогично отразится на структуре ReST API URL, если вдруг
|
||
|
||
<!--- ---------------------------------------------------- --->
|
||
<!--- ---------------------------------------------------- --->
|
||
<!--- ---------------------------------------------------- --->
|
||
|
||
<cfquery name="qSpecification">
|
||
select
|
||
s.specification_id
|
||
,s.specification
|
||
,s.descr
|
||
,(select count(*) from specification_item i where i.specification_id=s.specification_id) as item_cnt
|
||
/*,(select count(*) from specification_version v where v.specification_id=s.specification_id) as version_cnt*/
|
||
from specification s
|
||
where s.contract_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.contract_id#"/>
|
||
order by 1
|
||
</cfquery>
|
||
|
||
<cfoutput>
|
||
<h4>Спецификации (#qSpecification.recordCount#)</h4>
|
||
</cfoutput>
|
||
<cfif pageInfo.writePermitted()>
|
||
<cfoutput>
|
||
<cfset addUrl="specification.cfm?specification_id=-1&contract_id=#d.contract_id#&#tr.fwx#"/>
|
||
<button type="button" class="maincontrol" onclick="document.location.href='#addUrl#'">
|
||
<a href="#addUrl#">Создать</a>
|
||
</button>
|
||
</cfoutput>
|
||
</cfif>
|
||
Как правило, в договоре 1 спецификация, а ее версии определяются дополнительными соглашениями
|
||
<table class="worktable">
|
||
<thead>
|
||
<tr>
|
||
<th></th>
|
||
<th>Номер спецификации</th>
|
||
<th>Строк</th>
|
||
<th>Описание</th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<cfoutput query="qSpecification">
|
||
<tr>
|
||
<td>
|
||
<c:link_view_edit canWrite=#pageInfo.writePermitted()# entity="specification" id=#specification_id# fwx=#tr.fwx#/>
|
||
</td>
|
||
<td>#specification#</td>
|
||
<td class="c">
|
||
<cfif item_cnt GT 0>#item_cnt#</cfif>
|
||
</td>
|
||
<td>#descr#</td>
|
||
<td class="c">
|
||
<c:link_del canWrite=#pageInfo.writePermitted()# entity="specification" id=#specification_id# fwx=#tr.fwx#/>
|
||
</td>
|
||
</tr>
|
||
</cfoutput>
|
||
</table>
|
||
</cfif>
|
||
|
||
<layout:page section="extension" closeForm="Yes"/> <!--- *** правильно так? --->
|
||
<layout:page section="footer"/> |