initial draft

This commit is contained in:
msyu
2025-06-02 16:16:51 +03:00
commit 529334d03b
272 changed files with 22684 additions and 0 deletions
+292
View File
@@ -0,0 +1,292 @@
<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" 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 autoincrement/>
<d:param field="specification_id" type="integer" required/>
<d:param field="svc_id" type="integer" required/>
<!--- <d:param field="specification_item" type="varchar" size="1023" preprocessor=#cleanInput#/> можно было оставить здесь --->
<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.specification_item_uid#"
status=#pageInfo.status#
trackOut="tr"
idAttributesOut="id"
/>
<cfquery name="qSpecification" datasource="#request.DS#">
select s.specification_id, s.specification
from specification s
where s.specification_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.specification_id#" null=#!isNumeric(d.specification_id)#/>
</cfquery>
<cfquery name="qSvc" datasource="#request.DS#">
select s.svc, s.code, s.measure_id
from svc s
where s.svc_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.svc_id#" null=#!isNumeric(d.svc_id)#/>
</cfquery>
<!--- <cfquery name="qCost" datasource="#request.DS#">
select sum(sip.price*sip.quantity) as cost
from specification_item_param sip
where sip.specification_item_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.specification_item_id#" null=#!isNumeric(d.specification_item_id)#/>
</cfquery> --->
<!--- <cfquery name="qSpecificationItemParam" datasource="#request.DS#">
select
sip.specification_item_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_param sip
on (sp.service_param_id=sip.service_param_id AND sip.specification_item_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.specification_item_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 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)#/>
</cfquery>
</m:silent><!---
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
---><layout:page section="header" pageInfo=#pageInfo#>
<layout:attribute name="title">
<cfoutput>
Строка спецификации (экземпляр услуги)
<cfif len(d.specification_item_uid)>
[#d.specification_item_uid#]
</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="specification_item_uid" value="#d.specification_item_uid#"/>
<input type="hidden" name="specification_id" value="#d.specification_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">Спецификация (номер)</div>
<div class="td">
<a href="specification.cfm?specification_id=#d.specification_id#&#tr.fwx#">#qSpecification.specification#</a>
</div>
</div>
<div class="tr">
<div class="th">Услуга</div>
<div class="td">
<cfquery name="qList" datasource="#request.DS#">
select s.svc_id, s.code
from svc s
order by 2
</cfquery>
<c:combo
query=#qList#
combo="svc_id"
id="svc_id"
key="svc_id"
selected="#d.svc_id#"
displayf="##code## ##svc##
empty=""
class=""
onchange="submit();"
/>
<cfif d.service_id GT 0>
<c:link_view_edit canWrite=#pageInfo.writePermitted()# entity="svc" id=#d.svc_id# fwx=#tr.fwx#/>
</cfif>
</div>
</div>
<!--- <div class="tr">
<div class="th">Имя для печати</div>
<div class="td">
<cfset m_specification_item=#d.specification_item#/>
<cfif len(m_specification_item) EQ 0 AND d.service_id GT 0>
<cfif len(qService.modifier)>
<cfset m_specification_item="#qService.abstract_service# - #qService.modifier#."/>
<cfelse>
<cfset m_specification_item="#qService.abstract_service#."/>
</cfif>
<cfloop query="qSpecificationItemParam">
<cfif qSpecificationItemParam.quantity GT 0>
<!--- <cfif len(qSpecificationItemParam.param_class)>
<cfset m_param_name="#qSpecificationItemParam.param_class#/#qSpecificationItemParam.param#"/>
<cfelse>
<cfset m_param_name="#qSpecificationItemParam.param#"/>
</cfif> --->
<cfset m_param_name="#qSpecificationItemParam.param_short#"/>
<cfset m_specification_item="#m_specification_item# #m_param_name# #qSpecificationItemParam.quantity# #qSpecificationItemParam.measure_short#;"/>
</cfif>
</cfloop>
</cfif>
<textarea name="specification_item" id="specification_item" rows="3" cols="90" style="width:99%;"/>#m_specification_item#</textarea>
<button type="button" onclick="document.getElementById('specification_item').value='';submit();">Сформировать</button>
</div>
</div> --->
<div class="tr">
<div class="th">Количество</div>
<div class="td">
<input type="text" name="quantity" value="#request.roundSafe(d.quantity,qService.precision)#" size="5" class="r"/><!---*** Халява с точностью ---><!--- <cftry>#round(d.quantity,qService.precision)#<cfcatch type="ANY"></cfcatch></cftry> --->
</div>
</div>
<div class="tr">
<div class="th">Стоимость</div>
<div class="td">
<input type="text" name="price" id="price" value="#d.price#" size="15" class="r"/>
<i>подставить сумму по позициям: </i>
<b><a onclick="document.getElementById('price').value='#qCost.cost#';return false;" style="cursor:pointer;">#qCost.cost#</a></b>
</div>
</div>
<div class="tr">
<div class="th">Создано</div>
<div class="td">
#dateFormat(d.dt_created,'DD.MM.YYYY')# #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,'DD.MM.YYYY')# #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.specification_item_id GT 0>
<cfoutput>
<p>
Компоненты (#qSpecificationItemParam.recordCount#)
<!---<cfif pageInfo.writePermitted()>
<cfoutput>
<cfset addUrl="specification_item_param.cfm?specification_item_param=-1&specification_item_id=#d.specification_item_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_param_id GT 0>
<a href="specification_item_param.cfm?specification_item_param_id=#specification_item_param_id#&#tr.fwx#">
<img src="img/edit.gif"/>
</a>
</cfif>
<!--- <cfif NOT (specification_item_param_id GT 0)> --->
<a href="specification_item_param.cfm?service_param_id=#service_param_id#&specification_item_id=#d.specification_item_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_param_id GT 0>
<c:link_del canWrite=#pageInfo.writePermitted()# entity="specification_item_param" id=#specification_item_param_id# fwx=#tr.fwx#/>
</cfif>
</td>
</tr>
</cfoutput>
</table>
</cfif>
*** Можно переделать на прямой ввод в форму. Можно однородные позиции выбирать из списка, но тогда вариант выбрать 2 разных интерфейсно непонятно как реализовывать.
поскольку спека только для демонстрации, может этого и не делать?
Цену базовую показать
<layout:page section="footer"/>