Files
dmed/examples/teste_xls.rs
T
FelipeCN 3a888a058f feat: add DMED comparador library with TXT and XLS processing
- Implemented TXT processor for DMED files, extracting RPPSS records.
- Added XLS processor for Prosoft reports, supporting both XLS and XLSX formats.
- Created a comparison tool to identify discrepancies between TXT and XLS data.
- Developed a GUI using eframe for user-friendly interaction.
- Included detailed README documentation for setup and usage instructions.
- Added error handling for file processing and improved data extraction methods.
- Implemented tests for data processing functions and utilities.
- Introduced a build script for Windows resource management.
- Added example scripts for basic and complete comparisons.
- Included a report generation feature for discrepancies found during comparisons.
2026-01-30 10:42:23 -03:00

47 lines
1.8 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Script de teste rápido - execute com: cargo run --example teste_xls
use dmed::xls::processar_xls;
fn main() {
println!("=== TESTE DO PROCESSADOR XLS/XLSX ===\n");
let arquivo = "RELATORIO_PROSOFT_MOD_51.xls";
println!("📂 Tentando abrir: {}", arquivo);
println!("️ Suporta .xls e .xlsx (detecção automática)\n");
match processar_xls(arquivo) {
Ok(pessoas) => {
println!("✓ Arquivo processado com sucesso!");
println!("Total de registros únicos: {}\n", pessoas.len());
println!("=== Primeiros 10 registros ===");
for (i, pessoa) in pessoas.iter().take(10).enumerate() {
println!("{}. CPF: {} - R$ {:.2}",
i + 1,
pessoa.cpf,
pessoa.valor
);
}
// Estatísticas
let total_valor: f64 = pessoas.iter().map(|p| p.valor).sum();
let maior_valor = pessoas.iter()
.max_by(|a, b| a.valor.partial_cmp(&b.valor).unwrap())
.unwrap();
println!("\n=== Estatísticas ===");
println!("Total de valores: R$ {:.2}", total_valor);
println!("Maior valor: R$ {:.2} (CPF: {})", maior_valor.valor, maior_valor.cpf);
}
Err(e) => {
println!("✗ Erro ao processar arquivo: {}", e);
println!("\n💡 Dica:");
println!(" 1. Certifique-se que o arquivo existe na pasta do projeto");
println!(" 2. Nome esperado: RELATORIO_PROSOFT_MOD_51.xls");
println!(" 3. Formato: Excel .xls ou .xlsx (ambos são suportados)");
println!(" 4. Mesmo que a extensão seja .xls, pode ser .xlsx internamente");
}
}
}