<?php
	include '../../inc/inc.koneksi.php';	
	include '../../inc/fungsi_tanggal.php';

	$bulan	= $_GET[bulan];
	$tahun	= $_GET[tahun];

	if($bulan==1) $nbulan='JANUARI';
	else if($bulan==2) $nbulan='FEBRUARI';
	else if($bulan==3) $nbulan='MARET';
	else if($bulan==4) $nbulan='APRILI';
	else if($bulan==5) $nbulan='MEI';
	else if($bulan==6) $nbulan='JUNI';
	else if($bulan==7) $nbulan='JULI';
	else if($bulan==8) $nbulan='AGUSTUS';
	else if($bulan==9) $nbulan='SEPTEMBER';
	else if($bulan==10) $nbulan='OKTOBER';
	else if($bulan==11) $nbulan='NOVEMBER';
	else $nbulan='DESEMBER';
	
	$sql2		= "SELECT * FROM company";		
	$query2 	= mysql_query($sql2);
		
	while($r2=mysql_fetch_array($query2)){
		$kop1 = $r2[nama1];
		$kop2 = $r2[nama2];
		$kop3 = $r2[alamat];
	}
	
	$content = "<b><li>$kop1</li></b>
		<li>$kop2</li>
		<li>$kop3</li>
		<div span='12' align='center'>
			<li align='center'><b>REKAPITULASI LABA RUGI TAHUNAN</b></li>
			<li align='center'><b>BULAN $nbulan $tahun</b></li>
		</div>			
		<br>
		
		<table style='border:double'>
		<tr>
			<th style='border-right:double;border-bottom:double'><b>Keterangan</th>
			<th style='border-right:double;border-bottom:double'>Januari</th>
			<th style='border-right:double;border-bottom:double'>Februari</th>
			<th style='border-right:double;border-bottom:double'>Maret</th>
			<th style='border-right:double;border-bottom:double'>April</th>
			<th style='border-right:double;border-bottom:double'>Mei</th>
			<th style='border-right:double;border-bottom:double'>Juni</th>
			<th style='border-right:double;border-bottom:double'>Juli</th>
			<th style='border-right:double;border-bottom:double'>Agustus</th>
			<th style='border-right:double;border-bottom:double'>September</th>
			<th style='border-right:double;border-bottom:double'>Oktober</th>
			<th style='border-right:double;border-bottom:double'>November</th>
			<th style='border-right:double;border-bottom:double'>Desember</th>
			<th style='border-bottom:double'>Total</b></th>						
		</tr>
		
		<tr>		
			<td style='border-right:double'><b>Pendapatan Usaha</b></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-bottom:double' align='right'></td>
		</tr>";
		
		$query1 = "SELECT * FROM akun_bb WHERE nogol='41' AND level='2' ORDER BY noakun";
		$sql1	= mysql_query($query1);
		$subtot1= 0;
		$subtot2= 0;
		$subtot3= 0;
		$subtot4= 0;
		$subtot5= 0;
		$subtot6= 0;
		$subtot7= 0;
		$subtot8= 0;
		$subtot9= 0;
		$subtot10= 0;
		$subtot11= 0;
		$subtot12= 0;
		
		while($r1=mysql_fetch_array($sql1)){
			$noakun=$r1[noakun];
			
			$query	= "SELECT tanggal,noakun,debet,kredit FROM rekapjur WHERE noakun='$noakun' AND year(tanggal)='$tahun' AND batal='' ";
			$sql = mysql_query($query);
				
			$rdebet1=0;
			$rdebet2=0;
			$rdebet3=0;
			$rdebet4=0;
			$rdebet5=0;
			$rdebet6=0;
			$rdebet7=0;
			$rdebet8=0;
			$rdebet9=0;
			$rdebet10=0;
			$rdebet11=0;
			$rdebet12=0;
			
			$rkredit1=0;
			$rkredit2=0;
			$rkredit3=0;
			$rkredit4=0;
			$rkredit5=0;
			$rkredit6=0;
			$rkredit7=0;
			$rkredit8=0;
			$rkredit9=0;
			$rkredit10=0;
			$rkredit11=0;
			$rkredit12=0;
			while($r=mysql_fetch_array($sql)){
				$tanggal=$r[tanggal];
				$bln=substr($tanggal,5,2);
				if($bln=='1'){
					$rdebet1=$rdebet1+$r[debet];
					$rkredit1=$rkredit1+$r[kredit];
				}else if($bln=='2'){
					$rdebet2=$rdebet2+$r[debet];
					$rkredit2=$rkredit2+$r[kredit];
				}else if($bln=='3'){
					$rdebet3=$rdebet3+$r[debet];
					$rkredit3=$rkredit3+$r[kredit];
				}else if($bln=='4'){
					$rdebet4=$rdebet4+$r[debet];
					$rkredit4=$rkredit4+$r[kredit];
				}else if($bln=='5'){
					$rdebet5=$rdebet5+$r[debet];
					$rkredit5=$rkredit5+$r[kredit];
				}else if($bln=='6'){
					$rdebet6=$rdebet6+$r[debet];
					$rkredit6=$rkredit6+$r[kredit];
				}else if($bln=='7'){
					$rdebet7=$rdebet7+$r[debet];
					$rkredit7=$rkredit7+$r[kredit];
				}else if($bln=='8'){
					$rdebet8=$rdebet8+$r[debet];
					$rkredit8=$rkredit8+$r[kredit];
				}else if($bln=='9'){
					$rdebet9=$rdebet9+$r[debet];
					$rkredit9=$rkredit9+$r[kredit];
				}else if($bln=='10'){
					$rdebet10=$rdebet10+$r[debet];
					$rkredit10=$rkredit10+$r[kredit];
				}else if($bln=='11'){
					$rdebet11=$rdebet11+$r[debet];
					$rkredit11=$rkredit11+$r[kredit];
				}else if($bln=='12'){
					$rdebet12=$rdebet12+$r[debet];
					$rkredit12=$rkredit12+$r[kredit];
				}
			}
			
			$saldo1=$rkredit1-$rdebet1;
			$saldo2=$rkredit2-$rdebet2;
			$saldo3=$rkredit3-$rdebet3;
			$saldo4=$rkredit4-$rdebet4;
			$saldo5=$rkredit5-$rdebet5;
			$saldo6=$rkredit6-$rdebet6;
			$saldo7=$rkredit7-$rdebet7;
			$saldo8=$rkredit8-$rdebet8;
			$saldo9=$rkredit9-$rdebet9;
			$saldo10=$rkredit10-$rdebet10;
			$saldo11=$rkredit11-$rdebet11;
			$saldo12=$rkredit12-$rdebet12;
			$jsaldo=$saldo1+$saldo2+$saldo3+$saldo4+$saldo5+$saldo6+$saldo7+$saldo8+$saldo9+$saldo10+$saldo11+$saldo12;
			
			$subtot1=$subtot1+$saldo1;
			$subtot2=$subtot2+$saldo2;
			$subtot3=$subtot3+$saldo3;
			$subtot4=$subtot4+$saldo4;
			$subtot5=$subtot5+$saldo5;
			$subtot6=$subtot6+$saldo6;
			$subtot7=$subtot7+$saldo7;
			$subtot8=$subtot8+$saldo8;
			$subtot9=$subtot9+$saldo9;
			$subtot10=$subtot10+$saldo10;
			$subtot11=$subtot11+$saldo11;
			$subtot12=$subtot12+$saldo12;
			$jsubtot=$subtot1+$subtot2+$subtot3+$subtot4+$subtot5+$subtot6+$subtot7+$subtot8+$subtot9+$subtot10+$subtot11+$subtot12;
		
			$content .= "<tr>
					<td style='border-right:double'>$r1[naakun]</td>
					<td style='border-right:double' align='right'>".number_format($saldo1,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo2,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo3,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo4,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo5,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo6,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo7,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo8,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo9,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo10,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo11,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo12,2)."</td>
					<td width='20%' align='right'>".number_format($jsaldo,2)."</td>
				</tr>";
		}
				
	$content .= "</tr>
				<td style='border-right:double' align='right'>Jumlah</td>								
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot1,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot2,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot3,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot4,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot5,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot6,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot7,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot8,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot9,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot10,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot11,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot12,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($jsubtot,2)."</td>				
			</tr>";
			$laba1=$laba1+$subtot1;
			$laba2=$laba2+$subtot2;
			$laba3=$laba3+$subtot3;
			$laba4=$laba4+$subtot4;
			$laba5=$laba5+$subtot5;
			$laba6=$laba6+$subtot6;
			$laba7=$laba7+$subtot7;
			$laba8=$laba8+$subtot8;
			$laba9=$laba9+$subtot9;
			$laba10=$laba10+$subtot10;
			$laba11=$laba11+$subtot11;
			$laba12=$laba12+$subtot12;
			$jlaba=$laba1+$laba2+$laba3+$laba4+$laba5+$laba6+$laba7+$laba8+$laba9+$laba10+$laba11+$laba12;
				
	$content .= "<tr>		
			<td style='border-right:double'><b>Pengurang Pendapatan</b></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-bottom:double' align='right'></td>
		</tr>";
				
		$query1 = "SELECT * FROM akun_bb WHERE nogol='42' AND level='2' ORDER BY noakun";		
		$sql1	= mysql_query($query1);
		$subtot1= 0;
		$subtot2= 0;
		$subtot3= 0;
		$subtot4= 0;
		$subtot5= 0;
		$subtot6= 0;
		$subtot7= 0;
		$subtot8= 0;
		$subtot9= 0;
		$subtot10= 0;
		$subtot11= 0;
		$subtot12= 0;
		
		while($r1=mysql_fetch_array($sql1)){
			$noakun=$r1[noakun];
			
			$query	= "SELECT tanggal,noakun,debet,kredit FROM rekapjur WHERE noakun='$noakun' AND year(tanggal)='$tahun' AND batal='' ";
			$sql = mysql_query($query);
				
			$rdebet1=0;
			$rdebet2=0;
			$rdebet3=0;
			$rdebet4=0;
			$rdebet5=0;
			$rdebet6=0;
			$rdebet7=0;
			$rdebet8=0;
			$rdebet9=0;
			$rdebet10=0;
			$rdebet11=0;
			$rdebet12=0;
			
			$rkredit1=0;
			$rkredit2=0;
			$rkredit3=0;
			$rkredit4=0;
			$rkredit5=0;
			$rkredit6=0;
			$rkredit7=0;
			$rkredit8=0;
			$rkredit9=0;
			$rkredit10=0;
			$rkredit11=0;
			$rkredit12=0;
			while($r=mysql_fetch_array($sql)){
				$tanggal=$r[tanggal];
				$bln=substr($tanggal,5,2);
				if($bln=='1'){
					$rdebet1=$rdebet1+$r[debet];
					$rkredit1=$rkredit1+$r[kredit];
				}else if($bln=='2'){
					$rdebet2=$rdebet2+$r[debet];
					$rkredit2=$rkredit2+$r[kredit];
				}else if($bln=='3'){
					$rdebet3=$rdebet3+$r[debet];
					$rkredit3=$rkredit3+$r[kredit];
				}else if($bln=='4'){
					$rdebet4=$rdebet4+$r[debet];
					$rkredit4=$rkredit4+$r[kredit];
				}else if($bln=='5'){
					$rdebet5=$rdebet5+$r[debet];
					$rkredit5=$rkredit5+$r[kredit];
				}else if($bln=='6'){
					$rdebet6=$rdebet6+$r[debet];
					$rkredit6=$rkredit6+$r[kredit];
				}else if($bln=='7'){
					$rdebet7=$rdebet7+$r[debet];
					$rkredit7=$rkredit7+$r[kredit];
				}else if($bln=='8'){
					$rdebet8=$rdebet8+$r[debet];
					$rkredit8=$rkredit8+$r[kredit];
				}else if($bln=='9'){
					$rdebet9=$rdebet9+$r[debet];
					$rkredit9=$rkredit9+$r[kredit];
				}else if($bln=='10'){
					$rdebet10=$rdebet10+$r[debet];
					$rkredit10=$rkredit10+$r[kredit];
				}else if($bln=='11'){
					$rdebet11=$rdebet11+$r[debet];
					$rkredit11=$rkredit11+$r[kredit];
				}else if($bln=='12'){
					$rdebet12=$rdebet12+$r[debet];
					$rkredit12=$rkredit12+$r[kredit];
				}
			}
			
			$saldo1 =$rdebet1-$rkredit1;
			$saldo2 =$rdebet2-$rkredit2;
			$saldo3 =$rdebet3-$rkredit3;
			$saldo4 =$rdebet4-$rkredit4;
			$saldo5 =$rdebet5-$rkredit5;
			$saldo6 =$rdebet6-$rkredit6;
			$saldo7 =$rdebet7-$rkredit7;
			$saldo8 =$rdebet8-$rkredit8;
			$saldo9 =$rdebet9-$rkredit9;
			$saldo10=$rdebet10-$rkredit10;
			$saldo11=$rdebet11-$rkredit11;
			$saldo12=$rdebet12-$rkredit12;
			$jsaldo=$saldo1+$saldo2+$saldo3+$saldo4+$saldo5+$saldo6+$saldo7+$saldo8+$saldo9+$saldo10+$saldo11+$saldo12;
			
			$subtot1=$subtot1+$saldo1;
			$subtot2=$subtot2+$saldo2;
			$subtot3=$subtot3+$saldo3;
			$subtot4=$subtot4+$saldo4;
			$subtot5=$subtot5+$saldo5;
			$subtot6=$subtot6+$saldo6;
			$subtot7=$subtot7+$saldo7;
			$subtot8=$subtot8+$saldo8;
			$subtot9=$subtot9+$saldo9;
			$subtot10=$subtot10+$saldo10;
			$subtot11=$subtot11+$saldo11;
			$subtot12=$subtot12+$saldo12;
			$jsubtot=$subtot1+$subtot2+$subtot3+$subtot4+$subtot5+$subtot6+$subtot7+$subtot8+$subtot9+$subtot10+$subtot11+$subtot12;
		
			$content .= "<tr>
					<td style='border-right:double'>$r1[naakun]</td>
					<td style='border-right:double' align='right'>".number_format($saldo1,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo2,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo3,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo4,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo5,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo6,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo7,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo8,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo9,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo10,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo11,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo12,2)."</td>
					<td width='20%' align='right'>".number_format($jsaldo,2)."</td>
				</tr>";
		}
			
	$content .= "</tr>
				<td style='border-right:double' align='right'>Jumlah</td>								
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot1,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot2,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot3,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot4,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot5,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot6,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot7,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot8,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot9,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot10,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot11,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot12,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($jsubtot,2)."</td>				
			</tr>";
			$laba1=$laba1-$subtot1;
			$laba2=$laba2-$subtot2;
			$laba3=$laba3-$subtot3;
			$laba4=$laba4-$subtot4;
			$laba5=$laba5-$subtot5;
			$laba6=$laba6-$subtot6;
			$laba7=$laba7-$subtot7;
			$laba8=$laba8-$subtot8;
			$laba9=$laba9-$subtot9;
			$laba10=$laba10-$subtot10;
			$laba11=$laba11-$subtot11;
			$laba12=$laba12-$subtot12;
			$jlaba=$laba1+$laba2+$laba3+$laba4+$laba5+$laba6+$laba7+$laba8+$laba9+$laba10+$laba11+$laba12;
			
	$content .= "</tr>
				<td style='border-right:double' align='right'>Pendapatan Bersih</td>								
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba1,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba2,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba3,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba4,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba5,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba6,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba7,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba8,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba9,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba10,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba11,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba12,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($jlaba,2)."</td>
			</tr>";
	
	$content .= "<tr>
			<td style='border-right:double'><b>Harga Pokok Penjualan</b></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-bottom:double' align='right'></td>
		</tr>";
				
		$query1 = "SELECT * FROM akun_bb WHERE nogol='51' AND level='2' ORDER BY noakun";		
		$sql1	= mysql_query($query1);
		$subtot1= 0;
		$subtot2= 0;
		$subtot3= 0;
		$subtot4= 0;
		$subtot5= 0;
		$subtot6= 0;
		$subtot7= 0;
		$subtot8= 0;
		$subtot9= 0;
		$subtot10= 0;
		$subtot11= 0;
		$subtot12= 0;
		
		while($r1=mysql_fetch_array($sql1)){
			$noakun=$r1[noakun];
			
			$query	= "SELECT tanggal,noakun,debet,kredit FROM rekapjur WHERE noakun='$noakun' AND year(tanggal)='$tahun' AND batal='' ";
			$sql = mysql_query($query);
				
			$rdebet1=0;
			$rdebet2=0;
			$rdebet3=0;
			$rdebet4=0;
			$rdebet5=0;
			$rdebet6=0;
			$rdebet7=0;
			$rdebet8=0;
			$rdebet9=0;
			$rdebet10=0;
			$rdebet11=0;
			$rdebet12=0;
			
			$rkredit1=0;
			$rkredit2=0;
			$rkredit3=0;
			$rkredit4=0;
			$rkredit5=0;
			$rkredit6=0;
			$rkredit7=0;
			$rkredit8=0;
			$rkredit9=0;
			$rkredit10=0;
			$rkredit11=0;
			$rkredit12=0;
			while($r=mysql_fetch_array($sql)){
				$tanggal=$r[tanggal];
				$bln=substr($tanggal,5,2);
				if($bln=='1'){
					$rdebet1=$rdebet1+$r[debet];
					$rkredit1=$rkredit1+$r[kredit];
				}else if($bln=='2'){
					$rdebet2=$rdebet2+$r[debet];
					$rkredit2=$rkredit2+$r[kredit];
				}else if($bln=='3'){
					$rdebet3=$rdebet3+$r[debet];
					$rkredit3=$rkredit3+$r[kredit];
				}else if($bln=='4'){
					$rdebet4=$rdebet4+$r[debet];
					$rkredit4=$rkredit4+$r[kredit];
				}else if($bln=='5'){
					$rdebet5=$rdebet5+$r[debet];
					$rkredit5=$rkredit5+$r[kredit];
				}else if($bln=='6'){
					$rdebet6=$rdebet6+$r[debet];
					$rkredit6=$rkredit6+$r[kredit];
				}else if($bln=='7'){
					$rdebet7=$rdebet7+$r[debet];
					$rkredit7=$rkredit7+$r[kredit];
				}else if($bln=='8'){
					$rdebet8=$rdebet8+$r[debet];
					$rkredit8=$rkredit8+$r[kredit];
				}else if($bln=='9'){
					$rdebet9=$rdebet9+$r[debet];
					$rkredit9=$rkredit9+$r[kredit];
				}else if($bln=='10'){
					$rdebet10=$rdebet10+$r[debet];
					$rkredit10=$rkredit10+$r[kredit];
				}else if($bln=='11'){
					$rdebet11=$rdebet11+$r[debet];
					$rkredit11=$rkredit11+$r[kredit];
				}else if($bln=='12'){
					$rdebet12=$rdebet12+$r[debet];
					$rkredit12=$rkredit12+$r[kredit];
				}
			}
			
			$saldo1 =$rdebet1-$rkredit1;
			$saldo2 =$rdebet2-$rkredit2;
			$saldo3 =$rdebet3-$rkredit3;
			$saldo4 =$rdebet4-$rkredit4;
			$saldo5 =$rdebet5-$rkredit5;
			$saldo6 =$rdebet6-$rkredit6;
			$saldo7 =$rdebet7-$rkredit7;
			$saldo8 =$rdebet8-$rkredit8;
			$saldo9 =$rdebet9-$rkredit9;
			$saldo10=$rdebet10-$rkredit10;
			$saldo11=$rdebet11-$rkredit11;
			$saldo12=$rdebet12-$rkredit12;
			$jsaldo=$saldo1+$saldo2+$saldo3+$saldo4+$saldo5+$saldo6+$saldo7+$saldo8+$saldo9+$saldo10+$saldo11+$saldo12;
			
			$subtot1=$subtot1+$saldo1;
			$subtot2=$subtot2+$saldo2;
			$subtot3=$subtot3+$saldo3;
			$subtot4=$subtot4+$saldo4;
			$subtot5=$subtot5+$saldo5;
			$subtot6=$subtot6+$saldo6;
			$subtot7=$subtot7+$saldo7;
			$subtot8=$subtot8+$saldo8;
			$subtot9=$subtot9+$saldo9;
			$subtot10=$subtot10+$saldo10;
			$subtot11=$subtot11+$saldo11;
			$subtot12=$subtot12+$saldo12;
			$jsubtot=$subtot1+$subtot2+$subtot3+$subtot4+$subtot5+$subtot6+$subtot7+$subtot8+$subtot9+$subtot10+$subtot11+$subtot12;
				
			$content .= "<tr>
					<td style='border-right:double'>$r1[naakun]</td>
					<td style='border-right:double' align='right'>".number_format($saldo1,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo2,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo3,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo4,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo5,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo6,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo7,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo8,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo9,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo10,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo11,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo12,2)."</td>
					<td width='20%' align='right'>".number_format($jsaldo,2)."</td>
				</tr>";
		}
		
	$content .= "</tr>
				<td style='border-right:double' align='right'>Jumlah</td>								
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot1,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot2,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot3,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot4,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot5,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot6,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot7,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot8,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot9,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot10,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot11,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot12,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($jsubtot,2)."</td>				
			</tr>";
			$laba1=$laba1-$subtot1;
			$laba2=$laba2-$subtot2;
			$laba3=$laba3-$subtot3;
			$laba4=$laba4-$subtot4;
			$laba5=$laba5-$subtot5;
			$laba6=$laba6-$subtot6;
			$laba7=$laba7-$subtot7;
			$laba8=$laba8-$subtot8;
			$laba9=$laba9-$subtot9;
			$laba10=$laba10-$subtot10;
			$laba11=$laba11-$subtot11;
			$laba12=$laba12-$subtot12;
			$jlaba=$laba1+$laba2+$laba3+$laba4+$laba5+$laba6+$laba7+$laba8+$laba9+$laba10+$laba11+$laba12;
		
	$content .= "</tr>
				<td style='border-right:double' align='right'>Laba Kotor</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba1,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba2,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba3,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba4,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba5,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba6,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba7,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba8,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba9,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba10,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba11,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba12,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($jlaba,2)."</td>
			</tr>";

	$content .= "<tr>
			<td style='border-right:double'><b>Biaya Pemasaran</b></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-bottom:double' align='right'></td>
		</tr>";
				
		$query1 = "SELECT * FROM akun_bb WHERE nogol='52' AND level='2' ORDER BY noakun";		
		$sql1	= mysql_query($query1);
		$subtot1= 0;
		$subtot2= 0;
		$subtot3= 0;
		$subtot4= 0;
		$subtot5= 0;
		$subtot6= 0;
		$subtot7= 0;
		$subtot8= 0;
		$subtot9= 0;
		$subtot10= 0;
		$subtot11= 0;
		$subtot12= 0;
		
		while($r1=mysql_fetch_array($sql1)){
			$noakun=$r1[noakun];
			
			$query	= "SELECT tanggal,noakun,debet,kredit FROM rekapjur WHERE noakun='$noakun' AND year(tanggal)='$tahun' AND batal='' ";
			$sql = mysql_query($query);
				
			$rdebet1=0;
			$rdebet2=0;
			$rdebet3=0;
			$rdebet4=0;
			$rdebet5=0;
			$rdebet6=0;
			$rdebet7=0;
			$rdebet8=0;
			$rdebet9=0;
			$rdebet10=0;
			$rdebet11=0;
			$rdebet12=0;
			
			$rkredit1=0;
			$rkredit2=0;
			$rkredit3=0;
			$rkredit4=0;
			$rkredit5=0;
			$rkredit6=0;
			$rkredit7=0;
			$rkredit8=0;
			$rkredit9=0;
			$rkredit10=0;
			$rkredit11=0;
			$rkredit12=0;
			while($r=mysql_fetch_array($sql)){
				$tanggal=$r[tanggal];
				$bln=substr($tanggal,5,2);
				if($bln=='1'){
					$rdebet1=$rdebet1+$r[debet];
					$rkredit1=$rkredit1+$r[kredit];
				}else if($bln=='2'){
					$rdebet2=$rdebet2+$r[debet];
					$rkredit2=$rkredit2+$r[kredit];
				}else if($bln=='3'){
					$rdebet3=$rdebet3+$r[debet];
					$rkredit3=$rkredit3+$r[kredit];
				}else if($bln=='4'){
					$rdebet4=$rdebet4+$r[debet];
					$rkredit4=$rkredit4+$r[kredit];
				}else if($bln=='5'){
					$rdebet5=$rdebet5+$r[debet];
					$rkredit5=$rkredit5+$r[kredit];
				}else if($bln=='6'){
					$rdebet6=$rdebet6+$r[debet];
					$rkredit6=$rkredit6+$r[kredit];
				}else if($bln=='7'){
					$rdebet7=$rdebet7+$r[debet];
					$rkredit7=$rkredit7+$r[kredit];
				}else if($bln=='8'){
					$rdebet8=$rdebet8+$r[debet];
					$rkredit8=$rkredit8+$r[kredit];
				}else if($bln=='9'){
					$rdebet9=$rdebet9+$r[debet];
					$rkredit9=$rkredit9+$r[kredit];
				}else if($bln=='10'){
					$rdebet10=$rdebet10+$r[debet];
					$rkredit10=$rkredit10+$r[kredit];
				}else if($bln=='11'){
					$rdebet11=$rdebet11+$r[debet];
					$rkredit11=$rkredit11+$r[kredit];
				}else if($bln=='12'){
					$rdebet12=$rdebet12+$r[debet];
					$rkredit12=$rkredit12+$r[kredit];
				}
			}
			
			$saldo1 =$rdebet1-$rkredit1;
			$saldo2 =$rdebet2-$rkredit2;
			$saldo3 =$rdebet3-$rkredit3;
			$saldo4 =$rdebet4-$rkredit4;
			$saldo5 =$rdebet5-$rkredit5;
			$saldo6 =$rdebet6-$rkredit6;
			$saldo7 =$rdebet7-$rkredit7;
			$saldo8 =$rdebet8-$rkredit8;
			$saldo9 =$rdebet9-$rkredit9;
			$saldo10=$rdebet10-$rkredit10;
			$saldo11=$rdebet11-$rkredit11;
			$saldo12=$rdebet12-$rkredit12;
			$jsaldo=$saldo1+$saldo2+$saldo3+$saldo4+$saldo5+$saldo6+$saldo7+$saldo8+$saldo9+$saldo10+$saldo11+$saldo12;
			
			$subtot1=$subtot1+$saldo1;
			$subtot2=$subtot2+$saldo2;
			$subtot3=$subtot3+$saldo3;
			$subtot4=$subtot4+$saldo4;
			$subtot5=$subtot5+$saldo5;
			$subtot6=$subtot6+$saldo6;
			$subtot7=$subtot7+$saldo7;
			$subtot8=$subtot8+$saldo8;
			$subtot9=$subtot9+$saldo9;
			$subtot10=$subtot10+$saldo10;
			$subtot11=$subtot11+$saldo11;
			$subtot12=$subtot12+$saldo12;
			$jsubtot=$subtot1+$subtot2+$subtot3+$subtot4+$subtot5+$subtot6+$subtot7+$subtot8+$subtot9+$subtot10+$subtot11+$subtot12;
				
			$content .= "<tr>
					<td style='border-right:double'>$r1[naakun]</td>
					<td style='border-right:double' align='right'>".number_format($saldo1,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo2,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo3,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo4,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo5,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo6,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo7,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo8,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo9,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo10,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo11,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo12,2)."</td>
					<td width='20%' align='right'>".number_format($jsaldo,2)."</td>
				</tr>";
		}
		
	$content .= "</tr>
				<td style='border-right:double' align='right'>Jumlah</td>								
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot1,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot2,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot3,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot4,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot5,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot6,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot7,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot8,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot9,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot10,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot11,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot12,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($jsubtot,2)."</td>				
			</tr>";
			$laba1=$laba1-$subtot1;
			$laba2=$laba2-$subtot2;
			$laba3=$laba3-$subtot3;
			$laba4=$laba4-$subtot4;
			$laba5=$laba5-$subtot5;
			$laba6=$laba6-$subtot6;
			$laba7=$laba7-$subtot7;
			$laba8=$laba8-$subtot8;
			$laba9=$laba9-$subtot9;
			$laba10=$laba10-$subtot10;
			$laba11=$laba11-$subtot11;
			$laba12=$laba12-$subtot12;
			$jlaba=$laba1+$laba2+$laba3+$laba4+$laba5+$laba6+$laba7+$laba8+$laba9+$laba10+$laba11+$laba12;
			
	$content .= "<tr>
			<td style='border-right:double'><b>Biaya Administrasi dan Umum</b></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-bottom:double' align='right'></td>
		</tr>";
				
		$query1 = "SELECT * FROM akun_bb WHERE nogol='53' AND level='2' ORDER BY noakun";		
		$sql1	= mysql_query($query1);
		$subtot1= 0;
		$subtot2= 0;
		$subtot3= 0;
		$subtot4= 0;
		$subtot5= 0;
		$subtot6= 0;
		$subtot7= 0;
		$subtot8= 0;
		$subtot9= 0;
		$subtot10= 0;
		$subtot11= 0;
		$subtot12= 0;
		
		while($r1=mysql_fetch_array($sql1)){
			$noakun=$r1[noakun];
			
			$query	= "SELECT tanggal,noakun,debet,kredit FROM rekapjur WHERE noakun='$noakun' AND year(tanggal)='$tahun' AND batal='' ";
			$sql = mysql_query($query);
				
			$rdebet1=0;
			$rdebet2=0;
			$rdebet3=0;
			$rdebet4=0;
			$rdebet5=0;
			$rdebet6=0;
			$rdebet7=0;
			$rdebet8=0;
			$rdebet9=0;
			$rdebet10=0;
			$rdebet11=0;
			$rdebet12=0;
			
			$rkredit1=0;
			$rkredit2=0;
			$rkredit3=0;
			$rkredit4=0;
			$rkredit5=0;
			$rkredit6=0;
			$rkredit7=0;
			$rkredit8=0;
			$rkredit9=0;
			$rkredit10=0;
			$rkredit11=0;
			$rkredit12=0;
			while($r=mysql_fetch_array($sql)){
				$tanggal=$r[tanggal];
				$bln=substr($tanggal,5,2);
				if($bln=='1'){
					$rdebet1=$rdebet1+$r[debet];
					$rkredit1=$rkredit1+$r[kredit];
				}else if($bln=='2'){
					$rdebet2=$rdebet2+$r[debet];
					$rkredit2=$rkredit2+$r[kredit];
				}else if($bln=='3'){
					$rdebet3=$rdebet3+$r[debet];
					$rkredit3=$rkredit3+$r[kredit];
				}else if($bln=='4'){
					$rdebet4=$rdebet4+$r[debet];
					$rkredit4=$rkredit4+$r[kredit];
				}else if($bln=='5'){
					$rdebet5=$rdebet5+$r[debet];
					$rkredit5=$rkredit5+$r[kredit];
				}else if($bln=='6'){
					$rdebet6=$rdebet6+$r[debet];
					$rkredit6=$rkredit6+$r[kredit];
				}else if($bln=='7'){
					$rdebet7=$rdebet7+$r[debet];
					$rkredit7=$rkredit7+$r[kredit];
				}else if($bln=='8'){
					$rdebet8=$rdebet8+$r[debet];
					$rkredit8=$rkredit8+$r[kredit];
				}else if($bln=='9'){
					$rdebet9=$rdebet9+$r[debet];
					$rkredit9=$rkredit9+$r[kredit];
				}else if($bln=='10'){
					$rdebet10=$rdebet10+$r[debet];
					$rkredit10=$rkredit10+$r[kredit];
				}else if($bln=='11'){
					$rdebet11=$rdebet11+$r[debet];
					$rkredit11=$rkredit11+$r[kredit];
				}else if($bln=='12'){
					$rdebet12=$rdebet12+$r[debet];
					$rkredit12=$rkredit12+$r[kredit];
				}
			}
			
			$saldo1 =$rdebet1-$rkredit1;
			$saldo2 =$rdebet2-$rkredit2;
			$saldo3 =$rdebet3-$rkredit3;
			$saldo4 =$rdebet4-$rkredit4;
			$saldo5 =$rdebet5-$rkredit5;
			$saldo6 =$rdebet6-$rkredit6;
			$saldo7 =$rdebet7-$rkredit7;
			$saldo8 =$rdebet8-$rkredit8;
			$saldo9 =$rdebet9-$rkredit9;
			$saldo10=$rdebet10-$rkredit10;
			$saldo11=$rdebet11-$rkredit11;
			$saldo12=$rdebet12-$rkredit12;
			$jsaldo=$saldo1+$saldo2+$saldo3+$saldo4+$saldo5+$saldo6+$saldo7+$saldo8+$saldo9+$saldo10+$saldo11+$saldo12;
			
			$subtot1=$subtot1+$saldo1;
			$subtot2=$subtot2+$saldo2;
			$subtot3=$subtot3+$saldo3;
			$subtot4=$subtot4+$saldo4;
			$subtot5=$subtot5+$saldo5;
			$subtot6=$subtot6+$saldo6;
			$subtot7=$subtot7+$saldo7;
			$subtot8=$subtot8+$saldo8;
			$subtot9=$subtot9+$saldo9;
			$subtot10=$subtot10+$saldo10;
			$subtot11=$subtot11+$saldo11;
			$subtot12=$subtot12+$saldo12;
			$jsubtot=$subtot1+$subtot2+$subtot3+$subtot4+$subtot5+$subtot6+$subtot7+$subtot8+$subtot9+$subtot10+$subtot11+$subtot12;
				
			$content .= "<tr>
					<td style='border-right:double'>$r1[naakun]</td>
					<td style='border-right:double' align='right'>".number_format($saldo1,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo2,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo3,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo4,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo5,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo6,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo7,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo8,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo9,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo10,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo11,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo12,2)."</td>
					<td width='20%' align='right'>".number_format($jsaldo,2)."</td>
				</tr>";
		}
		
	$content .= "</tr>
				<td style='border-right:double' align='right'>Jumlah</td>								
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot1,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot2,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot3,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot4,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot5,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot6,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot7,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot8,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot9,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot10,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot11,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot12,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($jsubtot,2)."</td>				
			</tr>";
			$laba1=$laba1-$subtot1;
			$laba2=$laba2-$subtot2;
			$laba3=$laba3-$subtot3;
			$laba4=$laba4-$subtot4;
			$laba5=$laba5-$subtot5;
			$laba6=$laba6-$subtot6;
			$laba7=$laba7-$subtot7;
			$laba8=$laba8-$subtot8;
			$laba9=$laba9-$subtot9;
			$laba10=$laba10-$subtot10;
			$laba11=$laba11-$subtot11;
			$laba12=$laba12-$subtot12;
			$jlaba=$laba1+$laba2+$laba3+$laba4+$laba5+$laba6+$laba7+$laba8+$laba9+$laba10+$laba11+$laba12;
			
	$content .= "</tr>
				<td style='border-right:double' align='right'>Laba Usaha</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba1,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba2,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba3,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba4,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba5,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba6,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba7,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba8,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba9,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba10,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba11,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba12,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($jlaba,2)."</td>
			</tr>";
			
	$content .= "<tr>
			<td style='border-right:double'><b>Pendapatan dan Biaya Non Usaha</b></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-bottom:double' align='right'></td>
		</tr>
		<tr>
			<td style='border-right:double'><b>Pendapatan Non Usaha</b></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-bottom:double' align='right'></td>
		</tr>";
		$labanon1=0;
		$labanon2=0;
		$labanon3=0;
		$labanon4=0;
		$labanon5=0;
		$labanon6=0;
		$labanon7=0;
		$labanon8=0;
		$labanon9=0;
		$labanon10=0;
		$labanon11=0;
		$labanon12=0;
		$jlabanon=$labanon1+$labanon2+$labanon3+$labanon4+$labanon5+$labanon6+$labanon7+$labanon8+$labanon9+$labanon10+$labanon11+$labanon12;
		
		$query1 = "SELECT * FROM akun_bb WHERE nogol='61' AND level='2' ORDER BY noakun";		
		$sql1	= mysql_query($query1);
		$subtot1= 0;
		$subtot2= 0;
		$subtot3= 0;
		$subtot4= 0;
		$subtot5= 0;
		$subtot6= 0;
		$subtot7= 0;
		$subtot8= 0;
		$subtot9= 0;
		$subtot10= 0;
		$subtot11= 0;
		$subtot12= 0;
		
		while($r1=mysql_fetch_array($sql1)){
			$noakun=$r1[noakun];
			
			$query	= "SELECT tanggal,noakun,debet,kredit FROM rekapjur WHERE noakun='$noakun' AND year(tanggal)='$tahun' AND batal='' ";
			$sql = mysql_query($query);
				
			$rdebet1=0;
			$rdebet2=0;
			$rdebet3=0;
			$rdebet4=0;
			$rdebet5=0;
			$rdebet6=0;
			$rdebet7=0;
			$rdebet8=0;
			$rdebet9=0;
			$rdebet10=0;
			$rdebet11=0;
			$rdebet12=0;
			
			$rkredit1=0;
			$rkredit2=0;
			$rkredit3=0;
			$rkredit4=0;
			$rkredit5=0;
			$rkredit6=0;
			$rkredit7=0;
			$rkredit8=0;
			$rkredit9=0;
			$rkredit10=0;
			$rkredit11=0;
			$rkredit12=0;
			while($r=mysql_fetch_array($sql)){
				$tanggal=$r[tanggal];
				$bln=substr($tanggal,5,2);
				if($bln=='1'){
					$rdebet1=$rdebet1+$r[debet];
					$rkredit1=$rkredit1+$r[kredit];
				}else if($bln=='2'){
					$rdebet2=$rdebet2+$r[debet];
					$rkredit2=$rkredit2+$r[kredit];
				}else if($bln=='3'){
					$rdebet3=$rdebet3+$r[debet];
					$rkredit3=$rkredit3+$r[kredit];
				}else if($bln=='4'){
					$rdebet4=$rdebet4+$r[debet];
					$rkredit4=$rkredit4+$r[kredit];
				}else if($bln=='5'){
					$rdebet5=$rdebet5+$r[debet];
					$rkredit5=$rkredit5+$r[kredit];
				}else if($bln=='6'){
					$rdebet6=$rdebet6+$r[debet];
					$rkredit6=$rkredit6+$r[kredit];
				}else if($bln=='7'){
					$rdebet7=$rdebet7+$r[debet];
					$rkredit7=$rkredit7+$r[kredit];
				}else if($bln=='8'){
					$rdebet8=$rdebet8+$r[debet];
					$rkredit8=$rkredit8+$r[kredit];
				}else if($bln=='9'){
					$rdebet9=$rdebet9+$r[debet];
					$rkredit9=$rkredit9+$r[kredit];
				}else if($bln=='10'){
					$rdebet10=$rdebet10+$r[debet];
					$rkredit10=$rkredit10+$r[kredit];
				}else if($bln=='11'){
					$rdebet11=$rdebet11+$r[debet];
					$rkredit11=$rkredit11+$r[kredit];
				}else if($bln=='12'){
					$rdebet12=$rdebet12+$r[debet];
					$rkredit12=$rkredit12+$r[kredit];
				}
			}
			
			$saldo1=$rkredit1-$rdebet1;
			$saldo2=$rkredit2-$rdebet2;
			$saldo3=$rkredit3-$rdebet3;
			$saldo4=$rkredit4-$rdebet4;
			$saldo5=$rkredit5-$rdebet5;
			$saldo6=$rkredit6-$rdebet6;
			$saldo7=$rkredit7-$rdebet7;
			$saldo8=$rkredit8-$rdebet8;
			$saldo9=$rkredit9-$rdebet9;
			$saldo10=$rkredit10-$rdebet10;
			$saldo11=$rkredit11-$rdebet11;
			$saldo12=$rkredit12-$rdebet12;
			$jsaldo=$saldo1+$saldo2+$saldo3+$saldo4+$saldo5+$saldo6+$saldo7+$saldo8+$saldo9+$saldo10+$saldo11+$saldo12;
			
			$subtot1=$subtot1+$saldo1;
			$subtot2=$subtot2+$saldo2;
			$subtot3=$subtot3+$saldo3;
			$subtot4=$subtot4+$saldo4;
			$subtot5=$subtot5+$saldo5;
			$subtot6=$subtot6+$saldo6;
			$subtot7=$subtot7+$saldo7;
			$subtot8=$subtot8+$saldo8;
			$subtot9=$subtot9+$saldo9;
			$subtot10=$subtot10+$saldo10;
			$subtot11=$subtot11+$saldo11;
			$subtot12=$subtot12+$saldo12;
			$jsubtot=$subtot1+$subtot2+$subtot3+$subtot4+$subtot5+$subtot6+$subtot7+$subtot8+$subtot9+$subtot10+$subtot11+$subtot12;
				
			$content .= "<tr>
					<td style='border-right:double'>$r1[naakun]</td>
					<td style='border-right:double' align='right'>".number_format($saldo1,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo2,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo3,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo4,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo5,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo6,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo7,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo8,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo9,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo10,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo11,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo12,2)."</td>
					<td width='20%' align='right'>".number_format($jsaldo,2)."</td>
				</tr>";
		}
		
	$content .= "</tr>
				<td style='border-right:double' align='right'>Jumlah</td>								
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot1,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot2,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot3,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot4,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot5,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot6,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot7,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot8,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot9,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot10,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot11,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot12,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($jsubtot,2)."</td>				
			</tr>";
			$labanon1=$labanon1+$subtot1;
			$labanon2=$labanon2+$subtot2;
			$labanon3=$labanon3+$subtot3;
			$labanon4=$labanon4+$subtot4;
			$labanon5=$labanon5+$subtot5;
			$labanon6=$labanon6+$subtot6;
			$labanon7=$labanon7+$subtot7;
			$labanon8=$labanon8+$subtot8;
			$labanon9=$labanon9+$subtot9;
			$labanon10=$labanon10+$subtot10;
			$labanon11=$labanon11+$subtot11;
			$labanon12=$labanon12+$subtot12;
			$jlabanon=$labanon1+$labanon2+$labanon3+$labanon4+$labanon5+$labanon6+$labanon7+$labanon8+$labanon9+$labanon10+$labanon11+$labanon12;
			
			$laba1=$laba1+$subtot1;
			$laba2=$laba2+$subtot2;
			$laba3=$laba3+$subtot3;
			$laba4=$laba4+$subtot4;
			$laba5=$laba5+$subtot5;
			$laba6=$laba6+$subtot6;
			$laba7=$laba7+$subtot7;
			$laba8=$laba8+$subtot8;
			$laba9=$laba9+$subtot9;
			$laba10=$laba10+$subtot10;
			$laba11=$laba11+$subtot11;
			$laba12=$laba12+$subtot12;
			$jlaba=$laba1+$laba2+$laba3+$laba4+$laba5+$laba6+$laba7+$laba8+$laba9+$laba10+$laba11+$laba12;
			
	$content .= "<tr>
			<td style='border-right:double'><b>Biaya Non Usaha</b></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-right:double;border-bottom:double' align='right'></td>
			<td style='border-bottom:double' align='right'></td>
		</tr>";
		
		$query1 = "SELECT * FROM akun_bb WHERE nogol='62' AND level='2' ORDER BY noakun";		
		$sql1	= mysql_query($query1);
		$subtot1= 0;
		$subtot2= 0;
		$subtot3= 0;
		$subtot4= 0;
		$subtot5= 0;
		$subtot6= 0;
		$subtot7= 0;
		$subtot8= 0;
		$subtot9= 0;
		$subtot10= 0;
		$subtot11= 0;
		$subtot12= 0;
		
		while($r1=mysql_fetch_array($sql1)){
			$noakun=$r1[noakun];
			
			$query	= "SELECT tanggal,noakun,debet,kredit FROM rekapjur WHERE noakun='$noakun' AND year(tanggal)='$tahun' AND batal='' ";
			$sql = mysql_query($query);
				
			$rdebet1=0;
			$rdebet2=0;
			$rdebet3=0;
			$rdebet4=0;
			$rdebet5=0;
			$rdebet6=0;
			$rdebet7=0;
			$rdebet8=0;
			$rdebet9=0;
			$rdebet10=0;
			$rdebet11=0;
			$rdebet12=0;
			
			$rkredit1=0;
			$rkredit2=0;
			$rkredit3=0;
			$rkredit4=0;
			$rkredit5=0;
			$rkredit6=0;
			$rkredit7=0;
			$rkredit8=0;
			$rkredit9=0;
			$rkredit10=0;
			$rkredit11=0;
			$rkredit12=0;
			while($r=mysql_fetch_array($sql)){
				$tanggal=$r[tanggal];
				$bln=substr($tanggal,5,2);
				if($bln=='1'){
					$rdebet1=$rdebet1+$r[debet];
					$rkredit1=$rkredit1+$r[kredit];
				}else if($bln=='2'){
					$rdebet2=$rdebet2+$r[debet];
					$rkredit2=$rkredit2+$r[kredit];
				}else if($bln=='3'){
					$rdebet3=$rdebet3+$r[debet];
					$rkredit3=$rkredit3+$r[kredit];
				}else if($bln=='4'){
					$rdebet4=$rdebet4+$r[debet];
					$rkredit4=$rkredit4+$r[kredit];
				}else if($bln=='5'){
					$rdebet5=$rdebet5+$r[debet];
					$rkredit5=$rkredit5+$r[kredit];
				}else if($bln=='6'){
					$rdebet6=$rdebet6+$r[debet];
					$rkredit6=$rkredit6+$r[kredit];
				}else if($bln=='7'){
					$rdebet7=$rdebet7+$r[debet];
					$rkredit7=$rkredit7+$r[kredit];
				}else if($bln=='8'){
					$rdebet8=$rdebet8+$r[debet];
					$rkredit8=$rkredit8+$r[kredit];
				}else if($bln=='9'){
					$rdebet9=$rdebet9+$r[debet];
					$rkredit9=$rkredit9+$r[kredit];
				}else if($bln=='10'){
					$rdebet10=$rdebet10+$r[debet];
					$rkredit10=$rkredit10+$r[kredit];
				}else if($bln=='11'){
					$rdebet11=$rdebet11+$r[debet];
					$rkredit11=$rkredit11+$r[kredit];
				}else if($bln=='12'){
					$rdebet12=$rdebet12+$r[debet];
					$rkredit12=$rkredit12+$r[kredit];
				}
			}
			
			$saldo1 =$rdebet1-$rkredit1;
			$saldo2 =$rdebet2-$rkredit2;
			$saldo3 =$rdebet3-$rkredit3;
			$saldo4 =$rdebet4-$rkredit4;
			$saldo5 =$rdebet5-$rkredit5;
			$saldo6 =$rdebet6-$rkredit6;
			$saldo7 =$rdebet7-$rkredit7;
			$saldo8 =$rdebet8-$rkredit8;
			$saldo9 =$rdebet9-$rkredit9;
			$saldo10=$rdebet10-$rkredit10;
			$saldo11=$rdebet11-$rkredit11;
			$saldo12=$rdebet12-$rkredit12;
			$jsaldo=$saldo1+$saldo2+$saldo3+$saldo4+$saldo5+$saldo6+$saldo7+$saldo8+$saldo9+$saldo10+$saldo11+$saldo12;
			
			$subtot1=$subtot1+$saldo1;
			$subtot2=$subtot2+$saldo2;
			$subtot3=$subtot3+$saldo3;
			$subtot4=$subtot4+$saldo4;
			$subtot5=$subtot5+$saldo5;
			$subtot6=$subtot6+$saldo6;
			$subtot7=$subtot7+$saldo7;
			$subtot8=$subtot8+$saldo8;
			$subtot9=$subtot9+$saldo9;
			$subtot10=$subtot10+$saldo10;
			$subtot11=$subtot11+$saldo11;
			$subtot12=$subtot12+$saldo12;
			$jsubtot=$subtot1+$subtot2+$subtot3+$subtot4+$subtot5+$subtot6+$subtot7+$subtot8+$subtot9+$subtot10+$subtot11+$subtot12;
				
			$content .= "<tr>
					<td style='border-right:double'>$r1[naakun]</td>
					<td style='border-right:double' align='right'>".number_format($saldo1,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo2,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo3,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo4,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo5,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo6,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo7,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo8,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo9,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo10,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo11,2)."</td>
					<td style='border-right:double' align='right'>".number_format($saldo12,2)."</td>
					<td width='20%' align='right'>".number_format($jsaldo,2)."</td>
				</tr>";
		}
		
	$content .= "</tr>
				<td style='border-right:double' align='right'>Jumlah</td>								
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot1,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot2,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot3,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot4,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot5,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot6,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot7,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot8,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot9,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot10,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot11,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($subtot12,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($jsubtot,2)."</td>				
			</tr>";
			$laba1=$laba1-$subtot1;
			$laba2=$laba2-$subtot2;
			$laba3=$laba3-$subtot3;
			$laba4=$laba4-$subtot4;
			$laba5=$laba5-$subtot5;
			$laba6=$laba6-$subtot6;
			$laba7=$laba7-$subtot7;
			$laba8=$laba8-$subtot8;
			$laba9=$laba9-$subtot9;
			$laba10=$laba10-$subtot10;
			$laba11=$laba11-$subtot11;
			$laba12=$laba12-$subtot12;
			$jlaba=$laba1+$laba2+$laba3+$laba4+$laba5+$laba6+$laba7+$laba8+$laba9+$laba10+$laba11+$laba12;
			
			$labanon1=$labanon1-$subtot1;
			$labanon2=$labanon2-$subtot2;
			$labanon3=$labanon3-$subtot3;
			$labanon4=$labanon4-$subtot4;
			$labanon5=$labanon5-$subtot5;
			$labanon6=$labanon6-$subtot6;
			$labanon7=$labanon7-$subtot7;
			$labanon8=$labanon8-$subtot8;
			$labanon9=$labanon9-$subtot9;
			$labanon10=$labanon10-$subtot10;
			$labanon11=$labanon11-$subtot11;
			$labanon12=$labanon12-$subtot12;
			
			$jlabanon=$labanon1+$labanon2+$labanon3+$labanon4+$labanon5+$labanon6+$labanon7+$labanon8+$labanon9+$labanon10+$labanon11+$labanon12;
			
	$content .= "</tr>
				<td style='border-right:double' align='right'>Laba Usaha Non Usaha</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($labanon1,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($labanon2,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($labanon3,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($labanon4,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($labanon5,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($labanon6,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($labanon7,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($labanon8,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($labanon9,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($labanon10,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($labanon11,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($labanon12,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($jlabanon,2)."</td>
			</tr>
			
			</tr>
				<td style='border-right:double' align='right'>Laba Bersih</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba1,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba2,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba3,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba4,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba5,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba6,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba7,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba8,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba9,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba10,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba11,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($laba12,2)."</td>
				<td style='border-top:double;border-right:double' align='right'>".number_format($jlaba,2)."</td>
			</tr>
		</table>";
			
		header("Content-type: application/x-msdownload");
		header("Content-Disposition: attachment; filename=rekap_lr.xls");
		header("Pragma: no-cache");
		header("Expires: 0");
		echo $content;
?>