<?php 
include "includes/header.php"; 
include "includes/Mdme-functions.php";
$mdme = getMdmeCompany($db,'');
include_once "includes/pagepermission.php";

include "common/dpselect-functions.php";

//check permission - START
if(!($res_modm_prm)){
	header("Location:".admin_public_url."error.php");
}
//check permission - END

$id=$_REQUEST['id'];
if($id!="")
{
	
//check edit permission - START	
if(trim($res_modm_prm['EditPrm'])=="0") {
?>
<script>
  window.location="error.php";
</script>
<?php	
}
//check edit permission - END	

$operation="Edit";
$act="update";
$btn='Update';

$str_ed = "select * from m_banks where IsActive != '2' and bank_id = '".base64_decode($id)."' ";
$res_ed = $db->get_a_line($str_ed);

$edit_id = $res_ed['bank_id'];

$chk='';
if($res_ed['IsActive']=='1')
{
	$chk='checked';
}

}
else
{
	
//check edit permission - START	
if(trim($res_modm_prm['AddPrm'])=="0") {
?>
<script>
  window.location="error.php";
</script>
<?php	
}
//check edit permission - END
	$operation="Add";
	$act="insert";
	$btn='Save';
}
?>  

<div class="wrapper">
    <div class="container">        
		<!-- Page-Title - START -->
        <div class="row">
            <div class="col-sm-12">										
                <h4 class="page-title"><?php echo $operation; ?> Bank Information</h4>				
            </div>
        </div>
		<!-- Page-Title - END -->
							
		<div class="row">
			<div class="col-sm-12">
				<form id="jvalidate" name="frmBank" role="form" class="form-horizontal" action="#" method="post" enctype="multipart/form-data" >
				<input type="hidden" name="action" value="<?php echo $act; ?>" />
				<input type="hidden" name="edit_id" id="edit_id" value="<?php echo $edit_id; ?>"  />
				
					<div class="card-box">	

						<div class="form-group row">
							<label class="col-md-2 form-control-label">Select Company<span class="text-danger">*</span></label>
							<div class="col-md-8">											
								<?php 
									echo getSelectBox_companylist($db,'sel_company','jsrequired',$res_ed['company_id']);
								?>											
							</div>
						</div>	
						
						<div class="form-group row">
							<label class="col-md-2 form-control-label">Bank Name<span class="text-danger">*</span></label>
							<div class="col-md-10">											
								<input type="text" class="form-control jsrequired" name="txt_bank_name" id="txt_bank_name" value="<?php echo $res_ed['bank_name']; ?>" />										
							</div>
						</div>	
						
						<div class="form-group row">
							<label class="col-md-2 form-control-label">Account No<span class="text-danger">*</span></label>
							<div class="col-md-10">											
								<input type="text" class="form-control jsrequired" name="txt_acc_no" id="txt_acc_no" value="<?php echo $res_ed['account_no']; ?>" />								
							</div>
						</div>	
						
						<div class="form-group row">
							<label class="col-md-2 form-control-label">Branch<span class="text-danger">*</span></label>
							<div class="col-md-10">											
								<input type="text" class="form-control jsrequired" name="txt_branch" id="txt_branch" value="<?php echo $res_ed['branch_name']; ?>" />							
							</div>
						</div>	
						
						<div class="form-group row">
							<label class="col-md-2 form-control-label">IFSC Code<span class="text-danger">*</span></label>
							<div class="col-md-10">											
								<input type="text" class="form-control jsrequired" name="txt_ifsc_code" id="txt_ifsc_code" value="<?php echo $res_ed['ifsc_code']; ?>" />							
							</div>
						</div>	
						
						<div class="form-group row">
							<label class="col-md-2 form-control-label">Customer Id</label>
							<div class="col-md-10">											
								<input type="text" class="form-control" name="txt_bank_cus_id" id="txt_bank_cus_id" value="<?php echo $res_ed['bank_cus_id']; ?>" />							
							</div>
						</div>	
						
						<div class="form-group row">
							<label class="col-md-2 form-control-label">Debit Card No</label>
							<div class="col-md-10">											
								<input type="text" class="form-control" name="txt_debit_card_no" id="txt_debit_card_no" value="<?php echo $res_ed['bank_debit_card_no']; ?>" />						
							</div>
						</div>	
						
						<div class="form-group row">
							<label class="col-md-2 form-control-label">Authorized Name</label>
							<div class="col-md-10">											
								<input type="text" class="form-control" name="txt_auth_name" id="txt_auth_name" value="<?php echo $res_ed['authorized_name']; ?>" />						
							</div>
						</div>	
						
						
						<div class="row">
							<div class="col-sm-8">&nbsp;</div>
					
							<div class="col-sm-4">						
								<div class="form-group">
									<div class="btn-group pull-right m-t-15">
										<button class="btn btn-primary waves-effect waves-light" type="button" onClick="javascript:funSubmtWithImg('frmBank','banks_actions.php','jvalidate','banks','banks_mng.php');" >Submit</button>	
													 
										<button class="btn btn-secondary waves-effect m-l-5" type="button" onClick="javascript:funCancel('frmBank','jvalidate','banks','banks_mng.php');" >Cancel</button>
									</div>
								</div>						
							</div>
							
						</div>
										
						
					</div>
					
				</form>
            </div>
        </div> <!-- end row -->	
			

<?php include "includes/footer.php";  ?> 
	 </div> <!-- container -->
</div> <!-- End wrapper -->

<?php include "includes/footer_script.php";  ?> 

</body>
</html>
	  