Browse Source

fix edit_one

GGican 8 years ago
parent
commit
75eefee78c

+ 46 - 14
resources/views/admin/edit_table/table_one.blade.php

@@ -90,7 +90,7 @@
                                 </tr>
                                 </tr>
                                 <tr>
                                 <tr>
                                     <td width="10%">拆迁补偿总金额:</td>
                                     <td width="10%">拆迁补偿总金额:</td>
-                                    <td colspan="5"><input disabled id="total_money_2" class="form-control" type="text" placeholder="">( 元 )</td>
+                                    <td colspan="5"><input disabled id="total_money_2" class="form-control" type="text" placeholder="">( 元 )</td>
                                     <td colspan="2"><input value="{{ $table->total_money }}" id="total_money_1" name="total_money" class="form-control" type="text" placeholder="小写" onchange="NoToChinese(this.value)" >(元)</td>
                                     <td colspan="2"><input value="{{ $table->total_money }}" id="total_money_1" name="total_money" class="form-control" type="text" placeholder="小写" onchange="NoToChinese(this.value)" >(元)</td>
                                 </tr>
                                 </tr>
                                 <tr>
                                 <tr>
@@ -104,26 +104,38 @@
                                 </tr>
                                 </tr>
                                 <tr>
                                 <tr>
                                     <td rowspan="2">住宅</td>
                                     <td rowspan="2">住宅</td>
-                                    <td><input name="home_area" class="form-control" type="text" placeholder="" value="{{ $table->home_area }}"></td>
-                                    <td><input name="money_home_dprice" class="form-control" type="text" value="{{$table->money_home_dprice}}"></td>
-                                    <td><input name="money_home_price" class="form-control" type="text" value="{{$table->money_home_price}}"></td>
-                                    <td rowspan="3"><input name="money_home_tchae" class="form-control" type="text" value="{{ $table->money_home_tchae }}"></td>
-                                    <td rowspan="3"><input name="money_home_jchae" class="form-control" type="text"  value="{{ $table->money_home_jchae }}"></td>
+                                    <td><input name="home_area" class="form-control" type="text" placeholder="" value="{{ $table->home_area }}" onchange="get_product(home_area,money_home_dprice,money_home_price)">
+                                    </td>
+                                    <td><input name="money_home_dprice" class="form-control" type="text" value="{{$table->money_home_dprice}}" onchange="get_product(home_area,money_home_dprice,money_home_price)">
+                                    </td>
+                                    <td><input name="money_home_price" class="form-control" type="text" value="{{$table->money_home_price}}" onclick="get_product(home_area,money_home_dprice,money_home_price)">
+                                    </td>
+                                    <td rowspan="3"><input name="money_home_tchae" id="money_home_tchae" class="form-control" type="text" value="{{ $table->money_home_tchae }}" onclick="jian(money_home_price,money_home_price2,money_bus_price,total_money)">
+                                    </td>
+                                    <td rowspan="3"><input name="money_home_jchae" id="money_home_jchae" class="form-control" type="text"  value="{{ $table->money_home_jchae }}" onclick="jian(money_home_price,money_home_price2,money_bus_price,total_money)">
+                                    </td>
                                 </tr>
                                 </tr>
                                 <tr>
                                 <tr>
-                                    <td><input name="home_area2" class="form-control" type="text" value="{{ $table->home_area2 }}"></td>
-                                    <td><input name="money_home_dprice2" class="form-control" type="text" value="{{ $table->money_home_dprice2 }}"></td>
-                                    <td><input name="money_home_price2" class="form-control" type="text" value="{{ $table->money_home_price2 }}"></td>
+                                    <td><input name="home_area2" class="form-control" type="text" value="{{ $table->home_area2 }}" onchange="get_product(home_area2,money_home_dprice2,money_home_price2)">
+                                    </td>
+                                    <td><input name="money_home_dprice2" class="form-control" type="text" value="{{ $table->money_home_dprice2 }}" onchange="get_product(home_area2,money_home_dprice2,money_home_price2)">
+                                    </td>
+                                    <td><input name="money_home_price2" class="form-control" type="text" value="{{ $table->money_home_price2 }}" onclick="get_product(home_area2,money_home_dprice2,money_home_price2)">
+                                    </td>
                                 </tr>
                                 </tr>
                                 <tr>
                                 <tr>
                                     <td>商业</td>
                                     <td>商业</td>
