{set:
	$start = IFilter::act(IReq::get('start'));
	$end   = IFilter::act(IReq::get('end'));
	$countData = statistics::spandAmount($start,$end);
}

{js:my97date}
{js:chart}

<div class="headbar">
	<div class="position"><span>统计</span><span>></span><span>基础数据统计</span><span>></span><span>销售额统计</span></div>
	<form action='{url:/}' method='get'>
		<input type='hidden' name='controller' value='market' />
		<input type='hidden' name='action' value='amount' />
		<div class="operating">
			<div class="search f_l">
				<input type="text" name='start' class="Wdate" id="date_start" value='{$start}' pattern='date' alt='' onFocus="WdatePicker()" /> —— <input type="text" name='end' pattern='date' value='{$end}' class="Wdate" id="date_end" onFocus="WdatePicker()" />
				<button class="btn"><span>查 询</span></button>
				<button class="btn" onclick="amountReport()"><span>导出报表</span></button>
			</div>
		</div>
    </form>
</div>

<div class="content_box">
	<h3>销售金额统计：</h3>
	<div class='cont'>
		<ul>
			<li>销售金额统计，更清楚了了解每月销售的情况，为你下一步的营销计划做出更好的判定！</li>
		</ul>
	</div>
</div>

<div class='content_box'>
	<div id="myChart" style="min-height:350px;"></div>
</div>

<script type='text/javascript'>
//图表生成
$(function()
{
	//图标模板
	var option = {
		title:
		{
			text:'销售额'
		},
		xAxis:
		{
			name:'时间',
			data:{echo:JSON::encode(array_keys($countData))},
		},
		yAxis:
		{
			name:'金额(元)',
		},
		series:
		[
			{
				name:'销售金额',
				type:'line',
				data:{echo:JSON::encode(array_values($countData))}
			}
		],
		tooltip:
		{
			show:true
		}
	};
	echarts.init(document.getElementById('myChart')).setOption(option);
});

function amountReport()
{
	var url   = '{url:/market/amount_report/start/@start@/end/@end@}';
	var start = $('#date_start').val();
	var end   = $('#date_end').val();
	url = url.replace("@start@",start).replace("@end@",end);
	window.open(url);
	return false;
}
</script>