Changes between Version 6 and Version 7 of AdvancedReports


Ignore:
Timestamp:
03/10/22 23:33:31 (3 years ago)
Author:
193014
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AdvancedReports

    v6 v7  
    1010
    1111left join
    12 (       select bc.salon_id, count(v_bc.user_id_vraboten) as broj_vraboteni
     12(       select bc.salon_id, count(v.user_id) as broj_vraboteni
    1313                 from beautycenter as bc
    14                  left join vraboteni_beautycenter as v_bc on bc.salon_id = v_bc.salon_id
     14                join vraboteni as v on bc.salon_id = v.salon_id
    1515                 group by bc.salon_id
    1616  ) as br_vraboteni on bc.salon_id = br_vraboteni.salon_id
     
    1919(       select bc.salon_id, count(t.termin_id) as broj_termini
    2020                 from beautycenter as bc
    21                  left join vraboteni_beautycenter as v_bc on bc.salon_id = v_bc.salon_id
    22                   left join vraboteni as v on v_bc.user_id_vraboten = v.user_id
    23                   left join termini as t on v.user_id = t.user_id_vraboten
     21                 join vraboteni as v on bc.salon_id = v.salon_id
     22                  join termini as t on v.user_id = t.user_id_vraboten
    2423                 group by bc.salon_id
    2524  ) as br_termini on bc.salon_id = br_termini.salon_id
     
    2827(       select bc.salon_id, count(r.br_rez) as broj_rez
    2928                 from beautycenter as bc
    30                  left join vraboteni_beautycenter as v_bc on bc.salon_id = v_bc.salon_id
    31                   left join vraboteni as v on v_bc.user_id_vraboten = v.user_id
    32                   left join termini as t on v.user_id = t.user_id_vraboten
    33                   left join rezervacija as r on t.termin_id = r.termin_id
     29                  join vraboteni as v on bc.salon_id = v.salon_id
     30                  join termini as t on v.user_id = t.user_id_vraboten
     31                  join rezervacija as r on t.termin_id = r.termin_id
    3432                 group by bc.salon_id
    3533  ) as br_rezervacii on bc.salon_id = br_rezervacii.salon_id
     
    3836(       select bc.salon_id,u.usluga_id, count(ru.usluga_id)*cast(u.cena as numeric)  suma_ceni
    3937                 from beautycenter as bc
    40                  left join vraboteni_beautycenter as v_bc on bc.salon_id = v_bc.salon_id
    41                   left join vraboteni as v on v_bc.user_id_vraboten = v.user_id
    42                   left join termini as t on v.user_id = t.user_id_vraboten
    43                   left join rezervacija as r on t.termin_id = r.termin_id
    44                   left join rezervacija_uslugi as ru on r.br_rez = ru.br_rez
    45                   left join uslugi as u on ru.usluga_id = u.usluga_id
     38                   join vraboteni as v on bc.salon_id = v.salon_id
     39                   join termini as t on v.user_id = t.user_id_vraboten
     40                   join rezervacija as r on t.termin_id = r.termin_id
     41                   join rezervacija_uslugi as ru on r.br_rez = ru.br_rez
     42                   join uslugi as u on ru.usluga_id = u.usluga_id
    4643                 group by bc.salon_id,u.usluga_id,u.cena
    4744  ) as suma_uslugi on bc.salon_id = suma_uslugi.salon_id
     
    5350                     select bc.salon_id,u.usluga_id, count(ru.usluga_id)*cast(u.cena as numeric)  suma_ceni
    5451                     from beautycenter as bc
    55                      left join vraboteni_beautycenter as v_bc on bc.salon_id = v_bc.salon_id
    56                      left join vraboteni as v on v_bc.user_id_vraboten = v.user_id
    57                      left join termini as t on v.user_id = t.user_id_vraboten
    58                      left join rezervacija as r on t.termin_id = r.termin_id
    59                      left join rezervacija_uslugi as ru on r.br_rez = ru.br_rez
    60                      left join uslugi as u on ru.usluga_id = u.usluga_id
     52                      join vraboteni as v on bc.salon_id = v.salon_id
     53                      join termini as t on v.user_id = t.user_id_vraboten
     54                      join rezervacija as r on t.termin_id = r.termin_id
     55                      join rezervacija_uslugi as ru on r.br_rez = ru.br_rez
     56                      join uslugi as u on ru.usluga_id = u.usluga_id
    6157                    group by bc.salon_id,u.usluga_id,u.cena
    6258                  ) as suma_uslugi on bc.salon_id = suma_uslugi.salon_id
     
    8884
    8985{{{
    90 select b.salon_id,vb.user_id_vraboten, v.first_name, v.prezime, (current_date - vb.raboti_od) as vremetraenje
     86select b.salon_id,v.user_id, v.first_name, v.prezime, (current_date - v.raboti_od) as vremetraenje
    9187from beautycenter as b
    92 left join vraboteni_beautycenter as vb on b.salon_id = vb.salon_id
    93 left join vraboteni as v on vb.user_id_vraboten = v.user_id
    94 where vb.raboti_do is null
     88left join vraboteni as v on b.salon_id = v.salon_id
     89where v.raboti_do is null -- and b.salon_id = 'P1106'
    9590order by vremetraenje desc
    9691}}}
     
    136131count(CASE WHEN r.uplata_id notnull THEN 0 END) as uplata_online
    137132from klienti as k
    138 left join rezervacija as r on k.user_id = r.user_id_klient
     133join rezervacija as r on k.user_id = r.user_id_klient
    139134group by 1,2,3
    140135order by br_reztermini desc;
     
    149144select v.user_id , v.first_name,v.prezime, count(r.br_rez) as br_rezervacii
    150145from vraboteni as v
    151 left join termini as t on v.user_id = t.user_id_vraboten
    152 left join rezervacija as r on t.termin_id = r.termin_id
    153 left join rezervacija_uslugi as ru on r.br_rez = ru.br_rez
     146join termini as t on v.user_id = t.user_id_vraboten
     147join rezervacija as r on t.termin_id = r.termin_id
     148join rezervacija_uslugi as ru on r.br_rez = ru.br_rez
    154149where extract (year from t.pocetok) = extract (year from now() - interval '1 year')
    155150group by v.user_id
     
    171166 
    172167  from beautycenter as bc
    173   left join vraboteni_beautycenter as v_bc on bc.salon_id = v_bc.salon_id
    174   left join vraboteni as v on v_bc.user_id_vraboten = v.user_id
    175   left join termini as t on v.user_id = t.user_id_vraboten
    176   left join rezervacija as r on t.termin_id = r.termin_id
    177 
    178168left join(
    179 select bc.salon_id, extract (quarter from t.pocetok) as kvartal, count(r.br_rez) as broj_rezervacii
     169select  bc.salon_id, extract (quarter from t.pocetok) as kvartal, count(r.br_rez) as broj_rezervacii
    180170  from beautycenter as bc
    181   left join vraboteni_beautycenter as v_bc on bc.salon_id = v_bc.salon_id
    182   left join vraboteni as v on v_bc.user_id_vraboten = v.user_id
    183   left join termini as t on v.user_id = t.user_id_vraboten
    184   left join rezervacija as r on t.termin_id = r.termin_id
     171        join vraboteni as v on v.salon_id = bc.salon_id
     172        join termini as t on v.user_id = t.user_id_vraboten
     173    join rezervacija as r on t.termin_id = r.termin_id
    185174 where extract (year from t.pocetok) = extract (year from current_date)
    186175     group by 1,2
    187176) as broj_na_rezervacii   on bc.salon_id = broj_na_rezervacii.salon_id
     177
    188178}}}
    189179