diff --git a/Application.cfc b/Application.cfc index 8e8cf4f..b1ebb53 100644 --- a/Application.cfc +++ b/Application.cfc @@ -69,7 +69,7 @@ - + diff --git a/agreement_ls.cfm b/agreement_ls.cfm index e48d0fb..f6f1373 100644 --- a/agreement_ls.cfm +++ b/agreement_ls.cfm @@ -33,6 +33,8 @@ d.dt_contract k.contragent (select count(*) from specification_item_version siv join specification_item si on (siv.specification_item_uid=si.specification_item_uid) join specification s on (si.specification_id=s.specification_id) where a.contract_id=s.contract_id AND a.agreement_version=siv.agreement_version) as change_cnt + (select sum(quantity*price) from specification_item_version siv join specification_item si on (siv.specification_item_uid=si.specification_item_uid) join specification s on (si.specification_id=s.specification_id) where a.contract_id=s.contract_id AND a.agreement_version=siv.agreement_version) as agreement_sum + (select sum(quantity*price)*a.probability_perc/100 from specification_item_version siv join specification_item si on (siv.specification_item_uid=si.specification_item_uid) join specification s on (si.specification_id=s.specification_id) where a.contract_id=s.contract_id AND a.agreement_version=siv.agreement_version) as agreement_sum_p from agreement a join contract d on (a.contract_id=d.contract_id) @@ -107,6 +109,15 @@ select count(*) as cnt from agreement where 1=1 + + + + + + + + + @@ -123,12 +134,15 @@ select count(*) as cnt from agreement where 1=1 + + #gridFooter# - Создавать сделки (соглашения) нужно из договоров + Под суммой понимается здесь сумма измененных позиций, а не изменение суммы от предыдущей версии! + Создавать сделки (соглашения) нужно из договоров (потому что у нас сделка - это базовая или дополнительная версия фактуры договора с вероятностью, дополнительное или базовое соглашение к договору) diff --git a/contract.cfm b/contract.cfm index 7765ee3..624700b 100644 --- a/contract.cfm +++ b/contract.cfm @@ -147,12 +147,15 @@ a.contract_id ,a.agreement_version ,a.agreement + ,a.probability_perc ,a.dt_agreement ,a.is_actual ,(select count(*) from specification_item_version iv join specification_item i on (iv.specification_item_uid=i.specification_item_uid AND iv.agreement_version=a.agreement_version) join specification s on (i.specification_id=s.specification_id AND s.contract_id=a.contract_id) ) as items_changed + ,(select sum(quantity*price) from specification_item_version siv join specification_item si on (siv.specification_item_uid=si.specification_item_uid) join specification s on (si.specification_id=s.specification_id) where a.contract_id=s.contract_id AND a.agreement_version=siv.agreement_version) as agreement_sum + ,(select sum(quantity*price)*a.probability_perc/100 from specification_item_version siv join specification_item si on (siv.specification_item_uid=si.specification_item_uid) join specification s on (si.specification_id=s.specification_id) where a.contract_id=s.contract_id AND a.agreement_version=siv.agreement_version) as agreement_sum_p from agreement a where a.contract_id= order by a.agreement_version @@ -179,8 +182,11 @@ Номер соглашения (версия) Название Дата + Вероятность Действует Строк изменено + Сумма измененных + Сумма изм. с в. @@ -192,8 +198,11 @@ #agreement_version# #agreement# #dateFormat(dt_agreement,'DD.MM.YYYY')# + #probability_perc# #items_changed# + #nFmt(agreement_sum)# + #nFmt(agreement_sum_p)#