custom discount mod

Having fun setting up our new v.2_0_15 CS-Cart! Our company uses a strange discount matrix. There are 17 different customer groups. Each group is sub-divided into 10 different price levels. Products are divided into two different groups which affects the 10 price levels. I have successfully built a php script that reads across two of our proprietary tables in an adjacent mysql database to grab the price for each item for each customer group. It seems it would make more sense to make a call to an outside script to grab the price rather than insert into the product_prices static table (of about 850,000 rows according to my calculations). I would like to replace the get price function that CS-Cart uses with the one I wrote. In other words, when a call to the price is made, it will call the function I wrote. I see the get price function in the fn_catalog.php file. Does anyone have any suggestions before I would go and try to write a replacement function in this file? Has anyone ever written a mod to call a script written outside of CS-Cart (such as a stored procedure)? Thanks in advance for any help!