Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/php/includes/
Upload File :
Current File : /var/www/cesa.co.za/php/includes/UnempPractitioners.php

<?php

/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/PHPClass.php to edit this template
 */

/**
 * Description of UnempPractitioners
 *
 * @author otto
 */
class UnempPractitioners extends BaseTableClass {

    public function findExpired() {

        $dateExpired = new DateTime();
        $dateExpired->modify('-6 months');

        $dateStart = clone $dateExpired;
        $dateStart->modify('first day of this month');

        $dateEnd = clone $dateStart;
        $dateEnd->modify('+1 months');

        $dateLastYear = new DateTime();
        $dateLastYear->modify('-1 years');

        $sql = "SELECT * FROM UnempPractitioners "
                . "WHERE UnempPractitioners.DateCreated >= '" . $dateStart->format('Y-m-d') . "' "
                . "AND UnempPractitioners.DateCreated < '" . $dateEnd->format('Y-m-d') . "' "
                . "AND UnempPractitioners.approved = 1 "
                . "AND UnempPractitioners.reminder_sent IS NULL ";

//        echo $sql . '<br />';

        return $this->sqlf->getAll($sql);
    }

    public function updateReminderSent($unempPractitioner) {

        $nowDate = new DateTime();

        $unempPractitioner['reminder_sent'] = $nowDate->format('Y-m-d');

        $this->sqlf->autoExecute('UnempPractitioners', $unempPractitioner, 'UPDATE', 'UGid = ' . $unempPractitioner['UGid']);
    }
}