<style type="text/css">
@page  
{ 
	margin: 0mm 0mm 0mm 1mm;  
} 
@media screen {
	.page-break	{ height:10px; border-top:1px dotted #999; margin-bottom:13px; }
}
@media print {
	.page-break { height:0; page-break-before:always; margin:0; border-top:none; }
}
#_body{
	margin: 20px;
	width: 750px;
}
._hed{
	font-size: 14px;
	font-weight: bold;
}
._hed2{
	font-size: 11px;
}
p{
	margin: 0px;
	margin-bottom: 3px;
	font-size: 11px;
}
div{
	font-size: 11px;
}
._hed3{
	margin-top: -15px;
	margin-left: 130px;
}
._hed4{
	margin-top: -15px;
	margin-left: 80px;
}
._detTab{
	width: 100%;
	border-top: 1px solid #000;
}
._detTab tr th{
	font-weight: normal;
	font-size: 11px;
	padding: 3px;
	padding-bottom: 2px;
	border-bottom: 1px solid #000;
	border-left: 1px solid #000;
}
._detTab tr td{
	font-size: 11px;
	padding: 3px;
	border-left: 1px solid #000;
}
._right{
    border-right: 1px solid #000;
}
._bottom{
	border-top: 1px solid #000;
}
._footer{
	border-bottom: 1px solid #000;
}
._none{
    border: none;
}
._tot{
	width: 100%
}
._tot tr th{
	font-weight: normal;
	font-size: 11px;
}
._tot tr td{
	font-size: 11px;
}
</style>

<?php
if(!empty($this->data->cabang->tgl_pengukuhan)){
	$this->data->cabang->tgl_pengukuhan = date("d-m-Y", strtotime($this->data->cabang->tgl_pengukuhan));
}
$date = new Date;
$konversi = new Konversi;
	
