Anda di halaman 1dari 36

BAB IV

IMPLEMENTASI SISTEM

4.1

Implementasi Basis Data


Tahap implementasi ini merupakan rangkaian pelaksanaan kegiatan yang

dilakukan setelah tahap perancangan selesai dilaksanakan. Tujuan yang ingin


dicapai adalah dapat dioperasikannya sistem yang sejak awal dibuat.
Adapun Sistem basis data yang akan diimplementasikan dapat dilihat dibawah ini:
Nama Database (Alias)

Pengarsipan

Nama File

users

Media Penyimpan

Harddisk

Primary Key

id

Secondary/Foreign

Struktur File

:
Tabel 4.1 File users

No

Field Name

Type

Size

*id

int

255

2
3
4
5

Username
Pasword
Level_id
Karyawan_id

varchar
varchar
int
int

255
255
255
255

Nama Database (Alias)

Pengarsipan

Nama File

karyawan

Media Penyimpan

Harddisk

Primary Key

id

Secondary/Foreign

Struktur File

:
Tabel 4.2 File karyawan

No

Field Name

Type

Size

id

int

255

Nik

varchar

255

Nama

varchar

255

Jenis_kelamin

varchar

255

Gol_darah

varchar

255

Agama

Varchar

255

Alamat

Text

Telepon

Varchar

255

Tempat_lahir

Varchar

255

10

Tanggal_lahir

Date

11

Status_kawin

Varchar

255

12

Tanggal_masuk

Date

13

Foto

text

Nama Database (Alias)

Pengarsipan

Nama File

level

Media Penyimpan

Harddisk

Primary Key

id

Secondary/Foreign

Struktur File

:
Tabel 4.3 File level

No
Field Name
Type
1
*id
int
2
nama
varchar
Nama Database (Alias) :
pengarsipan
Nama File

jenis_surat

Media Penyimpan

Harddisk

Primary Key

id

Secondary/Foreign

Struktur File

Size
255
255

Tabel 4.4 file jenis_surat


No
1
2
3

Field Name
*id
kode
nama

Type
int
varchar
varchar

Nama Database (Alias)

pengarsipan

Nama File

surat_masuk

Media Penyimpan

Harddisk

Primary Key

id

Secondary/Foreign

Struktur File

Tabel 4.5 File surat_masuk

Size
255
255
255

No

Field Name

Type

Size

*id

int

255

Nomer_surat

varchar

255

Nomer_agenda

varchar

255

pengirim

varchar

255

Tanggal_surat

date

Tanggal_terima

Date

Perihal

Varchar

255

Lampiran

Text

Disposisi

Varchar

255

10

Gamabar

Text

11

Sifat

Varchar

255

12

Jenis_surat_id

Int

255

13

Pegawai_id

Int

255

Nama Database (Alias)

pengarsipan

Nama File

surat_keluar

Media Penyimpan

Harddisk

Primary Key

id

Secondary/Foreign

Struktur File

:
Tabel 4.6 File surat_keluar

No

Field Name

Type

Size

*id

int

255

Nomer_surat

varchar

255

Nomer_agenda

varchar

255

pengirim

varchar

255

Tanggal_surat

date

Tanggal_terima

Date

Perihal

Varchar

255

Lampiran

Text

Disposisi

Varchar

255

10

Gamabar

Text

11

Sifat

Varchar

255

12

Jenis_surat_id

Int

255

13

Pegawai_id

Int

255

4.2

Implementasi Program

4.2.1

Tampilan Utama Menu Login

Gambar 4.1 Menu Login


<div class="col-md-4 col-md-offset-4">
<div class="panel panel-default form-login">
<header class="panel-heading text-center">
<img src="img/logo.jpg" alt="MTS SYAMSUL ULUM GUNUNGGURUH"
class="logo">
<h4 class="text-center">MTS SYAMSUL ULUM GUNUNGGURUH</h4>
</header>
<div class="panel-body">
<form action="index.php?menu=proses_login" class="form"
method="POST">
<div class="form-group">
<!-- <label for="username">Username</label> -->
<input type="text" name="username" class="form-control"
placeholder="Username" autocomplete="off">
</div>
<div class="form-group">
<!-- <label for="password">Password</label> -->
<input type="password" name="password" class="form-control"
placeholder="Password" autocomplete="off">
</div>
<div class="form-group text-right">
<button type="submit" class="btn btn-primary">Login</button>

</div>
</form>
</div>
<footer class="panel-footer text-center">
<strong>Form Login</strong>
</footer>
</div>
</div>
Proses
<?php
if (isset($_POST)) {
$username = $sql->real_escape_string($_POST['username']);
$password = $sql->real_escape_string($_POST['password']);
$query = 'select * from users where username = "'.$username.'"
and password = "'.md5($password).'"';
$res = $sql->query($query);
if ($res->num_rows > 0) {
$data = $res->fetch_assoc();
$_SESSION['username'] = $data['username'];
$_SESSION['id_level'] = $data['level_id'];
echo '
<script>
alert("Anda Berhasil Login");
document.location = "index.php?menu=home";
</script>
';
} else {
echo '
<script>
alert("Username Atau Password Anda Salah");
document.location = "index.php?menu=login";
</script>
';
}
}

4.2.2

Form Menu Program

Gambar 4.2 Tampilan Form Menu Program


<div class="col-md-12">
<div class="row">
<div class="col-md-4 col-md-offset-4 text-center">
<img src="img/logo.jpg" alt="MTS SYAMSUL ULUM
GUNUNGGURUH">
<h2>Selamat Datang</h2>
<!-- <div class="alert-info">Anda Login Sebagai
<strong><?php echo $_SESSION['username'] ?></strong></div> -->
</div>
</div>
</div>

