<div class="wrapper">
    <div class="container">
        <!-- Page-Title -->
        <div class="row">
            <div class="col-sm-12">
                <h4 class="page-title">Transfer Retained Amount From <?php echo $this->session->userdata('business'); ?>:</h4>
            </div>
        </div>
        <?php if ($this->session->flashdata('Success') && $this->session->flashdata('Success') != ""){  ?>
        <div class="row">
            <div class="col-sm-12">
                <div class="alert alert-success">
                    <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                    <strong>Success!</strong> <?php echo $this->session->flashdata('Success'); ?>
                </div>
            </div>
        </div>
        <?php } ?>
        <?php if ($this->session->flashdata('Error') && $this->session->flashdata('Error') != ""){  ?>
        <div class="row">
            <div class="col-sm-12">
                <div class="alert alert-danger">
                    <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                    <strong>Error!</strong> <?php echo $this->session->flashdata('Error'); ?>
                </div>
            </div>
        </div>
        <?php } ?>
        <div class="row">
            <div class="col-lg-12">
                <div class="card-box">
                    <div class="row">
                        <?php if($invoice_retained){?>
                        <div class="col-md-4"><h4>Retained Through Invoices <span class="text-danger">(Cannot be Transfered):</span></h4></div>
                        <table class="table table-striped">
                            
                            
                            <tr>
                                <td><?php echo $invoice_retained['customer_id']; ?></td>
                                <td><?php echo $invoice_retained->customer_name;?></td>
                                <td><?php echo $invoice_retained->customer_type;?></td>
                                <td><?php echo $invoice_retained->retained;?></td>
                            </tr>
                            
                            
                        </table>
                        <?php } ?>
                    </div>
                    <div class="row">
                        <?php if($voucher_retained){?>
                        <div class="col-md-4"><h4>Retained Through Vouchers:</h4></div>
                        <table class="table table-striped">
                            <thead>
                                <th>Customer ID</th>
                                <th>Customer Name</th>
                                <th>Customer Type</th>
                                <th>Retained</th>
                                <th>Transfer Amount</th>
                                <th>To Branch</th>
                                <th>Acion</th>
                            </thead>
                            <tbody>
                            <tr>
                            <form method="post" action='<?php echo base_url();?>accounting_controller/retainedtransfervoucher' >
                                <td><input type='hidden' name='customer_id' value='<?php echo $voucher_retained->customer_id; ?>'><?php echo $voucher_retained->customer_id; ?></td>
                                <td><input type='hidden' name='customer_name' value='<?php echo $voucher_retained->customer_name; ?>'><?php echo $voucher_retained->customer_name;?></td>
                                <td><?php echo $voucher_retained->customer_type;?></td>
                                <td><?php echo $voucher_retained->retained;?></td>
                                <td><input name='transferamount' type="number" onKeyUp="if(this.value><?php echo $voucher_retained->retained;?>){this.value=<?php echo $voucher_retained->retained;?>;}" max="<?php echo $voucher_retained->retained;?>" value='<?php echo $voucher_retained->retained;?>'/></td>
                                <td>
                                    <select name='tobranch' id="tobranch">
                                        <?php foreach($businesses as $business){?>
                                        <?php if($business['id_business']!==$this->session->userdata('businessid')){?>
                                        <option value='<?php echo $business['id_business'];?>'><?php echo $business['business_name'];?></option>
                                        <?php } ?>
                                        <?php } ?>
                                    </select>
                                    <input type='hidden' name='frombranch' value='<?php echo $this->session->userdata('businessid')?>' />
                                </td>
                                <td><button type='submit' class="btn btn-small btn-pink">Transfer</button> </td>
                            </form>
                            </tr>
                            </tbody>
                          
                            
                        </table>
                        <?php } ?>
                    </div>
                 
                </div>
            </div>
        </div>
