-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathquote.php
executable file
·88 lines (87 loc) · 3.5 KB
/
quote.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
<?php
/*
* quote.php
*
* Copyright 2018 Krzysztof Hrybacz <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
?>
<?php
require('template_begin.php');
if ($_GET['id']!='') {
$result = mysqli_query($link,'SELECT * FROM `' . $_SESSION['company'] . '_quotes` WHERE id=' . $_GET['id'] . ';');
$quote = mysqli_fetch_array($result);
}
?>
<form action="quoteedit.php" method="POST">
<input type="hidden" name="id" value="<?php echo $quote['id']; ?>" />
<table>
<tr><td>Quote ID:<br /><input type="text" name="quoteid" value="<?php if ($quote['quoteid']!='') echo $quote['quoteid']; ?>" /></td>
<td>Date of creation:<br /><div class="field"><?php if ($quote['creation']!='') echo $quote['creation']; else echo date('Y-m-d'); ?> </div></td></tr>
<?php
$result = mysqli_query($link,'SELECT * FROM `' . $_SESSION['company'] . '_clients` WHERE id=' . $quote['client'] . ';');
$client = mysqli_fetch_array($result);
$result = mysqli_query($link,'SELECT * FROM `' . $_SESSION['company'] . '_clients` ORDER BY company,fullname;');
?>
<tr><td>Company:<br />
<input type="text" name="clientname" list="clients" onchange="phone(this);" value="<?php
if ($client['company']!='')
echo $client['company'];
else
echo $client['fullname'];
?>">
<datalist id="clients">
<?php
while ($client = mysqli_fetch_array($result)) {
if ($client['company']!='')
echo '<option>' . $client['company'] . '</option>';
else
echo '<option>' . $client['fullname'] . '</option>';
}
?>
</datalist></td>
<?php
$result = mysqli_query($link,'SELECT * FROM `' . $_SESSION['company'] . '_clients` WHERE id=' . $quote['client'] . ';');
$client = mysqli_fetch_array($result);
?>
<td>Client mobile:<br /><div id="phone" class="field"><?php if ($client['mobile']!='') echo $client['mobile']; ?> </div></td></tr>
</table><br />
Quote short description:<br />
<input type="text" name="name" value="<?php echo $quote['name']; ?>" maxlength="50" /><br /><br />
Description:
<textarea class="desc" name="description"><?php echo $quote['description']; ?></textarea>
<br /><br />
<table>
<tr><td></td><td>Created by:<br /><div class="field"><?php if ($quote['added']!='') {
$result = mysqli_query($link,'SELECT * FROM `' . $_SESSION['company'] . '_users` WHERE name="' . $quote['added'] . '";');
$user = mysqli_fetch_array($result);
echo $quote['added'] . ' - ' . $user['mail'];
}
else {
$result = mysqli_query($link,'SELECT * FROM `' . $_SESSION['company'] . '_users` WHERE name="' . $_SESSION['login'] . '";');
$user = mysqli_fetch_array($result);
echo $_SESSION['login'] . ' - ' . $user['mail'];
}
?> </div></td></tr>
</table><br /><br />
<input type="submit" value="Save" /><br /><br />
</form>
<?php
require('template_end.php');
?>