4.2.3

Form input surat masuk

Gambar 4.3 Tampilan input Surat Masuk


<?php
$get = '';
if (isset($_GET)) {
$get = '';
foreach($_GET as $key=>$val) {
if ($key == 'menu') continue;
if ($key == 'halaman') continue;
if ($key == 'order') continue;
if ($key == 'sort') continue;
$get .= '&'.$key.'='.$val;
}
$get;
}
$where = 'where 1';
if (isset($_GET['search'])) {
$by = $sql->real_escape_string($_GET['by']);
$search = $sql->real_escape_string($_GET['search']);
switch ($by) {
case 'nomer_surat':
$by = 'surat_masuk.nomer_surat';
$op = ' like ';
$search = '%'.$search.'%';
break;
case 'nomer_agenda':
$by = 'surat_masuk.nomer_agenda';
$op = ' like ';
$search = '%'.$search.'%';
break;
case 'perihal':
$by = 'surat_masuk.perihal';
$op = ' like ';
$search = '%'.$search.'%';
break;
case 'lampiran':
$by = 'surat_masuk.lampiran';
$op = ' like ';
$search = '%'.$search.'%';
break;
}
$where .= ' and '.$by.' '.$op.' "'.$search.'" ';
}
$orderby = '';
if(isset($_GET['sort'])) {
$sort = $sql->real_escape_string(isset($_GET['sort']) ?
$_GET['sort'] : 'surat_masuk.id');

$order = $sql->real_escape_string(isset($_GET['order']) ?
$_GET['order'] : 'desc');
$orderby .= ' order by '.$sort.' '.$order.' ';
}
$limit = 15;
$halaman = 1;
if (isset($_GET['halaman'])) {
$halaman = $sql->real_escape_string($_GET['halaman']);
}
$offset = ($halaman - 1) * $limit;
$query = 'select surat_masuk.*, jenis_surat.id as id_jenis,
jenis_surat.nama as nama_jenis from surat_masuk
inner join jenis_surat on surat_masuk.jenis_surat_id =
jenis_surat.id
'.$where.' '.$orderby.' limit '.$offset.','.$limit;
$res = $sql->query($query);
$datas = $res->fetch_all(MYSQLI_ASSOC);
$total = $sql->query('select surat_masuk.id from surat_masuk
inner join jenis_surat on surat_masuk.jenis_surat_id = jenis_surat.id '.
$where);
$jumlah_halaman = ceil($total->num_rows/$limit);
?>
<h4 class="text-center">Surat Masuk</h4>
<h4 class="text-center">
<?php
$ket = '';
if (isset($_GET['by'])) $ket = 'Dengan Kata Kunci '.$sql>real_escape_string($_GET['search']);
?>
<small><?php echo $ket; ?></small>
</h4>
<div class="text-center">
<a href="index.php?menu=tambah_surat_masuk" class="btn
btn-success "><i class="glyphicon glyphicon-plus-sign"></i> Input
Baru</a>
<br><br>
<form class="form-horizontal" action="index.php"
method="GET">
<input type="hidden" name="menu" value="surat_masuk">
<div class="form-group">
<label for="by" class="control-label col-md-1 col-md-offset3">Pencarian</label>
<div class="col-md-2">

<select name="by" id="by" class="form-control">


<option value="nomer_surat">Nomer Surat</option>
<option value="nomer_agenda">Nomer
Agenda</option>
<option value="perihal">Perihal</option>
<option value="lampiran">Lampiran</option>
</select>
</div>
<div class="col-md-3">
<input type="text" name="search" class="form-control">
</div>
</div>
</form>
</div>
<?php
$order_column = (isset($_GET['order']) ? (($_GET['order'] ==
'asc') ? 'desc' : 'asc') : 'desc');
?>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th rowspan="2" class="text-center col-md-1">No</th>
<th class="text-center"><a href="index.php?
menu=surat_masuk&sort=surat_masuk.nomer_surat&order=<?php
echo $order_column.$get?>">Nomer Surat</a></th>
<th class="text-center"><a href="index.php?
menu=surat_masuk&sort=surat_masuk.nomer_agenda&order=<?php
echo $order_column.$get?>">Nomer Agenda</a></th>
<th class="text-center"><a href="index.php?
menu=surat_masuk&sort=surat_masuk.tanggal_surat&order=<?php
echo $order_column.$get?>">Tanggal Surat</a></th>
<th class="text-center"><a href="index.php?
menu=surat_masuk&sort=surat_masuk.perihal&order=<?php echo
$order_column.$get?>">Perihal</a></th>
<th class="text-center"><a href="index.php?
menu=surat_masuk&sort=surat_masuk.lampiran&order=<?php echo
$order_column.$get?>">Lampiran</a></th>
<th class="text-center"><a href="index.php?
menu=surat_masuk&sort=surat_masuk.disposisi&order=<?php echo
$order_column.$get?>">Disposisi</a></th>
<th class="text-center"><a href="index.php?
menu=surat_masuk&sort=surat_masuk.jenis_surat_id&order=<?php
echo $order_column.$get?>">Sifat</a></th>
<th rowspan="2" class="text-center col-md-1"></th>
</tr>
</thead>
<tbody>
<?php
$a = 1;

