<?php 
if($xls==1){
	header('Content-type: application/word');
  	header('Content-Disposition: attachment; filename='.$nama_file);

  	$data = '<html xmlns:x="urn:schemas-microsoft-com:office:excel">
          	<head>
              	<!--[if gte mso 9]>
              	<xml>
                  <x:ExcelWorkbook>
                      <x:ExcelWorksheets>
                          <x:ExcelWorksheet>
                              <x:Name>Sheet 1</x:Name>
                              <x:WorksheetOptions>
                                  <x:Print>
                                      <x:ValidPrinterInfo/>
                                  </x:Print>
                              </x:WorksheetOptions>
                          </x:ExcelWorksheet>
                      </x:ExcelWorksheets>
                  </x:ExcelWorkbook>
              </xml>
              <![endif]-->
          </head>' ; 
}else if($xls==2){
	header('Content-type: application/word');
  	header('Content-Disposition: attachment; filename='.$nama_file);

  	$data = '<html xmlns:x="urn:schemas-microsoft-com:office:excel">
          	<head>
              <!--[if gte mso 9]>
              <xml>
                  <x:ExcelWorkbook>
                      <x:ExcelWorksheets>
                          <x:ExcelWorksheet>
                              <x:Name>Sheet 1</x:Name>
                              <x:WorksheetOptions>
                                  <x:Print>
                                      <x:ValidPrinterInfo/>
                                  </x:Print>
                              </x:WorksheetOptions>
                          </x:ExcelWorksheet>
                      </x:ExcelWorksheets>
                  </x:ExcelWorkbook>
              </xml>
              <![endif]-->
          </head>' ; 
}
?>
<style type='text/css'>
	table td {word-wrap:break-word;white-space: pre-line;}  
</style>



