<?php $expt1=0;$expt2=0;$incom1=0;$incom2=0;  ?>
<div class="right_col" role="main">
          <div class="">
            <div class="page-title">
                <div class="title_left">
                    <h3>PLS</h3>
                </div>
            </div>
            <div class="clearfix"></div>

            <div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>Profit Lose Statement</h2>
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
                     <li><a href="<?php echo base_url(); ?>account/plsprint/<?php echo $date1 ?>/<?php echo $date2; ?>"><i class="fa fa-print"></i></a></li>

                    </ul>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                  <div class="col-md-12">
                  <table class="table table-bordered" style="float:left;width:50%">
                  <thead>
                  <tr>
                  
                  <th>Expenditure</th>
                  <th><?php echo date('Y',strtotime($date2)); ?></th>
                  <th><?php echo date('Y',strtotime($date1)); ?></th>
                  </tr>
                  </thead>
                  <tbody>
                  <?php foreach ($exp as $key => $ex){?>

                  <tr>
                  <td><?php echo $ex['name']; ?></td>
                  <td><?php $d1=$this->account_model->plsdatewiseexp($ex['id'],date('Y-01-01',strtotime($date2)),date('Y-m-30',strtotime($date2))); echo $d1!=null?$d1:0; $expt1+=$d1;  ?></td>
                  <td><?php $d2=$this->account_model->plsdatewiseexp($ex['id'],date('Y-m-01',strtotime($date1)),date('Y-12-30',strtotime($date1))); echo $d2!=null?$d2:0; $expt2+=$d2; ?></td>
                  </tr>
                  <?php }?>
                  <tr><td>Total</td><td><?php echo $expt1;  ?></td><td><?php echo $expt2;  ?></td></tr>
                  </tbody>
                  </table>
                  
                  <table class=" table table-bordered" style="float:left;width:50%">
                  <thead>
                  <tr>
                  
                  <th>Income</th>
                  <th><?php echo date('Y',strtotime($date2)); ?></th>
                  <th><?php echo date('Y',strtotime($date1)); ?></th>
                  </tr>
                  </thead>
                  <tbody>
                  <?php foreach ($income as $key => $inc){?>
                  
                  <tr>
                  <td><?php echo $inc['name']; ?></td>
                   <td><?php $incomed1=$this->account_model->plsdatewiseincome($inc['id'],date('Y-01-01',strtotime($date2)),date('Y-m-30',strtotime($date2))); echo $incomed1!=null?$incomed1:0; $incom1+=$incomed1;  ?></td>
                  <td><?php $incomed2=$this->account_model->plsdatewiseincome($inc['id'],date('Y-m-01',strtotime($date1)),date('Y-12-30',strtotime($date1))); echo $incomed2!=null?$incomed2:0; $incom2+=$incomed2; ?></td>
                  </tr>
                  <?php }?>
                  <tr><td>Total</td><td><?php echo $incom1;  ?></td><td><?php echo $incom2;  ?></td></tr>
                  </tbody>
                  </table>
                  </div>
                   </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <!-- /page content -->
        <script src="<?php echo base_url(); ?>assets/vendors/jquery/dist/jquery.min.js"></script>