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

Question: Future Posting Date #108

Open
iamchris1688 opened this issue Sep 20, 2023 · 5 comments
Open

Question: Future Posting Date #108

iamchris1688 opened this issue Sep 20, 2023 · 5 comments

Comments

@iamchris1688
Copy link

Hi Medici team et. al., thank you SO MUCH for creating this package - super helpful!! Asking for tips for best approach / recommendation on creating a journal entry with a future posting date.

Consider this scenario: create a journal entry with a future posting date, say 14 days (parameterized) later.

As of today:
#1. Journal and Transaction have datetime and timestamp attributes at the journal entry time.
#2. Book.ledger({start_date: startDate, end_date: endDate}), Book.balance({start_date: startDate, end_date: endDate}).... are based on entry date as well.

What we need is to have extra field so-called posting-date.
On #1-enhanced: Journal and Transactions have extra posting date attributes.
On #2-enhanced: ability to query ledger and balance based on posting date.
#2a. If query as of today ==> query returns no data since posting dates are in the future.
#2b. If query as of 14 days later ==> query returns the journal and transactions since within the posting dates.

Thoughts / tips / help? Thank you in advance!!

@koresar
Copy link
Collaborator

koresar commented Sep 20, 2023

This sounds like a deficiency. We welcome any Pull Requests to fit your needs (including unit tests).

Would you or any your colleagues contribute to this package?

@Uzlopak
Copy link
Collaborator

Uzlopak commented Sep 20, 2023

What is the posting dates real world counter part? Isnt the date option enough?

@iamchris1688
Copy link
Author

Thanks @koresar, definitely - happy to do PR and to contribute back!

Thanks @Uzlopak for the date option tips! We were not aware previously, you are correct there is a date parm of the Entry construct. Preliminary test, entry with date option writes journal and transaction datetime fields correctly (datetime = date option), which is what we need, GREAT!!

// =========

Separate, we noticed the "fast/cached balance' does not recognize balance query by date range. So in this case if cache snapshot:

  1. does not exist, the balance query is always correct as it pulls live of the transaction model (which filters by start_date and end_date when provided).
  2. exist, balance query may or may not be correct as it looks at 'best snapshot' with keys and metas but without dates.

Thoughts? Let us know if our observation is inaccurate.
Thanks again!

@koresar
Copy link
Collaborator

koresar commented Sep 21, 2023

Oh, you are right.

Could you please add one more unit test to this file spec/balance.spec.ts which reproduces the date related bug you've mentioned? @iamchris1688

@iamchris1688
Copy link
Author

Sounds good, we'll add unit test and keep you posted. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants