018 some costs added

This commit is contained in:
msyu
2025-08-29 09:56:27 +03:00
parent 517585258d
commit 791a652a9b
4 changed files with 82 additions and 12 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.017"/> <cfset request.APP_VERSION="0.00.018"/>
<cfset request.STAND=getStand()/> <cfset request.STAND=getStand()/>
<cflock scope="application" type="readonly" timeout=3> <cflock scope="application" type="readonly" timeout=3>
+1
View File
@@ -121,6 +121,7 @@
</div> </div>
</cfoutput> </cfoutput>
сюда добавить сделок, договоров и т.д.
<!--- <!---
<layout:page section="extension" closeForm="Yes"/> <layout:page section="extension" closeForm="Yes"/>
+15 -4
View File
@@ -231,6 +231,15 @@
,siv.params::text ,siv.params::text
,a.__id::text as additional_agreement_uid ,a.__id::text as additional_agreement_uid
,a.__name as additional_agreement ,a.__name as additional_agreement
,(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
,(select count(*)
from elma.service_parametrs p
where p.__id = ANY (siv.params)
) 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#"/>=ANY(siv.deal)
@@ -260,10 +269,11 @@
<th>name_version</th> <th>name_version</th>
<th>date_accept</th> <th>date_accept</th>
<th>__index</th> <th>__index</th>
<th>date_nop</th> <th width="5%">date_nop</th>
<th>date_end</th> <th width="5%">date_end</th>
<th>is_easy</th> <th>is_easy</th>
<th>params</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>
@@ -288,7 +298,8 @@
<td class="c">#dateFormat(date_nop,'YYYY-MM-DD')#</td> <td class="c">#dateFormat(date_nop,'YYYY-MM-DD')#</td>
<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">#params#</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>
+65 -7
View File
@@ -117,9 +117,36 @@
<div class="td">#d.user_description#</div> <div class="td">#d.user_description#</div>
</div> </div>
<div class="tr">
<div class="th">Количество</div>
<div class="td">#d.cnt#</div>
</div>
<div class="tr">
<div class="th">Скидка</div>
<div class="td">#d.discount# %</div>
</div>
<div class="tr">
<div class="th">Сумма</div>
<div class="td">
<cfquery name="qParamCost">
select
sum(p.price*p.cnt*(100-COALESCE(p.discount,0))/100) as param_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
join elma.deals_services siv on (p.__id = ANY (siv.params))
where siv.__id=<cfqueryparam cfsqltype="cf_sql_other" value=#d.__id#/>
</cfquery>
<b>#nFmt(qParamCost.line_cost)#</b> по строке, с количеством и скидкой (<b>#nFmt(qParamCost.param_cost)#</b> по компонентам)
</div>
</div>
<div class="tr"> <div class="tr">
<div class="th">Версия</div> <div class="th">Версия</div>
<div class="td">#d.version#</div> <div class="td">#d.version#
</div>
</div> </div>
<div class="tr"> <div class="tr">
@@ -215,7 +242,9 @@
</cfquery> </cfquery>
#qParam.params# (обратная ссылка) #qParam.params# (обратная ссылка)
</div> </div>
</div> </div>
<!--- <div class="tr"> <!--- <div class="tr">
<div class="th">Сделка</div> <div class="th">Сделка</div>
@@ -242,11 +271,17 @@
,p.discount ,p.discount
,p.deal::text ,p.deal::text
,p.__index ,p.__index
,(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#/>
order by type order by type
</cfquery> </cfquery>
<cfquery name="qParamTotal" dbtype="query">
select
sum(param_cost) as total_cost
from qParam
</cfquery>
<cfoutput> <cfoutput>
<h4>Параметры (компоненты) (#qParam.recordCount#)</h4> <h4>Параметры (компоненты) (#qParam.recordCount#)</h4>
@@ -257,14 +292,15 @@
<thead> <thead>
<tr> <tr>
<th>__id</th> <th>__id</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>cnt</th>
<th>ed_izm</th> <th>ed_izm</th>
<th>price</th> <th>price</th>
<th>discount</th> <th>Скидка%</th>
<th>Ст-ть</th>
<th>deal</th> <th>deal</th>
<th>__index</th> <th>__index</th>
</tr> </tr>
@@ -273,20 +309,42 @@
<cfoutput query="qParam"> <cfoutput query="qParam">
<tr> <tr>
<td class="c">#__id#</td> <td class="c">#__id#</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>
<td class="c">#name#</td> <td class="c">#name#</td>
<td class="c">#cnt#</td> <td class="r">#cnt#</td>
<td class="c">#ed_izm#</td> <td class="c">#ed_izm#</td>
<td class="c">#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="c">#deal#</td> <td class="c">#deal#</td>
<td class="c">#__index#</td> <td class="c">#__index#</td>
</tr> </tr>
</cfoutput> </cfoutput>
<cfoutput query="qParamTotal">
<tr>
<td class="r b" colspan="8">Итого</td>
<td class="r b">#nFmt(total_cost)#</td>
<td colspan="2"></td>
</tr>
</cfoutput>
</table> </table>
</cfif> </cfif>
<cfquery name="qVer">
select __id::text, __index, version, date_nop, date_end, user_description, type, is_easy, cnt, discount, is_actual
,(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
where hash=<cfqueryparam cfsqltype="cf_sql_varchar" value=#d.hash#/>
order by __index, version
</cfquery>
<cfdump var=#qVer#/>
<layout:page section="footer"/> <layout:page section="footer"/>