= 2; $can_undo = lookupUserPermission('module_financial') >= 3; $types = accountTypes(); $kinds = accountLedgerKinds(); $open_accounts = accountsList(false); $account_id = intval($_GET['account'] ?? 0); $account = $account_id ? accountRow($account_id) : null; $missing_account = $account_id && !$account; if (!$account) { $pick = 0; foreach ($open_accounts as $id => $option) { if ($option['reconciling_id']) { $pick = $id; break; } } if (!$pick && isset($open_accounts[intval($config_default_payment_account)])) { $pick = intval($config_default_payment_account); } if (!$pick && $open_accounts) { $pick = array_key_first($open_accounts); } $account = $pick ? $open_accounts[$pick] : null; } $account_id = $account ? intval($account['account_id']) : 0; $is_card = $account && $account['type'] === 3; $currency = $account ? (string) $account['account_currency_code'] : (string) $session_company_currency; $money = function ($amount) use ($currency) { return escapeHtml(billingMoney($amount, $currency)); }; // A balance as the statement reads it - a card's as what is owed $statement_money = function ($balance) use ($account, $money) { return $account ? escapeHtml(reconcileBalanceText($account, $balance)) : $money($balance); }; $open = $account ? reconcileOpen($account_id) : null; $last = $account ? reconcileLast($account_id) : null; $history = $account && !$open ? reconcileHistory($account_id) : []; $starting = $account ? reconcileStartingBalance($account_id) : 0.0; // Brought forward from the bank's balance - and how far ITFlow was from it that day $opening = $account ? reconcileOpening($account_id) : null; $opening_totals = $opening ? reconcileTotals($opening) : null; $opening_gap = $opening ? round($opening_totals['difference'], 2) : 0.0; // The next statement most likely ends at the end of last month $suggest = date('Y-m-t', strtotime('first day of last month')); if ($last && $suggest <= $last['reconciliation_statement_date']) { $suggest = date('Y-m-d'); } if ($open) { $totals = reconcileTotals($open); $lines = reconcileLines($open, $later); $statement_date = $open['reconciliation_statement_date']; } else { $uncleared = $account ? mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*), COALESCE(SUM(ledger.txn_amount), 0) FROM (" . accountLedgerSql($account_id, false) . ") AS ledger WHERE ledger.txn_cleared_id IS NULL")) : [0, 0]; } $statement_form = function ($row) use ($mysqli, $account, $is_card, $suggest, $last, $starting, $money, $statement_money) { $date = $row ? $row['reconciliation_statement_date'] : $suggest; $ending = $row ? floatval($row['reconciliation_ending_balance']) * ($is_card ? -1 : 1) : null; $first = !$row && !$last; if ($first) { // An account with history before the statement most likely starts from the bank's balance $start = date('Y-m-01', strtotime($date)); $account_id = intval($account['account_id']); $earlier = mysqli_fetch_row(mysqli_query($mysqli, "SELECT EXISTS (SELECT 1 FROM payments WHERE payment_account_id = $account_id AND payment_date < '$start') OR EXISTS (SELECT 1 FROM revenues WHERE revenue_account_id = $account_id AND revenue_date < '$start') OR EXISTS (SELECT 1 FROM expenses WHERE expense_account_id = $account_id AND expense_date < '$start')"))[0]; $from_statement = intval($earlier) === 1; ?>
Its first statement starts from
>
>
>
>
>
value="" required>
It starts from - .
= 0.005) { return; } $day = date('M j, Y', strtotime($opening['reconciliation_statement_date'])); ?>
On ITFlow had at and the bank at - apart. Correct the opening balance by that so ITFlow matches the bank from then on, or leave it - the statements reconcile from the bank's balance either way. Correct the opening balance
That account no longer exists.
Add an account to reconcile first.
Accounts
Starting from
The statement
Ending
Cleared
ticked - in, out
Difference

Reconcile statement to

Cleared Date Who or what In Out
aria-label="Cleared">
-
0 ? $money($amount) : '' ?>
Nothing on up to is left to clear.
·
Reconciled to
Not cleared yet
line

Reconcile

The next statement
$row) { $t = $row['totals']; ?>
Statement to Cleared In Out Reconciled
Brought forward - everything before
= 0.005) { ?>
opening balance corrected by
= 0.005) { ?>
off ITFlow's
line
from
Undo
hasn't been reconciled yet.