function add_ctambon() { $cfg_main = Sysconfigmain::find()->one(); $sql = "DROP TABLE IF EXISTS cctambon_amp;"; \yii::$app->db->createCommand($sql)->execute(); echo $sql = "CREATE TABLE ctambon_amp SELECT * from ctambon tb \n WHERE tb.ampurcode = '{$cfg_main->provcode}{$cfg_main->distcode}'"; \yii::$app->db->createCommand($sql)->execute(); return; }
public function create_event() { $this->exec_sql("SET GLOBAL event_scheduler = ON;"); $this->exec_sql("DROP EVENT IF EXISTS event1;"); $this->exec_sql("DROP EVENT IF EXISTS event2;"); $this->exec_sql("DROP EVENT IF EXISTS event3;"); $this->exec_sql("DROP EVENT IF EXISTS event4;"); $bdg = '2014-09-30'; $model = \app\models\Sysconfigmain::find()->one(); if ($model) { $bdg = $model->note2; } $bdg = "'" . $bdg . "'"; $y = date('Y'); $t = SysSetTime::find()->one(); if (count($t) > 0) { $date = date('Y-m-d'); $time = $t->event_time; $days = $t->days; $sql = "CREATE EVENT event1\r\n ON SCHEDULE EVERY '{$days}' DAY\r\n STARTS '{$date} {$time}'\r\n DO BEGIN\n\n"; $sql .= $this->call("start_process", NULL); $sql .= $this->call("clear_import_not_success", NULL); $sql .= $this->call("clear_null_hospcode", NULL); $sql .= $this->call("clear_upload_error", NULL); $sql .= $this->call("merge_newborncare", NULL); $sql .= $this->call("cal_chart_dial_1", $bdg); $sql .= $this->call("cal_chart_dial_2", $bdg); $sql .= $this->call("cal_chart_dial_3", $bdg); $sql .= $this->call("cal_chart_dial_4", NULL); $sql .= $this->call("cal_chart_dial_5", NULL); $sql .= $this->call("cal_chart_dial_6", NULL); $sql .= $this->call("cal_ncd_cholesteral_colorchart", $bdg); $sql .= $this->call("cal_ncd_nocholesteral_colorchart", $bdg); $sql .= $this->call("cal_pyramid_level_1", $bdg); $sql .= $this->call("cal_pyramid_level_2"); $sql .= $this->call("cal_pyramid_level_3"); $sql .= $this->call("cal_sys_person_type"); $sql .= $this->call("cal_count_service", $y - 1); $sql .= $this->call("cal_count_service", $y); $sql .= $this->call("cal_rpt_visit_oldman", $y - 1); $sql .= $this->call("cal_rpt_visit_oldman", $y); //รายงานแผนไทย-knott $sql .= $this->call("cal_rpt_panth_visit_ratio", $y - 1); $sql .= $this->call("cal_rpt_panth_visit_ratio", $y); $sql .= $this->call("cal_rpt_panth_drug_value", $y - 1); $sql .= $this->call("cal_rpt_panth_drug_value", $y); $sql .= $this->call("cal_rpt_cervical_cancer_screening", $y - 1); $sql .= $this->call("cal_rpt_cervical_cancer_screening", $y); //จบ ใส่ store $sql .= $this->call("end_process", NULL); $sql .= "\nEND;"; $this->exec_sql($sql); } }
public function actionProcessreport() { $running = \app\models\SysProcessRunning::find()->one(); if ($running->is_running == 'false') { //$running->is_running = 'true'; //$running->update(); //ใส่ store; $this->call("start_process", NULL); $bdg = '2014-09-30'; $model = \app\models\Sysconfigmain::find()->one(); if ($model) { $bdg = $model->note2; } $bdg = "'" . $bdg . "'"; $this->call("merge_newborncare", NULL); $this->call("clear_upload_error", NULL); $this->call("clear_null_hospcode", NULL); //$this->call("cal_chart_dial_1", $bdg); $this->call("cal_chart_dial_2", $bdg); $this->call("cal_chart_dial_3", $bdg); $this->call("cal_chart_dial_4", NULL); //$this->call("cal_chart_dial_5", NULL); $this->call("cal_chart_dial_6", NULL); $this->call("cal_ncd_cholesteral_colorchart", $bdg); $this->call("cal_ncd_nocholesteral_colorchart", $bdg); $this->call("cal_pyramid_level_1", $bdg); $this->call("cal_pyramid_level_2"); $this->call("cal_pyramid_level_3"); $this->call("cal_sys_person_type"); $y = date('Y'); $this->call("cal_count_service", $y - 1); $this->call("cal_count_service", $y); $this->call("cal_rpt_visit_oldman", $y - 1); $this->call("cal_rpt_visit_oldman", $y); //รายงานแผนไทย-knott $this->call("cal_rpt_panth_visit_ratio", $y - 1); $this->call("cal_rpt_panth_visit_ratio", $y); $this->call("cal_rpt_panth_drug_value", $y - 1); $this->call("cal_rpt_panth_drug_value", $y); $this->call("cal_rpt_cervical_cancer_screening", $y - 1); $this->call("cal_rpt_cervical_cancer_screening", $y); $this->call("cal_rpt_breast_cancer_screening", $y - 1); $this->call("cal_rpt_breast_cancer_screening", $y); // sos store $this->call("cal_chart_dial_7", $bdg); $this->call("cal_chart_dial_8", $bdg); $this->call("cal_chart_dial_9", NULL); $this->call("end_process", NULL); // //จบใส่ store //$running->is_running = 'false'; // $running->update(); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Sysconfigmain::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'provcode', $this->provcode])->andFilterWhere(['like', 'distcode', $this->distcode])->andFilterWhere(['like', 'district_code', $this->district_code])->andFilterWhere(['like', 'district_name', $this->district_name])->andFilterWhere(['like', 'note1', $this->note1])->andFilterWhere(['like', 'note2', $this->note2])->andFilterWhere(['like', 'note3', $this->note3])->andFilterWhere(['like', 'note4', $this->note4])->andFilterWhere(['like', 'note5', $this->note5]); return $dataProvider; }