<?php

define('YUKEY', true);
$pre='pu_';
require(str_replace('sicms','',dirname(__FILE__)) . '/includes/init.php');
check_user("yukey","2133335");
update_user_info();
$rep='IR-PD2302004_2';
$tbTestedID='12';
	$s="SELECT tbTN,tbReportNo,tbTestedID FROM ". $GLOBALS['prefix']->table('tested')." WHERE tbReportNo='" . $rep . "' AND tbTestedID='" . $tbTestedID . "' LIMIT 1";
			$exist=$GLOBALS['db']->getRow($s);
			var_dump($exist);exit;
			//var_dump($db);exit;
			//var_dump($GLOBALS['db']);exit;
			/*
			var_dump($pre);
			echo "<br>";
			var_dump($prefix);
			echo "<br>";
			var_dump($s);exit;
			*/
			/*
			if($exist !=''){
			var_dump($exist);exit;
			}else{
			   echo "OK";
			}*/
/*
require(str_replace('sicms','',dirname(__FILE__)) . '/includes/lib_reports.php');
$tbPONumber='YT2108001';

//require(str_replace('sicms','',dirname(__FILE__)) . '/includes/show_pitem.php');
$active=!empty($_GET['active']) ? intval($_GET['active']) : 2;
$smarty->assign('active',$active);
$smarty->assign('pre',$pre);
$smarty->display('header.dwt');
$tbProductName='Yoto card(Multipack)';
$tbSampleSize=80;
$tbSpec=8;
if (strpos($tbProductName,'Multipack') !== false) {
    $tbUnit='sets';
	$tbPiece=$tbSampleSize * $tbSpec;
	} else {
    $tbUnit='pcs';
	$tbPiece='';
	}
echo $tbUnit.'<br>'.$tbSpec.'<br>'.$tbPiece;
/*
$rep=rep_details(68);
$remark=explode("\n",$rep['tbSupplement']);
$mark='';
foreach($remark as $k=>$v){

		   $mark.= $k+1 .": ".$v."<br>";
		}
		echo $mark;
/*
require(str_replace('sicms','',dirname(__FILE__)) . '/includes/get_tdata.php');
    if($rep!='')
	{
		require(str_replace('sicms','',dirname(__FILE__)) . '/includes/in_tdata.php');
		if($GLOBALS['db']->query($sql))
		{
		   require(str_replace('sicms','',dirname(__FILE__)) . '/includes/show_titem.php');
	       	var_dump($str);exit;
		   //echo json_encode($str);
		 } 
		else
		{
		echo json_encode("Database query error!");
		}
	}
	else
	{
	echo json_encode("Report Number is not Exist,Error!");
	}

//$point=$GLOBALS['db']->getRow($sql);
//$point=leftjoin('si',"a.*,b.*",'tbTestedID','tbSN','a.tbSN',10,'tested','test_items','');
//var_dump($point);exit;
//var_dump($total);exit;

$begin=date('Y')."-".date('m')."-01";
$end=date('Y')."-".date('m')."-31";
$pro_count=get_count('tbClientID','2','projects','tbInspectionDate','2017-05-01','2017-05-31');
$client_short=get_company('tbCompanyID',2,'','');
$po_number=$client_short['tbShortName'].date('y').date('m').sprintf("%03d",$pro_count+1);
$tcount=get_count('tbPONumber',$po_number,'reports','','','');
($tcount!=0) ? $tcount : $tcount=1;
$re_number="IR-".$po_number."_".$tcount;
echo $pro_count;
*/
?>