<?php
 
header("Content-type: application/vnd-ms-excel");
header("Content-Disposition: attachment; filename=report_sparepart_permesin.xls");
?>
<h3 colspan="23">TRACING PER KODE MESIN</h3>
<table border="1" cellpadding="2">
  	<tr>
        <th colspan="1"> </th>
    	<th colspan="3">RINCIAN MESIN</th>
        <th colspan="4">RINCIAN SPAREPART</th>
        <th colspan="3">RINCIAN ASAL DOKUMEN</th>
        <th colspan="2">INVOICE</th>
 
        <tr>
			<th colspan="1">NO</th>

			<th colspan="1">KODE MESIN</th>
			<th rowspan="1">NAMA MESIN</th>	
			<th colspan="1">SATUAN</th>
			
            <th rowspan="1">KODE BARANG</th>	 
			<th colspan="1">NAMA BARANG</th>
			<th rowspan="1">QTY SPAREPART</th>	
			<th colspan="1">SATUAN</th>
			
            <th rowspan="1">JENSI DOKUMEN</th>	
            <th colspan="1">NOMOR DOKUMEN </th>
			<th rowspan="1">TANGGAL DOKUMEN</th>	

            <th colspan="1">NOMOR</th>
			<th rowspan="1">TANGGAL</th>	


		</tr>


		   
		 </tr>  
  	</tr> 	
 

      <?php

    $this->db = $this->load->database('pasi', TRUE);
    $no = 1;  
    $query = $this->db->query("SELECT * FROM tdump_rpt_sp");
    foreach ($query->result() as $row)
    {
        echo "<tr>";
        echo "<td>".$no."</td>";
        echo "<td>".$row->kode_mesin."</td>";
        echo "<td>".$row->nama_mesin."</td>";
        echo "<td>".$row->satuan."</td>";
        echo "<td>".$row->kode_brg."</td>";
        echo "<td>".$row->nama_brg."</td>";
        echo "<td>".$row->jumlah_out."</td>";
        echo "<td>".$row->satuan_out."</td>";
        echo "<td>".$row->type_bc."</td>";
        echo "<td>".$row->no_daftar."</td>";
        echo "<td>".$row->tgl_nodaf."</td>";
        echo "<td>".$row->no_receive."</td>";
        echo "<td>".$row->tgl_receive."</td>"; 
        $no++;  


    }

    //  $query = $this->db->query("SELECT * FROM vwx_tracert_document_in");
     // $query = "SELECT * FROM vwx_tracert_document_in";
     // $result = $pdo->query($query);
     // $result->setFetchMode(PDO::FETCH_CLASS,'data');

 //     $no = 1;  
  //    while($data = $result->fetch()){  
  //      echo "<tr>";
  //      echo "<td>".$no."</td>";
  //      echo "<td>".$data['provinsi']."</td>";
  //      echo "<td>".$data['penyusun']."</td>";
  //      echo "<td>".$data['tglkonfirmasi']."</td>";
  //      echo "<td>".$data['tglreaksi']."</td>";
  //      echo "<td>".$data['root']."</td>";
  //      echo "<td>".$data['koreksi']."</td>";
    
  //     echo "</tr>";
        
   //..     $no++;  
   //   }






      ?>

</table>     