syncTotalsOnInspection in attik-backend/src/util/functions/forecast/syncTotalsOnInspections.ts sets remainingBalance = total - totalPaid and paid = true only when abs(total - totalPaid) ≤ $0.01. If totalPaid > total after a discount, remainingBalance is negative and paid stays false.inspection.paid in attik-backend/src/util/functions/inspection/checkReportAccess.ts; the client portal mirrors that via getReportLockMessage and lock UI on AttikReportList / ReportList when not paid.inspection.remainingBalance (e.g. JobAccordion.tsx Balance: $…), which can render $-50.00 with a Due Now chip even though the customer overpaid relative to the new total.attik-backend/src/events/streamHandlers/chargeStream.ts → syncTotalsOnInspection.Ryan was able to repro this issue in https://www.attik.ai/inspections/1008592864
attik-backend/src/util/functions/forecast/syncTotalsOnInspections.ts — remainingBalance and paid when totalPaid >= total (tolerance); avoid negative balance driving paid: false.attik-backend/src/util/functions/inspection/checkReportAccess.ts — report lock should treat settled/overpaid jobs as paid for gating.attik-backend/src/events/streamHandlers/chargeStream.ts — discount/charge updates already call syncTotalsOnInspection; verify behavior after totals fix.totalPaid > total, vs. clamping display to $0 only.attik-frontend/src/app/client/job/[slug]/components/JobAccordion.tsx — Pay for Your Service balance/chip when remainingBalance <= 0.attik-frontend/src/app/client/job/[slug]/components/AttikReportList.tsx, ReportList.tsx, attik-frontend/src/util/functions/report/getReportLockMessage.ts — lock when inspection.paid is false.attik-frontend/src/app/client/reports/components/LockedReportScreen.tsx, attik-frontend/src/app/client/reports/[slug]/page.tsx — backend 403 locked path uses checkReportAccess.attik-frontend/src/app/tools/inspections/[id]/components/ServicesPayments.tsx (balance display), EditChargesModal.tsx / DiscountModalButton (discount apply), ManualPaymentModal.tsx (full payment before discount in repro).attik-frontend/src/app/tools/inspections/[id]/components/WorkorderActionsDropdown.tsx — Open Client Portal for verification.paid or negative balance display.paid true, remainingBalance 0 (or product-approved overpayment handling), report unlocked when agreements complete.paid: false with negative remainingBalance.attik-backend/src/util/functions/forecast/syncTotalsOnInspections.tsattik-backend/src/util/functions/inspection/checkReportAccess.tsattik-frontend/src/app/client/job/[slug]/components/JobAccordion.tsxattik-frontend/src/util/functions/report/getReportLockMessage.tsPlease authenticate to join the conversation.
Completed
Main App
10 days ago
Linear
Get notified by email when there are changes.
Completed
Main App
10 days ago
Linear
Get notified by email when there are changes.