Added ACH and Concession entry. Like everything else, I haven't tested too robustly, but it does seem to work. I might want to change the monetary source id for Concession. Right now each concession gets its own monetary source, but we could probably use a common one without issue.

git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629/site@284 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-09 06:10:00 +00:00
parent 37beb8b436
commit fb29380ac5
2 changed files with 49 additions and 26 deletions

View File

@@ -168,20 +168,25 @@ function addPaymentSource(flash) {
'<FIELDSET CLASS="payment subset">' +
'<LEGEND>Payment #%{id} (%{remove})</LEGEND>' +
'<DIV ID="payment-type-div-%{id}">' +
'<DIV ID="payment-div-%{id}">' +
<?php
$types = array();
foreach(array('Cash', 'Check', 'Money Order', /*'ACH', 'Credit Card'*/) AS $name)
$types[preg_replace("/ /", "", strtolower($name))] = $name;
foreach(array('Cash', 'Check', 'Money Order', 'ACH', /*'Credit Card'*/ 'Concession') AS $name) {
$type = preg_replace("/ /", "", strtolower($name));
$acct = $name;
/* if ($acct === 'ACH') */
/* $acct = 'Bank'; */
$types[] = array('key' => $type, 'name' => $name, 'acct' => $acct);
}
foreach ($types AS $type => $name) {
foreach ($types AS $type) {
$div = '<DIV>';
$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="'.$name.'" ' . ($name == 'Cash' ? 'CHECKED ' : '') . '/>';
$div .= ' <LABEL FOR="payment-type-'.$type.'-%{id}">'.$name.'</LABEL>';
$div .= ' ONCLICK="switchPaymentType(\\\'payment-type-div\\\', %{id}, \\\''.$type['key'].'\\\')"';
$div .= ' CLASS="payment-radio-%{id}" ID="payment-radio-%{id}-'.$type['key'].'"';
$div .= ' VALUE="'.$type['acct'].'" ' . ($type['name'] == 'Cash' ? 'CHECKED ' : '') . '/>';
$div .= ' <LABEL FOR="payment-radio-%{id}-'.$type['key'].'">'.$type['name'].'</LABEL>';
$div .= '</DIV>';
echo "'$div' +\n";
}
@@ -196,12 +201,9 @@ function addPaymentSource(flash) {
'</DIV>' +
<?php
foreach ($types AS $type => $name) {
if ($type == 'cash')
continue;
foreach ($types AS $type) {
$div = '<DIV';
$div .= ' ID="payment-'.$type.'-div-%{id}"';
$div .= ' ID="payment-type-div-%{id}-'.$type['key'].'"';
$div .= ' CLASS="payment-type-div-%{id}"';
$div .= ' STYLE="display:none;">';
$div .= '</DIV>';
@@ -213,14 +215,16 @@ function addPaymentSource(flash) {
);
}
function switchPaymentType(paymentid, type) {
$(".payment-type-div-"+paymentid).slideUp();
$(".payment-type-div-"+paymentid).html('');
function switchPaymentType(paymentid_base, paymentid, type) {
$("."+paymentid_base+"-"+paymentid).slideUp();
$("."+paymentid_base+"-"+paymentid).html('');
var html;
switch(type)
{
case 'cash':
break;
return;
case 'check':
html =
@@ -283,13 +287,16 @@ function switchPaymentType(paymentid, type) {
'</DIV>';
break;
case 'concession':
return;
default:
html = '<DIV><H2>INVALID TYPE ('+type+')</H2></DIV>';
html = '<H2>INVALID TYPE ('+type+')</H2>';
break;
}
$("#payment-"+type+"-div-"+paymentid).html(html);
$("#payment-"+type+"-div-"+paymentid).slideDown();
$("#"+paymentid_base+"-"+paymentid+"-"+type).html(html);
$("#"+paymentid_base+"-"+paymentid+"-"+type).slideDown();
}