Skip to content
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: Trial Balance #1233

Merged
merged 3 commits into from
Feb 22, 2017

Conversation

jniles
Copy link
Collaborator

@jniles jniles commented Feb 21, 2017

EDIT See #1233 (comment) for the most recent changes.

This PR refactors the Trial Balance to improve stability and usability. It addresses a few of the issues cited in multiple issues. It also fixes a bug with the Trial Balance calculation of account balance changes.

Details
This commit improves the Trial Balance UI and UX in the following ways:

  1. The submit button now disables and enters a loading state after
    posting to the GL.
  2. The grid now right aligns the currency amounts.
  3. The grid now uses currency rendering for all amounts.
  4. The buttons now behave responsively.
  5. The labels no longer bleed into the headercrumb.

There are also some performance improvements:

  1. Use flat entity access on the grids
  2. Use fastWatch
  3. Use translate directive where possible

Addresses some of the points in #1163. Closes #1171. Addresses some of the points in #1042.

Bug Fix
This commit fixes a bug in the totals calculation for the trial balance
due to an incorrect LEFT JOIN. This has been broken out into multiple
subqueries. The performance of these queries should be investigated,
but there are no obvious optimizations to make.

Bug Fix
The $timeout hacks have been removed from ui-grid and replaced with events that redraw the grid when grouping changes. These sometimes caused flaky behavior in rendering.

Closes #868.

Feature
Finally, this PR includes a grid footer on the Trial Balance to give an overview of the changes. This is how the bug was discovered. See below on Vanga's dataset.

Closes #1189.

Feature
The Trial Balance finally has a loading indicator!

trialbalanceimprovements
Fig 1: Trial Balance Improvements


Thank you for contributing!

Before submitting this pull request, please verify that you have:

  • Run your code through ESLint. Check out our styleguide.
  • Run integration tests.
  • Run end-to-end tests.
  • Accurately described the changes your are making in this pull request.

For a more detailed checklist, see the official review checklist that this PR will be evaluated against.

Ensuring that the above checkboxes are completed will help speed the review process and help build a stronger application. Thanks!

@jniles
Copy link
Collaborator Author

jniles commented Feb 21, 2017

Interested in @imawh's feedback as well.

@jniles
Copy link
Collaborator Author

jniles commented Feb 21, 2017

Received feedback from @imawh. He proposes the following changes:

  1. Remove the total footer on avant and apres columns - these make no sense.
  2. Only show the footer if debits/credits imbalance. They should be balanced normally.
  3. Make the Voir les Details text smaller/more compact.
  4. Include the account label with the account number.
  5. Remove the "Group by Transaction" button.

@DedrickEnc
Copy link
Contributor

We should also ask Patrick, what he is thinking.

@jniles
Copy link
Collaborator Author

jniles commented Feb 21, 2017

@sfount, can you see if Patrick has any feedback?

@sfount
Copy link
Contributor

sfount commented Feb 21, 2017

Patrick is not at the office right now. I understand that he is not in good health.
@patsonjunior

@jniles
Copy link
Collaborator Author

jniles commented Feb 21, 2017

The following changes have landed:

This commit incorporates feedback from our accountant.

  1. Grid Footer is only shown when there are imbalances and is colored red.
  2. Totals are only ever shown for debit/credit and not for before/after.
  3. The grid is no longer padded - slightly more screen real estate for users.
  4. The account now includes the account text.
  5. Removed Group By Transaction
  6. Cancel button on detail page.
  7. "View Details" is translated just as "details".

Screenshots
trialbalancevalidstate
Fig 1: Trial Balance Valid State

trialbalanceerrorstate
Fig 2: Trial Balance Error State

Jonathan Niles added 3 commits February 22, 2017 07:01
This commit improves the Trial Balance UI and UX in the following ways:
 1. The submit button now disables and enters a loading state after
 posting to the GL.
 2. The grid now right aligns the currency amounts.
 3. The grid now uses currency rendering for all amounts.
 4. The buttons now behave responsively.
 5. The labels no longer bleed into the headercrumb.

There are also some performance improvements:
 1. Use flat entity access on the grids
 2. Use fastWatch
 3. Use translate directive where possible

Addresses some of the points in Third-Culture-Software#1163.  Closes Third-Culture-Software#1171.
This commit fixes a bug in the totals calculation for the trial balance
due to an incorrect LEFT JOIN.  This has been broken out into multiple
subqueries.  The performance of these queries should be investigated,
but there are no obvious optimizations to make.
This commit encorporates feedback from our accountant.
 1. Grid Footer is only shown when there are imbalances.
 2. Totals are only ever shown for debit/credit and not for
 before/after.
 3. The grid is no longer padded - slightly more screen real estate for
 users.
 4. The account now includes the account text.
 5. Removed Group By Transaction
