Life ConnectLife Connect
Table of contents
Architecture
Services
Swagger Docs
GitHub
Table of contents
Architecture
Services
Swagger Docs
GitHub

I have direction on invoice's item level

Overview

The goal of this update is to enhance the invoice model by introducing money flow directions for invoice items. Each invoice consists of two main parts:

  1. Invoice Header (invoiceNature == HEADER)
    • Contains general invoice details (e.g., sender, recipient, etc.).
  2. Invoice Items (invoiceNature == ITEM)
    • Represents individual invoice lines with monetary values.
    • Each item has an amount, and the total sum of all items forms the invoice total.
    • A new field direction is introduced with possible values:
      • CREDIT
      • DEBIT

Flow Direction Calculation

  • The overall flowDirection of an invoice is determined based on its balance:
    • If the balance is positive → flowDirection = INVOICE
    • If the balance is negative → flowDirection = CREDIT_NOTE
  • The handling of flowDirection differs based on invoice origin:
    • Automatic Invoices: flowDirection is dynamically determined during invoice creation. If adding an item makes the balance negative, flowDirection switches to CREDIT_NOTE, and vice versa.
    • Manual Invoices (invoiceOrigin == MANUAL): The user must select flowDirection, but validation ensures consistency:
      • If flowDirection == CREDIT_NOTE but the balance is positive, the invoice cannot be booked.

Validation Enhancements

  • A new validation collection will be added at the invoice header level.
  • Upon saving an invoice, validations will be executed and stored.
  • If there are validation messages:
    • The frontend will display them to the user.
    • Booking the invoice will be blocked if validation messages exist.

Additional Considerations

  • Currently, negative values are not supported in CFR; this needs to be implemented alongside invoices for accurate results.
  • Post-Settlements Invoice Creation was disabled due to incomplete analysis. Implementation should be reviewed and re-enabled if needed.

Updated InvoiceItem Model

class InvoiceItem {
    private String id;
    private String parentId;
    private CatalogValue invoiceNature;
    private String organisationId;
    private LedgerAccountShort expenseAccount;
    // Amounts
    private Money amount;
    private Money amountWithoutTaxes;
    private Money taxesAmount;
    private Quantity vatRate;
    private Money apportionAmount;
    private Money apportionTaxAmount;
    private Money premiumBasis;
    private Quantity premiumRate;
    private Descriptor descriptor;
    private String description;
    private CatalogValue feeType;
    private CatalogValue guaranteeOption;
    private CatalogValue eventTrigger;
    private TargetObject allocation;
    private String unique;
    // New field
    private AccountingEntryDirection direction;
}
Edit this page
Last Updated:
Contributors: gregory