Import statement
purch_import_statementHand over one statement: the balances it prints and its lines as you were given them. Accepted whole, or refused with the gap named.
You were handed a file; this reads it. Pass the statement's lines in text
exactly as you have them, one row per line, and state the opening and closing balance the
statement PRINTS. That is the normal way, and the only way when you have the text: retyping
rows is where digits slip. The rows are read here; the batch is refused unless opening + rows
= closing, and the refusal names the gap (P-3). Never adjust a line to make it fit: re-read.
rows as typed fields exists for one case only: a statement you have no text for, a person
reading from paper. row_count is the count the statement prints, if it prints one; leave
it out otherwise. hash is computed from the text; pass one only with rows. The same
statement is refused a second time (P-4); rows already on record are skipped and listed back.
Nothing is categorised here; review follows.
Effects: source recorded; transactions recorded with provenance; duplicates skipped and listed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hash | No | Only with rows: a content hash of the file, or a stable id the statement carries. With text the hash is computed here. | |
| kind | Yes | What kind of statement. | |
| name | Yes | File name as given. | |
| rows | No | Only when there is no text to pass: every row as typed fields, in the statement's order. | |
| text | No | The statement's lines exactly as you were given them, unchanged: one row per line, date first, amount last. A running-balance column after the amount is fine; dates without a year are fine. Header and footer lines are ignored. This is the normal way. | |
| apr_bp | No | Card statements: the purchase rate in basis points, as printed (2499 = 24.99%). | |
| account | No | The account label as printed (e.g. "Visa ending 4421"). Matched to the register by name; a new name adds the account. | |
| currency | Yes | ISO 4217 code of the statement. | |
| row_count | No | The number of rows the statement prints, if it prints one. Checked against the rows read; leave it out when the statement does not say. | |
| account_id | No | Or the account in the register this statement belongs to, e.g. ACC-0002. An existing purch_account id. | |
| period_end | Yes | Last day the statement covers. ISO date, YYYY-MM-DD. | |
| minimum_due | No | Card statements: the minimum payment due, as printed. In cents (integer minor units) — 1250 means $12.50. | |
| credit_limit | No | Card statements: the credit limit, as printed. In cents (integer minor units) — 1250 means $12.50. | |
| period_start | Yes | First day the statement covers. ISO date, YYYY-MM-DD. | |
| closing_balance | Yes | Closing balance as printed, signed. In cents (integer minor units) — 1250 means $12.50. | |
| opening_balance | Yes | Opening balance as printed, signed. In cents (integer minor units) — 1250 means $12.50. | |
| payment_due_date | No | Card statements: the payment due date, as printed. ISO date, YYYY-MM-DD. |