      <style>
	  	.float-right{
			  text-align:right !important;
		  }
		 .iframe{
			 width:80%;
			 height:80%;
			 visibility:hidden;
		  }
		  #wrap2 { width: 600px; height: 390px; padding: 0; overflow: hidden; }
		  #iFramePdf2 { width: 800px; height: 520px; border: 1px solid black; }
		  #iFramePdf2 { -ms-zoom: 0.75; -moz-transform: scale(0.75); -moz-transform-origin: 0 0; }
		  
		  #wrap
		  {
			  width: 320px;
			  height: 192px;
			  padding: 0;
			  overflow: hidden;
		  }

		  #iFramePdf
		  {
			  width: 1280px;
			  height: 786px;
			  border: 0;
		  
			  -ms-transform: scale(0.25);
			  -moz-transform: scale(0.25);
			  -o-transform: scale(0.25);
			  -webkit-transform: scale(0.25);
			  transform: scale(0.25);
		  
			  -ms-transform-origin: 0 0;
			  -moz-transform-origin: 0 0;
			  -o-transform-origin: 0 0;
			  -webkit-transform-origin: 0 0;
			  transform-origin: 0 0;
		  }
	  </style>
           	
      <?php 
	    if(isset($sess_data))
		  echo $sess_data['JSFunction'];
