<!--{include file="<!--{$oapath}-->public/ins_page.tpl"}-->
     <link rel='stylesheet' type='text/css' href="<!--{$oapath}-->Ins/js/layui/css/layui.css">
<block name="content">
	<div class="page-header">
	<h1> 新建转账</h1>
</div>
	<form method='post' id="form_data" name="form_data" enctype="multipart/form-data"   class="well form-horizontal">
		<input type="hidden" id="ajax" name="ajax" value="1">
		<input type="hidden" id="account_name_payment" name="account_name_payment">
		<input type="hidden" id="account_name_income" name="account_name_income">
		<input type="hidden" id="doc_type" name="doc_type" value="3">
		<input type="hidden" id="type" name="type" value="转账">
		<input type="hidden" id="opmode" name="opmode" value="add">
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="doc_no">单据编号：</label>
			<div class="col-sm-8">
				<p class="form-control-static">
					YYYY-####
				</p>
			</div>
		</div>
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="end_date" >日期：</label>
			<div class="col-sm-8">
				<input  class="form-control input-date" type="text" id="input_date" name="input_date"    check="require" msg="请输入日期" readonly="readonly">
			</div>
		</div>
                <div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="account_id_payment">转出帐号：</label>
			<div class="col-sm-8">
				<select id="account_id_payment" name="account_id_payment" class="form-control" check="require" msg="请选择收款帐号">
					<option value="" >请选择转出帐号</option>
										<!--{foreach $account_list as  $vo}-->
                                        <option value="<!--{$vo.id}-->" ><!--{$vo.name}--></option>
                                        <!--{/foreach}-->
				</select>
			</div>
		</div>
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" >账户余额：</label>
			<div class="col-sm-8">
				<input class="form-control" id="balance_payment" type="text" readonly="readonly" name="account_price_payment">
			</div>
		</div>
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="account_id_income">转入帐号：</label>
			<div class="col-sm-8">
				<select id="account_id_income" name="account_id_income" class="form-control" check="require" msg="请选择转入帐号">
					<option value="" >请选择转入帐号</option>
										<!--{foreach $account_list as  $vo}-->
                                        <option value="<!--{$vo.id}-->" ><!--{$vo.name}--></option>
                                        <!--{/foreach}-->
				</select>
			</div>
		</div>
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" >账户余额：</label>
			<div class="col-sm-8">
				<input class="form-control" id="balance_income" type="text" readonly="readonly" name="account_price_income">
			</div>
		</div>

		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="payment">金额：</label>
			<div class="col-sm-8">
				<input class="form-control" type="text" name="payment" check="require" msg="请输入金额">
			</div>
		</div>
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="actor_name">经办人：</label>
			<div class="col-sm-8">
				<input class="form-control" type="text" name="actor_name" check="require" msg="请输入经办人">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label" for="name">附件：</label>
			<div class="col-sm-10">
				<div class="uploader" id="uploader_add_file" add_file_id="add_file">
                                    <a class="btn btn-sm btn-primary" id="testList">添加附件</a>
                                    
                                    <ul class="file_list" new_upload="" id="file_list"></ul>
                            </div>
			</div>
		</div>
		<div class="form-group">
			<div class="form-actions col-sm-10 col-sm-offset-2">
				<input class="btn btn-sm btn-primary" type="button" value="保存" onclick="save();">
				<input class="btn btn-sm btn-default" type="button" value="取消" onclick="go_return_url();">
			</div>
		</div>
	</form>
