Changes between Initial Version and Version 1 of AdvancedReports


Ignore:
Timestamp:
02/10/23 10:50:41 (22 months ago)
Author:
181129
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AdvancedReports

    v1 v1  
     1{{{#!html
     2<h1 style="text-align: left; color: #5d5250; margin: 0; margin-top: 10px">
     3 Напредни извештаи од базата (SQL и складирани процедури)
     4</h1>
     5<hr style="margin: 0; margin-bottom:10px">
     6}}}
     7
     8{{{#!html
     9<h3 style="text-align: left; color: #5d5250; margin: 0; margin-top: 10px">
     10 Промет во последната година
     11</h3>
     12<hr style="margin: 0; margin-bottom:10px">
     13}}}
     14
     15{{{#!sql
     16SELECT
     17  SUM(CASE WHEN TipDok.TipID = 10 THEN -Stavka.Cena_Vkupno
     18  WHEN TipDok.TipID = 20 THEN Stavka.Cena_Vkupno END) as Promet
     19FROM
     20  Stavka
     21JOIN TipDok ON Stavka.TipID = TipDok.TipID
     22WHERE
     23  Datum >= date_trunc('year', current_date) - INTERVAL '1 year'
     24  AND Datum < date_trunc('year', current_date)
     25}}}
     26
     27{{{#!html
     28<h3 style="text-align: left; color: #5d5250; margin: 0; margin-top: 10px">
     29 Најтргован продукт во последната година
     30</h3>
     31<hr style="margin: 0; margin-bottom:10px">
     32}}}
     33
     34{{{#!sql
     35SELECT Artikal_Ime, SUM(Kolicina)
     36  AS Vkupno_Trgovan
     37FROM
     38  LagerList
     39JOIN Artikal ON LagerList.Artikal_ID = Artikal.Artikal_ID
     40JOIN Stavka ON LagerList.StavkaID = Stavka.StavkaID
     41WHERE
     42  Datum >= date_trunc('year', current_date) - INTERVAL '1 year'
     43  AND Datum < date_trunc('year', current_date)
     44GROUP BY Artikal_Ime
     45ORDER BY Vkupno_Trgovan DESC
     46LIMIT 1;
     47}}}
     48
     49{{{#!html
     50<h3 style="text-align: left; color: #5d5250; margin: 0; margin-top: 10px">
     51 Клиенти подредени по најпрофитабилни во последниот квартал
     52</h3>
     53<hr style="margin: 0; margin-bottom:10px">
     54}}}
     55
     56{{{#!sql
     57SELECT
     58  Klient.KlientIme,
     59  SUM(CASE WHEN Stavka.TipID = 10 THEN -Stavka.Cena_Vkupno
     60  WHEN Stavka.TipID = 20 THEN Stavka.Cena_Vkupno END) AS Vkupen_Promet
     61FROM
     62  Klient
     63JOIN Stavka ON Klient.KlientID = Stavka.KlientID
     64JOIN TipDok ON Stavka.TipID = TipDok.TipID
     65WHERE
     66  Stavka.Datum >= date_trunc('quarter', current_date) - INTERVAL '3 months'
     67  AND Stavka.Datum < date_trunc('quarter', current_date)
     68GROUP BY Klient.KlientIme
     69ORDER BY Vkupen_Promet DESC
     70}}}
     71