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

Query

Hi

SELECT DISTINCT T0.[CardName] as 'Party Name', T0.[DocNum] as 'Inv No', T0.[DocDate] as 'Date', (T0.[DocTotal]-T0.[VatSum]) as 'Basic', T0.[VatSum] as 'Taxes', T0.[DocTotal] as 'Inv Total', T1.U_O_Payment , (T0.DocTotal+T1.U_O_Payment) FROM OINV T0 INNER JOIN ORDR T1 ON T0.cardcode = T1.cardcode INNER JOIN OCRD T2 ON T0.cardcode = T2.cardcode

WHERE t0.docdate >=[%1] and t0.docdate <=[%2]

GROUP BY T0.[DocNum], T0.[DocDate], T0.[CardName], T0.[DocTotal], T0.[VatSum], T1.U_O_Payment

It is not displaying information from those orders which are related to invoice wise. Isn't it is related to through doc number or base document no.

Thanks

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 09, 2011 at 04:23 PM

    Hi,

    Try:

    SELECT DISTINCT T0.CardName as 'Party Name', T0.DocNum as 'Inv No', T0.DocDate as 'Date', (T0.DocTotal-T0.VatSum) as 'Basic', T0.VatSum as 'Taxes', T0.DocTotal as 'Inv Total', MAX(T3.U_O_Payment ), (T0.DocTotal+MAX(T3.U_O_Payment))

    FROM OINV T0

    INNER JOIN INV1 T1 ON T1.DocEntry=T0.DocEntry

    INNER JOIN OCRD T2 ON T0.cardcode = T2.cardcode

    LEFT JOIN ORDR T3 ON T3.DocEntry= T1.BaseEntry AND T1.BaseType= 17

    WHERE t0.docdate >=[%1\] and t0.docdate <=[%2\]

    GROUP BY T0.DocNum, T0.DocDate, T0.CardName, T0.DocTotal, T0.VatSum

    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.