agreement list added
This commit is contained in:
+84
-40
@@ -39,7 +39,9 @@
|
||||
status=#pageInfo.status#
|
||||
trackOut="tr"
|
||||
idAttributesOut="id"
|
||||
queryString="specification_id=#specification_id#&agreement_version=#agreement_version#"
|
||||
/>
|
||||
<!--- <cfdump var=#tr#/> --->
|
||||
|
||||
<!--- decoration --->
|
||||
<cfquery name="qDecoration" datasource="#request.DS#">
|
||||
@@ -57,13 +59,30 @@
|
||||
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
|
||||
select a.agreement, a.agreement_version, a.dt_agreement, a.is_actual
|
||||
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>
|
||||
|
||||
<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#"/>
|
||||
order by a.agreement_version
|
||||
</cfquery>
|
||||
|
||||
</m:silent><!---
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -82,9 +101,11 @@
|
||||
</cfoutput>
|
||||
</layout:attribute>
|
||||
<layout:attribute name="controls">
|
||||
<cfoutput>
|
||||
<button type="button" name="close" class="maincontrol" onClick="document.location.href='#tr.backUrl#'">
|
||||
Закрыть
|
||||
</button>
|
||||
</cfoutput>
|
||||
</layout:attribute>
|
||||
|
||||
</layout:page>
|
||||
@@ -102,9 +123,9 @@
|
||||
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Спецификация (номер)</div>
|
||||
<div class="th">Спецификация</div>
|
||||
<div class="td">
|
||||
#d.specification#
|
||||
#d.specification# [#d.specification_id#]
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -144,6 +165,20 @@
|
||||
#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 class="tr">
|
||||
<div class="th">Версии</div>
|
||||
<div class="td">
|
||||
<cfoutput query=#qVersion#>
|
||||
<cfif qVersion.agreement_version EQ qAgreement.agreement_version>
|
||||
<b>#agreement_version#</b>
|
||||
<cfelse>
|
||||
<a href="specification_version.cfm?specification_id=#specification_id#&agreement_version=#agreement_version#&track=#tr.self#">#agreement_version#</a>
|
||||
</cfif>
|
||||
|
||||
</cfoutput>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -156,55 +191,62 @@
|
||||
|
||||
<cfquery name="qItem" datasource="#request.DS#">
|
||||
select
|
||||
i.specification_item_uid
|
||||
i.specification_item_uid::text as 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
|
||||
,ver.agreement_version
|
||||
,ver.specification_item_uid
|
||||
,ver.agreement
|
||||
,ver.dt_agreement
|
||||
,ver.is_actual
|
||||
,ver.specification_item_version as specification_item
|
||||
,ver.quantity
|
||||
,ver.price
|
||||
,ver.dt_from
|
||||
,ver.dt_to
|
||||
from specification_item i
|
||||
join specification s on (i.specification_id=s.specification_id)
|
||||
--left outer join ()
|
||||
join (select
|
||||
siv.agreement_version
|
||||
,siv.specification_item_uid
|
||||
,a.agreement
|
||||
,a.contract_id
|
||||
,a.dt_agreement
|
||||
,a.is_actual
|
||||
,siv.specification_item_version
|
||||
,siv.quantity
|
||||
,siv.price
|
||||
,siv.dt_from
|
||||
,siv.dt_to
|
||||
,ii1.specification_id
|
||||
from specification_item_version siv
|
||||
join specification_item ii1 on (siv.specification_item_uid=ii1.specification_item_uid)
|
||||
join specification is1 on (ii1.specification_id=is1.specification_id)
|
||||
join agreement a on (siv.agreement_version=a.agreement_version AND is1.contract_id=a.contract_id)
|
||||
where a.agreement_version = (select max(iiv.agreement_version)
|
||||
from specification_item_version iiv
|
||||
join specification_item ii on (iiv.specification_item_uid=ii.specification_item_uid)
|
||||
join specification isp on (ii.specification_id=isp.specification_id)
|
||||
join agreement ia on (isp.contract_id=ia.contract_id AND iiv.agreement_version=ia.agreement_version)
|
||||
where iiv.specification_item_uid=siv.specification_item_uid
|
||||
<!--- <cfif qAgreement.is_actual GT 0> --->
|
||||
AND ia.is_actual
|
||||
<!--- </cfif> --->
|
||||
AND ia.agreement_version <= <cfqueryparam cfsqltype="cf_sql_integer" value="#agreement_version#"/>
|
||||
)
|
||||
) ver on (i.specification_item_uid=ver.specification_item_uid AND s.contract_id=ver.contract_id AND ver.specification_id=s.specification_id)
|
||||
|
||||
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>
|
||||
|
||||
<!--- <cfdump var=#qItem#/> --->
|
||||
|
||||
<cfoutput>
|
||||
<p>
|
||||
Строки спецификации (#qItem.recordCount#)
|
||||
@@ -250,7 +292,7 @@
|
||||
<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"><a href="specification_item_version.cfm?specification_item_uid=#specification_item_uid#&agreement_version=#qItem.agreement_version#&#tr.fwx#">#qItem.agreement_version#</a> <cfif is_actual><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">#quantity#</td>
|
||||
@@ -262,6 +304,8 @@
|
||||
</tr>
|
||||
</cfoutput>
|
||||
</table>
|
||||
<br/>
|
||||
учитываются только действующие соглашения
|
||||
|
||||
</cfif>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user