<?php session_start();
if($_SESSION[invcox] == ""){
header("location:login.php?action=need");
}else{

include("config.php");?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Arnim Holidays Accounting Software</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=yes,width=780,height=500,left = 100,top = 100');");
}
// End -->
</script>
<SCRIPT language=JavaScript>

function validate()

{
	if(document.form1.accname.value=="")

		{
			alert ("Please type Account Name.")
			//document.form1.company.value=' ';
			document.form1.accname.focus()
			return false

		}
	if(document.form1.accno.value=="")

		{
			//alert ("Please type Product Name.")
			//document.form1.contact_person.value=' ';
			document.form1.accno.focus()
			return false
		}
	if(document.form1.bank.value=="")

		{
			//alert ("Please type Product Name.")
			document.form1.bank.value=' ';
			document.form1.bank.focus()
			return false
		}
	if(document.form1.branch.value=="")

		{
			//alert ("Please type Product Name.")
			document.form1.branch.value=' ';
			document.form1.branch.focus()
			return false
		}
}

</SCRIPT>
</head>

<body>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" class="box-wrap">
  <tr>
    <td><?php include("top.php")?></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="30" background="images/place_bg.jpg" class="link2"><strong>&nbsp;&nbsp;<a href="index.php">Home</a> &gt; <a href="accounts.php">Accounts &gt; </a> <a href="bank.php"> Bank Laser </a>&gt; <a href="add_bank.php">Bank Accounts </a></strong></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td ><?php //include("bank_top.php");?></td>
  </tr>
  <tr>
    <td align="center"  class="round_box"><form action="insert_bank.php" method="post" enctype="multipart/form-data" name="form1" id="form1" onsubmit="return validate()">
      <table width="100%" border="0" cellpadding="2" cellspacing="1">
        <tr>
          <td width="16%" ><strong>Add New Bank Account </strong></td>
          <td width="16%" >&nbsp;</td>
          <td width="16%" >&nbsp;</td>
          <td width="16%" >&nbsp;</td>
          <td width="21%" >&nbsp;</td>
          <td width="15%" >&nbsp;</td>
        </tr>
        <tr>
          <td width="16%" bgcolor="#CCCCCC">Account Name </td>
          <td width="16%" bgcolor="#CCCCCC">Account No </td>
          <td width="16%" bgcolor="#CCCCCC">Bank</td>
          <td width="16%" bgcolor="#CCCCCC">Branch</td>
          <td width="21%" bgcolor="#CCCCCC">Opening Balance </td>
          <td width="15%" bgcolor="#CCCCCC">&nbsp;</td>
        </tr>
        <tr>
          <td width="16%" height="30" ><input name="accname" type="text" id="accname" />          </td>
          <td width="16%" ><input name="accno" type="text" id="accno" /></td>
          <td width="16%" ><input name="bank" type="text" id="bank" /></td>
          <td width="16%" ><input name="branch" type="text" id="branch" /></td>
          <td width="21%" ><input name="opening_balance" type="text" id="opening_balance" size="20" /></td>
          <td width="15%" ><input type="submit" name="Submit" value="Submit" /></td>
        </tr>
      </table>
    </form></td>
  </tr>
  <tr>
    <td >&nbsp;</td>
  </tr>
  <tr>
    <td height="200" valign="top"  class="round_box"><table width="100%" border="0" cellpadding="3" cellspacing="1" class="list_table">
          <tr>
            <td colspan="7" align="left" ><strong>Account List </strong></td>
          </tr>
          <tr>
            <th width="20%" align="left" ><strong>Account Name </strong></th>
            <th width="18%" align="left" ><strong>Account No </strong></th>
            <th width="13%" align="left" ><strong>Bank</strong></th>
            <th width="15%" align="left" ><strong>Branch</strong></th>
            <th width="17%" align="left" >Opening Balance </th>
            <th width="8%" align="center" >Edit</th>
            <th width="9%" align="center" >Delete</th>
        </tr>
		  <?php 
		   $m=date("m");
			$y=date("Y");
			  
		  $dt=$y.$m;
		  $result=mysql_query("select * from bank_acc ORDER by id asc");
		  $row=mysql_fetch_array($result);
		  if($row!=""){
		  do{
		  if($_GET[id]!=$row[id]){
		  ?>
          <tr>
          <td width="20%" align="left" valign="top"  class="link"><?php echo $row[accname];?></td>
            <td width="18%" align="left" valign="top"  class="link"><?php echo $row[accno];?></td>
            <td width="13%" align="left" valign="top"  class="link"><?php echo $row[bank];?></td>
            <td width="15%" align="left" valign="top"  class="link"><?php echo $row[branch];?></td>
            <td width="17%" align="left" valign="top"  class="link"><?php echo $row[opening_balance];?></td>
            <td width="8%" align="center" valign="top"  class="link"><a href="add_bank.php?id=<?php echo $row[id];?>&amp;action=edit">Edit</a></td>
            <td width="9%" align="center" valign="top"  class="link"><a href="delete_bank_ac.php?id=<?php echo $row[id];?>">Delete</a></td>
          </tr>
		  <?php } if(($_GET[action] == 'edit')&&($_GET[id] == $row[id])){?>
          <tr>
                <td colspan="8" ><form action="update_acc.php" method="post" enctype="multipart/form-data" name="form2" id="form2">
                    <table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <tr >
                        <td width="16%" height="30" align="left"><input name="accname" type="text" id="accname" value="<?php echo $row[accname];?>" />                        </td>
                        <td width="16%" align="left"><input name="accno" type="text" id="accno" value="<?php echo $row[accno];?>" /></td>
                        <td width="17%" align="left"><input name="bank" type="text" id="bank" value="<?php echo $row[bank];?>" /></td>
                        <td width="18%" align="left"><input name="branch" type="text" id="branch" value="<?php echo $row[branch]; ?>" />
                        <input name="id" type="hidden" id="id" value="<?php echo $row[id];?>" /></td>
                        <td width="18%" align="left"><input name="opening_balance" type="text" id="opening_balance" value="<?php echo $row[opening_balance]; ?>" size="15" /></td>
                        <td width="15%" align="center"><input type="submit" name="Submit2" value="Update" /></td>
                      </tr>
                    </table>
            </form></td>
        </tr>
          <?php }}while($row=mysql_fetch_array($result));}?>
    </table></td>
  </tr>
  <tr>
    <td><?php include("bot.php")?></td>
  </tr>
</table>
</body>
</html>
<?php }?>