<?php require_once('Connections/t77_connect.php'); ?><?
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
if($_GET['delete'] == 'item') {
if ((isset($HTTP_GET_VARS['item_id'])) && ($HTTP_GET_VARS['item_id'] != "")) {
$deleteSQL = sprintf("DELETE FROM t77_bill_items WHERE item_id=%s",
GetSQLValueString($HTTP_GET_VARS['item_id'], "int"));
mysql_select_db($database_t77_connect, $t77_connect);
$Result1 = mysql_query($deleteSQL, $t77_connect) or die(mysql_error());
$deleteGoTo = "items.php?id=" . $_GET['billid'] . "&reload=yes";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
$colname_delete_item = "0";
if (isset($_GET['id'])) {
$colname_delete_item = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}
mysql_select_db($database_t77_connect, $t77_connect);
$query_delete_item = sprintf("SELECT * FROM t77_bill_items WHERE t77_bill_items.item_id = %s", $colname_delete_item);
$delete_item = mysql_query($query_delete_item, $t77_connect) or die(mysql_error());
$row_delete_item = mysql_fetch_assoc($delete_item);
$totalRows_delete_item = mysql_num_rows($delete_item);
}
?><?
if($_GET['delete'] == 'bill') {
if ((isset($HTTP_GET_VARS['bill_id'])) && ($HTTP_GET_VARS['bill_id'] != "")) {
$deleteSQL = sprintf("DELETE FROM t77_bill_bills WHERE bill_id=%s",
GetSQLValueString($HTTP_GET_VARS['bill_id'], "int"));
mysql_select_db($database_t77_connect, $t77_connect);
$Result1 = mysql_query($deleteSQL, $t77_connect) or die(mysql_error());
$deleteSQL = sprintf("DELETE FROM t77_bill_items WHERE bill_id=%s",
GetSQLValueString($HTTP_GET_VARS['bill_id'], "int"));
mysql_select_db($database_t77_connect, $t77_connect);
$Result1 = mysql_query($deleteSQL, $t77_connect) or die(mysql_error());
$deleteGoTo = "doc_list.php?typeID=" . $_GET['typeID'] . "&reload=yes";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
$colname_delete_bill = "0";
if (isset($_GET['bill_id'])) {
$colname_delete_bill = (get_magic_quotes_gpc()) ? $_GET['bill_id'] : addslashes($_GET['bill_id']);
}
mysql_select_db($database_t77_connect, $t77_connect);
$query_delete_bill = sprintf("SELECT * FROM t77_bill_bills WHERE t77_bill_bills.bill_id = %s", $colname_delete_bill);
$delete_bill = mysql_query($query_delete_bill, $t77_connect) or die(mysql_error());
$row_delete_bill = mysql_fetch_assoc($delete_bill);
$totalRows_delete_bill = mysql_num_rows($delete_bill);
}
?><?
if($_GET['delete'] == 'company') {
if ((isset($HTTP_GET_VARS['comID'])) && ($HTTP_GET_VARS['comID'] != "")) {
$deleteSQL = sprintf("DELETE FROM t77_bill_companies WHERE company_id=%s",
GetSQLValueString($HTTP_GET_VARS['comID'], "int"));
mysql_select_db($database_t77_connect, $t77_connect);
$Result1 = mysql_query($deleteSQL, $t77_connect) or die(mysql_error());
$deleteGoTo = "companies.php?reload=yes";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
}
?><?
if($_GET['delete'] == 'docType') {
if ((isset($HTTP_GET_VARS['docType'])) && ($HTTP_GET_VARS['docType'] != "")) {
$deleteSQL = sprintf("DELETE FROM t77_bill_types WHERE bill_type=%s",
GetSQLValueString($HTTP_GET_VARS['docType'], "int"));
mysql_select_db($database_t77_connect, $t77_connect);
$Result1 = mysql_query($deleteSQL, $t77_connect) or die(mysql_error());
$deleteGoTo = "doc_types.php?reload=yes";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
}
?><?
if($_GET['delete'] == 'doc') {
if ((isset($HTTP_GET_VARS['docID'])) && ($HTTP_GET_VARS['docID'] != "")) {
$deleteSQL = sprintf("DELETE FROM t77_bill_bills WHERE bill_id=%s",
GetSQLValueString($HTTP_GET_VARS['docID'], "int"));
mysql_select_db($database_t77_connect, $t77_connect);
$Result1 = mysql_query($deleteSQL, $t77_connect) or die(mysql_error());
$deleteGoTo = "doc_list.php?reload=yes";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}}
?><? if($_GET['delete'] == 'contact') {
if ((isset($HTTP_GET_VARS['conID'])) && ($HTTP_GET_VARS['conID'] != "")) {
$deleteSQL = sprintf("DELETE FROM t77_bill_contacts WHERE contact_id=%s",
GetSQLValueString($HTTP_GET_VARS['conID'], "int"));
mysql_select_db($database_t77_connect, $t77_connect);
$Result1 = mysql_query($deleteSQL, $t77_connect) or die(mysql_error());
$deleteGoTo = $_GET['ref'] . "?reload=yes";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
} } ?><?
mysql_free_result($delete_item);
?>
<?php
mysql_free_result($delete_bill);
?>