<?php 
echo link_tag('media/assets/global/plugins/font-awesome/css/font-awesome.min.css');
echo link_tag('media/assets/global/plugins/simple-line-icons/simple-line-icons.min.css');
echo link_tag('media/assets/global/plugins/bootstrap/css/bootstrap.min.css');
echo link_tag('media/assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.min.css');
echo link_tag('media/assets/global/plugins/datatables/plugins/bootstrap/responsive.bootstrap.min.css');
echo link_tag('media/assets/global/plugins/datatables/plugins/bootstrap/select.bootstrap.min.css');
echo link_tag('media/assets/global/plugins/material-preloader/css/materialPreloader.min.css');
echo link_tag('media/assets/global/plugins/material-preloader/css/loader.css');
echo link_tag('media/assets/global/plugins/sweetalert/sweetalert.css');
echo link_tag('media/assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css');
echo link_tag('media/assets/global/plugins/select2/select2.min.css');
echo link_tag('media/assets/global/plugins/uniform/css/uniform.default.min.css');
echo link_tag('media/assets/global/css/components-md.css');
echo link_tag('media/assets/global/css/plugins-md.css');
echo link_tag('media/assets/admin/layout2/css/layout.css');
echo link_tag('media/assets/admin/layout2/css/themes/grey.css');
echo link_tag('media/assets/admin/layout2/css/custom.css');
echo link_tag('media/css/more.css');

echo script_tag(['media/assets/global/plugins/jquery.min.js',
                 'media/assets/global/plugins/jquery-migrate.min.js'
            ]);
?>

<style type="text/css">
.col-xs-12{padding: 0px;}
.form .form-body{padding: 0px}
@page { margin: 0; padding:0;}
@media print {
  .pagebreak { page-break-after: auto; } 
  .hidden-print {
    display: none !important;
  }
  .hidden-view {
    display: block !important;
  }
}
 .hidden-view {
    display: none;
  }
.form-control-static{margin: 0px; min-height: 27px}