if ($res->num_rows > 0) {
foreach ($datas as $data) {
?>
<tr>
<td class="text-center"><?php echo $a++; ?></td>
<td class=""><?php echo $data['nomer_surat']; ?
></td>
<td class=""><?php echo $data['nomer_agenda']; ?
></td>
<td class=""><?php echo
DateTime::createFromFormat('Y-m-d', $data['tanggal_surat'])>format('d-m-Y'); ?></td>
<td class=""><?php echo $data['perihal']; ?></td>
<td class=""><?php echo $data['lampiran']; ?
></td>
<td class=""><?php echo $data['disposisi']; ?> <a
href="index.php?menu=disposisi&id=<?php echo $data['id'] ?>"
class="ttips" title="Buat Disposisi"><i class="glyphicon glyphiconupload"></i></a></td>
<td class=""><?php echo $data['sifat']; ?></td>
<td class="text-center">
<form action="index.php?
menu=hapus_surat_masuk<?php echo $get;?>" method="POST"
class="form-inline no-padding no-margin">
<a href="index.php?
menu=edit_surat_masuk&id=<?php echo $data['id']; ?><?php echo
$get; ?>" class="ttips btn btn-link" title="Edit"><i class="glyphicon
glyphicon-pencil"></i></a>
<input type="hidden" name="id" value="<?php
echo $data['id']; ?>">
<button type="submit" onclick="if( !
confirm('Pasien Akan Dihapus, Lanjutkan?')) { return false; }"
class="ttips btn btn-link" title="Hapus"><i class="glyphicon
glyphicon-trash"></i></button>
</form>
</td>
</tr>
<?php
}
} else {
?>
<tr>
<td colspan="9" class="text-center">Tidak Ada
Data</td>
</tr>
<?php
}
?>
</tbody>
</table>

<?php if ($jumlah_halaman > 0) { ?>


<nav class="text-center">
<ul class="pagination">
<?php for($a=1; $a<=$jumlah_halaman; $a++) { ?>
<li><a href="index.php?menu=surat_masuk&halaman=<?
php echo $a.$get; ?>"><?php echo $a; ?></a></li>
<?php } ?>
</ul>
</nav>
<?php } ?>

4.2.4

Form input surat keluar

Gambar 4.4 Tampilan Form input surat keluar


<?php
/* Mengambil parameter GET di URL */
$get = '';
if (isset($_GET)) {
$get = '';
foreach($_GET as $key=>$val) {
if ($key == 'menu') continue;
if ($key == 'halaman') continue;
if ($key == 'order') continue;
if ($key == 'sort') continue;
$get .= '&'.$key.'='.$val;
}
$get;

}
$where = 'where 1';
if (isset($_GET['search'])) {
$by = $sql->real_escape_string($_GET['by']);
$search = $sql->real_escape_string($_GET['search']);
switch ($by) {
case 'nomer_surat':
$by = 'surat_keluar.nomer_surat';
$op = ' like ';
$search = '%'.$search.'%';
break;
case 'nomer_agenda':
$by = 'surat_keluar.nomer_agenda';
$op = ' like ';
$search = '%'.$search.'%';
break;
case 'perihal':
$by = 'surat_keluar.perihal';
$op = ' like ';
$search = '%'.$search.'%';
break;
case 'lampiran':
$by = 'surat_keluar.lampiran';
$op = ' like ';
$search = '%'.$search.'%';
break;
}
$where .= ' and '.$by.' '.$op.' "'.$search.'" ';
}
$orderby = '';
if(isset($_GET['sort'])) {
$sort = $sql->real_escape_string(isset($_GET['sort']) ?
$_GET['sort'] : 'surat_keluar.id');
$order = $sql->real_escape_string(isset($_GET['order']) ?
$_GET['order'] : 'desc');
$orderby .= ' order by '.$sort.' '.$order.' ';
}
$limit = 15;
$halaman = 1;
if (isset($_GET['halaman'])) {
$halaman = $sql->real_escape_string($_GET['halaman']);
}
$offset = ($halaman - 1) * $limit;

$query = 'select surat_keluar.*, jenis_surat.id as id_jenis,


jenis_surat.nama as nama_jenis from surat_keluar
inner join jenis_surat on surat_keluar.jenis_surat_id =
jenis_surat.id
'.$where.' '.$orderby.' limit '.$offset.','.$limit;
$res = $sql->query($query);
$datas = $res->fetch_all(MYSQLI_ASSOC);
$total = $sql->query('select surat_keluar.id from surat_keluar
inner join jenis_surat on surat_keluar.jenis_surat_id = jenis_surat.id '.
$where);
$jumlah_halaman = ceil($total->num_rows/$limit);
?>
<h4 class="text-center">Surat Keluar</h4>
<h4 class="text-center">
<?php
$ket = '';
if (isset($_GET['by'])) $ket = 'Dengan Kata Kunci '.$sql>real_escape_string($_GET['search']);
?>
<small><?php echo $ket; ?></small>
</h4>
<div class="text-center">
<a href="index.php?menu=tambah_surat_keluar" class="btn btnsuccess "><i class="glyphicon glyphicon-plus-sign"></i> Input
Baru</a>
<br><br>
<form class="form-horizontal" action="index.php"
method="GET">
<input type="hidden" name="menu" value="surat_keluar">
<div class="form-group">
<label for="by" class="control-label col-md-1 col-md-offset3">Pencarian</label>
<div class="col-md-2">
<select name="by" id="by" class="form-control">
<option value="nomer_surat">Nomer Surat</option>
<option value="nomer_agenda">Nomer
Agenda</option>
<option value="perihal">Perihal</option>
<option value="lampiran">Lampiran</option>
</select>
</div>
<div class="col-md-3">
<input type="text" name="search" class="form-control">
</div>
</div>
</form>

