forked from mgherghi/inventory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_labor.php
79 lines (72 loc) · 2.58 KB
/
add_labor.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
<?php
$page_title = 'Add Items';
require_once('includes/load.php');
// Checkin What level user has permission to view this page
page_require_level(1);
$all_products = find_all('products');
$all_orders = find_all('checkout');
$order_id = last_id('checkout');
//$new_order_id = $order_id[id] + 1;
?>
<!-- ************************* -->
<?php
if(isset($_POST['add_labor'])){
$req_fields = array( 'month','forecast','actual','absorption');
validate_fields($req_fields);
$month = remove_junk($db->escape($_POST['month']));
$forecast = remove_junk($db->escape($_POST['forecast']));
$actual = remove_junk($db->escape($_POST['actual']));
$absorption = remove_junk($db->escape($_POST['absorption']));
if(empty($errors))
{
$sql = "INSERT INTO labor (month,forcast,actual,absorption)";
$sql .= " VALUES ('{$month}','{$forecast}','{$actual}','{$absorption}')";
if($db->query($sql))
{
$session->msg("s", "Successfully added item");
redirect( 'add_labor.php' , false);
} else {
$session->msg("d", "Sorry Failed to insert.");
redirect( 'add_labor.php' , false);
}
} else {
$session->msg("d", $errors);
redirect( 'add_labor.php' , false);
}
}
?>
<?php include_once('layouts/header.php'); ?>
<div class="login-page">
<div class="text-center">
<!-- ************************* -->
<h2>Add Labor Entry</h3>
<!-- <h3>#<?php// echo $new_order_id;?></h3>
<!-- ************************* -->
</div>
<?php echo display_msg($msg); ?>
<form method="post" action="" class="clearfix">
<!-- ************************* -->
<div class="form-group">
</div>
<!-- ************************* employee number -->
<div class="form-group">
<label for="name" class="control-label">Employee Number</label>
<input type="date" class="form-control" name="month" placeholder="Date">
</div>
<div class="form-group">
<input type="number" class="form-control" name="forecast" placeholder="Forecast">
</div>
<!-- ************************* line and machine-->
<div class="form-group">
<input type="number" class="form-control" name="actual" placeholder="Actual">
</div>
<div class="form-group">
<input type="number" class="form-control" name="absorption" placeholder="absorption">
</div>
<!-- ************************* <div class="col-md-4"> -->
<div class="form-group clearfix">
<button type="submit" name="add_labor" class="btn btn-info">submit Item</button>
</div>
</form>
</div>
<?php include_once('layouts/footer.php'); ?>