(ATCScript "Water Balance Report" (Arg "DataFileObject") (Arg "ReportFile" "WaterBalanceReport.txt" "") (Set DoRow (FileAsString (+ StandardsDir "DoWaterBalanceRow.spt"))) (Set GroupCounter 0) (Set CRLF (+ (Chr 13) (Chr 10))) (Set PageHeader (+ "Water Balance Report for Scenario [" CurScenario "]" CRLF " Run Made " (Format (FileAttribute (+ InputDir CurScenario ".hbn") "date") "yyyy-mm-dd hh:mm") CRLF " (Units:Inches)" ) ) (If (= CurScenario "CurScenario") (Warn "CurScenario must be set before calling WaterBalance." "Water Balance Report") (Else (If (= DateFormat "DateFormat") (Set DateFormat " yyyy ")) (SaveFile ReportFile PageHeader) (Set sampleData (DataFile DataFileObject Data Scenario CurScenario Constituent SURO)) (Set Dates (DataTser sampleData Dates)) (Set nVal (Len Dates)) (For CurLocation In (DataFile DataFileObject AttributeValues "Location") (If (Or (> (InStr CurLocation "P:") 0) (> (InStr CurLocation "I:") 0)) (If (And (= (Mod GroupCounter 2) 0) (> GroupCounter 0)) (AppendFile ReportFile (+ CRLF (Chr 12) PageHeader)) ) (Increment GroupCounter) (Set Row 1) (Grid "Report" (+ nVal 3) 21) (Increment Row) (Grid 1 (Increment Row) (+ "Water Balance for " CurLocation)) (Increment Row) (Grid 1 Row "Date ") (For col = 1 to nVal (Grid (+ col 1) Row (+ " " (Format (ArrayItem Dates (- col 1)) DateFormat))) ) (Grid (+ nVal 2) Row " Aver ") (Grid (+ nVal 3) Row " Sum ") (If (> (InStr CurLocation "P:") 0) (Increment Row) (Grid 1 (Increment Row) "Rainfall ")(Set CurConstituent SUPY) (RunScript DoRow) (Increment Row) (Grid 1 (Increment Row) "Runoff") (Grid 1 (Increment Row) " Surface ")(Set CurConstituent SURO) (RunScript DoRow) (Grid 1 (Increment Row) " Interflow ")(Set CurConstituent IFWO) (RunScript DoRow) (Grid 1 (Increment Row) " Baseflow ")(Set CurConstituent AGWO) (RunScript DoRow) (Grid 1 (Increment Row) " Total ")(Set CurConstituent PERO) (RunScript DoRow) (Increment Row) (Grid 1 (Increment Row) "Deep Groundwater")(Set CurConstituent IGWI) (RunScript DoRow) (Increment Row) (Grid 1 (Increment Row) "Evaporation") (Grid 1 (Increment Row) " Potential ")(Set CurConstituent PET) (RunScript DoRow) (Grid 1 (Increment Row) " Intercep St ")(Set CurConstituent CEPE) (RunScript DoRow) (Grid 1 (Increment Row) " Upper Zone ")(Set CurConstituent UZET) (RunScript DoRow) (Grid 1 (Increment Row) " Lower Zone ")(Set CurConstituent LZET) (RunScript DoRow) (Grid 1 (Increment Row) " Ground Water")(Set CurConstituent AGWET)(RunScript DoRow) (Grid 1 (Increment Row) " Baseflow ")(Set CurConstituent BASET)(RunScript DoRow) (Grid 1 (Increment Row) " Total ")(Set CurConstituent TAET) (RunScript DoRow) (Else (If (> (InStr CurLocation "I:") 0) (Increment Row) (Grid 1 (Increment Row) "Rainfall ")(Set CurConstituent SUPY) (RunScript DoRow) (Increment Row) (Grid 1 (Increment Row) "Runoff") (Increment Row) (Grid 1 (Increment Row) " Surface ")(Set CurConstituent SURO) (RunScript DoRow) (Increment Row) (Grid 1 (Increment Row) "Evaporation") (Grid 1 (Increment Row) " Potential ")(Set CurConstituent PET) (RunScript DoRow) (Grid 1 (Increment Row) " Actual ")(Set CurConstituent IMPEV)(RunScript DoRow) (C Warn (Grid AsText)) ) ) ) (AppendFile ReportFile (Grid AsText (Chr 9) CRLF)) ) ) ) (If (= PrintFile "print") (Warn "printing" "status") (OpenFile ReportFile PrintFile) ) )