</div>
<?php
$order_column = (isset($_GET['order']) ? (($_GET['order'] ==
'asc') ? 'desc' : 'asc') : 'desc');
?>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th rowspan="2" class="text-center col-md-1">No</th>
<th class="text-center"><a href="index.php?
menu=surat_keluar&sort=surat_keluar.nomer_surat&order=<?php
echo $order_column.$get?>">Nomer Surat</a></th>
<th class="text-center"><a href="index.php?
menu=surat_keluar&sort=surat_keluar.nomer_agenda&order=<?php
echo $order_column.$get?>">Nomer Agenda</a></th>
<th class="text-center"><a href="index.php?
menu=surat_keluar&sort=surat_keluar.tanggal_surat&order=<?php
echo $order_column.$get?>">Tanggal Surat</a></th>
<th class="text-center"><a href="index.php?
menu=surat_keluar&sort=surat_keluar.perihal&order=<?php echo
$order_column.$get?>">Perihal</a></th>
<th class="text-center"><a href="index.php?
menu=surat_keluar&sort=surat_keluar.lampiran&order=<?php echo
$order_column.$get?>">Lampiran</a></th>
<th class="text-center"><a href="index.php?
menu=surat_keluar&sort=surat_keluar.disposisi&order=<?php echo
$order_column.$get?>">Disposisi</a></th>
<th class="text-center"><a href="index.php?
menu=surat_keluar&sort=surat_keluar.jenis_surat_id&order=<?php
echo $order_column.$get?>">Sifat</a></th>
<th rowspan="2" class="text-center col-md-1"></th>
</tr>
</thead>
<tbody>
<?php
$a = 1;
if ($res->num_rows > 0) {
foreach ($datas as $data) {
?>
<tr>
<td class="text-center"><?php echo $a++; ?></td>
<td class=""><?php echo $data['nomer_surat']; ?
></td>
<td class=""><?php echo $data['nomer_agenda']; ?
></td>
<td class=""><?php echo
DateTime::createFromFormat('Y-m-d', $data['tanggal_surat'])>format('d-m-Y'); ?></td>
<td class=""><?php echo $data['perihal']; ?></td>

<td class=""><?php echo $data['lampiran']; ?


></td>
<td class=""><?php echo $data['disposisi']; ?> <a
href="index.php?menu=disposisi_keluar&id=<?php echo $data['id'] ?
>" class="ttips" title="Buat Disposisi"><i class="glyphicon glyphiconupload"></i></a></td>
<td class=""><?php echo $data['sifat']; ?></td>
<td class="text-center">
<form action="index.php?
menu=hapus_surat_keluar<?php echo $get;?>" method="POST"
class="form-inline no-padding no-margin">
<a href="index.php?
menu=edit_surat_keluar&id=<?php echo $data['id']; ?><?php echo
$get; ?>" class="ttips btn btn-link" title="Edit"><i class="glyphicon
glyphicon-pencil"></i></a>
<input type="hidden" name="id" value="<?php
echo $data['id']; ?>">
<button type="submit" onclick="if( !
confirm('Pasien Akan Dihapus, Lanjutkan?')) { return false; }"
class="ttips btn btn-link" title="Hapus"><i class="glyphicon
glyphicon-trash"></i></button>
</form>
</td>
</tr>
<?php
}
} else {
?>
<tr>
<td colspan="9" class="text-center">Tidak Ada
Data</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php if ($jumlah_halaman > 0) { ?>
<nav class="text-center">
<ul class="pagination">
<?php for($a=1; $a<=$jumlah_halaman; $a++) { ?>
<li><a href="index.php?menu=surat_keluar&halaman=<?
php echo $a.$get; ?>"><?php echo $a; ?></a></li>
<?php } ?>
</ul>
</nav>
<?php } ?

4.2.5

Form karyawan

Gambar 4.5 Tampilan karyawan


<?php
/* Mengambil parameter GET di URL */
$get = '';
if (isset($_GET)) {
$get = '';
foreach($_GET as $key=>$val) {
if ($key == 'menu') continue;
if ($key == 'halaman') continue;
if ($key == 'order') continue;
if ($key == 'sort') continue;
$get .= '&'.$key.'='.$val;
}
$get;
}
$where = 'where 1 ';
if (isset($_GET['search'])) {
$by = $sql->real_escape_string(isset($_GET['by']) ? $_GET['by']
: 'nama');
$search = $sql->real_escape_string($_GET['search']);
switch ($by) {
case 'nama':
$by = 'karyawan.nama';
$op = ' like ';
$search = '%'.$search.'%';
break;
case 'nik':
$by = 'karyawan.nik';
$op = ' like ';
$search = '%'.$search.'%';

break;
}
$where .= ' and '.$by.' '.$op.' "'.$search.'" ';
}
$orderby = '';
if(isset($_GET['sort'])) {
$sort = $sql>real_escape_string(isset($_GET['sort']) ? $_GET['sort'] :
'karyawan.nik');
$order = $sql>real_escape_string(isset($_GET['order']) ? $_GET['order'] : 'desc');
$orderby .= ' order by '.$sort.' '.$order.' ';
}
$limit = 15;
$halaman = 1;
if (isset($_GET['halaman'])) {
$halaman = $sql->real_escape_string($_GET['halaman']);
}
$offset = ($halaman - 1) * $limit;
$query = 'select karyawan.* from karyawan
'.$where.' '.$orderby.' limit '.$offset.', '.$limit;
$res = $sql->query($query);
$datas = $res->fetch_all(MYSQLI_ASSOC);
$total = $sql->query('select karyawan.id from karyawan '.
$where);
$jumlah_halaman = ceil($total->num_rows/$limit);
?>
<h4 class="text-center">Data Pegawai</h4>
<?php
if(isset($_GET['search'])) {
echo '<h4 class="text-center">Hasil Kata Kunci : '.
$_GET['search'].'</h4>';
}
?>
<div class="well">
<div class="pull-right">
<a href="index.php?menu=tambah_data_karyawan"
class="btn btn-primary btn-sm"><i class="glyphicon glyphiconplus"></i> Tambah Pegawai</a>
</div>
<form action="index.php">

<input type="hidden" name="menu" value="data_karyawan">


<input type="hidden" name="by" value="nama">
<div class="row">
<div class="col-md-2">
<select name="by" class="form-control input-sm">
<option value="nik">NIK</option>
<option value="nama">Nama</option>
</select>
</div>
<div class="col-md-4">
<input type="text" class="form-control input-sm"
name="search" value="<?php echo (isset($_GET['search']) ?
$_GET['search'] : '') ?>" placeholder="Pencarian . . .">
</div>
</div>
</form>
</div>
<?php
$order_column = (isset($_GET['order']) ? (($_GET['order']
== 'asc') ? 'desc' : 'asc') : 'desc');
?>
<table class="table table-bordered table-condensed table-striped">
<thead>
<tr>
<th class="text-center">No</th>
<th class="text-center"><a href="index.php?
menu=data_karyawan&sort=karyawan.nik&order=<?php echo
$order_column.$get?>">NIK</a></th>
<th class="text-center"><a href="index.php?
menu=data_karyawan&sort=karyawan.nama&order=<?php echo
$order_column.$get?>">Nama</a></th>
<th class="text-center"><a href="index.php?
menu=data_karyawan&sort=karyawan.jenis_kelamin&order=<?php
echo $order_column.$get?>">Jenis Kelamin</a></th>
<th class="text-center"><a href="index.php?
menu=data_karyawan&sort=karyawan.gol_darah&order=<?php echo
$order_column.$get?>">Gol Darah</a></th>
<th class="text-center"><a href="index.php?
menu=data_karyawan&sort=karyawan.agama&order=<?php echo
$order_column.$get?>">Agama</a></th>
<th class="text-center col-md-3"><a href="index.php?
menu=data_karyawan&sort=karyawan.alamat&order=<?php echo
$order_column.$get?>">Alamat</a></th>
<th class="text-center"><a href="index.php?
menu=data_karyawan&sort=karyawan.telepon&order=<?php echo
$order_column.$get?>">Telepon</a></th>
<th class="text-center">TTL</th>
<th class="text-center">Status Kawin</th>

