예제 #1
0
 public function save()
 {
     $creator_id = $this->session->userdata('user_id');
     $source = $this->session->userdata('facility');
     $source = new Visit_Purpose();
     $source->Name = $this->input->post('source_name');
     $source->Active = "1";
     $source->save();
     $this->session->set_userdata('msg_success', $this->input->post('source_name') . ' was Added');
     $this->session->set_flashdata('filter_datatable', $this->input->post('source_name'));
     //Filter datatable
     redirect('settings_management');
 }
예제 #2
0
 public function synchronize_patients()
 {
     $data['regimens'] = Regimen::getAll();
     $data['supporters'] = Supporter::getAll();
     $data['service_types'] = Regimen_Service_Type::getAll();
     $data['sources'] = Patient_Source::getAll();
     $data['drugs'] = Drugcode::getAll();
     $data['regimen_change_purpose'] = Regimen_Change_Purpose::getAll();
     $data['visit_purpose'] = Visit_Purpose::getAll();
     $data['opportunistic_infections'] = Opportunistic_Infection::getAll();
     $data['regimen_drugs'] = Regimen_Drug::getAll();
 }
예제 #3
0
 public function edit($record_no)
 {
     $facility_code = $this->session->userdata('facility');
     $ccc_id = '2';
     $sql = "select pv.*,p.first_name,p.other_name,p.last_name,p.id as p_id " . "from patient_visit pv," . "patient p " . "where pv.id='{$record_no}' " . "and pv.patient_id=p.patient_number_ccc " . "and facility='{$facility_code}'";
     $query = $this->db->query($sql);
     $results = $query->result_array();
     //print_r($results);
     if ($results) {
         $data['results'] = $results;
         //Get expriry date the batch
         foreach ($results as $value) {
             $batch_number = $value['batch_number'];
             $drug_ig = $value['drug_id'];
             $ccc_id = $value['ccc_store_sp'];
             $sql = "select expiry_date FROM drug_stock_balance WHERE batch_number='{$batch_number}' AND drug_id='{$drug_ig}' AND stock_type='{$ccc_id}' AND facility_code='{$facility_code}' LIMIT 1";
             $expiry_sql = $this->db->query($sql);
             $expiry_array = $expiry_sql->result_array();
             $expiry_date = "";
             $data['expiries'] = $expiry_array;
             foreach ($expiry_array as $row) {
                 $expiry_date = $row['expiry_date'];
                 //print_r($expiry_date);
                 $data['original_expiry_date'] = $expiry_date;
             }
         }
     } else {
         $data['results'] = "";
     }
     $data['purposes'] = Visit_Purpose::getAll();
     $data['record'] = $record_no;
     $data['ccc_id'] = $ccc_id;
     $data['regimens'] = Regimen::getRegimens();
     $data['non_adherence_reasons'] = Non_Adherence_Reasons::getAllHydrated();
     $data['regimen_changes'] = Regimen_Change_Purpose::getAllHydrated();
     $data['doses'] = Dose::getAllActive();
     $data['indications'] = Opportunistic_Infection::getAllHydrated();
     $data['content_view'] = 'edit_dispensing_v';
     $data['hide_side_menu'] = 1;
     $this->base_params($data);
 }