if ($task == "insert") { if ($debug) { echo "TASK:INSERT"; } $deletecounter = 0; while (list($x, $v) = each($_POST)) { //echo print_r($_POST); if ($debug) { echo "looking for: " . $x . " " . $v . "<br>"; } if (strstr($x, "modepres_")) { $prescriptions_nr = substr(strrchr($x, "_"), 1); $dosageNew = $_POST['dosage_' . $prescriptions_nr]; $timesPerDayNew = $_POST['times_per_day_' . $prescriptions_nr]; $daysNew = $_POST['days_' . $prescriptions_nr]; $result = $bill_obj->GetNewQuotation_Prescriptions($encounter_nr, $in_outpatient); //$sqlQuery = "SELECT dosage, times_per_day, days, price, bill_number, drug_class FROM care_encounter_prescription WHERE nr=$prescriptions_nr"; //$result=$db->Execute($sqlQuery); if ($result) { $row = $result->FetchRow(); } $dosageOld = $row['dosage']; $timesPerDayOld = $row['times_per_day']; $daysOld = $row['days']; $old_bill_nr = $row['bill_number']; $drug_class = $row['drug_class']; $comment = $_POST['notes_' . $prescriptions_nr]; $user = $_SESSION['sess_user_name']; if ($_POST['modepres_' . $prescriptions_nr] == 'bill') { $billcounter++; //Okay, this one has to be billed!