cancel
Showing results for 
Search instead for 
Did you mean: 

Sellers and Prepared By in Invoices...OINV?

Former Member
0 Kudos

Hi,

I was requested to obtain a query that retrieves the sellers and originators for all invoices, I have tried looking into OINV but no luck yet.

Can someone tell me or suggest what table(s) should I look for?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

edy_simon
Active Contributor
0 Kudos

Hi Jose,

Not sure what you refers as Sellers and Originators.. maybe different localization.

But if you are referring to

Sales Person = OINV.SlpCode Join to the OSLP table

Owner = OINV.OwnerCode Join to the OHEM table.

Regards
Edy

Former Member
0 Kudos

ok with seller.

The other one I need is the one who creates the invoice in the system, not the seller, in Spanish it is 'Prepared By'.

edy_simon
Active Contributor
0 Kudos

Hi Jose,

the creator of the Invoice

OINV.UserSign join to the OUSR table

Regards

Edy

Former Member
0 Kudos

I have done this query to get both but it is not giving the exact result, it is providing multiple creators (don't make sense):

SELECT T0.DocNum as "Invoice Number", T0.CardCode as "Customer Code", T0.CardName as "Name", T0.NumAtCard as "Ref / PO No.", (T0.DocTotal-T0.VatSum) as "Invoice Ammount",

T1.SlpName as "Vendedor", T2.U_NAME as "Originator"

FROM OINV T0

INNER JOIN dbo.OSLP T1 ON T1.SlpCode=T0.SlpCode

INNER JOIN OUSR T2 on T0.UserSign=T2.userSign

edy_simon
Active Contributor
0 Kudos

Hi Jose


INNER JOIN OUSR T2 on T0.UserSign=T2.userSign


Change it to


INNER JOIN OUSR T2 on T0.UserSign=T2.USERID



Regards

Edy

Former Member
0 Kudos

Many, many thanks it worked like a charm!

Answers (0)