echo "prescrServ: " . $_GET['prescrServ'];
}
$i = 0;
if ($mode == 'delete') {
    $arr_item_number[0] = $nr;
}
foreach ($arr_item_number as $item_number) {
    $dosage = $arr_dosage[$i];
    $times_per_day = $arr_timesperday[$i];
    $days = $arr_days[$i];
    $total_dosage = $arr_total_dosage[$i];
    $notes = $arr_notes[$i];
    $article_item_number = $arr_article_item_number[$i];
    $price = $arr_price[$i];
    $article = $arr_article[$i];
    $drug_class = $presc_obj->GetClassOfItemFromItemNo($article_item_number);
    $is_labtest = $arr_is_labtest[$i];
    $is_medicine = $arr_is_medicine[$i];
    $is_radio_test = $arr_is_radio_test[$i];
    $is_service = $arr_is_service[$i];
    $i++;
    //$obj->setDataArray($_POST);
    switch ($mode) {
        case 'create':
            $sql = "INSERT INTO care_encounter_prescription (\n  \t\t                          `encounter_nr`,\n  \t\t                          `prescription_type_nr`,\n  \t\t                          `article`,\n  \t\t                          `article_item_number`,\n  \t\t                          `price`,\n  \t\t                          `drug_class`,\n\t\t\t\t\t\t\t\t  `dosage`,\n\t\t\t\t\t\t\t\t  `times_per_day`,\n\t\t\t\t\t\t\t\t  `days`,\n\t\t\t\t\t\t\t\t  `total_dosage`,\n  \t\t                          `application_type_nr`,\n  \t\t                          `notes`,\n  \t\t                          `prescribe_date`,\n  \t\t                          `prescriber`,\n  \t\t                          `is_outpatient_prescription`,\n  \t\t                          `history`,\n  \t\t                          `modify_id`)\n\n  \t\t                          VALUES (\n  \t\t                          '" . $encounter_nr . "',\n  \t\t                          0,\n  \t\t                          '" . $article . "',\n  \t\t                          '" . $article_item_number . "',\n  \t\t                          '" . $price . "',\n  \t\t                          '" . $drug_class . "',\n\t\t\t\t\t\t\t\t  '" . $dosage . "',\n\t\t\t\t\t\t\t\t  '" . $times_per_day . "',\n\t\t\t\t\t\t\t\t  '" . $days . "',\n  \t\t                          '" . $total_dosage . "',\n  \t\t                          0,\n  \t\t                          '" . $notes . "',\n  \t\t                          '" . date('Y-m-d', time()) . "',\n  \t\t                          '" . $prescriber . "',\n  \t\t                          1,\n  \t\t                          '" . $history . "',\n  \t\t                          ''\n  \t\t                          )";
            $db->Execute($sql);
            //*******
            // Load the visual signalling functions
            include_once $root_path . 'include/inc_visual_signalling_fx.php';
            if ($presc_obj->GetClassOfItem($article_item_number) == 'drug_list') {
                // Set the visual signal