-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpemasukkan.php
415 lines (380 loc) · 13.4 KB
/
pemasukkan.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
<?php
session_start();
require "function/functions.php";
// session dan cookie multilevel user
if(isset($_COOKIE['login'])) {
if ($_COOKIE['level'] == 'user') {
$_SESSION['login'] = true;
$ambilNama = $_COOKIE['login'];
}
elseif ($_COOKIE['level'] == 'admin') {
$_SESSION['login'] = true;
header('Location: administrator');
}
}
elseif ($_SESSION['level'] == 'user') {
$ambilNama = $_SESSION['user'];
}
else {
if ($_SESSION['level'] == 'admin') {
header('Location: administrator');
exit;
}
}
if(empty($_SESSION['login'])) {
header('Location: login');
exit;
}
$month = date('m');
$day = date('d');
$year = date('Y');
$today = $year . '-' . $month . '-' . $day;
$pemasukkan = query("SELECT * FROM pemasukkan WHERE tanggal = '$today' AND username = '$ambilNama'");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="shortcut icon" href="img/icon.png">
<title>Catatankas - Pemasukan</title>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-reboot.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/"
crossorigin="anonymous">
<link rel="stylesheet" href="css/styler.css?v=1.0">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css">
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/sweetalert.min.js"></script>
<style>
</style>
</head>
<body>
<div class="header">
<img src="img/icon.png" width="25px" height="25px" class="float-left logo-fav">
<h3 class="text-secondary font-weight-bold float-left logo">Catatankas</h3>
<!-- <h3 class="text-secondary float-left logo2">- Qu</h3> -->
<a href="logout">
<div class="logout">
<i class="fas fa-sign-out-alt float-right log"></i>
<p class="float-right logout">Logout</p>
</div>
</a>
</div>
<div class="sidebar">
<nav>
<ul>
<li>
<img src="img/user.png" class="img-fluid profile float-left" width="60px">
<h5 class="admin"><?= substr($ambilNama, 0, 7) ?></h5>
<div class="online online2">
<p class="float-right ontext">Online</p>
<div class="on float-right"></div>
</div>
</li>
<!-- fungsi slide -->
<script>
$(document).ready(function(){
$("#flip").click(function(){
$("#panel").slideToggle("medium");
$("#panel2").slideToggle("medium");
});
$("#flip2").click(function(){
$("#panel3").slideToggle("medium");
$("#panel4").slideToggle("medium");
});
});
</script>
<!-- dashboard -->
<a href="dashboard" style="text-decoration: none;">
<li>
<div>
<span class="fas fa-tachometer-alt"></span>
<span>Dashboard</span>
</div>
</li>
</a>
<!-- data -->
<li class="klik" id="flip" style="cursor:pointer;">
<div>
<span class="fas fa-database"></span>
<span>Data Harian</span>
<i class="fas fa-caret-up float-right" style="line-height: 20px;"></i>
</div>
</li>
<a href="pemasukkan" class="linkAktif">
<li id="panel" class="aktif" style="border-left: 5px solid #306bff;">
<div style="margin-left: 20px;">
<span><i class="fas fa-file-invoice-dollar"></i></span>
<span>Data Pemasukkan</span>
</div>
</li>
</a>
<a href="pengeluaran" class="linkAktif">
<li id="panel2">
<div style="margin-left: 20px;">
<span><i class="fas fa-hand-holding-usd"></i></span>
<span>Data Pengeluaran</span>
</div>
</li>
</a>
<!-- data -->
<!-- Input -->
<li class="klik2" id="flip2" style="cursor:pointer;">
<div>
<span class="fas fa-plus-circle"></span>
<span>Input Data</span>
<i class="fas fa-caret-right float-right" style="line-height: 20px;"></i>
</div>
</li>
<a href="tambahPemasukkan" class="linkAktif">
<li id="panel3" style="display: none;">
<div style="margin-left: 20px;">
<span><i class="fas fa-file-invoice-dollar"></i></span>
<span>Pemasukkan</span>
</div>
</li>
</a>
<a href="tambahPengeluaran" class="linkAktif">
<li id="panel4" style="display: none;">
<div style="margin-left: 20px;">
<span><i class="fas fa-hand-holding-usd"></i></span>
<span>Pengeluaran</span>
</div>
</li>
</a>
<!-- Input -->
<!-- laporan -->
<a href="laporan" style="text-decoration: none;">
<li>
<div>
<span><i class="fas fa-clipboard-list"></i></span>
<span>Laporan</span>
</div>
</li>
</a>
<!-- change icon -->
<script>
$(".klik").click(function () {
$(this).find('i').toggleClass('fa-caret-up fa-caret-right');
if ($(".klik").not(this).find("i").hasClass("fa-caret-right")) {
$(".klik").not(this).find("i").toggleClass('fa-caret-up fa-caret-right');
}
});
$(".klik2").click(function () {
$(this).find('i').toggleClass('fa-caret-up fa-caret-right');
if ($(".klik2").not(this).find("i").hasClass("fa-caret-right")) {
$(".klik2").not(this).find("i").toggleClass('fa-caret-up fa-caret-right');
}
});
</script>
<!-- change icon -->
</ul>
</nav>
</div>
<div class="main-content khusus">
<div class="konten khusus2">
<div class="konten_dalem khusus3">
<h2 class="head" style="color: #4b4f58;">Pemasukkan</h2>
<hr style="margin-top: -2px;">
<!-- bagian filter dan pencarian -->
<div class="row cari-filter">
<div class="col-lg-5">
<table class="tabel-data">
<tr>
<td><label>Pilih tanggal</label></td>
<td style="width: 71%">
<input type="date" value="<?= $today ?>" class="form-control filter" id="filter">
</td>
</tr>
</table>
</div>
<div class="col-lg-4">
<input type="hidden" id="username" value="<?= $ambilNama ?>">
</div>
<div class="col-lg-3">
<div class="input-group">
<input type="text" name="cari" class="form-control border-right-0 cari" id="keyword" placeholder="Search" autocomplete="off">
<div class="input-group-append">
<span class="input-group-text bg-white border-left-0 icone"><i class="fa fa-search"></i></span>
</div>
</div>
</div>
</div>
<!-- bagian filter dan pencarian -->
<!-- bagian isi tabel -->
<div class="headline">
<h5>Data Pemasukkan</h5>
</div>
<div class="container" id="container">
<div class="row tampil" id="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-sm table-hover table-striped table-bordered">
<tr>
<th>No.</th>
<th>Tanggal</th>
<th>Keterangan Pemasukkan</th>
<th>Sumber Pemasukkan</th>
<th>Jumlah Pemasukkan</th>
<th>Aksi</th>
</tr>
<?php $i = 1; ?>
<?php foreach ($pemasukkan as $row) : ?>
<tr class="show" id="<?= $row['id'] ?>">
<td> <?= $i ?> </td>
<td data-target="tanggal"><?= htmlspecialchars($row['tanggal']) ?></td>
<td data-target="keterangan"><?= htmlspecialchars($row['keterangan']) ?></td>
<td data-target="sumber"><?= htmlspecialchars($row['sumber']) ?></td>
<td data-target="jumlahMasuk"><?= htmlspecialchars($row['jumlah']) ?></td>
<td>
<a href="#" id="<?= $row['id']; ?>" class="btn btn-info delete">
<i class="fas fa-trash-alt"></i>
</a>
<a href="#" data-id="<?= $row['id']; ?>" data-role="update" class="btn btn-outline-secondary" id="openBtn">
<i class="fas fa-edit"></i>
</a>
</td>
</tr>
<?php
$jumlah2[] = $row["jumlah"];
$jumlahConvert = str_replace('.', '', $jumlah2);
$totali = array_sum($jumlahConvert);
$hasilJumlah = number_format($totali, 0, ',', '.');
?>
<?php $i++ ?>
<?php endforeach; ?>
<?php if(isset($jumlah2) != null) :?>
<tr>
<td colspan="4">Total Pemasukkan</td>
<td id="total" data-target="total"><?= $hasilJumlah ?></td>
</tr>
<?php endif; ?>
</table>
</div>
</div>
</div>
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary btn2" data-toggle="modal" data-target="#exampleModalCenter">
<i class=" fas fa-hand-holding-usd"></i> Tambah Data
</button>
</div>
<!-- bagian isi tabel -->
</div>
</div>
</div>
<!-- Modal Tambah Data -->
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalCenterTitle">Tambah Data Pemasukkan</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<!-- isi form -->
<div class="modal-body">
<script type="text/javascript" src="js/pisahTitik.js"></script>
<div class="form-group">
<label>Masukkan Tanggal</label>
<input type="date" value="<?= $today ?>" name="tanggal" class="form-control" id="tanggalTambah" required>
</div>
<div class="form-group">
<label>Masukkan Keterangan Pemasukkan</label>
<input type="text" name="keterangan" class="form-control" id="keteranganTambah" required>
</div>
<div class="form-group">
<label>Masukkan Sumber Pemasukkan</label>
<select name="sumber" class="form-control" id="sumberTambah">
<option>ATM</option>
<option>Pemberian</option>
<option>Piutang</option>
<option>Laba penjualan</option>
<option>Pekerjaan</option>
<option>Lain - lain</option>
</select>
</div>
<div class="form-group">
<label>Masukkan Jumlah Pemasukkan</label>
<input type="text" id="jumlahTambah" name="jumlah" class="form-control" onkeydown="return numbersonly(this, event);"
onkeyup="javascript:tandaPemisahTitik(this);" required>
</div>
</div>
<!-- footer form -->
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
<button type="submit" class="btn btn-primary tambahin">Tambah</button>
</div>
</div>
</div>
</div>
<!-- Modal Tambah Data -->
<!-- Modal edit data -->
<div class="modal fade" id="myModal2" data-backdrop="static">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalCenterTitle">Ubah Data Pemasukkan</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<!-- isi form -->
<div class="modal-body">
<input type="hidden" id="userId" class="form-control">
<div class="form-group">
<label for="tanggal">Tanggal</label>
<input type="date" class="form-control" id="tanggal" required>
</div>
<div class="form-group">
<label for="keterangan">Keterangan Pemasukkan</label>
<input type="text" class="form-control" id="keterangan" required>
</div>
<div class="form-group">
<label for="sumber">Sumber Pemasukkan</label>
<select class="form-control" id="sumber">
<option>ATM</option>
<option>Pemberian</option>
<option>Piutang</option>
<option>Laba penjualan</option>
<option>Pekerjaan</option>
<option>Lain - lain</option>
</select>
</div>
<div class="form-group">
<label for="jumlahMasuk">Jumlah Pemasukkan</label>
<input type="text" class="form-control" id="jumlahMasuk" onkeydown="return numbersonly(this, event);"
onkeyup="javascript:tandaPemisahTitik(this);" required>
</div>
</div>
<!-- footer form -->
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
<a href="#" id="save" class="btn btn-primary">simpan</a>
</div>
</div>
</div>
</div>
<!-- Modal edit data -->
<!-- double modal -->
<script>
$('#openBtn').click(function () {
$('#myModal2').modal({
show: true
});
})
</script>
<script src="js/bootstrap.js"></script>
<script src="ajax/js/filterPemasukkan.js"></script>
<script src="ajax/js/tambahPemasukkan.js"></script>
<script src="ajax/js/deletePemasukkan.js"></script>
<script src="ajax/js/cariPemasukkan.js"></script>
<script src="ajax/js/updatePemasukkan.js"></script>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js"></script>
</body>
</html>