-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathupdate_supplier.php
More file actions
181 lines (133 loc) · 6.76 KB
/
update_supplier.php
File metadata and controls
181 lines (133 loc) · 6.76 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
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
<?php
include_once("init.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>PDV Web - Update Supplier</title>
<!-- Stylesheets -->
<link rel="stylesheet" href="css/style.css">
<!-- Optimize for mobile devices -->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<!-- jQuery & JS files -->
<?php include_once("tpl/common_js.php"); ?>
<script src="js/script.js"></script>
<script src="js/update_supplier.js"></script>
</head>
<body>
<!-- TOP BAR -->
<?php include_once("tpl/top_bar.php"); ?>
<!-- end top-bar -->
<!-- HEADER -->
<div id="header-with-tabs">
<div class="page-full-width cf">
<?php require_once ("mainmenu.php");?>
<!-- end tabs -->
<!-- Change this image to your own company's logo -->
<!-- The logo will automatically be resized to 30px height. -->
<a href="#" id="company-branding-small" class="fr"><img src="<?php if (isset($_SESSION['logo'])) {
echo "upload/" . $_SESSION['logo'];
} else {
echo "upload/posnic.png";
} ?>" alt="PDV Web"/></a>
</div>
<!-- end full-width -->
</div>
<!-- end header -->
<!-- MAIN CONTENT -->
<div id="content">
<div class="page-full-width cf">
<div class="side-menu fl">
<h3>Gerenciar Fornecedores</h3>
<ul>
<li><a href="add_supplier.php">Adicionar Fornecedor</a></li>
<li><a href="view_supplier.php">Visualizar Fornecedor</a></li>
</ul>
</div>
<!-- end side-menu -->
<div class="side-content fr">
<div class="content-module">
<div class="content-module-heading cf">
<h3 class="fl">Atualizar Fornecedor</h3>
<span class="fr expand-collapse-text">CLIQUE PARA FECHAR</span>
<span class="fr expand-collapse-text initial-expand">CLIQUE PARA ABRIR</span>
</div>
<!-- end content-module-heading -->
<div class="content-module-main cf">
<form name="form1" method="post" id="form1" action="">
<table class="form" border="0" cellspacing="0" cellpadding="0">
<?php
if (isset($_POST['id'])) {
$id = mysqli_real_escape_string($db->connection, $_POST['id']);
$name = trim(mysqli_real_escape_string($db->connection, $_POST['name']));
$address = trim(mysqli_real_escape_string($db->connection, $_POST['address']));
$contact1 = trim(mysqli_real_escape_string($db->connection, $_POST['contact1']));
$contact2 = trim(mysqli_real_escape_string($db->connection, $_POST['contact2']));
if ($db->query("UPDATE supplier_details SET supplier_name ='$name',supplier_address='$address',supplier_contact1='$contact1',supplier_contact2='$contact2' where id='$id'"))
echo "<br><font color=green size=+1 >Fornecedor atualizado com sucesso!</font>";
else
echo "<br><font color=red size=+1 >Erro ao Gravar !</font>";
}
?>
<?php
if (isset($_GET['sid']))
$id = $_GET['sid'];
$line = $db->queryUniqueObject("SELECT * FROM supplier_details WHERE id=$id");
?>
<form name="form1" method="post" id="form1" action="">
<input name="id" type="hidden" value="<?php echo $_GET['sid']; ?>">
<tr>
<td>Nome:</td>
<td><input name="name" type="text" id="name" maxlength="200"
class="round default-width-input"onKeyPress="return ValidateAlpha(event)"
value="<?php echo $line->supplier_name; ?> "/></td>
<td><b>Contact</b><b>-1</b></td>
<td><input name="contact1" type="text" id="buyingrate" maxlength="20"
class="round default-width-input"onkeypress="return numbersonly(event)"
value="<?php echo $line->supplier_contact1; ?>"/></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Endereço:</td>
<td><textarea name="address" cols="15"
class="round full-width-textarea"><?php echo $line->supplier_address; ?></textarea>
</td>
<td><b>Contact</b><b>-2</b></td>
<td><input name="contact2" type="text" id="sellingrate" maxlength="20"
class="round default-width-input"onkeypress="return numbersonly(event)"
value="<?php echo $line->supplier_contact2; ?>"/></td>
</tr>
<tr>
<td>
</td>
<td>
<input class="button round blue image-right ic-add text-upper" type="submit"
name="Submit" value="Gravar">
<b>(Control + S)</b>
</td>
<td align="right"><input class="button round red text-upper" type="reset"
name="Reset" value="Limpar"></td>
</tr>
</table>
</form>
</div>
<!-- end content-module-main -->
</div>
<!-- end content-module -->
</div>
<!-- end full-width -->
</div>
<!-- end content -->
<!-- FOOTER -->
<div id="footer">
<p>Nome da Empresa - www.nomedaempresa.com.br</a>.
</p>
</div>
<!-- end footer -->
</body>
</html>