-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhandler.php
More file actions
131 lines (121 loc) · 4.64 KB
/
handler.php
File metadata and controls
131 lines (121 loc) · 4.64 KB
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
<?php
include "root.php";
if (isset($_GET['action'])) {
$action=$_GET['action'];
if ($action=="login") {
$root->login($_POST['username'],$_POST['pass']);
}
if ($action=="logout") {
session_start();
session_destroy();
$root->redirect("home.php");
}
if ($action=="terima_permintaan") {
$status='diterima';
$root->redirect("index.php");
// $root->aksi_edit_permintaan($_GET['id'],$status);
}
if ($action=="tolak_permintaan") {
$status='ditolak';
$root->aksi_edit_permintaan($_GET['id'],$status);
}
if ($action=="tambah_barang") {
$root->tambah_barang($_POST['kode_barang'],$_POST['nama_barang'],$_POST['stok'],$_POST['harga_jual'],$_POST['kategori'],$_POST['merk'],$_POST['user']);
}
if ($action=="tambah_kategori") {
$root->tambah_kategori($_POST['nama_kategori']);
}
if ($action=="hapus_kategori") {
$root->hapus_kategori($_GET['id_kategori']);
}
if ($action=="edit_kategori") {
$root->aksi_edit_kategori($_POST['id_kategori'],$_POST['nama_kategori']);
}
if ($action=="tambah_merk") {
$root->tambah_merk($_POST['nama_merk']);
}
if ($action=="hapus_merk") {
$root->hapus_merk($_GET['id_merk']);
}
if ($action=="edit_merk") {
$root->aksi_edit_merk($_POST['id_merk'],$_POST['nama_merk']);
}
if ($action=="hapus_barang") {
$root->hapus_barang($_GET['id_barang']);
}
if ($action=="tambah_permintaan_barang") {
$root->tambah_permintaan_barang($_POST['kode_barang'],$_POST['jumlah_permintaan'], $_POST['tgl_permintaan'], $_POST['ket_permintaan'],$_POST['kode_permintaan']);
}
if ($action=="edit_barang") {
$root->aksi_edit_barang($_POST['id_barang'],$_POST['kode_barang'],$_POST['nama_barang'],$_POST['stok'],$_POST['harga_jual'],$_POST['kategori'],$_POST['merk'],$_POST['user']);
}
if ($action=="tambah_supplier") {
$root->tambah_supplier($_POST['nama_sup'],$_POST['alamat'],$_POST['notlp']);
}
if ($action=="edit_supplier") {
$root->aksi_edit_supplier($_POST['nama_sup'],$_POST['alamat'],$_POST['notlp'],$_POST['id_sup']);
}
if ($action=="tambah_user") {
$root->tambah_user($_POST['username'],$_POST['password'],$_POST['nama'],$_POST['alamat'],$_POST['notlp'],$_POST['status']);
}
if ($action=="hapus_user") {
$root->hapus_user($_GET['id']);
}
if ($action=="edit_user") {
$root->aksi_edit_user($_POST['username'],$_POST['password'],$_POST['nama'],$_POST['alamat'],$_POST['notlp'],$_POST['id']);
}
if ($action=="edit_admin") {
$root->aksi_edit_admin($_POST['username'],$_POST['password']);
}
if ($action=="reset_admin") {
$pass=sha1("admin");
$q=$root->con->query("update user set username='admin',password='$pass',date_created=date_created where id='1'");
if ($q === TRUE) {
$root->alert("admin berhasil direset, username & password = 'admin'");
session_start();
session_destroy();
$root->redirect("index.php");
}
}
if ($action=="tambah_tempo") {
$root->tambah_tempo($_POST['id_barang'],$_POST['jumlah'],$_POST['trx']);
}
if ($action=="hapus_tempo") {
$root->hapus_tempo($_GET['id_tempo'],$_GET['id_barang'],$_GET['jumbel']);
}
if ($action=="selesai_transaksi") {
session_start();
$trx=date("d")."/RK/".$_SESSION['id']."/".date("y/h/i/s");
$query=$root->con->query("insert into transaksi set kode_kasir='$_SESSION[id]',total_bayar='$_POST[total_bayar]',no_invoice='$trx',nama_pembeli='$_POST[nama_pembeli]'");
$trx2=date("d")."/RK/".$_SESSION['id']."/".date("y");
$get1=$root->con->query("select * from transaksi where no_invoice='$trx'");
$datatrx=$get1->fetch_assoc();
$id_transaksi2=$datatrx['id_transaksi'];
$query2=$root->con->query("select * from tempo where trx='$trx2'");
while ($f=$query2->fetch_assoc()) {
$root->con->query("insert into sub_transaksi set id_barang='$f[id_barang]',id_transaksi='$id_transaksi2',jumlah_beli='$f[jumlah_beli]',total_harga='$f[total_harga]',no_invoice='$trx'");
}
$root->con->query("delete from tempo where trx='$trx2'");
$root->alert("Transaksi berhasil");
$root->redirect("transaksi.php");
}
if ($action=="delete_transaksi") {
$q1=$root->con->query("delete from transaksi where id_transaksi='$_GET[id]'");
$q2=$root->con->query("delete from sub_transaksi where id_transaksi='$_GET[id]'");
if ($q1===TRUE && $q2 === TRUE) {
$root->alert("Transaksi No $_GET[id] Berhasil Dihapus");
$root->redirect("laporan.php");
}
}
if ($action=="delete_permintaan_barang") {
$q3=$root->con->query("delete from permintaan where permintaan_id='$_GET[id]'");
$q4=$root->con->query("delete from detail_permintaan where permintaan_id='$_GET[id]'");
if ($q3===TRUE && $q4 === TRUE) {
$root->alert("Kode Permintaan $_GET[id] Berhasil Dihapus");
$root->redirect("list_permintaan.php");
}
}
}else{
echo "no direct script are allowed";
}
?>