</block>

                                		</div>
		<!-- Mainly scripts -->
		<script src="<!--{$oapath}-->Ins/js/jquery-2.1.1.js"></script>
		<script src="<!--{$oapath}-->Ins/js/bootstrap.min.js"></script>
		<script src="<!--{$oapath}-->Ins/js/plugins/metisMenu/jquery.metisMenu.js"></script>
		<script src="<!--{$oapath}-->Ins/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
		<!-- Custom and plugin javascript -->
		<script src="<!--{$oapath}-->Ins/js/inspinia.js"></script>
		<script src="<!--{$oapath}-->Ins/js/common.js"></script>
		<script src="<!--{$oapath}-->Ins/js/plugins/pace/pace.min.js"></script>
                
		<script src="<!--{$oapath}-->Ins/js/plugins/toastr/toastr.min.js"></script>
                <script src="<!--{$oapath}-->Ins/js/plugins/gritter/jquery.gritter.min.js"></script>
                <script src="<!--{$oapath}-->Ins/js/plugins/bootbox/bootbox.min.js"></script>
                
                    <script src="<!--{$oapath}-->Ins/js/plugins/date-time/moment-with-locales.js"></script>
	<script src="<!--{$oapath}-->Ins/js/plugins/date-time/bootstrap-datetimepicker.js"></script>
        
       <script type="text/javascript" src="<!--{$oapath}-->Ins/js/layui/layui.js"></script>

		<block name="js"></block>
		<script>
			$(document).ready(function() {
				$(".popup-container").width($("#dialog", parent.document).width());
				if (is_mobile()) {
					$(".popup-container").height(window.screen.height - 40);
					$(".popup-container").css('overflow', 'auto');
				}
			});
		</script>
        <block name="js">
             <script type="text/javascript">
	$(document).ready(function() {
		$('.input-date').datetimepicker({
			format : 'YYYY-MM-DD',
			locale : 'zh-cn',
			ignoreReadonly : true,
			widgetPositioning : {
				horizontal : 'auto',
				vertical : 'bottom'
			},
		});
		
		$(".input-daterange input").datetimepicker({
			format : "YYYY-MM-DD",
			locale : 'zh-cn',
			showTodayButton : true,
			showClose : true,
			ignoreReadonly : true,
			widgetPositioning : {
				horizontal : 'auto',
				vertical : 'bottom'
			},
		});

		$("#start_date").on("dp.change", function(e) {
			if ($("#end_date").length > 0) {
				$('#end_date').data("DateTimePicker").minDate(e.date);
			}
		});
		
		$("#end_date").on("dp.change", function(e) {
			if ($("#start_date").length > 0) {
				$('#start_date').data("DateTimePicker").maxDate(e.date);
			}
		});

		$(".input-date-time").datetimepicker({
			format : 'YYYY-MM-DD HH:mm',
			locale : 'zh-cn',
			sideBySide : true,
			showTodayButton : true,
			showClose : true,
			ignoreReadonly : true,
			widgetPositioning : {
				horizontal : 'auto',
				vertical : 'bottom'
			},
		});		 
	}); 
</script>
                <script type="text/javascript">
                        		function save() {
			sendForm("form_data", "oa.php?c=Finance&a=save_zhuan", "oa.php?c=Finance");
		}

		$(document).ready(function() {

                        $("#account_id_payment").change(function() {
			$account_name_payment=$('#account_id_payment option:selected').text();
			$("#account_name_payment").val($account_name_payment);
			$.getJSON("oa.php?c=Finance&a=read_account", {
			account_id:$(this).val()
                        }, function(data) {
                        if(data.status==1) {
                        $("#balance_payment").val(data.data.balance);
                        }
                        });
                        });
                        		$("#account_id_income").change(function() {
		$account_name_income=$('#account_id_income option:selected').text();
		$("#account_name_income").val($account_name_income);
		$.getJSON("oa.php?c=Finance&a=read_account", {
		account_id:$(this).val()
		}, function(data) {
		if(data.status==1) {
		$("#balance_income").val(data.data.balance);
		}
		});
		});
                        });
                        $(document).on("click", "#del_li", function() {
                                        $(this).parent().parent().parent().remove();		
                        });

                </script>
                       <script>
layui.use('upload', function(){
  var $ = layui.jquery
  ,upload = layui.upload;
  
  //普通图片上传
  var uploadInst = upload.render({
    elem: '#testList'
    ,url: 'oa.php?c=Popup&a=upload'
    ,accept: 'file'
    ,before: function(obj){
      //预读本地文件示例，不支持ie8
      obj.preview(function(index, file, result){
        $('#demo1').attr('src', result); //图片链接（base64）
      });
    }
    ,done: function(res){
      //如果上传失败
      if(res.code > 0){
        return layer.msg('上传失败');
      }else{
          var html="<li class='tbody'><input type='hidden' name='upload_file[]' value='"+res.name1+"'/><div class='loading' style='width: 100%;'></div><div class='data'><span class='del text-center'><a class='link del' id='del_li' style='display: inline;'>删除</a></span>";
          html+="<span class='size text-right'>"+res.size+"</span>";
          html+="<span class='auto autocut'>"+res.name2+"</span></div></li>";
          var demoText = $('#file_list');
          demoText.append(html);
      }
      //上传成功
    }
    ,error: function(){
      //演示失败状态，并实现重传
      var demoText = $('#demoText');
      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
      demoText.find('.demo-reload').on('click', function(){
        uploadInst.upload();
      });
    }
  });
  

  
  //绑定原始文件域
  upload.render({
    elem: '#test20'
    ,url: '/upload/'
    ,done: function(res){
      console.log(res)
    }
  });
  
});
</script>
        </block>
	</body>
</html>