' . "\n"; // The two entry ids, debit and credit, are actually individual // entries in separate accounts (each make up one of the two // entries required for "double entry"). This, when we provide // reconcile information, we're really providing reconcile info // for two independent accounts. The reconciling entries, // therefore, are those on the opposite side of the ledger in // each account. For example, assume this "double" entry is // // debit: A/R credit: Cash amount: 55 // // Then, our accounts might look like: // // RENT TAX A/R CASH BANK // ------- ------- ------- ------- ------- // |20 | 20| | | <-- Unrelated // | | |20 20| | <-- Unrelated // | | | | | // |50 | 50| | | <-- Rent paid by this entry // | |5 5| | | <-- Tax paid by this entry // | | |55 55| | <-- THIS ENTRY // | | | | | // | | | |75 75| <-- Deposit includes this entry // | | | | | // // In this case, we're looking to provide reconcile information // of A/R for (the credit side of) this entry, and also of Cash // (for the debit side). Taking the accounts as individual // entries, instead of the "double entry" representation in the // database, we're actually providing information on the two // A/R entries, 50 & 5, which are both debits, i.e. opposite // entries to the credit of A/R. The cash account entry // reconciles against the credit of 75. Again, this is the // opposite entry to the debit of Cash. // // Thus, for our debit_ledger_id, we're reconciling against // credits, and for our credit_ledger_id, against debits. /********************************************************************** ********************************************************************** ********************************************************************** ********************************************************************** * LedgerEntry Detail Main Section */ $transaction = $entry['Transaction']; $ledgers = array('debit' => $entry['DebitLedger'], 'credit' => $entry['CreditLedger']); $entries = array('debit' => $entry['DebitEntry'], 'credit' => $entry['CreditEntry']); $entry = $entry['DoubleEntry']; $rows = array(); $rows[] = array('ID', $entry['id']); $rows[] = array('Transaction', $html->link('#'.$transaction['id'], array('controller' => 'transactions', 'action' => 'view', $transaction['id']))); $rows[] = array('Timestamp', FormatHelper::datetime($transaction['stamp'])); $rows[] = array('Comment', $entry['comment']); echo $this->element('table', array('class' => 'item ledger-entry detail', 'caption' => 'Double Ledger Entry Detail', 'rows' => $rows, 'column_class' => array('field', 'value'))); /********************************************************************** * LedgerEntry Info Box */ /* echo '
' . "\n"; */ /* foreach ($ledgers AS $type => $ledger) { */ /* //pr($ledger); */ /* if (!$ledger['Account']['trackable']) */ /* continue; */ /* $applied_caption = "Transfers applied"; */ /* $remaining_caption = "Unapplied amount"; */ /* $rows = array(); */ /* $rows[] = array($applied_caption, */ /* FormatHelper::currency($stats[$type]['amount_reconciled'])); */ /* $rows[] = array($remaining_caption, */ /* FormatHelper::currency($stats[$type]['amount_remaining'])); */ /* echo $this->element('table', */ /* array('class' => 'item summary', */ /* 'caption' => "{$ledger['Account']['name']} Ledger Entry", */ /* 'rows' => $rows, */ /* 'column_class' => array('field', 'value'), */ /* //'suppress_alternate_rows' => true, */ /* )); */ /* } */ /* echo '
' . "\n"; */ echo ('
' . "\n"); foreach ($ledgers AS $type => $ledger) { $rows = array(); // REVISIT : 20090816 // Due to low priority, the ledger_entry/double_entry stuff // is a bit piecemeal at the moment (trying to reuse old // code as much as possible). So, LedgerEntry view is just // redirecting here. Of course, presenting a link for the // LedgerEntry then is, well, quite pointless. $rows[] = array('ID', '#' . $entries[$type]['id']); /* $rows[] = array('ID', $html->link('#' . $entries[$type]['id'], */ /* array('controller' => 'entries', */ /* 'action' => 'view', */ /* $entries[$type]['id']))); */ $rows[] = array('Account', $html->link($ledger['Account']['name'], array('controller' => 'accounts', 'action' => 'view', $ledger['Account']['id']))); $rows[] = array('Ledger', $html->link('#' . $ledger['Account']['id'] . '-' . $ledger['sequence'], array('controller' => 'ledgers', 'action' => 'view', $ledger['id']))); $rows[] = array('Amount', FormatHelper::currency($entries[$type]['amount'])); //$rows[] = array('Effect', $ledger['Account']['ftype'] == $type ? 'INCREASE' : 'DECREASE'); echo $this->element('table', array('class' => array('item', $type, 'detail'), 'caption' => ucfirst($type) . ' Ledger Entry', 'rows' => $rows, 'column_class' => array('field', 'value'))); } echo ('
' . "\n"); /********************************************************************** ********************************************************************** ********************************************************************** ********************************************************************** * Supporting Elements Section */ echo '
' . "\n"; /* End "detail supporting" div */ echo '
' . "\n"; /* End page div */ echo '' . "\n";