Copy link
Contributor

@sfount sfount left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code here LGTM. The changes to the SQL will make this a very robust procedure.

I have made a few comments however I don't think any of these things should be blocking.

I also have a number of comments on the UX experience for this module:

  1. Is there a reason that a different blue/ red colour is used for primary and error states? We have no other grids that have a blue header so when and where we use this should be considered. If these should have colours we should use the standard primary and danger colours used throughout the application.
  2. The submit button turns red if there are errors. A red button is used throughout the application for a serious action (usually deleting an entity) however this button can never be pressed and won't delete anything - I think this is misleading.
  3. The view errors button is also red, this is the same point as (2.)

@jniles the code here looks to me like it can be merged into master. If you would like to make any comments/ changes based on this review there is no problem. If this has to be in as soon as possible let me know and we can address the additional comments in an issue thread.

treeRowHeaderAlwaysVisible : false,
appScopeProvider : vm,
columnDefs : columns,
flatEntityAccess : true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

id="main-grid"
ui-grid="TrialBalanceMainBodyCtrl.gridOptions"
ui-grid-auto-resize
ui-grid-grouping>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this UI grid still need ui-grid-grouping ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes to make the uiGridGroupingConstants tree aggregation work. I might be able to migrate this to uiGridConstants instead, but for the moment, that's the way it was set up. The grouping aggregation doesn't work without the ui-grid-grouping directive.

'SessionService', 'TrialBalanceService', 'GridGroupingService', 'GridColumnService',
'NotifyService', '$state', '$timeout', 'uiGridConstants',
'SessionService', 'TrialBalanceService', 'NotifyService',
'$state', 'uiGridConstants', 'uiGridGroupingConstants', '$filter',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are grouping constants used any more? I think that functionality was removed with the view as transaction button. If they're no longer used all of these imports can be removed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are used in the aggregation functions.

fetchDataByAccount()
.then(function (data) {
vm.gridOptions.data = data;
cssClass = TrialBalance.getCSSClass(vm.feedBack);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason these CSS classes can't be assigned in the template like in many other modules using ng-class? I haven't looked into the specifics but this logic is very specific and unknown to me. If it is required it would be a good thing to standardise for these cases.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be fairly straightforward. You just have to make a header row template and switch the color based on that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ui-grid="TrialBalanceMainBodyCtrl.gridOptions"
ui-grid-auto-resize
ui-grid-grouping>
<bh-grid-loading-indicator
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 🎉

@jniles
Copy link
Collaborator Author

jniles commented Feb 22, 2017

@sfount, let's just get this in. It will be useful to teach the team here without the previous bugs and with a loading button. The others will just be UI issues and/or performance that we can address through more training when we make the upgrades.

Note: Travis CI isn't reporting it, but these tests pass.

@patsonjunior
Copy link

  1. A mon avis, il faudra d'abord revoir la configuration informatique de ce "Trial Balance" du fait qu'en principe toutes les écritures qu'elles soient générées automatiquement ou passées manuellement dans le journal de saisie dévraient toujours être équilibrées.

  2. Si après revision, l'erreur persiste, être alors capable de retouver le document ou la pièce qui soutient la transaction à partir de la colonne "Référence" qui se trouve dans le" journal de saisie" afin d'équilibrer la transaction du vrai montant, au lieu de le faire de façon imaginaire avec risque de surestimation ou de sousestimation de la valeurs du compte.

@jniles
Copy link
Collaborator Author

jniles commented Feb 22, 2017

@patsonjunior

  1. En principe, le system marche avec les transactions équilibrées. Main il faut tous les temps faire la verification parce ce que le reseau, l'oridinateur, le courant, ou autres choses peuvent bouger les informations. Dans le fonctionnement normale, on n'aura pas des déquilibrées.

  2. Vous avez raison! Si l'utilisateur clique sur le bouton "Voir Erreurs", ca va lui montrer les peices.

@sfount
Copy link
Contributor

sfount commented Feb 22, 2017

Okay, LGTM. We'll make issues to track UX improvements.

@sfount sfount merged commit 3db6574 into Third-Culture-Software:master Feb 22, 2017
@jniles jniles deleted the refactor-trial-balance branch February 22, 2017 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants