Numerous changes. Travel form, CSV report etc
This commit is contained in:
@@ -552,27 +552,15 @@ function _booking_amount_paid($nid, $person = NULL)
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to calculate the amount outstanding for a person/married couple
|
||||
* Function to calculate the total amount a person is required to pay
|
||||
*
|
||||
* @param $nid - the node id relating to the registration node
|
||||
* @param $amount_paid - if we have previously calculated the amount paid, this can be passed as a value
|
||||
* @param $include_paypal_fees - boolean to indicate whether we want the net amount or the amount owing including paypal fees
|
||||
* @param $person - the populated node object representing this person including related price information
|
||||
* @return amount owing as a decimal value
|
||||
*/
|
||||
function _booking_amount_owing($nid, $amount_paid = 0, $include_paypal_fees = TRUE)
|
||||
function _booking_total_due($person)
|
||||
{
|
||||
//$amount_paid = 0;
|
||||
$total_due = 0;
|
||||
$total_due = 0.00;
|
||||
|
||||
//fetch details about the person
|
||||
$person = db_query("SELECT price.booking_price, price.booking_late_price, person.booking_payment_id, " .
|
||||
"person.booking_total_pay_reqd, person.booking_amount_paid, person.booking_partner_id, person.booking_country, person.booking_welfare_required " .
|
||||
"FROM {booking_person} person, {booking_price} price " .
|
||||
"WHERE person.nid = :nid " .
|
||||
"AND person.booking_payment_id = price.pid",
|
||||
array(':nid' => $nid))
|
||||
->fetchObject();
|
||||
|
||||
//determine what rate this person needs to pay
|
||||
if ($person->booking_welfare_required == 'Y')
|
||||
{
|
||||
@@ -587,11 +575,45 @@ function _booking_amount_owing($nid, $amount_paid = 0, $include_paypal_fees = TR
|
||||
else
|
||||
$total_due = $person->booking_late_price;
|
||||
|
||||
return $total_due;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to calculate the amount outstanding for a person/married couple
|
||||
*
|
||||
* @param $nid - the node id relating to the registration node
|
||||
* @param $amount_paid - if we have previously calculated the amount paid, this can be passed as a value
|
||||
* @param $include_paypal_fees - boolean to indicate whether we want the net amount or the amount owing including paypal fees
|
||||
* @return amount owing as a decimal value
|
||||
*/
|
||||
function _booking_amount_owing($nid, $amount_paid = 0, $include_paypal_fees = TRUE)
|
||||
{
|
||||
//$amount_paid = 0;
|
||||
//$total_due = 0;
|
||||
|
||||
//fetch details about the person
|
||||
$person = db_query("SELECT price.booking_price, price.booking_late_price, person.booking_payment_id, " .
|
||||
"person.booking_total_pay_reqd, person.booking_amount_paid, person.booking_partner_id, person.booking_country, person.booking_welfare_required " .
|
||||
"FROM {booking_person} person, {booking_price} price " .
|
||||
"WHERE person.nid = :nid " .
|
||||
"AND person.booking_payment_id = price.pid",
|
||||
array(':nid' => $nid))
|
||||
->fetchObject();
|
||||
|
||||
//quick sanity check
|
||||
if (! $person) {
|
||||
watchdog('booking', "Unable to find matching person relating to registration id '" . $nid . "' .");
|
||||
return 0.00;
|
||||
}
|
||||
|
||||
$total_due = _booking_total_due($person);
|
||||
|
||||
//if we didn't get the amount paid as a command line parameter, check it now
|
||||
if ($amount_paid == 0)
|
||||
{
|
||||
$amount_paid = _booking_amount_paid($nid, $person);
|
||||
}
|
||||
}
|
||||
|
||||
//check if there is anything outstanding
|
||||
//use the original total amount required rather than the late-rate, to cater for people that paid before the late rate
|
||||
|
Reference in New Issue
Block a user