This rework is nowhere near complete, but there are certain things that are falling in place, and worth capturing. I started a branch for just this purpose of being able to check in intermediate work.

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@352 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-19 23:35:25 +00:00
parent af0c10f6a6
commit 3d262fd4db
24 changed files with 2401 additions and 1373 deletions

165
views/entries/view.ctp Normal file
View File

@@ -0,0 +1,165 @@
<?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('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";
$applied_caption = "Transfers applied";
$remaining_caption = "Unapplied amount";
foreach ($reconciled['stats'] AS $Rtype => $stats) {
$rtype = strtolower($Rtype);
$applied_caption = "Transfers applied";
$remaining_caption = "Unapplied amount";
/* $applied_caption = $Rtype . 's Applied'; */
/* $remaining_caption = 'Remaining for ' . $Rtype . 's'; */
$rows = array();
$rows[] = array($applied_caption,
'<SPAN id="'.$rtype.'-applied">' .
FormatHelper::currency($stats['applied']) .
'</SPAN>');
$rows[] = array($remaining_caption,
'<SPAN id="'.$rtype.'-unapplied">' .
FormatHelper::currency($stats['unapplied']) .
'</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,
// Grid configuration
'config' => array
('caption' => $caption,
'grid_div_id' => $rtype.'-entries',
),
));
}
/* End "detail supporting" div */
echo '</div>' . "\n";
/* End page div */
echo '</div>' . "\n";