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
+213 -41
View File
@@ -20,6 +20,7 @@
<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="__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="modifier" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/>
<d:param field="modifier_code" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/>
@@ -51,16 +52,12 @@
/>
<!--- decoration --->
<!--- <cfquery name="qDecoration" datasource="#request.DS#">
<cfquery name="qDecoration" datasource="#request.DS#">
select
c.__name as contract
,c.date_of_aggrement
,c.date_end_aggrement
,k.__name as contragent
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> --->
ds."__createdAt"
from elma.deals_services ds
where ds.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.__id# null=#!isValid("guid",d.__id)#/>
</cfquery>
</m:silent><!---
@@ -94,7 +91,18 @@
<div class="tr">
<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 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
from elma.service_parametrs p
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>
<b>#nFmt(qParamCost.line_cost)#</b> по строке, с количеством и скидкой (<b>#nFmt(qParamCost.param_cost)#</b> по компонентам)
</div>
@@ -144,8 +152,49 @@
<div class="tr">
<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>
@@ -187,14 +236,16 @@
join elma.deals d on (d.__id = ANY(siv.deal))
left outer join elma.companies c on (d._companies=c.__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>
<!--- <cfdump var=#qDeal#/> --->
<a href="deal.cfm?__id=#qDeal.__id#&#tr.fwx#">#qDeal.__id#</a>
#qDeal.contragent# | #qDeal.wz# |
#qDeal.__name# |
_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>
<cfif qDeal.recordCount>
<a href="deal.cfm?__id=#qDeal.__id#&#tr.fwx#">#qDeal.__id#</a>
#qDeal.contragent# | #qDeal.wz# |
#qDeal.__name# |
_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>
</cfif>
</div>
</div>
@@ -218,14 +269,16 @@
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.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>
<!--- <cfdump var=#qAdditionalAgreement#/> --->
<a href="additional_agreement.cfm?__id=#qAdditionalAgreement.__id#&#tr.fwx#">#qAdditionalAgreement.__id#</a> #qAdditionalAgreement.contragent# #qAdditionalAgreement.wz#
#qAdditionalAgreement.contract# #qAdditionalAgreement.additional_agreement#
is_actual: <b>#qAdditionalAgreement.is_actual#</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>
<cfif len(qAdditionalAgreement.__id)>
<a href="additional_agreement.cfm?__id=#qAdditionalAgreement.__id#&#tr.fwx#">#qAdditionalAgreement.__id#</a> #qAdditionalAgreement.contragent# #qAdditionalAgreement.wz#
#qAdditionalAgreement.contract# #qAdditionalAgreement.additional_agreement#
is_actual: <b>#qAdditionalAgreement.is_actual#</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>
</cfif>
</div>
</div>
@@ -238,7 +291,7 @@
<cfquery name="qParam">
select params::text
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>
#qParam.params# (обратная ссылка)
</div>
@@ -261,6 +314,7 @@
<cfquery name="qParam">
select
p.__id
,p.__index
,p.__name
,p.type
,p.price
@@ -274,7 +328,7 @@
,(p.price*p.cnt*(100-COALESCE(p.discount,0))/100) as param_cost
from elma.service_parametrs p
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
</cfquery>
<cfquery name="qParamTotal" dbtype="query">
@@ -291,24 +345,24 @@
<table class="worktable">
<thead>
<tr>
<th>__id</th>
<th>__index</th>
<!--- <th>__name</th> --->
<th>type</th>
<th>code</th>
<th>name</th>
<th>cnt</th>
<th>ed_izm</th>
<th>price</th>
<th>Скидка%</th>
<th>Кол-во</th>
<th>Ед.изм.</th>
<th>Цена</th>
<th>Скидка %</th>
<th>Ст-ть</th>
<th>deal</th>
<th>__index</th>
<!--- <th>deal</th> --->
<th>__id</th>
</tr>
</thead>
<cfoutput query="qParam">
<tr>
<td class="c">#__id#</td>
<td class="c">#__index#</td>
<!--- <td class="c">#__name#</td> --->
<td class="c">#type#</td>
<td class="c">#code#</td>
@@ -318,8 +372,8 @@
<td class="r">#price#</td>
<td class="c">#discount#</td>
<td class="r">#nFmt(param_cost)#</td>
<td class="c">#deal#</td>
<td class="c">#__index#</td>
<!--- <td class="c">#deal#</td> --->
<td class="c">#__id#</td>
</tr>
</cfoutput>
<cfoutput query="qParamTotal">
@@ -332,19 +386,137 @@
</table>
</cfif>
<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
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))
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#/>
order by __index, version
order by siv.__index, siv.version
</cfquery>
<cfquery name="qVerActual" dbtype="query">
select * from qVer where is_actual > 0
</cfquery>
<cfdump var=#qVer#/>
<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"/>