Changes between Version 8 and Version 9 of AdvancedReports


Ignore:
Timestamp:
01/19/22 14:21:46 (3 years ago)
Author:
195115
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AdvancedReports

    v8 v9  
    11= Напредни извештаи од базата (SQL и складирани процедури)
    22
    3 ==
     3== Извештаи за заработка на секоја фирма и генерален интерес за секое тромесечие
    44
    5 
     5{{{#!sql
     6select distinct f.firm_name,
     7    case when tabelaQuarter.quarter=1 then tabelaSuma.count else 0 end as prv_kvartal_suma,
     8    case when tabelaQuarter.quarter=2 then tabelaSuma.count  else 0 end as vtor_kvartal,
     9    case when tabelaQuarter.quarter=3 then tabelaSuma.count  else 0 end as tret_kvartal,
     10    case when tabelaQuarter.quarter=4 then tabelaSuma.count  else 0 end as cetvrt_kvartal,
     11       
     12    case when tabelaQuarter.quarter=1 then tabelaSuma.sum else 0 end as prv_kvartal_suma,
     13    case when tabelaQuarter.quarter=2 then tabelaSuma.sum  else 0 end as vtor_kvartal_suma,
     14    case when tabelaQuarter.quarter=3 then tabelaSuma.sum  else 0 end as tret_kvartal_suma,
     15    case when tabelaQuarter.quarter=4 then tabelaSuma.sum  else 0 end as cetvrt_kvartal_suma
     16       
     17       
     18       
     19    from firm as f
     20    join auditorium as a on a.firm_id = f.firm_id
     21    join gives as g on g.auditorium_id = a.auditorium_id
     22    join movieprojection as mp on mp.projection_id = g.projection_id
     23    join reservation as r on r.projection_id = mp.projection_id
     24   
     25    join(
     26    select distinct f.firm_name, extract(quarter from r.reservation_date) as quarter
     27    from firm as f
     28    join auditorium as a on a.firm_id = f.firm_id
     29    join gives as g on g.auditorium_id = a.auditorium_id
     30    join movieprojection as mp on mp.projection_id = g.projection_id
     31    join reservation as r on r.projection_id = mp.projection_id
     32   
     33    ) as tabelaQuarter on tabelaQuarter.firm_name = f.firm_name
     34   
     35    join(
     36    select distinct f.firm_id,f.firm_name , a.auditorium_name as sala,sum(mp.projection_price) ,count(distinct r.reservation_id ),mp.projection_price
     37    from reservation as r
     38    join movieprojection as mp on mp.projection_id = r.projection_id
     39    join gives as g on g.projection_id = mp.projection_id
     40    join auditorium as a on a.auditorium_id = g.auditorium_id
     41    join firm as f on f.firm_id = a.firm_id
     42    group by 1,2,3,6
     43    order by sum desc
     44    ) as tabelaSuma on tabelaSuma.firm_id = f.firm_id
     45    where ((extract(year from now())::integer-1)=(extract(year from r.reservation_date)::integer))
     46}}}
    647
    748==