<th class="text-center"><a href="index.php?


menu=data_karyawan&sort=karyawan.tanggal_masuk&order=<?php
echo $order_column.$get?>">Tanggal Masuk</a></th>
<th class="text-center"></th>
</tr>
</thead>
<tbody>
<?php if($res->num_rows > 0) { ?>
<?php
$a = 1;
foreach ($datas as $data) {
?>
<tr>
<td class="text-center"><?php echo $a++; ?></td>
<td><?php echo $data['nik'] ?></td>
<td><?php echo $data['nama'] ?></td>
<td><?php echo $data['jenis_kelamin'] ?></td>
<td><?php echo $data['gol_darah'] ?></td>
<td><?php echo $data['agama'] ?></td>
<td><?php echo $data['alamat'] ?></td>
<td><?php echo $data['telepon'] ?></td>
<td><?php echo $data['tempat_lahir'].',
'.DateTime::createFromFormat('Y-m-d', $data['tanggal_lahir'])>format('d-m-Y') ?></td>
<td><?php echo $data['status_kawin'] ?></td>
<td><?php echo DateTime::createFromFOrmat('Y-m-d',
$data['tanggal_masuk'])->format('d-m-Y') ?></td>
<td>
<form action="index.php?
menu=hapus_data_karyawan<?php echo $get ?>" class="form-inline
text-center" method="POST">
<a href="index.php?
menu=edit_data_karyawan&id=<?php echo $data['id'].$get ?>"
class="btn btn-link btn-xs ttips" title="Edit"><i class="glyphicon
glyphicon-pencil"></i></a>
<input type="hidden" name="id" value="<?php
echo $data['id'] ?>">
<button class="btn btn-link btn-xs ttips"
title="Hapus" onclick="if( ! confirm('Anda Yakin?')) { return false;}"><i
class="glyphicon glyphicon-trash"></i></button>
</form>
</td>
</tr>
<?php } ?>
<?php } else { ?>
<tr>
<td class="text-center" colspan="12">Tidak Ada
Data</td>
</tr>
<?php } ?>

</tbody>
</table>
<?php if ($jumlah_halaman > 0) { ?>
<nav class="text-center">
<ul class="pagination">
<!-- <li>
<a href="#" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
</li> -->
<?php for($a=1; $a<=$jumlah_halaman; $a++) { ?>
<li><a href="index.php?
menu=data_karyawan&halaman=<?php echo $a.$get; ?>"><?php
echo $a; ?></a></li>
<?php } ?>
<!-- <li>
<a href="#" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a>
</li> -->
</ul>
</nav>
<?php } ?>

4.2.6

Form jenis surat

Gambar 4.6 Tampilan Form jenis surat

<?php
/* Mengambil parameter GET di URL */
$get = '';
if (isset($_GET)) {
$get = '';
foreach($_GET as $key=>$val) {
if ($key == 'menu') continue;
if ($key == 'halaman') continue;
if ($key == 'order') continue;
if ($key == 'sort') continue;
$get .= '&'.$key.'='.$val;
}
$get;
}

$where = 'where 1';


