-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaddSubstructure.php
More file actions
60 lines (43 loc) · 1.47 KB
/
Copy pathaddSubstructure.php
File metadata and controls
60 lines (43 loc) · 1.47 KB
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
<?php
include 'DatabaseConnection.php';
$Name = $_POST['Name'];
$Start_Date = $_POST['Start_Date'];
$Total_Days = $_POST['Total_Days'];
$Quantity =$_POST['Quantity'];
$Labour_Rate= $_POST['Labour_Rate'];
$Machine_Rate= $_POST['Machine_Rate'];
echo "$Name ";
$query= "insert into newprojectschedule ( Name, Start_Date, Total_Days,Quantity,Labour_Rate,Machine_Rate )
VALUES ('$Name','$Start_Date', '$Total_Days','$Quantity','$Labour_Rate','$Machine_Rate' )";
$result = mysqli_query($conn, $query);
if (!$result) {
printf("Error: %s\n", mysqli_error($conn));
exit();
}
$query2= "select SubstructureID from newprojectschedule where Name= '$Name' ";
$result2= mysqli_query($conn, $query2);
$row = mysqli_fetch_array($result2);
$id= $row['SubstructureID'];
$query4="insert into progressreport ( SubstructureID )
VALUES ('$id' )";
$result4= mysqli_query($conn, $query4);
if (!$result4) {
printf("Error: %s\n", mysqli_error($conn));
exit();
}
//echo $row['SubstructureID'] ;
//echo "$result2";
// $date = strtotime("+1 day", strtotime("2007-02-28"));
// echo date("Y-m-d", $date);
$date= $Start_Date;
$IdealWork= $Quantity/$Total_Days;
for ($x = 1; $x <= $Total_Days; $x++)
{
$query3= "insert into workreport (SubstructureID, Date, IdealWork)
VALUES ('$id', '$date', '$IdealWork')";
$result3= mysqli_query($conn, $query3);
$date = date("Y-m-d", strtotime("+1 day", strtotime("$date")));
}
mysqli_close($conn);
header("Location: index.php");
?>