Exemplo n.º 1
0
 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_epi_tcl";
     $result_delete = mysql_query($sql_delete);
     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);
     /*$sql = "select p.patient_id, p.patient_dob, concat(p.patient_lastname, ', ', p.patient_firstname) ".
     	       "patient_name, p.patient_mother, ".
     	       "date_format(adddate(p.patient_dob, interval 1 year), '%b %y') month_reaches_age1, m.fully_immunized_date ".
                    "from m_patient p, m_patient_ccdev m ".
                    "where p.patient_id = m.patient_id and ".
                    "to_days(adddate(p.patient_dob,interval 1 year)) >= to_days('$start_date') and ".
     	       "to_days(adddate(p.patient_dob,interval 1 year)) <= to_days('$end_date') order by p.patient_dob ";
     	*/
     /*$sql = "select patient_id, patient_dob, concat(patient_lastname, ', ', patient_firstname) ".
       "patient_name, patient_mother, ".
       "date_format(adddate(patient_dob, interval 1 year), '%b %y') month_reaches_age1 ".
              "from m_patient ".
              "where to_days(adddate(patient_dob,interval 1 year)) >= to_days('$start_date') and ".
       "to_days(adddate(patient_dob,interval 1 year)) <= to_days('$end_date') order by patient_dob ";*/
     $sql = "select patient_id, patient_dob, concat(patient_lastname, ', ', patient_firstname) " . "patient_name, patient_mother, " . "date_format(adddate(patient_dob, interval 1 year), '%b %y') month_reaches_age1 " . "from m_patient " . "where to_days(registration_date) >= to_days('{$start_date}') and " . "to_days(registration_date) <= to_days('{$end_date}') order by registration_date ";
     if ($result = mysql_query($sql)) {
         if (mysql_num_rows($result)) {
             while ($report = mysql_fetch_array($result)) {
                 // blank variables
                 $patient_age = patient::get_age($report[patient_id]);
                 if ($patient_age <= 1) {
                     $family_id = 0;
                     $patient_address = '';
                     $barangay_id = '';
                     // retrieve other data
                     $family_id = family::get_family_id($report["patient_id"]);
                     if ($family_id) {
                         $patient_address = family::show_address($family_id);
                         $barangay_id = family::barangay_id($family_id);
                     }
                     $fully_immunized_date = $this->get_fully_immunized_date($report[patient_id]);
                     // insert data into tcl
                     $sql_insert = "insert into m_patient_epi_tcl (patient_id, patient_dob, family_id, patient_name, " . "patient_mother, patient_address, barangay_name, month_reaches_age1, " . "fully_immunized_date) values ('" . $report["patient_id"] . "', " . "'" . $report["patient_dob"] . "', '{$family_id}', '" . $report["patient_name"] . "', " . "'" . $report["patient_mother"] . "', '{$patient_address}', '{$barangay_id}', " . "'" . $report["month_reaches_age1"] . "', '{$fully_immunized_date}')";
                     $result_insert = mysql_query($sql_insert) or die(mysql_error());
                     $this->get_vaccine_date($report["patient_id"], $start_date, $end_date);
                 }
             }
             // while
             $sql = "select patient_id 'PATIENT ID', date_format(patient_dob,'%c/%e/%y') 'DATE OF BIRTH', " . "family_id 'FAMILY ID', patient_name 'NAME OF INFANT', patient_mother 'NAME OF MOTHER', " . "patient_address 'ADDRESS', barangay_name 'BRGY', month_reaches_age1 'MONTH REACHES AGE 1', " . "fully_immunized_date 'DATE FULLY IMMUNIZED', " . "BCG 'BCG', DPT1 'DPT 1', " . "DPT2 'DPT 2', DPT3 'DPT 3', " . "OPV1 'POLIO 1', OPV2 'POLIO 2', " . "OPV3 'POLIO 3', MSL 'MEASLES', " . "HEPB1 'HEPA B1', HEPB2 'HEPA B2', " . "HEPB3 'HEPA B3' " . "from m_patient_epi_tcl order by barangay_name, patient_dob ";
             //"where to_days(actual_vaccine_date) >= to_days('$start_date') and ".
             //"to_days(actual_vaccine_date) <= to_days('$end_date') ".
             //"order by barangay_name, patient_dob ";
             $pdf = new PDF('L', 'pt', 'Legal');
             //$pdf->SetMargins('0.5','0.5','0.5');
             $pdf->SetFont('Arial', '', 10);
             //$pdf->SetMargins('0.5','0.5','0.5');
             $pdf->AliasNbPages();
             $pdf->connect('localhost', 'root', '', 'game');
             $attr = array('titleFontSize' => 14, 'titleText' => 'TARGET CLIENT LIST FOR EPI (' . $post_vars["start_date"] . ' - ' . $post_vars["end_date"] . ')');
             $pdf->mysql_report($sql, false, $attr, "../modules/_uploads/epi_tcl.pdf");
             header("location: " . $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"] . "&report_menu=TCL");
         }
     }
 }
