Company portals
Maintain and recover company credit records
Understand indexed account storage, receipts, reconciliation, recovery exports and backups.
Guide source reviewed for PressFlow 2.0.5.
PressFlow now stores account exposure, individual order receivables and financial events in dedicated indexed database tables. WooCommerce orders remain the source of commercial totals and taxes. No additional service or database is required.
What changes for the printer
Open PressFlow → B2B storefronts → Manage company → Purchasing & billing. The existing credit, PO, bank-receipt and recovery controls remain in that tab. Billing shows 25 records per page. Monthly summaries show up to 100 records per page; their total includes the whole selected month, not just the displayed page. Use Next account summary page where offered before printing the next page.
The monthly figure is the current balance of orders created in that month. It is not a historical closing balance, consolidated VAT invoice or accounting package. Missing/deleted WooCommerce orders do not erase retained account records/receipts.
First use and conversion of an older account
Fresh installations initialise empty account tables when credit is first needed. The three tables must use InnoDB. If the database cannot create/read them or cannot support transactions, new company credit stays held with an explanation. Ask the host to review the reported database error. Do not remove receipts to clear a hold.
Older _pfw_b2b_credit_ledger metadata is converted automatically under the company
lock, at most 100 receivables per batch. That legacy serialized array still has to
be read during conversion; normal converted account reads no longer load it.
The conversion records progress, resumes safely, checks counts and currency balance
sums and retains the original metadata. It then queues a reconciliation against
current WooCommerce orders. New credit waits for conversion/reconciliation to finish.
Existing debt is not cleared and another payment method does not erase that debt.
If conversion remains pending, check WordPress/server cron, reopen the billing tab and use Refresh account balances. This action also proceeds in bounded batches. If the source legacy data changed or records do not match, review/restore the source with your developer rather than deleting conversion markers or editing SQL rows.
Receipts and order changes
Credit reservations and receipt changes commit the receivable, exposure and journal together in one transaction. Saved receipt references and amounts cannot be edited or removed through the storage API. Repeating the same reference/amount does not record another receipt. Use the documented refund/accounting process for corrections. The journal is an application audit record, not protection against a database owner manually changing data.
WooCommerce order saves mark account balances as pending and reconcile after the order update. Scheduled recovery retains pending work if that cannot finish. The credit store refuses to start inside another component's active transaction; it does not commit or roll back that component's work. Until reconciliation finishes, credit and production clearance remain held where required.
If a receipt saved but the WooCommerce paid-order update failed, use Retry paid order update. That finishes the order state without recording another payment. For missing/reassigned orders, restore/review the commercial record and refresh. Do not use a manually changed WooCommerce status as evidence of money received.
Recovery copies and backups
The printer can select Download account recovery export. This private JSON file contains company account authorisations and their recorded payments. It streams bounded pages while holding the company lease so concurrent account writes wait. For very large histories, export during a quiet period; a failed/busy export can be retried. Protect the downloaded file as financial/customer data.
The export is a readable recovery aid, not an automatic import/restore tool or a replacement for a complete database/files backup. Backups must include the account tables, WordPress options/metadata, WooCommerce orders and artwork storage. Do not downgrade blindly after new receipts: the retained legacy array is a pre-conversion copy and does not contain subsequent financial activity.
Do not change currency/decimal settings on an active credit account without review. Stored records retain their decimal scale for reads; changed account precision holds new writes until reviewed. Normal supported precision is zero to six decimal places.
Developer reference
Tables, using the site's actual $wpdb->prefix:
| Suffix | Purpose |
|---|---|
pfw_credit_accounts | Company/currency exposure in integer minor units, precision and version. |
pfw_credit_orders | Company/order key, indexed due dates, balances, state, version and per-order receipt snapshot. |
pfw_credit_events | Unique financial event keys, receipt amounts and receivable changes. |
Schema version: pfw_credit_schema. Per-company conversion progress:
pfw_credit_migration_{company}. These are internal persistence details, not an
invitation for extensions to update SQL/options. WooCommerce order reads/writes use
CRUD for HPOS/legacy compatibility. Use the company purchasing APIs and locks; never
write a balance without its receipt/event/exposure transaction.
PFW_B2B_Finance::ledger() remains a full snapshot compatibility/export method.
Interactive integrations should use bounded account queries rather than calling it
on every page. The store's get, page, recent, balance and month_balance
methods enforce readiness; storage failures must hold credit, not imply a zero debt.
Need a hand?
Contact the PressFlow team with details of what you are trying to do.