Skip to main content

What is Gestión de Ventas?

Gestión de Ventas is a modern, full-featured ERP (Enterprise Resource Planning) system built with Laravel 12 and designed specifically for businesses that need to manage sales operations, inventory control, accounting, and customer relationships in a single, integrated platform.
This system follows a modular architecture with clear separation of concerns, making it maintainable, testable, and scalable for businesses of any size.

Key Features

Sales Management

Complete point-of-sale (POS) system with support for cash and credit sales, NCF (Dominican fiscal) integration, and automatic invoice generation.

Inventory Control

Multi-warehouse inventory tracking with automatic stock adjustments, movement history, and real-time stock validation.

Accounting Integration

Automated journal entries, accounts receivable management, and double-entry bookkeeping with full audit trail.

Customer Management

Comprehensive client profiles with credit limits, payment history, and credit status tracking.

Architecture Highlights

The system is built following Laravel best practices and implements a layered architecture that ensures:

Skinny Controllers Pattern

Controllers act as orchestrators, delegating business logic to dedicated service classes:
public function store(StoreSaleRequest $request, SaleService $service)
{
    // Controller only coordinates - no business logic here
    $sale = $service->create($request->validated());
    
    return redirect()
        ->route('sales.index')
        ->with('success', "Venta #{$sale->number} registrada con éxito.");
}

Service Layer Architecture

Business logic is encapsulated in service classes:
  • CatalogService: Provides dropdown data for forms and filters
  • BusinessService: Handles create, update, and bulk operations
  • Transactional Integrity: All complex operations wrapped in database transactions

Pipeline Pattern for Filtering

Filters are implemented as independent, reusable classes:
$sales = (new SaleFilters($request))
    ->apply(Sale::query()->withIndexRelations())
    ->latest()
    ->paginate($perPage);

Form Request Validation

All validation and authorization happens before reaching the controller:
public function authorize(): bool
{
    return $this->user()->can('create sales');
}

Technology Stack

Backend

  • Laravel 12 - PHP framework
  • PHP 8.2+ - Modern PHP features
  • SQLite/MySQL - Database flexibility
  • Spatie Permissions - Role-based access control

Frontend

  • Blade Templates - Server-side rendering
  • Alpine.js - Reactive components
  • Tailwind CSS - Utility-first styling
  • Vite - Fast build tooling

Key Dependencies

The system leverages battle-tested Laravel packages:
PackagePurpose
spatie/laravel-permissionRole and permission management
maatwebsite/excelExcel import/export functionality
barryvdh/laravel-dompdfPDF generation for invoices
laravel/breezeAuthentication scaffolding

Core Modules

Sales Module

Handles the complete sales workflow from product selection to invoice generation:
  • Point-of-sale interface
  • Cash and credit payment types
  • NCF (fiscal numbering) integration for Dominican Republic compliance
  • Automatic inventory deduction
  • Invoice generation and printing
Key Files:
  • app/Models/Sales/Sale.php - Sale model with relationships
  • app/Http/Controllers/Sales/SaleController.php - Sales orchestration
  • app/Services/Sales/SalesServices/SaleService.php - Sales business logic

Inventory Module

Tracks product stock across multiple warehouses:
  • Real-time stock levels
  • Automatic movement tracking (inputs, outputs, adjustments)
  • Stock validation before sales
  • Movement history and audit trail

Accounting Module

Maintains financial records with automated posting:
  • Chart of accounts management
  • Automatic journal entries for sales
  • Accounts receivable tracking
  • Payment recording and reconciliation
  • Full audit trail with reversals for cancellations

Client Management

Comprehensive customer relationship management:
  • Client profiles with tax IDs (RNC)
  • Credit limits and balance tracking
  • Client status categories (active, blocked, restricted)
  • Payment history
  • Credit eligibility validation

Design Principles

1

Separation of Concerns

Each layer has a single, well-defined responsibility:
  • Models: Data persistence and relationships
  • Services: Business logic and transactions
  • Controllers: Request handling and response
  • Form Requests: Validation and authorization
2

Reusability

Code is DRY (Don’t Repeat Yourself):
  • Shared filter classes
  • Centralized catalog services
  • Reusable table configurations
3

Testability

Clean architecture enables easy testing:
  • Service classes are unit testable
  • Controllers are integration testable
  • Business logic isolated from framework
4

Maintainability

Clear structure makes the codebase easy to navigate:
  • Consistent naming conventions
  • Documented service methods
  • Type-hinted dependencies

Security Features

The system implements multiple security layers to protect your business data.
  • Permission-based access control via Spatie Permissions package
  • Form Request validation ensures only authorized users access resources
  • Soft deletes preserve data integrity and audit trail
  • Database transactions ensure data consistency
  • CSRF protection on all state-changing operations
  • Password hashing with Laravel’s bcrypt

Multi-tenancy Ready

The system supports country-based operations:
  • Geographic data (countries, states, municipalities)
  • Country-specific configurations
  • Localized tax settings
  • Multi-currency support foundation

Next Steps

Installation

Get the system up and running in minutes with our step-by-step installation guide.

Quickstart

Learn how to create your first sale and explore the core features.

Getting Help

If you encounter any issues or have questions:
  1. Check the Architecture Documentation for design patterns
  2. Review the code comments in service classes
  3. Examine the validation rules in Form Request classes
  4. Look at existing modules as examples for creating new features
This documentation is based on the actual codebase. All code examples are real and can be found in the source files referenced.

Build docs developers (and LLMs) love