{include file="$admin_template_path/html/header.html"}
<link href="{$admin_template_data}scripts/plug/datepicker/datepicker.css" rel="stylesheet" />
</head>
<body>
{include file="$admin_template_path/html/pagetops.html"}
{if $errorMessage}
<div id="errormsg">
<div class="msg">
  <div class="closebtn"><i data-icon="" class="icon-close"></i></div>
  {$errorMessage}
</div>
</div>
{literal}
<script type="text/javascript">
seajs.use(["modules/pageui/msg"], function(msg){
    msg.msginit("#errormsg");
});
</script>
{/literal}
{/if}

<div class="pagebg">
	<div class="mcontent pagemain clr">
	    {include file="$admin_template_path/html/leftmenu.html"}
	    <div class="pagemainconent">

		<div class="rightdetail_admin">
			<div class="sideblock">
                <div class="sideheader">报表</div>
                <div class="sidebody">
				<form action="" class="horizontal-form item-form disable-on-submit" action="" method="post" enctype="multipart/form-data">
					<div class="input-group clr">
					<label class="control-label" for="datepick">{$lang.from_date}</label>
					<div class="inputs">
					<input type="text" class="ipttheme" id="datepick" value="{$smarty.post.from_date}" name="from_date"/>
					</div>
					</div>
					<div class="input-group clr">
					<label class="control-label" for="datepick2">{$lang.to_date}</label>
					<div class="inputs">
					<input type="text" class="ipttheme" id="datepick2" value="{$smarty.post.to_date}" name="to_date"/>
					</div>
					</div>
					<div class="form-submit">
					<button type="submit" name="report" class="btntheme btnsize btn-primary">{$lang.generate_report}</button>
					</div>
				</form>
				</div>
				{if $reportData}
				<div class="input-group clr">
					<label class="control-label" for="datepick">{$lang.results}</label>
					<div class="inputs clr">
						<div id="placeholder" style="width:600px;height:300px;float:left;"></div>
						<p id="choices" style="float: left;">{$lang.graph}:</p>  
					</div>
				</div>
				{literal}
				<script id="source" language="javascript" type="text/javascript">
	seajs.use(["jq", "modules/pageui/admin"], function($, adm){
		$(function () {
			var datasets = {
				"Total": {
				label: "{/literal}{$lang.grid_total}{literal}",
				data: [{/literal}{foreach from=$reportData item=r key=k name=foo}[{$smarty.foreach.foo.index}, {$r.total}]{if !$smarty.foreach.foo.last},{/if}{/foreach}{literal}]
				},        
				"Receive": {
				label: "{/literal}{$lang.grid_receive}{literal}",
				data: [{/literal}{foreach from=$reportData item=r key=k name=foo}[{$smarty.foreach.foo.index}, {$r.receive}]{if !$smarty.foreach.foo.last},{/if}{/foreach}{literal}]
				},        
				"Referal": {
				label: "{/literal}{$lang.grid_referal}{literal}",
				data: [{/literal}{foreach from=$reportData item=r key=k name=foo}[{$smarty.foreach.foo.index}, {$r.referal}]{if !$smarty.foreach.foo.last},{/if}{/foreach}{literal}]
				},        
				"Win": {
				label: "{/literal}{$lang.grid_win}{literal}",
				data: [{/literal}{foreach from=$reportData item=r key=k name=foo}[{$smarty.foreach.foo.index}, {$r.win}]{if !$smarty.foreach.foo.last},{/if}{/foreach}{literal}]
				},
				"Deposit": {
				label: "{/literal}{$lang.grid_deposit}{literal}",
				data: [{/literal}{foreach from=$reportData item=r key=k name=foo}[{$smarty.foreach.foo.index}, {$r.deposit}]{if !$smarty.foreach.foo.last},{/if}{/foreach}{literal}]
				},        			         
				"Withdraw": {
				label: "{/literal}{$lang.grid_withdraw}{literal}",
				data: [{/literal}{foreach from=$reportData item=r key=k name=foo}[{$smarty.foreach.foo.index}, {$r.withdraw}]{if !$smarty.foreach.foo.last},{/if}{/foreach}{literal}]
				}        			         
			},
			options = {
				xaxis: { mode: "time", ticks: [{/literal}{foreach from=$reportData item=r key=k name=foo}[{$smarty.foreach.foo.index}, "{$k}"]{if !$smarty.foreach.foo.last},{/if}{/foreach}{literal}] },
				selection: { mode: "xy" },
				grid: { hoverable: true, clickable: true },
				series: { lines: { show: true }, points: { show: true } }
			};
			adm.plotInit("#placeholder", {
				datasets: datasets,
				options: options,
				contents: "{/literal}{$currency.symbol}{literal}"
			});
		});
	});
				</script>
				{/literal}
				{/if}
			</div>
		</div>

		</div>
	</div>
</div>
{literal}
<script type="text/javascript">
seajs.use(["jq", "modules/pageui/admin"], function($, adm){
	$(function(){
		adm.dateInput([$('#datepick'), $('#datepick2')]);
	});
});
</script>
{/literal}
</body>
</html>