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

Incoming payment

hi,

i would like to include OCQG GroupName to the following query.

SELECT

T0.DocDate as 'Posting Date',

T0.DocNum as 'AR Invoice Number',

T0.CardName,

T3.SlpName,

T0.DocDate as 'Payment Date',

T1.DocNum as 'Incoming Payment Number ',

T0.DocTotal as 'AR Invoice Total',

T1.TrsfrSum,

T1.CashSum,

T1.CheckSum,

T2.CheckNum as 'Cheque Number'

FROM OINV T0

LEFT JOIN ORCT T1 ON T0.ReceiptNum = T1.DocEntry

LEFT JOIN RCT1 T2 ON T1.DocNum = T2.DocNum

Left Join OSLP T3 ON T3.SlpCode= T0.SlpCode

where T0.DocDate >='[%0]' and T0.DocDate <='[%1]'

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on May 25, 2015 at 10:37 AM

    Hi Francis, Its a nice question.

    Please try below quite lengthy but simple query and revert back

    ;WITH Property as

    (

    Select A.CardCode,

    Case When A.QryGroup1 ='Y' then (Select GroupName from OCQG where GroupCode =1)

    When A.QryGroup2 ='Y' then (Select GroupName from OCQG where GroupCode =2)

    When A.QryGroup3 ='Y' then (Select GroupName from OCQG where GroupCode =3)

    When A.QryGroup4 ='Y' then (Select GroupName from OCQG where GroupCode =4)

    When A.QryGroup5 ='Y' then (Select GroupName from OCQG where GroupCode =5)

    When A.QryGroup6 ='Y' then (Select GroupName from OCQG where GroupCode =6)

    When A.QryGroup7 ='Y' then (Select GroupName from OCQG where GroupCode =7)

    When A.QryGroup8 ='Y' then (Select GroupName from OCQG where GroupCode =8)

    When A.QryGroup9 ='Y' then (Select GroupName from OCQG where GroupCode =9)

    When A.QryGroup10 ='Y' then (Select GroupName from OCQG where GroupCode =10)

    When A.QryGroup11 ='Y' then (Select GroupName from OCQG where GroupCode =11)

    When A.QryGroup12 ='Y' then (Select GroupName from OCQG where GroupCode =12)

    When A.QryGroup13 ='Y' then (Select GroupName from OCQG where GroupCode =13)

    When A.QryGroup14 ='Y' then (Select GroupName from OCQG where GroupCode =14)

    When A.QryGroup15 ='Y' then (Select GroupName from OCQG where GroupCode =15)

    When A.QryGroup16 ='Y' then (Select GroupName from OCQG where GroupCode =16)

    When A.QryGroup17 ='Y' then (Select GroupName from OCQG where GroupCode =17)

    When A.QryGroup18 ='Y' then (Select GroupName from OCQG where GroupCode =18)

    When A.QryGroup19 ='Y' then (Select GroupName from OCQG where GroupCode =19)

    When A.QryGroup20 ='Y' then (Select GroupName from OCQG where GroupCode =20)

    When A.QryGroup21 ='Y' then (Select GroupName from OCQG where GroupCode =21)

    When A.QryGroup22 ='Y' then (Select GroupName from OCQG where GroupCode =22)

    When A.QryGroup23 ='Y' then (Select GroupName from OCQG where GroupCode =23)

    When A.QryGroup24 ='Y' then (Select GroupName from OCQG where GroupCode =24)

    When A.QryGroup25 ='Y' then (Select GroupName from OCQG where GroupCode =25)

    When A.QryGroup26 ='Y' then (Select GroupName from OCQG where GroupCode =26)

    When A.QryGroup27 ='Y' then (Select GroupName from OCQG where GroupCode =27)

    When A.QryGroup28 ='Y' then (Select GroupName from OCQG where GroupCode =28)

    When A.QryGroup29 ='Y' then (Select GroupName from OCQG where GroupCode =29)

    When A.QryGroup30 ='Y' then (Select GroupName from OCQG where GroupCode =30)

    When A.QryGroup31 ='Y' then (Select GroupName from OCQG where GroupCode =31)

    When A.QryGroup32 ='Y' then (Select GroupName from OCQG where GroupCode =32)

    When A.QryGroup33 ='Y' then (Select GroupName from OCQG where GroupCode =33)

    When A.QryGroup34 ='Y' then (Select GroupName from OCQG where GroupCode =34)

    When A.QryGroup35 ='Y' then (Select GroupName from OCQG where GroupCode =35)

    When A.QryGroup36 ='Y' then (Select GroupName from OCQG where GroupCode =36)

    When A.QryGroup37 ='Y' then (Select GroupName from OCQG where GroupCode =37)

    When A.QryGroup38 ='Y' then (Select GroupName from OCQG where GroupCode =38)

    When A.QryGroup39 ='Y' then (Select GroupName from OCQG where GroupCode =39)

    When A.QryGroup40 ='Y' then (Select GroupName from OCQG where GroupCode =40)

    When A.QryGroup41 ='Y' then (Select GroupName from OCQG where GroupCode =41)

    When A.QryGroup42 ='Y' then (Select GroupName from OCQG where GroupCode =42)

    When A.QryGroup43 ='Y' then (Select GroupName from OCQG where GroupCode =43)

    When A.QryGroup44 ='Y' then (Select GroupName from OCQG where GroupCode =44)

    When A.QryGroup45 ='Y' then (Select GroupName from OCQG where GroupCode =45)

    When A.QryGroup46 ='Y' then (Select GroupName from OCQG where GroupCode =46)

    When A.QryGroup47 ='Y' then (Select GroupName from OCQG where GroupCode =47)

    When A.QryGroup48 ='Y' then (Select GroupName from OCQG where GroupCode =48)

    When A.QryGroup49 ='Y' then (Select GroupName from OCQG where GroupCode =49)

    When A.QryGroup50 ='Y' then (Select GroupName from OCQG where GroupCode =50)

    When A.QryGroup51 ='Y' then (Select GroupName from OCQG where GroupCode =51)

    When A.QryGroup52 ='Y' then (Select GroupName from OCQG where GroupCode =52)

    When A.QryGroup53 ='Y' then (Select GroupName from OCQG where GroupCode =53)

    When A.QryGroup54 ='Y' then (Select GroupName from OCQG where GroupCode =54)

    When A.QryGroup55 ='Y' then (Select GroupName from OCQG where GroupCode =55)

    When A.QryGroup56 ='Y' then (Select GroupName from OCQG where GroupCode =56)

    When A.QryGroup57 ='Y' then (Select GroupName from OCQG where GroupCode =57)

    When A.QryGroup58 ='Y' then (Select GroupName from OCQG where GroupCode =58)

    When A.QryGroup59 ='Y' then (Select GroupName from OCQG where GroupCode =59)

    When A.QryGroup60 ='Y' then (Select GroupName from OCQG where GroupCode =60)

    When A.QryGroup61 ='Y' then (Select GroupName from OCQG where GroupCode =61)

    When A.QryGroup62 ='Y' then (Select GroupName from OCQG where GroupCode =62)

    When A.QryGroup63 ='Y' then (Select GroupName from OCQG where GroupCode =63)

    When A.QryGroup64 ='Y' then (Select GroupName from OCQG where GroupCode =64)

    else 'None' end [Property]

    from OCRD A

    )

    SELECT

    T0.DocDate as 'Posting Date',

    T0.DocNum as 'AR Invoice Number',

    T0.CardName,

    T4.Property,

    T3.SlpName,

    T0.DocDate as 'Payment Date',

    T1.DocNum as 'Incoming Payment Number ',

    T0.DocTotal as 'AR Invoice Total',

    T1.TrsfrSum,

    T1.CashSum,

    T1.CheckSum,

    T2.CheckNum as 'Cheque Number'

    FROM OINV T0

    LEFT JOIN ORCT T1 ON T0.ReceiptNum = T1.DocEntry

    LEFT JOIN RCT1 T2 ON T1.DocNum = T2.DocNum

    Left Join OSLP T3 ON T3.SlpCode= T0.SlpCode

    Inner Join Property T4 on T0.CardCode = T4.CardCode

    where T0.DocDate >='[%0]' and T0.DocDate <='[%1]'

    Thanks

    Unnikrishnan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 25, 2015 at 10:21 AM

    Hello,

    You can check below:

    SELECT

    T0.DocDate as 'Posting Date',

    T0.DocNum as 'AR Invoice Number',

    T0.CardName,

    T3.SlpName,

    T0.DocDate as 'Payment Date',

    T1.DocNum as 'Incoming Payment Number ',

    T0.DocTotal as 'AR Invoice Total',

    T1.TrsfrSum,

    T1.CashSum,

    T1.CheckSum,

    T2.CheckNum as 'Cheque Number'

    FROM OINV T0

    LEFT JOIN ORCT T1 ON T0.ReceiptNum = T1.DocEntry

    LEFT JOIN RCT1 T2 ON T1.DocNum = T2.DocNum

    Left Join OSLP T3 ON T3.SlpCode= T0.SlpCode

    LEFt JOIN OCRD T4 on T0.CardCode = T4.CardCode

    LEFT JOIN OCQG T5 on T5.GroupCode = T4.GroupCode

    Thanks,

    Joseph

    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.