3bf9453c by Kevin Burton

User Manager Updates for invoices

1 parent 91e5e2eb
......@@ -22,11 +22,24 @@ jQuery(function($) {
}
$('#invoice_type').change(function() {
if ($('#invoice_type').val() == "invoice") {
$('.invoice_only').show();
} else {
$('.invoice_only').hide();
var invoice_type = $(this).val();
switch(invoice_type) {
case 'invoice':
$('tr.invoice_credit_only').show();
$('tr.invoice_only').show();
break;
case 'membership':
$('tr.invoice_credit_only').hide();
$('tr.invoice_only').show();
break;
default:
$('tr.invoice_credit_only').show();
$('tr.invoice_only').hide();
}
});
jQuery('#creditNotBtn').click(function(e) {
......
......@@ -713,6 +713,14 @@ class Actions {
if ($uid == 0) {
$uid = $_POST['uid'];
}
// All this for tax purposes....
$pp = strtolower(get_user_meta($uid, 'profile_preference', true));
if (empty($pp)) {
$pp = "home";
}
$pp = $pp . "_";
$amount = $_POST['amount'];
$invoice_type = $_POST['invoice_type'];
$paid_by = $_POST['paid_by'];
......@@ -728,6 +736,27 @@ class Actions {
}
// if membership....
if ($invoice_type=="membership") {
$paid = (isset($_POST['paid']) && $_POST['paid']=="on") ? true : false;
if ($paid) {
$status = "paid";
} else {
$status = "unpaid";
}
Invoice\GenerateMembershipInvoice($uid, $status, $paid_by, false);
// return json object
$return = array(
'success' => 'true'
);
die(json_encode($return));
}
// if not membership.....
$items = array();
$items[] = array(
......@@ -753,12 +782,12 @@ class Actions {
, 'total_taxes' => ""
, 'subtotal' => $amount
, 'total' => $amount
, 'bt_address' => ""
, 'bt_address2' => ""
, 'bt_city' => ""
, 'bt_province' => ""
, 'bt_country' => ""
, 'bt_postal' => ""
, 'bt_address' => get_user_meta($uid, $pp.'address', true)
, 'bt_address2' => get_user_meta($uid, $pp.'address2', true)
, 'bt_city' => get_user_meta($uid, $pp.'city', true)
, 'bt_province' => get_user_meta($uid, $pp.'province', true)
, 'bt_country' => get_user_meta($uid, $pp.'country', true)
, 'bt_postal' => get_user_meta($uid, $pp.'postal', true)
, 'bt_card_holder' => ""
, 'bt_card_number' => ""
, 'bt_card_type' => $paid_by
......