Changes between Version 11 and Version 12 of AdvancedReports


Ignore:
Timestamp:
01/05/24 15:31:30 (11 months ago)
Author:
216049
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AdvancedReports

    v11 v12  
    8585
    8686==== 6. Период од денот (интервали од 1 час) во кој најмногу се пишуваат казни
     87
     88==== 7. Вкупна заработувачка од билети и казни на претпријатието во минатата календарска година
     89
     90{{{#!div style="font-size: 80%"
     91  {{{#!sql
     92select
     93CASE
     94  WHEN sum_kz IS NOT NULL AND sum_b IS NOT NULL THEN COALESCE(sum_kz::int, 0) + COALESCE(sum_b::int, 0)
     95  WHEN sum_kz IS NOT NULL THEN COALESCE(sum_kz::int, 0)
     96  WHEN sum_b IS NOT NULL THEN COALESCE(sum_b::int, 0)
     97  ELSE 0
     98END
     99from (
     100select
     101(
     102select sum(kz_iznos)
     103from kazna k
     104where k.kz_plateno = true and (k.kz_datum between (make_date(extract(year from (now() - '1 years'::interval))::int, 1, 1)) and
     105                                                                        (make_date(extract(year from (now() - '1 years'::interval))::int, 12, 31)))
     106                                                                        and (k.kz_datum_plateno between (make_date(extract(year from (now() - '1 years'::interval))::int, 1, 1)) and
     107                                                                        (make_date(extract(year from (now() - '1 years'::interval))::int, 12, 31)))
     108)  sum_kz,
     109(
     110select sum(tb_cena)
     111from bilet b
     112join tipbilet tb on tb.tb_id = b.tb_id
     113where b.b_datum_na_kupuvanje between (make_date(extract(year from (now() - '1 years'::interval))::int, 1, 1)) and
     114                                                                        (make_date(extract(year from (now() - '1 years'::interval))::int, 12, 31))
     115)  sum_b
     116)
     117
     118  }}}
     119}}}