fix: buildPrintHTML usa sys_total correto
Build Fechamento de Caixa / build (macos-14, app) (push) Has been cancelled
Build Fechamento de Caixa / build (ubuntu-22.04, deb) (push) Has been cancelled
Build Fechamento de Caixa / build (windows-2022, msi) (push) Has been cancelled

This commit is contained in:
root
2026-07-05 20:57:49 +00:00
parent acb90f093d
commit 56a2ed5d31
2 changed files with 8 additions and 7 deletions
+6 -5
View File
@@ -322,13 +322,12 @@ impl ReciboData {
out.extend(escpos::divider());
// ── DIFERENÇA ──
// Diferença = TOTAL SISTEMA - saldo_esperado - cancelamentos
// Usa o valor calculado pelo frontend (já correto)
out.extend(escpos::line_bold("DIFERENCA"));
let diff = self.sys_total - self.saldo_esperado - self.cancelamentos;
let diff_str = if diff >= 0.0 {
format!("+{}", self.fmt_money(diff))
let diff_str = if self.diferenca >= 0.0 {
format!("+{}", self.fmt_money(self.diferenca))
} else {
self.fmt_money(diff)
self.fmt_money(self.diferenca)
};
out.extend(escpos::title(&diff_str));
@@ -528,8 +527,10 @@ pub fn caminho_impressora() -> Option<String> {
#[tauri::command]
pub fn imprimir_recibo(data: String) -> Result<usize, String> {
eprintln!("[DEBUG RECIBO JSON] {}", &data[..data.len().min(500)]);
let r: ReciboData =
serde_json::from_str(&data).map_err(|e| format!("Erro ao analisar dados: {}", e))?;
eprintln!("[DEBUG DIFERENCA] self.diferenca={}", r.diferenca);
let bytes = r.to_escpos();
log::info!("Imprimindo recibo: {} bytes ESC/POS", bytes.len());
PRINTER.imprimir_bytes(&bytes)