TabulariusLib 0.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package TabulariusLib --version 0.0.3
                    
NuGet\Install-Package TabulariusLib -Version 0.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TabulariusLib" Version="0.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TabulariusLib" Version="0.0.3" />
                    
Directory.Packages.props
<PackageReference Include="TabulariusLib" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TabulariusLib --version 0.0.3
                    
#r "nuget: TabulariusLib, 0.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TabulariusLib@0.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TabulariusLib&version=0.0.3
                    
Install as a Cake Addin
#tool nuget:?package=TabulariusLib&version=0.0.3
                    
Install as a Cake Tool

TabulariusLib

A .NET library to handle basic accounting tools to create a journal and accounts.

Features

With the journals and accounts you can generate the ledger, trial balance and then the financial statements as of balance sheet and profit and loss statement.

This is an early version and you can contribute to it on github. https://github.com/Tabularius/tabularius-lib-dotnet

How to use (taken from unit tests)

Create Account codes

public static class ExampleAccountCodes { public const string Cash = "1000"; public const string Revenue = "4000"; public const string Expense = "5000"; public const string Capital = "3000"; public const string RetainedEarnings = "3100"; public const string Payable = "2000"; }

Create Accounts

public static List<Account> GetExampleAccounts() { return new List<Account> { Account.Create("Cash", "Cash Account", ExampleAccountCodes.Cash, AccountType.Asset, null, "Debit"), Account.Create("Revenue", "Sales Revenue", ExampleAccountCodes.Revenue, AccountType.Income, null, "Credit"), Account.Create("Expense", "Office Supplies", ExampleAccountCodes.Expense, AccountType.Expense, null, "Debit"), Account.Create("Capital", "Owner's Capital", ExampleAccountCodes.Capital, AccountType.Equity, null, "Credit"), Account.Create("Retained Earnings", "Retained Earnings", ExampleAccountCodes.RetainedEarnings, AccountType.Equity, null, "Credit"), Account.Create("Payable", "Accounts Payable", ExampleAccountCodes.Payable, AccountType.Liability, null, "Credit") }; }

Create Journal

public static Journal GetExampleJournal() { var accounts = GetExampleAccounts(); var cash = accounts.Find(a ⇒ a.Code == ExampleAccountCodes.Cash); var revenue = accounts.Find(a ⇒ a.Code == ExampleAccountCodes.Revenue); var expense = accounts.Find(a ⇒ a.Code == ExampleAccountCodes.Expense); var capital = accounts.Find(a ⇒ a.Code == ExampleAccountCodes.Capital); var payable = accounts.Find(a ⇒ a.Code == ExampleAccountCodes.Payable); if (cash == null || revenue == null || expense == null || capital == null || payable == null) throw new InvalidOperationException("One or more required accounts are missing.");

var journal = Journal.Create(Guid.NewGuid(), "Main Journal", "Test Journal", null);

// Sales Invoice: Debit Cash, Credit Revenue
journal = journal.AddJournalEntry(
    JournalEntry.Create(
        Guid.NewGuid().ToString(),
        "Sales Invoice",
        DateTime.Today,
        "INV-001",
        [
            JournalLine.Create(Guid.NewGuid(), "Cash from Sales", cash.Code, 1000m, 0m),
            JournalLine.Create(Guid.NewGuid(), "Sales Revenue", revenue.Code, 0m, 1000m)
        ]
    ));

// Expense: Debit Expense, Credit Cash
journal = journal.AddJournalEntry(
    JournalEntry.Create(
        Guid.NewGuid().ToString(),
        "Office Supplies Expense",
        DateTime.Today,
        "EXP-001",
        [
            JournalLine.Create(Guid.NewGuid(), "Office Supplies", expense.Code, 200m, 0m),
            JournalLine.Create(Guid.NewGuid(), "Paid Cash", cash.Code, 0m, 200m)
        ]
    ));

// Owner's Investment: Debit Cash, Credit Capital
journal = journal.AddJournalEntry(
    JournalEntry.Create(
        Guid.NewGuid().ToString(),
        "Owner's Investment",
        DateTime.Today,
        "CAP-001",
        [
            JournalLine.Create(Guid.NewGuid(), "Cash Invested", cash.Code, 5000m, 0m),
            JournalLine.Create(Guid.NewGuid(), "Owner's Capital", capital.Code, 0m, 5000m)
        ]
    ));

// Liability: Purchase on Credit (Debit Expense, Credit Payable)
journal = journal.AddJournalEntry(
    JournalEntry.Create(
        Guid.NewGuid().ToString(),
        "Office Supplies on Credit",
        DateTime.Today,
        "EXP-002",
        [
            JournalLine.Create(Guid.NewGuid(), "Office Supplies (Credit)", expense.Code, 300m, 0m),
            JournalLine.Create(Guid.NewGuid(), "Accounts Payable", payable.Code, 0m, 300m)
        ]
    ));

return journal;

}

Create Ledger

Ledger ledger = Ledger.FromJournal("Main Ledger", "Test Ledger", journal, accounts);

Create Trial Balance

TrialBalance trialBalance = TrialBalance.FromLedger("TB", "Test TB", new DateTime(2024, 12, 31), ledger);

Create Profit and Loss Statement

ProfitAndLossStatement plStatement = ProfitAndLossStatement.FromLedger("P&L", "Test P&L", new DateTime(2024, 1, 1), new DateTime(2024, 12, 31), ledger);

Create Balance Sheet

TrialBalance closedTrialBalance = trialBalance.CloseAccounts(retainedEarnings); // The equity account for the P&L closing

// Create Balance from closed trial balance Balance balance = Balance.FromTrialBalance("Balance Sheet", "Test Balance", DateTime.Today, closedTrialBalance);

License

Apache-2.0

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.4 147 5/21/2025
0.0.3 145 5/20/2025
0.0.2 140 5/20/2025
0.0.1 141 5/20/2025

Initial release.