git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@356 97e9348a-65ac-dc4b-aefc-98561f571b83
170 lines
6.0 KiB
PHP
170 lines
6.0 KiB
PHP
<?php /* -*- mode:PHP -*- */
|
|
|
|
echo '<div class="entry view">' . "\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"). The reconciling entries
|
|
// are those on the opposite side of the ledger in the specific
|
|
// account. For example, assume the 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 DOUBLE ENTRY
|
|
// | | | | |
|
|
// | | | |75 75| <-- Deposit includes this entry
|
|
// | | | | |
|
|
//
|
|
// In this case, assume that THIS specific Entry is the A/R credit
|
|
// of the Double Entry. We'll need to provide information on the
|
|
// two A/R entries, 50 & 5, which are both debits, i.e. opposite
|
|
// entries to the credit of A/R.
|
|
|
|
|
|
/**********************************************************************
|
|
**********************************************************************
|
|
**********************************************************************
|
|
**********************************************************************
|
|
* Entry Detail Main Section
|
|
*/
|
|
|
|
$account = $entry['Account'];
|
|
$double = $entry['DoubleEntry'];
|
|
$transaction = $double['Transaction'];
|
|
$customer = $double['Customer'];
|
|
$lease = $double['Lease'];
|
|
$entry = $entry['Entry'];
|
|
|
|
$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($double['effective_date']));
|
|
$rows[] = array('Through', FormatHelper::date($entry['through_date']));
|
|
$rows[] = array('Amount', FormatHelper::currency($double['amount']));
|
|
$rows[] = array('Account', $html->link($account['name'],
|
|
array('controller' => 'accounts',
|
|
'action' => 'view',
|
|
$account['id'])));
|
|
$rows[] = array('Cr/Dr', ($entry['crdr'] .
|
|
' (Matching ' . $entry['opposite_crdr'] . ': ' .
|
|
$html->link('#'.$entry['matching_entry_id'],
|
|
array('controller' => 'entries',
|
|
'action' => 'view',
|
|
$entry['matching_entry_id'])) .
|
|
')'));
|
|
$rows[] = array('Double Entry', $html->link('#'.$double['id'],
|
|
array('controller' => 'double_entries',
|
|
'action' => 'view',
|
|
$double['id'])));
|
|
$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('Comment', $entry['comment']);
|
|
|
|
echo $this->element('table',
|
|
array('class' => 'item entry detail',
|
|
'caption' => 'Ledger Entry Detail',
|
|
'rows' => $rows,
|
|
'column_class' => array('field', 'value')));
|
|
|
|
|
|
/**********************************************************************
|
|
* Entry Info Box
|
|
*/
|
|
|
|
echo '<div class="infobox">' . "\n";
|
|
|
|
//pr($reconciled);
|
|
foreach ($reconciled['summary'] AS $Rtype => $stats) {
|
|
$rtype = strtolower($Rtype);
|
|
|
|
$applied_caption = "Applied";
|
|
$remaining_caption = "Balance";
|
|
|
|
/* $applied_caption = $Rtype . 's Applied'; */
|
|
/* $remaining_caption = 'Remaining for ' . $Rtype . 's'; */
|
|
|
|
$rows = array();
|
|
$rows[] = array($applied_caption,
|
|
'<SPAN id="'.$rtype.'-applied">' .
|
|
FormatHelper::currency($stats['reconciled']) .
|
|
'</SPAN>');
|
|
$rows[] = array($remaining_caption,
|
|
'<SPAN id="'.$rtype.'-unapplied">' .
|
|
FormatHelper::currency($stats['balance']) .
|
|
'</SPAN>');
|
|
|
|
echo $this->element('table',
|
|
array('class' => 'item summary',
|
|
'caption' => $Rtype . 's',
|
|
'rows' => $rows,
|
|
'column_class' => array('field', 'value'),
|
|
//'suppress_alternate_rows' => true,
|
|
));
|
|
}
|
|
|
|
echo '</div>' . "\n";
|
|
|
|
|
|
/**********************************************************************
|
|
**********************************************************************
|
|
**********************************************************************
|
|
**********************************************************************
|
|
* Supporting Elements Section
|
|
*/
|
|
|
|
echo '<div CLASS="detail supporting">' . "\n";
|
|
|
|
|
|
/**********************************************************************
|
|
* Reconciliation Ledger Entries
|
|
*/
|
|
|
|
foreach ($reconciled['entries'] AS $Rtype => $entries) {
|
|
$rtype = strtolower($Rtype);
|
|
|
|
$caption = $Rtype . 's applied';
|
|
echo $this->element('entries', array
|
|
(// Element configuration
|
|
'entry_ids' => $entries,
|
|
/* 'action' => 'reconcile', */
|
|
/* 'entry_id' => $entry['id'], */
|
|
/* 'reconcile_types' => array($rtype), */
|
|
// 'reconcile_id' => $entry['id'],
|
|
|
|
// Grid configuration
|
|
'config' => array
|
|
('caption' => $caption,
|
|
'grid_div_id' => $rtype.'-entries',
|
|
),
|
|
));
|
|
}
|
|
|
|
|
|
/* End "detail supporting" div */
|
|
echo '</div>' . "\n";
|
|
|
|
/* End page div */
|
|
echo '</div>' . "\n";
|