0

Finding Salesperson Code

Hi,
I have a report that lists all lines from the sales invoice line with "posting date" and "external document no." from the sales invoice header as filters:

B5 = NL("rows","sales invoice line",,"unit price","<>0","type","item","quantity","<>0","document no.",nl("filter","sales invoice header","no.","external document no.","XXX","posting date",np("datefilter","$B$2","$B$3")))

and on one of the columns, I have the salesperson code attached to each combination of item commission group code/sell-to customer no./shipment date (salesperson could be switched in the middle of the month):

C5 = NL(,"salesperson commission rate","salesperson code","commission type","contact","no.",NF(B5,"sell-to customer no."),"item commission group code",NF(B5,"item commission group code"),"start date",CONCATENATE("''|",np("datefilter",,NF(B5,"shipment date"))),"end date",CONCATENATE("''|",np("datefilter",NF(B5,"shipment date"),)))

I know that there is a field on the sales invoice line for salesperson code (summary salesperson code), but for some reason I cannot use that field. It works fine anyway, using the above formula.

Is there a way to get a list of unique "salesperson code" based on the following 3 tables with Jetreports formula:

Salesperson commission rate:
"commission type" = "contact"
"item commission group code" = "item commission group code" from sales invoice line
"start date" <= "shipment date" from sales invoice line or blank
"end date" >= "shipment date" from sales invoice line or blank

Sales invoice header:
"external document no." = "XXX"
"posting date" = np("datefilter","$B$2","$B$3")

Sales invoice line:
"document no." = "no." from sales invoice header
"unit price","<>0","type","item","quantity","<>0"

Thank you.

3 comments

Please sign in to leave a comment.