Exemplo n.º 2
0
                print "\n\t);\n";
                exit;
            }
        } else {
            // end of if tablewidths not defined
            for ($i = 0; $i < $this->numFields; $i++) {
                $this->colTitles[$i] = mysql_field_name($this->results, $i);
                switch (mysql_field_type($this->results, $i)) {
                    case 'int':
                        $this->colAlign[$i] = 'R';
                        break;
                    default:
                        $this->colAlign[$i] = 'L';
                }
            }
        }
        mysql_data_seek($this->results, 0);
        $this->Open();
        $this->setY($this->tMargin);
        $this->AddPage();
        $this->morepagestable($this->FontSizePt);
        $this->Output();
    }
}
$pdf = new PDF('L', 'pt', 'A3');
$pdf->SetFont('Arial', '', 11.5);
$pdf->AliasNbPages();
$pdf->connect('localhost', 'bestbiblioteca', 'sauldelafuente', 'bestbiblioteca');
$attr = array('titleFontSize' => 14, 'titleText' => 'Biblioteca FOCIM - Reporte Datos Basicos');
$pdf->mysql_report("SELECT users.nombre, users.user, dupusers.fecha, dupusers.ip1, dupusers.ip2\n\t\t\t\t\tFROM users, dupusers WHERE users.id = dupusers.userid\n\t\t\t\t\tGROUP BY dupusers.id ORDER BY dupusers.fecha", false, $attr);
Exemplo n.º 3
0
 function process_tcl_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_patient_ntp
     if ($post_vars["start_date"] && $post_vars["end_date"]) {
     } else {
         print $sql = "select c.consult_timestamp, c.consult_id consult_id, p.patient_id, " . "concat(p.patient_lastname, ', ', p.patient_firstname) patient_name, " . "round((to_days(now())-to_days(p.patient_dob))/365 , 1) patient_age, p.patient_gender, n.tb_class, n.patient_type_id, " . "n.treatment_category_id, n.outcome_id, n.tb_class, n.treatment_partner_id " . "from m_patient_ntp n, m_patient p " . "where n.patient_id = p.patient_id";
     }
     if ($result = mysql_query($sql)) {
         if (mysql_num_rows($result)) {
             while ($ntp = mysql_fetch_array($result)) {
                 print_r($ntp);
                 // retrieve family address
                 $family_id = family::get_family_id($ntp["patient_id"]);
                 print $patient_address = family::show_address($family_id);
                 // retrieve sputum exams
                 $sputum_beforetx = sputum::get_sputum_results($ntp["ntp_id"], "DX");
                 $sputum_eo2 = sputum::get_sputum_results($ntp["ntp_id"], "EO2");
                 $sputum_eo3 = sputum::get_sputum_results($ntp["ntp_id"], "EO3");
                 $sputum_eo4 = sputum::get_sputum_results($ntp["ntp_id"], "EO4");
                 $sputum_eo5 = sputum::get_sputum_results($ntp["ntp_id"], "EO5");
                 $sputum_7m = sputum::get_sputum_results($ntp["ntp_id"], "7M");
                 $sql_insert = "insert into m_patient_ntp_tcl (ntp_id, " . "ntp_timestamp, patient_id, patient_name, " . "patient_age, patient_gender, patient_address, " . "facility_code, tb_class, patient_type, " . "treatment_category, sputum_beforetx_result, " . "sputum_beforetx_date, sputum_eo2_result, " . "sputum_eo2_date, sputum_eo3_result, sputum_eo3_date, " . "sputum_eo4_result, sputum_eo4_date, sputum_eo5_result, " . "sputum_eo5_date, sputum_7m_result, sputum_7m_date, " . "treatment_outcome, treatment_partner, remarks) " . "values ('" . $ntp["ntp_id"] . "', '" . $ntp["ntp_timestamp"] . "', " . "'" . $ntp["patient_id"] . "', '" . $ntp["patient_name"] . "', " . "'" . $ntp["patient_age"] . "', '" . $ntp["patient_gender"] . "', " . "'{$patient_address}', '" . $_SESSION["datanode"]["code"] . "', " . "'" . $ntp["tb_class"] . "','" . $ntp["patient_type_id"] . "', " . "'" . $ntp["treatment_category_id"] . "', '" . $sputum_beforetx["lab_diagnosis"] . "', " . "'" . $sputum_beforetx["lab_timestamp"] . "', '" . $sputum_eo2["lab_diagnosis"] . "', " . "'" . $sputum_eo2["lab_timestamp"] . "', '" . $sputum_eo3["lab_diagnosis"] . "', " . "'" . $sputum_eo3["lab_timestamp"] . "', '" . $sputum_eo4["lab_diagnosis"] . "', " . "'" . $sputum_eo4["lab_timestamp"] . "', '" . $sputum_eo5["lab_diagnosis"] . "', " . "'" . $sputum_eo5["lab_timestamp"] . "', '" . $sputum_7m["lab_diagnosis"] . "', " . "'" . $sputum_7m["lab_timestamp"] . "', '" . $ntp["outcome_id"] . "', " . "'" . $ntp["treatment_partner_id"] . "','')";
                 if ($result_insert = mysql_query($sql_insert)) {
                 } else {
                     $sql_update = "update m_patient_ntp_tcl set " . "sputum_beforetx_result = '" . $sputum_beforetx["lab_diagnosis"] . "', " . "sputum_beforetx_date = '" . $sputum_beforetx["lab_timestamp"] . "'," . "sputum_eo2_result = '" . $sputum_eo2["lab_diagnosis"] . "', " . "sputum_eo2_date = '" . $sputum_eo2["lab_timestamp"] . "', " . "sputum_eo3_result = '" . $sputum_eo3["lab_diagnosis"] . "', " . "sputum_eo3_date = '" . $sputum_eo3["lab_timestamp"] . "', " . "sputum_eo4_result = '" . $sputum_eo4["lab_diagnosis"] . "', " . "sputum_eo4_date = '" . $sputum_eo4["lab_timestamp"] . "', " . "sputum_eo5_result = '" . $sputum_eo5["lab_diagnosis"] . "', " . "sputum_eo5_date = '" . $sputum_eo5["lab_timestamp"] . "', " . "sputum_7m_result = '" . $sputum_7m["lab_diagnosis"] . "', " . "sputum_7m_date = '" . $sputum_7m["lab_timestamp"] . "' " . "where ntp_id = '" . $ntp["ntp_id"] . "'";
                     $result_update = mysql_query($sql_update) or die(mysql_error());
                 }
             }
             // while
             $sql = "select date_format(ntp_timestamp, '%Y-%m-%d') 'REG DATE', ntp_id 'ID', patient_name 'NAME', " . "concat(patient_age,'/',patient_gender) 'AGE/SEX', patient_address 'ADDRESS', " . "facility_code 'RHU/BHS', tb_class 'TB CLASS', patient_type 'PT TYPE', treatment_category 'TX CAT', " . "if(sputum_beforetx_result<>'', concat(sputum_beforetx_result,': ',sputum_beforetx_date),'NA') 'DX', " . "if(sputum_eo2_result<>'', concat(sputum_eo2_result,': ',sputum_eo2_date),'NA') 'EO Mo2', " . "if(sputum_eo3_result<>'', concat(sputum_eo3_result,': ',sputum_eo3_date), 'NA') 'EO Mo3', " . "if(sputum_eo4_result<>'', concat(sputum_eo4_result,': ',sputum_eo4_date), 'NA') 'EO Mo4', " . "if(sputum_eo5_result<>'', concat(sputum_eo5_result,': ',sputum_eo5_date), 'NA') 'EO Mo5', " . "if(sputum_7m_result<>'', concat(sputum_7m_result,': ',sputum_7m_date),'NA') '>7Mos', " . "treatment_outcome 'OUTCOME', treatment_partner 'PARTNER'" . "from m_patient_ntp_tcl order by ntp_timestamp";
             $pdf = new PDF('L', 'pt', 'A3');
             $pdf->SetFont('Arial', '', 10);
             $pdf->AliasNbPages();
             $pdf->connect('localhost', 'root', 'kambing', 'game');
             $attr = array('titleFontSize' => 14, 'titleText' => 'CONSULTS REGISTER');
             $pdf->mysql_report($sql, false, $attr, "../modules/_uploads/consult_tcl.pdf");
             header("location: " . $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"] . "&report_menu=TCL");
         }
     }
 }
 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");
         }
     }
 }
    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");
            }
        }
    }
