Files
simpro-rssa/count_revisi_staff.php

80 lines
2.0 KiB
PHP

<?php
include('app/koneksi.php');
$data_pegawai_id=$_GET['data_pegawai_id'];
// Count revisions from all modules
$data_pel = pg_query("
SELECT COUNT(*) as count
FROM riwayat_pel
WHERE data_pegawai_id=$data_pegawai_id AND status = 'REVISI'
");
$data_spo = pg_query("
SELECT COUNT(*) as count
FROM riwayat_spo
WHERE data_pegawai_id=$data_pegawai_id AND status = 'REVISI'
");
$data_ship = pg_query("
SELECT COUNT(*) as count
FROM riwayat_ship
WHERE data_pegawai_id=$data_pegawai_id AND status = 'REVISI'
");
$data_ibel = pg_query("
SELECT COUNT(*) as count
FROM riwayat_ibel
WHERE data_pegawai_id=$data_pegawai_id AND status = 'REVISI'
");
$data_tbel = pg_query("
SELECT COUNT(*) as count
FROM riwayat_tbel
WHERE data_pegawai_id=$data_pegawai_id AND status = 'REVISI'
");
$data_kbel = pg_query("
SELECT COUNT(*) as count
FROM riwayat_kbel
WHERE data_pegawai_id=$data_pegawai_id AND status = 'REVISI'
");
$data_jbel = pg_query("
SELECT COUNT(*) as count
FROM riwayat_jbel
WHERE data_pegawai_id=$data_pegawai_id AND status = 'REVISI'
");
$r_pel = pg_fetch_assoc($data_pel);
$count_pel = $r_pel['count'];
$r_spo = pg_fetch_assoc($data_spo);
$count_spo = $r_spo['count'];
$r_ship = pg_fetch_assoc($data_ship);
$count_ship = $r_ship['count'];
$r_ibel = pg_fetch_assoc($data_ibel);
$count_ibel = $r_ibel['count'];
$r_tbel = pg_fetch_assoc($data_tbel);
$count_tbel = $r_tbel['count'];
$r_kbel = pg_fetch_assoc($data_kbel);
$count_kbel = $r_kbel['count'];
$r_jbel = pg_fetch_assoc($data_jbel);
$count_jbel = $r_jbel['count'];
echo json_encode(array(
'count_pelatihan' => $count_pel ? $count_pel : 0,
'count_spo' => $count_spo ? $count_spo : 0,
'count_fellowship' => $count_ship ? $count_ship : 0,
'count_ijin_belajar' => $count_ibel ? $count_ibel : 0,
'count_tugas_belajar' => $count_tbel ? $count_tbel : 0,
'count_ket_ijin_belajar' => $count_kbel ? $count_kbel : 0,
'count_pencantuman_gelar' => $count_jbel ? $count_jbel : 0
));
?>