From 2a3781fcea3eb89d8d707484f4e13322246653cd Mon Sep 17 00:00:00 2001 From: msyu Date: Sat, 21 Jun 2025 19:55:35 +0300 Subject: [PATCH] 011 some totals --- Application.cfc | 2 +- agreement.cfm | 11 +++++++++++ specification.cfm | 23 ++++++++++++++++++++--- specification_version.cfm | 25 +++++++++++++++---------- 4 files changed, 47 insertions(+), 14 deletions(-) diff --git a/Application.cfc b/Application.cfc index cf0f543..f6a1bcd 100644 --- a/Application.cfc +++ b/Application.cfc @@ -69,7 +69,7 @@ - + diff --git a/agreement.cfm b/agreement.cfm index eee3aa2..81e4b15 100644 --- a/agreement.cfm +++ b/agreement.cfm @@ -298,6 +298,10 @@ order by i.specification_id + + select sum(cost) as cost from qItem + +

Строки спецификаций (#qItem.recordCount#) (все суммы без вероятности) @@ -385,6 +389,13 @@ + + + + #cost# + + + diff --git a/specification.cfm b/specification.cfm index 5b48064..4f9965c 100644 --- a/specification.cfm +++ b/specification.cfm @@ -188,11 +188,15 @@ ,(select siv.price from specification_item_version siv join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id) where siv.specification_item_uid=i.specification_item_uid AND a.is_actual - order by siv.agreement_version desc limit 1) as price, - (select siv.price*siv.quantity from specification_item_version siv + order by siv.agreement_version desc limit 1) as price + ,(select siv.price*siv.quantity from specification_item_version siv join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id) where siv.specification_item_uid=i.specification_item_uid AND a.is_actual order by siv.agreement_version desc limit 1) as cost + ,(select siv.price*siv.quantity*a.probability_perc/100 from specification_item_version siv + join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id) + where siv.specification_item_uid=i.specification_item_uid AND a.is_actual + order by siv.agreement_version desc limit 1) as cost_p ,(select siv.dt_from from specification_item_version siv join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id) where siv.specification_item_uid=i.specification_item_uid AND a.is_actual @@ -211,6 +215,10 @@ order by 2 + + select sum(cost) as cost, sum(cost_p) as cost_p from qItem + +

Фактура - строки спецификации, актуальная версия (#qItem.recordCount#) @@ -238,6 +246,7 @@ Количество Цена Стоимость + Ст-сть с вер.   @@ -264,7 +273,7 @@ #quantity# #price# #cost# - + #cost_p# #item_version_count# @@ -281,6 +290,14 @@ + + + + #cost# + #cost_p# + + + Можно собрать версию спецификации на произвольную дату, а можно по версии определенного соглашения (это возможно, потому что соглашение меняет каждую строку не более 1 раза) diff --git a/specification_version.cfm b/specification_version.cfm index d00f509..f18019d 100644 --- a/specification_version.cfm +++ b/specification_version.cfm @@ -257,7 +257,9 @@ order by 2 - + + select sum(cost) as cost, sum(cost_p) as cost_p from qItem +

@@ -316,22 +318,25 @@ #quantity# #price# #cost# - #cost_p# - + #cost_p# #dateFormat(dt_from,'DD.MM.YYYY')# - #dateFormat(dt_to,'DD.MM.YYYY')# - - - + #dateFormat(dt_to,'DD.MM.YYYY')# + #item_version_count# #agreement# #dateFormat(dt_agreement,'DD.MM.YYYY')# #probability_perc#% - #qItem.agreement_version# - - + #qItem.agreement_version# + + + + + #cost# + #cost_p# + +