-
Notifications
You must be signed in to change notification settings - Fork 0
/
estimateActions.php
71 lines (67 loc) · 2.51 KB
/
estimateActions.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
<?php
include('dbconnect.php');
include('general.php');
putLinks();
if (isset($_GET['delrec']))
{
$idCode = $_GET['delrec'];
$conn = dbconn();
$delQuery = "delete from estimate where CODE='" . $idCode . "'";
//echo $idCode;
//echo $delQuery;
$result = mysqli_query($conn, $delQuery);
$idcode="";
$conn->close();
//exit();
header('Location: estimate.php');
}
//header('Location: estimateremove.php?');
if (isset($_GET['clear']))
{
if ($_GET['clear'] == "All")
{
$conn = dbconn();
$delQuery = "delete from estimate";
//echo $idCode;
//echo $delQuery;
$result = mysqli_query($conn, $delQuery);
$idcode="";
$conn->close();
//exit();
header('Location: estimate.php');
}
}
if (isset($_GET['addRec']) && isset($_GET['code']))
{
$code = $_GET['code'];
$price = $_GET['addRec'];
//echo $code . " " . $price;
//exit();
$conn = dbconn();
$addQuery = "INSERT INTO estimate (CODE,PRICESELL,QUANTITY) VALUES ($code,$price,1)
ON DUPLICATE KEY UPDATE PRICESELL=$price,QUANTITY=1";
$result = mysqli_query($conn, $addQuery);
$conn->close();
$code="";
$price=0;
//exit();
header('Location: marginsearch.php');
}
if (isset($_GET['insertRec']) && isset($_GET['code']) && isset($_GET['qty']) )
{
$code = $_GET['code'];
$price = $_GET['insertRec'];
$qty = $_GET['qty'];
//echo $code . " " . $price;
//exit();
$conn = dbconn();
$addQuery = "INSERT INTO estimate (CODE,PRICESELL,QUANTITY) VALUES ($code,$price,$qty)
ON DUPLICATE KEY UPDATE PRICESELL=$price,QUANTITY=$qty";
$result = mysqli_query($conn, $addQuery);
$conn->close();
$code="";
$price=0;
//exit();
header('Location: marginsearch.php');
}
?>