Database Views
TechCore Mini ERP includes three critical views that simplify credit sales monitoring and customer account management. These views automatically filter out voided transactions (nula = 0) to ensure data accuracy.
vw_CuotasVencidas
Shows all overdue installments with calculated late fees and days past due.Purpose
- Identify customers with overdue payments
- Calculate late fees automatically (2% per day)
- Monitor accounts receivable aging
- Generate collection reports
SQL Definition
Columns
| Column | Type | Description |
|---|---|---|
norden | VARCHAR(50) | Sale order number |
cliente | VARCHAR(200) | Customer name |
numeroCuota | INT | Installment number |
fechaVencimiento | DATE | Due date |
montoCuota | DECIMAL(18,2) | Installment amount |
diasAtraso | INT | Days overdue |
moraCalculada | DECIMAL(18,2) | Late fee (2% per day) |
The late fee calculation (
moraCalculada) uses a 2% daily rate multiplied by days overdue. This is automatically computed and does not require manual calculation.vw_CuotasPorVencer
Displays upcoming installments that are due but not yet overdue.Purpose
- Track upcoming payment obligations
- Send payment reminders to customers
- Forecast cash flow from accounts receivable
- Prevent installments from becoming overdue
SQL Definition
Columns
| Column | Type | Description |
|---|---|---|
norden | VARCHAR(50) | Sale order number |
cliente | VARCHAR(200) | Customer name |
numeroCuota | INT | Installment number |
fechaVencimiento | DATE | Due date |
montoCuota | DECIMAL(18,2) | Installment amount |
This view includes installments due today and in the future. Use this for proactive customer communication and payment reminders.
vw_EstadoCuenta
Provides a comprehensive account statement for all credit sales, showing total amounts, balances, and payments made.Purpose
- Generate customer account statements
- Monitor credit sale performance
- Track payment progress on installment plans
- Reconcile payments received vs outstanding balances
SQL Definition
Columns
| Column | Type | Description |
|---|---|---|
norden | VARCHAR(50) | Sale order number |
cliente | VARCHAR(200) | Customer name |
total | DECIMAL(18,2) | Total sale amount |
saldo | DECIMAL(18,2) | Current outstanding balance |
meses | INT | Payment plan duration (months) |
totalAbonado | DECIMAL(18,2) | Total payments received |
The
totalAbonado column aggregates all payments from the abonosVentas table. The saldo field is automatically updated by the TR_ActualizarSaldo trigger when payments are recorded.Usage Examples
Find Customers with Overdue Payments
Get Payment Reminders for Next 7 Days
Customer Account Summary
Related Topics
- Triggers - Automated processes that maintain data integrity
- Indexes - Performance optimizations for view queries
- Sales and Purchases - Complete sales and payment table structure
- Database Overview - Entity relationships and architecture