<?php
require("../connect.php");

// Check status angkut
$stmtExistSPB = mysqli_query($conn, "SELECT COUNT(*) existangkut 
FROM app_entity_63 WHERE instr(field_1139, '".$_POST['kuponpanen']."')
AND FROM_UNIXTIME(field_933,'%Y-%m-%d') >= '".$_POST['harvestdate']."';");
$rowExistSPB = mysqli_fetch_assoc($stmtExistSPB);

// Check status WB
$stmtExistWB = mysqli_query($conn, "SELECT COUNT(*) existwb FROM app_entity_71
WHERE field_1205 = (SELECT field_949 FROM app_entity_63 WHERE 
instr(field_1139, '".$_POST['kuponpanen']."') 
AND FROM_UNIXTIME(field_933,'%Y-%m-%d') >= '".$_POST['harvestdate']."' LIMIT 1);");
$rowExistWB = mysqli_fetch_assoc($stmtExistWB);

if ($rowExistWB['existwb'] >= 1) {
    echo 'sudah timbang';
} else if ($rowExistWB['existwb'] == 0) {
    echo 'blm timbang';
}

?>