<?
	require_once("user__check.php");
?>
<div id="left">
	
	<span class="title">总体数据报告</span>

	<span class="explain">报告类型：</span>
	<span class="control">
		<select id="og" onchange="change_type(this.value)">
			<option value="1">查看年报表</option>
			<option value="2">查看月报表</option>
			<option value="3" selected>查看日报表</option>
		</select>
	</span>

	<span class="explain">点入记录：</span>
	<span class="control">
		<select id="o1">
			<option value=0>所有采集站点记录</option>
			<?
				$sql="select id , name from ".TBL_PICK." where status>0 and uid=".$uid;
				$result=mysql_query($sql);
				while($row=mysql_fetch_array($result)){
					echo "<option value='".$row[0]."'>".$row[1]."</option>";
				}			
			?>
		</select>
	</span>

	<span class="explain">点出记录：</span>
	<span class="control">
	<select id="o2">
		<option value=0>所有投放站点记录</option>
		<?
			$sql="select id , name from ".TBL_POST." where status>0 and uid=".$uid;
			$result=mysql_query($sql);
			while($row=mysql_fetch_array($result)){
				echo "<option value='".$row[0]."'>".$row[1]."</option>";
			}	
		?>
	</select>
	</span>

	<span class="explain">所在年份：</span>
	<span class="control">
		<select id="oy">
		<?
			for($i=2007;$i<=2010;$i++){
				echo "<option value='$i' ".($i==date("Y")?" style='background:#EEEEEE;' selected":"").">$i</option>";
			}
		?>
		</select>
	</span>

	<span class="explain">所在月份：</span>
	<span class="control">
		<select id="om">
		<?
			for($i=1;$i<=12;$i++){
				echo "<option value='$i' ".($i==date("m")?" style='background:#EEEEEE;' selected":"").">$i</option>";
			}
		?>
		</select>
	</span>

	<span class="explain">所在日期：</span>
	<span class="control">
		<select id="od">
		<?
			for($i=1;$i<=31;$i++){
				echo "<option value='$i' ".($i==date("d")?" style='background:#EEEEEE;' selected":"").">$i</option>";
			}
		?>
		</select>
	</span>

	<span class="explain">&nbsp;</span>
	<span class="control">
		<button id="go1" onclick="document.all.report.src='plugin/charts/?ds='+escape('data1.php?uid=<?=$uid;?>&g='+document.all.og.value+'&id1='+document.all.o1.value+'&id2='+document.all.o2.value+'&y='+document.all.oy.value+'&m='+document.all.om.value+'&d='+document.all.od.value);">更新报告</button>
	</span>

	<br>
	<br>
	<br>

	<span class="title">详细数据报告</span>

	<span class="explain">报告类型：</span>
	<span class="control">
		<select id="t1">
			<option value="1">点出记录</option>
			<option value="2">点入记录</option>
		</select>
	</span>

	<span class="explain">报告时间：</span>
	<span class="control">
		<select id="t2">
			<option value="0">今天</option>
			<option value="1">昨天</option>
			<option value="2">前天</option>
		</select>
	</span>

	<span class="explain">&nbsp;</span>
	<span class="control">
		<button id="go2" onclick="document.all.report.src='plugin/tables/?ds='+escape('data2.php?uid=<?=$uid;?>&t1='+document.all.t1.value+'&t2='+document.all.t2.value);">查看报告</button>
	</span>

</div>

<div id="right2">
	<iframe id='report' src='about:blank' width='540' height='400' frameborder='0' scrolling='0'></iframe>
</div>

<script language="javascript">
function change_type(v)
{
	switch(v)
	{
		case "1":	
			document.all.oy.disabled=false;
			document.all.om.disabled=true;
			document.all.od.disabled=true;
			break;
		case "2":
			document.all.oy.disabled=false;
			document.all.om.disabled=false;
			document.all.od.disabled=true;
			break;
		case "3":
			document.all.oy.disabled=false;
			document.all.om.disabled=false;
			document.all.od.disabled=false;
			break;
	}
}
document.all.go1.click();
</script>