<!-- include 'header' -->

<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/swfuplad2/swfupload.js"></script>
<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/swfuplad2/swfupload.queue.js"></script>
<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/swfuplad2/fileprogress.js"></script>
<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/swfuplad2/handlers.js"></script>
<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/invoice.js"></script>

<link rel=stylesheet href="<?= WEB_SITE_GLOBAL ?>js/DataTables/jquery.dataTables.css"> 
<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/DataTables/jquery.dataTables.min.js"></script>

<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/dataTables.fixedColumns.min.js"></script>


<style type="text/css"> 

 div.dataTables_wrapper {
        width: 100%;
    }
table.DTFC_Cloned thead,table.DTFC_Cloned tfoot{background-color:white}div.DTFC_Blocker{background-color:white}div.DTFC_LeftWrapper table.dataTable,div.DTFC_RightWrapper table.dataTable{margin-bottom:0;z-index:2}div.DTFC_LeftWrapper table.dataTable.no-footer,div.DTFC_RightWrapper table.dataTable.no-footer{border-bottom:none}
</style> 

<script type="text/javascript">

		var swfu;

		window.onload = function() {
			var settings = {
				flash_url : "<?= WEB_SITE_GLOBAL ?>js/swfuplad2/swfupload.swf",
				upload_url: "/invoiceTrainingUpload",	// Relative to the SWF file
				
				file_size_limit : "8 MB",
				file_types : "*.xlsx",
				file_types_description : "*.xlsx",
				file_upload_limit : 8,
				file_queue_limit : 1,
				custom_settings : {
					progressTarget : "fsUploadProgress",
					cancelButtonId : "btnCancel"
				},
				debug: false,

				// Button settings
				button_image_url: "<?= WEB_SITE_GLOBAL ?>images/btn-normal1.jpg",	// Relative to the Flash file
				
				button_width: "200",
				button_height: "40",
				button_placeholder_id: "spanButtonPlaceHolder",
				//button_text: '<span class="theFont">浏览</span>',
				//button_text_style: ".theFont { font-size: 16; }",
				//button_text_left_padding: 12,
				//button_text_top_padding: 3,

				// The event handler functions are defined in handlers.js
				file_queued_handler : fileQueued,
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,
				upload_start_handler : uploadStart,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : uploadSuccess,
				upload_complete_handler : uploadComplete,
				queue_complete_handler : queueComplete	// Queue plugin event
			};

			swfu = new SWFUpload(settings);
	     };
	</script>


