-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcost_detail.php
187 lines (171 loc) · 4.88 KB
/
cost_detail.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
<!DOCTYPE html>
<?php if(isset($_POST['detail']) or isset($_POST['submit']) or isset($_POST['change_data'])){ ?>
<html lang="en" class="no-js">
<head>
<?php
$header = 20;
$subheader = "Cost";
include "desaign/configuration.php";
include "desaign/databases.php";
include "desaign/title.php" ;
include "desaign/css.php";
include "desaign/session.php";
$id = $_POST['id'];
$cost = $conf->get_cost($con,1,$id);
$list_cost = mysqli_fetch_assoc($cost);
$readonly = "disabled";
$name_input = "change_data";
$Input = "Change Data";
$id_hidden = "<input type='hidden' name='id' value='$id'/>";
if(isset($_POST['change_data'])){
$readonly = "";
$name_input = "submit";
$Input = "Save Data";
}
if(isset($_POST['submit'])){
$type_cost = $_POST['type_cost'];
$cost = $_POST['cost'];
$status = $_POST['status'];
$update = $conf->upd_cost($con, $type_cost, $cost,$status,$id);
if(update){
$keterangan = "success";
} else {
$keterangan = "gagal";
}
}
?>
</head>
<body class="page-header-fixed page-quick-sidebar-over-content page-sidebar-closed-hide-logo page-container-bg-solid">
<?php
include "desaign/nav_header.php";
?>
<div class="clearfix">
</div>
<!-- BEGIN CONTAINER -->
<div class="page-container">
<?php
include "desaign/menu.php";
?>
<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
<div class="page-content">
<!-- BEGIN PAGE HEADER-->
<div class="page-bar">
<ul class="page-breadcrumb">
<li>
<i class="fa fa-home"></i>
<a href="dashboard.php">Dashboard</a>
<i class="fa fa-angle-right"></i>
</li>
<li>
<a href="cost_list.php">Cost Detail</a>
</li>
</ul>
</div>
<div class="row">
<div class="portlet box green ">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-money"></i> Cost Detail
</div>
</div>
<div class="portlet-body form">
<?php if($keterangan == "success"){ ?>
<div class="alert alert-success display-show">
<button class="close" data-close="alert"></button>
<span>
Your Data Has Been Update, Thank You</span>
</div>
<?php echo "<script>window.setTimeout(function () {location.href='cost_list.php';}, 700);</script>";
} else if($keterangan == "gagal"){
?>
<div class="alert alert-danger display-show">
<button class="close" data-close="alert"></button>
<span>
Oooppss, data not match, please cek again</span>
</div>
<?php
} else {
}
?>
<form class="form-horizontal" action="" method="post" role="form">
<div class="form-body">
<div class="form-group">
<div class="col-md-2">
<label class="control-label" >Type Cost</label>
</div>
<div class="col-md-2">
<select required class="form-control" <?php echo $readonly ?> name="type_cost" >
<?php
$get_type_cost = $conf->get_type_cost($con);
while ($row = mysqli_fetch_assoc($get_type_cost)){
$selected = "";
if($list_cost['id_type']==$row['id']){
$selected = "selected";
}
?>
<option value="<?php echo $row['id'] ?>" <?php echo $selected ?>><?php echo $row['name'] ?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="form-group">
<div class="col-md-2">
<label class="control-label" >Cost</label>
</div>
<div class="col-md-3">
<input name="cost" required <?php echo $readonly ?> value="<?php echo $list_cost['cost'] ?>" type="number" autocomplete="off" class="form-control">
<?php echo $id_hidden; ?>
</div>
</div>
<div class="form-group">
<div class="col-md-2">
<label class="control-label">Status</label>
</div>
<div class="col-md-2">
<select class="form-control" <?php echo $readonly ?> name="status" >
<?php
$get_status_cost = $conf->get_status_cost($con);
while ($row = mysqli_fetch_assoc($get_status_cost)){
$selected = "";
if($list_cost['id_status']==$row['id']){
$selected = "selected";
}
?>
<option value="<?php echo $row['id'] ?>" <?php echo $selected ?>><?php echo $row['name'] ?></option>
<?php
}
?>
</select>
</div>
</div>
</div>
<div class="form-actions">
<div class="col-md-offset-3 col-md-9">
<button type="submit" name="<?php echo $name_input ?>" value="1" class="btn green"><?php echo $Input ?></button>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- END PAGE HEADER-->
<!-- BEGIN DASHBOARD STATS -->
<div class="row">
</div>
</div>
</div>
<!-- END CONTENT -->
</div>
<!-- END CONTAINER -->
<!-- BEGIN FOOTER -->
<?php
include "desaign/copyright2.php";
include "desaign/script.php";
?>
</body>
<!-- END BODY -->
</html>
<?php } ?>