-
Notifications
You must be signed in to change notification settings - Fork 0
/
act-kamar.php
44 lines (38 loc) · 1.1 KB
/
act-kamar.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
<?php
//print_r($_POST);
require('./lib/class.kamar.inc.php');
$kamar = new kamar();
if($_GET['mod']=='ins'){
$nkmr = $kamar->kokam($_POST['kdGedung'],$_POST['nmrKamar']);
$sets = 'kodeKamar,kodeGedung,nomorKamar,dayaTampung,kelasTarif';
$data = array($nkmr,$_POST['kdGedung'],$_POST['nmrKamar'],$_POST['capacity'],$_POST['klTarif']);
$kamar->insert('kamar',$sets,$data);
$kamar->tambahKamar($_POST['kdGedung']);
$obj = 'gedung';
}
if($_GET['mod']=='fit'){
$i=0;
while($i<count($_POST['capa'])){
$i++;
$sets = 'dayaTampung,kelasTarif';
$data = array($_POST['capa'][$i],$_POST['kelas'][$i],$_POST['kdkm'][$i]);
$key = 'kodeKamar';
$kamar->update('kamar',$sets,$data,$key);
}
$obj='gedung';
}
if($_GET['mod']=='upd'){
$kdkm = $_POST['kdGedung'].sprintf("%03d",$_POST['nmrKamar']);
$sets = 'kodeGedung,nomorKamar,dayaTampung,kelasTarif';
$data = array($_POST['kdGedung'],$_POST['nmrKamar'],
$_POST['capacity'],$_POST['klTarif'],$kdkm);
$key = 'kodeKamar';
$kamar->update('kamar',$sets,$data,$key);
$obj = 'kamar';
}
echo "
<script>
window.location='./?menu=$obj';
</script>
";
?>