//EOF Web28 - 2010-12-06 - read customer status earlier
 // Errechne neue Zwischensumme für Artikel Anfang
 $products_query = xtc_db_query("select SUM(final_price) as subtotal_final from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int) $_POST['oID'] . "' ");
 $products = xtc_db_fetch_array($products_query);
 $subtotal_final = $products['subtotal_final'];
 $subtotal_text = $xtPrice->xtcFormat($subtotal_final, true);
 xtc_db_query("update " . TABLE_ORDERS_TOTAL . " set text = '" . $subtotal_text . "', value = '" . $subtotal_final . "' where orders_id = '" . (int) $_POST['oID'] . "' and class = 'ot_subtotal' ");
 // Errechne neue Zwischensumme für Artikel Ende
 //BOF####### Produkte #######//
 $products_query = xtc_db_query("select final_price, products_tax, allow_tax from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int) $_POST['oID'] . "' ");
 while ($products = xtc_db_fetch_array($products_query)) {
     $tax_rate = $products['products_tax'];
     if ($products['allow_tax'] == '1') {
         $bprice = $products['final_price'];
         $nprice = $xtPrice->xtcRemoveTax($bprice, $tax_rate);
         $tax = $xtPrice->calcTax($nprice, $tax_rate);
     } else {
         $nprice = $products['final_price'];
         $bprice = $xtPrice->xtcAddTax($nprice, $tax_rate);
         $tax = $xtPrice->calcTax($nprice, $tax_rate);
     }
     $sql_data_array = array('orders_id' => (int) $_POST['oID'], 'n_price' => xtc_db_prepare_input($nprice), 'b_price' => xtc_db_prepare_input($bprice), 'tax' => xtc_db_prepare_input($tax), 'tax_rate' => xtc_db_prepare_input($products['products_tax']));
     $insert_sql_data = array('class' => 'products');
     $sql_data_array = xtc_array_merge($sql_data_array, $insert_sql_data);
     xtc_db_perform(TABLE_ORDERS_RECALCULATE, $sql_data_array);
 }
 //EOF####### Produkte #######//
 //BOF#######  Produkte Steuersätze  #######//
 $tax_query = xtc_db_query("SELECT tax_rate, SUM(tax) as tax_value\n                               FROM " . TABLE_ORDERS_RECALCULATE . "\n                              WHERE orders_id = '" . (int) $_POST['oID'] . "'\n                                AND class = 'products'\n                           GROUP BY tax_rate\n                            ");
 while ($tax = xtc_db_fetch_array($tax_query)) {
     $sql_data_array = array('orders_id' => (int) $_POST['oID'], 'tax' => xtc_db_prepare_input($tax['tax_value']), 'tax_rate' => xtc_db_prepare_input($tax['tax_rate']), 'class' => 'ot_tax');