Search This Blog

Saturday, September 28, 2019

Oracle Apps R12 Query for Employee contact relationship and details.

SELECT papf.person_id employee_id, papf.full_name employee_name,papf.employee_number,
papf.effective_start_date employee_start_date,
papf.effective_end_date employee_end_date,
papf_cont.full_name contact_name, hl.meaning contact_type,pcr.contact_type,
pcr.date_start contact_start_date, pcr.date_end contact_end_date, papf_cont.date_of_birth contact_dob, papf_cont.sex
FROM per_contact_relationships pcr,
per_all_people_f papf,
hr_lookups hl,
per_all_people_f papf_cont --contact info also saved in per_all_people_f without emp_num
WHERE 1 = 1
AND papf.person_id = pcr.person_id
AND pcr.contact_person_id = papf_cont.person_id
AND NVL (TRUNC (papf.effective_end_date), SYSDATE) >= TRUNC (SYSDATE)
AND NVL (TRUNC (papf_cont.effective_end_date), SYSDATE) >= TRUNC (SYSDATE)
AND hl.lookup_type(+) = 'CONTACT'
AND hl.lookup_code(+) = pcr.contact_type
and papf.employee_number = '1234'

html to get co-ordinates (latitude/longitude) and validation around +/- 50 meters.

<!DOCTYPE html>
<html>
<body>

<p>Click the button to get your coordinates.</p>

<button onclick="getLocation()">Check In</button>


<p id="demo"></p>

<script>
var x = document.getElementById("demo");

function getLocation() {
  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(showPosition);
  } else {
    x.innerHTML = "Geolocation is not supported by this browser.";
  }
}

function showPosition(position) {

// x.innerHTML = "Latitude: " + position.coords.latitude +
  //"<br>Longitude: " + position.coords.longitude;
 
  var meters = 50;
  var off_latitude = 85.1288229;
  var off_longitude = 89.3264959;

 
  var curr_latitude = position.coords.latitude;
  var curr_longitude = position.coords.longitude;


var coef = meters * 0.0000089;

var plus50_lat = off_latitude + coef;
// pi / 180 d= 0.018
var plus50_long = off_longitude + coef / Math.cos(off_latitude * 0.018);

var minus50_lat = off_latitude - coef;
var minus50_long = off_longitude - coef / Math.cos(off_latitude * 0.018);


if (
((curr_latitude <= off_latitude && curr_latitude >= minus50_lat)
||(curr_latitude <= plus50_lat && curr_latitude >= off_latitude)
)
   
      && (curr_longitude >= off_longitude && curr_longitude <= plus50_long) )
      {
         x.innerHTML = "You are in the office, good Morning" + "<br>"+ "CurrLatitude: "+ curr_latitude + "<br>CurrLongitude: " +curr_longitude
                        + "<br>"+ "off_latitude : "+ off_latitude + "<br>off_longitude : " + off_longitude
                        + "<br>"+ "plus50_lat : "+ plus50_lat + "<br>plus50_long : " + plus50_long + "<br>"+ "minus50_lat : "+ minus50_lat + "<br>minus50_long : " + minus50_long ; 
      }
     
    else
      {
      x.innerHTML = "You are not in the office, please recheck"+ "<br>"+ "CurrLatitude: "+ curr_latitude + "<br>CurrLongitude: " +curr_longitude
                        + "<br>"+ "off_latitude : "+ off_latitude + "<br>off_longitude : " + off_longitude
                        + "<br>"+ "plus50_lat : "+ plus50_lat + "<br>plus50_long : " + plus50_long + "<br>"+ "minus50_lat : "+ minus50_lat + "<br>minus50_long : " + minus50_long ;   
      }

 
}
</script>

</body>
</html>