chris_kzn
18th February 2014, 16:26
Hello BaaN gurus,

I am trying to find a method whereby the end user can run a report which would allow them to select either the top 10 or the top 20 suppliers, they can choose. Attached is the progress thus far of where I have got. I know that a sql query will be the quickest and shortest route but I really want to try and figure out these form customizations.

Anyway, if any of you could help the learner out he would greatly appreciate it. I need a formula that would reflect the total revenue, whether the user chooses by Purchase Order Date, by Receipt Date or by Delivery Date.

I am sure this must have been done and completed by most of the gurus.
:eek:

mark_h
18th February 2014, 20:48
I am not sure what you are looking for and those dates come from different tables. So depending which one you picked on which table you would hit to determine which suppliers and orders qualify. I am not sure this works for you - but sometimes I ask how they want a report to run. So lets say they pick the run option of receipt date. Then in my choice.continue I check for the run option and then call a routine specific to that run option. Each run options can have their own functions and/or reports.

Not saying you can't do it as one big query or function, but I like things simple.

bhushanchanda
19th February 2014, 06:50
Hi,

Yes, as Mark pointed out, at LN side too, we have the dates in different tables as well. And, its always better to split up your logic into different modules. That becomes efficient when you have to track out the errors or add more information to your reports. Not sure about the table structures, names on your version so can't really help you out with the exact queries you will need to trigger, but my suggestion would be the same i.e. use functions/sub-routines to build the report.

chris_kzn
19th February 2014, 12:23
Thank you guys - what we simply want is a list of top ten or top 25 suppliers whom we have spent the most amount of money with.

bhushanchanda
19th February 2014, 13:56
Here's a simple script to get the Top 10 Customers:-


function read.main.table()
{
select sum(cisli245.amth(1)):float0,
cisli245.stbp
from cisli245,cisli205
where cisli245._index2 refers to cisli205
and cisli205.idat inrange {:date.f} and {:date.t}
group by cisli245.stbp
as set with 10 rows
selectdo
get.name()
rprt_send()
endselect
}

function get.name()
{
select tccom100.nama
from tccom100
where tccom100._index1 = :cisli245.stbp
selectdo
endselect
}

I am getting the Invoice Date range. Similarly, in your case, you can use tfacp251 if you want to get the actual invoiced amount.
Again, I am not sure about the tables in your version, but in LN I can use tables like:-

tdpur400:- if I want to get the data based on Order Date
whinh312:- if I want to get the data based on Receipt Date
tfacp251:- if I want to get the data based on Document Date

You just need to add/subtract the amounts the discounts, you need to convert the amounts in Home currencies if there is no Amount in Home Currency field in the table etc.

Also figure out the date range you need to use.

mark_h
19th February 2014, 15:22
His profile shows 4c4 - not sure all those tables are relevant. But they can apply the same type logic to 4c4 tables. I don't think we do anything like this in 4c4 - done in a reporting tool or maybe our quality software.

chris_kzn
24th February 2014, 08:30
Thank you both, yes I am using BaaN4c4, so will have to modify it accordingly but hopefully the logic will work the same - now just to identify which tables correspond to these listed tables. Thank you.