0% found this document useful (0 votes)
73 views5 pages

Index

The document appears to be PHP code that is: 1. Setting the timezone and greeting based on the current time 2. Querying a database to get user information 3. Checking if the user's anniversary date has passed and inserting cuti (leave) records into another database table if so
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views5 pages

Index

The document appears to be PHP code that is: 1. Setting the timezone and greeting based on the current time 2. Querying a database to get user information 3. Checking if the user's anniversary date has passed and inserting cuti (leave) records into another database table if so
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

1 <?phpinclude 'header.php'; ?

>
2 <div class= "main-panel" >
3 <div class= "container" >
4 <div class= "page-inner" >
5 <div class= "mt-2 mb-4" >
6 <?php
7 date_default_timezone_set ("Asia/Jakarta" );
8 $jamskg = date ('H:i' );
9 $tglskg = date ('Y-m-d' );
10 if ($jamskg > '05:30' && $jamskg < '10:00' ) {
11 $salam = 'Pagi' ;
12 } elseif ($jamskg >= '10:00' && $jamskg < '15:00' ) {
13 $salam = 'Siang' ;
14 } elseif ($jamskg < '18:00' ) {
15 $salam = 'Sore' ;
16 } else {
17 $salam = 'Malam' ;
18 }
19
20 $nomorid = $_SESSION['id' ];
21 $cekdata = mysqli_query ($koneksilog ,"SELECT * FROM user where user_id=$nomorid" );
22 while ($cd = mysqli_fetch_array ($cekdata )){
23 $user_nama = $cd ['user_nama' ];
24 $user_level = $cd ['user_level' ];
25 $user_tupoksi = $cd ['user_tupoksi' ];
26 $user_wtct = $cd ['user_wtct' ];
27 $user_cuti_tahunan = $cd ['user_cuti_tahunan' ];
28 }
29 if (strtotime ($tglskg ) >= strtotime ($user_wtct )){
30 if ($user_level != "THOS" and $user_level != "PKWT" and $user_level != "administrator" ){
31 if ($user_cuti_tahunan +12 > 24){
32 $upt_cuti = 24;
33 $kurang = $user_cuti_tahunan +12-24;
34 }
35 else {
36 $upt_cuti = $user_cuti_tahunan + 12;
37 $kurang = 0;
38 }
39 $sql2 ="INSERT INTO cuti_karyawan VALUES (NULL, '$user_nama', '$user_wtct', '', '', '', 'Cuti Tahunan Timbul', '12', '$us
er_wtct', '$user_wtct', 'Timbul 12', '', '12', '$kurang', '', '$upt_cuti', '', '', '', '')" ;
40 $query = mysqli_query ($koneksilog , $sql2 );
41 }
42 else {
43 $upt_cuti = 12;
44 if ($user_cuti_tahunan != 0){
45 $hangus =date ('Y-m-d' , strtotime ('-1 day' , strtotime ($user_wtct )));
46 $sql2 ="INSERT INTO cuti_karyawan VALUES (NULL, '$user_nama', '$user_wtct', '', '', '', 'Cuti Tahunan Hangus', '$user
_cuti_tahunan', '$hangus', '$hangus', 'Hangus', '', '', '$user_cuti_tahunan', '', '', '', '', '', '')" ;
47 $query = mysqli_query ($koneksilog , $sql2 );
48 $sql3 ="INSERT INTO cuti_karyawan VALUES (NULL, '$user_nama', '$user_wtct', '', '', '', 'Cuti Tahunan Timbul', '12', '$
user_wtct', '$user_wtct', 'Timbul 12', '', '12', '', '', '$upt_cuti', '', '', '', '')" ;
49 $query = mysqli_query ($koneksilog , $sql3 );
50 }
51 else {
52 $sql2 ="INSERT INTO cuti_karyawan VALUES (NULL, '$user_nama', '$user_wtct', '', '', '', 'Cuti Tahunan Timbul', '12', '$
user_wtct', '$user_wtct', 'Timbul 12', '', '12', '', '', '$upt_cuti', '', '', '', '')" ;
53 $query = mysqli_query ($koneksilog , $sql2 );
54 }
55 }
56 $upt_wtct = date ('Y-m-d' , strtotime ('+1 year' , strtotime ($user_wtct )));
57 $sql1 = "update user set user_cuti_tahunan = '$upt_cuti', user_wtct = '$upt_wtct' where user_id='$nomorid'" ;
58 $query = mysqli_query ($koneksilog , $sql1 );
59 }
60 else {
61 }
62 ?>
63 <h2 class= "text-black pb-2" >Selamat <?php echo $salam; ?>, <?php echo $user_nama." [".$user_level."/".$user_t
upoksi."]"; ?></h2>
C:\xampp\htdocs\trebor\admin\index.php: 1/5
64 </div>
65
66
67 <!-- Statistik START
68 <div class="row mt--2">
69 <div class="col-md-6">
70 <div class="card full-height">
71 <div class="card-body">
72 <div class="card-title">Overall statistics</div>
73 <div class="card-category">Disposisi yang belum dikerjakan</div>
74 <div class="d-flex flex-wrap justify-content-around pb-2 pt-4">
75 <div class="px-2 pb-2 pb-md-0 text-center">
76 <div id="circles-2"></div>
77 <h6 class="fw-bold mt-3 mb-0">SLA 10 HK</h6>
78 </div>
79 <div class="px-2 pb-2 pb-md-0 text-center">
80 <div id="circles-1"></div>
81 <h6 class="fw-bold mt-3 mb-0">SLA <5 HK</h6>
82 </div>
83 <div class="px-2 pb-2 pb-md-0 text-center">
84 <div id="circles-3"></div>
85 <h6 class="fw-bold mt-3 mb-0">SLA <2 HK</h6>
86 </div>
87 </div>
88 </div>
89 </div>
90 </div>
91 <div class="col-md-6">
92 <div class="card full-height">
93 <div class="card-body">
94 <div class="card-title">Realisasi Anggaran</div>
95 <div class="row py-3">
96 <div class="col-md-3 d-flex flex-column justify-content-around">
97 <div>
98 <h6 class="fw-bold text-uppercase text-success op-8">Anggaran</h6>
99 <h3 class="fw-bold">Rp9.782</h3>
100 </div>
101 <div>
102 <h6 class="fw-bold text-uppercase text-danger op-8">Realisasi</h6>
103 <h3 class="fw-bold">Rp1.248</h3>
104 </div>
105 </div>
106 <div class="col-md-9">
107 <div id="chart-container">
108 <canvas id="totalIncomeChart"></canvas>
109 </div>
110 </div>
111 </div>
112 </div>
113 </div>
114 </div>
115 </div>
116
117 <script>
118 Circles.create({
119 id:'circles-1',
120 radius:45,
121 value:60,
122 maxValue:100,
123 width:7,
124 text: 5,
125 colors:['#f1f1f1', '#FF9E27'],
126 duration:400,
127 wrpClass:'circles-wrp',
128 textClass:'circles-text',
129 styleWrapper:true,
130 styleText:true
131 })
C:\xampp\htdocs\trebor\admin\index.php: 2/5
132
133 Circles.create({
134 id:'circles-2',
135 radius:45,
136 value:70,
137 maxValue:100,
138 width:7,
139 text: 36,
140 colors:['#f1f1f1', '#2BB930'],
141 duration:400,
142 wrpClass:'circles-wrp',
143 textClass:'circles-text',
144 styleWrapper:true,
145 styleText:true
146 })
147
148 Circles.create({
149 id:'circles-3',
150 radius:45,
151 value:40,
152 maxValue:100,
153 width:7,
154 text: 12,
155 colors:['#f1f1f1', '#F25961'],
156 duration:400,
157 wrpClass:'circles-wrp',
158 textClass:'circles-text',
159 styleWrapper:true,
160 styleText:true
161 })
162
163 var totalIncomeChart = document.getElementById('totalIncomeChart').getContext('2d');
164
165 var mytotalIncomeChart = new Chart(totalIncomeChart, {
166 type: 'bar',
167 data: {
168 labels: ["Jn", "Fb", "Mr", "Ap", "M", "Jn", "Jl", "Ag", "Sp", "Ok", "N", "D"],
169 datasets : [{
170 label: "Realisasi",
171 backgroundColor: '#ff9e27',
172 borderColor: 'rgb(23, 125, 255)',
173 data: [212516, 339432, 292483, 285764, 419353, 380478, 307080, 261549, 459405, 554515, 742263, 0],
174 }],
175 },
176 options: {
177 responsive: true,
178 maintainAspectRatio: false,
179 legend: {
180 display: false,
181 },
182 scales: {
183 yAxes: [{
184 ticks: {
185 display: false //this will remove only the label
186 },
187 gridLines : {
188 drawBorder: false,
189 display : false
190 }
191 }],
192 xAxes : [ {
193 gridLines : {
194 drawBorder: false,
195 display : false
196 }
197 }]
198 },
199 }
C:\xampp\htdocs\trebor\admin\index.php: 3/5
200 });
201 </script>
202
203 Statistik END -->
204
205 <!-- Kalender Start -->
206 <div class="row">
207 <div class="col-md-12">
208 <div class="card">
209 <div class="card-header">
210 <div class="card-title">Kalender KOJK Jember</div>
211 </div>
212 <div class="card-body">
213 <?php
214 require_once ('bdd.php' );
215 $sql = "SELECT id, title, start, ket, end, color FROM events " ;
216 $req = $bdd ->prepare ($sql );
217 $req ->execute ();
218 $events = $req ->fetchAll ();
219 ?>
220 <div id= "calendar" ></div>
221 </div>
222 </div>
223 </div>
224 </div>
225 <script>
226 /* initialize the calendar
227 -----------------------------------------------------------------*/
228 $(document).ready(function () {
229 $('#calendar').fullCalendar({
230 header : {
231 left : 'prev,next today' ,
232 center : 'title' ,
233 right : 'month,agendaWeek,agendaDay,listWeek'
234 },
235 defaultDate: '<?php echo date('Y-m-d') ?>',
236 editable: true,
237 eventLimit: false, // allow "more" link when too many events
238 selectable: true,
239 selectHelper: true,
240 select: function(start, end) {
241
242 $('#ModalAdd #start').val(moment(start).format('YYYY-MM-DD HH:mm:ss'));
243 $('#ModalAdd #end').val(moment(end).format('YYYY-MM-DD HH:mm:ss'));
244 $('#ModalAdd').modal('show');
245 },
246 eventRender: function(event, element) {
247 element.bind ('dblclick', function() {
248 $('#ModalEdit #id').val(event.id);
249 $('#ModalEdit #title').val(event.title);
250 $('#ModalEdit #color').val(event.color);
251 $('#ModalEdit').modal('show');
252 });
253 },
254 eventDrop: function(event, delta, revertFunc) { // si changement de position
255
256 edit(event);
257
258 },
259 eventResize: function(event,dayDelta,minuteDelta,revertFunc) { // si changement de longueur
260
261 edit(event);
262
263 },
264 events: [
265 <?php foreach($events as $event):
266
267 $start = explode(" ", $event['start']);
C:\xampp\htdocs\trebor\admin\index.php: 4/5
268 $end = explode(" ", $event['end']);
269 if($start[1] == '00:00:00'){
270 $start = $start[0];
271 }else{
272 $start = $event['start'];
273 }
274 if($end[1] == '00:00:00'){
275 $end = $end[0];
276 }else{
277 $end = $event['end'];
278 }
279 ?>
280 {
281 id : '<?php echo $event['id']; ?>',
282 title: '<?php if($event['ket'] != "Libur" and $event['ket'] != ""){echo $event['title']." (".$event['ket'].")";} else{echo $
event['title'];} ?>',
283 start: '<?php echo $start; ?>',
284 end: '<?php echo $end; ?>',
285 color: '<?php echo $event['color']; ?>',
286 },
287 <?php endforeach; ?>
288 ]
289 });
290
291 function edit(event){
292 start = event .start.format ('YYYY-MM-DD HH:mm:ss');
293 if(event.end){
294 end = event .end.format ('YYYY-MM-DD HH:mm:ss');
295 }else{
296 end = start;
297 }
298
299 id = event .id;
300
301 Event = [];
302 Event[0] = id;
303 Event[1] = start;
304 Event[2] = end;
305
306 $.ajax({
307 url : 'editEventDate.php' ,
308 type : "POST" ,
309 data : {Event:Event},
310 success: function(rep) {
311 if(rep == 'OK'){
312 alert ('Saved');
313 }else{
314 alert ('Could not be saved. try again.');
315 }
316 }
317 });
318 }
319
320 });
321 </script>
322 <!-- Kalender END -->
323 </div>
324 </div>
325 <?phpinclude 'footer.php'; ?>

C:\xampp\htdocs\trebor\admin\index.php: 5/5

You might also like