<!DOCTYPE html>
<!--
This is a starter template page. Use this page to start your new project from
scratch. This page gets rid of all links and provides the needed markup only.
-->
<?php foreach($kontak as $kontak) :   endforeach; ?> 
 
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta http-equiv="x-ua-compatible" content="ie=edge">

  <title>Laporan Transaksi</title>
  <!-- DataTables -->
  <link rel="stylesheet" href="<?php echo base_url();?>assets/plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
  <link rel="stylesheet" href="<?php echo base_url();?>assets/plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
  <!-- SweetAlert2 -->
  <link rel="stylesheet" href="<?php echo base_url();?>assets/plugins/sweetalert2-theme-bootstrap-4/bootstrap-4.min.css">
  <!-- Toastr -->
  <link rel="stylesheet" href="<?php echo base_url();?>assets/plugins/toastr/toastr.min.css">
  <link rel="icon" href="<?php echo base_url();?>images/kontak/<?php echo $kontak->logo ;?>" type="image/png" /> 
  <!-- Font Awesome Icons -->
  <link rel="stylesheet" href="<?php echo base_url();?>assets/plugins/fontawesome-free/css/all.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="<?php echo base_url();?>assets/dist/css/adminlte.min.css">
  <!-- Google Font: Source Sans Pro -->
  
