function new_reg($encounter, $reg, $prescriber)
 {
     global $db;
     $debug = false;
     $debug ? $db->debug = TRUE : ($db->debug = FALSE);
     $this->sql = "SELECT `item_id`, `item_number`,`item_description`, `unit_price` FROM care_tz_drugsandservices where item_description='" . $reg . "'";
     $this->request = $db->Execute($this->sql);
     while ($this->res = $this->request->FetchRow()) {
         $item_id = $this->res['item_id'];
         $item_number = $this->res['item_number'];
         $item_description = $this->res['item_description'];
         $unit_price = $this->res['unit_price'];
         $this->sql = "insert into {$this->tbl_prescriptions} (encounter_nr,article,article_item_number,price,prescribe_date,prescriber,history,modify_time,dosage,total_dosage)values('" . $encounter . "','" . $item_description . "','" . $item_id . "','" . $unit_price . "','" . date('Y-m-d') . "','" . $prescriber . "','" . date('Y-m-d H:i:s') . "','" . date('Y-m-d H:i:s') . "','1','1')";
         #$this->sql="insert into tbl_prescriptions(encounter_nr)values('".$encounter."')";
         $db->Execute($this->sql);
         $this->sql = 'select max(nr) from ' . $this->tbl_prescriptions . ' where encounter_nr=' . $encounter;
         $result = $db->Execute($this->sql);
         $WONumberArray = $result->FetchRow();
         $WONumber = $WONumberArray[0];
         if ($is_transmit_to_weberp_enable == 1) {
             $weberp_obj = new_weberp();
             $weberp_obj->make_patient_workorder_in_webERP($WONumber);
             $weberp_obj->issue_to_patient_workorder_in_weberp($WONumber, $item_number, $weberp_obj->defaultLocation, '1', '');
             destroy_weberp($weberp_obj);
         }
     }
     return TRUE;
 }
示例#2
0
 function insert_prescription($encounter_nr, $drug_list_id, $type)
 {
     global $db;
     global $is_transmit_to_weberp_enable;
     $enc_obj = new Encounter();
     $diag_obj_sub = new Diagnostics();
     $diag_obj = new Diagnostics();
     $drg_obj = new DrugsAndServices();
     $debug = true;
     $debug ? $db->debug = TRUE : ($db->debug = FALSE);
     if ($debug) {
         echo "class prescription::insert_prescription({$encounter_nr}, {$drug_list_id}, {$type})<br>";
     }
     $enc_class = $enc_obj->EncounterClass($encounter_nr);
     if ($enc_class == 2) {
         $class = 1;
     } else {
         $class = 0;
     }
     $this->sql = "INSERT INTO `care_encounter_prescription` ( " . "\t\t\t" . "\t\t\t`encounter_nr` , " . "\t\t\t`prescription_type_nr` , " . "\t\t\t`article` , " . "\t\t\t`article_item_number` , " . "\t\t\t`price` , " . "\t\t\t`drug_class` , " . "\t\t\t`order_nr` , " . "\t\t\t`dosage` , " . "\t\t\t`times_per_day` , " . "\t\t\t`days` , " . "\t\t\t`application_type_nr` , " . "\t\t\t`notes` , " . "\t\t\t`prescribe_date` , " . "\t\t\t`prescriber` , " . "\t\t\t`color_marker` , " . "\t\t\t`is_stopped` , " . "\t\t\t`is_outpatient_prescription` , " . "\t\t\t`is_disabled` , " . "\t\t\t`stop_date` , " . "\t\t\t`status` , " . "\t\t\t`history` , " . "\t\t\t`bill_number` , " . "\t\t\t`bill_status` , " . "\t\t\t`modify_id` , " . "\t\t\t`modify_time` , " . "\t\t\t`create_id` , " . "\t\t\t`create_time` )" . "VALUES (" . "\t\t\t" . "\t\t\t'" . $encounter_nr . "', " . "\t\t\t'" . $this->GetClassOfItem($this->GetItemNumberByID($drug_list_id)) . "', " . "\t\t\t'" . $this->GetNameOfItem($this->GetItemNumberByID($drug_list_id)) . "', " . "\t\t\t'" . $drug_list_id . "', " . "\t\t\t'" . $this->GetPriceOfItem($this->GetItemNumberByID($drug_list_id)) . "', " . "\t\t\t'" . $this_obj->GetClassOfItem($this->getItemNumberByID($drug_list_id)) . "', " . "\t\t\t'01', " . "\t\t\t'1', " . "\t\t\t'1', " . "\t\t\t'1', " . "\t\t\t'01', " . "\t\t\t'0', " . "\t\t\tNOW(), " . "\t\t\t'" . $enc_obj->ConsultingDr($encounter_nr) . "', " . "\t\t\t'1', " . "\t\t\t'0', " . "\t\t\t'" . $class . "', " . "\t\t\tNULL , " . "\t\t\tNULL , " . "\t\t\t'pending', " . "\t\t\t'Create: '" . date('Y-m-d H:i:s') . "' = '" . $_SESSION['sess_user_name'] . "'\n' , " . "\t\t\t'0', " . "\t\t\t'', " . "\t\t\t'', " . "\t\t\t'0000-00-00 00:00:00', " . "\t\t\t'" . $_SESSION['sess_user_name'] . "', " . "\t\t\t NOW() )";
     if ($debug) {
         echo $this->sql;
     }
     $db->Execute($this->sql);
     if ($is_transmit_to_weberp_enable == 1) {
         $this->sql = 'select max(nr) from care_encounter_prescription where encounter_nr="' . $encounter_nr . '"';
         $result = $db->Execute($this->sql);
         $WONumberArray = $result->FetchRow();
         $WONumber = $WONumberArray[0];
         $weberp_obj = new_weberp();
         $weberp_obj->make_patient_workorder_in_webERP($WONumber);
         //			$weberp_obj->issue_to_patient_workorder_in_weberp($WONumber, $StockID, $Location, $Quantity, $Batch);
         weberp_destroy($weberp_obj);
     }
     return TRUE;
 }
