
<html>
<head>
<link rel="stylesheet" href="../../css/font.css" type="text/css" />

<link href="../../css/pop_up style.css" rel="stylesheet" type="text/css">
<script src="../../js/branch_creation_ajax.js"         type="text/javascript"></script>
<script src="../../js/jquery/jquery.js"         type="text/javascript"></script>
<script src="../../js/shortcut.js"  type="text/javascript"></script>
<script src="../../js/enter_event_ajax.js"       type="text/javascript"></script>

<script>
shortcut.add("Alt+b",function() 
{
	document.getElementById("branch_name").focus();
});

shortcut.add("Alt+a",function() 
{
	document.getElementById("branch_address").focus();
});


</script></head>
<?php
error_reporting(0);
$edit_id=$_GET['edit_id'];
include("../../include/db.php");
/******************** Auto Generated ID*********************************************/
$date=date("Y");
$st_date=substr($date,2);
$month=date("m");	   
$datee=$st_date.$month;

if(!isset($_GET['branch_no']))
{
	$rs1=mysql_query("select branch_no from  branch_creation order by branch_id desc");
	if($res1=mysql_fetch_assoc($rs1))
	{
		$pur_array=explode('-',$res1['branch_no']);
	
	    $year1=$pur_array[1];
        $year2=substr($year1, 0, 2);
	    $year='20'.$year2;
		$purchase_no=$pur_array[2];
	}
	if($purchase_no=='')
		$branch_no='BN-'.$datee.'-0001';
	else
	{
		$purchase_no+=1;
		$branch_no='BN-'.$datee.'-'.str_pad($purchase_no, 4, '0', STR_PAD_LEFT);
	}
}
   

if($_GET['edit_id']!='')
{
$measurement_table_display_style='style="display:inline;"';
} 
else
{
$measurement_table_display_styles='style="display:none;"';
}
  $id=$_GET[edit_id];
  $sql="select * from branch_creation where branch_id='$_GET[edit_id]'";
  $rs=mysql_query($sql);
  $rscount=mysql_num_rows($rs);
 
  while($rsdata=mysql_fetch_array($rs))
  {
	  $branch_nos1=$rsdata['branch_no'];
	  $branch_name=$rsdata['branch_name'];
	  $branch_address=$rsdata['branch_address'];
	  $head_off=$rsdata['head_off'];
	  $branch_off=$rsdata['branch_off'];
	  $branch_ph=$rsdata['branch_ph'];
      $delivery_ph=$rsdata['delivery_ph'];
	  $delivery_off=$rsdata['delivery_off'];
  }
?>

<style type="text/css">

