<?php require_once("includes/initialize.php");
//$par = array();
global $database;
echo $id = $session->user_id;
$user_data = Userdata::find_by_id($session->user_id);
$biodata = Biodata::find_by_id($user_data->formno, $user_data->email);

//echo "Find: ".$biodata->surname;
$current_session = SESSIONCLASS::session_authenticate();
$a = (substr(rand(1, 10000000000), 0, 10));
$txt_ref = $a . (substr($biodata->surname, 0, 2));

//@todo:fix //inserts into the acceptance_tranz table from here
$transact = Transaction::t_processing($id, $biodata->session, $txt_ref);
$transaction = Transaction::find_by_txnref($txt_ref);


$fno = $transaction->formno;
$txn_ref = $transaction->txt_ref;
$level = $transaction->level;
$full_name = $transaction->surname . ' ' . $transaction->othernames;
$surname = $transaction->surname;
$othername = $transaction->othernames;
$amount = $transaction->amount;
$courses = $transaction->department;
$email = $transaction->email;
$phone = $transaction->phone;

$level0 = $transaction->programme;
$session = $transaction->session;
$transfee = $transaction->txt_fees;
$overhead = $transaction->overhead;
$_SESSION['txn_ref'] = $txn_ref;
$_SESSION['wayout'] = "Acceptance Fee";
$charges = $transfee + $overhead;
$amount_new = $amount - $charges;


$fname = $transaction->surname . ' ' . $transaction->othernames;

//@todo: fix //into webpaylog
$sqlw = $database->query("INSERT INTO webpaylog (txnref,datetime,debittedamount,responsedesc,responsecode,custname,custid) 
						VALUES('$txn_ref',NOW(),'$amount','null','null','$fname','$fno')") or die(mysql_error());


header("location: dashboard.php?type=invoicedetails");

?>


	