From a11db54ffc0d58ef0e50e2d321966663d6289a4f Mon Sep 17 00:00:00 2001 From: root Date: Sun, 28 Jun 2026 12:56:30 +0000 Subject: [PATCH] fix: fmtDiff hoisted, idFechamento snake_case --- src/index.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/index.html b/src/index.html index 9c95c3f..f06a868 100644 --- a/src/index.html +++ b/src/index.html @@ -2425,7 +2425,7 @@ window.salvarEdicaoConsulta = async function() { let uuid = full.uuid; if (!uuid && full.id_fechamento) { // Buscar uuid pelo id_fechamento primeiro - const found = await window.__TAURI__.core.invoke('sb_buscar_por_id_fechamento', { id_fechamento: full.id_fechamento }); + const found = await window.__TAURI__.core.invoke('sb_buscar_por_id_fechamento', { idFechamento: full.id_fechamento }); if (found && found.uuid) uuid = found.uuid; } @@ -2442,6 +2442,10 @@ window.salvarEdicaoConsulta = async function() { // Converte o registro "full" do Supabase para o formato usado pelo buildPrintHTML function consultaToPrintData(full) { + const fmtDiff = v => 'R$ ' + Math.abs(v || 0).toFixed(2).replace('.', ','); + const fmtDiffNeg = v => (v < 0 ? '-' : '') + 'R$ ' + Math.abs(v || 0).toFixed(2).replace('.', ','); + const fmt = v => 'R$ ' + (v || 0).toFixed(2).replace('.', ','); + const cartCred = parseFloat(full.saldo_credito || 0); const cartDeb = parseFloat(full.saldo_debito || 0); const cartAli = parseFloat(full.saldo_alimentacao || 0); @@ -2460,9 +2464,6 @@ function consultaToPrintData(full) { const diffOk = diferenca === 0; const diffStr = diferenca >= 0 ? `+${fmtDiff(diferenca)}` : fmtDiffNeg(diferenca); const dados = full.dados || {}; - const fmtDiff = v => 'R$ ' + Math.abs(v || 0).toFixed(2).replace('.', ','); - const fmtDiffNeg = v => (v < 0 ? '-' : '') + 'R$ ' + Math.abs(v || 0).toFixed(2).replace('.', ','); - const fmt = v => 'R$ ' + (v || 0).toFixed(2).replace('.', ','); const despesas_arr = (dados.despesas || []).map(d => ({ desc: d.desc || '', obs: d.obs || '', valor: parseFloat(d.valor || 0) })); const sangrias_arr = (dados.sangrias || []).map(s => ({ hora: s.hora || '', retirada: parseFloat(s.retirada || 0), gerente: s.gerente || '', valor: parseFloat(s.valor || 0) }));