Overview
The Overdue Payments module automatically identifies installments that are past their due date and calculates late payment penalties (mora). The system applies a 2% daily penalty rate to encourage timely payment.Database View: vw_CuotasVencidas
The overdue payments view (vw_CuotasVencidas) identifies all unpaid installments past their due date:
View Filters
Unpaid Installments Only
Unpaid Installments Only
The condition
pp.pagada = 0 ensures only outstanding installments are included. Once an installment is paid, it’s automatically removed from the overdue list.Past Due Date
Past Due Date
pp.fechaVencimiento < GETDATE() filters for installments where the due date has passed. Payments due today or in the future are excluded.Active Sales Only
Active Sales Only
Voided sales (
v.nula = 1) are excluded to prevent showing penalties on cancelled transactions.View Model Properties
TheVwCuotasVencida class in TechCore.Models represents overdue payment data:
The order number associated with this installment
Customer name from the
clientes tableInstallment number (1, 2, 3, etc.) within the payment plan
The original due date for this installment
The base installment amount before penalties
Number of days past the due date, calculated as
DATEDIFF(DAY, fechaVencimiento, GETDATE())Late payment penalty amount calculated using the formula:
(montoCuota * 0.02) * diasAtrasoMora Calculation Formula
The system calculates late payment penalties (mora) using a daily compound rate:Penalty Rate Breakdown
Days Late Calculation
The system calculates the number of days between the due date (
fechaVencimiento) and today (GETDATE())Example Calculation
Upcoming Payments View
The system also tracks installments that are due soon but not yet overdue:vw_CuotasPorVencer
VwCuotasPorVencer model includes the same fields as overdue payments but without penalty calculations, since these payments are not yet late.
Usage Examples
Query All Overdue Payments
Calculate Total Penalties
Find Critical Overdue Accounts (30+ days)
Get Upcoming Payments (Next 7 Days)
Payment Status Workflow
Payment Plan Created
When a credit sale is made, installments are created in
planPagos with pagada = 0After Due Date (Unpaid)
Installment moves to
vw_CuotasVencidas (overdue payments view) and penalty calculation beginsPerformance Optimization
The database includes indexes to optimize overdue payment queries:These filtered indexes significantly improve query performance since most queries focus on unpaid installments and active sales.
Related Tables
planPagos
Payment schedule containing all installments with due dates and payment status
ventas
Credit sales that generate payment plans and installments
abonosVentas
Payment records that mark installments as paid via the TR_ActualizarSaldo trigger
clientes
Customer information for overdue payment notifications and collection activities
See Also
- Accounts Receivable - Overall receivables tracking and balances
- Account Statements - Detailed customer account statements