<!-- include '../header' -->
<link rel=stylesheet href="<?= WEB_SITE_GLOBAL ?>css/jquery.validator.css"> 
<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/jquery.validator.min.js"></script>
<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/zh-CN.js"></script>
<script src="<?= receipt ?>"></script>

<script>
$(function() {
	$('select[priority]').change(function() {
		var name=$('select[priority] option:selected').val();
		var url='/receiptTrainItemEdi/{{receiptDetail.ridKey7}}.html?name='+encodeURI(name);
		
		window.location.href = url;
	});
	
	$('a[ediItem]').click(function(){
		var data=$(this).attr("data");
		data = JSON.parse(data);
		
		var riidKey=$(this).attr("riidKey");
		var ridKey=$(this).attr("ridKey");
		var describe=$(this).attr("describe");
		
		$("#itemEdi option[value='"+data[1]+"']").attr("selected","selected");
		
		$('#priceEdi').val(data[2]);
		$('#dateEdi').val(data[0]);
		$('#inputerEdi').val(data[3]);
		$('#describeEdi').val(describe);
		
		$('#riidKeyEdi').val(riidKey);
	});
	
})
</script>

<body>
	<div class="mainLayout">
		<div class="mainMenu">
			<div class="menuItem">
				<a href="#" class="mLogo">CLD</a>
				<ul>
					<!-- include '../admin/menuReceipt' -->
				</ul>
			</div>
		</div>
		<div class="warpContent">
			<div class="subMenu fL">
				<div class="menuItem">
					<!-- include '../admin/receipt_menu' -->
				</div>
			</div>
			<div class="adminContent autoHeight" style="height: 821px;">
				<!-- include 'receiptTrainApprovalForm' -->
				<div class="borad-news">
					<div class="subNav">
			    		<!-- include 'receiptTrainMenu' -->
					</div>
			  		<div class="saeaList">
			  			<!--支出项-->
			  			<div class="clearfix">
			  			<legend><div class="fR">
			  			<a class="button" href="#add-expenses" data-toggle="modal">添加支出</a></div>
			  			培训班支出</legend>
			  			<p>优先显示：
			  			<select priority >
			  			<!-- loop aiList -->
								<!-- if {{aiList' value.name}}!='讲课费' -->
								<option <!-- if {{aiList' value.name}}=={{name}} --> selected <!-- endif -->   value='{{aiList' value.name}}'>{{aiList' value.name}}</option>
								<!-- endif -->
							<!-- endloop -->
								</select>
							<span class="colRed" style="margin-left:30px">注：填写纸质报销单时请务必写上费用对应ID号</span>
						</p>
								
				  			<table class="table table-bordered table-condensed">
								<tbody>
									<tr><th width="30" class="taC"></th>
										<th width="30" class="taC">ID</th>
									<th width="70" class="taC">日期</th>
									<th width="80" class="taC">类别</th>
									<th width="60" class="taC" width="90">金额</th>
									<th width="90" class="taC">经手人</th>
									<th class="taC">支出描述</th>
									<th width="160" class="taC">操作人/操作时间</th>
									
									<th width="60" class="taC">操作</th>
									<!-- loop RItemList -->
									<tr>
										<td class="taC"><i class="colGray">{{{RItemList' value.i}}</i></td>
										<td>{{{RItemList' value.identifying}}</td>
										<td>{{RItemList' value.date}}</td>
										<td>{{RItemList' value.item}}</td>
										<td>{{RItemList' value.price}}</td>
										<td>{{RItemList' value.inputer}}</td>
										<td>{{RItemList' value.describe}}</td>
										<td>{{RItemList' value.creater}}/{{RItemList' value.creatDate}}</td>
										<td>
										<!-- if {{receiptDetail.status}}==2||{{receiptDetail.status}}==4||{{receiptDetail.status}}==5||{{receiptDetail.status}}==1 -->

											<!-- &&({{RItemList' value.creater}}=={{staff.0.username}}||{{RItemList' value.createrId}}=={{staff.0.sid}})  -->

										<!-- if {{RItemList' value.payType}}==0 -->

											<!-- if {{staff.0.sid}}=={{receiptDetail.staff}} -->
										<a href="#edi-expenses" ediItem data='["{{RItemList' value.date}}","{{RItemList' value.item}}","{{RItemList' value.price}}","{{RItemList' value.inputer}}"]' 
describe='{{RItemList' value.describe}}'  
riidKey="{{RItemList' value.riidKey}}" 
ridKey="{{receiptDetail.ridKey}}" data-toggle="modal" >编辑</a>	
										<a href="javascript:if(window.confirm('确认删除?'))window.location='/receiptTrainItemDelDo/{{RItemList' value.riidKey}}/{{receiptDetail.ridKey}}'" >移除</a>
<!-- else -->
											<!-- if {{RItemList' value.createrId}}=={{staff.0.sid}} -->
											<a href="#edi-expenses" ediItem data='["{{RItemList' value.date}}","{{RItemList' value.item}}","{{RItemList' value.price}}","{{RItemList' value.inputer}}"]'
											describe='{{RItemList' value.describe}}'
											riidKey="{{RItemList' value.riidKey}}"
											ridKey="{{receiptDetail.ridKey}}" data-toggle="modal" >编辑</a>
											<a href="javascript:if(window.confirm('确认删除?'))window.location='/receiptTrainItemDelDo/{{RItemList' value.riidKey}}/{{receiptDetail.ridKey}}'" >移除</a>
											<!-- endif -->

<!-- endif -->
											<!-- endif -->
										<!-- endif -->
										</td>
									</tr>
									<!-- endloop -->
									
								</tbody>
							</table>
						</div>
					</div>
				</div>
		</div>
	</div>
	
	
	<div class="modal hide fade" id="edi-expenses">
    <form action="/receiptTrainItemEdiDo" name="receiptTrainItemAdd" method="post" class="nice-validator n-yellow" novalidate="novalidate">
    <input type="hidden" name="ridKey" value="{{receiptDetail.ridKey}}">
    <input type="hidden" name="riidKey" id='riidKeyEdi' value="">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h3>编辑支出项</h3>
                </div>
                <div class="modal-body saeaList">
					<table class="table table-bordered table-condensed">
					<tbody>
						<tr>
							<th class="taC" colspan="2">支出信息填写</th>
						</tr>
						<tr>
							<th class="taC">项目</th><td>
							<select name="item" id='itemEdi'>
								<!-- loop aiList -->
								<!-- if {{aiList' value.name}}!='讲课费' -->
								<option value='{{aiList' value.name}}'>{{aiList' value.name}}</option>
								<!-- endif -->
							<!-- endloop -->
							</select>
						</tr>
						<tr>
							<th class="taC">支出金额</th>
							<td><input name='price' id='priceEdi' value="0" placeholder="输入支出金额" pattern="[0-9]" min="0" step="0.01" type="number"></td>
						</tr>
						<tr>
							<th class="taC">日期</th><td><input name='date' id='dateEdi' type="date"></td>
						</tr>
						<tr>
							<th class="taC">经手人</th>
							<td><input name='inputer' id='inputerEdi' class="form-control" type="text"></td>
						</tr>
						<tr>
							<th class="taC">支出描述</th>
							<td><textarea name='describe' id='describeEdi' class="form-control" rows="3"></textarea></td>
						</tr>
						<!--支出-->
						</tbody>
					</table>
                </div>
                <div class="modal-footer">
                	<input type="submit" value="确定" class="button">
                    <a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a>
                </div>
            </div>
        </div>
      </form>
    </div>
	
	
	
	<!--弹出 添加支出出 -->
    <div class="modal hide fade" id="add-expenses">
    <form action="/receiptTrainItemAddDo" name="receiptTrainItemAdd" method="post" class="nice-validator n-yellow" novalidate="novalidate">
    	<input type="hidden" name="ridKey" value="{{receiptDetail.ridKey}}">
		<input type="hidden" name="identifyingTotal" value="{{receiptTrainingDetail.identifyingTotal}}">
		<input type="hidden" name="rtidKey" value="{{receiptTrainingDetail.rtidKey}}">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h3>添加支出项</h3>
                </div>
                <div class="modal-body saeaList">
					<table class="table table-bordered table-condensed">
					<tbody>
						<tr>
							<th class="taC" colspan="2">支出信息填写</th>
						</tr>
						<tr>
							<th class="taC">项目</th><td>
							<select name="item" id='item'>
							<!-- loop aiList -->
								<!-- if {{aiList' value.name}}!='讲课费' -->
								<option value='{{aiList' value.name}}'>{{aiList' value.name}}</option>
								<!-- endif -->
							<!-- endloop -->
								
							</select>
							<p>公司支出的办公费和邮寄费，由审批人添加，无须再此添。</p>
						</tr>
						<tr>
							<th class="taC">支出金额</th>
							<td><input name='price' id='price' value="0" placeholder="输入支出金额" pattern="[0-9]" min="0" step="0.01" type="number"></td>
						</tr>
						<tr>
							<th class="taC">日期</th><td><input name='date' id='date' type="date"></td>
						</tr>
						<tr>
							<th class="taC">经手人</th>
							<td><input name='inputer' id='inputer' class="form-control" type="text"></td>
						</tr>
						<tr>
							<th class="taC">支出描述</th>
							<td><textarea name='describe' class="form-control" rows="3"></textarea></td>
						</tr>
						<!--支出-->
						</tbody>
					</table>
                </div>
                <div class="modal-footer">
                	<input type="submit" value="确定" class="button">
                    <a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a>
                </div>
            </div>
        </div>
      </form>
    </div>
    <!--弹出内容-->
<script type="text/javascript">autoFlashHeight();</script>
</body>
