<?php include_once( "../../../../spider.inc.php" ); ?>
{charset:UTF-8}
{template:admin_default.tpl}
{module:system.login.Require}
{module:shopping.report.promotion.Statistic}
{preset:page_title 'ショップ管理 > プロモーション成果レポート'}

	<div class="panc">
		<a href="../../">管理パネルトップ</a>
		&gt; <a href="../">ショップ管理</a>
		&gt; プロモーション成果レポート
	</div>
	<h1>ショップ管理 &gt; プロモーション成果レポート</h1>

	{if:IS_ERROR}
	<ul class="error">
	{foreach:errors error}
		<li>{write:error}</li>
	{/foreach}
	</ul>
	{/if}

	<form name="sform" action="./statistic.php" method="get">
	<table style="margin:0 auto;width:95%;">
	<tbody>
	<tr>
		<td style="line-height:2em;vertical-align:top;">
			<span style="white-space:nowrap;">{write:SHOPPING_LABEL_ORDER}日：<select name="sy">
			<option value=""></option>
			<?php for($i=2009;$i<=date('Y');$i++) { $request_object->setAttribute('year',$i); ?>
				<option value="{write:year}"
					{if:shopping.report.promotion.statistic.start_year=year} selected{/if}
					>{write:year}</option>
			<?php } ?>
			</select>年
			<select name="sm">
			<option value=""></option>
			<?php for($i=1;$i<=12;$i++) { $request_object->setAttribute('month',$i); ?>
				<option value="{write:month}"
					{if:shopping.report.promotion.statistic.start_month=month} selected{/if}
					>{write:month}</option>
			<?php } ?>
			</select>月
			<select name="sd" tabindex="150">
			<option value=""></option>
			<?php for($i=1;$i<=31;$i++) { $request_object->setAttribute('day',$i); ?>
				<option value="{write:day}"
					{if:shopping.report.promotion.statistic.start_day=day} selected{/if}
					>{write:day}</option>
			<?php } ?>
			</select>日<br />
			&nbsp;&nbsp; ～<select name="ey">
			<option value=""></option>
			<?php for($i=2009;$i<=date('Y');$i++) { $request_object->setAttribute('year',$i); ?>
				<option value="{write:year}"
					{if:shopping.report.promotion.statistic.end_year=year} selected{/if}
					>{write:year}</option>
			<?php } ?>
			</select>年
			<select name="em">
			<option value=""></option>
			<?php for($i=1;$i<=12;$i++) { $request_object->setAttribute('month',$i); ?>
				<option value="{write:month}"
					{if:shopping.report.promotion.statistic.end_month=month} selected{/if}
					>{write:month}</option>
			<?php } ?>
			</select>月
			<select name="ed" tabindex="150">
			<option value=""></option>
			<?php for($i=1;$i<=31;$i++) { $request_object->setAttribute('day',$i); ?>
				<option value="{write:day}"
					{if:shopping.report.promotion.statistic.end_day=day} selected{/if}
					>{write:day}</option>
			<?php } ?>
			</select>日<input type="submit" value="検索実行" /></span>
		</td>
		<td style="text-align:right;line-height:2em;">
			<nobr>
			<?php for ( $key=0;$key<=1;$key++ ) { $request_object->setAttribute('key',$key); ?>
			並べ替え項目<?php echo $key+1; ?>：<select name="shpsi[]" onchange="document.sform.submit();">
				{if:key>0}<option value=""{if:strlen(shopping.report.promotion.statistic.sortItems[key])=0} selected{/if}></option>{/if}
				<option value="pname"{if:shopping.report.promotion.statistic.sortItems[key]=='pname'} selected{/if}>プロモーション名</option>
				<option value="pid"{if:shopping.report.promotion.statistic.sortItems[key]=='pid'} selected{/if}>プロモーションID</option>
				<option value="shpstf"{if:shopping.report.promotion.statistic.sortItems[key]=='shpstf'} selected{/if}>状態</option>
			</select>
			並び順 <select name="shpso[]" onchange="document.sform.submit();">
				<option value="asc"{if:shopping.report.promotion.statistic.sortOrders[key]='ASC' or strlen(shopping.report.promotion.statistic.sortItems[key])==0} selected{/if}>昇順</option>
				<option value="desc"{if:shopping.report.promotion.statistic.sortOrders[key]='DESC'} selected{/if}>降順</option>
			</select><br />
			<?php } ?>
			</nobr>
		</td>
	</tr>
	</tbody>
	</table>
	</form>
	
	<br />
	<table class="paging" style="margin:0 auto;width:95%;border-style:none;">
	<tbody>
	<tr>
		<td style="text-align:center;">
			{write:shopping.report.promotion.statistic.total_count}件
		</td>
	</tr>
	</tbody>
	</table>
	<table class="list" style="margin:0 auto;width:95%;">
	<tbody>
	<tr class="list">
		<th class="list">紹介コード</th>
		<th class="list">プロモーション名</th>
		<th class="list">状態</th>
		<th class="list">{write:SHOPPING_LABEL_ORDER}数</th>
		<th class="list">承認済</th>
		<th class="list">支払済</th>
		<th class="list">非承認</th>
	</tr>
	{foreach:shopping.report.promotion.statistic.resultHash promotionCode reportDataHash}
	<tr>
		<td>{write:promotionCode}</td>
		<td>{write:reportDataHash['promotion_name']}</td>
		<td style='text-align:center;'>
			{write:SHOPPING_PROMOTION_STATUS_HASH[reportDataHash['promotion_status_flag']]}
		</td>
		<td style='text-align:right;'>
			有効：{if:strlen(trim(reportDataHash['count_available']))==0}0{else}{write:number_format(reportDataHash['count_available'])}{/if}件
			<br />
			キャンセル：{if:strlen(trim(reportDataHash['count_cancel']))==0}0{else}{write:number_format(reportDataHash['count_cancel'])}{/if}件
		</td>
		<td style='text-align:right;'>
			{if:strlen(trim(reportDataHash['count_10']))==0}0{else}{write:number_format(reportDataHash['count_10'])}{/if}件<br />
			&yen;{if:strlen(trim(reportDataHash['money_10']))==0}0{else}{write:number_format(reportDataHash['money_10'])}{/if}-
		</td>
		<td style='text-align:right;'>
			{if:strlen(trim(reportDataHash['count_101']))==0}0{else}{write:number_format(reportDataHash['count_101'])}{/if}件<br />
			&yen;{if:strlen(trim(reportDataHash['money_101']))==0}0{else}{write:number_format(reportDataHash['money_101'])}{/if}-
		</td>
		<td style='text-align:right;'>
			{if:strlen(trim(reportDataHash['count_255']))==0}0{else}{write:number_format(reportDataHash['count_255'])}{/if}件<br />
			&yen;{if:strlen(trim(reportDataHash['money_255']))==0}0{else}{write:number_format(reportDataHash['money_255'])}{/if}-
		</td>
	</tr>
	{/foreach}
	</tbody>
	</table>
	<table class="paging" style="margin:0 auto;width:95%;border-style:none;">
	<tbody>
	<tr>
		<td style="text-align:center;">
			{write:shopping.report.promotion.statistic.total_count}件
		</td>
	</tr>
	</tbody>
	</table>
