diff --git a/controllers/ledger_entries_controller.php b/controllers/ledger_entries_controller.php index 07a4b1d..aad81e4 100644 --- a/controllers/ledger_entries_controller.php +++ b/controllers/ledger_entries_controller.php @@ -298,9 +298,7 @@ class LedgerEntriesController extends AppController { 'Lease.id', ), - 'fields' => array('LedgerEntry.id', - 'LedgerEntry.amount', - 'LedgerEntry.comment'), + 'fields' => array('LedgerEntry.*'), 'conditions' => array('LedgerEntry.id' => $id), )); diff --git a/models/ledger_entry.php b/models/ledger_entry.php index 8578197..bfce372 100644 --- a/models/ledger_entry.php +++ b/models/ledger_entry.php @@ -91,7 +91,7 @@ class LedgerEntry extends AppModel { * query the ledger/account to find it out. */ function ledgerContextFields($ledger_id = null, $account_type = null) { - $fields = array('id', 'name', 'comment', 'amount'); + $fields = array('id', 'effective_date', 'through_date', 'comment', 'amount'); if (isset($ledger_id)) { $fields[] = ("IF(LedgerEntry.debit_ledger_id = $ledger_id," . @@ -114,7 +114,7 @@ class LedgerEntry extends AppModel { } function ledgerContextFields2($ledger_id = null, $account_id = null, $account_type = null) { - $fields = array('id', 'name', 'comment', 'amount'); + $fields = array('id', 'effective_date', 'through_date', 'comment', 'amount'); if (isset($ledger_id)) { $fields[] = ("IF(LedgerEntry.debit_ledger_id = $ledger_id," . diff --git a/views/elements/ledger_entries.ctp b/views/elements/ledger_entries.ctp index 8ca5e3d..b409395 100644 --- a/views/elements/ledger_entries.ctp +++ b/views/elements/ledger_entries.ctp @@ -50,6 +50,8 @@ else } $cols['Date'] = array('index' => 'Transaction.stamp', 'formatter' => 'date'); +$cols['Effective'] = array('index' => 'LedgerEntry.effective_date', 'formatter' => 'date'); +$cols['Through'] = array('index' => 'LedgerEntry.through_date', 'formatter' => 'date'); if ($single_account) { $cols['Account'] = array('index' => 'Account.name', 'formatter' => 'name'); diff --git a/views/elements/transactions.ctp b/views/elements/transactions.ctp index cfcd6c3..d0692cb 100644 --- a/views/elements/transactions.ctp +++ b/views/elements/transactions.ctp @@ -4,8 +4,7 @@ $cols = array(); $cols['ID'] = array('index' => 'Transaction.id', 'formatter' => 'id'); //$cols['Customer'] = array('index' => 'Customer.name', 'formatter' => 'longname'); -$cols['Timesamp'] = array('index' => 'Transaction.stamp', 'formatter' => 'date'); -$cols['Through'] = array('index' => 'Transaction.through_date', 'formatter' => 'date'); +$cols['Timestamp'] = array('index' => 'Transaction.stamp', 'formatter' => 'date'); $cols['Due'] = array('index' => 'Transaction.due_date', 'formatter' => 'date'); $cols['Comment'] = array('index' => 'Transaction.comment', 'formatter' => 'comment'); diff --git a/views/leases/invoice.ctp b/views/leases/invoice.ctp index b39d785..270bcb4 100644 --- a/views/leases/invoice.ctp +++ b/views/leases/invoice.ctp @@ -106,8 +106,7 @@ function resetForm() { $("#invoice-deposit").html("INTERNAL ERROR"); addChargeSource(false); - datepickerNow('charge_date'); - $("#through_date").val(''); + datepickerNow('TransactionStamp'); } @@ -150,6 +149,7 @@ function onGridState(grid_id, state) { } function addChargeSource(flash) { + var id = $("#charge-entry-id").val(); addDiv('charge-entry-id', 'charge', 'charges', flash, // HTML section '
' + @@ -168,6 +168,14 @@ function addChargeSource(flash) { 'value' => $defaultAccount, ), ), + "effective_date" => array('opts' => + array('type' => 'text'), + 'between' => 'BOM', + ), + "through_date" => array('opts' => + array('type' => 'text'), + 'between' => 'EOM', + ), "amount" => null, "comment" => array('opts' => array('size' => 50)), ), @@ -176,6 +184,20 @@ function addChargeSource(flash) { '
' ); + + $("#LedgerEntry"+id+"EffectiveDate") + .attr('autocomplete', 'off') + .datepicker({ constrainInput: true, + numberOfMonths: [1, 1], + showCurrentAtPos: 0, + dateFormat: 'mm/dd/yy' }); + + $("#LedgerEntry"+id+"ThroughDate") + .attr('autocomplete', 'off') + .datepicker({ constrainInput: true, + numberOfMonths: [1, 1], + showCurrentAtPos: 0, + dateFormat: 'mm/dd/yy' }); } --> @@ -253,14 +275,8 @@ echo $this->element('form_table', 'field_prefix' => 'Transaction', 'fields' => array ("stamp" => array('opts' => - array('id' => 'charge_date', - 'type' => 'text'), - 'between' => 'Now', - ), - "through_date" => array('opts' => - array('id' => 'through_date', - 'type' => 'text'), - 'between' => 'EOM', + array('type' => 'text'), + 'between' => 'Now', ), "comment" => array('opts' => array('size' => 50), ), @@ -288,14 +304,7 @@ echo $form->submit('Generate Invoice') . "\n";