MySQL Steps

Import RawData into MySQL and create a new table named: aa_mi_bsa_import.

1.  Update the FtsID and FutIF from the local unit’s chart of accounts: UPDATE aa_mi_bsa_import JOIN c_lufundcodes ON ImpFundCode = LfcCode JOIN c_fundtypestatecodes ON FtsID = LfcFtsID SET ImpLfcID = LfcID, ImpFutID = FtsFutID, ImpFtsID = FtsID WHERE LfcMunID = ImpMunID.

2.  Check for missing FutID’s: SELECT * FROM aa_mi_bsa_import WHERE ImpFutID IS NULL;.

3.  Update the ImpSscID by joining on the local unit’s chart of accounts: UPDATE aa_mi_bsa_import JOIN c_lucostcenters ON ImpFunctionCode = LccCode SET ImpFddLccID = LccID, ImpSscID = LccSscID WHERE ImpMunID = LccMunID AND ImpSection = LccSection

4.  Check for missing ImpSscID’s: SELECT * FROM aa_mi_bsa_import WHERE ImpSscID IS NULL;.

5.  Insert the temp data in the m_financialdatadetail table: INSERT INTO m_financialdatadetail (FddAndID, FddFutID, FddFtsID, FddLfcID, FddSscID, FddLccID, FddAccountString, FddAmount, FddComment, FddDateAdded, FddDateModified) SELECT ImpAndID, ImpFutID, ImpFtsID, ImpLfcID, ImpSscID, ImpFddLccID, ImpAccountString, ImpAmount, ImpDescription, NOW(), NOW() FROM aa_mi_bsa_import.

6.  Now insert any account string that do not already exist: INSERT INTO c_luaccountstrings (LasMunID, LasSection, LasLfcID, LasLccID, LasLocID, LasAccountString) SELECT DISTINCT ImpMunID, ImpSection, ImpLfcID, ImpFddLccID, '', ImpAccountString FROM aa_mi_bsa_import.