<?php
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn, $zdb);
$admin = $_SESSION["admin_" . $dbname];

if (isset($_REQUEST['prodcode'])) {
    $prodcode = $_REQUEST['prodcode'];
    $process = $_REQUEST['process'];
    $karigar = $_REQUEST['karigar'];
    
    $getprod = mysqli_query($conn, "SELECT rate  from jobgiven where process = '$process' and karigar = '$karigar' and prodcode = '$prodcode' order by vouchno DESC LIMIT 1")or die(mysqli_error($conn));
    // $qty = mysqli_fetch_array($getprod)

    $rows = array();
    $r =  mysqli_fetch_assoc($getprod) or die(mysqli_error($conn));

    echo  $r['rate'];

    // $rows = array('success' => true, 
    // 'qty'  => $qty);
    
    // header("Content-type: application\json");
    // echo json_encode($rows);
}
?>