Finally, finally... a working version for payment entry. The current schema is working well, and seems to handle our technical needs. However, it does seem to be very confusing with the extra accounts. Nonetheless, it does work and so I'll keep going down this path. This checkin also includes a mechanism to close the books on an account (by closing the underlying ledger) and start a new ledger. One of the decisions worth revisiting is separating out ledger entries that are really part of the same transaction. Without this change, inspecting a transaction results in the transaction total being off by a factor of two, since all money movement is in their twice (once for the expected reason, and again to hit the invoice/receipt ledger).

git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629@195 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-01 08:17:31 +00:00
parent 707c9a87ef
commit 44df78e69f
18 changed files with 455 additions and 207 deletions

View File

@@ -148,6 +148,17 @@ $grid_setup['onSelectRow'] = array
$('#payments').html('');
$('#payment-id').val(0);
addPaymentSource(false);
datepickerNow();
}
function datepickerNow() {
now = new Date();
$("#datepicker").val($.datepicker.formatDate('mm/dd/yy', now)
+ ' '
+ (now.getHours() < 10 ? '0' : '')
+ now.getHours() + ':'
+ (now.getMinutes() < 10 ? '0' : '')
+ now.getMinutes());
}
function addPaymentSource(flash) {
@@ -158,16 +169,6 @@ $grid_setup['onSelectRow'] = array
'<DIV ID="payment-type-div-%{id}">' +
<?php
/* REVISIT <AP> 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)
@@ -175,11 +176,10 @@ $grid_setup['onSelectRow'] = array
foreach ($types AS $type => $name) {
$div = '<DIV>';
$div .= '<INPUT TYPE="hidden" NAME="data[LedgerEntry][%{id}][bogus]" VALUE="1">';
$div .= '<INPUT TYPE="radio" NAME="data[LedgerEntry][%{id}][MonetarySource][monetary_type_id]"';
$div .= '<INPUT TYPE="radio" NAME="data[LedgerEntry][%{id}][monetary_type_name]"';
$div .= ' ONCLICK="switchPaymentType(%{id}, \\\''.$type.'\\\')"';
$div .= ' CLASS="payment-type-%{id}" ID="payment-type-'.$type.'-%{id}"';
$div .= ' VALUE="'.$monetary_type_ids[$name].'" ' . ($name == 'Cash' ? 'CHECKED ' : '') . '/>';
$div .= ' VALUE="'.$name.'" ' . ($name == 'Cash' ? 'CHECKED ' : '') . '/>';
$div .= ' <LABEL FOR="payment-type-'.$type.'-%{id}">'.$name.'</LABEL>';
$div .= '</DIV>';
echo "'$div' +\n";
@@ -228,7 +228,7 @@ function switchPaymentType(paymentid, type) {
'<DIV CLASS="input text required">' +
' <LABEL FOR="payment-check-number-'+paymentid+'">Check Number</LABEL>' +
// REVISIT <AP>: 20090617: Use comment field for now.
' <INPUT TYPE="text" SIZE="6" NAME="data[LedgerEntry]['+paymentid+'][MonetarySource][comment]"' +
' <INPUT TYPE="text" SIZE="6" NAME="data[LedgerEntry]['+paymentid+'][MonetarySource][data1]"' +
' ID="payment-check-number-'+paymentid+'" />' +
'</DIV>';
break;
@@ -238,7 +238,7 @@ function switchPaymentType(paymentid, type) {
'<DIV CLASS="input text required">' +
' <LABEL FOR="payment-moneyorder-number-'+paymentid+'">Money Order Number</LABEL>' +
// REVISIT <AP>: 20090617: Use comment field for now.
' <INPUT TYPE="text" SIZE="6" NAME="data[LedgerEntry]['+paymentid+'][MonetarySource][comment]"' +
' <INPUT TYPE="text" SIZE="6" NAME="data[LedgerEntry]['+paymentid+'][MonetarySource][data1]"' +
' ID="payment-moneyorder-number-'+paymentid+'" />' +
'</DIV>';
break;
@@ -248,14 +248,14 @@ function switchPaymentType(paymentid, type) {
'<DIV CLASS="input text required">' +
' <LABEL FOR="payment-ach-routing-'+paymentid+'">Routing Number</LABEL>' +
// REVISIT <AP>: 20090617: Use comment field for now.
' <INPUT TYPE="text" SIZE="9" NAME="data[LedgerEntry]['+paymentid+'][MonetarySource][comment]"' +
' <INPUT TYPE="text" SIZE="9" NAME="data[LedgerEntry]['+paymentid+'][MonetarySource][data1]"' +
' ID="payment-ach-routing-'+paymentid+'" />' +
'</DIV>' +
'<DIV CLASS="input text required">' +
' <LABEL FOR="payment-ach-account-'+paymentid+'">Account Number</LABEL>' +
// REVISIT <AP>: 20090617: Use comment field for now.
' <INPUT TYPE="text" SIZE="17" NAME="data[LedgerEntry]['+paymentid+'][MonetarySource][comment]"' +
' <INPUT TYPE="text" SIZE="17" NAME="data[LedgerEntry]['+paymentid+'][MonetarySource][data2]"' +
' ID="payment-ach-account-'+paymentid+'" />' +
'</DIV>';
break;
@@ -265,21 +265,21 @@ function switchPaymentType(paymentid, type) {
'<DIV CLASS="input text required">' +
' <LABEL FOR="payment-creditcard-account-'+paymentid+'">Account Number</LABEL>' +
// REVISIT <AP>: 20090617: Use comment field for now.
' <INPUT TYPE="text" SIZE="16" NAME="data[LedgerEntry]['+paymentid+'][MonetarySource][comment]' +
' <INPUT TYPE="text" SIZE="16" NAME="data[LedgerEntry]['+paymentid+'][MonetarySource][data1]' +
' ID="payment-creditcard-account-'+paymentid+'" />' +
'</DIV>' +
'<DIV CLASS="input text required">' +
' <LABEL FOR="payment-creditcard-expiration-'+paymentid+'">Expiration Date</LABEL>' +
// REVISIT <AP>: 20090617: Use comment field for now.
' <INPUT TYPE="text" SIZE="10" NAME="data[LedgerEntry]['+paymentid+'][MonetarySource][comment]' +
' <INPUT TYPE="text" SIZE="10" NAME="data[LedgerEntry]['+paymentid+'][MonetarySource][data2]' +
' ID="payment-creditcard-expiration-'+paymentid+'" />' +
' </DIV>' +
'<DIV CLASS="input text required">' +
' <LABEL FOR="payment-creditcard-cvv2-'+paymentid+'">CVV2 Code</LABEL>' +
// REVISIT <AP>: 20090617: Use comment field for now.
' <INPUT TYPE="text" SIZE="10" NAME=data[LedgerEntry]['+paymentid+'][MonetarySource][comment]' +
' <INPUT TYPE="text" SIZE="10" NAME=data[LedgerEntry]['+paymentid+'][MonetarySource][data3]' +
' ID="payment-creditcard-cvv2-'+paymentid+'" />' +
'</DIV>';
break;
@@ -436,7 +436,8 @@ echo $form->create(null, array('id' => 'payment-form',
<?php
echo 'Date: <input id="datepicker" name="data[Transaction][stamp]" type="text" /><BR>' . "\n";
echo 'Date: <input id="datepicker" name="data[Transaction][stamp]" type="text" />';
echo ' <A HREF="#" ONCLICK="datepickerNow(); return false;">Now</A><BR>' . "\n";
echo 'Comment: <input id="comment" name="data[Transaction][comment]" type="text" SIZE=80 /><BR>' . "\n";
echo $form->end('Post Payment');
@@ -457,8 +458,12 @@ echo $form->end('Post Payment');
<script type="text/javascript">
$(document).ready(function(){
$("#datepicker").datepicker()
.datepicker('setDate', '+0');
$("#datepicker").datepicker({ constrainInput: true,
numberOfMonths: [1, 1],
showCurrentAtPos: 0,
dateFormat: 'mm/dd/yy' })
//.datepicker('setDate', '+0');
;
<?php if (isset($customer['id'])) { ?>
$("#customer-id").val(<?php echo $customer['id']; ?>);