-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor General Ledger #2462
Refactor General Ledger #2462
Conversation
02cb7c7
to
4660c1b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I just noticed that there is an error when click on action -> Extrait de compte
to get the extrait de compte
report.
account.isTitleAccount = account.type_id === bhConstants.accounts.TITLE; | ||
function removeZeroes(account) { | ||
// remove zero values from the matrix to render as empty cells. | ||
fields.forEach(function (field) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -0,0 +1,138 @@ | |||
/** | |||
* @class Tree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 awesome... Good job
const Tree = require('../../server/lib/Tree'); | ||
const { expect } = require('chai'); | ||
|
||
function TreeUnitTests() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃 Excellent
@jniles this is the error thrown when we click on |
@mbayopanda, thanks for the bug report! Clearly I should probably address all the problems with the GL in this PR to make sure that we get it right. Here's my current plan of action:
Thanks for the review! It's good to have you back 👍 |
@mbayopanda, I've completed all the work I said I would do. When you get a chance, could I have another review? |
This commit optimizes the General Ledger matrix query by only doing a single SELECT with a GROUP BY. It also removes the need for pre-querying period ids and uses the raw fiscal year id instead. This is the first step to further optimizations of calculating the balances of title accounts by summing down the account tree.
This commit adds a footer to the General Ledger with the Fiscal Year in it. This allows rapid changes to the view without need to have multiple clicks.
This commit implements a Tree class on the server for constructing trees out of accounts, units, or other tree structures. The only requirement is that the objects have references pointing them to their parents.
This commit implements the sumOnProperty() function to sum tree nodes on a given property. Parent nodes are given the values of the sums of their children.
This commit implements basic summing on the general ledger's title accounts. The summing is performed on the server in JavaScript, but could be done on the client just as easily.
This commit makes sure empty accounts are pruned from the General Ledger report.
This commit removes the old Account Slip report link and replaces it with the account statement report link from the General Ledger. Closes Third-Culture-Software#1706.
This commit removes the account slip which is no longer used. It also adds an indent to the account list so that nested items are clearly below their parent. Finally, title accounts are rendered in bold.
This commit renames the general ledger files to remove the "accounts" portion of the name from all identifiers. This is the real General Ledger, since the previous version was folded into the Journal.
This commit indents the accounts in the tree to emphasize their relationships.
This commit implements a check footer at the bottom of the grid that sums the values in the columns. As a rule of accounting, summing the chart of accounts should give a zero. Thus, any columns which do not sum to 0 denote a problem in the dataset. Closes Third-Culture-Software#2463.
This commit links the General Ledger to the Account Statement via the dropdown menu in the General Ledger. Closes Third-Culture-Software#2459.
5c91185
to
ae25a1d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works very well. :+1
bors r+ |
2462: Refactor General Ledger r=mbayopanda a=jniles This PR refactors the General Ledger to make it more useful from an accounting perspective. **Code Refactor** 1. The server-side SQL query has been rewritten to be more performant and easier to read. In particular, the WHERE query filters on fiscal year instead of first looking up the periods in the fiscal year. 2. Removed the Account Slip code - it was essentially a duplication of effort from the Account Statement code. 3. Renamed all variables references `general-ledger-accounts` to `general-ledger`. We had folded the previous "General Ledger" into the Journal, so only this one remains. **Features** 1. A `<select>` element to the grid footer to use to switch the fiscal year and removes the Fiscal Year modal. This was requested by @WayneNiles and improves the UX by allowing users to switch fiscal years on the fly. By removing the modal, we also alleviate the maintenance burden on developers. 2. A "check row" at the bottom of the General Ledger has been implemented, showing the sum of each column with period balances. _These columns should always sum to zero_. If not, it means that there is an imbalanced transaction somewhere. 3. Title accounts are now show and hold the sum of the balances of their children. This allows a really quick comparison of bulk amounts, such as Income versus Expense. This has been implemented using a `Tree` class, available to be used in other reports. 4. Added title account highlighting and indentation to both the client and server-side generated reports for the General Ledger. The indentation is set to `15px` by default. 5. Add a link to the Account Statement module. This allows a user to directly inspect the values from the General Ledger in the Account Statement. **Screenshots** ![newgl](https://user-images.githubusercontent.com/896472/35456000-5a04432a-02d4-11e8-812d-760446e3a6ae.PNG) _Fig 1: New General Ledger Client_ ![newglreport](https://user-images.githubusercontent.com/896472/35456057-8e33d76e-02d4-11e8-8418-db15de5c8195.PNG) _Fig 2: New General Ledger Report w/ Indentation_ Closes #1706. Closes #2459. Closes #2463. Closes #2373.
Build succeeded |
This PR refactors the General Ledger to make it more useful from an accounting perspective.
Code Refactor
general-ledger-accounts
togeneral-ledger
. We had folded the previous "General Ledger" into the Journal, so only this one remains.Features
<select>
element to the grid footer to use to switch the fiscal year and removes the Fiscal Year modal. This was requested by @WayneNiles and improves the UX by allowing users to switch fiscal years on the fly. By removing the modal, we also alleviate the maintenance burden on developers.Tree
class, available to be used in other reports.15px
by default.Screenshots
Fig 1: New General Ledger Client
Fig 2: New General Ledger Report w/ Indentation
Closes #1706. Closes #2459. Closes #2463. Closes #2373.