Hi All
for VAT Computation I've framed following query.
Select inv1.taxcode , sum(valsum)
from oinv inner join inv1 on oinv.docentry = inv1.docentry
where oinv.docdate >= '01/sep/2011' and oinv.docdate <= '30/sep/2011'
group by inv1.taxcode.
In this query I want to exclude credit notes within 6 months.
But , if a credit note is passed after six months then VAT will be borned by the customer.
So, for this , I tried following query
Select inv1.taxcode , sum(valsum)
from oinv inner join inv1 on oinv.docentry = inv1.docentry
right outer join rin1 on inv1.docentry = rin1.baseentry and inv1.linenum = rin1.baseline and rin1.docdate > dateadd(M,6,inv1.docdate)
where oinv.docdate >= '01/sep/2011' and oinv.docdate <= '30/sep/2011'
group by inv1.taxcode.
But this is not giving me the desired result.
Your help is needed.
Thanking You
Malhaar