170 lines
9.5 KiB
PHP
170 lines
9.5 KiB
PHP
<?php
|
|
|
|
/*******************************************************************
|
|
|
|
App. Name : SISTEM INFORMASI PERENCANAAN PEMBANGUNAN DAERAH
|
|
Module : /apps/php/repo/hasil_forum.php
|
|
Desc. : PHP - Cetak Hasil Forum / Forum
|
|
Created By : Siau Pheng ([email protected]).
|
|
Created Date : March 21st, 2014.
|
|
Last Modified : June 6th, 2024.
|
|
|
|
(c) 2014 - 2024, 3FONIA Software; WWW.3FONIA.COM.
|
|
|
|
*******************************************************************/
|
|
|
|
ini_set("pcre.backtrack_limit", 100000000);
|
|
|
|
require_once(__DIR__."/../../../../../vendor/autoload.php");
|
|
require_once(__DIR__."/../func/report.php");
|
|
|
|
use siaupheng\fonia3\DB\MySQL;
|
|
use siaupheng\fonia3\Web\Param;
|
|
use siaupheng\fonia3\Web\Form;
|
|
|
|
$db = (is_resource($db)) ? $db : new MySQL();
|
|
$ajson = [];
|
|
$data = Param::Get("data");
|
|
$tahun = Param::Get("Tahun", $_SESSION['__WEB_APP']['RENC_THN']);
|
|
$id_forum = Param::Get("ForumID", 0);
|
|
$id_opd = Param::Get("OPDID", 0);
|
|
$id_status = Param::Get("StatusID", 0);
|
|
|
|
if ( $data == "pdf" || $data == "print") {
|
|
$nama_forum = "Semua Forum";
|
|
if ($id_forum > 0) {
|
|
$db->Query("SELECT N_Forum FROM para_forum WHERE ForumID='".$id_forum."' LIMIT 1");
|
|
if ($db->Next()) $nama_forum = $db->Row("N_Forum");
|
|
}
|
|
|
|
$cat_status = '<br><br><table class="ttd-ba-status"><tbody><tr><td class="judul" colspan="2">Keterangan :</td></tr>';
|
|
$db->Query("SELECT * FROM para_status WHERE Aktif=1 ORDER BY K_Status");
|
|
while ($db->Next()) {
|
|
$cat_status .= sprintf('<tr><td style="width:20px;">%s.</td><td>%s</td></tr>', $db->Row("K_Status"), $db->Row("N_Status"));
|
|
}
|
|
$cat_status .= '</tbody></table>';
|
|
|
|
$tsql = " Tahun='".$tahun."'";
|
|
$tsql .= ($id_forum==0) ? "" : " AND OPDID IN (SELECT OPDID FROM para90_opd WHERE Aktif=1 AND ForumID='".$id_forum."')";
|
|
$tsql .= ($id_opd==0) ? "" : " AND OPDID='".$id_opd."'";
|
|
$tsql .= ($id_status==0) ? " AND StatusID>0" : " AND StatusID='".$id_status."'";
|
|
|
|
// proses rekap database
|
|
Report_Empty("mus_opd");
|
|
$db->Query("INSERT INTO rep_mus_opd SELECT T.Tahun,T.KecID,T.OPDID,T.KelID,SUM(T.Rupiah2),'".user_unix()."','".user_id()."' FROM (SELECT * FROM mus_usulan_desa WHERE".$tsql.") T GROUP BY T.OPDID");
|
|
|
|
$db->Query("SELECT T.*,K.K_Lokasi K_Kec,K.N_Lokasi N_Kec,D.N_Lokasi N_Desa,CONCAT(IF(T.JU=3,'KEC',K.K_Lokasi),'.',T.Kode) Kode_Usul,CONCAT(T.Volume2,' ',S.N_Satuan) Vol_Satuan,O.S_OPD,O.K_OPD,O.N_OPD,F.ForumID,F.N_Forum,A.K_Status,A.S_Status,RO.* FROM (SELECT * FROM mus_usulan_desa WHERE".$tsql.") T LEFT JOIN para_lokasi K ON (K.LokasiID=T.KecID AND K.Level=1) LEFT JOIN para_lokasi D ON (D.LokasiID=T.KelID AND D.Level=2) LEFT JOIN para_satuan S ON (S.SatuanID=T.SatuanID2) LEFT JOIN para_status A ON (A.StatusID=T.StatusID) LEFT JOIN para90_opd O ON (O.OPDID=T.OPDID) LEFT JOIN para_forum F ON (F.ForumID=O.ForumID) LEFT JOIN rep_mus_opd RO ON (T.OPDID=RO.OPDID AND T.Tahun=RO.Tahun AND RO.UserID='".user_id()."' AND RO.Unix='".user_unix()."') ORDER BY O.ForumID,O.K_OPD,T.Prio,T.JU DESC,T.Kode");
|
|
}
|
|
|
|
if ( $data == "pdf" ) {
|
|
$html = '<p class="judul">Hasil Pembahasan Usulan Kegiatan Pembangunan<br>Pada Forum OPD Untuk Penyusunan Renja '.($tahun).'</p>';
|
|
$footer = '<htmlpagefooter name="RepFoot%s"><table class="footer"><tr><td width="33%%">eForum - Kabupaten Sambas</td><td width="34%%" class="c">%s</td><td width="33%%" class="r i">{DATE d-m-Y H:i} / Halaman : {PAGENO} dari {nbpg}</td></tr></table></htmlpagefooter>';
|
|
$_setfoot = '<sethtmlpagefooter name="RepFoot%s" show-this-page="1" value="on" />';
|
|
|
|
$t_head = '<div><table class="garis" autosize="1"><thead><tr><th>No. Prio</th><th>Usulan Kegiatan</th><th>Kode Rincian</th><th>Volume</th><th>Lokasi</th><th>Jumlah</th><th colspan="2">Lokasi (Desa/Kec)</th><th colspan="2">Keterangan</th></tr></thead><tbody>';
|
|
$t_foot = '</tbody></table></div>';
|
|
|
|
$t_ttd = 'Sambas, '.tgl_panjang().'<br><br><table class="ttd"><thead><tr><th>Nama</th><th>OPD</th><th style="width:20%;">Paraf</th></tr></thead><tbody><tr><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td></tr></tbody></table>';
|
|
|
|
$_line = '<tr><td class="c">%s</td><td>%s</td><td>%s</td><td class="r">%s</td><td>%s</td><td class="r">%s</td><td>%s</td><td>%s</td><td style="width:2%%;">%s</td><td>%s</td></tr>';
|
|
$_sub = '<tr class="%s"><td colspan="5" class="b">%s</td><td class="r b">%s</td><td colspan="4" class="b"> </td></tr>';
|
|
|
|
$body = $t_head;
|
|
$kfor = ""; $kopd = ""; $n_opd = "";
|
|
while ($db->Next()) {
|
|
$n_opd = $db->Row("N_OPD");
|
|
if ($kopd == "") {
|
|
$html .= sprintf($footer, $db->Row("K_OPD"), $n_opd);
|
|
$body .= sprintf($_setfoot, $db->Row("K_OPD"));
|
|
}
|
|
if ($kfor <> $db->Row("ForumID")) {
|
|
if ($kfor <> "") {
|
|
$body .= $t_foot;
|
|
$body .= '<pagebreak orientation="landscape" />';
|
|
$html .= sprintf($footer, "ttd", "Halaman Tanda Tangan OPD");
|
|
$body .= sprintf($_setfoot, "ttd");
|
|
$body .= $t_ttd . $cat_status;
|
|
$body .= '<pagebreak orientation="landscape" />';
|
|
$body .= $t_head;
|
|
}
|
|
$body .= sprintf($_sub, "forum", $db->Row("N_Forum"), " ");
|
|
$kfor = $db->Row("ForumID");
|
|
}
|
|
if ($kopd <> $db->Row("K_OPD")) {
|
|
if ($kopd <> "") {
|
|
$body .= $t_foot;
|
|
$body .= '<pagebreak orientation="landscape" />';
|
|
$body .= $t_head;
|
|
$html .= sprintf($footer, $db->Row("K_OPD"), $n_opd);
|
|
$body .= sprintf($_setfoot, $db->Row("K_OPD"));
|
|
}
|
|
$body .= sprintf($_sub, "opd", $db->Row("N_OPD"), rupiah($db->Row("OPD_RUPIAH")));
|
|
$kopd = $db->Row("K_OPD");
|
|
}
|
|
$body .= sprintf($_line, $db->Row("Prio"), $db->Row("Usulan2"), $db->Row("Kode_Usul"), $db->Row("Vol_Satuan"), $db->Row("Lokasi2"), rupiah($db->Row("Rupiah2")), $db->Row("N_Desa"), $db->Row("N_Kec"), $db->Row("K_Status"), ($db->Row("S_Status")==""?" ":$db->Row("S_Status")));
|
|
}
|
|
$body .= sprintf($t_foot);
|
|
if ($kfor <> "") {
|
|
$body .= '<pagebreak orientation="landscape" />';
|
|
$html .= sprintf($footer, "ttd", "Halaman Tanda Tangan OPD");
|
|
$body .= sprintf($_setfoot, "ttd");
|
|
$body .= $t_ttd . $cat_status;
|
|
}
|
|
|
|
$mpdf = new \Mpdf\Mpdf([
|
|
'mode' => 'c',
|
|
'format' => 'A4-L',
|
|
'margin_left' => 8,
|
|
'margin_right' => 8,
|
|
'margin_top' => 8,
|
|
'margin_header' => 5,
|
|
'margin_footer' => 5
|
|
]);
|
|
$mpdf->SetDisplayMode('fullpage');
|
|
$css = file_get_contents($_SESSION['__WEB_APP']['REAL_PATH'].'assets/css/pdf/forum.css');
|
|
$mpdf->WriteHTML($css, \Mpdf\HTMLParserMode::HEADER_CSS);
|
|
$mpdf->WriteHTML($html . $body, \Mpdf\HTMLParserMode::HTML_BODY);
|
|
$mpdf->SetAuthor($_SESSION['__WEB_APP']['REG_NAME']);
|
|
$mpdf->SetCreator($_SESSION['__WEB_APP']['APP_NAME']." v".$_SESSION['__WEB_APP']['APP_VER']);
|
|
$mpdf->setTitle("Hasil Forum ".$nama_forum);
|
|
$mpdf->Output("Hasil Forum ".$nama_forum.".pdf", \Mpdf\Output\Destination::INLINE);
|
|
|
|
} else if ( $data == "option-opd" ) {
|
|
$aoption = array('type' => "option", 'id' => "OPDID", 'value' => 0, 'avalue' => array());
|
|
$db->Query("SELECT * FROM vi_para90_opd WHERE Aktif=1 AND ForumID='".$id_forum."'".($_SESSION['__WEB_USER']['Level']==3?" AND OPDID IN (".$_SESSION['__WEB_USER']['AK_OPD'].")":""));
|
|
if ($db->RecordCount()<>1) $aoption['avalue'][] = array('value'=>0, 'html'=>"");
|
|
while ($db->Next()) {
|
|
if ($db->RecordCount()==1) $aoption['value'] = $db->Row("OPDID");
|
|
$aoption['avalue'][] = array('value'=>$db->Row("OPDID"), 'html'=>$db->Row("Nama_OPD"));
|
|
}
|
|
$ajson[] = $aoption;
|
|
|
|
} else if ( $data == "default") {
|
|
$form = new Form($db);
|
|
$ttahun = $form->option_db("_", "Tahun", $tahun, true, true, "para_periode", array("Tahun","Tahun"), "Tahun BETWEEN '".$_SESSION['__WEB_APP']['Tahun_Min']."' AND '".$_SESSION['__WEB_APP']['Tahun_Max']."'");
|
|
$tforum = $form->option_db("_", "ForumID", 0, true, true, "para_forum", array("ForumID","N_Forum"), "Aktif=1 ORDER BY ForumID", array(0," "), null, "RepoHasilForumJS.oc_Forum()");
|
|
$topd = $form->option("_", "OPDID", 0, true, true, array(0 => " "));
|
|
$tstatus = $form->option_db("_", "StatusID", 0, true, true, "vi_para_status", array("StatusID","Nama_Status"), "Aktif=1 ORDER BY K_Status", array(0,"SEMUA STATUS"));
|
|
|
|
echo '
|
|
<div class="row mb-1">
|
|
<label class="col-sm-4 col-lg-3 col-form-label" for="Tahun">Tahun Data</label>
|
|
<div class="col-sm-4 col-lg-5">'.$ttahun.'</div>
|
|
</div>
|
|
<div class="row mb-1">
|
|
<label class="col-sm-4 col-lg-3 col-form-label" for="ForumID">Nama Forum</label>
|
|
<div class="col-sm-8 col-lg-9">'.$tforum.'</div>
|
|
</div>
|
|
<div class="row mb-1">
|
|
<label class="col-sm-4 col-lg-3 col-form-label" for="OPDID">Nama Perangkat Deerah</label>
|
|
<div class="col-sm-8 col-lg-9">'.$topd.'</div>
|
|
</div>
|
|
<div class="row mb-1">
|
|
<label class="col-sm-4 col-lg-3 col-form-label" for="StatusID">Nama Status</label>
|
|
<div class="col-sm-8 col-lg-9">'.$tstatus.'</div>
|
|
</div>';
|
|
}
|
|
|
|
send_json($ajson);
|
|
?>
|