Many, many changes, and yet still much to do. Many things are working, but certainly nothing beyond simply data retrieval (no editing or adding of any data). Also, some work is still required to ensure the grids have the right columns; we can strip out certain columns for some views (such as removing customer from the leases grid of the customer view... completely redundant). And of course, there are still many bugs and lots to clean up.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@368 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -508,7 +508,9 @@ class AppController extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function gridDataFields(&$params, &$model) {
|
function gridDataFields(&$params, &$model) {
|
||||||
return null;
|
$db = &$model->getDataSource();
|
||||||
|
$fields = $db->fields($model, $model->alias);
|
||||||
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
function gridDataGroup(&$params, &$model) {
|
function gridDataGroup(&$params, &$model) {
|
||||||
|
|||||||
@@ -75,8 +75,9 @@ class AccountsController extends AppController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function gridDataFields(&$params, &$model) {
|
function gridDataFields(&$params, &$model) {
|
||||||
return array_merge(array('Account.*'),
|
$fields = parent::gridDataFields($params, $model);
|
||||||
$this->Account->Ledger->LedgerEntry->debitCreditFields(true, 'LedgerEntry', 'CurrentLedger'));
|
return array_merge($fields,
|
||||||
|
$this->Account->Ledger->LedgerEntry->debitCreditFields(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
function gridDataConditions(&$params, &$model) {
|
function gridDataConditions(&$params, &$model) {
|
||||||
@@ -234,7 +235,7 @@ class AccountsController extends AppController {
|
|||||||
array('contain' =>
|
array('contain' =>
|
||||||
array(// Models
|
array(// Models
|
||||||
'CurrentLedger' =>
|
'CurrentLedger' =>
|
||||||
array('fields' => array('id', 'sequence')),
|
array('fields' => array('id', 'sequence', 'name')),
|
||||||
|
|
||||||
'Ledger' =>
|
'Ledger' =>
|
||||||
array('Close' => array
|
array('Close' => array
|
||||||
@@ -249,11 +250,6 @@ class AccountsController extends AppController {
|
|||||||
//pr(compact('entries'));
|
//pr(compact('entries'));
|
||||||
$account['CurrentLedger']['LedgerEntry'] = $entries;
|
$account['CurrentLedger']['LedgerEntry'] = $entries;
|
||||||
|
|
||||||
// Summarize each ledger
|
|
||||||
foreach($account['Ledger'] AS &$ledger)
|
|
||||||
$ledger = array_merge($ledger,
|
|
||||||
$this->Account->Ledger->stats($ledger['id']));
|
|
||||||
|
|
||||||
// Obtain stats across ALL ledgers for the summary infobox
|
// Obtain stats across ALL ledgers for the summary infobox
|
||||||
$stats = $this->Account->stats($id, true);
|
$stats = $this->Account->stats($id, true);
|
||||||
$stats = $stats['Ledger'];
|
$stats = $stats['Ledger'];
|
||||||
|
|||||||
@@ -45,10 +45,6 @@ class CustomersController extends AppController {
|
|||||||
* to jqGrid.
|
* to jqGrid.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function gridDataSetup(&$params) {
|
|
||||||
parent::gridDataSetup($params);
|
|
||||||
}
|
|
||||||
|
|
||||||
function gridDataCountTables(&$params, &$model) {
|
function gridDataCountTables(&$params, &$model) {
|
||||||
return array
|
return array
|
||||||
('link' =>
|
('link' =>
|
||||||
@@ -61,17 +57,16 @@ class CustomersController extends AppController {
|
|||||||
|
|
||||||
function gridDataTables(&$params, &$model) {
|
function gridDataTables(&$params, &$model) {
|
||||||
$link = $this->gridDataCountTables($params, $model);
|
$link = $this->gridDataCountTables($params, $model);
|
||||||
|
// StatementEntry is needed to determine customer balance
|
||||||
$link['link']['StatementEntry'] = array('fields' => array());
|
$link['link']['StatementEntry'] = array('fields' => array());
|
||||||
return $link;
|
return $link;
|
||||||
}
|
}
|
||||||
|
|
||||||
function gridDataFields(&$params, &$model) {
|
function gridDataFields(&$params, &$model) {
|
||||||
$db = &$model->getDataSource();
|
$fields = parent::gridDataFields($params, $model);
|
||||||
$fields = $db->fields($model, $model->alias);
|
|
||||||
$fields[] = ('COUNT(DISTINCT CurrentLease.id) AS lease_count');
|
$fields[] = ('COUNT(DISTINCT CurrentLease.id) AS lease_count');
|
||||||
$fields = array_merge($fields,
|
return array_merge($fields,
|
||||||
$this->Customer->StatementEntry->chargePaymentFields(true));
|
$this->Customer->StatementEntry->chargePaymentFields(true));
|
||||||
return $fields;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function gridDataConditions(&$params, &$model) {
|
function gridDataConditions(&$params, &$model) {
|
||||||
@@ -104,37 +99,28 @@ class CustomersController extends AppController {
|
|||||||
return $order;
|
return $order;
|
||||||
}
|
}
|
||||||
|
|
||||||
function gridDataCount(&$params, &$model, $query) {
|
function gridDataCount(&$params, &$model) {
|
||||||
|
|
||||||
|
if ($params['action'] != 'current')
|
||||||
|
return parent::gridDataCount($params, $model);
|
||||||
|
|
||||||
|
// OK, for current customers, we have an issue.
|
||||||
// We don't have a good way to use the query to obtain
|
// We don't have a good way to use the query to obtain
|
||||||
// our count. The problem is that we're relying on the
|
// our count. The problem is that we're relying on the
|
||||||
// group by for the query, which will destroy the count,
|
// group by for the query, but that simply won't work
|
||||||
// whether we omit the group by or leave it in.
|
// for the count. However, it's not difficult to simply
|
||||||
// So, build a fresh query for counting.
|
// derive it since 'current' customers are mutually
|
||||||
|
// exclusive to 'past' customers.
|
||||||
|
|
||||||
$query['conditions'] = parent::gridDataConditions($params, $model);
|
$tmp_params = $params;
|
||||||
|
$tmp_params['action'] = 'all';
|
||||||
|
$all_count = parent::gridDataCount($tmp_params, $model);
|
||||||
|
$tmp_params['action'] = 'past';
|
||||||
|
$past_count = parent::gridDataCount($tmp_params, $model);
|
||||||
|
|
||||||
$count = $model->find('count',
|
// The current customer count is simply calculated
|
||||||
array_merge(array('link' => array_diff_key($query['link'],
|
// as all customers that are not past customers.
|
||||||
array('CurrentLease'=>1))),
|
return $all_count - $past_count;
|
||||||
array_diff_key($query, array('link'=>1))));
|
|
||||||
|
|
||||||
if ($params['action'] == 'all')
|
|
||||||
return $count;
|
|
||||||
|
|
||||||
$query['conditions'][] = 'CurrentLease.id IS NULL';
|
|
||||||
$count_past = $model->find('count', $query);
|
|
||||||
|
|
||||||
// Since we can't easily count 'current' directly, we
|
|
||||||
// can quickly derive it since 'current' customers
|
|
||||||
// are mutually exclusive to 'past' customers.
|
|
||||||
if ($params['action'] == 'current')
|
|
||||||
$count = $count - $count_past;
|
|
||||||
elseif ($params['action'] == 'past') {
|
|
||||||
$count = $count_past;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function gridDataPostProcessLinks(&$params, &$model, &$records, $links) {
|
function gridDataPostProcessLinks(&$params, &$model, &$records, $links) {
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ class LeasesController extends AppController {
|
|||||||
|
|
||||||
function gridDataCountTables(&$params, &$model) {
|
function gridDataCountTables(&$params, &$model) {
|
||||||
return array
|
return array
|
||||||
('link' => array('Unit' => array('fields' => array('Unit.id', 'Unit.name')),
|
('link' => array('Unit' => array('fields' => array('id', 'name')),
|
||||||
'Customer' => array('fields' => array('Customer.id', 'Customer.name'))));
|
'Customer' => array('fields' => array('id', 'name'))));
|
||||||
}
|
}
|
||||||
|
|
||||||
function gridDataTables(&$params, &$model) {
|
function gridDataTables(&$params, &$model) {
|
||||||
@@ -62,11 +62,9 @@ class LeasesController extends AppController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function gridDataFields(&$params, &$model) {
|
function gridDataFields(&$params, &$model) {
|
||||||
$db = &$model->getDataSource();
|
$fields = parent::gridDataFields($params, $model);
|
||||||
$fields = $db->fields($model, $model->alias);
|
return array_merge($fields,
|
||||||
$fields = array_merge($fields,
|
|
||||||
$this->Lease->StatementEntry->chargePaymentFields(true));
|
$this->Lease->StatementEntry->chargePaymentFields(true));
|
||||||
return $fields;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function gridDataConditions(&$params, &$model) {
|
function gridDataConditions(&$params, &$model) {
|
||||||
@@ -79,8 +77,8 @@ class LeasesController extends AppController {
|
|||||||
$conditions[] = 'Lease.close_date IS NOT NULL';
|
$conditions[] = 'Lease.close_date IS NOT NULL';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($params['custom']['customer_id']))
|
if (isset($customer_id))
|
||||||
$conditions[] = array('Lease.customer_id' => $params['custom']['customer_id']);
|
$conditions[] = array('Lease.customer_id' => $customer_id);
|
||||||
|
|
||||||
return $conditions;
|
return $conditions;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,221 +25,35 @@ class LedgerEntriesController extends AppController {
|
|||||||
* to jqGrid.
|
* to jqGrid.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function gridDataSetup(&$params) {
|
|
||||||
parent::gridDataSetup($params);
|
|
||||||
if (isset($params['custom']['collected_account_id']))
|
|
||||||
$params['custom']['account_id'] = $params['custom']['collected_account_id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
function gridDataTables(&$params, &$model) {
|
function gridDataTables(&$params, &$model) {
|
||||||
$link =
|
$link =
|
||||||
array(// Models
|
array(// Models
|
||||||
'Account' =>
|
'Transaction' =>
|
||||||
array('fields' => array('id', 'name', 'type'),
|
array('fields' => array('id', 'stamp'),
|
||||||
),
|
),
|
||||||
|
|
||||||
'Ledger' =>
|
'Ledger' =>
|
||||||
array('fields' => array('id', 'sequence'),
|
array('fields' => array('id', 'sequence'),
|
||||||
),
|
'Account' =>
|
||||||
|
array('fields' => array('id', 'name', 'type'),
|
||||||
'DoubleEntry' => array
|
|
||||||
('Transaction' =>
|
|
||||||
array('fields' => array('id', 'stamp'),
|
|
||||||
),
|
|
||||||
|
|
||||||
'DebitLedger' =>
|
|
||||||
array('fields' => array('id'),
|
|
||||||
'Account' => array('alias' => 'DebitAccount',
|
|
||||||
'fields' => array('id', 'name'),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
'CreditLedger' =>
|
'Tender' =>
|
||||||
array('fields' => array('id'),
|
|
||||||
'Account' => array('alias' => 'CreditAccount',
|
|
||||||
'fields' => array('id', 'name'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
'Customer' =>
|
|
||||||
array('fields' => array('id', 'name'),
|
array('fields' => array('id', 'name'),
|
||||||
),
|
),
|
||||||
|
|
||||||
'Lease' =>
|
/* 'DebitEntry', */
|
||||||
array('fields' => array('id', 'number'),
|
/* 'CreditEntry', */
|
||||||
'Unit' =>
|
|
||||||
array('fields' => array('id', 'name'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (count(array_intersect($params['fields'], array('applied'))) == 1) {
|
|
||||||
$link['Payment'] = array('DoubleEntry' =>
|
|
||||||
array('alias' => 'PaymentDoubleEntry',
|
|
||||||
'Receipt'),
|
|
||||||
'Account' => array('alias' => 'PaymentAccount'),
|
|
||||||
);
|
|
||||||
$link['Charge'] = array('DoubleEntry' =>
|
|
||||||
array('alias' => 'ChargeDoubleEntry',
|
|
||||||
'Invoice'),
|
|
||||||
'Account' => array('alias' => 'ChargeAccount'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
elseif (isset($params['custom']['customer_id']) || isset($params['custom']['lease_id'])) {
|
|
||||||
$link['Charge'] = array('DoubleEntry' =>
|
|
||||||
array('alias' => 'ChargeDoubleEntry',
|
|
||||||
'Invoice'),
|
|
||||||
'Account' => array('alias' => 'ChargeAccount'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return array('link' => $link);
|
return array('link' => $link);
|
||||||
}
|
}
|
||||||
|
|
||||||
function gridDataFields(&$params, &$model) {
|
function gridDataFields(&$params, &$model) {
|
||||||
$fields = parent::gridDataFields($params, $model);
|
$fields = parent::gridDataFields($params, $model);
|
||||||
|
return array_merge($fields,
|
||||||
if (!isset($fields))
|
$this->LedgerEntry->debitCreditFields());
|
||||||
$fields = array('Entry.*');
|
|
||||||
|
|
||||||
/* if (isset($params['custom']['reconcile_id'])) { */
|
|
||||||
/* $fields[] = array("IF(Entry.type = 'CHARGE',", */
|
|
||||||
/* " COALESCE(AppliedCharge.amount,0),", */
|
|
||||||
/* " COALESCE(AppliedPayment.amount,0))", */
|
|
||||||
/* " AS 'applied'"); */
|
|
||||||
/* $fields[] = array("Entry.amount - (", */
|
|
||||||
/* "IF(Entry.type = 'CHARGE',", */
|
|
||||||
/* " COALESCE(AppliedCharge.amount,0),", */
|
|
||||||
/* " COALESCE(AppliedPayment.amount,0))", */
|
|
||||||
/* ") AS 'balance'"); */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
if (isset($params['custom']['customer_id']) || isset($params['custom']['lease_id'])) {
|
|
||||||
$fields[] = "IF(Entry.type = 'CHARGE', DoubleEntry.amount, NULL) AS debit";
|
|
||||||
$fields[] = "IF(Entry.type = 'PAYMENT', DoubleEntry.amount, NULL) AS credit";
|
|
||||||
$fields[] = "IF(Entry.type = 'CHARGE', 1, -1) * DoubleEntry.amount AS balance";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (count(array_intersect($params['fields'], array('applied'))) == 1)
|
|
||||||
$fields[] = ('SUM(COALESCE(AppliedPayment.amount,0)' .
|
|
||||||
' + COALESCE(AppliedCharge.amount,0)) AS applied');
|
|
||||||
|
|
||||||
if (count(array_intersect($params['fields'], array('debit', 'credit'))) >= 1) {
|
|
||||||
$fields = array_merge($fields,
|
|
||||||
$this->Entry->DoubleEntry->debitCreditFields());
|
|
||||||
/* $fields = array_merge($fields, */
|
|
||||||
/* $this->Entry->Account->debitCreditFields()); */
|
|
||||||
/* $fields[] = "IF(Entry.crdr = 'CREDIT', DoubleEntry.amount, NULL) AS credit"; */
|
|
||||||
/* $fields[] = "IF(Entry.crdr = 'DEBIT', DoubleEntry.amount, NULL) AS debit"; */
|
|
||||||
/* $fields[] = "IF(Account.type IN Entry.crdr = 'DEBIT', DoubleEntry.amount, NULL) AS debit"; */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($params['action'] === 'collected')
|
|
||||||
$fields[] = 'MAX(Receipt.stamp) AS last_paid';
|
|
||||||
|
|
||||||
return $fields;
|
|
||||||
}
|
|
||||||
|
|
||||||
function gridDataConditions(&$params, &$model) {
|
|
||||||
$conditions = parent::gridDataConditions($params, $model);
|
|
||||||
|
|
||||||
if ($params['action'] === 'collected') {
|
|
||||||
extract($params['custom']);
|
|
||||||
|
|
||||||
if (!isset($params['custom']['account_id']))
|
|
||||||
die("INTERNAL ERROR: ACCOUNT ID NOT SET");
|
|
||||||
|
|
||||||
if (!empty($collected_from_date))
|
|
||||||
$conditions[]
|
|
||||||
= array('Receipt.stamp >=' =>
|
|
||||||
$this->Entry->Transaction->dateFormatBeforeSave($collected_from_date));
|
|
||||||
|
|
||||||
if (!empty($collected_through_date))
|
|
||||||
$conditions[]
|
|
||||||
= array('Receipt.stamp <=' =>
|
|
||||||
$this->Entry->Transaction->dateFormatBeforeSave($collected_through_date . ' 23:59:59'));
|
|
||||||
|
|
||||||
if (isset($collected_payment_accounts))
|
|
||||||
$conditions[] = array('PaymentAccount.id' => $collected_payment_accounts);
|
|
||||||
else
|
|
||||||
$conditions[] = array('NOT' => array(array('PaymentAccount.id' => null)));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($params['custom']['ledger_id'])) {
|
|
||||||
$ledger_id = $params['custom']['ledger_id'];
|
|
||||||
$conditions[] = array('Ledger.id' => $ledger_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($params['custom']['reconcile_id'])) {
|
|
||||||
$conditions[] = array('OR' =>
|
|
||||||
array('AppliedCharge.id' => $reconcile_id),
|
|
||||||
array('AppliedPayment.id' => $reconcile_id));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($params['custom']['account_id'])) {
|
|
||||||
$account_id = $params['custom']['account_id'];
|
|
||||||
$conditions[] = array('Account.id' => $account_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($params['custom']['customer_id'])) {
|
|
||||||
$customer_id = $params['custom']['customer_id'];
|
|
||||||
$conditions[] =
|
|
||||||
array('OR' =>
|
|
||||||
array(array(array('Entry.type' => 'CHARGE'),
|
|
||||||
array('DoubleEntry.customer_id' => $customer_id)),
|
|
||||||
array(array('Entry.type' => 'PAYMENT'),
|
|
||||||
array('ChargeDoubleEntry.customer_id' => $customer_id)),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($params['custom']['lease_id'])) {
|
|
||||||
$lease_id = $params['custom']['lease_id'];
|
|
||||||
$conditions[] =
|
|
||||||
array('OR' =>
|
|
||||||
array(array(array('Entry.type' => 'CHARGE'),
|
|
||||||
array('DoubleEntry.lease_id' => $lease_id)),
|
|
||||||
array(array('Entry.type' => 'PAYMENT'),
|
|
||||||
array('ChargeDoubleEntry.lease_id' => $lease_id)),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
/* array('OR' => */
|
|
||||||
/* array('AND' => */
|
|
||||||
/* array(array('Entry.type' => 'CHARGE'), */
|
|
||||||
/* array('DoubleEntry.lease_id' => $lease_id)) */
|
|
||||||
/* ), */
|
|
||||||
/* array('AND' => */
|
|
||||||
/* array(array('Entry.type' => 'PAYMENT'), */
|
|
||||||
/* array('ChargeDoubleEntry.lease_id' => $lease_id)), */
|
|
||||||
/* ), */
|
|
||||||
/* ); */
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($params['custom']['transaction_id'])) {
|
|
||||||
$conditions[] =
|
|
||||||
array('Transaction.id' => $params['custom']['transaction_id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $conditions;
|
|
||||||
}
|
|
||||||
|
|
||||||
function gridDataPostProcessLinks(&$params, &$model, &$records, $links) {
|
|
||||||
$links['Transaction'] = array('id');
|
|
||||||
$links['Entry'] = array('id');
|
|
||||||
$links['Account'] = array('controller' => 'accounts', 'name');
|
|
||||||
$links['DebitAccount'] = array('controller' => 'accounts', 'name');
|
|
||||||
$links['CreditAccount'] = array('controller' => 'accounts', 'name');
|
|
||||||
$links['MonetarySource'] = array('name');
|
|
||||||
$links['Customer'] = array('name');
|
|
||||||
$links['Lease'] = array('number');
|
|
||||||
$links['Unit'] = array('name');
|
|
||||||
return parent::gridDataPostProcessLinks($params, $model, $records, $links);
|
|
||||||
}
|
|
||||||
|
|
||||||
function gridDataGroup(&$params, &$model) {
|
|
||||||
return parent::gridDataGroup($params, $model);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function gridDataOrder(&$params, &$model, $index, $direction) {
|
function gridDataOrder(&$params, &$model, $index, $direction) {
|
||||||
@@ -248,46 +62,19 @@ class LedgerEntriesController extends AppController {
|
|||||||
$order = parent::gridDataOrder($params, $model, $index, $direction);
|
$order = parent::gridDataOrder($params, $model, $index, $direction);
|
||||||
|
|
||||||
if ($index === 'Transaction.stamp') {
|
if ($index === 'Transaction.stamp') {
|
||||||
$order[] = 'Entry.id ' . $direction;
|
$order[] = 'LedgerEntry.id ' . $direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $order;
|
return $order;
|
||||||
}
|
}
|
||||||
|
|
||||||
function gridDataRecords(&$params, &$model, $query) {
|
function gridDataPostProcessLinks(&$params, &$model, &$records, $links) {
|
||||||
if ($params['action'] === 'collected') {
|
$links['LedgerEntry'] = array('id');
|
||||||
$tquery = array_diff_key($query, array(/*'fields'=>1,*/'group'=>1,'limit'=>1,'order'=>1));
|
$links['Transaction'] = array('id');
|
||||||
$tquery['group'] = array('AppliedPayment.id');
|
$links['Ledger'] = array('id');
|
||||||
$tquery['fields'] = array("IF(Entry.type = 'CHARGE',",
|
$links['Account'] = array('controller' => 'accounts', 'name');
|
||||||
" SUM(COALESCE(AppliedCharge.amount,0)),",
|
$links['Tender'] = array('name');
|
||||||
" SUM(COALESCE(AppliedPayment.amount,0)))",
|
return parent::gridDataPostProcessLinks($params, $model, $records, $links);
|
||||||
" AS 'applied'",
|
|
||||||
|
|
||||||
"Charge.amount - (",
|
|
||||||
"IF(Entry.type = 'CHARGE',",
|
|
||||||
" SUM(COALESCE(AppliedCharge.amount,0)),",
|
|
||||||
" SUM(COALESCE(AppliedPayment.amount,0)))",
|
|
||||||
") AS 'balance'",
|
|
||||||
);
|
|
||||||
|
|
||||||
$total = $model->find('first', $tquery);
|
|
||||||
$params['userdata']['total'] = $total[0]['applied'];
|
|
||||||
$params['userdata']['balance'] = $total[0]['balance'];
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::gridDataRecords($params, $model, $query);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
**************************************************************************
|
|
||||||
**************************************************************************
|
|
||||||
* action: reverse the ledger entry
|
|
||||||
*/
|
|
||||||
|
|
||||||
function reverse($id) {
|
|
||||||
$this->Entry->reverse($id);
|
|
||||||
$this->redirect(array('action'=>'view', $id));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -305,96 +92,49 @@ class LedgerEntriesController extends AppController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the Entry and related fields
|
// Get the Entry and related fields
|
||||||
$entry = $this->Entry->find
|
$entry = $this->LedgerEntry->find
|
||||||
('first',
|
('first',
|
||||||
array('contain' => array
|
array('contain' => array
|
||||||
('Account' => array('id', 'name', 'type', 'trackable'),
|
(
|
||||||
'DoubleEntry' => array
|
'Transaction' =>
|
||||||
(//'fields' => array('id'),
|
array('fields' => array('id', 'stamp'),
|
||||||
|
),
|
||||||
|
|
||||||
|
'Ledger' =>
|
||||||
|
array('fields' => array('id', 'sequence', 'name'),
|
||||||
|
'Account' =>
|
||||||
|
array('fields' => array('id', 'name', 'type', 'trackable'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
'Tender' =>
|
||||||
|
array('fields' => array('id', 'name'),
|
||||||
|
),
|
||||||
|
|
||||||
'DebitEntry' => array('fields' => array('id', 'crdr')),
|
'DebitEntry' => array('fields' => array('id', 'crdr')),
|
||||||
'CreditEntry' => array('fields' => array('id', 'crdr')),
|
'CreditEntry' => array('fields' => array('id', 'crdr')),
|
||||||
'Transaction' => array('fields' => array('id', 'stamp')),
|
|
||||||
'Customer' => array('fields' => array('id', 'name')),
|
|
||||||
'Lease' => array('fields' => array('id')),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
'conditions' => array('Entry.id' => $id),
|
'conditions' => array('LedgerEntry.id' => $id),
|
||||||
));
|
));
|
||||||
|
|
||||||
$entry['Entry']['opposite_crdr'] =
|
if (!empty($entry['DebitEntry']) && !empty($entry['CreditEntry']))
|
||||||
ucfirst($this->Entry->Account->fundamentalOpposite($entry['Entry']['crdr']));
|
die("LedgerEntry has both a matching DebitEntry and CreditEntry");
|
||||||
$entry['Entry']['matching_entry_id'] =
|
if (empty($entry['DebitEntry']) && empty($entry['CreditEntry']))
|
||||||
$entry['DoubleEntry'][
|
die("LedgerEntry has neither a matching DebitEntry nor a CreditEntry");
|
||||||
ucfirst(strtolower($entry['Entry']['opposite_crdr'])) .
|
if (empty($entry['DebitEntry']) && count($entry['CreditEntry']) != 1)
|
||||||
'Entry']['id'];
|
die("LedgerEntry has more than one CreditEntry");
|
||||||
/* if ($entry['DoubleEntry']['DebitEntry']['id'] == $entry['Entry']['id']) */
|
if (empty($entry['CreditEntry']) && count($entry['DebitEntry']) != 1)
|
||||||
/* $entry['Entry']['matching_entry_id'] = $entry['DoubleEntry']['CreditEntry']['id']; */
|
die("LedgerEntry has more than one DebitEntry");
|
||||||
/* if ($entry['DoubleEntry']['CreditEntry']['id'] == $entry['Entry']['id']) */
|
|
||||||
/* $entry['Entry']['matching_entry_id'] = $entry['DoubleEntry']['DebitEntry']['id']; */
|
|
||||||
//pr(compact('entry'));
|
|
||||||
|
|
||||||
$reconciled = $this->Entry->reconciledEntries($id);
|
if (empty($entry['DebitEntry']))
|
||||||
//pr(compact('reconciled'));
|
$entry['MatchingEntry'] = $entry['CreditEntry'][0];
|
||||||
|
else
|
||||||
|
$entry['MatchingEntry'] = $entry['DebitEntry'][0];
|
||||||
/* // REVISIT <AP>: 20090711 */
|
|
||||||
/* // It's not clear whether we should be able to reverse charges that have */
|
|
||||||
/* // already been paid/cleared/reconciled. Certainly, that will be the */
|
|
||||||
/* // case when someone has pre-paid and then moves out early. However, this */
|
|
||||||
/* // will work well for items accidentally charged but not yet paid for. */
|
|
||||||
/* if ((!$entry['DebitLedger']['Account']['trackable'] || */
|
|
||||||
/* $stats['debit']['amount_reconciled'] == 0) && */
|
|
||||||
/* (!$entry['CreditLedger']['Account']['trackable'] || */
|
|
||||||
/* $stats['credit']['amount_reconciled'] == 0) */
|
|
||||||
|
|
||||||
/* && 0 */
|
|
||||||
|
|
||||||
/* ) */
|
|
||||||
/* { */
|
|
||||||
/* // Set up dynamic menu items */
|
|
||||||
/* $this->sidemenu_links[] = */
|
|
||||||
/* array('name' => 'Operations', 'header' => true); */
|
|
||||||
|
|
||||||
/* $this->sidemenu_links[] = */
|
|
||||||
/* array('name' => 'Undo', */
|
|
||||||
/* 'url' => array('action' => 'reverse', */
|
|
||||||
/* $id)); */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
/* if ($this->Entry->Ledger->Account->type */
|
|
||||||
/* ($entry['CreditLedger']['Account']['id']) == 'INCOME') */
|
|
||||||
/* { */
|
|
||||||
/* // Set up dynamic menu items */
|
|
||||||
/* $this->sidemenu_links[] = */
|
|
||||||
/* array('name' => 'Operations', 'header' => true); */
|
|
||||||
|
|
||||||
/* $this->sidemenu_links[] = */
|
|
||||||
/* array('name' => 'Reverse', */
|
|
||||||
/* 'url' => array('action' => 'reverse', */
|
|
||||||
/* $id)); */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
// Prepare to render.
|
// Prepare to render.
|
||||||
$title = "Ledger Entry #{$entry['Entry']['id']}";
|
$title = "Ledger Entry #{$entry['LedgerEntry']['id']}";
|
||||||
$this->set(compact('entry', 'title', 'reconciled'));
|
$this->set(compact('entry', 'title'));
|
||||||
}
|
|
||||||
|
|
||||||
function tst($id = null) {
|
|
||||||
$entry = $this->Entry->find
|
|
||||||
('first',
|
|
||||||
array('contain' => array('Account',
|
|
||||||
|
|
||||||
'DoubleEntry',
|
|
||||||
|
|
||||||
'Payment' => array('fields' => array('Payment.*'/*, 'AppliedPayment.*'*/),
|
|
||||||
'DoubleEntry'/* => array('alias' => 'PaymentDoubleEntry')*/),
|
|
||||||
'Charge' => array('fields' => array('Charge.*'/*, 'AppliedCharge.*'*/),
|
|
||||||
'DoubleEntry'/* => array('alias' => 'ChargeDoubleEntry')*/),
|
|
||||||
),
|
|
||||||
'conditions' => array('Entry.id' => $id),
|
|
||||||
));
|
|
||||||
pr($entry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,8 +65,9 @@ class LedgersController extends AppController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function gridDataFields(&$params, &$model) {
|
function gridDataFields(&$params, &$model) {
|
||||||
return array_merge(array('Ledger.*',
|
$fields = parent::gridDataFields($params, $model);
|
||||||
'CONCAT(Account.id, "-", Ledger.sequence) AS id_sequence'),
|
$fields[] = 'CONCAT(Account.id, "-", Ledger.sequence) AS id_sequence';
|
||||||
|
return array_merge($fields,
|
||||||
$this->Ledger->LedgerEntry->debitCreditFields(true));
|
$this->Ledger->LedgerEntry->debitCreditFields(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class StatementEntriesController extends AppController {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isset($params['custom']['statement_entry_id'])) {
|
if (isset($params['post']['custom']['statement_entry_id'])) {
|
||||||
$link['PaymentEntry'] = array();
|
$link['PaymentEntry'] = array();
|
||||||
$link['ChargeEntry'] = array();
|
$link['ChargeEntry'] = array();
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ class StatementEntriesController extends AppController {
|
|||||||
/* $link['PaymentEntry'] = array(); */
|
/* $link['PaymentEntry'] = array(); */
|
||||||
/* $link['ChargeEntry'] = array(); */
|
/* $link['ChargeEntry'] = array(); */
|
||||||
/* } */
|
/* } */
|
||||||
/* elseif (isset($params['custom']['customer_id']) || isset($params['custom']['lease_id'])) { */
|
/* elseif (isset($params['post']['custom']['customer_id']) || isset($params['post']['custom']['lease_id'])) { */
|
||||||
/* $link['PaymentEntry'] = array(); */
|
/* $link['PaymentEntry'] = array(); */
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
@@ -69,11 +69,9 @@ class StatementEntriesController extends AppController {
|
|||||||
|
|
||||||
function gridDataFields(&$params, &$model) {
|
function gridDataFields(&$params, &$model) {
|
||||||
$fields = parent::gridDataFields($params, $model);
|
$fields = parent::gridDataFields($params, $model);
|
||||||
|
extract($params['post']['custom']);
|
||||||
|
|
||||||
if (!isset($fields))
|
/* if (isset($params['post']['custom']['reconcile_id'])) { */
|
||||||
$fields = array('StatementEntry.*');
|
|
||||||
|
|
||||||
/* if (isset($params['custom']['reconcile_id'])) { */
|
|
||||||
/* $fields[] = array("IF(StatementEntry.type = 'CHARGE',", */
|
/* $fields[] = array("IF(StatementEntry.type = 'CHARGE',", */
|
||||||
/* " COALESCE(AppliedCharge.amount,0),", */
|
/* " COALESCE(AppliedCharge.amount,0),", */
|
||||||
/* " COALESCE(AppliedPayment.amount,0))", */
|
/* " COALESCE(AppliedPayment.amount,0))", */
|
||||||
@@ -85,11 +83,8 @@ class StatementEntriesController extends AppController {
|
|||||||
/* ") AS 'balance'"); */
|
/* ") AS 'balance'"); */
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
if (isset($params['custom']['customer_id']) || isset($params['custom']['lease_id'])
|
|
||||||
|| isset($params['custom']['statement_entry_id'])) {
|
|
||||||
$fields = array_merge($fields,
|
$fields = array_merge($fields,
|
||||||
$this->StatementEntry->chargePaymentFields());
|
$this->StatementEntry->chargePaymentFields());
|
||||||
}
|
|
||||||
|
|
||||||
if ($params['action'] === 'collected')
|
if ($params['action'] === 'collected')
|
||||||
$fields[] = 'MAX(Receipt.stamp) AS last_paid';
|
$fields[] = 'MAX(Receipt.stamp) AS last_paid';
|
||||||
@@ -99,19 +94,7 @@ class StatementEntriesController extends AppController {
|
|||||||
|
|
||||||
function gridDataConditions(&$params, &$model) {
|
function gridDataConditions(&$params, &$model) {
|
||||||
$conditions = parent::gridDataConditions($params, $model);
|
$conditions = parent::gridDataConditions($params, $model);
|
||||||
extract($params['custom']);
|
extract($params['post']['custom']);
|
||||||
|
|
||||||
if (isset($transaction_id))
|
|
||||||
$conditions[] = array('Transaction.id' => $transaction_id);
|
|
||||||
|
|
||||||
if (isset($account_id))
|
|
||||||
$conditions[] = array('Account.id' => $account_id);
|
|
||||||
|
|
||||||
if (isset($customer_id))
|
|
||||||
$conditions[] = array('Customer.id' => $customer_id);
|
|
||||||
|
|
||||||
if (isset($lease_id))
|
|
||||||
$conditions[] = array('Lease.id' => $lease_id);
|
|
||||||
|
|
||||||
if (!empty($from_date))
|
if (!empty($from_date))
|
||||||
$conditions[]
|
$conditions[]
|
||||||
@@ -148,10 +131,6 @@ class StatementEntriesController extends AppController {
|
|||||||
return parent::gridDataPostProcessLinks($params, $model, $records, $links);
|
return parent::gridDataPostProcessLinks($params, $model, $records, $links);
|
||||||
}
|
}
|
||||||
|
|
||||||
function gridDataGroup(&$params, &$model) {
|
|
||||||
return parent::gridDataGroup($params, $model);
|
|
||||||
}
|
|
||||||
|
|
||||||
function gridDataOrder(&$params, &$model, $index, $direction) {
|
function gridDataOrder(&$params, &$model, $index, $direction) {
|
||||||
$order = parent::gridDataOrder($params, $model, $index, $direction);
|
$order = parent::gridDataOrder($params, $model, $index, $direction);
|
||||||
|
|
||||||
@@ -265,28 +244,11 @@ class StatementEntriesController extends AppController {
|
|||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
$stats = $this->StatementEntry->stats($id);
|
$stats = $this->StatementEntry->stats($id);
|
||||||
pr($stats);
|
//pr($stats);
|
||||||
|
|
||||||
// Prepare to render.
|
// Prepare to render.
|
||||||
$title = "Statement Entry #{$entry['StatementEntry']['id']}";
|
$title = "Statement Entry #{$entry['StatementEntry']['id']}";
|
||||||
$this->set(compact('entry', 'title', 'reconciled', 'stats'));
|
$this->set(compact('entry', 'title', 'reconciled', 'stats'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function tst($id = null) {
|
|
||||||
$entry = $this->StatementEntry->find
|
|
||||||
('first',
|
|
||||||
array('contain' => array('Account',
|
|
||||||
|
|
||||||
'DoubleStatementEntry',
|
|
||||||
|
|
||||||
'Payment' => array('fields' => array('Payment.*'/*, 'AppliedPayment.*'*/),
|
|
||||||
'DoubleStatementEntry'/* => array('alias' => 'PaymentDoubleStatementEntry')*/),
|
|
||||||
'Charge' => array('fields' => array('Charge.*'/*, 'AppliedCharge.*'*/),
|
|
||||||
'DoubleStatementEntry'/* => array('alias' => 'ChargeDoubleStatementEntry')*/),
|
|
||||||
),
|
|
||||||
'conditions' => array('StatementEntry.id' => $id),
|
|
||||||
));
|
|
||||||
pr($entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class MonetarySourcesController extends AppController {
|
class TendersController extends AppController {
|
||||||
|
|
||||||
var $sidemenu_links = array();
|
var $sidemenu_links = array();
|
||||||
|
|
||||||
@@ -20,11 +20,11 @@ class MonetarySourcesController extends AppController {
|
|||||||
**************************************************************************
|
**************************************************************************
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
* action: index / all
|
* action: index / all
|
||||||
* - Generate a listing of MonetarySources
|
* - Generate a listing of Tenders
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function index() { $this->all(); }
|
function index() { $this->all(); }
|
||||||
function all() { $this->gridView('All MonetarySources', 'all'); }
|
function all() { $this->gridView('All Legal Tender', 'all'); }
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
@@ -43,7 +43,7 @@ class MonetarySourcesController extends AppController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function gridDataPostProcessLinks(&$params, &$model, &$records, $links) {
|
function gridDataPostProcessLinks(&$params, &$model, &$records, $links) {
|
||||||
$links['MonetarySource'] = array('id');
|
$links['Tender'] = array('id');
|
||||||
return parent::gridDataPostProcessLinks($params, $model, $records, $links);
|
return parent::gridDataPostProcessLinks($params, $model, $records, $links);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ class MonetarySourcesController extends AppController {
|
|||||||
**************************************************************************
|
**************************************************************************
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
* action: nsf
|
* action: nsf
|
||||||
* - Marks a monetary source as having insufficient funds.
|
* - Marks a tender as having insufficient funds.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function nsf($id = null) {
|
function nsf($id = null) {
|
||||||
@@ -65,7 +65,7 @@ class MonetarySourcesController extends AppController {
|
|||||||
// For testing purposes, must be deleted
|
// For testing purposes, must be deleted
|
||||||
$stamp = '2009-07-09';
|
$stamp = '2009-07-09';
|
||||||
|
|
||||||
$this->MonetarySource->nsf($id, $stamp);
|
$this->Tender->nsf($id, $stamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
@@ -81,8 +81,8 @@ class MonetarySourcesController extends AppController {
|
|||||||
$this->redirect(array('controller' => 'accounts', 'action'=>'index'));
|
$this->redirect(array('controller' => 'accounts', 'action'=>'index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the MonetarySource and related fields
|
// Get the Tender and related fields
|
||||||
$monetary_source = $this->MonetarySource->find
|
$tender = $this->Tender->find
|
||||||
('first', array
|
('first', array
|
||||||
('contain' => false,
|
('contain' => false,
|
||||||
));
|
));
|
||||||
@@ -104,7 +104,7 @@ class MonetarySourcesController extends AppController {
|
|||||||
$id));
|
$id));
|
||||||
|
|
||||||
// Prepare to render.
|
// Prepare to render.
|
||||||
$title = "Monetary Source #{$monetary_source['MonetarySource']['id']}";
|
$title = "Tender #{$tender['Tender']['id']}";
|
||||||
$this->set(compact('monetary_source', 'title'));
|
$this->set(compact('tender', 'title'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -64,23 +64,22 @@ class TransactionsController extends AppController {
|
|||||||
('first',
|
('first',
|
||||||
array('contain' =>
|
array('contain' =>
|
||||||
array(// Models
|
array(// Models
|
||||||
'LedgerEntry' =>
|
'Account' =>
|
||||||
array('fields' => array('LedgerEntry.id',
|
array('fields' => array('Account.id',
|
||||||
'LedgerEntry.amount',
|
'Account.name'),
|
||||||
'LedgerEntry.comment'),
|
),
|
||||||
|
|
||||||
|
'Ledger' =>
|
||||||
|
array('fields' => array('Ledger.id',
|
||||||
|
'Ledger.name'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'conditions' => array('Transaction.id' => $id),
|
'conditions' => array('Transaction.id' => $id),
|
||||||
));
|
));
|
||||||
|
|
||||||
/* // Figure out the transaction total */
|
|
||||||
/* $total = 0; */
|
|
||||||
/* foreach($transaction['LedgerEntry'] AS $entry) */
|
|
||||||
/* $total += $entry['amount']; */
|
|
||||||
|
|
||||||
// OK, prepare to render.
|
// OK, prepare to render.
|
||||||
$title = 'Transaction #' . $transaction['Transaction']['id'];
|
$title = 'Transaction #' . $transaction['Transaction']['id'];
|
||||||
$this->set(compact('transaction', 'title', 'total'));
|
$this->set(compact('transaction', 'title'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -52,51 +52,37 @@ class UnitsController extends AppController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function gridDataCountTables(&$params, &$model) {
|
function gridDataCountTables(&$params, &$model) {
|
||||||
$link = array
|
return array
|
||||||
('link' =>
|
('link' => array('UnitSize' => array('fields' => array('id', 'name')),
|
||||||
array(// Models
|
'CurrentLease' => array('fields' => array('id'))));
|
||||||
'UnitSize' => array('fields' => array('id', 'name')),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($params['action'] === 'occupied')
|
/* if ($params['action'] === 'occupied') */
|
||||||
$link['Lease'] = array('fields' => array(),
|
/* $link['Lease'] = array('fields' => array(), */
|
||||||
// Models
|
/* // Models */
|
||||||
'Contact' => array('fields' => array('display_name'),
|
/* 'Contact' => array('fields' => array('display_name'), */
|
||||||
//'type' => 'LEFT',
|
/* //'type' => 'LEFT', */
|
||||||
),
|
/* ), */
|
||||||
);
|
/* ); */
|
||||||
|
|
||||||
return $link;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function gridDataTables(&$params, &$model) {
|
function gridDataTables(&$params, &$model) {
|
||||||
$link = $this->gridDataCountTables($params, $model);
|
$link = $this->gridDataCountTables($params, $model);
|
||||||
$link['link']['CurrentLease']['LedgerEntry'] = array('fields' => array());
|
$link['link']['CurrentLease']['StatementEntry'] = array('fields' => array());
|
||||||
$link['link']['CurrentLease']['LedgerEntry']['Ledger'] = array('fields' => array());
|
|
||||||
$link['link']['CurrentLease']['LedgerEntry']['Ledger']['Account'] = array('fields' => array());
|
|
||||||
// INNER JOIN would be great, as it would ensure we're only looking
|
|
||||||
// at the ledger entries that we truly want. However, this also
|
|
||||||
// removes from the query any leases that do not yet have a ledger
|
|
||||||
// entry in A/R. A solution would be to INNER JOIN these tables,
|
|
||||||
// and LEFT JOIN it to the rest. Grouping of JOINs, however, is
|
|
||||||
// implemented with the 'joins' tag, and is not available through
|
|
||||||
// the Linkable behavior interface.
|
|
||||||
//$link['link']['CurrentLease']['LedgerEntry']['Ledger']['Account']['type'] = 'INNER';
|
|
||||||
$link['link']['CurrentLease']['LedgerEntry']['Ledger']['Account']['conditions']
|
|
||||||
= array('Account.id' =>
|
|
||||||
$this->Unit->CurrentLease->LedgerEntry->Ledger->Account->accountReceivableAccountID());
|
|
||||||
return $link;
|
return $link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* function gridDataTables(&$params, &$model) { */
|
||||||
|
/* return array */
|
||||||
|
/* ('link' => array('Unit' => array('fields' => array('Unit.id', 'Unit.name')), */
|
||||||
|
/* 'Customer' => array('fields' => array('Customer.id', 'Customer.name')))); */
|
||||||
|
/* } */
|
||||||
|
|
||||||
function gridDataFields(&$params, &$model) {
|
function gridDataFields(&$params, &$model) {
|
||||||
$db = &$model->getDataSource();
|
$fields = parent::gridDataFields($params, $model);
|
||||||
$fields = $db->fields($model, $model->alias);
|
|
||||||
$fields[] = ("SUM(IF(Account.id IS NULL, 0," .
|
return array_merge($fields,
|
||||||
" IF(LedgerEntry.debit_ledger_id = Account.id," .
|
$this->Unit->Lease->StatementEntry->chargePaymentFields(true));
|
||||||
" 1, -1))" .
|
|
||||||
" * LedgerEntry.amount) AS 'balance'");
|
|
||||||
return $fields;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function gridDataConditions(&$params, &$model) {
|
function gridDataConditions(&$params, &$model) {
|
||||||
@@ -242,8 +228,8 @@ class UnitsController extends AppController {
|
|||||||
$stats['CurrentLease']['balance'];
|
$stats['CurrentLease']['balance'];
|
||||||
|
|
||||||
// Figure out the total security deposit for the current lease.
|
// Figure out the total security deposit for the current lease.
|
||||||
$deposits = $this->Unit->Lease->findSecurityDeposits($unit['CurrentLease']['id']);
|
$deposits = $this->Unit->Lease->securityDeposits($unit['CurrentLease']['id']);
|
||||||
$outstanding_deposit = $deposits['summary']['balance'];
|
$outstanding_deposit = $deposits['summary']['Payment']['reconciled'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up dynamic menu items
|
// Set up dynamic menu items
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ class Account extends AppModel {
|
|||||||
* on the overall balance of the account.
|
* on the overall balance of the account.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function debitCreditFields($sum = false, $entry_name = 'Entry', $account_name = 'Account') {
|
function debitCreditFields($sum = false, $entry_name = 'LedgerEntry', $account_name = 'Account') {
|
||||||
return $this->LedgerEntry->debitCreditFields
|
return $this->LedgerEntry->debitCreditFields
|
||||||
($sum, $entry_name, $account_name);
|
($sum, $entry_name, $account_name);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,6 @@ class Contact extends AppModel {
|
|||||||
|
|
||||||
var $displayField = 'display_name';
|
var $displayField = 'display_name';
|
||||||
|
|
||||||
var $validate = array(
|
|
||||||
'id' => array('numeric'),
|
|
||||||
'display_name' => array('notempty'),
|
|
||||||
'id_federal' => array('ssn'),
|
|
||||||
'id_exp' => array('date')
|
|
||||||
);
|
|
||||||
|
|
||||||
var $hasMany = array(
|
var $hasMany = array(
|
||||||
'ContactsMethod',
|
'ContactsMethod',
|
||||||
'ContactsCustomer',
|
'ContactsCustomer',
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ class Lease extends AppModel {
|
|||||||
return false;
|
return false;
|
||||||
if (count($entries) != 1)
|
if (count($entries) != 1)
|
||||||
return null;
|
return null;
|
||||||
|
pr($entries);
|
||||||
return $entries[0]['StatementEntry']['through_date'];
|
return $entries[0]['StatementEntry']['through_date'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -425,7 +426,7 @@ class Lease extends AppModel {
|
|||||||
$query['group'] = null;
|
$query['group'] = null;
|
||||||
|
|
||||||
$stats = $this->StatementEntry->find('first', $query);
|
$stats = $this->StatementEntry->find('first', $query);
|
||||||
pr(compact('query', 'stats'));
|
//pr(compact('query', 'stats'));
|
||||||
|
|
||||||
// The fields are all tucked into the [0] index,
|
// The fields are all tucked into the [0] index,
|
||||||
// and the rest of the array is useless (empty).
|
// and the rest of the array is useless (empty).
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ class Ledger extends AppModel {
|
|||||||
* entries are a debit, or a credit, and also the effect each have
|
* entries are a debit, or a credit, and also the effect each have
|
||||||
* on the overall balance of the ledger.
|
* on the overall balance of the ledger.
|
||||||
*/
|
*/
|
||||||
function debitCreditFields($sum = false, $entry_name = 'Entry', $account_name = 'Account') {
|
function debitCreditFields($sum = false, $entry_name = 'LedgerEntry', $account_name = 'Account') {
|
||||||
return $this->LedgerEntry->debitCreditFields
|
return $this->LedgerEntry->debitCreditFields
|
||||||
($sum, $entry_name, $account_name);
|
($sum, $entry_name, $account_name);
|
||||||
}
|
}
|
||||||
@@ -128,7 +128,7 @@ class Ledger extends AppModel {
|
|||||||
|
|
||||||
$entries = $this->LedgerEntry->find
|
$entries = $this->LedgerEntry->find
|
||||||
('all', array
|
('all', array
|
||||||
('contain' => array('Ledger' => array('Account')),
|
('link' => array('Ledger' => array('Account')),
|
||||||
'fields' => array_merge(array("LedgerEntry.*"),
|
'fields' => array_merge(array("LedgerEntry.*"),
|
||||||
$this->LedgerEntry->debitCreditFields()),
|
$this->LedgerEntry->debitCreditFields()),
|
||||||
'conditions' => array('LedgerEntry.ledger_id' => $ids),
|
'conditions' => array('LedgerEntry.ledger_id' => $ids),
|
||||||
@@ -151,14 +151,14 @@ class Ledger extends AppModel {
|
|||||||
|
|
||||||
$this->queryInit($query);
|
$this->queryInit($query);
|
||||||
|
|
||||||
if (!isset($query['link']['Ledger']))
|
/* if (!isset($query['link']['Ledger'])) */
|
||||||
$query['link']['Ledger'] = array();
|
/* $query['link']['Ledger'] = array(); */
|
||||||
if (!isset($query['link']['Ledger']['fields']))
|
/* if (!isset($query['link']['Ledger']['fields'])) */
|
||||||
$query['link']['Ledger']['fields'] = array();
|
/* $query['link']['Ledger']['fields'] = array(); */
|
||||||
if (!isset($query['link']['Ledger']['Account']))
|
if (!isset($query['link']['Account']))
|
||||||
$query['link']['Ledger']['Account'] = array();
|
$query['link']['Account'] = array();
|
||||||
if (!isset($query['link']['Ledger']['Account']['fields']))
|
if (!isset($query['link']['Account']['fields']))
|
||||||
$query['link']['Ledger']['Account']['fields'] = array();
|
$query['link']['Account']['fields'] = array();
|
||||||
/* if (!isset($query['link']['Transaction'])) */
|
/* if (!isset($query['link']['Transaction'])) */
|
||||||
/* $query['link']['Transaction'] = array(); */
|
/* $query['link']['Transaction'] = array(); */
|
||||||
/* if (!isset($query['link']['Transaction']['fields'])) */
|
/* if (!isset($query['link']['Transaction']['fields'])) */
|
||||||
@@ -175,7 +175,7 @@ class Ledger extends AppModel {
|
|||||||
$query['group'][] = 'LedgerEntry.ledger_id';
|
$query['group'][] = 'LedgerEntry.ledger_id';
|
||||||
|
|
||||||
$stats = $this->LedgerEntry->find('first', $query);
|
$stats = $this->LedgerEntry->find('first', $query);
|
||||||
pr(compact('stats'));
|
//pr(compact('stats'));
|
||||||
|
|
||||||
|
|
||||||
/* unset($query['group']); */
|
/* unset($query['group']); */
|
||||||
@@ -187,6 +187,11 @@ class Ledger extends AppModel {
|
|||||||
// and the rest of the array is useless (empty).
|
// and the rest of the array is useless (empty).
|
||||||
$stats = $stats[0];
|
$stats = $stats[0];
|
||||||
|
|
||||||
|
// Make sure we have a member for debit/credit
|
||||||
|
foreach(array('debits', 'credits') AS $crdr)
|
||||||
|
if (!isset($stats[$crdr]))
|
||||||
|
$stats[$crdr] = null;
|
||||||
|
|
||||||
// Make sure we have a non-null balance
|
// Make sure we have a non-null balance
|
||||||
if (!isset($stats['balance']))
|
if (!isset($stats['balance']))
|
||||||
$stats['balance'] = 0;
|
$stats['balance'] = 0;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class LedgerEntry extends AppModel {
|
|||||||
);
|
);
|
||||||
|
|
||||||
var $hasOne = array(
|
var $hasOne = array(
|
||||||
'Payment',
|
'Tender',
|
||||||
);
|
);
|
||||||
|
|
||||||
var $hasMany = array(
|
var $hasMany = array(
|
||||||
@@ -44,23 +44,23 @@ class LedgerEntry extends AppModel {
|
|||||||
* on the overall balance of the account/ledger.
|
* on the overall balance of the account/ledger.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function debitCreditFields($sum = false, $entry_name = 'Entry', $account_name = 'Account') {
|
function debitCreditFields($sum = false, $entry_name = 'LedgerEntry', $account_name = 'Account') {
|
||||||
$fields = array
|
$fields = array
|
||||||
(
|
(
|
||||||
($sum ? 'SUM(' : '') .
|
($sum ? 'SUM(' : '') .
|
||||||
"IF({$entry_name}.type = 'DEBIT'," .
|
"IF({$entry_name}.crdr = 'DEBIT'," .
|
||||||
" {$entry_name}.amount, NULL)" .
|
" {$entry_name}.amount, NULL)" .
|
||||||
($sum ? ')' : '') . ' AS debit' . ($sum ? 's' : ''),
|
($sum ? ')' : '') . ' AS debit' . ($sum ? 's' : ''),
|
||||||
|
|
||||||
($sum ? 'SUM(' : '') .
|
($sum ? 'SUM(' : '') .
|
||||||
"IF({$entry_name}.type = 'CREDIT'," .
|
"IF({$entry_name}.crdr = 'CREDIT'," .
|
||||||
" {$entry_name}.amount, NULL)" .
|
" {$entry_name}.amount, NULL)" .
|
||||||
($sum ? ')' : '') . ' AS credit' . ($sum ? 's' : ''),
|
($sum ? ')' : '') . ' AS credit' . ($sum ? 's' : ''),
|
||||||
|
|
||||||
($sum ? 'SUM(' : '') .
|
($sum ? 'SUM(' : '') .
|
||||||
"IF(${account_name}.type IN ('ASSET', 'EXPENSE')," .
|
"IF(${account_name}.type IN ('ASSET', 'EXPENSE')," .
|
||||||
" IF({$entry_name}.type = 'DEBIT', 1, -1)," .
|
" IF({$entry_name}.crdr = 'DEBIT', 1, -1)," .
|
||||||
" IF({$entry_name}.type = 'CREDIT', 1, -1))" .
|
" IF({$entry_name}.crdr = 'CREDIT', 1, -1))" .
|
||||||
" * IF({$entry_name}.amount, {$entry_name}.amount, 0)" .
|
" * IF({$entry_name}.amount, {$entry_name}.amount, 0)" .
|
||||||
($sum ? ')' : '') . ' AS balance',
|
($sum ? ')' : '') . ' AS balance',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ OPTION 2
|
|||||||
|
|
||||||
$resultset = array();
|
$resultset = array();
|
||||||
foreach ($result AS $i => $entry) {
|
foreach ($result AS $i => $entry) {
|
||||||
pr(compact('entry'));
|
//pr(compact('entry'));
|
||||||
$entry['StatementEntry'] += $entry[0];
|
$entry['StatementEntry'] += $entry[0];
|
||||||
unset($entry[0]);
|
unset($entry[0]);
|
||||||
|
|
||||||
@@ -369,16 +369,12 @@ OPTION 2
|
|||||||
//'type' => 'INNER',
|
//'type' => 'INNER',
|
||||||
);
|
);
|
||||||
|
|
||||||
$query['fields'] = array();
|
$query['fields'] = array('StatementEntry.amount');
|
||||||
$query['fields'][] = "StatementEntry.amount AS total";
|
|
||||||
//$query['conditions'][] = array("{$Set}Entry.id !=" => null);
|
|
||||||
|
|
||||||
$query['conditions'][] = array('StatementEntry.id' => $id);
|
$query['conditions'][] = array('StatementEntry.id' => $id);
|
||||||
|
|
||||||
$query['group'] = 'StatementEntry.id';
|
$query['group'] = 'StatementEntry.id';
|
||||||
|
|
||||||
$result = $this->find('first', $query);
|
$result = $this->find('first', $query);
|
||||||
$result[0]['balance'] = $result[0]['total'] - $result[0]['reconciled'];
|
$result[0]['balance'] = $result['StatementEntry']['amount'] - $result[0]['reconciled'];
|
||||||
//pr(compact('query', 'result'));
|
//pr(compact('query', 'result'));
|
||||||
|
|
||||||
return $result['StatementEntry'] + $result[0];
|
return $result['StatementEntry'] + $result[0];
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
class Payment extends AppModel {
|
class Tender extends AppModel {
|
||||||
|
|
||||||
var $belongsTo = array(
|
var $belongsTo = array(
|
||||||
'LedgerEntry',
|
'LedgerEntry',
|
||||||
@@ -15,39 +15,39 @@ class Payment extends AppModel {
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
* function: addPayment
|
* function: addTender
|
||||||
* - Adds a new payment
|
* - Adds a new tender
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function addPayment($data, $customer_id, $lease_id = null, $reconcile = null) {
|
function addTender($data, $customer_id, $lease_id = null, $reconcile = null) {
|
||||||
// Create some models for convenience
|
// Create some models for convenience
|
||||||
$A = new Account();
|
$A = new Account();
|
||||||
|
|
||||||
// Assume this will succeed
|
// Assume this will succeed
|
||||||
$ret = true;
|
$ret = true;
|
||||||
|
|
||||||
// Establish the key payment parameters
|
// Establish the key tender parameters
|
||||||
$payment = array_intersect_key($data, array('stamp'=>1, 'type'=>1, 'name'=>1, 'amount'=>1,
|
$tender = array_intersect_key($data, array('stamp'=>1, 'type'=>1, 'name'=>1, 'amount'=>1,
|
||||||
'data1'=>1, 'data2'=>1, 'data3'=>1, 'data4'=>1));
|
'data1'=>1, 'data2'=>1, 'data3'=>1, 'data4'=>1));
|
||||||
$payment['customer_id'] = $customer_id;
|
$tender['customer_id'] = $customer_id;
|
||||||
|
|
||||||
// Create the payment entry, and reconcile the credit side
|
// Create the tender entry, and reconcile the credit side
|
||||||
// of the double-entry (which should be A/R) as a payment.
|
// of the double-entry (which should be A/R) as a tender.
|
||||||
$ids = $this->LedgerEntry->Ledger->Account->postLedgerEntry
|
$ids = $this->LedgerEntry->Ledger->Account->postLedgerEntry
|
||||||
($payment,
|
($tender,
|
||||||
array('debit_ledger_id' => $A->currentLedgerID($entry['account_id']),
|
array('debit_ledger_id' => $A->currentLedgerID($entry['account_id']),
|
||||||
'credit_ledger_id' => $A->currentLedgerID($A->paymentAccountID())
|
'credit_ledger_id' => $A->currentLedgerID($A->tenderAccountID())
|
||||||
) + $entry,
|
) + $entry,
|
||||||
array('debit' => 'payment',
|
array('debit' => 'tender',
|
||||||
'credit' => $reconcile)
|
'credit' => $reconcile)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($ids['error'])
|
if ($ids['error'])
|
||||||
$ret = false;
|
$ret = false;
|
||||||
|
|
||||||
$payment = array_intersect_key($ids,
|
$tender = array_intersect_key($ids,
|
||||||
array('payment_id'=>1,
|
array('tender_id'=>1,
|
||||||
'split_payment_id'=>1));
|
'split_tender_id'=>1));
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ class Payment extends AppModel {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function nsf($id, $stamp = null) {
|
function nsf($id, $stamp = null) {
|
||||||
pr(array('Payment::nsf',
|
pr(array('Tender::nsf',
|
||||||
compact('id')));
|
compact('id')));
|
||||||
|
|
||||||
$A = new Account();
|
$A = new Account();
|
||||||
@@ -96,7 +96,7 @@ class Payment extends AppModel {
|
|||||||
array(/* e3 */
|
array(/* e3 */
|
||||||
'LedgerEntry' =>
|
'LedgerEntry' =>
|
||||||
array('Transaction.id',
|
array('Transaction.id',
|
||||||
'Payment.id',
|
'Tender.id',
|
||||||
'Customer.id',
|
'Customer.id',
|
||||||
'Lease.id',
|
'Lease.id',
|
||||||
|
|
||||||
@@ -156,7 +156,7 @@ class Payment extends AppModel {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
'conditions' => array(array('Payment.id' => $id)),
|
'conditions' => array(array('Tender.id' => $id)),
|
||||||
));
|
));
|
||||||
pr($source);
|
pr($source);
|
||||||
|
|
||||||
@@ -31,10 +31,10 @@ function updateEntriesGrid() {
|
|||||||
account_ids.push($(this).val());
|
account_ids.push($(this).val());
|
||||||
});
|
});
|
||||||
|
|
||||||
cust['collected_account_id'] = <?php echo $account['id']; ?>;
|
cust['account_id'] = <?php echo $account['id']; ?>;
|
||||||
cust['collected_from_date'] = $('#TxFromDate').val();
|
cust['from_date'] = $('#TxFromDate').val();
|
||||||
cust['collected_through_date'] = $('#TxThroughDate').val();
|
cust['through_date'] = $('#TxThroughDate').val();
|
||||||
cust['collected_payment_accounts'] = account_ids;
|
cust['payment_accounts'] = account_ids;
|
||||||
|
|
||||||
$('#collected-total').html('Calculating...');
|
$('#collected-total').html('Calculating...');
|
||||||
$('#collected-entries-jqGrid').clearGridData();
|
$('#collected-entries-jqGrid').clearGridData();
|
||||||
@@ -155,7 +155,7 @@ echo '<div CLASS="detail supporting">' . "\n";
|
|||||||
|
|
||||||
echo $this->element('ledger_entries', array
|
echo $this->element('ledger_entries', array
|
||||||
(// Element configuration
|
(// Element configuration
|
||||||
'collected_account_id' => $account['id'],
|
'account_id' => $account['id'],
|
||||||
|
|
||||||
// Grid configuration
|
// Grid configuration
|
||||||
'config' => array
|
'config' => array
|
||||||
|
|||||||
@@ -9,12 +9,19 @@ echo '<div class="account view">' . "\n";
|
|||||||
* Account Detail Main Section
|
* Account Detail Main Section
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$rows = array(array('ID', $account['Account']['id']),
|
$ledger = $account['Ledger'];
|
||||||
array('Name', $account['Account']['name']),
|
$current_ledger = $account['CurrentLedger'];
|
||||||
array('Type', $account['Account']['type']),
|
|
||||||
array('External Name', $account['Account']['external_name']),
|
if (isset($account['Account']))
|
||||||
array('External Account', $account['Account']['external_account']),
|
$account = $account['Account'];
|
||||||
array('Comment', $account['Account']['comment']));
|
|
||||||
|
$rows = array();
|
||||||
|
$rows[] = array('ID', $account['id']);
|
||||||
|
$rows[] = array('Name', $account['name']);
|
||||||
|
$rows[] = array('Type', $account['type']);
|
||||||
|
$rows[] = array('External Name', $account['external_name']);
|
||||||
|
$rows[] = array('External Account', $account['external_account']);
|
||||||
|
$rows[] = array('Comment', $account['comment']);
|
||||||
|
|
||||||
echo $this->element('table',
|
echo $this->element('table',
|
||||||
array('class' => 'item account detail',
|
array('class' => 'item account detail',
|
||||||
@@ -56,9 +63,10 @@ echo '<div CLASS="detail supporting">' . "\n";
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
echo $this->element('ledgers', array
|
echo $this->element('ledgers', array
|
||||||
('config' => array
|
(// Grid configuration
|
||||||
('caption' => $account['Account']['name'] . " Ledgers",
|
'config' => array
|
||||||
'rows' => $account['Ledger'],
|
('caption' => $account['name'] . " Ledgers",
|
||||||
|
'filter' => array('account_id' => $account['id']),
|
||||||
)));
|
)));
|
||||||
|
|
||||||
|
|
||||||
@@ -66,21 +74,29 @@ echo $this->element('ledgers', array
|
|||||||
* Current Ledger
|
* Current Ledger
|
||||||
*/
|
*/
|
||||||
|
|
||||||
echo $this->element('entries', array
|
echo $this->element('ledger_entries', array
|
||||||
(// Element configuration
|
(// Grid configuration
|
||||||
'ledger_id' => $account['CurrentLedger']['id'],
|
|
||||||
'account_type' => $account['Account']['type'],
|
|
||||||
|
|
||||||
// Grid configuration
|
|
||||||
'config' => array
|
'config' => array
|
||||||
('caption' =>
|
('caption' => ("Current Ledger: " .
|
||||||
"Current Ledger: (" .
|
"(". $current_ledger['name'] .")"),
|
||||||
"#{$account['Account']['id']}" .
|
'filter' => array('ledger_id' => $current_ledger['id']),
|
||||||
"-" .
|
)));
|
||||||
"{$account['CurrentLedger']['sequence']}" .
|
|
||||||
")",
|
|
||||||
),
|
|
||||||
));
|
/**********************************************************************
|
||||||
|
* Entire Account
|
||||||
|
*/
|
||||||
|
|
||||||
|
echo $this->element('ledger_entries', array
|
||||||
|
(// Grid configuration
|
||||||
|
'config' => array
|
||||||
|
('grid_setup' => array('hiddengrid' => true),
|
||||||
|
'caption' => "Entire Ledger",
|
||||||
|
'filter' => array('account_id' => $account['id']),
|
||||||
|
)));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* End "detail supporting" div */
|
/* End "detail supporting" div */
|
||||||
echo '</div>' . "\n";
|
echo '</div>' . "\n";
|
||||||
|
|||||||
@@ -9,16 +9,24 @@ echo '<div class="contact view">' . "\n";
|
|||||||
* Contact Detail Main Section
|
* Contact Detail Main Section
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$rows = array(array('First Name', $contact['Contact']['first_name']),
|
$phones = $contact['ContactPhone'];
|
||||||
array('Middle Name', $contact['Contact']['middle_name']),
|
$addresses = $contact['ContactAddress'];
|
||||||
array('Last Name', $contact['Contact']['last_name']),
|
$emails = $contact['ContactEmail'];
|
||||||
array('Company', $contact['Contact']['company_name']),
|
|
||||||
array('SSN', $contact['Contact']['id_federal']),
|
if (isset($contact['Contact']))
|
||||||
array('ID', ($contact['Contact']['id_local']
|
$contact = $contact['Contact'];
|
||||||
. ($contact['Contact']['id_local']
|
|
||||||
? " - ".$contact['Contact']['id_local_state']
|
$rows = array();
|
||||||
: ""))),
|
$rows[] = array('First Name', $contact['first_name']);
|
||||||
array('Comment', $contact['Contact']['comment']));
|
$rows[] = array('Middle Name', $contact['middle_name']);
|
||||||
|
$rows[] = array('Last Name', $contact['last_name']);
|
||||||
|
$rows[] = array('Company', $contact['company_name']);
|
||||||
|
$rows[] = array('SSN', $contact['id_federal']);
|
||||||
|
$rows[] = array('ID', ($contact['id_local']
|
||||||
|
. ($contact['id_local']
|
||||||
|
? " - ".$contact['id_local_state']
|
||||||
|
: "")));
|
||||||
|
$rows[] = array('Comment', $contact['comment']);
|
||||||
|
|
||||||
echo $this->element('table',
|
echo $this->element('table',
|
||||||
array('class' => 'item contact detail',
|
array('class' => 'item contact detail',
|
||||||
@@ -57,7 +65,7 @@ echo '<div CLASS="detail supporting">' . "\n";
|
|||||||
*/
|
*/
|
||||||
$headers = array('Phone', 'Preference', 'Comment');
|
$headers = array('Phone', 'Preference', 'Comment');
|
||||||
$rows = array();
|
$rows = array();
|
||||||
foreach($contact['ContactPhone'] AS $phone) {
|
foreach($phones AS $phone) {
|
||||||
$rows[] = array(FormatHelper::phone($phone['phone']) .
|
$rows[] = array(FormatHelper::phone($phone['phone']) .
|
||||||
($phone['ext'] ? " x".$phone['ext'] : ""),
|
($phone['ext'] ? " x".$phone['ext'] : ""),
|
||||||
$phone['ContactsMethod']['preference'] . " / " .
|
$phone['ContactsMethod']['preference'] . " / " .
|
||||||
@@ -79,7 +87,7 @@ echo $this->element('table',
|
|||||||
*/
|
*/
|
||||||
$headers = array('Address', 'Preference', 'Comment');
|
$headers = array('Address', 'Preference', 'Comment');
|
||||||
$rows = array();
|
$rows = array();
|
||||||
foreach($contact['ContactAddress'] AS $address) {
|
foreach($addresses AS $address) {
|
||||||
$rows[] = array(preg_replace("/\n/", "<BR>\n", $address['address']) . "<BR>\n" .
|
$rows[] = array(preg_replace("/\n/", "<BR>\n", $address['address']) . "<BR>\n" .
|
||||||
$address['city'] . ", " .
|
$address['city'] . ", " .
|
||||||
$address['state'] . " " .
|
$address['state'] . " " .
|
||||||
@@ -103,7 +111,7 @@ echo $this->element('table',
|
|||||||
*/
|
*/
|
||||||
$headers = array('Email', 'Preference', 'Comment');
|
$headers = array('Email', 'Preference', 'Comment');
|
||||||
$rows = array();
|
$rows = array();
|
||||||
foreach($contact['ContactEmail'] AS $email) {
|
foreach($emails AS $email) {
|
||||||
$rows[] = array($email['email'],
|
$rows[] = array($email['email'],
|
||||||
$email['ContactsMethod']['preference'] . " / " .
|
$email['ContactsMethod']['preference'] . " / " .
|
||||||
$email['ContactsMethod']['type'],
|
$email['ContactsMethod']['type'],
|
||||||
@@ -123,9 +131,10 @@ echo $this->element('table',
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
echo $this->element('customers', array
|
echo $this->element('customers', array
|
||||||
('config' => array
|
(// Grid configuration
|
||||||
|
'config' => array
|
||||||
('caption' => 'Related Customers',
|
('caption' => 'Related Customers',
|
||||||
'rows' => $contact['Customer'],
|
'filter' => array('contact_id' => $contact['id']),
|
||||||
)));
|
)));
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,9 @@ echo '<div class="customer view">' . "\n";
|
|||||||
* Customer Detail Main Section
|
* Customer Detail Main Section
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$rows = array(array('Name', $customer['Customer']['name']),
|
$rows = array();
|
||||||
array('Comment', $customer['Customer']['comment']));
|
$rows[] = array('Name', $customer['Customer']['name']);
|
||||||
|
$rows[] = array('Comment', $customer['Customer']['comment']);
|
||||||
|
|
||||||
echo $this->element('table',
|
echo $this->element('table',
|
||||||
array('class' => 'item customer detail',
|
array('class' => 'item customer detail',
|
||||||
@@ -51,9 +52,10 @@ echo '<div CLASS="detail supporting">' . "\n";
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
echo $this->element('contacts', array
|
echo $this->element('contacts', array
|
||||||
('config' => array
|
(// Grid configuration
|
||||||
|
'config' => array
|
||||||
('caption' => 'Customer Contacts',
|
('caption' => 'Customer Contacts',
|
||||||
'rows' => $customer['Contact'],
|
'filter' => array('Customer.id' => $customer['Customer']['id']),
|
||||||
)));
|
)));
|
||||||
|
|
||||||
|
|
||||||
@@ -62,10 +64,10 @@ echo $this->element('contacts', array
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
echo $this->element('leases', array
|
echo $this->element('leases', array
|
||||||
('customer_id' => $customer['Customer']['id'],
|
(// Grid configuration
|
||||||
|
|
||||||
'config' => array
|
'config' => array
|
||||||
('caption' => 'Lease History',
|
('caption' => 'Lease History',
|
||||||
|
'filter' => array('Customer.id' => $customer['Customer']['id']),
|
||||||
)));
|
)));
|
||||||
|
|
||||||
|
|
||||||
@@ -73,15 +75,12 @@ echo $this->element('leases', array
|
|||||||
* Customer Account History
|
* Customer Account History
|
||||||
*/
|
*/
|
||||||
|
|
||||||
echo $this->element('ledger_entries', array
|
echo $this->element('statement_entries', array
|
||||||
(// Element configuration
|
(// Grid configuration
|
||||||
'customer_id' => $customer['Customer']['id'],
|
|
||||||
|
|
||||||
// Grid configuration
|
|
||||||
'config' => array
|
'config' => array
|
||||||
('caption' => 'Account',
|
('caption' => 'Account',
|
||||||
),
|
'filter' => array('Customer.id' => $customer['Customer']['id']),
|
||||||
));
|
)));
|
||||||
|
|
||||||
|
|
||||||
/* End "detail supporting" div */
|
/* End "detail supporting" div */
|
||||||
|
|||||||
@@ -4,20 +4,18 @@
|
|||||||
$cols = array();
|
$cols = array();
|
||||||
$cols['ID'] = array('index' => 'Account.id', 'formatter' => 'id');
|
$cols['ID'] = array('index' => 'Account.id', 'formatter' => 'id');
|
||||||
$cols['Name'] = array('index' => 'Account.name', 'formatter' => 'longname');
|
$cols['Name'] = array('index' => 'Account.name', 'formatter' => 'longname');
|
||||||
$cols['Type'] = array('index' => 'Account.type', 'formatter' => 'name');
|
$cols['Type'] = array('index' => 'Account.type', 'formatter' => 'enum');
|
||||||
$cols['Entries'] = array('index' => 'entries', 'width' => '60', 'align' => 'right');
|
$cols['Entries'] = array('index' => 'entries', 'formatter' => 'number');
|
||||||
$cols['Debits'] = array('index' => 'debits', 'formatter' => 'currency');
|
$cols['Debits'] = array('index' => 'debits', 'formatter' => 'currency');
|
||||||
$cols['Credits'] = array('index' => 'credits', 'formatter' => 'currency');
|
$cols['Credits'] = array('index' => 'credits', 'formatter' => 'currency');
|
||||||
$cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency');
|
$cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency');
|
||||||
$cols['Comment'] = array('index' => 'Account.comment', 'formatter' => 'comment');
|
$cols['Comment'] = array('index' => 'Account.comment', 'formatter' => 'comment');
|
||||||
|
|
||||||
// Set up search fields if requested by caller
|
|
||||||
if (isset($searchfields))
|
|
||||||
$grid->searchFields(array('Name'));
|
|
||||||
|
|
||||||
// Render the grid
|
// Render the grid
|
||||||
$grid
|
$grid
|
||||||
->columns($cols)
|
->columns($cols)
|
||||||
->sortField('Name')
|
->sortField('Name')
|
||||||
->defaultFields(array('ID', 'Name'))
|
->defaultFields(array('ID', 'Name'))
|
||||||
->render($this, isset($config) ? $config : null);
|
->searchFields(array('Name'))
|
||||||
|
->render($this, isset($config) ? $config : null,
|
||||||
|
array_diff(array_keys($cols), array('Comment')));
|
||||||
|
|||||||
@@ -6,19 +6,15 @@ $cols['ID'] = array('index' => 'Contact.id', 'formatter' => '
|
|||||||
$cols['Last Name'] = array('index' => 'Contact.last_name', 'formatter' => 'name');
|
$cols['Last Name'] = array('index' => 'Contact.last_name', 'formatter' => 'name');
|
||||||
$cols['First Name'] = array('index' => 'Contact.first_name', 'formatter' => 'name');
|
$cols['First Name'] = array('index' => 'Contact.first_name', 'formatter' => 'name');
|
||||||
$cols['Company'] = array('index' => 'Contact.company_name', 'formatter' => 'longname');
|
$cols['Company'] = array('index' => 'Contact.company_name', 'formatter' => 'longname');
|
||||||
if (0) { // REVISIT<AP>: Need to figure out how to put this in play
|
$cols['Type'] = array('index' => 'ContactsCustomer.type', 'formatter' => 'enum');
|
||||||
$cols['Type'] = array('index' => 'ContactsCustomer.type', 'width' => '75');
|
$cols['Active'] = array('index' => 'ContactsCustomer.active', 'formatter' => 'enum');
|
||||||
$cols['Active'] = array('index' => 'ContactsCustomer.active', 'width' => '75');
|
|
||||||
}
|
|
||||||
$cols['Comment'] = array('index' => 'Contact.comment', 'formatter' => 'comment');
|
$cols['Comment'] = array('index' => 'Contact.comment', 'formatter' => 'comment');
|
||||||
|
|
||||||
// Set up search fields if requested by caller
|
|
||||||
if (isset($searchfields))
|
|
||||||
$grid->searchFields(array('Last Name', 'First Name'));
|
|
||||||
|
|
||||||
// Render the grid
|
// Render the grid
|
||||||
$grid
|
$grid
|
||||||
->columns($cols)
|
->columns($cols)
|
||||||
->sortField('Last Name')
|
->sortField('Last Name')
|
||||||
->defaultFields(array('ID', 'Last Name', 'First Name'))
|
->defaultFields(array('ID', 'Last Name', 'First Name'))
|
||||||
->render($this, isset($config) ? $config : null);
|
->searchFields(array('Last Name', 'First Name', 'Company'))
|
||||||
|
->render($this, isset($config) ? $config : null,
|
||||||
|
array_diff(array_keys($cols), array('Type', 'Active', 'Comment')));
|
||||||
|
|||||||
@@ -3,25 +3,24 @@
|
|||||||
// Define the table columns
|
// Define the table columns
|
||||||
$cols = array();
|
$cols = array();
|
||||||
$cols['ID'] = array('index' => 'Customer.id', 'formatter' => 'id');
|
$cols['ID'] = array('index' => 'Customer.id', 'formatter' => 'id');
|
||||||
if (0) // REVISIT<AP>: Need to figure out how to put this in play
|
$cols['Relationship'] = array('index' => 'ContactsCustomer.type', 'formatter' => 'enum');
|
||||||
$cols['Relationship'] = array('index' => 'ContactsCustomer.type', 'width' => '75');
|
|
||||||
$cols['Name'] = array('index' => 'Customer.name', 'formatter' => 'longname');
|
$cols['Name'] = array('index' => 'Customer.name', 'formatter' => 'longname');
|
||||||
$cols['Last Name'] = array('index' => 'PrimaryContact.last_name', 'formatter' => 'name');
|
$cols['Last Name'] = array('index' => 'PrimaryContact.last_name', 'formatter' => 'name');
|
||||||
$cols['First Name'] = array('index' => 'PrimaryContact.first_name', 'formatter' => 'name');
|
$cols['First Name'] = array('index' => 'PrimaryContact.first_name', 'formatter' => 'name');
|
||||||
$cols['Leases'] = array('index' => 'lease_count', 'width' => '60');
|
$cols['Leases'] = array('index' => 'lease_count', 'formatter' => 'number');
|
||||||
$cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency');
|
$cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency');
|
||||||
$cols['Comment'] = array('index' => 'Customer.comment', 'formatter' => 'comment');
|
$cols['Comment'] = array('index' => 'Customer.comment', 'formatter' => 'comment');
|
||||||
|
|
||||||
// Set up search fields if requested by caller
|
|
||||||
if (isset($searchfields))
|
|
||||||
$grid->searchFields(array('Last Name', 'First Name'));
|
|
||||||
|
|
||||||
// Include custom data
|
// Certain fields are only valid with a particular context
|
||||||
//$grid->customData(compact('lease_id'));
|
if (!isset($config['filter']['contact_id']) && !isset($config['filter']['Contact.id']))
|
||||||
|
$grid->invalidFields('Relationship');
|
||||||
|
|
||||||
// Render the grid
|
// Render the grid
|
||||||
$grid
|
$grid
|
||||||
->columns($cols)
|
->columns($cols)
|
||||||
->sortField('Name')
|
->sortField('Name')
|
||||||
->defaultFields(array('ID', 'Name'))
|
->defaultFields(array('ID', 'Name'))
|
||||||
->render($this, isset($config) ? $config : null);
|
->searchFields(array('Name', 'Last Name', 'First Name'))
|
||||||
|
->render($this, isset($config) ? $config : null,
|
||||||
|
array_diff(array_keys($cols), array('Comment')));
|
||||||
|
|||||||
@@ -29,37 +29,9 @@ $cols['Applied'] = array('index' => "applied", 'formatter' =>
|
|||||||
$cols['Sub-Total'] = array('index' => 'subtotal-LedgerEntry.amount', 'formatter' => 'currency', 'sortable' => false);
|
$cols['Sub-Total'] = array('index' => 'subtotal-LedgerEntry.amount', 'formatter' => 'currency', 'sortable' => false);
|
||||||
|
|
||||||
|
|
||||||
// Since group_by_tx is a boolean, let's just get it
|
|
||||||
// defined, regardless of whether the caller did so.
|
|
||||||
// group_by_tx will cause all entry fields to be
|
|
||||||
// invalidated, and will leave only the transaction
|
|
||||||
// fields. Yes... the caller should just use the
|
|
||||||
// transactions element instead, in theory. However,
|
|
||||||
// it hasn't yet been implemented to the level of
|
|
||||||
// this element, and additionally, the transactions
|
|
||||||
// element will not allow for customer information
|
|
||||||
// (rightly so, since it's a ledger_entry field).
|
|
||||||
// However, at the current implementation, all ledger
|
|
||||||
// entries of a transaction are for the same customer.
|
|
||||||
// So... we allow it for now.
|
|
||||||
if (!isset($group_by_tx))
|
|
||||||
$group_by_tx = false;
|
|
||||||
|
|
||||||
// REVISIT <AP>: 20090715
|
|
||||||
// If we really want to group by transaction, we need
|
|
||||||
// a transaction listing, not a ledger_entry listing.
|
|
||||||
// switch controllers... don't overload this one.
|
|
||||||
$group_by_tx = false;
|
|
||||||
|
|
||||||
if (isset($transaction_id) || isset($reconcile_id))
|
if (isset($transaction_id) || isset($reconcile_id))
|
||||||
$grid->invalidFields('Transaction');
|
$grid->invalidFields('Transaction');
|
||||||
|
|
||||||
if ($group_by_tx)
|
|
||||||
$grid->invalidFields('Entry');
|
|
||||||
|
|
||||||
if ($group_by_tx)
|
|
||||||
$grid->invalidFields(array('Effective', 'Through'));
|
|
||||||
|
|
||||||
if (!isset($collected_account_id))
|
if (!isset($collected_account_id))
|
||||||
$grid->invalidFields('Last Payment');
|
$grid->invalidFields('Last Payment');
|
||||||
|
|
||||||
|
|||||||
@@ -97,22 +97,35 @@ $postData['custom'] = isset($custom_post_data) ? $custom_post_data : null;
|
|||||||
// Perform column customizations.
|
// Perform column customizations.
|
||||||
// This will largely be based off of the 'formatter' parameter,
|
// This will largely be based off of the 'formatter' parameter,
|
||||||
// but could be on any pertinent condition.
|
// but could be on any pertinent condition.
|
||||||
foreach ($jqGridColumns AS &$col) {
|
foreach ($jqGridColumns AS $header => &$col) {
|
||||||
$default = array();
|
$default = array();
|
||||||
|
|
||||||
// Make sure every column has a name
|
// Make sure every column has a name
|
||||||
$default['name'] = preg_replace("/\./", '-', $col['index']);
|
$default['name'] = preg_replace("/\./", '-', $col['index']);
|
||||||
|
$default['force'] = isset($col['forcewidth']) ? $col['forcewidth'] : null;
|
||||||
|
|
||||||
// Perform customization based on formatter
|
// Perform customization based on formatter
|
||||||
if (isset($col['formatter'])) {
|
if (isset($col['formatter'])) {
|
||||||
if ($col['formatter'] === 'id') {
|
if ($col['formatter'] === 'id') {
|
||||||
// Switch currency over to our own custom formatting
|
// Use our custom formatting for ids
|
||||||
$col['formatter'] = array('--special' => 'idFormatter');
|
$col['formatter'] = array('--special' => 'idFormatter');
|
||||||
$default['width'] = 50;
|
$default['width'] = 50;
|
||||||
$default['align'] = 'center';
|
$default['align'] = 'center';
|
||||||
|
|
||||||
|
// For IDs, force the width by default,
|
||||||
|
// unless otherwise instructed NOT to.
|
||||||
|
if (!isset($default['force']))
|
||||||
|
$default['force'] = true;
|
||||||
|
}
|
||||||
|
elseif ($col['formatter'] === 'number') {
|
||||||
|
$default['width'] = 60;
|
||||||
|
$default['align'] = 'right';
|
||||||
|
|
||||||
|
// No special formatting for number
|
||||||
|
unset($col['formatter']);
|
||||||
}
|
}
|
||||||
elseif ($col['formatter'] === 'currency') {
|
elseif ($col['formatter'] === 'currency') {
|
||||||
// Switch currency over to our own custom formatting
|
// Use our custom formatting for currency
|
||||||
$col['formatter'] = array('--special' => 'currencyFormatter');
|
$col['formatter'] = array('--special' => 'currencyFormatter');
|
||||||
$default['width'] = 85;
|
$default['width'] = 85;
|
||||||
$default['align'] = 'right';
|
$default['align'] = 'right';
|
||||||
@@ -122,14 +135,24 @@ foreach ($jqGridColumns AS &$col) {
|
|||||||
$default['width'] = 95;
|
$default['width'] = 95;
|
||||||
$default['align'] = 'center';
|
$default['align'] = 'center';
|
||||||
}
|
}
|
||||||
elseif ($col['formatter'] === 'name' || $col['formatter'] === 'longname') {
|
elseif (preg_match("/^(long|short)?name$/",
|
||||||
|
$col['formatter'], $matches)) {
|
||||||
$default['width'] = 100;
|
$default['width'] = 100;
|
||||||
if ($col['formatter'] === 'longname')
|
if (!empty($matches[1]) && $matches[1] === 'long')
|
||||||
$default['width'] *= 1.5;
|
$default['width'] *= 1.5;
|
||||||
|
if (!empty($matches[1]) && $matches[1] === 'short')
|
||||||
|
$default['width'] *= 0.7;
|
||||||
|
|
||||||
// No special formatting for name
|
// No special formatting for name
|
||||||
unset($col['formatter']);
|
unset($col['formatter']);
|
||||||
}
|
}
|
||||||
|
elseif ($col['formatter'] === 'enum') {
|
||||||
|
$default['width'] = 60;
|
||||||
|
//$default['align'] = 'right';
|
||||||
|
|
||||||
|
// No special formatting for enum
|
||||||
|
unset($col['formatter']);
|
||||||
|
}
|
||||||
elseif ($col['formatter'] === 'comment') {
|
elseif ($col['formatter'] === 'comment') {
|
||||||
$default['width'] = 300;
|
$default['width'] = 300;
|
||||||
$default['sortable'] = false;
|
$default['sortable'] = false;
|
||||||
@@ -137,6 +160,13 @@ foreach ($jqGridColumns AS &$col) {
|
|||||||
// No special formatting for comment
|
// No special formatting for comment
|
||||||
unset($col['formatter']);
|
unset($col['formatter']);
|
||||||
}
|
}
|
||||||
|
// else just let the formatter pass through untouched
|
||||||
|
|
||||||
|
// Just a rough approximation to ensure columns
|
||||||
|
// are wide enough to fully display their header.
|
||||||
|
$min_width = strlen($header) * 10;
|
||||||
|
if ((!isset($default['width']) || $default['width'] < $min_width) && !$default['force'])
|
||||||
|
$default['width'] = $min_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
$col = array_merge($default, $col);
|
$col = array_merge($default, $col);
|
||||||
|
|||||||
@@ -14,19 +14,11 @@ $cols['Move-Out'] = array('index' => 'Lease.moveout_date', 'formatter' => 'dat
|
|||||||
$cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency');
|
$cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency');
|
||||||
$cols['Comment'] = array('index' => 'Lease.comment', 'formatter' => 'comment');
|
$cols['Comment'] = array('index' => 'Lease.comment', 'formatter' => 'comment');
|
||||||
|
|
||||||
// Set up search fields if requested by caller
|
|
||||||
if (isset($searchfields))
|
|
||||||
$grid->searchFields(array('Customer', 'Unit'));
|
|
||||||
|
|
||||||
if (isset($customer_id))
|
|
||||||
$grid->invalidFields('Customer');
|
|
||||||
|
|
||||||
// Include custom data
|
|
||||||
$grid->customData(compact('customer_id'));
|
|
||||||
|
|
||||||
// Render the grid
|
// Render the grid
|
||||||
$grid
|
$grid
|
||||||
->columns($cols)
|
->columns($cols)
|
||||||
->sortField('LeaseID')
|
->sortField('LeaseID')
|
||||||
->defaultFields(array('LeaseID', 'Lease'))
|
->defaultFields(array('LeaseID', 'Lease'))
|
||||||
->render($this, isset($config) ? $config : null);
|
->searchFields(array('Customer', 'Unit'))
|
||||||
|
->render($this, isset($config) ? $config : null,
|
||||||
|
array_diff(array_keys($cols), array('Comment')));
|
||||||
|
|||||||
@@ -3,119 +3,27 @@
|
|||||||
// Define the table columns
|
// Define the table columns
|
||||||
$cols = array();
|
$cols = array();
|
||||||
$cols['Transaction'] = array('index' => 'Transaction.id', 'formatter' => 'id');
|
$cols['Transaction'] = array('index' => 'Transaction.id', 'formatter' => 'id');
|
||||||
$cols['Entry'] = array('index' => 'Entry.id', 'formatter' => 'id');
|
$cols['Entry'] = array('index' => 'LedgerEntry.id', 'formatter' => 'id');
|
||||||
|
|
||||||
$cols['Date'] = array('index' => 'Transaction.stamp', 'formatter' => 'date');
|
$cols['Date'] = array('index' => 'Transaction.stamp', 'formatter' => 'date');
|
||||||
$cols['Effective'] = array('index' => 'DoubleEntry.effective_date', 'formatter' => 'date');
|
|
||||||
$cols['Through'] = array('index' => 'Entry.through_date', 'formatter' => 'date');
|
|
||||||
|
|
||||||
$cols['Debit Account'] = array('index' => 'DebitAccount.name', 'formatter' => 'name');
|
|
||||||
$cols['Credit Account'] = array('index' => 'CreditAccount.name', 'formatter' => 'name');
|
|
||||||
$cols['Account'] = array('index' => 'Account.name', 'formatter' => 'name');
|
$cols['Account'] = array('index' => 'Account.name', 'formatter' => 'name');
|
||||||
$cols['Cr/Dr'] = array('index' => 'Entry.crdr', 'formatter' => 'name');
|
$cols['Cr/Dr'] = array('index' => 'LedgerEntry.crdr', 'formatter' => 'enum');
|
||||||
|
$cols['Tender'] = array('index' => 'Tender.name', 'formatter' => 'name');
|
||||||
$cols['Customer'] = array('index' => 'Customer.name', 'formatter' => 'longname');
|
$cols['Comment'] = array('index' => 'LedgerEntry.comment', 'formatter' => 'comment', 'width'=>150);
|
||||||
$cols['Lease'] = array('index' => 'Lease.number', 'formatter' => 'id');
|
|
||||||
$cols['Unit'] = array('index' => 'Unit.name', 'formatter' => 'name');
|
|
||||||
|
|
||||||
$cols['Source'] = array('index' => 'Entry.name', 'formatter' => 'name');
|
|
||||||
$cols['Comment'] = array('index' => 'Entry.comment', 'formatter' => 'comment', 'width'=>150);
|
|
||||||
|
|
||||||
$cols['Debit'] = array('index' => 'debit', 'formatter' => 'currency');
|
$cols['Debit'] = array('index' => 'debit', 'formatter' => 'currency');
|
||||||
$cols['Credit'] = array('index' => 'credit', 'formatter' => 'currency');
|
$cols['Credit'] = array('index' => 'credit', 'formatter' => 'currency');
|
||||||
$cols['Amount'] = array('index' => 'DoubleEntry.amount', 'formatter' => 'currency');
|
$cols['Amount'] = array('index' => 'LedgerEntry.amount', 'formatter' => 'currency');
|
||||||
|
$cols['Sub-Total'] = array('index' => 'subtotal-balance', 'formatter' => 'currency', 'sortable' => false);
|
||||||
|
|
||||||
$cols['Last Payment'] = array('index' => 'last_paid', 'formatter' => 'date');
|
|
||||||
$cols['Applied'] = array('index' => "applied", 'formatter' => 'currency');
|
|
||||||
$cols['Sub-Total'] = array('index' => 'subtotal-DoubleEntry.amount', 'formatter' => 'currency', 'sortable' => false);
|
|
||||||
|
|
||||||
|
|
||||||
if (isset($transaction_id) || isset($reconcile_id))
|
|
||||||
$grid->invalidFields('Transaction');
|
|
||||||
|
|
||||||
if (!isset($collected_account_id))
|
|
||||||
$grid->invalidFields('Last Payment');
|
|
||||||
|
|
||||||
if (isset($account_ftype) || isset($ar_account) || isset($customer_id) || isset($lease_id))
|
|
||||||
$grid->invalidFields(array('Debit Account', 'Credit Account'));
|
|
||||||
else
|
|
||||||
$grid->invalidFields(array('Account', 'Cr/Dr'));
|
|
||||||
|
|
||||||
if (isset($customer_id) || isset($lease_id))
|
|
||||||
$grid->invalidFields(array('Cr/Dr'));
|
|
||||||
|
|
||||||
if (isset($no_account) || isset($ledger_id) || isset($account_id) || isset($collected_account_id))
|
|
||||||
$grid->invalidFields(array('Account', 'Cr/Dr', 'Debit Account', 'Credit Account'));
|
|
||||||
|
|
||||||
if (isset($ledger_id) || isset($account_id) || isset($ar_account) || isset($customer_id) || isset($lease_id)) {
|
|
||||||
$grid->invalidFields('Amount');
|
|
||||||
$cols['Sub-Total']['index'] = 'subtotal-balance';
|
|
||||||
} else {
|
|
||||||
$grid->invalidFields(array('Debit', 'Credit'));
|
|
||||||
$cols['Sub-Total']['index'] = 'subtotal-DoubleEntry.amount';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($lease_id) || isset($customer_id))
|
|
||||||
$grid->invalidFields(array('Customer'));
|
|
||||||
|
|
||||||
if (isset($lease_id))
|
|
||||||
$grid->invalidFields(array('Lease', 'Unit'));
|
|
||||||
|
|
||||||
if (!isset($reconcile_id) && !isset($collected_account_id))
|
|
||||||
$grid->invalidFields('Applied');
|
|
||||||
else
|
|
||||||
$cols['Sub-Total']['index'] = 'subtotal-applied';
|
|
||||||
|
|
||||||
if (isset($account_ftype) || isset($collected_account_id))
|
|
||||||
$grid->invalidFields('Sub-Total');
|
|
||||||
|
|
||||||
|
|
||||||
// Now that columns are defined, establish basic grid parameters
|
|
||||||
$grid
|
|
||||||
->columns($cols)
|
|
||||||
->sortField('Date')
|
|
||||||
->defaultFields(array('Entry', 'Date', 'Amount', 'Credit', 'Debit'));
|
|
||||||
|
|
||||||
|
|
||||||
if (!isset($config['rows']) && !isset($collected_account_id)) {
|
|
||||||
$config['action'] = 'ledger';
|
|
||||||
$grid->limit(50);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($reconcile_id)) {
|
|
||||||
$config['action'] = 'reconcile';
|
|
||||||
$grid->customData(compact('reconcile_id'))->limit(20);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($collected_account_id)) {
|
|
||||||
$config['action'] = 'collected';
|
|
||||||
$account_id = $collected_account_id;
|
|
||||||
$grid->limit(50);
|
|
||||||
$grid->sortField('Last Payment');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($entry_ids)) {
|
|
||||||
unset($config['action']);
|
|
||||||
$grid->id_list($entry_ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up search fields if requested by caller
|
|
||||||
if (isset($searchfields))
|
|
||||||
$grid->searchFields(array('Customer', 'Unit'));
|
|
||||||
|
|
||||||
// Include custom data
|
|
||||||
$grid->customData(compact('ledger_id', 'account_id', 'ar_account', 'entry_type',
|
|
||||||
'account_type', 'account_ftype', 'monetary_source_id',
|
|
||||||
'customer_id', 'lease_id', 'transaction_id'));
|
|
||||||
|
|
||||||
// Render the grid
|
// Render the grid
|
||||||
$grid
|
$grid
|
||||||
|
->limit(50)
|
||||||
|
->columns($cols)
|
||||||
|
->sortField('Date')
|
||||||
|
->defaultFields(array('Entry', 'Date', 'Amount'))
|
||||||
|
->searchFields(array('Customer', 'Unit'))
|
||||||
->render($this, isset($config) ? $config : null,
|
->render($this, isset($config) ? $config : null,
|
||||||
array('Transaction', 'Entry', 'Date', 'Effective', 'Last Payment',
|
array_diff(array_keys($cols), array('Debit', 'Credit', 'Sub-Total', 'Comment')));
|
||||||
'Debit Account', 'Credit Account', 'Account', 'Cr/Dr',
|
|
||||||
'Customer', 'Unit',
|
|
||||||
'Comment',
|
|
||||||
'Debit', 'Credit', 'Amount',
|
|
||||||
'Applied', 'Sub-Total')
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,22 +3,21 @@
|
|||||||
// Define the table columns
|
// Define the table columns
|
||||||
$cols = array();
|
$cols = array();
|
||||||
$cols['ID'] = array('index' => 'id_sequence', 'formatter' => 'id');
|
$cols['ID'] = array('index' => 'id_sequence', 'formatter' => 'id');
|
||||||
|
$cols['Name'] = array('index' => 'Ledger.name', 'formatter' => 'name');
|
||||||
$cols['Account'] = array('index' => 'Account.name', 'formatter' => 'longname');
|
$cols['Account'] = array('index' => 'Account.name', 'formatter' => 'longname');
|
||||||
//$cols['Open Date'] = array('index' => 'PriorClose.stamp', 'formatter' => 'date');
|
$cols['Open Date'] = array('index' => 'PriorClose.stamp', 'formatter' => 'date');
|
||||||
$cols['Close Date'] = array('index' => 'Close.stamp', 'formatter' => 'date');
|
$cols['Close Date'] = array('index' => 'Close.stamp', 'formatter' => 'date');
|
||||||
$cols['Comment'] = array('index' => 'Ledger.comment', 'formatter' => 'comment');
|
$cols['Comment'] = array('index' => 'Ledger.comment', 'formatter' => 'comment');
|
||||||
$cols['Entries'] = array('index' => 'entries', 'width' => '60', 'align' => 'right');
|
$cols['Entries'] = array('index' => 'entries', 'formatter' => 'number');
|
||||||
$cols['Debits'] = array('index' => 'debits', 'formatter' => 'currency');
|
$cols['Debits'] = array('index' => 'debits', 'formatter' => 'currency');
|
||||||
$cols['Credits'] = array('index' => 'credits', 'formatter' => 'currency');
|
$cols['Credits'] = array('index' => 'credits', 'formatter' => 'currency');
|
||||||
$cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency');
|
$cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency');
|
||||||
|
|
||||||
// Set up search fields if requested by caller
|
|
||||||
if (isset($searchfields))
|
|
||||||
$grid->searchFields(array('Account', 'Comment'));
|
|
||||||
|
|
||||||
// Render the grid
|
// Render the grid
|
||||||
$grid
|
$grid
|
||||||
->columns($cols)
|
->columns($cols)
|
||||||
->sortField('ID', 'DESC')
|
->sortField('ID', 'ASC')
|
||||||
->defaultFields(array('ID', 'Account'))
|
->defaultFields(array('ID', 'Name', 'Account'))
|
||||||
->render($this, isset($config) ? $config : null);
|
->searchFields(array('Account', 'Comment'))
|
||||||
|
->render($this, isset($config) ? $config : null,
|
||||||
|
array_diff(array_keys($cols), array('Open Date', 'Comment')));
|
||||||
|
|||||||
@@ -5,17 +5,15 @@ $cols = array();
|
|||||||
$cols['ID'] = array('index' => 'Map.id', 'formatter' => 'id');
|
$cols['ID'] = array('index' => 'Map.id', 'formatter' => 'id');
|
||||||
$cols['Name'] = array('index' => 'Map.name', 'formatter' => 'longname');
|
$cols['Name'] = array('index' => 'Map.name', 'formatter' => 'longname');
|
||||||
$cols['Site Area'] = array('index' => 'SiteArea.name', 'formatter' => 'longname');
|
$cols['Site Area'] = array('index' => 'SiteArea.name', 'formatter' => 'longname');
|
||||||
$cols['Width'] = array('index' => 'Map.width', 'width' => '50', 'align' => 'right');
|
$cols['Width'] = array('index' => 'Map.width', 'formatter' => 'number');
|
||||||
$cols['Depth'] = array('index' => 'Map.depth', 'width' => '50', 'align' => 'right');
|
$cols['Depth'] = array('index' => 'Map.depth', 'formatter' => 'number');
|
||||||
$cols['Comment'] = array('index' => 'Map.comment', 'formatter' => 'comment');
|
$cols['Comment'] = array('index' => 'Map.comment', 'formatter' => 'comment');
|
||||||
|
|
||||||
// Set up search fields if requested by caller
|
|
||||||
if (isset($searchfields))
|
|
||||||
$grid->searchFields(array('Name'));
|
|
||||||
|
|
||||||
// Render the grid
|
// Render the grid
|
||||||
$grid
|
$grid
|
||||||
->columns($cols)
|
->columns($cols)
|
||||||
->sortField('Name')
|
->sortField('Name')
|
||||||
->defaultFields(array('ID', 'Name'))
|
->defaultFields(array('ID', 'Name'))
|
||||||
->render($this, isset($config) ? $config : null);
|
->searchFields(array('Name'))
|
||||||
|
->render($this, isset($config) ? $config : null,
|
||||||
|
array_diff(array_keys($cols), array()));
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
<?php /* -*- mode:PHP -*- */
|
|
||||||
|
|
||||||
// Define the table columns
|
|
||||||
$cols = array();
|
|
||||||
$cols['ID'] = array('index' => 'MonetarySource.id', 'formatter' => 'id');
|
|
||||||
$cols['Name'] = array('index' => 'MonetarySource.name', 'formatter' => 'longname');
|
|
||||||
$cols['Comment'] = array('index' => 'MonetarySource.comment', 'formatter' => 'comment');
|
|
||||||
|
|
||||||
// Set up search fields if requested by caller
|
|
||||||
if (isset($searchfields))
|
|
||||||
$grid->searchFields(array('ID', 'Name'));
|
|
||||||
|
|
||||||
// Render the grid
|
|
||||||
$grid
|
|
||||||
->columns($cols)
|
|
||||||
->sortField('ID')
|
|
||||||
->defaultFields(array('ID', 'Name'))
|
|
||||||
->render($this, isset($config) ? $config : null);
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
// Define the table columns
|
// Define the table columns
|
||||||
$cols = array();
|
$cols = array();
|
||||||
$cols['Transaction'] = array('index' => 'Transaction.id', 'formatter' => 'id');
|
$cols['Transaction'] = array('index' => 'Transaction.id', 'formatter' => 'id');
|
||||||
$cols['StatementEntry'] = array('index' => 'StatementEntry.id', 'formatter' => 'id');
|
$cols['Entry'] = array('index' => 'StatementEntry.id', 'formatter' => 'id');
|
||||||
|
|
||||||
$cols['Date'] = array('index' => 'Transaction.stamp', 'formatter' => 'date');
|
$cols['Date'] = array('index' => 'Transaction.stamp', 'formatter' => 'date');
|
||||||
$cols['Effective'] = array('index' => 'StatementEntry.effective_date', 'formatter' => 'date');
|
$cols['Effective'] = array('index' => 'StatementEntry.effective_date', 'formatter' => 'date');
|
||||||
@@ -13,7 +13,7 @@ $cols['Account'] = array('index' => 'Account.name', 'formatter' =>
|
|||||||
|
|
||||||
$cols['Customer'] = array('index' => 'Customer.name', 'formatter' => 'longname');
|
$cols['Customer'] = array('index' => 'Customer.name', 'formatter' => 'longname');
|
||||||
$cols['Lease'] = array('index' => 'Lease.number', 'formatter' => 'id');
|
$cols['Lease'] = array('index' => 'Lease.number', 'formatter' => 'id');
|
||||||
$cols['Unit'] = array('index' => 'Unit.name', 'formatter' => 'name');
|
$cols['Unit'] = array('index' => 'Unit.name', 'formatter' => 'shortname');
|
||||||
|
|
||||||
$cols['Comment'] = array('index' => 'StatementEntry.comment', 'formatter' => 'comment', 'width'=>150);
|
$cols['Comment'] = array('index' => 'StatementEntry.comment', 'formatter' => 'comment', 'width'=>150);
|
||||||
|
|
||||||
@@ -25,55 +25,26 @@ $cols['Applied'] = array('index' => "applied", 'formatter' =>
|
|||||||
$cols['Sub-Total'] = array('index' => 'subtotal-StatementEntry.amount', 'formatter' => 'currency', 'sortable' => false);
|
$cols['Sub-Total'] = array('index' => 'subtotal-StatementEntry.amount', 'formatter' => 'currency', 'sortable' => false);
|
||||||
|
|
||||||
|
|
||||||
if (isset($transaction_id))
|
/* if (!isset($statement_entry_id)) */
|
||||||
$grid->invalidFields('Transaction');
|
/* $grid->invalidFields('Applied'); */
|
||||||
|
/* else */
|
||||||
if (!isset($collected_account_id))
|
/* $cols['Sub-Total']['index'] = 'subtotal-applied'; */
|
||||||
$grid->invalidFields('Last Payment');
|
|
||||||
|
|
||||||
if (isset($ledger_id) || isset($account_id))
|
|
||||||
$grid->invalidFields(array('Account'));
|
|
||||||
|
|
||||||
if (isset($lease_id) || isset($customer_id))
|
|
||||||
$grid->invalidFields(array('Customer'));
|
|
||||||
|
|
||||||
if (isset($lease_id))
|
|
||||||
$grid->invalidFields(array('Lease', 'Unit'));
|
|
||||||
|
|
||||||
if (!isset($statement_entry_id))
|
|
||||||
$grid->invalidFields('Applied');
|
|
||||||
else
|
|
||||||
$cols['Sub-Total']['index'] = 'subtotal-applied';
|
|
||||||
|
|
||||||
|
// REVISIT <AP>: 20090722
|
||||||
|
// Disallowing these fields until more of the rework is complete
|
||||||
$grid->invalidFields('Sub-Total');
|
$grid->invalidFields('Sub-Total');
|
||||||
$grid->invalidFields('Applied');
|
$grid->invalidFields('Applied');
|
||||||
|
|
||||||
|
|
||||||
// Now that columns are defined, establish basic grid parameters
|
|
||||||
$grid
|
|
||||||
->columns($cols)
|
|
||||||
->sortField('Date')
|
|
||||||
->defaultFields(array('Entry', 'Date', 'Amount', 'Credit', 'Debit'));
|
|
||||||
|
|
||||||
|
|
||||||
/* // Set up search fields if requested by caller */
|
|
||||||
/* if (isset($searchfields)) */
|
|
||||||
/* $grid->searchFields(array('Customer', 'Unit')); */
|
|
||||||
|
|
||||||
|
|
||||||
// Include custom data
|
// Include custom data
|
||||||
$grid->customData(compact('transaction_id', 'account_id', 'customer_id', 'lease_id',
|
$grid->customData(compact('statement_entry_id', 'from_date', 'through_date',
|
||||||
'statement_entry_id', 'from_date', 'through_date',
|
|
||||||
'payment_accounts', 'charge_accounts'));
|
'payment_accounts', 'charge_accounts'));
|
||||||
|
|
||||||
// Render the grid
|
// Render the grid
|
||||||
$grid
|
$grid
|
||||||
|
->columns($cols)
|
||||||
|
->sortField('Date')
|
||||||
|
->defaultFields(array('Entry', 'Date', 'Charge', 'Payment'))
|
||||||
|
->searchFields(array('Customer', 'Unit'))
|
||||||
->render($this, isset($config) ? $config : null,
|
->render($this, isset($config) ? $config : null,
|
||||||
array('Transaction', 'StatementEntry', 'Date', 'Effective', 'Last Payment',
|
array_diff(array_keys($cols), array('Through', 'Lease', 'Last Payment', 'Comment')));
|
||||||
'Account',
|
|
||||||
'Customer', 'Unit',
|
|
||||||
'Comment',
|
|
||||||
'Charge', 'Payment', 'Amount',
|
|
||||||
'Applied', 'Sub-Total')
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|||||||
16
views/elements/tenders.ctp
Normal file
16
views/elements/tenders.ctp
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php /* -*- mode:PHP -*- */
|
||||||
|
|
||||||
|
// Define the table columns
|
||||||
|
$cols = array();
|
||||||
|
$cols['ID'] = array('index' => 'Tender.id', 'formatter' => 'id');
|
||||||
|
$cols['Name'] = array('index' => 'Tender.name', 'formatter' => 'longname');
|
||||||
|
$cols['Comment'] = array('index' => 'Tender.comment', 'formatter' => 'comment');
|
||||||
|
|
||||||
|
// Render the grid
|
||||||
|
$grid
|
||||||
|
->columns($cols)
|
||||||
|
->sortField('ID')
|
||||||
|
->defaultFields(array('ID', 'Name'))
|
||||||
|
->searchFields(array('ID', 'Name'))
|
||||||
|
->render($this, isset($config) ? $config : null,
|
||||||
|
array_diff(array_keys($cols), array()));
|
||||||
@@ -3,18 +3,17 @@
|
|||||||
// Define the table columns
|
// Define the table columns
|
||||||
$cols = array();
|
$cols = array();
|
||||||
$cols['ID'] = array('index' => 'Transaction.id', 'formatter' => 'id');
|
$cols['ID'] = array('index' => 'Transaction.id', 'formatter' => 'id');
|
||||||
|
$cols['Type'] = array('index' => 'Transaction.type', 'formatter' => 'enum');
|
||||||
//$cols['Customer'] = array('index' => 'Customer.name', 'formatter' => 'longname');
|
//$cols['Customer'] = array('index' => 'Customer.name', 'formatter' => 'longname');
|
||||||
$cols['Timestamp'] = array('index' => 'Transaction.stamp', 'formatter' => 'date');
|
$cols['Timestamp'] = array('index' => 'Transaction.stamp', 'formatter' => 'date');
|
||||||
$cols['Due'] = array('index' => 'Transaction.due_date', 'formatter' => 'date');
|
$cols['Amount'] = array('index' => 'Transaction.amount', 'formatter' => 'currency');
|
||||||
$cols['Comment'] = array('index' => 'Transaction.comment', 'formatter' => 'comment');
|
$cols['Comment'] = array('index' => 'Transaction.comment', 'formatter' => 'comment');
|
||||||
|
|
||||||
// Set up search fields if requested by caller
|
|
||||||
if (isset($searchfields))
|
|
||||||
$grid->searchFields(array('Due', 'Comment'));
|
|
||||||
|
|
||||||
// Render the grid
|
// Render the grid
|
||||||
$grid
|
$grid
|
||||||
->columns($cols)
|
->columns($cols)
|
||||||
->sortField('ID')
|
->sortField('Timestamp')
|
||||||
->defaultFields(array('ID', 'Timestamp'))
|
->defaultFields(array('ID', 'Timestamp'))
|
||||||
->render($this, isset($config) ? $config : null);
|
->searchFields(array('Type', 'Comment'))
|
||||||
|
->render($this, isset($config) ? $config : null,
|
||||||
|
array_diff(array_keys($cols), array('Comment')));
|
||||||
|
|||||||
@@ -3,22 +3,19 @@
|
|||||||
// Define the table columns
|
// Define the table columns
|
||||||
$cols = array();
|
$cols = array();
|
||||||
$cols['Sort'] = array('index' => 'Unit.sort_order', 'hidden' => true);
|
$cols['Sort'] = array('index' => 'Unit.sort_order', 'hidden' => true);
|
||||||
//$cols['Sort'] = array('index' => 'Unit.sort_order');
|
$cols['Walk'] = array('index' => 'Unit.walk_order', 'formatter' => 'number');
|
||||||
//$cols['Walk'] = array('index' => 'Unit.walk_order');
|
|
||||||
$cols['ID'] = array('index' => 'Unit.id', 'formatter' => 'id');
|
$cols['ID'] = array('index' => 'Unit.id', 'formatter' => 'id');
|
||||||
$cols['Unit'] = array('index' => 'Unit.name', 'width' => '50');
|
$cols['Unit'] = array('index' => 'Unit.name', 'formatter' => 'shortname');
|
||||||
$cols['Size'] = array('index' => 'UnitSize.name', 'width' => '75');
|
$cols['Size'] = array('index' => 'UnitSize.name', 'formatter' => 'shortname');
|
||||||
$cols['Status'] = array('index' => 'Unit.status', 'width' => '75');
|
$cols['Status'] = array('index' => 'Unit.status', 'formatter' => 'shortname');
|
||||||
$cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency');
|
$cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency');
|
||||||
$cols['Comment'] = array('index' => 'Unit.comment', 'formatter' => 'comment');
|
$cols['Comment'] = array('index' => 'Unit.comment', 'formatter' => 'comment');
|
||||||
|
|
||||||
// Set up search fields if requested by caller
|
|
||||||
if (isset($searchfields))
|
|
||||||
$grid->searchFields(array('Unit', 'Size', 'Status'));
|
|
||||||
|
|
||||||
// Render the grid
|
// Render the grid
|
||||||
$grid
|
$grid
|
||||||
->columns($cols)
|
->columns($cols)
|
||||||
->sortField('Sort')
|
->sortField('Sort')
|
||||||
->defaultFields(array('Sort', 'ID', 'Unit'))
|
->defaultFields(array('Sort', 'ID', 'Unit'))
|
||||||
->render($this, isset($config) ? $config : null);
|
->searchFields(array('Unit', 'Size', 'Status'))
|
||||||
|
->render($this, isset($config) ? $config : null,
|
||||||
|
array_diff(array_keys($cols), array('Walk', 'Comment')));
|
||||||
|
|||||||
@@ -1,169 +0,0 @@
|
|||||||
<?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";
|
|
||||||
@@ -160,6 +160,7 @@ class GridHelper extends AppHelper {
|
|||||||
$included = array_merge($included, $config['include']);
|
$included = array_merge($included, $config['include']);
|
||||||
if (isset($config['exclude']))
|
if (isset($config['exclude']))
|
||||||
$excluded = array_merge($excluded, $config['exclude']);
|
$excluded = array_merge($excluded, $config['exclude']);
|
||||||
|
unset($config['include'], $config['exclude']);
|
||||||
|
|
||||||
// Calculate the actual inclusion set
|
// Calculate the actual inclusion set
|
||||||
$included = array_diff(array_merge($this->included, $included),
|
$included = array_diff(array_merge($this->included, $included),
|
||||||
@@ -169,6 +170,10 @@ class GridHelper extends AppHelper {
|
|||||||
$this->jqGrid_options['jqGridColumns']
|
$this->jqGrid_options['jqGridColumns']
|
||||||
= array_intersect_key($this->columns, array_flip($included));
|
= array_intersect_key($this->columns, array_flip($included));
|
||||||
|
|
||||||
|
// Make sure search fields are all part of the inclusion set
|
||||||
|
$this->jqGrid_options['search_fields']
|
||||||
|
= array_intersect($this->jqGrid_options['search_fields'], $included);
|
||||||
|
|
||||||
// As an exception to the normal config variables,
|
// As an exception to the normal config variables,
|
||||||
// handle 'rows' here. The reason is so that we
|
// handle 'rows' here. The reason is so that we
|
||||||
// ease the burden on views which have a list of
|
// ease the burden on views which have a list of
|
||||||
@@ -178,8 +183,17 @@ class GridHelper extends AppHelper {
|
|||||||
if (isset($config['rows'])) {
|
if (isset($config['rows'])) {
|
||||||
// Shrink the limit... user can always override
|
// Shrink the limit... user can always override
|
||||||
$this->id_list($config['rows'])->limit(10);
|
$this->id_list($config['rows'])->limit(10);
|
||||||
|
unset($config['rows']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// One more exception, as the search fields get
|
||||||
|
// defined, but not passed to jqGrid unless
|
||||||
|
// specifically requested.
|
||||||
|
if (isset($config['search']))
|
||||||
|
unset($config['search']);
|
||||||
|
else
|
||||||
|
unset($this->jqGrid_options['search_fields']);
|
||||||
|
|
||||||
// Figure out what controller we're using to
|
// Figure out what controller we're using to
|
||||||
// populate the grid via ajax, and set it.
|
// populate the grid via ajax, and set it.
|
||||||
$controller = $this->controller;
|
$controller = $this->controller;
|
||||||
|
|||||||
@@ -16,29 +16,31 @@ $unit = $lease['Unit'];
|
|||||||
if (isset($lease['Lease']))
|
if (isset($lease['Lease']))
|
||||||
$lease = $lease['Lease'];
|
$lease = $lease['Lease'];
|
||||||
|
|
||||||
$rows = array(array('ID', $lease['id']),
|
$rows = array();
|
||||||
array('Number', $lease['number']),
|
|
||||||
array('Lease Type', $lease_type['name']),
|
$rows[] = array('ID', $lease['id']);
|
||||||
array('Unit', $html->link($unit['name'],
|
$rows[] = array('Number', $lease['number']);
|
||||||
|
$rows[] = array('Lease Type', $lease_type['name']);
|
||||||
|
$rows[] = array('Unit', $html->link($unit['name'],
|
||||||
array('controller' => 'units',
|
array('controller' => 'units',
|
||||||
'action' => 'view',
|
'action' => 'view',
|
||||||
$unit['id']))),
|
$unit['id'])));
|
||||||
array('Customer', $html->link($customer['name'],
|
$rows[] = array('Customer', $html->link($customer['name'],
|
||||||
array('controller' => 'customers',
|
array('controller' => 'customers',
|
||||||
'action' => 'view',
|
'action' => 'view',
|
||||||
$customer['id']))),
|
$customer['id'])));
|
||||||
array('Lease_Date', FormatHelper::date($lease['lease_date'], true)),
|
$rows[] = array('Lease_Date', FormatHelper::date($lease['lease_date'], true));
|
||||||
array('Move-in Planned', FormatHelper::date($lease['movein_planned_date'], true)),
|
$rows[] = array('Move-in Planned', FormatHelper::date($lease['movein_planned_date'], true));
|
||||||
array('Move-in', FormatHelper::date($lease['movein_date'], true)),
|
$rows[] = array('Move-in', FormatHelper::date($lease['movein_date'], true));
|
||||||
array('Move-out', FormatHelper::date($lease['moveout_date'], true)),
|
$rows[] = array('Move-out', FormatHelper::date($lease['moveout_date'], true));
|
||||||
array('Move-out Planned', FormatHelper::date($lease['moveout_planned_date'], true)),
|
$rows[] = array('Move-out Planned', FormatHelper::date($lease['moveout_planned_date'], true));
|
||||||
array('Notice Given', FormatHelper::date($lease['notice_given_date'], true)),
|
$rows[] = array('Notice Given', FormatHelper::date($lease['notice_given_date'], true));
|
||||||
array('Notice Received', FormatHelper::date($lease['notice_received_date'], true)),
|
$rows[] = array('Notice Received', FormatHelper::date($lease['notice_received_date'], true));
|
||||||
array('Closed', FormatHelper::date($lease['close_date'], true)),
|
$rows[] = array('Closed', FormatHelper::date($lease['close_date'], true));
|
||||||
array('Deposit', FormatHelper::currency($lease['deposit'])),
|
$rows[] = array('Deposit', FormatHelper::currency($lease['deposit']));
|
||||||
array('Rent', FormatHelper::currency($lease['rent'])),
|
$rows[] = array('Rent', FormatHelper::currency($lease['rent']));
|
||||||
array('Paid Through', FormatHelper::date($lease['paid_through'], true)),
|
$rows[] = array('Paid Through', FormatHelper::date($lease['paid_through'], true));
|
||||||
array('Comment', $lease['comment']));
|
$rows[] = array('Comment', $lease['comment']);
|
||||||
|
|
||||||
|
|
||||||
echo $this->element('table',
|
echo $this->element('table',
|
||||||
@@ -79,15 +81,12 @@ echo '<div CLASS="detail supporting">' . "\n";
|
|||||||
* Lease Account History
|
* Lease Account History
|
||||||
*/
|
*/
|
||||||
|
|
||||||
echo $this->element('ledger_entries', array
|
echo $this->element('statement_entries', array
|
||||||
(// Element configuration
|
(// Grid configuration
|
||||||
'lease_id' => $lease['id'],
|
|
||||||
|
|
||||||
// Grid configuration
|
|
||||||
'config' => array
|
'config' => array
|
||||||
('caption' => 'Account',
|
('caption' => 'Account',
|
||||||
),
|
'filter' => array('lease_id' => $lease['id']),
|
||||||
));
|
)));
|
||||||
|
|
||||||
|
|
||||||
/* End "detail supporting" div */
|
/* End "detail supporting" div */
|
||||||
|
|||||||
78
views/ledger_entries/view.ctp
Normal file
78
views/ledger_entries/view.ctp
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
<?php /* -*- mode:PHP -*- */
|
||||||
|
|
||||||
|
echo '<div class="ledger-entry view">' . "\n";
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
**********************************************************************
|
||||||
|
**********************************************************************
|
||||||
|
**********************************************************************
|
||||||
|
* Ledger Entry Detail Main Section
|
||||||
|
*/
|
||||||
|
|
||||||
|
$transaction = $entry['Transaction'];
|
||||||
|
$ledger = $entry['Ledger'];
|
||||||
|
$account = $ledger['Account'];
|
||||||
|
$tender = $entry['Tender'];
|
||||||
|
$matching = $entry['MatchingEntry'];
|
||||||
|
$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('Amount', FormatHelper::currency($entry['amount']));
|
||||||
|
$rows[] = array('Tender', $html->link($tender['name'],
|
||||||
|
array('controller' => 'tenders',
|
||||||
|
'action' => 'view',
|
||||||
|
$tender['id'])));
|
||||||
|
$rows[] = array('Account', $html->link($account['name'],
|
||||||
|
array('controller' => 'accounts',
|
||||||
|
'action' => 'view',
|
||||||
|
$account['id'])));
|
||||||
|
$rows[] = array('Ledger', $html->link($ledger['name'],
|
||||||
|
array('controller' => 'ledgers',
|
||||||
|
'action' => 'view',
|
||||||
|
$ledger['id'])));
|
||||||
|
$rows[] = array('Cr/Dr', ($entry['crdr'] .
|
||||||
|
' (Matching ' . $matching['crdr'] . ': ' .
|
||||||
|
$html->link('#'.$matching['id'],
|
||||||
|
array('controller' => 'ledger_entries',
|
||||||
|
'action' => 'view',
|
||||||
|
$matching['id'])) .
|
||||||
|
')'));
|
||||||
|
$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";
|
||||||
|
|
||||||
|
echo '</div>' . "\n";
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
**********************************************************************
|
||||||
|
**********************************************************************
|
||||||
|
**********************************************************************
|
||||||
|
* Supporting Elements Section
|
||||||
|
*/
|
||||||
|
|
||||||
|
echo '<div CLASS="detail supporting">' . "\n";
|
||||||
|
|
||||||
|
|
||||||
|
/* End "detail supporting" div */
|
||||||
|
echo '</div>' . "\n";
|
||||||
|
|
||||||
|
/* End page div */
|
||||||
|
echo '</div>' . "\n";
|
||||||
@@ -15,14 +15,16 @@ $account = $ledger['Account'];
|
|||||||
if (isset($ledger['Ledger']))
|
if (isset($ledger['Ledger']))
|
||||||
$ledger = $ledger['Ledger'];
|
$ledger = $ledger['Ledger'];
|
||||||
|
|
||||||
$rows = array(array('ID', $ledger['id']),
|
$rows = array();
|
||||||
array('Account', $html->link($account['name'],
|
$rows[] = array('ID', $ledger['id']);
|
||||||
|
$rows[] = array('Name', $ledger['name']);
|
||||||
|
$rows[] = array('Account', $html->link($account['name'],
|
||||||
array('controller' => 'accounts',
|
array('controller' => 'accounts',
|
||||||
'action' => 'view',
|
'action' => 'view',
|
||||||
$account['id']))),
|
$account['id'])));
|
||||||
array('Sequence', $ledger['sequence']),
|
$rows[] = array('Sequence', $ledger['sequence']);
|
||||||
array('Status', $ledger['close_id'] ? 'Closed' : 'Open'),
|
$rows[] = array('Status', $ledger['close_id'] ? 'Closed' : 'Open');
|
||||||
array('Comment', $ledger['comment']));
|
$rows[] = array('Comment', $ledger['comment']);
|
||||||
|
|
||||||
echo $this->element('table',
|
echo $this->element('table',
|
||||||
array('class' => 'item ledger detail',
|
array('class' => 'item ledger detail',
|
||||||
@@ -63,16 +65,12 @@ echo '<div CLASS="detail supporting">' . "\n";
|
|||||||
* Ledger Entries
|
* Ledger Entries
|
||||||
*/
|
*/
|
||||||
|
|
||||||
echo $this->element('entries', array
|
echo $this->element('ledger_entries', array
|
||||||
(// Element configuration
|
(// Grid configuration
|
||||||
'ledger_id' => $ledger['id'],
|
|
||||||
'account_type' => $account['type'],
|
|
||||||
|
|
||||||
// Grid configuration
|
|
||||||
'config' => array
|
'config' => array
|
||||||
('caption' => "Ledger Entries",
|
('caption' => "Ledger Entries",
|
||||||
),
|
'filter' => array('ledger_id' => $ledger['id']),
|
||||||
));
|
)));
|
||||||
|
|
||||||
|
|
||||||
/* End "detail supporting" div */
|
/* End "detail supporting" div */
|
||||||
|
|||||||
@@ -103,8 +103,8 @@ echo $this->element('statement_entries', array
|
|||||||
// Grid configuration
|
// Grid configuration
|
||||||
'config' => array
|
'config' => array
|
||||||
('caption' => 'Entries Applied',
|
('caption' => 'Entries Applied',
|
||||||
),
|
//'filter' => array('statement_entry_id' => $entry['id']),
|
||||||
));
|
)));
|
||||||
|
|
||||||
|
|
||||||
/* End "detail supporting" div */
|
/* End "detail supporting" div */
|
||||||
|
|||||||
@@ -1,33 +1,34 @@
|
|||||||
<?php /* -*- mode:PHP -*- */
|
<?php /* -*- mode:PHP -*- */
|
||||||
|
|
||||||
echo '<div class="monetary-source view">' . "\n";
|
echo '<div class="tender view">' . "\n";
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
* MonetarySource Detail Main Section
|
* Tender Detail Main Section
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$source = $monetarySource['MonetarySource'];
|
$tender = $tender['Tender'];
|
||||||
|
|
||||||
$rows = array(array('ID', $source['id']),
|
$rows = array();
|
||||||
array('Name', $source['name']),
|
$rows[] = array('ID', $tender['id']);
|
||||||
array('Data 1', $source['data1']),
|
$rows[] = array('Name', $tender['name']);
|
||||||
array('Data 2', $source['data2']),
|
$rows[] = array('Data 1', $tender['data1']);
|
||||||
array('Data 3', $source['data3']),
|
$rows[] = array('Data 2', $tender['data2']);
|
||||||
array('Data 4', $source['data4']),
|
$rows[] = array('Data 3', $tender['data3']);
|
||||||
array('Comment', $source['comment']));
|
$rows[] = array('Data 4', $tender['data4']);
|
||||||
|
$rows[] = array('Comment', $tender['comment']);
|
||||||
|
|
||||||
echo $this->element('table',
|
echo $this->element('table',
|
||||||
array('class' => 'item monetary-source detail',
|
array('class' => 'item tender detail',
|
||||||
'caption' => 'Monetary Source Detail',
|
'caption' => 'Legal Tender Detail',
|
||||||
'rows' => $rows,
|
'rows' => $rows,
|
||||||
'column_class' => array('field', 'value')));
|
'column_class' => array('field', 'value')));
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* MonetarySource Info Box
|
* Tender Info Box
|
||||||
*/
|
*/
|
||||||
|
|
||||||
echo '<div class="infobox">' . "\n";
|
echo '<div class="infobox">' . "\n";
|
||||||
@@ -56,14 +57,11 @@ echo '<div CLASS="detail supporting">' . "\n";
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
echo $this->element('ledger_entries', array
|
echo $this->element('ledger_entries', array
|
||||||
(// Element configuration
|
(// Grid configuration
|
||||||
'monetary_source_id' => $source['id'],
|
|
||||||
|
|
||||||
// Grid configuration
|
|
||||||
'config' => array
|
'config' => array
|
||||||
('caption' => "Ledger Entries",
|
('caption' => "Ledger Entries",
|
||||||
),
|
'filter' => array('tender_id' => $tender['id']),
|
||||||
));
|
)));
|
||||||
|
|
||||||
|
|
||||||
/* End "detail supporting" div */
|
/* End "detail supporting" div */
|
||||||
@@ -9,10 +9,26 @@ echo '<div class="transaction view">' . "\n";
|
|||||||
* Transaction Detail Main Section
|
* Transaction Detail Main Section
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$rows = array(array('ID', $transaction['Transaction']['id']),
|
$account = $transaction['Account'];
|
||||||
array('Timestamp', FormatHelper::datetime($transaction['Transaction']['stamp'])),
|
$ledger = $transaction['Ledger'];
|
||||||
array('Due', FormatHelper::date($transaction['Transaction']['due_date'])),
|
|
||||||
array('Comment', $transaction['Transaction']['comment']));
|
if (isset($transaction['Transaction']))
|
||||||
|
$transaction = $transaction['Transaction'];
|
||||||
|
|
||||||
|
$rows = array();
|
||||||
|
$rows[] = array('ID', $transaction['id']);
|
||||||
|
$rows[] = array('Type', $transaction['type']);
|
||||||
|
$rows[] = array('Timestamp', FormatHelper::datetime($transaction['stamp']));
|
||||||
|
$rows[] = array('Amount', FormatHelper::currency($transaction['amount']));
|
||||||
|
$rows[] = array('Account', $html->link($account['name'],
|
||||||
|
array('controller' => 'accounts',
|
||||||
|
'action' => 'view',
|
||||||
|
$account['id'])));
|
||||||
|
$rows[] = array('Ledger', $html->link($ledger['name'],
|
||||||
|
array('controller' => 'ledgers',
|
||||||
|
'action' => 'view',
|
||||||
|
$ledger['id'])));
|
||||||
|
$rows[] = array('Comment', $transaction['comment']);
|
||||||
|
|
||||||
echo $this->element('table',
|
echo $this->element('table',
|
||||||
array('class' => 'item transaction detail',
|
array('class' => 'item transaction detail',
|
||||||
@@ -27,7 +43,7 @@ echo $this->element('table',
|
|||||||
|
|
||||||
echo '<div class="infobox">' . "\n";
|
echo '<div class="infobox">' . "\n";
|
||||||
$rows = array();
|
$rows = array();
|
||||||
$rows[] = array('Total:', FormatHelper::currency($total));
|
$rows[] = array('Total:', FormatHelper::currency($transaction['amount']));
|
||||||
echo $this->element('table',
|
echo $this->element('table',
|
||||||
array('class' => 'summary',
|
array('class' => 'summary',
|
||||||
'rows' => $rows,
|
'rows' => $rows,
|
||||||
@@ -48,24 +64,29 @@ echo '<div CLASS="detail supporting">' . "\n";
|
|||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Entries
|
* Statement Entries
|
||||||
|
*/
|
||||||
|
|
||||||
|
echo $this->element('statement_entries', array
|
||||||
|
(// Grid configuration
|
||||||
|
'config' => array
|
||||||
|
(
|
||||||
|
'caption' => 'Statement Entries',
|
||||||
|
'filter' => array('transaction_id' => $transaction['id']),
|
||||||
|
)));
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* Ledger Entries
|
||||||
*/
|
*/
|
||||||
|
|
||||||
echo $this->element('ledger_entries', array
|
echo $this->element('ledger_entries', array
|
||||||
(// Element configuration
|
(// Grid configuration
|
||||||
'transaction_id' => $transaction['Transaction']['id'],
|
|
||||||
|
|
||||||
// Default for grouping by transaction is already false,
|
|
||||||
// but we'll get explicit here, since we clearly want to
|
|
||||||
// see all of the ledger entries not grouped by tx.
|
|
||||||
'group_by_tx' => false,
|
|
||||||
|
|
||||||
// Grid configuration
|
|
||||||
'config' => array
|
'config' => array
|
||||||
(
|
(
|
||||||
'caption' => 'Entries in Transaction',
|
'caption' => 'Ledger Entries',
|
||||||
),
|
'filter' => array('transaction_id' => $transaction['id']),
|
||||||
));
|
)));
|
||||||
|
|
||||||
|
|
||||||
/* End "detail supporting" div */
|
/* End "detail supporting" div */
|
||||||
|
|||||||
@@ -16,12 +16,13 @@ $unit_size = $unit['UnitSize'];
|
|||||||
if (isset($unit['Unit']))
|
if (isset($unit['Unit']))
|
||||||
$unit = $unit['Unit'];
|
$unit = $unit['Unit'];
|
||||||
|
|
||||||
$rows = array(array('Name', $unit['name']),
|
$rows = array();
|
||||||
array('Status', $unit['status']),
|
$rows[] = array('Name', $unit['name']);
|
||||||
array('Size', $unit_size['name']),
|
$rows[] = array('Status', $unit['status']);
|
||||||
array('Deposit', FormatHelper::currency($unit['deposit'])),
|
$rows[] = array('Size', $unit_size['name']);
|
||||||
array('Rent', FormatHelper::currency($unit['rent'])),
|
$rows[] = array('Deposit', FormatHelper::currency($unit['deposit']));
|
||||||
array('Comment', $unit['comment']));
|
$rows[] = array('Rent', FormatHelper::currency($unit['rent']));
|
||||||
|
$rows[] = array('Comment', $unit['comment']);
|
||||||
|
|
||||||
echo $this->element('table',
|
echo $this->element('table',
|
||||||
array('class' => 'item unit detail',
|
array('class' => 'item unit detail',
|
||||||
@@ -62,9 +63,10 @@ echo '<div CLASS="detail supporting">' . "\n";
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
echo $this->element('leases', array
|
echo $this->element('leases', array
|
||||||
('config' => array
|
(// Grid configuration
|
||||||
|
'config' => array
|
||||||
('caption' => 'Lease History',
|
('caption' => 'Lease History',
|
||||||
'rows' => $leases,
|
'filter' => array('Unit.id' => $unit['id']),
|
||||||
)));
|
)));
|
||||||
|
|
||||||
|
|
||||||
@@ -74,19 +76,15 @@ echo $this->element('leases', array
|
|||||||
|
|
||||||
if (isset($current_lease['id'])) {
|
if (isset($current_lease['id'])) {
|
||||||
echo $this->element('ledger_entries', array
|
echo $this->element('ledger_entries', array
|
||||||
(// Element configuration
|
(// Grid configuration
|
||||||
'ar_account' => true,
|
|
||||||
'lease_id' => $current_lease['id'],
|
|
||||||
|
|
||||||
// Grid configuration
|
|
||||||
'config' => array
|
'config' => array
|
||||||
(
|
(
|
||||||
'caption' =>
|
'caption' =>
|
||||||
('Current Lease Account ('
|
('Current Lease Account ('
|
||||||
. $current_lease['Customer']['name']
|
. $current_lease['Customer']['name']
|
||||||
. ')'),
|
. ')'),
|
||||||
),
|
'filter' => array('Lease.id' => $current_lease['id']),
|
||||||
));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -209,6 +209,12 @@ div.related {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Debugging */
|
/* Debugging */
|
||||||
|
.pr-caller {
|
||||||
|
color: #000;
|
||||||
|
background: #c8c;
|
||||||
|
/* padding-top: 0.2em; */
|
||||||
|
padding: 0.1em;
|
||||||
|
}
|
||||||
pre {
|
pre {
|
||||||
color: #000;
|
color: #000;
|
||||||
background: #f0f0f0;
|
background: #f0f0f0;
|
||||||
|
|||||||
@@ -126,7 +126,6 @@ div.detail.supporting { clear : both;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
div.infobox { float: right;
|
div.infobox { float: right;
|
||||||
width: 39%;
|
|
||||||
margin-top: 2.0em;
|
margin-top: 2.0em;
|
||||||
margin-right: 0.5em;
|
margin-right: 0.5em;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user