intermediate draft 5
This commit is contained in:
+123
-10
@@ -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>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user