From c1242c2c0cba9c400127aebdc91b3e48e5b519e5 Mon Sep 17 00:00:00 2001 From: msyu Date: Sun, 22 Jun 2025 11:06:43 +0300 Subject: [PATCH] 012 install separated, export --- Application.cfc | 3 +- income_daily_rpt.cfm | 78 +++++++++++++++++++++++++++------------- income_monthly_rpt.cfm | 81 ++++++++++++++++++++++++------------------ 3 files changed, 101 insertions(+), 61 deletions(-) diff --git a/Application.cfc b/Application.cfc index f6a1bcd..23e2540 100644 --- a/Application.cfc +++ b/Application.cfc @@ -69,12 +69,11 @@ - + - 182 000,00 diff --git a/income_daily_rpt.cfm b/income_daily_rpt.cfm index 664a36f..58909cb 100644 --- a/income_daily_rpt.cfm +++ b/income_daily_rpt.cfm @@ -19,11 +19,21 @@ +select + + m + dt + income_install + income_recurring + income_install+income_recurring as income + +from ( select --install - DATE_TRUNC('month', dayscale.dt)::date as m, - dayscale.dt::date, - sum(siv.price*siv.quantity*a.probability_perc/100) as income + DATE_TRUNC('month', dayscale.dt)::date as m + ,dayscale.dt::date + ,sum(siv.price*siv.quantity*a.probability_perc/100) as income_install + ,0 as income_recurring from (SELECT dd::date as dt FROM generate_series( '2023-01-01'::timestamp , '2029-12-31'::timestamp @@ -43,14 +53,15 @@ join contragent k on d.contragent_id=k.contragent_id join svc on (si.svc_id=svc.svc_id) group by dayscale.dt - - + union all + --fix and payg select - DATE_TRUNC('month', dayscale.dt)::date as m, - dayscale.dt::date, - sum(siv.price*siv.quantity*a.probability_perc/100/dayscale.days) + DATE_TRUNC('month', dayscale.dt)::date as m + ,dayscale.dt::date + ,0 + ,sum(siv.price*siv.quantity*a.probability_perc/100/dayscale.days) from (SELECT dd::date as dt , DATE_PART('days', DATE_TRUNC('month', dd) + '1 MONTH'::INTERVAL - '1 DAY'::INTERVAL) days FROM generate_series( @@ -72,8 +83,8 @@ join contragent k on d.contragent_id=k.contragent_id join svc on (si.svc_id=svc.svc_id) group by dayscale.dt - - order by 1 +) install_fix_payg +order by dt @@ -112,45 +123,64 @@ select count(*) as cnt from specification_item where 1=1
- + #qRead.recordCount# записей + + +
Дни и месяцы с нулевой суммой не показаны - - - + + + + + + - - + + + +
ДатаВыручкаОкругл
ДатаИнсталлЕжемесВыручка
#dateFormat(dt,"DD.MM.YYYY")##income##round(income)##nFmt(income_install)##nFmt(income_recurring)##nFmt(income)#
- - select m, sum(income) as income from qRead group by m order by m - + + select m + , sum(income_install) as income_install + , sum(income_recurring) as income_recurring + , sum(income) as income + from qRead + group by m + order by m + +
Суммировано по месяцам: - - - + + + + + + - - + + +
МесяцВыручкаОкругл
МесяцИнсталлЕжемесВыручка
#dateFormat(m,"MM.YYYY")##income##round(income)##nFmt(income_install)##nFmt(income_recurring)##nFmt(income)#
diff --git a/income_monthly_rpt.cfm b/income_monthly_rpt.cfm index bd98485..3ec37f1 100644 --- a/income_monthly_rpt.cfm +++ b/income_monthly_rpt.cfm @@ -17,12 +17,21 @@ ---> - - + + +select + + m + income_install + income_recurring + income_install+income_recurring as income + +from ( select - DATE_TRUNC('month', dayscale.dt)::date AS dt - ,sum(siv.price*siv.quantity*a.probability_perc/100) as income - + --install + DATE_TRUNC('month', dayscale.dt)::date as m + ,sum(siv.price*siv.quantity*a.probability_perc/100) as income_install + ,0 as income_recurring from (SELECT dd::date as dt FROM generate_series ( '2023-01-01'::timestamp @@ -45,12 +54,10 @@ union all -select - - DATE_TRUNC('month', dayscale.dt)::date - ,sum(siv.price*siv.quantity*a.probability_perc/100/dayscale.days) - - +select + DATE_TRUNC('month', dayscale.dt)::date as m + ,0 + ,sum(siv.price*siv.quantity*a.probability_perc/100/dayscale.days) from (SELECT dd::date as dt, DATE_PART('days', DATE_TRUNC('month', dd) + '1 MONTH'::INTERVAL - '1 DAY'::INTERVAL @@ -73,17 +80,14 @@ select join svc on (si.svc_id=svc.svc_id) group by DATE_TRUNC('month', dayscale.dt) - order by 1 +) install_fix_payg +order by 1 - + - - - - select count(*) as cnt from specification_item where 1=1 @@ -112,25 +116,32 @@ select count(*) as cnt from specification_item where 1=1 - -Месяцы с нулевой суммой не показаны - - + #qRead.recordCount# записей + + +
+ Месяцы с нулевой суммой не показаны - - - - - - - - - - - - - -
ДатаВыручкаОкругл
#dateFormat(dt,"MM.YYYY")##income##round(income)#
+ + + + + + + + + + + + + + + + + + + +
МесяцИнсталлЕжемесВыручка
#dateFormat(m,"MM.YYYY")##nFmt(income_install)##nFmt(income_recurring)##nFmt(income)#