<?
/*
 * Exemplar Web hosting
 * http://www.exemplar.biz
 *
 * Title: PHP Online Invoice System
 * Version: 2.0
 * Author: Exemplar
 * Date: 01-01-2006
 *
*/

include('header.php');
$year = date (Y);
$mon = date (m);
$day = date (d);
$today = $year."-". $mon."-". $day;
?>

 <SCRIPT language=JavaScript>

function taxable()
{
$tax1 = 0;
$tax2 = 0;
$tax3 = 0;
$tax4 = 0;
$tax5 = 0;
$tax6 = 0;
$tax7 = 0;
$tax8 = 0;
$tax9 = 0;
$tax10 = 0;
	if(form1.serv1tax.value=="yes")
	{
		$tax1 = Math.round(((eval(form1.serv1amt.value)*eval(<?=$taxrate?>))/100)*Math.pow(10,2))/Math.pow(10,2);
	}

	if(form1.serv2tax.value=="yes")
	{
		$tax2 = Math.round(((eval(form1.serv2amt.value)*eval(<?=$taxrate?>))/100)*Math.pow(10,2))/Math.pow(10,2);
	}

	if(form1.serv3tax.value=="yes")
	{
		$tax3 = Math.round(((eval(form1.serv3amt.value)*eval(<?=$taxrate?>))/100)*Math.pow(10,2))/Math.pow(10,2);
	}

	if(form1.serv4tax.value=="yes")
	{
		$tax4 = Math.round(((eval(form1.serv4amt.value)*eval(<?=$taxrate?>))/100)*Math.pow(10,2))/Math.pow(10,2);
	}

	if(form1.serv5tax.value=="yes")
	{
		$tax5 = Math.round(((eval(form1.serv5amt.value)*eval(<?=$taxrate?>))/100)*Math.pow(10,2))/Math.pow(10,2);
	}

	if(form1.serv6tax.value=="yes")
	{
		$tax6 = Math.round(((eval(form1.serv6amt.value)*eval(<?=$taxrate?>))/100)*Math.pow(10,2))/Math.pow(10,2);
	}

	if(form1.serv7tax.value=="yes")
	{
		$tax7 = Math.round(((eval(form1.serv7amt.value)*eval(<?=$taxrate?>))/100)*Math.pow(10,2))/Math.pow(10,2);
	}

	if(form1.serv8tax.value=="yes")
	{
		$tax8 = Math.round(((eval(form1.serv8amt.value)*eval(<?=$taxrate?>))/100)*Math.pow(10,2))/Math.pow(10,2);
	}

	if(form1.serv9tax.value=="yes")
	{
		$tax9 = Math.round(((eval(form1.serv9amt.value)*eval(<?=$taxrate?>))/100)*Math.pow(10,2))/Math.pow(10,2);
	}

	if(form1.serv10tax.value=="yes")
	{
		$tax10 = Math.round(((eval(form1.serv10amt.value)*eval(<?=$taxrate?>))/100)*Math.pow(10,2))/Math.pow(10,2);
	}

	form1.salestax.value=Math.round((eval($tax1) + eval($tax2) + eval($tax3) + eval($tax4) + eval($tax5) + eval($tax6) + eval($tax7) + eval($tax8) + eval($tax9) + eval($tax10))*Math.pow(10,2))/Math.pow(10,2);

}

function total()
{
	form1.total.value = Math.round((eval(form1.subtotal.value) + eval(form1.salestax.value) + eval(form1.shipping.value) + eval(form1.misc.value))*Math.pow(10,2))/Math.pow(10,2);
}