<body>
	<div class="mainLayout">
		<div class="mainMenu">
			<div class="menuItem">
				<a href="#" class="mLogo">CLD</a>
				<ul>
					<!-- include 'menuReceipt' -->
				</ul>
			</div>
			
		</div>
		<div class="warpContent">
			<div class="subMenu fL">
				<div class="menuItem">
					<!-- include 'invoiceMenu' -->
				</div>
			</div>
			<div class="adminContent autoHeight">
				<legend>
				{{iTrainDetail.trainName}}</legend>
				<div class="demandCate">
				<!-- if empty({{receiptDetail}})||(!({{receiptDetail.status}}==8||{{receiptDetail.status}}==9)) -->
				<form action="/invoiceTrainingDetail/{{itid}}.html" id="its" method="get" class="nice-validator n-default" novalidate="novalidate">
					<ul class="cateList">
						<li>
						<select name="trainStatus" node-itSChange >
							<option <!-- if {{trainStatus}}=='ALL' --> selected <!-- endif --> value="ALL">所有 </option>
							<option <!-- if {{trainStatus}}=='SUBED' --> selected <!-- endif --> value="SUBED" >待提交 </option><!--该状态为还没提交审批的发票-->
							<option <!-- if {{trainStatus}}=='APPROVAL' --> selected <!-- endif --> value="APPROVAL">审批中  </option>
							<option <!-- if {{trainStatus}}=='TICKET' --> selected <!-- endif --> value="TICKET">出票中 </option>
							<option <!-- if {{trainStatus}}=='TICKETING' --> selected <!-- endif --> value="TICKETING">退票中 </option>
							
							
						</select>
						</li>
						
						<li>
							<a href="#confirmBatchMail" node-store=batchMail data-toggle="modal">批量设置邮寄物品</a>
							<a href="#batchApproval" node-store=batchApproval data-toggle="modal">批量提交审批</a>
							<a href="#batchdel" node-store=batchDel data-toggle="modal">批量移除</a>
						</li>
						<li>
							<a href="#import" data-toggle="modal"class="button">导入Excel</a>
						</li>
	  			</ul>
	  			</form>
	  			<!-- endif -->
	  		</div>
				<div class="saeaList">
					<table id="example" class="stripe row-border order-column" cellspacing="0" width="2400" >
						<thead>
							<tr >
							
							<th width="64">操作</th>
							<th>开票流水号</th>
							<th>开票单位（抬头）</th>
							<th>纳税人识别码</th>
							
							<th>归属人</th>
							
							<th>邮寄物品</th>
							<th>邮寄地址</th>
							
							<th>注册地址、电话</th>
							<th>开户银行及账号</th>
							<th>开票内容</th>
							<th>数量</th>
							<th>单价</th>
							<th>总额</th>
							<th>发票备注</th>
							
							
							
							<th>状态</th>
							<th>发票号</th>
							<th>出票时间</th>
							<th>收款流水号</th>
							</tr>
						</thead>
						<tbody>
							
						</tbody>
						
					</table>
				</div>
				<!--翻页-->
				
			</div>
		</div>
	</div>
	<!-- if empty({{receiptDetail}})||(!({{receiptDetail.status}}==8||{{receiptDetail.status}}==9)) -->
	<!--设置邮寄物品-->
	<div class="modal hide fade" id="confirm-erro">

		<form action="/invoiceStoreMailItemSet" method="post">
			<input type="hidden" id="trainKey" name="trainKey"
				value="{{iTrainDetail.trainingKey}}"> <input type="hidden"
				id="MailStoreKey" name="storeKey" 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">
							<tr>
								<th colspan="4" class="taC">邮寄信息</th>
							</tr>
							<tr>
								<th class="taC" width="150">邮寄物品</th>
								<td colspan="3">

									<div class="checkbox">
										<label> <input type="checkbox" name="softLock"
											value="1"> 软件锁 <br>
										<input type="number" name="softLockNum" class="span1"
											placeholder="数量"
											value="">
										</label>
									</div>
									<div class="checkbox">
										<label> <input type="checkbox" checked disabled
											value="1"> 发票 <br>1
										</label>
									</div>
									<div class="checkbox">
										<label> <input type="checkbox" name="contract"
											value="1"> 合同 <br>
										<input type="number" name="contractNum" class="span1"
											placeholder="数量"
											value="">
										</label>
									</div>
									<div class="checkbox">
										<label> <input type="checkbox" name="instructions"
											value="1"> 说明书 <br>
										<input type="number" name="instructionsNum" class="span1"
											placeholder="数量"
											value="">
										</label>
									</div>
									<div class="checkbox">
										<label> <input type="checkbox" name="remittance"
											value="1"> 汇款账号单
										</label>
									</div>
									<div class="checkbox">
										<label> <input type="checkbox" checked="" disabled="">
											备注<br>
										<input type="text" class="span4" name="mailItems"
											value=""
											placeholder="备注信息或其他需要邮寄物品请填写在这，写明数量。">
										</label>
									</div>

								</td>
							</tr>
						</table>
						<div id="mailMsg" class="hide">获取信息失败</div>
					</div>
					<div class="modal-footer">
						<input type="submit" class="button" value="确定"> <a
							href="#" class="button btn-gray" data-dismiss="modal"
							aria-hidden="true">取消</a>
					</div>
				</div>
			</div>
		</form>
	</div>
	
	
	
	
	<div class="modal hide fade" id="confirmBatchMail">
		
		<form action="/invoiceStoreBatchMailItemSet" method="post">
			<input type="hidden" id="trainKey" name="trainKey"
				value="{{iTrainDetail.trainingKey}}"> <input type="hidden"
				id="BatchMailStoreKey" name="storeKey" value="">

			<div class="modal-dialog">
			
				
			
				<div class="modal-content">
					<div class="modal-header">
						<h3>设置邮寄物品</h3>
					</div>
					
					
					
				<div class="modal-body saeaList" id="BatchMailTipA">
				<img src="<?= WEB_SITE_GLOBAL ?>images/tip.gif"/>
				</div>
					
					<div class="modal-body saeaList" id="BatchMailTipB">
						<table class="table table-bordered table-condensed">
							<tr>
								<th colspan="4" class="taC">邮寄信息</th>
							</tr>
							<tr>
								<th class="taC" width="150">邮寄物品</th>
								<td colspan="3">

									<div class="checkbox">
										<label> <input type="checkbox" name="softLock"
											value="1"> 软件锁 <br>
										<input type="number" name="softLockNum" class="span1"
											placeholder="数量"
											value="">
										</label>
									</div>
									<div class="checkbox">
										<label> <input type="checkbox" checked disabled
											value="1"> 发票 <br>1
										</label>
									</div>
									<div class="checkbox">
										<label> <input type="checkbox" name="contract"
											value="1"> 合同 <br>
										<input type="number" name="contractNum" class="span1"
											placeholder="数量"
											value="">
										</label>
									</div>
									<div class="checkbox">
										<label> <input type="checkbox" name="instructions"
											value="1"> 说明书 <br>
										<input type="number" name="instructionsNum" class="span1"
											placeholder="数量"
											value="">
										</label>
									</div>
									<div class="checkbox">
										<label> <input type="checkbox" name="remittance"
											value="1"> 汇款账号单
										</label>
									</div>
									<div class="checkbox">
										<label> <input type="checkbox" checked="" disabled="">
											备注<br>
										<input type="text" class="span4" name="mailItems"
											value=""
											placeholder="备注信息或其他需要邮寄物品请填写在这，写明数量。">
										</label>
									</div>

								</td>
							</tr>
						</table>
						<div id="mailMsg" class="hide">获取信息失败</div>
					</div>
					<div class="modal-footer">
						<input type="submit" class="button" value="确定"> <a
							href="#" class="button btn-gray" data-dismiss="modal"
							aria-hidden="true">取消</a>
					</div>
				</div>
				
				
			</div>
		</form>
	</div>
	
	
	
	<!--申请确认-->
    
    
		<!--申请确认-->
