Esempio n. 1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('item_inventories')->where('conversion', '>', 0)->update(['min_stock' => 2, 'oos' => 1, 'osa' => 0]);
     $areas = ['MDC', 'ROSE PHARMACY', '360 PHARMACY', '360 DRUG', 'ST. JOSEPH DRUG', 'SOUTH STAR DRUG'];
     $stores = StoreInventories::select('id')->whereIn('area', $areas)->get();
     foreach ($stores as $item) {
         ItemInventories::where('store_inventory_id', $item->id)->update(['min_stock' => 3]);
     }
     DB::statement("update `item_inventories` set `oos` = 0, `osa` = 1 where `sapc` > min_stock");
 }
 public function areastorelist(Request $request)
 {
     if (\Request::ajax()) {
         $areas = $request->areas;
         $type = $request->type;
         $report_type = 1;
         if (is_null($type) || $type != 'assortment') {
             $report_type = 2;
         }
         if ($report_type == 2) {
             $data['selection'] = StoreInventories::select('store_id', 'store_name')->whereIn('area', $areas)->orderBy('store_name')->lists('store_name', 'store_id');
         } else {
             $data['selection'] = AssortmentInventories::select('store_id', 'store_name')->whereIn('area', $areas)->orderBy('store_name')->lists('store_name', 'store_id');
         }
         return \Response::json($data, 200);
     }
 }