//		  {
//			 foreach($sess_data as $key=>$val)
//			  {
//		  		print_r($val);
//			  } 
//		  }
		  		
	  ?>
      <!-- Content Wrapper. Contains page content -->
      <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            Process Payment
          </h1>
          <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            <li><a href="#">Payments</a></li>
            <li class="active">Process Payment</li>
          </ol>
        </section>

        <!-- Main content -->
        <section class="content">
          <div class="row">  
                                     
              <div class="col-md-5">
              <div class="box box-success">
              <div class="box-header with-border">
                <h3 class="box-title">Summary</h3>
              </div><!-- /.box-header -->
                  <div class="box-body">
       
                      <form role="form">
                       	 <div class="form-group">
                          <label class="col-sm-7 blue-btn control-label info_field">Share Capital</label>
                          <div class="col-sm-5 info_field">                        	
                  		  <input type="text" class="form-control green" value="42500" readonly >
                          </div>
                          </div>
                          <div class="form-group">
                          <label class="col-sm-7 blue-btn control-label info_field">Loan Balance</label>
                          <div class="col-sm-5 info_field">                        	
                  		  <input type="text" class="form-control magenta"  value="35700" readonly >
                          </div>
                          </div>
                          <div class="form-group">
                          <label class="col-sm-7 blue-btn control-label info_field">Interest</label>
                          <div class="col-sm-5 info_field">                        	
                  		 <input type="text" class="form-control magenta" value="4750" readonly >
                          </div>
                          </div>
                          <div class="form-group">
                          <label class="col-sm-7 blue-btn control-label info_field">Penalties</label>
                          <div class="col-sm-5 info_field">                        	
                          <input type="text" class="form-control red" value="0.00" readonly >
                          </div>
                          </div>
                          <div class="form-group">
                          <label class="col-sm-7 blue-btn control-label info_field">Money Bound</label>
                          <div class="col-sm-5 info_field">                        	
                  	      <input type="text" class="form-control purple" value="39200" readonly >
                          </div>
                          </div>
                          <div class="form-group">
                          <label class="col-sm-7 blue-btn control-label info_field">Free Shares</label>
                          <div class="col-sm-5 info_field">                        	
                  		  <input type="text" class="form-control green" value="4740" readonly="readonly" >
                          </div>
                          </div>
                         </form>
                      </div><!-- /.box-body -->
                  </div> <!-- /.box --> 
                <div id="wrap">
                <?php $receipt = isset($sess_data['receiptName'])?$sess_data['receiptName']:'null'?>
          		<iframe class="iframe" id="iFramePdf" src="<?php echo base_url();?>documents/receipts/<?php echo $receipt ?>"></iframe>
                </div>
              </div>  
                            
             <div class="col-md-7">
             	<div class="box box-success">
                  <div class="box-header with-border">
                   <h3 class="box-title">Payment Breakdown</h3>
                   <h4 class="box-title pull-right purple"><?php echo date("d/m/Y -  g:i:s a"); ?></h4>
                  </div><!-- /.box-header -->
                    <form role="form" class="form-horizontal" name="payments" action="<?php echo site_url();?>payments/insert_payment" method="post" id="payments">                    
                     <div class="box-body">
                    
                    <div class="form-group">
                    <div class="col-sm-6">
                    <select class="form-control  reg_label" id="select2" name="subject_id">
                      <option></option>
                       <?php
						  if($members ==NULL)
							  {
								  echo "No members to Show";
							  }
						  else
							  {
								  foreach($members as $member)
									  {
										   echo " <option value='".$member['user_id']."'>".$member['name']." - ".$member['member_no']."</option>";
									  }
							  }				
					?>
                    </select>
                    </div>
                    <div class="col-sm-6">
                    <?php echo form_error('member_name'); ?> 
                    <input type="text" class="form-control" id="demo" name="member_name" value="" readonly>
                    <input type="hidden" id="subject_id" name="subject_id" value="" />
                    </div>
                  </div>                  
               		
                      
                        <div class="form-group">
                        <label for="reg_fee" class="col-sm-6 control-label float-right">Reg. Fee</label>
                        <div class="col-sm-6">                        	
                        <input type="text" class="form-control" id="reg_fee" name="reg_fee" value="<?php echo set_value('reg_fee'); ?>" placeholder="0.00" onkeyup="computePayments();">
                        </div>
                        </div>
                        <div class="form-group">
                        <label for="share_capital" class="col-sm-6 control-label float-right">Share Capital</label>
                        <div class="col-sm-6">                        	
                        <input type="text" class="form-control" id="share_capital" name="share_capital"  value="<?php echo set_value('share_capital'); ?>" placeholder="0.00" onkeyup="computePayments();">
                        </div>
                        </div>
                        <div class="form-group">
                        <label for="service_charge" class="col-sm-6 control-label float-right">Service Charge</label>
                        <div class="col-sm-6">                        	
                        <input type="text" class="form-control" id="service_charge" name="service_charge" value="<?php echo set_value('service_charge'); ?>" placeholder="0.00" onkeyup="computePayments();">
                        </div>
                        </div>
                        <div class="form-group">
                        <label for="loan_repay" class="col-sm-6 control-label float-right">Loan Repayment</label>
                        <div class="col-sm-6">                        	
                        <input type="text" class="form-control" id="loan_repay" name="loan_repay" value="<?php echo set_value('loan_repay'); ?>" placeholder="0.00" onkeyup="computePayments();">
                        </div>
                        </div>
                        <div class="form-group">
                        <label for="interest" class="col-sm-6 control-label float-right">Loan Interest</label>
                        <div class="col-sm-6">                        	
                        <input type="text" class="form-control" id="interest" name="interest" value="<?php echo set_value('interest'); ?>" placeholder="0.00" onblur="computePayments();">
                        </div>
                        </div>
                        <div class="form-group">
                        <label for="loan_penalty" class="col-sm-6 control-label float-right">Loan penalty</label>
                        <div class="col-sm-6">                        	
                        <input type="text" class="form-control" id="loan_penalty" name="loan_penalty" value="<?php echo set_value('loan_penalty'); ?>" placeholder="0.00" onkeyup="computePayments();">
                        </div>
                        </div>
                        <div class="form-group">
                        <label for="default_penalty" class="col-sm-6 control-label float-right">Default Penalty</label>
                        <div class="col-sm-6">                        	
                        <input type="text" class="form-control" id="default_penalty" name="default_penalty" value="<?php echo set_value('default_penalty'); ?>" placeholder="0.00" onkeyup="computePayments();">
                        </div>
                        </div>
                        <div class="form-group">
                        <label for="withdrawal_fee" class="col-sm-6 control-label float-right">Withdrawal Fee</label>
                        <div class="col-sm-6">                        	
                        <input type="text" class="form-control" id="withdrawal_fee" name="withdrawal_fee" value="<?php echo set_value('withdrawal_fee'); ?>" placeholder="0.00" onkeyup="computePayments();">
                        </div>
                        </div>
                      </div><!-- /.box-body -->
                   	<div class="box-footer">
                   	<div class="form-group">
                        <label for="total" class="col-sm-6 control-label float-right">Total Amount Received</label>
                        <div class="col-sm-6">  
                        <?php echo form_error('total'); ?>                    	
                        <input type="text" class="form-control" id="total" name="total" value="<?php echo set_value('total'); ?>" placeholder="0.00" readonly="readonly">
                        </div>
                        </div>
                    <div class="clear-fix form-group"></div>
                    <div class="form-group">
                        <div class="col-sm-6">
                        <button type="reset" class="btn btn-danger btn-block">Reset</button>
                        </div>
                        <div class="col-sm-6">
                        <button type="submit" class="btn btn-success btn-block">Submit</button>
                        </div>
                    </div>
                  </div><!-- /.box-footer -->
                    </form>
                 
               </div><!-- /.box -->     
          </div>
              
        </div>   <!-- /.row -->
      </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
    
    <!--JS for the process payment form-->
    <script type="text/javascript">													
		  $("#select2").on("change", function() {
		  $("#subject_id").val( $(this).find("option:selected").val() );
		  $("#demo").val( $(this).find("option:selected").text() );													
		});	
												
	  	function validateInput(val)
		{		
			var val = val;
			if (val == "")
				{
					val = 0;
					return val;	
				}
			else if  (isNaN(val))
				{
					alert("Must input numbers");
					return false;	
				}
			else
			{ 
				var val = val;
				return val;
			}		
		}
  	  function computePayments()
	  {
		  var reg_fee = validateInput(document.getElementById("reg_fee").value);
		  var share_capital = validateInput(document.getElementById("share_capital").value);
		  var service_charge = validateInput(document.getElementById("service_charge").value);
		  var loan_repay = validateInput(document.getElementById("loan_repay").value);
		  var interest = validateInput(document.getElementById("interest").value);
		  var loan_penalty = validateInput(document.getElementById("loan_penalty").value);
		  var default_penalty = validateInput(document.getElementById("default_penalty").value);
		  var withdrawal_fee = validateInput(document.getElementById("withdrawal_fee").value);	
	  
		  var sum =parseInt(reg_fee)+parseInt(share_capital)+parseInt(service_charge)+parseInt(loan_repay)+parseInt(interest)+parseInt(loan_penalty)+parseInt(default_penalty)+parseInt(withdrawal_fee);
					  
		  document.getElementById("total").value = sum;
	  
	  }													
	</script>