<tr class="head">
   <td align="center">Anggaran</td>
   <td align="center">Kuota</td>
   <td align="center">Terpakai</td>
   <td align="center">Keterangan</td>
 </tr>';
 $nox = 1;
 if($n==0){
   $out.='<tr>
     <td>-</td>
     <td>-</td>
     <td>-</td>
   </tr>';
 }else{
   while ($r=mysql_fetch_assoc($e)) {
     $kuota        =getKuotaAnggaran($r['replid']); 
     $terpakaiPerc =intval($kuota['terpakaiPerc']);
     // var_dump(intval($terpakaiPerc));exit();
     if($terpakaiPerc>75) {$clr='red';}
     elseif($terpakaiPerc>50) {$clr='orange';}
     elseif($terpakaiPerc>25) {$clr='yellow';}
     elseif($terpakaiPerc>0 OR $terpakaiPerc<25) {$clr='green';}
     $out.='<tr>
               <td>'.$r['nama'].'</td>
               <td align="right">Rp. '.number_format($kuota['kuotaNum']).'</td>
               <td align="right"> Rp. '.number_format($kuota['terpakaiNum']).' ('.$kuota['terpakaiPerc'].' %)</td>
               <td>'.$r['keterangan'].'</td>
         </tr>';
     $nox++;
   }
 }
                    							LEFT JOIN aka_tingkat t ON t.replid = d.tingkat
                    						WHERE
                    							d.nama LIKE "%'.$searchTerm.'%"
                    							OR k.nama LIKE "%'.$searchTerm.'%"
                    						GROUP BY	
                    							d.replid ';
                    */
                    // var_dump($s);exit();
                    $e = mysql_query($s);
                    $r = mysql_fetch_assoc($e);
                    $stat = $e ? 'sukses' : 'gagal';
                    if (!$e) {
                        $stat = 'gagal';
                    } else {
                        //sukses
                        $kuota = getKuotaAnggaran($r['detilanggaran']);
                        $stat = 'sukses';
                        $transaksiArr = array('nomer' => $r['nomer'], 'nobukti' => $r['nobukti'], 'tanggal' => tgl_indo7($r['tanggal']), 'idrekkas' => $r['rekkas'], 'rekkas' => getRekening($r['rekkas']), 'iddetilanggaran' => $r['detilanggaran'], 'detilanggaran' => getAnggaran($r['detilanggaran']), 'kuotaBilCur' => 'Rp. ' . number_format($kuota['kuotaNum']), 'sisaBilCur' => 'Rp. ' . number_format($kuota['sisaNum']), 'terpakaiBilCur' => 'Rp. ' . number_format($kuota['terpakaiNum']), 'sisaBilNum' => $kuota['sisaNum'], 'outcome' => array('idjurnal' => $r['idjurnal'], 'idrekitem' => $r['rekitem'], 'rekitem' => getRekening($r['rekitem']), 'nominal' => setuang($r['nominal']), 'uraian' => $r['uraian']));
                    }
                    $out = json_encode(array('status' => $stat, 'transaksiArr' => $transaksiArr));
                    break;
                case 'in_come':
                    $s = 'SELECT 
								t.*, 
								j.replid idjurnal 
							  FROM ' . $tb . ' t 
							  	LEFT JOIN keu_jurnal j on j.transaksi = t.replid
							  WHERE
							  	t.replid =' . $_POST['replid'] . ' AND
							  	j.jenis ="d"';
                    // var_dump($s);exit();