<div class="modal hide fade" id="confirm">
	
	<form action="/invoiceStoreApproval" method="post" >
	<input type="hidden" id="trainKey" name="trainKey" value="{{iTrainDetail.trainingKey}}">
		<input type="hidden" id="appStoreKey" name="storeKey" value="">
		<div class="modal-dialog">
			<div class="modal-content">
			<div class="modal-header">
			<h3>确认信息无误</h3>
			</div>
			<div class="modal-body">
				申请提交后开票信息将不能修改，请确认信息无误。
			</div>
		<div class="modal-footer">
		<input type="submit" class="button" value="无误，提交申请">
				
		<a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">我要检查一下</a>
		</div>
	</div>
	</div>
	
	</form>
	
	</div>
	
	
	
	<div class="modal hide fade" id="batchApproval">
	
	<form action="/invoiceStoreBatchApproval" method="post" >
	<input type="hidden" id="trainKey" name="trainKey" value="{{iTrainDetail.trainingKey}}">
		<input type="hidden" id="appBatchStoreKey" name="storeKey" value="">
		<div class="modal-dialog">
			<div class="modal-content">
			<div class="modal-header">
			<h3>确认信息无误</h3>
			</div>
			
			<div class="modal-body" id="batchApprovalA">
				<img src="<?= WEB_SITE_GLOBAL ?>images/tip.gif"/>
				</div>
			
			
			<div class="modal-body" id="batchApprovalB">
				申请提交后开票信息将不能修改，请确认信息无误。
			</div>
		<div class="modal-footer">
		<input type="submit" class="button" value="无误，提交申请">
				
		<a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">我要检查一下</a>
		</div>
	</div>
	</div>
	
	</form>
	
	</div>
	
	
	
			<!--申请确认-->
			
			<!--移除-->
		<div class="modal hide fade" id="del">
		
		<form action="/invoiceStoreDelete" method="post" >
		<input type="hidden" id="trainKey" name="trainKey" value="{{iTrainDetail.trainingKey}}">
		<input type="hidden" id="iStoreKey" name="iStoreKey" value="">
			<div class="modal-dialog">
				<div class="modal-content">
				<div class="modal-header">
				<h3>确认移除</h3>
				</div>
				
				
				
				
				<div class="modal-body" >
					请确认是否移除发票。
				</div>
			<div class="modal-footer">
				<input type="submit" class="button" value="确定移除">
					
					<a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">取消</a>
			</div>
		</div>
		</div>
		
		</form>
		
		</div>
		
		
		
		
		
		<div class="modal hide fade" id="batchdel">
		
		<form action="/invoiceStoreBatchDelete" method="post" >
		<input type="hidden" id="trainKey" name="trainKey" value="{{iTrainDetail.trainingKey}}">
		<input type="hidden" id="batchStoreKey" name="storeKey" value="">
			<div class="modal-dialog">
				<div class="modal-content">
				<div class="modal-header">
				<h3>确认移除</h3>
				</div>
				
				<div class="modal-body" id="batchdelA">
				<img src="<?= WEB_SITE_GLOBAL ?>images/tip.gif"/>
				</div>
				
				<div class="modal-body" id="batchdelB">
					请确认是否移除发票。
				</div>
			<div class="modal-footer">
				<input type="submit" class="button" value="确定移除">
					
					<a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">取消</a>
			</div>
		</div>
		</div>
		
		</form>
		
		</div>
		
		
		
		
		
		
				<!--移除-->
				
				<!--导入-->
			<div class="modal hide fade" id="import">
			<form action="/invoiceStoreImport" method="post" name="invoiceTraining">
			<input type="hidden" id="trainingKey" name="trainingKey" value="{{iTrainDetail.trainingKey}}">
			<input type="hidden" id="enclosurName" name="trainName" value="">
				<div class="modal-dialog">
					<div class="modal-content">
					<div class="modal-header">
					<h3>导入Excel</h3>
					</div>
					<div class="modal-body saeaList">
						<table class="table table-bordered table-condensed">
							<tr><th class="taC" width="150">Excel模板</th><td><a href="/upload/invoiceTraining/培训班模板.xlsx">下载</a></td></tr>
							<tr><th class="taC" width="150">选择Excel文件</th>
							<td>
							
						<div class="controls">
			            	<span id="spanButtonPlaceHolder"></span>	
							<input id="btnCancel" type="button" value="取消所有上传" style="display:none"  onclick="swfu.cancelQueue();" disabled="disabled" style="margin-left: 2px; font-size: 8pt; height: 29px;" />			
			            </div>
						<span class="fieldset flash" id="fsUploadProgress"></span>
						<span id="divStatus">0 个文件已上传</span>
							
							
							</td></tr>
						</table>
						<p class="alert alert-block">导入数据为新增开票，已导入开票不受影响。</p>
					</div>
				<div class="modal-footer">
					<input type="submit" class="button" value="确认上传">
					<a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">取消</a>
				</div>
			</div>
			</div>
			</form>
			</div>
			
			<!-- endif -->
					<!--导入-->
