<!-- 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() {
	$('input[receiptAmount]').keyup(function() {
		 var amount=$(this).val();
		 var ridKey=$(this).attr("data");
		 $.ajax({
				url:"/ajaxSetRceiptAmountByRid",
				type: "post",
				cache: false,
				dataType: "json",
				data: {
					amount:amount,
					ridKey:ridKey
				},
				global: true,
				success: function(data){
					if(data.stauts==2){
						
					}
				},
				error:function(err){}
				});
	});
	
})
</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;">
			<legend>{{receiptTrainingDetail.trainName}}
			
			
			<div class="fR">
			<form action="/exportReceiptTrainExcel" id="up" method="post">
<input type="hidden" name="rtidKey" value="{{receiptTrainingDetail.rtidKey}}">
<input type="hidden" name="ridKey" value="{{ridKey}}">
<input type="hidden" name="summaryJson" value='{{summaryJson}}'>
<input type="hidden" name="aiListJson" value='{{aiListJson}}'>


<ul class="cateList ">
<li>
<input type="submit" class="button" value="导出Excel">
</li></ul>
</form>
</div>
			</legend>
				<div class="borad-news">
					<div class="subNav">
			    		<!-- include 'receiptTrainMenu' -->
					</div>
			  		<div class="saeaList" <!-- if {{trainEdiType}}!='INFO' --> style="display:none" <!-- endif --> >
			  		
			  			<legend>培训班信息</legend>
			  			<table class="table table-bordered table-condensed">
							<tbody>
								<tr>
									<th colspan="4" class="taC">培训班信息</th>
								</tr>
								<tr>
									<th class="taC" width="150"><span class="colRed" title="必填">*</span>培训班名称</th>
									<td>{{receiptTrainingDetail.trainName}}</td>
									<th class="taC" width="150">所在办事处</th><td>{{staff.0.category}}</td>
								</tr>
								<tr>
									<th class="taC"><span class="colRed" title="必填">*</span>开班时间</th>
									<td>{{receiptTrainingDetail.trainStartDate}}</td>
									<th class="taC"><span class="colRed" title="必填">*</span>结束时间</th>
									<td>{{receiptTrainingDetail.trainEndDate}}</td>
								</tr>
								<tr>
									<th class="taC"><span class="colRed" title="必填">*</span>缴费参加人数</th>
									<td>{{receiptTrainingDetail.participants}}
									</td>
									<th class="taC"><span class="colRed" title="必填">*</span>免费参加人数</th>
									<td>{{receiptTrainingDetail.freeParticipants}}</td>
								
									
								</tr>
								<tr>
									<th class="taC"><span class="colRed" title="必填">*</span>培训班地址</th>
									<td colspan="3">{{receiptTrainingDetail.trainAddress}}</td>
								</tr>
								<tr>
									<th class="taC">备注</th>
									<td colspan="3">{{receiptTrainingDetail.trainRemarks}}</td>
								</tr>
								<tr>
									<th colspan="4" class="taC">审批信息</th>
								</tr>
								<tr>
									<th class="taC"><span class="colRed" title="必填">*</span>审批组
									</th>
									<td>
									
								<!-- loop veList -->
								<!-- if {{receiptDetail.verify}}=={{veList' value.vid}} --> 
								{{veList' value.description}}（{{veList' value.staff}}）
								<!-- endif -->
								<!-- endloop -->
								
									</td>
									<th class="taC"><span class="colRed" title="必填">*</span>所在办事处</th>
									<td>
									
								<!-- loop category -->
								<!-- if {{category' value.cid}} == {{receiptDetail.cid}}  -->
								 {{category' value.title}}
								 <!-- endif -->
								<!-- endloop -->
								
									</td>
								</tr>
								<tr>
									<th colspan="4" class="taC">汇款信息</th>
								</tr>
								
							<tr>
									<th class="taC"><span class="colRed" title="必填">*</span>汇款人户名
									</th><td>{{receiptDetail.remittanceName}}</td>
									<th class="taC"><span class="colRed" title="必填">*</span>汇款银行</th>
									<td>
									
							<!-- if 0 == {{receiptDetail.remittanceBankType}}  --> 广发银行 <!-- endif --> 
							<!-- if 1 == {{receiptDetail.remittanceBankType}}  --> 其他 <!-- endif -->
									</td>
								</tr>
								<tr>
									<th class="taC"><span class="colRed" title="必填">*</span>汇款开户银行名称
									</th><td>{{receiptDetail.bankName}}</td>
									<th class="taC"><span class="colRed" title="必填">*</span>汇款帐号</th>
									<td>{{receiptDetail.bankNumber}}</td>
								</tr>
								<tr  node-cn <!-- if 0 == {{receiptDetail.remittanceBankType}} --> style="display:none" <!-- endif --> >
									<th class="taC"><span class="colRed" title="必填">*</span>联行号
									<div class="tipContent"><span class="tipGray">?</span><div class="tipConactive"><p>1.如果不是公司广发，务必填上银行联行号</p><p>2.如不清楚银行联行号请咨询报销查款专用 QQ：2870766094</p></div></div></th>
									<td>{{receiptDetail.coupletNumber}}</td>
									<th class="taC"></th><td></td>
								</tr>
								
								
							</tbody>
						</table>
						
						
					</div>
					<!-- 汇总表 -->
					<div class="saeaList" <!-- if {{trainEdiType}}!='COLLECT' --> style="display:none" <!-- endif -->>
			  			<legend>汇总表</legend>
			  			
			  			<table class="table table-condensed table-hover table-bordered" >
								<tbody><tr>
									<th class="taC" rowspan="2">汇总项目</th><th class="taC" colspan="2">收入按开票金额计算</th><th class="taC" colspan="2">收入按入账金额计算</th>
								</tr><tr>
									<th class="taC">金额</th><th class="taC" rowspan="2">占比</th><th class="taC">金额</th><th class="taC" rowspan="2">占比</th>
								</tr>
								<tr>
									<th>收入</th>
									<td class="taR">{{invoiceTrainingDetail.invoiceTotalAmount}}</td>
									<td class="taR">{{invoiceTrainingDetail.invoiceArriveAmountM}}</td>
								</tr>
								<tr>
									<th>支出</th>
									<td class="taR">{{total}}</td>
									<td class="taR">{{invoicetotalProportion}}%</td>
									
									<td class="taR">{{total}}</td>
									<td class="taR">{{totalProportion}}%</td>
								</tr>
								<tr>
									<th>利润</th>
									<td class="taR"><b>{{invoiceProfit}}</b></td>
									<td class="taR">{{invoiceprofitProportion}}%</td>
									
									<td class="taR"><b>{{profit}}</b></td>
									<td class="taR">{{profitProportion}}%</td>
								</tr>
								<tr>
									<td colspan="5" class="taC colGray">收入-支出=利润</td>
								</tr>
								<tr>
									<th>公司利润</th>
									<td class="taR">{{invoiceCompanyProfit}}</td>
									<td class="taR">{{invoicecompanyProfitProportion}}%</td>
									<td class="taR">{{companyProfit}}</td>
									<td class="taR">{{companyProfitProportion}}%</td>
								</tr>
								<tr>
									<th>办事处利润</th>
									<td class="taR">{{invoiceCategoryProfit}}</td>
									<td class="taR">{{invoicecategoryProportion}}%</td>
									<td class="taR">{{categoryProfit}}</td>
									<td class="taR">{{categoryProportion}}%</td>
								</tr>
								<tr>
									<th>公司收款</th>
									<td class="taR">{{invoiceTrainingDetail.invoiceCompanyAmountM}}</td>
									<td class="taR">{{invoiceTotalAmountProportionB}}%</td>
									<td class="taR">{{invoiceTrainingDetail.invoiceCompanyAmountM}}</td>
									<td class="taR">{{invoiceTotalAmountProportion}}%</td>
								</tr>
								<tr>
									<td colspan="5" class="taC colGray">收入×40%=办事处利润&nbsp;&nbsp;&nbsp;收入×60%=公司利润</td>
								</tr>
								<tr>
									<th>备用金（借款）</th>
									<td class="taR">{{receiptLoanDetail.sum}}</td>
									<td class="taR">{{invoicesumProportion}}%</td>
									<td class="taR">{{receiptLoanDetail.sum}}</td>
									<td class="taR">{{sumProportion}}%</td>
								</tr>
								<tr>
									<th>办事处收款</th>
									<td class="taR">{{invoiceTrainingDetail.RIAmount}}</td>
									<td class="taR">{{invoiceRIAmountProportion}}%</td>
									<td class="taR">{{invoiceTrainingDetail.RIAmount}}</td>
									<td class="taR">{{RIAmountProportion}}%</td>
								</tr>
								<tr>
									<th>办事处实际支出</th>
									<td class="taR">{{categoryActualExpenditure}}</td>
									<td class="taR">{{ICAEP}}%</td>
									<td class="taR">{{categoryActualExpenditure}}</td>
									<td class="taR">{{categoryActualExpenditureProportion}}%</td>
								</tr>
								<tr>
									<th>付总部款</th>
									<td class="taR"><b>{{payment}}</b></td>
									<td class="taR">{{invoicepaymentProportion}}%</td>
									<td class="taR"><b>{{payment}}</b></td>
									<td class="taR">{{paymentProportion}}%</td>
								</tr>
								<tr>
									<td colspan="5" class="taC colGray">备用金+办事处收款-办事处实际支出=付总部款</td>
								</tr>
								<tr><td colspan="5">学员：{{receiptTrainingDetail.participantsTotal}}人(缴费{{receiptTrainingDetail.participants}}&nbsp;免费{{receiptTrainingDetail.freeParticipants}})&nbsp;&nbsp;&nbsp;讲师：{{lectureCount}} 人</td></tr>
						</tbody></table>
			  			
			  			
			  			<table class="table table-bordered table-condensed table-hover">
							<tbody>
								<tr>
									<th class="taC" colspan="4">项目</th><th class="taC">金额</th><th class="taC" >占入账金额比例</th>
								</tr>
								
								
								<!-- loop aiList -->
								<!-- if {{aiList' key}}==0 -->
								<tr>
									<th rowspan="{{aiCount}}" width="20">支出明细</th><th colspan="2">{{aiList' value.name}}</th>
									<td colspan="2" class="taR">{{aiList' value.priceFormat}}</td>
									<td class="taR">{{aiList' value.proportion}}%</td>
								</tr>
								<!-- elseif {{aiList' value.name}}=='讲课费' -->
								<tr>
									<th rowspan="3" colspan="2">讲课费</th><td class="taC colGray">外聘</td>
									<td class="taR">{{aiList' value.outsideTaxPrice}}</td>
									<td class="taR">{{aiList' value.outsideTaxProportion}}%</td>
								</tr>
								<tr>
									<td class="taC colGray">外聘(不计税)</td><td class="taR">{{aiList' value.outsideNoTaxPrice}}</td>
									<td class="taR">{{aiList' value.outsideNoTaxProportion}}%</td>
								</tr>
								<tr>
									<td class="taC colGray">员工</td><td class="taR">{{aiList' value.insidePrice}}</td>
									<td class="taR">{{aiList' value.insideProportion}}%</td>
								</tr>
								<!-- elseif {{aiList' value.name}}=='办公费' -->
								<tr>
									<th rowspan="2" colspan="2">{{aiList' value.name}}</th>
									<td class="taC colGray">办事处支出</td><td class="taR">{{aiList' value.categoryPrice}}</td>
									<td class="taR">{{aiList' value.categoryProportion}}%</td>
								</tr>
								<tr>
									<td class="taC colGray">公司支出</td><td class="taR">{{aiList' value.companyPrice}}</td>
									<td class="taR">{{aiList' value.companyProportion}}%</td>
								</tr>
								<!-- elseif {{aiList' value.name}}=='邮寄费' -->
								<tr>
									<th rowspan="2" colspan="2">{{aiList' value.name}}</th>
									<td class="taC colGray">办事处支出</td><td class="taR">{{aiList' value.categoryPrice}}</td>
									<td class="taR">{{aiList' value.categoryProportion}}%</td>
								</tr>
								<tr>
									<td class="taC colGray">公司支出</td><td  class="taR">{{aiList' value.companyPrice}}</td>
									<td class="taR">{{aiList' value.companyProportion}}%</td>
								</tr>
								<!-- else -->
								<tr>
									<th colspan="2">{{aiList' value.name}}</th><td colspan="2" class="taR">{{aiList' value.priceFormat}}</td>
									<td class="taR">{{aiList' value.proportion}}%</td>
								</tr>
								<!-- endif -->
								<!-- endloop -->
								<tr>
									<th colspan="2">小计</th><td colspan="2" class="taR">{{total}}</td>
									<td class="taR">{{totalProportion}}%</td>
								</tr>
								
							</tbody>
						</table>
						
						<!-- if empty({{wbDetail}}) -->
						<!-- if {{showType}}=='approval'&&inarray({{staff.0.sid}},{{verifyId}}) -->
						<table class="table table-bordered table-condensed table-hover " >
							<tbody>
								<tr><th colspan="2" class="taC">费用结算</th></tr>
								<th>结算结果<br><span class="colGray">("支出"由公司汇出，"收入"提交人需汇款至公司。)</span></th>
								<td class="taR" width="200">
								<!-- if {{payment}}>=0 -->
					<span class="colGreen">收入</span>
					<!-- else -->
					<span class="colRed">支出</span>
					<!-- endif -->
								</td>
								
								<tr><th>汇款金额</th>
								<td class="taR" width="200">
								￥{{payment}}
								<!-- 
								<input data="{{receiptDetail.ridKey}}" receiptAmount value='{{receiptDetail.amount}}' placeholder="输入汇款金额" pattern="[0-9]" step="1" min="0" class="span2" type="number">
								 -->
								</td>
								</tr>
							</tbody>
						</table>
						<!-- endif -->
						
						<!-- if {{showType}}=='implement'&&inarray({{staff.0.sid}},{{executeId}}) -->
						<form action="/receiptTrainImplementWateDo"  method="post" class="nice-validator n-yellow" novalidate="novalidate">
						<input type="hidden" name="ridKey" value="{{receiptDetail.ridKey}}">
						<input type="hidden" name="amount" value="{{paymentAuthCode}}">
						<table class="table table-bordered table-condensed table-hover">
							<tbody>
								<tr><th colspan="2" class="taC">确认汇款金额</th></tr>
								
								<tr><th>结算结果<br><span class="colGray">("支出"由公司汇出，"收入"提交人需汇款至公司。)</span></th>
				<td class="taR" width="200">
				
					<!-- if {{payment}}>=0 -->
					<span class="colGreen">收入</span>
					<!-- else -->
					<span class="colRed">支出</span>
					<!-- endif -->
				
				
				
				</td>
				</tr>
					<tr><th>汇款金额（用于生成汇款单）</th><td class="taR" width="220">￥
				{{paymentAbs}}
					</td></tr>			
								<!-- 
								<tr><th>汇款金额（用于生成汇款单）</th><td class="taR" width="220">￥
									<input name='amount' placeholder= "输入汇款金额" pattern="[0-9]" step="1" min="0" class="span2" type="number">
								</td></tr>
								<tr><th>流水类型("支出"由公司汇出，"收入"提交人汇款至公司。)</th>
								<td class="taR" width="200">
								<select name="expensesType" >
									<option value="INCOME">收入</option>
									<option value="EXPENDITURE">支出</option>
								</select>
								</td></tr>
								 -->
										
								<tr><th>银行</th>
								<td class="taR" width="200">
								<select name="bank" id="bank">
									<option value="CGBDeposit">纵横广发</option>
									<option value="ICBCDeposit">纵横工行</option>
									<option value="HUADeposit">华润银行</option>
									<option value="PersonalDeposit">个人广发</option>
									</select>
								</td></tr>
										
										
									<tr>
							<th >录入时间</th>
							<td><input class="datepicker-here span3" name="inputDate" value='{{inputDate}}' placeholder="按时间筛选" type="text" data-timepicker="true" data-language="zh" data-time-format="hh:ii:00"></td>
						</tr>
										
										<tr>
							<th >备注</th>
							<td><textarea name="remarks"></textarea></td>
						</tr>	
										
										
										
								</tbody>
								</table>
								<p class="taR"><input class="button" type="submit" value="确定生成流水"></p>
								
						</form>
						
						
						<!-- endif -->
						
						<!-- else -->
						<div class="alert alert-erro" style="margin:0">该费用已生成流水。</div>
						<br/>
						<table class="table table-bordered table-condensed table-hover">
									<tbody>
										<tr><th colspan="2" class="taC">银行水流详情</th></tr>
										<tr><th>结算结果<br><span class="colGray">("支出"由公司汇出，"收入"提交人需汇款至公司。)</span></th>
										<td class="taR" width="200">
										<!-- if {{wbDetail.expensesType}}==1 -->
										收入
										<!-- elseif {{wbDetail.expensesType}}==2 -->
										支出
										<!-- endif -->
										</td></tr>
										<tr><th>汇款金额</th><td class="taR" width="220">￥{{wbDetail.accountPriceShow}}
										</td></tr>
										<tr>
							<th >银行</th>
							<td class="taR">
							<!-- if {{wbDetail.accountBank}}=='CGBDeposit' -->
							纵横广发
							<!-- elseif {{wbDetail.accountBank}}=='ICBCDeposit' -->
							纵横工行
							<!-- elseif {{wbDetail.accountBank}}=='HUADeposit' -->
							华润银行
							<!-- elseif {{wbDetail.accountBank}}=='PersonalDeposit' -->
							个人广发
							<!-- endif -->

		</td>
						</tr>
										<tr><th>提交人</th><td class="taR" width="220">
										{{wbDetail.category}}-{{wbDetail.name}}</td></tr>
										<tr>
							<th >录入时间</th>
							<td  class="taR">
							{{wbDetail.inputDate}}</td>
						</tr>
										<tr><th>备注</th><td class="taR" width="220">{{wbDetail.remarks}}
										</td></tr>
										</tbody>
						</table>
						<!-- endif -->
						
					</div>
					
				</div>
		</div>
	</div>
	<!--弹出-->
<div class="modal hide fade" id="addCallout">
    <div class="modal-header">
    <h3>添加批注</h3>
    </div>
    <div class="modal-body">
    <form class="">
	    	<div class="control-group">
				<div class="controls clearfix">
					<label>
	                	批注内容
	              	</label>
	              	<textarea rows="8" class="span6"></textarea>
				</div>
	    	</div>
    </form>
    </div>
	<div class="modal-footer">
	    <a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">取消</a>
	   	<a href="#" class="button">确定</a>
	</div>
</div>


<!--弹出 导出 -->
    <div class="modal hide fade" id="export">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h3>导出Excel</h3>
                </div>
                <div class="modal-body saeaList">
					<a href="">下载 广西办事处2018年8月广西路桥工程集团有限公司路面分公司企业培训.xls</a>
                </div>
                <div class="modal-footer">
                    <a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a>
                </div>
            </div>
        </div>
    </div>
    <!--弹出内容-->
   
<script type="text/javascript">autoFlashHeight();</script>
</body>