.style2 {color: #FF0000}
.style7{font-family: Tahoma, Arial, Helvetica, sans-serif;font-size: 13px;}
.headings{ font-family:verdana; font-size:10px;}
.types_class { 
    height: 25px; 
    width: 200px; 
    background-color: transparent;  
    border-style: solid;  
    border-width: 0px 0px 1px 0px;  
    border-color:#CCC; 
    outline:0;
	font-size:14px;
  } 
  
  .types_class_text { 
    height: 35px; 
    width: 300px; 
    background-color: transparent;  
    border-style: solid;  
    border-width: 0px 0px 1px 0px;  
    border-color:#CCC; 
    outline:0;
	font-size:14px;
  } 
</style>
<style type="text/css">
<!--
.txt{ font-family: Verdana, Arial, Helvetica, sans-serif; font-size:13px;}
.style9 {font-weight: bold}
input:focus {  border-color:#0171b9; }
select:focus {  border-color:#0171b9; } 
textarea:focus {  border-color:#0171b9; } 
-->
</style>
    <table width="100%" >
  <tr>
    <td height="26" colspan="8" class="txt" style="font-size:14px;"><strong>Branch Creation</strong></td>
  </tr>
    
 
<tr>

  <td width="106" height="39" align="left" class="field"></td>
  <td width="248" align="left" class="txt"><span class="style2"><strong>B</strong></span>ranch Name<span class="style2">*</span></td>
  
  <td width="317" class="style7"><input type="text" name="branch_name" id="branch_name" autofocus class="types_class" tabindex="1" onKeyUp="branch_clear_validation(this.value),enterevent(event,'branch_address','branch_name')" style="height:26px;" value="<?php if($_GET['edit_id']!='') { echo $branch_name; } ?>"><div id="branch_validation_div" style="color:#F00"></div></td>
  <td width="218" class="style7"><span class="txt"><span style="color:#F00"><strong>A</strong></span>ddress</span></td>
  <td width="244" class="style7"><textarea name="branch_address" id="branch_address" cols="60" rows="7" tabindex="2" onKeyUp="enterevent(event,'head_off','branch_address')" class="types_class"><?php if($_GET['edit_id']!='') { echo $branch_address; } ?>
  </textarea></td>
  <td width="146" class="style7"><input type="hidden" readonly name="branch_no" id="branch_no" tabindex="3" class="text_box" style="font-size:12px" value="<?php if($_GET['edit_id']!='') { echo $_GET['branch_no']; } else{ echo $branch_no;  } ?>">
              &nbsp;&nbsp;</td>
  </tr>
<tr>
  <td align="left" valign="top" class="field"></td>
  <td rowspan="2" align="left" valign="top" class="txt">H.O.Ph </td>
  <td rowspan="2" valign="top"  ><input type="text" name="head_off" id="head_off" class="types_class" onKeyPress="if ((event.keyCode &lt; 46) || (event.keyCode &gt; 57)) event.returnValue = false" tabindex="4" maxlength="11" style="width:200px; height:26px;" value="<?php if($_GET['edit_id']!='') { echo $head_off; } ?>" onKeyUp="enterevent(event,'branch_off','head_off')" />
    &nbsp;</td>
  <td rowspan="2" valign="top"  ><span class="txt">B.O.Cell </span></td>
  <td rowspan="2" valign="top"  ><input type="text" name="branch_off" id="branch_off" class="types_class" onKeyPress="if ((event.keyCode &lt; 46) || (event.keyCode &gt; 57)) event.returnValue = false" tabindex="5" maxlength="10" style="width:200px; height:26px;" value="<?php if($_GET['edit_id']!='') { echo $branch_off; } ?>" onKeyUp="enterevent(event,'branch_ph','branch_off')" />
    &nbsp;</td>
  <td rowspan="2" valign="top"  >&nbsp;</td>
  </tr>

<tr>

  <td height="34"  valign="top" class="style7">&nbsp;</td>
  </tr>

    <tr>
    <td height="34">&nbsp;</td>
    <td><span class="txt">B.O.Ph</span></td>
    <td><input type="text" name="branch_ph" id="branch_ph" class="types_class" onKeyPress="if ((event.keyCode &lt; 46) || (event.keyCode &gt; 57)) event.returnValue = false" tabindex="6" maxlength="11" style="width:200px; height:26px;" value="<?php if($_GET['edit_id']!='') { echo $branch_ph; } ?>" onKeyUp="enterevent(event,'delivery_ph','branch_ph')" />
      &nbsp;</td>
    <td><span class="txt">Delivery.Off.Ph</span></td>
    <td><input type="text" name="delivery_ph" id="delivery_ph" class="types_class" onKeyPress="if ((event.keyCode &lt; 46) || (event.keyCode &gt; 57)) event.returnValue = false" tabindex="7" maxlength="11" style="width:200px; height:26px;" value="<?php if($_GET['edit_id']!='') { echo $delivery_ph; } ?>" onKeyUp="enterevent(event,'delivery_off','delivery_ph')" />
      &nbsp;</td>
    <td>&nbsp;</td>
    <td width="1">&nbsp;</td>
    <td width="3">&nbsp;</td>
    </tr>
    <tr>
      <td height="37">&nbsp;</td>
      <td><span class="txt">Delivery.Off.Cell</span></td>
      <td><input type="text" name="delivery_off" id="delivery_off" class="types_class" onKeyPress="if ((event.keyCode &lt; 46) || (event.keyCode &gt; 57)) event.returnValue = false" tabindex="8" maxlength="10" style="width:200px; height:26px;" value="<?php if($_GET['edit_id']!='') { echo $delivery_off; } ?>" onKeyUp="enterevent(event,'booking_place','delivery_off')" />
      &nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      </tr>
    <tr>
      <td height="37">&nbsp;</td>
      <td colspan="4"><div id="branch_place_list_div"><?php include('branch_sublist.php') ?></div></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      </tr>
        <tr>  
    <td colspan="10" class="style7" align="center"><input type="button" name="action"  id="action" tabindex="11" value="<?php if($_GET['edit_id']!='') { echo "EDIT";  } else { echo "ADD"; } ?>" class="add_button" onClick="branch_mainlist_add(branch_no.value,branch_name.value,branch_address.value,head_off.value,branch_off.value,branch_ph.value,delivery_ph.value,delivery_off.value,'<?php echo $_GET[edit_id];;?>',this.value)" style="
    background-color: #0171b9;    color: #fff;    border: 0px;padding: 10px 15px 8px;"/>&nbsp;&nbsp;</td>
            </tr>
  </table>   
</html>