Exemplo n.º 6
0
 function process_inclusive_dates()
 {
     if (func_num_args() > 0) {
         $arg_list = func_get_args();
         $menu_id = $arg_list[0];
         $post_vars = $arg_list[1];
         //$start_date = $arg_list[1];
         //$end_date = $arg_list[2];
         $get_vars = $arg_list[2];
         $validuser = $arg_list[3];
         $isadmin = $arg_list[4];
         //print_r($arg_list);
     }
     $sql_delete = "delete from m_patient_epi_tcl";
     $result_delete = mysql_query($sql_delete);
     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_vaccine
     $sql = "select p.patient_id, p.patient_dob, concat(p.patient_lastname, ', ', p.patient_firstname) " . "patient_name, p.patient_mother, " . "date_format(adddate(p.patient_dob, interval 1 year), '%m-%Y') month_reaches_age1, m.fully_immunized_date " . "from m_patient p, m_patient_ccdev m " . "where p.patient_id = m.patient_id and " . "to_days(p.patient_dob) >= to_days('{$start_date}') and " . "to_days(p.patient_dob) <= to_days('{$end_date}') order by p.patient_dob ";
     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 = '';
                 //$vaccines = '';
                 //$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);
                 }
                 // insert data into tcl
                 $sql_insert = "insert into m_patient_epi_tcl (patient_id, patient_dob, family_id, patient_name, " . "patient_mother, patient_address, barangay_name, month_reaches_age1, " . "fully_immunized_date) values ('" . $report["patient_id"] . "', " . "'" . $report["patient_dob"] . "', '{$family_id}', '" . $report["patient_name"] . "', " . "'" . $report["patient_mother"] . "', '{$patient_address}', '{$barangay_name}', " . "'" . $report["month_reaches_age1"] . "', '" . $report["fully_immunized_date"] . "')";
                 $result_insert = mysql_query($sql_insert) or die(mysql_error());
                 $this->get_vaccine_date($report["patient_id"], $start_date, $end_date);
             }
             // while
             $sql = "select * from m_patient_epi_tcl " . "order by barangay_name, patient_dob ";
             $pdf = new PDF('L', 'pt', 'Legal');
             $pdf->SetFont('Arial', '', 10);
             $pdf->AliasNbPages();
             $pdf->connect('localhost', 'root', 'root', 'lagrosa');
             $attr = array('titleFontSize' => 14, 'titleText' => 'EPI REGISTER');
             $pdf->mysql_report($sql, false, $attr, "../modules/_uploads/epi_tcl.pdf");
             header("location: " . $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"] . "&report_menu=TCL");
         }
     }
 }
