Further progress on payment entries. There is an outstanding charges grid, but it doesn't have amounts due to the way I designed the ledger_entries element. I'll do a bit of rework on that next.

git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605@163 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-18 00:49:40 +00:00
parent ba218fbeeb
commit a2ae522b2d
7 changed files with 255 additions and 48 deletions

View File

@@ -180,15 +180,59 @@ class CustomersController extends AppController {
/* $customer = $this->data; */
/* } */
if (isset($id)) {
$customer = $this->Customer->details($id);
unset($customer['deposits']['Entries']);
$this->Customer->recursive = -1;
$customer = $this->Customer->read(null, $id);
$customer = $customer['Customer'];
$unreconciled = $this->Customer->findUnreconciledLedgerEntries($id);
$charges = $unreconciled['debit'];
}
else {
$customer = null;
$charges = array('balance' => 0, 'entry' => array());
}
$title = 'Payment Entry';
$this->set(compact('customer', 'title'));
$this->set(compact('customer', 'charges', 'title'));
}
/**************************************************************************
**************************************************************************
**************************************************************************
* action: unreconciledEntries
* - returns the list of unreconciled entries
*/
function unreconciled($id) {
//$this->layout = 'ajax';
$this->layout = null;
$this->autoLayout = false;
$this->autoRender = false;
Configure::write('debug', '0');
header("Content-type: text/xml;charset=utf-8");
App::import('Helper', 'Xml');
$xml = new XmlHelper();
// Find the unreconciled entries, then manipulate the structure
// slightly to accomodate the format necessary for XML Helper.
$unreconciled = $this->Customer->findUnreconciledLedgerEntries($id);
$unreconciled = array('entries' =>
array_intersect_key($unreconciled['debit'],
array('entry'=>1, 'balance'=>1)));
// XML Helper will dump an empty tag if the array is empty
if (!count($unreconciled['entries']['entry']))
unset($unreconciled['entries']['entry']);
pr($unreconciled);
//$reconciled = $cust->reconcileNewLedgerEntry($cust_id, 'credit', $amount);
$opts = array();
//$opts['format'] = 'tags';
echo $xml->header();
echo $xml->serialize($unreconciled, $opts);
}
}