foxproquery
Programmer
I have a line of code for a program that calculates the ledgers for the next month and adds them to the ledger tables.NB: There may be transactions already posted to the nest month, so these will have to be taken into considerations. Here is the code
[SELECT CL.ol_prid, CL.ol_ownid, CL.Ol_accid,m.nxtmo AS ol_month, m.nxty AS ol_year, ;
CL.ol_aabb, CL.ol_aacb, CL.ol_aacbdt, ;
CL.ol_prbb, CL.ol_prcb, CL.ol_prcbdt, ;
CL.ol_gsbb, CL.ol_gscb, CL.ol_gscbdt, ;
CL.ol_mfbb, CL.ol_mfcb, CL.ol_mfcbdt, ;
FROM c_oledg CL;
WHERE CL.ol_prid+CL.ol_ownid+CL.ol_accid+STR(CL.ol_month,2)+STR (CL.ol_year,4) NOT IN ;
(SELECT DISTINCT primkey ; FROM c_otran) ;
INTO ARRAY a_oupdat ;
UNION ;
SELECT L.ol_prid, L.ol_accid, m.nxtmo AS ol_month, m.nxty AS ol_year, ;
L.ol_aabb+T.ol_aabb AS ol_aabb, ;
L.ol_aacb, L.ol_aacbdt, ;
L.ol_prbb+T.ol_prbb AS ol_prbb, ;
L.ol_prcb, L.ol_prcbdt, ;
L.ol_gsbb+T.ol_gsbb AS ol_gsbb, ;
L.ol_gscb, L.ol_gscbdt, ;
L.ol_mfbb+T.ol_mfbb AS ol_mfbb, ;
L.ol_mfcb, L.ol_mfcbdt ;
FROM c_oledg L, c_otran ;
WHERE L.ol_prid+L.ol_ownid+L.ol_accid+STR(L.ol_month,2)+STR (L.ol_year,4)==T.primkey;
ORDER BY 1,2,3,4
SELECT ownledg
APPEND FROM ARRAY a-oupdat
Do dopen WITH "ownledg","monthlies"
FOR j=1 TO ALEN(a_oupdat,1)
IF SEEK(a_oupdat[j,1]+a_oupdat[j,2]+a_oupdat[j,3]+STR(m.mACMO,2)+STR(m.mACYR,4))
REPL ownledg.ol_aacb WITH a_oupdat[j,6], ;
ownledg.ol_aacb WITH a_oupdat[j,9], ;
ownledg.ol_aacb WITH a_oupdat[j,12], ;
ownledg.ol_aacb WITH a_oupdat[j,15], ;
ENDIF
ENDFOR]
My question is this code is calculating the management fee applied from the prior month and instead of carrying it over to the next month it is doubling it and dumping it in the wrong field instead of the prior month field.How can i rectify this glitch.
[SELECT CL.ol_prid, CL.ol_ownid, CL.Ol_accid,m.nxtmo AS ol_month, m.nxty AS ol_year, ;
CL.ol_aabb, CL.ol_aacb, CL.ol_aacbdt, ;
CL.ol_prbb, CL.ol_prcb, CL.ol_prcbdt, ;
CL.ol_gsbb, CL.ol_gscb, CL.ol_gscbdt, ;
CL.ol_mfbb, CL.ol_mfcb, CL.ol_mfcbdt, ;
FROM c_oledg CL;
WHERE CL.ol_prid+CL.ol_ownid+CL.ol_accid+STR(CL.ol_month,2)+STR (CL.ol_year,4) NOT IN ;
(SELECT DISTINCT primkey ; FROM c_otran) ;
INTO ARRAY a_oupdat ;
UNION ;
SELECT L.ol_prid, L.ol_accid, m.nxtmo AS ol_month, m.nxty AS ol_year, ;
L.ol_aabb+T.ol_aabb AS ol_aabb, ;
L.ol_aacb, L.ol_aacbdt, ;
L.ol_prbb+T.ol_prbb AS ol_prbb, ;
L.ol_prcb, L.ol_prcbdt, ;
L.ol_gsbb+T.ol_gsbb AS ol_gsbb, ;
L.ol_gscb, L.ol_gscbdt, ;
L.ol_mfbb+T.ol_mfbb AS ol_mfbb, ;
L.ol_mfcb, L.ol_mfcbdt ;
FROM c_oledg L, c_otran ;
WHERE L.ol_prid+L.ol_ownid+L.ol_accid+STR(L.ol_month,2)+STR (L.ol_year,4)==T.primkey;
ORDER BY 1,2,3,4
SELECT ownledg
APPEND FROM ARRAY a-oupdat
Do dopen WITH "ownledg","monthlies"
FOR j=1 TO ALEN(a_oupdat,1)
IF SEEK(a_oupdat[j,1]+a_oupdat[j,2]+a_oupdat[j,3]+STR(m.mACMO,2)+STR(m.mACYR,4))
REPL ownledg.ol_aacb WITH a_oupdat[j,6], ;
ownledg.ol_aacb WITH a_oupdat[j,9], ;
ownledg.ol_aacb WITH a_oupdat[j,12], ;
ownledg.ol_aacb WITH a_oupdat[j,15], ;
ENDIF
ENDFOR]
My question is this code is calculating the management fee applied from the prior month and instead of carrying it over to the next month it is doubling it and dumping it in the wrong field instead of the prior month field.How can i rectify this glitch.