<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
ini_set ("display_errors", "0");
error_reporting(E_ALL);
require("../connect.php");

// Get detail upah bulanan
$stmtUpahBulanan = mysqli_prepare($conn, "SELECT id, 
CONCAT('Rp',FORMAT(field_1634, 0),',-') AS GAPOK, 
CONCAT('Rp',FORMAT(field_1631, 0),',-') AS TUNJANGANJABATAN, 
CONCAT('Rp',FORMAT(field_1632, 0),',-') AS TUNJANGANTETAP, 
CONCAT('Rp',FORMAT(field_1633, 0),',-') AS TUNJANGANTDKTETAP, 
CONCAT('Rp',FORMAT(field_1635, 0),',-') AS TUNJANGANDLL, 
CONCAT('Rp',FORMAT(IFNULL(field_1637, 0), 0),',-') AS LEMBUR, 
CONCAT('Rp',FORMAT(field_1627, 0),',-') AS BPJSCOMP, 
CONCAT('Rp',FORMAT(field_1622, 0),',-') AS NATURA, 
CONCAT('Rp',FORMAT(field_1638, 0),',-') AS PREMIKERJA, 
CONCAT('Rp',FORMAT(field_1643, 0),',-') AS PENALTI, 
CONCAT('Rp',FORMAT(IFNULL(field_1626, 0), 0),',-') AS RAPELTHR, 
CONCAT('Rp',FORMAT(field_1629, 0),',-') AS GAJIGROSS, 
CONCAT('Rp',FORMAT(field_1636, 0),',-') AS POTONGANJABATAN, 
CONCAT('Rp',FORMAT(field_1639, 0),',-') AS JHTKARYAWAN, 
CONCAT('Rp',FORMAT(field_1642, 0),',-') AS PENSIUNKARYAWAN, 
CONCAT('Rp',FORMAT(field_1641, 0),',-') AS PPH21, 
CONCAT('Rp',FORMAT(field_1640, 0),',-') AS BPJSKARYAWAN, 
CONCAT('Rp',FORMAT(IFNULL(field_1646, 0), 0),',-') AS IURANKOPERASI, 
CONCAT('Rp',FORMAT(IFNULL(field_1645, 0), 0),',-') AS IURANSPM, 
CONCAT('Rp',FORMAT(IFNULL(field_1647, 0), 0),',-') AS POTONGANPINJAMAN, 
CONCAT('Rp',FORMAT(IFNULL(field_1686, 0), 0),',-') AS POTONGANPRIBADI, 
CONCAT('Rp',FORMAT(IFNULL(field_1615, 0), 0),',-') AS GAJIBERSIH 
FROM app_entity_82 WHERE parent_item_id = ? AND field_1614 = ?;");
mysqli_stmt_bind_param($stmtUpahBulanan, 'is', $_POST['empid'], $_POST['periode']);
mysqli_stmt_execute($stmtUpahBulanan);
$resultBulananUpah = mysqli_stmt_get_result($stmtUpahBulanan);
$rowBulanan = mysqli_fetch_assoc($resultBulananUpah);

echo json_encode(array_map('utf8_encode', array(
    "ROWID" => $rowBulanan['id'], 
    "GAPOK" => $rowBulanan['GAPOK'], 
    "TUNJANGANJABATAN" => $rowBulanan['TUNJANGANJABATAN'], 
    "TUNJANGANTETAP" => $rowBulanan['TUNJANGANTETAP'],
    "TUNJANGANTDKTETAP" => $rowBulanan['TUNJANGANTDKTETAP'],
    "TUNJANGANDLL" => $rowBulanan['TUNJANGANDLL'],
    "LEMBURAN" => $rowBulanan['LEMBUR'],
    "BPJSCOMP" => $rowBulanan['BPJSCOMP'],
    "NATURA" => $rowBulanan['NATURA'],
    "PREMIKERJA" => $rowBulanan['PREMIKERJA'],
    "RAPELTHR" => $rowBulanan['RAPELTHR'],
    "GAJIGROSS" => $rowBulanan['GAJIGROSS'],
    "POTONGANJABATAN" => $rowBulanan['POTONGANJABATAN'],
    "PENALTI" => $rowBulanan['PENALTI'],
    "JHTKARYAWAN" => $rowBulanan['JHTKARYAWAN'],
    "PENSIUNKARYAWAN" => $rowBulanan['PENSIUNKARYAWAN'],
    "PPH21" => $rowBulanan['PPH21'],
    "BPJSKARYAWAN" => $rowBulanan['BPJSKARYAWAN'],
    "IURANKOPERASI" => $rowBulanan['IURANKOPERASI'], 
    "IURANSPM" => $rowBulanan['IURANSPM'],
    "POTONGANPINJAMAN" => $rowBulanan['POTONGANPINJAMAN'],
    "POTONGANPRIBADI" => $rowBulanan['POTONGANPRIBADI'],
    "GAJIBERSIH" => $rowBulanan['GAJIBERSIH']
)));

?>