019 some version navigation

This commit is contained in:
msyu
2025-08-29 23:46:53 +03:00
parent 791a652a9b
commit db421e12fd
4 changed files with 255 additions and 76 deletions
+1 -1
View File
@@ -99,7 +99,7 @@
<cfset request.RECORDS_PER_PAGE=500/> <cfset request.RECORDS_PER_PAGE=500/>
<cfset request.APP_VERSION="0.00.018"/> <cfset request.APP_VERSION="0.00.019"/>
<cfset request.STAND=getStand()/> <cfset request.STAND=getStand()/>
<cflock scope="application" type="readonly" timeout=3> <cflock scope="application" type="readonly" timeout=3>
+12 -7
View File
@@ -58,7 +58,7 @@
,k.id_klienta as wz ,k.id_klienta as wz
from elma.aggrements c from elma.aggrements c
left outer join elma.companies k on (c.company_uid=k.__id) left outer join elma.companies k on (c.company_uid=k.__id)
where c.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.contract_uid#/> where c.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.contract_uid# null=#!isValid("guid",d.contract_uid)#/>
</cfquery> </cfquery>
@@ -126,7 +126,7 @@
from elma.additional_agreements a from elma.additional_agreements a
left outer join elma.deals d on (a.deal_uid=d.__id) left outer join elma.deals d on (a.deal_uid=d.__id)
left outer join s on (d.__status_status=s.status_id) left outer join s on (d.__status_status=s.status_id)
where a.contract_uid=<cfqueryparam cfsqltype="cf_sql_other" value=#d.contract_uid#/> where a.contract_uid=<cfqueryparam cfsqltype="cf_sql_other" value=#d.contract_uid# null=#!isValid("guid",d.contract_uid)#/>
order by index order by index
</cfquery> </cfquery>
<cfloop query=#qVer#> <cfloop query=#qVer#>
@@ -143,9 +143,12 @@
<div class="tr"> <div class="tr">
<div class="th">Договор</div> <div class="th">Договор</div>
<div class="td"><a href="contract.cfm?__id=#d.contract_uid#&#tr.fwx#"><b>#qDecoration.contract#</b> #dateFormat(qDecoration.date_of_aggrement,'DD.MM.YYYY')# <div class="td">
<cfif len(d.contract_uid)>
<a href="contract.cfm?__id=#d.contract_uid#&#tr.fwx#"><b>#qDecoration.contract#</b> #dateFormat(qDecoration.date_of_aggrement,'DD.MM.YYYY')#
[#d.contract_uid#]</a> [#d.contract_uid#]</a>
#qDecoration.contragent# #qDecoration.wz# #qDecoration.contragent# #qDecoration.wz#
</cfif>
</div> </div>
</div> </div>
@@ -162,6 +165,7 @@
<div class="tr"> <div class="tr">
<div class="th">Сделка</div> <div class="th">Сделка</div>
<div class="td"> <div class="td">
<cfif len(d.deal_uid)>
<a href="deal.cfm?__id=#d.deal_uid#&#tr.fwx#">#d.deal_uid#</a> <a href="deal.cfm?__id=#d.deal_uid#&#tr.fwx#">#d.deal_uid#</a>
<cfquery name="qDeal"> <cfquery name="qDeal">
with with
@@ -176,11 +180,12 @@
, s.probability_pc , s.probability_pc
from elma.deals d from elma.deals d
left outer join s on (d.__status_status=s.status_id) left outer join s on (d.__status_status=s.status_id)
where d.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.deal_uid#/> where d.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.deal_uid# null=#!isValid("guid",d.deal_uid)#/>
</cfquery> </cfquery>
#qDeal.__name# #qDeal.__name#
(#qDeal.status#: (#qDeal.status#:
#qDeal.probability_pc#%) #qDeal.probability_pc#%)
</cfif>
</div> </div>
</div> </div>
@@ -190,7 +195,7 @@
<cfquery name="qService_"> <cfquery name="qService_">
select services_::text select services_::text
from elma.additional_agreements a from elma.additional_agreements a
where a.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.__id#/> where a.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.__id# null=#!isValid("guid",d.__id)#/>
</cfquery> </cfquery>
#qService_.services_# (обратная ссылка) #qService_.services_# (обратная ссылка)
</div> </div>
@@ -204,7 +209,7 @@
, b.__name , b.__name
from elma.additional_agreements a from elma.additional_agreements a
join elma.additional_agreements b on (b.__id = ANY(a.base_by)) join elma.additional_agreements b on (b.__id = ANY(a.base_by))
where a.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.__id#/> where a.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.__id# null=#!isValid("guid",d.__id)#/>
</cfquery> </cfquery>
<a href="additional_agreement.cfm?__id=#qBaseBy.__id#&#tr.fwx#">#qBaseBy.__id#</a> <a href="additional_agreement.cfm?__id=#qBaseBy.__id#&#tr.fwx#">#qBaseBy.__id#</a>
#qBaseBy.__name# #qBaseBy.__name#
@@ -239,7 +244,7 @@
,siv.is_easy ,siv.is_easy
,siv.params::text ,siv.params::text
from elma.deals_services siv from elma.deals_services siv
where <cfqueryparam cfsqltype="cf_sql_other" value="#d.__id#"/>=ANY(siv.additional_agreement) where <cfqueryparam cfsqltype="cf_sql_other" value="#d.__id#" null=#!isValid("guid",d.__id)#/>=ANY(siv.additional_agreement)
order by type order by type
</cfquery> </cfquery>
+9 -7
View File
@@ -76,7 +76,7 @@
left outer join elma.companies k on (d._companies=k.__id) left outer join elma.companies k on (d._companies=k.__id)
left outer join elma.comp_users_ext c on (d._owner=c.__id) left outer join elma.comp_users_ext c on (d._owner=c.__id)
left outer join s on (d.__status_status=s.status_id) left outer join s on (d.__status_status=s.status_id)
where d.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.__id#/> where d.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.__id# null=#!isValid("guid",d.__id)#/>
</cfquery> </cfquery>
@@ -157,7 +157,7 @@
,g.date_of_aggrement ,g.date_of_aggrement
from elma.additional_agreements a from elma.additional_agreements a
join elma.aggrements g on (a.contract_uid=g.__id) join elma.aggrements g on (a.contract_uid=g.__id)
where a.deal_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#d.__id#"/> where a.deal_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#d.__id#" null=#!isValid("guid",d.__id)#/>
</cfquery> </cfquery>
<cfloop query=#qAgreement#> <cfloop query=#qAgreement#>
<a href="additional_agreement.cfm?__id=#__id#&#tr.fwx#" title="доп.соглашение">#__name#</a> <a href="additional_agreement.cfm?__id=#__id#&#tr.fwx#" title="доп.соглашение">#__name#</a>
@@ -242,7 +242,7 @@
) as param_cnt ) as param_cnt
from elma.deals_services siv from elma.deals_services siv
left outer join elma.additional_agreements a on (a.__id=ANY(siv.additional_agreement)) left outer join elma.additional_agreements a on (a.__id=ANY(siv.additional_agreement))
where <cfqueryparam cfsqltype="cf_sql_other" value="#d.__id#"/>=ANY(siv.deal) where <cfqueryparam cfsqltype="cf_sql_other" value="#d.__id#" null=#!isValid("guid",d.__id)#/>=ANY(siv.deal)
and siv.is_actual and siv.is_actual
order by version::int order by version::int
</cfquery> </cfquery>
@@ -255,11 +255,12 @@
<table class="worktable"> <table class="worktable">
<thead> <thead>
<tr> <tr>
<th>__id</th> <th>__index</th>
<!--- <th>__name</th> ---> <!--- <th>__name</th> --->
<th>user_description</th> <th>user_description</th>
<th>Кол-во</th> <th>Кол-во</th>
<th>Скидка%</th> <th>Скидка%</th>
<th width="5%">Сумма</th>
<th>abstractive_service_code</th> <th>abstractive_service_code</th>
<th>modifier_code</th> <th>modifier_code</th>
<th>is_actual</th> <th>is_actual</th>
@@ -273,7 +274,7 @@
<th width="5%">date_end</th> <th width="5%">date_end</th>
<th>is_easy</th> <th>is_easy</th>
<th>Компонентов</th> <th>Компонентов</th>
<th width="5%">Сумма</th>
<!--- <th>additional_agreement_uid</th> ---> <!--- <th>additional_agreement_uid</th> --->
<th>additional_agreement</th> <th>additional_agreement</th>
</tr> </tr>
@@ -281,11 +282,12 @@
<cfoutput query="qService"> <cfoutput query="qService">
<tr> <tr>
<td class="c"><a href="deal_service.cfm?__id=#__id#&#tr.fwx#">#__id#</a></td> <td class="c"><a href="deal_service.cfm?__id=#__id#&#tr.fwx#" title="__id">#__index#</a></td>
<!--- <td class="c">#__name#</td> ---> <!--- <td class="c">#__name#</td> --->
<td class="c">#user_description#</td> <td class="c">#user_description#</td>
<td class="c">#cnt#</td> <td class="c">#cnt#</td>
<td class="c">#discount#</td> <td class="c">#discount#</td>
<td class="r">#nFmt(line_cost)#</td>
<td class="c">#abstractive_service_code#</td> <td class="c">#abstractive_service_code#</td>
<td class="c">#modifier_code#</td> <td class="c">#modifier_code#</td>
<td class="c">#is_actual#</td> <td class="c">#is_actual#</td>
@@ -299,7 +301,7 @@
<td class="c">#dateFormat(date_end,'YYYY-MM-DD')#</td> <td class="c">#dateFormat(date_end,'YYYY-MM-DD')#</td>
<td class="c"><cfif is_easy GT 0>Простая<cfelseif is_easy EQ 0>Композитная<cfelse>is_easy=#is_easy#</cfif></td> <td class="c"><cfif is_easy GT 0>Простая<cfelseif is_easy EQ 0>Композитная<cfelse>is_easy=#is_easy#</cfif></td>
<td class="c">#param_cnt#</td> <td class="c">#param_cnt#</td>
<td class="r">#nFmt(line_cost)#</td>
<!--- <td class="c">#additional_agreement_uid#</td> ---> <!--- <td class="c">#additional_agreement_uid#</td> --->
<td class="c"><a href="additional_agreement.cfm?__id=#additional_agreement_uid#&#tr.fwx#">#additional_agreement#</a></td> <td class="c"><a href="additional_agreement.cfm?__id=#additional_agreement_uid#&#tr.fwx#">#additional_agreement#</a></td>
</tr> </tr>
+200 -28
View File
@@ -20,6 +20,7 @@
<d:bean readonly=true table="elma.deals_services" datasource="#request.DS#" output="d" status="status"> <d:bean readonly=true table="elma.deals_services" datasource="#request.DS#" output="d" status="status">
<d:param field="__id" type="uuid" key/> <d:param field="__id" type="uuid" key/>
<d:param field="__name" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/> <d:param field="__name" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/>
<d:param field="__index" type="integer" forNull=""/>
<d:param field="user_description" type="varchar" preprocessor=#plain2HtmClean# forNull=""/> <d:param field="user_description" type="varchar" preprocessor=#plain2HtmClean# forNull=""/>
<d:param field="modifier" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/> <d:param field="modifier" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/>
<d:param field="modifier_code" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/> <d:param field="modifier_code" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/>
@@ -51,16 +52,12 @@
/> />
<!--- decoration ---> <!--- decoration --->
<!--- <cfquery name="qDecoration" datasource="#request.DS#"> <cfquery name="qDecoration" datasource="#request.DS#">
select select
c.__name as contract ds."__createdAt"
,c.date_of_aggrement from elma.deals_services ds
,c.date_end_aggrement where ds.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.__id# null=#!isValid("guid",d.__id)#/>
,k.__name as contragent </cfquery>
from elma.aggrements c
left outer join elma.companies k on (c.company_uid=k.__id)
where c.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.contract_uid#/>
</cfquery> --->
</m:silent><!--- </m:silent><!---
@@ -94,7 +91,18 @@
<div class="tr"> <div class="tr">
<div class="th">__id</div> <div class="th">__id</div>
<div class="td">#d.__id#</div> <div class="td">
#d.__id#
&nbsp; &nbsp; &nbsp;
<span style="background-color:##e0e0e0">__index </span> #d.__index#
&nbsp; &nbsp; &nbsp;
<span style="background-color:##e0e0e0">__createdAt </span> #dateTimeFormat(qDecoration.__createdAt,"yyyy-MM-dd HH:nn:ss.SSSZ")#
</div>
</div>
<div class="tr">
<div class="th"></div>
<div class="td"></div>
</div> </div>
<div class="tr"> <div class="tr">
@@ -136,7 +144,7 @@
,sum(siv.cnt*(100-COALESCE(siv.discount,0))/100*p.price*p.cnt*(100-COALESCE(p.discount,0))/100) as line_cost ,sum(siv.cnt*(100-COALESCE(siv.discount,0))/100*p.price*p.cnt*(100-COALESCE(p.discount,0))/100) as line_cost
from elma.service_parametrs p from elma.service_parametrs p
join elma.deals_services siv on (p.__id = ANY (siv.params)) join elma.deals_services siv on (p.__id = ANY (siv.params))
where siv.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.__id#/> where siv.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.__id# null=#!isValid("guid",d.__id)#/>
</cfquery> </cfquery>
<b>#nFmt(qParamCost.line_cost)#</b> по строке, с количеством и скидкой (<b>#nFmt(qParamCost.param_cost)#</b> по компонентам) <b>#nFmt(qParamCost.line_cost)#</b> по строке, с количеством и скидкой (<b>#nFmt(qParamCost.param_cost)#</b> по компонентам)
</div> </div>
@@ -144,8 +152,49 @@
<div class="tr"> <div class="tr">
<div class="th">Версия</div> <div class="th">Версия</div>
<div class="td">#d.version# <div class="td">
#d.version# <i>вообще не понимаю, какой смысл вкладывается в эту цифру...</i>
</div>
</div>
<div class="tr">
<div class="th">Версии</div>
<div class="td">
<cfquery name="qV">
with
status(status, status_id, probability_pc) as (VALUES
('Закрыта неуспешно',7,0),('Закрыта успешно',6,100),('Договор подписан',5,100),('Договор на подписании',15,90),('Договор на согласовании',12,70),
('Тестирование',8,50),('Отправлено ТКП',10,20),('Внутреннее согласование',37,10),('Проработка решения',4,10),('Сбор потребностей',1,0)
)
select siv.__id::text, siv.__index, siv.version
, siv.date_nop, siv.date_end, siv.user_description
, siv.type, siv.is_easy, siv.cnt, siv.discount
, siv.is_actual, siv."__createdAt"
, d.__id::text as deal_uid, d.__index as deal_index, d.__name as deal, d.__status_status
, a.__id::text as aa_uid, a.index as aa_version, a.__name as additional_agreement
, status.status, status.probability_pc
,(select
sum(siv.cnt*(100-COALESCE(siv.discount,0))/100*p.price*p.cnt*(100-COALESCE(p.discount,0))/100)
from elma.service_parametrs p
where p.__id = ANY (siv.params)
) as line_cost
from elma.deals_services siv
left outer join elma.additional_agreements a on (a.__id = ANY(siv.additional_agreement))
join elma.deals d on (d.__id = ANY(siv.deal))
left outer join status on (d.__status_status = status.status_id)
where hash=<cfqueryparam cfsqltype="cf_sql_varchar" value=#d.hash#/>
AND siv.is_actual
order by siv.__index, siv.version
</cfquery>
<cfloop query=#qV#>
<cfif __id EQ toString(d.__id)>
<b>#aa_version#:#version#[#__index#]</b>
<cfelse>
<a href="deal_service.cfm?__id=#__id#&#tr.fwx#">#aa_version#:#version#[#__index#]</a>
</cfif>
</cfloop>
(только актуальные и со сделкой)
</div> </div>
</div> </div>
@@ -187,14 +236,16 @@
join elma.deals d on (d.__id = ANY(siv.deal)) join elma.deals d on (d.__id = ANY(siv.deal))
left outer join elma.companies c on (d._companies=c.__id) left outer join elma.companies c on (d._companies=c.__id)
left outer join s on (d.__status_status=s.status_id) left outer join s on (d.__status_status=s.status_id)
where siv.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.__id#/> where siv.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.__id# null=#!isValid("guid",d.__id)#/>
</cfquery> </cfquery>
<!--- <cfdump var=#qDeal#/> ---> <!--- <cfdump var=#qDeal#/> --->
<cfif qDeal.recordCount>
<a href="deal.cfm?__id=#qDeal.__id#&#tr.fwx#">#qDeal.__id#</a> <a href="deal.cfm?__id=#qDeal.__id#&#tr.fwx#">#qDeal.__id#</a>
#qDeal.contragent# | #qDeal.wz# | #qDeal.contragent# | #qDeal.wz# |
#qDeal.__name# | #qDeal.__name# |
_plannedDueDate: <cfif len(qDeal._plannedDueDate)><b>#dateFormat(qDeal._plannedDueDate,'DD.MM.YYYY')#</b><cfelse>--</cfif> _plannedDueDate: <cfif len(qDeal._plannedDueDate)><b>#dateFormat(qDeal._plannedDueDate,'DD.MM.YYYY')#</b><cfelse>--</cfif>
<b>#qDeal.__status_status#: #qDeal.status# (#qDeal.probability_pc#%)</b> <b>#qDeal.__status_status#: #qDeal.status# (#qDeal.probability_pc#%)</b>
</cfif>
</div> </div>
</div> </div>
@@ -218,14 +269,16 @@
join elma.additional_agreements b on (b.__id = ANY(a.base_by)) join elma.additional_agreements b on (b.__id = ANY(a.base_by))
left outer join elma.aggrements c on (a.contract_uid=c.__id) left outer join elma.aggrements c on (a.contract_uid=c.__id)
left outer join elma.companies z on (c.company_uid=z.__id) left outer join elma.companies z on (c.company_uid=z.__id)
where siv.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.__id#/> where siv.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.__id# null=#!isValid("guid",d.__id)#/>
</cfquery> </cfquery>
<!--- <cfdump var=#qAdditionalAgreement#/> ---> <!--- <cfdump var=#qAdditionalAgreement#/> --->
<cfif len(qAdditionalAgreement.__id)>
<a href="additional_agreement.cfm?__id=#qAdditionalAgreement.__id#&#tr.fwx#">#qAdditionalAgreement.__id#</a> #qAdditionalAgreement.contragent# #qAdditionalAgreement.wz# <a href="additional_agreement.cfm?__id=#qAdditionalAgreement.__id#&#tr.fwx#">#qAdditionalAgreement.__id#</a> #qAdditionalAgreement.contragent# #qAdditionalAgreement.wz#
#qAdditionalAgreement.contract# #qAdditionalAgreement.additional_agreement# #qAdditionalAgreement.contract# #qAdditionalAgreement.additional_agreement#
is_actual: <b>#qAdditionalAgreement.is_actual#</b> is_actual: <b>#qAdditionalAgreement.is_actual#</b>
last_aa: <b>#qAdditionalAgreement.last_aa#</b> last_aa: <b>#qAdditionalAgreement.last_aa#</b>
base_by: <a href="additional_agreement.cfm?__id=#qAdditionalAgreement.base_by_uid#&#tr.fwx#">#qAdditionalAgreement.base_by_uid#</a> base_by: <a href="additional_agreement.cfm?__id=#qAdditionalAgreement.base_by_uid#&#tr.fwx#">#qAdditionalAgreement.base_by_uid#</a>
</cfif>
</div> </div>
</div> </div>
@@ -238,7 +291,7 @@
<cfquery name="qParam"> <cfquery name="qParam">
select params::text select params::text
from elma.deals_services siv from elma.deals_services siv
where siv.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.__id#/> where siv.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.__id# null=#!isValid("guid",d.__id)#/>
</cfquery> </cfquery>
#qParam.params# (обратная ссылка) #qParam.params# (обратная ссылка)
</div> </div>
@@ -261,6 +314,7 @@
<cfquery name="qParam"> <cfquery name="qParam">
select select
p.__id p.__id
,p.__index
,p.__name ,p.__name
,p.type ,p.type
,p.price ,p.price
@@ -274,7 +328,7 @@
,(p.price*p.cnt*(100-COALESCE(p.discount,0))/100) as param_cost ,(p.price*p.cnt*(100-COALESCE(p.discount,0))/100) as param_cost
from elma.service_parametrs p from elma.service_parametrs p
join elma.deals_services siv on (p.__id = ANY (siv.params)) join elma.deals_services siv on (p.__id = ANY (siv.params))
where siv.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.__id#/> where siv.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.__id# null=#!isValid("guid",d.__id)#/>
order by type order by type
</cfquery> </cfquery>
<cfquery name="qParamTotal" dbtype="query"> <cfquery name="qParamTotal" dbtype="query">
@@ -291,24 +345,24 @@
<table class="worktable"> <table class="worktable">
<thead> <thead>
<tr> <tr>
<th>__id</th> <th>__index</th>
<!--- <th>__name</th> ---> <!--- <th>__name</th> --->
<th>type</th> <th>type</th>
<th>code</th> <th>code</th>
<th>name</th> <th>name</th>
<th>cnt</th> <th>Кол-во</th>
<th>ed_izm</th> <th>Ед.изм.</th>
<th>price</th> <th>Цена</th>
<th>Скидка %</th> <th>Скидка %</th>
<th>Ст-ть</th> <th>Ст-ть</th>
<th>deal</th> <!--- <th>deal</th> --->
<th>__index</th> <th>__id</th>
</tr> </tr>
</thead> </thead>
<cfoutput query="qParam"> <cfoutput query="qParam">
<tr> <tr>
<td class="c">#__id#</td> <td class="c">#__index#</td>
<!--- <td class="c">#__name#</td> ---> <!--- <td class="c">#__name#</td> --->
<td class="c">#type#</td> <td class="c">#type#</td>
<td class="c">#code#</td> <td class="c">#code#</td>
@@ -318,8 +372,8 @@
<td class="r">#price#</td> <td class="r">#price#</td>
<td class="c">#discount#</td> <td class="c">#discount#</td>
<td class="r">#nFmt(param_cost)#</td> <td class="r">#nFmt(param_cost)#</td>
<td class="c">#deal#</td> <!--- <td class="c">#deal#</td> --->
<td class="c">#__index#</td> <td class="c">#__id#</td>
</tr> </tr>
</cfoutput> </cfoutput>
<cfoutput query="qParamTotal"> <cfoutput query="qParamTotal">
@@ -334,17 +388,135 @@
<cfquery name="qVer"> <cfquery name="qVer">
select __id::text, __index, version, date_nop, date_end, user_description, type, is_easy, cnt, discount, is_actual with
status(status, status_id, probability_pc) as (VALUES
('Закрыта неуспешно',7,0),('Закрыта успешно',6,100),('Договор подписан',5,100),('Договор на подписании',15,90),('Договор на согласовании',12,70),
('Тестирование',8,50),('Отправлено ТКП',10,20),('Внутреннее согласование',37,10),('Проработка решения',4,10),('Сбор потребностей',1,0)
)
select siv.__id::text, siv.__index, siv.version
, siv.date_nop, siv.date_end, siv.user_description
, siv.type, siv.is_easy, siv.cnt, siv.discount
, siv.is_actual, siv."__createdAt"
, d.__id::text as deal_uid, d.__index as deal_index, d.__name as deal, d.__status_status
, a.__id::text as aa_uid, a.index as aa_version, a.__name as additional_agreement
, status.status, status.probability_pc
,(select ,(select
sum(siv.cnt*(100-COALESCE(siv.discount,0))/100*p.price*p.cnt*(100-COALESCE(p.discount,0))/100) sum(siv.cnt*(100-COALESCE(siv.discount,0))/100*p.price*p.cnt*(100-COALESCE(p.discount,0))/100)
from elma.service_parametrs p from elma.service_parametrs p
where p.__id = ANY (siv.params) where p.__id = ANY (siv.params)
) as line_cost ) as line_cost
from elma.deals_services siv from elma.deals_services siv
left outer join elma.additional_agreements a on (a.__id = ANY(siv.additional_agreement))
left outer join elma.deals d on (d.__id = ANY(siv.deal))
left outer join status on (d.__status_status = status.status_id)
where hash=<cfqueryparam cfsqltype="cf_sql_varchar" value=#d.hash#/> where hash=<cfqueryparam cfsqltype="cf_sql_varchar" value=#d.hash#/>
order by __index, version order by siv.__index, siv.version
</cfquery> </cfquery>
<cfdump var=#qVer#/>
<cfquery name="qVerActual" dbtype="query">
select * from qVer where is_actual > 0
</cfquery>
<cfoutput>
<h4>Версии строки (без черновиков) (#qVerActual.recordCount#)</h4>
</cfoutput>
<table class="worktable">
<thead>
<tr>
<th>Индекс версии</th>
<th>Создана</th>
<th>Версия доп.с.</th>
<th>Версия строки</th>
<th>is_actual</th>
<th>НОУ</th>
<th>КОУ</th>
<th>User Description</th>
<th>type</th>
<th>Кол-во</th>
<th>Скидка%</th>
<th>Ст-ть</th>
<th>Сделка</th>
<th>Статус</th>
<th>Вер-ть</th>
<th>Доп.с.</th>
</tr>
</thead>
<cfoutput query="qVerActual">
<tr>
<td class="c"><a href="deal_service.cfm?__id=#__id#&#tr.fwx#" title="#__id#">#__index#</a></td>
<td class="c">#dateFormat(__createdAt,"YYYY-MM-DD")#</td>
<td class="c">#aa_version#</td>
<td class="c">#version#</td>
<td class="c">#is_actual#</td>
<td class="c">#dateFormat(date_nop,"YYYY-MM-DD")#</td>
<td class="r">#dateFormat(date_end,"YYYY-MM-DD")#</td>
<td class="c">#user_description#</td>
<td class="r">#type#</td>
<td class="c">#cnt#</td>
<td class="c">#discount#</td>
<td class="r">#nFmt(line_cost)#</td>
<td class="c"><a href="deal.cfm?__id=#deal_uid#&#tr.fwx#" title="#deal_uid#">#deal#</a></td>
<td class="c">#__status_status#</td>
<td class="c">#probability_pc#</td>
<td class="c"><a href="additional_agreement.cfm?__id=#aa_uid#&#tr.fwx#" title="#aa_uid#">#additional_agreement#</a></td>
</tr>
</cfoutput>
</table>
<cfoutput>
<h4>Версии строки (включая черновики) (#qVer.recordCount#)</h4>
</cfoutput>
<table class="worktable">
<thead>
<tr>
<th>Индекс версии</th>
<th>Создана</th>
<th>Версия доп.с.</th>
<th>Версия строки</th>
<th>is_actual</th>
<th>НОУ</th>
<th>КОУ</th>
<th>User Description</th>
<th>type</th>
<th>Кол-во</th>
<th>Скидка%</th>
<th>Ст-ть</th>
<th>Сделка</th>
<th>Статус</th>
<th>Вер-ть</th>
<th>Доп.с.</th>
</tr>
</thead>
<cfoutput query="qVer">
<tr>
<td class="c"><a href="deal_service.cfm?__id=#__id#&#tr.fwx#" title="#__id#">#__index#</a></td>
<td class="c">#dateFormat(__createdAt,"YYYY-MM-DD")#</td>
<td class="c">#aa_version#</td>
<td class="c">#version#</td>
<td class="c">#is_actual#</td>
<td class="c">#dateFormat(date_nop,"YYYY-MM-DD")#</td>
<td class="r">#dateFormat(date_end,"YYYY-MM-DD")#</td>
<td class="c">#user_description#</td>
<td class="r">#type#</td>
<td class="c">#cnt#</td>
<td class="c">#discount#</td>
<td class="r">#nFmt(line_cost)#</td>
<td class="c"><a href="deal.cfm?__id=#deal_uid#&#tr.fwx#" title="#deal_uid#">#deal#</a></td>
<td class="c">#__status_status#</td>
<td class="c">#probability_pc#</td>
<td class="c"><a href="additional_agreement.cfm?__id=#aa_uid#&#tr.fwx#" title="#aa_uid#">#additional_agreement#</a></td>
</tr>
</cfoutput>
</table>
<!--- <cfdump var=#qVer#/> --->
<layout:page section="footer"/> <layout:page section="footer"/>