SHARE
TWEET

Untitled

a guest Jan 20th, 2017 259 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. include_once('mysqli_array.inc.php');
  4.  
  5. $host = 'localhost';
  6. $user = 'root';
  7. $password = '';
  8. $db = 'the_core_gt';
  9.  
  10. $connection_wbs = array('server' => 'gtdb02.transactelgroup.com',
  11.     'user' => 'TheCoreWS',
  12.     'password' => 'U53r7h3C0r3W5',
  13.     'database' => 'db_thecore');
  14.  
  15.  
  16.  
  17. $query_wbs = "SELECT vfn.val_value AS 'first', IFNULL(vsn.val_value,'') AS 'last', CASE vgn.val_value WHEN 1 THEN 'female' WHEN 2 THEN 'male' ELSE '' END AS 'gender',
  18.                             vbt.val_value AS 'birthday',
  19.                             vem.val_value AS 'email',
  20.                             p.pos_id AS 'position_id', IFNULL(su.uni_id, u.uni_id) AS 'superunit_id', TRIM(vwl.val_value) AS 'NickName', TRIM(vwl.val_value) AS 'network_login',
  21.                             u.uni_id AS 'unit_id',
  22.                             vsp.val_value AS 'supervisor',
  23.                             p.pos_name AS 'position', IFNULL(su.uni_name, u.uni_name) AS 'superunit',
  24.                             u.uni_name AS 'unit', CONCAT(IFNULL(vfn.val_value,''), ' ', IFNULL(vln.val_value,''), ' ', IFNULL(vsn.val_value,''), ' ', IFNULL(vsl.val_value,'')) AS 'full_name',
  25.                             vpem.val_value AS 'personal_email', IFNULL(vis.val_value,0) AS 'Is_sup',
  26.                             vst.val_value AS 'Status',
  27.                             c.cit_name AS 'city',
  28.                             e.emp_id AS 'VHUR',
  29.                             vhd.val_value AS 'hire_date',
  30.                             vgi.val_value AS 'generic_id',
  31.                             vdm.val_value AS 'domain_id', CASE vdm.val_value WHEN 3 THEN 'SV' WHEN 2 THEN 'TRTEL' WHEN 1 THEN 'TI' ELSE '' END AS 'domain',
  32.                             vaem.val_value AS 'account_email'
  33.                     FROM emp_employees e
  34.                     LEFT JOIN val_values vfn ON e.emp_id = vfn.val_emp_id AND vfn.val_pro_id = 3 AND vfn.val_active = 1
  35.                     LEFT JOIN val_values vln ON e.emp_id = vln.val_emp_id AND vln.val_pro_id = 4 AND vln.val_active = 1
  36.                     LEFT JOIN val_values vsn ON e.emp_id = vsn.val_emp_id AND vsn.val_pro_id = 5 AND vsn.val_active = 1
  37.                     LEFT JOIN val_values vsl ON e.emp_id = vsl.val_emp_id AND vsl.val_pro_id = 6 AND vsl.val_active = 1
  38.                     LEFT JOIN val_values vgn ON e.emp_id = vgn.val_emp_id AND vgn.val_pro_id = 31 AND vgn.val_active = 1
  39.                     LEFT JOIN val_values vbt ON e.emp_id = vbt.val_emp_id AND vbt.val_pro_id = 29 AND vbt.val_active = 1
  40.                     LEFT JOIN val_values vem ON e.emp_id = vem.val_emp_id AND vem.val_pro_id = 9 AND vem.val_active = 1
  41.                     LEFT JOIN val_values vps ON e.emp_id = vps.val_emp_id AND vps.val_pro_id = 20 AND vps.val_active = 1
  42.                     LEFT JOIN val_values vun ON e.emp_id = vun.val_emp_id AND vun.val_pro_id = 18 AND vun.val_active = 1
  43.                     LEFT JOIN val_values vwl ON e.emp_id = vwl.val_emp_id AND vwl.val_pro_id = 10 AND vwl.val_active = 1
  44.                     LEFT JOIN val_values vsp ON e.emp_id = vsp.val_emp_id AND vsp.val_pro_id = 21 AND vsp.val_active = 1
  45.                     LEFT JOIN val_values vpem ON e.emp_id = vpem.val_emp_id AND vpem.val_pro_id = 25 AND vpem.val_active = 1
  46.                     LEFT JOIN val_values vis ON e.emp_id = vis.val_emp_id AND vis.val_pro_id = 48 AND vis.val_active = 1
  47.                     LEFT JOIN val_values vst ON e.emp_id = vst.val_emp_id AND vst.val_pro_id = 14 AND vst.val_active = 1
  48.                     LEFT JOIN val_values vhd ON e.emp_id = vhd.val_emp_id AND vhd.val_pro_id = 15 AND vhd.val_active = 1
  49.                     LEFT JOIN val_values vgi ON e.emp_id = vgi.val_emp_id AND vgi.val_pro_id = 84 AND vgi.val_active = 1
  50.                     LEFT JOIN val_values vdm ON e.emp_id = vdm.val_emp_id AND vdm.val_pro_id = 88 AND vdm.val_active = 1
  51.                     LEFT JOIN val_values vaem ON e.emp_id = vaem.val_emp_id AND vaem.val_pro_id = 46 AND vaem.val_active = 1
  52.                     LEFT JOIN val_values vct ON e.emp_id = vct.val_emp_id AND vct.val_pro_id = 27 AND vct.val_active = 1
  53.                     LEFT OUTER JOIN cit_cities c ON vct.val_value = c.CIT_ID
  54.                     LEFT OUTER JOIN uni_units u ON u.uni_id= vun.val_value
  55.                     LEFT OUTER JOIN uni_units su ON u.uni_parent_uni_id = su.uni_id
  56.                     LEFT OUTER JOIN pos_positions p ON p.pos_id = vps.val_value
  57.                     WHERE e.emp_active = 1
  58.                     GROUP BY e.emp_id";
  59.  
  60.  
  61. $result_wbs = mysqli_array($query_wbs, null, 2, $connection_wbs);
  62. echo json_encode($result_wbs);
  63. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top