<div id="reg_med" >
	<div style="width:1688;text-align:center;" >
  		<div class="title">REGISTER PENAHANAN PIDANA ANAK</div>
  		<div class="subtitle">Bulan : <?php echo $nama_bulan." ".$tahun;?></div>
	</div>
	<table class="register" width="1688" border="1" cellspacing="0" cellpadding="4">
			<thead>
				<tr>
					<th style="vertical-align:text-top; text-align: left; width: 38px;" rowspan="3">Nomor Urut</th>
				    	<th style="vertical-align:text-top; text-align: left; width: 150px;" rowspan="3">Nomor Perkara</th>
				    	<th style="vertical-align:text-top; text-align: left; width: 300px;" rowspan="3">Nama Anak, tempat lahir, umur/tanggal lahir, jenis kelamin, kebangsaan, tempat tinggal, agama, pekerjaan, pendidikan</th>
				    	<th style="vertical-align:text-top; text-align: left; width: 300px;" rowspan="3">Pasal yang didakwakan</th>
				    	<th  style="vertical-align:text-top; text-align: center;" colspan="5">Tanggal / Jenis Penahanan</th>
				    	<th style="vertical-align:text-top; text-align: left; width: 150px; "rowspan="3">keterangan</th>
				</tr>
				<tr>
					<th style="vertical-align:text-top; text-align: center; width: 150px;">Penyidik</th>
				    	<th style="vertical-align:text-top; text-align: center; width: 150px;">Penuntut Umum</th>
				    	<th style="vertical-align:text-top; text-align: center; width: 150px;">PN</th>
				    	<th style="vertical-align:text-top; text-align: center; width: 150px;">PT</th>
				    	<th style="vertical-align:text-top; text-align: center; width: 150px;">MA</th>
				</tr>
				<tr>
				 	<th style="vertical-align:text-top; text-align: left;">
				 		<p>a. Penyidik</p>
				    		<p>b. Penyidik perpanjangan PU</p>
				   	 	<p>c. Jenis Penahanan</p>
				   	 </th>
				    	<th style="vertical-align:text-top; text-align: left;">
				    		<p>a. PU</p>
				    		<p>b. Perpanjangan KPN</p>
				    		<p>c. Jenis Penahanan</p>
				    	</th>
				    	<th style="vertical-align:text-top; text-align: left;">
				    		<p>a. Hakim</p>
				    		<p>b. Perpanjangan KPN</p>
				    		<p>c. Jenis Penahanan</p>
				    	</th>
				    	<th style="vertical-align:text-top; text-align: left;">
				    		<p>a. Hakim Banding</p>
				    		<p>b. Perpanjangan KPT</p>
				    		<p>c. Jenis penahanan</p>
				    	</th>
				    	<th style="vertical-align:text-top; text-align: left;">
				    		<p>a. Hakim Kasasi</p>
				    		<p>b. Perpanjangan KMA</p>
				    		<p>c. Jenis penahanan</p>
				    	</th>
				</tr>
				<tr>
					<?php 
					$i=1;
					for ($i=1; $i <= 10; $i++) { 
						echo "<th><div align='center'>".$i."</div></th>";
				 	}
					?>
				</tr>
				</thead>
				<?php
				$no = 0;
				foreach ($queryRegister->result() as $row) { $no++;
				?>
				<tr>
					<td style="vertical-align:text-top;  text-align: center;"><?php echo $no; ?></div></td>
					<td style="vertical-align:text-top;  text-align: left;"><?php echo $row->nomor_perkara; ?></td>
					<td style="vertical-align:text-top;  text-align: left;"><?php echo $row->terdakwa; ?></td>
					<td style="vertical-align:text-top;  text-align: left;"><?php echo $row->pasal_dakwaan; ?></td>
					<td style="vertical-align:text-top;  text-align: left;">
						<?php 
							if(!empty($row->PNY1)){ 
								echo "a.".$row->PNY1." s/d ".$row->PNY2."<br/><div align='center'> (".$row->jenis_PNY.")</div><br/>";
							} else {
								echo "a.<br/>";
							}
							if(!empty($row->PNY_PU1)){ 
								echo "b.".$row->PNY_PU1." s/d ".$row->PNY_PU2."<br/><div align='center'> (".$row->jenis_PNY_PU.")</div><br/>";
							} else {
								echo "b.<br/>";
							}
							echo "c."
						?>
					</td>
					<td style="vertical-align:text-top;  text-align: left;">
						<?php 
							if(!empty($row->PU1)){ 
								echo "a.".$row->PU1." s/d ".$row->PU2."<br/><div align='center'> (".$row->jenis_PU.")</div><br/>";
							} else {
								echo "a.<br/>";
							}
							if(!empty($row->PU_KPN1)){ 
								echo "b.".$row->PU_KPN1." s/d ".$row->PU_KPN2."<br/><div align='center'> (".$row->jenis_PU_KPN.")</div><br/>";
							} else {
								echo "b.<br/>";
							}
							echo "c."
						?>
					</td>
					<td style="vertical-align:text-top;  text-align: left;">
						<?php 
							if(!empty($row->HKPN1)){ 
								echo "a.".$row->HKPN1." s/d ".$row->HKPN2."<br/><div align='center'> (".$row->jenis_HKPN.")</div><br/>";
							} else {
								echo "a.<br/>";
							}
							if(!empty($row->HKPN_KPN1)){ 
								echo "b.".$row->HKPN_KPN1." s/d ".$row->HKPN_KPN2."<br/><div align='center'> (".$row->jenis_HKPN_KPN.")</div><br/>";
							} else {
								echo "b.<br/>";
							}
							echo "c."
						?>
					</td>
					<td style="vertical-align:text-top;  text-align: left;">
						<?php 
							if(!empty($row->HKPT1)){ 
								echo "a.".$row->HKPT1." s/d ".$row->HKPT2."<br/><div align='center'> (".$row->jenis_HKPT.")</div><br/>";
							} else {
								echo "a.<br/>";
							}
							if(!empty($row->HKPT_KPT1)){ 
								echo "b.".$row->HKPT_KPT1." s/d ".$row->HKPT_KPT2."<br/><div align='center'> (".$row->jenis_HKPT_KPT.")</div><br/>";
							} else {
								echo "b.<br/>";
							}
							echo "c."
						?>
					</td>
					<td style="vertical-align:text-top;  text-align: left;">
						<?php 
							if(!empty($row->HKMA1)){ 
								echo "a.".$row->HKMA1." s/d ".$row->HKMA2."<br/><div align='center'> (".$row->jenis_HKMA.")</div><br/>";
							} else {
								echo "a.<br/>";
							}
							if(!empty($row->HKMA_KMA1)){ 
								echo "b.".$row->HKMA_KMA1." s/d ".$row->HKMA_KMA2."<br/><div align='center'> (".$row->jenis_HKMA_KMA.")</div><br/>";
							} else {
								echo "b.<br/>";
							}
							echo "c."
						?>
					</td>
					<td style="vertical-align:text-top;  text-align: left;"></td>
					
					
				</tr>
				<?php } ?>
			</table>
			</div>
		
	</div>
	</div>
	</div>
</div>