Ver código fonte

领料列表合并

tincey 3 anos atrás
pai
commit
a7fbe89a7c

+ 2 - 1
application/admin/controller/Product.php

@@ -197,7 +197,8 @@ class Product extends Backend
     }
     public function show($ids){
         $row = $this->model->get($ids);
-        $row['data'] = $this->detail->where('pid',$row['id'])->select();
+        $row['data'] =Db::query("select *,sum(weight) as sum from mn_product_detail where pid= {$ids} group by material");
+//        halt($this->detail->buildSql());
 //        halt($row['data']);
         $this->view->assign("row", $row);
         return $this->view->fetch();

+ 3 - 3
application/admin/view/product/show.html

@@ -66,7 +66,7 @@
                 <td><input class='form-control' type="text" readonly value="{$row.pname}"></td>
                 <td><input class='form-control' type="text" readonly value="{$vo.material}"></td>
                 <td><input class='form-control' type="text" readonly value="{$row.specifications}"></td>
-                <td><input class='form-control' type="text" readonly value="{$vo.weight}"></td>
+                <td><input class='form-control' type="text" readonly value="{$vo.sum}"></td>
                 <td><input class='form-control' type="text" readonly value="{$row.unit}"></td>
                 <td><input class='form-control' type="text" readonly value="{$vo.createtime}"></td>
 <!--                <td><button type="submit" class="btn btn-primary btn-embossed disabled">{:__('Del')}</button></td>-->
@@ -123,6 +123,7 @@
             </div>
             <div style="height: 20px;"></div>
             <div id="body">
+                <div style="height: 5px;"></div>
                 <table class="tg" style="width: 800px;" id="print_gy">
                     <tr>
                         <th>批次号</th>
@@ -137,14 +138,13 @@
                         <td>{$row.batch}</td>
                         <td>{$row.pname}</td>
                         <td>{$vo.material}</td>
-                        <td>{$vo.weight}</td>
+                        <td>{$vo.sum}</td>
                         <td>{$row.specifications}</td>
                         <td>{$row.unit}</td>
                         <!--                <td><button type="submit" class="btn btn-primary btn-embossed disabled">{:__('Del')}</button></td>-->
                     </tr>
                     {/foreach}
                 </table>
-                <div style="height: 5px;"></div>
 
             </div>
         </div>