<div class="page-content" >
    <div class="row" >
        <div class="col-sm-12">
            <div class="widget-box">
                <div class="widget-header" style="height:40px;">
                    <h5  style="text-align:center; color:red;"><b>Search By Month</b> </h5>
                </div>

                <div class="widget-body">
                    <div class="widget-main no-padding">
                        <form action="<?php echo admin_url()?>/extraincomesetup/searchIncome/month" method="post">

                            <fieldset class="col-xs-6 col-sm-6">
                                <div class="col-xs-4 col-sm-4"><label>Date From</label></div>
                                <?php echo form_error('data[fromdate]', '<div style="color: rgb(255, 0, 0);">', '</div>'); ?>
                                <div class="input-group col-xs-8 col-sm-8">
                                    <input class="form-control date-picker" id="id-date-picker-1" type="text" name="data[fromdate]" value="<?php echo set_value('data[fromdate]',false); ?>" data-date-format="dd-mm-yyyy" />
                                    <span class="input-group-addon">
                                        <i class="fa fa-calendar bigger-110"></i>
                                    </span>
                                </div>
                            </fieldset>

                            <fieldset class="col-xs-6 col-sm-6">
                                <div class="col-xs-4 col-sm-4"><label>Date To</label></div>
                                <?php echo form_error('data[todate]', '<div style="color: rgb(255, 0, 0);">', '</div>'); ?>
                                <div class="input-group col-xs-8 col-sm-8">
                                    <input class="form-control date-picker" id="id-date-picker-1" type="text" name="data[todate]" value="<?php echo set_value('data[todate]',false); ?>" data-date-format="dd-mm-yyyy" />
                                    <span class="input-group-addon">
                                        <i class="fa fa-calendar bigger-110"></i>
                                    </span>
                                </div>
                            </fieldset>


                            <div class="clearfix"></div>

                            <div class="form-actions center">
                                <button type="submit" name="btnSdateRange" class="btn btn-sm btn-success">
                                    <i class="ace-icon fa fa-undo bigger-110"></i>
                                    Search Income By Month
                                </button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>



