 <?php 
 if($_POST)
 {
	$bank_company_id 			=		set_value('bank_company_id',$_POST['bank_company_id']);
 	$bank_branch_id 			=		set_value('bank_branch_id',$_POST['bank_branch_id']);
	$bank_name 			        =		set_value('bank_name',$_POST['bank_name']);
	$bank_branch 			    =		set_value('bank_branch',$_POST['bank_branch']);
	$bank_acount_number 		=		set_value('bank_acount_number',$_POST['bank_acount_number']);
	$bank_acount_type 			=		set_value('bank_acount_type',$_POST['bank_acount_type']);
	$bank_opening_balance 		=		set_value('bank_opening_balance',$_POST['bank_opening_balance']);
	$opening_balance_type 		=		set_value('opening_balance_type',$_POST['opening_balance_type']);
 	$ifsc_code 			        =		set_value('ifsc_code',$_POST['ifsc_code']);
			
			 
}
else
{
	$bank_company_id 			  =		'';
	$bank_branch_id			      =		'';
	$bank_name			          =		'';
	$bank_branch			      =		'';
	$bank_acount_number 		  =		'';
	$bank_acount_type			  =		'';
	$bank_opening_balance 		  =		'';
	$opening_balance_type		  =		'';
	$ifsc_code		              =		'';
 
}

 ?>
 <div class="box-body">
 	<div style="color:red;" class="error"><strong><?php if($this->session->flashdata('error')){ echo $this->session->flashdata('error');} ?></strong></div>
    <form role="form" id="add_bank" name="add_bank" action="<?php echo base_url();?>General_masters/add_bank" method="post">
    	<div class="col-md-4">
            <div class="form-group">
                <label>Company Name</label><?php echo form_error('parent_id');?>
                <select class="form-control select2" id="parent_id" name="parent_id">
                	<option value="">Select Parent Ledger Group Name</option>
                  	<?php foreach($ledger_drpdwn as $row)
                  	{?>
                  		<option value="<?php echo $row['ledger_id'];?>" <?php if($parent_id==$row['ledger_id'])echo "selected";?>><?php echo $row['ledger_group_name'];?></option>
                  	<?php }?>                	
                </select>             
            </div>
			<div class="form-group">
                <label>Branch Name </label><?php echo form_error('parent_id');?>
                <select class="form-control select2" id="parent_id" name="parent_id">
                	<option value="">Select Parent Ledger Group Name</option>
                  	<?php foreach($ledger_drpdwn as $row)
                  	{?>
                  		<option value="<?php echo $row['ledger_id'];?>" <?php if($parent_id==$row['ledger_id'])echo "selected";?>><?php echo $row['ledger_group_name'];?></option>
                  	<?php }?>                	
                </select>             
            </div>
			<div class="form-group">
                <label>Bank Name</label><?php echo form_error('parent_id');?>
                <select class="form-control select2" id="parent_id" name="parent_id">
                	<option value="">Select Parent Ledger Group Name</option>
                  	<?php foreach($ledger_drpdwn as $row)
                  	{?>
                  		<option value="<?php echo $row['ledger_id'];?>" <?php if($parent_id==$row['ledger_id'])echo "selected";?>><?php echo $row['ledger_group_name'];?></option>
                  	<?php }?>                	
                </select>             
            </div>
	        <div class="form-group">
	       
	              <label>Account Number</label><?php echo form_error('parent_id');?>
                <select class="form-control select2" id="parent_id" name="parent_id">
                	<option value="">Select Parent Ledger Group Name</option>
                  	<?php foreach($ledger_drpdwn as $row)
                  	{?>
                  		<option value="<?php echo $row['ledger_id'];?>" <?php if($parent_id==$row['ledger_id'])echo "selected";?>><?php echo $row['ledger_group_name'];?></option>
                  	<?php }?>                	
                </select>     
	        </div>
	        
	        <div class="form-group">
                <label>Acount Type</label><?php echo form_error('parent_id');?>
                <select class="form-control select2" id="parent_id" name="parent_id">
                	<option value="">Select Parent Ledger Group Name</option>
                  	<?php foreach($ledger_drpdwn as $row)
                  	{?>
                  		<option value="<?php echo $row['ledger_id'];?>" <?php if($parent_id==$row['ledger_id'])echo "selected";?>><?php echo $row['ledger_group_name'];?></option>
                  	<?php }?>                	
                </select>             
            </div>
	        
	    </div>
    	<div class="col-md-4">
	        
			<div class="form-group">
                <label>Opening Balance</label><?php echo form_error('parent_id');?>
                <select class="form-control select2" id="parent_id" name="parent_id">
                	<option value="">Select Parent Ledger Group Name</option>
                  	<?php foreach($ledger_drpdwn as $row)
                  	{?>
                  		<option value="<?php echo $row['ledger_id'];?>" <?php if($parent_id==$row['ledger_id'])echo "selected";?>><?php echo $row['ledger_group_name'];?></option>
                  	<?php }?>                	
                </select>             
            </div>
			<div class="form-group">
                <label>Opening Balance Type</label><?php echo form_error('parent_id');?>
                <select class="form-control select2" id="parent_id" name="parent_id">
                	<option value="">Select Parent Ledger Group Name</option>
                  	<?php foreach($ledger_drpdwn as $row)
                  	{?>
                  		<option value="<?php echo $row['ledger_id'];?>" <?php if($parent_id==$row['ledger_id'])echo "selected";?>><?php echo $row['ledger_group_name'];?></option>
                  	<?php }?>                	
                </select>             
            </div>
			<div class="form-group">
                <label>IFSC Code</label><?php echo form_error('parent_id');?>
                <select class="form-control select2" id="parent_id" name="parent_id">
                	<option value="">Select Parent Ledger Group Name</option>
                  	<?php foreach($ledger_drpdwn as $row)
                  	{?>
                  		<option value="<?php echo $row['ledger_id'];?>" <?php if($parent_id==$row['ledger_id'])echo "selected";?>><?php echo $row['ledger_group_name'];?></option>
                  	<?php }?>                	
                </select>             
            </div>
	        <div class="form-group">
            <div class="col-md-6"></div>
            	<div class="col-md-6"><input type="submit" id="submit" name="submit" class="btn btn-info" value="Save">
            	<a href="<?php echo base_url()?>General_masters/bank"><button type="button" class="btn btn-warning">Cancel</button></a></div>
            </div>
	        
	        
	        
            
	    </div>
    	<div class="col-md-4 form-group has-warning">
    		<h4><label>Recently Listed Ledger Group</label></h4>
    		<div class="box box-warning">
			    <table class="table table-bordered table-hover">
			        <thead>
			            <tr>
			                <th>Name</th>
			                <th>Parent 	Ledger Group Name</th>
			                
			            </tr>
			        </thead>
			        <tbody>
	        			<?php if(count($recent_list)!=0)
	        			{
	        				foreach($recent_list as $row)
	        				{?>
		    					<tr>
		    						<td><a href="<?php echo base_url();?>General_masters/edit_ledgergroup/<?php echo $row['bank_id'];?>"><strong><?php echo $row['bank_name'];?></strong></a></td>
		    						<td><?php echo $row['bank_name'];?></td>
		    					 
		    					</tr>
	        				<?php }
	        			}
	        			else
	        			{?>
	        				<tr><td colspan="3">Data Not Found</td></tr>
	        			<?php }?>
			        </tbody>
			    </table>
			    <a class="text-red" href="<?php echo base_url();?>General_masters/ledgergroup"><strong>View All Bank Lists</strong></a>
		    </div>
	    </div>
	</form>
    <!-- /.box-body -->
</div>

<script type="text/javascript">
	$(function()
	{
		setTimeout(company_select);
	});
	function company_select()
	{
		$("#branch_cmp_id").select2({
			ajax: { 
				dataType: 'json', 
				url: '<?php echo base_url();?>General_masters/get_company',
				cache: true,
				data: function (params) 
					{
						return {
							q: params.term
						}
					}
			}
		});
	}
</script>