diff --git a/app/Config/Boot/development.php b/app/Config/Boot/development.php index 37dafdc0..a868447a 100644 --- a/app/Config/Boot/development.php +++ b/app/Config/Boot/development.php @@ -21,7 +21,7 @@ ini_set('display_errors', '1'); | backtraces along with the other error information. If you would | prefer to not see this, set this value to false. */ -defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', false); +defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true); /* |-------------------------------------------------------------------------- diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index dba09cec..1bb4a2b1 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -23,13 +23,14 @@ class Home extends BaseController $p['penerimaan'] = $model->getPenn($param)->getResult(); $p['updatex'] = $model->getUpd()->getFirstRow('array'); $p['perkategori'] = $model->getKat($param)->getResult(); + $p['pie_penerimaan'] = $model->getPiePen($param)->getResult(); + echo view('inc/head'); echo view('inc/navbar'); echo view('inc/sidebar'); echo view('ppm/dashboard', $p); echo view('inc/footer'); - echo view('inc/js'); } else { return redirect()->to('auth'); } diff --git a/app/Models/Mpemby.php b/app/Models/Mpemby.php index 4311e030..383d499f 100644 --- a/app/Models/Mpemby.php +++ b/app/Models/Mpemby.php @@ -47,4 +47,21 @@ class Mpemby extends Model "); return $query; } + + + function getPiePen($param) + { + $tahun = $param['tahun']; + $tahunl = $tahun - 1; + $bln = date('m'); + $query = $this->db->query("SELECT NM_PAJAK,TOTALN PENERIMAAN, + (SELECT ROUND(SUM(TOTAL)) FROM PERJENIS_MV) PENERIMAAN_TOT + FROM ( + SELECT NM_PAJAK,ROUND(SUM(CASE WHEN THNBYR= '" . $tahun . "' THEN TOTAL ELSE 0 END)) TOTALN, + ROUND(SUM(CASE WHEN THNBYR= '" . $tahunl . "' THEN TOTAL ELSE 0 END)) TOTALP + FROM PERJENIS_MV + GROUP BY NM_PAJAK ORDER BY TOTALN DESC) + "); + return $query; + } } diff --git a/app/Views/inc/js.php b/app/Views/inc/js.php index dc1fb055..4a6a2462 100644 --- a/app/Views/inc/js.php +++ b/app/Views/inc/js.php @@ -1,23 +1,22 @@ <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> - <script>window.jQuery || document.write('<script src="src/js/vendor/jquery-3.3.1.min.js"><\/script>')</script> - <script src="<?= base_url('public/theme/plugins/popper.js/dist/umd/popper.min.js') ?>"></script> - <script src="<?= base_url('public/theme/plugins/bootstrap/dist/js/bootstrap.min.js') ?>"></script> - <script src="<?= base_url('public/theme/plugins/perfect-scrollbar/dist/perfect-scrollbar.min.js') ?>"></script> - <script src="<?= base_url('public/theme/plugins/screenfull/dist/screenfull.js') ?>"></script> - <script src="<?= base_url('public/theme/plugins/datatables.net/js/jquery.dataTables.min.js') ?>"></script> - <script src="<?= base_url('public/theme/plugins/datatables.net-bs4/js/dataTables.bootstrap4.min.js') ?>"></script> - <script src="<?= base_url('public/theme/plugins/datatables.net-responsive/js/dataTables.responsive.min.js') ?>"></script> - <script src="<?= base_url('public/theme/plugins/datatables.net-responsive-bs4/js/responsive.bootstrap4.min.js') ?>"></script> - <script src="<?= base_url('public/theme/plugins/jvectormap/jquery-jvectormap.min.js') ?>"></script> - <script src="<?= base_url('public/theme/plugins/jvectormap/tests/assets/jquery-jvectormap-world-mill-en.js') ?>"></script> - <script src="<?= base_url('public/theme/plugins/moment/moment.js') ?>"></script> - <script src="<?= base_url('public/theme/plugins/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js') ?>"></script> - <script src="<?= base_url('public/theme/plugins/d3/dist/d3.min.js') ?>"></script> - <script src="<?= base_url('public/theme/plugins/c3/c3.min.js') ?>"></script> - <script src="<?= base_url('public/theme/js/tables.js') ?>"></script> - <script src="<?= base_url('public/theme/js/widgets.js') ?>"></script> - <script src="<?= base_url('public/theme/js/charts.js') ?>"></script> - <script src="<?= base_url('public/theme/dist/js/theme.min.js') ?>"></script> - - </body> +<script src="<?= base_url('public/theme/plugins/popper.js/dist/umd/popper.min.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/bootstrap/dist/js/bootstrap.min.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/perfect-scrollbar/dist/perfect-scrollbar.min.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/screenfull/dist/screenfull.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/datatables.net/js/jquery.dataTables.min.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/datatables.net-bs4/js/dataTables.bootstrap4.min.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/datatables.net-responsive/js/dataTables.responsive.min.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/datatables.net-responsive-bs4/js/responsive.bootstrap4.min.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/jvectormap/jquery-jvectormap.min.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/jvectormap/tests/assets/jquery-jvectormap-world-mill-en.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/moment/moment.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js') ?>"></script> +<script src="https://cdnjs.cloudflare.com/ajax/libs/highcharts/11.3.0/highcharts.js"></script> +<script src="https://cdnjs.cloudflare.com/ajax/libs/highcharts/11.3.0/highcharts-more.min.js"></script> +<script src="<?= base_url('public/theme/js/tables.js') ?>"></script> +<script src="<?= base_url('public/theme/js/widgets.js') ?>"></script> +<script src="<?= base_url('public/theme/dist/js/theme.min.js') ?>"></script> + +</body> + </html> \ No newline at end of file diff --git a/app/Views/ppm/dashboard.php b/app/Views/ppm/dashboard.php index 7e00064b..1acf09c6 100644 --- a/app/Views/ppm/dashboard.php +++ b/app/Views/ppm/dashboard.php @@ -14,12 +14,21 @@ foreach ($penerimaan as $row) { +$datanya_penerimaan = "["; +foreach ($pie_penerimaan as $_junk => $data) { + $datanya_penerimaan = $datanya_penerimaan . "['" . $data->NM_PAJAK . "', " . $data->PENERIMAAN . "],"; +} +$datanya_penerimaan = $datanya_penerimaan . "]"; + + ?> <div class="main-content"> <div class="container-fluid"> + <h3>Dashboard Nasional</h3> <div class="row clearfix"> + <div class="col-lg-3 col-md-6 col-sm-12"> <div class="widget"> <div class="widget-body"> @@ -239,7 +248,7 @@ foreach ($penerimaan as $row) { <h3>Per Jenis Pajak</h3> </div> <div class="card-body"> - <div id="c3-donut-chart"></div> + <div id="preview_jenis_penerimaan"></div> </div> </div> </div> @@ -707,4 +716,86 @@ foreach ($penerimaan as $row) { </div> </form> </div> -</div> \ No newline at end of file +</div> + + +<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> +<script src="<?= base_url('public/theme/plugins/popper.js/dist/umd/popper.min.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/bootstrap/dist/js/bootstrap.min.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/perfect-scrollbar/dist/perfect-scrollbar.min.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/screenfull/dist/screenfull.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/datatables.net/js/jquery.dataTables.min.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/datatables.net-bs4/js/dataTables.bootstrap4.min.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/datatables.net-responsive/js/dataTables.responsive.min.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/datatables.net-responsive-bs4/js/responsive.bootstrap4.min.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/jvectormap/jquery-jvectormap.min.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/jvectormap/tests/assets/jquery-jvectormap-world-mill-en.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/moment/moment.js') ?>"></script> +<script src="<?= base_url('public/theme/plugins/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js') ?>"></script> +<script src="https://cdnjs.cloudflare.com/ajax/libs/highcharts/11.3.0/highcharts.js"></script> +<script src="https://cdnjs.cloudflare.com/ajax/libs/highcharts/11.3.0/highcharts-more.min.js"></script> +<script src="<?= base_url('public/theme/js/tables.js') ?>"></script> +<script src="<?= base_url('public/theme/js/widgets.js') ?>"></script> +<script src="<?= base_url('public/theme/dist/js/theme.min.js') ?>"></script> + + +<script type="text/javascript"> + var chart; + + $(document).ready(function() { + + // Build the chart + chart = new Highcharts.Chart({ + chart: { + renderTo: 'preview_jenis_penerimaan', + plotBackgroundColor: null, + plotBorderWidth: null, + plotShadow: false + }, + title: { + text: '', + style: { + fontSize: '18px', + fontWeight: 'bold', + textTransform: 'uppercase' + } + }, + tooltip: { + formatter: function() { + return '<b>' + this.point.name + '</b>: ' + Highcharts.numberFormat(this.y, 0); + } + }, + colors: ['#7cb5ec', '#f7a35c', '#90ee7e', '#7798BF', '#aaeeee', '#ff0066', '#eeaaee', '#55BF3B', '#DF5353', '#6798BF', '#eeeeee'], + plotOptions: { + pie: { + allowPointSelect: true, + cursor: 'pointer', + dataLabels: { + style: { + width: '250px' + }, + enabled: true, + color: '#000000', + connectorColor: 'red', + formatter: function() { + return '<b>' + this.point.name + '</b>: ' + Highcharts.numberFormat(this.percentage, 0) + ' % '; + } + }, + showInLegend: false + } + }, + exporting: { + enabled: false + }, + credits: { + enabled: false + }, + series: [{ + type: 'pie', + name: 'Peranan', + data: <?php echo $datanya_penerimaan; ?>, + innerSize: '50%' + }] + }); + }); +</script> \ No newline at end of file diff --git a/public/theme/js/charts.js b/public/theme/js/charts.js index 226e7b41..92d3b20b 100644 --- a/public/theme/js/charts.js +++ b/public/theme/js/charts.js @@ -1,218 +1,4 @@ -(function($) { - 'use strict'; - var c3LineChart = c3.generate({ - bindto: '#c3-line-chart', - data: { - columns: [ - ['data1', 30, 200, 100, 400, 150, 250], - ['data2', 50, 20, 10, 40, 15, 25] - ] - }, - color: { - pattern: ['rgba(88,216,163,1)', 'rgba(237,28,36,0.6)', 'rgba(4,189,254,0.6)'] - }, - padding: { - top: 0, - right: 0, - bottom: 30, - left: 0, - } - }); - - setTimeout(function() { - c3LineChart.load({ - columns: [ - ['data1', 230, 190, 300, 500, 300, 400] - ] - }); - }, 1000); - - setTimeout(function() { - c3LineChart.load({ - columns: [ - ['data3', 130, 150, 200, 300, 200, 100] - ] - }); - }, 1500); - - setTimeout(function() { - c3LineChart.unload({ - ids: 'data1' - }); - }, 2000); - - var c3SplineChart = c3.generate({ - bindto: '#c3-spline-chart', - data: { - columns: [ - ['data1', 30, 200, 100, 400, 150, 250], - ['data2', 130, 100, 140, 200, 150, 50] - ], - type: 'spline' - }, - color: { - pattern: ['rgba(88,216,163,1)', 'rgba(237,28,36,0.6)', 'rgba(4,189,254,0.6)'] - }, - padding: { - top: 0, - right: 0, - bottom: 30, - left: 0, - } - }); - var c3BarChart = c3.generate({ - bindto: '#c3-bar-chart', - data: { - columns: [ - ['data1', 30, 200, 100, 400, 150, 250], - ['data2', 130, 100, 140, 200, 150, 50] - ], - type: 'bar' - }, - color: { - pattern: ['rgba(88,216,163,1)', 'rgba(4,189,254,0.6)', 'rgba(237,28,36,0.6)'] - }, - padding: { - top: 0, - right: 0, - bottom: 30, - left: 0, - }, - bar: { - width: { - ratio: 0.7 // this makes bar width 50% of length between ticks - } - } - }); - - setTimeout(function() { - c3BarChart.load({ - columns: [ - ['data3', 130, -150, 200, 300, -200, 100] - ] - }); - }, 1000); - - var c3StepChart = c3.generate({ - bindto: '#c3-step-chart', - data: { - columns: [ - ['data1', 300, 350, 300, 0, 0, 100], - ['data2', 130, 100, 140, 200, 150, 50] - ], - types: { - data1: 'step', - data2: 'area-step' - } - }, - color: { - pattern: ['rgba(88,216,163,1)', 'rgba(4,189,254,0.6)', 'rgba(237,28,36,0.6)'] - }, - padding: { - top: 0, - right: 0, - bottom: 30, - left: 0, - } - }); - var c3PieChart = c3.generate({ - bindto: '#c3-pie-chart', - data: { - // iris data from R - columns: [ - ['data1', 30], - ['data2', 120], - ], - type: 'pie', - onclick: function(d, i) { - console.log("onclick", d, i); - }, - onmouseover: function(d, i) { - console.log("onmouseover", d, i); - }, - onmouseout: function(d, i) { - console.log("onmouseout", d, i); - } - }, - color: { - pattern: ['#6153F9', '#8E97FC', '#A7B3FD'] - }, - padding: { - top: 0, - right: 0, - bottom: 30, - left: 0, - } - }); - - setTimeout(function() { - c3PieChart.load({ - columns: [ - ["Income", 0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.2, 0.4, 0.4, 0.3, 0.3, 0.3, 0.2, 0.4, 0.2, 0.5, 0.2, 0.2, 0.4, 0.2, 0.2, 0.2, 0.2, 0.4, 0.1, 0.2, 0.2, 0.2, 0.2, 0.1, 0.2, 0.2, 0.3, 0.3, 0.2, 0.6, 0.4, 0.3, 0.2, 0.2, 0.2, 0.2], - ["Outcome", 1.4, 1.5, 1.5, 1.3, 1.5, 1.3, 1.6, 1.0, 1.3, 1.4, 1.0, 1.5, 1.0, 1.4, 1.3, 1.4, 1.5, 1.0, 1.5, 1.1, 1.8, 1.3, 1.5, 1.2, 1.3, 1.4, 1.4, 1.7, 1.5, 1.0, 1.1, 1.0, 1.2, 1.6, 1.5, 1.6, 1.5, 1.3, 1.3, 1.3, 1.2, 1.4, 1.2, 1.0, 1.3, 1.2, 1.3, 1.3, 1.1, 1.3], - ["Revenue", 2.5, 1.9, 2.1, 1.8, 2.2, 2.1, 1.7, 1.8, 1.8, 2.5, 2.0, 1.9, 2.1, 2.0, 2.4, 2.3, 1.8, 2.2, 2.3, 1.5, 2.3, 2.0, 2.0, 1.8, 2.1, 1.8, 1.8, 1.8, 2.1, 1.6, 1.9, 2.0, 2.2, 1.5, 1.4, 2.3, 2.4, 1.8, 1.8, 2.1, 2.4, 2.3, 1.9, 2.3, 2.5, 2.3, 1.9, 2.0, 2.3, 1.8], - ] - }); - }, 1500); - - setTimeout(function() { - c3PieChart.unload({ - ids: 'data1' - }); - c3PieChart.unload({ - ids: 'data2' - }); - }, 2500); - var c3DonutChart = c3.generate({ - bindto: '#c3-donut-chart', - data: { - columns: [ - ['data1', 30], - ['data2', 120], - ], - type: 'donut', - onclick: function(d, i) { - console.log("onclick", d, i); - }, - onmouseover: function(d, i) { - console.log("onmouseover", d, i); - }, - onmouseout: function(d, i) { - console.log("onmouseout", d, i); - } - }, - color: { - pattern: ['rgba(88,216,163,1)', 'rgba(4,189,254,0.6)', 'rgba(237,28,36,0.6)'] - }, - padding: { - top: 0, - right: 0, - bottom: 30, - left: 0, - }, - donut: { - title: "Iris Petal Width" - } - }); - - setTimeout(function() { - c3DonutChart.load({ - columns: [ - ["setosa", 0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.2, 0.4, 0.4, 0.3, 0.3, 0.3, 0.2, 0.4, 0.2, 0.5, 0.2, 0.2, 0.4, 0.2, 0.2, 0.2, 0.2, 0.4, 0.1, 0.2, 0.2, 0.2, 0.2, 0.1, 0.2, 0.2, 0.3, 0.3, 0.2, 0.6, 0.4, 0.3, 0.2, 0.2, 0.2, 0.2], - ["versicolor", 1.4, 1.5, 1.5, 1.3, 1.5, 1.3, 1.6, 1.0, 1.3, 1.4, 1.0, 1.5, 1.0, 1.4, 1.3, 1.4, 1.5, 1.0, 1.5, 1.1, 1.8, 1.3, 1.5, 1.2, 1.3, 1.4, 1.4, 1.7, 1.5, 1.0, 1.1, 1.0, 1.2, 1.6, 1.5, 1.6, 1.5, 1.3, 1.3, 1.3, 1.2, 1.4, 1.2, 1.0, 1.3, 1.2, 1.3, 1.3, 1.1, 1.3], - ["virginica", 2.5, 1.9, 2.1, 1.8, 2.2, 2.1, 1.7, 1.8, 1.8, 2.5, 2.0, 1.9, 2.1, 2.0, 2.4, 2.3, 1.8, 2.2, 2.3, 1.5, 2.3, 2.0, 2.0, 1.8, 2.1, 1.8, 1.8, 1.8, 2.1, 1.6, 1.9, 2.0, 2.2, 1.5, 1.4, 2.3, 2.4, 1.8, 1.8, 2.1, 2.4, 2.3, 1.9, 2.3, 2.5, 2.3, 1.9, 2.0, 2.3, 1.8], - ] - }); - }, 1500); - - setTimeout(function() { - c3DonutChart.unload({ - ids: 'data1' - }); - c3DonutChart.unload({ - ids: 'data2' - }); - }, 2500); +(function ($) { })(jQuery);