Course invoices
Showing
2 changed files
with
54 additions
and
1 deletions
| ... | @@ -760,12 +760,52 @@ class Actions { | ... | @@ -760,12 +760,52 @@ class Actions { |
| 760 | 760 | ||
| 761 | } | 761 | } |
| 762 | 762 | ||
| 763 | public static function wp_ajax_course_registration() { | 763 | public static function wp_ajax_course_registration() { // here |
| 764 | $user = new User\Account($_POST['user_id']); | 764 | $user = new User\Account($_POST['user_id']); |
| 765 | $course = new Courses\Course($_POST['course_id']); | ||
| 766 | $enrolltype = $_POST['enrolltype']; | ||
| 767 | $amount = $course->$enrolltype; | ||
| 765 | 768 | ||
| 766 | $user->registerForCourse($_POST['course_id'], (boolean)isset($_POST['exam']), $_POST['enrolltype']); | 769 | $user->registerForCourse($_POST['course_id'], (boolean)isset($_POST['exam']), $_POST['enrolltype']); |
| 767 | $user->approveToCourse($_POST['course_id']); | 770 | $user->approveToCourse($_POST['course_id']); |
| 768 | 771 | ||
| 772 | $items = array(); | ||
| 773 | |||
| 774 | $items[] = array( | ||
| 775 | 'post_id' => $_POST['course_id'] | ||
| 776 | , 'cost' => $amount | ||
| 777 | , 'discount_label' => "" | ||
| 778 | , 'discount_amount' => 0 | ||
| 779 | , 'tax_label' => "" | ||
| 780 | , 'tax_rate' => "" | ||
| 781 | , 'tax_amount' => "0.00" | ||
| 782 | , 'subtotal' => $amount | ||
| 783 | , 'total' => $amount | ||
| 784 | , 'description' => $course->post_title | ||
| 785 | , 'extras' => array() | ||
| 786 | ); | ||
| 787 | |||
| 788 | $invoice_data = Array(); | ||
| 789 | $invoice_data['items'] = $items; | ||
| 790 | $invoice_data['payment'] = array( | ||
| 791 | 'total_cost' => $amount | ||
| 792 | , 'total_discounts' => "" | ||
| 793 | , 'total_taxes' => "" | ||
| 794 | , 'subtotal' => $amount | ||
| 795 | , 'total' => $amount | ||
| 796 | , 'bt_address' => "" | ||
| 797 | , 'bt_address2' => "" | ||
| 798 | , 'bt_city' => "" | ||
| 799 | , 'bt_province' => "" | ||
| 800 | , 'bt_country' => "" | ||
| 801 | , 'bt_postal' => "" | ||
| 802 | , 'bt_card_holder' => "" | ||
| 803 | , 'bt_card_number' => "" | ||
| 804 | , 'bt_card_type' => $_POST['paid_by'] | ||
| 805 | ); | ||
| 806 | |||
| 807 | Invoice\create($invoice_data, 'course', 'Course Invoice', $user->ID, 'paid', 'publish', 0); | ||
| 808 | |||
| 769 | die(json_encode(Array('success' => 'true', 'refresh' => 'true'))); | 809 | die(json_encode(Array('success' => 'true', 'refresh' => 'true'))); |
| 770 | } | 810 | } |
| 771 | 811 | ... | ... |
| ... | @@ -54,6 +54,19 @@ | ... | @@ -54,6 +54,19 @@ |
| 54 | </div> | 54 | </div> |
| 55 | 55 | ||
| 56 | <div class="dashboard-section" style="margin-left:20px;margin-top:10px;"> | 56 | <div class="dashboard-section" style="margin-left:20px;margin-top:10px;"> |
| 57 | <div class="dashboard-section-title">PAID BY</div> | ||
| 58 | <div class="dashboard-section-links"></div> | ||
| 59 | <div class="dashboard-section-content small"> | ||
| 60 | <select name="paid_by"> | ||
| 61 | <option value="visa">Visa</option> | ||
| 62 | <option value="mc">Mastercard</option> | ||
| 63 | <option value="amex">American Express</option> | ||
| 64 | <option value="cheque">Cheque</option> | ||
| 65 | </select> | ||
| 66 | </div> | ||
| 67 | </div> | ||
| 68 | |||
| 69 | <div class="dashboard-section" style="margin-left:20px;margin-top:10px;"> | ||
| 57 | <div class="dashboard-section-title">ENROLMENT TYPE</div> | 70 | <div class="dashboard-section-title">ENROLMENT TYPE</div> |
| 58 | <div class="dashboard-section-links"></div> | 71 | <div class="dashboard-section-links"></div> |
| 59 | <div class="dashboard-section-content small"> | 72 | <div class="dashboard-section-content small"> | ... | ... |
-
Please register or sign in to post a comment