示例#3
0
     }
     /*if ($referrer_notes=='') { $errorbesonder=1; $error=1; $errornum++;};
     
     	                  $encounter_class_nr=trim($encounter_class_nr);
     
     					  if ($encounter_class_nr=='') { $errorstatus=1; $error=1; $errornum++;};
     
     			          if($insurance_show) {
                               if(trim($insurance_nr) &&  trim($insurance_firm_name)=='') { $error_ins_co=1; $error=1; $errornum++;}
     		              }
     	           */
 }
 if (!$error) {
     if ($is_transmit_to_weberp_enable == 1) {
         $persondata = $person_obj->getAllInfoArray();
         $weberp_obj = new_weberp();
         if (!$weberp_obj->transfer_patient_to_webERP_asCustomer($pid, $persondata)) {
             $person_obj->setPatientIsTransmit2ERP($pid, 0);
         } else {
             $person_obj->setPatientIsTransmit2ERP($pid, 1);
         }
         destroy_weberp($weberp_obj);
     }
     if (!$GLOBAL_CONFIG['patient_service_care_hide']) {
         if (!empty($sc_care_start)) {
             $sc_care_start = formatDate2Std($sc_care_start, $date_format);
         }
         if (!empty($sc_care_end)) {
             $sc_care_end = formatDate2Std($sc_care_end, $date_format);
         }
         $care_class = compact('sc_care_nr', 'sc_care_class_nr', 'sc_care_start', 'sc_care_end', 'encoder');
示例#4
0
 function GetSubClassOfItem($item_number)
 {
     global $db;
     global $is_transmit_to_weberp_enable;
     $debug = FALSE;
     $debug ? $db->debug = TRUE : ($db->debug = FALSE);
     if ($is_transmit_to_weberp_enable == 1) {
         $this->sql = 'SELECT partcode from care_tz_drugsandservices where item_id=' . $item_number;
         if ($this->result = $db->Execute($this->sql)) {
             if ($this->result->RecordCount()) {
                 $this->row = $this->result->GetArray();
                 $weberp_obj = new_weberp();
                 $property = $weberp_obj->getStockCatProperty('1', $this->row[0]['partcode']);
                 switch ($property) {
                     case 'Tablets':
                         return 'tabs';
                         break;
                     case 'Injections':
                         return 'injections';
                         break;
                     case 'Syrups':
                         return 'syrups';
                         break;
                     case 'Suspensions':
                         return 'suspensions';
                         break;
                     case 'Others':
                         return 'others';
                         break;
                     case '':
                         return '';
                         break;
                     default:
                         return '';
                 }
             } else {
                 return '';
             }
         }
     } else {
         $this->sql = "SELECT sub_class FROM {$this->tb_drugsandservices} WHERE item_id = '{$item_number}' ";
         if ($this->result = $db->Execute($this->sql)) {
             if ($this->result->RecordCount()) {
                 $this->item_array = $this->result->GetArray();
                 while (list($x, $v) = each($this->item_array)) {
                     $db->debug = FALSE;
                     return $v['sub_class'];
                 }
             } else {
                 $db->debug = FALSE;
                 return false;
             }
         }
     }
 }