2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
8 /* This program is free software. You can redistribute it and/or */
9 /* modify it under the terms of the GNU General Public License */
10 /* as published by the Free Software Foundation. */
11 /************************************************************************/
13 $_user_location = 'users';
14 define('AT_INCLUDE_PATH', '../../include/');
15 require(AT_INCLUDE_PATH.'vitals.inc.php');
16 require('include/payments.lib.php');
18 if ($_POST['cancel']) {
19 header('location: index.php');
23 ///Get the fee for the current course
24 $course_id = intval($_GET['course_id']);
26 $sql = "SELECT course_fee FROM ".TABLE_PREFIX."ec_course_fees WHERE course_id=$course_id";
27 $result = mysql_query($sql, $db);
28 if ($this_course_fee = mysql_fetch_assoc($result)) {
29 $this_course_fee = $this_course_fee['course_fee'];
31 header('location: index.php');
34 $course_id = intval($_REQUEST['course_id']);
35 $member_id = intval($_SESSION['member_id']);
36 require (AT_INCLUDE_PATH.'header.inc.php');
38 ///Check if a partial payment has already been made so the balance can be calculated
39 $sql4 = "SELECT SUM(amount) AS total_amount FROM ".TABLE_PREFIX."payments WHERE course_id='$course_id' AND approved=1 AND member_id=$member_id";
40 $result4 = mysql_query($sql4, $db);
41 while ($row4 = mysql_fetch_assoc($result4)) {
42 if($row4['total_amount'] > 0){
43 $amount_paid = $row4['total_amount'];
48 $balance_course_fee = $this_course_fee - $amount_paid;
49 $this_course_fee = $balance_course_fee;
51 $sql = "INSERT INTO ".TABLE_PREFIX."payments VALUES (NULL, NULL, 0, '', '{$_SESSION['member_id']}', '$course_id', '$balance_course_fee')";
52 $result = mysql_query($sql, $db);
54 $payment_id = mysql_insert_id($db);
56 <div class="input-form">
58 <h3><?php echo _AT('confirm'); ?></h3>
60 <p><?php echo _AT('ec_confirm_info'); ?></p>
63 <dt><?php echo _AT('ec_course');?></dt>
64 <dd><?php echo $system_courses[$course_id]['title']; ?></dd>
66 <dt><?php echo _AT('ec_this_course_fee');?></dt>
67 <dd><?php echo $_config['ec_currency_symbol'].$this_course_fee.' '.$_config['ec_currency'];?></dd>
69 <dt><?php echo _AT('ec_amount_recieved');?></dt>
70 <dd><?php echo $_config['ec_currency_symbol'].$amount_paid;?></dd>
72 <dt><?php echo _AT('ec_balance_due');?></dt>
73 <dd><?php echo $_config['ec_currency_symbol'].number_format($balance_course_fee, 2).' '.$_config['ec_currency'];;?></dd>
76 <h4><?php echo _AT('ec_requirements'); ?></h4>
78 <li><?php echo _AT('ec_requirements_ssl'); ?></li>
79 <li><?php echo _AT('ec_requirements_cookies'); ?></li>
80 <li><?php echo _AT('ec_requirements_javascript'); ?></li>
81 <li><?php echo _AT('ec_requirements_comments'); ?></li>
87 * these payment forms below can be replaced by any other payment gateway.
88 * when the gateway sends back the response then it is authenticated and if
89 * the amounts match then the `payments` transaction is updated and approved.
93 <div class="row buttons">
94 <?php beanstream_print_form($payment_id, $balance_course_fee, $course_id); ?>
95 <?php paypal_print_form($payment_id, $balance_course_fee, $course_id); ?>
96 <?php mirapay_print_form($payment_id, $balance_course_fee, $course_id); ?>
97 <?php check_payment_print_form($payment_id, $balance_course_fee, $course_id); ?>
102 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>