<?PHP
include "../inc/var.php";
include "../inc/connect.php";
# include $server_inc."/whm_functions.php";
include $server_inc."/client_functions.php";
include $server_inc."/login_functions.php";

if (isset($delete)) { mysql_query("delete from invoice_service where srid='".addslashes(trim($delete))."'"); }

include $server_admin_inc."/header.php";

echo("
	<table width='725' cellpadding='0' cellspacing='0' border='0'>
		<tr>
			<td width='1%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='375'></td>
			<td width='99%' align='left' valign='top'>

			<form action='".$PHP_SELF."' method='POST'>
			".((isset($pid))?"<input type='hidden' name='pid' value='".trim($pid)."'>":"")."
			<input type='hidden' name='sid' value='".trim($sid)."'>
			<table width='725' cellpadding='2' cellspacing='0' border='0'>
				<tr>
					<td colspan='2' align='left' valign='top'><img src='".$http_images."/menu_arrow.gif'> <a href='".$http_admin."/invoice.php?sid=".$sid."'>Invoice Home</a> &gt; [ <a href='".$http_admin."/invoice_add_billable_service.php?sid=".$sid."'>Add Billable Services</a> ] [ <a href='".$http_admin."/invoice_edit_billable_service.php?sid=".$sid."'>Edit Billable Services</a> ] [ <a href='".$http_admin."/invoice_delete_billable_service.php?sid=".$sid."'><font color='#990000'>Delete Billable Services</font></a> ]</td>
				</tr>
				<tr>
					<td colspan='2' align='left' valign='top'><hr color='#F0EFED'></td>
				</tr>
			</table>
			<table width='100%' border='0' cellspacing='1' cellpadding='2'>
				<tr>
					<td colspan='4'><font color='#990000'>Warning: This is a true delete.</font></td>
				</tr>
				<tr>
					<td align='center' valign='middle' bgcolor='#E5E7E9'><b>#</b></td>
					<td align='left' valign='middle' bgcolor='#E5E7E9'>&nbsp;<b>Service Name</b></td>
					<td align='left' valign='middle' bgcolor='#E5E7E9'>&nbsp;<b>Service Cost</b></td>
					<td align='left' valign='middle' bgcolor='#E5E7E9'>&nbsp;<font color='#990000'><b>Delete</b></font></td>
				</tr>
				");

			$x=1;
			$y=1;
			$query="select ";
			$query.="srid, ";						// 0
			$query.="service_name, ";				// 1
			$query.="service_description, ";		// 2
			$query.="service_show_description, ";	// 3
			$query.="service_cost ";				// 4
			$query.="from invoice_service ";
			$query.="order by service_name asc";

			$row=mysql_query($query);
			while ($rs=mysql_fetch_row($row))
				{
				$srid=stripslashes(trim($rs[0]));
				$service_name=stripslashes(trim($rs[1]));
				$service_description=stripslashes(trim($rs[2]));
				$service_show_description=stripslashes(trim($rs[3]));
				$service_cost=stripslashes(trim($rs[4]));

				if ($y==1) {$bgcolor="#F2F4F6"; $y=0;} else {$bgcolor="#ECEEF0"; $y=1;}
				echo("
					<tr>
						<td align='center' valign='top' bgcolor='#E5E7E9'><b>".$x.".</b></td>
						<td align='left' valign='top' bgcolor='".$bgcolor."'>&nbsp;<a href='".$http_admin."/invoice_add_billable_service.php?srid=".$rs[0]."&sid=".$sid."'><img src='".$http_images."/icon_view.gif' border='0'></a>&nbsp;
					");
				if ($service_show_description==1)
					{
					echo "<A HREF='".$http_admin."/invoice_add_billable_service.php?srid=".$rs[0]."&sid=".$sid."' class='cleanlink3' onmouseover=\"return overlib('".$service_description."', CAPTION, '".str_replace("'", "", stripslashes($rs[1]))."');\" onmouseout='nd();'>".str_replace("'", "", stripslashes($rs[1]))."</a>";
					}
				else
					{
					echo "<a href='".$http_admin."/invoice_add_billable_service.php?srid=".$rs[0]."&sid=".$sid."'>".stripslashes($rs[1])."</a>";
					}
				echo("
						</td>
						<td align='left' valign='top' bgcolor='".$bgcolor."'>&nbsp;".$currency."".sprintf("%01.2f",$service_cost)."&nbsp;".$currency_type."</td>
						<td align='left' valign='top' bgcolor='".$bgcolor."'>&nbsp;[<a href='".$http_admin."/invoice_delete_billable_service.php?sid=".$sid."&delete=".$srid."'>delete</a>]</td>
					</tr>
					");
				$x++;
				}
	echo("
					<tr>
						<td colspan='4'><img src='".$http_images."/space.gif' width='1' height='8'></td>
					</tr>
				</table>
				</form>
				</td>
			</tr>
		</table>
		");
mysql_close($dblink);
include $server_admin_inc."/footer.php";
?>