Parcourir la source

更新剩余疫苗数

ChenWuJie il y a 4 ans
Parent
commit
f4065936e3

+ 1 - 1
app/Community/Controllers/HomeController.php

xqd
@@ -95,7 +95,7 @@ class HomeController extends Controller
                 $yersterday = 'appoint_start_time[start]='.date('Y-m-d 00:00:00',strtotime('-1 days'))
                     .'&appoint_start_time[end]='.date('Y-m-d 00:00:00', time());
                 $row->column(3,new InfoBox('疫苗总库存(支)', 'first-order', 'aqua', '/cdms/vaccines', $data['have_num']));
-                $row->column(3,new InfoBox('疫苗库存告急(中)', 'first-order', 'aqua', '/cdms/vaccines', $data['less_num']));
+                $row->column(3,new InfoBox('疫苗库存告急(支)', 'first-order', 'aqua', '/cdms/vaccines?stock=10', $data['less_num']));
                 $row->column(3,new InfoBox('昨日接种消耗(支)', 'first-order', 'aqua', '/cdms/order_vaccines?order_status=4&'.$yersterday, $data['yesterday']));
             });
     }

+ 5 - 2
app/Community/Controllers/StatController.php

xqd xqd
@@ -150,8 +150,7 @@ class StatController extends  Controller
         $oneday = strtotime(date('Y-m-d 00:00:00',strtotime('+1 days')));
         $twoday = strtotime(date('Y-m-d 00:00:00',strtotime('+2 days')));
         $beforeoneday = strtotime(date('Y-m-d 00:00:00',strtotime('-1 days')));
-        $data['have_num'] = Vaccine::where($another)->sum('stock'); //疫苗库存总数
-        $data['less_num'] = Vaccine::where($another)->where(['stock'=>10])->count();//缺苗钟数
+
         if ($org_id)
         {
             $ids = Order::where(['product_type'=>4])
@@ -159,12 +158,16 @@ class StatController extends  Controller
                 ->whereBetween('appoint_start_time',[$beforeoneday,strtotime('today')])
                 ->where('order_status',4)
                 ->pluck('id')->toArray();
+            $data['have_num'] = Vaccine::where($another)->sum('stock'); //疫苗库存总数
+            $data['less_num'] = Vaccine::where($another)->where('stock','<=',10)->count();//缺苗钟数
         }else
         {
             $ids = Order::where(['product_type'=>4])
                 ->whereBetween('appoint_start_time',[$beforeoneday,strtotime('today')])
                 ->where('order_status',4)
                 ->pluck('id')->toArray();
+            $data['have_num'] = Vaccine::sum('stock'); //疫苗库存总数
+            $data['less_num'] = Vaccine::where('stock','<=',10)->count();//缺苗钟数
         }
         $data['yesterday']= OrderVaccine::whereIn('order_id',$ids)->count(); //疫苗订单总数
         return $data;

+ 1 - 0
app/Community/Controllers/VaccineController.php

xqd
@@ -68,6 +68,7 @@ class VaccineController extends AdminController
         $grid->filter(function ($fliter){
             $fliter->like('name','疫苗');
             $fliter->equal('type','疫苗类型')->select(Vaccine::getType());
+            $fliter->lt('stock','剩余疫苗');
         });
 
         $grid->column('created_at', __('创建时间'));