fix: mapa colunas VENDAS e fluxos - Supabase Sheet IDs corrigidos

This commit is contained in:
Hermes Agent
2026-07-11 00:09:21 +00:00
parent 553ba8f2f5
commit 7ffea14891
+25 -22
View File
@@ -75,6 +75,7 @@ Tabela principal de fechamentos de caixa.
| `ip_origem` | inet | IP de origem | | `ip_origem` | inet | IP de origem |
| `user_agent` | text | Browser/cliente | | `user_agent` | text | Browser/cliente |
| `observacoes` | text | Notas | | `observacoes` | text | Notas |
| `atualizado_em` | timestamptz | Data última alteração |
**Constraints**: **Constraints**:
- `UNIQUE (loja, data, turno, operador)` - `UNIQUE (loja, data, turno, operador)`
@@ -146,13 +147,13 @@ URL: https://docs.google.com/spreadsheets/d/1OJZzDRTaU9Zh49QsgzAqNMxkn_7X7p7u_Bi
| D | DESPESAS | `total_despesas` | | | D | DESPESAS | `total_despesas` | |
| E | VALES | `total_vales` | | | E | VALES | `total_vales` | |
| F | DINHEIRO | `fechamento_dinheiro` | | | F | DINHEIRO | `fechamento_dinheiro` | |
| G | PIX TAV | `total_pixcnpj` | | | G | PIX TAV | `total_pixcnpj` | PIX taxado (cobrado ao cliente) |
| H | PIX LOJA | `total_pixcnpj` | | | H | PIX LOJA | `saldo_pixcnpj` | PIX do cliente na loja |
| I | PRAZO | `total_areceber` | | | I | PRAZO | `total_areceber` | |
| J | PZREC | `saldo_areceber` | | | J | PZREC | `saldo_areceber` | Valor a receber contado |
| K | CRÉDITO | `total_cartao_credito` | | | K | CRÉDITO | `total_cartao_credito` | |
| L | DÉBITO | `total_cartao_debito` | | | L | DÉBITO | `total_cartao_debito` | |
| M | VOUCHER | `total_cartao_pix` | | | M | VOUCHER | `total_cartao_alimentacao` | Ticket alimentação |
| N | CARTÃO | `fechamento_cartoes` | | | N | CARTÃO | `fechamento_cartoes` | |
| O | **T. VENDA** | **`vendas`** | `=SOMA(K7705:M7705)` — total de vendas | | O | **T. VENDA** | **`vendas`** | `=SOMA(K7705:M7705)` — total de vendas |
| P | **TX CARTÃO** | calculado | `=SOMA(SEERRO(VENDAS!K*1,95%;0);SEERRO(VENDAS!L*1,2%;0);SEERRO(VENDAS!M*6%;0))` | | P | **TX CARTÃO** | calculado | `=SOMA(SEERRO(VENDAS!K*1,95%;0);SEERRO(VENDAS!L*1,2%;0);SEERRO(VENDAS!M*6%;0))` |
@@ -179,31 +180,31 @@ URL: https://docs.google.com/spreadsheets/d/1OJZzDRTaU9Zh49QsgzAqNMxkn_7X7p7u_Bi
### Fluxo Actual (funciona) ### Fluxo Actual (funciona)
``` ```
PC PDV (ficheiros) PC PDV (ficheiros DBF)
↓ SyncThing ↓ SyncThing
VPS (ficheiros) VPS (ficheiros)
↓ N8N (conversão) ↓ N8N ("PDV Sync - Syncthing para Supabase")
Supabase → Google Sheets (VENDAS) Supabase (tabela pdv_fechamento)
↓ N8N ("PDV → Google Sheets Sync")
Google Sheets (VENDAS)
Sheet (Exportação) Sheet (Exportação) → CSV/Excel → Meu Dinheiro (app)
CSV/Excel
Meu Dinheiro (app)
``` ```
### Fluxo Futuro (objectivo) ### Fluxo App Fechamento Caixa → Sheet VENDAS (2026-07-10)
``` ```
PDV Web (novo sistema)
Supabase
↓ ← N8N (quando disponível)
Google Sheets (opcional) → Exportação → Meu Dinheiro
App Fechamento Caixa (Tauri) App Fechamento Caixa (Tauri)
↓ POST / rest/v1/fechamentos_web
Supabase (tabela fechamentos_web)
↓ N8N Workflow "Supabase → Sheet VENDAS" (20h BRT)
Google Sheets (VENDAS) ← última linha: 7729 (01/07/2026)
Sheet (Exportação) → Meu Dinheiro
``` ```
**Nota:** Os dois fluxos são independentes. O N8N do PDV não escreve na mesma Sheet que o App Fechamento Caixa — o App escreve em linha nova a partir da 7730.
--- ---
## 6. Tarefas em Aberto ## 6. Tarefas em Aberto
@@ -246,15 +247,17 @@ App Fechamento Caixa (Tauri)
### Supabase (self-hosted) ### Supabase (self-hosted)
- **Container IPs**: podem mudar após `docker update` da Hostinger - **Container IPs**: podem mudar após `docker update` da Hostinger
- PostgREST (supabase-rest): `172.16.6.7` — ⚠️ MUDANÇA FREQUENTE - ⚠️ IPs listados abaixo podem estar desactualizados — o cron `Kong DNS fix` mantém o `kong.yml` actualizado
- Kong: `172.16.6.7` (mesmo host, porta 8000) - PostgREST (supabase-rest): ver cron `Kong DNS fix`
- Kong: `supabase-kong` (mesmo host, porta 8000)
- DB: `172.16.6.4` - DB: `172.16.6.4`
- Auth: `172.16.6.8` - Auth: ver cron
- Meta: `172.16.6.9` - Meta: `172.16.6.9`
- Pooler: `172.16.6.10` - Pooler: `172.16.6.10`
- **Problema conhecido**: IPs hardcoded no `kong.yml` — corrigido automaticamente - **Problema conhecido**: IPs hardcoded no `kong.yml` — corrigido automaticamente
- Cron `Kong DNS fix` (job ID: `9a64e7b49ac6`) corre a cada 15 min - Cron `Kong DNS fix` (job ID: `9a64e7b49ac6`) corre a cada 15 min
- Usa DNS names (`http://supabase-rest:3000/`) em vez de IPs hardcoded
- Compara IP actual do `supabase-rest` com o em `kong.yml` - Compara IP actual do `supabase-rest` com o em `kong.yml`
- Se diferente: substitui e reinicia `supabase-kong` - Se diferente: substitui e reinicia `supabase-kong`