-
Notifications
You must be signed in to change notification settings - Fork 0
/
purchase.php
130 lines (112 loc) · 4.72 KB
/
purchase.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
<?php session_start(); ?>
<?php include "connection.php";
if(isset($_POST['submit'])) {
$date=$_POST["date"];
$invoice=$_POST["invoice"];
$supplier=$_POST["name"];
$description=$_POST["desc"];
$qty=$_POST["qty"];
$price=$_POST["unit_price"];
$val=$_POST["val"];
$discount=$_POST["t_discount"];
$tot=$_POST["fin"];
$checkqsn = "SELECT * FROM purchase_journal where in_num='$invoice'";
$runcheck = mysqli_query($conn , $checkqsn) or die(mysqli_error($conn));
$qno = mysqli_num_rows($runcheck);
if($qno==0){
$query = "INSERT INTO purchase_journal VALUES('$invoice','$date','$supplier','$description','$qty','$price','$val','$discount','$tot')" ;
$run = mysqli_query($conn , $query) or die(mysqli_error($conn));
if (mysqli_affected_rows($conn) > 0 ) {
echo "<script>alert('successfully added'); </script> " ;
}
else {
echo"<script>alert('error, try again!'); </script> " ;
}
}else
{
echo"<script>alert('Invoice number already found.Can not duplicate !'); </script> " ;
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
<link rel="stylesheet" href="index.css">
<script src="purchase.js"></script>
<title>Purchase Journal</title>
</head>
<body>
<nav class="navbar navbar-dark navbar-expand-lg bg-dark">
<a class="navbar-brand" href="index.html"><img src="logo.jpeg" alt="" width="50px" style="margin-left: 10px;"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarTogglerDemo02">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="index.html">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="about_us.html">About Us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="team.html">Team</a>
</li>
</ul>
</div>
</nav>
<section style="margin-top: 2rem;margin-bottom: 80px;">
<h1>Input data of the the Purchase Voucher</h1>
<form method="POST" action="">
<label>Date</label>
<br>
<input type="date" name="date" id="date" required>
<br>
<label>Innovice Number</label>
<br>
<input type="text" name="invoice" id="invoice">
<br>
<label>Supplier</label>
<br>
<input type="text" name="name" id="name" required>
<br>
<label>Description</label>
<br>
<input type="text" name="desc" id="desc">
<br>
<label>Quantity</label>
<br>
<input type="number" name="qty" id="qty" required value="0" onchange="calvalue()">
<br>
<label>Unit Price</label>
<br>
<input type="number" name="unit_price" id="unit_price" required value="0" onchange="calvalue()">
<br>
<label>Value</label>
<br>
<input type="number" name="val" id="value" required value="0">
<br>
<label>Trade Discount Percentage</label>
<br>
<input type="number" name="t_discount" id="t_discount" required value="0" onchange="caltot()">
<br>
<label>Total Value</label>
<br>
<input type="number" name="fin" id="final" required >
<br><br>
<input type="submit" name="submit" value="Add to Journal" id="su-button">
<div id="error" class="hide"></div>
</form>
</section>
<div class="footer bg-dark">
<p>© Copyright 2021 Auditaholic</p>
</div>
</body>
</html>