for notes only
this is sql for annual department budgeting:
select pt.PURCHID, pt.PURCHNAME, pt.ORDERACCOUNT, pt.INVOICEACCOUNT, pt.DELIVERYDATE, pt.CREATEDDATETIME, pt.PURCHSTATUS, /* 3. invoiced */ pt.DATAAREAID, /* pt.SOURCEDOCUMENTHEADER, pt.SOURCEDOCUMENTLINE, */ pl.ITEMID, pl.QTYORDERED, pl.PURCHPRICE, /* pl.QTYORDERED * pl.PURCHPRICE as Total, */ pl.LINEAMOUNT, pl.PURCHUNIT, pl.ASSETID, PL.PURCHREQID, /* PL.PURCHREQLINEREFID, */ PRT.PURCHREQNAME, PRT.SUBMITTEDBY, PRL.NAME from PURCHTABLE pt inner join PURCHLINE pl on pt.DATAAREAID=pl.DATAAREAID and pt.PURCHID=pl.purchid INNER JOIN PURCHREQTABLE PRT ON PRT.PURCHREQID=PL.PURCHREQID INNER JOIN PURCHREQLINE PRL ON PRL.LINEREFID=PL.PURCHREQLINEREFID where 1=1 and year(pt.DELIVERYDATE)=2016 --and pt.DATAAREAID='mtl_' AND PRT.SUBMITTEDBY='it.helpd'