
<div class="row" id="portlet-content">
    <div class="col-md-12">
        <div class="portlet light" style="position:relative">
            <div class="portlet-title">
                <div class="caption">
                    <i class="fa fa-laptop"></i>Pasien <?=$this->M_general->get_value('bbmc_re_tipe_pasien','id_tipe_pasien',$tipe_pasien,'tipe_pasien')?>
                </div>

                
                <div class="tools" style="margin-top:2px">
                    <form action="<?=site_url()?>/front_office/ugd_dir/ugd/fillter_date_lab/<?=$tipe_pasien?>" method="post">
                        <div style="float: right; margin-left: 5px;">
                            <input class="datepickers" type="text" name="tgl_awal" value="<?=date('m/d/Y',strtotime($tgl_awal))?>" placeholder="Dari Tanggal" style="width:100px; border:1px solid silver" autocomplete="off"> 
                            <input class="datepickers" type="text" name="tgl_akhir" value="<?=date('m/d/Y',strtotime($tgl_akhir))?>"  placeholder="Sampai" style="width:100px; border:1px solid silver" autocomplete="off"> 
                            <input type="submit" value="Submit" style="height: 23px">
                        </div>
                    </form>
                 </div>

            </div>

            <?php 
            $tgl_akhir = date('Y-m-d',strtotime($tgl_akhir . "+1 days"));
            $period = new DatePeriod(
                 new DateTime(@$tgl_awal),
                 new DateInterval('P1D'),
                 new DateTime(@$tgl_akhir)
            );
            ?>

            <div class="portlet-body" id="page-content" style="display:nonee">
                <div class="table-responsive">
                    <table id="<?=$controller?>_table" class="table table-bordered table-striped table-hover" style="width:100%">
                        <thead>
                            <tr>
                                <th class="text-left">Tanggal</th>
                                <th class="text-left">Pasien Berkunjung</th>
                                <th class="text-left">Total Penerimaan</th>
                                <th class="text-left">Total Pengeluaran</th>
                            </tr>
                        </thead>
                        <tbody>
                        <?php 
                        $total = 0;
                        foreach ($period as $key => $value) { 
                          $tgl = $value->format('Y-m-d'); 
                          $penerimaan = $this->M_general->get_pendapatan_pasien_lab($tgl, $tipe_pasien); 
                          $pengeluaran = $this->M_general->get_pengeluaran_pasien_lab($tgl, $tipe_pasien);
                          ?>
                          <tr>
                            <td><?=$tgl?></td>
                            <td><a target="_Blank" style="color:blue; text-decoration: underline;" href="<?=site_url()?>/front_office/ugd_dir/ugd/laboratorium/<?=$tgl?>/<?=$tipe_pasien?>"><?=$this->M_general->get_jumlah_pasien_lab($tgl, $tipe_pasien)?></a></td>
                            <td><a target="_Blank" style="color:blue; text-decoration: underline;" href="<?=site_url()?>/front_office/ugd_dir/ugd/laboratorium_penerimaan/<?=$tgl?>/<?=$tipe_pasien?>"><?=$this->M_general->currency($penerimaan);?></a></td>
                            <td><a target="_Blank" style="color:blue; text-decoration: underline;" href="<?=site_url()?>/front_office/ugd_dir/ugd/laboratorium_pengeluaran/<?=$tgl?>/<?=$tipe_pasien?>"><?=$this->M_general->currency($pengeluaran);?></a></td>
                         </tr>
                        <?php }?>

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

               
            </div>
           
        </div>
    </div>
</div>





<script>
  $(document).ready( function () {
    var table=$('#<?=$controller?>_table').DataTable({
      "order": [[ 1, 'asc' ]],
      "processing": false,
      "serverSide": false,
      "searching": true,
      "language": {
            "url": "<?=base_url('media/assets/global/plugins/datatables/media/js')?>/indonesian.json"
       },
      "columnDefs": [
        {"targets": [0],"bSortable": false}
      ],
    
      "fnInitComplete": function(oSettings, json) {
        $('.dataTables_processing').css('display','none');
        $( "#loading-content" ).fadeOut( "fast", function() {
          $( "#tombol-action" ).fadeIn("fast");
          $( "#page-content" ).fadeIn("fast");
        });
      }
    });

  });

  $('.hapusdata').click(function(){
    if(confirm("Apakah kamu yakin menghapus entry ini?")){
      return true;
    }
    else{
      return false;
    }
  });
</script>


<script>
  $(document).ready(function () {
    $('.datepickers').datepicker({
      format: 'dd-mm-yyyy' 
    });
  });
</script>