-                                    <td><input name="money_bus_area" class="form-control" type="text" placeholder="" value="{{ $table->money_bus_area }}"></td>
-                                    <td><input name="money_bus_dprice" class="form-control" type="text" placeholder="" value="{{ $table->money_bus_dprice }}"></td>
-                                    <td><input name="money_bus_price" class="form-control" type="text" placeholder="" value="{{ $table->money_bus_price }}"></td>
+                                    <td><input name="money_bus_area" class="form-control" type="text" placeholder="" value="{{ $table->money_bus_area }}" onchange="get_product(money_bus_area,money_bus_dprice,money_bus_price)">
+                                    </td>
+                                    <td><input name="money_bus_dprice" class="form-control" type="text" placeholder="" value="{{ $table->money_bus_dprice }}" onchange="get_product(money_bus_area,money_bus_dprice,money_bus_price)">
+                                    </td>
+                                    <td><input name="money_bus_price" class="form-control" type="text" placeholder="" value="{{ $table->money_bus_price }}" onclick="get_product(money_bus_area,money_bus_dprice,money_bus_price)">
+                                    </td>
                                 </tr>
                                 </tr>
                                 <tr>
                                 <tr>
                                     <td>购买房屋位置</td>
                                     <td>购买房屋位置</td>
-                                    <td colspan="7"><input name="home_addr" class="form-control" type="text" placeholder="" value="{{ $table->home_addr }}"></td>
+                                    <td colspan="7"><input name="home_addr" class="form-control" type="text" placeholder="" value="{{ $table->home_addr }}">
+                                    </td>
                                 </tr>
                                 </tr>
                                 <tr >
                                 <tr >
                                     <td rowspan="2" colspan="2" style="height: 90px;">征收实施单位(章)</td>
                                     <td rowspan="2" colspan="2" style="height: 90px;">征收实施单位(章)</td>
@@ -205,6 +217,26 @@
 
 
                             $('#total_money_2').val(re);
                             $('#total_money_2').val(re);
                         });
                         });
+                        function jian(I,P,Q,total){
+                            var result;
+                            if ($(I).val() == ''){$(I).val(0);}
+                            if ($(P).val() == ''){$(P).val(0);}
+                            if ($(Q).val() == ''){$(Q).val(0);}
+                            if ($(total).val() == ''){$(total).val(0);}
+                            result = parseFloat($(total).val()) - ( parseFloat($(I).val())+parseFloat($(P).val())+parseFloat($(Q).val()) );
+                            result = Math.round(result);
+                            if(result >= 0){
+                                $('#money_home_tchae').val(result);
+                                $('#money_home_jchae').val('');
+                            }else{
+                                $('#money_home_tchae').val('');
+                                $('#money_home_jchae').val(result*(-1));
+                            }
+                        }
+                        function get_product(left,right,product){
+                            var result = (left.value*right.value);
+                            product.value = result.toFixed(0);
+                        }
                         function NoToChinese(num) {
                         function NoToChinese(num) {
                             if (!/^\d*(\.\d*)?$/.test(num)) { alert("Number is wrong!"); return "Number is wrong!"; }
                             if (!/^\d*(\.\d*)?$/.test(num)) { alert("Number is wrong!"); return "Number is wrong!"; }
                             var AA = new Array("零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖");
                             var AA = new Array("零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖");
@@ -227,7 +259,7 @@
                                 for (var i = 0; i < a[1].length; i++) re += AA[a[1].charAt(i)];
                                 for (var i = 0; i < a[1].length; i++) re += AA[a[1].charAt(i)];
                             }
                             }
 
 
