2 // Copyright (C) 2011 Ken Chapple <ken@mi-squared.com>
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 require_once( dirname(__FILE__
)."/../../../patient.inc" );
16 public function __construct( $id ) {
18 $this->dob
= $this->get_DOB( $id );
21 /* Function to get patient dob
23 * @return (string) containing date of birth in the format "YYYY mm dd"
25 private function get_DOB( $patient_id ) {
26 $dob = getPatientData( $patient_id, "DOB as TS_DOB" );
27 $dob = $dob['TS_DOB'];
28 $date = ($dob . ' 00:00:00'); // MYSQL Date Format
32 public function calculateAgeOnDate( $date )
34 $ageInfo=parseAgeInfo($this->dob
,$date);
35 return $ageInfo['age'];