Skip to Content
Jun 19, 2008 at 01:51 PM




I have made the query which is not OK

I would like to have per document date the sum of total net amount for all invoices minus total net amount of credit notes and also total weight invoices less total weight creidt note. the link is the date but if tehre is not a creidt note raised that date the query takes only net total of invoices

SELECT T0.[DocDate], SUM((T0.DocTotal-T0.VATsum-T0.TotalExpns)-(T1.DocTotal-T1.VATsum-T1.TotalExpns)) as 'CA HT', SUM(T0.[Weight]-T1.[Weight]) AS POIDS FROM OINV T0 OUTER JOIN ORIN T1 ON T1.[DocDate]=T0.[DocDate] 
WHERE T0.[DocDate] >=[%0] and  T0.[DocDate] <=[%1] 
GROUP BY T0.[DocDate]