-
Notifications
You must be signed in to change notification settings - Fork 1
/
bincard_view_add_new_action.php
57 lines (50 loc) · 2.12 KB
/
bincard_view_add_new_action.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
<?php
include('db.php');
if(isset($_POST['Submit']))
{
$ID = $_REQUEST['ID'];
$binitem_issued_date = $_POST['binitem_issued_date'];
$binitem_issued_recpnt = $_POST['binitem_issued_recpnt'];
$binitem_issued_qty = $_POST['binitem_issued_qty'];
if (empty($binitem_issued_date) || empty($binitem_issued_recpnt) || empty($binitem_issued_qty) ) {
if($binitem_issued_date == '0000-00-00')
{
echo "<script>alert('Pick a Date!');
window.location='bincard.php';
</script>";
}
if(empty($binitem_issued_recpnt))
{
echo "<script>alert('Supplier !');
window.location='bincard.php';
</script>";
}
if(empty($binitem_issued_qty))
{
echo "<script>alert('Quantity is empty!');
window.location='bincard.php';
</script>";
}
}
else
{
$sql ="INSERT INTO bincard_issued_record (bin_ID, recpnt, issued_date, qty)";
$sql.="VALUES ('$ID','$binitem_issued_recpnt','$binitem_issued_date','$binitem_issued_qty')";
$result = mysqli_query($con,$sql);
$sql1 = "SELECT * FROM";
$sql1.=" bincard_issued_record";
$result1 = mysqli_query($con,$sql1);
while ($row= mysqli_fetch_array($result1))
{
$addID = $row['ID'];
}
$sql2 = "UPDATE bincard_issued_record";
$sql2.=" SET ItemSetID = 'SP-$addID',itemCode = 'SET SP-$addID' WHERE ID = '$addID'";
$result2 = mysqli_query($con,$sql2);
//display success message
echo "<script>alert('Data added successfully');
window.location='bincard_view.php?ID=$ID';
</script>";
}
}
?>