?>
<div id="_body">

	<table style="width: 100%">
		<tr>
			<td style="width: 46%;">
				<?php if($this->data->data->ppn_nilai!=0){ ?>
					<p class="_hed"><?php echo $this->data->cabang->nm_cabang ?></p>
					<p class="hed">JTH. TEMPO</p>
				    <p class="_hed2 _hed4">: <?php echo $date->tglIndo($date->nextDayDate($this->data->data->tgl, $this->data->data->top))?></p>
				<?php }
				else{ ?>
				    <p class="_hed"><?php echo $this->data->cabang->kop ?></p>
				    <p class="_hed">&nbsp;</p>
				<?php }?>
				<!--<p class="_hed2"><?php echo $this->data->cabang->alamat.' '.$this->data->cabang->manager ?></p>
				<p class="_hed2"><?php echo 'TELP : '.$this->data->cabang->telp.' FAX : '.$this->data->cabang->fax ?></p>-->
				<p class="hed">SALES</p>
				<p class="_hed2 _hed4">: <?php echo $this->data->data->nm_sales ?></p>
				<p class="_hed2">KETERANGAN</p>
				<p class="_hed2 _hed4">: <?php echo $this->data->data->ket ?></p>
				<p class="hed2">NOTA NO.</p>
				<p class="_hed2 _hed4">: <?php echo $this->data->data->nonjl ?></p>
				<!--<p class="_hed2">NPWP / NPPKP</p>
				<p class="_hed2 _hed3">: <?php echo $this->data->cabang->npwp ?></p>
				<p class="_hed2">Tgl. Pengukuhan PKP</p>
				<p class="_hed2 _hed3">: <?php echo $this->data->cabang->tgl_pengukuhan ?></p>-->
			</td>
			<!--<td style="width: 200px;">
				<p class="_hed">NOTA PENJUALAN</p>
				<p class="hed2">Nomor</p>
				<p class="_hed2 _hed4">: <?php echo $this->data->data->nonjl ?></p>
				<p class="hed">Tanggal</p>
				<p class="_hed2 _hed4">: <?php echo $date->tglIndo($this->data->data->tgl) ?></p>
				<p class="hed">Sales</p>
				<p class="_hed2 _hed4">: <?php echo $this->data->data->nm_sales ?></p>
				<p class="hed">No. Ref</p>
				<p class="_hed2 _hed4">: <?php echo $this->data->data->noref ?></p>
			</td>-->
			<td style="width: 53%;">
				<p class="_hed2"><?php echo $this->data->cabang->manager.', '.$date->tglIndo($this->data->data->tgl) ?></p>
				<p class="_hed2">Kepada Yth :</p>
				<p class="_hed2"><?php echo $this->data->data->nm_sub.' ('.$this->data->data->kd_sub.')' ?></p>
				<p class="_hed2"><?php echo $this->data->sub->alamat ?></p>
				<p class="_hed2"><?php echo $this->data->sub->kota ?></p>
				<!--<p class="_hed2" style="margin-top: 5px;">
					Bayar : <?php echo $this->data->data->jen_bayar ?>, &nbsp;&nbsp;&nbsp;&nbsp; 
					J. Tempo : 
					<?php 
					$date = new Date;
					$jt = $date->getPenjumlahanTanggal($this->data->data->tgl, 0, $this->data->data->top, 0);
					echo date("d/m/Y", strtotime($jt)) 
					?>
				</p>-->
				
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center">
				<b>SURAT JALAN</b>
			</td>
		</tr>
		<tr>
			<td colspan="2">
				<!--
				<p style="font-weight: bold;">NOTA NO : <?php echo $this->data->data->nonjl ?></p>
				<p style="font-weight: bold; margin-top: -13px; text-align: center;  width: 100%">BUKTI NOTA PENJUALAN</p>
				-->
			</td>
		</tr>
		<tr>
			<td colspan="2">
				<table class="_detTab" cellspacing="0" cellpadding="0" style="width:90%;">
					<thead>
						<tr>
							<th style="width: 4%;">No</th>
							<th style="width: 12%;">Kode</th>
							<th style="width: 74%;">Nama Barang</th>
							<th style="width: 12%;" align="right" class="_right">Qty</th>
							<!--<th style="width: 20px;">Sat</th>
							<th align="right" style="width: 13%;">Price</th>
							<th align="right" style="width: 30px;">D.%1</th>
							<th align="right" style="width: 30px;">D.%2</th>
							<th align="right" style="width: 16%;" class="_right">Value</th>-->
						</tr>
					</thead>
					<tbody>
						<?php 
						$no = 1;
						$kode = new Kode;
						$disRp1 = 0;
						$disRp2 = 0;
						$disPer1 = 0;
						$disPer2 = 0;
						$bruto = 0;
						$disc = 0;
						$netto = 0;
						foreach($this->data->det as $row){ 
							$tot = $kode->totBertingkat($row);
							
							$disRp1  = $disRp1 + $tot['disrp1'];
							$disRp2  = $disRp2 + $tot['disrp2'];
							$disPer1 = $disPer1 + $tot['disper1'];
							$disPer2 = $disPer2 + $tot['disper2'];

							$bruto 	= $bruto + $tot['bruto'];
							$disc 	= $disc + $tot['dis'];
							$netto 	= $netto + $tot['tot'];
						?>
							<tr>
								<td><?php echo $no++ ?></td>
								<td><?php echo $row->kd_inv ?></td>
								<td><?php echo substr($row->nm_inv, 0, 50) ?></td>
								<td align="right" class="_right"><?php echo number_format($row->qty,2) ?> <?php echo $row->satuan ?></td>
								<!--<td align="right"><?php echo number_format($row->harga) ?></td>
								<td align="right"><?php echo number_format($row->diskon_4,2) ?>%</td>
								<td align="right"><?php echo number_format($row->diskon_5,2) ?>%</td>
								<td align="right" class="_right"><?php echo number_format($tot['tot']) ?></td>-->
							</tr>
						<?php 
						} ?>
						<tr>
							<td colspan="4" rowspan="6" class="_bottom" style="border-left: none; border-bottom: none">
								<!--<p>Terbilang : <?php echo strtoupper($konversi->konversi($this->data->data->gtot)) ?> RUPIAH</p>
								<?php if($this->data->data->ppn_nilai!=0){ ?>
								    <p>Pembayaran ditujukan ke <b><?php echo $this->data->cabang->rek_an.' - '.$this->data->cabang->rek_bank.' '.$this->data->cabang->rek_no?></b></p>
								<?php } ?>-->
								<div style="width:100%;margin-top: 20px">
									<table style="width:100%;">
									    <tr>
									       <td class="_none" style="width:50%;" colspan="2" align="center">Penerima</td>
									       <td class="_none" style="width:50%;" align="center">dibuat oleh</td>
									    </tr>
            							<tr>
            								<td class="_none">&nbsp;</td>
            								<td class="_none">&nbsp;</td>
            								<td class="_none">&nbsp;</td>
            							</tr>
									    <tr>
									       <td class="_none" align="center">(</td>
									       <td class="_none" align="center">)</td>
									       <td class="_none" align="center">( <span style="margin-left: 30px;"><?php echo $this->data->data->chusr ?></span> <span style="margin-left: 30px;">)</span></td>
									    </tr>
									</table>        
									<!--<?php echo $this->data->data->kd_sopir.' / '.$this->data->data->kd_kernet.' / '.$this->data->data->kd_kernet2 ?>-->
								</div>
							</td>
						<!--<td class="_bottom">
								Sub Total
							</td>
							<td align="right" class="_bottom _right"><?php echo number_format($bruto) ?></td>-->
						</tr>
						<!--<tr>
							<td class="_bottom">
								Diskon Cash
							</td>
							<td align="right" class="_bottom _right"><?php echo number_format($this->data->data->diskg_nilai) ?></td>
						</tr>
						<tr>
							<td class="_bottom">
								Total Diskon
							</td>
							<td align="right" class="_bottom _right"><?php echo number_format($this->data->data->diskt) ?></td>
						</tr>
						<tr>
							<td class="_bottom">
								DPP
							</td>
							<?php
							$dpp = $this->data->data->gtot - $this->data->data->ppn_nilai;
							?>
							<td align="right" class="_bottom"><?php echo number_format($dpp) ?></td>
						</tr>
						<tr>
							<td class="_bottom">
								PPN
							</td>
							<td align="right" class="_bottom"><?php echo number_format($this->data->data->ppn_nilai) ?></td>
						</tr>
						
						<tr>
							<td class="_bottom _footer">
								Grand Total
							</td>
							<td align="right" class="_bottom _footer _right"><?php echo number_format($this->data->data->gtot) ?></td>
						</tr>
						<tr>
							<td class="_none">&nbsp;</td>
							<td class="_none">&nbsp;</td>
						</tr>
						<tr>
							<td class="_none">&nbsp;</td>
							<td class="_none">&nbsp;</td>
						</tr>-->
					</tbody>
				</table>
			</td>
		</tr>
	</table>

</div>