Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| aa147885a8 | |||
| 00fa17fa52 |
@@ -142,7 +142,7 @@ impl SupabaseClient {
|
|||||||
"frango": estado.get("frango").and_then(|v| v.as_i64()).unwrap_or(0),
|
"frango": estado.get("frango").and_then(|v| v.as_i64()).unwrap_or(0),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Upsert via POST com Prefer: resolution=merge-duplicates
|
// Primeiro tenta INSERT (upsert via Prefer)
|
||||||
let resp = self
|
let resp = self
|
||||||
.http
|
.http
|
||||||
.post(&format!("{}/rest/v1/fechamentos_web", self.base_url))
|
.post(&format!("{}/rest/v1/fechamentos_web", self.base_url))
|
||||||
@@ -152,7 +152,7 @@ impl SupabaseClient {
|
|||||||
.send()?;
|
.send()?;
|
||||||
|
|
||||||
let status = resp.status();
|
let status = resp.status();
|
||||||
if status.is_success() {
|
if status.is_success() || status.as_u16() == 409 {
|
||||||
Ok(serde_json::json!({ "ok": true, "id_fechamento": id_fechamento }))
|
Ok(serde_json::json!({ "ok": true, "id_fechamento": id_fechamento }))
|
||||||
} else {
|
} else {
|
||||||
let body = resp.text().unwrap_or_default();
|
let body = resp.text().unwrap_or_default();
|
||||||
|
|||||||
+2
-2
@@ -873,9 +873,9 @@ function updateTotals() {
|
|||||||
const fr = receberTotal;
|
const fr = receberTotal;
|
||||||
setText('fech-total', fmt(fd + fc + fr));
|
setText('fech-total', fmt(fd + fc + fr));
|
||||||
|
|
||||||
// Diferença = total_fechamento - saldo_esperado - cancelamentos
|
// Diferença = total_fechamento (sysTotal: troco+credito+debito+alimentacao+vales+receber+pixCartao+pixCnpj) - saldo_esperado - cancelamentos
|
||||||
const cancelTotal = estado.cancelamentos.reduce((s,r) => s+(parseNum(r.valor||0)||0), 0);
|
const cancelTotal = estado.cancelamentos.reduce((s,r) => s+(parseNum(r.valor||0)||0), 0);
|
||||||
const diff = (fd + fc + fr) - parseNum(val('f-saldo-esperado')) - cancelTotal;
|
const diff = sysTotal - parseNum(val('f-saldo-esperado')) - cancelTotal;
|
||||||
const difEl = document.getElementById('diferenca');
|
const difEl = document.getElementById('diferenca');
|
||||||
const badgeEl = document.getElementById('dif-badge');
|
const badgeEl = document.getElementById('dif-badge');
|
||||||
if (difEl) {
|
if (difEl) {
|
||||||
|
|||||||
Reference in New Issue
Block a user