Changes between Version 2 and Version 3 of AdvancedReports


Ignore:
Timestamp:
02/03/22 03:22:13 (3 years ago)
Author:
193014
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AdvancedReports

    v2 v3  
    11= Напредни извештаи од базата (SQL и складирани процедури)
     2
     3=== Извештај за секој салон со бројот на вработени, термини,резервации и вкупната заработувачка
     4
     5
     6{{{
     7select distinct bc.salon_id , br_vraboteni.broj_vraboteni, br_termini.broj_termini, br_rezervacii.broj_rez, zarabotuvacka.vkupno
     8       
     9  from beautycenter as bc
     10
     11left join
     12(       select bc.salon_id, count(v_bc.user_id_vraboten) as broj_vraboteni
     13                 from beautycenter as bc
     14                 left join vraboteni_beautycenter as v_bc on bc.salon_id = v_bc.salon_id
     15                 group by bc.salon_id
     16  ) as br_vraboteni on bc.salon_id = br_vraboteni.salon_id
     17 
     18left join
     19(       select bc.salon_id, count(t.termin_id) as broj_termini
     20                 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
     24                 group by bc.salon_id
     25  ) as br_termini on bc.salon_id = br_termini.salon_id
     26 
     27  left join
     28(       select bc.salon_id, count(r.br_rez) as broj_rez
     29                 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
     34                 group by bc.salon_id
     35  ) as br_rezervacii on bc.salon_id = br_rezervacii.salon_id
     36     
     37  left join
     38(       select bc.salon_id,u.usluga_id, count(ru.usluga_id)*cast(u.cena as numeric)  suma_ceni
     39                 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
     46                 group by bc.salon_id,u.usluga_id,u.cena
     47  ) as suma_uslugi on bc.salon_id = suma_uslugi.salon_id
     48
     49  left join
     50(       select bc.salon_id, sum(suma_uslugi.suma_ceni) vkupno
     51                 from beautycenter as bc
     52                  left join (
     53                     select bc.salon_id,u.usluga_id, count(ru.usluga_id)*cast(u.cena as numeric)  suma_ceni
     54                     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
     61                    group by bc.salon_id,u.usluga_id,u.cena
     62                  ) as suma_uslugi on bc.salon_id = suma_uslugi.salon_id
     63                 group by bc.salon_id
     64  ) as zarabotuvacka on bc.salon_id = zarabotuvacka.salon_id
     65
     66}}}
     67
    268
    369=== Број на вработени за дадена дејност.
     
    57123
    58124(
    59    select count(usluga_id)*cast(u.cena as numeric)  broj_rezervacii
     125   select count(usluga_id)*cast(u.cena as numeric)  suma_ceni
    60126   from rezervacija_uslugi 
    61127   group by usluga_id