Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c7109b1017 | |||
| f45d1e8170 | |||
| 8ea5ba771a | |||
| 84578fe43d | |||
| 3e94789cb0 | |||
| 292d0b85d9 | |||
| a8edab029d | |||
| cbaef8772d |
+481
-115
@@ -1380,32 +1380,32 @@ function buildConfirmHTML(data) {
|
|||||||
<td>${cartPix > 0 ? fmt(cartPix) : '-'}</td>
|
<td>${cartPix > 0 ? fmt(cartPix) : '-'}</td>
|
||||||
</tr>`;
|
</tr>`;
|
||||||
|
|
||||||
return `<!DOCTYPE html>
|
let html = `<!DOCTYPE html>
|
||||||
<html><head>
|
<html><head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Fechamento de Caixa</title>
|
<title>Fechamento de Caixa</title>
|
||||||
<style>
|
<style>
|
||||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||||
body { font-family: 'Courier New', monospace; font-size: 13px; width: 80mm; margin: 0 auto; padding: 8px; }
|
body { font-family: 'Courier New', monospace; font-size: 13px; width: 80mm; margin: 0 auto; padding: 8px; font-weight: bold; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
|
||||||
.header { text-align: center; margin-bottom: 8px; }
|
.header { text-align: center; margin-bottom: 8px; }
|
||||||
.header h1 { font-size: 18px; }
|
.header h1 { font-size: 18px; font-weight: bold; }
|
||||||
.header h2 { font-size: 14px; font-weight: normal; }
|
.header h2 { font-size: 14px; font-weight: normal; }
|
||||||
hr { border: none; border-top: 1px dashed #000; margin: 5px 0; }
|
hr { border: none; border-top: 1px dashed #000; margin: 5px 0; }
|
||||||
.section-title { font-weight: bold; font-size: 13px; border-top: 1px dashed #000; padding-top: 3px; margin-top: 6px; }
|
.section-title { font-weight: bold; font-size: 13px; border-top: 1px dashed #000; padding-top: 3px; margin-top: 6px; }
|
||||||
.row { display: flex; justify-content: space-between; padding: 1px 0; font-size: 12px; }
|
.row { display: flex; justify-content: space-between; padding: 1px 0; font-size: 12px; font-weight: bold; }
|
||||||
.row.total-row { font-weight: bold; }
|
.row.total-row { font-weight: bold; }
|
||||||
.cart-table { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 4px; }
|
.cart-table { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 4px; font-weight: bold; }
|
||||||
.cart-table th { font-weight: bold; border-bottom: 1px solid #000; padding: 2px; }
|
.cart-table th { font-weight: bold; border-bottom: 1px solid #000; padding: 2px; }
|
||||||
.cart-table td { padding: 2px 4px; text-align: right; }
|
.cart-table td { padding: 2px 4px; text-align: right; font-weight: bold; }
|
||||||
.cart-table td:first-child { text-align: left; }
|
.cart-table td:first-child { text-align: left; }
|
||||||
.cart-table tr.total-row { font-weight: bold; border-top: 1px dashed #000; }
|
.cart-table tr.total-row { font-weight: bold; border-top: 1px dashed #000; }
|
||||||
.subtotal { font-size: 12px; margin-top: 4px; }
|
.subtotal { font-size: 12px; margin-top: 4px; }
|
||||||
.diff-ok { color: #2e7d32; }
|
.subtotal .row { padding: 1px 0; }
|
||||||
.diff-bad { color: #c0272d; }
|
.diff-ok { color: #2e7d32; font-weight: bold; }
|
||||||
.obs { font-size: 11px; color: #555; margin-top: 6px; white-space: pre-wrap; }
|
.diff-bad { color: #c0272d; font-weight: bold; }
|
||||||
|
.obs { font-size: 11px; color: #555; margin-top: 6px; white-space: pre-wrap; font-weight: normal; }
|
||||||
.footer { text-align: center; font-size: 11px; color: #555; margin-top: 8px; }
|
.footer { text-align: center; font-size: 11px; color: #555; margin-top: 8px; }
|
||||||
@media print { body { margin: 0; } }
|
@media print { body { background: #fff; font-weight: bold !important; } }
|
||||||
</style>
|
|
||||||
</head><body>
|
</head><body>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h1>${data.loja}</h1>
|
<h1>${data.loja}</h1>
|
||||||
@@ -1604,26 +1604,26 @@ function buildPrintHTML(data) {
|
|||||||
<title>Fechamento de Caixa</title>
|
<title>Fechamento de Caixa</title>
|
||||||
<style>
|
<style>
|
||||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||||
body { font-family: 'Courier New', monospace; font-size: 13px; width: 80mm; margin: 0 auto; padding: 8px; }
|
body { font-family: 'Courier New', monospace; font-size: 13px; width: 80mm; margin: 0 auto; padding: 8px; font-weight: bold; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
|
||||||
.header { text-align: center; margin-bottom: 8px; }
|
.header { text-align: center; margin-bottom: 8px; }
|
||||||
.header h1 { font-size: 18px; }
|
.header h1 { font-size: 18px; font-weight: bold; }
|
||||||
.header h2 { font-size: 14px; font-weight: normal; }
|
.header h2 { font-size: 14px; font-weight: normal; }
|
||||||
hr { border: none; border-top: 1px dashed #000; margin: 5px 0; }
|
hr { border: none; border-top: 1px dashed #000; margin: 5px 0; }
|
||||||
.section-title { font-weight: bold; font-size: 13px; border-top: 1px dashed #000; padding-top: 3px; margin-top: 6px; }
|
.section-title { font-weight: bold; font-size: 13px; border-top: 1px dashed #000; padding-top: 3px; margin-top: 6px; }
|
||||||
.row { display: flex; justify-content: space-between; padding: 1px 0; font-size: 12px; }
|
.row { display: flex; justify-content: space-between; padding: 1px 0; font-size: 12px; font-weight: bold; }
|
||||||
.row.total-row { font-weight: bold; }
|
.row.total-row { font-weight: bold; }
|
||||||
.cart-table { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 4px; }
|
.cart-table { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 4px; font-weight: bold; }
|
||||||
.cart-table th { font-weight: bold; border-bottom: 1px solid #000; padding: 2px; }
|
.cart-table th { font-weight: bold; border-bottom: 1px solid #000; padding: 2px; }
|
||||||
.cart-table td { padding: 2px 4px; text-align: right; }
|
.cart-table td { padding: 2px 4px; text-align: right; font-weight: bold; }
|
||||||
.cart-table td:first-child { text-align: left; }
|
.cart-table td:first-child { text-align: left; }
|
||||||
.cart-table tr.total-row { font-weight: bold; border-top: 1px dashed #000; }
|
.cart-table tr.total-row { font-weight: bold; border-top: 1px dashed #000; }
|
||||||
.subtotal { font-size: 12px; margin-top: 4px; }
|
.subtotal { font-size: 12px; margin-top: 4px; }
|
||||||
.subtotal .row { padding: 1px 0; }
|
.subtotal .row { padding: 1px 0; }
|
||||||
.diff-ok { color: #2e7d32; }
|
.diff-ok { color: #2e7d32; font-weight: bold; }
|
||||||
.diff-bad { color: #c0272d; }
|
.diff-bad { color: #c0272d; font-weight: bold; }
|
||||||
.obs { font-size: 11px; color: #555; margin-top: 6px; white-space: pre-wrap; }
|
.obs { font-size: 11px; color: #555; margin-top: 6px; white-space: pre-wrap; font-weight: normal; }
|
||||||
.footer { text-align: center; font-size: 11px; color: #555; margin-top: 8px; }
|
.footer { text-align: center; font-size: 11px; color: #555; margin-top: 8px; }
|
||||||
@media print { body { margin: 0; } }
|
@media print { body { background: #fff; font-weight: bold !important; } }
|
||||||
</style>
|
</style>
|
||||||
</head><body>
|
</head><body>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@@ -1853,9 +1853,11 @@ function triggerWindowPrint() {
|
|||||||
window.print();
|
window.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Recibo 80mm via Tauri (ESC/POS USB) ─────────────────────────────────
|
// ─── buildReciboData — lê do FORMULÁRIO principal (não do estado carregado do BD) ───
|
||||||
// ─── Recibo 80mm via Tauri (ESC/POS USB) ─────────────────────────────────
|
// Importante: quando editing, o estado estápopulado pelo abrirFechamentoEdicao, não do BD
|
||||||
// Build data object shared by both ESC/POS and preview
|
|
||||||
|
// ─── buildReciboData — lê do FORMULÁRIO principal ───────────────────────────
|
||||||
|
// usado tanto para novo fechamento quanto para edição
|
||||||
function buildReciboData() {
|
function buildReciboData() {
|
||||||
const cartCred = estado.cartoes.credito.reduce((s,r) => s+(r.valor||0), 0);
|
const cartCred = estado.cartoes.credito.reduce((s,r) => s+(r.valor||0), 0);
|
||||||
const cartDeb = estado.cartoes.debito.reduce((s,r) => s+(r.valor||0), 0);
|
const cartDeb = estado.cartoes.debito.reduce((s,r) => s+(r.valor||0), 0);
|
||||||
@@ -1876,6 +1878,7 @@ function buildReciboData() {
|
|||||||
return {
|
return {
|
||||||
uuid: estado.uuid,
|
uuid: estado.uuid,
|
||||||
id_local: estado.id_local,
|
id_local: estado.id_local,
|
||||||
|
id: estado.id,
|
||||||
loja: estado.loja,
|
loja: estado.loja,
|
||||||
data: estado.data,
|
data: estado.data,
|
||||||
operador: estado.operador,
|
operador: estado.operador,
|
||||||
@@ -1899,7 +1902,7 @@ function buildReciboData() {
|
|||||||
vales: valesTotal,
|
vales: valesTotal,
|
||||||
areceber: receberTotal,
|
areceber: receberTotal,
|
||||||
cancelamentos: cancelTotal,
|
cancelamentos: cancelTotal,
|
||||||
// Full arrays for preview
|
// Full arrays for preview / Supabase
|
||||||
despesas_arr: estado.despesas.map(r => ({ desc: r.desc||'', obs: r.obs||'', valor: r.valor||0 })),
|
despesas_arr: estado.despesas.map(r => ({ desc: r.desc||'', obs: r.obs||'', valor: r.valor||0 })),
|
||||||
sangrias_arr: estado.sangrias.map(r => ({ hora: r.hora||'', retirada: parseNum(r.retirada)||0, gerente: r.gerente||'' })),
|
sangrias_arr: estado.sangrias.map(r => ({ hora: r.hora||'', retirada: parseNum(r.retirada)||0, gerente: r.gerente||'' })),
|
||||||
pixcnpj_arr: estado.pixcnpj.map(r => ({ nome: r.nome||'', valor: r.valor||0 })),
|
pixcnpj_arr: estado.pixcnpj.map(r => ({ nome: r.nome||'', valor: r.valor||0 })),
|
||||||
@@ -1910,10 +1913,22 @@ function buildReciboData() {
|
|||||||
cartoes_debito: estado.cartoes.debito.map(r => r.valor || 0),
|
cartoes_debito: estado.cartoes.debito.map(r => r.valor || 0),
|
||||||
cartoes_alimentacao: estado.cartoes.alimentacao.map(r => r.valor || 0),
|
cartoes_alimentacao: estado.cartoes.alimentacao.map(r => r.valor || 0),
|
||||||
cartoes_pix: estado.cartoes.pix.map(r => r.valor || 0),
|
cartoes_pix: estado.cartoes.pix.map(r => r.valor || 0),
|
||||||
|
total_cartao_credito: cartCred,
|
||||||
|
total_cartao_debito: cartDeb,
|
||||||
|
total_cartao_alimentacao: cartAli,
|
||||||
|
total_cartao_pix: cartPix,
|
||||||
|
total_pixcnpj: pixCnpjTotal,
|
||||||
|
total_sangrias: sangriasTotal,
|
||||||
|
total_despesas: despesasTotal,
|
||||||
|
total_vales: valesTotal,
|
||||||
|
total_areceber: receberTotal,
|
||||||
|
total_cancelamentos: cancelTotal,
|
||||||
observacoes: estado.observacoes,
|
observacoes: estado.observacoes,
|
||||||
clientes: estado.clientes,
|
clientes: estado.clientes,
|
||||||
frango: estado.frango,
|
frango: estado.frango,
|
||||||
vendas: estado.vendas || 0,
|
vendas: estado.vendas || 0,
|
||||||
|
edited_at: new Date().toISOString(),
|
||||||
|
edited_by: config.admin_user || 'admin',
|
||||||
sync_status: estado.sync_status,
|
sync_status: estado.sync_status,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -2374,6 +2389,10 @@ window.abrirFechamentoEdicao = function(full) {
|
|||||||
const dados = full.dados || full;
|
const dados = full.dados || full;
|
||||||
if (!dados) { alert('Dados detalhados não encontrados neste registro.'); return; }
|
if (!dados) { alert('Dados detalhados não encontrados neste registro.'); return; }
|
||||||
|
|
||||||
|
// IDs do registro — CRÍTICO para o salvamento via Supabase
|
||||||
|
estado.uuid = full.uuid || null;
|
||||||
|
estado.id = full.id || full.uuid || null;
|
||||||
|
|
||||||
// Preenche o estado global com todos os campos do JSONB
|
// Preenche o estado global com todos os campos do JSONB
|
||||||
estado.loja = dados.loja || full.loja || '';
|
estado.loja = dados.loja || full.loja || '';
|
||||||
estado.data = dados.data || full.data || '';
|
estado.data = dados.data || full.data || '';
|
||||||
@@ -2448,7 +2467,7 @@ window.abrirFechamentoEdicao = function(full) {
|
|||||||
renderTable('tbl-cartao-pix', estado.cartoes.pix);
|
renderTable('tbl-cartao-pix', estado.cartoes.pix);
|
||||||
|
|
||||||
// Recalcula totais
|
// Recalcula totais
|
||||||
calcAll();
|
updateTotals();
|
||||||
|
|
||||||
// Rola para o topo do formulário
|
// Rola para o topo do formulário
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
@@ -2464,18 +2483,24 @@ window.toggleEditConsulta = async function() {
|
|||||||
// Se já está editando, apenas fecha
|
// Se já está editando, apenas fecha
|
||||||
if (window._editModalOpen) { closeEditModal(); return; }
|
if (window._editModalOpen) { closeEditModal(); return; }
|
||||||
|
|
||||||
// Pede senha admin primeiro (se configurada)
|
// Pede senha admin primeiro — sempre, para proteger edições
|
||||||
const pw = config.admin_password;
|
const pw = config.admin_password;
|
||||||
if (pw) {
|
if (pw) {
|
||||||
const ok = await askPassword();
|
const ok = await askPassword();
|
||||||
if (!ok) return;
|
if (!ok) return;
|
||||||
|
} else {
|
||||||
|
// Sem senha configurada — avisa e abre mesmo assim (primeiro uso)
|
||||||
|
const ok = await askPassword(); // mostra diálogo vazio para o admin configurar mentalmente
|
||||||
|
if (!ok) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
openEditModal(full);
|
openEditModal(full);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Pede senha admin — retorna Promise<boolean>
|
||||||
function askPassword() {
|
function askPassword() {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
|
const pw = config.admin_password;
|
||||||
const overlay = document.createElement('div');
|
const overlay = document.createElement('div');
|
||||||
overlay.style.cssText = 'position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.5);z-index:999999;display:flex;align-items:center;justify-content:center;';
|
overlay.style.cssText = 'position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.5);z-index:999999;display:flex;align-items:center;justify-content:center;';
|
||||||
overlay.id = 'pw-modal';
|
overlay.id = 'pw-modal';
|
||||||
@@ -2485,21 +2510,24 @@ function askPassword() {
|
|||||||
<input type="password" id="pw-input" placeholder="Digite a senha..." style="width:100%;padding:10px;font-size:14px;border:1px solid #ccc;border-radius:6px;box-sizing:border-box;margin-bottom:12px" />
|
<input type="password" id="pw-input" placeholder="Digite a senha..." style="width:100%;padding:10px;font-size:14px;border:1px solid #ccc;border-radius:6px;box-sizing:border-box;margin-bottom:12px" />
|
||||||
<div id="pw-error" style="color:#c0272d;font-size:12px;margin-bottom:8px;display:none">Senha incorreta</div>
|
<div id="pw-error" style="color:#c0272d;font-size:12px;margin-bottom:8px;display:none">Senha incorreta</div>
|
||||||
<div style="display:flex;gap:8px;justify-content:center">
|
<div style="display:flex;gap:8px;justify-content:center">
|
||||||
<button onclick="document.getElementById('pw-modal').remove();window._pwResult=false;window._pwResolve&&window._pwResolve(false)" style="padding:8px 16px;background:#888;color:#fff;border:none;border-radius:6px;cursor:pointer">Cancelar</button>
|
<button id="pw-cancel-btn" style="padding:8px 16px;background:#888;color:#fff;border:none;border-radius:6px;cursor:pointer">Cancelar</button>
|
||||||
<button id="pw-ok-btn" style="padding:8px 16px;background:#e65100;color:#fff;border:none;border-radius:6px;cursor:pointer">OK</button>
|
<button id="pw-ok-btn" style="padding:8px 16px;background:#e65100;color:#fff;border:none;border-radius:6px;cursor:pointer">OK</button>
|
||||||
</div>
|
</div>
|
||||||
</div>`;
|
</div>`;
|
||||||
document.body.appendChild(overlay);
|
document.body.appendChild(overlay);
|
||||||
const inp = document.getElementById('pw-input');
|
const inp = document.getElementById('pw-input');
|
||||||
inp.focus();
|
inp.focus();
|
||||||
window._pwResolve = resolve;
|
|
||||||
|
document.getElementById('pw-cancel-btn').addEventListener('click', () => {
|
||||||
|
document.getElementById('pw-modal').remove();
|
||||||
|
resolve(false);
|
||||||
|
});
|
||||||
inp.addEventListener('keydown', e => { if (e.key === 'Enter') document.getElementById('pw-ok-btn').click(); });
|
inp.addEventListener('keydown', e => { if (e.key === 'Enter') document.getElementById('pw-ok-btn').click(); });
|
||||||
document.getElementById('pw-ok-btn').addEventListener('click', () => {
|
document.getElementById('pw-ok-btn').addEventListener('click', () => {
|
||||||
const val = document.getElementById('pw-input').value;
|
const val = document.getElementById('pw-input').value;
|
||||||
if (val === pw) {
|
if (val === pw) {
|
||||||
document.getElementById('pw-modal').remove();
|
document.getElementById('pw-modal').remove();
|
||||||
window._pwResult = true;
|
resolve(true);
|
||||||
window._pwResolve && window._pwResolve(true);
|
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('pw-error').style.display = 'block';
|
document.getElementById('pw-error').style.display = 'block';
|
||||||
inp.value = '';
|
inp.value = '';
|
||||||
@@ -2509,75 +2537,336 @@ function askPassword() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modal de edição separado e compacto
|
// Monta HTML de uma grade editável dentro do modal
|
||||||
|
function editTableHTML(id, headers, rows, numericCols) {
|
||||||
|
const fmtNum = v => {
|
||||||
|
const n = parseFloat(v);
|
||||||
|
return isNaN(n) ? '' : 'R$ ' + n.toLocaleString('pt-BR', { minimumFractionDigits: 2 });
|
||||||
|
};
|
||||||
|
const hdr = headers.map((h,i) => `<th style="padding:2px 4px;text-align:${numericCols.includes(i)?'right':'left'};font-size:10px;white-space:nowrap">${h}</th>`).join('');
|
||||||
|
const body = rows.map((row, ri) => {
|
||||||
|
const cells = row.map((val, ci) => {
|
||||||
|
const isNum = numericCols.includes(ci);
|
||||||
|
const displayVal = (val !== null && val !== undefined && val !== '')
|
||||||
|
? (isNum ? fmtNum(val) : val)
|
||||||
|
: '';
|
||||||
|
const extra = isNum
|
||||||
|
? `oninput="window._recalcEditTotals()" onblur="this.value=fmtBR(this)" `
|
||||||
|
: '';
|
||||||
|
return `<td style="padding:1px 2px"><input data-tbl="${id}" data-row="${ri}" data-col="${ci}" value="${displayVal}" ${extra}${isNum ? `style="width:100%;padding:2px;font-size:11px;text-align:right;border:1px solid #ccc;border-radius:2px"` : `style="width:100%;padding:2px;font-size:11px;border:1px solid #ccc;border-radius:2px"`} /></td>`;
|
||||||
|
}).join('');
|
||||||
|
return `<tr>${cells}</tr>`;
|
||||||
|
}).join('');
|
||||||
|
return `<table style="width:100%;border-collapse:collapse;font-size:11px;margin-bottom:4px"><thead><tr>${hdr}</tr></thead><tbody>${body}</tbody></table>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Monta uma grade vazia com N linhas editáveis
|
||||||
|
function editTableEmpty(id, headers, nRows, numericCols) {
|
||||||
|
const emptyRows = Array.from({length: nRows}, () => headers.map(() => ''));
|
||||||
|
return editTableHTML(id, headers, emptyRows, numericCols);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adiciona linha a uma grade editável no modal
|
||||||
|
window._editAddRow = function(tblId) {
|
||||||
|
const container = document.getElementById('tbl-edit-' + tblId);
|
||||||
|
if (!container) return;
|
||||||
|
const tbl = container.querySelector('table');
|
||||||
|
if (!tbl) return;
|
||||||
|
const numericCols = container.dataset.numeric ? JSON.parse(container.dataset.numeric) : [];
|
||||||
|
const cols = tbl.querySelector('tr').cells.length;
|
||||||
|
const newRowIdx = tbl.rows.length;
|
||||||
|
const row = tbl.insertRow(-1);
|
||||||
|
for (let c = 0; c < cols; c++) {
|
||||||
|
const td = row.insertCell(-1);
|
||||||
|
const isNum = numericCols.includes(c);
|
||||||
|
td.innerHTML = `<input data-tbl="${tblId}" data-row="${newRowIdx}" data-col="${c}" value="" ${isNum ? `oninput="window._recalcEditTotals()" onblur="this.value=fmtBR(this)" style="width:100%;padding:2px;font-size:11px;text-align:right;border:1px solid #ccc;border-radius:2px"` : `style="width:100%;padding:2px;font-size:11px;border:1px solid #ccc;border-radius:2px"`} />`;
|
||||||
|
}
|
||||||
|
// Recalcula após adicionar
|
||||||
|
window._recalcEditTotals();
|
||||||
|
};
|
||||||
|
|
||||||
|
// Lê todos os dados das grades editáveis do modal
|
||||||
|
function readEditTables() {
|
||||||
|
const inputs = document.querySelectorAll('#modal-edit input[data-tbl]');
|
||||||
|
const tables = {};
|
||||||
|
inputs.forEach(inp => {
|
||||||
|
const tbl = inp.dataset.tbl;
|
||||||
|
const row = parseInt(inp.dataset.row);
|
||||||
|
const col = parseInt(inp.dataset.col);
|
||||||
|
if (!tables[tbl]) tables[tbl] = [];
|
||||||
|
while (tables[tbl].length <= row) tables[tbl].push([]);
|
||||||
|
tables[tbl][row][col] = inp.value;
|
||||||
|
});
|
||||||
|
// Converte valores numéricos
|
||||||
|
const numericCols = {
|
||||||
|
'credito': [0], 'debito': [0], 'alimentacao': [0], 'pix': [0],
|
||||||
|
'vales': [1], 'despesas': [2], 'sangrias': [1],
|
||||||
|
'cancelamentos': [1], 'pixcnpj': [1], 'receber': [1]
|
||||||
|
};
|
||||||
|
Object.keys(tables).forEach(tbl => {
|
||||||
|
const ncols = numericCols[tbl] || [];
|
||||||
|
tables[tbl] = tables[tbl].filter(row => row.some(c => c !== '' && c != null));
|
||||||
|
tables[tbl] = tables[tbl].map(row => row.map((val, ci) => {
|
||||||
|
if (ncols.includes(ci)) return parseNum(val);
|
||||||
|
return (val || '').trim();
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
return tables;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recalcula todos os totais do modal de edição e atualiza o display
|
||||||
|
window._recalcEditTotals = function() {
|
||||||
|
const tables = readEditTables();
|
||||||
|
const cartCred_tot = (tables.credito || []).reduce((s, r) => s + (r[0] || 0), 0);
|
||||||
|
const cartDeb_tot = (tables.debito || []).reduce((s, r) => s + (r[0] || 0), 0);
|
||||||
|
const cartAli_tot = (tables.alimentacao || []).reduce((s, r) => s + (r[0] || 0), 0);
|
||||||
|
const cartPix_tot = (tables.pix || []).reduce((s, r) => s + (r[0] || 0), 0);
|
||||||
|
const vales_tot = (tables.vales || []).reduce((s, r) => s + (r[1] || 0), 0);
|
||||||
|
const desp_tot = (tables.despesas || []).reduce((s, r) => s + (r[2] || 0), 0);
|
||||||
|
const sang_tot = (tables.sangrias || []).reduce((s, r) => s + (r[1] || 0), 0);
|
||||||
|
const pixcnpj_tot = (tables.pixcnpj || []).reduce((s, r) => s + (r[1] || 0), 0);
|
||||||
|
const recv_tot = (tables.receber || []).reduce((s, r) => s + (r[1] || 0), 0);
|
||||||
|
const canc_tot = (tables.cancelamentos || []).reduce((s, r) => s + (r[1] || 0), 0);
|
||||||
|
|
||||||
|
const el = id => document.getElementById(id);
|
||||||
|
const fmtTot = v => v > 0 ? 'R$ ' + v.toLocaleString('pt-BR', { minimumFractionDigits: 2 }) : '—';
|
||||||
|
|
||||||
|
if (el('edit-total-credito')) el('edit-total-credito').textContent = fmtTot(cartCred_tot);
|
||||||
|
if (el('edit-total-debito')) el('edit-total-debito').textContent = fmtTot(cartDeb_tot);
|
||||||
|
if (el('edit-total-alimentacao')) el('edit-total-alimentacao').textContent = fmtTot(cartAli_tot);
|
||||||
|
if (el('edit-total-pix')) el('edit-total-pix').textContent = fmtTot(cartPix_tot);
|
||||||
|
if (el('edit-total-vales')) el('edit-total-vales').textContent = fmtTot(vales_tot);
|
||||||
|
if (el('edit-total-despesas')) el('edit-total-despesas').textContent = fmtTot(desp_tot);
|
||||||
|
if (el('edit-total-sangrias')) el('edit-total-sangrias').textContent = fmtTot(sang_tot);
|
||||||
|
if (el('edit-total-pixcnpj')) el('edit-total-pixcnpj').textContent = fmtTot(pixcnpj_tot);
|
||||||
|
if (el('edit-total-receber')) el('edit-total-receber').textContent = fmtTot(recv_tot);
|
||||||
|
if (el('edit-total-cancel')) el('edit-total-cancel').textContent = fmtTot(canc_tot);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Modal de edição completo com todas as grades
|
||||||
function openEditModal(full) {
|
function openEditModal(full) {
|
||||||
window._editModalOpen = true;
|
window._editModalOpen = true;
|
||||||
|
|
||||||
const dados = full.dados || {};
|
const dados = full.dados || {};
|
||||||
const fmtM = v => parseFloat(v||0).toFixed(2).replace('.', ',');
|
|
||||||
const fmtMR = v => 'R$ ' + fmtM(v);
|
// helper para fmt dinheiro
|
||||||
|
const fmtMR = v => {
|
||||||
|
const n = parseFloat(v||0);
|
||||||
|
if (isNaN(n) || n === 0) return '';
|
||||||
|
return 'R$ ' + n.toLocaleString('pt-BR', { minimumFractionDigits: 2 });
|
||||||
|
};
|
||||||
|
|
||||||
|
// helper inline para fmt table cell (já em editTableHTML)
|
||||||
|
|
||||||
const editedInfo = full.edited_at
|
const editedInfo = full.edited_at
|
||||||
? `<div style="background:#fff8e1;border-radius:4px;padding:6px 10px;font-size:11px;color:#666;margin-bottom:8px">
|
? `<div style="background:#fff8e1;border-radius:4px;padding:6px 10px;font-size:11px;color:#666;margin-bottom:8px">
|
||||||
<strong>⚠️ Última edição:</strong> ${full.edited_at.replace('T',' ').substring(0,16)} por <strong>${full.edited_by||'?'}</strong>
|
<strong>⚠️ Última edição:</strong> ${full.edited_at.replace('T',' ').substring(0,16)} por <strong>${full.edited_by||'?'}</strong>
|
||||||
</div>`
|
</div>`
|
||||||
: '';
|
: '';
|
||||||
|
|
||||||
const troco = parseFloat(full.saldo_troco||0);
|
// --- Cartões ---
|
||||||
const credito = parseFloat(full.saldo_credito||0);
|
const cartCred_rows = (dados.cartoes?.credito || full.cartoes_credito || []).map(r => [typeof r === 'object' ? r.valor : r]);
|
||||||
const debito = parseFloat(full.saldo_debito||0);
|
const cartDeb_rows = (dados.cartoes?.debito || full.cartoes_debito || []).map(r => [typeof r === 'object' ? r.valor : r]);
|
||||||
const alimentacao = parseFloat(full.saldo_alimentacao||0);
|
const cartAli_rows = (dados.cartoes?.alimentacao || full.cartoes_alimentacao || []).map(r => [typeof r === 'object' ? r.valor : r]);
|
||||||
const vales = parseFloat(full.saldo_vales||0);
|
const cartPix_rows = (dados.cartoes?.pix || full.cartoes_pix || []).map(r => [typeof r === 'object' ? r.valor : r]);
|
||||||
const pixcnpj = parseFloat(full.total_pixcnpj||0);
|
|
||||||
const areceber = parseFloat(full.saldo_areceber||0);
|
const cartCredHTML = editTableHTML('credito', ['Valor (R$)'], cartCred_rows.length ? cartCred_rows : [['']], [0]);
|
||||||
const clientes = dados.clientes ?? full.clientes ?? 0;
|
const cartDebHTML = editTableHTML('debito', ['Valor (R$)'], cartDeb_rows.length ? cartDeb_rows : [['']], [0]);
|
||||||
const frango = dados.frango ?? full.frango ?? 0;
|
const cartAliHTML = editTableHTML('alimentacao', ['Valor (R$)'], cartAli_rows.length ? cartAli_rows : [['']], [0]);
|
||||||
const vendas = dados.vendas ?? full.vendas ?? 0;
|
const cartPixHTML = editTableHTML('pix', ['Valor (R$)'], cartPix_rows.length ? cartPix_rows : [['']], [0]);
|
||||||
const saldo_esperado = parseFloat(full.saldo_esperado||0);
|
|
||||||
const obs = full.observacoes||'';
|
// --- Vales ---
|
||||||
|
const vales_rows = (full.vales_arr || []).map(r => [r.nome||r.Nome||'', r.valor||0, r.obs||r.Obs||'']);
|
||||||
|
const valesHTML = editTableHTML('vales', ['Nome', 'Valor (R$)', 'Obs'], vales_rows.length ? vales_rows : [['','','']], [1]);
|
||||||
|
|
||||||
|
// --- Despesas ---
|
||||||
|
const despesas_rows = (full.despesas_arr || []).map(r => [r.desc||r.Desc||'', r.obs||r.Obs||'', r.valor||0]);
|
||||||
|
const despesasHTML = editTableHTML('despesas', ['Descrição', 'Obs', 'Valor (R$)'], despesas_rows.length ? despesas_rows : [['','','']], [2]);
|
||||||
|
|
||||||
|
// --- Sangrias ---
|
||||||
|
const sangrias_rows = (full.sangrias_arr || []).map(r => [r.hora||r.Hora||'', r.retirada||r.valor||0, r.gerente||r.Gerente||'']);
|
||||||
|
const sangriasHTML = editTableHTML('sangrias', ['Hora', 'Valor (R$)', 'Gerente'], sangrias_rows.length ? sangrias_rows : [['','','']], [1]);
|
||||||
|
|
||||||
|
// --- Cancelamentos ---
|
||||||
|
const cancel_rows = (full.cancelamentos_arr || []).map(r => [r.numero||r.Numero||'', r.valor||0, r.motivo||r.Motivo||'']);
|
||||||
|
const cancelHTML = editTableHTML('cancelamentos', ['Número', 'Valor (R$)', 'Motivo'], cancel_rows.length ? cancel_rows : [['','','']], [1]);
|
||||||
|
|
||||||
|
// --- PIX CNPJ ---
|
||||||
|
const pixcnpj_rows = (full.pixcnpj_arr || []).map(r => [r.nome||r.desc||r.Desc||'', r.valor||0]);
|
||||||
|
const pixcnpjHTML = editTableHTML('pixcnpj', ['Nome', 'Valor (R$)'], pixcnpj_rows.length ? pixcnpj_rows : [['','']], [1]);
|
||||||
|
|
||||||
|
// --- A Receber ---
|
||||||
|
const receber_rows = (full.receber_arr || []).map(r => [r.nome||r.Nome||'', r.valor||0]);
|
||||||
|
const receberHTML = editTableHTML('receber', ['Nome', 'Valor (R$)'], receber_rows.length ? receber_rows : [['','']], [1]);
|
||||||
|
|
||||||
|
// --- Totais (só leitura formatado) ---
|
||||||
|
const totaisInfo = `
|
||||||
|
<div style="display:grid;grid-template-columns:1fr 1fr 1fr 1fr;gap:4px;background:#f5f5f5;border-radius:6px;padding:8px;margin-bottom:8px;font-size:11px">
|
||||||
|
<div><strong>Total Crédito:</strong> <span id="edit-total-credito">${fmtMR(full.total_cartao_credito||0)}</span></div>
|
||||||
|
<div><strong>Total Débito:</strong> <span id="edit-total-debito">${fmtMR(full.total_cartao_debito||0)}</span></div>
|
||||||
|
<div><strong>Total Alimentação:</strong> <span id="edit-total-alimentacao">${fmtMR(full.total_cartao_alimentacao||0)}</span></div>
|
||||||
|
<div><strong>Total PIX:</strong> <span id="edit-total-pix">${fmtMR(full.total_cartao_pix||0)}</span></div>
|
||||||
|
<div><strong>Total Sangrias:</strong> <span id="edit-total-sangrias">${fmtMR(full.total_sangrias||0)}</span></div>
|
||||||
|
<div><strong>Total Despesas:</strong> <span id="edit-total-despesas">${fmtMR(full.total_despesas||0)}</span></div>
|
||||||
|
<div><strong>Total Vales:</strong> <span id="edit-total-vales">${fmtMR(full.total_vales||0)}</span></div>
|
||||||
|
<div><strong>Total PIX CNPJ:</strong> <span id="edit-total-pixcnpj">${fmtMR(full.total_pixcnpj||0)}</span></div>
|
||||||
|
<div><strong>Total Receber:</strong> <span id="edit-total-receber">${fmtMR(full.total_areceber||0)}</span></div>
|
||||||
|
<div><strong>Total Cancel:</strong> <span id="edit-total-cancel">${fmtMR(full.total_cancelamentos||0)}</span></div>
|
||||||
|
</div>`;
|
||||||
|
|
||||||
const overlay = document.createElement('div');
|
const overlay = document.createElement('div');
|
||||||
overlay.id = 'modal-edit';
|
overlay.id = 'modal-edit';
|
||||||
overlay.style.cssText = 'position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.6);z-index:99998;display:flex;align-items:center;justify-content:center;';
|
overlay.style.cssText = 'position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.6);z-index:99998;overflow-y:auto';
|
||||||
overlay.innerHTML = `
|
overlay.innerHTML = `
|
||||||
<div style="background:#fff;border-radius:12px;padding:16px;max-width:520px;width:95%;max-height:92vh;overflow-y:auto;font-size:13px">
|
<div style="background:#fff;margin:16px auto;border-radius:12px;padding:16px;max-width:800px;width:95%;font-size:13px">
|
||||||
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:10px">
|
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;position:sticky;top:0;background:#fff;z-index:1">
|
||||||
<h2 style="margin:0;font-size:15px;color:#e65100">✏️ Editar Fechamento — ${full.loja||''} ${full.data||''}</h2>
|
<h2 style="margin:0;font-size:15px;color:#e65100">✏️ Editar Fechamento Completo</h2>
|
||||||
<button onclick="closeEditModal()" style="background:none;border:none;font-size:18px;cursor:pointer">✕</button>
|
<button onclick="closeEditModal()" style="background:none;border:none;font-size:18px;cursor:pointer;padding:4px 8px">✕</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
${editedInfo}
|
${editedInfo}
|
||||||
|
|
||||||
<div style="background:#f5f5f5;border-radius:6px;padding:8px;margin-bottom:10px;font-size:12px">
|
<!-- Identificação -->
|
||||||
<div><strong>📅 Data:</strong> ${full.data||'?'} <strong>Turno:</strong> ${full.turno||'?'} <strong>Operador:</strong> ${full.operador||'?'}</div>
|
<div style="background:#f5f5f5;border-radius:6px;padding:8px;margin-bottom:10px">
|
||||||
|
<div style="display:grid;grid-template-columns:1fr 1fr 1fr 1fr;gap:8px">
|
||||||
|
<div><label style="font-size:10px;color:#555">Data:</label><input type="date" id="edit-data" value="${full.data||''}" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px" /></div>
|
||||||
|
<div><label style="font-size:10px;color:#555">Loja:</label>
|
||||||
|
<select id="edit-loja" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px">
|
||||||
|
<option value="alianca" ${(full.loja||'').toLowerCase()==='alianca'?'selected':''}>Aliança</option>
|
||||||
|
<option value="uniao" ${(full.loja||'').toLowerCase()==='uniao'?'selected':''}>União</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div><label style="font-size:10px;color:#555">Turno:</label>
|
||||||
|
<select id="edit-turno" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px">
|
||||||
|
<option value="manha" ${(full.turno||'')==='manha'?'selected':''}>Manhã</option>
|
||||||
|
<option value="tarde" ${(full.turno||'')==='tarde'?'selected':''}>Tarde</option>
|
||||||
|
<option value="integral" ${(full.turno||'')==='integral'?'selected':''}>Integral</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div><label style="font-size:10px;color:#555">Operador:</label><input type="text" id="edit-operador" value="${full.operador||''}" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px" /></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="hidden" id="edit-id" value="${full.id||''}" />
|
<!-- Totais (leitura) -->
|
||||||
|
${totaisInfo}
|
||||||
|
|
||||||
<div style="display:grid;grid-template-columns:1fr 1fr 1fr;gap:6px;margin-bottom:8px">
|
<!-- Cartões de Crédito -->
|
||||||
<div><label style="font-size:10px;color:#555">Troco:</label><input type="text" id="edit-troco" value="${fmtMR(troco)}" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px;font-size:13px;text-align:right" onblur="this.value=fmtBR(this)" /></div>
|
<div style="margin-bottom:12px">
|
||||||
<div><label style="font-size:10px;color:#555">Crédito:</label><input type="text" id="edit-credito" value="${fmtMR(credito)}" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px;font-size:13px;text-align:right" onblur="this.value=fmtBR(this)" /></div>
|
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:4px">
|
||||||
<div><label style="font-size:10px;color:#555">Débito:</label><input type="text" id="edit-debito" value="${fmtMR(debito)}" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px;font-size:13px;text-align:right" onblur="this.value=fmtBR(this)" /></div>
|
<strong style="font-size:12px;color:#1565c0">💳 Cartão de Crédito</strong>
|
||||||
<div><label style="font-size:10px;color:#555">Alimentação:</label><input type="text" id="edit-alimentacao" value="${fmtMR(alimentacao)}" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px;font-size:13px;text-align:right" onblur="this.value=fmtBR(this)" /></div>
|
<button onclick="_editAddRow('credito')" style="background:#1565c0;color:#fff;border:none;border-radius:4px;padding:2px 8px;cursor:pointer;font-size:11px">+ Linha</button>
|
||||||
<div><label style="font-size:10px;color:#555">Vales:</label><input type="text" id="edit-vales" value="${fmtMR(vales)}" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px;font-size:13px;text-align:right" onblur="this.value=fmtBR(this)" /></div>
|
</div>
|
||||||
<div><label style="font-size:10px;color:#555">PIX CNPJ:</label><input type="text" id="edit-pixcnpj" value="${fmtMR(pixcnpj)}" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px;font-size:13px;text-align:right" onblur="this.value=fmtBR(this)" /></div>
|
<div id="tbl-edit-credito" data-numeric="[0]">${cartCredHTML}</div>
|
||||||
<div><label style="font-size:10px;color:#555">À Receber:</label><input type="text" id="edit-areceber" value="${fmtMR(areceber)}" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px;font-size:13px;text-align:right" onblur="this.value=fmtBR(this)" /></div>
|
|
||||||
<div><label style="font-size:10px;color:#555">Clientes:</label><input type="number" id="edit-clientes" value="${clientes}" min="0" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px;font-size:13px" /></div>
|
|
||||||
<div><label style="font-size:10px;color:#555">Frango:</label><input type="number" id="edit-frango" value="${frango}" min="0" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px;font-size:13px" /></div>
|
|
||||||
<div><label style="font-size:10px;color:#555">Vendas (R$):</label><input type="text" id="edit-vendas" value="${fmtMR(vendas)}" style="width:100%;padding:5px;border:1px solid #e65100;border-radius:4px;font-size:13px;text-align:right;font-weight:bold" onblur="this.value=fmtBR(this)" /></div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="display:grid;grid-template-columns:1fr 1fr 1fr;gap:6px;margin-bottom:8px">
|
<!-- Cartões de Débito -->
|
||||||
<div><label style="font-size:10px;color:#555">Dinheiro Contado:</label><input type="text" id="edit-fd" value="${fmtMR(parseFloat(full.fechamento_dinheiro||0))}" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px;font-size:13px;text-align:right" onblur="this.value=fmtBR(this)" /></div>
|
<div style="margin-bottom:12px">
|
||||||
<div><label style="font-size:10px;color:#555">Cartões Contado:</label><input type="text" id="edit-fc" value="${fmtMR(parseFloat(full.fechamento_cartoes||0))}" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px;font-size:13px;text-align:right" onblur="this.value=fmtBR(this)" /></div>
|
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:4px">
|
||||||
<div><label style="font-size:10px;color:#555">A Receber Contado:</label><input type="text" id="edit-fr" value="${fmtMR(parseFloat(full.fechamento_areceber||0))}" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px;font-size:13px;text-align:right" onblur="this.value=fmtBR(this)" /></div>
|
<strong style="font-size:12px;color:#2e7d32">💳 Cartão de Débito</strong>
|
||||||
<div><label style="font-size:10px;color:#555">Total Sangrias:</label><input type="text" id="edit-sangrias" value="${fmtMR(parseFloat(full.total_sangrias||0))}" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px;font-size:13px;text-align:right" onblur="this.value=fmtBR(this)" /></div>
|
<button onclick="_editAddRow('debito')" style="background:#2e7d32;color:#fff;border:none;border-radius:4px;padding:2px 8px;cursor:pointer;font-size:11px">+ Linha</button>
|
||||||
<div><label style="font-size:10px;color:#555">Total Despesas:</label><input type="text" id="edit-despesas" value="${fmtMR(parseFloat(full.total_despesas||0))}" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px;font-size:13px;text-align:right" onblur="this.value=fmtBR(this)" /></div>
|
</div>
|
||||||
<div><label style="font-size:10px;color:#555">Saldo Esperado:</label><input type="text" id="edit-esperado" value="${fmtMR(saldo_esperado)}" style="width:100%;padding:5px;border:1px solid #e65100;border-radius:4px;font-size:13px;text-align:right;font-weight:bold" onblur="this.value=fmtBR(this)" /></div>
|
<div id="tbl-edit-debito" data-numeric="[0]">${cartDebHTML}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="margin-bottom:8px">
|
<!-- Alimentação -->
|
||||||
|
<div style="margin-bottom:12px">
|
||||||
|
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:4px">
|
||||||
|
<strong style="font-size:12px;color:#e65100">🍽️ Alimentação</strong>
|
||||||
|
<button onclick="_editAddRow('alimentacao')" style="background:#e65100;color:#fff;border:none;border-radius:4px;padding:2px 8px;cursor:pointer;font-size:11px">+ Linha</button>
|
||||||
|
</div>
|
||||||
|
<div id="tbl-edit-alimentacao" data-numeric="[0]">${cartAliHTML}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- PIX -->
|
||||||
|
<div style="margin-bottom:12px">
|
||||||
|
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:4px">
|
||||||
|
<strong style="font-size:12px;color:#7b1fa2">📱 PIX</strong>
|
||||||
|
<button onclick="_editAddRow('pix')" style="background:#7b1fa2;color:#fff;border:none;border-radius:4px;padding:2px 8px;cursor:pointer;font-size:11px">+ Linha</button>
|
||||||
|
</div>
|
||||||
|
<div id="tbl-edit-pix" data-numeric="[0]">${cartPixHTML}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Vales -->
|
||||||
|
<div style="margin-bottom:12px">
|
||||||
|
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:4px">
|
||||||
|
<strong style="font-size:12px;color:#c62828">📋 Vales</strong>
|
||||||
|
<button onclick="_editAddRow('vales')" style="background:#c62828;color:#fff;border:none;border-radius:4px;padding:2px 8px;cursor:pointer;font-size:11px">+ Linha</button>
|
||||||
|
</div>
|
||||||
|
<div id="tbl-edit-vales" data-numeric="[1]">${valesHTML}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Despesas -->
|
||||||
|
<div style="margin-bottom:12px">
|
||||||
|
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:4px">
|
||||||
|
<strong style="font-size:12px;color:#ef6c00">💸 Despesas</strong>
|
||||||
|
<button onclick="_editAddRow('despesas')" style="background:#ef6c00;color:#fff;border:none;border-radius:4px;padding:2px 8px;cursor:pointer;font-size:11px">+ Linha</button>
|
||||||
|
</div>
|
||||||
|
<div id="tbl-edit-despesas" data-numeric="[2]">${despesasHTML}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Sangrias -->
|
||||||
|
<div style="margin-bottom:12px">
|
||||||
|
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:4px">
|
||||||
|
<strong style="font-size:12px;color:#00695c">🏧 Sangrias</strong>
|
||||||
|
<button onclick="_editAddRow('sangrias')" style="background:#00695c;color:#fff;border:none;border-radius:4px;padding:2px 8px;cursor:pointer;font-size:11px">+ Linha</button>
|
||||||
|
</div>
|
||||||
|
<div id="tbl-edit-sangrias" data-numeric="[1]">${sangriasHTML}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- PIX CNPJ -->
|
||||||
|
<div style="margin-bottom:12px">
|
||||||
|
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:4px">
|
||||||
|
<strong style="font-size:12px;color:#6a1b9a">PIX CNPJ</strong>
|
||||||
|
<button onclick="_editAddRow('pixcnpj')" style="background:#6a1b9a;color:#fff;border:none;border-radius:4px;padding:2px 8px;cursor:pointer;font-size:11px">+ Linha</button>
|
||||||
|
</div>
|
||||||
|
<div id="tbl-edit-pixcnpj" data-numeric="[1]">${pixcnpjHTML}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- A Receber -->
|
||||||
|
<div style="margin-bottom:12px">
|
||||||
|
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:4px">
|
||||||
|
<strong style="font-size:12px;color:#283593">📬 A Receber</strong>
|
||||||
|
<button onclick="_editAddRow('receber')" style="background:#283593;color:#fff;border:none;border-radius:4px;padding:2px 8px;cursor:pointer;font-size:11px">+ Linha</button>
|
||||||
|
</div>
|
||||||
|
<div id="tbl-edit-receber" data-numeric="[1]">${receberHTML}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Cancelamentos -->
|
||||||
|
<div style="margin-bottom:12px">
|
||||||
|
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:4px">
|
||||||
|
<strong style="font-size:12px;color:#777">❌ Cancelamentos</strong>
|
||||||
|
<button onclick="_editAddRow('cancelamentos')" style="background:#777;color:#fff;border:none;border-radius:4px;padding:2px 8px;cursor:pointer;font-size:11px">+ Linha</button>
|
||||||
|
</div>
|
||||||
|
<div id="tbl-edit-cancelamentos" data-numeric="[1]">${cancelHTML}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Saldo de Caixa (SÓ TROCO é editável — restante é soma automática) -->
|
||||||
|
<div style="margin-bottom:12px;background:#f5f5f5;border-radius:6px;padding:8px">
|
||||||
|
<strong style="font-size:12px;color:#333;margin-bottom:4px;display:block">💰 Saldo de Caixa <span style="font-size:10px;color:#888">(apenas Troco é editável)</span></strong>
|
||||||
|
<div style="display:grid;grid-template-columns:repeat(4,1fr);gap:6px">
|
||||||
|
<div><label style="font-size:10px;color:#555">Troco:</label><input type="text" id="edit-troco" value="${fmtMR(full.saldo_troco)}" style="width:100%;padding:5px;border:1px solid #2e7d32;border-radius:4px;text-align:right" onblur="this.value=fmtBR(this)" /></div>
|
||||||
|
<div><label style="font-size:10px;color:#888">Crédito:</label><input type="text" id="edit-sld-credito" value="${fmtMR(full.saldo_credito)}" readonly tabindex="-1" style="width:100%;padding:5px;border:1px solid #ddd;border-radius:4px;text-align:right;background:#eee;color:#666" /></div>
|
||||||
|
<div><label style="font-size:10px;color:#888">Débito:</label><input type="text" id="edit-sld-debito" value="${fmtMR(full.saldo_debito)}" readonly tabindex="-1" style="width:100%;padding:5px;border:1px solid #ddd;border-radius:4px;text-align:right;background:#eee;color:#666" /></div>
|
||||||
|
<div><label style="font-size:10px;color:#888">Alimentação:</label><input type="text" id="edit-sld-alimentacao" value="${fmtMR(full.saldo_alimentacao)}" readonly tabindex="-1" style="width:100%;padding:5px;border:1px solid #ddd;border-radius:4px;text-align:right;background:#eee;color:#666" /></div>
|
||||||
|
<div><label style="font-size:10px;color:#888">Vales:</label><input type="text" id="edit-sld-vales" value="${fmtMR(full.saldo_vales)}" readonly tabindex="-1" style="width:100%;padding:5px;border:1px solid #ddd;border-radius:4px;text-align:right;background:#eee;color:#666" /></div>
|
||||||
|
<div><label style="font-size:10px;color:#888">PIX CNPJ:</label><input type="text" id="edit-sld-pixcnpj" value="${fmtMR(full.total_pixcnpj)}" readonly tabindex="-1" style="width:100%;padding:5px;border:1px solid #ddd;border-radius:4px;text-align:right;background:#eee;color:#666" /></div>
|
||||||
|
<div><label style="font-size:10px;color:#888">À Receber:</label><input type="text" id="edit-sld-areceber" value="${fmtMR(full.saldo_areceber)}" readonly tabindex="-1" style="width:100%;padding:5px;border:1px solid #ddd;border-radius:4px;text-align:right;background:#eee;color:#666" /></div>
|
||||||
|
<div><label style="font-size:10px;color:#888">PIX Cartão:</label><input type="text" id="edit-sld-pixcartao" value="${fmtMR(full.total_cartao_pix)}" readonly tabindex="-1" style="width:100%;padding:5px;border:1px solid #ddd;border-radius:4px;text-align:right;background:#eee;color:#666" /></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Contadores -->
|
||||||
|
<div style="display:grid;grid-template-columns:1fr 1fr 1fr 1fr;gap:6px;margin-bottom:12px">
|
||||||
|
<div><label style="font-size:10px;color:#555">Clientes:</label><input type="number" id="edit-clientes" value="${dados.clientes||full.clientes||0}" min="0" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px" /></div>
|
||||||
|
<div><label style="font-size:10px;color:#555">Frango Assado:</label><input type="number" id="edit-frango" value="${dados.frango||full.frango||0}" min="0" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px" /></div>
|
||||||
|
<div><label style="font-size:10px;color:#555">Vendas (R$):</label><input type="text" id="edit-vendas" value="${fmtMR(dados.vendas||full.vendas||0)}" style="width:100%;padding:5px;border:1px solid #e65100;border-radius:4px;text-align:right;font-weight:bold" onblur="this.value=fmtBR(this)" /></div>
|
||||||
|
<div><label style="font-size:10px;color:#555">Saldo Esperado:</label><input type="text" id="edit-esperado" value="${fmtMR(full.saldo_esperado)}" style="width:100%;padding:5px;border:1px solid #e65100;border-radius:4px;text-align:right;font-weight:bold" onblur="this.value=fmtBR(this)" /></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Observações -->
|
||||||
|
<div style="margin-bottom:12px">
|
||||||
<label style="font-size:10px;color:#555">Observações:</label>
|
<label style="font-size:10px;color:#555">Observações:</label>
|
||||||
<textarea id="edit-obs" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px;font-size:13px;height:50px">${obs}</textarea>
|
<textarea id="edit-obs" style="width:100%;padding:5px;border:1px solid #ccc;border-radius:4px;font-size:13px;height:60px">${full.observacoes||''}</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="display:flex;gap:8px;flex-wrap:wrap">
|
<div style="display:flex;gap:8px;flex-wrap:wrap">
|
||||||
@@ -2603,7 +2892,7 @@ function closeEditModal() {
|
|||||||
window._editModalOpen = false;
|
window._editModalOpen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Salva edições do modal de edição separado
|
// Salva edições do modal de edição completo
|
||||||
window.salvarEdicaoModal = async function() {
|
window.salvarEdicaoModal = async function() {
|
||||||
const full = window._currentConsulta;
|
const full = window._currentConsulta;
|
||||||
if (!full) return;
|
if (!full) return;
|
||||||
@@ -2611,27 +2900,92 @@ window.salvarEdicaoModal = async function() {
|
|||||||
const p = v => parseNum(v);
|
const p = v => parseNum(v);
|
||||||
const inp = id => { const el = document.getElementById(id); return el ? el.value : ''; };
|
const inp = id => { const el = document.getElementById(id); return el ? el.value : ''; };
|
||||||
|
|
||||||
|
// Lê todas as grades editáveis
|
||||||
|
const tables = readEditTables();
|
||||||
|
|
||||||
|
// Calcula totais dos cartões
|
||||||
|
const cartCred_tot = (tables.credito || []).reduce((s, r) => s + (r[0] || 0), 0);
|
||||||
|
const cartDeb_tot = (tables.debito || []).reduce((s, r) => s + (r[0] || 0), 0);
|
||||||
|
const cartAli_tot = (tables.alimentacao || []).reduce((s, r) => s + (r[0] || 0), 0);
|
||||||
|
const cartPix_tot = (tables.pix || []).reduce((s, r) => s + (r[0] || 0), 0);
|
||||||
|
const vales_tot = (tables.vales || []).reduce((s, r) => s + (r[1] || 0), 0);
|
||||||
|
const desp_tot = (tables.despesas || []).reduce((s, r) => s + (r[2] || 0), 0);
|
||||||
|
const sang_tot = (tables.sangrias || []).reduce((s, r) => s + (r[1] || 0), 0);
|
||||||
|
const pixcnpj_tot = (tables.pixcnpj || []).reduce((s, r) => s + (r[1] || 0), 0);
|
||||||
|
const recv_tot = (tables.receber || []).reduce((s, r) => s + (r[1] || 0), 0);
|
||||||
|
const canc_tot = (tables.cancelamentos || []).reduce((s, r) => s + (r[1] || 0), 0);
|
||||||
|
|
||||||
|
// Monta estruturas de volta
|
||||||
|
const cartoes = {
|
||||||
|
credito: (tables.credito || []).map(r => r[0]),
|
||||||
|
debito: (tables.debito || []).map(r => r[0]),
|
||||||
|
alimentacao: (tables.alimentacao || []).map(r => r[0]),
|
||||||
|
pix: (tables.pix || []).map(r => r[0]),
|
||||||
|
};
|
||||||
|
|
||||||
|
const vales = (tables.vales || []).map(r => ({ nome: r[0], valor: r[1], obs: r[2]||'' }));
|
||||||
|
const despesas = (tables.despesas || []).map(r => ({ desc: r[0], obs: r[1]||'', valor: r[2] }));
|
||||||
|
const sangrias = (tables.sangrias || []).map(r => ({ hora: r[0], retirada: r[1], gerente: r[2]||'' }));
|
||||||
|
const cancelamentos = (tables.cancelamentos || []).map(r => ({ numero: r[0], valor: r[1], motivo: r[2]||'' }));
|
||||||
|
const pixcnpj = (tables.pixcnpj || []).map(r => ({ nome: r[0], valor: r[1] }));
|
||||||
|
const receber = (tables.receber || []).map(r => ({ nome: r[0], valor: r[1] }));
|
||||||
|
|
||||||
const now = new Date().toISOString();
|
const now = new Date().toISOString();
|
||||||
const operador = estado.operador || full.operador || '';
|
const operador = estado.operador || full.operador || '';
|
||||||
|
|
||||||
const updates = {
|
const updates = {
|
||||||
saldo_troco: p(inp('edit-troco')),
|
// Identificação
|
||||||
saldo_credito: p(inp('edit-credito')),
|
loja: inp('edit-loja'),
|
||||||
saldo_debito: p(inp('edit-debito')),
|
data: inp('edit-data'),
|
||||||
saldo_alimentacao: p(inp('edit-alimentacao')),
|
turno: inp('edit-turno'),
|
||||||
saldo_vales: p(inp('edit-vales')),
|
operador: inp('edit-operador'),
|
||||||
total_pixcnpj: p(inp('edit-pixcnpj')),
|
|
||||||
saldo_areceber: p(inp('edit-areceber')),
|
// Cartões (como arrays de números crus)
|
||||||
fechamento_dinheiro: p(inp('edit-fd')),
|
cartoes_credito: cartoes.credito,
|
||||||
fechamento_cartoes: p(inp('edit-fc')),
|
cartoes_debito: cartoes.debito,
|
||||||
fechamento_areceber: p(inp('edit-fr')),
|
cartoes_alimentacao: cartoes.alimentacao,
|
||||||
total_sangrias: p(inp('edit-sangrias')),
|
cartoes_pix: cartoes.pix,
|
||||||
total_despesas: p(inp('edit-despesas')),
|
|
||||||
|
// Totais de cartões
|
||||||
|
total_cartao_credito: cartCred_tot,
|
||||||
|
total_cartao_debito: cartDeb_tot,
|
||||||
|
total_cartao_alimentacao: cartAli_tot,
|
||||||
|
total_cartao_pix: cartPix_tot,
|
||||||
|
|
||||||
|
// Saldo de caixa (editável via tabela saldo)
|
||||||
|
saldo_troco: p(inp('edit-troco')),
|
||||||
|
saldo_credito: p(inp('edit-sld-credito')),
|
||||||
|
saldo_debito: p(inp('edit-sld-debito')),
|
||||||
|
saldo_alimentacao: p(inp('edit-sld-alimentacao')),
|
||||||
|
saldo_vales: p(inp('edit-sld-vales')),
|
||||||
|
total_pixcnpj: p(inp('edit-sld-pixcnpj')),
|
||||||
|
saldo_areceber: p(inp('edit-sld-areceber')),
|
||||||
|
|
||||||
|
// Totais
|
||||||
|
total_vales: vales_tot,
|
||||||
|
total_despesas: desp_tot,
|
||||||
|
total_sangrias: sang_tot,
|
||||||
|
total_areceber: recv_tot,
|
||||||
|
total_cancelamentos: canc_tot,
|
||||||
|
|
||||||
|
// Lançamentos detalhados
|
||||||
|
vales: vales,
|
||||||
|
despesas: despesas,
|
||||||
|
sangrias: sangrias,
|
||||||
|
cancelamentos: cancelamentos,
|
||||||
|
pixcnpj: pixcnpj,
|
||||||
|
receber: receber,
|
||||||
|
|
||||||
|
// Contadores
|
||||||
clientes: parseInt(inp('edit-clientes') || '0'),
|
clientes: parseInt(inp('edit-clientes') || '0'),
|
||||||
frango: parseInt(inp('edit-frango') || '0'),
|
frango: parseInt(inp('edit-frango') || '0'),
|
||||||
vendas: p(inp('edit-vendas')),
|
vendas: p(inp('edit-vendas')),
|
||||||
|
|
||||||
|
// Meta
|
||||||
saldo_esperado: p(inp('edit-esperado')),
|
saldo_esperado: p(inp('edit-esperado')),
|
||||||
observacoes: inp('edit-obs'),
|
observacoes: inp('edit-obs'),
|
||||||
|
|
||||||
|
// Edit log
|
||||||
edited_at: now,
|
edited_at: now,
|
||||||
edited_by: operador,
|
edited_by: operador,
|
||||||
};
|
};
|
||||||
@@ -2640,10 +2994,12 @@ window.salvarEdicaoModal = async function() {
|
|||||||
if (!hasTauri) { alert('Tauri não disponível.'); return; }
|
if (!hasTauri) { alert('Tauri não disponível.'); return; }
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const id = document.getElementById('edit-id').value || full.id;
|
// Usa uuid (string) — que é o id externo do registro no Supabase
|
||||||
if (!id) { alert('ID do registro não encontrado.'); return; }
|
const uuid = full.uuid || full.id;
|
||||||
|
if (!uuid) { alert('UUID do registro não encontrado.'); return; }
|
||||||
|
console.log('[DEBUG] salvarEdicaoModal uuid:', uuid, 'updates:', JSON.stringify(updates));
|
||||||
|
|
||||||
await window.__TAURI__.core.invoke('sb_atualizar_fechamento', { id, updates });
|
await window.__TAURI__.core.invoke('sb_atualizar_fechamento', { id: uuid, updates: JSON.stringify(updates) });
|
||||||
closeEditModal();
|
closeEditModal();
|
||||||
closeRelatorioModal();
|
closeRelatorioModal();
|
||||||
alert('✅ Atualizado com sucesso!');
|
alert('✅ Atualizado com sucesso!');
|
||||||
@@ -2799,30 +3155,37 @@ window.printRelatorio = function() {
|
|||||||
const full = window._currentConsulta;
|
const full = window._currentConsulta;
|
||||||
if (!full) return;
|
if (!full) return;
|
||||||
const data = consultaToPrintData(full);
|
const data = consultaToPrintData(full);
|
||||||
const html = buildPrintHTML(data);
|
|
||||||
const previewStyle = `
|
let html = `<!DOCTYPE html>
|
||||||
<style>
|
<html><head>
|
||||||
body { width: 80mm; margin: 0 auto; font-family: 'Courier New', monospace; font-size: 13px; background: #fff; padding: 10px; }
|
<meta charset="UTF-8">
|
||||||
.header { text-align: center; margin-bottom: 8px; }
|
<title>Fechamento de Caixa</title>
|
||||||
.header h1 { font-size: 18px; }
|
<style>
|
||||||
.header h2 { font-size: 14px; font-weight: normal; }
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||||
hr { border: none; border-top: 1px dashed #000; margin: 5px 0; }
|
body { font-family: 'Courier New', monospace; font-size: 14px; width: 80mm; margin: 0 auto; padding: 8px; font-weight: bold; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
|
||||||
.section-title { font-weight: bold; font-size: 13px; border-top: 1px dashed #000; padding-top: 3px; margin-top: 6px; }
|
.header { text-align: center; margin-bottom: 8px; }
|
||||||
.row { display: flex; justify-content: space-between; padding: 1px 0; font-size: 12px; }
|
.header h1 { font-size: 20px; font-weight: bold; }
|
||||||
.row.total-row { font-weight: bold; }
|
.header h2 { font-size: 15px; font-weight: normal; }
|
||||||
.cart-table { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 4px; }
|
hr { border: none; border-top: 2px solid #000; margin: 6px 0; }
|
||||||
.cart-table th { font-weight: bold; border-bottom: 1px solid #000; padding: 2px; }
|
.section-title { font-weight: bold; font-size: 14px; border-top: 2px solid #000; padding-top: 4px; margin-top: 8px; }
|
||||||
.cart-table td { padding: 2px 4px; text-align: right; }
|
.row { display: flex; justify-content: space-between; padding: 2px 0; font-size: 13px; font-weight: bold; }
|
||||||
.cart-table td:first-child { text-align: left; }
|
.row.total-row { font-weight: bold; }
|
||||||
.cart-table tr.total-row { font-weight: bold; border-top: 1px dashed #000; }
|
.cart-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 4px; font-weight: bold; }
|
||||||
.subtotal { font-size: 12px; margin-top: 4px; }
|
.cart-table th { font-weight: bold; border-bottom: 2px solid #000; padding: 2px; }
|
||||||
.diff-ok { color: #2e7d32; }
|
.cart-table td { padding: 2px 4px; text-align: right; font-weight: bold; }
|
||||||
.diff-bad { color: #c0272d; }
|
.cart-table td:first-child { text-align: left; }
|
||||||
.obs { font-size: 11px; color: #555; margin-top: 6px; white-space: pre-wrap; }
|
.cart-table tr.total-row { font-weight: bold; border-top: 2px solid #000; }
|
||||||
.footer { text-align: center; font-size: 11px; color: #555; margin-top: 8px; }
|
.subtotal { font-size: 13px; margin-top: 4px; }
|
||||||
@media print { body { background: #fff; } }
|
.subtotal .row { padding: 2px 0; }
|
||||||
</style>`;
|
.diff-ok { color: #2e7d32; font-weight: bold; }
|
||||||
const fullHtml = `<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Recibo</title>${previewStyle}</head><body>${html}</body></html>`;
|
.diff-bad { color: #c0272d; font-weight: bold; }
|
||||||
|
.obs { font-size: 11px; color: #555; margin-top: 6px; white-space: pre-wrap; font-weight: normal; }
|
||||||
|
.footer { text-align: center; font-size: 11px; color: #555; margin-top: 8px; }
|
||||||
|
@media print { body { background: #fff; font-weight: bold !important; } }
|
||||||
|
</style>
|
||||||
|
</head><body>
|
||||||
|
${buildPrintHTML(data)}
|
||||||
|
</body></html>`;
|
||||||
|
|
||||||
const existing = document.getElementById('print-preview-overlay');
|
const existing = document.getElementById('print-preview-overlay');
|
||||||
if (existing) document.body.removeChild(existing);
|
if (existing) document.body.removeChild(existing);
|
||||||
@@ -2844,7 +3207,7 @@ window.printRelatorio = function() {
|
|||||||
overlay.appendChild(btnFechar);
|
overlay.appendChild(btnFechar);
|
||||||
overlay.appendChild(btnImprimir);
|
overlay.appendChild(btnImprimir);
|
||||||
document.body.appendChild(overlay);
|
document.body.appendChild(overlay);
|
||||||
iframe.srcdoc = fullHtml;
|
iframe.srcdoc = html;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Intercepta o envio — se sync_status=editing, faz PATCH
|
// Intercepta o envio — se sync_status=editing, faz PATCH
|
||||||
@@ -2893,8 +3256,11 @@ async function salvarEdicaoSupabase() {
|
|||||||
// Remove campos que não devem ir no PATCH
|
// Remove campos que não devem ir no PATCH
|
||||||
delete data.uuid;
|
delete data.uuid;
|
||||||
delete data.id_local;
|
delete data.id_local;
|
||||||
|
// Usa o id numérico se disponível, senão usa uuid
|
||||||
|
const id = estado.id || estado.uuid;
|
||||||
|
console.log('[DEBUG] salvando id:', id, 'data:', JSON.stringify(data));
|
||||||
const result = await window.__TAURI__.core.invoke('sb_atualizar_fechamento', {
|
const result = await window.__TAURI__.core.invoke('sb_atualizar_fechamento', {
|
||||||
uuid: estado.uuid,
|
id: id,
|
||||||
updates: JSON.stringify(data)
|
updates: JSON.stringify(data)
|
||||||
});
|
});
|
||||||
console.log('[DEBUG] sb_atualizar_fechamento result:', result);
|
console.log('[DEBUG] sb_atualizar_fechamento result:', result);
|
||||||
|
|||||||
Reference in New Issue
Block a user