<?php
include '../koneksi.php';

$serviceId = $_POST['serviceId'] ?? '';
$custId = $_POST['custId'] ?? '';

if(empty($serviceId) || empty($custId)){
    echo '';
    exit;
}
// print_r($_POST);
// exit;

$sql = mysqli_query($konek,"SELECT 
    urs.idjenis_service,
    urs.harga_serviceraxi,
    rp.tgl_raxips
FROM uraianraxips_service urs
JOIN detail_raxips dr 
    ON urs.iddetail_raxips = dr.iddetail_raxips
JOIN raxi_ps rp 
    ON dr.idraxips = rp.idraxips
WHERE rp.idcustomer = '$custId'
  AND urs.idjenis_service = '$serviceId'
ORDER BY rp.tgl_raxips DESC
LIMIT 1;
");

$row = mysqli_fetch_assoc($sql);
echo $row['harga_serviceraxi'] ?? '';

?>