Removed monetary_source_type. It was redundant, and it's entirely unclear what purpose it ultimately would or could serve. Our use of different accounts for Check, Cash, etc likely obsoleted any intention we might have had for monetary_source_type
git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629/site@288 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -284,7 +284,6 @@ class LedgerEntriesController extends AppController {
|
|||||||
('first',
|
('first',
|
||||||
array('contain' => array('MonetarySource.id',
|
array('contain' => array('MonetarySource.id',
|
||||||
'MonetarySource.name',
|
'MonetarySource.name',
|
||||||
'MonetarySource.MonetaryType.id',
|
|
||||||
'Transaction.id',
|
'Transaction.id',
|
||||||
'Transaction.stamp',
|
'Transaction.stamp',
|
||||||
'DebitLedger.id',
|
'DebitLedger.id',
|
||||||
|
|||||||
@@ -38,8 +38,7 @@ class MonetarySourcesController extends AppController {
|
|||||||
|
|
||||||
function jqGridDataTables(&$params, &$model) {
|
function jqGridDataTables(&$params, &$model) {
|
||||||
return array
|
return array
|
||||||
('link' => array('MonetaryType' => array('fields' => array('MonetaryType.id', 'MonetaryType.name')),
|
('contain' => false,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,9 +64,7 @@ class MonetarySourcesController extends AppController {
|
|||||||
// Get the MonetarySource and related fields
|
// Get the MonetarySource and related fields
|
||||||
$monetary_source = $this->MonetarySource->find
|
$monetary_source = $this->MonetarySource->find
|
||||||
('first', array
|
('first', array
|
||||||
('contain' => array
|
('contain' => false,
|
||||||
('MonetaryType',
|
|
||||||
),
|
|
||||||
));
|
));
|
||||||
|
|
||||||
// Prepare to render.
|
// Prepare to render.
|
||||||
|
|||||||
@@ -463,10 +463,9 @@ class Account extends AppModel {
|
|||||||
*
|
*
|
||||||
* monetary_source_data
|
* monetary_source_data
|
||||||
* - monetary_source_id (optional... if set all else is ignored)
|
* - monetary_source_id (optional... if set all else is ignored)
|
||||||
* - monetary_type_name
|
* - account_name
|
||||||
* - MonetarySource
|
* - MonetarySource
|
||||||
* - name
|
* - name
|
||||||
* - monetary_type_id
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function postLedgerEntry($transaction_data,
|
function postLedgerEntry($transaction_data,
|
||||||
@@ -512,8 +511,8 @@ class Account extends AppModel {
|
|||||||
= array_intersect_key($monetary_data,
|
= array_intersect_key($monetary_data,
|
||||||
array('monetary_source_id'=>1));
|
array('monetary_source_id'=>1));
|
||||||
}
|
}
|
||||||
elseif (isset($monetary_data['monetary_type_name'])) {
|
elseif (isset($monetary_data['account_name'])) {
|
||||||
if ($monetary_data['monetary_type_name'] === 'Cash') {
|
if ($monetary_data['account_name'] === 'Cash') {
|
||||||
// No distinguishing features of Cash, just
|
// No distinguishing features of Cash, just
|
||||||
// use the shared monetary source
|
// use the shared monetary source
|
||||||
$monetary_data['monetary_source_id'] =
|
$monetary_data['monetary_source_id'] =
|
||||||
@@ -525,21 +524,16 @@ class Account extends AppModel {
|
|||||||
else {
|
else {
|
||||||
// The monetary source needs to be unique
|
// The monetary source needs to be unique
|
||||||
// Create a new one dedicated to this entry
|
// Create a new one dedicated to this entry
|
||||||
$monetary_data['MonetarySource']['monetary_type_id'] =
|
|
||||||
$this->Ledger->LedgerEntry->MonetarySource->MonetaryType
|
|
||||||
->nameToID($monetary_data['monetary_type_name']);
|
|
||||||
|
|
||||||
$monetary_data['MonetarySource']['name'] =
|
|
||||||
$this->Ledger->LedgerEntry->MonetarySource->MonetaryType
|
|
||||||
->nameToID($monetary_data['monetary_type_name']);
|
|
||||||
|
|
||||||
// Give it a fancy name based on the check number
|
// Give it a fancy name based on the check number
|
||||||
$monetary_data['MonetarySource']['name'] = $monetary_data['monetary_type_name'];
|
$monetary_data['MonetarySource']['name'] = $monetary_data['account_name'];
|
||||||
if ($monetary_data['monetary_type_name'] === 'Check' ||
|
if ($monetary_data['account_name'] === 'Check' ||
|
||||||
$monetary_data['monetary_type_name'] === 'Money Order') {
|
$monetary_data['account_name'] === 'Money Order') {
|
||||||
$monetary_data['MonetarySource']['name'] .=
|
$monetary_data['MonetarySource']['name'] .=
|
||||||
' #' . $monetary_data['MonetarySource']['data1'];
|
' #' . $monetary_data['MonetarySource']['data1'];
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$monetary_data['MonetarySource']['name'] = $monetary_data['account_name'];
|
||||||
|
}
|
||||||
|
|
||||||
$monetary_data
|
$monetary_data
|
||||||
= array_intersect_key($monetary_data,
|
= array_intersect_key($monetary_data,
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ class MonetarySource extends AppModel {
|
|||||||
);
|
);
|
||||||
|
|
||||||
var $belongsTo = array(
|
var $belongsTo = array(
|
||||||
'MonetaryType',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var $hasMany = array(
|
var $hasMany = array(
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
<?php
|
|
||||||
class MonetaryType extends AppModel {
|
|
||||||
|
|
||||||
var $name = 'MonetaryType';
|
|
||||||
var $validate = array(
|
|
||||||
'id' => array('numeric'),
|
|
||||||
'name' => array('notempty'),
|
|
||||||
'tillable' => array('boolean')
|
|
||||||
);
|
|
||||||
|
|
||||||
var $hasMany = array(
|
|
||||||
'MonetarySource',
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
@@ -166,7 +166,7 @@ class Transaction extends AppModel {
|
|||||||
foreach ($data['LedgerEntry'] AS $entry) {
|
foreach ($data['LedgerEntry'] AS $entry) {
|
||||||
|
|
||||||
// Get the Monetary Source squared away
|
// Get the Monetary Source squared away
|
||||||
if ($entry['monetary_type_name'] === 'Cash') {
|
if ($entry['account_name'] === 'Cash') {
|
||||||
// No distinguishing features of Cash, just
|
// No distinguishing features of Cash, just
|
||||||
// use the shared monetary source
|
// use the shared monetary source
|
||||||
$entry['monetary_source_id'] =
|
$entry['monetary_source_id'] =
|
||||||
@@ -176,39 +176,16 @@ class Transaction extends AppModel {
|
|||||||
else {
|
else {
|
||||||
// The monetary source needs to be unique
|
// The monetary source needs to be unique
|
||||||
// Create a new one dedicated to this entry
|
// Create a new one dedicated to this entry
|
||||||
$entry['MonetarySource']['monetary_type_id'] =
|
|
||||||
$this->LedgerEntry->MonetarySource->MonetaryType
|
|
||||||
->nameToID($entry['monetary_type_name']);
|
|
||||||
|
|
||||||
if (!isset($entry['MonetarySource']['monetary_type_id'])) {
|
|
||||||
$entry['MonetarySource']['name'] = 'Other';
|
|
||||||
$entry['MonetarySource']['monetary_type_id'] =
|
|
||||||
$this->LedgerEntry->MonetarySource->MonetaryType
|
|
||||||
->nameToID('Other Non-Tillable');
|
|
||||||
} else {
|
|
||||||
$entry['MonetarySource']['name'] = $entry['monetary_type_name'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Give it a fancy name based on the check number
|
// Give it a fancy name based on the check number
|
||||||
if ($entry['monetary_type_name'] === 'Check' ||
|
if ($entry['account_name'] === 'Check' ||
|
||||||
$entry['monetary_type_name'] === 'Money Order') {
|
$entry['account_name'] === 'Money Order') {
|
||||||
$entry['MonetarySource']['name'] .=
|
$entry['MonetarySource']['name'] .=
|
||||||
' #' . $entry['MonetarySource']['data1'];
|
' #' . $entry['MonetarySource']['data1'];
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$entry['MonetarySource']['name'] = $entry['account_name'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine which account we'll use for the ledger entry
|
|
||||||
$account_name = $entry['monetary_type_name'];
|
|
||||||
|
|
||||||
// REVISIT <AP>: 20090708
|
|
||||||
// I _hate_ hardcoding values, but I'm not sure how
|
|
||||||
// else to handle this at the moment. I'm pretty sure
|
|
||||||
// what needs to happen is for the account information
|
|
||||||
// to be figured out programatically on the receipt
|
|
||||||
// presentation page, and then those values would flow
|
|
||||||
// back after entry to here.
|
|
||||||
if ($account_name === 'ACH')
|
|
||||||
$account_name = 'Bank';
|
|
||||||
|
|
||||||
// This entry of physical money is part of the receipt transaction
|
// This entry of physical money is part of the receipt transaction
|
||||||
// debit: Cash/Check/Etc credit: Receipt
|
// debit: Cash/Check/Etc credit: Receipt
|
||||||
@@ -216,7 +193,7 @@ class Transaction extends AppModel {
|
|||||||
|
|
||||||
// Receipt must debit the "money" asset (bank, cash, check, etc)...
|
// Receipt must debit the "money" asset (bank, cash, check, etc)...
|
||||||
$entry['debit_ledger_id']
|
$entry['debit_ledger_id']
|
||||||
= $A->currentLedgerID($A->nameToID($account_name));
|
= $A->currentLedgerID($A->nameToID($entry['account_name']));
|
||||||
|
|
||||||
// ...and credit the Receipt ledger
|
// ...and credit the Receipt ledger
|
||||||
$entry['credit_ledger_id']
|
$entry['credit_ledger_id']
|
||||||
|
|||||||
@@ -175,14 +175,12 @@ function addPaymentSource(flash) {
|
|||||||
foreach(array('Cash', 'Check', 'Money Order', 'ACH', /*'Credit Card'*/ 'Concession') AS $name) {
|
foreach(array('Cash', 'Check', 'Money Order', 'ACH', /*'Credit Card'*/ 'Concession') AS $name) {
|
||||||
$type = preg_replace("/ /", "", strtolower($name));
|
$type = preg_replace("/ /", "", strtolower($name));
|
||||||
$acct = $name;
|
$acct = $name;
|
||||||
/* if ($acct === 'ACH') */
|
|
||||||
/* $acct = 'Bank'; */
|
|
||||||
$types[] = array('key' => $type, 'name' => $name, 'acct' => $acct);
|
$types[] = array('key' => $type, 'name' => $name, 'acct' => $acct);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($types AS $type) {
|
foreach ($types AS $type) {
|
||||||
$div = '<DIV>';
|
$div = '<DIV>';
|
||||||
$div .= '<INPUT TYPE="radio" NAME="data[LedgerEntry][%{id}][monetary_type_name]"';
|
$div .= '<INPUT TYPE="radio" NAME="data[LedgerEntry][%{id}][account_name]"';
|
||||||
$div .= ' ONCLICK="switchPaymentType(\\\'payment-type-div\\\', %{id}, \\\''.$type['key'].'\\\')"';
|
$div .= ' ONCLICK="switchPaymentType(\\\'payment-type-div\\\', %{id}, \\\''.$type['key'].'\\\')"';
|
||||||
$div .= ' CLASS="payment-radio-%{id}" ID="payment-radio-%{id}-'.$type['key'].'"';
|
$div .= ' CLASS="payment-radio-%{id}" ID="payment-radio-%{id}-'.$type['key'].'"';
|
||||||
$div .= ' VALUE="'.$type['acct'].'" ' . ($type['name'] == 'Cash' ? 'CHECKED ' : '') . '/>';
|
$div .= ' VALUE="'.$type['acct'].'" ' . ($type['name'] == 'Cash' ? 'CHECKED ' : '') . '/>';
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
$cols = array();
|
$cols = array();
|
||||||
$cols['ID'] = array('index' => 'MonetarySource.id', 'formatter' => 'id');
|
$cols['ID'] = array('index' => 'MonetarySource.id', 'formatter' => 'id');
|
||||||
$cols['Name'] = array('index' => 'MonetarySource.name', 'formatter' => 'longname');
|
$cols['Name'] = array('index' => 'MonetarySource.name', 'formatter' => 'longname');
|
||||||
$cols['Type'] = array('index' => 'MonetaryType.name', 'formatter' => 'name');
|
|
||||||
$cols['Comment'] = array('index' => 'MonetarySource.comment', 'formatter' => 'comment');
|
$cols['Comment'] = array('index' => 'MonetarySource.comment', 'formatter' => 'comment');
|
||||||
|
|
||||||
// Set up search fields if requested by caller
|
// Set up search fields if requested by caller
|
||||||
|
|||||||
@@ -9,17 +9,14 @@ echo '<div class="monetary-source view">' . "\n";
|
|||||||
* MonetarySource Detail Main Section
|
* MonetarySource Detail Main Section
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$type = $monetarySource['MonetaryType'];
|
|
||||||
$source = $monetarySource['MonetarySource'];
|
$source = $monetarySource['MonetarySource'];
|
||||||
|
|
||||||
$rows = array(array('ID', $source['id']),
|
$rows = array(array('ID', $source['id']),
|
||||||
array('Name', $source['name']),
|
array('Name', $source['name']),
|
||||||
array('Type', $type['name']),
|
|
||||||
array('Data 1', $source['data1']),
|
array('Data 1', $source['data1']),
|
||||||
array('Data 2', $source['data2']),
|
array('Data 2', $source['data2']),
|
||||||
array('Data 3', $source['data3']),
|
array('Data 3', $source['data3']),
|
||||||
array('Data 4', $source['data4']),
|
array('Data 4', $source['data4']),
|
||||||
array('Tillable', $type['tillable'] ? 'Yes' : 'No'),
|
|
||||||
array('Comment', $source['comment']));
|
array('Comment', $source['comment']));
|
||||||
|
|
||||||
echo $this->element('table',
|
echo $this->element('table',
|
||||||
|
|||||||
Reference in New Issue
Block a user