273 lines
13 KiB
Plaintext
273 lines
13 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="specification_item_version" key="specification_item_uid" pageInfoOut="pageInfo"/>
|
||
<!--- так... а у нас ключ составной --->
|
||
|
||
<d:bean readonly=#!pageInfo.writePermitted()# table="#pageInfo.entity#" datasource="#request.DS#" output="d" status="status">
|
||
<d:param field="specification_item_uid" type="guid" key/>
|
||
<d:param field="agreement_version" type="integer" key/>
|
||
|
||
<d:param field="specification_item_version" type="varchar" size="1023" preprocessor=#cleanInput#/>
|
||
<d:param field="quantity" type="numeric" init="1"/>
|
||
<d:param field="price" type="numeric" init="0"/>
|
||
<d:param field="dt_from" type="timestamp" format="yyyy-MM-dd" forNull="" init="#dateFormat(Now(),'YYYY-MM-DD')#"/> <!--- !!! Important yyyy-MM-dd NOT YYYY-MM-DD --->
|
||
<d:param field="dt_to" type="timestamp" format="yyyy-MM-dd" forNull="" init=""/> <!--- !!! Important yyyy-MM-dd NOT YYYY-MM-DD --->
|
||
|
||
<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=""
|
||
queryString="#request.thisPage#?specification_item_uid=#d.specification_item_uid#&agreement_version=#d.agreement_version#"
|
||
defaultBackUrl="specification_item.cfm?specification_item_uid=#d.specification_item_uid#"
|
||
status=#pageInfo.status#
|
||
trackOut="tr"
|
||
idAttributesOut="id"
|
||
/>
|
||
|
||
<!--- контекст строки всегда известен при создании версии, полный ключ не нужен для него - соответственно, джойн с основной таблицей. При этом мы собираем неверсионную часть данных, а версионная образует параллельную ветку --->
|
||
<!--- можно обратить внимание на то, что это один джойн, который растет сверху вниз (возможно, ветвится), добавляются таблицы и поля. На самом деле джойны внешние только для удобства отладки - так ошибки виднее --->
|
||
<cfquery name="qSpecificationItem" datasource="#request.DS#">
|
||
select i.svc_id, v.svc
|
||
,s.specification_id, s.specification, s.contract_id
|
||
,d.contract, d.dt_contract, d.contragent_id
|
||
,k.contragent
|
||
from specification_item i
|
||
left join specification s on (i.specification_id=s.specification_id)
|
||
left join contract d on (s.contract_id=d.contract_id)
|
||
left join contragent k on (d.contragent_id=k.contragent_id)
|
||
left join svc v on (i.svc_id=v.svc_id)
|
||
where i.specification_item_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#d.specification_item_uid#" null=#!IsValid('guid',d.specification_item_uid)#/>
|
||
</cfquery>
|
||
|
||
|
||
|
||
<!--- <cfquery name="qCost" datasource="#request.DS#">
|
||
select sum(sip.price*sip.quantity) as cost
|
||
from specification_item_version_param sip
|
||
where sip.specification_item_version_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.specification_item_version_id#" null=#!isNumeric(d.specification_item_version_id)#/>
|
||
</cfquery> --->
|
||
|
||
|
||
<!--- <cfquery name="qSpecificationItemParam" datasource="#request.DS#">
|
||
select
|
||
sip.specification_item_version_param_id
|
||
,sp.service_param_id
|
||
,sp.param_id
|
||
,sip.price
|
||
,sip.quantity
|
||
,p.param_id
|
||
,p.param
|
||
,p.param_short
|
||
,p.code
|
||
,p.precision
|
||
,c.param_class
|
||
,m.measure_short
|
||
,spp.min_price
|
||
from service_param sp
|
||
left outer join specification_item_version_param sip
|
||
on (sp.service_param_id=sip.service_param_id AND sip.specification_item_version_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.specification_item_version_id#"/>)
|
||
left outer join param p on (sp.param_id=p.param_id)
|
||
left outer join abstract_service_param_class ac on (sp.abstract_service_param_class_id=ac.abstract_service_param_class_id)
|
||
left outer join param_class c on (ac.param_class_id=c.param_class_id)
|
||
left outer join measure m on (c.measure_id=m.measure_id)
|
||
left outer join service_param_price spp on
|
||
(sp.service_param_id=spp.service_param_id) /***из-за полиморфизма тут надо сложнее*/
|
||
where sp.service_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.service_id#"/>
|
||
order by c.param_class, p.param
|
||
</cfquery> --->
|
||
<!--- Здесь выборка строится от шаблона, и на него уже накручиваются реквизиты экземпляра --->
|
||
<!--- <cfdump var=#qSpecificationItemParam#/> --->
|
||
<!--- 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 specification_item_version e
|
||
left outer join usr a on (e.creator_id=a.usr_id)
|
||
left outer join usr m on (e.updater_id=m.usr_id)
|
||
where e.specification_item_uid=<cfqueryparam cfsqltype="cf_sql_other" value=#d.specification_item_uid# null=#!isValid('guid',d.specification_item_uid)#/>
|
||
AND e.agreement_version=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.agreement_version#" null=#!isValid('integer',d.agreement_version)#/>
|
||
</cfquery>
|
||
|
||
</m:silent><!---
|
||
------------------------------------------------------------------------------------------------------------------------
|
||
------------------------------------------------------------------------------------------------------------------------
|
||
------------------------------------------------------------------------------------------------------------------------
|
||
------------------------------------------------------------------------------------------------------------------------
|
||
------------------------------------------------------------------------------------------------------------------------
|
||
---><layout:page section="header" pageInfo=#pageInfo#>
|
||
<layout:attribute name="title">
|
||
<cfoutput>
|
||
Версия строки спецификации
|
||
[#d.specification_item_uid#]:[#d.agreement_version#]
|
||
</cfoutput>
|
||
</layout:attribute>
|
||
</layout:page>
|
||
|
||
<cfif status.errorState GT 0>
|
||
<cfoutput><div class="err">#status.errorMessage#</div></cfoutput>
|
||
</cfif>
|
||
|
||
<cfoutput>
|
||
<input type="hidden" name="specification_item_uid" value="#d.specification_item_uid#"/>
|
||
<!--- <input type="hidden" name="agreement_version" value="#d.agreement_version#"/> --->
|
||
<input type="hidden" name="track" value="#tr.self#"/>
|
||
<input type="hidden" name="pass" value=""/><!--- pass marker to prevent save on submit --->
|
||
|
||
<div class="detail">
|
||
|
||
<layout:detail_line title="Спецификация">
|
||
<a href="specification.cfm?specification_id=#qSpecificationItem.specification_id#&#tr.fwx#">#qSpecificationItem.specification#[#qSpecificationItem.specification_id#]</a>
|
||
<a href="contract.cfm?contract_id=#qSpecificationItem.contract_id#&#tr.fwx#">#qSpecificationItem.contract# #dateFormat(qSpecificationItem.dt_contract,'DD.MM.YYYY')#</a>
|
||
<a href="contragent.cfm?contragent_id=#qSpecificationItem.contragent_id#&#tr.fwx#">#qSpecificationItem.contragent# </a>
|
||
</layout:detail_line>
|
||
|
||
<layout:detail_line title="Услуга">
|
||
<a href="svc.cfm?svc_id=#qSpecificationItem.svc_id#&#tr.fwx#">[#d.specification_item_uid#] #qSpecificationItem.svc#</a>
|
||
</layout:detail_line>
|
||
|
||
<!--- <layout:detail_line title="Версия">#d.agreement_version# (версия-номер соглашения)</layout:detail_line> --->
|
||
<layout:detail_line title="Версия">
|
||
<cfquery name="qList" datasource="#request.DS#">
|
||
select a.agreement_version, a.agreement, a.dt_agreement
|
||
from agreement a
|
||
where a.contract_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#qSpecificationItem.contract_id#" null=#!isValid('integer',qSpecificationItem.contract_id)#/>
|
||
order by 1
|
||
</cfquery>
|
||
<c:combo
|
||
query=#qList#
|
||
combo="agreement_version"
|
||
id="agreement_version"
|
||
key="agreement_version"
|
||
selected="#d.agreement_version#"
|
||
displayf="##agreement## [##agreement_version##] ##dateFormat(dt_agreement,'DD.MM.YYYY')##"
|
||
class=""
|
||
/>
|
||
(версия-номер соглашения)
|
||
</layout:detail_line>
|
||
|
||
<layout:detail_line title="Имя для печати">
|
||
<textarea name="specification_item_version" id="specification_item_version" rows="2" cols="90" style="width:99%;"/><cfif len(d.specification_item_version)>#d.specification_item_version#<cfelse>#qSpecificationItem.svc#</cfif></textarea>
|
||
<!--- <button type="button" onclick="document.getElementById('specification_item_version').value='';submit();">Сформировать</button> --->
|
||
</layout:detail_line>
|
||
|
||
<layout:detail_line title="Дата с">
|
||
<input type="date" name="dt_from" id="dt_from" value="#dateFormat(d.dt_from,"YYYY-MM-DD")#"/>
|
||
<button type="button" onclick="document.getElementById('dt_from').value='#DateFormat(Now(), 'YYYY-MM-DD')#';">Сегодня</button>
|
||
</layout:detail_line>
|
||
|
||
<layout:detail_line title="Дата по">
|
||
<input type="date" name="dt_to" id="dt_to" value="#dateFormat(d.dt_to,"YYYY-MM-DD")#"/>
|
||
<button type="button" onclick="document.getElementById('dt_to').value='#DateFormat(Now(), 'YYYY-MM-DD')#';">Сегодня</button>
|
||
</layout:detail_line>
|
||
|
||
<layout:detail_line title="Количество">
|
||
<input type="text" name="quantity" value="#d.quantity#" size="5" class="r"/><!---*** Халява с точностью ---><!--- <cftry>#round(d.quantity,qService.precision)#<cfcatch type="ANY"></cfcatch></cftry> --->
|
||
</layout:detail_line>
|
||
|
||
<layout:detail_line title="Цена">
|
||
<input type="text" name="price" id="price" value="#d.price#" size="10" class="r"/>
|
||
</layout:detail_line>
|
||
|
||
<layout:detail_line title="Создано">
|
||
#dateFormat(d.dt_created,'DD.MM.YYYY')# #timeFormat(d.dt_created,'HH:MM')#
|
||
#qDecoration.creator# <cfif len(qDecoration.creator_shortname)>(#qDecoration.creator_shortname#)</cfif>
|
||
|
||
Изменено
|
||
#dateFormat(d.dt_updated,'DD.MM.YYYY')# #timeFormat(d.dt_updated,'HH:MM')#
|
||
#qDecoration.updater# <cfif len(qDecoration.updater_shortname)>(#qDecoration.updater_shortname#)</cfif>
|
||
</layout:detail_line>
|
||
|
||
</div>
|
||
|
||
</cfoutput>
|
||
|
||
<layout:page section="extension" closeForm="Yes"/>
|
||
|
||
<cfif len(d.specification_item_uid) AND d.agreement_version GT 0>
|
||
<!--- <cfoutput>
|
||
<p>
|
||
Компоненты (#qSpecificationItemParam.recordCount#)
|
||
<!---<cfif pageInfo.writePermitted()>
|
||
<cfoutput>
|
||
<cfset addUrl="specification_item_version_param.cfm?specification_item_version_param=-1&specification_item_version_id=#d.specification_item_version_id#&#tr.fwx#"/>
|
||
<button type="button" class="maincontrol" onclick="document.location.href='#addUrl#'">
|
||
<a href="#addUrl#">Создать</a>
|
||
</button>
|
||
</cfoutput>
|
||
</cfif>--->
|
||
</p>
|
||
</cfoutput>
|
||
<table class="worktable">
|
||
<thead>
|
||
<tr>
|
||
<th></th>
|
||
<th>Вариант компонента</th>
|
||
<th>Код</th>
|
||
<th>Количество</th>
|
||
<th>Ед.изм.</th>
|
||
<th>Базовая цена</th>
|
||
<th>Цена</th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<cfoutput query="qSpecificationItemParam">
|
||
<tr>
|
||
<td>
|
||
<cfif specification_item_version_param_id GT 0>
|
||
<a href="specification_item_version_param.cfm?specification_item_version_param_id=#specification_item_version_param_id#&#tr.fwx#">
|
||
<img src="img/edit.gif"/>
|
||
</a>
|
||
</cfif>
|
||
<!--- <cfif NOT (specification_item_version_param_id GT 0)> --->
|
||
<a href="specification_item_version_param.cfm?service_param_id=#service_param_id#&specification_item_version_id=#d.specification_item_version_id#&#tr.fwx#">
|
||
<img src="img/add.gif"/>
|
||
</a>
|
||
</td>
|
||
<td>
|
||
<a href="service_param.cfm?service_param_id=#service_param_id#&#tr.fwx#">
|
||
#param_class# #param#
|
||
</a>
|
||
</td>
|
||
<td>#qService.abstract_service_code#.#qService.modifier_code#.#code#</td>
|
||
<td class="r"><!--- *** Халява --->
|
||
<cftry>#round(quantity,precision)#<cfcatch type="ANY"></cfcatch></cftry>
|
||
</td>
|
||
<td>#measure_short#</td>
|
||
<td class="r">#min_price#</td>
|
||
<td class="r">#price#</td>
|
||
<td class="c">
|
||
<cfif specification_item_version_param_id GT 0>
|
||
<c:link_del canWrite=#pageInfo.writePermitted()# entity="specification_item_version_param" id=#specification_item_version_param_id# fwx=#tr.fwx#/>
|
||
</cfif>
|
||
</td>
|
||
</tr>
|
||
</cfoutput>
|
||
</table> --->
|
||
|
||
</cfif>
|
||
Здесь могли бы быть компоненты (но мы их пока не запилили)
|
||
|
||
|
||
<layout:page section="footer"/>
|