<?php include_once( "../../../spider.inc.php" ); ?>
{charset:UTF-8}
{template:admin_default.tpl}
{module:shopping.category.LoadList}
{module:shopping.promotion.Form}
{preset:page_title 'ショップ管理 > プロモーション管理 > 追加・編集'}

	<div class="panc">
		<a href="../../">管理パネルトップ</a>
		&gt; <a href="../">ショップ管理</a>
		&gt; <a href="./">プロモーション管理</a>
		{if:strlen(shopping.promotion.promotion_object->'promotion_number')==0}
		&gt; プロモーションの新規追加
		{else}
		&gt; <a href="./detail.php?shppn={write:shopping.promotion.promotion_object->'promotion_number'}">{write:shopping.promotion.promotion_object->'promotion_name'}</a>
		&gt; 編集
		{/if}
	</div>

	<h1>
		プロモーション管理
		{if:strlen(shopping.promotion.promotion_object->'promotion_number')==0}
		&gt; プロモーションの新規追加
		{else}
		&gt; {write:shopping.promotion.promotion_object->'promotion_name'}
		&gt; 編集
		{/if}
	</h1>

{if:IS_ERROR}
	<ul class="error">
	{foreach:errors error}
		<li>{write:error}</li>
	{/foreach}
	</ul>
{else}
	
	<form name="cform" action="./confirm.php?shppn={write:shopping.promotion.promotion_object->'promotion_number'}" method="post" enctype="multipart/form-data">
	<input type="hidden" id="promotion_number" name="promotion_number" value="{write:shopping.promotion.promotion_object->'promotion_number'}" />
	<h2>基本情報</h2>
	<table style="width:95%;margin:0 auto;" class="detail">
	<tbody>
	<tr>
		<th style="width:12em;">プロモーションID</th>
		<td>
			{if:strlen(shopping.promotion.promotion_object->'promotion_number')==0}
			<input type="text" name="promotion_id" size="15" value="{write:shopping.promotion.promotion_object->'promotion_id'}" style="ime-mode:inactive;" />
			<br />
			<span class="form_attention">※未入力なら自動発行します。入力する場合は4-16桁の半角英数字で入力してください。</span>
			{else}
			{write:shopping.promotion.promotion_object->'promotion_id'}
			<input type="hidden" name="promotion_id" value="{write:shopping.promotion.promotion_object->'promotion_id'}" />
			{/if}
		</td>
	</tr>
	<tr>
		<th style="width:12em;">紹介コード<span class="required">※</span></th>
		<td>
			{if:strlen(shopping.promotion.promotion_object->'member_id')>0}
				<input type="hidden" name="promotion_code" value="{write:shopping.promotion.promotion_object->'promotion_code'}" />
				{write:shopping.promotion.promotion_object->'promotion_code'}
			{else}
				<input type="text" name="promotion_code" size="30" value="{write:shopping.promotion.promotion_object->'promotion_code'}" style="ime-mode:inactive;"
				/><input type="button" value="ランダム生成" onclick="shoppingPromotionFormSetRandomString(cform.promotion_code,12)" />
				<br />
				<span class="form_attention">※4-16桁の半角英数字で入力してください。</span>
			{/if}
		</td>
	</tr>
	<tr>
		<th style="width:12em;">プロモーション種別<span class="required">※</span></th>
		<td>
			<select name="promotion_rank"{if:strlen(shopping.promotion.promotion_object->'member_id')>0} disabled="disabled"{/if}>
			{foreach:SHOPPING_PROMOTION_RANK_HASH rankKey rankName}
				<option value="{write:rankKey}"
					{if:shopping.promotion.promotion_object->'promotion_rank'==rankKey} selected{/if}
					>{write:rankName}</option>
			{/foreach}
			</select>
		</td>
	</tr>
	<tr>
		<th style="width:12em;">プロモーション名<span class="required">※</span></th>
		<td>
			<input type="text" name="promotion_name" size="80" value="{write:shopping.promotion.promotion_object->'promotion_name'}" style="ime-mode:active;" />
			<br />
			<span class="form_attention">※全角80文字以内で入力してください。</span>
		</td>
	</tr>
	<tr>
		<th style="width:12em;">プロモーション名<br />フリガナ</th>
		<td>
			<input type="text" name="promotion_kana" size="80" value="{write:shopping.promotion.promotion_object->'promotion_kana'}" style="ime-mode:active;" />
			<br />
			<span class="form_attention">※入力する場合は全角80文字以内で入力してください。</span>
		</td>
	</tr>
	<tr>
		<th style="width:12em;">管理メモ</th>
		<td><textarea name="description" cols="50" rows="3">{write:shopping.promotion.promotion_object->'description'}</textarea></td>
	</tr>
	</tbody>
	</table>
	<br />
	
	<h2>プロモーション優待設定</h2>
	<p>
		このプロモーション経由で{write:SHOPPING_LABEL_ORDER}が確定した時の{write:SHOPPING_LABEL_ORDER}者と紹介者への報酬を設定できます。
	</p>
	<table style="width:95%;margin:0 auto;" class="detail">
	<tbody>
	<tr>
		<th style="width:12em;">紹介割引<span class="required">※</span></th>
		<td>
			<span style="white-space:nowrap;"><input type="radio" name="discount_type" value="" id="discount_type_none" style="cursor:pointer;"
				{if:shopping.promotion.promotion_object->'discount_type'==''} checked{/if}
				/><label for="discount_type_none" style="cursor:pointer;"> 割引なし</label></span>
			<span style="white-space:nowrap;"><input type="radio" name="discount_type" value="money" id="discount_type_money" style="cursor:pointer;"
				{if:shopping.promotion.promotion_object->'discount_type'=='money'} checked{/if}
				/><label for="discount_type_money" style="cursor:pointer;"> 定額</label></span>
			<span style="white-space:nowrap;"><input type="radio" name="discount_type" value="rate" id="discount_type_rate" style="cursor:pointer;"
				{if:shopping.promotion.promotion_object->'discount_type'=='rate'} checked{/if}
				/><label for="discount_type_rate" style="cursor:pointer;"> 定率</label></span><br />
			数値=<input type="text" name="discount_value" size="5" value="{write:shopping.promotion.promotion_object->'discount_value'}" style="ime-mode:inactive;" />
			<br />
			<span class="form_attention">※数値=定額の場合は7桁までの金額、定率の場合は0-99の百分率で入力してください。</span>
		</td>
	</tr>
	</tbody>
	</table>
	<br />
	
	<h2>アフィリエイト成果報告設定</h2>
	<p>
		※アフィリエイトプロバイダへ出稿で{write:SHOPPING_LABEL_ORDER}完了ページに成果報告タグが必要な場合のみ入力してください。
	</p>
	<table style="width:95%;margin:0 auto;" class="detail">
	<tbody>
	<tr>
		<th style="width:12em;">成果報告金額</th>
		<td>
			<span style="white-space:nowrap;"><input type="radio" id="exec_tax_0" name="exec_tax" value="0"
				{if:shopping.promotion.promotion_object->'exec_tax'=='0'} checked{/if}
			/><label for="buying_flag_0" style="cursor:pointer;"> 税込</label></span>
			<span style="white-space:nowrap;"><input type="radio" id="exec_tax_1" name="exec_tax" value="1"
				{if:shopping.promotion.promotion_object->'exec_tax'=='1'} checked{/if}
			/><label for="buying_flag_1" style="cursor:pointer;"> 税抜き(少数切り捨て)</label></span>
			<span style="white-space:nowrap;"><input type="radio" id="exec_tax_2" name="exec_tax" value="2"
				{if:shopping.promotion.promotion_object->'exec_tax'=='2'} checked{/if}
			/><label for="buying_flag_2" style="cursor:pointer;"> 税抜き(少数切り上げ)</label></span>
			<span style="white-space:nowrap;"><input type="radio" id="exec_tax_3" name="exec_tax" value="3"
				{if:shopping.promotion.promotion_object->'exec_tax'=='2'} checked{/if}
			/><label for="buying_flag_3" style="cursor:pointer;"> 税抜き(少数四捨五入)</label></span>
		</td>
	</tr>
	<tr>
		<th style="width:12em;">成果報告HTMLタグ</th>
		<td>
			<textarea name="exec_tag" cols="50" rows="3">{write:shopping.promotion.promotion_object->'exec_tag'}</textarea><br />
			<span class="form_attention">※このプロモーション経由の{write:SHOPPING_LABEL_ORDER}時に{write:SHOPPING_LABEL_ORDER}完了ページで表示するHTMLが指定されている場合に入力してください。</span>
		</td>
	</tr>
	<tr>
		<th style="width:12em;">成果報告URL</th>
		<td>
			<input type="text" size="80" name="exec_url" value="{write:shopping.promotion.promotion_object->'exec_url'}" /><br />
			<span class="form_attention">※このプロモーション経由の{write:SHOPPING_LABEL_ORDER}完了時に指定のURLに情報を送信する必要がある場合にURLを入力してください。</span>
		</td>
	</tr>
	<tr>
		<th style="width:12em;">成果報告<br />{write:SHOPPING_LABEL_ORDER}{write:SHOPPING_LABEL_PRODUCT}フォーマット</th>
		<td>
			<textarea name="tag_item_format" cols="50" rows="3">{write:shopping.promotion.promotion_object->'tag_item_format'}</textarea><br />
			<span class="form_attention">※成果報告のタグやURL中で{write:SHOPPING_LABEL_ORDER}{write:SHOPPING_LABEL_PRODUCT}のIDや金額を全て記入する場合の書式を入力してください。</span>
		</td>
	</tr>
	<tr>
		<th style="width:12em;">成果報告<br />{write:SHOPPING_LABEL_ORDER}{write:SHOPPING_LABEL_PRODUCT}結合文字</th>
		<td>
			<input type="text" size="10" name="tag_item_implode" value="{write:shopping.promotion.promotion_object->'tag_item_implode'}" /><br />
			<span class="form_attention">※成果報告のタグやURL中で{write:SHOPPING_LABEL_ORDER}{write:SHOPPING_LABEL_PRODUCT}のIDや金額を全て記入する場合の{write:SHOPPING_LABEL_PRODUCT}情報結合文字を入力してください。</span>
		</td>
	</tr>
	</tbody>
	</table>
	<br />

	{if:strlen(shopping.promotion.promotion_object->'member_id')==0}
	<h2>プロモーション成果報酬設定</h2>
	<p>アフィリエイト出稿の成果報酬を設定すると{write:SHOPPING_LABEL_ORDER}一覧画面でのコストに記録され粗利の計算をより正しく表示できます。</p>
	<table style="width:95%;margin:0 auto;" class="detail">
	<tbody>
	<tr>
		<th style="width:12em;">成果報酬<span class="required">※</span></th>
		<td>
			<span style="white-space:nowrap;"><input type="radio" name="pay_type" value="" id="pay_type_none" style="cursor:pointer;"
				{if:shopping.promotion.promotion_object->'pay_type'==''} checked{/if}
				/><label for="pay_type_none" style="cursor:pointer;"> 報酬なし</label></span>
			<span style="white-space:nowrap;"><input type="radio" name="pay_type" value="money" id="pay_type_money" style="cursor:pointer;"
				{if:shopping.promotion.promotion_object->'pay_type'=='money'} checked{/if}
				/><label for="pay_type_money" style="cursor:pointer;"> 定額</label></span>
			<span style="white-space:nowrap;"><input type="radio" name="pay_type" value="rate" id="pay_type_rate" style="cursor:pointer;"
				{if:shopping.promotion.promotion_object->'pay_type'=='rate'} checked{/if}
				/><label for="pay_type_rate" style="cursor:pointer;"> 定率</label></span><br />
			数値=<input type="text" name="pay_value" size="5" value="{write:shopping.promotion.promotion_object->'pay_value'}" style="ime-mode:inactive;" />
			<br />
			<span class="form_attention">※数値=定額の場合は7桁までの金額、定率の場合は0-99の百分率で入力してください。</span>
		</td>
	</tr>
	</tbody>
	</table>
	<br />
	{else}
	{set:memberObject shopping.promotion.promotion_object->'memberObject'}
	<h2>会員アフィリエイト設定</h2>
	<p>会員向けアフィリエイトの報酬・セルフ{write:SHOPPING_LABEL_ORDER}の設定をおこなってください。</p>
	<table style="width:95%;margin:0 auto;" class="detail">
	<tbody>
	<tr>
		<th style="width:12em;">関連会員情報</th>
		<td>
			会員ID: {write:shopping.promotion.promotion_object->'member_id'}<br />
			表示名: {write:memberObject->'view_name'}<br />
			<div style="font-size:x-small;text-align:right;">
				※会員情報や銀行口座の設定は<a href="/<?php echo SYSTEM_DIR_NAME_ADMIN_PANEL; ?>/member/member/form.php?mn={write:memberObject->'member_number'}">個人情報編集画面</a>でおこなってください。
			</div>
		</td>
	</tr>
	<tr>
		<th style="width:12em;">紹介報酬<span class="required">※</span></th>
		<td>
			<span style="white-space:nowrap;"><input type="radio" name="pay_type" value="" id="pay_type_none" style="cursor:pointer;"
				{if:shopping.promotion.promotion_object->'pay_type'==''} checked{/if}
				/><label for="pay_type_none" style="cursor:pointer;"> 報酬なし</label></span>
			<span style="white-space:nowrap;"><input type="radio" name="pay_type" value="money" id="pay_type_money" style="cursor:pointer;"
				{if:shopping.promotion.promotion_object->'pay_type'=='money'} checked{/if}
				/><label for="pay_type_money" style="cursor:pointer;"> 定額</label></span>
			<span style="white-space:nowrap;"><input type="radio" name="pay_type" value="rate" id="pay_type_rate" style="cursor:pointer;"
				{if:shopping.promotion.promotion_object->'pay_type'=='rate'} checked{/if}
				/><label for="pay_type_rate" style="cursor:pointer;"> 定率</label></span><br />
			数値=<input type="text" name="pay_value" size="5" value="{write:shopping.promotion.promotion_object->'pay_value'}" style="ime-mode:inactive;" />
			<br />
			<span class="form_attention">※数値=定額の場合は7桁までの金額、定率の場合は0-99の百分率で入力してください。</span>
		</td>
	</tr>
	<tr>
		<th style="width:12em;">セルフ{write:SHOPPING_LABEL_ORDER}(卸販売)割引</th>
		<td>
			<span style="white-space:nowrap;"><input type="radio" name="buying_flag" value="0" id="buying_flag_0" style="cursor:pointer;"
				{if:shopping.promotion.promotion_object->'buying_flag'=='0'} checked{/if}
				/><label for="buying_flag_0" style="cursor:pointer;"> なし</label></span>
			<span style="white-space:nowrap;"><input type="radio" name="buying_flag" value="1" id="buying_flag_1" style="cursor:pointer;"
				{if:shopping.promotion.promotion_object->'buying_flag'=='1'} checked{/if}
				/><label for="buying_flag_1" style="cursor:pointer;"> 先払いのみ許可</label></span>
			<span style="white-space:nowrap;"><input type="radio" name="buying_flag" value="2" id="buying_flag_2" style="cursor:pointer;"
				{if:shopping.promotion.promotion_object->'buying_flag'=='2'} checked{/if}
				/><label for="buying_flag_2" style="cursor:pointer;"> 許可</label></span><br />
			卸割引率=<input type="text" name="buying_rate" size="5" value="{write:shopping.promotion.promotion_object->'buying_rate'}" style="ime-mode:inactive;" />%<br />
			<span class="form_attention">※割引率を0-99の百分率で入力してください。(例) 3割引する場合=30</span>
		</td>
	</tr>
	</tbody>
	</table>
	<br />
	{/if}
	
	<p style="text-align:center;">
		<input type="submit" value="{if:strlen(shopping.promotion.promotion_object->'promotion_number')==0}作成{else}編集{/if}する"
		/><br />
	</p>
	<p style="text-align:center;">
	</p>
	</form>
	<br />
<script language="JavaScript" type="text/javascript"><!--
function shoppingPromotionFormSetRandomString(textObject,strlen) {
	var randObject	= new FormerCommon.RandomString();
	randObject.set(textObject,strlen);
}
//--></script>
{/if}
	<hr style="width:95%;margin:0 auto;margin-top:1em;text-align:center;" />
	<div style="width:95%;margin:0 auto;text-align:right;">
		{if:strlen(shopping.promotion.promotion_object->'promotion_number')==0}
		{else}
		&gt; <a href="./detail.php?shppn={write:shopping.promotion.promotion_object->'promotion_number'}">{write:shopping.promotion.promotion_object->'promotion_name'}の詳細へ戻る</a>
		&nbsp;&nbsp;
		{/if}
		<a href="./">&gt;&gt; プロモーション一覧へ戻る</a>
	</div>