-                            $('#total_money1').val(re);
+                            $('#total_money_2').val(re);
                         }
                         }
                         function printed(printpage)
                         function printed(printpage)
                         {
                         {

+ 16 - 8
resources/views/admin/table/table_one.blade.php

@@ -96,21 +96,29 @@
                                 </tr>
                                 </tr>
                                 <tr>
                                 <tr>
                                     <td rowspan="2">住宅</td>
                                     <td rowspan="2">住宅</td>
-                                    <td><input name="home_area" class="form-control" type="text" placeholder=""  onchange="get_product(home_area,money_home_dprice,money_home_price)"></td>
-                                    <td><input name="money_home_dprice" class="form-control" type="text" placeholder="" onchange="get_product(home_area,money_home_dprice,money_home_price)"></td>
+                                    <td><input name="home_area" class="form-control" type="text" placeholder=""  onchange="get_product(home_area,money_home_dprice,money_home_price)">
+                                    </td>
+                                    <td><input name="money_home_dprice" class="form-control" type="text" placeholder="" onchange="get_product(home_area,money_home_dprice,money_home_price)">
+                                    </td>
                                     <td><input name="money_home_price" value="0" class="form-control" type="text" placeholder=""></td>
                                     <td><input name="money_home_price" value="0" class="form-control" type="text" placeholder=""></td>
-                                    <td rowspan="3"><input id="money_home_tchae" value="0" name="money_home_tchae" class="form-control" type="text" placeholder=""  onclick="jian(money_home_price,money_home_price2,money_bus_price,total_money)"></td>
-                                    <td rowspan="3"><input id="money_home_jchae" value="0" name="money_home_jchae" class="form-control" type="text" placeholder="" onclick="jian(money_home_price,money_home_price2,money_bus_price,total_money)"></td>
+                                    <td rowspan="3"><input id="money_home_tchae" value="0" name="money_home_tchae" class="form-control" type="text" placeholder=""  onclick="jian(money_home_price,money_home_price2,money_bus_price,total_money)">
+                                    </td>
+                                    <td rowspan="3"><input id="money_home_jchae" value="0" name="money_home_jchae" class="form-control" type="text" placeholder="" onclick="jian(money_home_price,money_home_price2,money_bus_price,total_money)">
+                                    </td>
                                 </tr>
                                 </tr>
                                 <tr>
                                 <tr>
-                                    <td><input name="home_area2" class="form-control" type="text" placeholder="" onchange="get_product(home_area2,money_home_dprice2,money_home_price2)"></td>
-                                    <td><input name="money_home_dprice2" class="form-control" type="text" placeholder="" onchange="get_product(home_area2,money_home_dprice2,money_home_price2)"></td>
+                                    <td><input name="home_area2" class="form-control" type="text" placeholder="" onchange="get_product(home_area2,money_home_dprice2,money_home_price2)">
+                                    </td>
+                                    <td><input name="money_home_dprice2" class="form-control" type="text" placeholder="" onchange="get_product(home_area2,money_home_dprice2,money_home_price2)">
+                                    </td>
                                     <td><input name="money_home_price2" value="0" class="form-control" type="text" placeholder=""></td>
                                     <td><input name="money_home_price2" value="0" class="form-control" type="text" placeholder=""></td>
                                 </tr>
                                 </tr>
                                 <tr>
                                 <tr>
                                     <td>商业</td>
                                     <td>商业</td>
-                                    <td><input name="money_bus_area" class="form-control" type="text" placeholder=""  onchange="get_product(money_bus_area,money_bus_dprice,money_bus_price)"></td>
-                                    <td><input name="money_bus_dprice" class="form-control" type="text" placeholder="" onchange="get_product(money_bus_area,money_bus_dprice,money_bus_price)"></td>
+                                    <td><input name="money_bus_area" class="form-control" type="text" placeholder=""  onchange="get_product(money_bus_area,money_bus_dprice,money_bus_price)">
+                                    </td>
+                                    <td><input name="money_bus_dprice" class="form-control" type="text" placeholder="" onchange="get_product(money_bus_area,money_bus_dprice,money_bus_price)">
+                                    </td>
                                     <td><input name="money_bus_price" value="0" class="form-control" type="text" placeholder=""></td>
                                     <td><input name="money_bus_price" value="0" class="form-control" type="text" placeholder=""></td>
                                 </tr>
                                 </tr>
                                 <tr>
                                 <tr>