upgrade mengikuti dalev
This commit is contained in:
@@ -0,0 +1,302 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : SISTEM INFORMASI MONITORING DAN EVALUASI
|
||||
Module : /apps/php/repo/rekap_hasil_opd.php
|
||||
Desc. : PHP - Laporan Rekap Hasil Per OPD
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : March 20th, 2012.
|
||||
Last Modified : June 24th, 2024.
|
||||
|
||||
(c) 2012 - 2024, 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
ini_set('display_errors', '0');
|
||||
ini_set("max_execution_time", "900");
|
||||
ini_set("pcre.backtrack_limit", "5000000");
|
||||
|
||||
require_once(__DIR__."/../../../../../vendor/autoload.php");
|
||||
require_once(__DIR__."/../func/emonev.php");
|
||||
//require_once("Spreadsheet/Excel/Writer.php");
|
||||
|
||||
use siaupheng\fonia3\DB\MySQL;
|
||||
use siaupheng\fonia3\DB\SQL;
|
||||
use siaupheng\fonia3\Web\Param;
|
||||
use siaupheng\fonia3\Web\Table;
|
||||
use siaupheng\fonia3\Web\Form;
|
||||
|
||||
$db = $db ?? new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
$mode = Param::Get("mode");
|
||||
$tahun = Param::Get("Tahun", $_SESSION['__WEB_APP']['REAL_THN']);
|
||||
$twulan = Param::Get("TW", $_SESSION['__WEB_APP']['REAL_TW']);
|
||||
$id_opd = Param::Get("OPDID", 0);
|
||||
|
||||
if ( $data == "print" || $data == "export") {
|
||||
$nama_opd = "";
|
||||
$db->Query("SELECT Nama_OPD FROM vi_para90_opd WHERE OPDID='".$id_opd."'");
|
||||
if ($db->Next()) $nama_opd = $db->Row("Nama_OPD");
|
||||
$tabel_data = "dpa_detail"; $tsql = "";
|
||||
if ($id_opd>0) $tsql .= " AND T.OPDID='".$id_opd."'";
|
||||
|
||||
if ($twulan == 1) {
|
||||
$q3 = "T.RencK_TW1";
|
||||
$qR = "T.RealK_TW1";
|
||||
$qSF = "T.RencF_TW1,0";
|
||||
$qRF = "T.RealF_TW1,0";
|
||||
} else if ($twulan == 2) {
|
||||
$q3 = "T.RencK_TW1+T.RencK_TW2";
|
||||
$qR = "T.RealK_TW1+T.RealK_TW2";
|
||||
$qSF = "T.RealF_TW1,T.RencF_TW2";
|
||||
$qRF = "T.RealF_TW1,T.RealF_TW2";
|
||||
} else if ($twulan == 3) {
|
||||
$q3 = "T.RencK_TW1+T.RencK_TW2+T.RencK_TW3";
|
||||
$qR = "T.RealK_TW1+T.RealK_TW2+T.RealK_TW3";
|
||||
$qSF = "T.RealF_TW1,T.RealF_TW2,T.RencF_TW3";
|
||||
$qRF = "T.RealF_TW1,T.RealF_TW2,T.RealF_TW3";
|
||||
} else if ($twulan == 4) {
|
||||
$q3 = "T.RencK_TW1+T.RencK_TW2+T.RencK_TW3+T.RencK_TW4";
|
||||
$qR = "T.RealK_TW1+T.RealK_TW2+T.RealK_TW3+T.RealK_TW4";
|
||||
$qSF = "T.RealF_TW1,T.RealF_TW2,T.RencF_TW3,T.RencF_TW4";
|
||||
$qRF = "T.RealF_TW1,T.RealF_TW2,T.RencF_TW3,T.RealF_TW4";
|
||||
}
|
||||
|
||||
/*/ proses rekap database
|
||||
Report_Empty("rekap_urus");
|
||||
Report_Empty("rekap_fung");
|
||||
Report_Empty("rekap_opd");
|
||||
Report_Empty("rekap_upt");
|
||||
$asql = array();
|
||||
// insert urusan
|
||||
$db->Query("INSERT INTO rep_rekap_urus SELECT T.Tahun,BU.K_Urusan,SUM(T.B_Total),SUM(".$q3."),0,SUM(".$qR."),0,0,0,'".user_unix()."','".user_id()."' FROM ".$tabel_data." T LEFT JOIN para_opd S ON (T.OPDID=S.OPDID) LEFT JOIN para_bidang_u BU ON (BU.K_BidangU=S.K_BidangU) WHERE T.Tahun='".$tahun."'".$tsql." GROUP BY T.Tahun,BU.K_Urusan");
|
||||
$db->Query("SELECT T.Tahun,BU.K_Urusan,SUM(((".$q3.")/T.B_Total*100)*T.B_Total/RU.URUS_PAGU) S_PSN,SUM(((".$qR.")/T.B_Total*100)*T.B_Total/RU.URUS_PAGU) R_PSN,SUM(GREATEST(".$qSF.")*T.B_Total/RU.URUS_PAGU) OS_PSN,SUM(GREATEST(".$qRF.")*T.B_Total/RU.URUS_PAGU) OR_PSN FROM ".$tabel_data." T LEFT JOIN para_opd S ON (T.OPDID=S.OPDID) LEFT JOIN para_bidang_u BU ON (BU.K_BidangU=S.K_BidangU) LEFT JOIN rep_rekap_urus RU ON (T.Tahun=RU.Tahun AND BU.K_Urusan=RU.K_Urusan AND RU.UserID='".user_id()."' AND RU.Unix='".user_unix()."') WHERE T.Tahun='".$tahun."'".$tsql." GROUP BY T.Tahun,BU.K_Urusan");
|
||||
while ($db->Next()){
|
||||
$asql[] = "UPDATE rep_rekap_urus SET URUS_TARGET_PSN='".$db->Row("S_PSN")."',URUS_REAL_PSN='".$db->Row("R_PSN")."',URUS_INDI_S='".$db->Row("OS_PSN")."',URUS_INDI_R='".$db->Row("OR_PSN")."' WHERE Tahun='".$db->Row("Tahun")."' AND K_Urusan='".$db->Row("K_Urusan")."' AND UserID='".user_id()."' AND Unix='".user_unix()."'";
|
||||
}
|
||||
// insert fungsi
|
||||
$db->Query("INSERT INTO rep_rekap_fung SELECT T.Tahun,S.K_BidangU,SUM(T.B_Total),SUM(".$q3."),0,SUM(".$qR."),0,0,0,'".user_unix()."','".user_id()."' FROM ".$tabel_data." T LEFT JOIN para_opd S ON (T.OPDID=S.OPDID) WHERE T.Tahun='".$tahun."'".$tsql." GROUP BY T.Tahun,S.K_BidangU");
|
||||
$db->Query("SELECT T.Tahun,S.K_BidangU,SUM(((".$q3.")/T.B_Total*100)*T.B_Total/RF.FUNG_PAGU) S_PSN,SUM(((".$qR.")/T.B_Total*100)*T.B_Total/RF.FUNG_PAGU) R_PSN,SUM(GREATEST(".$qSF.")*T.B_Total/RF.FUNG_PAGU) OS_PSN,SUM(GREATEST(".$qRF.")*T.B_Total/RF.FUNG_PAGU) OR_PSN FROM ".$tabel_data." T LEFT JOIN para_opd S ON (T.OPDID=S.OPDID) LEFT JOIN rep_rekap_fung RF ON (T.Tahun=RF.Tahun AND S.K_BidangU=RF.K_BidangU AND RF.UserID='".user_id()."' AND RF.Unix='".user_unix()."') WHERE T.Tahun='".$tahun."'".$tsql." GROUP BY T.Tahun,S.K_BidangU");
|
||||
while ($db->Next()){
|
||||
$asql[] = "UPDATE rep_rekap_fung SET FUNG_TARGET_PSN='".$db->Row("S_PSN")."',FUNG_REAL_PSN='".$db->Row("R_PSN")."',FUNG_INDI_S='".$db->Row("OS_PSN")."',FUNG_INDI_R='".$db->Row("OR_PSN")."' WHERE Tahun='".$db->Row("Tahun")."' AND K_BidangU='".$db->Row("K_BidangU")."' AND UserID='".user_id()."' AND Unix='".user_unix()."'";
|
||||
}
|
||||
// insert opd
|
||||
$db->Query("INSERT INTO rep_rekap_opd SELECT T.Tahun,T.OPDID,SUM(T.B_Total),SUM(".$q3."),0,SUM(".$qR."),0,0,0,'".user_unix()."','".user_id()."' FROM ".$tabel_data." T WHERE T.Tahun='".$tahun."'".$tsql." GROUP BY T.Tahun,T.OPDID");
|
||||
$db->Query("SELECT T.Tahun,T.OPDID,SUM(((".$q3.")/T.B_Total*100)*T.B_Total/RS.OPD_PAGU) S_PSN,SUM(((".$qR.")/T.B_Total*100)*T.B_Total/RS.OPD_PAGU) R_PSN,SUM(GREATEST(".$qSF.")*T.B_Total/RS.OPD_PAGU) OS_PSN,SUM(GREATEST(".$qRF.")*T.B_Total/RS.OPD_PAGU) OR_PSN FROM ".$tabel_data." T LEFT JOIN rep_rekap_opd RS ON (T.Tahun=RS.Tahun AND T.OPDID=RS.OPDID AND RS.UserID='".user_id()."' AND RS.Unix='".user_unix()."') WHERE T.Tahun='".$tahun."'".$tsql." GROUP BY T.Tahun,T.OPDID");
|
||||
while ($db->Next()){
|
||||
$asql[] = "UPDATE rep_rekap_opd SET OPD_TARGET_PSN='".$db->Row("S_PSN")."',OPD_REAL_PSN='".$db->Row("R_PSN")."',OPD_INDI_S='".$db->Row("OS_PSN")."',OPD_INDI_R='".$db->Row("OR_PSN")."' WHERE Tahun='".$db->Row("Tahun")."' AND OPDID='".$db->Row("OPDID")."' AND UserID='".user_id()."' AND Unix='".user_unix()."'";
|
||||
}
|
||||
// insert upt
|
||||
$db2->Query("INSERT INTO rep_rekap_upt SELECT T.Tahun,T.OPDID,T.UPTID,SUM(T.B_Total),SUM(".$q3."),0,SUM(".$qR."),0,0,0,'".user_unix()."','".user_id()."' FROM ".$tabel_data." T WHERE T.Tahun='".$tahun."'".$tsql." GROUP BY T.Tahun,T.OPDID,T.UPTID");
|
||||
$db->Query("SELECT T.Tahun,T.OPDID,T.UPTID,SUM(((".$q3.")/T.B_Total*100)*T.B_Total/RU.UPT_PAGU) S_PSN,SUM(((".$qR.")/T.B_Total*100)*T.B_Total/RU.UPT_PAGU) R_PSN,SUM(GREATEST(".$qSF.")*T.B_Total/RU.UPT_PAGU) OS_PSN,SUM(GREATEST(".$qRF.")*T.B_Total/RU.UPT_PAGU) OR_PSN FROM ".$tabel_data." T LEFT JOIN rep_rekap_upt RU ON (T.Tahun=RU.Tahun AND T.OPDID=RU.OPDID AND T.UPTID=RU.UPTID AND RU.UserID='".user_id()."' AND RU.Unix='".user_unix()."') WHERE T.Tahun='".$tahun."'".$tsql." GROUP BY T.Tahun,T.OPDID,T.UPTID");
|
||||
while ($db->Next()){
|
||||
$asql[] = "UPDATE rep_rekap_upt SET UPT_TARGET_PSN='".$db->Row("S_PSN")."',UPT_REAL_PSN='".$db->Row("R_PSN")."',UPT_INDI_S='".$db->Row("OS_PSN")."',UPT_INDI_R='".$db->Row("OR_PSN")."' WHERE Tahun='".$db->Row("Tahun")."' AND OPDID='".$db->Row("OPDID")."' AND UPTID='".$db->Row("UPTID")."' AND UserID='".user_id()."' AND Unix='".user_unix()."'";
|
||||
}
|
||||
for ($x=0; $x<count($asql); $x++) $db2->Query($asql[$x]);
|
||||
|
||||
$tsql = "";
|
||||
if ($id_opd>0) $tsql = " AND RT.OPDID='".$id_opd."'";
|
||||
if ($id_upt>0) $tsql .= " AND RT.UPTID='".$id_upt."'";
|
||||
$db->Query("SELECT R.K_Urusan KO_URUSAN,BU.K_BidangU KO_FUNGSI,S.K_OPD KO_OPD,U.K_UPT KO_UPT,R.N_Urusan N_URUSAN,BU.N_BidangU N_FUNGSI,S.N_OPD N_OPD,U.N_UPT N_UPT,RU.*,RF.*,RS.*,RT.* FROM rep_rekap_upt RT LEFT JOIN para_opd S ON (RT.OPDID=S.OPDID) LEFT JOIN para_upt U ON (RT.UPTID=U.UPTID) LEFT JOIN para_bidang_u BU ON (S.K_BidangU=BU.K_BidangU AND BU.Aktif=1) LEFT JOIN para_urusan R ON (BU.K_Urusan=R.K_Urusan) LEFT JOIN rep_rekap_urus RU ON (BU.K_Urusan=RU.K_Urusan AND RT.Tahun=RU.Tahun AND RU.UserID='".user_id()."' AND RU.Unix='".user_unix()."') LEFT JOIN rep_rekap_fung RF ON (S.K_BidangU=RF.K_BidangU AND RT.Tahun=RF.Tahun AND RF.UserID='".user_id()."' AND RF.Unix='".user_unix()."') LEFT JOIN rep_rekap_opd RS ON (RT.OPDID=RS.OPDID AND RT.Tahun=RS.Tahun AND RS.UserID='".user_id()."' AND RS.Unix='".user_unix()."') WHERE RT.Tahun='".$tahun."'".$tsql." AND RT.Unix='".user_unix()."' ORDER BY R.K_Urusan, BU.K_BidangU, S.K_OPD, U.K_UPT");*/
|
||||
$db->Query("SELECT TRUE");
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
$_head = '<div style="text-align:center;font-size:120%;"><b>LAPORAN PELAKSANAAN RENCANA PROGRAM DAN ANGGARAN KEGIATAN PEMBANGUNAN DAERAH APBD<br>KABUPATEN MEMPAWAH TRIWULAN '.romawi($twulan).' TAHUN ANGGARAN '.$tahun.'</b></div><br>
|
||||
<table width="100%" class="garis"><thead>
|
||||
<tr><th width="20" rowspan="2">Kode</th><th width="180" rowspan="2">Urusan/Bidang Urusan Pemerintahan Daerah</th><th width="50" rowspan="2">Jumlah Anggaran (Rp)</th><th width="100" colspan="4">Penyerapan Keuangan (%)</th><th width="100" colspan="2">Indikator Keluaran (OUTPUT)</th></tr>
|
||||
<tr><th>Target</th><th>%</th><th>Realisasi</th><th>%</th><th>S (%)</th><th>R (%)</th></tr>
|
||||
<tr><th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th><th>7</th><th>8</th><th>9</th></tr></thead><tbody>';
|
||||
$_line = '<tr><td class="l" nowrap>%s</td><td class="l">%s</td><td class="r">%s</td><td class="r">%s</td><td class="r">%s</td><td class="r">%s</td><td class="r">%s</td><td class="r">%s</td><td class="r">%s</td></tr>';
|
||||
$_bline = '<tr><td class="b" nowrap>%s</td><td class="b">%s</td><td class="b r">%s</td><td class="b r">%s</td><td class="b r">%s</td><td class="b r">%s</td><td class="b r">%s</td><td class="b r">%s</td><td class="b r">%s</td></tr>';
|
||||
$header = $_head;
|
||||
$body = $urus = $fung = $opd = "";
|
||||
while ($db->Next()) {
|
||||
if ($urus <> $db->Row("KO_URUSAN")) {
|
||||
$body .= sprintf($_bline, $db->Row("KO_URUSAN"), $db->Row("N_URUSAN"), uang2($db->Row("URUS_PAGU")), uang2($db->Row("URUS_TARGET")), uang2($db->Row("URUS_TARGET_PSN")), uang2($db->Row("URUS_REAL")), uang2($db->Row("URUS_REAL_PSN")), uang2($db->Row("URUS_INDI_S")), uang2($db->Row("URUS_INDI_R")));
|
||||
$urus = $db->Row("KO_URUSAN");
|
||||
}
|
||||
if ($fung <> $db->Row("KO_FUNGSI")) {
|
||||
$body .= sprintf($_bline, $db->Row("KO_FUNGSI"), $db->Row("N_FUNGSI"), uang($db->Row("FUNG_PAGU"),2), uang($db->Row("FUNG_TARGET"),2), uang($db->Row("FUNG_TARGET_PSN"),2), uang($db->Row("FUNG_REAL"),2), uang($db->Row("FUNG_REAL_PSN"),2), uang($db->Row("FUNG_INDI_S"),2), uang($db->Row("FUNG_INDI_R"),2));
|
||||
$fung = $db->Row("KO_FUNGSI");
|
||||
}
|
||||
if ($opd <> $db->Row("KO_OPD")) {
|
||||
$body .= sprintf($_bline, $db->Row("KO_OPD"), $db->Row("N_OPD"), uang($db->Row("OPD_PAGU"),2), uang($db->Row("OPD_TARGET"),2), uang($db->Row("OPD_TARGET_PSN"),2), uang($db->Row("OPD_REAL"),2), uang($db->Row("OPD_REAL_PSN"),2), uang($db->Row("OPD_INDI_S"),2), uang($db->Row("OPD_INDI_R"),2));
|
||||
$opd = $db->Row("KO_OPD");
|
||||
}
|
||||
$body .= sprintf($_line, $db->Row("KO_UPT"), $db->Row("N_UPT"), uang($db->Row("UPT_PAGU"),2), uang($db->Row("UPT_TARGET"),2), uang($db->Row("UPT_TARGET_PSN"),2), uang($db->Row("UPT_REAL"),2), uang($db->Row("UPT_REAL_PSN"),2), uang($db->Row("UPT_INDI_S"),2), uang($db->Row("UPT_INDI_R"),2));
|
||||
}
|
||||
echo $header . $body . "</tbody></table>";
|
||||
|
||||
} else if ( $data == "export" ) {
|
||||
$wbook = new Spreadsheet_Excel_Writer();
|
||||
$fjudul =& $wbook->addFormat();
|
||||
$fjudul->setBold();
|
||||
$fjudul->setAlign("center");
|
||||
$fhead =& $wbook->addFormat();
|
||||
$fhead->setBold();
|
||||
$fhead->setAlign("center");
|
||||
$fhead->setVAlign("vcenter");
|
||||
$fhead->setBorder(1);
|
||||
$fhead->setTextWrap();
|
||||
$ftxt =& $wbook->addFormat();
|
||||
$ftxt->setVAlign("top");
|
||||
$ftxt->setBottom(1);
|
||||
$ftxt->setTextWrap();
|
||||
$ftxt->setNumFormat("@");
|
||||
$fbtxt =& $wbook->addFormat();
|
||||
$fbtxt->setVAlign("top");
|
||||
$fbtxt->setBottom(1);
|
||||
$fbtxt->setTextWrap();
|
||||
$fbtxt->setBold();
|
||||
$fbtxt->setNumFormat("@");
|
||||
$fctxt =& $wbook->addFormat();
|
||||
$fctxt->setVAlign("top");
|
||||
$fctxt->setAlign("center");
|
||||
$fctxt->setBottom(1);
|
||||
$fctxt->setTextWrap();
|
||||
$fctxt->setNumFormat("@");
|
||||
$fbctxt =& $wbook->addFormat();
|
||||
$fbctxt->setVAlign("top");
|
||||
$fbctxt->setAlign("center");
|
||||
$fbctxt->setBottom(1);
|
||||
$fbctxt->setTextWrap();
|
||||
$fbctxt->setBold();
|
||||
$fbctxt->setNumFormat("@");
|
||||
$fbrtxt =& $wbook->addFormat();
|
||||
$fbrtxt->setVAlign("top");
|
||||
$fbrtxt->setAlign("right");
|
||||
$fbrtxt->setBottom(1);
|
||||
$fbrtxt->setTextWrap();
|
||||
$fbrtxt->setBold();
|
||||
$fbrtxt->setNumFormat("@");
|
||||
$fnum =& $wbook->addFormat();
|
||||
$fnum->setNumFormat(4);
|
||||
$fnum->setBottom(1);
|
||||
$fbnum =& $wbook->addFormat();
|
||||
$fbnum->setNumFormat(4);
|
||||
$fbnum->setBottom(1);
|
||||
$fbnum->setBold();
|
||||
|
||||
$wsheet =& $wbook->addWorksheet("Real Triwulan");
|
||||
$wsheet->setColumn(0,0,18);
|
||||
$wsheet->setColumn(1,1,60);
|
||||
$wsheet->setColumn(2,3,16);
|
||||
$wsheet->setColumn(4,4,8);
|
||||
$wsheet->setColumn(5,5,16);
|
||||
$wsheet->setColumn(6,6,8);
|
||||
$wsheet->setColumn(7,8,8);
|
||||
$wsheet->write(0,0,"LAPORAN PELAKSANAAN RENCANA PROGRAM DAN ANGGARAN KEGIATAN PEMBANGUNAN DAERAH APBD",$fjudul);
|
||||
$wsheet->setMerge(0,0,0,8);
|
||||
$wsheet->write(1,0,"KABUPATEN MEMPAWAH TRIWULAN ".romawi($twulan)." TAHUN ANGGARAN ".$tahun,$fjudul);
|
||||
$wsheet->setMerge(1,0,1,8);
|
||||
$baris = 3;
|
||||
for ($x=$baris; $x<=($baris+1); $x++) {
|
||||
for ($y=0; $y<=8; $y++) $wsheet->write($x,$y,"",$fhead);
|
||||
}
|
||||
$wsheet->write($baris,0,"Kode",$fhead);
|
||||
$wsheet->setMerge($baris,0,($baris+1),0);
|
||||
$wsheet->write($baris,1,"Urusan/Bidang Urusan Pemerintahan Daerah",$fhead);
|
||||
$wsheet->setMerge($baris,1,($baris+1),1);
|
||||
$wsheet->write($baris,2,"Jumlah Anggaran (Rp)",$fhead);
|
||||
$wsheet->setMerge($baris,2,($baris+1),2);
|
||||
$wsheet->write($baris,3,"Penyerapan Keuangan (%)",$fhead);
|
||||
$wsheet->setMerge($baris,3,$baris,6);
|
||||
$wsheet->write($baris,7,"Indikator Keluaran (OUTPUT)",$fhead);
|
||||
$wsheet->setMerge($baris,7,$baris,8);
|
||||
$wsheet->write(($baris+1),3,"Target",$fhead);
|
||||
$wsheet->write(($baris+1),4,"%",$fhead);
|
||||
$wsheet->write(($baris+1),5,"Realisasi",$fhead);
|
||||
$wsheet->write(($baris+1),6,"%",$fhead);
|
||||
$wsheet->write(($baris+1),7,"S (%)",$fhead);
|
||||
$wsheet->write(($baris+1),8,"R (%)",$fhead);
|
||||
for ($x=1; $x<=9; $x++) $wsheet->write(($baris+2),$x-1,$x,$fhead);
|
||||
|
||||
$baris += 3;
|
||||
$urus = $fung = $opd = "";
|
||||
while ($db->Next()) {
|
||||
if ($urus <> $db->Row("KO_URUSAN")) {
|
||||
if ($urus <> "") {
|
||||
for ($x=0; $x<=8; $x++) $wsheet->write($baris, $x, "");
|
||||
$baris++;
|
||||
}
|
||||
for ($x=0; $x<=8; $x++) $wsheet->write($baris, $x, "", $fbtxt);
|
||||
$wsheet->write($baris,0,$db->Row("KO_URUSAN"), $fbtxt);
|
||||
$wsheet->write($baris,1,$db->Row("N_URUSAN"), $fbtxt);
|
||||
$wsheet->write($baris,2,$db->Row("URUS_PAGU"), $fbnum);
|
||||
$wsheet->write($baris,3,$db->Row("URUS_TARGET"), $fbnum);
|
||||
$wsheet->write($baris,4,$db->Row("URUS_TARGET_PSN"), $fbnum);
|
||||
$wsheet->write($baris,5,$db->Row("URUS_REAL"), $fbnum);
|
||||
$wsheet->write($baris,6,$db->Row("URUS_REAL_PSN"), $fbnum);
|
||||
$wsheet->write($baris,7,$db->Row("URUS_INDI_S"), $fbnum);
|
||||
$wsheet->write($baris,8,$db->Row("URUS_INDI_R"), $fbnum);
|
||||
$baris++;
|
||||
$urus = $db->Row("KO_URUSAN");
|
||||
}
|
||||
if ($fung <> $db->Row("KO_FUNGSI")) {
|
||||
if ($fung <> "") {
|
||||
for ($x=0; $x<=8; $x++) $wsheet->write($baris, $x, "");
|
||||
$baris++;
|
||||
}
|
||||
for ($x=0; $x<=8; $x++) $wsheet->write($baris, $x, "", $fbtxt);
|
||||
$wsheet->write($baris,0,$db->Row("KO_FUNGSI"), $fbtxt);
|
||||
$wsheet->write($baris,1,$db->Row("N_FUNGSI"), $fbtxt);
|
||||
$wsheet->write($baris,2,$db->Row("FUNG_PAGU"), $fbnum);
|
||||
$wsheet->write($baris,3,$db->Row("FUNG_TARGET"), $fbnum);
|
||||
$wsheet->write($baris,4,$db->Row("FUNG_TARGET_PSN"), $fbnum);
|
||||
$wsheet->write($baris,5,$db->Row("FUNG_REAL"), $fbnum);
|
||||
$wsheet->write($baris,6,$db->Row("FUNG_REAL_PSN"), $fbnum);
|
||||
$wsheet->write($baris,7,$db->Row("FUNG_INDI_S"), $fbnum);
|
||||
$wsheet->write($baris,8,$db->Row("FUNG_INDI_R"), $fbnum);
|
||||
$baris++;
|
||||
$fung = $db->Row("KO_FUNGSI");
|
||||
}
|
||||
if ($opd <> $db->Row("KO_OPD")) {
|
||||
if ($opd <> "") {
|
||||
for ($x=0; $x<=8; $x++) $wsheet->write($baris, $x, "");
|
||||
$baris++;
|
||||
}
|
||||
for ($x=0; $x<=8; $x++) $wsheet->write($baris, $x, "", $fbtxt);
|
||||
$wsheet->write($baris,0,$db->Row("KO_OPD"), $fbtxt);
|
||||
$wsheet->write($baris,1,$db->Row("N_OPD"), $fbtxt);
|
||||
$wsheet->write($baris,2,$db->Row("OPD_PAGU"), $fbnum);
|
||||
$wsheet->write($baris,3,$db->Row("OPD_TARGET"), $fbnum);
|
||||
$wsheet->write($baris,4,$db->Row("OPD_TARGET_PSN"), $fbnum);
|
||||
$wsheet->write($baris,5,$db->Row("OPD_REAL"), $fbnum);
|
||||
$wsheet->write($baris,6,$db->Row("OPD_REAL_PSN"), $fbnum);
|
||||
$wsheet->write($baris,7,$db->Row("OPD_INDI_S"), $fbnum);
|
||||
$wsheet->write($baris,8,$db->Row("OPD_INDI_R"), $fbnum);
|
||||
$baris++;
|
||||
$opd = $db->Row("KO_OPD");
|
||||
}
|
||||
for ($x=0; $x<=8; $x++) $wsheet->write($baris, $x, "", $ftxt);
|
||||
$wsheet->write($baris,0,$db->Row("KO_UPT"), $ftxt);
|
||||
$wsheet->write($baris,1,$db->Row("N_UPT"), $ftxt);
|
||||
$wsheet->write($baris,2,$db->Row("UPT_PAGU"), $fnum);
|
||||
$wsheet->write($baris,3,$db->Row("UPT_TARGET"), $fnum);
|
||||
$wsheet->write($baris,4,$db->Row("UPT_TARGET_PSN"), $fnum);
|
||||
$wsheet->write($baris,5,$db->Row("UPT_REAL"), $fnum);
|
||||
$wsheet->write($baris,6,$db->Row("UPT_REAL_PSN"), $fnum);
|
||||
$wsheet->write($baris,7,$db->Row("UPT_INDI_S"), $fnum);
|
||||
$wsheet->write($baris,8,$db->Row("UPT_INDI_R"), $fnum);
|
||||
$baris++;
|
||||
}
|
||||
$wbook->send("Rekap Hasil UPT ".$twulan."-".$tahun." - ".tgl_dmy(true).".xls");
|
||||
$wbook->close();
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$q_opd = "";
|
||||
if (in_array($_SESSION['__WEB_USER']['Level'],[1,3,4])) {
|
||||
$q_opd = " AND OPDID IN (".$_SESSION['__WEB_USER']['AK_OPD'].")";
|
||||
}
|
||||
|
||||
$form = new Form($db);
|
||||
$form->option_que("Tahun Data", "Tahun", $tahun, true, false, "SELECT Tahun,CONCAT('Tahun ',Tahun) N_Tahun FROM renja90_awal_prog GROUP BY Tahun ORDER BY Tahun", ["Tahun","N_Tahun"]);
|
||||
$form->option_db("Nama Perangkat Daerah", "OPDID", $id_opd, true, false, "vi_para90_opd", array("OPDID","Nama_OPD"), "Aktif=1".$q_opd." ORDER BY K_OPD", (user_level(3)?array(0,"SEMUA OPD"):null));
|
||||
$form->radio("Triwulan", "TW", $twulan, true, false, array(1=>"I",2=>"II",3=>"III",4=>"IV"));
|
||||
$form->show(' _Tahun_ _OPDID_ _TW_ ');
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,337 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : SISTEM INFORMASI MONITORING DAN EVALUASI
|
||||
Module : /apps/php/repo/rekap_hasil_prog.php
|
||||
Desc. : PHP - Laporan Rekap Hasil Program
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : March 20th, 2012.
|
||||
Last Modified : June 24th, 2024.
|
||||
|
||||
(c) 2012 - 2024, 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
ini_set('display_errors', '0');
|
||||
ini_set("max_execution_time", "900");
|
||||
ini_set("pcre.backtrack_limit", "5000000");
|
||||
|
||||
require_once(__DIR__."/../../../../../vendor/autoload.php");
|
||||
require_once(__DIR__."/../func/emonev.php");
|
||||
//require_once("Spreadsheet/Excel/Writer.php");
|
||||
|
||||
use siaupheng\fonia3\DB\MySQL;
|
||||
use siaupheng\fonia3\DB\SQL;
|
||||
use siaupheng\fonia3\Web\Param;
|
||||
use siaupheng\fonia3\Web\Table;
|
||||
use siaupheng\fonia3\Web\Form;
|
||||
|
||||
$db = $db ?? new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
$mode = Param::Get("mode");
|
||||
$tahun = Param::Get("Tahun", $_SESSION['__WEB_APP']['REAL_THN']);
|
||||
$twulan = Param::Get("TW", $_SESSION['__WEB_APP']['REAL_TW']);
|
||||
$id_opd = Param::Get("OPDID", 0);
|
||||
|
||||
if ( $data == "print" || $data == "export") {
|
||||
$nama_opd = "";
|
||||
$db->Query("SELECT Nama_OPD FROM vi_para90_opd WHERE OPDID='".$id_opd."'");
|
||||
if ($db->Next()) $nama_opd = $db->Row("Nama_OPD");
|
||||
$tabel_data = "dpa_sub"; $tsql = "";
|
||||
if ($id_opd>0) $tsql .= " AND T.OPDID='".$id_opd."'";
|
||||
|
||||
if ($twulan == 1) {
|
||||
$q3 = "T.RencK_TW1";
|
||||
$qR = "T.RealK_TW1";
|
||||
$qSF = "T.RencF_TW1,0";
|
||||
$qRF = "T.RealF_TW1,0";
|
||||
} else if ($twulan == 2) {
|
||||
$q3 = "T.RencK_TW1+T.RencK_TW2";
|
||||
$qR = "T.RealK_TW1+T.RealK_TW2";
|
||||
$qSF = "T.RealF_TW1,T.RencF_TW2";
|
||||
$qRF = "T.RealF_TW1,T.RealF_TW2";
|
||||
} else if ($twulan == 3) {
|
||||
$q3 = "T.RencK_TW1+T.RencK_TW2+T.RencK_TW3";
|
||||
$qR = "T.RealK_TW1+T.RealK_TW2+T.RealK_TW3";
|
||||
$qSF = "T.RealF_TW1,T.RealF_TW2,T.RencF_TW3";
|
||||
$qRF = "T.RealF_TW1,T.RealF_TW2,T.RealF_TW3";
|
||||
} else if ($twulan == 4) {
|
||||
$q3 = "T.RencK_TW1+T.RencK_TW2+T.RencK_TW3+T.RencK_TW4";
|
||||
$qR = "T.RealK_TW1+T.RealK_TW2+T.RealK_TW3+T.RealK_TW4";
|
||||
$qSF = "T.RealF_TW1,T.RealF_TW2,T.RencF_TW3,T.RencF_TW4";
|
||||
$qRF = "T.RealF_TW1,T.RealF_TW2,T.RencF_TW3,T.RealF_TW4";
|
||||
}
|
||||
|
||||
/* proses rekap database
|
||||
Report_Empty("rekap_urus");
|
||||
Report_Empty("rekap_fung");
|
||||
Report_Empty("rekap_opd");
|
||||
Report_Empty("rekap_upt");
|
||||
Report_Empty("rekap_prog");
|
||||
|
||||
$asql = array();
|
||||
// insert urusan
|
||||
$db->Query("INSERT INTO rep_rekap_urus SELECT T.Tahun,BU.K_Urusan,SUM(T.B_Total),SUM(".$q3."),0,SUM(".$qR."),0,0,0,'".user_unix()."','".user_id()."' FROM ".$tabel_data." T LEFT JOIN para_opd S ON (T.OPDID=S.OPDID) LEFT JOIN para_bidang_u BU ON (BU.K_BidangU=S.K_BidangU) WHERE T.Tahun='".$tahun."'".$tsql." GROUP BY T.Tahun,BU.K_Urusan");
|
||||
$db->Query("SELECT T.Tahun,BU.K_Urusan,SUM(((".$q3.")/T.B_Total*100)*T.B_Total/RU.URUS_PAGU) S_PSN,SUM(((".$qR.")/T.B_Total*100)*T.B_Total/RU.URUS_PAGU) R_PSN,SUM(GREATEST(".$qSF.")*T.B_Total/RU.URUS_PAGU) OS_PSN,SUM(GREATEST(".$qRF.")*T.B_Total/RU.URUS_PAGU) OR_PSN FROM ".$tabel_data." T LEFT JOIN para_opd S ON (T.OPDID=S.OPDID) LEFT JOIN para_bidang_u BU ON (BU.K_BidangU=S.K_BidangU) LEFT JOIN rep_rekap_urus RU ON (T.Tahun=RU.Tahun AND BU.K_Urusan=RU.K_Urusan AND RU.UserID='".user_id()."' AND RU.Unix='".user_unix()."') WHERE T.Tahun='".$tahun."'".$tsql." GROUP BY T.Tahun,BU.K_Urusan");
|
||||
while ($db->Next()){
|
||||
$asql[] = "UPDATE rep_rekap_urus SET URUS_TARGET_PSN='".$db->Row("S_PSN")."',URUS_REAL_PSN='".$db->Row("R_PSN")."',URUS_INDI_S='".$db->Row("OS_PSN")."',URUS_INDI_R='".$db->Row("OR_PSN")."' WHERE Tahun='".$db->Row("Tahun")."' AND K_Urusan='".$db->Row("K_Urusan")."' AND UserID='".user_id()."' AND Unix='".user_unix()."'";
|
||||
}
|
||||
// insert fungsi
|
||||
$db->Query("INSERT INTO rep_rekap_fung SELECT T.Tahun,S.K_BidangU,SUM(T.B_Total),SUM(".$q3."),0,SUM(".$qR."),0,0,0,'".user_unix()."','".user_id()."' FROM ".$tabel_data." T LEFT JOIN para_opd S ON (T.OPDID=S.OPDID) WHERE T.Tahun='".$tahun."'".$tsql." GROUP BY T.Tahun,S.K_BidangU");
|
||||
$db->Query("SELECT T.Tahun,S.K_BidangU,SUM(((".$q3.")/T.B_Total*100)*T.B_Total/RF.FUNG_PAGU) S_PSN,SUM(((".$qR.")/T.B_Total*100)*T.B_Total/RF.FUNG_PAGU) R_PSN,SUM(GREATEST(".$qSF.")*T.B_Total/RF.FUNG_PAGU) OS_PSN,SUM(GREATEST(".$qRF.")*T.B_Total/RF.FUNG_PAGU) OR_PSN FROM ".$tabel_data." T LEFT JOIN para_opd S ON (T.OPDID=S.OPDID) LEFT JOIN rep_rekap_fung RF ON (T.Tahun=RF.Tahun AND S.K_BidangU=RF.K_BidangU AND RF.UserID='".user_id()."' AND RF.Unix='".user_unix()."') WHERE T.Tahun='".$tahun."'".$tsql." GROUP BY T.Tahun,S.K_BidangU");
|
||||
while ($db->Next()){
|
||||
$asql[] = "UPDATE rep_rekap_fung SET FUNG_TARGET_PSN='".$db->Row("S_PSN")."',FUNG_REAL_PSN='".$db->Row("R_PSN")."',FUNG_INDI_S='".$db->Row("OS_PSN")."',FUNG_INDI_R='".$db->Row("OR_PSN")."' WHERE Tahun='".$db->Row("Tahun")."' AND K_BidangU='".$db->Row("K_BidangU")."' AND UserID='".user_id()."' AND Unix='".user_unix()."'";
|
||||
}
|
||||
// insert opd
|
||||
$db->Query("INSERT INTO rep_rekap_opd SELECT T.Tahun,T.OPDID,SUM(T.B_Total),SUM(".$q3."),0,SUM(".$qR."),0,0,0,'".user_unix()."','".user_id()."' FROM ".$tabel_data." T WHERE T.Tahun='".$tahun."'".$tsql." GROUP BY T.Tahun,T.OPDID");
|
||||
$db->Query("SELECT T.Tahun,T.OPDID,SUM(((".$q3.")/T.B_Total*100)*T.B_Total/RS.OPD_PAGU) S_PSN,SUM(((".$qR.")/T.B_Total*100)*T.B_Total/RS.OPD_PAGU) R_PSN,SUM(GREATEST(".$qSF.")*T.B_Total/RS.OPD_PAGU) OS_PSN,SUM(GREATEST(".$qRF.")*T.B_Total/RS.OPD_PAGU) OR_PSN FROM ".$tabel_data." T LEFT JOIN rep_rekap_opd RS ON (T.Tahun=RS.Tahun AND T.OPDID=RS.OPDID AND RS.UserID='".user_id()."' AND RS.Unix='".user_unix()."') WHERE T.Tahun='".$tahun."'".$tsql." GROUP BY T.Tahun,T.OPDID");
|
||||
while ($db->Next()){
|
||||
$asql[] = "UPDATE rep_rekap_opd SET OPD_TARGET_PSN='".$db->Row("S_PSN")."',OPD_REAL_PSN='".$db->Row("R_PSN")."',OPD_INDI_S='".$db->Row("OS_PSN")."',OPD_INDI_R='".$db->Row("OR_PSN")."' WHERE Tahun='".$db->Row("Tahun")."' AND OPDID='".$db->Row("OPDID")."' AND UserID='".user_id()."' AND Unix='".user_unix()."'";
|
||||
}
|
||||
// insert upt
|
||||
$db2->Query("INSERT INTO rep_rekap_upt SELECT T.Tahun,T.OPDID,T.UPTID,SUM(T.B_Total),SUM(".$q3."),0,SUM(".$qR."),0,0,0,'".user_unix()."','".user_id()."' FROM ".$tabel_data." T WHERE T.Tahun='".$tahun."'".$tsql." GROUP BY T.Tahun,T.OPDID,T.UPTID");
|
||||
$db->Query("SELECT T.Tahun,T.OPDID,T.UPTID,SUM(((".$q3.")/T.B_Total*100)*T.B_Total/RU.UPT_PAGU) S_PSN,SUM(((".$qR.")/T.B_Total*100)*T.B_Total/RU.UPT_PAGU) R_PSN,SUM(GREATEST(".$qSF.")*T.B_Total/RU.UPT_PAGU) OS_PSN,SUM(GREATEST(".$qRF.")*T.B_Total/RU.UPT_PAGU) OR_PSN FROM ".$tabel_data." T LEFT JOIN rep_rekap_upt RU ON (T.Tahun=RU.Tahun AND T.OPDID=RU.OPDID AND T.UPTID=RU.UPTID AND RU.UserID='".user_id()."' AND RU.Unix='".user_unix()."') WHERE T.Tahun='".$tahun."'".$tsql." GROUP BY T.Tahun,T.OPDID,T.UPTID");
|
||||
while ($db->Next()){
|
||||
$asql[] = "UPDATE rep_rekap_upt SET UPT_TARGET_PSN='".$db->Row("S_PSN")."',UPT_REAL_PSN='".$db->Row("R_PSN")."',UPT_INDI_S='".$db->Row("OS_PSN")."',UPT_INDI_R='".$db->Row("OR_PSN")."' WHERE Tahun='".$db->Row("Tahun")."' AND OPDID='".$db->Row("OPDID")."' AND UPTID='".$db->Row("UPTID")."' AND UserID='".user_id()."' AND Unix='".user_unix()."'";
|
||||
}
|
||||
// insert program
|
||||
$db2->Query("INSERT INTO rep_rekap_prog SELECT T.Tahun,T.OPDID,T.UPTID,T.ProgID,SUM(T.B_Total),SUM(".$q3."),0,SUM(".$qR."),0,0,0,'".user_unix()."','".user_id()."' FROM ".$tabel_data." T WHERE T.Tahun='".$tahun."'".$tsql." GROUP BY T.Tahun,T.OPDID,T.UPTID,T.ProgID");
|
||||
$db->Query("SELECT T.Tahun,T.OPDID,T.UPTID,T.ProgID,SUM(((".$q3.")/T.B_Total*100)*T.B_Total/RP.PROG_PAGU) S_PSN,SUM(((".$qR.")/T.B_Total*100)*T.B_Total/RP.PROG_PAGU) R_PSN,SUM(GREATEST(".$qSF.")*T.B_Total/RP.PROG_PAGU) OS_PSN,SUM(GREATEST(".$qRF.")*T.B_Total/RP.PROG_PAGU) OR_PSN FROM ".$tabel_data." T LEFT JOIN rep_rekap_prog RP ON (T.Tahun=RP.Tahun AND T.OPDID=RP.OPDID AND T.UPTID=RP.UPTID AND T.ProgID=RP.ProgID AND RP.UserID='".user_id()."' AND RP.Unix='".user_unix()."') WHERE T.Tahun='".$tahun."'".$tsql." GROUP BY T.Tahun,T.OPDID,T.UPTID,T.ProgID");
|
||||
while ($db->Next()){
|
||||
$asql[] = "UPDATE rep_rekap_prog SET PROG_TARGET_PSN='".$db->Row("S_PSN")."',PROG_REAL_PSN='".$db->Row("R_PSN")."',PROG_INDI_S='".$db->Row("OS_PSN")."',PROG_INDI_R='".$db->Row("OR_PSN")."' WHERE Tahun='".$db->Row("Tahun")."' AND OPDID='".$db->Row("OPDID")."' AND UPTID='".$db->Row("UPTID")."' AND ProgID='".$db->Row("ProgID")."' AND UserID='".user_id()."' AND Unix='".user_unix()."'";
|
||||
}
|
||||
for ($x=0; $x<count($asql); $x++) $db2->Query($asql[$x]);
|
||||
|
||||
$tsql = "";
|
||||
if ($id_opd>0) $tsql = " AND RP.OPDID='".$id_opd."'";
|
||||
if ($id_upt>0) $tsql = " AND RP.UPTID='".$id_upt."'";
|
||||
$tsql .= ($is_rutin==1) ? "" : " AND RP.ProgID>7";
|
||||
$db->Query("SELECT R.K_Urusan KO_URUSAN,BU.K_BidangU KO_FUNGSI,S.K_OPD KO_OPD,U.K_UPT KO_UPT,PR.K_Prog KO_PROGRAM,R.N_Urusan N_URUSAN,BU.N_BidangU N_FUNGSI,S.N_OPD N_OPD,U.N_UPT N_UPT,P.N_Prog N_PROGRAM,RU.*,RF.*,RS.*,RT.*,RP.*,PR.Prog_Indi INDI_PROG,PR.Prog_Target TAR_PROG FROM rep_rekap_prog RP LEFT JOIN dpa_prog PR ON (RP.Tahun=PR.Tahun AND RP.OPDID=PR.OPDID AND RP.UPTID=PR.UPTID AND RP.ProgID=PR.ProgID) LEFT JOIN para_opd S ON (RP.OPDID=S.OPDID) LEFT JOIN para_upt U ON (RP.UPTID=U.UPTID) LEFT JOIN para_program P ON (RP.ProgID=P.ProgID) LEFT JOIN para_bidang_u BU ON (S.K_BidangU=BU.K_BidangU AND BU.Aktif=1) LEFT JOIN para_urusan R ON (BU.K_Urusan=R.K_Urusan) LEFT JOIN rep_rekap_urus RU ON (BU.K_Urusan=RU.K_Urusan AND RP.Tahun=RU.Tahun AND RU.UserID='".user_id()."' AND RU.Unix='".user_unix()."') LEFT JOIN rep_rekap_fung RF ON (S.K_BidangU=RF.K_BidangU AND RP.Tahun=RF.Tahun AND RF.UserID='".user_id()."' AND RF.Unix='".user_unix()."') LEFT JOIN rep_rekap_opd RS ON (RP.OPDID=RS.OPDID AND RP.Tahun=RS.Tahun AND RS.UserID='".user_id()."' AND RS.Unix='".user_unix()."') LEFT JOIN rep_rekap_upt RT ON (RP.OPDID=RT.OPDID AND RP.UPTID=RT.UPTID AND RP.Tahun=RT.Tahun AND RT.UserID='".user_id()."' AND RT.Unix='".user_unix()."') WHERE RP.Tahun='".$tahun."'".$tsql." AND RP.Unix='".user_unix()."' ORDER BY R.K_Urusan, BU.K_BidangU, S.K_OPD, U.K_UPT, P.N_Urut, PR.K_Prog");*/
|
||||
$db->Query("SELECT TRUE");
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
$_head = '<div style="text-align:center;font-size:120%;"><b>LAPORAN PELAKSANAAN RENCANA PROGRAM DAN ANGGARAN KEGIATAN PEMBANGUNAN DAERAH APBD<br>KABUPATEN MEMPAWAH TRIWULAN '.romawi($twulan).' TAHUN ANGGARAN '.$tahun.'</b></div><br>
|
||||
<table width="100%" class="garis"><thead>
|
||||
<tr><th width="20" rowspan="2">Kode</th><th width="180" rowspan="2">Urusan/Bidang Urusan Pemerintahan Daerah<br>/Program</th><th width="50" rowspan="2">Jumlah Anggaran (Rp)</th><th width="100" colspan="4">Penyerapan Keuangan (%)</th><th width="100" colspan="3">Indikator Keluaran (OUTPUT)</th></tr>
|
||||
<tr><th>Target</th><th>%</th><th>Realisasi</th><th>%</th><th>Target Kinerja</th><th>S (%)</th><th>R (%)</th></tr>
|
||||
<tr><th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th><th>7</th><th>8</th><th>9</th><th>10</th></tr></thead><tbody>';
|
||||
$_line = '<tr><td class="l" nowrap>%s</td><td class="l">%s</td><td class="r">%s</td><td class="r">%s</td><td class="r">%s</td><td class="r">%s</td><td class="r">%s</td><td class="l">%s</td><td class="r">%s</td><td class="r">%s</td></tr>';
|
||||
$_bline = '<tr><td class="l b" nowrap>%s</td><td class="l b">%s</td><td class="r b">%s</td><td class="r b">%s</td><td class="r b">%s</td><td class="r b">%s</td><td class="r b">%s</td><td class="r b">%s</td><td class="r b">%s</td><td class="r b">%s</td></tr>';
|
||||
$header = $_head;
|
||||
$body = $urus = $fung = $opd = $upt = "";
|
||||
while ($db->Next()) {
|
||||
if ($urus <> $db->Row("KO_URUSAN")) {
|
||||
$body .= sprintf($_bline, $db->Row("KO_URUSAN"), $db->Row("N_URUSAN"), uang2($db->Row("URUS_PAGU")), uang2($db->Row("URUS_TARGET")), uang2($db->Row("URUS_TARGET_PSN")), uang2($db->Row("URUS_REAL")), uang2($db->Row("URUS_REAL_PSN")), "", uang2($db->Row("URUS_INDI_S")), uang2($db->Row("URUS_INDI_R")));
|
||||
$urus = $db->Row("KO_URUSAN");
|
||||
}
|
||||
if ($fung <> $db->Row("KO_FUNGSI")) {
|
||||
$body .= sprintf($_bline, $db->Row("KO_FUNGSI"), $db->Row("N_FUNGSI"), uang($db->Row("FUNG_PAGU"),2), uang($db->Row("FUNG_TARGET"),2), uang($db->Row("FUNG_TARGET_PSN"),2), uang($db->Row("FUNG_REAL"),2), uang($db->Row("FUNG_REAL_PSN"),2), "", uang($db->Row("FUNG_INDI_S"),2), uang($db->Row("FUNG_INDI_R"),2));
|
||||
$fung = $db->Row("KO_FUNGSI");
|
||||
}
|
||||
if ($opd <> $db->Row("KO_OPD")) {
|
||||
$body .= sprintf($_bline, $db->Row("KO_OPD"), $db->Row("N_OPD"), uang($db->Row("OPD_PAGU"),2), uang($db->Row("OPD_TARGET"),2), uang($db->Row("OPD_TARGET_PSN"),2), uang($db->Row("OPD_REAL"),2), uang($db->Row("OPD_REAL_PSN"),2), "", uang($db->Row("OPD_INDI_S"),2), uang($db->Row("OPD_INDI_R"),2));
|
||||
$opd = $db->Row("KO_OPD");
|
||||
}
|
||||
if ($upt <> $db->Row("KO_UPT")) {
|
||||
$body .= sprintf($_bline, $db->Row("KO_UPT"), $db->Row("N_UPT"), uang($db->Row("UPT_PAGU"),2), uang($db->Row("UPT_TARGET"),2), uang($db->Row("UPT_TARGET_PSN"),2), uang($db->Row("UPT_REAL"),2), uang($db->Row("UPT_REAL_PSN"),2), "", uang($db->Row("UPT_INDI_S"),2), uang($db->Row("UPT_INDI_R"),2));
|
||||
$upt = $db->Row("KO_UPT");
|
||||
}
|
||||
$body .= sprintf($_line, $db->Row("KO_PROGRAM"), $db->Row("N_PROGRAM"), uang($db->Row("PROG_PAGU"),2), uang($db->Row("PROG_TARGET"),2), uang($db->Row("PROG_TARGET_PSN"),2), uang($db->Row("PROG_REAL"),2), uang($db->Row("PROG_REAL_PSN"),2), $db->Row("TAR_PROG"), uang($db->Row("PROG_INDI_S"),2), uang($db->Row("PROG_INDI_R"),2));
|
||||
}
|
||||
echo $header . $body . "</tbody></table>";
|
||||
|
||||
} else if ( $data == "export" ) {
|
||||
$wbook = new Spreadsheet_Excel_Writer();
|
||||
$fjudul =& $wbook->addFormat();
|
||||
$fjudul->setBold();
|
||||
$fjudul->setAlign("center");
|
||||
$fhead =& $wbook->addFormat();
|
||||
$fhead->setBold();
|
||||
$fhead->setAlign("center");
|
||||
$fhead->setVAlign("vcenter");
|
||||
$fhead->setBorder(1);
|
||||
$fhead->setTextWrap();
|
||||
$ftxt =& $wbook->addFormat();
|
||||
$ftxt->setVAlign("top");
|
||||
$ftxt->setBottom(1);
|
||||
$ftxt->setTextWrap();
|
||||
$ftxt->setNumFormat("@");
|
||||
$fbtxt =& $wbook->addFormat();
|
||||
$fbtxt->setVAlign("top");
|
||||
$fbtxt->setBottom(1);
|
||||
$fbtxt->setTextWrap();
|
||||
$fbtxt->setBold();
|
||||
$fbtxt->setNumFormat("@");
|
||||
$fctxt =& $wbook->addFormat();
|
||||
$fctxt->setVAlign("top");
|
||||
$fctxt->setAlign("center");
|
||||
$fctxt->setBottom(1);
|
||||
$fctxt->setTextWrap();
|
||||
$fctxt->setNumFormat("@");
|
||||
$fbctxt =& $wbook->addFormat();
|
||||
$fbctxt->setVAlign("top");
|
||||
$fbctxt->setAlign("center");
|
||||
$fbctxt->setBottom(1);
|
||||
$fbctxt->setTextWrap();
|
||||
$fbctxt->setBold();
|
||||
$fbctxt->setNumFormat("@");
|
||||
$fbrtxt =& $wbook->addFormat();
|
||||
$fbrtxt->setVAlign("top");
|
||||
$fbrtxt->setAlign("right");
|
||||
$fbrtxt->setBottom(1);
|
||||
$fbrtxt->setTextWrap();
|
||||
$fbrtxt->setBold();
|
||||
$fbrtxt->setNumFormat("@");
|
||||
$fnum =& $wbook->addFormat();
|
||||
$fnum->setNumFormat(4);
|
||||
$fnum->setBottom(1);
|
||||
$fbnum =& $wbook->addFormat();
|
||||
$fbnum->setNumFormat(4);
|
||||
$fbnum->setBottom(1);
|
||||
$fbnum->setBold();
|
||||
|
||||
$wsheet =& $wbook->addWorksheet("Real Triwulan");
|
||||
$wsheet->setColumn(0,0,18);
|
||||
$wsheet->setColumn(1,1,60);
|
||||
$wsheet->setColumn(2,3,16);
|
||||
$wsheet->setColumn(4,4,8);
|
||||
$wsheet->setColumn(5,5,16);
|
||||
$wsheet->setColumn(6,6,8);
|
||||
$wsheet->setColumn(7,7,25);
|
||||
$wsheet->setColumn(8,9,8);
|
||||
$wsheet->write(0,0,"LAPORAN PELAKSANAAN RENCANA PROGRAM DAN ANGGARAN KEGIATAN PEMBANGUNAN DAERAH APBD",$fjudul);
|
||||
$wsheet->setMerge(0,0,0,9);
|
||||
$wsheet->write(1,0,"KABUPATEN MEMPAWAH TRIWULAN ".romawi($twulan)." TAHUN ANGGARAN ".$tahun,$fjudul);
|
||||
$wsheet->setMerge(1,0,1,9);
|
||||
$baris = 3;
|
||||
for ($x=$baris; $x<=($baris+1); $x++) {
|
||||
for ($y=0; $y<=9; $y++) $wsheet->write($x,$y,"",$fhead);
|
||||
}
|
||||
$wsheet->write($baris,0,"Kode",$fhead);
|
||||
$wsheet->setMerge($baris,0,($baris+1),0);
|
||||
$wsheet->write($baris,1,"Urusan/Bidang Urusan Pemerintahan Daerah/Program",$fhead);
|
||||
$wsheet->setMerge($baris,1,($baris+1),1);
|
||||
$wsheet->write($baris,2,"Jumlah Anggaran (Rp)",$fhead);
|
||||
$wsheet->setMerge($baris,2,($baris+1),2);
|
||||
$wsheet->write($baris,3,"Penyerapan Keuangan (%)",$fhead);
|
||||
$wsheet->setMerge($baris,3,$baris,6);
|
||||
$wsheet->write($baris,7,"Indikator Keluaran (OUTPUT)",$fhead);
|
||||
$wsheet->setMerge($baris,7,$baris,9);
|
||||
$wsheet->write(($baris+1),3,"Target",$fhead);
|
||||
$wsheet->write(($baris+1),4,"%",$fhead);
|
||||
$wsheet->write(($baris+1),5,"Realisasi",$fhead);
|
||||
$wsheet->write(($baris+1),6,"%",$fhead);
|
||||
$wsheet->write(($baris+1),7,"Target Kinerja",$fhead);
|
||||
$wsheet->write(($baris+1),8,"S (%)",$fhead);
|
||||
$wsheet->write(($baris+1),9,"R (%)",$fhead);
|
||||
for ($x=1; $x<=10; $x++) $wsheet->write(($baris+2),$x-1,$x,$fhead);
|
||||
|
||||
$baris += 3;
|
||||
$urus = $fung = $opd = $upt = "";
|
||||
while ($db->Next()) {
|
||||
if ($urus <> $db->Row("KO_URUSAN")) {
|
||||
if ($urus <> "") {
|
||||
for ($x=0; $x<=9; $x++) $wsheet->write($baris, $x, "");
|
||||
$baris++;
|
||||
}
|
||||
for ($x=0; $x<=9; $x++) $wsheet->write($baris, $x, "", $fbtxt);
|
||||
$wsheet->write($baris,0,$db->Row("KO_URUSAN"), $fbtxt);
|
||||
$wsheet->write($baris,1,$db->Row("N_URUSAN"), $fbtxt);
|
||||
$wsheet->write($baris,2,$db->Row("URUS_PAGU"), $fbnum);
|
||||
$wsheet->write($baris,3,$db->Row("URUS_TARGET"), $fbnum);
|
||||
$wsheet->write($baris,4,$db->Row("URUS_TARGET_PSN"), $fbnum);
|
||||
$wsheet->write($baris,5,$db->Row("URUS_REAL"), $fbnum);
|
||||
$wsheet->write($baris,6,$db->Row("URUS_REAL_PSN"), $fbnum);
|
||||
$wsheet->write($baris,8,$db->Row("URUS_INDI_S"), $fbnum);
|
||||
$wsheet->write($baris,9,$db->Row("URUS_INDI_R"), $fbnum);
|
||||
$baris++;
|
||||
$urus = $db->Row("KO_URUSAN");
|
||||
}
|
||||
if ($fung <> $db->Row("KO_FUNGSI")) {
|
||||
if ($fung <> "") {
|
||||
for ($x=0; $x<=9; $x++) $wsheet->write($baris, $x, "");
|
||||
$baris++;
|
||||
}
|
||||
for ($x=0; $x<=9; $x++) $wsheet->write($baris, $x, "", $fbtxt);
|
||||
$wsheet->write($baris,0,$db->Row("KO_FUNGSI"), $fbtxt);
|
||||
$wsheet->write($baris,1,$db->Row("N_FUNGSI"), $fbtxt);
|
||||
$wsheet->write($baris,2,$db->Row("FUNG_PAGU"), $fbnum);
|
||||
$wsheet->write($baris,3,$db->Row("FUNG_TARGET"), $fbnum);
|
||||
$wsheet->write($baris,4,$db->Row("FUNG_TARGET_PSN"), $fbnum);
|
||||
$wsheet->write($baris,5,$db->Row("FUNG_REAL"), $fbnum);
|
||||
$wsheet->write($baris,6,$db->Row("FUNG_REAL_PSN"), $fbnum);
|
||||
$wsheet->write($baris,8,$db->Row("FUNG_INDI_S"), $fbnum);
|
||||
$wsheet->write($baris,9,$db->Row("FUNG_INDI_R"), $fbnum);
|
||||
$baris++;
|
||||
$fung = $db->Row("KO_FUNGSI");
|
||||
}
|
||||
if ($opd <> $db->Row("KO_OPD")) {
|
||||
if ($opd <> "") {
|
||||
for ($x=0; $x<=9; $x++) $wsheet->write($baris, $x, "");
|
||||
$baris++;
|
||||
}
|
||||
for ($x=0; $x<=9; $x++) $wsheet->write($baris, $x, "", $fbtxt);
|
||||
$wsheet->write($baris,0,$db->Row("KO_OPD"), $fbtxt);
|
||||
$wsheet->write($baris,1,$db->Row("N_OPD"), $fbtxt);
|
||||
$wsheet->write($baris,2,$db->Row("OPD_PAGU"), $fbnum);
|
||||
$wsheet->write($baris,3,$db->Row("OPD_TARGET"), $fbnum);
|
||||
$wsheet->write($baris,4,$db->Row("OPD_TARGET_PSN"), $fbnum);
|
||||
$wsheet->write($baris,5,$db->Row("OPD_REAL"), $fbnum);
|
||||
$wsheet->write($baris,6,$db->Row("OPD_REAL_PSN"), $fbnum);
|
||||
$wsheet->write($baris,8,$db->Row("OPD_INDI_S"), $fbnum);
|
||||
$wsheet->write($baris,9,$db->Row("OPD_INDI_R"), $fbnum);
|
||||
$baris++;
|
||||
$opd = $db->Row("KO_OPD");
|
||||
}
|
||||
if ($upt <> $db->Row("KO_UPT")) {
|
||||
if ($upt <> "") {
|
||||
for ($x=0; $x<=9; $x++) $wsheet->write($baris, $x, "");
|
||||
$baris++;
|
||||
}
|
||||
for ($x=0; $x<=9; $x++) $wsheet->write($baris, $x, "", $fbtxt);
|
||||
$wsheet->write($baris,0,$db->Row("KO_UPT"), $fbtxt);
|
||||
$wsheet->write($baris,1,$db->Row("N_UPT"), $fbtxt);
|
||||
$wsheet->write($baris,2,$db->Row("UPT_PAGU"), $fbnum);
|
||||
$wsheet->write($baris,3,$db->Row("UPT_TARGET"), $fbnum);
|
||||
$wsheet->write($baris,4,$db->Row("UPT_TARGET_PSN"), $fbnum);
|
||||
$wsheet->write($baris,5,$db->Row("UPT_REAL"), $fbnum);
|
||||
$wsheet->write($baris,6,$db->Row("UPT_REAL_PSN"), $fbnum);
|
||||
$wsheet->write($baris,8,$db->Row("UPT_INDI_S"), $fbnum);
|
||||
$wsheet->write($baris,9,$db->Row("UPT_INDI_R"), $fbnum);
|
||||
$baris++;
|
||||
$upt = $db->Row("KO_UPT");
|
||||
}
|
||||
for ($x=0; $x<=9; $x++) $wsheet->write($baris, $x, "", $ftxt);
|
||||
$wsheet->write($baris,0,$db->Row("KO_PROGRAM"), $ftxt);
|
||||
$wsheet->write($baris,1,$db->Row("N_PROGRAM"), $ftxt);
|
||||
$wsheet->write($baris,2,$db->Row("PROG_PAGU"), $fnum);
|
||||
$wsheet->write($baris,3,$db->Row("PROG_TARGET"), $fnum);
|
||||
$wsheet->write($baris,4,$db->Row("PROG_TARGET_PSN"), $fnum);
|
||||
$wsheet->write($baris,5,$db->Row("PROG_REAL"), $fnum);
|
||||
$wsheet->write($baris,6,$db->Row("PROG_REAL_PSN"), $fnum);
|
||||
$wsheet->write($baris,7,$db->Row("TAR_PROG"), $ftxt);
|
||||
$wsheet->write($baris,8,$db->Row("PROG_INDI_S"), $fnum);
|
||||
$wsheet->write($baris,9,$db->Row("PROG_INDI_R"), $fnum);
|
||||
$baris++;
|
||||
}
|
||||
|
||||
$wbook->send("Rekap Hasil Program ".$twulan."-".$tahun." - ".tgl_dmy(true).".xls");
|
||||
$wbook->close();
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$q_opd = "";
|
||||
if (in_array($_SESSION['__WEB_USER']['Level'],[1,3,4])) {
|
||||
$q_opd = " AND OPDID IN (".$_SESSION['__WEB_USER']['AK_OPD'].")";
|
||||
}
|
||||
|
||||
$form = new Form($db);
|
||||
$form->option_que("Tahun Data", "Tahun", $tahun, true, false, "SELECT Tahun,CONCAT('Tahun ',Tahun) N_Tahun FROM renja90_awal_prog GROUP BY Tahun ORDER BY Tahun", ["Tahun","N_Tahun"]);
|
||||
$form->option_db("Nama Perangkat Daerah", "OPDID", $id_opd, true, false, "vi_para90_opd", array("OPDID","Nama_OPD"), "Aktif=1".$q_opd." ORDER BY K_OPD", (user_level(3)?array(0,"SEMUA OPD"):null));
|
||||
$form->radio("Triwulan", "TW", $twulan, true, false, array(1=>"I",2=>"II",3=>"III",4=>"IV"));
|
||||
$form->show(' _Tahun_ _OPDID_ _TW_ ');
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : SISTEM INFORMASI MONITORING DAN EVALUASI
|
||||
Module : /apps/php/repo/rekap_progkeg.php
|
||||
Desc. : PHP - Laporan Rekap Program & Kegiatan
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : March 20th, 2012.
|
||||
Last Modified : June 24th, 2024.
|
||||
|
||||
(c) 2012 - 2024, 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
ini_set('display_errors', '0');
|
||||
ini_set("max_execution_time", "900");
|
||||
ini_set("pcre.backtrack_limit", "5000000");
|
||||
|
||||
require_once(__DIR__."/../../../../../vendor/autoload.php");
|
||||
require_once(__DIR__."/../func/emonev.php");
|
||||
|
||||
use siaupheng\fonia3\DB\MySQL;
|
||||
use siaupheng\fonia3\Web\Param;
|
||||
use siaupheng\fonia3\Web\Form;
|
||||
|
||||
$db = $db ?? new MySQL();
|
||||
$data = Param::Get("data");
|
||||
$tahun = Param::Get("Tahun", $_SESSION['__WEB_APP']['REAL_THN']);
|
||||
$is_rutin = Param::Get("Cetak_Rutin", 1);
|
||||
|
||||
if ( $data == "print" || $data == "export") {
|
||||
$tsql = ($is_rutin==1) ? "" : " AND ProgID<>422";
|
||||
//todo: cek lagi utk rutin/penunjang berdasarkan urusanid=20
|
||||
|
||||
$adata = array();
|
||||
$db->Query("SELECT COUNT(DISTINCT ProgID) P_RPJMD FROM renstra_prog WHERE RPJMDID=2".$tsql);
|
||||
if ($db->Next()) $adata['RPJMD']['Prog'] = $db->Row("P_RPJMD");
|
||||
|
||||
$db->Query("SELECT COUNT(DISTINCT ProgID) Prog,COUNT(*) Keg FROM renstra_keg WHERE RPJMDID=2".$tsql);
|
||||
if ($db->Next()) $adata['RENSTRA'] = $db->AllRow();
|
||||
|
||||
$db->Query("SELECT COUNT(DISTINCT ProgID) Prog,COUNT(*) Keg FROM renja90_awal_keg WHERE RPJMDID=2 AND Tahun='".$tahun."'".$tsql);
|
||||
if ($db->Next()) $adata['RKPD'] = $db->AllRow();
|
||||
|
||||
$db->Query("SELECT COUNT(DISTINCT ProgID) Prog,COUNT(*) Keg FROM dpa_keg WHERE RPJMDID=2 AND Tahun='".$tahun."'".$tsql);
|
||||
if ($db->Next()) $adata['RKA'] = $db->AllRow();
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
$_head = '<div style="text-align:center;font-size:120%;"><b>REKAP JUMLAH PROGRAM DAN KEGIATAN<br>TAHUN ANGGARAN '.$tahun.'</b></div><br>
|
||||
<table width="100%" class="garis">
|
||||
<tr><td width="20" class="c b" rowspan="2">Tahun</td><td width="50" class="c b" rowspan="2">Program RPJMD</td><td width="100" class="c b" colspan="2">RENSTRA</td><td width="100" class="c b" colspan="2">RKPD</td><td width="100" class="c b" colspan="2">RKA</td></tr>
|
||||
<tr><td class="c b">Program</td><td class="c b">Kegiatan</td><td class="c b">Program</td><td class="c b">Kegiatan</td><td class="c b">Program</td><td class="c b">Kegiatan</td></tr>';
|
||||
$_line = '<tr><td class="c" nowrap>%s</td><td class="r">%s</td><td class="r">%s</td><td class="r">%s</td><td class="r">%s</td><td class="r">%s</td><td class="r">%s</td><td class="r">%s</td></tr>';
|
||||
$header = $_head;
|
||||
$body = "";
|
||||
$body .= sprintf($_line, $tahun, rupiah($adata['RPJMD']['Prog']), rupiah($adata['RENSTRA']['Prog']), rupiah($adata['RENSTRA']['Keg']), rupiah($adata['RKPD']['Prog']), rupiah($adata['RKPD']['Keg']), rupiah($adata['RKA']['Prog']), rupiah($adata['RKA']['Keg']));
|
||||
echo $header . $body . "</table>";
|
||||
|
||||
} else if ( $data == "export" ) {
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$form = new Form($db);
|
||||
$form->option_db("Tahun Data", "Tahun", $tahun, true, false, "para_periode", array("Tahun","Tahun"));
|
||||
$form->radio("Rutin / Penunjang", "Cetak_Rutin", $is_rutin, true, false, array(1=>"Ya",2=>"Tidak"));
|
||||
$form->show(' _Tahun_ _Cetak_Rutin_ ');
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user