umkm-app/application/views/admin/laporanbulanan.php

495 lines
28 KiB
PHP
Raw Normal View History

<?php
function rupiah($angka){
$hasil_rupiah = "Rp " . number_format($angka,2,',','.');
return $hasil_rupiah;
}
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="<?php echo base_url()?>assets/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="<?php echo base_url()?>assets/css/dataTables.bootstrap4.min.css">
<link data-require="sweet-alert@*" data-semver="0.4.2" rel="stylesheet" href="<?php echo base_url()?>assets/css/sweetalert.min.css" />
<link rel="icon" type="image/png" href="../../assets/images/favicon.png" />
<title>Aplikasi UMKM</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="#">
<img src="<?php echo base_url()?>assets/images/logo-white.png" width="100" alt="">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
</ul>
<form methode="POST" action="../login/logout" class="form-inline my-2 my-lg-0" >
<button class="btn btn-outline-warning btn-sm my-2 my-sm-0" type="submit">Logout</button>
</form>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-3" style="cursor:pointer;">
<div class="card">
<div class="card-header text-center">
<img src="<?php echo base_url()?>assets/images/<?php echo $user_logged->foto_user ?>" width="125" /><br>
<strong><?php echo $user_logged->nama ?></strong>
</div>
<ul class="list-group list-group-flush">
<a href="<?php echo base_url('index.php/')?>admin/dashboard" style="text-decoration:none;">
<li class="list-group-item text-dark border-bottom">Data Pemilik UMKM</li>
</a>
<a href="<?php echo base_url('index.php/')?>admin/umkm" style="text-decoration:none;">
<li class="list-group-item text-dark border-bottom">Data UMKM</li>
</a>
<a href="<?php echo base_url('index.php/')?>admin/absensi" style="text-decoration:none;">
2021-11-22 13:56:10 +07:00
<li class="list-group-item text-dark border-bottom">Presensi</li>
</a>
<a href="<?php echo base_url('index.php/')?>admin/laporan" style="text-decoration:none;">
<li class="list-group-item bg-primary text-white border-bottom">Laporan</li>
</a>
<a href="<?php echo base_url('index.php/')?>admin/setting" style="text-decoration:none;">
<li class="list-group-item text-dark">Setting</li>
</a>
</ul>
</div>
</div>
<div class="col col-md-9 col-lg-9 col-sm-12 col-12">
<div class="card">
<h5 class="card-header">Laporan</h5>
<div class="card-body">
<div>
<ul class="nav nav-tabs">
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>admin/laporan" class="nav-link">Tahunan</a>
</li>
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>admin/laporanbulanan" class="nav-link active">Bulanan</a>
</li>
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>admin/laporankecamatan" class="nav-link">Kecamatan</a>
</li>
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>admin/laporankelurahan" class="nav-link">Kelurahan</a>
</li>
</ul>
<?php
if($bulan==1){
$bulantext = 'Januari';
}elseif($bulan==1){
$bulantext = 'Februari';
}elseif($bulan==2){
$bulantext = 'Februari';
}elseif($bulan==3){
$bulantext = 'Maret';
}elseif($bulan==4){
$bulantext = 'April';
}elseif($bulan==5){
$bulantext = 'Mei';
}elseif($bulan==6){
$bulantext = 'Juni';
}elseif($bulan==7){
$bulantext = 'Julai';
}elseif($bulan==8){
$bulantext = 'Agustus';
}elseif($bulan==9){
$bulantext = 'September';
}elseif($bulan==10){
$bulantext = 'Oktober';
}elseif($bulan==11){
$bulantext = 'November';
}elseif($bulan==12){
$bulantext = 'Desember';
}
?>
<div class="mt-3">
<div>
<form action="" method="POST" class="needs-validation">
<div class="form-group">
<label for="bulan">Pilih Bulan</label>
<select name="bulan" class="form-control" id="bulan" onchange="this.form.submit()" required>
<?php foreach($bulan_list as $list) {?>
<option value="<?php echo $list['bulan'] ?>" <?php if($list['bulan']===$bulan){echo "selected";}?>>
<?php echo $list['text'] ?>
</option>
<?php } ?>
</select>
</div>
</form>
</div>
<div class="card">
<div class="card-header bg-primary text-white">
<div class="row">
<div class="col col-12 col-sm-12 col-md-8 col-lg-8">
<h6>Data UMKM Kota Magelang Bulan <?php echo $bulantext ?> <?php echo $tahun ?></h6>
</div>
<div class="col col-12 col-sm-12 col-md-4 col-lg-4 text-right">
<a href="<?php echo base_url('index.php/')?>admin/lapbulpdf?bulan=<?php echo $bulan ?>&tahun=<?php echo $tahun ?>" target="_blank" class="btn btn-sm btn-warning">Print / PDF</a>
<a href="<?php echo base_url('index.php/')?>admin/lapbulxls?bulan=<?php echo $bulan ?>&tahun=<?php echo $tahun ?>" target="_blank" class="btn btn-sm btn-success">Export Excel</a>
</div>
</div>
</div>
<?php if($msg!=='empty'){?>
<div class="card-body">
<div class="row">
<table class="table table-bordered table-sm text-center text-nowrap table-responsive-sm table-striped">
<thead class="">
<tr>
<th class="align-middle" colspan="3">Jumlah UMKM</th>
<th class="align-middle" colspan="3">Omset/Bulan</th>
</tr>
<tr>
<th><small>P</small></th>
<th><small>J</small></th>
<th><small>I</small></th>
<th><small>P</small></th>
<th><small>J</small></th>
<th><small>I</small></th>
</tr>
</thead>
<tbody>
<tr>
<td><small><?php echo $umkm_jen1 ?></small></td>
<td><small><?php echo $umkm_jen2 ?></small></td>
<td><small><?php echo $umkm_jen3 ?></small></td>
<td><small><?php echo rupiah($omset_bln_jen1) ?></small></td>
<td><small><?php echo rupiah($omset_bln_jen2) ?></small></td>
<td><small><?php echo rupiah($omset_bln_jen3) ?></small></td>
</tr>
</tbody>
<tfoot>
<tr>
<th class="align-middle" colspan="3"><small>Total</small></th>
<th class="align-middle" colspan="3"><small>Total</small></th>
</tr>
<?php
$umkm = $umkm_jen1+$umkm_jen2+$umkm_jen3;
$omset = $omset_bln_jen1+$omset_bln_jen2+$omset_bln_jen3;
?>
<tr>
<th class="align-middle" colspan="3" ><small><?php echo $umkm ?></small></th>
<th class="align-middle" colspan="3" ><small><?php echo rupiah($omset) ?></small></th>
</tr>
</tfoot>
</table>
</div>
<hr>
<div class="row">
<table class="table table-bordered table-sm text-center text-nowrap table-responsive-lg table-striped">
<thead class="">
<tr>
<th class="align-middle" colspan="3" rowspan="2">Aset</th>
<th class="align-middle" colspan="6" >Jumlah Naker</th>
</tr>
<tr>
<th colspan="2" ><small>P</small></th>
<th colspan="2" ><small>J</small></th>
<th colspan="2" ><small>I</small></th>
</tr>
<tr>
<th><small>P</small></th>
<th><small>J</small></th>
<th><small>I</small></th>
<th><small>L</small></th>
<th><small>P</small></th>
<th><small>L</small></th>
<th><small>P</small></th>
<th><small>L</small></th>
<th><small>P</small></th>
</tr>
</thead>
<tbody>
<tr>
<td><small><?php echo rupiah($aset_jen1) ?></small></td>
<td><small><?php echo rupiah($aset_jen2) ?></small></td>
<td><small><?php echo rupiah($aset_jen3) ?></small></td>
<td><small><?php echo $naker_jen1_l ?></small></td>
<td><small><?php echo $naker_jen1_p ?></small></td>
<td><small><?php echo $naker_jen2_l ?></small></td>
<td><small><?php echo $naker_jen2_p ?></small></td>
<td><small><?php echo $naker_jen3_l ?></small></td>
<td><small><?php echo $naker_jen3_p ?></small></td>
</tr>
</tbody>
<tfoot>
<tr>
<th class="align-middle" colspan="3"><small>Total</small></th>
<th class="align-middle" colspan="6"><small>Total</small></th>
</tr>
<?php
$naker = $naker_jen1_l+$naker_jen2_l+$naker_jen3_l;
$naker = $naker+$naker_jen1_p+$naker_jen2_p+$naker_jen3_p;
$aset = $aset_jen1+$aset_jen2+$aset_jen3;
?>
<tr>
<th class="align-middle" colspan="3" ><small><?php echo rupiah($aset) ?></small></th>
<th class="align-middle" colspan="6" ><small><?php echo $naker ?></small></th>
</tr>
</tfoot>
</table>
</div>
<hr>
<div class="row">
<table class="table table-bordered table-sm text-center text-nowrap table-responsive-sm table-striped">
<thead class="">
<tr>
<th class="align-middle" colspan="9" >Klasifikasi</th>
</tr>
<tr>
<th colspan="3" ><small>P</small></th>
<th colspan="3" ><small>J</small></th>
<th colspan="3" ><small>I</small></th>
</tr>
<tr>
<th><small>M</small></th>
<th><small>K</small></th>
<th><small>MN</small></th>
<th><small>M</small></th>
<th><small>K</small></th>
<th><small>MN</small></th>
<th><small>M</small></th>
<th><small>K</small></th>
<th><small>MN</small></th>
</tr>
</thead>
<tbody>
<tr>
<td><small><?php echo $umkm_jen1_ket1?></small></td>
<td><small><?php echo $umkm_jen1_ket2?></small></td>
<td><small><?php echo $umkm_jen1_ket3?></small></td>
<td><small><?php echo $umkm_jen2_ket1?></small></td>
<td><small><?php echo $umkm_jen2_ket2?></small></td>
<td><small><?php echo $umkm_jen2_ket3?></small></td>
<td><small><?php echo $umkm_jen3_ket1?></small></td>
<td><small><?php echo $umkm_jen3_ket2?></small></td>
<td><small><?php echo $umkm_jen3_ket3?></small></td>
</tr>
</tbody>
<tfoot>
<tr>
<th class="align-middle" colspan="3"><small>Mikro</small></th>
<th class="align-middle" colspan="3"><small>Kecil</small></th>
<th class="align-middle" colspan="3"><small>Menengah</small></th>
</tr>
<?php
$mikro = $umkm_jen1_ket1+$umkm_jen2_ket1+$umkm_jen3_ket1;
$kecil = $umkm_jen1_ket2+$umkm_jen2_ket2+$umkm_jen3_ket2;
$menengah = $umkm_jen1_ket3+$umkm_jen2_ket3+$umkm_jen3_ket3;
?>
<tr>
<th class="align-middle" colspan="3" ><small><?php echo $mikro ?></small></th>
<th class="align-middle" colspan="3" ><small><?php echo $kecil ?></small></th>
<th class="align-middle" colspan="3" ><small><?php echo $menengah ?></small></th>
</tr>
</tfoot>
</table>
</div>
</div>
<?php } else {?>
<div class="card-body text-center">
<img src="<?php echo base_url()?>assets/images/search.png" width="150" /><br>
<div class="alert alert-warning" role="alert">
Tidak ada <strong>laporan yang sudah dibuat</strong> saat ini.
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="<?php echo base_url()?>assets/js/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/jquery.dataTables.min.js"></script>
<script src="<?php echo base_url()?>assets/js/dataTables.bootstrap4.min.js"></script>
<script src="<?php echo base_url()?>assets/js/sweetalert.min.js"></script>
<script src="<?php echo base_url()?>assets/js/chart.js"></script>
<script>
var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ['Aset', 'Omset'],
datasets: [
{
label: '<?php echo $tahun ?>',
data: [<?php echo $aset_1 ?>, <?php echo $omset_1 ?>],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(255, 99, 132, 0.2)'
],
borderColor: [
'rgba(255, 99, 132, 1)',
'rgba(255, 99, 132, 1)'
],
borderWidth: 1
},
{
label: '<?php echo $tahun_0 ?>',
data: [<?php echo $aset_0 ?>, <?php echo $omset_0 ?>],
backgroundColor: [
'rgba(54, 162, 235, 0.2)',
'rgba(54, 162, 235, 0.2)'
],
borderColor: [
'rgba(54, 162, 235, 1)',
'rgba(54, 162, 235, 1)'
],
borderWidth: 1
}
]
},
options: {
scales: {
y: {
beginAtZero: true
}
}
}
});
</script>
<script>
var ctx = document.getElementById('myChart2').getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ['Jml UMKM', 'Tenaga Kerja', 'Mikro', 'Kecil','Menengah'],
datasets: [
{
label: '<?php echo $tahun ?>',
data: [<?php echo $umkm_1 ?>, <?php echo $naker_1 ?>, <?php echo $mikro_1 ?>, <?php echo $kecil_1 ?>, <?php echo $menengah_1 ?>],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(255, 99, 132, 0.2)'
],
borderColor: [
'rgba(255, 99, 132, 1)',
'rgba(255, 99, 132, 1)'
],
borderWidth: 1
},
{
label: '<?php echo $tahun_0 ?>',
data: [<?php echo $umkm_0 ?>, <?php echo $naker_0 ?>, <?php echo $mikro_0 ?>, <?php echo $kecil_0 ?>, <?php echo $menengah_0 ?>],
backgroundColor: [
'rgba(54, 162, 235, 0.2)',
'rgba(54, 162, 235, 0.2)'
],
borderColor: [
'rgba(54, 162, 235, 1)',
'rgba(54, 162, 235, 1)'
],
borderWidth: 1
}
]
},
options: {
scales: {
y: {
beginAtZero: true
}
}
}
});
</script>
<script>
$(document).ready(function() {
$('#tabeldata').DataTable();
} );
</script>
<script>
const element = document.querySelectorAll('#btn_hapus')
element.forEach(function(el){
el.addEventListener('click', function (e) {
e.preventDefault();
var urlToRedirect = e.currentTarget.getAttribute('href'); //use currentTarget because the click may be on the nested i tag and not a tag causing the href to be empty
console.log(urlToRedirect); // verify if this is the right URL
swal({
title: "Kamu yakin ?",
text: "Data yang dihapus tidak bisa dikembalikan.",
icon: "warning",
buttons: [
'Batal',
'Hapus'
],
dangerMode: true,
}).then(function(isConfirm) {
if (isConfirm) {
swal({
title: 'Berhasil',
text: 'Data berhasil terhapus',
icon: 'success'
}).then(function() {
window.location.href = urlToRedirect;
});
} else {
swal("Batal", "Data tidak terhapus.)", "error");
}
});
});
});
</script>
</body>
</html>