
<?php $this->load->view('site/layout');  ?>
  <link href="<?php echo base_url() ?>public/plugins/custom/datatables/datatables.bundle.css" rel="stylesheet" type="text/css" />
  

    <?php $this->load->view('site/navbar');  ?>

<div class="kt-content  kt-grid__item kt-grid__item--fluid kt-grid kt-grid--hor" id="kt_content">
  
            <!-- begin:: Content Head -->
            <div class="kt-subheader  kt-grid__item" id="kt_subheader">
              <div class="kt-container  kt-container--fluid ">
                <div class="kt-subheader__main">
                  <h3 class="kt-subheader__title"><a href="<?php echo base_url() ?>Dashboard/"><?php echo $this->lang->line('dashboard'); ?></a></h3>
                  <span class="kt-subheader__separator kt-subheader__separator--v"></span>
                  <span class="kt-subheader__desc"><?php echo $this->lang->line('expense') ?></span>
                </div>
                
              </div>
            </div>
</div>
  <div class="kt-portlet kt-portlet--mobile">
                <div class="kt-portlet__head kt-portlet__head--lg">
                  <div class="kt-portlet__head-label">
                    <span class="kt-portlet__head-icon">
                      <i class="kt-font-brand flaticon2-line-chart"></i>
                    </span>
                    <h3 class="kt-portlet__head-title">
                      <?php echo $this->lang->line('invoices'); ?>
                    </h3>
                  </div>
                  <div class="kt-portlet__head-toolbar">
                    <div class="kt-portlet__head-wrapper">
                      <div class="kt-portlet__head-actions">
                         <div class="dropdown dropdown-inline">
                         <?php if(get_ap('ex_cat',$this->operator_id)==1){?>
                          <a href="<?= base_url()?>/<?=$this->thispage?>/category_list/" ><button type="button" class="btn btn-default btn-icon-sm "  >
                             <?php echo $this->lang->line('category') ?>
                          </button></a>
                          <?php } ?>
                        </div>
                        &nbsp;
                        <?php if(get_ap('ex_add',$this->operator_id)==1){?>
                           <a href="<?= base_url()?>/<?=$this->thispage?>/add/" class="btn btn-brand btn-elevate btn-icon-sm">
                              <i class="la la-plus"></i>
                                <?php echo $this->lang->line('add') ?> <?php echo $this->lang->line('expense') ?>
                            </a>
                        <?php } ?>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="kt-portlet__body">

                  <!--begin: Datatable -->
                  <table class="table table-striped- table-bordered table-hover table-checkable dataTable no-footer dir-inline" id="kt_table_1">
                    <thead>
                      <tr>
                        <th><?php echo $this->lang->line('sno') ?></th>
                         <th><?php echo $this->lang->line('date-added') ?></th>
                          <th><?php echo $this->lang->line('expense-name') ?></th>
                          <th><?php echo $this->lang->line('expense-price') ?></th>
                          <th><?php echo $this->lang->line('category') ?></th>
                          <th ><?php echo $this->lang->line('expense-date') ?></th>
                          <th ><?php echo $this->lang->line('update-by') ?></th>
                         
                      </tr>
                    </thead>
                    <tbody>
                      <tr>
                       <?php $count=1; foreach($all_groups as $row){?>
                      <tr>
                           <td><?php echo $count++; ?></td>
                           <td><?= substr($row['create_on'],0,10); ?></td>
                        <td><?= $row['expense_name']; ?></td>
                        <td><?= $row['expense_price']; ?></td>
                        <?php 
                          $this->db->where('id',$row['category_id']);
                        $cat = $this->db->get('expense_category')->row(); ?>
                        <td><?php echo $cat->category_name; ?></td>
                        <td><?= substr($row['expense_date'],0,10); ?></td>
                        <?php 
                        $this->db->where('id',$row['updated_by']);
                        $user = $this->db->get('user')->row_array();
                        ?>
                        <td><?= $user['name']; ?></td>
                 <!--  <td>
                  <a href="<?= base_url(''.$this->thispage.'/edit/'.$row['id'])?>" class="btn btn-sm btn-clean btn-icon btn-icon-md" title="Edit details">
                    <i class="la la-edit"></i>
                  </a></td><td>
                  <a href=""  onclick="alert_box(<?php echo $row['id'] ?>)" class="btn btn-sm btn-clean btn-icon btn-icon-md" title="Delete">
                    <i class="la la-trash"></i>
                  </a>
                    </td>  -->
                      </tr>
                       <?php } ?>
                    </tbody>
                  </table>

                  <!--end: Datatable -->
                </div>
              </div><!-- /.row -->
 <?php $this->load->view('site/footer_2'); ?> 


   

  <script>function alert_box(id) { 
  var result= confirm("Are You Confirm!")
  if(result){
    window.location.href = "<?= base_url(''.$this->thispage.'/del/')?>" + id;

  }
  
}</script>