Changes between Version 10 and Version 11 of AdvancedReports


Ignore:
Timestamp:
01/01/23 15:24:36 (21 months ago)
Author:
201065
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AdvancedReports

    v10 v11  
    6565}}}
    6666
     67===  Предвидување дали одреден артикл во одреден магацин треба да се нарача во однос на неговота достапност и потрошувачка во последниот месец дена ===
     68
     69{{{#!sql
     70select a.articlename, l.locationname,
     71        (case
     72                when q1.dostapnost+coalesce(q2.incoming, 0)<coalesce(q3.sold, 0) then 'Yes'
     73                else 'No'
     74        end
     75        ) as defict from articles a
     76left join storedarticles s on s.articleid=a.articleid
     77left join locations l on l.locationid=s.locationid
     78left join (
     79        select articleid, locationid, coalesce(sum(quantity), 0) as dostapnost from storedarticles s
     80        group by s.sarticleid, s.locationid
     81) q1 on q1.articleid=a.articleid and q1.locationid=l.locationid
     82left join (
     83        select articleid, locationid, coalesce(sum(quantity), 0) as incoming from orderedarticles o
     84        where o.articlestatus='In progress' or o.articlestatus='Delivered'
     85        group by o.articleid, o.locationid
     86) q2 on q2.articleid=a.articleid and q2.locationid=l.locationid
     87left join (
     88        select i.articleid, l.locationid, coalesce(sum(quantity), 0) as sold from invoicedarticles i
     89        left join invoices inv on inv.invoiceid=i.invoiceid and inv.datecreate between now()-interval '1 month' and now()
     90        left join workers w on w.userid=inv.workeruserid
     91        left join locations l on l.locationid=w.locationid
     92        group by i.articleid, l.locationid
     93)q3 on q3.articleid=a.articleid and q3.locationid=l.locationid
     94order by a.articlename
     95
     96}}}
     97
    6798===  Извештај за профитот на сите магацини според набавени артикли и продадени артикли во период од една година===
    6899