3940 lines
180 KiB
PHP
Executable File
3940 lines
180 KiB
PHP
Executable File
<?php
|
|
|
|
/**
|
|
* Trait for SQL KPI
|
|
*/
|
|
|
|
namespace modules\gemba\admin\model;
|
|
|
|
trait Adminquerytrait
|
|
{
|
|
/**
|
|
* summary
|
|
*/
|
|
public function sqlSaveGembaPeople()
|
|
{
|
|
$sqlInsertGemba = 'INSERT INTO `master_kpi`
|
|
(
|
|
`kpi`,
|
|
`description`)
|
|
VALUES
|
|
(
|
|
:kpi,
|
|
:description)';
|
|
|
|
$sqlInsertScale = 'INSERT INTO `kpi_scale`
|
|
(
|
|
`kpi_id`,
|
|
`effective_date`,
|
|
`target`,
|
|
`uom`,
|
|
`expired_date`)
|
|
VALUES
|
|
(
|
|
:kpi_id,
|
|
:effective_date,
|
|
:target,
|
|
:uom,
|
|
:expired_date) ';
|
|
|
|
$sqlInsertGembaEmp = 'INSERT INTO `employement_has_kpi_scale`
|
|
(
|
|
`efective_date`,
|
|
`bobot`,
|
|
`kpi_scale_id`,
|
|
`employement_nik`,
|
|
`expired_date`,
|
|
`value_type`,
|
|
`targetID`,
|
|
`value_category`,
|
|
`additional_note`,
|
|
`is_allow_more_than_100`)
|
|
VALUES
|
|
(
|
|
:efective_date,
|
|
:bobot,
|
|
:kpi_scale_id,
|
|
:employement_nik,
|
|
:expired_date,
|
|
:value_type,
|
|
:targetID,
|
|
:value_category,
|
|
:additional_note,
|
|
:is_allow_more_than_100)';
|
|
|
|
$sqlScaleDetail = 'insert into kpi_scale_detail(`no_urut`,`description`,`start`,`finish`,`type`,`kpi_scale_id`,target_value)values(:noUrut,:description,:min,:max,:type,:kpiScaleId,:target_value)';
|
|
|
|
$sqlMonthlyTarget = "INSERT INTO emp_kpi_monthly_target
|
|
(target, `year`, `month`, employement_has_kpi_scale_id, min, max)
|
|
VALUES
|
|
(:target, :year, :month, :employement_has_kpi_scale_id, :min, :max)";
|
|
|
|
$sqlQuarterTarget = "INSERT INTO emp_kpi_quarter_target
|
|
(target, `year`, `periode`, employement_has_kpi_scale_id, min, max, bobot)
|
|
VALUES
|
|
(:target, :year, :periode, :employement_has_kpi_scale_id, :min, :max, :bobot)";
|
|
|
|
$sql['sqlInsertGemba'] = $sqlInsertGemba;
|
|
$sql['sqlInsertScale'] = $sqlInsertScale;
|
|
$sql['sqlInsertGembaEmp'] = $sqlInsertGembaEmp;
|
|
$sql['sqlScaleDetail'] = $sqlScaleDetail;
|
|
$sql['sqlMonthlyTarget'] = $sqlMonthlyTarget;
|
|
$sql['sqlQuarterTarget'] = $sqlQuarterTarget;
|
|
|
|
return $sql;
|
|
}
|
|
|
|
function sqlUpdateGembaPeople()
|
|
{
|
|
|
|
$sqlUpdateScale = 'UPDATE `kpi_scale` SET
|
|
`kpi_id`=:kpi_id,
|
|
`effective_date`=:effective_date,
|
|
`expired_date`=:expired_date,
|
|
`target`=:target,
|
|
`uom`=:uom
|
|
WHERE `id`=:kpi_scale_id';
|
|
|
|
$sqlUpdateGembaEmp = 'UPDATE `employement_has_kpi_scale` SET
|
|
`efective_date`=:efective_date,
|
|
`expired_date`=:expired_date,
|
|
`bobot`=:bobot,
|
|
`value_type`=:value_type,
|
|
`value_category`=:value_category,
|
|
`targetID`=:targetID,
|
|
`additional_note`=:additional_note,
|
|
`is_allow_more_than_100`=:is_allow_more_than_100
|
|
WHERE `id`=:emp_kpi_scale_id and `employement_nik`=:employement_nik';
|
|
|
|
$deleteGembaScaleDetail = 'delete from kpi_scale_detail where kpi_scale_id=:emp_kpi_scale_id';
|
|
|
|
$sqlScaleDetail = 'insert into kpi_scale_detail(`no_urut`,`description`,`start`,`finish`,`type`,`kpi_scale_id`,target_value)values(:noUrut,:description,:min,:max,:type,:kpiScaleId,:target_value)';
|
|
|
|
$deleteMonthlyTarget = 'delete from emp_kpi_monthly_target where employement_has_kpi_scale_id=:employement_has_kpi_scale_id';
|
|
|
|
$deleteQuarterTarget = 'delete from emp_kpi_quarter_target where employement_has_kpi_scale_id=:employement_has_kpi_scale_id';
|
|
|
|
$deleteQuarterTarget = 'delete from emp_kpi_quarter_target where employement_has_kpi_scale_id=:employement_has_kpi_scale_id';
|
|
|
|
$sqlMonthlyTarget = "INSERT INTO emp_kpi_monthly_target
|
|
(target, `year`, `month`, employement_has_kpi_scale_id, min, max)
|
|
VALUES
|
|
(:target, :year, :month, :employement_has_kpi_scale_id, :min, :max)";
|
|
|
|
$sqlQuarterTarget = "INSERT INTO emp_kpi_quarter_target
|
|
(target, `year`, `periode`, employement_has_kpi_scale_id, min, max, bobot)
|
|
VALUES
|
|
(:target, :year, :periode, :employement_has_kpi_scale_id, :min, :max, :bobot)";
|
|
|
|
$sql['sqlUpdateScale'] = $sqlUpdateScale;
|
|
$sql['sqlUpdateGembaEmp'] = $sqlUpdateGembaEmp;
|
|
$sql['deleteGembaScaleDetail'] = $deleteGembaScaleDetail;
|
|
$sql['sqlScaleDetail'] = $sqlScaleDetail;
|
|
$sql['deleteMonthlyTarget'] = $deleteMonthlyTarget;
|
|
$sql['sqlMonthlyTarget'] = $sqlMonthlyTarget;
|
|
$sql['sqlQuarterTarget'] = $sqlQuarterTarget;
|
|
$sql['deleteQuarterTarget'] = $deleteQuarterTarget;
|
|
|
|
return $sql;
|
|
}
|
|
|
|
function sqlViewData()
|
|
{
|
|
return 'SELECT
|
|
`id`,
|
|
`kpi`,
|
|
`description`
|
|
FROM `master_kpi`';
|
|
}
|
|
|
|
function sqlViewGembaScaleDetail()
|
|
{
|
|
return 'SELECT
|
|
a.`id`,
|
|
a.`no_urut`,
|
|
a.`description`,
|
|
a.`start` AS min,
|
|
a.`finish` AS max,
|
|
a.`target_value`,
|
|
a.`type`,
|
|
b.`expired_date` as expiredDate,
|
|
a.`kpi_scale_id`
|
|
FROM `kpi_scale_detail` a
|
|
INNER JOIN kpi_scale b on a.kpi_scale_id=b.id
|
|
WHERE a.kpi_scale_id=:id';
|
|
}
|
|
|
|
function sqlViewGembaPeopleDetail()
|
|
{
|
|
$sql1 = 'SELECT
|
|
KS.`id` AS kpiScaleId,
|
|
KS.`effective_date` AS effectiveDate,
|
|
KS.`expired_date` AS expiredDate,
|
|
KS.`target`,
|
|
KS.`uom`,
|
|
MK.`id` AS kpiId,
|
|
MK.`kpi`,
|
|
MK.`description`,
|
|
EK.`id` AS empGembaScaleId,
|
|
(EK.`bobot`*100) AS bobot,
|
|
EK.`value_type` as valueType,
|
|
EK.`targetID`,
|
|
EK.`value_category` as valueCategory,
|
|
EK.`additional_note` as additional_note,
|
|
EK.`is_allow_more_than_100` as is_allow_more_than_100
|
|
FROM kpi_scale KS
|
|
LEFT JOIN master_kpi MK ON MK.`id`=KS.`kpi_id`
|
|
LEFT JOIN employement_has_kpi_scale EK ON EK.`kpi_scale_id`=KS.`id`
|
|
WHERE KS.`id`=:id';
|
|
|
|
$sqlDetail = 'select description,start as min,finish as max,`type`, target_value from kpi_scale_detail where kpi_scale_id=:id order by no_urut asc';
|
|
$sqlMonthlyTarget = 'select
|
|
DISTINCT
|
|
t1.*, target as target_value,
|
|
if(t3.result_date is not null, 1,0) is_approve
|
|
from
|
|
emp_kpi_monthly_target t1
|
|
LEFT JOIN employement_has_kpi_scale t2 ON t1.employement_has_kpi_scale_id = t2.id
|
|
LEFT JOIN (SELECT DISTINCT a.result_date,periode, a.employement_nik
|
|
FROM
|
|
`employement_has_behivor_performance` a
|
|
INNER JOIN pa_approval b ON a.id = b.employement_has_behivor_performance_id
|
|
ORDER BY a.result_date ASC) t3 ON t3.employement_nik = t2.employement_nik AND year(t3.result_date)=t1.`year` and t1.`month` <= MONTH(t3.result_date)
|
|
where
|
|
employement_has_kpi_scale_id=:employement_has_kpi_scale_id
|
|
order by month asc';
|
|
$sqlQuarterTarget = "select *, target as target_value from emp_kpi_quarter_target where employement_has_kpi_scale_id=:employement_has_kpi_scale_id AND periode like '%Q%' order by id asc";
|
|
$sqlSemesterTarget = "select *, target as target_value from emp_kpi_quarter_target where employement_has_kpi_scale_id=:employement_has_kpi_scale_id AND periode like '%S%' order by id asc";
|
|
$sqlGetPAApproval = "SELECT DISTINCT a.result_date,periode, a.employement_nik, MONTH(a.result_date) as month, year(a.result_date) as year
|
|
FROM
|
|
`employement_has_behivor_performance` a
|
|
INNER JOIN pa_approval b ON a.id = b.employement_has_behivor_performance_id
|
|
INNER JOIN employement_has_kpi_scale c on a.employement_nik = c.employement_nik
|
|
WHERE c.id=:employement_has_kpi_scale_id
|
|
AND year(result_date)=:year
|
|
ORDER BY a.result_date ASC";
|
|
|
|
$sqlGetExpiredDay = "SELECT * FROM kpi_ref_set_expired WHERE bu=:bu";
|
|
|
|
$sql['sql'] = $sql1;
|
|
$sql['sqlDetail'] = $sqlDetail;
|
|
$sql['sqlMonthlyTarget'] = $sqlMonthlyTarget;
|
|
$sql['sqlQuarterTarget'] = $sqlQuarterTarget;
|
|
$sql['sqlSemesterTarget'] = $sqlSemesterTarget;
|
|
$sql['sqlGetPAApproval'] = $sqlGetPAApproval;
|
|
$sql['sqlGetExpiredDay'] = $sqlGetExpiredDay;
|
|
return $sql;
|
|
}
|
|
|
|
function sqlSaveGembaScale()
|
|
{
|
|
$sqlInsert = 'insert into kpi_scale_detail(`no_urut`,`description`,`start`,`finish`,`type`,`kpi_scale_id`)values(:noUrut,:description,:min,:max,:type,:kpiScaleId)';
|
|
|
|
$sqlUpdate = 'update kpi_scale_detail set
|
|
`no_urut`=:noUrut,
|
|
`description`=:description,
|
|
`start`=:min,
|
|
`finish`=:max,
|
|
`type`=:type,
|
|
`kpi_scale_id`=:kpiScaleId
|
|
where `id`=:id';
|
|
|
|
$sql['insert'] = $sqlInsert;
|
|
$sql['update'] = $sqlUpdate;
|
|
return $sql;
|
|
}
|
|
|
|
function sqlViewdatauser()
|
|
{
|
|
$sql = "SELECT id,kpi from (
|
|
SELECT d.id id,kpi,effective_date,target,no_urut,type,c.description scale,start,finish,d.description description,bobot*100 bobot FROM hcportal.employement_has_kpi_scale a, hcportal.kpi_scale b, hcportal.kpi_scale_detail c , hcportal.master_kpi d
|
|
WHERE a.kpi_scale_id = c.kpi_scale_id AND c.kpi_scale_id = b.id AND b.kpi_id = d.id AND kpi like :user
|
|
order by effective_date desc, no_urut asc
|
|
) a group by kpi";
|
|
|
|
return $sql;
|
|
}
|
|
|
|
function sqlViewDataKPI($offset, $jumpage)
|
|
{
|
|
$where = " ((`kpi` LIKE :search) OR (`description` LIKE :search) OR (`id` LIKE :search) OR (`kpiID` LIKE :search) OR (`id_name` LIKE :search)) ";
|
|
|
|
$table = "(SELECT c.`positionID` AS id, a.id AS kpiID,a.kpi,a.description,b.`target`,d.result,d.result_date,d.kpi_value,e.`description` AS id_name FROM
|
|
(((master_kpi a INNER JOIN kpi_scale b ON a.id=b.kpi_id )
|
|
INNER JOIN job_title_kpi c ON b.id=c.`kpi_scale_id`)
|
|
INNER JOIN kpi_result_nonpeople d ON c.id=d.job_title_kpi_id)
|
|
INNER JOIN job_title e ON c.`positionID`=e.positionID
|
|
UNION
|
|
SELECT c.employement_nik AS id,a.id AS kpiID,a.kpi,a.description,b.`target`,d.result,d.result_date,d.kpi_value,CONCAT(f.title,' ', f.first_name,' ', f.last_name) AS id_name FROM
|
|
((((master_kpi a INNER JOIN kpi_scale b ON a.id=b.kpi_id )
|
|
INNER JOIN employement_has_kpi_scale c ON b.id=c.`kpi_scale_id`)
|
|
INNER JOIN kpi_result d ON c.id=d.employement_has_kpi_scale_id)
|
|
INNER JOIN employement e ON e.nik=c.employement_nik)
|
|
INNER JOIN emp_profiles f ON f.`id`=e.`emp_profile_id`
|
|
) AS tab";
|
|
$sql = "SELECT
|
|
SQL_CALC_FOUND_ROWS
|
|
`id`,
|
|
`kpiID`,
|
|
`kpi`,
|
|
`description`,
|
|
`target`,
|
|
`result`,
|
|
`result_date`,
|
|
kpi_value,
|
|
`id_name`
|
|
FROM {$table}
|
|
WHERE {$where}
|
|
LIMIT {$offset}, {$jumpage}";
|
|
|
|
$sqltotal = "SELECT count(`kpiID`) as total FROM {$table} WHERE {$where}";
|
|
|
|
$sqlFilter = 'SELECT FOUND_ROWS() as filter';
|
|
|
|
$sql1['sql'] = $sql;
|
|
$sql1['sqltotal'] = $sqltotal;
|
|
$sql1['filter'] = $sqlFilter;
|
|
return $sql1;
|
|
}
|
|
function sqlViewDataNonPeople($offset, $jumpage)
|
|
{
|
|
$where = " ((`kpi` LIKE :search) OR (`description` LIKE :search) OR (`id` LIKE :search) OR (`kpiID` LIKE :search) OR (`id_name` LIKE :search)) ";
|
|
|
|
$table = "(SELECT c.`positionID` AS id, a.id AS kpiID,a.kpi,a.description,b.`target`,d.result,d.result_date,d.kpi_value,e.`description` AS id_name FROM
|
|
(((master_kpi a INNER JOIN kpi_scale b ON a.id=b.kpi_id )
|
|
INNER JOIN job_title_kpi c ON b.id=c.`kpi_scale_id`)
|
|
INNER JOIN kpi_result_nonpeople d ON c.id=d.job_title_kpi_id)
|
|
INNER JOIN job_title e ON c.`positionID`=e.positionID
|
|
) AS tab";
|
|
$sql = "SELECT
|
|
SQL_CALC_FOUND_ROWS
|
|
`id`,
|
|
`kpiID`,
|
|
`kpi`,
|
|
`description`,
|
|
`target`,
|
|
`result`,
|
|
`result_date`,
|
|
kpi_value,
|
|
`id_name`
|
|
FROM {$table}
|
|
WHERE {$where}
|
|
LIMIT {$offset}, {$jumpage}";
|
|
|
|
$sqltotal = "
|
|
SELECT count(`kpiID`) as total
|
|
FROM {$table} WHERE {$where}";
|
|
|
|
$sqlfilter = 'SELECT FOUND_ROWS() as filter';
|
|
|
|
$sql1['sql'] = $sql;
|
|
$sql1['sqltotal'] = $sqltotal;
|
|
$sql1['filter'] = $sqlFilter;
|
|
return $sql1;
|
|
}
|
|
|
|
function sqlViewDataPeople($offset, $jumpage)
|
|
{
|
|
$where = " ((`kpi` LIKE :search) OR (`description` LIKE :search) OR (`id` LIKE :search) OR (`kpiID` LIKE :search) OR (`id_name` LIKE :search)) ";
|
|
|
|
$table = "(
|
|
SELECT c.employement_nik AS id,a.id AS kpiID,a.kpi,a.description,b.`target`,d.result,d.result_date,d.kpi_value,CONCAT(f.title,' ', f.first_name,' ', f.last_name) AS id_name FROM
|
|
((((master_kpi a INNER JOIN kpi_scale b ON a.id=b.kpi_id )
|
|
INNER JOIN employement_has_kpi_scale c ON b.id=c.`kpi_scale_id`)
|
|
INNER JOIN kpi_result d ON c.id=d.employement_has_kpi_scale_id)
|
|
INNER JOIN employement e ON e.nik=c.employement_nik)
|
|
INNER JOIN emp_profiles f ON f.`id`=e.`emp_profile_id`
|
|
) AS tab";
|
|
$sql = "SELECT
|
|
SQL_CALC_FOUND_ROWS
|
|
`id`,
|
|
`kpiID`,
|
|
`kpi`,
|
|
`description`,
|
|
`target`,
|
|
`result`,
|
|
`result_date`,
|
|
kpi_value,
|
|
`id_name`
|
|
FROM {$table}
|
|
WHERE {$where}
|
|
LIMIT {$offset}, {$jumpage}";
|
|
|
|
$sqltotal = "
|
|
SELECT count(`kpiID`) as total
|
|
FROM {$table} WHERE {$where}";
|
|
|
|
$sqlfilter = 'SELECT FOUND_ROWS() as filter';
|
|
|
|
$sql1['sql'] = $sql;
|
|
$sql1['sqltotal'] = $sqltotal;
|
|
$sql1['filter'] = $sqlFilter;
|
|
return $sql1;
|
|
}
|
|
|
|
function sqlSearchGemba($params)
|
|
{
|
|
$where = " AND kpi_ref_function_id = 0";
|
|
|
|
if ($params['is_function'] == '1') {
|
|
$where = " AND kpi_ref_function_id != 0";
|
|
}
|
|
|
|
$sql = "SELECT
|
|
`id`,
|
|
`kpi`,
|
|
`description`
|
|
FROM `master_kpi` where `kpi` like :user {$where}";
|
|
return $sql;
|
|
}
|
|
|
|
function sqlViewDataGembaEmployeeMonth()
|
|
{
|
|
$sqlPeopleMonitoring = "SELECT
|
|
ehks.id,
|
|
ehks.kpi_scale_id,
|
|
Round(( ehks.bobot * 100 ), 2) AS weight,
|
|
ehks.efective_date as effective_date,
|
|
ehks.expired_date,
|
|
ehks.value_type,
|
|
ehks.employement_nik,
|
|
ehks.value_category,
|
|
'kpi' as type_kpi,
|
|
ehks.is_allow_more_than_100,
|
|
null as general_kpi_scale_id,
|
|
null as org_layer_kpi_id,
|
|
(SELECT bobot FROM emp_kpi_quarter_target WHERE employement_has_kpi_scale_id = ehks.id AND periode ='Q1') as q1_bobot,
|
|
(SELECT bobot FROM emp_kpi_quarter_target WHERE employement_has_kpi_scale_id = ehks.id AND periode ='Q2') as q2_bobot,
|
|
(SELECT bobot FROM emp_kpi_quarter_target WHERE employement_has_kpi_scale_id = ehks.id AND periode ='Q3') as q3_bobot,
|
|
(SELECT bobot FROM emp_kpi_quarter_target WHERE employement_has_kpi_scale_id = ehks.id AND periode ='Q4') as q4_bobot,
|
|
(SELECT bobot FROM emp_kpi_quarter_target WHERE employement_has_kpi_scale_id = ehks.id AND periode ='S1') as s1_bobot,
|
|
(SELECT bobot FROM emp_kpi_quarter_target WHERE employement_has_kpi_scale_id = ehks.id AND periode ='S2') as s2_bobot,
|
|
ehks.efective_date as date_kpi,
|
|
'manual' as target_setting
|
|
FROM
|
|
`employement_has_kpi_scale` ehks
|
|
LEFT JOIN emp_kpi_approval app ON app.employement_has_kpi_scale_id = ehks.id
|
|
WHERE
|
|
ehks.`employement_nik` = :nik
|
|
AND YEAR(ehks.`efective_date`) = :year
|
|
AND MONTH(ehks.`efective_date`) = :month
|
|
UNION
|
|
SELECT
|
|
t1.id,
|
|
t2.kpi_scale_id,
|
|
round((t1.yearly_weight *100),2) as weight,
|
|
DATE_FORMAT(t3.effective_date, '%Y-%m-%d') as effective_date,
|
|
t3.expired_date,
|
|
t2.value_type,
|
|
t1.nik as employement_nik,
|
|
t2.value_category,
|
|
'kpi_general' as type_kpi,
|
|
'0' as is_allow_more_than_100,
|
|
t1.general_kpi_scale_id,
|
|
null as org_layer_kpi_id,
|
|
(SELECT weight FROM general_kpi_detail_weight WHERE general_kpi_emp_id = t1.id AND period_value ='Q1') as q1_bobot,
|
|
(SELECT weight FROM general_kpi_detail_weight WHERE general_kpi_emp_id = t1.id AND period_value ='Q2') as q2_bobot,
|
|
(SELECT weight FROM general_kpi_detail_weight WHERE general_kpi_emp_id = t1.id AND period_value ='Q3') as q3_bobot,
|
|
(SELECT weight FROM general_kpi_detail_weight WHERE general_kpi_emp_id = t1.id AND period_value ='Q4') as q4_bobot,
|
|
(SELECT weight FROM general_kpi_detail_weight WHERE general_kpi_emp_id = t1.id AND period_value ='S1') as s1_bobot,
|
|
(SELECT weight FROM general_kpi_detail_weight WHERE general_kpi_emp_id = t1.id AND period_value ='S2') as s2_bobot,
|
|
DATE_FORMAT(t3.effective_date, '%Y-%m-%d') as date_kpi,
|
|
t2.target_sharing
|
|
FROM
|
|
general_kpi_emp t1
|
|
INNER JOIN general_kpi_scale t2 ON t1.general_kpi_scale_id = t2.id
|
|
INNER JOIN kpi_scale t3 ON t2.kpi_scale_id = t3.id
|
|
WHERE
|
|
t1.nik=:nik
|
|
AND
|
|
YEAR(t3.effective_date)=:year
|
|
AND
|
|
MONTH(t3.effective_date)=:month
|
|
AND
|
|
t1.status='2'
|
|
UNION
|
|
SELECT
|
|
t2.id,
|
|
t1.kpi_scale_id,
|
|
round((t2.bobot),2) as weight,
|
|
DATE_FORMAT(t1.efective_date, '%Y-%m-%d') as effective_date,
|
|
t2.expired_date,
|
|
t1.value_type,
|
|
t2.employement_nik,
|
|
t1.value_category,
|
|
'kpi_position' as type_kpi,
|
|
'0' as is_allow_more_than_100,
|
|
null as general_kpi_scale_id,
|
|
t2.org_layer_kpi_id,
|
|
(SELECT bobot FROM employement_kpi_position_periode_setting WHERE employement_kpi_position_id = t2.id AND periode ='Q1') as q1_bobot,
|
|
(SELECT bobot FROM employement_kpi_position_periode_setting WHERE employement_kpi_position_id = t2.id AND periode ='Q2') as q2_bobot,
|
|
(SELECT bobot FROM employement_kpi_position_periode_setting WHERE employement_kpi_position_id = t2.id AND periode ='Q3') as q3_bobot,
|
|
(SELECT bobot FROM employement_kpi_position_periode_setting WHERE employement_kpi_position_id = t2.id AND periode ='Q4') as q4_bobot,
|
|
(SELECT bobot FROM employement_kpi_position_periode_setting WHERE employement_kpi_position_id = t2.id AND periode ='S1') as s1_bobot,
|
|
(SELECT bobot FROM employement_kpi_position_periode_setting WHERE employement_kpi_position_id = t2.id AND periode ='S2') as s2_bobot,
|
|
t2.efective_date as date_kpi,
|
|
'manual' as target_setting
|
|
FROM
|
|
org_layer_kpi t1
|
|
INNER JOIN employement_kpi_position t2 ON t1.id=t2.org_layer_kpi_id AND t2.id = (SELECT id FROM employement_kpi_position WHERE org_layer_kpi_id = t1.id AND employement_nik = :nik AND efective_date <= now() ORDER BY efective_date DESC LIMIT 1)
|
|
INNER JOIN employement t3 ON t2.employement_nik = t3.nik
|
|
WHERE
|
|
t3.nik = :nik
|
|
AND
|
|
t2.`year` = :year
|
|
AND
|
|
t2.status='2'";
|
|
|
|
$sql['sqlPeopleMonitoring'] = $sqlPeopleMonitoring;
|
|
return $sql;
|
|
}
|
|
|
|
function sqlViewDataGembaEmployee()
|
|
{
|
|
$sqlPeople = "SELECT
|
|
id,
|
|
kpi_scale_id,
|
|
round((bobot*100),2) as weight,
|
|
efective_date,
|
|
expired_date,
|
|
value_type,
|
|
employement_nik,
|
|
value_category,
|
|
'kpi' as type_kpi,
|
|
'2' as status,
|
|
'2' as status_tm
|
|
FROM
|
|
`employement_has_kpi_scale`
|
|
WHERE
|
|
`employement_nik`=:nik
|
|
AND
|
|
YEAR(`efective_date`)=:year
|
|
UNION
|
|
SELECT
|
|
t1.id,
|
|
t2.kpi_scale_id,
|
|
round((t1.yearly_weight *100),2) as weight,
|
|
DATE_FORMAT(t3.effective_date, '%Y-%m-%d') as effective_date,
|
|
t3.expired_date,
|
|
t2.value_type,
|
|
t1.nik as employement_nik,
|
|
t2.value_category,
|
|
'kpi_general' as type_kpi,
|
|
t1.status,
|
|
'2' as status_tm
|
|
FROM
|
|
general_kpi_emp t1
|
|
INNER JOIN general_kpi_scale t2 ON t1.general_kpi_scale_id = t2.id
|
|
INNER JOIN kpi_scale t3 ON t2.kpi_scale_id = t3.id
|
|
WHERE
|
|
t1.nik=:nik
|
|
AND
|
|
YEAR(t3.effective_date)=:year
|
|
UNION
|
|
SELECT
|
|
t2.id,
|
|
t1.kpi_scale_id,
|
|
round((t2.bobot),2) as weight,
|
|
DATE_FORMAT(t1.efective_date, '%Y-%m-%d') as effective_date,
|
|
t1.expired_date,
|
|
t1.value_type,
|
|
t2.employement_nik,
|
|
t1.value_category,
|
|
'kpi_position' as type_kpi,
|
|
t2.status,
|
|
t2.status_tm
|
|
FROM
|
|
org_layer_kpi t1
|
|
INNER JOIN employement_kpi_position t2 ON t1.id=t2.org_layer_kpi_id AND t2.id = (SELECT id FROM employement_kpi_position WHERE org_layer_kpi_id = t1.id AND efective_date <= now() ORDER BY efective_date DESC LIMIT 1)
|
|
INNER JOIN employement t3 ON t2.employement_nik = t3.nik
|
|
WHERE
|
|
t3.nik = :nik
|
|
AND
|
|
t2.`year` = :year";
|
|
|
|
$sqlTotBobot = "select ifnull(sum(totweight),0) as totweight from (SELECT ROUND((bobot*100),2) AS totweight
|
|
FROM `employement_has_kpi_scale` WHERE `employement_nik`=:nik AND YEAR(`efective_date`)=:year
|
|
AND `expired_date` >=:expdate) as tab";
|
|
|
|
$sqlScale = 'SELECT a.id AS idMasterGemba,a.kpi,a.description,b.target,b.uom,b.id AS kpi_scale_id FROM master_kpi a INNER JOIN kpi_scale b ON a.id=b.kpi_id WHERE b.id=:kpiPeopleID AND YEAR(b.effective_date)=:year';
|
|
$sqlScaleNew = "SELECT
|
|
a.id AS idMasterGemba,
|
|
a.kpi,a.description,
|
|
c.target_value as `target`,b.uom,b.id AS kpi_scale_id,
|
|
a.kpi_ref_function_id
|
|
FROM master_kpi a
|
|
INNER JOIN kpi_scale b ON a.id=b.kpi_id
|
|
INNER JOIN kpi_scale_detail c on b.id=c.kpi_scale_id
|
|
WHERE b.id=:kpiPeopleID AND YEAR(b.effective_date)=:year";
|
|
|
|
$sqlCheckApproval = 'SELECT COUNT(`employement_has_kpi_scale_id`) as total FROM `emp_kpi_approval` WHERE `employement_has_kpi_scale_id`=:id';
|
|
|
|
|
|
$sqlPeopleMonitoring = "SELECT
|
|
ehks.id,
|
|
ehks.kpi_scale_id,
|
|
Round(( ehks.bobot * 100 ), 2) AS weight,
|
|
ehks.efective_date as effective_date,
|
|
ehks.expired_date,
|
|
ehks.value_type,
|
|
ehks.employement_nik,
|
|
ehks.value_category,
|
|
'kpi' as type_kpi,
|
|
ehks.is_allow_more_than_100,
|
|
null as general_kpi_scale_id,
|
|
null as org_layer_kpi_id,
|
|
(SELECT bobot FROM emp_kpi_quarter_target WHERE employement_has_kpi_scale_id = ehks.id AND periode ='Q1') as q1_bobot,
|
|
(SELECT bobot FROM emp_kpi_quarter_target WHERE employement_has_kpi_scale_id = ehks.id AND periode ='Q2') as q2_bobot,
|
|
(SELECT bobot FROM emp_kpi_quarter_target WHERE employement_has_kpi_scale_id = ehks.id AND periode ='Q3') as q3_bobot,
|
|
(SELECT bobot FROM emp_kpi_quarter_target WHERE employement_has_kpi_scale_id = ehks.id AND periode ='Q4') as q4_bobot,
|
|
(SELECT bobot FROM emp_kpi_quarter_target WHERE employement_has_kpi_scale_id = ehks.id AND periode ='S1') as s1_bobot,
|
|
(SELECT bobot FROM emp_kpi_quarter_target WHERE employement_has_kpi_scale_id = ehks.id AND periode ='S2') as s2_bobot,
|
|
ehks.efective_date as date_kpi,
|
|
'0' as target_sharing,
|
|
'0' as result_sharing
|
|
FROM
|
|
`employement_has_kpi_scale` ehks
|
|
LEFT JOIN emp_kpi_approval app ON app.employement_has_kpi_scale_id = ehks.id
|
|
WHERE
|
|
ehks.`employement_nik` = :nik
|
|
AND Year(ehks.`efective_date`) = :year
|
|
UNION
|
|
SELECT
|
|
t1.id,
|
|
t2.kpi_scale_id,
|
|
round((t1.yearly_weight *100),2) as weight,
|
|
DATE_FORMAT(t3.effective_date, '%Y-%m-%d') as effective_date,
|
|
t3.expired_date,
|
|
t2.value_type,
|
|
t1.nik as employement_nik,
|
|
t2.value_category,
|
|
'kpi_general' as type_kpi,
|
|
t2.is_allow_more_than_100,
|
|
t1.general_kpi_scale_id,
|
|
null as org_layer_kpi_id,
|
|
(SELECT weight FROM general_kpi_detail_weight WHERE general_kpi_emp_id = t1.id AND period_value ='Q1') as q1_bobot,
|
|
(SELECT weight FROM general_kpi_detail_weight WHERE general_kpi_emp_id = t1.id AND period_value ='Q2') as q2_bobot,
|
|
(SELECT weight FROM general_kpi_detail_weight WHERE general_kpi_emp_id = t1.id AND period_value ='Q3') as q3_bobot,
|
|
(SELECT weight FROM general_kpi_detail_weight WHERE general_kpi_emp_id = t1.id AND period_value ='Q4') as q4_bobot,
|
|
(SELECT weight FROM general_kpi_detail_weight WHERE general_kpi_emp_id = t1.id AND period_value ='S1') as s1_bobot,
|
|
(SELECT weight FROM general_kpi_detail_weight WHERE general_kpi_emp_id = t1.id AND period_value ='S2') as s2_bobot,
|
|
DATE_FORMAT(t3.effective_date, '%Y-%m-%d') as date_kpi,
|
|
t2.target_sharing,
|
|
t2.result_sharing
|
|
FROM
|
|
general_kpi_emp t1
|
|
INNER JOIN general_kpi_scale t2 ON t1.general_kpi_scale_id = t2.id
|
|
INNER JOIN kpi_scale t3 ON t2.kpi_scale_id = t3.id
|
|
WHERE
|
|
t1.nik=:nik
|
|
AND
|
|
YEAR(t3.effective_date)=:year
|
|
AND
|
|
t1.status='2'
|
|
UNION
|
|
SELECT
|
|
t2.id,
|
|
t1.kpi_scale_id,
|
|
round((t2.bobot),2) as weight,
|
|
DATE_FORMAT(t1.efective_date, '%Y-%m-%d') as effective_date,
|
|
t2.expired_date,
|
|
t1.value_type,
|
|
t2.employement_nik,
|
|
t1.value_category,
|
|
'kpi_position' as type_kpi,
|
|
'0' as is_allow_more_than_100,
|
|
null as general_kpi_scale_id,
|
|
t2.org_layer_kpi_id,
|
|
(SELECT bobot FROM employement_kpi_position_periode_setting WHERE employement_kpi_position_id = t2.id AND periode ='Q1') as q1_bobot,
|
|
(SELECT bobot FROM employement_kpi_position_periode_setting WHERE employement_kpi_position_id = t2.id AND periode ='Q2') as q2_bobot,
|
|
(SELECT bobot FROM employement_kpi_position_periode_setting WHERE employement_kpi_position_id = t2.id AND periode ='Q3') as q3_bobot,
|
|
(SELECT bobot FROM employement_kpi_position_periode_setting WHERE employement_kpi_position_id = t2.id AND periode ='Q4') as q4_bobot,
|
|
(SELECT bobot FROM employement_kpi_position_periode_setting WHERE employement_kpi_position_id = t2.id AND periode ='S1') as s1_bobot,
|
|
(SELECT bobot FROM employement_kpi_position_periode_setting WHERE employement_kpi_position_id = t2.id AND periode ='S2') as s2_bobot,
|
|
t2.efective_date as date_kpi,
|
|
'0' as target_sharing,
|
|
'0' as result_sharing
|
|
FROM
|
|
org_layer_kpi t1
|
|
INNER JOIN employement_kpi_position t2 ON t1.id=t2.org_layer_kpi_id AND t2.id = (SELECT id FROM employement_kpi_position WHERE org_layer_kpi_id = t1.id AND employement_nik = :nik AND efective_date <= now() ORDER BY efective_date DESC LIMIT 1)
|
|
INNER JOIN employement t3 ON t2.employement_nik = t3.nik
|
|
WHERE
|
|
t3.nik = :nik
|
|
AND
|
|
t2.`year` = :year
|
|
AND
|
|
t2.status='2'";
|
|
|
|
|
|
$sql['sqlPeople'] = $sqlPeople;
|
|
$sql['sqlTotBobot'] = $sqlTotBobot;
|
|
$sql['sqlScale'] = $sqlScale;
|
|
$sql['sqlScaleNew'] = $sqlScaleNew;
|
|
$sql['sqlCheckApproval'] = $sqlCheckApproval;
|
|
$sql['sqlPeopleMonitoring'] = $sqlPeopleMonitoring;
|
|
return $sql;
|
|
}
|
|
|
|
function sqlViewDataGembaMonitoring()
|
|
{
|
|
$sqlPeople = 'SELECT id,kpi_scale_id,round((bobot*100),2) as weight,efective_date,expired_date,value_type,employement_nik,value_category FROM `employement_has_kpi_scale` WHERE `employement_nik`=:nik AND YEAR(`efective_date`)=:year';
|
|
|
|
$sqlTotBobot = "select ifnull(sum(totweight),0) as totweight from (SELECT ROUND((bobot*100),2) AS totweight
|
|
FROM `employement_has_kpi_scale` WHERE `employement_nik`=:nik AND YEAR(`efective_date`)=:year
|
|
AND `expired_date` >=:expdate) as tab";
|
|
|
|
$sqlScale = 'SELECT a.id AS idMasterGemba,a.kpi,a.description,b.target,b.uom,b.id AS kpi_scale_id FROM master_kpi a INNER JOIN kpi_scale b ON a.id=b.kpi_id WHERE b.id=:kpiPeopleID AND YEAR(b.effective_date)=:year';
|
|
$sqlScaleNew = "SELECT
|
|
a.id AS idMasterGemba,
|
|
a.kpi,a.description,
|
|
c.target_value as `target`,b.uom,b.id AS kpi_scale_id
|
|
FROM master_kpi a
|
|
INNER JOIN kpi_scale b ON a.id=b.kpi_id
|
|
INNER JOIN kpi_scale_detail c on b.id=c.kpi_scale_id
|
|
WHERE b.id=:kpiPeopleID AND YEAR(b.effective_date)=:year";
|
|
|
|
$sqlCheckApproval = 'SELECT COUNT(`employement_has_kpi_scale_id`) as total FROM `emp_kpi_approval` WHERE `employement_has_kpi_scale_id`=:id';
|
|
|
|
$sqlPeopleMonitoring = "SELECT
|
|
ehks.id,
|
|
ehks.kpi_scale_id,
|
|
Round(( ehks.bobot * 100 ), 2) AS weight,
|
|
ehks.efective_date,
|
|
ehks.expired_date,
|
|
ehks.value_type,
|
|
ehks.employement_nik,
|
|
ehks.value_category,
|
|
CONCAT_WS(' ',t4.first_name, t4.last_name ) as name,
|
|
t5.description as jabatan
|
|
FROM
|
|
`employement_has_kpi_scale` ehks
|
|
LEFT JOIN emp_kpi_approval app ON app.employement_has_kpi_scale_id = ehks.id
|
|
LEFT JOIN employement t3 ON ehks.employement_nik = t3.nik
|
|
LEFT JOIN emp_profiles t4 ON t3.emp_profile_id = t4.id
|
|
LEFT OUTER JOIN job_title t5 ON t3.positionID = t5.positionID
|
|
WHERE
|
|
Year(ehks.`efective_date`) = :year
|
|
AND
|
|
LEFT(t3.positionID,2) = 'PM'
|
|
ORDER BY
|
|
ehks.employement_nik LIMIT 20";
|
|
|
|
$sqlPeopleMonitoring = "SELECT
|
|
ehks.id,
|
|
ehks.kpi_scale_id,
|
|
Round(( ehks.bobot * 100 ), 2) AS weight,
|
|
ehks.efective_date,
|
|
ehks.expired_date,
|
|
ehks.value_type,
|
|
ehks.employement_nik,
|
|
ehks.value_category,
|
|
CONCAT_WS(' ',t4.first_name, t4.last_name ) as name,
|
|
t5.description as jabatan,
|
|
t6.`month`,
|
|
t7.result_quantitative,
|
|
a.id AS idMasterGemba,
|
|
a.kpi,a.description,
|
|
c.target_value as `target`,b.uom,b.id AS kpi_scale_id
|
|
FROM
|
|
`employement_has_kpi_scale` ehks
|
|
LEFT JOIN emp_kpi_approval app ON app.employement_has_kpi_scale_id = ehks.id
|
|
LEFT JOIN employement t3 ON ehks.employement_nik = t3.nik
|
|
LEFT JOIN emp_profiles t4 ON t3.emp_profile_id = t4.id
|
|
LEFT OUTER JOIN job_title t5 ON t3.positionID = t5.positionID
|
|
LEFT JOIN emp_kpi_monthly_target t6 ON t6.employement_has_kpi_scale_id = ehks.id
|
|
LEFT JOIN kpi_result t7 ON t7.employement_has_kpi_scale_id = t6.employement_has_kpi_scale_id and DATE_FORMAT(t7.result_date,'%m') = t6.`month`
|
|
INNER JOIN kpi_scale b ON b.id=ehks.kpi_scale_id
|
|
LEFT JOIN master_kpi a ON a.id=b.kpi_id
|
|
INNER JOIN kpi_scale_detail c on b.id=c.kpi_scale_id
|
|
WHERE
|
|
Year(ehks.`efective_date`) = :year
|
|
AND
|
|
LEFT(t3.positionID,2) = 'PM'
|
|
ORDER BY
|
|
ehks.employement_nik";
|
|
|
|
|
|
$sql['sqlPeople'] = $sqlPeople;
|
|
$sql['sqlTotBobot'] = $sqlTotBobot;
|
|
$sql['sqlScale'] = $sqlScale;
|
|
$sql['sqlScaleNew'] = $sqlScaleNew;
|
|
$sql['sqlCheckApproval'] = $sqlCheckApproval;
|
|
$sql['sqlPeopleMonitoring'] = $sqlPeopleMonitoring;
|
|
return $sql;
|
|
}
|
|
|
|
function sqlViewDataGembaMonitoring1()
|
|
{
|
|
$sqlPeople = 'SELECT id,kpi_scale_id,round((bobot*100),2) as weight,efective_date,expired_date,value_type,employement_nik,value_category FROM `employement_has_kpi_scale` WHERE `employement_nik`=:nik AND YEAR(`efective_date`)=:year';
|
|
|
|
$sqlTotBobot = "select ifnull(sum(totweight),0) as totweight from (SELECT ROUND((bobot*100),2) AS totweight
|
|
FROM `employement_has_kpi_scale` WHERE `employement_nik`=:nik AND YEAR(`efective_date`)=:year
|
|
AND `expired_date` >=:expdate) as tab";
|
|
|
|
$sqlScale = 'SELECT a.id AS idMasterGemba,a.kpi,a.description,b.target,b.uom,b.id AS kpi_scale_id FROM master_kpi a INNER JOIN kpi_scale b ON a.id=b.kpi_id WHERE b.id=:kpiPeopleID AND YEAR(b.effective_date)=:year';
|
|
$sqlScaleNew = "SELECT
|
|
a.id AS idMasterGemba,
|
|
a.kpi,a.description,
|
|
c.target_value as `target`,b.uom,b.id AS kpi_scale_id
|
|
FROM master_kpi a
|
|
INNER JOIN kpi_scale b ON a.id=b.kpi_id
|
|
INNER JOIN kpi_scale_detail c on b.id=c.kpi_scale_id
|
|
WHERE b.id=:kpiPeopleID AND YEAR(b.effective_date)=:year";
|
|
|
|
$sqlCheckApproval = 'SELECT COUNT(`employement_has_kpi_scale_id`) as total FROM `emp_kpi_approval` WHERE `employement_has_kpi_scale_id`=:id';
|
|
|
|
$sqlPeopleMonitoring = "SELECT
|
|
ehks.id,
|
|
ehks.kpi_scale_id,
|
|
Round(( ehks.bobot * 100 ), 2) AS weight,
|
|
ehks.efective_date,
|
|
ehks.expired_date,
|
|
ehks.value_type,
|
|
ehks.employement_nik,
|
|
ehks.value_category,
|
|
CONCAT_WS(' ',t4.first_name, t4.last_name ) as name,
|
|
t5.description as jabatan,
|
|
LEFT(t3.positionID,2) as bu,
|
|
(select description from company where id=ol.entity_id) as company,
|
|
(select description from division where id=ol.division_id) as division,
|
|
(select description from department where id=ol.department_id) as department,
|
|
period.type as type_periode,
|
|
ksd.target_value
|
|
FROM
|
|
`employement_has_kpi_scale` ehks
|
|
LEFT JOIN emp_kpi_approval app ON app.employement_has_kpi_scale_id = ehks.id
|
|
LEFT JOIN employement t3 ON ehks.employement_nik = t3.nik
|
|
LEFT JOIN emp_profiles t4 ON t3.emp_profile_id = t4.id
|
|
LEFT OUTER JOIN job_title t5 ON t3.positionID = t5.positionID
|
|
LEFT JOIN (SELECT ej.* FROM emp_job ej ORDER BY ej.effective_date DESC) AS ej ON t3.nik = ej.nik
|
|
LEFT JOIN org_layer ol ON ej.layer_id = ol.id
|
|
LEFT JOIN emp_preiode_apraisal_quarter period ON period.nik = t3.nik AND period.id = (SELECT id FROM `emp_preiode_apraisal_quarter` WHERE `nik`=t3.nik AND `effective_date` <=ehks.efective_date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN kpi_scale_detail ksd ON ksd.kpi_scale_id = ehks.kpi_scale_id
|
|
WHERE
|
|
Year(ehks.`efective_date`) = :year
|
|
AND
|
|
LEFT(t3.positionID,2) = 'KS'
|
|
AND
|
|
period.type IN('yearly','semester')
|
|
-- AND
|
|
-- ehks.employement_nik='16000390'
|
|
ORDER BY
|
|
ehks.employement_nik";
|
|
|
|
// $sqlPeopleMonitoring = "SELECT
|
|
// ehks.id,
|
|
// ehks.kpi_scale_id,
|
|
// Round(( ehks.bobot * 100 ), 2) AS weight,
|
|
// ehks.efective_date,
|
|
// ehks.expired_date,
|
|
// ehks.value_type,
|
|
// ehks.employement_nik,
|
|
// ehks.value_category,
|
|
// CONCAT_WS(' ',t4.first_name, t4.last_name ) as name,
|
|
// t5.description as jabatan,
|
|
// t6.`month`,
|
|
// t7.result_quantitative,
|
|
// a.id AS idMasterGemba,
|
|
// a.kpi,a.description,
|
|
// c.target_value as `target`,b.uom,b.id AS kpi_scale_id
|
|
// FROM
|
|
// `employement_has_kpi_scale` ehks
|
|
// LEFT JOIN emp_kpi_approval app ON app.employement_has_kpi_scale_id = ehks.id
|
|
// LEFT JOIN employement t3 ON ehks.employement_nik = t3.nik
|
|
// LEFT JOIN emp_profiles t4 ON t3.emp_profile_id = t4.id
|
|
// LEFT OUTER JOIN job_title t5 ON t3.positionID = t5.positionID
|
|
// LEFT JOIN emp_kpi_monthly_target t6 ON t6.employement_has_kpi_scale_id = ehks.id
|
|
// LEFT JOIN kpi_result t7 ON t7.employement_has_kpi_scale_id = t6.employement_has_kpi_scale_id and DATE_FORMAT(t7.result_date,'%m') = t6.`month`
|
|
// INNER JOIN kpi_scale b ON b.id=ehks.kpi_scale_id
|
|
// LEFT JOIN master_kpi a ON a.id=b.kpi_id
|
|
// INNER JOIN kpi_scale_detail c on b.id=c.kpi_scale_id
|
|
// WHERE
|
|
// Year(ehks.`efective_date`) = :year
|
|
// AND
|
|
// LEFT(t3.positionID,2) = 'PM'
|
|
// ORDER BY
|
|
// ehks.employement_nik";
|
|
|
|
$sqlExportDataMonitoringTarget = "SELECT
|
|
(select description from company where id=ol.entity_id) as company,
|
|
(select description from division where id=ol.division_id) as division,
|
|
(select description from department where id=ol.department_id) as department,
|
|
t5.description as jabatan,
|
|
ehks.employement_nik,
|
|
CONCAT_WS(' ',t4.first_name, t4.last_name ) as name,
|
|
period.type as type_periode,
|
|
mk.kpi,
|
|
mk.description,
|
|
ehks.efective_date,
|
|
ehks.expired_date,
|
|
ehks.uom,
|
|
Round(( ehks.bobot * 100 ), 2) AS weight,
|
|
ehks.value_type,
|
|
ehks.value_category,
|
|
ksd.target_value,
|
|
ekmt.*
|
|
FROM
|
|
`employement_has_kpi_scale` ehks
|
|
LEFT JOIN emp_kpi_approval app ON app.employement_has_kpi_scale_id = ehks.id
|
|
LEFT JOIN employement t3 ON ehks.employement_nik = t3.nik
|
|
LEFT JOIN emp_profiles t4 ON t3.emp_profile_id = t4.id
|
|
LEFT OUTER JOIN job_title t5 ON t3.positionID = t5.positionID
|
|
LEFT JOIN (SELECT ej.* FROM emp_job ej ORDER BY ej.effective_date DESC) AS ej ON t3.nik = ej.nik
|
|
LEFT JOIN org_layer ol ON ej.layer_id = ol.id
|
|
LEFT JOIN emp_preiode_apraisal_quarter period ON period.nik = t3.nik AND period.id = (SELECT id FROM `emp_preiode_apraisal_quarter` WHERE `nik`=t3.nik AND `effective_date` <=ehks.efective_date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN kpi_scale ks ON ehks.kpi_scale_id = ks.id
|
|
INNER JOIN master_kpi mk ON ks.kpi_id = mk.id
|
|
INNER JOIN kpi_scale_detail ksd ON ksd.kpi_scale_id = ks.id
|
|
INNER JOIN emp_kpi_monthly_target ekmt ON ekmt.employement_has_kpi_scale_id = ehks.id
|
|
WHERE
|
|
Year(ehks.`efective_date`) = :year
|
|
AND
|
|
LEFT(t3.positionID,2) = 'KS'
|
|
AND
|
|
period.type IN('yearly','semester')
|
|
ORDER BY
|
|
ehks.employement_nik";
|
|
|
|
|
|
$sqlExportDataMonitoringTarget = "SELECT
|
|
tab.*
|
|
FROM
|
|
(SELECT
|
|
t7.`entity_id` as company,
|
|
t9.description as division,
|
|
t8.description as department,
|
|
ifnull(t10.description,t7.description) as jabatan,
|
|
t1.employement_nik,
|
|
CONCAT_WS(' ',t4.first_name, t4.last_name ) as name,
|
|
t11.type as type_periode,
|
|
t13.kpi,
|
|
t13.description,
|
|
t1.efective_date,
|
|
t1.expired_date,
|
|
t12.uom,
|
|
if(t16.bobot,t16.bobot,Round(( t1.bobot * 100 ), 2)) AS weight,
|
|
t1.value_type,
|
|
t1.value_category,
|
|
if(t11.type='semester',t16.target, t14.target_value) as target_value,
|
|
t15.employement_has_kpi_scale_id,
|
|
t15.id,
|
|
t15.max,
|
|
t15.min,
|
|
t15.`month`,
|
|
t15.target,
|
|
t15.`year`,
|
|
t17.result_quantitative,
|
|
FORMAT(kpiGetAch(t1.value_category,t15.target,t15.min,t15.max,t17.result_quantitative,LEFT(t3.positionID,2))*100,2) as archievement,
|
|
FORMAT(kpiScores(kpiGetAch(t1.value_category,t15.target,t15.min,t15.max,t17.result_quantitative,LEFT(t3.positionID,2)),IF(t16.bobot is not null,t16.bobot/100,t1.bobot),t1.is_allow_more_than_100)*100,2) as score,
|
|
t11.type as periode,
|
|
t16.periode as periode_quarter,
|
|
t1.is_allow_more_than_100,
|
|
'Regular' as kpi_type,
|
|
if(t2.approvedDate is not null,'Approve','Waiting Approval') as status_kpi,
|
|
if(t18.`timestamp` is not null,'Approve','Waiting Approval') as status_pa,
|
|
t1.id as has_kpi_id,
|
|
t1.bobot * 100 as yearly_weight
|
|
FROM
|
|
`employement_has_kpi_scale` t1
|
|
LEFT JOIN emp_kpi_approval t2 ON t2.employement_has_kpi_scale_id = t1.id
|
|
LEFT JOIN employement t3 ON t1.employement_nik = t3.nik
|
|
LEFT JOIN emp_profiles t4 ON t3.emp_profile_id = t4.id
|
|
inner join emp_job t5 on t3.nik=t5.nik and t5.effective_date=(select max(ej.effective_date) from emp_job ej where ej.nik=t3.nik and ej.effective_date<=NOW())
|
|
inner join mpp_detail t6 on t5.mpp_detail_id=t6.id
|
|
inner join org_layer t7 on t6.org_layer_id=t7.id
|
|
left outer join department t8 on t7.department_id=t8.id
|
|
left outer join division t9 on t7.division_id=t9.id
|
|
left outer join ndc_business_titles t10 on t7.`bt_id`=t10.id
|
|
LEFT JOIN emp_preiode_apraisal_quarter t11 ON t11.nik = t3.nik AND t11.id = (SELECT id FROM `emp_preiode_apraisal_quarter` WHERE `nik`=t3.nik AND `effective_date` <=t1.efective_date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN kpi_scale t12 ON t1.kpi_scale_id = t12.id
|
|
INNER JOIN master_kpi t13 ON t12.kpi_id = t13.id
|
|
INNER JOIN kpi_scale_detail t14 ON t14.kpi_scale_id = t12.id
|
|
INNER JOIN emp_kpi_monthly_target t15 ON t15.employement_has_kpi_scale_id = t1.id
|
|
LEFT JOIN emp_kpi_quarter_target t16 ON t1.id = t16.employement_has_kpi_scale_id AND (t16.periode = 'S1' OR t16.periode = 'S2')
|
|
LEFT JOIN kpi_result t17 ON t17.employement_has_kpi_scale_id = t15.employement_has_kpi_scale_id and DATE_FORMAT(t17.result_date,'%m') = t15.`month`
|
|
LEFT JOIN kpi_score_approval t18 ON t1.id = t18.employement_has_kpi_scale_id AND (SELECT id FROM kpi_score_approval WHERE employement_has_kpi_scale_id = t1.id ORDER BY id DESC LIMIT 1)
|
|
WHERE
|
|
Year(t1.`efective_date`) = :year
|
|
AND
|
|
LEFT(t3.positionID,2) = :bu
|
|
AND
|
|
t11.type IN('yearly','semester')
|
|
and
|
|
t3.`status`='active'
|
|
UNION
|
|
SELECT
|
|
t7.`entity_id` as company,
|
|
t9.description as division,
|
|
t8.description as department,
|
|
ifnull(t10.description,t7.description) as jabatan,
|
|
t2.nik as employement_nik,
|
|
CONCAT_WS(' ',t4.first_name, t4.last_name ) as name,
|
|
t11.type as type_periode,
|
|
t13.kpi,
|
|
t13.description,
|
|
t12.effective_date as efective_date,
|
|
t12.expired_date,
|
|
t12.uom,
|
|
if(t16.weight ,t16.weight * 100 ,Round(( t2.yearly_weight * 100 ), 2)) AS weight,
|
|
t1.value_type,
|
|
t1.value_category,
|
|
if(t11.type='semester',t16.target, t14.target_value) as target_value,
|
|
(5000000+t2.id) as employement_has_kpi_scale_id,
|
|
t15.id,
|
|
t15.max,
|
|
t15.min,
|
|
t15.`month`,
|
|
t15.target,
|
|
t15.`year`,
|
|
t17.result_quantitative,
|
|
FORMAT(kpiGetAch(t1.value_category,t15.target,t15.min,t15.max,t17.result_quantitative,LEFT(t3.positionID,2))*100,2) as archievement,
|
|
FORMAT(kpiScores(kpiGetAch(t1.value_category,t15.target,t15.min,t15.max,t17.result_quantitative,LEFT(t3.positionID,2)),IF(t16.weight is not null,t16.weight,t2.yearly_weight),'1')*100,2) as score,
|
|
t11.type as periode,
|
|
t16.period_value as periode_quarter,
|
|
'1' as is_allow_more_than_100,
|
|
'General' as kpi_type,
|
|
if(t2.status ='2','Approve','Waiting Approval') as status_kpi,
|
|
'Approve' as status_pa,
|
|
t2.id as has_kpi_id,
|
|
t2.yearly_weight * 100 as yearly_weight
|
|
FROM
|
|
general_kpi_scale t1
|
|
INNER JOIN general_kpi_emp t2 ON t1.id = t2.general_kpi_scale_id
|
|
LEFT JOIN employement t3 ON t2.nik = t3.nik
|
|
LEFT JOIN emp_profiles t4 ON t3.emp_profile_id = t4.id
|
|
inner join emp_job t5 on t3.nik=t5.nik and t5.effective_date=(select max(ej.effective_date) from emp_job ej where ej.nik=t3.nik and ej.effective_date<=NOW())
|
|
inner join mpp_detail t6 on t5.mpp_detail_id=t6.id
|
|
inner join org_layer t7 on t6.org_layer_id=t7.id
|
|
left outer join department t8 on t7.department_id=t8.id
|
|
left outer join division t9 on t7.division_id=t9.id
|
|
left outer join ndc_business_titles t10 on t7.`bt_id`=t10.id
|
|
INNER JOIN kpi_scale t12 ON t1.kpi_scale_id = t12.id
|
|
LEFT JOIN emp_preiode_apraisal_quarter t11 ON t11.nik = t3.nik AND t11.id = (SELECT id FROM `emp_preiode_apraisal_quarter` WHERE `nik`=t3.nik AND `effective_date` <= t12.effective_date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN master_kpi t13 ON t12.kpi_id = t13.id
|
|
INNER JOIN kpi_scale_detail t14 ON t14.kpi_scale_id = t12.id
|
|
INNER JOIN general_kpi_monthly_target t15 ON t15.general_kpi_scale_id = t1.id
|
|
LEFT JOIN general_kpi_detail_weight t16 ON t2.id = t16.general_kpi_emp_id AND (t16.period_value = 'S1' OR t16.period_value = 'S2')
|
|
LEFT JOIN general_kpi_emp_result t17 ON t17.general_kpi_emp_id = t2.id AND t15.id = t17.monthly_target_id
|
|
WHERE
|
|
Year(t12.effective_date ) = :year
|
|
AND
|
|
LEFT(t3.positionID,2) = :bu
|
|
AND
|
|
t11.type IN('yearly','semester')
|
|
and
|
|
t3.`status`='active'
|
|
AND
|
|
t1.target_sharing ='1'
|
|
AND
|
|
t1.result_sharing ='0'
|
|
UNION
|
|
SELECT
|
|
t7.`entity_id` as company,
|
|
t9.description as division,
|
|
t8.description as department,
|
|
ifnull(t10.description,t7.description) as jabatan,
|
|
t2.nik as employement_nik,
|
|
CONCAT_WS(' ',t4.first_name, t4.last_name ) as name,
|
|
t11.type as type_periode,
|
|
t13.kpi,
|
|
t13.description,
|
|
t12.effective_date as efective_date,
|
|
t12.expired_date,
|
|
t12.uom,
|
|
if(t16.weight ,t16.weight * 100 ,Round(( t2.yearly_weight * 100 ), 2)) AS weight,
|
|
t1.value_type,
|
|
t1.value_category,
|
|
if(t11.type='semester',t16.target, t14.target_value) as target_value,
|
|
(5000000+t15.general_kpi_emp_id) as employement_has_kpi_scale_id,
|
|
t15.id,
|
|
t15.max,
|
|
t15.min,
|
|
t15.`month`,
|
|
t15.target,
|
|
t15.`year`,
|
|
t17.result_quantitative,
|
|
FORMAT(kpiGetAch(t1.value_category,t15.target,t15.min,t15.max,t17.result_quantitative,LEFT(t3.positionID,2))*100,2) as archievement,
|
|
FORMAT(kpiScores(kpiGetAch(t1.value_category,t15.target,t15.min,t15.max,t17.result_quantitative,LEFT(t3.positionID,2)),IF(t16.weight is not null,t16.weight,t2.yearly_weight),'1')*100,2) as score,
|
|
t11.type as periode,
|
|
t16.period_value as periode_quarter,
|
|
'1' as is_allow_more_than_100,
|
|
'General' as kpi_type,
|
|
if(t2.status ='2','Approve','Waiting Approval') as status_kpi,
|
|
'Approve' as status_pa,
|
|
t2.id as has_kpi_id,
|
|
t2.yearly_weight * 100 as yearly_weight
|
|
FROM
|
|
general_kpi_scale t1
|
|
INNER JOIN general_kpi_emp t2 ON t1.id = t2.general_kpi_scale_id
|
|
LEFT JOIN employement t3 ON t2.nik = t3.nik
|
|
LEFT JOIN emp_profiles t4 ON t3.emp_profile_id = t4.id
|
|
inner join emp_job t5 on t3.nik=t5.nik and t5.effective_date=(select max(ej.effective_date) from emp_job ej where ej.nik=t3.nik and ej.effective_date<=NOW())
|
|
inner join mpp_detail t6 on t5.mpp_detail_id=t6.id
|
|
inner join org_layer t7 on t6.org_layer_id=t7.id
|
|
left outer join department t8 on t7.department_id=t8.id
|
|
left outer join division t9 on t7.division_id=t9.id
|
|
left outer join ndc_business_titles t10 on t7.`bt_id`=t10.id
|
|
INNER JOIN kpi_scale t12 ON t1.kpi_scale_id = t12.id
|
|
LEFT JOIN emp_preiode_apraisal_quarter t11 ON t11.nik = t3.nik AND t11.id = (SELECT id FROM `emp_preiode_apraisal_quarter` WHERE `nik`=t3.nik AND `effective_date` <= t12.effective_date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN master_kpi t13 ON t12.kpi_id = t13.id
|
|
INNER JOIN kpi_scale_detail t14 ON t14.kpi_scale_id = t12.id
|
|
INNER JOIN general_kpi_emp_monthly_target t15 ON t15.general_kpi_emp_id = t2.id
|
|
LEFT JOIN general_kpi_detail_weight t16 ON t2.id = t16.general_kpi_emp_id AND (t16.period_value = 'S1' OR t16.period_value = 'S2')
|
|
LEFT JOIN general_kpi_emp_result t17 ON t17.general_kpi_emp_id = t2.id AND t15.id = t17.monthly_target_id
|
|
WHERE
|
|
Year(t12.effective_date ) = :year
|
|
AND
|
|
LEFT(t3.positionID,2) = :bu
|
|
AND
|
|
t11.type IN('yearly','semester')
|
|
and
|
|
t3.`status`='active'
|
|
AND
|
|
t1.target_sharing ='0'
|
|
AND
|
|
t1.result_sharing ='0') tab
|
|
ORDER BY
|
|
tab.employement_nik";
|
|
|
|
|
|
$sql['sqlPeople'] = $sqlPeople;
|
|
$sql['sqlTotBobot'] = $sqlTotBobot;
|
|
$sql['sqlScale'] = $sqlScale;
|
|
$sql['sqlScaleNew'] = $sqlScaleNew;
|
|
$sql['sqlCheckApproval'] = $sqlCheckApproval;
|
|
$sql['sqlPeopleMonitoring'] = $sqlPeopleMonitoring;
|
|
$sql['sqlExportDataMonitoringTarget'] = $sqlExportDataMonitoringTarget;
|
|
return $sql;
|
|
}
|
|
|
|
|
|
function sqlViewDataGembaEmployeeResult()
|
|
{
|
|
$sqlCheckBuUser = "SELECT LEFT(emp.positionID,2) as bu FROM employement emp WHERE emp.nik=:nik";
|
|
$sqlPeople = "SELECT
|
|
a.id,
|
|
MAX(a.kpi_scale_id) as kpi_scale_id,
|
|
round((a.bobot*100),2) as weight,
|
|
MAX(a.expired_date) as expired_date,
|
|
MAX(a.value_category) as value_category,
|
|
MAX(a.value_type) as value_type,
|
|
min(d.min) as min,
|
|
max(d.max) as max,
|
|
MAX(a.is_allow_more_than_100) as is_allow_more_than_100,
|
|
(SELECT bobot FROM emp_kpi_quarter_target WHERE employement_has_kpi_scale_id = a.id AND periode ='Q1') as q1_bobot,
|
|
(SELECT bobot FROM emp_kpi_quarter_target WHERE employement_has_kpi_scale_id = a.id AND periode ='Q2') as q2_bobot,
|
|
(SELECT bobot FROM emp_kpi_quarter_target WHERE employement_has_kpi_scale_id = a.id AND periode ='Q3') as q3_bobot,
|
|
(SELECT bobot FROM emp_kpi_quarter_target WHERE employement_has_kpi_scale_id = a.id AND periode ='Q4') as q4_bobot,
|
|
(SELECT bobot FROM emp_kpi_quarter_target WHERE employement_has_kpi_scale_id = a.id AND periode ='S1') as s1_bobot,
|
|
(SELECT bobot FROM emp_kpi_quarter_target WHERE employement_has_kpi_scale_id = a.id AND periode ='S2') as s2_bobot,
|
|
MAX(a.employement_nik) as employement_nik,
|
|
MAX(a.'personal') as type_kpi
|
|
FROM
|
|
`employement_has_kpi_scale` a
|
|
join emp_kpi_approval b on a.id=b.employement_has_kpi_scale_id
|
|
left join emp_kpi_monthly_target d on d.employement_has_kpi_scale_id = a.id
|
|
WHERE
|
|
`employement_nik`=:nik
|
|
AND YEAR(`efective_date`)=:year
|
|
group by a.id
|
|
UNION
|
|
SELECT
|
|
*
|
|
FROM
|
|
(
|
|
SELECT
|
|
t1.id,
|
|
max(t1.kpi_scale_id) as kpi_scale_id,
|
|
round((t2.bobot),2) as weight,
|
|
max(t4.expired_date) as expired_date,
|
|
max(t1.value_category) as value_category,
|
|
max(t1.value_type) as value_type,
|
|
min(t5.min) as min,
|
|
max(t5.max) as max,
|
|
0 as is_allow_more_than_100,
|
|
(SELECT bobot FROM org_layer_kpi_quarter_target WHERE org_layer_id = t1.id AND periode ='Q1') as q1_bobot,
|
|
(SELECT bobot FROM org_layer_kpi_quarter_target WHERE org_layer_id = t1.id AND periode ='Q2') as q2_bobot,
|
|
(SELECT bobot FROM org_layer_kpi_quarter_target WHERE org_layer_id = t1.id AND periode ='Q3') as q3_bobot,
|
|
(SELECT bobot FROM org_layer_kpi_quarter_target WHERE org_layer_id = t1.id AND periode ='Q4') as q4_bobot,
|
|
(SELECT bobot FROM org_layer_kpi_quarter_target WHERE org_layer_id = t1.id AND periode ='S1') as s1_bobot,
|
|
(SELECT bobot FROM org_layer_kpi_quarter_target WHERE org_layer_id = t1.id AND periode ='S2') as s2_bobot,
|
|
MAX(t2.employement_nik) as employement_nik,
|
|
MAX(t1.'kpi_position') as type_kpi
|
|
FROM
|
|
org_layer_kpi t1
|
|
INNER JOIN employement_kpi_position t2 ON t1.id=t2.org_layer_kpi_id AND t2.id = (SELECT id FROM employement_kpi_position WHERE org_layer_kpi_id = t1.id AND efective_date <= now() ORDER BY efective_date DESC LIMIT 1)
|
|
INNER JOIN employement t3 ON t2.employement_nik = t3.nik
|
|
INNER JOIN kpi_scale t4 ON t1.kpi_scale_id = t4.id
|
|
INNER JOIN org_layer_kpi_monthly_target t5 ON t1.org_layer_id = t5.org_layer_kpi_id
|
|
WHERE
|
|
t3.nik = :nik
|
|
AND
|
|
YEAR(t4.effective_date)=:year
|
|
ORDER BY t1.id
|
|
) tab
|
|
WHERE
|
|
tab.id is not null";
|
|
|
|
$sqlPeopleScore = 'SELECT Adminscores(Gembagetach(:value_category, :target_value, :min, :max, :result,:bu),:bobot,:is_allow_100) as score';
|
|
|
|
$sqlScale = 'SELECT a.id AS idMasterGemba,a.kpi,a.description,b.target,b.uom,b.id AS kpi_scale_id FROM master_kpi a INNER JOIN kpi_scale b ON a.id=b.kpi_id WHERE b.id=:kpiPeopleID AND YEAR(b.effective_date)=:year';
|
|
|
|
$sqlScaleNew = "SELECT
|
|
a.id AS idMasterGemba,
|
|
a.kpi,a.description,
|
|
round(c.target_value,2) as `target`,b.uom,b.id AS kpi_scale_id,
|
|
a.kpi_ref_function_id
|
|
FROM master_kpi a
|
|
INNER JOIN kpi_scale b ON a.id=b.kpi_id
|
|
INNER JOIN kpi_scale_detail c on b.id=c.kpi_scale_id
|
|
WHERE b.id=:kpiPeopleID AND YEAR(b.effective_date)=:year";
|
|
|
|
$sqlCheckApproval = 'SELECT COUNT(`employement_has_kpi_scale_id`) as total FROM `emp_kpi_approval` WHERE `employement_has_kpi_scale_id`=:id';
|
|
|
|
$sqlCheckResult = "SELECT DATE_FORMAT(`result_Date`,'%M %Y') as resultDate, result_quantitative as kpiValue, result FROM kpi_result WHERE `employement_has_kpi_scale_id`=:id and DATE_FORMAT(`result_Date`,'%Y')=:year order by result_Date desc limit 1";
|
|
$sqlResultAvg = "SELECT avg(result_quantitative) as kpiValue FROM kpi_result WHERE `employement_has_kpi_scale_id`=:id and DATE_FORMAT(`result_Date`,'%Y')=:year";
|
|
$sqlResultTotal = "SELECT sum(result_quantitative) as kpiValue FROM kpi_result WHERE `employement_has_kpi_scale_id`=:id and DATE_FORMAT(`result_Date`,'%Y')=:year";
|
|
$sqlResultMax = "SELECT max(result_quantitative) as kpiValue FROM kpi_result WHERE `employement_has_kpi_scale_id`=:id and DATE_FORMAT(`result_Date`,'%Y')=:year";
|
|
// pa approval
|
|
$sqlPaApproval = "select count(a.id) as total from employement_has_behivor_performance a inner join `pa_approval` b on a.id=b.`employement_has_behivor_performance_id` where a.employement_nik=:nik and year(a.result_date)=:year";
|
|
|
|
$sql['sqlPeople'] = $sqlPeople;
|
|
$sql['sqlScale'] = $sqlScale;
|
|
$sql['sqlScaleNew'] = $sqlScaleNew;
|
|
$sql['sqlCheckApproval'] = $sqlCheckApproval;
|
|
$sql['sqlCheckResult'] = $sqlCheckResult;
|
|
$sql['sqlResultAvg'] = $sqlResultAvg;
|
|
$sql['sqlPaApprovalNew'] = $sqlPaApproval;
|
|
$sql['sqlResultTotal'] = $sqlResultTotal;
|
|
$sql['sqlResultMax'] = $sqlResultMax;
|
|
$sql['sqlPeopleScore'] = $sqlPeopleScore;
|
|
$sql['sqlCheckBuUser'] = $sqlCheckBuUser;
|
|
|
|
return $sql;
|
|
}
|
|
|
|
function sqlDeleteGembaPeople()
|
|
{
|
|
$sqlget = 'select kpi_scale_id from employement_has_kpi_scale where id=:id and employement_nik=:nik';
|
|
$sql = 'delete from employement_has_kpi_scale where id=:id and employement_nik=:nik';
|
|
$sql1 = 'delete from kpi_scale where `id`=:id';
|
|
|
|
$sql2['sqlget'] = $sqlget;
|
|
$sql2['sql'] = $sql;
|
|
$sql2['sql1'] = $sql1;
|
|
|
|
return $sql2;
|
|
}
|
|
|
|
function sqlExportToExcel()
|
|
{
|
|
$userAllbu = array('15000204', '19000303', '18000632', '22000235');
|
|
$userAllArea = array('19000069', '21000130');
|
|
$use = \Helper::getSessionVar('username');
|
|
$bu = \Helper::getSessionVar('empSite');
|
|
$whereBu = '';
|
|
if (!in_array($use, $userAllbu)) {
|
|
$whereBu = " AND LEFT(a.positionID,2)='" . $bu . "' HAVING sub_area_id IN (SELECT subarea_id FROM `user_admin_subarea` WHERE `username`='{$use}')";
|
|
}
|
|
|
|
if (!in_array($use, $userAllbu) && in_array($use, $userAllArea)) {
|
|
$whereBu = " AND LEFT(a.positionID,2)='" . $bu . "' ";
|
|
}
|
|
|
|
|
|
$where = " ((left(positionID,2) LIKE :bu)
|
|
AND ( mid(positionID,3,2) LIKE :divisi) AND ( MID(positionID,5,2) LIKE :department)) ";
|
|
|
|
$table = "(SELECT `nik`,
|
|
CONCAT(title,\" \",first_name,\" \",last_name) `name`,
|
|
a.positionID `positionID` ,
|
|
(SELECT sub_area_id FROM emp_personal_sub_area WHERE nik=a.nik AND effective_date<=CURRENT_DATE() ORDER BY effective_date DESC ,id DESC LIMIT 1) AS sub_area_id
|
|
FROM employement a join emp_profiles b on a.`emp_profile_id`=b.`id`
|
|
where left(a.grade,1)>2
|
|
{$whereBu}
|
|
) AS tab";
|
|
$sql = "SELECT
|
|
SQL_CALC_FOUND_ROWS
|
|
`nik`,
|
|
`name`,
|
|
`positionID`
|
|
FROM {$table}";
|
|
|
|
|
|
$sql2['sql'] = $sql;
|
|
|
|
return $sql2;
|
|
}
|
|
|
|
public function sqlGembaMonitoringProgress()
|
|
{
|
|
$sqlGembaPeople = "select
|
|
a.id,
|
|
a.kpi_scale_id,
|
|
a.bobot,
|
|
a.value_type
|
|
from `employement_has_kpi_scale` a inner join emp_kpi_approval b on a.id=b.`employement_has_kpi_scale_id`
|
|
where a.`employement_nik`=:nik and a.efective_date<=:end and a.expired_date>=:start and year(a.efective_date)=:year and year(a.expired_date)=:year";
|
|
|
|
// total kpi in current year
|
|
$sqlKPIAll = "SELECT count(id) as total FROM employement_has_kpi_scale
|
|
where employement_nik=:nik and year(efective_date)=:year and year(expired_date)=:year";
|
|
|
|
// total KPI active in periode selected
|
|
$sqlGembaActive = 'select
|
|
a.id,
|
|
a.kpi_scale_id,
|
|
round((bobot*100),2) as weight
|
|
from `employement_has_kpi_scale` a
|
|
where
|
|
a.`employement_nik`=:nik and a.efective_date<=:end and a.expired_date>=:start and year(a.efective_date)=:year and year(a.expired_date)=:year';
|
|
//cek jumlah kpi target setting
|
|
$sqlTS = "select count(id) as tot from kpi_scale_detail where kpi_scale_id=:kpi_scale_id";
|
|
|
|
//cek jumlah result submit per kpi
|
|
$sqlTotalResult = ' select count(id) as total from kpi_result where employement_has_kpi_scale_id=:id';
|
|
|
|
$sqlCekApproval = "select count(id) as tot from `employement_has_kpi_scale` where employement_nik=:nik and efective_date<=:end and expired_date>=:start and id not in (select employement_has_kpi_scale_id from emp_kpi_approval) and year(efective_date)=:year and year(expired_date)=:year";
|
|
|
|
$sqlTsteEmp = ' select count(id) as total from employement_has_behivor_performance where employement_nik=:nik and periode=:periode and year(result_date)=:year';
|
|
|
|
// get tste N+1
|
|
$sqlTsteN = 'select count(a.id) as total from employement_has_behivor_performance a inner join `result_behavior_n1` b on a.id=b.`employement_has_behivor_performance_id` where a.employement_nik=:nik and a.periode=:periode and year(a.result_date)=:year';
|
|
|
|
// pa approval
|
|
$sqlPaApproval = ' select count(a.id) as total from employement_has_behivor_performance a inner join `pa_approval` b on a.id=b.`employement_has_behivor_performance_id` where a.employement_nik=:nik and a.periode=:periode and year(a.result_date)=:year';
|
|
|
|
// pa approval
|
|
$sqlPaApprovalNew = ' select count(a.id) as total from employement_has_behivor_performance a inner join `pa_approval` b on a.id=b.`employement_has_behivor_performance_id` where a.employement_nik=:nik and and year(a.result_date)=:year';
|
|
|
|
|
|
|
|
return array(
|
|
'sqlGembaPeople' => $sqlGembaPeople,
|
|
'sqlKPIAll' => $sqlKPIAll,
|
|
'sqlGembaActive' => $sqlGembaActive,
|
|
'sqlTS' => $sqlTS,
|
|
'sqlTotalResult' => $sqlTotalResult,
|
|
'sqlCekApproval' => $sqlCekApproval,
|
|
'sqlTsteEmp' => $sqlTsteEmp,
|
|
'sqlTsteN' => $sqlTsteN,
|
|
'sqlPaApproval' => $sqlPaApproval,
|
|
'sqlPaApprovalNew' => $sqlPaApprovalNew
|
|
);
|
|
}
|
|
|
|
|
|
function sqlSearchEmp()
|
|
{
|
|
$sql = "SELECT distinct e.nik,
|
|
e.nik_atasan,
|
|
e.grade,
|
|
e.emp_profile_id,
|
|
e.status,
|
|
e.hired_date,
|
|
e.flag_app,
|
|
e.effective_date,
|
|
CONCAT_WS(' ',CONCAT(p.title,'. '), p.first_name,p.middle_name,p.last_name) as fullname,
|
|
p.first_name,
|
|
p.middle_name,
|
|
p.last_name,
|
|
p.nick_name,
|
|
p.title,
|
|
p.gender,
|
|
p.date_join,
|
|
ej.job_title,
|
|
ej.layer_id,
|
|
ol.description as org_layer_description
|
|
FROM
|
|
employement e
|
|
LEFT JOIN emp_profiles p ON p.id = e.emp_profile_id
|
|
LEFT JOIN emp_job ej ON ej.nik = e.nik AND ej.id=(SELECT id FROM emp_job WHERE nik = e.nik AND effective_date <= now() ORDER BY effective_date DESC LIMIT 1)
|
|
LEFT JOIN mpp_detail md ON md.id = ej.mpp_detail_id
|
|
LEFT JOIN org_layer ol ON md.org_layer_id = ol.id
|
|
LEFT JOIN emp_personal_sub_area epsa ON epsa.nik = e.nik AND epsa.id=(SELECT id FROM emp_personal_sub_area WHERE nik = e.nik AND effective_date <= now() ORDER BY effective_date DESC LIMIT 1)
|
|
WHERE
|
|
e.status = 'active'
|
|
AND
|
|
(
|
|
e.nik LIKE :search
|
|
OR p.first_name LIKE :search
|
|
OR p.middle_name LIKE :search
|
|
OR p.last_name LIKE :search
|
|
OR p.nick_name LIKE :search
|
|
)
|
|
AND ol.department_id=:department_id
|
|
AND epsa.sub_area_id=:sub_area_id
|
|
ORDER BY e.nik, p.first_name, p.middle_name, p.last_name, p.nick_name
|
|
LIMIT 50";
|
|
return $sql;
|
|
}
|
|
|
|
public function sqlSaveGembaPeopleGeneral()
|
|
{
|
|
$sqlInsertGemba = 'INSERT INTO `master_kpi`
|
|
(
|
|
`kpi`,
|
|
`description`)
|
|
VALUES
|
|
(
|
|
:kpi,
|
|
:description)';
|
|
|
|
$sqlInsertScale = 'INSERT INTO `kpi_scale`
|
|
(
|
|
`kpi_id`,
|
|
`effective_date`,
|
|
`target`,
|
|
`uom`,
|
|
`expired_date`)
|
|
VALUES
|
|
(
|
|
:kpi_id,
|
|
:effective_date,
|
|
:target,
|
|
:uom,
|
|
:expired_date) ';
|
|
|
|
$sqlInsertGembaEmp = 'INSERT INTO `employement_has_kpi_scale`
|
|
(
|
|
`efective_date`,
|
|
`bobot`,
|
|
`kpi_scale_id`,
|
|
`employement_nik`,
|
|
`expired_date`,
|
|
`value_type`,
|
|
`targetID`,
|
|
`value_category`,
|
|
`additional_note`,
|
|
`is_allow_more_than_100`)
|
|
VALUES
|
|
(
|
|
:efective_date,
|
|
:bobot,
|
|
:kpi_scale_id,
|
|
:employement_nik,
|
|
:expired_date,
|
|
:value_type,
|
|
:targetID,
|
|
:value_category,
|
|
:additional_note,
|
|
:is_allow_more_than_100)';
|
|
|
|
$sqlScaleDetail = 'insert into kpi_scale_detail(`no_urut`,`description`,`start`,`finish`,`type`,`kpi_scale_id`,target_value)values(:noUrut,:description,:min,:max,:type,:kpiScaleId,:target_value)';
|
|
|
|
$sqlMonthlyTarget = "INSERT INTO emp_kpi_monthly_target
|
|
(target, `year`, `month`, employement_has_kpi_scale_id, min, max)
|
|
VALUES
|
|
(:target, :year, :month, :employement_has_kpi_scale_id, :min, :max)";
|
|
|
|
$sqlQuarterTarget = "INSERT INTO emp_kpi_quarter_target
|
|
(target, `year`, `periode`, employement_has_kpi_scale_id, min, max, bobot)
|
|
VALUES
|
|
(:target, :year, :periode, :employement_has_kpi_scale_id, :min, :max, :bobot)";
|
|
|
|
|
|
$sqlInsertGeneralGembaScale = "INSERT INTO general_kpi_scale
|
|
(kpi_scale_id, country_id, bu, managed_by, value_category, value_type, target_sharing, result_sharing,status)
|
|
VALUES
|
|
(:kpi_scale_id, :country_id, :bu, :managed_by, :value_category, :value_type, :target_sharing, :result_sharing,:status)";
|
|
|
|
$sqlInsertGeneralGembaEmp = "INSERT INTO general_kpi_emp
|
|
(nik, general_kpi_scale_id, yearly_weight, assign_by, is_setting_bobot, status)
|
|
VALUES
|
|
(:nik, :general_kpi_scale_id, :yearly_weight, :assign_by, :is_setting_bobot, :status)";
|
|
|
|
$sqlUpdateGeneralGembaEmp = "UPDATE general_kpi_emp
|
|
SET nik=:nik, yearly_weight=:yearly_weight, general_kpi_scale_id=:general_kpi_scale_id, assign_by=:assign_by, is_setting_bobot =:is_setting_bobot,status=:status
|
|
WHERE
|
|
id=:id";
|
|
|
|
$sqlInsertGeneralGembaDetailWeight = "INSERT INTO general_kpi_detail_weight
|
|
(period_type, period_value, weight, general_kpi_emp_id, target)
|
|
VALUES
|
|
(:period_type, :period_value, :weight, :general_kpi_emp_id, :target)";
|
|
|
|
$sqlUpdateGeneralGembaDetailWeight = "UPDATE general_kpi_detail_weight
|
|
SET period_type=:period_type, period_value=:period_value, weight=:weight, general_kpi_emp_id=:general_kpi_emp_id, target=:target
|
|
WHERE
|
|
period_value=:period_value AND general_kpi_emp_id=:general_kpi_emp_id";
|
|
|
|
$sqlMonthlyTargetGeneral = "INSERT INTO general_kpi_monthly_target
|
|
(target, `year`, `month`, general_kpi_scale_id, min, max)
|
|
VALUES
|
|
(:target, :year, :month, :general_kpi_scale_id, :min, :max)";
|
|
|
|
$sql['sqlInsertGemba'] = $sqlInsertGemba;
|
|
$sql['sqlInsertScale'] = $sqlInsertScale;
|
|
$sql['sqlInsertGeneralGembaScale'] = $sqlInsertGeneralGembaScale;
|
|
$sql['sqlInsertGeneralGembaEmp'] = $sqlInsertGeneralGembaEmp;
|
|
$sql['sqlUpdateGeneralGembaEmp'] = $sqlUpdateGeneralGembaEmp;
|
|
$sql['sqlInsertGeneralGembaDetailWeight'] = $sqlInsertGeneralGembaDetailWeight;
|
|
$sql['sqlUpdateGeneralGembaDetailWeight'] = $sqlUpdateGeneralGembaDetailWeight;
|
|
$sql['sqlInsertGembaEmp'] = $sqlInsertGembaEmp;
|
|
$sql['sqlScaleDetail'] = $sqlScaleDetail;
|
|
$sql['sqlMonthlyTargetGeneral'] = $sqlMonthlyTargetGeneral;
|
|
$sql['sqlQuarterTarget'] = $sqlQuarterTarget;
|
|
|
|
return $sql;
|
|
}
|
|
|
|
function sqlViewDataGembaGeneral()
|
|
{
|
|
$sqlPeople = 'SELECT
|
|
t3.kpi,
|
|
t3.description,
|
|
DATE_FORMAT(t2.effective_date, "%Y-%m-%d") as start_date,
|
|
t2.expired_date,
|
|
t2.uom,
|
|
t1.*,
|
|
getEmpName(t1.managed_by) as manage_by_name
|
|
FROM
|
|
general_kpi_scale t1
|
|
INNER JOIN kpi_scale t2 ON t1.kpi_scale_id = t2.id
|
|
INNER JOIN master_kpi t3 ON t2.kpi_id = t3.id
|
|
WHERE
|
|
t1.managed_by =:nik
|
|
AND
|
|
YEAR(t2.effective_date)=:year';
|
|
|
|
$sqlTotBobot = "select ifnull(sum(totweight),0) as totweight from (SELECT ROUND((bobot*100),2) AS totweight
|
|
FROM `employement_has_kpi_scale` WHERE `employement_nik`=:nik AND YEAR(`efective_date`)=:year
|
|
AND `expired_date` >=:expdate) as tab";
|
|
|
|
$sqlScale = 'SELECT a.id AS idMasterGemba,a.kpi,a.description,b.target,b.uom,b.id AS kpi_scale_id FROM master_kpi a INNER JOIN kpi_scale b ON a.id=b.kpi_id WHERE b.id=:kpiPeopleID AND YEAR(b.effective_date)=:year';
|
|
$sqlScaleNew = "SELECT
|
|
a.id AS idMasterGemba,
|
|
a.kpi,a.description,
|
|
c.target_value as `target`,b.uom,b.id AS kpi_scale_id
|
|
FROM master_kpi a
|
|
INNER JOIN kpi_scale b ON a.id=b.kpi_id
|
|
INNER JOIN kpi_scale_detail c on b.id=c.kpi_scale_id
|
|
WHERE b.id=:kpiPeopleID AND YEAR(b.effective_date)=:year";
|
|
|
|
$sqlCheckApproval = 'SELECT COUNT(`employement_has_kpi_scale_id`) as total FROM `emp_kpi_approval` WHERE `employement_has_kpi_scale_id`=:id';
|
|
|
|
$sqlPeopleMonitoring = 'SELECT ehks.id,
|
|
ehks.kpi_scale_id,
|
|
Round(( ehks.bobot * 100 ), 2) AS weight,
|
|
ehks.efective_date,
|
|
ehks.expired_date,
|
|
ehks.value_type,
|
|
ehks.employement_nik,
|
|
ehks.value_category,
|
|
ehks.is_allow_more_than_100
|
|
FROM `employement_has_kpi_scale` ehks
|
|
LEFT JOIN emp_kpi_approval app ON app.employement_has_kpi_scale_id = ehks.id
|
|
WHERE ehks.`employement_nik` = :nik
|
|
AND Year(ehks.`efective_date`) = :year';
|
|
|
|
|
|
$sql['sqlPeople'] = $sqlPeople;
|
|
$sql['sqlTotBobot'] = $sqlTotBobot;
|
|
$sql['sqlScale'] = $sqlScale;
|
|
$sql['sqlScaleNew'] = $sqlScaleNew;
|
|
$sql['sqlCheckApproval'] = $sqlCheckApproval;
|
|
$sql['sqlPeopleMonitoring'] = $sqlPeopleMonitoring;
|
|
return $sql;
|
|
}
|
|
|
|
function sqlViewGembaPeopleDetailGeneral($params)
|
|
{
|
|
$where = '';
|
|
if (isset($params['nik'])) {
|
|
$where .= " AND t1.nik = '{$params['nik']}' ";
|
|
}
|
|
|
|
$sql1 = 'SELECT
|
|
KS.`id` AS kpiScaleId,
|
|
KS.`effective_date` AS effectiveDate,
|
|
KS.`expired_date` AS expiredDate,
|
|
KS.`target`,
|
|
KS.`uom`,
|
|
MK.`id` AS kpiId,
|
|
MK.`kpi`,
|
|
MK.`description`,
|
|
GK.`id` AS AdminGeneralScaleId,
|
|
GK.`value_type` as valueType,
|
|
GK.`value_category` as valueCategory,
|
|
GK.target_sharing,
|
|
MK.kpi_ref_function_id,
|
|
krf.function_name,
|
|
YEAR(KS.effective_date) as year
|
|
FROM kpi_scale KS
|
|
LEFT JOIN master_kpi MK ON MK.`id`=KS.`kpi_id`
|
|
LEFT JOIN general_kpi_scale GK ON GK.`kpi_scale_id`=KS.`id`
|
|
LEFT JOIN kpi_ref_function krf ON MK.kpi_ref_function_id = krf.id
|
|
WHERE KS.`id`=:id';
|
|
$sqlDetail = 'select description,start as min,finish as max,`type`, target_value from kpi_scale_detail where kpi_scale_id=:id order by no_urut asc';
|
|
|
|
$sqlListEmp = "SELECT
|
|
t1.nik,
|
|
t1.id,
|
|
(t1.yearly_weight*100) as bobot,
|
|
CONCAT_WS(' ',CONCAT(t5.title,'. '), t5.first_name,t5.middle_name,t5.last_name) as fullname,
|
|
t6.`type`
|
|
FROM
|
|
general_kpi_emp t1
|
|
INNER JOIN general_kpi_scale t2 ON t1.general_kpi_scale_id = t2.id
|
|
INNER JOIN kpi_scale t3 ON t2.kpi_scale_id = t3.id
|
|
LEFT JOIN employement t4 ON t1.nik = t4.nik
|
|
LEFT JOIN emp_profiles t5 ON t5.id = t4.emp_profile_id
|
|
LEFT JOIN emp_preiode_apraisal_quarter t6 ON t6.nik = t4.nik AND t6.id = (SELECT id FROM `emp_preiode_apraisal_quarter` WHERE `nik`=t4.nik AND `effective_date` <=DATE_FORMAT(t3.effective_date, '%Y-%m-%d') ORDER BY effective_date DESC LIMIT 1)
|
|
WHERE
|
|
t1.general_kpi_scale_id = :general_kpi_scale_id
|
|
{$where}";
|
|
|
|
$sqlMonthlyTarget = 'select
|
|
DISTINCT
|
|
t1.*, target as target_value
|
|
from
|
|
general_kpi_monthly_target t1
|
|
LEFT JOIN general_kpi_scale t2 ON t1.general_kpi_scale_id = t2.id
|
|
where
|
|
general_kpi_scale_id=:general_kpi_scale_id
|
|
order by month asc';
|
|
|
|
$sqlQuarterTarget = "select *, target as target_value from emp_kpi_quarter_target where employement_has_kpi_scale_id=:employement_has_kpi_scale_id AND periode like '%Q%' order by id asc";
|
|
$sqlPeriodSetting = "SELECT
|
|
id,
|
|
weight*100 as bobot,
|
|
null as min,
|
|
null as max,
|
|
target,
|
|
target as target_value,
|
|
period_type,
|
|
period_value as view,
|
|
period_value as value
|
|
FROM
|
|
general_kpi_detail_weight
|
|
WHERE
|
|
general_kpi_emp_id =:general_kpi_emp_id";
|
|
|
|
$sqlGetPAApproval = "SELECT DISTINCT a.result_date,periode, a.employement_nik, MONTH(a.result_date) as month, year(a.result_date) as year
|
|
FROM
|
|
`employement_has_behivor_performance` a
|
|
INNER JOIN pa_approval b ON a.id = b.employement_has_behivor_performance_id
|
|
INNER JOIN employement_has_kpi_scale c on a.employement_nik = c.employement_nik
|
|
WHERE c.id=:employement_has_kpi_scale_id
|
|
AND year(result_date)=:year
|
|
ORDER BY a.result_date ASC";
|
|
|
|
$sql['sql'] = $sql1;
|
|
$sql['sqlListEmp'] = $sqlListEmp;
|
|
$sql['sqlMonthlyTarget'] = $sqlMonthlyTarget;
|
|
$sql['sqlQuarterTarget'] = $sqlQuarterTarget;
|
|
$sql['sqlPeriodSetting'] = $sqlPeriodSetting;
|
|
$sql['sqlGetPAApproval'] = $sqlGetPAApproval;
|
|
$sql['sqlDetail'] = $sqlDetail;
|
|
return $sql;
|
|
}
|
|
|
|
function sqlDeleteGembaPeopleGeneral()
|
|
{
|
|
$sqlget = 'select
|
|
t1.kpi_scale_id
|
|
from
|
|
general_kpi_scale t1
|
|
where
|
|
t1.id =:id
|
|
and
|
|
t1.managed_by =:nik';
|
|
|
|
$sql = 'delete from general_kpi_scale where id=:id and managed_by=:nik';
|
|
|
|
$sql1 = 'delete from kpi_scale where `id`=:id';
|
|
|
|
$sql2['sqlget'] = $sqlget;
|
|
$sql2['sql'] = $sql;
|
|
$sql2['sql1'] = $sql1;
|
|
|
|
return $sql2;
|
|
}
|
|
|
|
|
|
function sqlUpdateGembaPeopleGeneral()
|
|
{
|
|
|
|
$sqlUpdateScale = 'UPDATE `kpi_scale` SET
|
|
`kpi_id`=:kpi_id,
|
|
`effective_date`=:effective_date,
|
|
`expired_date`=:expired_date,
|
|
`target`=:target,
|
|
`uom`=:uom
|
|
WHERE `id`=:kpi_scale_id';
|
|
|
|
$sqlUpdateGembaGeneralScale = 'UPDATE general_kpi_scale
|
|
SET
|
|
value_category=:value_category,
|
|
value_type=:value_type
|
|
WHERE id=:id AND managed_by=:managed_by';
|
|
|
|
$deleteGembaScaleDetail = 'delete from kpi_scale_detail where kpi_scale_id=:emp_kpi_scale_id';
|
|
|
|
$sqlScaleDetail = 'insert into kpi_scale_detail(`no_urut`,`description`,`start`,`finish`,`type`,`kpi_scale_id`,target_value)values(:noUrut,:description,:min,:max,:type,:kpiScaleId,:target_value)';
|
|
|
|
$deleteMonthlyTarget = 'delete from general_kpi_monthly_target where general_kpi_scale_id=:general_kpi_scale_id';
|
|
|
|
$sqlMonthlyTarget = "INSERT INTO general_kpi_monthly_target
|
|
(target, `year`, `month`, general_kpi_scale_id, min, max)
|
|
VALUES
|
|
(:target, :year, :month, :general_kpi_scale_id, :min, :max)";
|
|
|
|
$sql['sqlUpdateScale'] = $sqlUpdateScale;
|
|
$sql['sqlUpdateGembaGeneralScale'] = $sqlUpdateGembaGeneralScale;
|
|
$sql['deleteGembaScaleDetail'] = $deleteGembaScaleDetail;
|
|
$sql['sqlScaleDetail'] = $sqlScaleDetail;
|
|
$sql['deleteMonthlyTarget'] = $deleteMonthlyTarget;
|
|
$sql['sqlMonthlyTarget'] = $sqlMonthlyTarget;
|
|
|
|
return $sql;
|
|
}
|
|
|
|
function sqlEmp()
|
|
{
|
|
$sql = "SELECT distinct e.nik,
|
|
e.nik_atasan,
|
|
e.grade,
|
|
e.emp_profile_id,
|
|
e.status,
|
|
e.hired_date,
|
|
e.flag_app,
|
|
e.effective_date,
|
|
CONCAT_WS(' ',CONCAT(p.title,'. '), p.first_name,p.middle_name,p.last_name) as fullname,
|
|
p.first_name,
|
|
p.middle_name,
|
|
p.last_name,
|
|
p.nick_name,
|
|
p.title,
|
|
p.gender,
|
|
p.date_join,
|
|
ej.job_title,
|
|
ej.layer_id,
|
|
ol.description as org_layer_description,
|
|
period.`type`
|
|
FROM
|
|
employement e
|
|
LEFT JOIN emp_profiles p ON p.id = e.emp_profile_id
|
|
LEFT JOIN (SELECT ej.nik, ej.job_title, ej.layer_id, ej.effective_date FROM emp_job ej ORDER BY ej.effective_date DESC) as ej ON e.nik = ej.nik
|
|
LEFT JOIN org_layer ol ON ej.layer_id = ol.id
|
|
LEFT JOIN emp_preiode_apraisal_quarter period ON period.nik = e.nik AND period.id = (SELECT id FROM `emp_preiode_apraisal_quarter` WHERE `nik`=e.nik AND `effective_date` <=CURDATE() ORDER BY effective_date DESC LIMIT 1)
|
|
WHERE
|
|
e.status = 'active'
|
|
AND
|
|
e.nik LIKE :nik";
|
|
|
|
return $sql;
|
|
}
|
|
|
|
public function setStatementApprovalIns()
|
|
{
|
|
try {
|
|
$sql = "INSERT INTO kpi_general_approval
|
|
(approval_type,approval_status,approval_level,is_last_approval,approved_by,is_group,general_kpi_scale_id,days_limit_approval,is_limit_approval)
|
|
VALUES
|
|
(:approval_type,:approval_status,:approval_level,:is_last_approval,:approved_by,:is_group,:transaction_id,:days_limit_approval,:is_limit_approval)";
|
|
|
|
return $this->registry->db->prepare($sql);
|
|
} catch (ErrorException $e) {
|
|
$this->registry->log->error('Message: ' . $e->getMessage() . ' Line: ' . $e->getLine() . ' File: ' . $e->getFile() . ', user: ' . \Helper::getSessionVar('username'));
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public function setStatementGroupApprovalIns()
|
|
{
|
|
try {
|
|
$sql = "INSERT INTO kpi_general_group_approval
|
|
(approval_id,nik_app)
|
|
VALUES
|
|
(:emp_absence_approval_id,:nik_app)";
|
|
|
|
return $this->registry->db->prepare($sql);
|
|
} catch (ErrorException $e) {
|
|
$this->registry->log->error('Message: ' . $e->getMessage() . ' Line: ' . $e->getLine() . ' File: ' . $e->getFile() . ', user: ' . \Helper::getSessionVar('username'));
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function sqlViewDataGembaGeneralApproval()
|
|
{
|
|
$sqlPeopleApproval = "SELECT
|
|
CONCAT_WS(' ', t5.`first_name`, t5.`middle_name`, t5.`last_name`) AS nama,
|
|
t7.kpi,
|
|
t7.description,
|
|
DATE_FORMAT(t6.effective_date, '%Y-%m-%d') as start_date,
|
|
t6.expired_date,
|
|
t6.uom,
|
|
t3.*,
|
|
t1.approval_status,
|
|
t1.approved_by,
|
|
t1.approval_type,
|
|
YEAR(t6.effective_date) as years
|
|
FROM
|
|
kpi_general_approval t1
|
|
LEFT JOIN kpi_general_group_approval t2 on t1.id = t2.approval_id
|
|
LEFT JOIN general_kpi_scale t3 on t1.general_kpi_scale_id = t3.id
|
|
LEFT JOIN employement t4 ON t3.managed_by = t4.nik
|
|
LEFT JOIN emp_profiles t5 ON t4.emp_profile_id = t5.id
|
|
INNER JOIN kpi_scale t6 ON t3.kpi_scale_id = t6.id
|
|
INNER JOIN master_kpi t7 ON t6.kpi_id = t7.id
|
|
WHERE
|
|
t1.approval_status = :type
|
|
AND (t1.approved_by = :nik OR t2.nik_app = :nik)";
|
|
|
|
$sql['sqlPeopleApproval'] = $sqlPeopleApproval;
|
|
return $sql;
|
|
}
|
|
|
|
|
|
public function getQueryApprovalGembaGeneral()
|
|
{
|
|
$sql = "SELECT a.id,
|
|
pe.id as pengajuan_id,
|
|
a.approved_by as nik,
|
|
a.approval_type as `type`,
|
|
a.approval_status,
|
|
a.approval_status as `status`,
|
|
a.approval_level,
|
|
:approved_by AS approved_by,
|
|
a.approved_date as processed_at,
|
|
a.is_last_approval,
|
|
a.days_limit_approval,
|
|
a.is_limit_approval,
|
|
a.reject_comment as notes,
|
|
'1970-01-01' AS start_date,
|
|
'1970-01-01' AS end_date,
|
|
pe.managed_by as created_by,
|
|
'1970-01-01' as created_at
|
|
FROM kpi_general_approval a
|
|
LEFT JOIN general_kpi_scale pe ON a.general_kpi_scale_id = pe.id
|
|
WHERE pe.id = :transaction_id
|
|
ORDER BY a.approval_level ASC";
|
|
return $sql;
|
|
}
|
|
|
|
public function setQueryUpdateApprovalGembaGeneral()
|
|
{
|
|
$sql = "UPDATE kpi_general_approval
|
|
SET approval_status = :approval_status,
|
|
approved_date = NOW(),
|
|
approved_by = :approved_by,
|
|
reject_comment = :reject_comment
|
|
WHERE id = :id";
|
|
return $sql;
|
|
}
|
|
|
|
public function setQueryUpdateNextApprovalGembaGeneral()
|
|
{
|
|
$sql = "UPDATE kpi_general_approval SET approval_status='1' WHERE id=:id";
|
|
return $sql;
|
|
}
|
|
|
|
public function getQueryLevelApprovalGembaGeneral()
|
|
{
|
|
$sql = "SELECT approval_level
|
|
FROM (
|
|
SELECT a.id,
|
|
pe.id as pengajuan_id,
|
|
a.approved_by as nik,
|
|
a.approval_type as `type`,
|
|
a.approval_status,
|
|
a.approval_status as `status`,
|
|
a.approval_level,
|
|
a.approved_by AS approved_by,
|
|
a.approved_date as processed_at,
|
|
a.is_last_approval,
|
|
a.days_limit_approval,
|
|
a.is_limit_approval,
|
|
a.reject_comment as notes,
|
|
'1970-01-01' AS start_date,
|
|
'1970-01-01' AS end_date,
|
|
pe.managed_by as created_by,
|
|
'1970-01-01' as created_at
|
|
FROM kpi_general_approval a
|
|
LEFT JOIN general_kpi_scale pe ON a.general_kpi_scale_id = pe.id
|
|
WHERE pe.id = :transaction_id
|
|
) AS t
|
|
WHERE t.approved_by = :approved_by
|
|
ORDER BY t.approval_level ASC";
|
|
return $sql;
|
|
}
|
|
|
|
function sqlSearchEmpByNik()
|
|
{
|
|
$sql = "SELECT distinct e.nik,
|
|
e.nik_atasan,
|
|
e.grade,
|
|
e.emp_profile_id,
|
|
e.status,
|
|
e.hired_date,
|
|
e.flag_app,
|
|
e.effective_date,
|
|
CONCAT_WS(' ',CONCAT(p.title,'. '), p.first_name,p.middle_name,p.last_name) as fullname,
|
|
p.first_name,
|
|
p.middle_name,
|
|
p.last_name,
|
|
p.nick_name,
|
|
p.title,
|
|
p.gender,
|
|
p.date_join,
|
|
ej.job_title,
|
|
ej.layer_id,
|
|
ol.description as org_layer_description,
|
|
period.`type`
|
|
FROM
|
|
employement e
|
|
LEFT JOIN emp_profiles p ON p.id = e.emp_profile_id
|
|
LEFT JOIN (SELECT ej.nik, ej.job_title, ej.layer_id, ej.effective_date FROM emp_job ej ORDER BY ej.effective_date DESC) as ej ON e.nik = ej.nik
|
|
LEFT JOIN org_layer ol ON ej.layer_id = ol.id
|
|
LEFT JOIN emp_preiode_apraisal_quarter period ON period.nik = e.nik AND period.id = (SELECT id FROM `emp_preiode_apraisal_quarter` WHERE `nik`=e.nik AND `effective_date` <=CURDATE() ORDER BY effective_date DESC LIMIT 1)
|
|
WHERE
|
|
e.status = 'active'
|
|
AND (
|
|
e.nik = :nik
|
|
)
|
|
ORDER BY e.nik, p.first_name, p.middle_name, p.last_name, p.nick_name
|
|
LIMIT 50";
|
|
return $sql;
|
|
}
|
|
|
|
|
|
public function sqlsaveGembaPosition()
|
|
{
|
|
$sqlInsertGemba = 'INSERT INTO `master_kpi`
|
|
(
|
|
`kpi`,
|
|
`description`)
|
|
VALUES
|
|
(
|
|
:kpi,
|
|
:description)';
|
|
|
|
$sqlInsertScale = 'INSERT INTO `kpi_scale`
|
|
(
|
|
`kpi_id`,
|
|
`effective_date`,
|
|
`target`,
|
|
`uom`,
|
|
`expired_date`)
|
|
VALUES
|
|
(
|
|
:kpi_id,
|
|
:effective_date,
|
|
:target,
|
|
:uom,
|
|
:expired_date) ';
|
|
|
|
$sqlInsertGembaPosition = 'INSERT INTO `org_layer_kpi`
|
|
(
|
|
`efective_date`,
|
|
`bobot`,
|
|
`kpi_scale_id`,
|
|
`mpp_detail_id`,
|
|
`expired_date`,
|
|
`value_type`,
|
|
`targetID`,
|
|
`value_category`,
|
|
`additional_note`,
|
|
`is_allow_more_than_100`,
|
|
`status`)
|
|
VALUES
|
|
(
|
|
:efective_date,
|
|
:bobot,
|
|
:kpi_scale_id,
|
|
:mpp_detail_id,
|
|
:expired_date,
|
|
:value_type,
|
|
:targetID,
|
|
:value_category,
|
|
:additional_note,
|
|
:is_allow_more_than_100,
|
|
:status)';
|
|
|
|
$sqlScaleDetail = 'insert into kpi_scale_detail(`no_urut`,`description`,`start`,`finish`,`type`,`kpi_scale_id`,target_value)values(:noUrut,:description,:min,:max,:type,:kpiScaleId,:target_value)';
|
|
|
|
$sqlMonthlyTarget = "INSERT INTO org_layer_kpi_monthly_target
|
|
(target, `year`, `month`, org_layer_kpi_id, min, max)
|
|
VALUES
|
|
(:target, :year, :month, :org_layer_kpi_id, :min, :max)";
|
|
|
|
$sqlQuarterTarget = "INSERT INTO org_layer_kpi_quarter_target
|
|
(target, `year`, `periode`, org_layer_kpi_id, min, max, bobot)
|
|
VALUES
|
|
(:target, :year, :periode, :org_layer_kpi_id, :min, :max, :bobot)";
|
|
|
|
$sql['sqlInsertGemba'] = $sqlInsertGemba;
|
|
$sql['sqlInsertScale'] = $sqlInsertScale;
|
|
$sql['sqlInsertGembaPosition'] = $sqlInsertGembaPosition;
|
|
$sql['sqlScaleDetail'] = $sqlScaleDetail;
|
|
$sql['sqlMonthlyTarget'] = $sqlMonthlyTarget;
|
|
$sql['sqlQuarterTarget'] = $sqlQuarterTarget;
|
|
|
|
return $sql;
|
|
}
|
|
|
|
function sqlViewDataGembaPosition()
|
|
{
|
|
$sqlPosition = "SELECT
|
|
t1.id,
|
|
t1.kpi_scale_id,
|
|
round(SUM((t1.bobot*100)),2) as weight,
|
|
t1.efective_date,
|
|
t1.expired_date,
|
|
t1.value_type,
|
|
t1.org_layer_id,
|
|
t1.mpp_detail_id,
|
|
t1.value_category,
|
|
'kpi' as type_kpi,
|
|
'2' as status,
|
|
t3.description as org_layer,
|
|
count(t1.id) as total_kpi
|
|
FROM
|
|
org_layer_kpi t1
|
|
INNER JOIN mpp_detail t2 ON t1.mpp_detail_id = t2.id
|
|
INNER JOIN org_layer t3 ON t2.org_layer_id = t3.id
|
|
WHERE
|
|
YEAR(`efective_date`)=:year
|
|
AND
|
|
(t1.mpp_detail_id = :mpp_detail_id OR :mpp_detail_id = '')
|
|
GROUP BY t1.mpp_detail_id LIMIT 25";
|
|
|
|
$sqlPositionDetail = "SELECT
|
|
t1.id,
|
|
t1.kpi_scale_id,
|
|
round((t1.bobot*100),2) as weight,
|
|
t1.efective_date,
|
|
t1.expired_date,
|
|
t1.value_type,
|
|
t1.org_layer_id,
|
|
t1.mpp_detail_id,
|
|
t1.value_category,
|
|
'kpi' as type_kpi,
|
|
t1.status,
|
|
t3.description as org_layer
|
|
FROM
|
|
org_layer_kpi t1
|
|
INNER JOIN mpp_detail t2 ON t1.mpp_detail_id = t2.id
|
|
INNER JOIN org_layer t3 ON t2.org_layer_id = t3.id
|
|
WHERE
|
|
YEAR(`efective_date`)=:year
|
|
AND
|
|
t1.mpp_detail_id=:mpp_detail_id";
|
|
|
|
$sqlTotBobot = "select ifnull(sum(totweight),0) as totweight from (SELECT ROUND((bobot*100),2) AS totweight
|
|
FROM `employement_has_kpi_scale` WHERE `employement_nik`=:nik AND YEAR(`efective_date`)=:year
|
|
AND `expired_date` >=:expdate) as tab";
|
|
|
|
$sqlScale = 'SELECT a.id AS idMasterGemba,a.kpi,a.description,b.target,b.uom,b.id AS kpi_scale_id FROM master_kpi a INNER JOIN kpi_scale b ON a.id=b.kpi_id WHERE b.id=:kpiPeopleID AND YEAR(b.effective_date)=:year';
|
|
$sqlScaleNew = "SELECT
|
|
a.id AS idMasterGemba,
|
|
a.kpi,a.description,
|
|
c.target_value as `target`,b.uom,b.id AS kpi_scale_id
|
|
FROM master_kpi a
|
|
INNER JOIN kpi_scale b ON a.id=b.kpi_id
|
|
INNER JOIN kpi_scale_detail c on b.id=c.kpi_scale_id
|
|
WHERE b.id=:kpiPeopleID AND YEAR(b.effective_date)=:year";
|
|
|
|
$sqlCheckApproval = 'SELECT COUNT(`employement_has_kpi_scale_id`) as total FROM `emp_kpi_approval` WHERE `employement_has_kpi_scale_id`=:id';
|
|
|
|
$sqlPositionMonitoring = "SELECT
|
|
t1.id,
|
|
t1.kpi_scale_id,
|
|
round((t1.bobot*100),2) as weight,
|
|
DATE_FORMAT(t1.efective_date, '%Y-%m-%d') as effective_date,
|
|
t1.expired_date,
|
|
t1.value_type,
|
|
'' as employement_nik,
|
|
t1.value_category,
|
|
'kpi_position' as type_kpi,
|
|
'0' as is_allow_more_than_100,
|
|
null as general_kpi_scale_id,
|
|
t1.id as org_layer_kpi_id,
|
|
(SELECT bobot FROM org_layer_kpi_quarter_target WHERE org_layer_kpi_id = t1.id AND periode ='Q1') as q1_bobot,
|
|
(SELECT bobot FROM org_layer_kpi_quarter_target WHERE org_layer_kpi_id = t1.id AND periode ='Q2') as q2_bobot,
|
|
(SELECT bobot FROM org_layer_kpi_quarter_target WHERE org_layer_kpi_id = t1.id AND periode ='Q3') as q3_bobot,
|
|
(SELECT bobot FROM org_layer_kpi_quarter_target WHERE org_layer_kpi_id = t1.id AND periode ='Q4') as q4_bobot,
|
|
(SELECT bobot FROM org_layer_kpi_quarter_target WHERE org_layer_kpi_id = t1.id AND periode ='S1') as s1_bobot,
|
|
(SELECT bobot FROM org_layer_kpi_quarter_target WHERE org_layer_kpi_id = t1.id AND periode ='S2') as s2_bobot,
|
|
t1.efective_date as date_kpi
|
|
FROM
|
|
org_layer_kpi t1
|
|
INNER JOIN mpp_detail t2 ON t1.mpp_detail_id = t2.id
|
|
INNER JOIN org_layer t3 ON t2.org_layer_id = t3.id
|
|
WHERE
|
|
t2.id = :mpp_detail_id
|
|
AND
|
|
YEAR(t1.efective_date) = :year
|
|
AND
|
|
t1.status ='2'";
|
|
|
|
|
|
$sql['sqlPosition'] = $sqlPosition;
|
|
$sql['sqlPositionDetail'] = $sqlPositionDetail;
|
|
$sql['sqlTotBobot'] = $sqlTotBobot;
|
|
$sql['sqlScale'] = $sqlScale;
|
|
$sql['sqlScaleNew'] = $sqlScaleNew;
|
|
$sql['sqlCheckApproval'] = $sqlCheckApproval;
|
|
$sql['sqlPositionMonitoring'] = $sqlPositionMonitoring;
|
|
return $sql;
|
|
}
|
|
|
|
function sqlViewGembaPositionDetail()
|
|
{
|
|
$sql1 = 'SELECT
|
|
KS.`id` AS kpiScaleId,
|
|
KS.`effective_date` AS effectiveDate,
|
|
KS.`expired_date` AS expiredDate,
|
|
KS.`target`,
|
|
KS.`uom`,
|
|
MK.`id` AS kpiId,
|
|
MK.`kpi`,
|
|
MK.`description`,
|
|
EK.`id` AS empGembaScaleId,
|
|
(EK.`bobot`*100) AS bobot,
|
|
EK.`value_type` as valueType,
|
|
EK.`targetID`,
|
|
EK.`value_category` as valueCategory,
|
|
EK.`additional_note` as additional_note,
|
|
EK.`is_allow_more_than_100` as is_allow_more_than_100,
|
|
EK.org_layer_id,
|
|
layer.description as org_layer
|
|
FROM kpi_scale KS
|
|
LEFT JOIN master_kpi MK ON MK.`id`=KS.`kpi_id`
|
|
LEFT JOIN org_layer_kpi EK ON EK.`kpi_scale_id`=KS.`id`
|
|
LEFT JOIN org_layer layer ON EK.org_layer_id = layer.id
|
|
WHERE KS.`id`=:id';
|
|
|
|
$sqlDetail = 'select description,start as min,finish as max,`type`, target_value from kpi_scale_detail where kpi_scale_id=:id order by no_urut asc';
|
|
$sqlMonthlyTarget = 'select
|
|
DISTINCT
|
|
t1.*, target as target_value
|
|
from
|
|
org_layer_kpi_monthly_target t1
|
|
LEFT JOIN employement_has_kpi_scale t2 ON t1.org_layer_kpi_id = t2.id
|
|
where
|
|
org_layer_kpi_id=:org_layer_kpi_id
|
|
order by month asc';
|
|
$sqlQuarterTarget = "select *, target as target_value from org_layer_kpi_quarter_target where org_layer_kpi_id=:org_layer_kpi_id AND periode like '%Q%' order by id asc";
|
|
$sqlSemesterTarget = "select *, target as target_value from org_layer_kpi_quarter_target where org_layer_kpi_id=:org_layer_kpi_id AND periode like '%S%' order by id asc";
|
|
$sqlGetPAApproval = "SELECT DISTINCT a.result_date,periode, a.org_layer_id, MONTH(a.result_date) as month, year(a.result_date) as year
|
|
FROM
|
|
`employement_has_behivor_performance` a
|
|
INNER JOIN pa_approval b ON a.id = b.employement_has_behivor_performance_id
|
|
INNER JOIN employement_has_kpi_scale c on a.org_layer_id = c.org_layer_id
|
|
WHERE c.id=:org_layer_kpi_id
|
|
AND year(result_date)=:year
|
|
ORDER BY a.result_date ASC";
|
|
|
|
$sqlGetExpiredDay = "SELECT * FROM kpi_ref_set_expired WHERE bu=:bu";
|
|
|
|
$sql['sql'] = $sql1;
|
|
$sql['sqlDetail'] = $sqlDetail;
|
|
$sql['sqlMonthlyTarget'] = $sqlMonthlyTarget;
|
|
$sql['sqlQuarterTarget'] = $sqlQuarterTarget;
|
|
$sql['sqlSemesterTarget'] = $sqlSemesterTarget;
|
|
$sql['sqlGetPAApproval'] = $sqlGetPAApproval;
|
|
$sql['sqlGetExpiredDay'] = $sqlGetExpiredDay;
|
|
return $sql;
|
|
}
|
|
|
|
|
|
public function setStatementApprovalGembaPositionIns()
|
|
{
|
|
try {
|
|
$sql = "INSERT INTO kpi_position_approval
|
|
(approval_type,approval_status,approval_level,is_last_approval,approved_by,is_group,org_layer_kpi_id,days_limit_approval,is_limit_approval)
|
|
VALUES
|
|
(:approval_type,:approval_status,:approval_level,:is_last_approval,:approved_by,:is_group,:transaction_id,:days_limit_approval,:is_limit_approval)";
|
|
|
|
return $this->registry->db->prepare($sql);
|
|
} catch (ErrorException $e) {
|
|
$this->registry->log->error('Message: ' . $e->getMessage() . ' Line: ' . $e->getLine() . ' File: ' . $e->getFile() . ', user: ' . \Helper::getSessionVar('username'));
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public function setStatementGroupApprovalGembaPositionIns()
|
|
{
|
|
try {
|
|
$sql = "INSERT INTO kpi_position_group_approval
|
|
(approval_id,nik_app)
|
|
VALUES
|
|
(:emp_absence_approval_id,:nik_app)";
|
|
|
|
return $this->registry->db->prepare($sql);
|
|
} catch (ErrorException $e) {
|
|
$this->registry->log->error('Message: ' . $e->getMessage() . ' Line: ' . $e->getLine() . ' File: ' . $e->getFile() . ', user: ' . \Helper::getSessionVar('username'));
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function sqlViewDataGembaPositionApproval()
|
|
{
|
|
$sqlPeopleApproval = "SELECT
|
|
t7.kpi,
|
|
t7.description,
|
|
DATE_FORMAT(t6.effective_date, '%Y-%m-%d') as start_date,
|
|
t6.expired_date,
|
|
t6.uom,
|
|
t3.*,
|
|
t1.approval_status,
|
|
t1.approved_by,
|
|
t1.approval_type,
|
|
YEAR(t6.effective_date) as years,
|
|
t5.description as org_layer
|
|
FROM
|
|
kpi_position_approval t1
|
|
LEFT JOIN kpi_position_group_approval t2 on t1.id = t2.approval_id
|
|
LEFT JOIN org_layer_kpi t3 on t1.org_layer_kpi_id = t3.id
|
|
INNER JOIN mpp_detail t4 ON t3.mpp_detail_id = t4.id
|
|
INNER JOIN org_layer t5 ON t4.org_layer_id = t5.id
|
|
INNER JOIN kpi_scale t6 ON t3.kpi_scale_id = t6.id
|
|
INNER JOIN master_kpi t7 ON t6.kpi_id = t7.id
|
|
WHERE
|
|
t1.approval_status = :type
|
|
AND (t1.approved_by = :nik OR t2.nik_app = :nik)";
|
|
|
|
$sql['sqlPeopleApproval'] = $sqlPeopleApproval;
|
|
return $sql;
|
|
}
|
|
|
|
public function getQueryApprovalGembaPosition()
|
|
{
|
|
$sql = "SELECT a.id,
|
|
pe.id as pengajuan_id,
|
|
a.approved_by as nik,
|
|
a.approval_type as `type`,
|
|
a.approval_status,
|
|
a.approval_status as `status`,
|
|
a.approval_level,
|
|
:approved_by AS approved_by,
|
|
a.approved_date as processed_at,
|
|
a.is_last_approval,
|
|
a.days_limit_approval,
|
|
a.is_limit_approval,
|
|
a.reject_comment as notes,
|
|
'1970-01-01' AS start_date,
|
|
'1970-01-01' AS end_date,
|
|
'1970-01-01' as created_at
|
|
FROM kpi_position_approval a
|
|
LEFT JOIN org_layer_kpi pe ON a.org_layer_kpi_id = pe.id
|
|
WHERE pe.id = :transaction_id
|
|
ORDER BY a.approval_level ASC";
|
|
return $sql;
|
|
}
|
|
|
|
public function setQueryUpdateApprovalGembaPosition()
|
|
{
|
|
$sql = "UPDATE kpi_position_approval
|
|
SET approval_status = :approval_status,
|
|
approved_date = NOW(),
|
|
approved_by = :approved_by,
|
|
reject_comment = :reject_comment
|
|
WHERE id = :id";
|
|
return $sql;
|
|
}
|
|
|
|
public function setQueryUpdateNextApprovalGembaPosition()
|
|
{
|
|
$sql = "UPDATE kpi_position_approval SET approval_status='1' WHERE id=:id";
|
|
return $sql;
|
|
}
|
|
|
|
public function getQueryLevelApprovalGembaPosition()
|
|
{
|
|
$sql = "SELECT approval_level
|
|
FROM (
|
|
SELECT a.id,
|
|
pe.id as pengajuan_id,
|
|
a.approved_by as nik,
|
|
a.approval_type as `type`,
|
|
a.approval_status,
|
|
a.approval_status as `status`,
|
|
a.approval_level,
|
|
a.approved_by AS approved_by,
|
|
a.approved_date as processed_at,
|
|
a.is_last_approval,
|
|
a.days_limit_approval,
|
|
a.is_limit_approval,
|
|
a.reject_comment as notes,
|
|
'1970-01-01' AS start_date,
|
|
'1970-01-01' AS end_date,
|
|
'1970-01-01' as created_at
|
|
FROM kpi_position_approval a
|
|
LEFT JOIN org_layer_kpi pe ON a.org_layer_kpi_id = pe.id
|
|
WHERE pe.id = :transaction_id
|
|
) AS t
|
|
WHERE t.approved_by = :approved_by
|
|
ORDER BY t.approval_level ASC";
|
|
return $sql;
|
|
}
|
|
|
|
|
|
public function setStatementApprovalEmpGembaPositionIns()
|
|
{
|
|
try {
|
|
$sql = "INSERT INTO employement_kpi_position_approval
|
|
(approval_type,approval_status,approval_level,is_last_approval,approved_by,is_group,employement_kpi_position_id,days_limit_approval,is_limit_approval)
|
|
VALUES
|
|
(:approval_type,:approval_status,:approval_level,:is_last_approval,:approved_by,:is_group,:transaction_id,:days_limit_approval,:is_limit_approval)";
|
|
|
|
return $this->registry->db->prepare($sql);
|
|
} catch (ErrorException $e) {
|
|
$this->registry->log->error('Message: ' . $e->getMessage() . ' Line: ' . $e->getLine() . ' File: ' . $e->getFile() . ', user: ' . \Helper::getSessionVar('username'));
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public function setStatementGroupApprovalEmpGembaPositionIns()
|
|
{
|
|
try {
|
|
$sql = "INSERT INTO employement_kpi_position_group_approval
|
|
(approval_id,nik_app)
|
|
VALUES
|
|
(:emp_absence_approval_id,:nik_app)";
|
|
|
|
return $this->registry->db->prepare($sql);
|
|
} catch (ErrorException $e) {
|
|
$this->registry->log->error('Message: ' . $e->getMessage() . ' Line: ' . $e->getLine() . ' File: ' . $e->getFile() . ', user: ' . \Helper::getSessionVar('username'));
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public function getQueryApprovalEmpGembaPosition()
|
|
{
|
|
$sql = "SELECT a.id,
|
|
pe.id as pengajuan_id,
|
|
a.approved_by as nik,
|
|
a.approval_type as `type`,
|
|
a.approval_status,
|
|
a.approval_status as `status`,
|
|
a.approval_level,
|
|
:approved_by AS approved_by,
|
|
a.approved_date as processed_at,
|
|
a.is_last_approval,
|
|
a.days_limit_approval,
|
|
a.is_limit_approval,
|
|
a.reject_comment as notes,
|
|
'1970-01-01' AS start_date,
|
|
'1970-01-01' AS end_date,
|
|
'1970-01-01' as created_at
|
|
FROM employement_kpi_position_approval a
|
|
LEFT JOIN employement_kpi_position pe ON a.employement_kpi_position_id = pe.id
|
|
WHERE pe.id = :transaction_id
|
|
ORDER BY a.approval_level ASC";
|
|
return $sql;
|
|
}
|
|
|
|
public function setQueryUpdateApprovalEmpGembaPosition()
|
|
{
|
|
$sql = "UPDATE employement_kpi_position_approval
|
|
SET approval_status = :approval_status,
|
|
approved_date = NOW(),
|
|
approved_by = :approved_by,
|
|
reject_comment = :reject_comment
|
|
WHERE id = :id";
|
|
return $sql;
|
|
}
|
|
|
|
public function setQueryUpdateNextApprovalEmpGembaPosition()
|
|
{
|
|
$sql = "UPDATE employement_kpi_position_approval SET approval_status='1' WHERE id=:id";
|
|
return $sql;
|
|
}
|
|
|
|
public function getQueryLevelApprovalEmpGembaPosition()
|
|
{
|
|
$sql = "SELECT approval_level
|
|
FROM (
|
|
SELECT a.id,
|
|
pe.id as pengajuan_id,
|
|
a.approved_by as nik,
|
|
a.approval_type as `type`,
|
|
a.approval_status,
|
|
a.approval_status as `status`,
|
|
a.approval_level,
|
|
a.approved_by AS approved_by,
|
|
a.approved_date as processed_at,
|
|
a.is_last_approval,
|
|
a.days_limit_approval,
|
|
a.is_limit_approval,
|
|
a.reject_comment as notes,
|
|
'1970-01-01' AS start_date,
|
|
'1970-01-01' AS end_date,
|
|
'1970-01-01' as created_at
|
|
FROM employement_kpi_position_approval a
|
|
LEFT JOIN employement_kpi_position pe ON a.employement_kpi_position_id = pe.id
|
|
WHERE pe.id = :transaction_id
|
|
) AS t
|
|
WHERE t.approved_by = :approved_by
|
|
ORDER BY t.approval_level ASC";
|
|
return $sql;
|
|
}
|
|
|
|
function sqlGembaRefFunction($params)
|
|
{
|
|
|
|
$table = "kpi_ref_function t1";
|
|
|
|
$where = "((t1.function_name LIKE :search) OR (t1.description LIKE :search))";
|
|
|
|
$sql = "SELECT
|
|
t1.*
|
|
FROM {$table}
|
|
WHERE {$where}
|
|
LIMIT {$params['offset']}, {$params['jumPage']}";
|
|
|
|
$sqlFilter = 'SELECT FOUND_ROWS() as filter';
|
|
|
|
$sqltotal = "SELECT
|
|
count(t1.id) as total
|
|
FROM {$table}
|
|
WHERE {$where}";
|
|
|
|
$sql1['data'] = $sql;
|
|
$sql1['total'] = $sqltotal;
|
|
$sql1['filter'] = $sqlFilter;
|
|
|
|
return $sql1;
|
|
}
|
|
|
|
function sqlGembaMaster($params)
|
|
{
|
|
|
|
$table = "master_kpi t1
|
|
LEFT JOIN kpi_ref_function t2 ON t1.kpi_ref_function_id = t2.id";
|
|
|
|
$where = "((t1.kpi LIKE :search) OR (t1.description LIKE :search))";
|
|
|
|
$sql = "SELECT
|
|
t1.*,
|
|
t2.function_name
|
|
FROM {$table}
|
|
WHERE {$where}
|
|
ORDER BY id asc
|
|
LIMIT {$params['offset']}, {$params['jumPage']}";
|
|
|
|
$sqlFilter = 'SELECT FOUND_ROWS() as filter';
|
|
|
|
$sqltotal = "SELECT
|
|
count(t1.id) as total
|
|
FROM {$table}
|
|
WHERE {$where}";
|
|
|
|
$sql1['data'] = $sql;
|
|
$sql1['total'] = $sqltotal;
|
|
$sql1['filter'] = $sqlFilter;
|
|
|
|
return $sql1;
|
|
}
|
|
|
|
function sqlViewDataGembaPositionApprovalTm()
|
|
{
|
|
$sqlPeopleApproval = "SELECT
|
|
t7.kpi,
|
|
t7.description,
|
|
DATE_FORMAT(t6.effective_date, '%Y-%m-%d') as start_date,
|
|
t6.expired_date,
|
|
t6.uom,
|
|
t3.*,
|
|
t1.approval_status,
|
|
t1.approved_by,
|
|
t1.approval_type,
|
|
YEAR(t6.effective_date) as years,
|
|
t5.description as org_layer
|
|
FROM
|
|
kpi_position_approval t1
|
|
LEFT JOIN kpi_position_group_approval t2 on t1.id = t2.approval_id
|
|
LEFT JOIN org_layer_kpi t3 on t1.org_layer_kpi_id = t3.id
|
|
INNER JOIN mpp_detail t4 ON t3.mpp_detail_id = t4.id
|
|
INNER JOIN org_layer t5 ON t4.org_layer_id = t5.id
|
|
INNER JOIN kpi_scale t6 ON t3.kpi_scale_id = t6.id
|
|
INNER JOIN master_kpi t7 ON t6.kpi_id = t7.id
|
|
WHERE
|
|
t1.approval_status = :type
|
|
AND (t1.approved_by = :nik OR t2.nik_app = :nik)";
|
|
|
|
$sqlPeopleApproval = "SELECT
|
|
t1.employement_nik,
|
|
getEmpName(t1.employement_nik) as emp_name,
|
|
DATE_FORMAT(t1.efective_date, '%Y-%m-%d') as start_date,
|
|
t1.efective_date,
|
|
t1.expired_date,
|
|
t1.`year`,
|
|
t1.status,
|
|
t1.status_tm,
|
|
t1.status_tm as approval_status,
|
|
t1.notes,
|
|
t4.kpi,
|
|
t4.description,
|
|
t3.uom,
|
|
t2.value_category,
|
|
t2.value_type,
|
|
t1.id,
|
|
t1.org_layer_kpi_id,
|
|
t1.bobot as bobot_emp_set,
|
|
t2.bobot*100 as bobot
|
|
FROM
|
|
employement_kpi_position t1
|
|
LEFT JOIN org_layer_kpi t2 ON t1.org_layer_kpi_id = t2.id
|
|
LEFT JOIN kpi_scale t3 ON t2.kpi_scale_id = t3.id
|
|
LEFT JOIN master_kpi t4 ON t3.kpi_id = t4.id
|
|
WHERE
|
|
t1.status_tm = :type";
|
|
|
|
$sql['sqlPeopleApproval'] = $sqlPeopleApproval;
|
|
return $sql;
|
|
}
|
|
|
|
|
|
function sqlViewDataPaResultKalibrasi($params)
|
|
{
|
|
|
|
$table = "pa_result t1
|
|
LEFT JOIN employement t2 ON t1.nik = t2.nik
|
|
LEFT JOIN emp_personal_sub_area t3 ON t3.id =(select id from emp_personal_sub_area where nik=t2.nik and effective_date<=current_date() order by effective_date desc ,id desc limit 1)";
|
|
|
|
$where = "((getEmpName(t1.nik) LIKE :search) OR (t1.nik LIKE :search)) AND t1.tahun = :tahun AND (left(positionID,2) LIKE :bu OR :bu = '')
|
|
AND
|
|
(mid(positionID,3,2) LIKE :divisi OR :divisi = '' OR :divisi ='All')
|
|
AND
|
|
(MID(positionID,5,2) LIKE :department OR :department = '' OR :department ='All')
|
|
AND
|
|
(t3.sub_area_id = :sub_area_id OR :sub_area_id = '' OR :sub_area_id ='All')
|
|
AND
|
|
(t1.periode = :periode OR :periode = '' OR :periode ='All')";
|
|
|
|
$sql = "SELECT
|
|
t1.id,
|
|
t1.nik,
|
|
getEmpName(t1.nik) as emp_name,
|
|
t1.periode,
|
|
t1.tahun,
|
|
t1.kpi,
|
|
t1.ip,
|
|
t1.nilai_mutu1,
|
|
t1.nilai_kalibrasi,
|
|
t1.kalibrasi_oleh,
|
|
getEmpName(t1.kalibrasi_oleh) as emp_name_kalibrasi,
|
|
t1.kalibrasi_date
|
|
FROM {$table}
|
|
WHERE {$where}
|
|
LIMIT {$params['offset']}, {$params['jumPage']}";
|
|
|
|
$sqlFilter = 'SELECT FOUND_ROWS() as filter';
|
|
|
|
$sqltotal = "SELECT
|
|
count(t1.id) as total
|
|
FROM {$table}
|
|
WHERE {$where}";
|
|
|
|
$sql1['data'] = $sql;
|
|
$sql1['total'] = $sqltotal;
|
|
$sql1['filter'] = $sqlFilter;
|
|
|
|
return $sql1;
|
|
}
|
|
|
|
function sqlViewDataGembaFinalResult()
|
|
{
|
|
|
|
$sql = "SELECT `id`, `year`, `month`, `score`, `ref_level_color_id` FROM `kpi_final_result_month_acc` where `nik`= :nik";
|
|
|
|
return $sql;
|
|
}
|
|
|
|
function sqlViewDataGembaFinalResultMonth()
|
|
{
|
|
|
|
$sql = "SELECT
|
|
`id`, `year`, `month`, `score`, `ref_level_color_id`
|
|
from
|
|
`kpi_final_result_month_acc`
|
|
where
|
|
`year`=:qyear and `month`=:qmonth and (`ref_level_color_id`=1 or `ref_level_color_id`=2 or `ref_level_color_id`=0 )";
|
|
|
|
return $sql;
|
|
}
|
|
|
|
function sqlViewDataGembaFinalResultYear()
|
|
{
|
|
$sql = "SELECT
|
|
`id`, `year`, `score`, `ref_level_color_id`
|
|
from
|
|
`kpi_final_result_periode_acc`
|
|
where
|
|
`nik`=:nik and `periode`=:qtype and `year`<=:qyear and (`ref_level_color_id`=1 or `ref_level_color_id`=2 or `ref_level_color_id`=0 )";
|
|
|
|
return $sql;
|
|
}
|
|
|
|
function sqlViewDataGembaFinalResultPeriodic()
|
|
{
|
|
$sql = "SELECT
|
|
`id`, `year`, `score`, `ref_level_color_id`
|
|
from
|
|
`kpi_final_result_periode_acc`
|
|
where
|
|
`nik`=:nik and `periode`=:qtype and `year`=:qyear and (`ref_level_color_id`=1 or `ref_level_color_id`=2 or `ref_level_color_id`=0 )";
|
|
|
|
return $sql;
|
|
}
|
|
|
|
function sqlViewNikByBuDv()
|
|
{
|
|
|
|
$sql = "SELECT
|
|
t1.nik,
|
|
concat_ws(' ',IFNULL(t2.first_name,''),IFNULL(t2.middle_name,''),IFNULL(t2.last_name,'')) as fullName,
|
|
t7.description as division_name,
|
|
t8.description as department_name,
|
|
t4.description as mpp_name,
|
|
t5.description as layer_name,
|
|
t10.description as business_title_name,
|
|
t11.description as job_title,
|
|
t9.description as work_location
|
|
from employement t1
|
|
inner join emp_profiles t2 on t1.emp_profile_id=t2.id
|
|
inner join emp_job t3 on t1.nik=t3.nik and t3.effective_date=(select max(t31.effective_date) from emp_job t31 where t31.nik=t1.nik and t31.effective_date<=:effective_date)
|
|
inner join mpp_detail t4 on t3.mpp_detail_id=t4.id
|
|
inner join org_layer t5 on t4.org_layer_id=t5.id
|
|
inner join emp_personal_sub_area t6 on t1.nik=t6.nik and t6.effective_date=(select max(t61.effective_date) from emp_personal_sub_area t61 where t61.nik=t1.nik and t61.effective_date<=:effective_date)
|
|
left outer join division t7 on t5.division_id=t7.id
|
|
left outer join department t8 on t5.department_id=t8.id
|
|
left outer join sub_area t9 on t6.sub_area_id=t9.id
|
|
inner join ndc_business_titles t10 on t5.bt_id=t10.id
|
|
inner join job_code t11 on t10.job_code_id=t11.id
|
|
inner join (select nik from kpi_final_result_month_acc group by nik) t12 on t12.nik=t1.nik
|
|
where
|
|
t1.`status`='active'
|
|
AND t5.entity_id=:bu
|
|
AND t5.division_id=:divisi
|
|
AND t5.department_id=:department
|
|
AND t6.sub_area_id=:area";
|
|
|
|
return $sql;
|
|
}
|
|
|
|
function sqlViewNikByBuDvPeriodic()
|
|
{
|
|
$sql = "SELECT
|
|
t1.nik,
|
|
concat_ws(' ',IFNULL(t2.first_name,''),IFNULL(t2.middle_name,''),IFNULL(t2.last_name,'')) as fullName,
|
|
t7.description as division_name,
|
|
t8.description as department_name,
|
|
t4.description as mpp_name,
|
|
t5.description as layer_name,
|
|
t10.description as business_title_name,
|
|
t11.description as job_title,
|
|
t9.description as work_location
|
|
from employement t1
|
|
inner join emp_profiles t2 on t1.emp_profile_id=t2.id
|
|
inner join emp_job t3 on t1.nik=t3.nik and t3.effective_date=(select max(t31.effective_date) from emp_job t31 where t31.nik=t1.nik and t31.effective_date<=:effective_date)
|
|
inner join mpp_detail t4 on t3.mpp_detail_id=t4.id
|
|
inner join org_layer t5 on t4.org_layer_id=t5.id
|
|
inner join emp_personal_sub_area t6 on t1.nik=t6.nik and t6.effective_date=(select max(t61.effective_date) from emp_personal_sub_area t61 where t61.nik=t1.nik and t61.effective_date<=:effective_date)
|
|
left outer join division t7 on t5.division_id=t7.id
|
|
left outer join department t8 on t5.department_id=t8.id
|
|
left outer join sub_area t9 on t6.sub_area_id=t9.id
|
|
inner join ndc_business_titles t10 on t5.bt_id=t10.id
|
|
inner join job_code t11 on t10.job_code_id=t11.id
|
|
inner join (select nik from kpi_final_result_periode_acc group by nik) t12 on t12.nik=t1.nik
|
|
where
|
|
t1.`status`='active'
|
|
AND t5.entity_id=:bu
|
|
AND t5.division_id=:divisi
|
|
AND t5.department_id=:department
|
|
AND t6.sub_area_id=:area";
|
|
|
|
return $sql;
|
|
}
|
|
|
|
function sqlViewDataMonitoringPip($params)
|
|
{
|
|
$field = "t1.nik,
|
|
getEmpName(t1.nik) as emp_name,
|
|
t5.description as bt_name,
|
|
t6.description as division_name,
|
|
t7.description as department_name,
|
|
t9.description as sub_area_name,
|
|
getEmpName(t10.nik_atasan) as atasan_name,
|
|
t1.`id`,
|
|
t1.`year`,
|
|
t1.`month`,
|
|
t1.`score`,
|
|
t1.`ref_level_color_id`,
|
|
t11.color,
|
|
(SELECT
|
|
a.pip_state
|
|
FROM
|
|
pip_register a
|
|
INNER JOIN pip_register_monthly_value b ON a.id = b.register_id
|
|
WHERE
|
|
b.periode_value =:qmonth
|
|
AND
|
|
b.`year` = :qyear
|
|
AND
|
|
a.nik = t1.nik) as pip_state,
|
|
(SELECT
|
|
a.pip_status
|
|
FROM
|
|
pip_register a
|
|
INNER JOIN pip_register_monthly_value b ON a.id = b.register_id
|
|
WHERE
|
|
b.periode_value =:qmonth
|
|
AND
|
|
b.`year` = :qyear
|
|
AND
|
|
a.nik = t1.nik) as status";
|
|
|
|
$table = "`kpi_final_result_month_acc` t1
|
|
INNER JOIN emp_job t2 ON t1.nik = t2.nik AND t2.id = (SELECT id FROM emp_job WHERE nik = t1.nik AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN mpp_detail t3 ON t2.mpp_detail_id = t3.id
|
|
INNER JOIN org_layer t4 ON t3.org_layer_id = t4.id
|
|
INNER JOIN ndc_business_titles t5 ON t4.bt_id = t5.id
|
|
INNER JOIN division t6 ON t4.division_id = t6.id
|
|
INNER JOIN department t7 ON t4.department_id = t7.id
|
|
INNER JOIN emp_personal_sub_area t8 ON t8.nik = t1.nik AND t8.id = (SELECT id FROM emp_personal_sub_area WHERE nik = t1.nik AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN sub_area t9 ON t8.sub_area_id = t9.id
|
|
INNER JOIN employement t10 ON t10.nik = t1.nik
|
|
INNER JOIN kpi_ref_level_color t11 ON t1.ref_level_color_id = t11.id ";
|
|
|
|
|
|
$where = "t1.`year`=:qyear
|
|
and
|
|
t1.`month`=:qmonth
|
|
and
|
|
(t1.`ref_level_color_id`=1 or t1.`ref_level_color_id`=2 or t1.`ref_level_color_id`=0 )";
|
|
|
|
$sql = "SELECT
|
|
$field
|
|
from
|
|
$table
|
|
where
|
|
$where
|
|
LIMIT {$params['offset']}, {$params['jumPage']}";
|
|
|
|
$total = "SELECT
|
|
count(*) as total
|
|
from
|
|
$table
|
|
where
|
|
$where";
|
|
|
|
return array("data" => $sql, "total" => $total);
|
|
}
|
|
|
|
|
|
|
|
function sqlGetTotalPip($params)
|
|
{
|
|
$field = "COUNT(*) as total";
|
|
|
|
$table = "`kpi_final_result_month_acc` t1
|
|
INNER JOIN emp_job t2 ON t1.nik = t2.nik AND t2.id = (SELECT id FROM emp_job WHERE nik = t1.nik AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN mpp_detail t3 ON t2.mpp_detail_id = t3.id
|
|
INNER JOIN org_layer t4 ON t3.org_layer_id = t4.id
|
|
INNER JOIN ndc_business_titles t5 ON t4.bt_id = t5.id
|
|
INNER JOIN division t6 ON t4.division_id = t6.id
|
|
INNER JOIN department t7 ON t4.department_id = t7.id
|
|
INNER JOIN emp_personal_sub_area t8 ON t8.nik = t1.nik AND t8.id = (SELECT id FROM emp_personal_sub_area WHERE nik = t1.nik AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN sub_area t9 ON t8.sub_area_id = t9.id
|
|
INNER JOIN employement t10 ON t10.nik = t1.nik
|
|
INNER JOIN kpi_ref_level_color t11 ON t1.ref_level_color_id = t11.id ";
|
|
|
|
$w_pip_state = 't1.nik not in (
|
|
SELECT
|
|
a.nik
|
|
FROM
|
|
pip_register a
|
|
INNER JOIN pip_register_monthly_value b ON a.id = b.register_id
|
|
WHERE
|
|
b.periode_value =:periode_value
|
|
AND
|
|
b.`year` = :qyear
|
|
)';
|
|
|
|
if ($params['type'] > 0) {
|
|
$w_pip_state = " t1.nik in (
|
|
SELECT
|
|
a.nik
|
|
FROM
|
|
pip_register a
|
|
INNER JOIN pip_register_monthly_value b ON a.id = b.register_id
|
|
WHERE
|
|
b.periode_value =:periode_value
|
|
AND
|
|
b.`year` = :qyear
|
|
AND a.pip_state = {$params['type']}
|
|
)";
|
|
}
|
|
|
|
|
|
$where = "t1.`year`=:qyear
|
|
and
|
|
t1.`month`=:qmonth
|
|
and
|
|
(t1.`ref_level_color_id`=1 or t1.`ref_level_color_id`=2 or t1.`ref_level_color_id`=0 )
|
|
and
|
|
{$w_pip_state}";
|
|
|
|
$sql = "SELECT
|
|
$field
|
|
from
|
|
$table
|
|
where
|
|
$where";
|
|
|
|
return array("data" => $sql);
|
|
}
|
|
|
|
function sqlGetAllAvailableLine()
|
|
{
|
|
$sql = `select *
|
|
from gedung_sector_line a
|
|
INNER JOIN gedung_sector b on a.gedung_sector_id = b.id
|
|
INNER JOIN gedung c on b.gedung_id = c.id
|
|
INNER JOIN ref_manufacture_sub_area d on c.sub_area_id = d.sub_area_id
|
|
INNER JOIN ref_manunfactures e on d.ref_manunfactures_id = e.id
|
|
INNER JOIN ref_manufacture_area f on e.id = f.ref_manunfactures_id
|
|
LEFT JOIN gmbs_business_unit g on a.id = g.gedung_sector_line_id;`;
|
|
return $sql;
|
|
}
|
|
|
|
function sqlGetTotalPipN1($params)
|
|
{
|
|
$field = "COUNT(*) as total";
|
|
|
|
$table = "`kpi_final_result_month_acc` t1
|
|
INNER JOIN emp_job t2 ON t1.nik = t2.nik AND t2.id = (SELECT id FROM emp_job WHERE nik = t1.nik AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN mpp_detail t3 ON t2.mpp_detail_id = t3.id
|
|
INNER JOIN org_layer t4 ON t3.org_layer_id = t4.id
|
|
INNER JOIN ndc_business_titles t5 ON t4.bt_id = t5.id
|
|
INNER JOIN division t6 ON t4.division_id = t6.id
|
|
INNER JOIN department t7 ON t4.department_id = t7.id
|
|
INNER JOIN emp_personal_sub_area t8 ON t8.nik = t1.nik AND t8.id = (SELECT id FROM emp_personal_sub_area WHERE nik = t1.nik AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN sub_area t9 ON t8.sub_area_id = t9.id
|
|
INNER JOIN employement t10 ON t10.nik = t1.nik
|
|
INNER JOIN kpi_ref_level_color t11 ON t1.ref_level_color_id = t11.id ";
|
|
|
|
$w_pip_state = 't1.nik not in (
|
|
SELECT
|
|
a.nik
|
|
FROM
|
|
pip_register a
|
|
INNER JOIN pip_register_monthly_value b ON a.id = b.register_id
|
|
)';
|
|
|
|
if ($params['type'] > 0) {
|
|
$w_pip_state = " t1.nik in (
|
|
SELECT
|
|
a.nik
|
|
FROM
|
|
pip_register a
|
|
INNER JOIN pip_register_monthly_value b ON a.id = b.register_id
|
|
WHERE
|
|
a.pip_state = {$params['type']}
|
|
)";
|
|
}
|
|
|
|
|
|
$where = "t10.nik_atasan =:nik_atasan
|
|
and
|
|
:qyear=:qyear
|
|
and
|
|
:periode_value=:periode_value
|
|
and
|
|
:qmonth=:qmonth
|
|
and
|
|
(t1.`ref_level_color_id`=1 or t1.`ref_level_color_id`=2 or t1.`ref_level_color_id`=0 )
|
|
and
|
|
{$w_pip_state}";
|
|
|
|
$sql = "SELECT
|
|
$field
|
|
from
|
|
$table
|
|
where
|
|
$where";
|
|
|
|
return array("data" => $sql);
|
|
}
|
|
|
|
function sqlGetDetailRegistrasiPip($params)
|
|
{
|
|
$field = "t2.*,
|
|
t1.kpi_scale_id,
|
|
t1.value_type,
|
|
t1.value_category,
|
|
t1.is_allow_more_than_100,
|
|
t3.color";
|
|
|
|
$table = "employement_has_kpi_scale t1
|
|
INNER JOIN kpi_final_result t2 ON t1.id = t2.employement_has_kpi_scale_id
|
|
INNER JOIN kpi_ref_level_color t3 ON t2.ref_level_color_id = t3.id ";
|
|
|
|
$where = "t1.employement_nik = :nik
|
|
AND
|
|
t2.`month` = :month
|
|
AND
|
|
t2.`year` = :year
|
|
AND
|
|
t3.`id` IN (1,2)";
|
|
|
|
$sql = "SELECT
|
|
$field
|
|
from
|
|
$table
|
|
where
|
|
$where";
|
|
|
|
return array("data" => $sql);
|
|
}
|
|
|
|
public function sqlSaveRegisterPip()
|
|
{
|
|
|
|
$sqlGetLastPipLevelMonth = 'SELECT
|
|
t1.`month`,
|
|
t1.`year`,
|
|
t3.periode_value,
|
|
t2.pip_state
|
|
FROM
|
|
kpi_final_result_month_acc t1
|
|
LEFT JOIN pip_register t2 ON t1.nik = t2.nik
|
|
LEFT JOIN pip_register_monthly_value t3 ON t2.id = t3.register_id AND t3.periode_value = t1.`month` AND t3.`year` = t1.`year`
|
|
WHERE
|
|
t1.nik = :nik
|
|
AND
|
|
t1.`year` = :year
|
|
GROUP BY t1.`month`,t1.`year`
|
|
ORDER BY t1.`month` ASC';
|
|
|
|
$sqlInsertPipRegister = 'INSERT INTO `pip_register`
|
|
(
|
|
`register_date`,
|
|
`register_by`,
|
|
`nik`,
|
|
`pip_status`,
|
|
`pip_state`,
|
|
`pip_periode`,
|
|
`ta_status`
|
|
)
|
|
VALUES
|
|
(
|
|
:register_date,
|
|
:register_by,
|
|
:nik,
|
|
:pip_status,
|
|
:pip_state,
|
|
:pip_periode,
|
|
:ta_status
|
|
)';
|
|
|
|
$sqlUpdatePipRegister = 'UPDATE
|
|
`pip_register`
|
|
SET
|
|
pip_status =:pip_status
|
|
WHERE
|
|
id=:id';
|
|
|
|
$sqlInsertPipRegisterMonthlyValue = 'INSERT INTO `pip_register_monthly_value`
|
|
(
|
|
`register_id`,
|
|
`year`,
|
|
`periode_value`,
|
|
`score`
|
|
)
|
|
VALUES
|
|
(
|
|
:register_id,
|
|
:year,
|
|
:periode_value,
|
|
:score)';
|
|
|
|
$sqlInsertPipProjectAssignment = 'INSERT INTO `pip_project_assignment`
|
|
(
|
|
`project_title`,
|
|
`kpi_final_result_id`,
|
|
`register_id`,
|
|
`identification_problem`,
|
|
`improvement_initiative`,
|
|
`target_kpi_score`,
|
|
`note`
|
|
)
|
|
VALUES
|
|
(
|
|
:project_title,
|
|
:kpi_final_result_id,
|
|
:register_id,
|
|
:identification_problem,
|
|
:improvement_initiative,
|
|
:target_kpi_score,
|
|
:note)';
|
|
|
|
$sql['sqlGetLastPipLevelMonth'] = $sqlGetLastPipLevelMonth;
|
|
$sql['sqlInsertPipRegister'] = $sqlInsertPipRegister;
|
|
$sql['sqlInsertPipRegisterMonthlyValue'] = $sqlInsertPipRegisterMonthlyValue;
|
|
$sql['sqlInsertPipProjectAssignment'] = $sqlInsertPipProjectAssignment;
|
|
$sql['sqlUpdatePipRegister'] = $sqlUpdatePipRegister;
|
|
|
|
return $sql;
|
|
}
|
|
|
|
function sqlGetDetailRegistrasiPipSubmit($params)
|
|
{
|
|
$field = "t2.*,
|
|
t1.kpi_scale_id,
|
|
t1.value_type,
|
|
t1.value_category,
|
|
t1.is_allow_more_than_100,
|
|
t3.color,
|
|
t4.identification_problem,
|
|
t4.improvement_initiative,
|
|
t4.note,
|
|
Round(t4.target_kpi_score, 2) target_kpi_score,
|
|
t4.register_id,
|
|
t4.id as pip_project_assignment_id";
|
|
|
|
$table = "employement_has_kpi_scale t1
|
|
INNER JOIN kpi_final_result t2 ON t1.id = t2.employement_has_kpi_scale_id
|
|
INNER JOIN kpi_ref_level_color t3 ON t2.ref_level_color_id = t3.id
|
|
INNER JOIN pip_project_assignment t4 ON t4.kpi_final_result_id = t2.id ";
|
|
|
|
$where = "t1.employement_nik = :nik
|
|
AND
|
|
t2.`month` = :month
|
|
AND
|
|
t2.`year` = :year";
|
|
|
|
$sql = "SELECT
|
|
$field
|
|
from
|
|
$table
|
|
where
|
|
$where";
|
|
|
|
return array("data" => $sql);
|
|
}
|
|
|
|
function sqlViewDataMonitoringPipN1($params)
|
|
{
|
|
$field = "t1.nik,
|
|
getEmpName(t1.nik) as emp_name,
|
|
t5.description as bt_name,
|
|
t6.description as division_name,
|
|
t7.description as department_name,
|
|
t9.description as sub_area_name,
|
|
getEmpName(t10.nik_atasan) as atasan_name,
|
|
t1.`id`,
|
|
t1.`year`,
|
|
t1.`month`,
|
|
t1.`score`,
|
|
t1.`ref_level_color_id`,
|
|
t11.color,
|
|
(SELECT
|
|
a.pip_state
|
|
FROM
|
|
pip_register a
|
|
INNER JOIN pip_register_monthly_value b ON a.id = b.register_id
|
|
WHERE
|
|
b.periode_value =t1.`month`
|
|
AND
|
|
b.`year` = t1.`year`
|
|
AND
|
|
a.nik = t1.nik) as pip_state,
|
|
(SELECT
|
|
a.id
|
|
FROM
|
|
pip_register a
|
|
INNER JOIN pip_register_monthly_value b ON a.id = b.register_id
|
|
WHERE
|
|
b.periode_value =t1.`month`
|
|
AND
|
|
b.`year` = t1.`year`
|
|
AND
|
|
a.nik = t1.nik) as pip_register_id";
|
|
|
|
$table = "`kpi_final_result_month_acc` t1
|
|
INNER JOIN emp_job t2 ON t1.nik = t2.nik AND t2.id = (SELECT id FROM emp_job WHERE nik = t1.nik AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN mpp_detail t3 ON t2.mpp_detail_id = t3.id
|
|
INNER JOIN org_layer t4 ON t3.org_layer_id = t4.id
|
|
INNER JOIN ndc_business_titles t5 ON t4.bt_id = t5.id
|
|
INNER JOIN division t6 ON t4.division_id = t6.id
|
|
INNER JOIN department t7 ON t4.department_id = t7.id
|
|
INNER JOIN emp_personal_sub_area t8 ON t8.nik = t1.nik AND t8.id = (SELECT id FROM emp_personal_sub_area WHERE nik = t1.nik AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN sub_area t9 ON t8.sub_area_id = t9.id
|
|
INNER JOIN employement t10 ON t10.nik = t1.nik
|
|
INNER JOIN kpi_ref_level_color t11 ON t1.ref_level_color_id = t11.id
|
|
INNER JOIN pip_register t12 ON t10.nik = t12.nik ";
|
|
|
|
|
|
$where = "(t1.`ref_level_color_id`=1 or t1.`ref_level_color_id`=2 or t1.`ref_level_color_id`=0 )
|
|
AND
|
|
(SELECT
|
|
a.pip_state
|
|
FROM
|
|
pip_register a
|
|
INNER JOIN pip_register_monthly_value b ON a.id = b.register_id
|
|
WHERE
|
|
b.periode_value =t1.`month`
|
|
AND
|
|
b.`year` = t1.`year`
|
|
AND
|
|
a.nik = t1.nik) is not null
|
|
AND
|
|
t12.pip_status = 'register'
|
|
AND
|
|
t10.nik_atasan = :nik_atasan";
|
|
|
|
$sql = "SELECT
|
|
$field
|
|
from
|
|
$table
|
|
where
|
|
$where
|
|
LIMIT {$params['offset']}, {$params['jumPage']}";
|
|
|
|
$total = "SELECT
|
|
count(*) as total
|
|
from
|
|
$table
|
|
where
|
|
$where";
|
|
|
|
return array("data" => $sql, "total" => $total);
|
|
}
|
|
|
|
function sqlViewDataMonitoringPipTeam($params)
|
|
{
|
|
$field = "t1.nik,
|
|
getEmpName(t1.nik) as emp_name,
|
|
t5.description as bt_name,
|
|
t6.description as division_name,
|
|
t7.description as department_name,
|
|
t9.description as sub_area_name,
|
|
getEmpName(t1.nik_atasan) as atasan_name,
|
|
t12.pip_state,
|
|
t12.pip_status";
|
|
|
|
$table = "`employement` t1
|
|
INNER JOIN emp_job t2 ON t1.nik = t2.nik AND t2.id = (SELECT id FROM emp_job WHERE nik = t1.nik AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN mpp_detail t3 ON t2.mpp_detail_id = t3.id
|
|
INNER JOIN org_layer t4 ON t3.org_layer_id = t4.id
|
|
INNER JOIN ndc_business_titles t5 ON t4.bt_id = t5.id
|
|
INNER JOIN division t6 ON t4.division_id = t6.id
|
|
INNER JOIN department t7 ON t4.department_id = t7.id
|
|
INNER JOIN emp_personal_sub_area t8 ON t8.nik = t1.nik AND t8.id = (SELECT id FROM emp_personal_sub_area WHERE nik = t1.nik AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN sub_area t9 ON t8.sub_area_id = t9.id
|
|
INNER JOIN pip_register t12 ON t12.nik = t1.nik AND t12.id = (SELECT id FROM pip_register WHERE nik = t1.nik ORDER BY id DESC LIMIT 1)";
|
|
|
|
|
|
$where = "t1.nik_atasan = :nik_atasan";
|
|
|
|
$sql = "SELECT
|
|
$field
|
|
from
|
|
$table
|
|
where
|
|
$where
|
|
LIMIT {$params['offset']}, {$params['jumPage']}";
|
|
|
|
$total = "SELECT
|
|
count(*) as total
|
|
from
|
|
$table
|
|
where
|
|
$where";
|
|
|
|
return array("data" => $sql, "total" => $total);
|
|
}
|
|
|
|
function sqlGetHistoryPipEmp($params)
|
|
{
|
|
$sqlYear = "SELECT
|
|
t2.`year`
|
|
FROM
|
|
pip_register t1
|
|
INNER JOIN pip_register_monthly_value t2 ON t1.id = t2.register_id
|
|
WHERE
|
|
t1.nik = :nik
|
|
GROUP BY t2.`year`
|
|
ORDER BY t2.`year` ASC";
|
|
|
|
$sqlMonth = "SELECT
|
|
t1.pip_state,
|
|
LPAD((t2.periode_value+1), 2, '0') as periode_value,
|
|
t2.score,
|
|
t1.pip_status
|
|
FROM
|
|
pip_register t1
|
|
INNER JOIN pip_register_monthly_value t2 ON t1.id = t2.register_id
|
|
WHERE
|
|
t1.nik = :nik
|
|
AND
|
|
t2.`year` =:year
|
|
ORDER BY t2.periode_value ASC";
|
|
|
|
return array("sqlYear" => $sqlYear, "sqlMonth" => $sqlMonth);
|
|
}
|
|
|
|
function sqlGetPipMonitoringMonthlyReport($params)
|
|
{
|
|
$field = "t2.nik_atasan,
|
|
getEmpName(t2.nik_atasan) as atasan_name,
|
|
t6.description as department_name";
|
|
|
|
$table = "pip_register t1
|
|
INNER JOIN employement t2 ON t1.nik = t2.nik
|
|
INNER JOIN emp_job t3 ON t2.nik_atasan = t3.nik AND t3.id = (SELECT id FROM emp_job WHERE nik = t2.nik_atasan AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN mpp_detail t4 ON t3.mpp_detail_id = t4.id
|
|
INNER JOIN org_layer t5 ON t4.org_layer_id = t5.id
|
|
INNER JOIN department t6 ON t5.department_id = t6.id";
|
|
|
|
|
|
$where = "";
|
|
|
|
$sql = "SELECT
|
|
$field
|
|
from
|
|
$table
|
|
$where
|
|
ORDER BY
|
|
t2.nik_atasan ASC
|
|
LIMIT {$params['offset']}, {$params['jumPage']}";
|
|
|
|
$total = "SELECT
|
|
count(*) as total
|
|
from
|
|
$table
|
|
$where";
|
|
|
|
$sqlGetPipList = "SELECT
|
|
t2.nik,
|
|
getEmpName(t2.nik) as emp_name,
|
|
t6.description as business_titles_name,
|
|
t11.description AS kpi_name,
|
|
t7.project_title,
|
|
round(t7.target_kpi_score,2) as target_kpi_score
|
|
FROM
|
|
pip_register t1
|
|
INNER JOIN employement t2 ON t1.nik = t2.nik
|
|
INNER JOIN emp_job t3 ON t2.nik_atasan = t3.nik AND t3.id = (SELECT id FROM emp_job WHERE nik = t2.nik_atasan AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN mpp_detail t4 ON t3.mpp_detail_id = t4.id
|
|
INNER JOIN org_layer t5 ON t4.org_layer_id = t5.id
|
|
INNER JOIN ndc_business_titles t6 ON t5.bt_id = t6.id
|
|
INNER JOIN pip_project_assignment t7 ON t1.id = t7.register_id
|
|
INNER JOIN kpi_final_result t8 ON t7.kpi_final_result_id = t8.id
|
|
INNER JOIN employement_has_kpi_scale t9 ON t8.employement_has_kpi_scale_id = t9.id
|
|
INNER JOIN kpi_scale t10 ON t9.kpi_scale_id = t10.id
|
|
INNER JOIN master_kpi t11 ON t10.kpi_id = t11.id
|
|
WHERE
|
|
t2.nik_atasan = :nik_atasan
|
|
ORDER BY
|
|
t2.nik ASC";
|
|
|
|
return array(
|
|
"data" => $sql,
|
|
"total" => $total,
|
|
"pip_list" => $sqlGetPipList
|
|
);
|
|
}
|
|
|
|
function sqlViewDataListPipMonitoring($params)
|
|
{
|
|
$field = "t1.nik,
|
|
getEmpName(t1.nik) as emp_name,
|
|
t5.description as bt_name,
|
|
t6.description as division_name,
|
|
t7.description as department_name,
|
|
t9.description as sub_area_name,
|
|
getEmpName(t10.nik_atasan) as atasan_name,
|
|
t1.`id`,
|
|
t1.`year`,
|
|
t1.`month`,
|
|
t1.`score`,
|
|
t1.`ref_level_color_id`,
|
|
t11.color,
|
|
(SELECT
|
|
a.pip_state
|
|
FROM
|
|
pip_register a
|
|
INNER JOIN pip_register_monthly_value b ON a.id = b.register_id
|
|
WHERE
|
|
a.id = t12.id) as pip_state,
|
|
(SELECT
|
|
a.id
|
|
FROM
|
|
pip_register a
|
|
INNER JOIN pip_register_monthly_value b ON a.id = b.register_id
|
|
WHERE
|
|
a.id = t12.id) as pip_register_id,
|
|
t12.pip_status as status";
|
|
|
|
$table = "`kpi_final_result_month_acc` t1
|
|
INNER JOIN emp_job t2 ON t1.nik = t2.nik AND t2.id = (SELECT id FROM emp_job WHERE nik = t1.nik AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN mpp_detail t3 ON t2.mpp_detail_id = t3.id
|
|
INNER JOIN org_layer t4 ON t3.org_layer_id = t4.id
|
|
INNER JOIN ndc_business_titles t5 ON t4.bt_id = t5.id
|
|
INNER JOIN division t6 ON t4.division_id = t6.id
|
|
INNER JOIN department t7 ON t4.department_id = t7.id
|
|
INNER JOIN emp_personal_sub_area t8 ON t8.nik = t1.nik AND t8.id = (SELECT id FROM emp_personal_sub_area WHERE nik = t1.nik AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN sub_area t9 ON t8.sub_area_id = t9.id
|
|
INNER JOIN employement t10 ON t10.nik = t1.nik
|
|
INNER JOIN kpi_ref_level_color t11 ON t1.ref_level_color_id = t11.id
|
|
INNER JOIN pip_register t12 ON t10.nik = t12.nik AND t12.id = (SELECT id FROM pip_register WHERE nik = t10.nik ORDER BY id DESC LIMIT 1) ";
|
|
|
|
|
|
$where = "(t1.`ref_level_color_id`=1 or t1.`ref_level_color_id`=2 or t1.`ref_level_color_id`=0 )
|
|
AND
|
|
(SELECT
|
|
a.pip_state
|
|
FROM
|
|
pip_register a
|
|
INNER JOIN pip_register_monthly_value b ON a.id = b.register_id
|
|
WHERE
|
|
b.periode_value =t1.`month`
|
|
AND
|
|
b.`year` = t1.`year`
|
|
AND
|
|
a.nik = t1.nik) is not null";
|
|
|
|
$sql = "SELECT
|
|
$field
|
|
from
|
|
$table
|
|
where
|
|
$where
|
|
GROUP BY t1.nik
|
|
LIMIT {$params['offset']}, {$params['jumPage']}";
|
|
|
|
$total = "SELECT
|
|
count(*) as total
|
|
from
|
|
$table
|
|
where
|
|
$where
|
|
GROUP BY t1.nik";
|
|
|
|
return array("data" => $sql, "total" => $total);
|
|
}
|
|
|
|
function sqlGetDataFormPipEvaluation($params)
|
|
{
|
|
$sqlInfoParticipant = "SELECT
|
|
t1.nik,
|
|
getEmpName(t1.nik) as emp_name,
|
|
t5.description as bt_name,
|
|
t6.description as division_name,
|
|
t7.description as department_name,
|
|
t9.description as sub_area_name,
|
|
getEmpName(t1.nik_atasan) as atasan_name
|
|
FROM
|
|
employement t1
|
|
INNER JOIN emp_job t2 ON t1.nik = t2.nik AND t2.id = (SELECT id FROM emp_job WHERE nik = t1.nik AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN mpp_detail t3 ON t2.mpp_detail_id = t3.id
|
|
INNER JOIN org_layer t4 ON t3.org_layer_id = t4.id
|
|
INNER JOIN ndc_business_titles t5 ON t4.bt_id = t5.id
|
|
INNER JOIN division t6 ON t4.division_id = t6.id
|
|
INNER JOIN department t7 ON t4.department_id = t7.id
|
|
INNER JOIN emp_personal_sub_area t8 ON t8.nik = t1.nik AND t8.id = (SELECT id FROM emp_personal_sub_area WHERE nik = t1.nik AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN sub_area t9 ON t8.sub_area_id = t9.id
|
|
WHERE
|
|
t1.nik = :nik";
|
|
|
|
|
|
$sqlHistoriPip = "SELECT
|
|
t1.nik,
|
|
t1.pip_state,
|
|
t1.pip_status,
|
|
t2.periode_value,
|
|
t2.`year`,
|
|
round(t3.score,2) score,
|
|
t4.name as color_name,
|
|
t4.`level` as level_color,
|
|
t4.color,
|
|
(SELECT
|
|
b.color
|
|
FROM
|
|
kpi_final_result_month_acc a
|
|
LEFT JOIN kpi_ref_level_color b ON a.ref_level_color_id = b.id
|
|
WHERE
|
|
a.nik = t1.nik
|
|
AND
|
|
a.`month` = (t2.periode_value+1)
|
|
AND
|
|
a.`year` = t2.`year`) as color_after,
|
|
(SELECT
|
|
round(a.score,2)
|
|
FROM
|
|
kpi_final_result_month_acc a
|
|
LEFT JOIN kpi_ref_level_color b ON a.ref_level_color_id = b.id
|
|
WHERE
|
|
a.nik = t1.nik
|
|
AND
|
|
a.`month` = (t2.periode_value+1)
|
|
AND
|
|
a.`year` = t2.`year`) as score_after
|
|
FROM
|
|
pip_register t1
|
|
INNER JOIN pip_register_monthly_value t2 ON t1.id = t2.register_id
|
|
LEFT JOIN kpi_final_result_month_acc t3 ON t3.nik = t1.nik AND t3.`month` = t2.periode_value AND t3.`year` = t2.`year`
|
|
LEFT JOIN kpi_ref_level_color t4 ON t3.ref_level_color_id = t4.id
|
|
WHERE
|
|
t1.nik = :nik
|
|
AND
|
|
t2.`year` =:year
|
|
AND
|
|
t2.periode_value <=:month
|
|
ORDER BY
|
|
t1.pip_state ASC, t2.periode_value ASC ";
|
|
|
|
|
|
|
|
$sqlSummaryFinalResult = "SELECT
|
|
t3.id as pip_project_assignment_id,
|
|
t1.nik,
|
|
t1.pip_state,
|
|
t1.pip_status,
|
|
t2.periode_value,
|
|
t2.`year`,
|
|
t3.improvement_initiative,
|
|
t7.kpi as kpi_name,
|
|
t7.description as kpi_desc,
|
|
round(t4.ach,2) as ach_actual,
|
|
round(t4.result_quantitative,2) as actual,
|
|
t8.name as color_name,
|
|
t8.`level` as level_color,
|
|
t8.color,
|
|
round(t4.target,2) as target,
|
|
round((t4.result_quantitative - t4.target),2) as gap,
|
|
(SELECT
|
|
round(a.ach,2)
|
|
FROM
|
|
kpi_final_result a
|
|
LEFT JOIN kpi_ref_level_color b ON a.ref_level_color_id = b.id
|
|
WHERE
|
|
a.employement_has_kpi_scale_id = t4.employement_has_kpi_scale_id
|
|
AND
|
|
a.`month` = (t4.month+1)
|
|
AND
|
|
a.`year` = t4.`year`) as ach_after,
|
|
(SELECT
|
|
b.color
|
|
FROM
|
|
kpi_final_result a
|
|
LEFT JOIN kpi_ref_level_color b ON a.ref_level_color_id = b.id
|
|
WHERE
|
|
a.employement_has_kpi_scale_id = t4.employement_has_kpi_scale_id
|
|
AND
|
|
a.`month` = (t4.month+1)
|
|
AND
|
|
a.`year` = t4.`year`) as color_after
|
|
FROM
|
|
pip_register t1
|
|
INNER JOIN pip_register_monthly_value t2 ON t1.id = t2.register_id
|
|
INNER JOIN pip_project_assignment t3 ON t3.register_id = t1.id
|
|
INNER JOIN kpi_final_result t4 ON t3.kpi_final_result_id = t4.id
|
|
INNER JOIN employement_has_kpi_scale t5 ON t4.employement_has_kpi_scale_id = t5.id
|
|
INNER JOIN kpi_scale t6 ON t5.kpi_scale_id = t6.id
|
|
INNER JOIN master_kpi t7 ON t6.kpi_id = t7.id
|
|
LEFT JOIN kpi_ref_level_color t8 ON t4.ref_level_color_id = t8.id
|
|
WHERE
|
|
t1.nik = :nik
|
|
AND
|
|
t2.`year` =:year
|
|
AND
|
|
t4.month =:month
|
|
ORDER BY
|
|
t1.pip_state";
|
|
|
|
$sqlStatusPIP = "SELECT
|
|
round(a.score,2) as score,
|
|
b.*,
|
|
if(b.id=1 OR b.id=2,'Failed', 'Success') as status_pip
|
|
FROM
|
|
kpi_final_result_month_acc a
|
|
LEFT JOIN kpi_ref_level_color b ON a.ref_level_color_id = b.id
|
|
WHERE
|
|
a.nik = :nik
|
|
AND
|
|
a.`month` = (:month + 1)
|
|
AND
|
|
a.`year` = :year";
|
|
|
|
|
|
return array(
|
|
"sqlInfoParticipant" => $sqlInfoParticipant,
|
|
"sqlHistoriPip" => $sqlHistoriPip,
|
|
"sqlSummaryFinalResult" => $sqlSummaryFinalResult,
|
|
"sqlStatusPIP" => $sqlStatusPIP,
|
|
);
|
|
}
|
|
|
|
|
|
function sqlViewDataListPipMonitoringServices($params)
|
|
{
|
|
$field = "t1.nik,
|
|
getEmpName(t1.nik) as emp_name,
|
|
t5.description as bt_name,
|
|
t6.description as division_name,
|
|
t7.description as department_name,
|
|
t9.description as sub_area_name,
|
|
getEmpName(t10.nik_atasan) as atasan_name,
|
|
t1.`id`,
|
|
t1.`year`,
|
|
t1.`month`,
|
|
t1.`score`,
|
|
t1.`ref_level_color_id`,
|
|
t11.color,
|
|
(SELECT
|
|
a.pip_state
|
|
FROM
|
|
pip_register a
|
|
INNER JOIN pip_register_monthly_value b ON a.id = b.register_id
|
|
WHERE
|
|
a.id = t12.id) as pip_state,
|
|
(SELECT
|
|
a.id
|
|
FROM
|
|
pip_register a
|
|
INNER JOIN pip_register_monthly_value b ON a.id = b.register_id
|
|
WHERE
|
|
a.id = t12.id) as pip_register_id,
|
|
t12.pip_status as status,
|
|
t13.pip_action";
|
|
|
|
$table = "`kpi_final_result_month_acc` t1
|
|
INNER JOIN emp_job t2 ON t1.nik = t2.nik AND t2.id = (SELECT id FROM emp_job WHERE nik = t1.nik AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN mpp_detail t3 ON t2.mpp_detail_id = t3.id
|
|
INNER JOIN org_layer t4 ON t3.org_layer_id = t4.id
|
|
INNER JOIN ndc_business_titles t5 ON t4.bt_id = t5.id
|
|
INNER JOIN division t6 ON t4.division_id = t6.id
|
|
INNER JOIN department t7 ON t4.department_id = t7.id
|
|
INNER JOIN emp_personal_sub_area t8 ON t8.nik = t1.nik AND t8.id = (SELECT id FROM emp_personal_sub_area WHERE nik = t1.nik AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN sub_area t9 ON t8.sub_area_id = t9.id
|
|
INNER JOIN employement t10 ON t10.nik = t1.nik
|
|
INNER JOIN kpi_ref_level_color t11 ON t1.ref_level_color_id = t11.id
|
|
INNER JOIN pip_register t12 ON t10.nik = t12.nik AND t12.id = (SELECT id FROM pip_register WHERE nik = t12.nik ORDER BY id DESC LIMIT 1)
|
|
LEFT JOIN pip_register_action t13 ON t12.id = t13.pip_register_id";
|
|
|
|
|
|
$where = "(t1.`ref_level_color_id`=1 or t1.`ref_level_color_id`=2 or t1.`ref_level_color_id`=0 )
|
|
AND
|
|
(SELECT
|
|
a.pip_state
|
|
FROM
|
|
pip_register a
|
|
INNER JOIN pip_register_monthly_value b ON a.id = b.register_id
|
|
WHERE
|
|
b.periode_value =t1.`month`
|
|
AND
|
|
b.`year` = t1.`year`
|
|
AND
|
|
a.nik = t1.nik) is not null";
|
|
|
|
$sql = "SELECT
|
|
$field
|
|
from
|
|
$table
|
|
where
|
|
$where
|
|
GROUP BY t1.nik
|
|
LIMIT {$params['offset']}, {$params['jumPage']}";
|
|
|
|
$total = "SELECT
|
|
count(*) as total
|
|
from
|
|
$table
|
|
where
|
|
$where
|
|
GROUP BY t1.nik";
|
|
|
|
return array("data" => $sql, "total" => $total);
|
|
}
|
|
|
|
function sqlViewDataListPipMonitoringAction($params)
|
|
{
|
|
$field = "t1.nik,
|
|
getEmpName(t1.nik) as emp_name,
|
|
t5.description as bt_name,
|
|
t6.description as division_name,
|
|
t7.description as department_name,
|
|
t9.description as sub_area_name,
|
|
getEmpName(t10.nik_atasan) as atasan_name,
|
|
t1.`id`,
|
|
t1.`year`,
|
|
t1.`month`,
|
|
t1.`score`,
|
|
t1.`ref_level_color_id`,
|
|
t11.color,
|
|
(SELECT
|
|
a.pip_state
|
|
FROM
|
|
pip_register a
|
|
INNER JOIN pip_register_monthly_value b ON a.id = b.register_id
|
|
WHERE
|
|
b.periode_value =t1.`month`
|
|
AND
|
|
b.`year` = t1.`year`
|
|
AND
|
|
a.nik = t1.nik) as pip_state,
|
|
(SELECT
|
|
a.id
|
|
FROM
|
|
pip_register a
|
|
INNER JOIN pip_register_monthly_value b ON a.id = b.register_id
|
|
WHERE
|
|
b.periode_value =t1.`month`
|
|
AND
|
|
b.`year` = t1.`year`
|
|
AND
|
|
a.nik = t1.nik) as pip_register_id,
|
|
t12.pip_status as status,
|
|
t13.pip_action,
|
|
t14.status as pip_action_status";
|
|
|
|
$table = "`kpi_final_result_month_acc` t1
|
|
INNER JOIN emp_job t2 ON t1.nik = t2.nik AND t2.id = (SELECT id FROM emp_job WHERE nik = t1.nik AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN mpp_detail t3 ON t2.mpp_detail_id = t3.id
|
|
INNER JOIN org_layer t4 ON t3.org_layer_id = t4.id
|
|
INNER JOIN ndc_business_titles t5 ON t4.bt_id = t5.id
|
|
INNER JOIN division t6 ON t4.division_id = t6.id
|
|
INNER JOIN department t7 ON t4.department_id = t7.id
|
|
INNER JOIN emp_personal_sub_area t8 ON t8.nik = t1.nik AND t8.id = (SELECT id FROM emp_personal_sub_area WHERE nik = t1.nik AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN sub_area t9 ON t8.sub_area_id = t9.id
|
|
INNER JOIN employement t10 ON t10.nik = t1.nik
|
|
INNER JOIN kpi_ref_level_color t11 ON t1.ref_level_color_id = t11.id
|
|
INNER JOIN pip_register t12 ON t10.nik = t12.nik AND t12.id = (SELECT id FROM pip_register WHERE nik = t12.nik ORDER BY id DESC LIMIT 1)
|
|
INNER JOIN pip_register_action t13 ON t12.id = t13.pip_register_id
|
|
INNER JOIN pip_register_action_status t14 ON t13.id = t14.pip_register_action_id ";
|
|
|
|
|
|
$where = "(t1.`ref_level_color_id`=1 or t1.`ref_level_color_id`=2 or t1.`ref_level_color_id`=0 )
|
|
AND
|
|
(SELECT
|
|
a.pip_state
|
|
FROM
|
|
pip_register a
|
|
INNER JOIN pip_register_monthly_value b ON a.id = b.register_id
|
|
WHERE
|
|
b.periode_value =t1.`month`
|
|
AND
|
|
b.`year` = t1.`year`
|
|
AND
|
|
a.nik = t1.nik) is not null";
|
|
|
|
$sql = "SELECT
|
|
$field
|
|
from
|
|
$table
|
|
where
|
|
$where
|
|
GROUP BY t1.nik
|
|
LIMIT {$params['offset']}, {$params['jumPage']}";
|
|
|
|
$total = "SELECT
|
|
count(*) as total
|
|
from
|
|
$table
|
|
where
|
|
$where
|
|
GROUP BY t1.nik";
|
|
|
|
return array("data" => $sql, "total" => $total);
|
|
}
|
|
|
|
function sqlViewDataListPipMonitoringTa($params)
|
|
{
|
|
$field = "t1.nik,
|
|
getEmpName(t1.nik) as emp_name,
|
|
t5.description as bt_name,
|
|
t6.description as division_name,
|
|
t7.description as department_name,
|
|
t9.description as sub_area_name,
|
|
getEmpName(t10.nik_atasan) as atasan_name,
|
|
t1.`id`,
|
|
t1.`year`,
|
|
t1.`month`,
|
|
t1.`score`,
|
|
t1.`ref_level_color_id`,
|
|
t11.color,
|
|
(SELECT
|
|
a.pip_state
|
|
FROM
|
|
pip_register a
|
|
INNER JOIN pip_register_monthly_value b ON a.id = b.register_id
|
|
WHERE
|
|
a.id = t12.id) as pip_state,
|
|
(SELECT
|
|
a.id
|
|
FROM
|
|
pip_register a
|
|
INNER JOIN pip_register_monthly_value b ON a.id = b.register_id
|
|
WHERE
|
|
a.id = t12.id) as pip_register_id,
|
|
t12.ta_status as status,
|
|
t13.pip_action";
|
|
|
|
$table = "`kpi_final_result_month_acc` t1
|
|
INNER JOIN emp_job t2 ON t1.nik = t2.nik AND t2.id = (SELECT id FROM emp_job WHERE nik = t1.nik AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN mpp_detail t3 ON t2.mpp_detail_id = t3.id
|
|
INNER JOIN org_layer t4 ON t3.org_layer_id = t4.id
|
|
INNER JOIN ndc_business_titles t5 ON t4.bt_id = t5.id
|
|
INNER JOIN division t6 ON t4.division_id = t6.id
|
|
INNER JOIN department t7 ON t4.department_id = t7.id
|
|
INNER JOIN emp_personal_sub_area t8 ON t8.nik = t1.nik AND t8.id = (SELECT id FROM emp_personal_sub_area WHERE nik = t1.nik AND effective_date <= :date ORDER BY effective_date DESC LIMIT 1)
|
|
INNER JOIN sub_area t9 ON t8.sub_area_id = t9.id
|
|
INNER JOIN employement t10 ON t10.nik = t1.nik
|
|
INNER JOIN kpi_ref_level_color t11 ON t1.ref_level_color_id = t11.id
|
|
INNER JOIN pip_register t12 ON t10.nik = t12.nik AND t12.id = (SELECT id FROM pip_register WHERE nik = t12.nik ORDER BY id DESC LIMIT 1)
|
|
LEFT JOIN pip_register_action t13 ON t12.id = t13.pip_register_id";
|
|
|
|
|
|
$where = "(t1.`ref_level_color_id`=1 or t1.`ref_level_color_id`=2 or t1.`ref_level_color_id`=0 )
|
|
AND
|
|
(SELECT
|
|
a.pip_state
|
|
FROM
|
|
pip_register a
|
|
INNER JOIN pip_register_monthly_value b ON a.id = b.register_id
|
|
WHERE
|
|
b.periode_value =t1.`month`
|
|
AND
|
|
b.`year` = t1.`year`
|
|
AND
|
|
a.nik = t1.nik) is not null";
|
|
|
|
$sql = "SELECT
|
|
$field
|
|
from
|
|
$table
|
|
where
|
|
$where
|
|
GROUP BY t1.nik
|
|
LIMIT {$params['offset']}, {$params['jumPage']}";
|
|
|
|
$total = "SELECT
|
|
count(*) as total
|
|
from
|
|
$table
|
|
where
|
|
$where
|
|
GROUP BY t1.nik";
|
|
|
|
return array("data" => $sql, "total" => $total);
|
|
}
|
|
|
|
public function setStatementGetIssues()
|
|
{
|
|
$sql = "SELECT c.id as gmb_asessor_result_id,a.note as issues, concat(bx.section_code,'-',bx.section_name) as section,
|
|
h.type_name as `type`, i.category_name as category, concat(d.employement_nik,' - ',getEmpName(d.employement_nik)) as assessor,
|
|
e.status,e.risk_level,t1.due_date,concat(e.pic,' - ',getEmpName(e.pic)) as pic,e.note,t1.feedback,
|
|
e.pic as pic_nik, getEmpName(e.pic) as pic_name,ix.file_location
|
|
FROM gmb_asessor_result_notes a
|
|
inner join gmb_event_sections b on a.gmb_event_sections_id=b.id
|
|
INNER JOIN gmb_question_section bx on b.gmb_question_section_id=bx.id
|
|
INNER JOIN gmb_asessor_result c on a.gmb_asessor_result_id=c.id
|
|
INNER JOIN gmb_event_asessor d on c.gmb_event_asessor_id=d.id
|
|
INNER JOIN gmb_answer_detail f on c.gmb_answer_detail_id=f.id
|
|
INNER JOIN gmb_questions g on f.gmb_questions_id=g.id
|
|
INNER JOIN gmb_question_types h on g.gmb_question_types_id=h.id
|
|
INNER JOIN gmb_question_category i on g.gmb_question_category_id=i.id
|
|
LEFT JOIN gmb_assesor_result_files ix on ix.gmb_asessor_result_id=c.id
|
|
LEFT JOIN gmb_asessor_result_status e on c.id=e.gmb_asessor_result_id
|
|
LEFT JOIN gmb_event_question_feedback t1 on e.gmb_asessor_result_id=t1.gmb_asessor_result_status_gmb_asessor_result_id
|
|
where b.gmb_events_id=:event_id";
|
|
|
|
return $this->registry->db->prepare($sql);
|
|
}
|
|
|
|
public function setStatementGetStatus()
|
|
{
|
|
$sql = "SELECT gmb_asessor_result_id
|
|
FROM gmb_asessor_result_status a
|
|
where gmb_asessor_result_id=:id";
|
|
|
|
return $this->registry->db->prepare($sql);
|
|
}
|
|
|
|
public function setStatementInsStatus()
|
|
{
|
|
$sql = "INSERT INTO gmb_asessor_result_status
|
|
(gmb_asessor_result_id,note,pic,risk_level,status)
|
|
values
|
|
(:gmb_asessor_result_id,:note,:pic,:risk_level,:status)";
|
|
|
|
return $this->registry->db->prepare($sql);
|
|
}
|
|
|
|
public function setStatementUpdStatus()
|
|
{
|
|
$sql = "UPDATE gmb_asessor_result_status SET
|
|
note=:note,
|
|
pic=:pic,
|
|
risk_level=:risk_level,
|
|
status=:status
|
|
WHERE gmb_asessor_result_id=:gmb_asessor_result_id";
|
|
|
|
return $this->registry->db->prepare($sql);
|
|
}
|
|
|
|
public function setStatementGetGeneralIssues()
|
|
{
|
|
$sql = "SELECT a.id,a.issues,a.file_address,a.status,a.risk_level,b.due_date,a.pic as pic_nik,getEmpName(a.pic) as pic_name,a.created_by,getEmpName(a.created_by) as created_by_name,a.created_date,
|
|
b.feedback
|
|
FROM gmb_event_issues a
|
|
LEFT JOIN gmb_event_issue_feedback b on a.id=b.gmb_event_issues_id
|
|
WHERE a.gmb_events_id=:event_id
|
|
ORDER BY a.id desc";
|
|
|
|
return $this->registry->db->prepare($sql);
|
|
}
|
|
|
|
public function setStatementUpdDueDate()
|
|
{
|
|
$sql = "UPDATE gmb_event_issues SET
|
|
pic=:pic
|
|
WHERE id=:id";
|
|
|
|
return $this->registry->db->prepare($sql);
|
|
}
|
|
|
|
public function setStatementGetResponCount()
|
|
{
|
|
$sql = "SELECT sum(total) as total from (
|
|
SELECT count(b.gmb_event_issues_id) as total, 'general' as type
|
|
FROM gmb_event_issues a
|
|
INNER JOIN gmb_event_issue_feedback b on b.gmb_event_issues_id=a.id
|
|
LEFT JOIN gmb_issue_feedback_respond_read c on b.gmb_event_issues_id=c.issue_feedback_id
|
|
WHERE a.gmb_events_id=:id and b.feedback is not null and b.gmb_event_issues_id not in
|
|
(select b.issue_feedback_id from gmb_event_issue_feedback a
|
|
RIGHT JOIN gmb_issue_feedback_respond_read b on a.gmb_event_issues_id=b.issue_feedback_id
|
|
where a.gmb_events_id=:id
|
|
)
|
|
UNION
|
|
SELECT count(b.gmb_asessor_result_status_gmb_asessor_result_id) as total, 'assessment' as type
|
|
FROM gmb_asessor_result_status a
|
|
INNER JOIN gmb_event_question_feedback b on b.gmb_asessor_result_status_gmb_asessor_result_id=a.gmb_asessor_result_id
|
|
INNER JOIN gmb_asessor_result t1 on a.gmb_asessor_result_id=t1.id
|
|
INNER JOIN gmb_event_questions t2 on t2.id=t1.gmb_event_questions_id
|
|
LEFT JOIN gmb_question_feedback_respond_read c on b.gmb_asessor_result_status_gmb_asessor_result_id=c.question_feedback_id
|
|
WHERE t2.gmb_events_id=:id and b.feedback is not null and b.gmb_asessor_result_status_gmb_asessor_result_id not in
|
|
(select b.question_feedback_id from gmb_event_question_feedback a
|
|
RIGHT JOIN gmb_question_feedback_respond_read b on a.gmb_asessor_result_status_gmb_asessor_result_id=b.question_feedback_id
|
|
where t2.gmb_events_id=:id
|
|
)
|
|
) as tab";
|
|
|
|
return $this->registry->db->prepare($sql);
|
|
}
|
|
|
|
public function setStatementGetResponCountGeneralIssue()
|
|
{
|
|
$sql = "SELECT count(b.gmb_event_issues_id) as total
|
|
FROM gmb_event_issues a
|
|
INNER JOIN gmb_event_issue_feedback b on b.gmb_event_issues_id=a.id
|
|
LEFT JOIN gmb_issue_feedback_respond_read c on b.gmb_event_issues_id=c.issue_feedback_id
|
|
WHERE a.gmb_events_id=:id and b.feedback is not null and b.gmb_event_issues_id not in
|
|
(select b.issue_feedback_id from gmb_event_issue_feedback a
|
|
RIGHT JOIN gmb_issue_feedback_respond_read b on a.gmb_event_issues_id=b.issue_feedback_id
|
|
where a.gmb_events_id=:id
|
|
)
|
|
";
|
|
|
|
return $this->registry->db->prepare($sql);
|
|
}
|
|
|
|
public function setStatementGetResponCountIssue()
|
|
{
|
|
$sql = "SELECT count(b.gmb_asessor_result_status_gmb_asessor_result_id) as total
|
|
FROM gmb_asessor_result_status a
|
|
INNER JOIN gmb_event_question_feedback b on b.gmb_asessor_result_status_gmb_asessor_result_id=a.gmb_asessor_result_id
|
|
INNER JOIN gmb_asessor_result t1 on a.gmb_asessor_result_id=t1.id
|
|
INNER JOIN gmb_event_questions t2 on t2.id=t1.gmb_event_questions_id
|
|
LEFT JOIN gmb_question_feedback_respond_read c on b.gmb_asessor_result_status_gmb_asessor_result_id=c.question_feedback_id
|
|
WHERE t2.gmb_events_id=:id and b.feedback is not null and b.gmb_asessor_result_status_gmb_asessor_result_id not in
|
|
(select b.question_feedback_id from gmb_event_question_feedback a
|
|
RIGHT JOIN gmb_question_feedback_respond_read b on a.gmb_asessor_result_status_gmb_asessor_result_id=b.question_feedback_id
|
|
where t2.gmb_events_id=:id
|
|
)
|
|
";
|
|
|
|
return $this->registry->db->prepare($sql);
|
|
}
|
|
|
|
public function setStatementGetResponCountGenIssue()
|
|
{
|
|
$sql = "SELECT count(b.gmb_event_issues_id) as total
|
|
FROM gmb_event_issues a
|
|
INNER JOIN gmb_event_issue_feedback b on b.gmb_event_issues_id=a.id
|
|
LEFT JOIN gmb_issue_feedback_respond_read c on b.gmb_event_issues_id=c.issue_feedback_id
|
|
WHERE a.id=:id and b.feedback is not null and b.gmb_event_issues_id not in
|
|
(select b.issue_feedback_id from gmb_event_issue_feedback a
|
|
RIGHT JOIN gmb_issue_feedback_respond_read b on a.gmb_event_issues_id=b.issue_feedback_id
|
|
where a.id=:id
|
|
)
|
|
";
|
|
|
|
return $this->registry->db->prepare($sql);
|
|
}
|
|
|
|
public function setStatementGetResponCountAssIssue()
|
|
{
|
|
$sql = "SELECT count(b.gmb_asessor_result_status_gmb_asessor_result_id) as total
|
|
FROM gmb_asessor_result_status a
|
|
INNER JOIN gmb_event_question_feedback b on b.gmb_asessor_result_status_gmb_asessor_result_id=a.gmb_asessor_result_id
|
|
LEFT JOIN gmb_question_feedback_respond_read c on b.gmb_asessor_result_status_gmb_asessor_result_id=c.question_feedback_id
|
|
WHERE a.gmb_asessor_result_id=:id and b.feedback is not null and b.gmb_asessor_result_status_gmb_asessor_result_id not in
|
|
(select b.question_feedback_id from gmb_event_question_feedback a
|
|
RIGHT JOIN gmb_question_feedback_respond_read b on a.gmb_asessor_result_status_gmb_asessor_result_id=b.question_feedback_id
|
|
where a.gmb_asessor_result_id=:id
|
|
)
|
|
";
|
|
|
|
return $this->registry->db->prepare($sql);
|
|
}
|
|
|
|
public function setStatementCheckGenIssueRead()
|
|
{
|
|
$sql = "SELECT a.id
|
|
FROM gmb_issue_feedback_respond_read a
|
|
WHERE a.issue_feedback_id=:id and nik=:nik
|
|
";
|
|
|
|
return $this->registry->db->prepare($sql);
|
|
}
|
|
|
|
public function setStatementCheckIssueRead()
|
|
{
|
|
$sql = "SELECT a.id
|
|
FROM gmb_question_feedback_respond_read a
|
|
WHERE a.question_feedback_id=:id and nik=:nik
|
|
";
|
|
|
|
return $this->registry->db->prepare($sql);
|
|
}
|
|
|
|
public function setStatementInsGenIssueRead()
|
|
{
|
|
$sql = "INSERT INTO gmb_issue_feedback_respond_read (issue_feedback_id,nik) values (:id,:nik)";
|
|
|
|
return $this->registry->db->prepare($sql);
|
|
}
|
|
|
|
public function setStatementInsIssueRead()
|
|
{
|
|
$sql = "INSERT INTO gmb_question_feedback_respond_read (question_feedback_id,nik) values (:id,:nik)";
|
|
|
|
return $this->registry->db->prepare($sql);
|
|
}
|
|
}
|