intermediate draft 5
This commit is contained in:
parent
e15f690012
commit
38b621bc44
@ -111,7 +111,7 @@
|
||||
<div class="tr">
|
||||
<div class="th">Номер версии</div>
|
||||
<div class="td">
|
||||
#d.agreement_version# (некорректно, в одном месте версией называется номер, а в другом сущность, и это отразилось в именовании таблиц и полей)
|
||||
#d.agreement_version# (некорректный нейминг, в одном месте версией называется номер, а в другом сущность, и это отразилось в именовании таблиц и полей)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -215,6 +215,9 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Спецификация</th>
|
||||
<th>Договор</th>
|
||||
<th>Контрагент</th>
|
||||
<th>Стабильный ключ строки</th>
|
||||
<th>Услуга</th>
|
||||
<th>Код услуги</th>
|
||||
@ -222,10 +225,7 @@
|
||||
<th>Дата с</th>
|
||||
<th>Дата по</th>
|
||||
<th>Кол-во</th>
|
||||
<th>Цена</th>
|
||||
<th>Спецификация</th>
|
||||
<th>Договор</th>
|
||||
<th>Контрагент</th>
|
||||
<th>Цена</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -234,17 +234,23 @@
|
||||
<td>
|
||||
<a href="specification_item_version.cfm?specification_item_uid=#specification_item_uid#&agreement_version=#agreement_version#&#tr.fwx#" class=<cfif pageInfo.writePermitted()>"edit"<cfelse>"view"</cfif>></a>
|
||||
</td>
|
||||
<td>#specification_item_uid#</td>
|
||||
<td>#svc#</td>
|
||||
<td>
|
||||
<a href="specification.cfm?specification_id=#specification_id#&#tr.fwx#">#specification#</a>
|
||||
</td>
|
||||
<td>#contract# #dateFormat(dt_contract,'DD.MM.YYYY')#</td>
|
||||
<td>#contragent#</td>
|
||||
<td>
|
||||
<a href="specification_item.cfm?specification_item_uid=#specification_item_uid#&#tr.fwx#">#specification_item_uid#</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="svc.cfm?svc_id=#svc_id#&#tr.fwx#">#svc#</a>
|
||||
</td>
|
||||
<td>#code#</td>
|
||||
<td>#specification_item_version#</td>
|
||||
<td>#dateFormat(dt_from,'DD.MM.YYYY')#</td>
|
||||
<td>#dateFormat(dt_to,'DD.MM.YYYY')#</td>
|
||||
<td>#quantity#</td>
|
||||
<td>#price#</td>
|
||||
<td><a href="specification.cfm?specification_id=#specification_id#&#tr.fwx#">#specification#</a></td>
|
||||
<td>#contract# #dateFormat(dt_contract,'DD.MM.YYYY')#</td>
|
||||
<td>#contragent#</td>
|
||||
<td>#price#</td>
|
||||
<td class="c">
|
||||
<cfif pageInfo.writePermitted()>
|
||||
<a href="specification_item_version_del.cfm?specification_item_uid=#specification_item_uid#&agreement_version=#agreement_version#&#tr.fwx#" class="del"></a>
|
||||
|
@ -104,6 +104,7 @@ insert into specification (specification,contract_id) values ('first spec',1);
|
||||
-- ìîæåò, îíà íå î÷åíü-òî è íóæíà, ó íåå ïîëåé-òî òîëüêî îïèñàíèå, à îíî íå î÷åíü íóæíî, à êëþ÷ ñîñòàâíîé è ðàñïðîñòðàíÿåòñÿ äàëüøå
|
||||
-- è ïðàâäà, îíà ïðîñòî íå èñïîëüçóåòñÿ
|
||||
drop table if exists specification_version CASCADE;
|
||||
/*
|
||||
create table specification_version (
|
||||
specification_id int
|
||||
,agreement_version int NOT NULL -- FK agreement
|
||||
@ -116,6 +117,7 @@ create table specification_version (
|
||||
,CONSTRAINT PK_specification_version PRIMARY KEY (specification_id, agreement_version)
|
||||
);
|
||||
ALTER TABLE specification_version OWNER TO dbo;
|
||||
*/
|
||||
|
||||
-- ñòðîêà ñïåöèôèêàöèè
|
||||
drop table if exists specification_item CASCADE;
|
||||
|
@ -6,13 +6,13 @@
|
||||
|
||||
<cfparam name="ATTRIBUTES.entity" type="string"/>
|
||||
<cfparam name="ATTRIBUTES.accessObject" type="string" default=#ATTRIBUTES.entity#/>
|
||||
<cfparam name="ATTRIBUTES.key" type="string" default="#ATTRIBUTES.entity#_id"/>
|
||||
<cfparam name="ATTRIBUTES.key" type="string" default="#ATTRIBUTES.entity#_id"/><!--- для составных ключей рекомендуется "undefined" *** можно сделать листом, и дальше конструировать, как ни в чем не бывало --->
|
||||
<cfparam name="ATTRIBUTES.pageInfoOut" type="string"/>
|
||||
<cfparam name="ATTRIBUTES.formEncType" type="string" default=""/>
|
||||
<cfparam name="ATTRIBUTES.trackOut" type="string" default="tr"/>
|
||||
|
||||
<cfparam name="ATTRIBUTES.defaultBackUrl" default="#ATTRIBUTES.entity#_ls.cfm"/>
|
||||
<cfparam name="ATTRIBUTES.thisUrl" default=""/>
|
||||
<cfparam name="ATTRIBUTES.defaultBackUrl" default="#ATTRIBUTES.entity#_ls.cfm"/><!--- для зависимых сущностей передавать обязательно --->
|
||||
<cfparam name="ATTRIBUTES.thisUrl" default=""/><!--- для составных ключей передавать обязательно *** выбрасывать исключение --->
|
||||
<!--- заново конструируем Url текущей страницы, без трека --->
|
||||
<cfif len(ATTRIBUTES.thisUrl) EQ 0><!--- наугад используем типовое соглашение--->
|
||||
<cfparam name="#ATTRIBUTES.key#" default="-1"/>
|
||||
|
671
service.cfm
671
service.cfm
@ -1,671 +0,0 @@
|
||||
<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="service" key="service_id" pageInfoOut="pageInfo"/>
|
||||
|
||||
<cfif structKeyExists(form,"vat_free")>
|
||||
<cfset form.vat_perc=""/><!--- *** выглядит некрасиво - модифицировать форму --->
|
||||
<!--- <cfdump var=#form#/> --->
|
||||
</cfif>
|
||||
|
||||
<d:bean readonly=#!pageInfo.writePermitted()# table="#pageInfo.entity#" datasource="#request.DS#" output="d" status="status">
|
||||
<d:param field="service_id" type="integer" key autoincrement/>
|
||||
<d:param field="abstract_service_id" type="integer"/>
|
||||
<d:param field="modifier_id" type="integer" forNull=""/>
|
||||
<d:param field="manager_id" type="integer" forNull=""/>
|
||||
<d:param field="measure_id" type="integer" forNull=""/>
|
||||
<d:param field="precision" type="integer" forNull=""/>
|
||||
<!--- <d:param field="sort" type="integer" forNull=""/> --->
|
||||
<d:param field="is_internal" type="bit" init="0" default="0"/><!--- *** bit and boolean --->
|
||||
<d:param field="status_id" type="integer" default="1" init="1"/>
|
||||
<d:param field="dt_status" type="timestamp" default="#Now()#" init="#Now()#"/>
|
||||
<d:param field="vat_perc" type="integer" init="#request.VAT#" forNull=""/>
|
||||
<d:param field="vat_free" type="bit" default=false init=false/>
|
||||
<d:param field="descr" type="varchar" preprocessor=#plain2HtmClean#/>
|
||||
<d:param field="commercial_note" 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.service_id#"
|
||||
status=#pageInfo.status#
|
||||
trackOut="tr"
|
||||
idAttributesOut="id"
|
||||
/>
|
||||
|
||||
<cfquery name="qDecoration" datasource="#request.DS#">
|
||||
select a.abstract_service, m.modifier, m.modifier_id, c.modifier_class,
|
||||
m.code as modifier_code, a.code, g.area_code, a.manager_id,
|
||||
a.measure_id, u.measure, u.measure_short, a.precision
|
||||
,au.login as creator, au.shortname as creator_shortname, mu.login as updater, mu.shortname as updater_shortname
|
||||
from service s
|
||||
left outer join abstract_service a on (s.abstract_service_id=a.abstract_service_id)
|
||||
left outer join area g on a.area_id=g.area_id
|
||||
left outer join modifier m on (s.modifier_id=m.modifier_id)
|
||||
left outer join modifier_class c on (m.modifier_class_id=c.modifier_class_id)
|
||||
left outer join measure u on (a.measure_id=u.measure_id)
|
||||
left outer join usr au on (s.creator_id=au.usr_id)
|
||||
left outer join usr mu on (s.updater_id=mu.usr_id)
|
||||
where s.service_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.service_id#" null=#!isNumeric(d.service_id)#/>
|
||||
</cfquery>
|
||||
|
||||
<!--- template --->
|
||||
<cfquery name="qAbstractService" datasource="#request.DS#">
|
||||
select a.modifier_class_id, mc.modifier_class, a.measure_id, a.precision
|
||||
from abstract_service a
|
||||
left outer join modifier_class mc on (a.modifier_class_id=mc.modifier_class_id)
|
||||
where a.abstract_service_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.abstract_service_id#" null=#!isNumeric(d.abstract_service_id)#/>
|
||||
</cfquery>
|
||||
|
||||
<!--- Патчим атрибуты значениями родительского класса - никогда раньше так не делали, всегда вели себя так, словно d immutable --->
|
||||
<!--- Принесет ли модифицируемость пагубные последствия? --->
|
||||
<!--- Похожее раньше делали в bean через init и default --->
|
||||
<cfif NOT d.measure_id GT 0>
|
||||
<cfset d.measure_id=qAbstractService.measure_id/>
|
||||
</cfif>
|
||||
<cfif NOT d.precision GT 0>
|
||||
<cfset d.precision=qAbstractService.precision/>
|
||||
</cfif>
|
||||
|
||||
</m:silent><!---
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
---><layout:page section="header" pageInfo=#pageInfo#>
|
||||
<layout:attribute name="title">
|
||||
<cfoutput>
|
||||
Вариант услуги (конкретная услуга)
|
||||
<cfif d.service_id GT 0>
|
||||
<b>#qDecoration.abstract_service#</b>
|
||||
<cfif qDecoration.modifier_id GT 0>
|
||||
<!--- #qDecoration.modifier_class#: ---> <b> - #qDecoration.modifier#</b>
|
||||
</cfif>
|
||||
[#d.service_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="service_id" value="#d.service_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">
|
||||
<cfquery name="qList" datasource="#request.DS#">
|
||||
select abstract_service_id, abstract_service, code
|
||||
from abstract_service
|
||||
order by 3,2
|
||||
</cfquery>
|
||||
<c:combo
|
||||
query=#qList#
|
||||
combo="abstract_service_id"
|
||||
id="abstract_service_id"
|
||||
key="abstract_service_id"
|
||||
selected="#d.abstract_service_id#"
|
||||
displayf="##abstract_service## ##code##"
|
||||
empty=""
|
||||
class=""
|
||||
<!---onchange="submit();"--->
|
||||
/>
|
||||
<cfif d.abstract_service_id GT 0>
|
||||
<c:link_view_edit canWrite=#pageInfo.writePermitted()# entity="abstract_service" id=#d.abstract_service_id# fwx=#tr.fwx#/>
|
||||
Единица измерения: <b>#qDecoration.measure# (#qDecoration.measure_short#)</b>
|
||||
Точность: <b><cfif isNumeric(qDecoration.precision)>#qDecoration.precision#<cfelse>(нет)</cfif></b>
|
||||
</cfif>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Характеристика</div>
|
||||
<div class="td">
|
||||
<cfquery name="qList" datasource="#request.DS#">
|
||||
select m.modifier_id, m.modifier
|
||||
from modifier m
|
||||
join abstract_service a on (m.modifier_class_id=a.modifier_class_id)
|
||||
where a.abstract_service_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.abstract_service_id#"/>
|
||||
order by m.sort, m.code, m.modifier
|
||||
</cfquery>
|
||||
<cfif qList.recordCount GT 0>
|
||||
<a href="modifier_class.cfm?modifier_class_id=#qAbstractService.modifier_class_id#&#tr.fwx#">#qAbstractService.modifier_class#</a>
|
||||
<c:combo
|
||||
query=#qList#
|
||||
combo="modifier_id"
|
||||
id="modifier_id"
|
||||
key="modifier_id"
|
||||
selected="#d.modifier_id#"
|
||||
displayf="##modifier##"
|
||||
empty=""
|
||||
class=""
|
||||
/>
|
||||
<cfif d.modifier_id GT 0>
|
||||
<c:link_view_edit canWrite=#pageInfo.writePermitted()# entity="modifier" id=#d.modifier_id# fwx=#tr.fwx#/>
|
||||
</cfif>
|
||||
<cfelse>
|
||||
(нет)
|
||||
</cfif>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Код варианта услуги</div>
|
||||
<div class="td">
|
||||
<b>#request.skuCode(qDecoration.area_code, qDecoration.code, qDecoration.modifier_code)#</b>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Паттерн: копирование атрибута из родительского класса --->
|
||||
<!--- Может быть, лучше было реализовать не в интерфейсе, а в наборе данных --->
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Единица измерения</div>
|
||||
<div class="td">
|
||||
<cfquery name="qList" datasource="#request.DS#">
|
||||
select measure_id, measure
|
||||
from measure
|
||||
order by 2
|
||||
</cfquery>
|
||||
<c:combo
|
||||
query=#qList#
|
||||
combo="measure_id"
|
||||
id="measure_id"
|
||||
key="measure_id"
|
||||
selected="#d.measure_id#"
|
||||
displayf="##measure##"
|
||||
empty=""
|
||||
class=""
|
||||
<!---onchange="submit();"--->
|
||||
/>
|
||||
<i>для композитных услуг (состоящих из компонентов) указывать штуки. Обычно композитные услуги попадают в спецификацию в количестве 1 шт.</i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Точность</div>
|
||||
<div class="td">
|
||||
<input type="text" name="precision" value="#d.precision#" size="1" class="r"/>
|
||||
<i>Количество знаков после запятой, 0 - целое число. Переопределяет точность из абстрактной услуги</i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- <div class="tr">
|
||||
<div class="th">Сортировка</div>
|
||||
<div class="td">
|
||||
<input type="text" name="sort" id="sort" value="#d.sort#" size="2"/>
|
||||
<i>Целое число - порядок, в котором вариант услуги будет выводиться в списке в рамках абстрактной услуги. Рекомендуется ставить через 100, чтобы потом удобнее было тасовать</i>
|
||||
</div>
|
||||
</div> --->
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Ответственный</div>
|
||||
<div class="td">
|
||||
<cfquery name="qList" datasource="#request.DS#">
|
||||
select usr_id, firstname, middlename, lastname
|
||||
from usr
|
||||
order by 4,2,3
|
||||
</cfquery>
|
||||
<cfif d.manager_id GT 0>
|
||||
<cfset m_manager_id=d.manager_id/>
|
||||
<cfelse>
|
||||
<cfset m_manager_id=qDecoration.manager_id/>
|
||||
</cfif>
|
||||
<c:combo
|
||||
query=#qList#
|
||||
combo="manager_id"
|
||||
id="manager_id"
|
||||
key="usr_id"
|
||||
selected="#m_manager_id#"
|
||||
displayf="##lastname## ##firstname## ##middlename## "
|
||||
empty=""
|
||||
class=""
|
||||
/>
|
||||
<i>Переопределяет ответственного за абстрактную услугу</i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Внутренняя</div>
|
||||
<div class="td">
|
||||
<input type="checkbox" name="is_internal" id="is_internal" value="1"<cfif d.is_internal> checked</cfif> />
|
||||
<i>Предоставляется только внутри компании. Не должна попадать в списки, публикуемые наружу. Не предполагается наличия цены. При снятии отметки станет обычной услугой.</i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Статус</div>
|
||||
<div class="td">
|
||||
<cfquery name="qList" datasource="#request.DS#">
|
||||
select status_id, status
|
||||
from status
|
||||
order by 1
|
||||
</cfquery>
|
||||
<c:combo
|
||||
query=#qList#
|
||||
combo="status_id"
|
||||
id="status_id"
|
||||
key="status_id"
|
||||
selected="#d.status_id#"
|
||||
displayf="##status##"
|
||||
class=""
|
||||
<!---onchange="submit();"--->
|
||||
/>
|
||||
с <input type="text" name="dt_status" id="dt_status" value="#dateFormat(d.dt_status,'DD.MM.YYYY')#" size="10"/>
|
||||
<button type="button" onclick="document.getElementById('dt_status').value='#DateFormat(Now(), 'DD.MM.YYYY')#';">Сегодня</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Ставка НДС</div>
|
||||
<div class="td">
|
||||
<input type="text" name="vat_perc" id="vat_perc" value="#d.vat_perc#" size="2"/>%
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">НДС не облагается</div>
|
||||
<div class="td">
|
||||
<input type="checkbox" name="vat_free" id="vat_free" value="1"<cfif d.vat_free> checked</cfif> />
|
||||
<i>Если флаг установлен, ставка НДС игнорируется</i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Описание</div>
|
||||
<div class="td">
|
||||
<textarea name="descr" rows="5" cols="100" style="width:97%">#request.htm2plain(d.descr)#</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Коммерческие примечания</div>
|
||||
<div class="td">
|
||||
<textarea name="commercial_note" rows="5" cols="100" style="width:97%">#request.htm2plain(d.commercial_note)#</textarea>
|
||||
</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>
|
||||
|
||||
Изменено
|
||||
#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.service_id GT 0>
|
||||
<cfquery name="qServiceParam" datasource="#request.DS#">
|
||||
select
|
||||
sp.service_param_id
|
||||
,ac.param_class_id
|
||||
,ac.abstract_service_param_class_id
|
||||
,ac.is_multiple
|
||||
,sp.param_id
|
||||
,sp.min_value
|
||||
,sp.max_value
|
||||
,p.param
|
||||
,p.code as param_code
|
||||
,p.precision
|
||||
,m.measure
|
||||
,m.measure_short
|
||||
,c.param_class
|
||||
|
||||
,(select count(*) from service_param_price t where t.service_param_id=sp.service_param_id AND t.pricing_model_id=1) as inst_cnt
|
||||
,(select price from service_param_price t where t.service_param_id=sp.service_param_id AND t.pricing_model_id=1 order by service_param_price_id desc limit 1) as prc_inst
|
||||
,(select service_param_price_id from service_param_price t where t.service_param_id=sp.service_param_id AND t.pricing_model_id=1 order by service_param_price_id desc limit 1) as prc_inst_id
|
||||
,(select status from service_param_price t where t.service_param_id=sp.service_param_id AND t.pricing_model_id=1 order by service_param_price_id desc limit 1) as prc_inst_stat
|
||||
|
||||
,(select count(*) from service_param_price t where t.service_param_id=sp.service_param_id AND t.pricing_model_id=2) as fix_cnt
|
||||
,(select price from service_param_price t where t.service_param_id=sp.service_param_id AND t.pricing_model_id=2 order by service_param_price_id desc limit 1) as prc_fix
|
||||
,(select service_param_price_id from service_param_price t where t.service_param_id=sp.service_param_id AND t.pricing_model_id=2 order by service_param_price_id desc limit 1) as prc_fix_id
|
||||
,(select status from service_param_price t where t.service_param_id=sp.service_param_id AND t.pricing_model_id=2 order by service_param_price_id desc limit 1) as prc_fix_stat
|
||||
|
||||
,(select count(*) from service_param_price t where t.service_param_id=sp.service_param_id AND t.pricing_model_id=3) as payg_cnt
|
||||
,(select price from service_param_price t where t.service_param_id=sp.service_param_id AND t.pricing_model_id=3 order by service_param_price_id desc limit 1) as prc_payg
|
||||
,(select service_param_price_id from service_param_price t where t.service_param_id=sp.service_param_id AND t.pricing_model_id=3 order by service_param_price_id desc limit 1) as prc_payg_id
|
||||
,(select status from service_param_price t where t.service_param_id=sp.service_param_id AND t.pricing_model_id=3 order by service_param_price_id desc limit 1) as prc_payg_stat
|
||||
|
||||
from abstract_service_param_class ac
|
||||
left outer join service_param sp on (ac.abstract_service_param_class_id=sp.abstract_service_param_class_id
|
||||
AND sp.service_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.service_id#"/>)
|
||||
left outer join param_class c on (ac.param_class_id=c.param_class_id)
|
||||
left outer join param p on (sp.param_id=p.param_id)
|
||||
left outer join measure m on (p.measure_id=m.measure_id)
|
||||
where ac.abstract_service_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.abstract_service_id#"/>
|
||||
order by ac.sort, ac.abstract_service_param_class_id, p.sort, p.param
|
||||
</cfquery>
|
||||
<!--- <cfdump var=#qServiceParam#/> --->
|
||||
|
||||
<cfoutput>
|
||||
<p>
|
||||
<b>Компоненты варианта услуги</b> (#qServiceParam.recordCount#), цены без НДС
|
||||
<cfif qServiceParam.recordCount GT 0>
|
||||
<cfif pageInfo.writePermitted()>
|
||||
<!--- Под добавлением имеется в виду только добавление разрешенного варианта из тех, что определены в абстрактной услуге --->
|
||||
<cfoutput>
|
||||
<cfset addUrl="service_param.cfm?service_param_id=-1&service_id=#d.service_id#&#tr.fwx#"/>
|
||||
<button type="button" class="maincontrol" onclick="document.location.href='#addUrl#'">
|
||||
<a href="#addUrl#">Добавить</a>
|
||||
</button>
|
||||
</cfoutput>
|
||||
<i></i>
|
||||
</cfif>
|
||||
</cfif>
|
||||
</p>
|
||||
</cfoutput>
|
||||
<!--- можно в строки добавить кнопки добавления цен, можно сразу с ценой
|
||||
*** здесь выводится единица измерения от класса. Пока не понял, нужна ли возможность переопределять единицу измерения --->
|
||||
<cfif qServiceParam.recordCount GT 0>
|
||||
<table class="worktable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th>Компонент</th>
|
||||
<th>Вариант компонента</th>
|
||||
<th>Код</th>
|
||||
<th>Ед.изм.</th>
|
||||
<th>Min</th>
|
||||
<th>Max</th>
|
||||
<th>Цена инст</th>
|
||||
<th>Цена фикс</th>
|
||||
<th>Цена payg</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<cfoutput query="qServiceParam">
|
||||
<tr>
|
||||
<td>
|
||||
<cfif service_param_id GT 0>
|
||||
<a href="service_param.cfm?service_param_id=#service_param_id#¶m_class_id=#param_class_id#¶m_id=#param_id#&#tr.fwx#">
|
||||
<img src="img/edit.gif"/><!--- *** халява param_class_id=#param_class_id# --->
|
||||
</a>
|
||||
<cfelse>
|
||||
<a href="service_param.cfm?abstract_service_param_class_id=#abstract_service_param_class_id#&service_param_id=#service_param_id#<!--- ¶m_class_id=#param_class_id# --->&service_id=#d.service_id#&#tr.fwx#">
|
||||
<img src="img/add.gif"/>
|
||||
</a>
|
||||
</cfif>
|
||||
<!--- </a> --->
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<cfif service_param_id GT 0>
|
||||
<form name="frmClone#param_id#" action="param_clone.cfm"><!--- *** а почто метод не указан? --->
|
||||
<input type="hidden" name="original_service_param_id" value="#service_param_id#"/>
|
||||
<input type="hidden" name="param_id" value="#param_id#"/><!--- *** аккуратнее было бы восстанавливать на принимающей стороне из service_param_id --->
|
||||
<input type="hidden" name="do_clone" value="1"/>
|
||||
<input type="hidden" name="track" value="#tr.fw#"/>
|
||||
<button type="submit"<cfif !pageInfo.writePermitted()> disabled</cfif>>clone</button>
|
||||
</form>
|
||||
</cfif>
|
||||
</td>
|
||||
|
||||
<td class="mid"><!--- mid=vertical-align:middle указан для симметрии, здесь оно по умолчанию, а вот в ячейке ниже его нужно явно указывать --->
|
||||
<a href="param_class.cfm?param_class_id=#param_class_id#&#tr.fwx#">#param_class#</a>
|
||||
<cfif service_param_id GT 0 AND is_multiple GT 0>
|
||||
<a href="service_param.cfm?abstract_service_param_class_id=#abstract_service_param_class_id#<!--- ¶m_class_id=#param_class_id# --->¶m_id=#param_id#&service_id=#service_id#&#tr.fwx#" title="добавить вариант компонента #param_class#">
|
||||
<img src="img/add.gif"/>
|
||||
</a>
|
||||
</cfif>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<!--- <div class="table wh100">
|
||||
<a href="param.cfm?param_id=#param_id#&#tr.fwx#" class="tcell mid">#param#</a>
|
||||
</div> ---><!--- такой изврат, чтобы сделать ссылку на пустой ячейке --->
|
||||
<cfif param_id GT 0>
|
||||
<a href="param.cfm?param_id=#param_id#&#tr.fwx#" class="tcell mid">
|
||||
<!--- #param_param_class# / ---> #param#
|
||||
<cfif len(param) LE 1>(основной вариант)</cfif>
|
||||
</a>
|
||||
<cfelse>
|
||||
(не выбран)
|
||||
</cfif>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<cfif param_id GT 0>
|
||||
<!--- наличие кода более явно указывает на актуальность компонента в конкретной услуге --->
|
||||
#request.skuCode(qDecoration.area_code,qDecoration.code,qDecoration.modifier_code,param_code)#
|
||||
</cfif>
|
||||
</td>
|
||||
<td class="c">#measure_short#</td>
|
||||
<td class="c">#request.roundSafe(min_value,precision)#</td>
|
||||
<td class="c">#request.roundSafe(max_value,precision)#</td>
|
||||
<td class="r">
|
||||
<cfif prc_inst_id GT 0>
|
||||
<cfif len(prc_inst_stat)>(#prc_inst_stat#)</cfif>
|
||||
<a href="service_param_price.cfm?service_param_price_id=#prc_inst_id#&#tr.fwx#">
|
||||
<cfif len(prc_inst)>
|
||||
#prc_inst#
|
||||
<cfelse>
|
||||
<i>по запросу</i>
|
||||
</cfif>
|
||||
</a>
|
||||
</cfif>
|
||||
<cfif inst_cnt GT 1>(#inst_cnt#)</cfif>
|
||||
</td>
|
||||
<td class="r">
|
||||
<cfif prc_fix_id GT 0>
|
||||
<cfif len(prc_fix_stat)>(prc_fiх_stat)</cfif>
|
||||
<a href="service_param_price.cfm?service_param_price_id=#prc_fix_id#&#tr.fwx#">
|
||||
<cfif len(prc_fix)>
|
||||
#prc_fix#
|
||||
<cfelse>
|
||||
<i>по запросу</i>
|
||||
</cfif>
|
||||
</a>
|
||||
</cfif>
|
||||
</td>
|
||||
<td class="r">
|
||||
<cfif prc_payg_id GT 0>
|
||||
<a href="service_param_price.cfm?service_param_price_id=#prc_payg_id#&#tr.fwx#">
|
||||
<cfif len(prc_payg)>
|
||||
#prc_payg#
|
||||
<cfelse>
|
||||
<i>по запросу</i>
|
||||
</cfif>
|
||||
</a>
|
||||
</cfif>
|
||||
</td>
|
||||
<td class="c">
|
||||
<cfif service_param_id GT 0>
|
||||
<c:link_del canWrite=#pageInfo.writePermitted()# entity="service_param" id=#service_param_id# fwx=#tr.fwx#/>
|
||||
</cfif>
|
||||
</td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
</table>
|
||||
</cfif>
|
||||
|
||||
|
||||
<!--- <cfif qServiceParam.recordCount GT 0>
|
||||
<cfelse>
|
||||
<cfquery name="qPrice" datasource="#request.DS#">
|
||||
select
|
||||
<d:field_set titleMapOut="titleMapPrice" lengthOut="fieldCountPrice">
|
||||
<d:field title="price_id" cfSqlType="CF_SQL_INTEGER">prc.price_id</d:field>
|
||||
<d:field title=#i18("Цена без НДС, ₽","Price w/o VAT, ₽")# cfSqlType="CF_SQL_INTEGER">prc.base_price</d:field>
|
||||
</d:field_set>
|
||||
from
|
||||
price prc
|
||||
where prc.service_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.service_id#"/>
|
||||
order by 1
|
||||
</cfquery>
|
||||
</cfif> --->
|
||||
|
||||
<!--- ---------------------------------------------------------------------------- --->
|
||||
|
||||
<cffunction name="formatPrice" output="true">
|
||||
<cfargument name="price"/>
|
||||
<cfif isNumeric(price)><cfreturn numberFormat(price,'.00')/><cfelse><cfreturn "(по запросу)"></cfif>
|
||||
</cffunction>
|
||||
<cfset request.formatPrice=formatPrice/>
|
||||
|
||||
<cfquery name="qServicePrice" datasource="#request.DS#">
|
||||
select
|
||||
t.service_price_id
|
||||
,t.service_id
|
||||
,t.pricing_model_id
|
||||
,m.pricing_model
|
||||
,m.pricing_model_short
|
||||
,t.pricing_period
|
||||
,t.rating_period
|
||||
,t.price
|
||||
<!--- ,t.discount_policy_id --->
|
||||
,t.dt_from
|
||||
,t.dt_to
|
||||
,t.status
|
||||
,t.descr
|
||||
from service_price t
|
||||
left outer join pricing_model m on (t.pricing_model_id=m.pricing_model_id)
|
||||
where t.service_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.service_id#"/>
|
||||
order by 1
|
||||
</cfquery>
|
||||
|
||||
<cfoutput>
|
||||
<p>
|
||||
<b>Цены услуги</b> без НДС (#qServicePrice.recordCount#)
|
||||
<cfif pageInfo.writePermitted()>
|
||||
<cfset addUrl="service_price.cfm?service_id=#d.service_id#&#tr.fwx#"/>
|
||||
<button type="button" class="maincontrol" onclick="document.location.href='#addUrl#'">
|
||||
<a href="#addUrl#">Добавить</a>
|
||||
</button>
|
||||
</cfif>
|
||||
<i>цена услуги - это то, что остается, если все компоненты обнулить, или их нет (для атомарной услуги). Если компоненты есть, обычно цена услуги не нужна, стоимость складывается из компонентов</i>
|
||||
</p>
|
||||
</cfoutput>
|
||||
|
||||
<table class="worktable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>ID</th>
|
||||
<th>Ц-обр.</th>
|
||||
<th>Период цены</th>
|
||||
<th>Период опроса</th>
|
||||
<!--- <th>Политика</th> --->
|
||||
<th>Статус</th>
|
||||
<th>С</th>
|
||||
<th>По</th>
|
||||
<th>Цена GPL без НДС</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<cfoutput query="qServicePrice">
|
||||
<tr>
|
||||
<td>
|
||||
<c:link_view_edit canWrite=#pageInfo.writePermitted()# entity="service_price" key="service_price_id" id=#service_price_id# fwx=#tr.fwx#/>
|
||||
</td>
|
||||
<td>#service_price_id#</td>
|
||||
<td>#pricing_model_short#</td>
|
||||
<td>#pricing_period#</td>
|
||||
<td>#rating_period#</td>
|
||||
<!--- <td>#discount_policy_id#</td> --->
|
||||
<td>#status#</td>
|
||||
<td>#dateFormat(dt_from,'DD.MM.YYYY')#</td>
|
||||
<td>#dateFormat(dt_to,'DD.MM.YYYY')#</td>
|
||||
<td class="r">#request.formatPrice(price)#</td>
|
||||
<td class="c">
|
||||
<c:link_del canWrite=#pageInfo.writePermitted()# entity="service_price" key="service_price_id" id=#service_price_id# fwx=#tr.fwx#/>
|
||||
</td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
</table>
|
||||
|
||||
<!--- ---------------------------------------------------------------------------- --->
|
||||
|
||||
<cfquery name="qSpecification" datasource="#request.DS#">
|
||||
select f.specification_id, f.specification,
|
||||
(select count(*) from specification_item_param sip where sip.specification_item_id=si.specification_item_id) as item_param_cnt
|
||||
from specification_item si
|
||||
left outer join specification f on (si.specification_id=f.specification_id)
|
||||
where si.service_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.service_id#"/>
|
||||
</cfquery>
|
||||
|
||||
<cfoutput>
|
||||
<p><b>Используется спецификациями</b> (#qSpecification.recordCount#)</p>
|
||||
</cfoutput>
|
||||
|
||||
<table class="worktable">
|
||||
<thead>
|
||||
<tr>
|
||||
<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_param_cnt GT 0>
|
||||
#item_param_cnt#
|
||||
</cfif>
|
||||
</td>
|
||||
<td class="c">
|
||||
under construction
|
||||
</td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
</table>
|
||||
|
||||
<cfelse>
|
||||
|
||||
Компоненты доступны после сохранения услуги
|
||||
|
||||
</cfif>
|
||||
<!--- ------------------------------------------------------------------------------- --->
|
||||
<!--- ------------------------------------------------------------------------------- --->
|
||||
<!--- ------------------------------------------------------------------------------- --->
|
||||
<layout:page section="footer"/>
|
@ -148,16 +148,52 @@
|
||||
<cfquery name="qItem" datasource="#request.DS#">
|
||||
select
|
||||
i.specification_item_uid
|
||||
,s.svc_id
|
||||
,s.svc
|
||||
,s.code
|
||||
,svc.svc_id
|
||||
,svc.svc
|
||||
,svc.code
|
||||
,s.specification_id
|
||||
,s.contract_id
|
||||
<!--- ,i.price*i.quantity as cost --->
|
||||
<!--- ,(select count(*) from svc_param sp where sp.svc_id=i.svc_id) as svc_param_count --->
|
||||
,(select siv.agreement_version from specification_item_version siv
|
||||
join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id)
|
||||
where siv.specification_item_uid=i.specification_item_uid AND a.is_actual
|
||||
order by siv.agreement_version desc limit 1) as agreement_version
|
||||
,(select a.agreement from specification_item_version siv
|
||||
join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id)
|
||||
where siv.specification_item_uid=i.specification_item_uid AND a.is_actual
|
||||
order by siv.agreement_version desc limit 1) as agreement
|
||||
,(select a.dt_agreement from specification_item_version siv
|
||||
join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id)
|
||||
where siv.specification_item_uid=i.specification_item_uid AND a.is_actual
|
||||
order by siv.agreement_version desc limit 1) as dt_agreement
|
||||
,(select siv.specification_item_version from specification_item_version siv
|
||||
join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id)
|
||||
where siv.specification_item_uid=i.specification_item_uid AND a.is_actual
|
||||
order by siv.agreement_version desc limit 1) as specification_item
|
||||
,(select siv.quantity from specification_item_version siv
|
||||
join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id)
|
||||
where siv.specification_item_uid=i.specification_item_uid AND a.is_actual
|
||||
order by siv.agreement_version desc limit 1) as quantity
|
||||
,(select siv.price from specification_item_version siv
|
||||
join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id)
|
||||
where siv.specification_item_uid=i.specification_item_uid AND a.is_actual
|
||||
order by siv.agreement_version desc limit 1) as price
|
||||
,(select siv.dt_from from specification_item_version siv
|
||||
join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id)
|
||||
where siv.specification_item_uid=i.specification_item_uid AND a.is_actual
|
||||
order by siv.agreement_version desc limit 1) as dt_from
|
||||
,(select siv.dt_to from specification_item_version siv
|
||||
join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id)
|
||||
where siv.specification_item_uid=i.specification_item_uid AND a.is_actual
|
||||
order by siv.agreement_version desc limit 1) as dt_to
|
||||
,(select count(*) from specification_item_version siv where siv.specification_item_uid=i.specification_item_uid) as item_version_count
|
||||
from specification_item i
|
||||
left outer join svc s on (i.svc_id=s.svc_id)
|
||||
join specification s on (i.specification_id=s.specification_id)
|
||||
--left outer join ()
|
||||
left outer join svc on (i.svc_id=svc.svc_id)
|
||||
where i.specification_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.specification_id#"/>
|
||||
order by 1
|
||||
order by 2
|
||||
</cfquery>
|
||||
|
||||
<cfoutput>
|
||||
@ -172,7 +208,8 @@
|
||||
</cfoutput>
|
||||
</cfif>
|
||||
</p>
|
||||
</cfoutput>
|
||||
</cfoutput>
|
||||
(количество, цена, даты актуальности, версия/соглашение, имя для печати - для последней актуальной версии)
|
||||
<table class="worktable">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -181,6 +218,14 @@
|
||||
<th>Услуга</th>
|
||||
<th>Код услуги</th>
|
||||
<th>Версий</th>
|
||||
<th> </th>
|
||||
<th>Тек. соглашение</th>
|
||||
<th>Тек. версия</th>
|
||||
<th>Дата с</th>
|
||||
<th>Дата по</th>
|
||||
<th>Количество</th>
|
||||
<th>Цена</th>
|
||||
<th>Имя для печати</th>
|
||||
<!--- <th>Компонентов</th> --->
|
||||
<th></th>
|
||||
</tr>
|
||||
@ -193,21 +238,89 @@
|
||||
<td>#specification_item_uid#</td>
|
||||
<td>#svc#</td>
|
||||
<td>#code#</td>
|
||||
<td>#item_version_count#</td>
|
||||
<td class="c">#item_version_count#</td>
|
||||
<td class="c"></td>
|
||||
<td><a href="agreement.cfm?contract_id=#contract_id#&agreement_version=#agreement_version#&#tr.fwx#">#agreement# #dateFormat(dt_agreement,'DD.MM.YYYY')#</td>
|
||||
<td class="c"><a href="specification_item_version.cfm?specification_item_uid=#specification_item_uid#&agreement_version=#agreement_version#&#tr.fwx#">#agreement_version#</a></td>
|
||||
<td class="c">#dateFormat(dt_from,'DD.MM.YYYY')#</td>
|
||||
<td class="c">#dateFormat(dt_to,'DD.MM.YYYY')#</td>
|
||||
<td class="r">#quantity#</td>
|
||||
<td class="r">#price#</td>
|
||||
<td>#specification_item#</td>
|
||||
<td class="c">
|
||||
<c:link_del canWrite=#pageInfo.writePermitted()# entity="specification_item" id=#specification_item_uid# fwx=#tr.fwx#/>
|
||||
<c:link_del canWrite=#pageInfo.writePermitted()# entity="specification_item" key="specification_item_uid" id=#specification_item_uid# fwx=#tr.fwx#/>
|
||||
</td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
</table>
|
||||
|
||||
Здесь отсутствуют версионные поля - цена, количество, название для печати.
|
||||
Если бы они были - это получилась бы версия спецификации.
|
||||
Как сущности версии спецификации нет.
|
||||
Можно синтезировать версию спецификации на произвольную дату, а можно по версии определенного соглашения (это должно быть возмозно, потому что соглашение меняет каждую строку не более 1 раза
|
||||
)
|
||||
Спецификация по версии соглашения не учитывает is_actual этого соглашения, но учитывает предыдущие
|
||||
*** Собственно, нам нужно для илюстрации версионности как раз синтезировать спецификацию на дату и спецификацию по версии согдашения
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<cfquery name="qVersion" datasource="#request.DS#">
|
||||
select
|
||||
a.agreement
|
||||
,a.dt_agreement
|
||||
,a.agreement_version
|
||||
,a.is_actual
|
||||
,(select count(*) from specification_item si
|
||||
join specification_item_version iv on (si.specification_item_uid=iv.specification_item_uid)
|
||||
where si.specification_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.specification_id#"/>
|
||||
AND iv.agreement_version=a.agreement_version
|
||||
) as changed_item_cnt
|
||||
from agreement a
|
||||
where a.contract_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.contract_id#"/>
|
||||
/*AND exists (
|
||||
select * from specification_item si
|
||||
join specification_item_version iv on (si.specification_item_uid=iv.specification_item_uid)
|
||||
where si.specification_id=s.specification_id
|
||||
AND iv.agreement_version=a.agreement_version
|
||||
)*/
|
||||
order by 2
|
||||
</cfquery>
|
||||
|
||||
<cfoutput>
|
||||
<p>
|
||||
Версии (#qVersion.recordCount#)
|
||||
<!--- <cfif pageInfo.writePermitted()>
|
||||
<cfoutput>
|
||||
<cfset addUrl="specification_item.cfm?specification_item_uid=&specification_id=#d.specification_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>
|
||||
</tr>
|
||||
</thead>
|
||||
<cfoutput query="qVersion">
|
||||
<tr>
|
||||
<td>
|
||||
<!--- <c:link_view_edit canWrite=#pageInfo.writePermitted()# entity="specification_item" key="specification_item_uid" id=#specification_item_uid# fwx=#tr.fwx#/> --->
|
||||
</td>
|
||||
<td>#agreement#</td>
|
||||
<td class="c">#dateFormat(dt_agreement,'DD.MM.YYYY')#</td>
|
||||
<td class="c"><a href="specification_version.cfm?specification_id=#specification_id#&agreement_version=#agreement_version#&#tr.fwx#">#agreement_version#</a></td>
|
||||
<td class="c">#changed_item_cnt#</td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
</table>
|
||||
</cfif>
|
||||
|
||||
|
||||
|
@ -177,7 +177,7 @@
|
||||
|
||||
<cfoutput>
|
||||
<p>
|
||||
Версии (#qSpecificationItemVersion.recordCount#) (история инстанса)
|
||||
Версии строки (#qSpecificationItemVersion.recordCount#) (история инстанса)
|
||||
<cfif pageInfo.writePermitted()>
|
||||
<cfoutput>
|
||||
<cfset addUrl="specification_item_version.cfm?agreement_version=-1&specification_item_uid=#d.specification_item_uid#&#tr.fwx#"/>
|
||||
@ -195,7 +195,7 @@
|
||||
<th>Версия N</th>
|
||||
<th>Соглашение</th>
|
||||
<th>Дата соглашения</th>
|
||||
<th>Действует</th>
|
||||
<th>Согл. действ.</th>
|
||||
<th>Дата с</th>
|
||||
<th>Дата по</th>
|
||||
<th>Услуга (для печати)</th>
|
||||
@ -214,10 +214,10 @@
|
||||
<td class="c"><a href="agreement.cfm?contract_id=#contract_id#&agreement_version=#agreement_version#&#tr.fwx#">#agreement_version#</a></td>
|
||||
<td>#agreement#</td>
|
||||
<td class="c">#dateFormat(dt_agreement,'DD.MM.YYYY')#</td>
|
||||
<td><cfif is_actual GT 0><img src="img/ok.png"/></cfif></td>
|
||||
<td class="c"><cfif is_actual GT 0><img src="img/ok.png"/></cfif></td>
|
||||
<td class="c">#dateFormat(dt_from, 'DD.MM.YYYY')#</td>
|
||||
<td class="c">#dateFormat(dt_to, 'DD.MM.YYYY')#</td>
|
||||
<td class="r">#specification_item_version#</td>
|
||||
<td>#specification_item_version#</td>
|
||||
<td class="r">#quantity#</td>
|
||||
<td class="r">#price#</td>
|
||||
<td class="c">
|
||||
|
@ -5,52 +5,75 @@
|
||||
</cfsilent><m:silent silent="No">
|
||||
|
||||
<m:prepare_detail entity="specification_item" pageInfoOut="pageInfo"/>
|
||||
<cfparam name="specification_item_id" type="integer"/>
|
||||
<cfparam name="specification_item_uid" type="guid"/>
|
||||
|
||||
<d:del
|
||||
entity="#pageInfo.entity#"
|
||||
confirmMessage="Удалить строку спецификации (экземпляр услуги)?"
|
||||
denyMessage="Удаление данной строки невозможно (заданы компоненты/варианты компонентов)."
|
||||
accessObj="#pageInfo.entity#"
|
||||
denyMessage="Удаление данной строки невозможно (заданы версии)."
|
||||
accessObj=""
|
||||
status="status"
|
||||
output="markup">
|
||||
|
||||
<d:dependency entity="specification_item_param" title="Компоненты строки спецификации (экземпляра услуги)">
|
||||
<d:dependency_field key>specification_item_param_id</d:dependency_field>
|
||||
<d:dependency_field title="Компонент">c.param_class</d:dependency_field>
|
||||
<d:dependency_field title="Вариант компонента">coalesce(p.param, p1.param) as param</d:dependency_field><!---*** нужно обдумать смысл--->
|
||||
<d:dependency_field title="Количество">sip.quantity</d:dependency_field>
|
||||
<d:dependency entity="specification_item_version" title="Версии строки спецификации">
|
||||
<d:dependency_field key>siv.specification_item_uid</d:dependency_field>
|
||||
<d:dependency_field key>siv.agreement_version</d:dependency_field>
|
||||
|
||||
<d:dependency_field title="Договор">d.contract</d:dependency_field>
|
||||
<d:dependency_field title="Дата договора">d.dt_contract</d:dependency_field>
|
||||
<d:dependency_field title="Соглашение">a.agreement</d:dependency_field>
|
||||
<d:dependency_field title="Дата соглашеия">a.dt_agreement</d:dependency_field>
|
||||
<d:dependency_field title="Версия">siv.agreement_version</d:dependency_field>
|
||||
<d:dependency_field title="Количество">siv.quantity</d:dependency_field>
|
||||
<d:dependency_field title="Цена">siv.price</d:dependency_field>
|
||||
<d:dependency_field title="Имя для печати">siv.specification_item_version</d:dependency_field>
|
||||
<d:dependency_from>
|
||||
specification_item_param sip
|
||||
left outer join service_param sp on (sip.service_param_id=sp.service_param_id)
|
||||
left outer join param p on sp.param_id=p.param_id
|
||||
left outer join param_class c on p.param_class_id=c.param_class_id
|
||||
left outer join param p1 on sp.param_id=p1.param_id
|
||||
specification_item_version siv
|
||||
left outer join specification_item si on (siv.specification_item_uid=si.specification_item_uid)
|
||||
left outer join specification s on (si.specification_id=s.specification_id)
|
||||
left outer join contract d on (s.contract_id=d.contract_id)
|
||||
left outer join contragent k on (d.contragent_id=k.contragent_id)
|
||||
left outer join agreement a on (siv.agreement_version=a.agreement_version AND s.contract_id=a.contract_id)
|
||||
</d:dependency_from>
|
||||
<d:dependency_condition cfsqltype="cf_sql_integer" value='#specification_item_id#'>specification_item_id</d:dependency_condition>
|
||||
<d:dependency_order_by>1</d:dependency_order_by>
|
||||
</d:dependency>
|
||||
|
||||
<d:del_condition field="specification_item_id" value="#specification_item_id#" cfsqltype="cf_sql_integer"/>
|
||||
<d:dependency_condition cfsqltype="cf_sql_other" value='#specification_item_uid#'>
|
||||
siv.specification_item_uid
|
||||
</d:dependency_condition>
|
||||
<d:dependency_order_by>
|
||||
siv.agreement_version
|
||||
</d:dependency_order_by>
|
||||
</d:dependency>
|
||||
<d:del_condition field="specification_item_uid" value="#specification_item_uid#" cfsqltype="cf_sql_other"/>
|
||||
</d:del>
|
||||
|
||||
<m:dispatch_detail
|
||||
<!--- ---><m:dispatch_detail
|
||||
usePRG="Yes"
|
||||
pageInfo=#pageInfo#
|
||||
id="#specification_item_id#"
|
||||
id="#specification_item_uid#"
|
||||
status=#status#
|
||||
trackOut="tr"
|
||||
idAttributesOut="id"
|
||||
/>
|
||||
/>
|
||||
<!--- <m:dispatch_detail
|
||||
usePRG="No"<!---*** --->
|
||||
pageInfo=#pageInfo#
|
||||
id=""
|
||||
queryString="#request.thisPage#?specification_item_uid=#specification_item_uid#"
|
||||
defaultBackUrl="specification.cfm?specification_id=#d.specification_item_id#"
|
||||
status=#pageInfo.status#
|
||||
trackOut="tr"
|
||||
idAttributesOut="id"
|
||||
/> --->
|
||||
|
||||
<!--- decoration --->
|
||||
<cfquery name="qDecoration" datasource="#request.DS#">
|
||||
select
|
||||
si.specification_item,
|
||||
n.specification
|
||||
si.specification_item_uid
|
||||
,s.specification
|
||||
,svc.svc
|
||||
from specification_item si
|
||||
join specification n on (si.specification_id=n.specification_id)
|
||||
where si.specification_item_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#specification_item_id#" null=#!isValid("integer", specification_item_id)#/>
|
||||
left outer join specification s on (si.specification_id=s.specification_id)
|
||||
left outer join svc on (si.svc_id=svc.svc_id)
|
||||
where si.specification_item_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#specification_item_uid#" null=#!isValid("guid", specification_item_uid)#/>
|
||||
</cfquery>
|
||||
|
||||
|
||||
@ -62,8 +85,8 @@
|
||||
<cfoutput>
|
||||
Удаление строки спецификации
|
||||
<b>#qDecoration.specification#</b>
|
||||
#qDecoration.specification_item#
|
||||
[#specification_item_id#]
|
||||
#qDecoration.svc#
|
||||
[#specification_item_uid#]
|
||||
|
||||
</cfoutput>
|
||||
</layout:attribute>
|
||||
|
@ -15,8 +15,21 @@
|
||||
<cfreturn htmlEditFormat(s)/>
|
||||
</cffunction>
|
||||
|
||||
<m:prepare_detail entity="specification_item_version" key="specification_item_uid" pageInfoOut="pageInfo"/>
|
||||
<!--- так... а у нас ключ составной --->
|
||||
|
||||
<!--- так... а у нас ключ составной, prepare_detail несколько сложнее --->
|
||||
<cfparam name="specification_item_uid" type="guid"/>
|
||||
<cfparam name="agreement_version" type="integer" default="-1"/>
|
||||
<m:prepare_detail
|
||||
entity="specification_item_version"
|
||||
key="undefined"
|
||||
pageInfoOut="pageInfo"
|
||||
thisUrl="#request.thisPage#?specification_item_uid=#specification_item_uid#&agreement_version=#agreement_version#"
|
||||
defaultBackUrl="specification_item.cfm?specification_item_uid=#specification_item_uid#"
|
||||
/>
|
||||
|
||||
<!--- <cfdump var=#pageInfo#/>
|
||||
<cfdump var=#specification_item_version#/>
|
||||
<cfabort/> --->
|
||||
|
||||
<d:bean readonly=#!pageInfo.writePermitted()# table="#pageInfo.entity#" datasource="#request.DS#" output="d" status="status">
|
||||
<d:param field="specification_item_uid" type="guid" key/>
|
||||
@ -142,8 +155,12 @@
|
||||
<a href="contragent.cfm?contragent_id=#qSpecificationItem.contragent_id#&#tr.fwx#">#qSpecificationItem.contragent# </a>
|
||||
</layout:detail_line>
|
||||
|
||||
<layout:detail_line title="Строка">
|
||||
#d.specification_item_uid#
|
||||
</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>
|
||||
<a href="svc.cfm?svc_id=#qSpecificationItem.svc_id#&#tr.fwx#">#qSpecificationItem.svc# [#qSpecificationItem.svc_id#]</a>
|
||||
</layout:detail_line>
|
||||
|
||||
<!--- <layout:detail_line title="Версия">#d.agreement_version# (версия-номер соглашения)</layout:detail_line> --->
|
||||
@ -164,6 +181,28 @@
|
||||
class=""
|
||||
/>
|
||||
(версия-номер соглашения)
|
||||
<!--- *** можно придумать коструктор ссылок с декоратором tr.fwx --->
|
||||
<cfif d.agreement_version GT 0>
|
||||
<a href="agreement.cfm?agreement_version=#d.agreement_version#&contract_id=#qSpecificationItem.contract_id#&#tr.fwx#">
|
||||
#d.agreement_version#
|
||||
</a>
|
||||
</cfif>
|
||||
<a href="agreement.cfm?contract_id=#qSpecificationItem.contract_id#&#tr.fwx#">
|
||||
<img src="img/add.gif"/>
|
||||
</a>
|
||||
|
||||
|
||||
</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="Имя для печати">
|
||||
@ -171,18 +210,8 @@
|
||||
<!--- <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> --->
|
||||
<input type="text" name="quantity" value="#d.quantity#" size="10" class="r"/><!---*** Халява с точностью ---><!--- <cftry>#round(d.quantity,qService.precision)#<cfcatch type="ANY"></cfcatch></cftry> --->
|
||||
</layout:detail_line>
|
||||
|
||||
<layout:detail_line title="Цена">
|
||||
|
68
specification_item_version_del.cfm
Normal file
68
specification_item_version_del.cfm
Normal file
@ -0,0 +1,68 @@
|
||||
<cfsilent>
|
||||
<cfimport prefix="m" taglib="lib"/>
|
||||
<cfimport prefix="d" taglib="lib/data"/>
|
||||
<cfimport prefix="layout" taglib="layout"/>
|
||||
</cfsilent><m:silent silent="No">
|
||||
|
||||
<m:prepare_detail entity="specification_item_version" pageInfoOut="pageInfo"/>
|
||||
|
||||
<cfparam name="specification_item_uid" type="guid"/>
|
||||
<cfparam name="agreement_version" type="integer"/>
|
||||
|
||||
<d:del
|
||||
entity="#pageInfo.entity#"
|
||||
confirmMessage="Удалить версию строки спецификации?"
|
||||
denyMessage="Удаление данной версии строки невозможно (ситуация не предусмотрена)."
|
||||
accessObj=""
|
||||
status="status"
|
||||
output="markup">
|
||||
|
||||
<d:del_condition field="specification_item_uid" value="#specification_item_uid#" cfsqltype="cf_sql_other"/>
|
||||
<d:del_condition field="agreement_version" value="#agreement_version#" cfsqltype="cf_sql_integer"/>
|
||||
</d:del>
|
||||
|
||||
<!--- ---><m:dispatch_detail
|
||||
usePRG="Yes"
|
||||
pageInfo=#pageInfo#
|
||||
id="#specification_item_uid#"
|
||||
status=#status#
|
||||
trackOut="tr"
|
||||
idAttributesOut="id"
|
||||
/>
|
||||
|
||||
|
||||
<!--- decoration --->
|
||||
<cfquery name="qDecoration" datasource="#request.DS#">
|
||||
select
|
||||
si.specification_item_uid
|
||||
,s.specification
|
||||
,svc.svc
|
||||
from specification_item si
|
||||
left outer join specification s on (si.specification_id=s.specification_id)
|
||||
left outer join svc on (si.svc_id=svc.svc_id)
|
||||
where si.specification_item_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#specification_item_uid#" null=#!isValid("guid", specification_item_uid)#/>
|
||||
</cfquery>
|
||||
|
||||
|
||||
</m:silent><!--- ----------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------------
|
||||
---><layout:page section="header" pageInfo=#pageInfo#>
|
||||
<layout:attribute name="title">
|
||||
<cfoutput>
|
||||
Удаление версии строки спецификации
|
||||
<b>#qDecoration.specification#</b>
|
||||
#qDecoration.svc#
|
||||
[#specification_item_uid#]
|
||||
[#agreement_version#]
|
||||
|
||||
</cfoutput>
|
||||
</layout:attribute>
|
||||
<layout:attribute name="controls"> </layout:attribute>
|
||||
</layout:page>
|
||||
|
||||
<!---<cfdump var=#qDecoration#/>--->
|
||||
|
||||
<cfoutput>#markup#</cfoutput>
|
||||
|
||||
<layout:page section="footer"/>
|
269
specification_version.cfm
Normal file
269
specification_version.cfm
Normal file
@ -0,0 +1,269 @@
|
||||
<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>
|
||||
|
||||
<!--- Синтетическая версия спецификации (отчет). Не подразумевает сохранения --->
|
||||
<cfparam name="specification_id" type="integer"/>
|
||||
<cfparam name="agreement_version" type="integer"/>
|
||||
<m:prepare_detail entity="specification" accessObject="undefined" key="specification_id" pageInfoOut="pageInfo"/>
|
||||
|
||||
<d:bean readonly=true table="specification" datasource="#request.DS#" output="d" status="status">
|
||||
<d:param field="specification_id" type="integer" key autoincrement/>
|
||||
<d:param field="contract_id" type="integer" forNull=""/>
|
||||
<d:param field="specification" type="varchar" size="255" preprocessor=#cleanInput#/>
|
||||
<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.specification_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 #pageInfo.entity# 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.#pageInfo.key#=<cfqueryparam attributeCollection=#id#/>
|
||||
</cfquery>
|
||||
|
||||
<cfquery name="qContract" datasource="#request.DS#">
|
||||
select d.contract_id, d.contract, d.dt_contract, c.contragent_id, c.contragent
|
||||
from contract d
|
||||
left outer join contragent c on (d.contragent_id=c.contragent_id)
|
||||
where d.contract_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.contract_id#"/>
|
||||
</cfquery>
|
||||
<cfquery name="qAgreement" datasource="#request.DS#">
|
||||
select a.agreement, a.agreement_version, a.dt_agreement
|
||||
from agreement a
|
||||
where a.contract_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.contract_id#"/>
|
||||
AND a.agreement_version=<cfqueryparam cfsqltype="cf_sql_integer" value="#agreement_version#" null=#!isValid('integer', agreement_version)#>
|
||||
</cfquery>
|
||||
|
||||
</m:silent><!---
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
---><layout:page section="header" pageInfo=#pageInfo#>
|
||||
<layout:attribute name="title">
|
||||
<cfoutput>
|
||||
Версия [#agreement_version#]
|
||||
спецификации
|
||||
<cfif d.specification_id GT 0>
|
||||
<b>#d.specification#</b>
|
||||
[#d.specification_id#]
|
||||
</cfif>
|
||||
</cfoutput>
|
||||
</layout:attribute>
|
||||
<layout:attribute name="controls">
|
||||
<button type="button" name="close" class="maincontrol" onClick="document.location.href='#tr.backUrl#'">
|
||||
Закрыть
|
||||
</button>
|
||||
</layout:attribute>
|
||||
|
||||
</layout:page>
|
||||
|
||||
<cfif status.errorState GT 0>
|
||||
<cfoutput><div class="err">#status.errorMessage#</div></cfoutput>
|
||||
</cfif>
|
||||
|
||||
<cfoutput>
|
||||
<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">
|
||||
#d.specification#
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Договор</div>
|
||||
<div class="td">
|
||||
#qContract.contragent# #qContract.contract# #dateFormat(qContract.dt_contract,'DD.MM.YYYY')#
|
||||
<cfif d.contract_id GT 0>
|
||||
<c:link_view_edit canWrite=#pageInfo.writePermitted()# entity="contract" id=#d.contract_id# fwx=#tr.fwx#/>
|
||||
</cfif>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Соглашение</div>
|
||||
<div class="td">
|
||||
<a href="argeement.cfm?contract_id=#d.contract_id#&agreement_version=#agreement_version#&#tr.fwx#">
|
||||
#qAgreement.agreement# [#qAgreement.agreement_version#] #dateFormat(qAgreement.dt_agreement,'DD.MM.YYYY')#
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Описание</div>
|
||||
<div class="td">
|
||||
#d.descr#
|
||||
</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>
|
||||
|
||||
Изменено
|
||||
#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_id GT 0>
|
||||
|
||||
<cfquery name="qItem" datasource="#request.DS#">
|
||||
select
|
||||
i.specification_item_uid
|
||||
,svc.svc_id
|
||||
,svc.svc
|
||||
,svc.code
|
||||
,s.specification_id
|
||||
,s.contract_id
|
||||
<!--- ,i.price*i.quantity as cost --->
|
||||
<!--- ,(select count(*) from svc_param sp where sp.svc_id=i.svc_id) as svc_param_count --->
|
||||
,(select siv.agreement_version from specification_item_version siv
|
||||
join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id)
|
||||
where siv.specification_item_uid=i.specification_item_uid AND a.is_actual
|
||||
order by siv.agreement_version desc limit 1) as agreement_version
|
||||
,(select a.agreement from specification_item_version siv
|
||||
join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id)
|
||||
where siv.specification_item_uid=i.specification_item_uid AND a.is_actual
|
||||
order by siv.agreement_version desc limit 1) as agreement
|
||||
,(select a.dt_agreement from specification_item_version siv
|
||||
join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id)
|
||||
where siv.specification_item_uid=i.specification_item_uid AND a.is_actual
|
||||
order by siv.agreement_version desc limit 1) as dt_agreement
|
||||
,(select siv.specification_item_version from specification_item_version siv
|
||||
join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id)
|
||||
where siv.specification_item_uid=i.specification_item_uid AND a.is_actual
|
||||
order by siv.agreement_version desc limit 1) as specification_item
|
||||
,(select siv.quantity from specification_item_version siv
|
||||
join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id)
|
||||
where siv.specification_item_uid=i.specification_item_uid AND a.is_actual
|
||||
order by siv.agreement_version desc limit 1) as quantity
|
||||
,(select siv.price from specification_item_version siv
|
||||
join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id)
|
||||
where siv.specification_item_uid=i.specification_item_uid AND a.is_actual
|
||||
order by siv.agreement_version desc limit 1) as price
|
||||
,(select siv.dt_from from specification_item_version siv
|
||||
join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id)
|
||||
where siv.specification_item_uid=i.specification_item_uid AND a.is_actual
|
||||
order by siv.agreement_version desc limit 1) as dt_from
|
||||
,(select siv.dt_to from specification_item_version siv
|
||||
join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id)
|
||||
where siv.specification_item_uid=i.specification_item_uid AND a.is_actual
|
||||
order by siv.agreement_version desc limit 1) as dt_to
|
||||
,(select count(*) from specification_item_version siv where siv.specification_item_uid=i.specification_item_uid) as item_version_count
|
||||
from specification_item i
|
||||
join specification s on (i.specification_id=s.specification_id)
|
||||
--left outer join ()
|
||||
left outer join svc on (i.svc_id=svc.svc_id)
|
||||
where i.specification_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.specification_id#"/>
|
||||
order by 2
|
||||
</cfquery>
|
||||
|
||||
<cfoutput>
|
||||
<p>
|
||||
Строки спецификации (#qItem.recordCount#)
|
||||
<cfif pageInfo.writePermitted()>
|
||||
<cfoutput>
|
||||
<cfset addUrl="specification_item.cfm?specification_item_uid=&specification_id=#d.specification_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>
|
||||
<th>Дата с</th>
|
||||
<th>Дата по</th>
|
||||
<th>Количество</th>
|
||||
<th>Цена</th>
|
||||
<th>Имя для печати</th>
|
||||
<!--- <th>Компонентов</th> --->
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<cfoutput query="qItem">
|
||||
<tr>
|
||||
<td>
|
||||
<c:link_view_edit canWrite=#pageInfo.writePermitted()# entity="specification_item" key="specification_item_uid" id=#specification_item_uid# fwx=#tr.fwx#/>
|
||||
</td>
|
||||
<td>#specification_item_uid#</td>
|
||||
<td>#svc#</td>
|
||||
<td>#code#</td>
|
||||
<td class="c">#item_version_count#</td>
|
||||
<td class="c"></td>
|
||||
<td><a href="agreement.cfm?contract_id=#contract_id#&agreement_version=#agreement_version#&#tr.fwx#">#agreement# #dateFormat(dt_agreement,'DD.MM.YYYY')#</td>
|
||||
<td class="c"><a href="specification_item_version.cfm?specification_item_uid=#specification_item_uid#&agreement_version=#agreement_version#&#tr.fwx#">#agreement_version#</a></td>
|
||||
<td class="c">#dateFormat(dt_from,'DD.MM.YYYY')#</td>
|
||||
<td class="c">#dateFormat(dt_to,'DD.MM.YYYY')#</td>
|
||||
<td class="r">#quantity#</td>
|
||||
<td class="r">#price#</td>
|
||||
<td>#specification_item#</td>
|
||||
<td class="c">
|
||||
<c:link_del canWrite=#pageInfo.writePermitted()# entity="specification_item" key="specification_item_uid" id=#specification_item_uid# fwx=#tr.fwx#/>
|
||||
</td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
</table>
|
||||
|
||||
</cfif>
|
||||
|
||||
|
||||
<layout:page section="footer"/>
|
177
svc.cfm
Normal file
177
svc.cfm
Normal file
@ -0,0 +1,177 @@
|
||||
<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="svc" accessObject="" key="svc_id" pageInfoOut="pageInfo"/>
|
||||
|
||||
<d:bean readonly=#!pageInfo.writePermitted()# table="svc" datasource="#request.DS#" output="d" status="pageInfo.status">
|
||||
<d:param field="svc_id" type="integer" key /><!--- autoincrement --->
|
||||
<d:param field="svc" type="varchar" size="255" required preprocessor=#cleanInput#/>
|
||||
<d:param field="svc_short" type="varchar" size="255" required preprocessor=#cleanInput#/>
|
||||
<d:param field="code" type="varchar" size="255" preprocessor=#cleanInput#/>
|
||||
<d:param field="version" type="varchar" size="255" preprocessor=#cleanInput#/>
|
||||
<d:param field="orchestrator_name" type="varchar" size="255" required preprocessor=#cleanInput#/>
|
||||
<d:param field="is_production_ready" type="boolean" default="0"/>
|
||||
<d:param field="sort" type="integer" forNull=""/>
|
||||
<d:param field="descr" type="varchar" preprocessor=#plain2HtmClean#/>
|
||||
<d:param field="man" 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.svc_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 svc 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.svc_id=<cfqueryparam attributeCollection=#id#/>
|
||||
</cfquery>
|
||||
|
||||
|
||||
</m:silent><!---
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
---><layout:page section="header" pageInfo=#pageInfo#>
|
||||
<layout:attribute name="title">
|
||||
<cfoutput>
|
||||
Сервис
|
||||
<cfif d.svc_id GT 0>
|
||||
<b>#d.svc#</b>
|
||||
[#d.svc_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="svc_id" value="#d.svc_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">
|
||||
<input type="text" name="svc_id" value="#d.svc_id#" size="3"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Наименование *</div>
|
||||
<div class="td">
|
||||
<input type="text" name="svc" value="#d.svc#" size="70"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Сокращение *</div>
|
||||
<div class="td">
|
||||
<input type="text" name="svc_short" value="#d.svc_short#" size="70"/>
|
||||
<i>используется для формирования имени экземпляра</i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Имя для оркестратора *</div>
|
||||
<div class="td">
|
||||
<input type="text" name="orchestrator_name" value="#d.orchestrator_name#" size="30"/><i></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Код</div>
|
||||
<div class="td">
|
||||
<input type="text" name="code" value="#d.code#" size="70"/><i>код по каталогу (сопоставление модификатора с параметрами - открытый вопрос)</i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Версия</div>
|
||||
<div class="td">
|
||||
<input type="text" name="version" value="#d.version#" size="10"/><i></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Production Ready</div>
|
||||
<div class="td">
|
||||
<input type="checkbox" name="is_production_ready" value="1"<cfif d.is_production_ready GT 0> checked</cfif>/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Сортировка</div>
|
||||
<div class="td"><input type="text" name="sort" value="#d.sort#" size="3"/><i>порядок вывода в форме, целое число, рекомендуется через 10</i></div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Описание</div>
|
||||
<div class="td">
|
||||
<textarea name="descr" rows="5" cols="100">#request.htm2plain(d.descr)#</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Руководство</div>
|
||||
<div class="td">
|
||||
<textarea name="man" rows="5" cols="100">#request.htm2plain(d.man)#</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>
|
||||
|
||||
Изменено
|
||||
#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"/>
|
||||
|
||||
|
||||
|
||||
<layout:page section="footer"/>
|
133
svc_ls.cfm
Normal file
133
svc_ls.cfm
Normal file
@ -0,0 +1,133 @@
|
||||
<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="hideNonPositive">
|
||||
<cfargument name="a"/>
|
||||
<cfreturn (a GT 0)? a : ""/>
|
||||
</cffunction>
|
||||
|
||||
<m:prepare_ls entity="svc" accessObject="" pageInfoOut="pageInfo" trackOut="tr"/>
|
||||
|
||||
<cftry>
|
||||
<cfquery name="qRead" datasource="#request.DS#">
|
||||
select
|
||||
<d:field_set titleMapOut="titleMap" lengthOut="fieldCount">
|
||||
<d:field title="ID" cfSqlType="CF_SQL_INTEGER">s.svc_id</d:field>
|
||||
<d:field title="Наименование">s.svc</d:field>
|
||||
<d:field title="Сокращение">s.svc_short</d:field>
|
||||
<d:field title="Имя для оркестратора">s.orchestrator_name</d:field>
|
||||
<d:field title="Код">s.code</d:field>
|
||||
<d:field title="Production Ready">s.is_production_ready</d:field>
|
||||
<d:field title="Описание">s.descr</d:field>
|
||||
<d:field title="v">s.version</d:field>
|
||||
<d:field title="Sort">s.sort</d:field>
|
||||
<d:field title="Экземпляров">(select count(*) from specification_item i where i.svc_id=s.svc_id) as spec_cnt</d:field>
|
||||
</d:field_set>
|
||||
from svc s
|
||||
where 1=1 <m:filter_build filter=#pageInfo.settings.filter#/>
|
||||
order by <m:order_build sortArray=#pageInfo.settings.sort.sortArray# fieldCount=#fieldCount#/>
|
||||
</cfquery>
|
||||
|
||||
|
||||
<cfcatch type="database">
|
||||
<!--- <cfrethrow/> --->
|
||||
<m:ls_catch catch=#cfcatch# status=#pageInfo.status#/>
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
|
||||
<cfquery name="qCountTotal" datasource="#request.DS#">
|
||||
select count(*) as cnt from svc 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:attribute name="controls">
|
||||
<!---skip filter link, filter is not implemented--->
|
||||
<!---<layout:language_switch/>--->
|
||||
</layout:attribute>
|
||||
</layout:page>
|
||||
|
||||
<cfif pageInfo.readPermitted() AND !pageInfo.status.errorState>
|
||||
|
||||
<layout:grid_summary
|
||||
recordCount=#qRead.recordCount#
|
||||
totalCount=#qCountTotal.cnt#
|
||||
footerOut="gridFooter"
|
||||
excelLink="Yes"
|
||||
jsonLink="Yes"
|
||||
/>
|
||||
|
||||
|
||||
<!--- так довольно громоздко, но можно обойтись без Dynamic Evaluation --->
|
||||
<cfset queryAddColumn(qRead,'f_link_view_edit')/>
|
||||
<cfset titleMap.f_link_view_edit={ordinal=#StructCount(titleMap)+1#}/><!--- *** Это легко забыть, потому что TitleMap никак не сцеплен с qRead. Напрашивается: упаковать их в одну обертку (но тогда обращение станет длиннее). Еще идея - назвать qRead и TitleMap так, чтобы была видна их связь. --->
|
||||
<!--- <cfdump var=#titleMap#/> --->
|
||||
<cfset queryAddColumn(qRead,'f_link_del')/>
|
||||
<cfset titleMap.f_link_del={ordinal=0}/>
|
||||
|
||||
<cfset queryAddColumn(qRead,'f_is_production_ready')/>
|
||||
<cfset titleMap.f_is_production_ready=titleMap.is_production_ready/>
|
||||
|
||||
<cfset queryAddColumn(qRead,'f_svc')/>
|
||||
<cfset titleMap.f_svc=titleMap.svc/>
|
||||
|
||||
|
||||
<cfoutput query=#qRead# startRow=#pageInfo.nStart# maxRows=#pageInfo.recordsPerPage#><!--- *** Здесь некомфортное дублирование startRow, maxRows с вызовом c:table ниже, причем в c:table оно закопано в модуль, и аргументы называются по-разному... но мы хотим немного сэкономить и не обрабатывать весь резалтсет --->
|
||||
<cfsavecontent variable="qRead.f_link_view_edit">
|
||||
<a href="#pageInfo.entity#.cfm?#pageInfo.entity#_id=#svc_id#&#tr.fwx#" name="#svc_id#" <cfif pageInfo.writePermitted()>title="редактировать" class="edit"<cfelse>title="просмотр" class="view"</cfif>></a>
|
||||
</cfsavecontent>
|
||||
|
||||
<cfsavecontent variable="qRead.f_link_del">
|
||||
<cfif pageInfo.writePermitted()><a href="#pageInfo.entity#_del.cfm?#pageInfo.entity#_id=#svc_id#&#tr.fwx#" name="#svc_id#" class="del" title="удалить"></a></cfif>
|
||||
</cfsavecontent>
|
||||
|
||||
<cfsavecontent variable="qRead.f_is_production_ready">
|
||||
<cfif is_production_ready GT 0><img src="img/ok.png"/></cfif>
|
||||
</cfsavecontent>
|
||||
|
||||
<cfsavecontent variable="qRead.f_svc">
|
||||
<a href="#pageInfo.entity#.cfm?#pageInfo.entity#_id=#svc_id#&#tr.fwx#">#svc#</a>
|
||||
</cfsavecontent>
|
||||
</cfoutput>
|
||||
|
||||
<c:table query=#qRead# recordsPerPage=#pageInfo.recordsPerPage# nStart=#pageInfo.nStart# titleMap=#titleMap# sortArray=#pageInfo.settings.sort.sortArray# class="worktable wide">
|
||||
<c:column width="1%" sortable="false"><!---*** class="c" не пробрасывается --->
|
||||
<c:th><c:link_add canWrite=#pageInfo.writePermitted()# entity=#pageInfo.entity# fwx=#tr.fwx#/></c:th>
|
||||
<c:td field="f_link_view_edit" class="c"/>
|
||||
</c:column>
|
||||
<c:column width="3%" field="svc_id"/>
|
||||
<c:column width="5%" field="f_svc"/>
|
||||
<c:column width="5%" field="svc_short"/>
|
||||
<c:column width="2%" field="f_is_production_ready"><c:td class="c"/></c:column>
|
||||
<c:column width="5%" field="code"/>
|
||||
<c:column width="2%" field="version"/>
|
||||
<c:column width="3%" field="sort"/>
|
||||
<c:column width="20%" field="descr"/>
|
||||
<c:column width="5%" field="spec_cnt" formatter=#hideNonPositive#><c:td class="c"/></c:column>
|
||||
<c:column width="1%" sortable="false">
|
||||
<c:td field="f_link_del" class="c"/>
|
||||
</c:column>
|
||||
</c:table>
|
||||
|
||||
<cfoutput>#gridFooter#</cfoutput>
|
||||
|
||||
</cfif>
|
||||
<layout:page section="footer"/>
|
Loading…
Reference in New Issue
Block a user