Example #1
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;
 }
Example #2
0
 function insert_prescription($encounter_nr, $drug_list_id, $type)
 {
     global $db;
     global $is_transmit_to_weberp_enable;
     if ($type == 1) {
         $sql = 'select item_id from care_tz_drugsandservices where item_number="' . $drug_list_id . '"';
         $result = $db->Execute($sql);
         $row = $result->FetchRow();
         $item = $row['item_id'];
     } else {
         $item = $drug_list_id;
     }
     $enc_obj = new Encounter();
     //$diag_obj_sub = new Diagnostics;
     //$diag_obj = new Diagnostics;
     $debug = false;
     $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 " . $this->tb . " (\n\t\t\t`nr`,\n\t\t\t`encounter_nr` ,\n\t\t\t`prescription_type_nr` ,\n\t\t\t`article` ,\n\t\t\t`article_item_number` ,\n\t\t\t`price` ,\n\t\t\t`drug_class` ,\n\t\t\t`order_nr` ,\n\t\t\t`dosage` ,\n\t\t\t`times_per_day` ,\n\t\t\t`days` ,\n\t\t\t`total_dosage` ,\n\t\t\t`application_type_nr` ,\n\t\t\t`notes` ,\n\t\t\t`prescribe_date` ,\n\t\t\t`prescriber` ,\n\t\t\t`color_marker` ,\n\t\t\t`is_stopped` ,\n\t\t\t`is_outpatient_prescription` ,\n\t\t\t`is_disabled` ,\n\t\t\t`stop_date` ,\n\t\t\t`status` ,\n\t\t\t`history` ,\n\t\t\t`bill_number` ,\n\t\t\t`bill_status` ,\n\t\t\t`modify_id` ,\n\t\t\t`modify_time` ,\n\t\t\t`create_id` ,\n\t\t\t`create_time` )\n\t\tVALUES (\n\t\t\tnull,\n\t\t\t'" . $encounter_nr . "',\n\t\t\t'0',\n\t\t\t'" . $this->GetNameOfItem($item) . "',\n\t\t\t'" . $item . "',\n\t\t\t'" . $this->GetPriceOfItem($item) . "',\n\t\t\t'" . $this->GetClassOfItem($item) . "',\n\t\t\t'01',\n\t\t\t'1',\n\t\t\t'1',\n\t\t\t'1',\n\t\t\t'1',\n\t\t\t'01',\n\t\t\t'0',\n\t\t\tNOW(),\n\t\t\t'" . $_SESSION['sess_user_name'] . "',\n\t\t\t'1',\n\t\t\t'0',\n\t\t\t'" . $class . "',\n\t\t\tNULL ,\n\t\t\tNULL ,\n\t\t\t'pending',\n\t\t\t'Create: " . date('Y-m-d H:i:s') . " = " . $_SESSION['sess_user_name'] . "'\n ,\n\t\t\t'0',\n\t\t\t'',\n\t\t\t'',\n\t\t\t'" . date('Y-m-d H:i:s') . "',\n\t\t\t'" . $_SESSION['sess_user_name'] . "',\n\t\t\tNOW()\n\t\t)";
     //echo $this->sql;
     if ($debug) {
         echo $this->sql;
     }
     $db->Execute($this->sql);
     if ($is_transmit_to_weberp_enable) {
         $this->sql = 'select partcode from ' . $this->tb_drugsandservices . ' where item_id="' . $drug_list_id . '"';
         $result = $db->Execute($this->sql);
         $itemrow = $result->FetchRow();
         $WONumber = $WONumberArray[0];
         $weberp_obj = new_weberp();
         $weberp_obj->stock_adjustment_in_webERP($WONumber);
         weberp_destroy($weberp_obj);
     }
     return TRUE;
 }