示例#1
0
 public function run()
 {
     //  Seed for barcode
     $barcode = array("encoding_format" => 'code39', "barcode_width" => '2', "barcode_height" => '30', "text_size" => '11');
     Barcode::create($barcode);
     $this->command->info("Barcode table seeded");
     //  Seed for quick codes
     $quick = array(array("feed_source" => 1, "config_prop" => 'PORT', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("feed_source" => 1, "config_prop" => 'MODE', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("feed_source" => 1, "config_prop" => 'CLIENT_RECONNECT', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("feed_source" => 1, "config_prop" => 'EQUIPMENT_IP', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("feed_source" => 0, "config_prop" => 'COMPORT', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("feed_source" => 0, "config_prop" => 'BAUD_RATE', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("feed_source" => 0, "config_prop" => 'PARITY', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("feed_source" => 0, "config_prop" => 'STOP_BITS', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("feed_source" => 0, "config_prop" => 'APPEND_NEWLINE', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("feed_source" => 0, "config_prop" => 'DATA_BITS', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("feed_source" => 0, "config_prop" => 'APPEND_CARRIAGE_RETURN', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("feed_source" => 2, "config_prop" => 'DATASOURCE', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("feed_source" => 2, "config_prop" => 'DAYS', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("feed_source" => 4, "config_prop" => 'BASE_DIRECTORY', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("feed_source" => 4, "config_prop" => 'USE_SUB_DIRECTORIES', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("feed_source" => 4, "config_prop" => 'SUB_DIRECTORY_FORMAT', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("feed_source" => 4, "config_prop" => 'FILE_NAME_FORMAT', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("feed_source" => 4, "config_prop" => 'FILE_EXTENSION', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("feed_source" => 4, "config_prop" => 'FILE_SEPERATOR', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')));
     foreach ($quick as $codes) {
         DB::table('ii_quickcodes')->insert($codes);
     }
     $this->command->info("Quick codes table seeded");
     //  Seed for interfaced equipment in blis client
     $equipment = array(array("equipment_name" => 'Mindray BS-200E', "comm_type" => 2, "equipment_version" => '01.00.07', "lab_section" => 1, "feed_source" => 1, "config_file" => '\\BLISInterfaceClient\\configs\\BT3000Plus\\bt3000pluschameleon.xml'), array("equipment_name" => 'ABX Pentra 60 C+', "comm_type" => 2, "equipment_version" => '', "lab_section" => 1, "feed_source" => 2, "config_file" => '\\BLISInterfaceClient\\configs\\pentra\\pentra60cplus.xml'), array("equipment_name" => 'ABX MACROS 60', "comm_type" => 1, "equipment_version" => '', "lab_section" => 1, "feed_source" => 0, "config_file" => '\\BLISInterfaceClient\\configs\\micros60\\abxmicros60.xml'), array("equipment_name" => 'BT 3000 Plus', "comm_type" => 1, "equipment_version" => '', "lab_section" => 1, "feed_source" => 0, "config_file" => '\\BLISInterfaceClient\\configs\\BT3000Plus\\bt3000plus.xml'), array("equipment_name" => 'Sysmex SX 500i', "comm_type" => 1, "equipment_version" => '', "lab_section" => 1, "feed_source" => 1, "config_file" => '\\BLISInterfaceClient\\configs\\SYSMEX\\SYSMEXXS500i.xml'), array("equipment_name" => 'BD FACSCalibur', "comm_type" => 1, "equipment_version" => '', "lab_section" => 1, "feed_source" => 4, "config_file" => '\\BLISInterfaceClient\\configs\\BDFACSCalibur\\bdfacscalibur.xml'), array("equipment_name" => 'Mindray BC 3600', "comm_type" => 1, "equipment_version" => '', "lab_section" => 1, "feed_source" => 0, "config_file" => '\\BLISInterfaceClient\\configs\\mindray\\mindraybc3600.xml'), array("equipment_name" => 'Selectra Junior', "comm_type" => 1, "equipment_version" => '', "lab_section" => 1, "feed_source" => 0, "config_file" => '\\BLISInterfaceClient\\configs\\selectrajunior\\selectrajunior.xml'), array("equipment_name" => 'GeneXpert', "comm_type" => 2, "equipment_version" => '', "lab_section" => 1, "feed_source" => 1, "config_file" => '\\BLISInterfaceClient\\configs\\geneXpert\\genexpert.xml'), array("equipment_name" => 'ABX Pentra 80', "comm_type" => 2, "equipment_version" => '', "lab_section" => 1, "feed_source" => 0, "config_file" => '\\BLISInterfaceClient\\configs\\pentra80\\abxpentra80.xml'), array("equipment_name" => 'Sysmex XT 2000i', "comm_type" => 1, "equipment_version" => '', "lab_section" => 1, "feed_source" => 1, "config_file" => '\\BLISInterfaceClient\\configs\\SYSMEX\\SYSMEXXT2000i.xml'), array("equipment_name" => 'Vitalex Flexor', "comm_type" => 1, "equipment_version" => '', "lab_section" => 1, "feed_source" => 1, "config_file" => '\\BLISInterfaceClient\\configs\\flexorE\\flexore.xml'));
     foreach ($equipment as $equip) {
         BlisClient::create($equip);
     }
     $this->command->info("Blis client table seeded");
     //  interfaced equipment properties
     $props = array(array("equip_id" => 1, "prop_id" => 1, "prop_value" => '5150', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 1, "prop_id" => 2, "prop_value" => 'client', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 1, "prop_id" => 3, "prop_value" => 'chameleon', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 1, "prop_id" => 4, "prop_value" => 'yes', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 3, "prop_id" => 5, "prop_value" => '10', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 3, "prop_id" => 6, "prop_value" => '9600', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 3, "prop_id" => 7, "prop_value" => 'None', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 3, "prop_id" => 8, "prop_value" => '1', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 3, "prop_id" => 9, "prop_value" => 'No', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 3, "prop_id" => 10, "prop_value" => '8', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 3, "prop_id" => 11, "prop_value" => 'No', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 2, "prop_id" => 12, "prop_value" => 'create ODBC datasource to the equipment db and put name here', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 2, "prop_id" => 13, "prop_value" => '0', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 4, "prop_id" => 5, "prop_value" => '10', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 4, "prop_id" => 6, "prop_value" => '9600', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 4, "prop_id" => 7, "prop_value" => 'None', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 4, "prop_id" => 8, "prop_value" => '1', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 4, "prop_id" => 9, "prop_value" => 'No', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 4, "prop_id" => 10, "prop_value" => '8', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 4, "prop_id" => 11, "prop_value" => 'No', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 5, "prop_id" => 1, "prop_value" => '5150', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 5, "prop_id" => 2, "prop_value" => 'server', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 5, "prop_id" => 3, "prop_value" => 'no', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 5, "prop_id" => 4, "prop_value" => 'set the Analyzer PC IP address here', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 6, "prop_id" => 14, "prop_value" => '', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 6, "prop_id" => 15, "prop_value" => '', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 6, "prop_id" => 16, "prop_value" => '', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 6, "prop_id" => 17, "prop_value" => '', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 6, "prop_id" => 18, "prop_value" => '', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 6, "prop_id" => 19, "prop_value" => '', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 7, "prop_id" => 5, "prop_value" => '10', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 7, "prop_id" => 6, "prop_value" => '9600', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 7, "prop_id" => 7, "prop_value" => 'None', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 7, "prop_id" => 8, "prop_value" => '1', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 7, "prop_id" => 9, "prop_value" => 'No', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 7, "prop_id" => 10, "prop_value" => '8', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 7, "prop_id" => 11, "prop_value" => 'No', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 8, "prop_id" => 5, "prop_value" => '10', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 8, "prop_id" => 6, "prop_value" => '9600', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 8, "prop_id" => 7, "prop_value" => 'None', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 8, "prop_id" => 8, "prop_value" => '1', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 8, "prop_id" => 9, "prop_value" => 'No', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 8, "prop_id" => 10, "prop_value" => '8', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 8, "prop_id" => 11, "prop_value" => 'No', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 9, "prop_id" => 1, "prop_value" => '5150', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 9, "prop_id" => 2, "prop_value" => 'server', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 9, "prop_id" => 3, "prop_value" => 'no', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 9, "prop_id" => 4, "prop_value" => 'set the Analyzer PC IP address here', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 10, "prop_id" => 5, "prop_value" => '10', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 10, "prop_id" => 6, "prop_value" => '9600', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 10, "prop_id" => 7, "prop_value" => 'None', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 10, "prop_id" => 8, "prop_value" => '1', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 10, "prop_id" => 9, "prop_value" => 'No', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 10, "prop_id" => 10, "prop_value" => '8', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 10, "prop_id" => 11, "prop_value" => 'No', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 11, "prop_id" => 1, "prop_value" => '5150', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 11, "prop_id" => 2, "prop_value" => 'server', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 11, "prop_id" => 3, "prop_value" => 'no', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 11, "prop_id" => 4, "prop_value" => 'set the Analyzer PC IP address here', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 12, "prop_id" => 1, "prop_value" => '5150', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 12, "prop_id" => 2, "prop_value" => 'server', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 12, "prop_id" => 3, "prop_value" => 'no', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')), array("equip_id" => 12, "prop_id" => 4, "prop_value" => 'set the Analyzer PC IP address here', "created_at" => date('Y-m-d H:i:s'), "updated_at" => date('Y-m-d H:i:s')));
     foreach ($props as $prop) {
         DB::table('equip_config')->insert($prop);
     }
     $this->command->info("Equipment config table seeded");
     /* Require Verifications table */
     RequireVerification::create(["verification_required" => "0", "verification_required_from" => '6:00 PM', 'verification_required_to' => '6:00 PM']);
     $this->command->info('Require Verifications table seeded');
 }
示例#2
0
 /**
  * Display a listing of Tests. Factors in filter parameters
  * The search string may match: patient_number, patient name, test type name, specimen ID or visit ID
  *
  * @return Response
  */
 public function index()
 {
     $fromRedirect = Session::pull('fromRedirect');
     if ($fromRedirect) {
         $input = Session::get('TESTS_FILTER_INPUT');
     } else {
         $input = Input::except('_token');
     }
     $searchString = isset($input['search']) ? $input['search'] : '';
     $testStatusId = isset($input['test_status']) ? $input['test_status'] : '';
     $dateFrom = isset($input['date_from']) ? $input['date_from'] : '';
     $dateTo = isset($input['date_to']) ? $input['date_to'] : '';
     // Search Conditions
     if ($searchString || $testStatusId || $dateFrom || $dateTo) {
         $testSet = Test::search($searchString, $testStatusId, $dateFrom, $dateTo);
         if (count($tests) == 0) {
             Session::flash('message', trans('messages.empty-search'));
         }
     } else {
         // List all the active tests
         $testSet = Test::orderBy('time_created', 'DESC');
     }
     // Create Test Statuses array. Include a first entry for ALL
     $testStatus = array('all') + TestStatus::all()->lists('name', 'id')->toArray();
     foreach ($testStatus as $key => $value) {
         $testStatus[$key] = trans("messages.{$value}");
     }
     // Pagination
     $testSet = $testSet->paginate(config('blis.page-items'))->appends($input);
     //	Barcode
     $barcode = Barcode::first();
     // Load the view and pass it the tests
     return view('test.index', compact('testSet', 'testStatus', 'barcode'))->withInput($input);
 }
示例#3
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index($id)
 {
     //	Get item
     $item = Item::find($id);
     //	Barcode
     $barcode = Barcode::first();
     //Load the view and pass the stocks
     return View::make('inventory.stock.index')->with('item', $item)->with('barcode', $barcode);
 }
示例#4
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     //show a Item
     $item = Item::find($id);
     //	Barcode
     $barcode = Barcode::first();
     //show the view and pass the $item to it
     return view('inventory.item.show')->with('item', $item)->with('barcode', $barcode);
 }
示例#5
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Barcode::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'num' => $this->num, 'status' => $this->status, 'create_at' => $this->create_at, 'update_at' => $this->update_at, 'pid' => $this->pid, 'uid' => Yii::$app->user->id]);
     $query->andFilterWhere(['like', 'barcode', $this->barcode]);
     return $dataProvider;
 }
示例#6
0
 /**
  * POST接收一个JSON数组
  * 保存单据数据
  */
 public function actionSave()
 {
     if (isset($_POST['jsonData'])) {
         $jsonData = $_POST['jsonData'];
     }
     if ($jsonData != null) {
         $json = array();
         $idArray = array();
         $dataArray = json_decode($jsonData);
         //解析JSON数据
         $sellnum = $dataArray[0]->sellnum;
         //第一个数组0 代表销售单据
         //查询单据号的所有的单据,用来比较是否更改数据
         $sell = Sell::find()->where(['uid' => Yii::$app->user->id, 'sellnum' => $sellnum])->all();
         $jsonCount = count($dataArray);
         //获取JSON数组总和
         $json['return_code'] = 1;
         for ($i = 1; $i < $jsonCount; $i++) {
             //数组0是单据号,所以 i 从1 开始循环
             $id = $dataArray[$i]->id;
             if ($id == 0) {
                 //表单JSON数据会提交一个 id,代表单据在数据的id,如果为0,是新数据
                 $model = new Sell();
                 //直接把数据保存在Model 在 model->save();
                 $model->sellnum = $sellnum;
                 $model->addnum = $dataArray[$i]->addnum;
                 $product = $dataArray[$i]->product;
                 $brand = explode('-', $product);
                 if (count($brand) == 1) {
                     $model->brand = $product;
                 } else {
                     $model->brand = $brand[0];
                     $model->model = $brand[1];
                 }
                 $model->count = $dataArray[$i]->count;
                 $model->price = $dataArray[$i]->price;
                 $model->addprice = $dataArray[$i]->addprice;
                 $model->oldprice = $dataArray[$i]->oldprice;
                 $model->color = $dataArray[$i]->color;
                 $model->barcode = $dataArray[$i]->barcode;
                 $model->supplier = $dataArray[$i]->supplier;
                 $model->warehouse = $dataArray[$i]->warehouse;
                 $model->remark = $dataArray[$i]->remark;
                 $model->employee = Yii::$app->user->identity->username;
                 $model->status = 0;
                 $model->pid = $dataArray[$i]->pid;
                 $model->uid = Yii::$app->user->id;
                 //检测是否填写客户信息,有的话保存在客户表tbl_customer,在把返回的客户ID 保存在出库单据cid上
                 if ($dataArray[$i]->custom != "" || $dataArray[$i]->tell != "") {
                     $customModel = new Customer();
                     if ($dataArray[$i]->custom == "") {
                         $customModel->name = "无";
                     } else {
                         $customModel->name = $dataArray[$i]->custom;
                     }
                     if ($dataArray[$i]->tell == "") {
                         $customModel->tell = "无";
                     } else {
                         $customModel->tell = $dataArray[$i]->tell;
                     }
                     $customModel->uid = Yii::$app->user->id;
                     $customModel->save();
                     //保存客户数据
                     $cid = $customModel->getAttribute('id');
                     //获取客户数据的ID
                     $model->cid = $cid;
                 }
                 $model->save();
                 $idArray[] = $model->getAttribute('id');
                 //更新条码为 出库状态 status=1
                 if ($dataArray[$i]->barcode != "") {
                     //如果产品有条码,更新条码数据库tab_barcode的状态为1,代表出库了
                     Barcode::updateAll(['status' => 1], 'barcode=:barcode', [':barcode' => $dataArray[$i]->barcode]);
                 }
             } else {
                 if ($id > 0) {
                     //大于0 代表数据已经在库,直接更新数据库
                     //先查询这个单据号的所以数据,用来循环比较表格数据
                     $timeNow = date('Y-m-d H:i:s', time());
                     //表格JSON数据 与 数据库查询数据循环比较,查找对应ID的数据
                     foreach ($sell as $item) {
                         //ID一样说明数据找到
                         if ($item->getAttribute('id') == $id) {
                             //获取客户ID
                             $cid = $item->getAttribute('cid');
                             //查询客户信息,对比表格输入数据是否有更改,然后update tbl_customer
                             if ($cid != null && $cid > 0) {
                                 $customModel = Customer::find()->where(['uid' => Yii::$app->user->id, 'id' => $cid])->one();
                                 if ($customModel->getAttribute('name') != $dataArray[$i]->custom) {
                                     Customer::updateAll(['name' => $dataArray[$i]->custom], 'id=:id', [':id' => $cid]);
                                 }
                                 if ($customModel->getAttribute('tell') != $dataArray[$i]->tell) {
                                     Customer::updateAll(['tell' => $dataArray[$i]->tell], 'id=:id', [':id' => $cid]);
                                 }
                             }
                             //数据库对比表格输入信息是否有更改,然后update tbl_sell
                             if ($item->getAttribute('count') != $dataArray[$i]->count || $item->getAttribute('price') != $dataArray[$i]->price || $item->getAttribute('remark') != $dataArray[$i]->remark) {
                                 Sell::updateAll(['count' => $dataArray[$i]->count, 'price' => $dataArray[$i]->price, 'remark' => $dataArray[$i]->remark], 'id=:id', [':id' => $id]);
                             }
                         }
                     }
                 }
             }
         }
         $json['idArray'] = $idArray;
         echo json_encode($json);
     }
 }
示例#7
0
 /**
  * Finds the Barcode model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Barcode the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Barcode::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#8
0
 public function actionDeletebill()
 {
     if (isset($_POST['id'])) {
         $id = $_POST['id'];
     }
     if ($id != null) {
         $uid = Yii::$app->user->id;
         Add::updateAll(['status' => 1], 'id=:id AND uid=:uid', [':id' => $id, ':uid' => $uid]);
         $add = Add::find()->where(['uid' => $uid, 'id' => $id])->one();
         if ($add) {
             $barcode = $add->getAttribute('barcode');
             $codeArray = explode(",", $barcode);
             for ($i = 0; $i < count($codeArray); $i++) {
                 Barcode::updateAll(['del' => 1, 'uid' => $uid], 'barcode=:barcode', [':barcode' => $codeArray[$i]]);
             }
         }
     }
 }
示例#9
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     // Update
     $barcode = Barcode::find($id);
     $barcode->encoding_format = Input::get('encoding_format');
     $barcode->barcode_width = Input::get('barcode_width');
     $barcode->barcode_height = Input::get('barcode_height');
     $barcode->text_size = Input::get('text_size');
     $barcode->save();
     // redirect
     $url = Session::get('SOURCE_URL');
     return redirect()->to($url)->with('message', trans('messages.barcode-update-success'))->with('activebarcode', $barcode->id);
 }