Balance Sheet File

1.  Import the Balance Sheet Excel worksheet and index the SystemCode and MunID fields.

2.  Update the MunID in the work table: UPDATE aa_al_fundbalance JOIN m_municipalities ON SystemCode = MunDOECode SET aa_al_fundbalance.MunID = m_municipalities.MunID WHERE MunModID = 2 AND MunState = 'AL' AND MunType = 'District'

3.  Update the SadID in the work table: UPDATE aa_al_fundbalance JOIN m_schoolannualdata ON MunID = SadScdID AND FiscalYear = SadYear SET aa_al_fundbalance.SadID = m_schoolannualdata.SadID WHERE SadScenario = 'Baseline'

4.  Check for missing SadID’s and insert records for each one missing: INSERT INTO m_schoolannualdata (SadScdID, SadYear, SadDataStatus, SadScenario, SadDateAdded, SadDateModified) SELECT DISTINCT aa_al_expenditures.MunID AS SadScdID, FiscalYear AS SadYear, 'Audited' AS SadDataStatus, 'Baseline' AS SadScenario, NOW() AS SadDateAdded, NOW() AS SadDateModified FROM aa_al_expenditures JOIN m_municipalities ON SystemCode = MunDOECode WHERE SadID IS NULL AND MunModID = 2 AND MunState = 'AL' AND MunType = 'District'

5.  Run the update to SadID script again.

6.  Now insert the Expenditure records to the financial detail table: INSERT INTO s_financialdatadetail (SfdMunID, SfdSadID, SfdFtsID, SfdSscID, SfdFundCode, SfdAmount, SfdDateAdded, SfdDateModified) SELECT MunID, SadID, SfdFtsID, SfdSscID, SfdFundCode, ROUND(REPLACE(REPLACE(SfdAmount,'$',''),',',''),0), SfdDateAdded, SfdDateModified FROM aa_al_fundbalance