</div> <div class="col-xs-2"> <input type="text" class="form-control" autofocus name="CHINAHOUSE_PROVINCE_TH" value=""> </div> </div> </fieldset> <fieldset class="scheduler-border"> <legend class="scheduler-border"><h4>ชื่อนามสกุล ของพี่-น้องร่วมบิดา-มารดาเดียวกัน</h4></legend> <?php if ($person['PARENT_ID'] != 0 || $person['BROTHER_LIST'] != '') { ?> <div class="row"> <?php $count_brother = 1; $brothers = get_person_brother($person['PARENT_ID'], $person['BROTHER_LIST'], $person['ID']); while ($brother = mysql_fetch_assoc($brothers)) { // print_r($brother); ?> <div class="row"> <div class="col-xs-2"> <h5><?php echo $count_brother; ?> .ชื่อนามสกุล</h5> </div> <div class="col-xs-3" style="margin-top: 7px;"> <?php echo get_person_name_string($brother['ID']) . " " . get_person_surname_string($brother['ID']); ?> </div>
$fbs = mysql_query("SELECT * FROM contact WHERE CONTACT_OWNER_ID = {$organization_id} AND CONTACT_TYPE_ID = 8 AND CONTACT_THRU_DATE='' ORDER BY CONTACT_FROM_DATE LIMIT 1"); $fb = mysql_fetch_assoc($fbs); $objPHPExcel->getActiveSheet()->setCellValue('AP' . $i, $fb['CONTACT_STRING']); //-----Email ที่ทำงาน--------// $fbs = mysql_query("SELECT * FROM contact WHERE CONTACT_OWNER_ID = {$organization_id} AND CONTACT_TYPE_ID = 7 AND CONTACT_THRU_DATE='' ORDER BY CONTACT_FROM_DATE LIMIT 1"); $fb = mysql_fetch_assoc($fbs); $objPHPExcel->getActiveSheet()->setCellValue('AQ' . $i, $fb['CONTACT_STRING']); //-----บิดา----------------// if (!empty($person["PARENT_ID"])) { $parent = get_person_name_string($person["PARENT_ID"]) . " " . get_person_surname_string($person["PARENT_ID"]); $objPHPExcel->getActiveSheet()->setCellValue('AR' . $i, $parent); } //----พี่น้อง---------------// if (!empty($person["BROTHER_LIST"])) { $brother = ""; $bro_list = get_person_brother($person["PARENT_ID"], $person["BROTHER_LIST"], $id); while ($brother_list = mysql_fetch_assoc($bro_list)) { // print_r($brother_list); if ($brother_list['STATUS'] == 1) { $brother_status = "ยังมีชีวิตอยู่"; } elseif ($brother_list['STATUS'] == 0) { $brother_status = "เสียชีวิตแล้ว"; } $brother .= get_person_name_string($brother_list["ID"]) . " " . get_person_surname_string($brother_list["ID"]) . "/" . $brother_status . ","; } $brother = substr($brother, 0, strlen($brother) - 1); $objPHPExcel->getActiveSheet()->setCellValue('AS' . $i, $brother); } //----บรรพบุรุษ-----------// $china_houses = mysql_fetch_assoc(get_chinahouse_data($person["CHINAHOUSE_ID"])); $china_vallage = mysql_fetch_assoc(get_china($china_houses['CHINAHOUSE_VILLAGE_ID']));
function check_chinahouse($person) { if ($person['CHINAHOUSE_ID'] != 0) { return $person['CHINAHOUSE_ID']; } else { if ($person['PARENT_ID'] == 0 && $person['BROTHER_LIST'] == '') { return 0; } else { if ($person['PARENT_ID'] != 0) { $parent_id = $person['PARENT_ID']; $parents = get_person_detial($parent_id); $parent = mysql_fetch_assoc($parents); if ($parent['CHINAHOUSE_ID'] == 0) { $brothers = get_person_brother($person['PARENT_ID'], $person['BROTHER_LIST'], $person['ID']); while ($brother = mysql_fetch_assoc($brothers)) { if ($brother['CHINAHOUSE_ID'] != 0) { return $brother['CHINAHOUSE_ID']; } } if ($parent['PARENT_ID'] == 0 && $parent['BROTHER_LIST'] == '') { return 0; } else { return 1; } } else { return $parent['CHINAHOUSE_ID']; } } else { $has_parent = false; $brothers = get_person_brother($person['PARENT_ID'], $person['BROTHER_LIST'], $person['ID']); while ($brother = mysql_fetch_assoc($brothers)) { if ($brother['PARENT_ID'] != 0) { $has_parent = true; add_parent_id($person['ID'], $brother['PARENT_ID']); } if ($brother['CHINAHOUSE_ID'] != 0) { return $brother['CHINAHOUSE_ID']; } } if ($has_parent) { return 1; } else { return 0; } } } } }