Very, very early snapshot. Some models are working, and I have a controller for testing. Everything is subject to change. I _do_ have a working tenant ledger though, so it's worth a snapshot.
git-svn-id: file:///svn-source/pmgr/branches/initial_20090526/site@15 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
36
controllers/transactions_controller.php
Normal file
36
controllers/transactions_controller.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class TransactionsController extends AppController {
|
||||||
|
var $helpers = array('Html');
|
||||||
|
var $uses = array('Contact', 'Charge', 'Payment', 'Receipt');
|
||||||
|
|
||||||
|
function ledger($id = null) {
|
||||||
|
if (!$id) {
|
||||||
|
$this->Session->setFlash(__('Invalid Item.', true));
|
||||||
|
$this->redirect(array('action'=>''));
|
||||||
|
}
|
||||||
|
$this->Charge->recursive = 0;
|
||||||
|
//$ledgers = array($this->Charge->read(null, $id));
|
||||||
|
$this->set('ledgers', $this->Charge->find('all'));
|
||||||
|
//$this->set(compact('ledgers', 'tables'));
|
||||||
|
}
|
||||||
|
|
||||||
|
function contact($id = null) {
|
||||||
|
if (!$id) {
|
||||||
|
$this->Session->setFlash(__('Invalid Item.', true));
|
||||||
|
$this->redirect(array('action'=>''));
|
||||||
|
}
|
||||||
|
$this->Contact->recursive = 4;
|
||||||
|
$this->Contact->Lease->LeaseType->unbindModel(array('hasMany' => array('Lease')));
|
||||||
|
$this->Contact->Lease->Charge->unbindModel(array('belongsTo' => array('Lease')));
|
||||||
|
$this->Contact->Lease->Charge->ChargeType->unbindModel(array('hasMany' => array('Charge')));
|
||||||
|
$this->Contact->Lease->Charge->Receipt->unbindModel(array('hasMany' => array('ChargesReceipt')));
|
||||||
|
|
||||||
|
//$ledgers = array($this->Charge->read(null, $id));
|
||||||
|
//$this->set('ledgers', $this->Contact->Lease->Charge->find('all'));
|
||||||
|
//$this->set(compact('ledgers', 'tables'));
|
||||||
|
$this->set('tenant', $this->Contact->read(null, $id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
53
models/charge.php
Normal file
53
models/charge.php
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
class Charge extends AppModel {
|
||||||
|
|
||||||
|
var $name = 'Charge';
|
||||||
|
var $validate = array(
|
||||||
|
'id' => array('numeric'),
|
||||||
|
'charge_type_id' => array('numeric'),
|
||||||
|
'lease_id' => array('numeric'),
|
||||||
|
'charge_date' => array('date'),
|
||||||
|
'charge_to_date' => array('date'),
|
||||||
|
'due_date' => array('date'),
|
||||||
|
'amount' => array('money'),
|
||||||
|
'tax' => array('money'),
|
||||||
|
'total' => array('money')
|
||||||
|
);
|
||||||
|
|
||||||
|
var $belongsTo = array(
|
||||||
|
'ChargeType' => array(
|
||||||
|
'className' => 'ChargeType',
|
||||||
|
'foreignKey' => 'charge_type_id',
|
||||||
|
'conditions' => '',
|
||||||
|
'fields' => '',
|
||||||
|
'order' => ''
|
||||||
|
),
|
||||||
|
'Lease' => array(
|
||||||
|
'className' => 'Lease',
|
||||||
|
'foreignKey' => 'lease_id',
|
||||||
|
'conditions' => '',
|
||||||
|
'fields' => '',
|
||||||
|
'order' => ''
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
var $hasAndBelongsToMany = array(
|
||||||
|
'Receipt' => array(
|
||||||
|
'className' => 'Receipt',
|
||||||
|
'joinTable' => 'charges_receipts',
|
||||||
|
'foreignKey' => 'charge_id',
|
||||||
|
'associationForeignKey' => 'receipt_id',
|
||||||
|
'unique' => true,
|
||||||
|
'conditions' => '',
|
||||||
|
'fields' => '',
|
||||||
|
'order' => '',
|
||||||
|
'limit' => '',
|
||||||
|
'offset' => '',
|
||||||
|
'finderQuery' => '',
|
||||||
|
'deleteQuery' => '',
|
||||||
|
'insertQuery' => ''
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
39
models/charge_type.php
Normal file
39
models/charge_type.php
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
class ChargeType extends AppModel {
|
||||||
|
|
||||||
|
var $name = 'ChargeType';
|
||||||
|
var $validate = array(
|
||||||
|
'id' => array('numeric'),
|
||||||
|
'name' => array('notempty'),
|
||||||
|
'account_id' => array('numeric')
|
||||||
|
);
|
||||||
|
|
||||||
|
//The Associations below have been created with all possible keys, those that are not needed can be removed
|
||||||
|
/* var $belongsTo = array( */
|
||||||
|
/* 'Account' => array( */
|
||||||
|
/* 'className' => 'Account', */
|
||||||
|
/* 'foreignKey' => 'account_id', */
|
||||||
|
/* 'conditions' => '', */
|
||||||
|
/* 'fields' => '', */
|
||||||
|
/* 'order' => '' */
|
||||||
|
/* ) */
|
||||||
|
/* ); */
|
||||||
|
|
||||||
|
var $hasMany = array(
|
||||||
|
'Charge' => array(
|
||||||
|
'className' => 'Charge',
|
||||||
|
'foreignKey' => 'charge_type_id',
|
||||||
|
'dependent' => false,
|
||||||
|
'conditions' => '',
|
||||||
|
'fields' => '',
|
||||||
|
'order' => '',
|
||||||
|
'limit' => '',
|
||||||
|
'offset' => '',
|
||||||
|
'exclusive' => '',
|
||||||
|
'finderQuery' => '',
|
||||||
|
'counterQuery' => ''
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
46
models/contact.php
Normal file
46
models/contact.php
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
class Contact extends AppModel {
|
||||||
|
|
||||||
|
var $name = 'Contact';
|
||||||
|
var $validate = array(
|
||||||
|
'id' => array('numeric'),
|
||||||
|
'display_name' => array('notempty'),
|
||||||
|
'id_federal' => array('ssn'),
|
||||||
|
'id_exp' => array('date')
|
||||||
|
);
|
||||||
|
|
||||||
|
var $hasAndBelongsToMany = array(
|
||||||
|
'Lease' => array(
|
||||||
|
'className' => 'Lease',
|
||||||
|
'joinTable' => 'contacts_leases',
|
||||||
|
'foreignKey' => 'contact_id',
|
||||||
|
'associationForeignKey' => 'lease_id',
|
||||||
|
'unique' => true,
|
||||||
|
'conditions' => '',
|
||||||
|
'fields' => '',
|
||||||
|
'order' => '',
|
||||||
|
'limit' => '',
|
||||||
|
'offset' => '',
|
||||||
|
'finderQuery' => '',
|
||||||
|
'deleteQuery' => '',
|
||||||
|
'insertQuery' => ''
|
||||||
|
),
|
||||||
|
'ContactEmail' => array(
|
||||||
|
'className' => 'ContactEmail',
|
||||||
|
'joinTable' => 'contacts_methods',
|
||||||
|
'foreignKey' => 'contact_id',
|
||||||
|
'associationForeignKey' => 'method_id',
|
||||||
|
'unique' => true,
|
||||||
|
'conditions' => "ContactsMethod.method = 'EMAIL'",
|
||||||
|
'fields' => '',
|
||||||
|
'order' => '',
|
||||||
|
'limit' => '',
|
||||||
|
'offset' => '',
|
||||||
|
'finderQuery' => '',
|
||||||
|
'deleteQuery' => '',
|
||||||
|
'insertQuery' => ''
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
30
models/contact_email.php
Normal file
30
models/contact_email.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
class ContactEmail extends AppModel {
|
||||||
|
|
||||||
|
var $name = 'ContactEmail';
|
||||||
|
var $validate = array(
|
||||||
|
'id' => array('numeric'),
|
||||||
|
'email' => array('email')
|
||||||
|
);
|
||||||
|
|
||||||
|
//The Associations below have been created with all possible keys, those that are not needed can be removed
|
||||||
|
var $hasAndBelongsToMany = array(
|
||||||
|
'Contact' => array(
|
||||||
|
'className' => 'Contact',
|
||||||
|
'joinTable' => 'contacts_methods',
|
||||||
|
'foreignKey' => 'method_id',
|
||||||
|
'associationForeignKey' => 'contact_id',
|
||||||
|
'unique' => true,
|
||||||
|
'conditions' => "ContactsMethod.method = 'EMAIL'",
|
||||||
|
'fields' => '',
|
||||||
|
'order' => '',
|
||||||
|
'limit' => '',
|
||||||
|
'offset' => '',
|
||||||
|
'finderQuery' => '',
|
||||||
|
'deleteQuery' => '',
|
||||||
|
'insertQuery' => ''
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
85
models/lease.php
Normal file
85
models/lease.php
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
class Lease extends AppModel {
|
||||||
|
|
||||||
|
var $name = 'Lease';
|
||||||
|
var $validate = array(
|
||||||
|
'id' => array('numeric'),
|
||||||
|
'number' => array('alphanumeric'),
|
||||||
|
'lease_type_id' => array('numeric'),
|
||||||
|
'unit_id' => array('numeric'),
|
||||||
|
'late_schedule_id' => array('numeric'),
|
||||||
|
'lease_date' => array('date'),
|
||||||
|
'movein_planed_date' => array('date'),
|
||||||
|
'movein_date' => array('date'),
|
||||||
|
'moveout_date' => array('date'),
|
||||||
|
'moveout_planed_date' => array('date'),
|
||||||
|
'notice_given_date' => array('date'),
|
||||||
|
'notice_received_date' => array('date'),
|
||||||
|
'close_date' => array('date'),
|
||||||
|
'deposit' => array('money'),
|
||||||
|
'amount' => array('money'),
|
||||||
|
'next_amount' => array('money'),
|
||||||
|
'next_amount_date' => array('date')
|
||||||
|
);
|
||||||
|
|
||||||
|
//The Associations below have been created with all possible keys, those that are not needed can be removed
|
||||||
|
var $belongsTo = array(
|
||||||
|
'LeaseType' => array(
|
||||||
|
'className' => 'LeaseType',
|
||||||
|
'foreignKey' => 'lease_type_id',
|
||||||
|
'conditions' => '',
|
||||||
|
'fields' => '',
|
||||||
|
'order' => ''
|
||||||
|
),
|
||||||
|
'Unit' => array(
|
||||||
|
'className' => 'Unit',
|
||||||
|
'foreignKey' => 'unit_id',
|
||||||
|
'conditions' => '',
|
||||||
|
'fields' => '',
|
||||||
|
'order' => ''
|
||||||
|
),
|
||||||
|
'LateSchedule' => array(
|
||||||
|
'className' => 'LateSchedule',
|
||||||
|
'foreignKey' => 'late_schedule_id',
|
||||||
|
'conditions' => '',
|
||||||
|
'fields' => '',
|
||||||
|
'order' => ''
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
var $hasMany = array(
|
||||||
|
'Charge' => array(
|
||||||
|
'className' => 'Charge',
|
||||||
|
'foreignKey' => 'lease_id',
|
||||||
|
'dependent' => false,
|
||||||
|
'conditions' => '',
|
||||||
|
'fields' => '',
|
||||||
|
'order' => '',
|
||||||
|
'limit' => '',
|
||||||
|
'offset' => '',
|
||||||
|
'exclusive' => '',
|
||||||
|
'finderQuery' => '',
|
||||||
|
'counterQuery' => ''
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
var $hasAndBelongsToMany = array(
|
||||||
|
'Contact' => array(
|
||||||
|
'className' => 'Contact',
|
||||||
|
'joinTable' => 'contacts_leases',
|
||||||
|
'foreignKey' => 'lease_id',
|
||||||
|
'associationForeignKey' => 'contact_id',
|
||||||
|
'unique' => true,
|
||||||
|
'conditions' => '',
|
||||||
|
'fields' => '',
|
||||||
|
'order' => '',
|
||||||
|
'limit' => '',
|
||||||
|
'offset' => '',
|
||||||
|
'finderQuery' => '',
|
||||||
|
'deleteQuery' => '',
|
||||||
|
'insertQuery' => ''
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
28
models/lease_type.php
Normal file
28
models/lease_type.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
class LeaseType extends AppModel {
|
||||||
|
|
||||||
|
var $name = 'LeaseType';
|
||||||
|
var $validate = array(
|
||||||
|
'id' => array('numeric'),
|
||||||
|
'name' => array('notempty')
|
||||||
|
);
|
||||||
|
|
||||||
|
//The Associations below have been created with all possible keys, those that are not needed can be removed
|
||||||
|
var $hasMany = array(
|
||||||
|
'Lease' => array(
|
||||||
|
'className' => 'Lease',
|
||||||
|
'foreignKey' => 'lease_type_id',
|
||||||
|
'dependent' => false,
|
||||||
|
'conditions' => '',
|
||||||
|
'fields' => '',
|
||||||
|
'order' => '',
|
||||||
|
'limit' => '',
|
||||||
|
'offset' => '',
|
||||||
|
'exclusive' => '',
|
||||||
|
'finderQuery' => '',
|
||||||
|
'counterQuery' => ''
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
31
models/payment.php
Normal file
31
models/payment.php
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
class Payment extends AppModel {
|
||||||
|
|
||||||
|
var $name = 'Payment';
|
||||||
|
var $validate = array(
|
||||||
|
'id' => array('numeric'),
|
||||||
|
'receipt_id' => array('numeric'),
|
||||||
|
'payment_type_id' => array('numeric'),
|
||||||
|
'amount' => array('money')
|
||||||
|
);
|
||||||
|
|
||||||
|
//The Associations below have been created with all possible keys, those that are not needed can be removed
|
||||||
|
var $belongsTo = array(
|
||||||
|
'Receipt' => array(
|
||||||
|
'className' => 'Receipt',
|
||||||
|
'foreignKey' => 'receipt_id',
|
||||||
|
'conditions' => '',
|
||||||
|
'fields' => '',
|
||||||
|
'order' => ''
|
||||||
|
),
|
||||||
|
'PaymentType' => array(
|
||||||
|
'className' => 'PaymentType',
|
||||||
|
'foreignKey' => 'payment_type_id',
|
||||||
|
'conditions' => '',
|
||||||
|
'fields' => '',
|
||||||
|
'order' => ''
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
29
models/payment_type.php
Normal file
29
models/payment_type.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
class PaymentType extends AppModel {
|
||||||
|
|
||||||
|
var $name = 'PaymentType';
|
||||||
|
var $validate = array(
|
||||||
|
'id' => array('numeric'),
|
||||||
|
'name' => array('notempty'),
|
||||||
|
'tillable' => array('boolean')
|
||||||
|
);
|
||||||
|
|
||||||
|
//The Associations below have been created with all possible keys, those that are not needed can be removed
|
||||||
|
var $hasMany = array(
|
||||||
|
'Payment' => array(
|
||||||
|
'className' => 'Payment',
|
||||||
|
'foreignKey' => 'payment_type_id',
|
||||||
|
'dependent' => false,
|
||||||
|
'conditions' => '',
|
||||||
|
'fields' => '',
|
||||||
|
'order' => '',
|
||||||
|
'limit' => '',
|
||||||
|
'offset' => '',
|
||||||
|
'exclusive' => '',
|
||||||
|
'finderQuery' => '',
|
||||||
|
'counterQuery' => ''
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
46
models/receipt.php
Normal file
46
models/receipt.php
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
class Receipt extends AppModel {
|
||||||
|
|
||||||
|
var $name = 'Receipt';
|
||||||
|
var $validate = array(
|
||||||
|
'id' => array('numeric'),
|
||||||
|
'stamp' => array('time')
|
||||||
|
);
|
||||||
|
|
||||||
|
//The Associations below have been created with all possible keys, those that are not needed can be removed
|
||||||
|
var $hasMany = array(
|
||||||
|
'Payment' => array(
|
||||||
|
'className' => 'Payment',
|
||||||
|
'foreignKey' => 'receipt_id',
|
||||||
|
'dependent' => false,
|
||||||
|
'conditions' => '',
|
||||||
|
'fields' => '',
|
||||||
|
'order' => '',
|
||||||
|
'limit' => '',
|
||||||
|
'offset' => '',
|
||||||
|
'exclusive' => '',
|
||||||
|
'finderQuery' => '',
|
||||||
|
'counterQuery' => ''
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
var $hasAndBelongsToMany = array(
|
||||||
|
'Charge' => array(
|
||||||
|
'className' => 'Charge',
|
||||||
|
'joinTable' => 'charges_receipts',
|
||||||
|
'foreignKey' => 'receipt_id',
|
||||||
|
'associationForeignKey' => 'charge_id',
|
||||||
|
'unique' => true,
|
||||||
|
'conditions' => '',
|
||||||
|
'fields' => '',
|
||||||
|
'order' => '',
|
||||||
|
'limit' => '',
|
||||||
|
'offset' => '',
|
||||||
|
'finderQuery' => '',
|
||||||
|
'deleteQuery' => '',
|
||||||
|
'insertQuery' => ''
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
66
views/transactions/contact.ctp
Normal file
66
views/transactions/contact.ctp
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<?php /* -*- mode:PHP -*- */ ?>
|
||||||
|
|
||||||
|
<div class="contacts view">
|
||||||
|
<h2><?php __('Contact'); ?></h2>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
function currency($number) {
|
||||||
|
if ($number < 0) {
|
||||||
|
return "($ " . number_format(-1*$number, 2) . ")";
|
||||||
|
} else {
|
||||||
|
return "$ " . number_format($number, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$rows = array();
|
||||||
|
foreach($tenant['Contact'] AS $col => $val) {
|
||||||
|
$rows[] = array(array($col, 'width=1%'), $val);
|
||||||
|
}
|
||||||
|
echo('<table cellpadding="0" cellspacing="0">' . "\n");
|
||||||
|
echo(' <CAPTION>Tenant Info</CAPTION>' . "\n");
|
||||||
|
echo $html->tableCells($rows, null, array('class' => "altrow"));
|
||||||
|
echo('</table>' . "\n");
|
||||||
|
|
||||||
|
$grand_total = 0;
|
||||||
|
foreach($tenant['Lease'] AS $lease) {
|
||||||
|
$headers = array('Date', /*'Through',*/ /*'Charge/Receipt'*/'ID', 'Type', 'Comment', 'Amount', 'Total');
|
||||||
|
|
||||||
|
$rows = array();
|
||||||
|
$running_total = 0;
|
||||||
|
foreach($lease['Charge'] AS $charge) {
|
||||||
|
$amount = $charge['total'];
|
||||||
|
$running_total += $amount;
|
||||||
|
$rows[] = array(date_format(date_create($charge['charge_date']), 'm-d-Y') . ' - ' .
|
||||||
|
date_format(date_create($charge['charge_to_date']), 'm-d-Y'),
|
||||||
|
'#'.$charge['id'],
|
||||||
|
$charge['ChargeType']['name'],
|
||||||
|
$charge['comment'],
|
||||||
|
currency($amount),
|
||||||
|
currency($running_total));
|
||||||
|
|
||||||
|
foreach ($charge['Receipt'] AS $receipt) {
|
||||||
|
$amount = -1 * $receipt['ChargesReceipt']['amount'];
|
||||||
|
$running_total += $amount;
|
||||||
|
$rows[] = array(' -- ' .date_format(date_create($receipt['stamp']), 'm-d-Y'),
|
||||||
|
//null,
|
||||||
|
'#'.$receipt['id'],
|
||||||
|
'Receipt',
|
||||||
|
$receipt['comment'],
|
||||||
|
currency($amount),
|
||||||
|
currency($running_total));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$grand_total += $running_total;
|
||||||
|
|
||||||
|
echo('<table cellpadding="0" cellspacing="0">' . "\n");
|
||||||
|
echo(' <CAPTION>Lease #'.$lease['number'].' (Unit '.$lease['Unit']['name'].')</CAPTION>' . "\n");
|
||||||
|
echo $html->tableHeaders($headers);
|
||||||
|
echo $html->tableCells($rows, null, array('class' => "altrow"));
|
||||||
|
echo('</table>' . "\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<DIV ALIGN=RIGHT><H3>Grand Total: <?php echo currency($grand_total); ?></H3></DIV>
|
||||||
|
</div>
|
||||||
53
views/transactions/ledger.ctp
Normal file
53
views/transactions/ledger.ctp
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?php /* -*- mode:PHP -*- */ ?>
|
||||||
|
|
||||||
|
<div class="ledgers view">
|
||||||
|
<h2><?php __('Ledgers'); ?></h2>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
foreach($ledgers AS $ledger) {
|
||||||
|
foreach ($ledger AS $tablename => $table) {
|
||||||
|
|
||||||
|
if (array_key_exists(0, $table)) {
|
||||||
|
// Horizontal table (multiple items)
|
||||||
|
$headers = array_keys($table[0]);
|
||||||
|
|
||||||
|
//$rows = array_map('array_values', $table);
|
||||||
|
$rows = array();
|
||||||
|
//echo("<PRE>table:\n"); print_r($table); echo("</PRE>\n");
|
||||||
|
foreach ($table as $row) {
|
||||||
|
//echo("<PRE>row:\n"); print_r($row); echo("</PRE>\n");
|
||||||
|
$rows[] = array_values($row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Vertical table (one item)
|
||||||
|
$headers = array('Field', 'Value');
|
||||||
|
|
||||||
|
$rows = array();
|
||||||
|
foreach ($table as $col => $val) {
|
||||||
|
$rows[] = array($col, $val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($rows AS &$row) {
|
||||||
|
foreach ($row AS &$cell) {
|
||||||
|
if (is_array($cell))
|
||||||
|
$cell = "<ARRAY>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//echo("<PRE>headers:\n"); print_r($headers); echo("</PRE>\n");
|
||||||
|
//echo("<PRE>rows:\n"); print_r($rows); echo("</PRE>\n");
|
||||||
|
?>
|
||||||
|
<table cellpadding="0" cellspacing="0">
|
||||||
|
<CAPTION><?php echo $tablename ?></CAPTION>
|
||||||
|
<?php
|
||||||
|
echo $html->tableHeaders($headers);
|
||||||
|
echo $html->tableCells($rows, null, array('class' => "altrow"));
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
</div>
|
||||||
58
views/transactions/ledger_1.ctp
Normal file
58
views/transactions/ledger_1.ctp
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<div class="ledgers view">
|
||||||
|
<h2><?php __('Ledgers'); ?></h2>
|
||||||
|
|
||||||
|
<table cellpadding="0" cellspacing="0">
|
||||||
|
<?php
|
||||||
|
if (isset($paginator)) {
|
||||||
|
echo $paginator->counter(array(
|
||||||
|
'format' => __('Page %page% of %pages%, showing %current% records (%start% - %end%) of %count% total', true)));
|
||||||
|
|
||||||
|
$cells = array($paginator->sort('id'),
|
||||||
|
$paginator->sort('charge_type_id'),
|
||||||
|
$paginator->sort('lease_id'),
|
||||||
|
$paginator->sort('charge_date'),
|
||||||
|
$paginator->sort('charge_to_date'),
|
||||||
|
$paginator->sort('due_date'),
|
||||||
|
$paginator->sort('amount'),
|
||||||
|
$paginator->sort('tax'),
|
||||||
|
$paginator->sort('total'),
|
||||||
|
$paginator->sort('comment'));
|
||||||
|
} else {
|
||||||
|
$cells = array('Id', 'Type', 'Lease', 'Date', 'Through', 'Due', 'Amount', 'Tax', 'Total', 'Comment');
|
||||||
|
}
|
||||||
|
echo $html->tableHeaders($cells);
|
||||||
|
|
||||||
|
$cells = array();
|
||||||
|
foreach ($ledgers as $ledger) {
|
||||||
|
$cells[] = array($html->link($ledger['Charge']['id'],
|
||||||
|
array('controller' => 'transactions',
|
||||||
|
'action' => 'view',
|
||||||
|
$ledger['Charge']['id'])),
|
||||||
|
$ledger['Charge']['charge_type_id'],
|
||||||
|
$ledger['Charge']['lease_id'],
|
||||||
|
$ledger['Charge']['charge_date'],
|
||||||
|
$ledger['Charge']['charge_to_date'],
|
||||||
|
$ledger['Charge']['due_date'],
|
||||||
|
$ledger['Charge']['amount'],
|
||||||
|
$ledger['Charge']['tax'],
|
||||||
|
$ledger['Charge']['total'],
|
||||||
|
$ledger['Charge']['comment']);
|
||||||
|
}
|
||||||
|
echo $html->tableCells($cells, null, array('class' => "altrow"));
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if (isset($paginator)) {
|
||||||
|
echo('<div class="paging">' . "\n");
|
||||||
|
echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));
|
||||||
|
echo(' | ');
|
||||||
|
echo $paginator->numbers();
|
||||||
|
echo(' | ');
|
||||||
|
echo $paginator->next(__('next', true).' >>', array(), null, array('class'=>'disabled'));
|
||||||
|
echo('</div>' . "\n");
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
</DIV>
|
||||||
Reference in New Issue
Block a user