-
Notifications
You must be signed in to change notification settings - Fork 98
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
Automatically add number of employees to cost centers in step-down cost allocation reports #5977
Automatically add number of employees to cost centers in step-down cost allocation reports #5977
Conversation
aaf792b
to
6145aa3
Compare
const missingCenters = []; | ||
for (let i = 0; i < computables.length; i++) { | ||
const basis = computables[i]; | ||
const data = await allocationQuantities(basis.id); |
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.
@jniles How do I deal with this?
FIXED.
6145aa3
to
b527329
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.
Ok, I'll see what I can do. -Jonathan |
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.
b527329
to
5988683
Compare
const newQuantity = ccData[basis.name]; | ||
// See if there is an existing quantity | ||
const qRecordId = await db.exec(findQRec, [cc.id, basis.id]); | ||
if (qRecordId.length > 0) { |
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.
Can we just delete these values and rewrite? I.e. if we are computing the number of employees, just clear out the old values and then do an INSERT for the rest?
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.
I'm happy to do that after the demo. By doing drop and insert, I can do it with transactions and clean it up. Lets get this out so we can use it for the demo.
5988683
to
a534540
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.
I've tested this with the Vanga database, and it works like a charm. Thanks!
bors r+
Build succeeded: |
This PR adds/updates the number of employees for each cost center based on the query proposed by @jniles in its issue:
Closes #5962
I think I was able to verify that computes the correct number of employees for each cost center both in bhima_test and in the vanga dataset (after applying the employees and cost center update scripts from @jniles and @lomamech (respectively).
To use: Go to the "Allocation Keys" page and click on the [Update] button. That will update the cost_center_allocation_base_value table with the items that it can compute (currently only num employees).
This does not work completely yet, because