function generate_summary() { 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); } list($month, $day, $year) = explode("/", $post_vars["report_date"]); //$report_date = $year."-".str_pad($month, 2, "0", STR_PAD_LEFT)."-".str_pad($day, 2, "0", STR_PAD_LEFT); $report_date = $year . '-' . $month . '-' . str_pad($day, 2, "0", STR_PAD_LEFT); list($end_month, $end_day, $end_year) = explode("/", $post_vars["end_report_date"]); //$end_report_date = $end_year."-".str_pad($end_month, 2, "0", STR_PAD_LEFT)."-".str_pad($day, 2, "0", STR_PAD_LEFT); $end_report_date = $end_year . '-' . $end_month . '-' . str_pad($end_day, 2, "0", STR_PAD_LEFT); $_SESSION[report_date] = $report_date; $_SESSION[end_report_date] = $end_report_date; // STEP 1. empty report tables for given date $sql_delete = "delete from m_consult_report_dailyservice where service_date BETWEEN '{$report_date}' AND '{$end_report_date}'"; $result_delete = mysql_query($sql_delete); $sql_delete = "delete from m_consult_ccdev_report_dailyservice where service_date BETWEEN '{$report_date}' AND '{$end_report_date}'"; $result_delete = mysql_query($sql_delete); $sql_delete = "delete from m_consult_mc_report_dailyservice where service_date BETWEEN '{$report_date}' AND '{$end_report_date}'"; $result_delete = mysql_query($sql_delete); // STEP 2. get all consults for specified report date // records are unique for patient_id and service_date /*$sql_patient = "select c.patient_id, c.consult_id, ". "concat(p.patient_lastname, ', ', p.patient_firstname) patient_name, ". "round((to_days(c.consult_date)-to_days(p.patient_dob))/365,2) patient_age, ". "p.patient_gender ". "from m_consult c, m_patient p ". "where c.patient_id = p.patient_id ". "and to_days(c.consult_date) = to_days('$report_date')"; */ $sql_patient = "select c.patient_id, c.consult_id, " . "concat(p.patient_lastname, ', ', p.patient_firstname, ' ',p.patient_middle) patient_name, " . "round((to_days(c.consult_date)-to_days(p.patient_dob))/365,2) patient_age, " . "p.patient_gender,date_format(c.consult_date,'%h:%i %p') as consult_start,date_format(c.consult_end,'%h:%i %p') as consult_end, round((unix_timestamp(c.consult_end)-unix_timestamp(c.consult_date))/60,2) as consult_minutes, elapsed_time " . "from m_consult c, m_patient p " . "where c.patient_id = p.patient_id " . "and c.consult_date BETWEEN '{$report_date}' AND '{$end_report_date}'"; $result_patient = mysql_query($sql_patient) or die("Cannot query: 305 " . mysql_error()); if ($result_patient) { if (mysql_num_rows($result_patient)) { while ($patient = mysql_fetch_array($result_patient)) { // get family and address if ($family_id = family::get_family_id($patient["patient_id"])) { $patient_address = family::get_family_address($family_id); $barangay_id = family::barangay_id($family_id); } else { $family_id = 0; $barangay_id = 0; $patient_address = reminder::get_home_address($patient_id); //$barangay_name = reminder::get_barangay($patient_id); } // get chief complaint and diagnosis from notes $complaints = notes::get_complaints($patient["patient_id"], $report_date); $diagnosis = notes::get_diagnosis_list($patient["patient_id"], $report_date); $treatment = notes::get_plan($patient["patient_id"], $report_date); //get vaccines $vaccines = $this->get_vaccines($patient["patient_id"], $report_date, $end_report_date); $services = $this->get_services($patient["consult_id"], $patient["patient_id"], $report_date, $end_report_date); $ptgroup = $this->get_ptgroup($patient["consult_id"], $report_date, $end_report_date); $aog = $this->get_aog($patient["patient_id"], $report_date, $end_report_date); $visit_seq = healthcenter::get_total_visits($patient["patient_id"]); $philhealth_id = philhealth::get_philhealth_id($patient["patient_id"]); //get elapsed time and data and time started $elapsed_time = $this->get_str_elapsed($patient["consult_start"], $patient["consult_end"], $patient["elapsed_time"]); if ($mc_id = mc::registry_record_exists($patient["patient_id"])) { $pp_weeks = mc::get_pp_weeks($mc_id, $patient["consult_id"]); //$visit_sequence = mc::get_ppvisit_sequence($mc_id, $patient["consult_id"]); } if ($complaints != '' || $diagnosis != '' || $treatment != '') { $sql_insert = "insert into m_consult_report_dailyservice (patient_id, patient_name, " . "patient_gender, patient_age, patient_address, patient_bgy, family_id, philhealth_id, " . "notes_cc, notes_dx, notes_tx, service_date) values " . "('" . $patient["patient_id"] . "', '" . $patient["patient_name"] . "', " . "'" . $patient["patient_gender"] . "', '" . $patient["patient_age"] . "', " . "'{$patient_address}', '{$barangay_id}', '{$family_id}', '{$philhealth_id}', " . "'{$complaints}', '{$diagnosis}', '{$treatment}', '{$report_date}')"; $result_insert = mysql_query($sql_insert); } if ($vaccines != '' || $services != '') { if ($ptgroup == 'CHILD') { $sql_insert = "insert into m_consult_ccdev_report_dailyservice (patient_id, " . "patient_name, patient_gender, patient_age, patient_address, patient_bgy, " . "family_id, philhealth_id, service_given, vaccine_given, service_date) values " . "('" . $patient["patient_id"] . "', '" . $patient["patient_name"] . "', " . "'" . $patient["patient_gender"] . "', '" . $patient["patient_age"] . "', " . "'{$patient_address}', '{$barangay_id}', '{$family_id}', '{$philhealth_id}', " . "'{$services}', '{$vaccines}', '{$report_date}')"; $result_insert = mysql_query($sql_insert); } if ($ptgroup == 'MATERNAL') { $sql_insert = "insert into m_consult_mc_report_dailyservice (patient_id, " . "patient_name, patient_gender, patient_age, aog_weeks, postpartum_weeks, patient_address, " . "patient_bgy, family_id, philhealth_id, visit_sequence, service_given, vaccine_given, " . "service_date) values " . "('" . $patient["patient_id"] . "', '" . $patient["patient_name"] . "', " . "'" . $patient["patient_gender"] . "', '" . $patient["patient_age"] . "', " . "'{$aog}', '{$pp_weeks}', '{$patient_address}', '{$barangay_id}', '{$family_id}', '{$philhealth_id}', " . "'{$visit_seq}', '{$services}', '{$vaccines}', '{$report_date}')"; $result_insert = mysql_query($sql_insert); } } } /*$sql = "select patient_id 'PATIENT ID', concat(patient_name,' / ',patient_gender,' / ',patient_age) ". "'NAME / SEX / AGE', patient_address 'ADDRESS', patient_bgy 'BRGY', family_id 'FAMILY ID', ". "philhealth_id 'PHILHEALTH ID', notes_cc 'COMPLAINTS', notes_dx 'DIAGNOSIS', notes_tx 'TREATMENT' ". "from m_consult_report_dailyservice where service_date = '$report_date' order by patient_name "; $pdf = new PDF('L','pt','A4'); $pdf->SetFont('Arial','',12); $pdf->AliasNbPages(); $pdf->connect('localhost','$_SESSION[dbuser]','$_SESSION[dbpass]','$_SESSION[dbname]'); $attr=array('titleFontSize'=>14,'titleText'=>'DAILY SERVICE REGISTER - CONSULTS'); $pdf->mysql_report($sql,false,$attr,"../modules/_uploads/consult_reg.pdf"); header("location:".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&report_menu=SUMMARY"); //$sql = "select patient_id 'PATIENT ID', concat(patient_name,' / ',patient_gender,' / ',patient_age) ". // "'NAME / SEX / AGE', patient_address 'ADDRESS', patient_bgy 'BRGY', family_id 'FAMILY ID', ". // "philhealth_id 'PHILHEALTH ID', vaccine_given 'VACCINE(S) GIVEN', service_given 'SERVICE(S) GIVEN' " // "from m_consult_ccdev_report_dailyservice where service_date = '$report_date' order by patient_name "; //$pdf = new PDF('L','pt','A4'); //$pdf->SetFont('Arial','',12); //$pdf->AliasNbPages(); //$pdf->connect('localhost','$_SESSION[dbuser]','$_SESSION[dbpass]','$_SESSION[dbname]'); //$attr=array('titleFontSize'=>14,'titleText'=>'DAILY SERVICE REGISTER - CHILD CARE SERVICES'); //$pdf->mysql_report($sql,false,$attr,"../modules/_uploads/consult_ccdev_reg.pdf"); //header("location:".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&report_menu=SUMMARY"); $sql = "select patient_id 'PATIENT ID', concat(patient_name,' / ',patient_gender,' / ',patient_age) ". "'NAME / SEX / AGE', aog_weeks 'AOG (wks)', postpartum_weeks 'POSTPARTUM WK', ". "patient_address 'ADDRESS', patient_bgy 'BRGY', family_id 'FAMILY ID', ". "philhealth_id 'PHILHEALTH ID', visit_sequence 'VISIT SEQ.', vaccine_given 'VACCINE(S) GIVEN', ". "service_given 'SERVICE(S) GIVEN' ". "from m_consult_mc_report_dailyservice where service_date = '$report_date' order by patient_name "; $pdf = new PDF('L','pt','A4'); $pdf->SetFont('Arial','',12); $pdf->AliasNbPages(); $pdf->connect('localhost','$_SESSION[dbuser]','$_SESSION[dbpass]','$_SESSION[dbname]'); $attr=array('titleFontSize'=>14,'titleText'=>'DAILY SERVICE REGISTER - MATERNAL CARE SERVICES'); $pdf->mysql_report($sql,false,$attr,"../modules/_uploads/consult_mc_reg.pdf"); header("location:".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&report_menu=SUMMARY"); */ } } //STEP 3. display daily service report print "<br/>"; print "<b>DAILY SERVICE REPORT</b><br/>"; print "REPORT DATE : <b>" . $post_vars["report_date"] . " to " . $post_vars["end_report_date"] . "</b><br/><br/>"; print "PRINTER FRIENDLY VERSION: <a href='../chits_query/pdf_reports/dailyservice_report.php?arr=consult' target='new'>CONSULTS</a> "; print "<a href='../chits_query/pdf_reports/dailyservice_report.php?arr=ccdev' target='new'>CHILD CARE</a> "; print "<a href='../chits_query/pdf_reports/dailyservice_report.php?arr=mc' target='new'>MATERNAL CARE</a><br />"; $_SESSION["arr_consult"] = $this->display_consults($report_date, "patient_id", $end_report_date); //pass the report_date and patient_id $_SESSION["arr_ccdev"] = $this->display_ccdev($report_date, $end_report_date); $_SESSION["arr_mc"] = $this->display_mc($report_date, $end_report_date); $sql = "select count(distinct(patient_id)) from m_consult where " . "to_days(consult_date) = to_days('{$report_date}') and patient_id != '0'"; $result = mysql_result(mysql_query($sql), 0); print "<br/>"; print "Total No. of Today's Patients : {$result}"; }
function form_mc_postpartum() { 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); } if ($post_vars["mc_id"] && $post_vars["submitmc"]=="Update Postpartum Data Form") { $sql = "select mc_id, patient_id, consult_id, mc_consult_date, ". "delivery_date, obscore_gp, obscore_fpal, child_patient_id, ". "delivery_location, outcome_id, birthmode, birthweight, ". "breastfeeding_asap,date_breastfed,healthy_baby ". "from m_patient_mc ". "where mc_id = '".$post_vars["mc_id"]."'"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { $mc = mysql_fetch_array($result); if($mc["date_breastfed"]!='0000-00-00'): list($byr,$bmonth,$bdate) = explode('-',$mc["date_breastfed"]); $bfeed_date = $bmonth.'/'.$bdate.'/'.$byr; endif; } } } // get most recent pregnancy id $patient_id = healthcenter::get_patient_id($get_vars["consult_id"]); $mc_id = mc::registry_record_exists($patient_id); if ($mc_id) { // edit prenatal data print "<a name='visit1form'>"; print "<table width='300'>"; print "<form action = '".$_SERVER["SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&consult_id=".$get_vars["consult_id"]."&ptmenu=".$get_vars["ptmenu"]."&module=mc&mc=POSTP&mc_id=".$get_vars["mc_id"]."' name='form_mc_postpartum' method='post'>"; print "<tr valign='top'><td>"; print "<b>".FTITLE_MC_POSTPARTUM_DATA_FORM."</b><br/><br/>"; print "</td></tr>"; print "<tr valign='top'><td>"; print "<span class='tinylight'><b>IMPORTANT:</b> ".INSTR_POSTPARTUM_RECORD.". DATA FIELDS WITH <font color='red'><b>*</b></font> ARE REQUIRED.</span><br/>"; // THIS COMPLETES THE REST OF ENTRIES IN m_patient_mc TABLE print "<table bgcolor='#FFCCFF' width='300' cellpadding='3'>"; print "<tr valign='top'><td>"; print "<span class='boxtitle'>REGISTRY INFORMATION</span><br/>"; print "<span class='tinylight'>"; print "REGISTRY ID: <font color='red'>".module::pad_zero($mc_id, 7)."</font><br/>"; print "</span>"; print "</td></tr>"; print "<tr valign='top'><td>"; if ($mc["delivery_date"]) { list($year, $month, $day) = explode("-", $mc["delivery_date"]); $delivery_date = "$month/$day/$year"; } print "<span class='boxtitle'>".LBL_DELIVERY_DATE."<font color='red'> *</font></span><br> "; print "<input type='text' size='10' maxlength='10' class='textbox' name='delivery_date' value='".($delivery_date?$delivery_date:$post_vars["delivery_date"])."' style='border: 1px solid #000000'> "; print "<a href=\"javascript:show_calendar4('document.form_mc_postpartum.delivery_date', document.form_mc_postpartum.delivery_date.value);\"><img src='../images/cal.gif' width='16' height='16' border='0' alt='Click Here to Pick up the date'></a><br>"; print "<small>Click on the calendar icon to select date. Otherwise use MM/DD/YYYY format.</small><br>"; print "</td></tr>"; print "<tr valign='top'><td>"; print "<span class='boxtitle'>".LBL_FINAL_OBSTETRIC_SCORE."</span><br> "; print "G/P <input type='text' class='tinylight' size='7' maxlength='7' name='obscore_gp' value='".($mc["obscore_gp"]?$mc["obscore_gp"]:$post_vars["obscore_gp"])."' style='border: 1px solid #000000'> "; print "FPAL <input type='text' class='tinylight' size='7' maxlength='7' name='obscore_fpal' value='".($mc["obscore_fpal"]?$mc["obscore_fpal"]:$post_vars["obscore_fpal"])."' style='border: 1px solid #000000'><br>"; print "</td></tr>"; print "<tr valign='top'><td>"; print "<span class='boxtitle'>".LBL_CHILD_PATIENT_ID."</span><br> "; print "<input type='text' class='tinylight' size='5' maxlength='5' name='child_patient_id' value='".($mc["child_patient_id"]?$mc["child_patient_id"]:$post_vars["child_patient_id"])."' style='border: 1px solid #000000'/><br/> "; print "<small>".INSTR_CHILD_PATIENT_ID."</small><br>"; print "</td></tr>"; print "<tr valign='top'><td>"; print "<span class='boxtitle'>".LBL_DELIVERY_LOCATION."</span><font color='red'> *</font><br> "; print mc::show_delivery_location($mc["delivery_location"]); print "</td></tr>"; print "<tr valign='top'><td>"; print "<span class='boxtitle'>".LBL_BIRTH_ATTENDANT."</span><font color='red'> *</font><br> "; print mc::show_attendant($mc["birthmode"]); print "</td></tr>"; print "<tr valign='top'><td>"; print "<span class='boxtitle'>".LBL_PREGNANCY_OUTCOME."</span><font color='red'> *</font><br> "; print mc::show_pregnancy_outcomes($mc["outcome_id"]); print "</td></tr>"; print "<tr valign='top'><td>"; print "<span class='boxtitle'>".LBL_BABY_WEIGHT." (KG)</span><font color='red'> *</font><br> "; print "<input type='text' class='tinylight' size='5' maxlength='5' name='birth_weight' value='".($mc["birthweight"]?$mc["birthweight"]:$post_vars["birth_weight"])."' style='border: 1px solid #000000'> "; print "</td></tr>"; print "<tr valign='top'><td>"; print "<span class='boxtitle'>".LBL_BREASTFEEDING_FLAG."?</span><br> "; print "<input type='checkbox' name='breastfeeding_flag' value='1' ".($mc["breastfeeding_asap"]=="Y"?"checked":"")."'> ".INSTR_BREASTFEEDING_ASAP_FLAG."<br>"; print "</td></tr>"; echo "<tr><td>"; print "<span class='boxtitle'>DATE OF BREASTFEEDING</span> "; echo "<input type='text' name='date_breastfed' id='bfeed' size='10' value='$bfeed_date' maxlength='10' value='$mc[date_breastfed]' style='border: 1px solid #000000' readonly></input> "; print "<a href=\"javascript:show_calendar4('document.form_mc_postpartum.date_breastfed', document.form_mc_postpartum.date_breastfed.value);\"><img src='../images/cal.gif' width='16' height='16' border='0' alt='Click Here to Pick up the date'></a>"; echo "</td></tr>"; print "<tr valign='top'><td>"; print "<span class='boxtitle'>".LBL_HEALTHY_BABY_FLAG."?</span><br>"; print "<input type='checkbox' name='healthy_baby_flag' value='1' ".($mc["healthy_baby"]=="Y"?"checked":"")."'> ".INSTR_HEALTHY_BABY_FLAG."<br>"; print "</td></tr>"; print "<tr bgcolor='#FF66FF' valign='top'><td>"; print "<span class='boxtitle'>".LBL_END_PREGNANCY_FLAG."?</span><br> "; print "<input type='checkbox' name='end_pregnancy_flag' value='1' ".($mc["end_pregnancy_flag"]=="Y"?"checked":"")."'> ".INSTR_END_PREGNANCY_FLAG."<br>"; print "</td></tr>"; print "</table>"; print "</td></tr>"; print "<tr><td>"; if ($mc_id || $post_vars["mc_id"]) { if ($_SESSION["priv_add"] || $_SESSION["isadmin"]) { print "<br><input type='submit' value = 'Save Postpartum Data' class='textbox' name='submitmc' style='border: 1px solid #000000'><br>"; } } print "</td></tr>"; print "</form>"; print "</table><br>"; $q_post_remarks = mysql_query("SELECT postpartum_remarks FROM m_patient_mc WHERE mc_id='$get_vars[mc_id]'") or die("Cannot query; 1856"); list($remarks) = mysql_fetch_array($q_post_remarks); echo "<form method='POST' name='form_postpartum_remarks'>"; echo "<a name='postrem'></a>"; echo "<table bgcolor='#FFCCFF' width='300' cellpadding='3'>"; echo "<span class='boxtitle'>POSTPARTUM REMARKS</span>"; echo "<tr><td>"; if($_POST["update_postpartum"]): echo "<textarea name='postpartum_remarks' cols='35' width='4'>"; else: echo "<textarea name='postpartum_remarks' cols='35' width='4' readonly>"; endif; echo $remarks."</textarea></td></tr>"; if($_POST["update_postpartum"]): echo "<tr><td><input type='submit' name='submitmc' value='Save Postpartum Remarks' style='border: 1px solid #000000'></input> <input type='button' name='cancel' value='Cancel' onclick='history.go(-1)' style='border: 1px solid #000000'></input></td></tr>"; else: echo "<tr><td><input type='submit' name='update_postpartum' value='Update Postpartum Remarks' style='border: 1px solid #000000'></input></td></tr>"; endif; echo "</table>"; echo "</form>"; } else { print "<font color='red'>No valid Registry ID. Please create a new one.</font>"; } }
function generate_summary() { 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); } list($month, $day, $year) = explode("/", $post_vars["report_date"]); $report_date = $year . "-" . str_pad($month, 2, "0", STR_PAD_LEFT) . "-" . str_pad($day, 2, "0", STR_PAD_LEFT); // STEP 1. empty report tables for given date $sql_delete = "delete from m_consult_report_dailyservice where service_date = '{$report_date}'"; $result_delete = mysql_query($sql_delete); $sql_delete = "delete from m_consult_ccdev_report_dailyservice where service_date = '{$report_date}'"; $result_delete = mysql_query($sql_delete); $sql_delete = "delete from m_consult_mc_report_dailyservice where service_date = '{$report_date}'"; $result_delete = mysql_query($sql_delete); // STEP 2. get all consults for specified report date // records are unique for patient_id and service_date $sql_patient = "select c.patient_id, c.consult_id, " . "concat(p.patient_lastname, ', ', p.patient_firstname) patient_name, " . "round((to_days(c.consult_date)-to_days(p.patient_dob))/365,2) patient_age, " . "p.patient_gender " . "from m_consult c, m_patient p " . "where c.patient_id = p.patient_id " . "and to_days(c.consult_date) = to_days('{$report_date}')"; if ($result_patient = mysql_query($sql_patient)) { if (mysql_num_rows($result_patient)) { while ($patient = mysql_fetch_array($result_patient)) { // get family and address if ($family_id = family::get_family_id($patient["patient_id"])) { $patient_address = family::get_family_address($family_id); $barangay_name = family::barangay_name($family_id); } else { $family_id = 0; $patient_address = reminder::get_home_address($patient_id); $barangay_name = reminder::get_barangay($patient_id); } // get chief complaint and diagnosis from notes $complaints = notes::get_complaints($patient["patient_id"], $report_date); $diagnosis = notes::get_diagnosis_list($patient["patient_id"], $report_date); $treatment = notes::get_plan($patient["patient_id"], $report_date); //get vaccines $vaccines = $this->get_vaccines($patient["patient_id"], $report_date); $services = $this->get_services($patient["consult_id"], $patient["patient_id"], $report_date); $ptgroup = $this->get_ptgroup($patient["consult_id"], $report_date); $aog = $this->get_aog($patient["patient_id"], $report_date); $visit_seq = healthcenter::get_total_visits($patient["patient_id"]); if ($mc_id = mc::registry_record_exists($patient["patient_id"])) { $pp_weeks = mc::get_pp_weeks($mc_id, $patient["consult_id"]); //$visit_sequence = mc::get_ppvisit_sequence($mc_id, $patient["consult_id"]); } if ($complaints != '' || $diagnosis != '' || $treatment != '') { $sql_insert = "insert into m_consult_report_dailyservice (patient_id, patient_name, " . "patient_gender, patient_age, patient_address, patient_bgy, family_id, " . "notes_cc, notes_dx, notes_tx, service_date) values " . "('" . $patient["patient_id"] . "', '" . $patient["patient_name"] . "', " . "'" . $patient["patient_gender"] . "', '" . $patient["patient_age"] . "', " . "'{$patient_address}', '{$barangay_name}', '{$family_id}', " . "'{$complaints}', '{$diagnosis}', '{$treatment}', '{$report_date}')"; $result_insert = mysql_query($sql_insert); } if ($vaccines != '' || $services != '') { if ($ptgroup == 'CHILD') { $sql_insert = "insert into m_consult_ccdev_report_dailyservice (patient_id, " . "patient_name, patient_gender, patient_age, patient_address, patient_bgy, " . "family_id, service_given, vaccine_given, service_date) values " . "('" . $patient["patient_id"] . "', '" . $patient["patient_name"] . "', " . "'" . $patient["patient_gender"] . "', '" . $patient["patient_age"] . "', " . "'{$patient_address}', '{$barangay_name}', '{$family_id}', " . "'{$services}', '{$vaccines}', '{$report_date}')"; $result_insert = mysql_query($sql_insert); } if ($ptgroup == 'MATERNAL') { $sql_insert = "insert into m_consult_mc_report_dailyservice (patient_id, " . "patient_name, patient_gender, patient_age, aog_weeks, postpartum_weeks, patient_address, " . "patient_bgy, family_id, visit_sequence, service_given, vaccine_given, " . "service_date) values " . "('" . $patient["patient_id"] . "', '" . $patient["patient_name"] . "', " . "'" . $patient["patient_gender"] . "', '" . $patient["patient_age"] . "', " . "'{$aog}', '{$pp_weeks}', '{$patient_address}', '{$barangay_name}', '{$family_id}', '{$visit_seq}', " . "'{$services}', '{$vaccines}', '{$report_date}')"; $result_insert = mysql_query($sql_insert); } } } } } //STEP 3. display daily service report print "<br/>"; print "<b>DAILY SERVICE REPORT</b><br/>"; print "REPORT DATE : <b>" . $post_vars["report_date"] . "</b><br/><br/>"; $this->display_consults($report_date); $this->display_ccdev($report_date); $this->display_mc($report_date); $sql = "select count(distinct(patient_id)) from m_consult where " . "to_days(consult_date) = to_days('{$report_date}') and patient_id != '0'"; $result = mysql_result(mysql_query($sql), 0); print "<br/>"; print "Total No. of Today's Patients : {$result}"; }