function get_person_province_string($id, $type) { $addressDatas = get_person_all_address($id, $type); $addressData = mysql_fetch_assoc($addressDatas); // print_r($addressData); if ($addressData) { $showAddrs = get_address_data($addressData['ADDRESSLIST_ADDRESS_ID']); $showAddr = mysql_fetch_assoc($showAddrs); return get_province_string($showAddr['ADDRESS_PROVINCE_ID']); } else { return "-"; } }
include '../helper/db_connect.php'; include '../helper/helper.php'; connect_database(); // if($search_type == 1){ // $query = "SELECT ID FROM person WHERE (REGISTER_NUMBER BETWEEN $start_data AND $end_data) AND REGISTER_THRU_DATE = ''"; // }else{ // $query = "SELECT PERSONNAME_OWNER_ID FROM personname WHERE PERSONNAME_NAME BETWEEN '$start_data' AND '$end_data'"; // } $persons = mysql_query(search_between_data($start_data, $end_data, $search_type)); $count = 0; while ($person = mysql_fetch_row($persons)) { for ($i = 0; $i < $numprint; $i++) { $id = $person[0]; $person_name = get_person_name_string($id) . ' ' . get_person_surname_string($id); $homeAddrs = get_person_all_address($id, 1); $checkHome = mysql_fetch_assoc(get_person_all_address($id, 1)); if ($checkHome) { $homeAddr = mysql_fetch_assoc($homeAddrs); } else { $homeAddr = give_addr(); } if ($count % 3 == 0) { ?> <div class="row"> <?php } ?> <div class="col-xs-4"> <?php
echo $organization['ORGANIZATION_NAME']; ?> </h6> </div> <div class="col-sm-2"> <h5>ตำแหน่งงาน</h5> </div> <div class="col-sm-4"> <h6> <?php echo $organizationrole['ORGANIZATION_ROLE']; ?> </h6> </div> </div> <?php $organizationAddrs = get_person_all_address($organization_id, 2); $count_addr = 1; while ($organizationAddr = mysql_fetch_assoc($organizationAddrs)) { ?> <div class="row"> <div class="col-sm-2"> <h5>ที่อยู่</h5> </div> <div class="col-sm-10"> <h6> <?php echo $organizationAddr['ADDRESS_NUM'] . ' ' . $organizationAddr['ADDRESS_VILLAGE'] . ' ' . $organizationAddr['ADDRESS_ALLEY'] . ' ' . $organizationAddr['ADDRESS_MOO'] . ' ' . $organizationAddr['ADDRESS_ROAD'] . ' ' . get_district_string($organizationAddr['ADDRESS_DISTRICT_ID']) . ' ' . get_amphur_string($organizationAddr['ADDRESS_AMPHUR_ID']) . ' ' . get_province_string($organizationAddr['ADDRESS_PROVINCE_ID']) . ' ' . $organizationAddr['ADDRESS_ZIPCODE']; ?> </h6> </div> </div> <?php
} else { $facebook = array("CONTACT_STRING" => ''); } $organization_ids = get_person_organization($person["ID"]); $organization_id = mysql_fetch_assoc($organization_ids); if ($organization_id) { $organization_ids = get_person_organization($person["ID"]); $organization_id = mysql_fetch_assoc($organization_ids); // print_r($organization_id); $organization_datas = get_organization_data($organization_id['ORGANIZATION_ID']); $organization_data = mysql_fetch_assoc($organization_datas); $org_type = $organization_data['ORGANIZATION_TYPE_ID']; $org_comment = $organization_data['ORGANIZATION_COMMENT']; $org_name = $organization_data['ORGANIZATION_NAME']; $org_role = $organization_id['ORGANIZATION_ROLE']; $organization_addrs = get_person_all_address($organization_id['ORGANIZATION_ID'], 2); $org_addr = mysql_fetch_assoc($organization_addrs); $organization_phones = get_person_contact($organization_id['ORGANIZATION_ID'], 6); $organization_phone = mysql_fetch_assoc($organization_phones); if ($organization_phone) { $organization_phones = get_person_contact($organization_id['ORGANIZATION_ID'], 6); $organization_phone = mysql_fetch_assoc($organization_phones); if ($organization_phone['CONTACT_COMMENT'] == '') { $org_phone_string = $homeTel['CONTACT_ARER_CODE'] . '-' . $homeTel['CONTACT_STRING']; } else { $org_phone_string = $homeTel['CONTACT_ARER_CODE'] . '-' . $homeTel['CONTACT_STRING'] . 'ต่อ' . $homeTel['CONTACT_COMMENT']; } } else { $org_phone_string = ''; } $organization_webs = get_person_contact($organization_id['ORGANIZATION_ID'], 7);
</div> </center> <div class="well"> <form action="../action/add.php" method="Post" style="margin:10 10 10 10" enctype="multipart/form-data"> <div class="row"> <h3>ข้อมูลการติดต่อ</h3> </div> <fieldset class="scheduler-border"> <legend class="scheduler-border">ที่อยู่ <a onClick="javascript:window.location.assign('new_address.php?id=<?php echo $id; ?> &type=1')">เพิ่มที่อยู่</a> </legend> <?php $homeAddrs = get_person_all_address($id, 1); $count = 1; while ($homeAddr = mysql_fetch_assoc($homeAddrs)) { // print_r($homeAddr); ?> <div class="row"> <div class="col-sm-2"> <h4>ที่อยู่บ้าน<?php echo $count; ?> </h4> </div> <div class="col-sm-6" style="margin-top: 10px"> <?php echo $homeAddr['ADDRESS_NUM'] . ' ' . $homeAddr['ADDRESS_VILLAGE'] . ' ' . $homeAddr['ADDRESS_ALLEY'] . ' ' . $homeAddr['ADDRESS_MOO'] . ' ' . $homeAddr['ADDRESS_ROAD'] . ' ' . get_district_string($homeAddr['ADDRESS_DISTRICT_ID']) . ' ' . get_amphur_string($homeAddr['ADDRESS_AMPHUR_ID']) . ' ' . get_province_string($homeAddr['ADDRESS_PROVINCE_ID']) . ' ' . $homeAddr['ADDRESS_ZIPCODE']; ?>
function del_old_address($id, $type) { $homeAddrs = get_person_all_address($id, $type); while ($homeAddr = mysql_fetch_assoc($homeAddrs)) { del_address($id, $homeAddrs['ID'], $type); } }