SELECT t1.account AS account, t1.value AS value, COALESCE(t2.budget,0) AS total_budget
FROM
(SELECT public.Accounts.name AS account, SUM(public.Splits.value_num)/AVG(public.accounts.commodity_scu) AS value
FROM public.Accounts
INNER JOIN public.Splits ON public.Accounts.guid=public.Splits.account_guid
INNER JOIN public.transactions ON public.splits.tx_guid = public.transactions.guid
WHERE public.Accounts.account_type = 'EXPENSE' AND public.transactions.post_date >= date_trunc('month', CURRENT_DATE)
GROUP BY public.accounts.name) t1
LEFT JOIN
(SELECT public.accounts.name AS account, public.budget_amounts.amount_num/public.budget_amounts.amount_denom AS budget
FROM public.budget_amounts
INNER JOIN public.accounts ON public.budget_amounts.account_guid = public.accounts.guid
WHERE public.accounts.account_type = 'EXPENSE' AND public.budget_amounts.period_num = date_part('month', CURRENT_DATE)) t2
ON
t1.account = t2.account
ORDER BY value DESC
Maybe if there's an empty or null set from the server, just give the graph an empty object with the column definitions, then you shouldn't need any hacky/custom logic.The month rolled around today, and holey crap there was a lot of bugs waiting to surface! For a start my Monthly Expense bar graphs *completely* disappeared, took me a while to realize that's because I haven't spent anything this month yet -_- doh.
Still, I definitely want columns showing no matter what, so I've rejigged it now to permanently show any Expense accounts that have a budget set for them. If you spend something in an expense account that doesn't have a budget set, the graph will automatically update and start tracking that expenditure too.
Lol, it's probably because of how the table styles it's columns, and the columns are dynamic and will only be within the bounds of the data.Side note: I'd *really* like the last header in my table to extend over the scroll bar, but every time I try something the table explodes in a rather catastrophic fashion.
So unless an actual dev *cough*carnage*cough* wants to take a look, that's how it's going to stay
I switched from JTable to DynaTable btw! Wanted to stick with jquery only
Maybe if there's an empty or null set from the server, just give the graph an empty object with the column definitions, then you shouldn't need any hacky/custom logic.
Yeah probably :/ I think it's something to do with the fact that it's nested inside a bootstrap column, and I'm not applying CSS with enough finesse. Ahh well it'll do for now.Lol, it's probably because of how the table styles it's columns, and the columns are dynamic and will only be within the bounds of the data.
[/quote]A couple suggestions:
Make negative numbers red (standard accounting practices)
If you can, add the "View transactions" and "View details" links to the side menu.
Make the side menu collapsible/expandable.
Yeah probably :/ I think it's something to do with the fact that it's nested inside a bootstrap column, and I'm not applying CSS with enough finesse. Ahh well it'll do for now.
table {
width: 511px; /* 140px * 3 column + 16px scrollbar width */
border-spacing: 0;
}
tbody, thead tr { display: block; }
tbody {
height: 325px;
overflow-y: auto;
overflow-x: hidden;
}
tbody td, thead th {
width: 165px;
}