Exemplo n.º 7
0
 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_mc_prenatal_tcl";
     $result_delete = mysql_query($sql_delete) or die(mysql_error());
     $sql_delete = "delete from m_patient_mc_postpartum_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);
     // prenatal
     $get_prenatal = mysql_query("SELECT\n              m.mc_id, \n              p.registration_date,\n              p.patient_id,\n              concat(p.patient_lastname,', ',p.patient_firstname) patient_name,\n              m.patient_lmp,\n              m.obscore_gp,\n              m.patient_edc,\n              m.trimester1_date,\n              m.trimester2_date,\n              m.trimester3_date,\n              date_format(m.delivery_date, '%c/%e/%y') delivery_date,\n              m.outcome_id, \n              m.birthweight,\n              m.delivery_location,\n              round((to_days(now())-to_days(p.patient_dob))/365,2) patient_age,\n              m.birthmode\n              FROM m_patient p, m_patient_mc m\n              WHERE p.patient_id = m.patient_id AND\n              to_days(p.registration_date) >= to_days('{$start_date}') AND\n              to_days(p.registration_date) <= to_days('{$end_date}') AND\n              m.delivery_date = '0000-00-00'") or die(mysql_error());
     /*$sql = "select m.mc_id, p.registration_date, p.patient_id, concat(p.patient_lastname, ', ', p.patient_firstname) ".
       "patient_name, m.patient_lmp, m.obscore_gp, m.patient_edc, m.trimester1_date, m.trimester2_date, ".
       "m.trimester3_date, date_format(m.delivery_date, '%c/%e/%y') delivery_date, m.outcome_id, m.birthweight, ".
       "m.delivery_location, ".
       "m.breastfeeding_asap, round((to_days(now())-to_days(p.patient_dob))/365,2) patient_age, ".
       "adddate(m.delivery_date, interval 28 day) postpartum_wk4, ".
       "adddate(m.delivery_date, interval 42 day) postpartum_wk6, m.birthmode ".
       "from m_patient p, m_patient_mc m ".
              "where p.patient_id = m.patient_id and ".
              "to_days(p.registration_date) >= to_days('$start_date') and ".
       "to_days(p.registration_date) <= to_days('$end_date') "; */
     if ($get_prenatal) {
         if (mysql_num_rows($get_prenatal)) {
             while ($prenatal = mysql_fetch_array($get_prenatal)) {
                 // blank variables
                 $family_id = '';
                 $patient_address = '';
                 $barangay_id = '';
                 // retrieve other data
                 $family_id = family::get_family_id($prenatal["patient_id"]);
                 if ($family_id != '0') {
                     $patient_address = family::show_address($family_id);
                     $barangay_id = family::barangay_id($family_id);
                 }
                 if ($prenatal[birthweight] == '0') {
                     $birthweight = '';
                 } else {
                     $birthweight = $prenatal[birthweight];
                 }
                 if ($prenatal[delivery_date] == '0/0/00') {
                     $delivery_date = '';
                 } else {
                     $delivery_date = $prenatal[delivery_date];
                 }
                 $fully_immunized_date = $this->get_fully_immunized_tt_date($prenatal["patient_id"]);
                 $tt_vaccines = $this->get_tt_vaccines($prenatal["patient_id"]);
                 $risk_id_date = $this->get_risk_id_date($prenatal["patient_id"]);
                 $iron_date = $this->get_iron_date($prenatal["patient_id"]);
                 /*$vita_date = $this->get_vita_date($report["patient_id"]);
                   $home_visit_dates = $this->get_home_visit_dates($report["patient_id"]);
                   $clinic_visit_dates = $this->get_clinic_visit_dates($report["patient_id"],$report[postpartum_wk4],$report[postpartum_wk6]);*/
                 $trimester1_visit_dates = $this->get_trimester1_visit_dates($prenatal["patient_id"], $prenatal["trimester1_date"], $prenatal["patient_lmp"]);
                 $trimester2_visit_dates = $this->get_trimester2_visit_dates($prenatal["patient_id"], $prenatal["trimester2_date"], $prenatal["trimester1_date"]);
                 $trimester3_visit_dates = $this->get_trimester3_visit_dates($prenatal["patient_id"], $prenatal["trimester3_date"], $prenatal["trimester2_date"]);
                 //$breastfeeding_date = $this->get_breastfeeding_date($report["patient_id"]);
                 $attendant = $this->get_attendant($prenatal[birthmode]);
                 //insert data into prenatal tcl
                 $sql_insert = "insert into m_patient_mc_prenatal_tcl (mc_id, patient_id, registration_date, family_id, patient_name, " . "patient_age, patient_address, barangay_name, patient_lmp, obscore_gp, patient_edc, " . "trimester1_visit_dates, trimester2_visit_dates, trimester3_visit_dates, risk_id_date, " . "fully_immunized_date, TT_vaccine_dates, IRON, delivery_date, outcome_id, birthweight, " . "delivery_location, attendant_name) values ('" . $prenatal["mc_id"] . "', " . "'" . $prenatal["patient_id"] . "', '" . $prenatal["registration_date"] . "', " . "'{$family_id}', '" . $prenatal["patient_name"] . "', '" . $prenatal["patient_age"] . "', " . "'{$patient_address}', '{$barangay_id}', '" . $prenatal["patient_lmp"] . "', " . "'" . $prenatal["obscore_gp"] . "', '" . $prenatal["patient_edc"] . "', " . "'{$trimester1_visit_dates}', '{$trimester2_visit_dates}', " . "'{$trimester3_visit_dates}', '{$risk_id_date}', '{$fully_immunized_date}', " . "'{$tt_vaccines}', '{$iron_date}', '{$delivery_date}', " . "'" . $prenatal["outcome_id"] . "', '{$birthweight}', " . "'" . $prenatal["delivery_location"] . "', '{$attendant}')";
                 $result_insert = mysql_query($sql_insert) or die(mysql_error());
                 /*$sql_insert = "insert into m_patient_mc_postpartum_tcl (mc_id, patient_id, family_id, patient_name, ".
                                               "patient_age, patient_address, barangay_name, postpartum_wk4, postpartum_wk6, ".
                   "date_started_breastfeeding, postpartum_home_visit, postpartum_clinic_visit, ".
                   "IRON, VITA) values ('".$report["mc_id"]."', '".$report["patient_id"]."', ".
                   "'$family_id', '".$report["patient_name"]."', '".$report["patient_age"]."', ".
                   "'$patient_address', '$barangay_id', '".$report["postpartum_wk4"]."', ".
                   "'".$report["postpartum_wk6"]."', '$breastfeeding_date','$home_visit_dates', ".
                   "'$clinic_visit_dates', '$iron_date', '$vita_date')";
                         $result_insert = mysql_query($sql_insert) or die(mysql_error());*/
             }
             // while
         }
     }
     // get postpartum
     /*$get_pp = mysql_query("SELECT
       m.mc_id,
       p.registration_date,
       p.patient_id,
       concat(p.patient_lastname,', ',p.patient_firstname) patient_name,
       m.breastfeeding_asap,
       round((to_days(now())-to_days(p.patient_dob))/365,2) patient_age,
       adddate(m.delivery_date, interval 28 day) postpartum_wk4,
       adddate(m.delivery_date, interval 42 day) postpartum_wk6
       FROM m_patient p, m_patient_mc m
       WHERE p.patient_id = m.patient_id AND
       to_days(p.registration_date) >= to_days('$start_date') AND
       to_days(p.registration_date) <= to_days('$end_date') AND
       m.delivery_date <> '0000-00-00' ")
       or die(mysql_error());*/
     /*$get_pp = mysql_query("SELECT
       m.mc_id,
       p.registration_date,
       p.patient_id,
       concat(p.patient_lastname,', ',p.patient_firstname) patient_name,
       m.breastfeeding_asap,
       round((to_days(now())-to_days(p.patient_dob))/365,2) patient_age,
       adddate(m.delivery_date, interval 28 day) postpartum_wk4,
       adddate(m.delivery_date, interval 42 day) postpartum_wk6
       FROM m_patient p, m_patient_mc m
       WHERE p.patient_id = m.patient_id AND
       to_days(m.postpartum_date) >= to_days('$start_date') AND
       to_days(m.postpartum_date) <= to_days('$end_date') ")
       or die(mysql_error());*/
     $get_pp = mysql_query("SELECT\n              m.mc_id,\n              p.registration_date, pp.postpartum_date, pp.visit_sequence,\n              p.patient_id,\n              concat(p.patient_lastname,', ',p.patient_firstname) patient_name,\n              m.breastfeeding_asap,\n              round((to_days(now())-to_days(p.patient_dob))/365,2) patient_age,\n              adddate(m.delivery_date, interval 28 day) postpartum_wk4,\n              adddate(m.delivery_date, interval 42 day) postpartum_wk6\n              FROM m_patient p, m_patient_mc m, m_consult_mc_postpartum pp\n              WHERE p.patient_id = m.patient_id AND\n              to_days(pp.postpartum_date) >= to_days('{$start_date}') AND\n              to_days(pp.postpartum_date) <= to_days('{$end_date}') AND \n              m.patient_id=pp.patient_id AND \n              pp.visit_sequence='1'") or die(mysql_error());
     if ($get_pp) {
         if (mysql_num_rows($get_pp)) {
             while ($pp = mysql_fetch_array($get_pp)) {
                 // blank variables
                 $family_id = '';
                 $patient_address = '';
                 $barangay_id = '';
                 // retrieve other data
                 $family_id = family::get_family_id($pp["patient_id"]);
                 if ($family_id != '0') {
                     $patient_address = family::show_address($family_id);
                     $barangay_id = family::barangay_id($family_id);
                 }
                 $vita_date = $this->get_vita_date($pp["patient_id"]);
                 $iron_date = $this->get_iron_date($pp["patient_id"]);
                 $home_visit_dates = $this->get_home_visit_dates($pp["patient_id"]);
                 $clinic_visit_dates = $this->get_clinic_visit_dates($pp["patient_id"], $pp[postpartum_wk4], $pp[postpartum_wk6]);
                 $breastfeeding_date = $this->get_breastfeeding_date($pp["patient_id"]);
                 // insert into postpartum tcl
                 $sql_insert = "insert into m_patient_mc_postpartum_tcl (mc_id, patient_id, family_id, patient_name, " . "patient_age, patient_address, barangay_name, postpartum_wk4, postpartum_wk6, " . "date_started_breastfeeding, postpartum_home_visit, postpartum_clinic_visit, " . "IRON, VITA) values ('" . $pp["mc_id"] . "', '" . $pp["patient_id"] . "', " . "'{$family_id}', '" . $pp["patient_name"] . "', '" . $pp["patient_age"] . "', " . "'{$patient_address}', '{$barangay_id}', '" . $pp["postpartum_wk4"] . "', " . "'" . $pp["postpartum_wk6"] . "', '{$breastfeeding_date}','{$home_visit_dates}', " . "'{$clinic_visit_dates}', '{$iron_date}', '{$vita_date}')";
                 $result_insert = mysql_query($sql_insert) or die(mysql_error());
             }
         }
     }
     $sql = "select date_format(registration_date, '%c/%e/%y') 'REGISTRATION DATE', " . "family_id 'FAMILY ID', concat(patient_name, ' / ', patient_age) 'NAME / AGE', " . "patient_address 'ADDRESS', barangay_name 'BRGY', date_format(patient_lmp, '%c/%e/%y') 'LMP', " . "obscore_gp 'G-P', date_format(patient_edc, '%c/%e/%y') 'EDC', " . "trimester1_visit_dates '1st TRIMESTER VISITS', " . "trimester2_visit_dates '2nd TRIMESTER VISITS', " . "trimester3_visit_dates '3rd TRIMESTER VISITS', " . "risk_id_date 'RISK CODE / DATE DETECTED', fully_immunized_date " . "'FULLY IMMUNIZED DATE', TT_vaccine_dates 'TT IMMUNIZATION GIVEN', " . "IRON 'IRON', delivery_date 'DATE TERMINATED', " . "outcome_id 'OUTCOME', birthweight 'BIRTH WEIGHT', delivery_location 'PLACE OF DELIVERY', " . "attendant_name 'ATTENDED BY' " . "from m_patient_mc_prenatal_tcl order by barangay_name, registration_date ";
     $pdf = new PDF('L', 'pt', 'Legal');
     $pdf->SetFont('Arial', '', 10);
     $pdf->AliasNbPages();
     $pdf->connect('localhost', 'root', 'root', 'cuartero');
     $attr = array('titleFontSize' => 14, 'titleText' => 'TARGET CLIENT LIST FOR PRENATAL CARE (' . $post_vars["start_date"] . ' - ' . $post_vars["end_date"] . ')');
     $pdf->mysql_report($sql, false, $attr, "../modules/_uploads/mc_prenatal_tcl.pdf");
     header("location:" . $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"] . "&report_menu=TCL");
     $sql = "select family_id 'FAMILY ID', concat(patient_name, ' / ', patient_age) 'NAME / AGE', " . "patient_address 'ADDRESS', barangay_name 'BRGY', date_format(postpartum_wk4, '%c/%e/%y') '4TH PP WK', " . "date_format(postpartum_wk6, '%c/%e/%y') '6TH PP WK', " . "postpartum_home_visit 'DATES OF POSTPARTUM CARE HOME VISITS', " . "postpartum_clinic_visit 'DATES OF POSTPARTUM CARE CLINIC CHECK-UP BTW 4-6 WKS PP', " . "date_started_breastfeeding 'DATE STARTED BREASTFEEDING', " . "IRON 'IRON', VITA 'VITAMIN A' " . "from m_patient_mc_postpartum_tcl order by barangay_name, patient_name ";
     $pdf = new PDF('L', 'pt', 'Legal');
     $pdf->SetFont('Arial', '', 12);
     $pdf->AliasNbPages();
     $pdf->connect('localhost', 'root', 'root', 'chits');
     $attr = array('titleFontSize' => 14, 'titleText' => 'TARGET CLIENT LIST FOR POSTPARTUM CARE (' . $post_vars["start_date"] . ' - ' . $post_vars["end_date"] . ')');
     $pdf->mysql_report($sql, false, $attr, "../modules/_uploads/mc_postpartum_tcl.pdf");
     header("location:" . $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"] . "&report_menu=TCL");
 }
Exemplo n.º 8
0
                print "\n\t);\n";
                exit;
            }
        } else {
            // end of if tablewidths not defined
            for ($i = 0; $i < $this->numFields; $i++) {
                $this->colTitles[$i] = mysql_field_name($this->results, $i);
                switch (mysql_field_type($this->results, $i)) {
                    case 'int':
                        $this->colAlign[$i] = 'R';
                        break;
                    default:
                        $this->colAlign[$i] = 'L';
                }
            }
        }
        mysql_data_seek($this->results, 0);
        $this->Open();
        $this->setY($this->tMargin);
        $this->AddPage();
        $this->morepagestable($this->FontSizePt);
        $this->Output();
    }
}
$pdf = new PDF('L', 'pt', 'A3');
$pdf->SetFont('Arial', '', 11.5);
$pdf->AliasNbPages();
$pdf->connect('localhost', 'bestbiblioteca', 'sauldelafuente', 'bestbiblioteca');
$attr = array('titleFontSize' => 14, 'titleText' => 'Biblioteca FOCIM - Reporte Datos Basicos');
$pdf->mysql_report("SELECT libros.titulo AS TITULO,\n\t\t\tlibros.id AS ID,\n\t\t\tlibros.anyo AS ANYO,\n\t\t\tlibros.edicion AS EDICION,\n\t\t\tlibros.isbn AS ISBN,\n\t\t\tlibros.coleccion AS COLECCION,\n\t\t\teditoriales.nombre AS EDITORIAL,\n\t\t\tciudades.nombre AS CIUDAD,\n\t\t\tpaises.nombre AS PAIS \n\t\t\tFROM libros,\n\t\t\t\teditoriales,\n\t\t\t\tciudades,\n\t\t\t\tpaises \n\t\t\tWHERE editoriales.id=libros.editorial\n\t\t\tAND ciudades.id=libros.ciudad\n\t\t\tAND paises.id=libros.pais ORDER BY libros.id", false, $attr);
Exemplo n.º 9
0
                $this->colTitles[$i] = mysql_field_name($this->results, $i);
                switch (mysql_field_type($this->results, $i)) {
                    case 'int':
                        $this->colAlign[$i] = 'R';
                        break;
                    default:
                        $this->colAlign[$i] = 'L';
                }
            }
        }
        mysql_data_seek($this->results, 0);
        $this->Open();
        $this->setY($this->tMargin);
        $this->AddPage();
        $this->morepagestable($this->FontSizePt);
        $this->Output();
    }
}
$pdf = new PDF('L', 'pt', 'A3');
$pdf->SetFont('Arial', '', 9);
$pdf->AliasNbPages();
// The first Parameter is localhost again unless you are retrieving data from a different server.
// The second parameter is your MySQL User ID.
// The third parameter is your password for MySQL. In many cases these would be the same as your OS
ID and Password . $pdf->connect('localhost', 'UserID', 'PassWord', 'Database');
// This is the title of the Report generated.
$attr = array('titleFontSize' => 24, 'titleText' => 'MySQL Report generation using FPDF');
// This is your query. It should be a 'SELECT' query.
// Reports are run over 'SELECT' querires generally.
$pdf->mysql_report("SELECT * FROM Table", false, $attr);
Exemplo n.º 10
0
<?php

require 'mysql_report.php';
$pdf = new PDF('L', 'pt', 'A3');
$pdf->SetFont('Arial', '', 11.5);
$pdf->connect('localhost', 'root', '', 'db');
$attr = array('titleFontSize' => 18, 'titleText' => 'this would be the title');
$pdf->mysql_report("SELECT * FROM registered_users ORDER BY USER LIMIT 100", false, $attr);
$pdf->Output();