<script type="text/javascript">
$(document).ready( function () {
	
	var data = {{trainlistJson}}
	
	
	var table =$('#example').DataTable({
		data:data,
    	language: {
    		"sProcessing": "处理中...",
    		"sLengthMenu": "显示 _MENU_ 项结果",
    		"sSearch": "搜索:",
    		"sInfoEmpty": "显示第 0 至 0 项结果，共 0 项",
    		"sEmptyTable": "表中数据为空",
    		 "oPaginate": {
    	            "sFirst": "首页",
    	            "sPrevious": "上页",
    	            "sNext": "下页",
    	            "sLast": "末页"
    	        },
    		 "sInfo": "显示第 _START_ 至 _END_ 项结果，共 _TOTAL_ 项",
    	},
    	
    	
    	
    	
    	
    	scrollY:        "700px",
        scrollX:        true,
        scrollCollapse: true,
        paging:         true,
    	
//     	fixedColumns:   {
//             leftColumns: 3
//         }

    	
    });
	
	 $('#example tbody').on( 'click', 'tr', function () {
	
		var input=$(this).children("td:eq(0)").find("input");
		var inputDis=input.attr('disabled');
		
		if(inputDis!='disabled'){
			var id=input.val();
			
			if($("#"+id).prop("checked")){
			　　　　$("#"+id).prop("checked",false);
			　　}else{
			　　　　$("#"+id).prop("checked",true);
			　　}
			
			$(this).toggleClass('selected');
		}

	    } );
	
	 $("a[node-store=batchDel]").click(function() {
			
			var id_array=new Array();  
			$('input[name="isBox"]:checked').each(function(){  
			
			    id_array.push($(this).val());//向数组中添加元素  
			});  
			var idstr=id_array.join(',');//将数组元素连接起来以构建一个字符串  
			$("input[id=batchStoreKey]").val(idstr);
			
			if(idstr==''){
				$('#batchdelA').show();
				$('#batchdelB').hide();
			}else{
				$('#batchdelA').hide();
				$('#batchdelB').show();
			}
			
		});
	 
	 autoFlashHeight();
	 
	 $("a[node-store=batchMail]").click(function() {
			
			var id_array=new Array();  
			$('input[name="isBox"]:checked').each(function(){  
			    id_array.push($(this).val());
			});  
			var idstr=id_array.join(',');
			$("input[id=BatchMailStoreKey]").val(idstr);
			
			if(idstr==''){
				$('#BatchMailTipA').show();
				$('#BatchMailTipB').hide();
			}else{
				$('#BatchMailTipA').hide();
				$('#BatchMailTipB').show();
			}
			
			
		});
	 
		$("a[node-store=batchApproval]").click(function() {
			
			var id_array=new Array();  
			$('input[name="isBox"]:checked').each(function(){  
			    id_array.push($(this).val());
			});  
			var idstr=id_array.join(',');
			$("input[id=appBatchStoreKey]").val(idstr);
			
			if(idstr==''){
				$('#batchApprovalA').show();
				$('#batchApprovalB').hide();
			}else{
				$('#batchApprovalA').hide();
				$('#batchApprovalB').show();
			}
			
		});
	
		setSearchLo('tran');

} );

</script>

</body>
