Changes between Version 14 and Version 15 of AdvancedReports


Ignore:
Timestamp:
01/11/24 08:45:43 (11 months ago)
Author:
212034
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AdvancedReports

    v14 v15  
    9898==== 5. Период од денот (интервали од 1 час) во кој најмногу се купува билети (часовни и дневни)
    9999
     100{{{#!div style="font-size: 80%"
     101  {{{#!sql
     102select a.tb_ime, a.interval_1h , a.broj_pati
     103from(
     104        select tb_ime, interval_1h , count(tb_ime||'-'||interval_1h) broj_pati
     105        from(
     106                select *,
     107                (to_char(extract (hour from b.b_datum_na_kupuvanje), '00') || ':00 -' || to_char(extract (hour from (b.b_datum_na_kupuvanje  + '1 hours'::interval))::int, '00') || ':00') as interval_1h
     108                from tipbilet t
     109                left join bilet b on b.tb_id = t.tb_id
     110                where b.b_datum_na_kupuvanje between (make_date(extract(year from (now() - '1 years'::interval))::int, 1, 1)) and (make_date(extract(year from (now() - '1 years'::interval))::int, 12, 31))
     111        )
     112        group by tb_ime, interval_1h
     113        order by tb_ime, interval_1h
     114) a
     115where broj_pati = (
     116        select max(broj_pati)
     117        from(
     118                select tb_ime, interval_1h , count(tb_ime||'-'||interval_1h) broj_pati
     119                from(
     120                        select *,
     121                        (to_char(extract (hour from b.b_datum_na_kupuvanje), '00') || ':00 -' || to_char(extract (hour from (b.b_datum_na_kupuvanje  + '1 hours'::interval))::int, '00') || ':00') as interval_1h
     122                        from tipbilet t
     123                        left join bilet b on b.tb_id = t.tb_id
     124                        where b.b_datum_na_kupuvanje between (make_date(extract(year from (now() - '1 years'::interval))::int, 1, 1)) and (make_date(extract(year from (now() - '1 years'::interval))::int, 12, 31))
     125                        and tb_ime = a.tb_ime
     126                )
     127                group by tb_ime, interval_1h
     128                order by tb_ime, interval_1h
     129        )
     130--        group by tb_ime
     131) and tb_ime in ('Часовен', 'Дневен')
     132
     133  }}}
     134}}}
    100135
    101136==== 6. Вкупна заработувачка од билети и казни на претпријатието во минатата календарска година