fix: fmtDiff hoisted, idFechamento snake_case
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-06-28 12:56:30 +00:00
parent 674caf2b7a
commit a11db54ffc
+5 -4
View File
@@ -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) }));