Just with a bit of explanation. Sage Pro ERP has global variables which stores current fiscal year and period for the company and these are as follows.
1. gc_fcyr – This variable stores current fiscal year for the logged in company. Example “2013”
2. gc_fcprd – This variable stores current fiscal period for the logged in company. Example “003
Along with these global variables there exists a program “c_retfyp” which is also used to determine the fiscal year and period for the company. The syntax to call this routine is as follows.
ln_fyear = c_retfyp(gc_compid, ld_date, 3, .f.)
where gc_compid = current company
ld_date = current system date
The third parameter is numeric value and you can pass any value from 1 to 4 and based upon these values the routine will return results in different string format which is as follows.
1 = return the year as a 4-character string
2 = return the period as a 2-character string
3 = return the year+period as a 7-character string
4 = return the quarter as a single-character string
The fourth parameter should be passed as .f.
Consider the below example to get the current fiscal year and period for login company. Here I will pass ld_date = {01/16/14}
ln_fyear = c_retfyp(gc_compid, ld_date, 1, .f.)
Then depending upon 3rd parameter value I will get below results.
3rd parameter value is 1, then I will get output as “2014”
3rd parameter value is 2, then I will get output as “001”
3rd parameter value is 3, then I will get output as “2014001”
3rd parameter value is 4, then I will get output as “1”