Skip to Content
author's profile photo Former Member
Former Member

query with creditnote details

Hi,

is there somebody who is able to add some extra line to thi query to see also to creditnote totals en amount on the result.

now it is only showing ar invoices

select

itemcode, dscription, sum(quantity) as HVH, sum(linetotal) as Omzet

from

inv1 t0 inner join oinv t1 on t0.docentry = t1.docentry

where

t1.cardcode between '[%0]' and '[%1]' and

t1.docdate >= '[%2]' and t1.docdate <= '[%3]' and

itemcode in (select itemcode from oitm t2 where t2.cardcode = '[%4]')

group by itemcode, dscription

thanks

Mark

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 15, 2010 at 02:44 PM

    Hi Matk,

    Try this:

    select
    itemcode, dscription, sum(quantity) as HVH, sum(linetotal) as Omzet
    from
    inv1 t0 inner join oinv t1 on t0.docentry = t1.docentry
    where
    t1.cardcode between '[%0]' and '[%1]' and
    t1.docdate >= '[%2]' and t1.docdate <= '[%3]' 
    and t0.itemcode in (select itemcode from oitm t2 where t2.cardcode = '[%4]')
    group by itemcode, dscription
    UNION ALL
    select
    itemcode, dscription, -sum(quantity) as HVH, -sum(linetotal) as Omzet
    from
    rin1 t0 inner join orin t1 on t0.docentry = t1.docentry
    where
    t1.cardcode between '[%0]' and '[%1]' and
    t1.docdate >= '[%2]' and t1.docdate <= '[%3]' 
    and t0.itemcode in (select itemcode from oitm t2 where t2.cardcode = '[%4]')
    group by itemcode, dscription
    order by itemcode
    

    Thanks,

    Gordon

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.