}
     }
     break;
 case 'delete':
     if ($security_level < 4) {
         $messageStack->add_session(ERROR_NO_PERMISSION, 'error');
         gen_redirect(html_href_link(FILENAME_DEFAULT, gen_get_all_get_params(array('action')), 'SSL'));
         break;
     }
     $id = (int) db_prepare_input($_POST['rowSeq']);
     $result = $db->Execute("select id from " . TABLE_JOURNAL_MAIN . " \r\n\t\twhere bill_acct_id = " . $id . " or ship_acct_id = " . $id . " or store_id = " . $id);
     if ($result->RecordCount() == 0) {
         $db->Execute("delete from " . TABLE_ADDRESS_BOOK . " where ref_id = " . $id);
         $db->Execute("delete from " . TABLE_DATA_SECURITY . " where ref_1 = " . $id);
         $db->Execute("delete from " . TABLE_CONTACTS . " where id = " . $id);
         gen_add_audit_log(ACT_LOG_DELETE_ACCOUNT . constant('ACT_' . strtoupper($type) . '_TYPE_NAME'), gen_get_account_name($id));
         gen_redirect(html_href_link(FILENAME_DEFAULT, gen_get_all_get_params(array('action')), 'SSL'));
     }
     $messageStack->add(ACT_ERROR_CANNOT_DELETE, 'error');
     break;
 case 'go_first':
     $_GET['page'] = 1;
     break;
 case 'go_previous':
     $_GET['page']--;
     break;
 case 'go_next':
     $_GET['page']++;
     break;
 case 'go_last':
     $_GET['page'] = 99999;
        //  case '21':
        break;
    case '9':
    case '10':
    case '12':
        //  case  '19':
        // check for stock available for SO, Customer Quote and Sales
        if ($qty > $inventory->fields['branch_qty_in_stock'] && strpos(COG_ITEM_TYPES, $inventory->fields['inventory_type']) !== false) {
            $stock_note = array(ORD_INV_STOCK_LOW);
            $stock_note[] = ORD_INV_STOCK_BAL . $inventory->fields['branch_qty_in_stock'];
            // fetch open orders
            $sku_history = gather_history($inventory->fields['sku']);
            if (is_array($sku_history['open_po'])) {
                $stock_note[] = ORD_INV_OPEN_POS;
                foreach ($sku_history['open_po'] as $value) {
                    $store = $value['store_id'] ? gen_get_account_name($value['store_id']) : COMPANY_NAME;
                    // get name from id
                    $stock_note[] = sprintf(ORD_INV_STOCK_STATUS, $store, $value['purchase_invoice_id'], $value['qty'], gen_spiffycal_db_date_short($value['date_1']));
                }
            }
        }
        break;
    case '7':
    case '13':
    default:
}
//put it all together
// echo back some submitted values
$xml .= xmlEntry("qty", $qty);
if ($cID) {
    $xml .= xmlEntry("cID", $cID);
// | published by the Free Software Foundation, either version 3 of  |
// | the License, or any later version.                              |
// |                                                                 |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of  |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   |
// | GNU General Public License for more details.                    |
// |                                                                 |
// | The license that is bundled with this package is located in the |
// | file: /doc/manual/ch01-Introduction/license.html.               |
// | If not, see http://www.gnu.org/licenses/                        |
// +-----------------------------------------------------------------+
//  Path: /modules/accounts/pages/main/template_i_general.php
//
// some setup
$acct_def = !$cInfo->dept_rep_id ? array() : array(array('id' => $cInfo->dept_rep_id, 'text' => gen_get_account_name($cInfo->dept_rep_id)));
// *********************** Display account information ******************************
?>

<div id="cat_general" class="tabset_content">
  <h2 class="tabset_label"><?php 
echo TEXT_GENERAL;
?>
</h2>
  <fieldset class="formAreaTitle">
    <legend><?php 
echo ACT_CATEGORY_CONTACT;
?>
</legend>
    <table width="100%" class="formArea" border="0" cellspacing="2" cellpadding="2">
      <tr>