<div class="page-content" >
    <div class="row" >
        <div class="col-sm-12">
            <div class="widget-box" style="border: 1px solid grey">
                <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" >
                 <?php
                    $message = $this->session->userdata('message');
                    if (!empty($message)) {
                        ?>
                        <div class="alert alert-block alert-success">
                            <h6 class="lighter arial green" style="text-align:center;"><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" style="text-align:center;"><b>
                                    <?php echo $errormessage;
                                    $this->session->unset_userdata('errormessage');
                                    ?>
                                </b></h6>
                        </div>
                        <?php
                    }
                 ?>

                    <?php if(!empty($allextraincome)){?>

                                <!-- PAGE CONTENT BEGINS -->

                                <?php $adminLebel=$this->session->userdata('admin_level');?>


                                <div class="row">
                                    <div class="col-xs-12">


                                        <div class="clearfix">
                                            <div class="pull-right tableTools-container"></div>
                                        </div>
                                        <div class="table-header" style="height:60px;">
                                           <h3 style="text-align:center;"> By Category</h3>
                                        </div>

                                        <!-- div.table-responsive -->

                                        <!-- div.dataTables_borderWrap -->
                                        <div>
                                            <table id="dynamic-table" class="table table-striped table-bordered table-hover">
                                                <thead>
                                                    <tr style="color:red;">


                                                        <th style="color:red;">Serial</th>
                                                        <th>Income Category</th>
                                                        <th>
                                                            Amount
                                                        </th>
                                                        <th>Payment Process</th>

                                                        <th >Date</th>

                                                        <th>
                                                            ReceiverId & Name
                                                        </th>
                                                        <th>Action</th>
                                                    </tr>
                                                </thead>

                                                <tbody>

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

                                                    <tr>

                                                        <td style="color:red;">
                                                        <?php echo ++$i;?>
                                                        </td>
                                                        <td>
                                                            <?php
                                                            if(!empty($value['incomeCategory'])){
                                                                $incomeCategoryInfo=getincomeCategoryById($value['incomeCategory']);
                                                                echo $incomeCategoryInfo['category_name'];
                                                                }
                                                            ?>
                                                        </td>
                                                        <td><span class="label label-warning"><?php if(!empty($value['amount'])){ echo $value['amount'];}?></span></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><?php  if(!empty($value['date'])){echo $value['date'];}?></td>


                                                    <td>
                                                        <?php if(!empty($value['receiver_id'])){?>
                                                        Id :&nbsp;&nbsp;<?php  echo $value['receiver_id'];?><br/>
                                                        Name :&nbsp;&nbsp;<?php $usrnme=getEmployeeById($value['receiver_id']); echo $usrnme['userName'];?>
                                                        <?php }?>
                                                    </td>

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

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

                                                                <a class="red" href="<?php echo admin_url()?>/extraincomesetup/delete_income/<?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()?>/extraincomesetup/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>


                                <!-- PAGE CONTENT ENDS -->
                                <?php }?>
            <div class="row">
                <table class="table table-bordered">
                    <tbody>
                    <tr class="success">
                        <td width=50%>Extra Income Summary</td>
                        <td width=50%></td>
                    </tr>
                    <tr class="danger">
                        <td width=50%>
                            Overall Extra Income: <?php if(isset($total_extra_income)){echo $total_extra_income['amount'].' Taka';}?>
                        </td>
                        <td width=50%>
                            Current Year Income : <?php if(isset($total_income)){echo $total_income['amount'].' Taka';}?>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
                        </div><!-- /.row-->

