diff --git a/Finance Reports/BudgetCumulativeComparison.py b/Finance Reports/BudgetCumulativeComparison.py index bbba951..b274483 100644 --- a/Finance Reports/BudgetCumulativeComparison.py +++ b/Finance Reports/BudgetCumulativeComparison.py @@ -3,9 +3,10 @@ global model sql = model.SqlContent('BudgetCumulativeGivingYoY') +model.Title = "Cumulative Giving Comparison" # Initialize data structure to store percentages by year and week -weeks = range(1, 54) # Assuming there are 52 weeks +weeks = range(1, 54) # Assuming there are 53 weeks years = [] d = [] # Will store data for each year, where each entry is a list of 52 weeks @@ -31,20 +32,20 @@ d[year_col][52] = row.Percentage # Generate Google Chart script -print """""" -print """") +print("
-""" \ No newline at end of file +""") \ No newline at end of file diff --git a/Finance Reports/BudgetSummary.sql b/Finance Reports/BudgetSummary.sql index d96aa6b..16a87f0 100644 --- a/Finance Reports/BudgetSummary.sql +++ b/Finance Reports/BudgetSummary.sql @@ -53,7 +53,7 @@ FROM #contribs c LEFT JOIN FundSets fs ON fsf.FundSetId = fs.FundSetId GROUP BY c.Month, c.year, fsf.FundSetId, COALESCE(fs.description, cf.FundName); -SELECT TOP 100 * +SELECT * INTO #summed FROM ( SELECT @@ -93,7 +93,8 @@ SELECT c.Fund, p.Giving AS 'Giving PYTD', c.Giving - p.Giving AS 'PY Difference', (c.Giving - p.Giving) * 100 / p.Giving AS 'PY Pct', - CAST(@Today AS DATE) AS 'As Of' + CAST(@Today AS DATE) AS 'As Of', + @year as 'Year' FROM #summed c LEFT JOIN #summed p ON c.Fund = p.Fund AND c.Year = p.Year + 1 WHERE c.Budget > 0 AND c.year = @year @@ -109,7 +110,8 @@ SELECT c.Fund, p.Giving AS 'Giving PYTD', c.Giving - p.Giving AS 'PY Difference', (c.Giving - p.Giving) * 100 / p.Giving AS 'PY Pct', - CAST(@Today AS DATE) AS 'As Of' + CAST(@Today AS DATE) AS 'As Of', + @year as 'Year' FROM #summed c LEFT JOIN #summed p ON c.Fund = p.Fund AND c.Year = p.Year + 1 WHERE c.Budget IS NULL AND c.year = @year diff --git a/Finance Reports/BudgetSummaryChart.py b/Finance Reports/BudgetSummaryChart.py index eab1610..6bcbbea 100644 --- a/Finance Reports/BudgetSummaryChart.py +++ b/Finance Reports/BudgetSummaryChart.py @@ -1,6 +1,9 @@ global model +global Data -sql = model.SqlContent('BudgetSummary').replace('@p1', '1') +y = Data.p1 or '1' + +sql = model.SqlContent('BudgetSummary').replace('@p1', y) d = model.SqlListDynamicData(sql) def formatMoney(num): @@ -13,8 +16,8 @@ def formatMoney(num): labelPositions = [[]] def determineLine(x): - margin = 80 - + margin = 85 + line = 1 while True: c = False @@ -23,7 +26,7 @@ def determineLine(x): for lp in labelPositions[line]: if lp is None: continue - + if lp > x-margin and lp < x+margin: line += 1 c = True @@ -38,12 +41,12 @@ def getMarkedLabel(x, y, label1, label2, textColor="#000", lineStyle="stroke:#99 line = determineLine(x) yBase = y + 10 # top of bar y += line * 50 + 10 # top of the indicator (for line 1, bottom of the bar). - + yTop = yBase - (10 if extendTop else 0) r = "