text: <?php
  /**
   * PQRS Measure 0259 -- Numerator
   *
   * Copyright (C) 2015 - 2017      Suncoast Connection
    * 
   * LICENSE: This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0
   * See the Mozilla Public License for more details. 
   * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
   * 
   * @author  Art Eaton <art@suncoastconnection.com>
   * @author  Bryan lee <bryan@suncoastconnection.com>
   * @package LibreHealthEHR 
   * @link    http://suncoastconnection.com
   * @link    http://librehealth.io
   *
   * Please support this product by sharing your changes with the LibreHealth.io community.
   */
   
  class PQRS_0259_Numerator extends PQRSFilter
  {
      public function getTitle()
      {
          return "Numerator";
      }
  
      public function test( PQRSPatient $patient, $beginDate, $endDate )
      {
   $query =
  " SELECT COUNT(b1.code) AS count".  
  " FROM billing AS b1".
  " JOIN form_encounter AS fe ON (b1.encounter = fe.encounter)".
  " WHERE b1.pid = ? ".
  " AND fe.date BETWEEN '".$beginDate."' AND '".$endDate."' ".
  " AND b1.code = 'G8826'; ";
  //G8833 hard fail
  $result = sqlFetchArray(sqlStatementNoLog($query, array($patient->id))); 
  
  if ($result['count']> 0){ return true;} else {return false;}  
  		
      }
  }
  