|
|
|
|
@@ -2,88 +2,8 @@
|
|
|
|
|
|
|
|
|
|
echo '<div class="ledger-entry view">' . "\n";
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
**********************************************************************
|
|
|
|
|
**********************************************************************
|
|
|
|
|
**********************************************************************
|
|
|
|
|
* LedgerEntry Detail Main Section
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
$transaction = $entry['Transaction'];
|
|
|
|
|
$debit_ledger = $entry['DebitLedger'];
|
|
|
|
|
$credit_ledger = $entry['CreditLedger'];
|
|
|
|
|
$ledgers['debit'] = $entry['DebitLedger'];
|
|
|
|
|
$ledgers['credit'] = $entry['CreditLedger'];
|
|
|
|
|
$source = $entry['MonetarySource'];
|
|
|
|
|
$customer = $entry['Customer'];
|
|
|
|
|
$lease = $entry['Lease'];
|
|
|
|
|
$entry = $entry['LedgerEntry'];
|
|
|
|
|
|
|
|
|
|
$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('Effective', FormatHelper::date($entry['effective_date']));
|
|
|
|
|
$rows[] = array('Through', FormatHelper::date($entry['through_date']));
|
|
|
|
|
$rows[] = array('Customer', (isset($customer['name'])
|
|
|
|
|
? $html->link($customer['name'],
|
|
|
|
|
array('controller' => 'customers',
|
|
|
|
|
'action' => 'view',
|
|
|
|
|
$customer['id']))
|
|
|
|
|
: null));
|
|
|
|
|
$rows[] = array('Lease', (isset($lease['id'])
|
|
|
|
|
? $html->link('#'.$lease['id'],
|
|
|
|
|
array('controller' => 'leases',
|
|
|
|
|
'action' => 'view',
|
|
|
|
|
$lease['id']))
|
|
|
|
|
: null));
|
|
|
|
|
$rows[] = array('Monetary Source', (isset($source['name'])
|
|
|
|
|
? $html->link($source['name'],
|
|
|
|
|
array('controller' => 'monetary_sources',
|
|
|
|
|
'action' => 'view',
|
|
|
|
|
$source['id']))
|
|
|
|
|
: null));
|
|
|
|
|
$rows[] = array('Amount', FormatHelper::currency($entry['amount']));
|
|
|
|
|
|
|
|
|
|
foreach ($ledgers AS $type => $ledger)
|
|
|
|
|
$rows[] = array(ucfirst($type), ($html->link($ledger['Account']['name'],
|
|
|
|
|
array('controller' => 'accounts',
|
|
|
|
|
'action' => 'view',
|
|
|
|
|
$ledger['Account']['id']))
|
|
|
|
|
. ' ('
|
|
|
|
|
. $html->link('#' . $ledger['Account']['id']
|
|
|
|
|
. '-' . $ledger['sequence'],
|
|
|
|
|
array('controller' => 'ledgers',
|
|
|
|
|
'action' => 'view',
|
|
|
|
|
$ledger['id']))
|
|
|
|
|
. ')'));
|
|
|
|
|
|
|
|
|
|
$rows[] = array('Comment', $entry['comment']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo $this->element('table',
|
|
|
|
|
array('class' => 'item ledger-entry detail',
|
|
|
|
|
'caption' => 'Ledger Entry Detail',
|
|
|
|
|
'rows' => $rows,
|
|
|
|
|
'column_class' => array('field', 'value')));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
* LedgerEntry Info Box
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
echo '<div class="infobox">' . "\n";
|
|
|
|
|
$rows = array();
|
|
|
|
|
foreach ($ledgers AS $type => $ledger) {
|
|
|
|
|
pr($ledger);
|
|
|
|
|
if (!$ledger['Account']['trackable'])
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
// The two accounts, debit and credit, are actually individual
|
|
|
|
|
// entries in each of those account (each make up one of the two
|
|
|
|
|
// 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,
|
|
|
|
|
@@ -119,16 +39,77 @@ foreach ($ledgers AS $type => $ledger) {
|
|
|
|
|
// Thus, for our debit_ledger_id, we're reconciling against
|
|
|
|
|
// credits, and for our credit_ledger_id, against debits.
|
|
|
|
|
|
|
|
|
|
// Since we're looking at items opposite to $type (see above),
|
|
|
|
|
// our verbage needs to reflect those entry types.
|
|
|
|
|
|
|
|
|
|
$verb = ($ledger['Account']['ftype'] == $type) ? 'REDUCTION' : 'INCREASE';
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
**********************************************************************
|
|
|
|
|
**********************************************************************
|
|
|
|
|
**********************************************************************
|
|
|
|
|
* LedgerEntry Detail Main Section
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
$rows[] = array("Applied $verb {$ledger['Account']['name']}:",
|
|
|
|
|
$transaction = $entry['Transaction'];
|
|
|
|
|
$ledgers = array('debit' => $entry['DebitLedger'],
|
|
|
|
|
'credit' => $entry['CreditLedger']);
|
|
|
|
|
$source = $entry['MonetarySource'];
|
|
|
|
|
$customer = $entry['Customer'];
|
|
|
|
|
$lease = $entry['Lease'];
|
|
|
|
|
$entry = $entry['LedgerEntry'];
|
|
|
|
|
|
|
|
|
|
$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('Effective', FormatHelper::date($entry['effective_date']));
|
|
|
|
|
$rows[] = array('Through', FormatHelper::date($entry['through_date']));
|
|
|
|
|
$rows[] = array('Customer', (isset($customer['name'])
|
|
|
|
|
? $html->link($customer['name'],
|
|
|
|
|
array('controller' => 'customers',
|
|
|
|
|
'action' => 'view',
|
|
|
|
|
$customer['id']))
|
|
|
|
|
: null));
|
|
|
|
|
$rows[] = array('Lease', (isset($lease['id'])
|
|
|
|
|
? $html->link('#'.$lease['id'],
|
|
|
|
|
array('controller' => 'leases',
|
|
|
|
|
'action' => 'view',
|
|
|
|
|
$lease['id']))
|
|
|
|
|
: null));
|
|
|
|
|
$rows[] = array('Monetary Source', (isset($source['name'])
|
|
|
|
|
? $html->link($source['name'],
|
|
|
|
|
array('controller' => 'monetary_sources',
|
|
|
|
|
'action' => 'view',
|
|
|
|
|
$source['id']))
|
|
|
|
|
: null));
|
|
|
|
|
//$rows[] = array('Amount', FormatHelper::currency($entry['amount']));
|
|
|
|
|
$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 '<div class="infobox">' . "\n";
|
|
|
|
|
$rows = array();
|
|
|
|
|
foreach ($ledgers AS $type => $ledger) {
|
|
|
|
|
//pr($ledger);
|
|
|
|
|
if (!$ledger['Account']['trackable'])
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
$applied_caption = "Transfers applied to {$ledger['Account']['name']} entry";
|
|
|
|
|
$remaining_caption = "{$ledger['Account']['name']} entry unapplied amount";
|
|
|
|
|
|
|
|
|
|
$rows[] = array($applied_caption,
|
|
|
|
|
FormatHelper::currency($stats[$type]['amount_reconciled']));
|
|
|
|
|
$rows[] = array("{$debit_ledger['Account']['name']} Amount Remaining:",
|
|
|
|
|
$rows[] = array($remaining_caption,
|
|
|
|
|
FormatHelper::currency($stats[$type]['amount_remaining']));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo $this->element('table',
|
|
|
|
|
@@ -139,6 +120,31 @@ echo $this->element('table',
|
|
|
|
|
));
|
|
|
|
|
echo '</div>' . "\n";
|
|
|
|
|
|
|
|
|
|
echo ('<DIV CLASS="ledger-double-entry">' . "\n");
|
|
|
|
|
foreach ($ledgers AS $type => $ledger) {
|
|
|
|
|
$rows = array();
|
|
|
|
|
|
|
|
|
|
$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($entry['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 ('</DIV>' . "\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
**********************************************************************
|
|
|
|
|
@@ -162,8 +168,8 @@ foreach ($ledgers AS $type => $ledger) {
|
|
|
|
|
$caption = ('Matching ' . (($type == 'credit') ? 'DEBITS' : 'CREDITS') .
|
|
|
|
|
' from Account ' . $ledger['Account']['name']);
|
|
|
|
|
//$caption = ('Reconciled Entries ' . ($ledger['Account']['ftype'] == $type ? 'OUT OF' : 'INTO') .
|
|
|
|
|
$caption = ('Contribution to entries ' . ($ledger['Account']['ftype'] == $type ? 'OUT OF' : 'INTO') .
|
|
|
|
|
' Account ' . $ledger['Account']['name']);
|
|
|
|
|
$caption = ('Applied transfers ' . ($ledger['Account']['ftype'] == $type ? 'out of' : 'into') .
|
|
|
|
|
' Account: ' . $ledger['Account']['name']);
|
|
|
|
|
echo $this->element('ledger_entries', array
|
|
|
|
|
(// Element configuration
|
|
|
|
|
'account_ftype' => $type,
|
|
|
|
|
|