# Existing-data migration

Only the administrator role can use **More → Existing data**, including templates, uploads, previews and confirmation. CEO and branch roles have no access.

Run migration 021 before using this workspace. XLSX import needs PHP zip and SimpleXML; CSV is available without zip. Supported uploads are .csv and .xlsx, up to 5 MB and 500 records. XLSX reads only the first worksheet and rejects formulas, macros, external links and oversized expanded archives. Download the matching CSV template, open it in Excel if desired, and save CSV or XLSX. Store dates as YYYY-MM-DD text, phones and identity numbers as text, and monetary amounts as plain decimals without currency or grouping separators. Exact template headers are required; column order may differ.

## Entry order and references

1. Set up branches and loan-officer staff through the existing administrator screens.
2. Import clients; import collateral using client source references or generated CL references.
3. Import financial accounts with their opening balances, cutover date and statement reference.
4. Import applications and loans using the originating officer username, original terms and security references (semicolon separated).
5. Import later historical receipts and expenses as needed.

Manual entry uses the same validation as uploaded files. Every record needs a source reference unique within its record type. Related source references must already have been saved. The commit result lists generated system references. A repeated file or source reference is rejected, never used to overwrite a live record.

## Status and financial meaning

Clients are registered; collateral can be held, released or sold. Applications can be draft, submitted, approved, returned or rejected. Approved historical applications require original approval date and archive reference. Current submitted/approved applications require held collateral. Existing loans can be active or closed; overdue is calculated from the original payout date, rather than stored as an unrelated status. Active security cannot be reserved twice.

Loan opening balances are debt outstanding **through the cutover date**, split into principal, interest and late fees. Original principal and interest remain on the loan. The opening snapshot accounts for earlier reductions without creating fake repayments. Enter the original daily late fee and fee cap; remaining future fee days follow those terms. Closed loans require zero opening debt. The system creates the linked application and instalment schedule. This phase supports the existing one-to-four-week product, not arbitrary legacy rollover chains. Imported loans do not apply automatic early-settlement interest adjustments until their original rate policy has been separately reviewed; ordinary repayments remain available.

Historical verified receipts must be strictly after the loan cutover, in payment-date order, with allocations matching the receipt and not exceeding outstanding components. Do not import receipts already included in the loan opening balance. Rejected receipts have zero allocations.

An account opening balance is cash at the **start of its opening date**. It must already include all historical cash activity before that date. Imported paid expenses and verified receipts must predate that account cutover and match its branch/payment method. Those payments and historical loan payouts are explicitly excluded from cash reposting, including later account synchronisation. New payments follow the standard verification and selected-account rules. Imported historical payments cannot use live cash reversals; any migration correction needs separate review.

Historical records show a migration notice and the source/statement reference. Archive references are not fabricated uploaded documents or new CEO approvals. Pending or draft imported records still need normal evidence before proceeding through live workflows. This workspace does not silently alter loans, payments, accounts or statuses already recorded in Lendford.

## Review and save

The preview checks every row in a rollback transaction and lists spreadsheet row errors. No live records survive preview. Correct the file and create a new preview when invalid. Confirmation rechecks current relationships and duplicates, then saves the whole batch in one transaction. A failure rolls back all records; an already-saved batch cannot be confirmed again. Batch source, administrator, reason, input values, current status and created records remain in the audit trail.

Portfolio balances for imported loans are available from their opening cutover date. Earlier portfolio dates exclude those loans because pre-cutover allocation history is not available from a current-balance snapshot.
