@extends('layouts.admin')
@section('content')


    {{--修改表格--}}
@include('admin.table.style')

    <!--左侧菜单栏-->
@include('admin.left-sidebar')
    <!-- 内容 -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                受理案件
                <small> </small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="{{ url('/')}}"><i class="fa fa-dashboard"></i> 主页</a></li>
                <li><a href="#">项目申请</a></li>
                <li><a href="{{ url('/table') }}">受理案件</a></li>
            </ol>
        </section>
        <!-- Main content -->
        <section class="content">
            <!-- Default box -->
            <div class="box">
                <div class="box-header">

                </div>
                <!-- /.box-header -->
                <div class="box-body" id="print">
                    {{--content--}}
                    <div class="row" style="text-align: center">
                        <h3>国有土地上房屋征收与补偿核算单（产权调换）</h3><br>
                    </div>
                    <form action="" method="post">
                        {{ csrf_field() }}
                    <div id="example2_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
                        <div class="row">
                            <div class="col-sm-2">项目名称：</div>
                            <div class="col-sm-7">
                                <select name="project_name" class="form-control">
                                    <option value=" "></option>
                                    @foreach($project as $data)
                                        <option value="{{ $data->project_name }}"
                                                @if($table->project_name == $data->project_name) selected @endif
                                        >{{ $data->project_name }}</option>
                                    @endforeach
                                </select>                            </div>
                            <div class="col-sm-1">编号：</div>
                            <div class="col-sm-2">
                                <input style="margin: 0px;" name="num" class="form-control" type="text" placeholder="必填项">
                            </div><br><br>
                        </div>
                        <div class="row">
                            <div class="col-sm-12">
                                <table style="border: 1px solid #585858" id="example2" class="table table-bordered">
                                    <tbody>
                                    <tr>
                                        <td>被征收户姓名</td>
                                        <td colspan="3"><input name="bzc_name" value="{{ $table->bzc_name }}" class="form-control" type="text" placeholder=""></td>
                                        <td>被征收房屋住址</td>
                                        <td colspan="4"><input name="bzc_addr" value="{{ $table->bzc_addr }}" class="form-control" type="text" placeholder=""></td>
                                    </tr>
                                    <tr>
                                        <td>联系电话</td>
                                        <td colspan="3"><input name="bzc_tel" value="{{ $table->bzc_tel }}" class="form-control" type="text" placeholder=""></td>
                                        <td>被征收人身份证号</td>
                                        <td colspan="4"><input name="bzc_cardid" value="{{ $table->bzc_cardid }}" class="form-control" type="text" placeholder=""></td>
                                    </tr>
                                    <tr>
                                        <td>产权性质</td>
                                        <td colspan="3"><input name="chanquan" value="{{ $table->chanquan }}" class="form-control" type="text" placeholder=""></td>
                                        <td>用 途</td>
                                        <td colspan="4"><input name="used" value="{{ $table->used }}" class="form-control" type="text" placeholder=""></td>
                                    </tr>
                                    <tr>
                                        <td>证件名称</td>
                                        <td colspan="2">建设用地通知书（批准书）</td>
                                        <td>建设用地规划许可证</td>
                                        <td>建设工程规划许可证</td>
                                        <td colspan="2">国有土地使用证</td>
                                        <td colspan="2">房屋所有权证</td>
                                    </tr>
                                    <tr>
                                        <td>证号</td>
                                        <td colspan="2"><input name="tongzhi_id" value="{{ $table->tongzhi_id }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="yongdi_id" value="{{ $table->yongdi_id }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="gongchen_id" value="{{ $table->gongchen_id }}" class="form-control" type="text" placeholder=""></td>
                                        <td colspan="2"><input name="shiyong_id" value="{{ $table->shiyong_id }}" class="form-control" type="text" placeholder=""></td>
                                        <td colspan="2"><input name="suoyou_id" value="{{ $table->suoyou_id }}" class="form-control" type="text" placeholder=""></td>
                                    </tr>
                                    <tr>
                                        <td colspan="3">被征收房屋面积</td>
                                        <td rowspan="2">可置换住宅面积（㎡）</td>
                                        <td rowspan="2">可置换商业面积（㎡）</td>
                                        <td rowspan="2" >单价（元/㎡）</td>
                                        <td  colspan="3" rowspan="2" >房务补偿额（元）</td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td>面积</td>
                                        <td>转换系数</td>
                                    </tr>
                                    <tr>
                                        <td >住宅有证面积：</td>
                                        <td><input name="data1_1" value="{{ $table->data1_1 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data1_2" value="{{ $table->data1_2 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="bzc_area" value="{{ $table->bzc_area }}" class="form-control" type="text" placeholder="" onclick="get_product_area(data1_1,data1_2,this)"></td>
                                        <td><input name="data2" value="{{ $table->data2 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data3" value="{{ $table->data3 }}" class="form-control" type="text" placeholder=""></td>
                                        <td  colspan="3"><input name="data4" value="{{ $table->data4 }}" class="form-control" type="text" placeholder="" onclick="get_product(bzc_area,data3,this)"></td>
                                    </tr>
                                    <tr>
                                        <td >无证面积：</td>
                                        <td><input name="data1_3" value="{{ $table->data1_3 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data1_4" value="{{ $table->data1_4 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data5" value="{{ $table->data5 }}" class="form-control" type="text" placeholder="" onclick="get_product_area(data1_3,data1_4,this)"></td>
                                        <td><input name="data6" value="{{ $table->data6 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data7" value="{{ $table->data7 }}" class="form-control" type="text" placeholder=""></td>
                                        <td  colspan="3"><input name="data8" value="{{ $table->data8 }}" class="form-control" type="text" placeholder="" onclick="get_product(data5,data7,this)"></td>
                                    </tr>
                                    <tr>
                                        <td >其中住改非：</td>
                                        <td><input name="data1_5" value="{{ $table->data1_5 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data1_6" value="{{ $table->data1_6 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data9" value="{{ $table->data9 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data10" value="{{ $table->data10 }}" class="form-control" type="text" placeholder="" onclick="get_product_area(data1_5,data1_6,this)"></td>
                                        <td><input name="data11" value="{{ $table->data11 }}" class="form-control" type="text" placeholder=""></td>
                                        <td  colspan="3"><input name="data12" value="{{ $table->data12 }}" class="form-control" type="text" placeholder="" onclick="get_product(data10,data11,this)"></td>
                                    </tr>
                                    <tr>
                                        <td >商业有证面积：</td>
                                        <td><input name="data1_7" value="{{ $table->data1_7 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data1_8" value="{{ $table->data1_8 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data13" value="{{ $table->data13 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data14" value="{{ $table->data14 }}" class="form-control" type="text" placeholder="" onclick="get_product_area(data1_7,data1_8,this)"></td>
                                        <td><input name="data15" value="{{ $table->data15 }}" class="form-control" type="text" placeholder=""></td>
                                        <td  colspan="3"><input name="data16" value="{{ $table->data16 }}" class="form-control" type="text" placeholder="" onclick="get_product(data14,data15,this)"></td>
                                    </tr>
                                    <tr>
                                        <td ><input name="data_other" value="{{ $table->data_other }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data1_9" value="{{ $table->data1_9 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data1_10" value="{{ $table->data1_10 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data17" value="{{ $table->data17 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data18" value="{{ $table->data18 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data19" value="{{ $table->data19 }}" class="form-control" type="text" placeholder=""></td>
                                        <td  colspan="3"><input name="data20" value="{{ $table->data20 }}" class="form-control" type="text" placeholder="" onclick="data20.value = (data19.value*data18.value*data17.value);"></td>
                                    </tr>
                                    <tr>
                                        <td colspan="3">小 计：</td>
                                        <td><input name="data21" value="{{ $table->data21 }}" class="form-control" type="text" placeholder="" onclick="add(bzc_area,data5,data17,this)"></td>
                                        <td><input name="data22" value="{{ $table->data22 }}" class="form-control" type="text" placeholder="" onclick="add(data10,data14,data18,this)"></td>
                                        <td><input name="data23" value="{{ $table->data23 }}" class="form-control" type="text" placeholder=""></td>
                                        <td colspan="3"><input name="data24" value="{{ $table->data24 }}" class="form-control" type="text" placeholder="" onclick="added(data4,data8,data12,data16,data20,this)"></td>
                                    </tr>
                                    <tr>
                                        <td >装修补偿额：</td>
                                        <td colspan="5"><textarea name="data26_1" class="form-control">{{ $table->data26_1 }}</textarea></td>
                                        <td colspan="3"><input class="form-control" id="data252" name="data25" value="{{ $table->data25 }}" onchange="NoToChinese(this.value,data251)"></td>
                                    </tr>
                                    <tr>
                                        <td>庭院补偿额</td>
                                        <td>总面积</td>
                                        <td><input name="all_area" value="{{ $table->all_area }}" class="form-control" type="text" placeholder=""></td>
                                        <td colspan="3"><textarea name="data25_1" class="form-control">{{ $table->data25_1 }}</textarea></td>
                                        <td colspan="3"><input name="data26" id="data262" value="{{ $table->data26 }}" class="form-control" type="text" placeholder="" onchange="NoToChinese(this.value,data261)"></td>
                                    </tr>
                                    <tr>
                                        <td>停产停业损失补偿额</td>
                                        <td colspan="5"><textarea name="data27_1" class="form-control">{{ $table->data27_1 }}</textarea></td>
                                        <td colspan="3"><input name="data27" id="data272" value="{{ $table->data27 }}" class="form-control" type="text" placeholder="" onchange="NoToChinese(this.value,data271)"></td>
                                    </tr>
                                    <tr>
                                        <td rowspan="6">构筑物及其他补偿金</td>
                                        <td>名称</td>
                                        <td>金额</td>
                                        <td>名称</td>
                                        <td>金额</td>
                                        <td>名称</td>
                                        <td>金额</td>
                                        <td>名称</td>
                                        <td>金额</td>
                                    </tr>
                                    <tr>

                                        <td><input name="data28" value="{{ $table->data28 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data29" value="{{ $table->data29 }}" class="form-control sum" type="text" placeholder=""></td>
                                        <td><input name="data30" value="{{ $table->data30 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data30_1" value="{{ $table->data30_1 }}"  class="form-control sum" type="text" placeholder=""></td>
                                        <td><input name="data30_2" value="{{ $table->data30_2 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data30_3" value="{{ $table->data30_3 }}" class="form-control sum" type="text" placeholder=""></td>
                                        <td><input name="data30_4" value="{{ $table->data30_4 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data30_5" value="{{ $table->data30_5 }}" class="form-control sum" type="text" placeholder=""></td>
                                    </tr>
                                    <tr>
                                        <td><input name="data31" value="{{ $table->data31 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data32" value="{{ $table->data32 }}" class="form-control sum" type="text" placeholder=""></td>
                                        <td><input name="data33" value="{{ $table->data33 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data33_1" value="{{ $table->data33_1 }}" class="form-control sum" type="text" placeholder=""></td>
                                        <td><input name="data33_2" value="{{ $table->data33_2 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data33_3" value="{{ $table->data33_3 }}" class="form-control sum" type="text" placeholder=""></td>
                                        <td><input name="data33_4" value="{{ $table->data33_4 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data33_5" value="{{ $table->data33_5 }}" class="form-control sum" type="text" placeholder=""></td>
                                    </tr>
                                    <tr>
                                        <td><input name="data34" value="{{ $table->data34 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data35" value="{{ $table->data35 }}" class="form-control sum" type="text" placeholder=""></td>
                                        <td><input name="data36" value="{{ $table->data36 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data36_1" value="{{ $table->data36_1 }}"  class="form-control sum" type="text" placeholder=""></td>
                                        <td><input name="data36_2" value="{{ $table->data36_2 }}"  class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data36_3" value="{{ $table->data36_3 }}"  class="form-control sum" type="text" placeholder=""></td>
                                        <td><input name="data36_4" value="{{ $table->data36_4 }}"  class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data36_5" value="{{ $table->data36_5 }}"  class="form-control sum" type="text" placeholder=""></td>
                                    </tr>
                                    <tr>
                                        <td><input name="data37" value="{{ $table->data37 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data38" value="{{ $table->data38 }}" class="form-control sum" type="text" placeholder=""></td>
                                        <td><input name="data39" value="{{ $table->data39 }}" class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data39_1" value="{{ $table->data39_1 }}"  class="form-control sum" type="text" placeholder=""></td>
                                        <td><input name="data39_2" value="{{ $table->data39_2 }}"  class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data39_3" value="{{ $table->data39_3 }}"  class="form-control sum" type="text" placeholder=""></td>
                                        <td><input name="data39_4" value="{{ $table->data39_4 }}"  class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data39_5" value="{{ $table->data39_5 }}"  class="form-control sum" type="text" placeholder=""></td>
                                    </tr>
                                    <tr>
                                        <td ><input name="data39_6" value="{{ $table->data39_6 }}"  class="form-control" type="text" placeholder=""></td>
                                        <td ><input name="data39_7" value="{{ $table->data39_7 }}"  class="form-control sum" type="text" placeholder=""></td>
                                        <td><input name="data39_8"  value="{{ $table->data39_8 }}"  class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data39_9"  value="{{ $table->data39_9 }}" class="form-control sum" type="text" placeholder=""></td>
                                        <td><input name="data39_10" value="{{ $table->data39_10 }}"  class="form-control" type="text" placeholder=""></td>
                                        <td><input name="data39_11" value="{{ $table->data39_11 }}"  class="form-control sum" type="text" placeholder=""></td>
                                        <td>合 计</td>
                                        <td><input name="data39_13" value="{{ $table->data39_13 }}"  class="form-control" type="text" placeholder="" onclick="sum(data39_13)"></td>
                                    </tr>
                                    <?php $i = 1; $k = 1; $h = 0?>
                                    @foreach($table->jsons as $value)
                                        <tr>
                                            <td colspan="2">拆迁补偿总金额 （<?php echo $i++ ?>）</td>
                                            <td colspan="5">￥<input disabled id="data431" class="form-control" type="text" placeholder="">（元）</td>
                                            <td colspan="2"><input name="data43" id="data432" value="{{ $value->data43 }}"  class="form-control <?php echo 'next'.$h ?>" type="text" placeholder="小写" onclick="get_change(data24,data25,data26,data27,data39_13,this)" >（元）</td>
                                        </tr>
                                        <tr>
                                            <td rowspan="8">产权调换差价计算 （<?php echo $k++  ?>）</td>
                                            <td>房屋类别</td>
                                            <td>可调换面积（㎡）</td>
                                            <td>实际调换面积（㎡）</td>
                                            <td>大于可调换面积（㎡）</td>
                                            <td>小于可调换面积（㎡）</td>
                                            <td colspan="3">可调换面积价格核算（元）</td>
                                        </tr>
                                        <tr>
                                            <td>住宅</td>
                                            <td><input name="home_area" value="{{ $value->home_area }}" class="form-control <?php echo 'next'.$h ?>" type="text" placeholder="" onclick="add(bzc_area,data5,data17,this)"></td>
                                            <td><input name="data50" value="{{ $value->data50 }}" class="form-control <?php echo 'next'.$h ?>" type="text" placeholder=""></td>
                                            <td><input name="data51" value="{{ $value->data51 }}" class="form-control <?php echo 'next'.$h ?>" type="text" placeholder=""></td>
                                            <td><input name="data51_1" value="{{ $value->data51_1 }}" class="form-control <?php echo 'next'.$h ?>" type="text" placeholder=""></td>
                                            <td colspan="2"><textarea name="data51_2" class="form-control next" type="text" placeholder="">{{ $table->data51_2 }}</textarea></td>
                                            <td><input name="data52" value="{{ $value->data52 }}" class="form-control <?php echo 'next'.$h ?>" type="text" placeholder=""></td>
                                        </tr>
                                        <tr>
                                            <td>商业</td>
                                            <td><input name="data53" value="{{ $value->data53 }}" class="form-control <?php echo 'next'.$h ?>" type="text" placeholder="" onclick="add(data10,data14,data18,this)"></td>
                                            <td><input name="data54" value="{{ $value->data54 }}" class="form-control <?php echo 'next'.$h ?>" type="text" placeholder=""></td>
                                            <td><input name="data55" value="{{ $value->data55 }}" class="form-control <?php echo 'next'.$h ?>" type="text" placeholder=""></td>
                                            <td><input name="data55_1" value="{{ $value->data55_1 }}" class="form-control <?php echo 'next'.$h ?>" type="text" placeholder=""></td>
                                            <td colspan="2"><textarea name="data55_2" class="form-control next" type="text" placeholder="">{{ $table->data55_2 }}</textarea></td>
                                            <td><input name="data56" value="{{ $value->data56 }}" class="form-control <?php echo 'next'.$h ?>" type="text" placeholder=""></td>
                                        </tr>
                                        <tr>
                                            <td>房屋类别</td>
                                            <td colspan="2">大于可调换面积价格核算（元）</td>
                                            <td>调换房屋价格（元）</td>
                                            <td colspan="2">应退差额（元）</td>
                                            <td colspan="2">应缴差额（元）</td>
                                        </tr>
                                        <tr>
                                            <td rowspan="2">住宅</td>
                                            <td><textarea name="data57_2" class="form-control next" type="text" placeholder="">{{ $value->data57_2 }}</textarea></td>
                                            <td ><input name="data57" value="{{ $value->data57 }}" class="form-control <?php echo 'next'.$h ?>" type="text" placeholder=""></td>
                                            <td rowspan="2"><input name="data58" value="{{ $value->data58 }}" class="form-control <?php echo 'next'.$h ?>" type="text" placeholder="" onclick="add_money(data52,data57,data57_1,this)"></td>
                                            <td colspan="2"  rowspan="3"><input id="data59" name="data59" value="{{ $value->data59 }}" class="form-control <?php echo 'next'.$h ?>" type="text" placeholder="" onclick="jian(data43,data58,data62)"></td>
                                            <td colspan="2"  rowspan="3"><input id="data60" name="data60" value="{{ $value->data60 }}" class="form-control <?php echo 'next'.$h ?>" type="text" placeholder="" onclick="jian(data43,data58,data62)"></td>
                                        </tr>
                                        <tr>
                                            <td ><textarea name="data57_3" class="form-control next" type="text" >{{ $value->data57_3 }}</textarea></td>
                                            <td><input name="data57_1" value="{{ $value->data57_1 }}" class="form-control <?php echo 'next'.$h ?>" type="text" ></td>
                                        </tr>
                                        <tr>
                                            <td rowspan="2">商业</td>
                                            <td  ><textarea name="data61_2" class="form-control next" type="text" placeholder="">{{ $value->data61_2 }}</textarea></td>
                                            <td  ><input name="data61" value="{{ $value->data61 }}" class="form-control <?php echo 'next'.$h ?>" type="text" placeholder=""></td>
                                            <td rowspan="2"><input name="data62" value="{{ $value->data62 }}" class="form-control <?php echo 'next'.$h ?>" type="text" placeholder="" onclick="add_money(data56,data61,data61_1,this)"></td>
                                        </tr>
                                        <tr>
                                            <td ><textarea name="data61_3" class="form-control next" type="text" > {{ $value->data61_3 }}</textarea></td>
                                            <td ><input name="data61_1" value="{{ $value->data61_1 }}" class="form-control <?php echo 'next'.$h ?>" type="text" ></td>
                                            <td colspan="2"><a id="nextid" onclick="nextPage()"></a></td>
                                            <td colspan="2">
                                                <textarea name="data61_4" class="form-control next" type="text">{{ $value->data61_4 }}</textarea>
                                                <input type="hidden" name="json" id="json">
                                                <input type="hidden" name="hours" id="hours">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>调换房屋位置</td>
                                            <td colspan="8"><input name="data63" value="{{ $value->data63 }}" class="form-control <?php echo 'next'.$h++ ?>" type="text" placeholder="       小区      楼号     单元      层数      室" ></td>
                                        </tr>
                                        @endforeach
                                    <tr>
                                        <td rowspan="2" colspan="2" style="height:120px;">征收实施单位（章）<br></td>
                                        <td>被征收人（签字）</td>
                                        <td colspan="2"></td>
                                        <td>代理人（签字）</td>
                                        <td colspan="3"></td>
                                    </tr>
                                    <tr>
                                        <td>签约时间</td>
                                        <td colspan="6"><input readonly id="table_time" name="table_time" value="{{ $table->table_time }}" class="form-control form_datetime" type="hidden" placeholder=""></td>
                                    </tr>

                                    </tbody>
                                </table>
                                <div class="row">
                                    <div class="col-sm-4">核算（签字）：<input name="hesuan"  style="border: none #ffffff;border-bottom: #777777 solid 1px;" type="text" placeholder=""></div>
                                    <div class="col-sm-4">初审（签字）：<input disabled style="border: none #ffffff;border-bottom: #777777 solid 1px;" ></div>
                                    <div class="col-sm-4">监审（签字）：<input disabled style="border: none #ffffff;border-bottom: #777777 solid 1px;" ></div>
                                </div><br>
                                <div class="row">
                                    <div class="col-sm-4">复核（签字）：<input name="fuhe" style="border: none #ffffff;border-bottom: #777777 solid 1px;" type="text" value="{{ $table->fuhe }}" placeholder=""></div>
                                    <div class="col-sm-4">初审（签字）：<input   style="border: none #ffffff;border-bottom: #777777 solid 1px;" ></div>
                                    <div class="col-sm-4">监审（签字）：<input   style="border: none #ffffff;border-bottom: #777777 solid 1px;" ></div>
                                </div><br>
                                <div class="row">
                                    <div class="col-sm-8">提交说明 : <label id="sub_description">{{ $table->sub_description }}</label></div>
                                </div>
                            </div>
                        </div>
                        <div class="row" id="bottom_button">
                            <div class="col-sm-8"></div>
                            <div class="col-sm-4">
                                @if($table->status == null  || $table->status<2)
                                    @if($user->role == 0 && $table->status == 0)
                                        <button id="sub" type="submit" onclick="javascript:this.form.action='{{ url('/table/save/'.$table_id.'/update') }}'" class="btn btn-success">
                                            保存</button>
                                    @endif
                                    @if($user->role == $table->status)
                                        @if($table->status == 0)
                                            <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal">提交</button>
                                        @else
                                            <button id="sub" type="submit" onclick="javascript:this.form.action='{{ url('/table/sub/'.$table_id) }}'" class="btn btn-primary">
                                                提交</button>
                                        @endif
                                    @endif
                                    <a href="{{ url('/on_table') }}" class="btn btn-info">返回</a>
                                        <a href="{{ url('/print/'.$table_id) }}"  target="_blank"  class="btn btn-success">打印</a>
                                @else
                                    <a href="{{ url('/') }}" class="btn btn-info">返回</a>
                                    <a href="{{ url('/print/'.$table_id) }}" target="_blank"  class="btn btn-success">打印</a>
                                @endif
                            </div>
                        </div>
                    </div>

                        {{--model--}}
                        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                            <div class="modal-dialog" role="document">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                        <h4 class="modal-title" id="myModalLabel">提交说明</h4>
                                    </div>
                                    <div class="modal-body">
                                        <div class="form-group">
                                            <textarea class="form-control" id="model_des" name="sub_description" placeholder="输入您的内容..."></textarea>
                                        </div>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-default" data-dismiss="modal">返回</button>
                                        <button id="sub" type="submit" class="btn btn-primary" onclick="javascript:this.form.action='{{ url('/table/sub/'.$table_id) }}'">提交</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        {{--end model--}}

                        </form>
                </div>
                <!-- /.box-body -->
            </div>
            <!-- /.box -->

            <script type="text/javascript">
                $(".form_datetime").datetimepicker({
                    language: 'zh',
                    format: 'yyyy年mm月dd日',
                    minView:'month'
                }).on('changeDate',function(){
                    $(".datetimepicker").hide();
                });
                function nextPage(){
                    var json = [];
                    var chae = $('#data59').val();
                    //差额不够时隐藏下一页
                    if(chae == ''||chae == 0 ){
                        document.getElementById('nextid').style.display = "none";
                    }
                    //批量赋值在数组里
                    $(".next").each(function(){
                        json[this.name] =this.value;
                        this.value = ''; //清空当前页数据，伪第二页
                    });

                    //赋值下一页的总金额
                    $('#data432').val(chae);

                    jsons.push(json);
                    hours += 1;
                    $('#hours').val(hours);

                    console.log(jsons);

                    return jsons;
                }
                var jsons = [];
                function getdata(){
                    for (var j = 0; j <{{ count($table->jsons)}}; j++) {
                        var json = {};
                        $(".next" + j).each(function () {
                            json[this.name] = this.value;
                        });
                        jsons.push(json);
                    }
                    console.log(jsons);
                    return jsons;
                }
                $('form').submit(function(){
                    jsons = getdata();
                    var temp = JSON.stringify(jsons);
                    $('#json').val(temp);

                    console.log(temp);

                    return true;
                });
                $(function(){
                    change(data252,data251);
                    change(data262,data261);
                    change(data272,data271);
                    change(data432,data431);
                });
                function change(one,add){
                    var num = $(one).val();
//                            if (!/^\d*(\.\d*)?$/.test(num)) { alert("Number is wrong!"); return "Number is wrong!"; }
                    var AA = new Array("零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖");
                    var BB = new Array("", "拾", "佰", "仟", "萬", "億", "点", "");
                    var a = ("" + num).replace(/(^0*)/g, "").split("."), k = 0, re = "";
                    for (var i = a[0].length - 1; i >= 0; i--) {
                        switch (k) {
                            case 0: re = BB[7] + re; break;
                            case 4: if (!new RegExp("0{4}\\d{" + (a[0].length - i - 1) + "}$").test(a[0]))
                                re = BB[4] + re; break;
                            case 8: re = BB[5] + re; BB[7] = BB[5]; k = 0; break;
                        }
                        if (k % 4 == 2 && a[0].charAt(i + 2) != 0 && a[0].charAt(i + 1) == 0) re = AA[0] + re;
                        if (a[0].charAt(i) != 0) re = AA[a[0].charAt(i)] + BB[k % 4] + re; k++;
                    }

                    if (a.length > 1) //加上小数部分(如果有小数部分)
                    {
                        re += BB[6];
                        for (var i = 0; i < a[1].length; i++) re += AA[a[1].charAt(i)];
                    }
                    $(add).val(re);
                }
                function sum(result){
                    var sum = 0;
                    $(".sum").each(function(){
                        if (this.value == '') this.value = 0;
                        sum  += parseInt(this.value);
                    });
                    result.value = sum;
                }
                function get_product(left,right,product){
                    var result = (left.value*right.value);
                    product.value = result.toFixed(0);
                }
                function get_product_area(left,right,product){
                    var result = (left.value*right.value);
                    product.value = result.toFixed(2);
                }
                function add(one,two,three,add) {
                    if ($(one).val() == ''){
                        $(one).val(0);
                    }if ($(two).val() == ''){
                        $(two).val(0);
                    }if ($(three).val() == ''){
                        $(three).val(0);
                    }
                    var result = parseFloat($(one).val()) + parseFloat($(two).val()) + parseFloat($(three).val());
                    add.value= result.toFixed(2);
                }
                function add_money(one,two,three,add) {
                    if ($(one).val() == ''){
                        $(one).val(0);
                    }if ($(two).val() == ''){
                        $(two).val(0);
                    }if ($(three).val() == ''){
                        $(three).val(0);
                    }
                    var result = parseFloat($(one).val()) + parseFloat($(two).val()) + parseFloat($(three).val());
                    add.value= result.toFixed(0);
                }
                function adde(one,two,three,four,add) {
                    var result = parseInt($(one).val()) + parseInt($(two).val()) + parseInt($(three).val()) + parseInt($(four).val());
                    add.value= Math.round(result);
                }
                function added(one,two,three,four,five,add) {
                    if ($(one).val() == ''){$(one).val(0);}
                    if ($(two).val() == ''){$(two).val(0);}
                    if ($(three).val() == ''){$(three).val(0);}
                    if ($(four).val() == ''){$(four).val(0);}
                    if ($(five).val() == ''){$(five).val(0);}
                    var result = parseInt($(one).val()) + parseInt($(two).val()) + parseInt($(three).val()) + parseInt($(four).val()) + parseInt($(five).val())
                    add.value= Math.round(result);
                }
                function jian(I,P,Q){
                    var result = 0;
                    if ($(I).val() == ''){$(I).val(0);}
                    if ($(P).val() == ''){$(P).val(0);}
                    if ($(Q).val() == ''){$(Q).val(0);}
                    result = parseFloat($(I).val()) - parseFloat($(P).val())-parseFloat($(Q).val());
                    result = Math.round(result);

                    if(result >= 0){
                        $('#data59').val(result);
                        $('#data60').val('');
                    }else{
                        $('#data59').val('');
                        $('#data60').val(result*(-1));
                    }
                    if ($('#data59').val() == ''||$('#data59').val() == 0){
                        document.getElementById('nextid').style.display = "none";
                    }else{
                        document.getElementById('nextid').style.display = "inline";
                    }
                }
                function NoToChinese(num,to) {
                    if (!/^\d*(\.\d*)?$/.test(num)) { alert("Number is wrong!"); return "Number is wrong!"; }
                    var AA = new Array("零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖");
                    var BB = new Array("", "拾", "佰", "仟", "萬", "億", "点", "");
                    var a = ("" + num).replace(/(^0*)/g, "").split("."), k = 0, re = "";
                    for (var i = a[0].length - 1; i >= 0; i--) {
                        switch (k) {
                            case 0: re = BB[7] + re; break;
                            case 4: if (!new RegExp("0{4}\\d{" + (a[0].length - i - 1) + "}$").test(a[0]))
                                re = BB[4] + re; break;
                            case 8: re = BB[5] + re; BB[7] = BB[5]; k = 0; break;
                        }
                        if (k % 4 == 2 && a[0].charAt(i + 2) != 0 && a[0].charAt(i + 1) == 0) re = AA[0] + re;
                        if (a[0].charAt(i) != 0) re = AA[a[0].charAt(i)] + BB[k % 4] + re; k++;
                    }

                    if (a.length > 1) //加上小数部分(如果有小数部分)
                    {
                        re += BB[6];
                        for (var i = 0; i < a[1].length; i++) re += AA[a[1].charAt(i)];
                    }

                    $(to).val(re);
                }
                function get_change(one,two,three,four,five,add){
                    if ($(one).val() == ''){$(one).val(0);}
                    if ($(two).val() == ''){$(two).val(0);}
                    if ($(three).val() == ''){$(three).val(0);}
                    if ($(four).val() == ''){$(four).val(0);}
                    if ($(five).val() == ''){$(five).val(0);}
                    var  num = 0;
                    num = parseInt($(one).val()) + parseInt($(two).val())+ parseInt($(three).val())+ parseInt($(four).val())+ parseInt($(five).val());

                    $(add).val(num);

//                            if (!/^\d*(\.\d*)?$/.test(num)) { alert("Number is wrong!"); return "Number is wrong!"; }
                    var AA = new Array("零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖");
                    var BB = new Array("", "拾", "佰", "仟", "萬", "億", "点", "");
                    var a = ("" + num).replace(/(^0*)/g, "").split("."), k = 0, re = "";
                    for (var i = a[0].length - 1; i >= 0; i--) {
                        switch (k) {
                            case 0: re = BB[7] + re; break;
                            case 4: if (!new RegExp("0{4}\\d{" + (a[0].length - i - 1) + "}$").test(a[0]))
                                re = BB[4] + re; break;
                            case 8: re = BB[5] + re; BB[7] = BB[5]; k = 0; break;
                        }
                        if (k % 4 == 2 && a[0].charAt(i + 2) != 0 && a[0].charAt(i + 1) == 0) re = AA[0] + re;
                        if (a[0].charAt(i) != 0) re = AA[a[0].charAt(i)] + BB[k % 4] + re; k++;
                    }

                    if (a.length > 1) //加上小数部分(如果有小数部分)
                    {
                        re += BB[6];
                        for (var i = 0; i < a[1].length; i++) re += AA[a[1].charAt(i)];
                    }

                    $('#data431').val(re);
                }
                function printed(printpage){
                    $('#bottom_button').hide();
                    var headstr = "<html><head><title></title></head><body>";
                    var footstr = "</body>";
                    var newstr = document.all.item(printpage).innerHTML;
                    var oldstr = document.body.innerHTML;
                    document.body.innerHTML = headstr+newstr+footstr;
                    window.print();
                    document.body.innerHTML = oldstr;
                    $('#bottom_button').show();

                    return false;
                }
            </script>
        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
@endsection