function subtotal()
{
	taxable();
	form1.subtotal.value = Math.round((eval(form1.serv1amt.value) + eval(form1.serv2amt.value) + eval(form1.serv3amt.value) + eval(form1.serv4amt.value) + eval(form1.serv5amt.value) + eval(form1.serv6amt.value) + eval(form1.serv7amt.value) + eval(form1.serv8amt.value) + eval(form1.serv9amt.value) + eval(form1.serv10amt.value))*Math.pow(10,2))/Math.pow(10,2);
	total();
}
function servtotal1()
{
	form1.serv1amt.value = Math.round((form1.serv1qty.value * form1.serv1rate.value)*Math.pow(10,2))/Math.pow(10,2);
	subtotal();
}
function servtotal2()
{
	form1.serv2amt.value = Math.round((form1.serv2qty.value * form1.serv2rate.value)*Math.pow(10,2))/Math.pow(10,2);
	subtotal();
}
function servtotal3()
{
	form1.serv3amt.value = Math.round((form1.serv3qty.value * form1.serv3rate.value)*Math.pow(10,2))/Math.pow(10,2);
	subtotal();
}
function servtotal4()
{
	form1.serv4amt.value = Math.round((form1.serv4qty.value * form1.serv4rate.value)*Math.pow(10,2))/Math.pow(10,2);
	subtotal();
}
function servtotal5()
{
	form1.serv5amt.value = Math.round((form1.serv5qty.value * form1.serv5rate.value)*Math.pow(10,2))/Math.pow(10,2);
	subtotal();
}
function servtotal6()
{
	form1.serv6amt.value = Math.round((form1.serv6qty.value * form1.serv6rate.value)*Math.pow(10,2))/Math.pow(10,2);
	subtotal();
}
function servtotal7()
{
	form1.serv7amt.value = Math.round((form1.serv7qty.value * form1.serv7rate.value)*Math.pow(10,2))/Math.pow(10,2);
	subtotal();
}
function servtotal8()
{
	form1.serv8amt.value = Math.round((form1.serv8qty.value * form1.serv8rate.value)*Math.pow(10,2))/Math.pow(10,2);
	subtotal();
}
function servtotal9()
{
	form1.serv9amt.value = Math.round((form1.serv9qty.value * form1.serv9rate.value)*Math.pow(10,2))/Math.pow(10,2);
	subtotal();
}
function servtotal10()
{
	form1.serv10amt.value = Math.round((form1.serv10qty.value * form1.serv10rate.value)*Math.pow(10,2))/Math.pow(10,2);
	subtotal();
}




</SCRIPT>
<blockquote>
<?

 echo " <h1>Add invoice</h1>";

