Changes between Version 6 and Version 7 of AdvancedReports
- Timestamp:
- 12/27/22 20:59:59 (2 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
AdvancedReports
v6 v7 70 70 select q1.locationname, prihod-odliv as profit from 71 71 ( 72 select l.locationid, l.locationname, sum(i.price*i.quantity) as prihod from locations l72 select l.locationid, l.locationname, coalesce(sum(i.price*i.quantity), 0) as prihod from locations l 73 73 left join storedarticles s on s.locationid=l.locationid 74 74 left join invoicedarticles i on i.articleid=s.articleid … … 79 79 full outer join 80 80 ( 81 select l.locationid, l.locationname, sum(o.price*o.quantity) as odliv from locations l81 select l.locationid, l.locationname, coalesce(sum(o.price*o.quantity), 0) as odliv from locations l 82 82 left join orderedarticles o on o.locationid=l.locationid 83 83 left join orders o2 on o2.orderid=o.orderid and o2.datecreated between now()-interval '1 year' and now() … … 85 85 86 86 ) q2 on q2.locationid=q1.locationid 87 88 87 }}} 89 88 … … 109 108 110 109 }}} 110 111 === Извештај за набавувачите со најголема заработка=== 112 113 {{{#!sql 114 select s.supplierinfo, u.firstname, u.lastname, u.username, coalesce(sum(o2.quantity), 0) as koldostavena, coalesce(sum(o2.quantity*o2.price)) as zarabotkasupp from suppliers s 115 left join users u on u.userid=s.userid 116 left join orders o on o.supplieruserid=s.userid and (o.status='Delivered' or o.status='Processed') 117 left join orderedarticles o2 on o2.orderid=o.orderid and (o2.articlestatus='Delivered' or o2.articlestatus='Processed') 118 group by s.userid, u.userid 119 order by zarabotkasupp desc 120 121 122 }}}