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
+65 -7
View File
@@ -117,9 +117,36 @@
<div class="td">#d.user_description#</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="th">Версия</div>
<div class="td">#d.version#</div>
<div class="td">#d.version#
</div>
</div>
<div class="tr">
@@ -215,7 +242,9 @@
</cfquery>
#qParam.params# (обратная ссылка)
</div>
</div>
</div>
<!--- <div class="tr">
<div class="th">Сделка</div>
@@ -242,11 +271,17 @@
,p.discount
,p.deal::text
,p.__index
,(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#/>
order by type
</cfquery>
<cfquery name="qParamTotal" dbtype="query">
select
sum(param_cost) as total_cost
from qParam
</cfquery>
<cfoutput>
<h4>Параметры (компоненты) (#qParam.recordCount#)</h4>
@@ -257,14 +292,15 @@
<thead>
<tr>
<th>__id</th>
<th>__name</th>
<!--- <th>__name</th> --->
<th>type</th>
<th>code</th>
<th>name</th>
<th>cnt</th>
<th>ed_izm</th>
<th>price</th>
<th>discount</th>
<th>Скидка%</th>
<th>Ст-ть</th>
<th>deal</th>
<th>__index</th>
</tr>
@@ -273,20 +309,42 @@
<cfoutput query="qParam">
<tr>
<td class="c">#__id#</td>
<td class="c">#__name#</td>
<!--- <td class="c">#__name#</td> --->
<td class="c">#type#</td>
<td class="c">#code#</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">#price#</td>
<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>
</tr>
</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>
</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"/>