029 reconciliation

This commit is contained in:
2026-03-25 14:08:34 +03:00
parent 6d06a68ad8
commit 8187db1ea3
11 changed files with 789 additions and 40 deletions
+39 -25
View File
@@ -121,11 +121,10 @@
</div>
</cfoutput>
сюда добавить сделок, договоров и т.д.
<layout:page section="extension" closeForm="Yes"/>
<cfif len(d.__id)>
<cfif len(d.__id)>
<cfquery name="qContract">
select
@@ -398,31 +397,29 @@
,siv.params::text
,a.__id::text as additional_agreement_uid
,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)
AND p."__deletedAt" IS NULL
) as line_cost
,(select count(*)
from elma.service_parametrs p
where p.__id = ANY (siv.params)
AND p."__deletedAt" IS NULL
) as param_cnt
,p.price
,p.cnt as p_cnt
,p.ed_izm
,p.code
,p.discount as p_discount
,p.__id as p_uid
,p.name
,s.probability_pc
,d.__index
,d.__id as deal_uid
from elma.deals_services siv
join elma.deals d on d.__id=ANY(siv.deal)
join status s on (d.__status_status=s.status_id)
join elma.service_parametrs p ON (p.__id = ANY (siv.params) AND p."__deletedAt" IS NULL)
left outer join elma.additional_agreements a on (a.__id=ANY(siv.additional_agreement))
where d._companies=<cfqueryparam cfsqltype="cf_sql_other" value="#d.__id#" null=#!isValid("guid",d.__id)#/>
and siv.is_actual
AND siv.is_actual
AND a.is_actual
order by version::int
</cfquery>
<cfoutput>
<h4>Услуги (версии строк спецификации, только актуальные) (#qService.recordCount#) *** здесь не учтено дублирование строк в новых версиях</h4>
<h4>Услуги (версии строк спецификации, только актуальные) <!--- (#qService.recordCount#) ---></h4>
</cfoutput>
<!--- <layout:render_query query=#qService#/> --->
@@ -431,7 +428,8 @@
<tr>
<th>__index</th>
<!--- <th>__name</th> --->
<th width="12%">user_description</th>
<th width="20%">user_description</th>
<th width="25%">Компоненты</th>
<th>Кол-во</th>
<th>Скидка%</th>
<th width="5%">Сумма</th>
@@ -445,20 +443,37 @@
<th>__index</th>
<th width="5%">date_nop</th>
<th width="5%">date_end</th>
<th>is_easy</th>
<th>Компонентов</th>
<th width="12%">additional_agreement</th>
<th>is_easy</th>
<th width="7%">additional_agreement</th>
</tr>
</thead>
<cfoutput query="qService">
<cfoutput query="qService" group="__index">
<tr>
<td class="c"><a href="deal_service.cfm?__id=#__id#&#tr.fwx#" title="__id">#__index#</a></td>
<!--- <td class="c">#__name#</td> --->
<td class="l">#user_description#</td>
<td class="c">#cnt#</td>
<td class="c">#discount#</td>
<td class="r">#nFmt(line_cost)#</td>
<td>
<table>
<cfset cost=0/>
<cfoutput group="p_uid">
<cfif p_cnt NEQ 0>
<tr>
<td class="nw">#code#</td>
<td>#name#</td>
<td>#p_cnt#</td>
<td>#ed_izm#</td>
<td class="r nw">#nFmt(price,3)#</td>
<td class="r">#p_discount#%</td>
</tr>
<cfset cost+=price*p_cnt*(100-(isNumeric(p_discount)?p_discount:0))/100 />
</cfif>
</cfoutput>
</table>
</td>
<td class="c">#cnt#</td>
<td class="c">#discount#%</td>
<td class="r">#nFmt(cost*cnt*(100-(isNumeric(discount)?discount:0))/100)#</td>
<td class="l">
#abstractive_service_code#.#modifier_code#<!--- <cfswitch expression=#type#>
<cfcase value=1>-i</cfcase>
@@ -476,7 +491,6 @@
<td class="c">#dateFormat(date_nop,'YYYY-MM-DD')#</td>
<td class="c">#dateFormat(date_end,'YYYY-MM-DD')#</td>
<td class="c">#is_easy#</td>
<td class="c">#param_cnt#</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>
@@ -484,5 +498,5 @@
</cfoutput>
</table>
</cfif>
</cfif><!--- len(d.__id) --->
<layout:page section="footer"/>