th{font-size:10px !important;}
td{font-size:9px !important;}
.portlet.box.blue > .portlet-title{background: #fff; }
.portlet.box.blue > .portlet-title > .caption{color: black}
</style>






<div class="col-xs-12" id="portlet-content" style="padding:0px">
    <div class="col-md-12 col-xs-12">
        <div class="portlet box blue" style="position:relative; padding:0px">
            <div class="portlet-title " style="padding-left:15px; min-height:30px">
                <img src="<?=base_url()?>media/images/logo_header.jpg" style="width:200px; float: right; padding: 10px; padding-right: 0px">

                <div class="caption" >
                	
	                <?php 
	                $id_re_pasien = $this->Content_m->get_value('bbmc_tr_kunjungan','id_re_kunjungan',$id_re_kunjungan,'id_re_pasien');
	                $get = @$this->Content_m->get_row_custom('bbmc_tr_pasien','id_re_pasien',$id_re_pasien);
                    
	                ?>

                    <span style="font-size:12px">
                    BATU BULAN MEDICAL CLINIC<br>
                    Alamat: Jl. Raya Batu Bulan Anyelir 5 No. 3 A<br>
                    Website: klinikbbmc.com<br>
                    Telp: (0361) 8461172<br><br><br><br>
                    </span>
                  	
                    <span style="font-size:9px; line-height: 12px">
                    NRM : BBMC-<?=@$get->nrm?> / <span>Kunjungan #<?=$id_re_kunjungan?></span><br>
                    Nama Pasien : <?=@$get->nama_pasien?> <span> / <?=$this->Content_m->get_value('bbmc_re_tipe_pasien','id_tipe_pasien',$id_tipe_pasien,'tipe_pasien')?></span><br>
                    Alamat : <?=@$get->alamat?> <br>
                    
                    Diagnosa : 
                    <?php 
                    $this->db->where('id_re_kunjungan',$id_re_kunjungan);
                    $this->db->where('deleted','0');
                    $f_diagnosa = $this->Content_m->select_db('bbmc_tr_icd');
                    foreach ($f_diagnosa->result() as $key ) {
                        echo "".$this->Content_m->get_value('bbmc_re_icd','id_icd',$key->id_icd,'icd')." ".$this->Content_m->get_value('bbmc_re_icd','id_icd',$key->id_icd,'diagnosa').", ";
                        //$key->id_icd." ";   
                    }
                    ?>
                    </span>

                  
                </div>

                
                <div class="actions" style="font-size:12px; margin-top: 4px">
          
                  
                  
                
                </div>
            </div>
           <div class="portlet-body" id="page-content">
                <div class="table-responsive">
                    <table id="<?=$controller?>_table" class="table table-bordered table-striped table-hover" style="width:100%; table-layout: fixed;" >
                        <thead>
                            <tr>
                                <th class="text-center" style="width: 40px !important">No</th>
                                <th class="text-left">Detail Tindakan</th>
                                <th class="text-right" style="width: 120px !important">Biaya</th>
                            </tr>
                        </thead>
                        <tbody>

                        	<?php 
                        	$i=1;
                        	$ttl=0;
                        	$query = $this->Content_m->get_account_tindakan($id_re_kunjungan);
                        	foreach ($query->result() as $key ) { 
                        		if($id_tipe_pasien == '1'){
                        			$biaya = $key->price_umum;
                        		}else if($id_tipe_pasien == '2'){
                        			$biaya = $key->price_bpjs;
                        		}else if($id_tipe_pasien == '3'){
                        			$biaya = $key->price_shhc;
                        		}else if($id_tipe_pasien == '4'){
                        			$biaya = $key->price_inhealth;
                        		}else if($id_tipe_pasien == '5'){
                        			$biaya = $key->price_mega;
                        		}
                        		$ttl = $ttl+$biaya;
                        		?>
                        		<tr>
                        			<td class="text-center"><?=$i?></td>
                        			<td><?=$key->name?></td>
                        			<td class="text-right">
                        				<?=$this->Content_m->currency($biaya)?>
                        			</td>
                        		</tr>
                        	<?php $i++; } ?>
                            <tr>
                                <th class="text-center"></th>
                                <th class="text-left">Detail Obat</th>
                                <th class="text-right" style="width: 120px !important"></th>
                            </tr>
                            <?php 
                            $i=1;
                            $this->db->where('id_re_kunjungan',$id_re_kunjungan);
                            $get = $this->Content_m->select_db('bbmc_tr_pengobatan');
                            foreach ($get->result() as $key ) { ?>
                            <tr>
                                <td class="text-center"><?=$i?></td>
                                <td>
                                    <?php 
                                    $this->db->where('id_pengobatan',$key->id_re_pengobatan);
                                    $q_pengobatan = $this->Content_m->select_db('bbmc_tr_pengobatan_pasien');
                                    foreach ($q_pengobatan->result() as $keyb) {
                                       $get_obat = @$this->Content_m->get_row('bbmc_re_apotik_obat','id_re_apotik_obat',$keyb->id_obat); 
                                       echo $get_obat->nama_obat." @".$keyb->qty." ".$get_obat->sediaan." ".$keyb->cara_pemakaian."<br>";
                                    }?>
                                  
                                </td>
                                <td class="text-right">
                                    <?php 
                                    foreach ($q_pengobatan->result() as $keyb) {
                                       $get_obat = @$this->Content_m->get_row('bbmc_re_apotik_obat','id_re_apotik_obat',$keyb->id_obat); 
                                       echo $get_obat->harga_jual."<br>";
                                    }?>
                                </td>
                            </tr>
                            <?php $i++;} ?>
                        

                        </tbody>
                        <tfoot>
                        	<tr>
                        		<td colspan="2"></td>
                        		<td class="text-right"><b><?=$this->Content_m->currency($ttl)?></b></td>
                        	</tr>
                        </tfoot>
                       
                        
                    </table>
                   
                </div>
            </div>
           

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




<?php 
 echo script_tag(['media/assets/global/plugins/bootstrap/js/bootstrap.min.js',
'media/assets/global/plugins/datatables/media/js/jquery.dataTables.min.js',
'media/assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.min.js',
'media/assets/global/plugins/datatables/extensions/Responsive/js/dataTables.responsive.min.js',
'media/assets/global/plugins/datatables/plugins/bootstrap/responsive.bootstrap.min.js',
'media/assets/global/plugins/datatables/plugins/bootstrap/dataTables.select.min.js',
'media/assets/global/plugins/material-preloader/js/materialPreloader.min.js',
'media/assets/global/plugins/sweetalert/sweetalert.min.js',
'media/assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js',
'media/assets/global/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.id.min.js',
'media/assets/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js',
'media/assets/global/plugins/select2/select2.full.min.js',
//'media/assets/global/plugins/uniform/jquery.uniform.min.js',
'media/assets/global/plugins/select2/i18n/id.js',
'media/assets/global/scripts/metronic.js',
'media/assets/admin/layout2/scripts/layout.js'
]);
?>

<script>
$(document).ready(function() {    
   Metronic.init();
   Layout.init();
   //window.print();
});
$(document).ready( function () {
    $('#atable').DataTable();
});

$('.print').click(function(){
  window.print();
});
//window.print();
</script>
