Comments (1)
I'm not an expert myself, but here is what I did to get started:
- You would need to be familiar with double-entry accounting terminology
- You'd need a MongoDB
- When
require("medici")
is executed it creates Mongoose in-memory schemas. Nothing is created in the DB at this stage. - Then you need to create a new Book. For example I keep a book per (crypto) currency:
const currencyBook = new medici.book("Flash-" + currency);
- Then save your first entry:
const memo = "User cash deposit";
const user = "[email protected]";
const metaData = { userId: 123412341234, transactionId: 567856785678 };
const creditAccount = "Assets:Morgan Bank";
const debitAccount = "Liabilities:User";
const amount = 1000.00;
currencyBook.entry(memo + " : executed by : " + user)
.credit(creditAccount, amount, metaData)
.debit(debitAccount, amount * 0.99, metaData)
.debit("MyFee", amount * 0.01, metaData)
.commit();
- Get the accounts' balance:
const myIncome = await currencyBook.balance({ account: "MyFee" });
const userBalance = await books.balance({ account: "Liabilities:User", user: userId });
I do not guarantee that any of the above code would work as is.
Was that something you were looking for?
from medici.
Related Issues (20)
- Add transaction level-db support HOT 4
- Commit not working HOT 3
- Example in readme is broken HOT 1
- money should not be stored as number HOT 1
- Add support for mongoose 6.x HOT 4
- Wrong default for timestamp in transactions schema HOT 1
- Little Confusion in debit function HOT 1
- v5 Discussion Thread HOT 35
- FastBalance approaches and solutions HOT 23
- Timestamp HOT 3
- After upgrading to 5.1.0 retrieving balance using custom properties as keys returns 0 HOT 11
- NIIF Support HOT 5
- Database independent - using ORM https://www.prisma.io/ HOT 3
- Mongoose Specify Connection HOT 4
- Set Timestamp for Journal Entry HOT 7
- Question: do you have an UI for this or do you plan to build one? HOT 3
- last version not released? HOT 3
- new release HOT 3
- Questions on the implementation HOT 10
- Question: Why MongoDB? Have you considered iterating to a relational db? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from medici.