</head>
<body class="hold-transition sidebar-collapse layout-top-nav"  >
<div class="wrapper">

   

 

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
     

    <!-- Main content -->
    <div class="content">

        <div class="row">
          <div class="col-lg-12">
            <div class="card card-success card-outline">
              <div class="card-body">
              	<div class="row">
              		<div class="col-lg-12">

              			<h2>LAPORAN FAKTUR <?php echo  strtoupper($jenis_laporan.' '.$kontak->nama_toko) ;?> </h2>
              			<h5>Alamat <?php echo  $kontak->alamat ;?> </h5>
              			<h5>Laporan <?php echo  ucwords($jenis_laporan).", " ;?>  <?php if($jenis_laporan =='harian'){
              				echo "Tanggal : ".$tanggal;
              			}else if($jenis_laporan =='bulanan'){
              				echo "Bulan : ".bulan_cetak(date($bulan))." Tahun ".$tahun;
              			} else if($jenis_laporan =='pilihan'){
              				echo "Tanggal : ".tgl_indo(date($tanggal_awal))." s/d ".tgl_indo(date($tanggal_akhir));

              			} 
              			?> </h5>
              			<hr>
              		</div>
              	</div><!-- /.row -->
              	<table  class="table table-bordered table-striped">
              		<thead>
              			<tr>
              				<th>No</th>
              				<th>ID Faktur</th>
              				<th>Kantor</th>
              				<th>Supliyer</th>
              				 
              				<th style="text-align: right;">Nominal</th>
              			 
              				<th>Jatuh Tempo</th>
                      <th>Status</th>
              		 
              				<th>admin</th>
              			 
              				
              			</tr>
              		</thead>
              		<tbody>

              			<?php $no=1; foreach($faktur as $rows) : ?> 
              			<tr>
              				<td><?php echo $no; ?></td>
              				<td><?php echo $rows->id_faktur; ?></a></td>
              				<td>
              					<?php 
              					$id_kantor = $rows->id_kantor; 
              					$sql_menu = "SELECT * FROM tb_kantor WHERE  id_kantor = '$id_kantor' ";
              					$main_menu = $this->db->query($sql_menu)->result();
              					foreach ($main_menu as $maink) {
              						echo  $maink->nama_kantor;

              					}
              					?>
              				</td>
              				<td> 
              					<?php 
              					$id_supliyer = $rows->id_supliyer; 
              					$sql_menu = "SELECT * FROM tb_supliyer WHERE  id_supliyer = '$id_supliyer' ";
              					$main_menu = $this->db->query($sql_menu)->result();
              					foreach ($main_menu as $maink) {
              						echo  $maink->nama_supliyer;

              					}
              					?>
              				</td>
              				<td style="text-align: right;"><?php echo nominal($rows->nominal); ?></td>
              				 
              				<td><?php echo $rows->jatuh_tempo; ?></td>
                      <td><?php echo $rows->status; ?></td>
              			 



              				<td><?php 
              				$id_admin = $rows->id_admin; 
              				$sql_menu = "SELECT * FROM tb_admin WHERE  id = '$id_admin' ";
              				$main_menu = $this->db->query($sql_menu)->result();
              				foreach ($main_menu as $maink) {
              					echo   $maink->nama_admin;

              				}
              				?>

              			</td>


              		 
              		</tr>
              		<tr>
              			<td></td>
              			<td colspan="6">
              				<table>
              					<thead>
              						<tr>
              							<th>No</th>
              							<th>Nama Barang</th>
              							<th>Jumlah</th>
              							<th>Expired</th>
              							 
              						</tr>
              					</thead>
              					<tbody>
              						<?php 
			              				$id_faktur = $rows->id_faktur; 
			              				$nob=1;
			              			
			              				$sql_detail = "SELECT * FROM tb_faktur_detail WHERE  id_faktur = '$id_faktur' ";
			              				$detail = $this->db->query($sql_detail)->result();
			              				foreach ($detail as $b) { 
			              							$id_barang= $b->id_barang;
													  			$this->db->where('id',$id_barang);
													  			$query = $this->db->get('tb_barang');
													  			$row = $query->row();
													  	 
													  			$nama_barang = $row->nama_barang;
													   
 																	

			              					?>
              						<tr>
              							<td><?php echo $nob; ?></td>
              							<td><?php echo $nama_barang; ?></td>
              							<td><?php echo $b->jumlah; ?></td>
              							<td><?php echo $b->expired; ?></td>
              						 
              						</tr>
              							<?php } $nob++; ?>	
              					</tbody>
              				</table>
              			</td>
              		</tr>
              		<?php $no++; endforeach; ?>

              	</tbody>
                <tfoot>
              		<tr>
              			<td></td>
              			<td></td>
              			<td></td>
              			<td>Total</td>
              				<?php $no=1; foreach($jumlah as $rowss) : ?> 
              			<td style="text-align: right;"> <?php echo nominal($rowss->nominal); ?></td>
              			 
              			<?php  endforeach; ?>
              			<td></td>
              			<td></td>
              			<td></td>
              		</tr>

              	</tfoot>
              		

              </table>
              <hr>
              
              <div class="row">
              	<div class="col-lg-12">
              		<table width="100%" border="0">
              			<tr>

              				<td >Mangetahui,</td>
              				<td width="400px;"  ></td>
              				<td ><?php echo $kontak->kab_kota ; ?>, <?php echo tgl_indo(date('Y-m-d'));  ?></td>
              			</tr>
              			<tr>
              				<td>Manager </td>
              				<td width="400px;"></td>
              				<td>Admin</td>
              			</tr>
              			<tr height="70px;">
              				<td></td>
              				<td></td>
              				<td></td>
              			</tr>
              			<tr>
              				<td> _____________________________ </td>
              				<td width="400px;"></td>
              				<td><strong><?php echo $nama_admin; ?></strong></td>
              			</tr>
              		</table>

              	</div><!-- /.row -->
              </div>
            </div>

             
          </div>
          <!-- /.col-md-6 -->
          
          <!-- /.col-md-6 -->
        </div>
        <!-- /.row -->
      
    </div>
   
  </div>
  <!-- /.content-wrapper -->

   
 




 
<!-- jQuery -->
<script src="<?php echo base_url();?>assets/plugins/jquery/jquery.min.js"></script>
<script src="<?php echo base_url().'assets/js/jquery.js'?>"></script>
<script src="<?php echo base_url().'assets/js/numeral.min.js'?>"></script>
<!-- Bootstrap 4 -->
<script src="<?php echo base_url();?>assets/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="<?php echo base_url();?>assets/dist/js/adminlte.min.js"></script>
 
<!-- DataTables -->
<script src="<?php echo base_url();?>assets/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="<?php echo base_url();?>assets/plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="<?php echo base_url();?>assets/plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="<?php echo base_url();?>assets/plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
 
<!-- AdminLTE for demo purposes -->
<script src="<?php echo base_url();?>assets/dist/js/demo.js"></script>
 
</body>
</html>
