$out = ''; $totaset = 0; if ($jum != 0) { $nox = $starting + 1; while ($res = mysql_fetch_assoc($result)) { $btn = '<td align="center"> <button data-hint="ubah" class="button" onclick="detilanggaranFR(' . $res['replid'] . ');"> <i class="icon-pencil on-left"></i> </button> <button data-hint="hapus" class="button" onclick="detilanggaranDel(' . $res['replid'] . ');"> <i class="icon-remove on-left"></i> </button> </td>'; $kuota = 'Rp. ' . number_format(getDetAnggaran($res['replid'], 'kuotaNum')); $terpakaiNum = 'Rp. ' . number_format(getDetAnggaran($res['replid'], 'terpakaiNum')); $terpakaiPerc = intval(getDetAnggaran($res['replid'], 'terpakaiPerc')); if ($terpakaiPerc > 75) { $clr = 'red'; } elseif ($terpakaiPerc > 50) { $clr = 'orange'; } elseif ($terpakaiPerc > 25) { $clr = 'yellow'; } elseif ($terpakaiPerc > 0 or $terpakaiPerc < 25) { $clr = 'green'; } $prog = '<span class="progress-bar" data-role="progress-bar" data-value="' . ($terpakaiPerc == 0 ? 1 : $terpakaiPerc) . '" data-color="bg-' . $clr . '"></span>'; $out .= '<tr> <td>' . $res['nama'] . '</td> <td align="right">' . $kuota . '</td> <td align="right"> ' . $prog . '
<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']); $kuotaNum = 'Rp. ' . number_format(getDetAnggaran($r['replid'], 'kuotaNum')); $terpakaiNum = 'Rp. ' . number_format(getDetAnggaran($r['replid'], 'terpakaiNum')); $terpakaiPerc = getDetAnggaran($r['replid'], 'terpakaiPerc'); 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">' . $kuotaNum . '</td> <td align="right">' . $terpakaiNum . ' (' . $terpakaiPerc . ' %)</td> <td>' . $r['keterangan'] . '</td> </tr>';
a.nama detilanggaran, a.replid iddetilanggaran from '.$tb.' t LEFT JOIN sar_lokasi l ON t.lokasi= l.replid LEFT JOIN keu_detilanggaran a ON a.replid = t.detilanggaran WHERE t.replid='.$_POST['replid']; // var_dump($s);exit(); $e = mysql_query($s); $r = mysql_fetch_assoc($e); $itemArr = array(); $biayaSatSum =$biayaTotSum=$biayaTotSum2=0; // anggaran $kuotaNum = getDetAnggaran($r['iddetilanggaran'],'kuotaNum'); $sisaNum = getDetAnggaran($r['iddetilanggaran'],'sisaNum'); if(!$e) $stat = ($e)?'sukses':'gagal_ambil_data_aktivitas'; else{ $s2 ='SELECT * FROM '.$tb3.' WHERE aktivitas ='.$_POST['replid']; $e2 = mysql_query($s2); while($r2 = mysql_fetch_assoc($e2)){ $itemArr[]=array( 'iditem' =>$r2['replid'], 'item' =>$r2['item'], 'jumlah' =>$r2['jumlah'], 'biayaSat' =>intval($r2['biaya']), 'biayaTot' =>(intval($r2['biaya']) * intval($r2['jumlah'])), ); $biayaSatSum+=intval($r2['biaya']); $biayaTotSum+=(intval($r2['biaya']) * intval($r2['jumlah'])); }
WHERE d.kategorianggaran = ' . $r['replid'] . ' GROUP BY d.replid'; // print_r($s2);exit(); $e2 = mysql_query($s2); $n2 = mysql_num_rows($e2); if ($n2 <= 0) { $out .= '<tr><td width="100%" colspan="4" align="center">.. kosong ..</td></tr>'; } else { while ($r2 = mysql_fetch_assoc($e2)) { $out .= '<tr> <td width="25%">' . $r2['nama'] . '</td> <td width="25%">' . $r2['keterangan'] . '</td> <td align="right" width="25%">Rp. ' . number_format(getDetAnggaran($r2['replid'], 'kuotaNum')) . '</td> <td align="right" width="25%">Rp. ' . number_format(getDetAnggaran($r2['replid'], 'terpakaiNum')) . '</td> </tr>'; } } $out .= '<tr class="head2"> <th width="70%" colspan="2" align="right">Total Kuota:</th> <th width="40%" align="right">Rp. ' . number_format(getKatAnggaran($r['replid'], 'kuotaNum')) . '</th> <th width="40%" align="right">Rp. ' . number_format(getKatAnggaran($r['replid'], 'terpakaiNum')) . '</th> </tr><tr> <th width="70%" colspan="2" align="right">Selisih:</th> <th width="40%" colspan="2" align="center">Rp. ' . number_format(getKatAnggaran($r['replid'], 'sisaNum')) . '</th> </tr>'; $out .= '</table>'; $out .= '</td>'; $nox++; }
} else { $ss .= 'ORDER BY ' . $sidx . ' ' . $sord; } // print_r($ss);exit(); $result = mysql_query($ss) or die("Couldn t execute query." . mysql_error()); $rows = array(); while ($row = mysql_fetch_assoc($result)) { if ($_GET['subaksi'] == 'rek') { // rekening $arr = array('replid' => $row['replid'], 'kode' => $row['kode'], 'nama' => $row['nama'], 'saldoSementara' => $row['saldoSementara']); } elseif ($_GET['subaksi'] == 'detilanggaran') { // anggaran $kuotaNum = getDetAnggaran($row['replid'], 'kuotaNum'); $terpakaiPerc = getDetAnggaran($row['replid'], 'terpakaiPerc'); $terpakaiNum = getDetAnggaran($row['replid'], 'terpakaiNum'); $sisaNum = getDetAnggaran($row['replid'], 'sisaNum'); $arr = array('replid' => $row['replid'], 'nama' => $row['nama'], 'kategorianggaran' => $row['kategorianggaran'], 'tingkat' => $row['tingkat'], 'kuotaBilCur' => 'Rp. ' . number_format($kuotaNum), 'sisaBilCur' => 'Rp. ' . number_format($sisaNum), 'terpakaiBilCur' => 'Rp. ' . number_format($terpakaiNum), 'sisaBilNum' => $sisaNum, 'idrekening' => $row['idrekening'], 'rekening' => $row['rekening']); } else { $arr[] = $row; } $rows[] = $arr; } $response = array('page' => $page, 'total' => $total_pages, 'records' => $count, 'rows' => $rows); $out = json_encode($response); } else { $out = json_encode(array('status' => 'invalid_no_post')); } } else { switch ($_POST['aksi']) { // jenis laporan (checkbox) case 'jenislaporan':
j.jenis ="k"'; // var_dump($s);exit(); $e = mysql_query($s); $r = mysql_fetch_assoc($e); $stat = $e ? 'sukses' : 'gagal'; if (!$e) { $stat = 'gagal'; } else { //sukses $kuotaNum = getDetAnggaran($r['detilanggaran'], 'kuotaNum'); $kuotaCur = setuang(getDetAnggaran($r['detilanggaran'], 'kuotaNum')); // var_dump($kuotaCur);exit(); $terpakaiNum = getDetAnggaran($r['detilanggaran'], 'terpakaiNum'); $terpakaiCur = setuang(getDetAnggaran($r['detilanggaran'], 'terpakaiNum')); $sisaNum = getDetAnggaran($r['detilanggaran'], 'sisaNum'); $sisaCur = setuang(getDetAnggaran($r['detilanggaran'], 'sisaNum')); $stat = 'sukses'; $nobuktiTyp = strpos($r['nobukti'], 'INV') === false ? '0' : '1'; //==TRUE?1:0; $transaksiArr = array('nomer' => $r['nomer'], 'nobuktiTyp' => $nobuktiTyp, 'nobukti' => $r['nobukti'], 'tanggal' => tgl_indo7($r['tanggal']), 'idrekkas' => $r['rekkas'], 'rekkas' => getRekening($r['rekkas']), 'outcome' => array('iddetilanggaran' => $r['detilanggaran'], 'detilanggaran' => getAnggaran($r['detilanggaran']) . '[sisa :' . $sisaCur . ' kuota ' . $kuotaCur . ']', 'sisaanggaran' => $sisaNum, 'sisaanggaran' => $sisaNum, '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