<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 Expense By Month</b> </h5>
                </div>

                <div class="widget-body">
                    <div class="widget-main no-padding">
                        <form action="<?php echo admin_url()?>/salaryexpensesetup/searchSalaryExpense/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 By Month
                                </button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>



<div class="page-content" >


                        <div class="row">
                         <?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"  style="text-align:center;">
                                        <h6 class="lighter arial red"><b>
                                                <?php echo $errormessage;
                                                $this->session->unset_userdata('errormessage');
                                                ?>
                                            </b></h6>
                                    </div>
                                    <?php
                                }
                                ?>

                    <?php if(!empty($allsalaryExpense)){?>
                            <div class="col-xs-12">
                                <!-- 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;">Expense By Employee/Officers</h3>
                                        </div>

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

                                        <!-- div.dataTables_borderWrap -->
                                        <div>
                                            <table id="dynamic-table" class="table table-striped table-bordered table-hover">
                                                <thead>
                                                    <tr>

                                                        <th>Serial</th>
                                                        <th>EmployeeId </th>
                                                        <th>Employee Name</th>
                                                        <th>
                                                           Salary Expense Type
                                                        </th>
                                                        <th>
                                                           Salary Amount
                                                        </th>

                                                        <th >Date</th>

                                                        <th>Action</th>
                                                    </tr>
                                                </thead>

                                                <tbody>

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

                                                    <tr>

                                                        <td>
                                                            <?php echo ++$i;?>
                                                        </td>
                                        <td style="color:red;">Id :&nbsp;&nbsp;<?php echo $value['employee_id'];?><br/>
                                                        </td>
                                                        <td style="color:red;">
                                                            <?php $emp_usrname=getEmployeeById($value['employee_id']); echo $emp_usrname['userName'];?>
                                                        </td>
                                                        <td>
                                                            <?php
                                                                if(!empty($value['salary_type'])){echo element($value['salary_type'],getsalaryType(),null);}
                                                            ?>
                                                        </td>
                                                        <td><span class="label label-warning"><?php  echo $value['salaryAmount'];?></span></td>
                                                        <td><?php  echo $value['date'];?></td>


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

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

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

                   <?php }?>


                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>


                                </div><!-- PAGE CONTENT ENDS -->
                                <?php }?>
                            </div><!-- /.col -->
                            <div class="row">
                                <table class="table table-bordered">
                                    <tbody>
                                    <tr class="success">
                                        <td width=50%>
                                            Expense Summary
                                        </td>
                                        <td width=50%>

                                        </td>
                                    </tr>
                                    <tr class="danger">
                                        <td width=50%>
                                            Total Expense: <?php if(isset($total_expense)){ echo $total_expense['salaryAmount'].' Taka';}?>
                                        </td>
                                        <td width=50%>
                                             This Year Expense :
                                            <?php if(isset($salary_expense_year)){ echo $salary_expense_year['salaryAmount'].' Taka';}?>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div><!-- /.row -->