if($submit)
{

$sql = "INSERT INTO invoices (clientid, date,due_date,purchaseorder, shipping, total,status,serv1amt,serv2amt,serv3amt,serv4amt
,serv5amt,serv6amt,serv7amt,serv8amt,serv9amt,serv10amt,serv1desc,serv2desc,serv3desc,serv4desc,serv5desc,serv6desc,serv7desc
,serv8desc,serv9desc,serv10desc,serv1qty,serv2qty,serv3qty,serv4qty,serv5qty,serv6qty,serv7qty,serv8qty,serv9qty,serv10qty
,serv1rate,serv2rate,serv3rate,serv4rate,serv5rate,serv6rate,serv7rate,serv8rate,serv9rate,serv10rate,serv1tax
,serv2tax,serv3tax,serv4tax,serv5tax,serv6tax,serv7tax,serv8tax,serv9tax,serv10tax,subtotal,salestax,note,misc)
VALUES ('$clientid',NOW(),'$due_date','$purchaseorder','$shipping','$total','$status','$serv1amt','$serv2amt','$serv3amt','$serv4amt'
,'$serv5amt','$serv6amt','$serv7amt','$serv8amt','$serv9amt','$serv10amt','$serv1desc','$serv2desc','$serv3desc','$serv4desc'
,'$serv5desc','$serv6desc','$serv7desc','$serv8desc','$serv9desc','$serv10desc','$serv1qty','$serv2qty','$serv3qty','$serv4qty'
,'$serv5qty','$serv6qty','$serv7qty','$serv8qty','$serv9qty','$serv10qty','$serv1rate','$serv2rate','$serv3rate','$serv4rate'
,'$serv5rate','$serv6rate','$serv7rate','$serv8rate','$serv9rate','$serv10rate','$serv1tax','$serv2tax','$serv3tax','$serv4tax'
,'$serv5tax','$serv6tax','$serv7tax','$serv8tax','$serv9tax','$serv10tax','$subtotal','$salestax','$note','$misc')";
$result = mysqli_query($db,$sql);
echo "<br>The invoice has been succesfully created.<br><br>\n";


}
else
{
//-------------------------------begin add new invoice----------------------------------------------------
?>

<form method="post" name=form1 action="<?php echo $PHP_SELF?>">
<input type="hidden" name="clientid" value="<?=$cid?>">
<?

$sql = mysqli_query($db,"Select * From clients Where clientid = '$cid'");
$alrow = mysqli_fetch_array($sql);
$afirst_name = $alrow["first_name"];
$alast_name = $alrow["last_name"];
$acompany = $alrow["company"];
$aaddress = $alrow["address"];
$acity = $alrow["city"];
$astate = $alrow["state"];
$azip = $alrow["zip"];
$date = $myrow["date"];
$ashiptoname = $alrow["shiptoname"];
$ashiptoaddr = $alrow["shiptoaddr"];
$ashiptocity = $alrow["shiptocity"];
$ashiptostate = $alrow["shiptostate"];
$ashiptozip = $alrow["shiptozip"];
$apurchaseorder = $alrow["purchaseorder"];
$ataxid = $alrow["taxid"];
?>
<br><br>
<? //---------------------Add new fields----------------------------------------------------- ?>
<TABLE cellSpacing=1 cellPadding=2 width=605 border=0>
        <TBODY>
        <TR align=middle bgColor=#800000>
          <TD vAlign=top width=86><FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=2>Date</FONT></TD>
          <TD vAlign=top width=170><FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=2>Invoice #</FONT></TD>
          <TD vAlign=top width=170><FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=2>Purchase Order #</FONT></TD>
          <TD vAlign=top width=150><FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=2>Tax ID</FONT></TD>
          <TD vAlign=top width=178><FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=2>Due Date</FONT></TD>
          </TR>
        <TR vAlign=center align=middle bgColor=#cccccc>
          <TD><FONT face="Arial, Helvetica, sans-serif" color=#800000 size=2><? echo $today ?>
          </FONT></TD>
<?
$sql2 ="SELECT id FROM invoices WHERE id > '$id' ORDER by id DESC LIMIT 1";

$resultn = mysqli_query($db,$sql2);
$nextrows = mysqli_num_rows($resultn);
while ($nextrow = mysqli_fetch_array($resultn)) {
$next=$nextrow['id']+1;
}
?>
          <TD><FONT face="Arial, Helvetica, sans-serif" color=#800000 size=2><?=$next?>
          <INPUT type=hidden value="" name=id>
          </FONT></TD>
          <TD><FONT face="Arial, Helvetica, sans-serif" color=#800000 size=2>
          <INPUT type="text" name="purchaseorder" id="purchaseorder" size="10" value="<?=$apurchaseorder?>"></FONT></TD>
          <TD><FONT face="Arial, Helvetica, sans-serif" color=#800000 size=2>
          <INPUT type="text" name="taxid" id="taxid" size="10" value="<?=$ataxid?>"></FONT></TD>
          <TD NOWRAP><FONT face="Arial, Helvetica, sans-serif" color=#800000 size=2>
<? //-----------calendar------------------------------?>

<input type="text" name="due_date" id="due_date" value="<?=$p_due?>">
<img src="img.gif" id="f_trigger_c"
     style="cursor: pointer; border: 1px solid red;"
     title="Date selector"
     onmouseover="this.style.background='red';"
     onmouseout="this.style.background=''" />
<script type="text/javascript">
    Calendar.setup({
        inputField     :    "due_date",
        ifFormat       :    "%Y-%m-%d",
        button         :    "f_trigger_c",
        align          :    "Tl",
        singleClick    :    true
    });
</script>

</TD>

     </TR>
     <FONT face=arial color=#006699 size=2>
     </TBODY></TABLE><BR>
      <TABLE cellSpacing=1 cellPadding=2 width=604 border=0>
        <TBODY>
        <TR bgColor=#800000>
          <TD vAlign=top width="50%"><FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=2>Bill To </FONT></TD>
          <TD vAlign=top width="50%"><FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=2>Ship To</FONT></TD>
          </TR>
          <FONT face=arial color=#006699 size=2>
        <TR vAlign=top bgColor=#cccccc>
          <TD width="50%">
<?=$afirst_name?>
<?=$alast_name?><br>
<?=$acompany?><br>
<?=$aaddress?><br>
<?=$acity?>,
<?=$astate?>
 <?=$azip?>

          </td>
          <TD width="50%">
          <FONT face="Arial, Helvetica, sans-serif" color=#800000 size=2>
<?=$ashiptoname?><br>
<?=$ashiptoaddr?><br>
<?=$ashiptocity?>,
 <?=$ashiptostate?>
 <?=$ashiptozip?>
            </FONT>
        </TD>
        </TR></TBODY></TABLE><BR>

      <TABLE cellSpacing=1 cellPadding=2 width=604 border=0>
        <TBODY>
        <TR bgColor=#800000>
          <TD width=331><FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=2>Service Description </FONT></TD>
          <TD width=59><FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=2>Taxable</FONT></TD>
          <TD width=51><FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=2>Qty/Hrs</FONT></TD>
          <TD width=70><FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=2>Rate</FONT></TD>
          <TD width=67><FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=2>Amount</FONT></TD>
          </TR>
        <TR bgColor=#cccccc>
          <TD><FONT face="Arial, Helvetica, sans-serif" size=2>
          <TEXTAREA id=serv1desc rows=2 cols=35 name=serv1desc></TEXTAREA> </FONT></TD>
          <TD align=middle>
       <SELECT id=serv1tax onchange=servtotal1(); name=serv1tax>
          <OPTION value=yes>yes</OPTION>
          <OPTION value=no selected>no</OPTION>
       </SELECT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=2>
          <INPUT id=serv1qty onchange=servtotal1(); size=5 value="0" name=serv1qty> </FONT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=1><?=$currency?>
            <INPUT id=serv1rate onchange=servtotal1(); size=5 value="0" name=serv1rate> </FONT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=1><?=$currency?>
            <INPUT id=serv1amt onchange=servtotal1(); size=5 value="0" name=serv1amt>
            </FONT></TD></TR>
        <TR bgColor=#cccccc>
          <TD><FONT face="Arial, Helvetica, sans-serif" size=2>
          <TEXTAREA id=serv2desc rows=2 cols=35 name=serv2desc></TEXTAREA> </FONT></TD>
          <TD align=middle>
       <SELECT id=serv2tax onchange=servtotal2(); name=serv2tax>
           <OPTION value=yes>yes</OPTION>
           <OPTION value=no selected>no</OPTION>
       </SELECT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=2>
          <INPUT id=serv2qty onchange=servtotal2(); size=5 value="0" name=serv2qty> </FONT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=1><?=$currency?>
            <INPUT id=serv2rate onchange=servtotal2(); size=5 value="0" name=serv2rate> </FONT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=1><?=$currency?>
            <INPUT id=serv2amt onchange=servtotal2(); size=5 value="0" name=serv2amt>
            </FONT></TD></TR>
        <TR bgColor=#cccccc>
          <TD><FONT face="Arial, Helvetica, sans-serif" size=2>
          <TEXTAREA id=serv3desc rows=2 cols=35 name=serv3desc></TEXTAREA> </FONT></TD>
          <TD align=middle>
        <SELECT id=serv3tax onchange=servtotal3(); name=serv3tax>
          <OPTION value=yes>yes</OPTION>
          <OPTION value=no selected>no</OPTION>
        </SELECT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=2>
          <INPUT id=serv3qty onchange=servtotal3(); size=5 value="0" name=serv3qty> </FONT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=1><?=$currency?>
            <INPUT id=serv3rate onchange=servtotal3(); size=5 value="0" name=serv3rate> </FONT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=1><?=$currency?>
            <INPUT id=serv3amt onchange=servtotal3(); size=5 value="0" name=serv3amt>
            </FONT></TD></TR>
        <TR bgColor=#cccccc>
          <TD><FONT face="Arial, Helvetica, sans-serif" size=2>
          <TEXTAREA id=serv4desc rows=2 cols=35 name=serv4desc></TEXTAREA> </FONT></TD>
          <TD align=middle>
        <SELECT id=serv4tax onchange=servtotal4(); name=serv4tax>
          <OPTION value=yes>yes</OPTION>
          <OPTION value=no selected>no</OPTION>
        </SELECT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=2>
          <INPUT id=serv4qty onchange=servtotal4(); size=5 value="0" name=serv4qty> </FONT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=1><?=$currency?>
            <INPUT id=serv4rate onchange=servtotal4(); size=5 value="0" name=serv4rate> </FONT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=1><?=$currency?>
            <INPUT id=serv4amt onchange=servtotal4(); size=5 value="0" name=serv4amt>
            </FONT></TD></TR>
        <TR bgColor=#cccccc>
          <TD><FONT face="Arial, Helvetica, sans-serif" size=2>
          <TEXTAREA id=serv5desc rows=2 cols=35 name=serv5desc></TEXTAREA> </FONT></TD>
          <TD align=middle>
        <SELECT id=serv5tax onchange=servtotal5(); name=serv5tax>
          <OPTION value=yes>yes</OPTION>
          <OPTION value=no selected>no</OPTION>
        </SELECT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=2>
          <INPUT id=serv5qty onchange=servtotal5(); size=5 value="0" name=serv5qty> </FONT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=1><?=$currency?>
            <INPUT id=serv5rate onchange=servtotal5(); size=5 value="0" name=serv5rate> </FONT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=1><?=$currency?>
            <INPUT id=serv5amt onchange=servtotal5(); size=5 value="0" name=serv5amt>
            </FONT></TD></TR>
        <TR bgColor=#cccccc>
          <TD><FONT face="Arial, Helvetica, sans-serif" size=2>
         <TEXTAREA id=serv6desc rows=2 cols=35 name=serv6desc></TEXTAREA> </FONT></TD>
          <TD align=middle>
        <SELECT id=serv6tax onchange=servtotal6(); name=serv6tax>
          <OPTION value=yes>yes</OPTION>
          <OPTION value=no selected>no</OPTION>
        </SELECT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=2>
          <INPUT id=serv6qty onchange=servtotal6(); size=5 value="0" name=serv6qty> </FONT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=1><?=$currency?>
            <INPUT id=serv6rate onchange=servtotal6(); size=5 value="0" name=serv6rate> </FONT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=1><?=$currency?>
            <INPUT id=serv6amt onchange=servtotal6(); size=5 value="0" name=serv6amt>
            </FONT></TD></TR>
        <TR bgColor=#cccccc>
          <TD><FONT face="Arial, Helvetica, sans-serif" size=2>
          <TEXTAREA id=serv7desc rows=2 cols=35 name=serv7desc></TEXTAREA> </FONT></TD>
          <TD align=middle>
        <SELECT id=serv7tax onchange=servtotal7(); name=serv7tax>
           <OPTION value=yes>yes</OPTION>
           <OPTION value=no selected>no</OPTION>
         </SELECT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=2>
          <INPUT id=serv7qty onchange=servtotal7(); size=5 value="0" name=serv7qty> </FONT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=1><?=$currency?>
            <INPUT id=serv7rate onchange=servtotal7(); size=5 value="0" name=serv7rate> </FONT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=1><?=$currency?>
            <INPUT id=serv7amt onchange=servtotal7(); size=5 value="0" name=serv7amt>
            </FONT></TD></TR>
        <TR bgColor=#cccccc>
          <TD><FONT face="Arial, Helvetica, sans-serif" size=2>
          <TEXTAREA id=serv8desc rows=2 cols=35 name=serv8desc></TEXTAREA> </FONT></TD>
          <TD align=middle>
        <SELECT id=serv8tax onchange=servtotal8(); name=serv8tax>
          <OPTION value=yes>yes</OPTION>
          <OPTION value=no selected>no</OPTION>
        </SELECT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=2>
          <INPUT id=serv8qty onchange=servtotal8(); size=5 value="0"  name=serv8qty> </FONT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=1><?=$currency?>
            <INPUT id=serv8rate onchange=servtotal8(); size=5 value="0" name=serv8rate> </FONT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=1><?=$currency?>
            <INPUT id=serv8amt onchange=servtotal8(); size=5 value="0" name=serv8amt>
            </FONT></TD></TR>
        <TR bgColor=#cccccc>
          <TD><FONT face="Arial, Helvetica, sans-serif" size=2>
          <TEXTAREA id=serv9desc rows=2 cols=35 name=serv9desc></TEXTAREA> </FONT></TD>
          <TD align=middle>
        <SELECT id=serv9tax onchange=servtotal9(); name=serv9tax>
          <OPTION value=yes>yes</OPTION>
          <OPTION value=no selected>no</OPTION>
        </SELECT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=2>
          <INPUT id=serv9qty onchange=servtotal9(); size=5 value="0" name=serv9qty> </FONT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=1><?=$currency?>
            <INPUT id=serv9rate onchange=servtotal9(); size=5 value="0" name=serv9rate> </FONT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=1><?=$currency?>
            <INPUT id=serv9amt onchange=servtotal9(); size=5 value="0" name=serv9amt>
            </FONT></TD></TR>
        <TR bgColor=#cccccc>
          <TD><FONT face="Arial, Helvetica, sans-serif" size=2>
          <TEXTAREA id=serv10desc rows=2 cols=35 name=serv10desc></TEXTAREA> </FONT></TD>
          <TD align=middle>
        <SELECT id=serv10tax onchange=servtotal10(); name=serv10tax>
          <OPTION value=yes>yes</OPTION> <OPTION value=no selected>no</OPTION>
        </SELECT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=2>
          <INPUT id=serv10qty onchange=servtotal10(); size=5 value="0" name=serv10qty> </FONT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=1><?=$currency?>
            <INPUT id=serv10rate onchange=servtotal10(); size=5 value="0" name=serv10rate> </FONT></TD>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif" size=1><?=$currency?>
            <INPUT id=serv10amt onchange=servtotal10(); size=5 value="0" name=serv10amt> </FONT></TD></TR>
        <TR align=left bgColor=#cccccc>
          <TD colSpan=5><FONT face="Arial, Helvetica, sans-serif" size=2>Note:</FONT>
          <INPUT id=note maxLength=100 size=65 name=note></TD></TR>
        <TR bgColor=#cccccc>
          <TD align=middle>&nbsp; </TD>
          <TD align=middle>&nbsp; </TD>
          <TD align=middle>&nbsp; </TD>
          <TD align=middle>&nbsp; </TD>
          <TD align=middle>&nbsp; </TD></TR>
        <TR bgColor=#cccccc>
          <TD rowSpan=2>&nbsp;</TD>
          <TD align=middle bgColor=#800000 colSpan=2><STRONG>
          <FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=3>Sub total
            </FONT></STRONG></TD>
          <TD align=middle bgColor=#800000 colSpan=2>
          <FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=2><?=$currency?>
          <INPUT id=subtotal onchange=servtotal1(); size=12 value="0" name=subtotal>
            </FONT></TD>
          </TR>
        <TR bgColor=#cccccc>
          <TD align=middle bgColor=#800000 colSpan=2><STRONG>
          <FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=3>Sales Tax</FONT></STRONG></TD>
          <TD align=middle bgColor=#800000 colSpan=2>
          <FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=2><?=$currency?>
          <INPUT id=salestax onchange=servtotal1(); size=12 value="0" name=salestax>
            </FONT></TD>
          </TR>
        <TR bgColor=#cccccc>
          <TD rowSpan=3>
          <FONT face="Arial, Helvetica, sans-serif" size=1><BR>
            </FONT><FONT face="Arial, Helvetica, sans-serif" size=2>&nbsp;</FONT></TD>
          <TD align=middle bgColor=#800000 colSpan=2><STRONG>
          <FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=3>Shipping
            </FONT></STRONG></TD>
          <TD align=middle bgColor=#800000 colSpan=2>
          <FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=2><?=$currency?>
          <INPUT id=shipping onchange=servtotal1(); size=12 value="0" name=shipping>
            </FONT></TD></TR>
        <TR bgColor=#cccccc>
          <TD align=middle bgColor=#800000 colSpan=2><STRONG>
          <FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=3>Miscellaneous</FONT></STRONG></TD>
          <TD align=middle bgColor=#800000 colSpan=2>
          <FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=2><?=$currency?>
          <INPUT id=misc onchange=servtotal1(); size=12 value="0" name=misc>
        </FONT></TD>
        </TR>
        <TR bgColor=#cccccc>
          <TD align=middle bgColor=#800000 colSpan=2><STRONG>
          <FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=3>Total
            </FONT></STRONG></TD>
          <TD align=middle bgColor=#800000 colSpan=2>
          <FONT face="Arial, Helvetica, sans-serif" color=#ffffff size=2><?=$currency?>
          <INPUT id=total onchange=servtotal1(); size=12 value="0" name=total>
        </FONT></TD></TR>
        <TR align=middle bgColor=#cccccc>
          <TD colSpan=5><FONT face="Arial, Helvetica, sans-serif" size=2>



  </FONT></TD></TR></TBODY></TABLE></FONT></FONT></FONT></FONT>
<? //-----------------------end add new fields--------------------------------------------------------------------------------- ?>
<br>
Status is automatically set to 'pending'<br><br>
<INPUT type=hidden value="pending" name="status">
<input type="Submit" name="submit" value="Add invoice"></form>
</blockquote>

<?
include "footer.php";
}
?>

