Overview
The DatosComprobacion class manages comprehensive expense verification data for travel assignments. It calculates totals for advance payments (anticipados) and accrued expenses (devengados), tracking verified receipts across multiple expense categories including per diem, fuel, tolls, and passenger fares.
namespace InapescaWeb . Entidades
{
public class DatosComprobacion
{
// Financial calculation properties using double precision
private double pdTotalComprobado ;
private double pdTotalViaticosAnt ;
// ... 40+ numeric properties
}
}
Source: InapescaWeb.Entidades/DatosComprobacion.cs
This entity uses double data type for all financial calculations to maintain precision in monetary computations and expense reconciliation.
Constructor and Initialization
The constructor initializes all numeric properties to zero:
public DatosComprobacion ()
{
// General totals
pdTotalImporteReintegro = 0 ;
pdTotalComprobadoTarjeta = 0 ;
pdGranTotal = 0 ;
// Category totals
pdTotalComprobado = 0 ;
pdTotalComprobadoViaticos = 0 ;
pdTotalComprobadoCombustible = 0 ;
// Advance and accrued separately
pdTotalComprobadoAnt = 0 ;
pdTotalComprobadoDev = 0 ;
// ... all properties initialized to 0
}
General Totals
Grand Total Properties
Grand total of all expenses across all categories and payment types
Total verified/documented expenses (sum of all categories)
Total amount to be reimbursed to the employee or returned to the institution
Total expenses paid via institutional credit/debit card
Expense Categories - Overall
Per Diem (Viaticos)
Total verified per diem expenses (all types combined)
Total per diem for rural zone travel (lower daily rate)
Total per diem for navigated days (maritime assignments)
Total lodging/accommodation expenses
Fuel (Combustible)
TotalComprobadoCombustible
Total verified fuel expenses
Tolls (Peaje)
Total verified toll/highway charges
Total toll expenses without tax invoice (non-fiscal receipts)
Passenger Fares (Pasaje)
Total verified passenger transportation fares (flights, buses, etc.)
Special Categories
Total expenses for singladuras (24-hour maritime navigation periods)
Total expenses for rural zone assignments
Total expenses documented with non-fiscal receipts (no tax invoice)
Maximum allowed non-fiscal expenses for advance payments
Maximum allowed non-fiscal expenses for accrued payments
Total amount requiring reimbursement processing
Advance Payments (Anticipados)
Advance payments are amounts provided to employees before travel begins.
Advance Totals
Total documented expenses from advance payment funds
Number of days covered by advance payment
Grand total of advance payment allocation
Advance by Category
TotalComprobadoViaticosAnt
Verified per diem expenses paid from advance
Total per diem amount in advance payment
TotalComprobadoCombustibleAnt
Verified fuel expenses paid from advance
Total fuel amount in advance payment
Verified passenger fare expenses paid from advance
Total passenger fare amount in advance payment
Verified toll expenses paid from advance
Total toll amount in advance payment
Advance Extensions (Ampliaciones)
Additional fuel amount for advance payment extensions
Additional toll amount for advance payment extensions
Additional passenger fare amount for advance payment extensions
Accrued Expenses (Devengados)
Accrued expenses are amounts paid after travel is completed, based on actual expenses incurred.
Accrued Totals
Total documented expenses for accrued payment
Number of days covered by accrued payment
Grand total of accrued payment allocation
Accrued by Category
TotalComprobadoViaticosDev
Verified per diem expenses for accrued payment
Total per diem amount for accrued payment
TotalComprobadoCombustibleDev
Verified fuel expenses for accrued payment
Total fuel amount for accrued payment
Verified passenger fare expenses for accrued payment
Total passenger fare amount for accrued payment
Verified toll expenses for accrued payment
Total toll amount for accrued payment
Accrued Extensions (Ampliaciones)
Additional fuel amount for accrued payment extensions
Additional toll amount for accrued payment extensions
Additional passenger fare amount for accrued payment extensions
Usage Example
using InapescaWeb . Entidades ;
// Create expense verification record
var datos = new DatosComprobacion ();
// Advance payment verification
datos . DiasAnt = 5 ;
datos . TotalViaticosAnt = 5000.00 ;
datos . TotalCombustibleAnt = 1500.00 ;
datos . TotalPasajeAnt = 2800.00 ;
datos . TotalTotalAnt = 9300.00 ;
// Verified expenses from advance
datos . TotalComprobadoViaticosAnt = 4850.00 ;
datos . TotalComprobadoCombustibleAnt = 1480.00 ;
datos . TotalComprobadoPasajeAnt = 2800.00 ;
datos . TotalComprobadoAnt = 9130.00 ;
// Accrued expenses (additional days)
datos . DiasDev = 2 ;
datos . TotalViaticosDev = 2000.00 ;
datos . TotalCombustibleDev = 600.00 ;
datos . TotalTotalDev = 2600.00 ;
// Verified accrued expenses
datos . TotalComprobadoViaticosDev = 1950.00 ;
datos . TotalComprobadoCombustibleDev = 580.00 ;
datos . TotalComprobadoDev = 2530.00 ;
// Calculate grand totals
datos . TotalComprobado = datos . TotalComprobadoAnt + datos . TotalComprobadoDev ;
datos . GranTotal = datos . TotalTotalAnt + datos . TotalTotalDev ;
// Calculate reimbursement
// (Total allocated - Total verified)
double totalAllocated = datos . TotalTotalAnt + datos . TotalTotalDev ;
double totalVerified = datos . TotalComprobado ;
datos . TotalImporteReintegro = totalAllocated - totalVerified ;
// If negative, employee should return funds
// If positive, additional reimbursement to employee
Console . WriteLine ( $"Total Allocated: $ { totalAllocated : N2 } " );
Console . WriteLine ( $"Total Verified: $ { totalVerified : N2 } " );
Console . WriteLine ( $"Reimbursement: $ { datos . TotalImporteReintegro : N2 } " );
Calculation Patterns
Category Totals
// Total verified expenses = sum of all categories
TotalComprobado = TotalComprobadoViaticos
+ TotalComprobadoCombustible
+ TotalComprobadoPasaje
+ TotalComprobadoPeaje ;
Advance vs Accrued
// Separate verification for advance and accrued
TotalComprobadoAnt = TotalComprobadoViaticosAnt
+ TotalComprobadoCombustibleAnt
+ TotalComprobadoPasajeAnt
+ TotalComprobadoPeajeAnt ;
TotalComprobadoDev = TotalComprobadoViaticosDev
+ TotalComprobadoCombustibleDev
+ TotalComprobadoPasajeDev
+ TotalComprobadoPeajeDev ;
Reimbursement Calculation
// If verified < allocated: employee returns money
// If verified > allocated: institution pays employee
TotalImporteReintegro = ( TotalTotalAnt + TotalTotalDev )
- ( TotalComprobadoAnt + TotalComprobadoDev );
Business Rules
Validation should be implemented in the business logic layer, not in the entity itself.
Non-Fiscal Receipt Limits
if ( TotalComprobadoNoFiscal > MaxNofiscalAnt + MaxNofiscalDev )
{
// Exceeds maximum allowed non-fiscal receipts
// Reject or require additional fiscal invoices
}
Category Verification
// Verified amounts should not exceed allocated amounts
if ( TotalComprobadoViaticosAnt > TotalViaticosAnt )
{
// Per diem verification exceeds advance allocation
// Possible data entry error
}
Per Diem Rate Validation
// Verify daily rate matches zone classification
double dailyRate = TotalViaticosAnt / DiasAnt ;
// Compare against official rate tables
CFDI Integration
Mexican tax regulations require CFDI (Comprobante Fiscal Digital por Internet) for expense verification. The system processes CFDI XML files to extract and validate expense data.
cfdv33 - CFDI version 3.3 invoices
cfdv4 - CFDI version 4.0 invoices
cfdiv33 - CFDI income version 3.3
cfdiv4 - CFDI income version 4.0
These entities parse XML invoice data to populate the verification totals in DatosComprobacion.
Comision Travel assignment that these expenses verify
comprobacion Individual expense line items
Xml CFDI XML invoice parsing
Pagos Payment processing records
Reporting and Analysis
Expense Summary Report
public class ExpenseReport
{
public void PrintSummary ( DatosComprobacion datos )
{
Console . WriteLine ( "=== EXPENSE VERIFICATION SUMMARY ===" )
Console . WriteLine ();
Console . WriteLine ( "ADVANCE PAYMENT:" );
Console . WriteLine ( $" Days: { datos . DiasAnt } " );
Console . WriteLine ( $" Per Diem: $ { datos . TotalViaticosAnt : N2 } " );
Console . WriteLine ( $" Fuel: $ { datos . TotalCombustibleAnt : N2 } " );
Console . WriteLine ( $" Tolls: $ { datos . TotalPeajeAnt : N2 } " );
Console . WriteLine ( $" Fares: $ { datos . TotalPasajeAnt : N2 } " );
Console . WriteLine ( $" TOTAL: $ { datos . TotalTotalAnt : N2 } " );
Console . WriteLine ();
Console . WriteLine ( "ADVANCE VERIFIED:" );
Console . WriteLine ( $" Per Diem: $ { datos . TotalComprobadoViaticosAnt : N2 } " );
Console . WriteLine ( $" Fuel: $ { datos . TotalComprobadoCombustibleAnt : N2 } " );
Console . WriteLine ( $" Tolls: $ { datos . TotalComprobadoPeajeAnt : N2 } " );
Console . WriteLine ( $" Fares: $ { datos . TotalComprobadoPasajeAnt : N2 } " );
Console . WriteLine ( $" TOTAL: $ { datos . TotalComprobadoAnt : N2 } " );
Console . WriteLine ();
Console . WriteLine ( "ACCRUED PAYMENT:" );
Console . WriteLine ( $" Days: { datos . DiasDev } " );
Console . WriteLine ( $" Per Diem: $ { datos . TotalViaticosDev : N2 } " );
Console . WriteLine ( $" Fuel: $ { datos . TotalCombustibleDev : N2 } " );
Console . WriteLine ( $" TOTAL: $ { datos . TotalTotalDev : N2 } " );
Console . WriteLine ();
Console . WriteLine ( "REIMBURSEMENT:" );
Console . WriteLine ( $" Amount: $ { datos . TotalImporteReintegro : N2 } " );
if ( datos . TotalImporteReintegro < 0 )
Console . WriteLine ( $" Status: Employee returns $ { Math . Abs ( datos . TotalImporteReintegro ) : N2 } " );
else if ( datos . TotalImporteReintegro > 0 )
Console . WriteLine ( $" Status: Institution pays $ { datos . TotalImporteReintegro : N2 } " );
else
Console . WriteLine ( $" Status: Balanced - no reimbursement needed" );
}
}
See Also