<img src="<?php echo HTTP_PATH; ?> images/our-heroes.svg" alt="Cancer Research UK" /> </div> <div id="awards" class="callout panel"> <div class="title"> <!-- <i class="icon-icons_trophy"></i> --> Available to spend </div> <div class="price-panel"> <!-- <i class="icon-icons_trophy"></i> --> <?php $sum_all = getAvailable($_SESSION['user']->EmpNum); $sum_credit_card = getCreditCard($_SESSION['user']->EmpNum); $sum_orders = getEmpBasketOrdersSum($_SESSION['user']->EmpNum); $remaining_amount = $sum_all + $sum_credit_card - $sum_orders; echo '£' . ' ' . $remaining_amount; ?> </div> <div class="unlaimed-panel"> <!-- <i class="icon-icons_trophy"></i> --> +2 Unclaimed </div> </div> <div class="callout panel" id="menu_container"> <?php $menu->db = $db; echo $menu->Menu(); ?> </div>
if (isset($_POST['unspent_award'])) { if (quarterCheck()) { //For each employee check if he has an approved award //received more then 3 months ago $employees = $db->prepare("SELECT * FROM tblempall"); $employees->execute(); while ($employee = $employees->fetch(PDO::FETCH_OBJ)) { //get his approved awards that are older then 3 months $awards = $db->prepare("SELECT COUNT(*) as Count FROM tblnominations WHERE NominatedEmpNum LIKE :EmpNum AND AprStatus LIKE '1' AND AprDate < NOW() - INTERVAL 3 MONTH"); $awards->execute(array(':EmpNum' => $employee->EmpNum)); $awards = $awards->fetch(PDO::FETCH_OBJ); if ($awards->Count > 0) { //calculate the user's remaining amount $sum_all = getAvailable($employee->EmpNum); $sum_credit_card = getCreditCard($employee->EmpNum); $sum_orders = getEmpBasketOrdersSum($employee->EmpNum); $remaining_amount = $sum_all + $sum_credit_card - $sum_orders; if ($remaining_amount > 0) { //shoot him an email $email = new StdClass(); $email->emailTo = $employee->Eaddress; $email->subject = "CRUK Website Unspent Amount Reminder"; $email->Content = '<p>Hi ' . $employee->Fname . '<p> <pYou have money in your account to spend!</p>'; sendEmail($email); } } } } } /*