<?php

require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include ('includes/function.php');
//include ('includes/simgeImage.php');
$zdb = $_SESSION["zdbyear_" . $dbname];
$zyear = right($zdb, 4);

mysqli_select_db($conn, $zdb);

$tdate = date("Y-m-d");
if (isset($_REQUEST["voucher"])) {
    $voucher = $_REQUEST["voucher"];
    $maindb = $_REQUEST["maindb"];

    mysqli_query($conn, "UPDATE `$maindb` SET apprv = '1' WHERE vouchno='$voucher'") or die(mysqli_error($conn));
    mysqli_query($conn, "UPDATE `schedtreat` SET checkin = '1' WHERE vouchno='$voucher' and scheddate='$tdate'") or die(mysqli_error($conn));

    $ctr++;
    echo "1";
}
?>