QR Code Document Retrieval Guide (Invoices & Estimates)

The SierraBooks application supports instant document retrieval and presentation via dynamically generated QR codes printed on physical or digital PDF invoices and estimates.

Scanning a document’s QR code bypasses manual search menus, pulling the live database record straight from Firestore and presenting it to the operator instantly.

How It Works

Each printed Invoice and Estimate document has a unique, high-resolution QR code rendered directly into the footer area.

+---------------------------------------+
|             SIERRA BOOKS              |
|                                       |
|   Invoice ID: #INV-928475             |
|                                       |
|   [ QR CODE ] <-- Scan to View Live   |
|                                       |
+---------------------------------------+

When an operator scans this QR code using a smartphone camera or an external scanner:

  1. URL Decoded: The scanner parses the embedded deep-link:

    • Invoices: https://sierrabooks.page.link/view/invoice/<invoiceId>

    • Estimates: https://sierrabooks.page.link/view/estimate/<estimateId>

  2. App Interception: The SierraBooks Flutter application intercepts the incoming OS routing event via the centralized Dynamic Link Handler (main_dynamic_links.dart).

  3. Firestore Synchronization: The app contacts Cloud Firestore to load the raw document schema in real-time, verifying its existence.

  4. Instant View/Edit Presentation: The app opens the live view immediately, pushing Glob.EditInvoicePage or Glob.EditEstimatePage onto the navigation stack with full edit capabilities.

  5. Analytics Recorded: A custom processed_qr_code tracking event is sent to Firebase Analytics for business telemetry.

Generating QR Codes on Documents

QR codes are generated dynamically at the PDF compilation stage using the embedded PDF generator layout engine.

For Invoices (create_pdf_invoice.dart) and Estimates (create_pdf_estimate.dart), the QR code is compiled using the following PDF widget structure:

// --- PAY / VIEW QR CODE ---
pw.Container(
  width: 60,
  height: 60,
  child: pw.BarcodeWidget(
    barcode: pw.Barcode.qrCode(),
    data: 'https://sierrabooks.page.link/view/invoice/${invoice.id}',
    drawText: false,
  ),
)

Step-by-Step Operator Guide

Follow these simple steps to retrieve a document live:

  1. Locate the Code: Find the square QR Code located in the bottom footer of any printed or PDF document.

  2. Scan: Open the native iOS or Android camera app and point it at the QR code.

  3. App Direct Launch: Tap the banner notification that appears on the screen (e.g., “Open in SierraBooks”).

  4. Instant Editing: The app will automatically wake up, synchronize with the backend, and load the live invoice/estimate details immediately without requiring any search queries or manual entry.

Analytics & Telemetry

Every successful QR scan records a custom tracking event to measure engagement and operational speed.

The custom processed_qr_code event tracks the following parameters:

QR Code Telemetry Parameters

Parameter Name

Data Type

Description

document_type

String

Indicates if the scanned code belonged to an "invoice" or "estimate".

document_id

String

The unique Firestore document ID retrieved.

url

String

The complete parsed URL of the dynamic deep link.