Skip to main content
The Book Component (billing.book) handles the management of sales and purchase books (Libro de Ventas y Compras) required for tax reporting in Chile.

Overview

This component provides functionality for creating, maintaining, and reporting sales and purchase books that consolidate all tax documents issued and received during a period.
This component is currently under development. Workers and functionality will be added in future releases.

Status

The Book Component is in active development. The following features are planned:
Track and consolidate all issued sales documents (invoices, receipts, credit/debit notes) for a period.
Track and consolidate all received purchase documents for a period.
Generate official sales and purchase book reports in required formats for SII submission.
Manage books by tax periods (monthly, yearly).
Validate book completeness and accuracy before submission.

Planned Workers

The following workers are planned for implementation:
  • Builder Worker: Constructs sales and purchase books from document collections
  • Validator Worker: Validates book content and structure
  • Generator Worker: Generates book reports in required formats (XML, PDF)
  • Loader Worker: Loads existing books from storage
  • Period Manager Worker: Manages book periods and closures

Current Implementation

getWorkers

Returns all available workers in this component.
return
array
Returns an empty array (no workers implemented yet)
use libredte\lib\Core\Package\Billing\Component\Book\BookComponent;

$bookComponent = $billingPackage->getBookComponent();
$workers = $bookComponent->getWorkers(); // Currently returns []

Expected Usage (Coming Soon)

Once implemented, the component will support operations like:
// Future usage example (not yet implemented)
use libredte\lib\Core\Package\Billing\Component\Book\BookComponent;

$bookComponent = $billingPackage->getBookComponent();

// Build a sales book for a period
$salesBook = $bookComponent->buildSalesBook(
    period: '2024-03',
    documents: $salesDocuments
);

// Build a purchase book
$purchaseBook = $bookComponent->buildPurchaseBook(
    period: '2024-03',
    documents: $purchaseDocuments
);

// Generate book report for SII
$bookReport = $bookComponent->generateReport($salesBook);

// Validate before submission
$isValid = $bookComponent->validate($salesBook);

Books in Chilean Tax System

In the Chilean tax system, businesses must maintain:

Libro de Ventas (Sales Book)

A register of all sales documents issued:
  • Facturas Electrónicas (Electronic Invoices)
  • Boletas Electrónicas (Electronic Receipts)
  • Notas de Crédito (Credit Notes)
  • Notas de Débito (Debit Notes)
  • Facturas de Exportación (Export Invoices)

Libro de Compras (Purchase Book)

A register of all purchase documents received:
  • Purchase invoices from suppliers
  • Credit and debit notes received
  • Import documents

Reporting Requirements

Books must be:
  • Maintained for each tax period (monthly)
  • Submitted to SII electronically
  • Kept for the legally required retention period
  • Available for tax audits

Development Status

Check the source code for the latest implementation status: Location: /workspace/source/src/Package/Billing/Component/Book/BookComponent.php:37
Workers and methods are being actively developed. Check the official LibreDTE documentation for updates on availability.

Source Reference

Namespace: libredte\lib\Core\Package\Billing\Component\Book\BookComponent Location: /workspace/source/src/Package/Billing/Component/Book/BookComponent.php:37

Build docs developers (and LLMs) love