echo "Radiology: allocate2insurance(" . $new_bill_number . ", {$radtest_nr}," . $_POST['insurance'] . ");";
             }
             if ($debug) {
                 echo "radtest nr." . $radtest_nr . "<br>";
             }
             if ($debug) {
                 echo "billnumber: {$new_bill_number}<br>";
             }
             //if ($debug) echo "radtest nr.: ".$_POST['insurance_'.$radtest_nr]."<br>";
             if ($debug) {
                 echo "insurance: " . $_POST['insurance'] . "<br>";
             }
             $bill_obj->StoreRadiologyItemToBill($pid, $radtest_nr, $new_bill_number, $_POST['insurance_' . $radtest_nr], $_GET['unit_price']);
             $bill_obj->UpdateBillNumberNewRadiology($radtest_nr, $new_bill_number);
             if ($_POST['insurance'] != -1) {
                 $insurance_obj->allocateRadiologyItemsToinsurance($new_bill_number, $radtest_nr, $_POST['showprice_' . $radtest_nr], $_POST['insurance']);
             }
         } elseif ($_POST['moderad_' . $radtest_nr] == 'delete') {
             $deletecounter++;
             //Hmm, lets kick this one out!
             $bill_obj->DeleteNewRadiology($radtest_nr, 'Disabled by billing officer');
         }
     }
 }
 if ($billcounter) {
     $sql = 'select pid FROM care_encounter where encounter_nr=' . $encounter_nr;
     $result = $db->Execute($sql);
     $row = $result->FetchRow();
     $batch_nr = $row['pid'];
     if ($clear_bill) {
         if ($balance < 0) {