🗄 Tabla requerida — Registros Contables
Ejecuta en Supabase → SQL Editor:
CREATE TABLE IF NOT EXISTS registros_contables (
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
recepcion_id uuid REFERENCES recepciones(id) ON DELETE CASCADE,
numero_guia_verif text,
kg_guia numeric(8,2),
discrepancia_kg numeric(8,2),
estado_verificacion text CHECK (estado_verificacion IN ('ok','diferencia','pendiente')) DEFAULT 'pendiente',
numero_factura text,
fecha_factura date,
monto_factura numeric(14,0),
pagado boolean DEFAULT false,
fecha_pago date,
responsable text,
observaciones text,
created_at timestamptz DEFAULT now()
);
ALTER TABLE registros_contables ENABLE ROW LEVEL SECURITY;
DROP POLICY IF EXISTS "allow all" ON registros_contables;
CREATE POLICY "allow all" ON registros_contables FOR ALL USING (true) WITH CHECK (true);