3bf9453c by Kevin Burton

User Manager Updates for invoices

1 parent 91e5e2eb
...@@ -22,11 +22,24 @@ jQuery(function($) { ...@@ -22,11 +22,24 @@ jQuery(function($) {
22 } 22 }
23 23
24 $('#invoice_type').change(function() { 24 $('#invoice_type').change(function() {
25 if ($('#invoice_type').val() == "invoice") { 25
26 $('.invoice_only').show(); 26 var invoice_type = $(this).val();
27 } else { 27
28 $('.invoice_only').hide(); 28 switch(invoice_type) {
29 case 'invoice':
30 $('tr.invoice_credit_only').show();
31 $('tr.invoice_only').show();
32 break;
33 case 'membership':
34 $('tr.invoice_credit_only').hide();
35 $('tr.invoice_only').show();
36 break;
37 default:
38 $('tr.invoice_credit_only').show();
39 $('tr.invoice_only').hide();
29 } 40 }
41
42
30 }); 43 });
31 44
32 jQuery('#creditNotBtn').click(function(e) { 45 jQuery('#creditNotBtn').click(function(e) {
......
...@@ -713,6 +713,14 @@ class Actions { ...@@ -713,6 +713,14 @@ class Actions {
713 if ($uid == 0) { 713 if ($uid == 0) {
714 $uid = $_POST['uid']; 714 $uid = $_POST['uid'];
715 } 715 }
716
717 // All this for tax purposes....
718 $pp = strtolower(get_user_meta($uid, 'profile_preference', true));
719 if (empty($pp)) {
720 $pp = "home";
721 }
722 $pp = $pp . "_";
723
716 $amount = $_POST['amount']; 724 $amount = $_POST['amount'];
717 $invoice_type = $_POST['invoice_type']; 725 $invoice_type = $_POST['invoice_type'];
718 $paid_by = $_POST['paid_by']; 726 $paid_by = $_POST['paid_by'];
...@@ -728,6 +736,27 @@ class Actions { ...@@ -728,6 +736,27 @@ class Actions {
728 } 736 }
729 737
730 738
739 // if membership....
740 if ($invoice_type=="membership") {
741
742 $paid = (isset($_POST['paid']) && $_POST['paid']=="on") ? true : false;
743 if ($paid) {
744 $status = "paid";
745 } else {
746 $status = "unpaid";
747 }
748
749
750 Invoice\GenerateMembershipInvoice($uid, $status, $paid_by, false);
751 // return json object
752 $return = array(
753 'success' => 'true'
754 );
755 die(json_encode($return));
756 }
757
758 // if not membership.....
759
731 $items = array(); 760 $items = array();
732 761
733 $items[] = array( 762 $items[] = array(
...@@ -753,12 +782,12 @@ class Actions { ...@@ -753,12 +782,12 @@ class Actions {
753 , 'total_taxes' => "" 782 , 'total_taxes' => ""
754 , 'subtotal' => $amount 783 , 'subtotal' => $amount
755 , 'total' => $amount 784 , 'total' => $amount
756 , 'bt_address' => "" 785 , 'bt_address' => get_user_meta($uid, $pp.'address', true)
757 , 'bt_address2' => "" 786 , 'bt_address2' => get_user_meta($uid, $pp.'address2', true)
758 , 'bt_city' => "" 787 , 'bt_city' => get_user_meta($uid, $pp.'city', true)
759 , 'bt_province' => "" 788 , 'bt_province' => get_user_meta($uid, $pp.'province', true)
760 , 'bt_country' => "" 789 , 'bt_country' => get_user_meta($uid, $pp.'country', true)
761 , 'bt_postal' => "" 790 , 'bt_postal' => get_user_meta($uid, $pp.'postal', true)
762 , 'bt_card_holder' => "" 791 , 'bt_card_holder' => ""
763 , 'bt_card_number' => "" 792 , 'bt_card_number' => ""
764 , 'bt_card_type' => $paid_by 793 , 'bt_card_type' => $paid_by
......