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

Filtering positive/negative account balances #86

Closed
pedrobaeza opened this issue Apr 20, 2018 · 5 comments
Closed

Filtering positive/negative account balances #86

pedrobaeza opened this issue Apr 20, 2018 · 5 comments

Comments

@pedrobaeza
Copy link
Member

Use case

In Spain, we have several sections in the Balance Sheet that includes the sum of balances that are greater than 0 in one side, and the opposite in the other side. They are for example the accounts 551. But the balance is not taken as a whole, but account per account. Example:

  • You have in the account 551001 positive balance: then it should go to one side.
  • You have in the account 551002 negative balance: then i should go to the other side.

So putting the expression (bale[551%] if bale[551%] > 0) doesn't work, and you can't define the expression if a fixed way like (bale[551001] if bale[551001] > 0) + (bale[551002] if bale[551002] > 0) + ... because there are infinite accounts: you have 551001, 551002, but also 5510001, 5510002... (with 7 digits), and so on.

Proposed solution

Add an account expansion mechanism at expression level. This can be an optional fifth letter in the expressions (for example, a). If included, mis_builder will switch the expression before passing it to the "SQL parsing" for making the expansion by account. Example: if you put the expression +(balea[551%] if balea[551%] > 0), it searches on the system the account selector, and unfolds the expression with the result:

+(bale[551000] if bale[551000] > 0)+(bale[551001] if bale[551001] > 0)+(bale[551002] if bale[551002] > 0)

and then continues the normal pipe

I don't know enough yet the mis_builder code, but maybe with a little guidance I can implement it.

@sbidoul
Copy link
Member

sbidoul commented Apr 20, 2018

Ah, the creativity of administrations is without limits :)

To be sure I understand, it could then mean that line 551 could appear on both sides, eg if 551001 has a positive balance and 551002 has a negative one?

@pedrobaeza
Copy link
Member Author

Yeah, exactly.

@sbidoul
Copy link
Member

sbidoul commented Apr 20, 2018

So weird.

I'm thinking to solve this with (bal|pbal|nbal)[iep] to get the sum of positive or negative balances.

Let me think about it during the coming days.

@pedrobaeza
Copy link
Member Author

OK, thanks.

@sbidoul
Copy link
Member

sbidoul commented Apr 20, 2018

Yet that is really weird. Because normally the administration is not interested in how accounts are organized below a certain level, so companies are free to add low level accounts as they please. This somehow exposes that fine structure to the administration.

@sbidoul sbidoul changed the title Account expansion in expressions Filtering positive/negative account balances May 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants