Pacioli.Accounting.Kernel 0.1.0

dotnet add package Pacioli.Accounting.Kernel --version 0.1.0
                    
NuGet\Install-Package Pacioli.Accounting.Kernel -Version 0.1.0
                    
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="Pacioli.Accounting.Kernel" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Pacioli.Accounting.Kernel" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Pacioli.Accounting.Kernel" />
                    
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 Pacioli.Accounting.Kernel --version 0.1.0
                    
#r "nuget: Pacioli.Accounting.Kernel, 0.1.0"
                    
#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 Pacioli.Accounting.Kernel@0.1.0
                    
#: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=Pacioli.Accounting.Kernel&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Pacioli.Accounting.Kernel&version=0.1.0
                    
Install as a Cake Tool

Pacioli.Accounting.Kernel (v1)

Este repositorio contiene un motor contable puro (sin EF/DB/UI) diseñado para usarse como NuGet en:

  • Pacioli.Master (backend / persistencia / APIs)
  • Pacioli.Core (UI / preview / validación previa, si aplica)
  • Reporteador (render de reportes, exportaciones, etc.)

La idea central es:

Journal (asiento) → Posting → LedgerPostings → Projections (reportes)

Donde:

  • Journal: cómo se captura el asiento (líneas, fecha, descripción, etc.)
  • LedgerPostings: movimientos atómicos listos para reportes (debit/credit por cuenta, ya normalizados)
  • Projections: cálculos para reportes (Trial Balance, Mayor, Movimientos), hechos solo desde LedgerPostings

Proyectos

  • Pacioli.Accounting.Contracts
    • Tipos de entrada/salida del motor (Snapshots, Results, Projections)
  • Pacioli.Accounting.Kernel
    • Implementación (normalize/validate/post/project)
  • Pacioli.Accounting.Kernel.Tests
    • Unit tests (black-box)

Cómo se usa (flujo real)

1) En Master (leer journals → PostMany → guardar/reportar)

Objetivo típico en Master:

  • Lees N journals desde DB
  • Construyes N PostingRequestSnapshot
  • Ejecutas kernel.PostMany(requests)
  • Con los LedgerPostings resultantes:
    • (opción A) los guardas/materializas en una tabla de postings
    • (opción B) proyectas reportes “on the fly” sin persistir postings

Ejemplo (pseudo-código orientativo, sin EF):

using Pacioli.Accounting.Contracts.Enums;
using Pacioli.Accounting.Contracts.Snapshots;
using Pacioli.Accounting.Kernel;

// NOTE: This is an example only. Mapping from DB entities is app-specific.
public static class MasterPostingExample
{
    public static void Run()
    {
        var kernel = new AccountingKernel();

        // 1) Load journals from DB (your code)
        var journalsFromDb = LoadJournalsFromDb();

        // 2) Build requests
        var requests = journalsFromDb
            .Select(j => MapToPostingRequest(j))
            .ToList();

        // 3) Post many
        var batch = kernel.PostMany(requests);

        // 4) Policy decision in Master:
        //    - Reject all if any failed
        //    - Or continue with successful postings and log/report violations
        if (!batch.OkAll)
        {
            // Handle violations per journal
            // e.g., return a 409/422, log, or mark invalid journals
        }

        // 5) Use successful postings
        var postings = batch.LedgerPostings;

        // Option A: Persist postings for fast reporting (recommended if reports are heavy)
        SaveLedgerPostings(postings);

        // Option B: Project right away
        var trialBalances = kernel.ProjectTrialBalanceMany(postings);

        // Example: pick the TB for a specific period
        // var tb = trialBalances.Single(x => x.PeriodId == targetPeriodId);
    }

    private static IEnumerable<object> LoadJournalsFromDb()
    {
        // Return your journal entities
        return Array.Empty<object>();
    }

    private static PostingRequestSnapshot MapToPostingRequest(object journalEntity)
    {
        // TODO: Map your DB entity to JournalSnapshot + Context + Options.

        var context = new PostingContextSnapshot(
            periodFrom: new DateTime(2026, 01, 01),
            periodToExclusive: new DateTime(2026, 02, 01),
            currency: "USD",
            internalAmountPrecision: 2,
            internalAmountRoundingMode: AmountRoundingMode.HalfUp);

        var journal = new JournalSnapshot(
            journalId: Guid.NewGuid(),
            periodId: Guid.NewGuid(),
            postingDate: new DateTime(2026, 01, 15),
            documentNo: "J-0001",
            reference: "REF-1",
            description: "Example",
            lines: new[]
            {
                new JournalLineSnapshot(Guid.NewGuid(), Guid.NewGuid(), DcSide.Debit, 10.00m),
                new JournalLineSnapshot(Guid.NewGuid(), Guid.NewGuid(), DcSide.Credit, 10.00m),
            });

        var options = new PostingOptionsSnapshot(strict: true, autoBalanceRoundingDiff: true);

        return new PostingRequestSnapshot(journal, context, options);
    }

    private static void SaveLedgerPostings(IReadOnlyList<Pacioli.Accounting.Contracts.Results.LedgerPostingSnapshot> postings)
    {
        // Persist using your repository/EF/Dapper/etc. (outside of the Kernel)
    }
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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.

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.1.0 160 1/8/2026