function process_inclusive_dates() {
        if (func_num_args()>0) {
            $arg_list = func_get_args();
            $menu_id = $arg_list[0];
            $post_vars = $arg_list[1];
            $get_vars = $arg_list[2];
            $validuser = $arg_list[3];
            $isadmin = $arg_list[4];
            print_r($arg_list);
        }
        // loop through m_consult_disease_notifiable
        $sql = "select p.patient_id, c.consult_id, concat(p.patient_lastname, ', ', p.patient_firstname) patient_name, c.onset_date, ".
               "round((to_days(now())-to_days(p.patient_dob))/365 , 1) patient_age, p.patient_gender, c.disease_id  ".
               "from m_consult_disease_notifiable c, m_patient p ".
               "where c.patient_id = p.patient_id";
        if ($result = mysql_query($sql)) {
            if (mysql_num_rows($result)) {
                while ($report = mysql_fetch_array($result)) {
                    // blank variables
                    $family_id = 0;
                    $patient_address = '';
                    $barangay_name = '';
                    $disease_name = '';
                    $icd_code = '';
                    // retrieve other data
                    $family_id = family::get_family_id($report["patient_id"]);
                    if ($family_id) {
                        $patient_address = family::show_address($family_id);
                        $barangay_name = family::barangay_name($family_id);
                    }
                    $disease_name = notifiable::get_notifiable_disease_name($report["disease_id"]);
                    $icd_code = notifiable_report::get_disease_icdcode($report["disease_id"]);

                    // insert data into tcl
                    $sql_insert = "insert into m_patient_notifiable_tcl (consult_id, patient_id, ".
                                  "patient_name, onset_date, patient_age, patient_gender, patient_address, ".
                                  "barangay_name, diagnosis, icd10) ".
                                  "values ('".$report["consult_id"]."', '".$report["patient_id"]."', ".
                                  "'".$report["patient_name"]."', '".$report["onset_date"]."', '".$report["patient_age"]."', ".
                                  "'".$report["patient_gender"]."', '$patient_address', '$barangay_name', ".
                                  "'$disease_name', '$icd_code')";
                    $result_insert = mysql_query($sql_insert);
                } // while
                print $sql = "select patient_name, onset_date, patient_age, patient_gender, ".
                       "patient_address, barangay_name, diagnosis, icd10 ".
                       "from m_patient_notifiable_tcl order by diagnosis";
                $pdf = new PDF('P','pt','A4');
                $pdf->SetFont('Arial','',10);
                $pdf->AliasNbPages();
                $pdf->connect('localhost','root','kambing','game');
                $attr=array('titleFontSize'=>14,'titleText'=>'NOTIFIABLE DISEASE REGISTER');
                $pdf->mysql_report($sql,false,$attr, "../modules/_uploads/ntp_tcl.pdf");
                header("location: ".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&report_menu=TCL");
            }
        }
    }
Esempio n. 2
0
	}
}
if (file_exists('../modules/notifiable/class.notifiable.php')) {
	include '../modules/notifiable/class.notifiable.php';
	$notifiable = new notifiable;
	if (!$module->activated('notifiable') && $initmod) {
		$notifiable->init_sql();
		$notifiable->init_menu();
		$notifiable->init_deps();
		$notifiable->init_lang();
		$notifiable->init_help();
	}
}
if (file_exists('../modules/notifiable_report/class.notifiable_report.php')) {
	include '../modules/notifiable_report/class.notifiable_report.php';
	$notifiable_report = new notifiable_report;
	if (!$module->activated('notifiable_report') && $initmod) {
		$notifiable_report->init_sql();
		$notifiable_report->init_menu();
		$notifiable_report->init_deps();
		$notifiable_report->init_lang();
		$notifiable_report->init_help();
	}
}
if (file_exists('../modules/ntp/class.ntp.php')) {
	include '../modules/ntp/class.ntp.php';
	$ntp = new ntp;
	if (!$module->activated('ntp') && $initmod) {
		$ntp->init_sql();
		$ntp->init_menu();
		$ntp->init_deps();
 function process_inclusive_dates()
 {
     if (func_num_args() > 0) {
         $arg_list = func_get_args();
         $menu_id = $arg_list[0];
         $post_vars = $arg_list[1];
         $get_vars = $arg_list[2];
         $validuser = $arg_list[3];
         $isadmin = $arg_list[4];
         //print_r($arg_list);
     }
     $sql_delete = "delete from m_patient_notifiable_tcl";
     $result_delete = mysql_query($sql_delete) or die(mysql_error());
     list($month, $day, $year) = explode("/", $post_vars["start_date"]);
     $start_date = $year . "-" . str_pad($month, 2, "0", STR_PAD_LEFT) . "-" . str_pad($day, 2, "0", STR_PAD_LEFT);
     list($month, $day, $year) = explode("/", $post_vars["end_date"]);
     $end_date = $year . "-" . str_pad($month, 2, "0", STR_PAD_LEFT) . "-" . str_pad($day, 2, "0", STR_PAD_LEFT);
     // loop through m_consult_disease_notifiable
     $sql = "select p.patient_id, c.consult_id, " . "concat(p.patient_lastname, ', ', p.patient_firstname) patient_name, c.onset_date, " . "round((to_days(now())-to_days(p.patient_dob))/365 , 1) patient_age, p.patient_gender, " . "c.disease_id from m_consult_disease_notifiable c, m_patient p " . "where c.patient_id = p.patient_id and to_days(c.disease_timestamp) >= to_days('{$start_date}') " . "and to_days(c.disease_timestamp) <= to_days('{$end_date}')";
     if ($result = mysql_query($sql)) {
         if (mysql_num_rows($result)) {
             while ($report = mysql_fetch_array($result)) {
                 // blank variables
                 $family_id = 0;
                 $patient_address = '';
                 $barangay_name = '';
                 $disease_name = '';
                 $icd_code = '';
                 // retrieve other data
                 $family_id = family::get_family_id($report["patient_id"]);
                 if ($family_id) {
                     $patient_address = family::show_address($family_id);
                     $barangay_name = family::barangay_name($family_id);
                 }
                 $disease_name = notifiable::get_notifiable_disease_name($report["patient_id"], $report[consult_id]);
                 $icd_code = notifiable_report::get_disease_icdcode($report["patient_id"], $report[consult_id]);
                 // insert data into tcl
                 $sql_insert = "insert into m_patient_notifiable_tcl (consult_id, patient_id, " . "patient_name, onset_date, patient_age, patient_gender, patient_address, " . "barangay_name, diagnosis, icd10) " . "values ('" . $report["consult_id"] . "', '" . $report["patient_id"] . "', " . "'" . $report["patient_name"] . "', '" . $report["onset_date"] . "', '" . $report["patient_age"] . "', " . "'" . $report["patient_gender"] . "', '{$patient_address}', '{$barangay_name}', " . "'{$disease_name}', '{$icd_code}')";
                 $result_insert = mysql_query($sql_insert);
             }
             // while
             $sql = "select concat(patient_name,' / ',patient_gender,' / ',patient_age) " . "'PATIENT NAME / GENDER / AGE', patient_address 'ADDRESS', " . "barangay_name 'BARANGAY', onset_date 'ONSET DATE', " . "diagnosis 'DIAGNOSIS', icd10 'ICD10'" . "from m_patient_notifiable_tcl order by barangay_name, diagnosis";
             $pdf = new PDF('P', 'pt', 'A4');
             $pdf->SetFont('Arial', '', 10);
             $pdf->AliasNbPages();
             $pdf->connect('localhost', 'root', 'root', 'chits');
             $attr = array('titleFontSize' => 14, 'titleText' => 'TARGET CLIENT LIST FOR NOTIFIABLE DISEASES (' . $post_vars["start_date"] . ' - ' . $post_vars["end_date"] . ')');
             $pdf->mysql_report($sql, false, $attr, "../modules/_uploads/notifiable_tcl.pdf");
             header("location: " . $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"] . "&report_menu=TCL");
         }
     }
 }