-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUntitled-4.php
More file actions
102 lines (71 loc) · 2.56 KB
/
Copy pathUntitled-4.php
File metadata and controls
102 lines (71 loc) · 2.56 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
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
<?php
else if($taskType == 'annual'){
$dateOfNow = new DateTime(date('Y-m-d'));
$MonthOfNow = $dateOfNow->format('F');
$YearToUseForApril = "";
$YearToUseforMarch = "";
if($MonthOfNow=="January" || $MonthOfNow=="February" || $MonthOfNow=="March"){
$YearToUseforMarch = $dateOfNow->format('Y');
$dateOfNow->modify('last year');
$YearToUseForApril = $dateOfNow->format('Y');
}
else{
$YearToUseForApril = $dateOfNow->format('Y');
$dateOfNow->modify('next year');
$YearToUseforMarch = $dateOfNow->format('Y');
}
$April = new DateTime($YearToUseForApril.'-04-01');
$March = new DateTime($YearToUseforMarch.'-03-31');
$April = $April->format('Y-m-d');
$March = $March->format('Y-m-d');
$selectUserTask = "SELECT * FROM finishedtask WHERE taskID = '$taskID' AND `DateSubmitted` BETWEEN '$April' AND '$March';";
// SELECT week FROM `finishedtask` WHERE `taskID` = '23';
$result = mysqli_query($con, $selectUserTask);
$numrows = mysqli_num_rows($result);
$don = "0";
while($userRow = mysqli_fetch_assoc($result)){
$noOfDays = $userRow['noOfDaysLate'];
$isLate = $userRow['isLate'];
}
//new monthly code
$selectUserTask = "SELECT * FROM `usertask` WHERE usertaskID = '$taskID' LIMIT 1";
$result = mysqli_query($con, $selectUserTask);
while($userRow = mysqli_fetch_assoc($result)){
$dateStarted = $userRow['dateStarted'];
}
$date = new DateTime($dateStarted);
$date->modify('next year');
$nextYearSample = $date->format('Y');
$date = new DateTime($nextYearSample.'-04-01');
$nextYearMarch = $date->format('Y-m-d');
$end = new DateTime(date('Y-m-d'));
$start = new DateTime($nextYearMarch);
$end->modify('+1 day');
$interval = $end->diff($start);
// total days
// $finalDiff = $interval->days;
$finalDiff = $interval->format('%R%a')."\n";
if($finalDiff >0){
$_SESSION['noOfDaysLate']=$finalDiff;
$_SESSION['TaskID'] = $_GET['FinishSample'];
// echo $eememe;
echo "<script>
// document.getElementById('daysLateDiv').style.display = 'none';
console.log('$finalDiff');
$('#reasonModal').modal('show');
console.log('$eememe');
document.getElementById('daysLate').value='$finalDiff';
</script>";
}
else if($finalDiff == 0){
$_SESSION['noOfDaysLate']='0';
$_SESSION['TaskID'] = $_GET['FinishSample'];
$taskID = $_SESSION['TaskID'];
echo "<script>
// document.getElementById('actionText').value='$finalDiff';
$('#actionModal').modal('show');
//document.getElementById('finished$taskID').click(); DITO AKO NATAPOS
</script>";
}
}
?>