<div class="page-content" >
    <br>
    <a href="<?php echo base_url('admin/extraincomesetup/incomeSearch');?>"><b>Back to Search</b></a>

    <div class="row">
        <?php
        $message = $this->session->userdata('message');
        if (!empty($message)) {
            ?>
            <div class="alert alert-block alert-success">
                <h6 class="lighter arial green"><b>
                        <?php echo $message;
                        $this->session->unset_userdata('message');
                        ?>
                    </b></h6>
            </div>
            <?php
        }
        $errormessage = $this->session->userdata('errormessage');
        if (!empty($errormessage)) {
            ?>
            <div class="alert alert-block alert-danger">
                <h6 class="lighter arial red"><b>
                        <?php echo $errormessage;
                        $this->session->unset_userdata('errormessage');
                        ?>
                    </b></h6>
            </div>
            <?php
        }
        ?>

        <?php if(!empty($allincome)){?>
            <div class="col-xs-12">
                <div class="row">
                    <div class="col-xs-12">
                        <?php $adminLebel=$this->session->userdata('admin_level');?>

                        <div class="clearfix">
                            <div class="pull-right tableTools-container"></div>
                        </div>
                        <div class="table-header" style="height:60px;">
                            <h3 style="text-align:center;">Income From Customer In
                                <?php if(isset($year)){echo 'Year : '.$year;}?>
                                <?php if(isset($from_date) && isset($to_date)){echo '<br>From '.$from_date.' To '.$to_date;}?>
                            </h3>
                        </div>
                        <div>
                            <table id="dynamic-table" class="table table-striped table-bordered table-hover">
                                <thead>
                                <tr style="color:red;">


                                    <th style="color:red;">CustomerId & Name</th>
                                    <th>Ref ID & Name</th>
                                    <!--<th>Payment Process</th>-->

                                    <th>
                                        Amount
                                    </th>

                                    <th >Date</th>
                                    <th>
                                        Payment Description
                                    </th>
                                    <th>
                                        Receiver Id & Name
                                    </th>
                                    <th>Action</th>
                                </tr>
                                </thead>

                                <tbody>

                                <?php
                                $i=0;
                                foreach($allincome as $value){?>

                                    <tr>
                                        <td style="color:red;"><?php echo ++$i.'  .';?>
                                            Id :&nbsp;&nbsp;<?php echo $value['customerId'];?><br/>
                                            Name:&nbsp;&nbsp;

                                            <?php  $sl_id = getlandCustomerslIdById($value['customerId']);?>
                                            <a href="<?php  echo base_url('admin/landcustomerRegistration/viewProfile').'/'.$sl_id[0]['id'];?>">
                                                <?php
                                                    $app_name=getlandCustomerNameById($value['customerId']);
                                                    echo $app_name['applicant_name'];
                                                ?>
                                                <?php
                                                    $refname=getlandCustomerNameById($value['customerId']);
                                                    echo $refname['ref_id'];
                                                ?>
                                            </a>
                                            
                                        </td>
                                        <td>
                                            <?php if(!empty($allEmployeeId) && $allEmployeeId['userId']=$refname['ref_id']){
                                                               $custref= $allEmployeeId['userId']; $emp_usrname=getEmployeeById($allEmployeeId['userId']); 
                                            }?>                                                
                                                <?php
                                                if(!empty($custref)){
                                                                    echo "<a href='".base_url('admin/employeesetup/view_profile').'/'.$custref."'>".$custref." ".$emp_usrname['userName']."</a></br>";
                                                                }                                                                
                                                        ?>
                                        </td>
                                        <!--<td >-->
                                            <?php
                                            // if(!empty($value['paymentProcess']))
                                            // {
                                            //     foreach(getPaymentProcess() as $key=>$val)
                                            //     {
                                            //         if($value['paymentProcess']==$key){echo $val;}
                                            //     }
                                            // }
                                            // if(!empty($value['pay_order_ddNo']))
                                            // {
                                            //     echo "  ( Number- ".$value['pay_order_ddNo']."  )";
                                            // }
                                            ?>
                                        <!--</td>-->
                                        <td><span class="label label-warning"><?php  echo $value['amount'];?></span></td>
                                        <td><?php  echo $value['date'];?></td>
                                        <td><?php  echo $value['payment_description'];?></td>
                                        <td>
                                            Id:<?php  echo $value['receiver_id'].'</br>';?>
                                            Name : 
                                            <?php 
                                                    $data['receiver_id']= $value['receiver_id'];
                                                    $data['adminallname'] =$this->extraincomesetupmodel->getadminname($data['receiver_id']);
                                                    foreach ($data['adminallname'] as $key => $adminnamevalue) {
                                                            echo "".$adminnamevalue['admin_name']."<br>";
                                                        }
                                                ?>
                                            <?php if(!empty($alladminId) && $alladminId['employeeId']=$value['receiver_id']){
                                                               $adminid= $alladminId['admin_name']; 
                                                               echo $adminid; 
                                            }?>
                                            
                                             <?php 
                                             // echo print_r($alladminId); 
                                             ?>

                                        </td> 
                                        

                                        <td>
                                            <div class="hidden-sm hidden-xs action-buttons">

                                                <?php if($adminLebel==1){?>
                                                    <a class="green" href="<?php echo admin_url()?>/landincomesetup/edit_landincome/<?php echo $value['id'];?>">
                                                        <i class="ace-icon fa fa-pencil bigger-130"></i>
                                                    </a>

                                                    <a class="red" href="<?php echo admin_url()?>/landincomesetup/delete_landincome/<?php echo $value['id'];?>" onclick="return ConfirmDelete()">
                                                        <i class="ace-icon fa fa-trash-o bigger-130"></i>
                                                    </a>
                                                <?php }?>
                                                <a class="red" href="<?php echo admin_url()?>/landincomesetup/invoice/<?php echo $value['id'];?>">
                                                    <i class="ace-icon glyphicon glyphicon-print  bigger-130"></i>
                                                </a>
                                            </div>


                                        </td>
                                    </tr>

                                <?php }?>


                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <table class="table table-bordered">
                        <tbody>
                        <tr class="success">
                            <td width=50%>Customer Income Summary</td>
                            <td width=50%></td>
                        </tr>
                        <tr class="danger">
                            <td width=50%></td>
                            <td width=50%>
                                Income : <?php if(isset($total_income)){echo $total_income[0]['amount'].' Taka';}?>
                            </td>
                        </tr>
                        </tbody>
                    </table>                   
                </div>
            </div><!-- PAGE CONTENT ENDS -->
        <?php }else{echo '<span id="not-found-error">No Data is Found</span>';}?>
    </div><!-- /.col -->
</div><!-- /.row -->
