<?php 

include("db_connection.php");
$Mainclass=new DB_Controller();
$scan_barcode = $Mainclass->real_escapes($_REQUEST['scan_barcode']);
$O_Code = $_COOKIE['O_Code'];

$today = date('Y-m-d');
$flag = 0;

$Check_Rate_Exist=$Mainclass->num_check('gold_rate_master',"SLN","DATE(Entry_Date)='".$today."'");

if($Check_Rate_Exist==0){
$flag = 1;
}

else{

$Check_Exist=$Mainclass->num_check('dealer_gold_stock_master',"SLN","Barcode='".$scan_barcode."' and Dealer_Code='".$O_Code."'");

if($Check_Exist==0)
{

$flag = 2;

}  

else{

$flag = 0;

}


}


echo $flag;

?>