<?PHP 
include("header.php");
//session_start();
//error_reporting(0);

$id=$_REQUEST['id'];

include "checksession.php";

include ("include/db-connect.php");

if(isset($_REQUEST['submit']))
 {
	 $bname=$_REQUEST['bname'];
	   $account=$_REQUEST['account'];
	  $aname=$_REQUEST['aname'];
	   $branch=$_REQUEST['branch'];
	    $ifsc=$_REQUEST['ifsc'];
	
//---------------------Small photo Png  edit coding start------------------------------	
	  $small_jpg=$_FILES['small_jpg']['name'];


       $viewid="select * from bank_det where id='$id'";
       $resultid=mysql_query($viewid);
	   $rowid= mysql_fetch_row($resultid);

	       $id1=$rowid[0]; 
		 
		   $photo_1=$rowid[6]; 

	        $filename=$id1.$small_jpg; 

  $uploaddir='sample/';
  $uploadfile=$uploaddir.$filename;

move_uploaded_file($_FILES['small_jpg']['tmp_name'],$uploadfile);
	
 if($small_jpg==NULL)
		  {
		  
   $imag_photo=$photo_1;
}
else
{
   $imag_photo=$uploadfile; 
 	
	}
//---------------------Small photo Png edit coding end------------------------------		 
	 
 $upd_qur="UPDATE bank_det SET bname='$bname',account='$account',aname='$aname',branch='$branch',ifsc='$ifsc',image='$imag_photo' where id='$id'";
			
    $exce=mysql_query($upd_qur);
	
	?>
    <script>
	window.location='view_bankdetails.php?edit=success';
	</script>
    <?
		                   
     //header("location:view_bankdetails.php?edit=success"); 
}
 
 ?>
  <div id="content">
  <div class="breadcrumb">
       <!-- <a href="http://amarasudhan.com/admin/index.php?route=common/home&amp;token=b735cc089ec2d51abb9a8e1901f501fb">Home</a>-->
      </div>
              <div class="box">
    <div class="heading">
      <h1><img src="view/image/home.png" alt="" />Dashboard > <? echo $array['menu'] ?> Edit Bank Details</h1>
    </div>
    <div class="content">
      <div class="overview" style="width:50%; margin-left:300px;">
        <div class="dashboard-heading"> Bank Details</div>
        <div class="dashboard-content">
 
  <?php
if($_REQUEST['add'] == 'success') {echo $result= '<h4 class="alert_success"> Added Successfully </h4>';}
elseif($_REQUEST['add'] == 'fail'){echo $result= '<h4 class="alert_error"> Already Exit</h4>';}
?>	
 <?php
 $id=$_REQUEST['id']; 
 $sel="select * from bank_det where id=$id";
 $run=mysql_query($sel);
 $array=mysql_fetch_array($run);
  
 ?>

  <form action="" method="post" enctype="multipart/form-data" id="question" >
  <!--<script type="text/javascript" src="../prototype.js"></script>
  <script type="text/javascript" src="../validation.js"></script>
  <script src="../ckeditor.js"></script>-->
		<div class="add_row" style="margin-top:20px"><div id="wrapper">
		<div class="wrap_box">
        
                           <div style="float:left;width:200px;">Bank Name&nbsp;<font color="#FF0000">*</font>	</div> 
							<div id="txtHintstate" style="margin-left:200px;">
                            <input  type="text"  name="bname" size="19" class="required" value="<?php echo $array['bname']; ?>">
                            </div><div class="spacer"></div>
                         
                           <br />
                            <div style="float:left;width:200px;">Account No.&nbsp;<font color="#FF0000">*</font>	</div> 
							<div id="txtHintstate" style="margin-left:200px;">
                            <input  type="text"  name="account" size="19" class="required" value="<?php echo $array['account']; ?>">
                            </div><div class="spacer"></div>  <br />
                            
                            
                            <div style="float:left;width:200px;">Account Name&nbsp;<font color="#FF0000">*</font>	</div> 
							<div id="txtHintstate" style="margin-left:200px;">
                            <input  type="text"  name="aname" size="19" class="required" value="<?php echo $array['aname']; ?>">
                            </div><div class="spacer"></div>
                             <br />
                            
                            
                            <div style="float:left;width:200px;">Branch&nbsp;<font color="#FF0000">*</font>	</div> 
							<div id="txtHintstate" style="margin-left:200px;">
                            <input  type="text"  name="branch" size="19" class="required" value="<?php echo $array['branch']; ?>">
                            </div><div class="spacer"></div>
                             <br />
                         
                            <div style="float:left;width:200px;">IFSC Code&nbsp;<font color="#FF0000">*</font>	</div> 
							<div id="txtHintstate" style="margin-left:200px;">
                            <input  type="text"  name="ifsc" size="19" class="required" value="<?php echo $array['ifsc']; ?>">
                            </div><div class="spacer"></div>
                             <br />
                            
                            
                            <div style="float:left;width:200px;">Bank Logo&nbsp;<font color="#FF0000">*</font>	</div> 
							<div id="txtHintstate" style="margin-left:200px;">
                            <input  type="file"  name="small_jpg" size="55">
                            <img src="<?php echo $array['image']; ?>" width="50" height="50">
                            </div><div class="spacer"></div>
                             <br />
                       <div class="add_row" style="margin-left:195px;">
                      <p><span class="maintextbox"> <input type="submit" name="submit" id="button" value="Submit" > </span></p>
                      </div></div><!-- End option--></div><!-- End add_row-->
                      </div>
 
   </form>
   
        </div>
      </div>
      
      
    </div>
  </div>
</div>
<!--[if IE]>
<script type="text/javascript" src="view/javascript/jquery/flot/excanvas.js"></script>
<![endif]--> 
<script type="text/javascript" src="view/javascript/jquery/flot/jquery.flot.js"></script> 
<script type="text/javascript"><!--
function getSalesChart(range) {
	$.ajax({
		type: 'get',
		url: 'index.php?route=common/home/chart&token=b735cc089ec2d51abb9a8e1901f501fb&range=' + range,
		dataType: 'json',
		async: false,
		success: function(json) {
			var option = {	
				shadowSize: 0,
				lines: { 
					show: true,
					fill: true,
					lineWidth: 1
				},
				grid: {
					backgroundColor: '#FFFFFF'
				},	
				xaxis: {
            		ticks: json.xaxis
				}
			}

			$.plot($('#report'), [json.order, json.customer], option);
		}
	});
}

getSalesChart($('#range').val());
//--></script> 
</div>
<div id="footer">Copyright &copy; 2014 | Powered by <a href="http://linikantech.com/" target="_blank">Linikantech</a><!--<a href="http://www.opencart.com">OpenCart</a> &copy; 2009-2016 All Rights Reserved.<br />Version 1.5.6.4--></div>
</body></html>