if (isset($_GET['search'])) {
$by = $sql->real_escape_string($_GET['by']);
$search = $sql->real_escape_string($_GET['search']);
switch ($by) {
case 'nama':
$by = 'jenis_surat.nama';
$op = ' like ';
$search = '%'.$search.'%';
break;
}
$where .= ' and '.$by.' '.$op.' "'.$search.'" ';
}
$orderby = '';
if(isset($_GET['sort'])) {
$sort = $sql->real_escape_string(isset($_GET['sort']) ?
$_GET['sort'] : 'jenis_surat.id');

$order = $sql->real_escape_string(isset($_GET['order']) ?
$_GET['order'] : 'desc');
$orderby .= ' order by '.$sort.' '.$order.' ';
}
$limit = 15;
$halaman = 1;
if (isset($_GET['halaman'])) {
$halaman = $sql->real_escape_string($_GET['halaman']);
}
$offset = ($halaman - 1) * $limit;
$query = 'select jenis_surat.* from jenis_surat
'.$where.' '.$orderby.' limit '.$offset.','.$limit;
$res = $sql->query($query);
$datas = $res->fetch_all(MYSQLI_ASSOC);
$total = $sql->query('select jenis_surat.id from jenis_surat '.
$where);
$jumlah_halaman = ceil($total->num_rows/$limit);
?>
<h4 class="text-center">Jenis Surat</h4>
<?php if (isset($_GET['search'])) { ?>
<div class="text-center"><strong>Hasil Cari : <?php echo
$_GET['search']; ?></strong></div>
<?php } ?>
<div class="controls">
<a href="index.php?menu=tambah_jenis_surat" class="btn btnwarning btn-sm">Tambah Jenis Surat</a>
<form action="index.php" class="pull-right" method="GET">
<input type="hidden" name="menu" value="jenis_surat">
<input type="hidden" name="by" value="nama">
<div class="form-group">
<input type="text" name="search" id="search"
placeholder="Pencarian . . ." class="form-control input-sm">
</div>
</form>
</div>
<?php
$order_column = (isset($_GET['order']) ? (($_GET['order'] ==
'asc') ? 'desc' : 'asc') : 'desc');
?>
<table class="table table-bordered table-condensed table-striped">
<thead>
<th class="text-center col-md-1">No</th>

<th class="text-center"><a href="index.php?


