diff --git a/controllers/transactions_controller.php b/controllers/transactions_controller.php
index 70bb925..7bbc859 100644
--- a/controllers/transactions_controller.php
+++ b/controllers/transactions_controller.php
@@ -2,6 +2,8 @@
class TransactionsController extends AppController {
+ var $components = array('RequestHandler');
+
var $sidemenu_links =
array(array('name' => 'Transactions', 'header' => true),
array('name' => 'All', 'url' => array('controller' => 'transactions', 'action' => 'all')),
@@ -92,4 +94,20 @@ class TransactionsController extends AppController {
$title = 'Transaction #' . $transaction['Transaction']['id'];
$this->set(compact('transaction', 'title', 'total'));
}
+
+ /**************************************************************************
+ **************************************************************************
+ **************************************************************************
+ * action: postReceipt
+ * - handles the creation of a payment receipt
+ */
+
+ function postReceipt() {
+ if ($this->RequestHandler->isPost()) {
+ pr($this->data);
+ //$this->redirect(array('action'=>'index'));
+ }
+ $this->autoRender = false;
+ }
+
}
diff --git a/views/customers/payment.ctp b/views/customers/payment.ctp
index 78151bb..9023240 100644
--- a/views/customers/payment.ctp
+++ b/views/customers/payment.ctp
@@ -164,7 +164,7 @@ $grid_setup['onSelectRow'] = array
function resetPaymentForm() {
// Get a clean slate for our payments
$('#payments').html('');
- $('#payment-id').val(1);
+ $('#payment-id').val(0);
addPaymentSource(false);
}
@@ -176,16 +176,27 @@ $grid_setup['onSelectRow'] = array
'
' +
20090616:
+ * MUST GET THIS FROM THE DATABASE!!
+ * HARDCODED VALUES BAD... VERY BAD...
+ */
+ $monetary_type_ids = array('Cash' => 2,
+ 'Check' => 3,
+ 'Money Order' => 4,
+ 'ACH' => 5,
+ 'Credit Card' => 7,
+ );
+
$types = array();
foreach(array('Cash', 'Check', 'Money Order', /*'ACH', 'Credit Card'*/) AS $name)
$types[preg_replace("/ /", "", strtolower($name))] = $name;
foreach ($types AS $type => $name) {
$div = '
';
- $div .= '';
+ $div .= ' VALUE="'.$monetary_type_ids[$name].'" ' . ($name == 'Cash' ? 'CHECKED ' : '') . '/>';
$div .= ' ';
$div .= '
';
echo "'$div' +\n";
@@ -196,7 +207,7 @@ $grid_setup['onSelectRow'] = array
'
' +
' ' +
' ' +
'
' +
@@ -233,7 +244,8 @@ function switchPaymentType(paymentid, type) {
html =
'
' +
' ' +
- ' : 20090617: Use comment field for now.
+ ' ' +
'
';
break;
@@ -242,7 +254,8 @@ function switchPaymentType(paymentid, type) {
html =
'
' +
' ' +
- ' : 20090617: Use comment field for now.
+ ' ' +
'
';
break;
@@ -251,13 +264,15 @@ function switchPaymentType(paymentid, type) {
html =
'
' +
' ' +
- ' : 20090617: Use comment field for now.
+ ' ' +
'
' +
'
' +
' ' +
- ' : 20090617: Use comment field for now.
+ ' ' +
'
';
break;
@@ -266,19 +281,22 @@ function switchPaymentType(paymentid, type) {
html =
'
' +
' ' +
- ' : 20090617: Use comment field for now.
+ ' ' +
'
' +
'
' +
' ' +
- ' : 20090617: Use comment field for now.
+ ' ' +
'
' +
'
' +
' ' +
- ' : 20090617: Use comment field for now.
+ ' ' +
'
';
break;
@@ -300,7 +318,7 @@ function switchPaymentType(paymentid, type) {
//echo '
' . "\n";
echo $this->element('customers',
- array('caption' => '
Select Customer',
+ array('caption' => '
Select Customer',
'limit' => 7,
'grid_setup' => $grid_setup,
));
@@ -311,14 +329,55 @@ echo ('
' .
: 'Please select customer') .
'
' . "\n");
- //echo $form->create(null, array('id' => 'payment-form', 'action' => 'other'));
- echo $form->create(null, array('id' => 'payment-form', 'url' => 'http://localhost/vars.php'));
+echo $form->create(null, array('id' => 'payment-form',
+ 'url' => array('controller' => 'transactions',
+ 'action' => 'postReceipt')));
+
+/***************************************************
+ * Post data should look like this:
+ *
+ * data => Array
+ * (
+ * [Transaction] => Array
+ * (
+ * stamp =>
+ * through_date =>
+ * due_date =>
+ * comment =>
+ * )
+ *
+ * [LedgerEntry] => Array
+ * (
+ * [0] => Array
+ * (
+ * name =>
+ * amount =>
+ * debit_ledger_id =>
+ * credit_ledger_id =>
+ * comment =>
+ *
+ * [MonetarySource] => Array
+ * (
+ * name =>
+ * monetary_type_id =>
+ * comment =>
+ * )
+ *
+ * REVISIT: Reconciliations will be tricker.
+ * )
+ *
+ * )
+ *
+ * )
+ *
+ ***************************************************/
+
?>
' . "\n"; // End of the dialog DIV