How to find function source code ?

SOLVED

I need to find the calculations or script for the 'Stock by product' function. Is there an SQL script for that, and how can I find it?