menu=jenis_surat&sort=jenis_surat.nama&order=<?php echo
$order_column.$get?>">Nama</a></th>
<th class="text-center col-md-1"></th>
</thead>
<tbody>
<?php
$a = 1;
foreach ($datas as $data) {
?>
<tr>
<td class="text-center"><?php echo $a++; ?></td>
<td><?php echo $data['nama']; ?></td>
<td class="text-center">
<form action="index.php?menu=hapus_jenis_surat<?
php echo $get;?>" method="POST" class="form-inline no-padding nomargin">
<a href="index.php?menu=edit_jenis_surat&id=<?
php echo $data['id']; ?><?php echo $get; ?>" class="ttips btn btn-link"
title="Edit"><i class="glyphicon glyphicon-pencil"></i></a>
<input type="hidden" name="id" value="<?php
echo $data['id']; ?>">
<button type="submit" onclick="if( ! confirm('Pasien
Akan Dihapus, Lanjutkan?')) { return false; }" class="ttips btn btn-link"
title="Hapus"><i class="glyphicon glyphicon-trash"></i></button>
</form>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php if ($jumlah_halaman > 0) { ?>
<nav class="text-center">
<ul class="pagination">
<?php for($a=1; $a<=$jumlah_halaman; $a++) { ?>
<li><a href="index.php?menu=jenis_surat&halaman=<?
php echo $a.$get; ?>"><?php echo $a; ?></a></li>
<?php } ?>
</ul>
</nav>
<?php } ?>

4.2.7

Form users

Gambar 4.7 Tampilan Form users


<?php
/* Mengambil parameter GET di URL */
$get = '';
if (isset($_GET)) {
$get = '';
foreach($_GET as $key=>$val) {
if ($key == 'menu') continue;
if ($key == 'halaman') continue;
if ($key == 'order') continue;
if ($key == 'sort') continue;
$get .= '&'.$key.'='.$val;
}
$get;
}
$where = 'where 1';
if (isset($_GET['search'])) {
$by = $sql->real_escape_string($_GET['by']);
$search = $sql->real_escape_string($_GET['search']);
switch ($by) {
case 'nama':
$by = 'users.nama';
$op = ' like ';
$search = '%'.$search.'%';
break;
case 'username':
$by = 'users.username';
$op = ' like ';
$search = '%'.$search.'%';
break;
case 'nama_level':
$by = 'level.nama';
$op = ' like ';

$search = '%'.$search.'%';
break;
}
$where .= ' and '.$by.' '.$op.' "'.$search.'" ';
}
$orderby = '';
if(isset($_GET['sort'])) {
$sort = $sql->real_escape_string(isset($_GET['sort']) ?
$_GET['sort'] : 'users.id');
$order = $sql->real_escape_string(isset($_GET['order']) ?
$_GET['order'] : 'desc');
$orderby .= ' order by '.$sort.' '.$order.' ';
}
$limit = 15;
$halaman = 1;
if (isset($_GET['halaman'])) {
$halaman = $sql->real_escape_string($_GET['halaman']);
}
$offset = ($halaman - 1) * $limit;
$query = 'select users.*, level.id as id_level, level.nama as
nama_level from users
inner join level on users.level_id = level.id
'.$where.' '.$orderby.' limit '.$offset.','.$limit;
$res = $sql->query($query);
$datas = $res->fetch_all(MYSQLI_ASSOC);
$total = $sql->query('select users.id from users inner join level on
users.level_id = level.id '.$where);
$jumlah_halaman = ceil($total->num_rows/$limit);
?>
<h4 class="text-center">User</h4>
<?php if (isset($_GET['search'])) { ?>
<div class="text-center"><strong>Hasil Cari : <?php echo
$_GET['search']; ?></strong></div>
<?php } ?>
<div class="controls">
<a href="index.php?menu=tambah_user" class="btn btn-warning
btn-sm">Tambah User</a>
<form action="index.php" class="pull-right" method="GET">
<input type="hidden" name="menu" value="user">
<div class="form-group">
<div class="row">
<div class="col-md-4">

<select name="by" id="by" class="form-control inputsm">


<option value="username">Username</option>
<option value="nama_level">Level</option>
</select>
</div>
<div class="col-md-8">
<input type="text" name="search" id="search"
placeholder="Pencarian . . ." class="form-control input-sm">
</div>
</div>
</div>
</form>
</div>
<?php
$order_column = (isset($_GET['order']) ? (($_GET['order'] ==
'asc') ? 'desc' : 'asc') : 'desc');
?>
<table class="table table-bordered table-condensed table-striped">
<thead>
<th class="text-center col-md-1">No</th>
<th class="text-center col-md-4"><a href="index.php?
menu=user&sort=users.username&order=<?php echo $order_column.
$get?>">Username</a></th>
<th class="text-center col-md-2"><a href="index.php?
menu=user&sort=level.nama&order=<?php echo $order_column.
$get?>">Level</a></th>
<th class="text-center col-md-1"></th>
</thead>
<tbody>
<?php
$a = 1;
foreach ($datas as $data) {
?>
<tr>
<td class="text-center"><?php echo $a++; ?></td>
<td><?php echo $data['username'] ?></td>
<td><?php echo $data['nama_level'] ?></td>
<td class="text-center">
<form action="index.php?menu=hapus_user<?php
echo $get;?>" method="POST" class="form-inline no-padding nomargin">
<a href="index.php?menu=edit_user&id=<?php
echo $data['id']; ?><?php echo $get; ?>" class="ttips btn btn-link"
title="Edit"><i class="glyphicon glyphicon-pencil"></i></a>
<input type="hidden" name="id" value="<?php
echo $data['id']; ?>">

<button type="submit" onclick="if( ! confirm('Pasien


Akan Dihapus, Lanjutkan?')) { return false; }" class="ttips btn btn-link"
title="Hapus"><i class="glyphicon glyphicon-trash"></i></button>
</form>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php if ($jumlah_halaman > 0) { ?>
<nav class="text-center">
<ul class="pagination">
<?php for($a=1; $a<=$jumlah_halaman; $a++) { ?>
<li><a href="index.php?menu=user&halaman=<?php echo
$a.$get; ?>"><?php echo $a; ?></a></li>
<?php } ?>
</ul>
</nav>
<?php } ?>

4.2.8

Form Laporan surat Masuk

Gambar 4.8 Tampilan Form surat Masuk


<?php
$bulan = (isset($_GET['bulan']) ? $_GET['bulan'] : date('n'));
$tahun = (isset($_GET['tahun']) ? $_GET['tahun'] : date('Y'));
$query = 'select surat_masuk.*, jenis_surat.id as id_jenis, jenis_surat.nama as
nama_jenis from surat_masuk
inner join jenis_surat on surat_masuk.jenis_surat_id = jenis_surat.id
where MONTH(surat_masuk.tanggal_surat) = '.$bulan.'
and YEAR(surat_masuk.tanggal_surat) = '.$tahun.'
';
$res = $sql->query($query);

$data = $res->fetch_all(MYSQLI_ASSOC);
?>
<div class="row hidden-print">
<form action="index.php" method="GET" class="form-horizontal col-md-6 col-mdoffset-3">
<input type="hidden" name="menu" value="laporan_surat_masuk">
<div class="row">
<div class="col-md-5">
<select name="bulan" id="bulan" class="form-control input-sm">
<?php
$selected = '';
for($a=1; $a<=12; $a++) {
if ($a == $bulan) $selected = 'selected="selected"';
?>
<option value="<?php echo $a ?>" <?php echo $selected ?>><?php
echo $_master_bulan[$a-1] ?></option>
<?php
$selected = '';
}
?>
</select>
</div>
<div class="col-md-6">
<input type="text" name="tahun" id="tahun" class="form-control input-sm"
value="<?php echo $tahun ?>">
</div>
<div class="col-md-1">
<button type="submit" class="btn btn-primary"><i class="glyphicon
glyphicon-search"></i></button>
</div>
</div>
</form>
</div>
<h4 class="text-center">
<img src="img/logo.jpg" alt="MTS SYAMSUL ULUM GUNUNGGURUH"
class="" height="80px"> <br>
MTS SYAMSUL ULUM GUNUNGGURUH
</h4>
<hr>
<h4 class="text-center">Laporan Data Surat Masuk</h4>
<h5 class="text-center">Bulan <?php echo $_master_bulan[$bulan-1].' '.$tahun ?
></h5>
<table class="table table-bordered table-condensed table-striped">
<thead>
<tr>
<th class="text-center col-md-1">ID Surat</th>

<th class="text-center col-md-1">No Surat</th>


<th class="text-center col-md-1">Tanggal Surat</th>
<th class="text-center col-md-1">Tanggal Terima</th>
<th class="text-center col-md-3">Perihal</th>
<th class="text-center col-md-1">Sifat</th>
<th class="text-center col-md-1">Disposisi</th>
</tr>
</thead>
<tbody>
<?php
$a = 1;
foreach ($data as $item) {
?>
<tr>
<td class="text-center"><?php echo $item['id'] ?></td>
<td class="text-center"><?php echo $item['nomer_surat'] ?></td>
<td class="text-center"><?php echo DateTime::createFromFormat('Y-m-d',
$item['tanggal_surat'])->format('d-m-Y') ?></td>
<td class="text-center"><?php echo DateTime::createFromFormat('Y-m-d',
$item['tanggal_terima'])->format('d-m-Y') ?></td>
<td class="text-center"><?php echo $item['perihal'] ?></td>
<td class="text-center"><?php echo $item['sifat'] ?></td>
<td class="text-center"><?php echo $item['disposisi'] ?></td>
</tr>
<?php } ?>
<?php if ($res->num_rows == 0) { ?>
<tr>
<td colspan="7" class="text-center">Tidak Ada Data</td>
</tr>
<?php } ?>
</tbody>
</table>
Jumlah Surat Masuk : <?php echo $res->num_rows; ?>

4.2.9

Form Laporan surat keluar

Gambar 4.8 Tampilan Form surat keluar


<?php
$bulan = (isset($_GET['bulan']) ? $_GET['bulan'] : date('n'));
$tahun = (isset($_GET['tahun']) ? $_GET['tahun'] : date('Y'));
$query = 'select surat_keluar.*, jenis_surat.id as id_jenis,
jenis_surat.nama as nama_jenis from surat_keluar
inner join jenis_surat on surat_keluar.jenis_surat_id =
jenis_surat.id
where MONTH(surat_keluar.tanggal_surat) = '.$bulan.'
and YEAR(surat_keluar.tanggal_surat) = '.$tahun.'
';
$res = $sql->query($query);
$data = $res->fetch_all(MYSQLI_ASSOC);
?>
<div class="row hidden-print">
<form action="index.php" method="GET" class="form-horizontal
col-md-6 col-md-offset-3">
<input type="hidden" name="menu"
value="laporan_surat_keluar">
<div class="row">
<div class="col-md-5">
<select name="bulan" id="bulan" class="form-control
input-sm">
<?php
$selected = '';
for($a=1; $a<=12; $a++) {
if ($a == $bulan) $selected = 'selected="selected"';
?>
<option value="<?php echo $a ?>" <?php echo
$selected ?>><?php echo $_master_bulan[$a-1] ?></option>
<?php
$selected = '';
}
?>
</select>
</div>

<div class="col-md-6">
<input type="text" name="tahun" id="tahun"
class="form-control input-sm" value="<?php echo $tahun ?>">
</div>
<div class="col-md-1">
<button type="submit" class="btn btn-primary"><i
class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
</div>
<h4 class="text-center">
<img src="img/logo.jpg" alt="MTS SYAMSUL ULUM
GUNUNGGURUH" class="" height="80px"> <br>
MTS SYAMSUL ULUM GUNUNGGURUH
</h4>
<hr>
<h4 class="text-center">Laporan Data Surat Keluar</h4>
<h5 class="text-center">Bulan <?php echo $_master_bulan[$bulan1].' '.$tahun ?></h5>
<table class="table table-bordered table-condensed table-striped">
<thead>
<tr>
<th class="text-center col-md-1">ID Surat</th>
<th class="text-center col-md-1">No Surat</th>
<th class="text-center col-md-1">Tanggal Surat</th>
<th class="text-center col-md-1">Tanggal Kirim</th>
<th class="text-center col-md-3">Perihal</th>
<th class="text-center col-md-1">Sifat</th>
<th class="text-center col-md-1">Disposisi</th>
</tr>
</thead>
<tbody>
<?php
$a = 1;
foreach ($data as $item) {
?>
<tr>
<td class="text-center"><?php echo $item['id'] ?></td>
<td class="text-center"><?php echo $item['nomer_surat']
?></td>
<td class="text-center"><?php echo
DateTime::createFromFormat('Y-m-d', $item['tanggal_surat'])>format('d-m-Y') ?></td>
<td class="text-center"><?php echo
DateTime::createFromFormat('Y-m-d', $item['tanggal_kirim'])>format('d-m-Y') ?></td>

<td class="text-center"><?php echo $item['perihal'] ?


></td>
<td class="text-center"><?php echo $item['sifat'] ?
></td>
<td class="text-center"><?php echo $item['disposisi'] ?
></td>
</tr>
<?php } ?>
<?php if ($res->num_rows == 0) { ?>
<tr>
<td colspan="7" class="text-center">Tidak Ada
Data</td>
</tr>
<?php } ?>
</tbody>
</table>
Jumlah Surat Keluar : <?php echo $res->num_rows; ?>

BAB V
KESIMPULAN DAN SARAN

5.1 Kesimpulan
Aplikasi Sistem pengarsipan surat masuk dan keluar berbasis php pada
MTs Syamsul Ulum Gunugguruh sebagai usulan yang penulis ajukan, dapat
diambil kesimpulan bahwa :
1. Dengan dilakukannya pemakaian prosedur aplikasi pengarsipan
keluar masuk surat yang tepat, maka akan mendapatkan pengolahan
data yang terperinci.
2. Didalam perancangan program apikasi pengarsipan Surat masuk dan
surat keluar, telah disertakan database, sehingga tidak akan terjadi
kesalahan dalam proses input dan Output data surat.
3. Dengan diimplementasikannya program aplikasi pengarsipan surat
masuk dan suart keluar, maka akan terminimalisirnya keterlambatan
dalam pembuatan laporan.

5.2 Saran
Beberapa hal yang perlu penulis sarankan, khususnya dalam menjalankan
program aplikasi ini adalah sebagai berikut :

1. Sebaiknya bagian operator atau admin yang mengurus pengarsipan


surat masuk dan keluar ini mengetahui prosedur pengarsipan surat
keluar dan masuk yang telah dibuat
2. Dapat mengerti dan memahami perancangan sistem didalamnya.
3. Dalam mengimplementasikannya, sebaiknya data yang terdapat
dalam database selalu dibackup pada setiap dibutuhkan.