diff --git a/admin/medicine/addMed.php b/admin/medicine/addMed.php
index 7f309d3..a1bacab 100644
--- a/admin/medicine/addMed.php
+++ b/admin/medicine/addMed.php
@@ -55,6 +55,7 @@
';
@@ -64,6 +65,7 @@
|
|
+ |
|
-
+
-
+
-
+
+
+
+
+
= ?
- GROUP BY med.ID, med.medName";
+ WHERE medName LIKE ? AND ship.expirationDate >= ?
+ GROUP BY med.ID, med.medName, med.recommendedDosage";
$stmt = $conn->prepare($sql);
diff --git a/admin/medicine/outStockSearch.php b/admin/medicine/outStockSearch.php
index cacfbfd..8ef2817 100644
--- a/admin/medicine/outStockSearch.php
+++ b/admin/medicine/outStockSearch.php
@@ -4,11 +4,11 @@
$conn = $db->getConnection();
// Prepare the statement
- $sql = "SELECT med.ID, med.medName, SUM(ship.quantity) as inStock
+ $sql = "SELECT med.ID, med.medName, recommendedDosage, SUM(ship.quantity) as inStock
FROM medicines AS med
JOIN medshipment AS ship ON med.ID = ship.medID
- GROUP BY med.ID, med.medName
- HAVING SUM(ship.quantity) = 0";
+ GROUP BY med.ID, med.medName, recommendedDosage
+ HAVING SUM(ship.quantity) < recommendedDosage";
$stmt = $conn->prepare($sql);
@@ -22,4 +22,3 @@
$results = $result->fetch_all(MYSQLI_ASSOC);
// Free result and close statement
$stmt->close();
-?>
diff --git a/admin/medicine/processAddMed.php b/admin/medicine/processAddMed.php
index 03f7dde..bcc23be 100644
--- a/admin/medicine/processAddMed.php
+++ b/admin/medicine/processAddMed.php
@@ -13,8 +13,6 @@
$expireDate = date_create_from_format("Y-m-d",$_POST['medExpireDate']);
$manuDate = date_create_from_format("Y-m-d",$_POST['medManuDate']);
- $conn = $db->getConnection();
-
$medicineItem = array(
'medName'=>$name,
'price' => $price,
@@ -22,7 +20,10 @@
);
$result = $db->select('medicines','ID',$medicineItem);
if(!$result){
+ $medicineItem['recommendedDosage'] = $_POST['medDosage'];
+
$db->insert('medicines',$medicineItem);
+
$result = $db->select('medicines','ID',$medicineItem);
}
@@ -33,8 +34,9 @@
'manufactureDate' => date_format($manuDate,'Y-m-d'),
'medID' => $result['ID']
);
+
$result = $db->select('medshipment','*',array('Lot' => $lot));
- echo var_dump($result)."
";
+
if($result){
$db->updateAmount('medshipment',array('quantity' => $quantity),array('Lot' => $lot));
}else{
diff --git a/admin/medicine/requestMed.php b/admin/medicine/requestMed.php
index 2373547..2fa3609 100644
--- a/admin/medicine/requestMed.php
+++ b/admin/medicine/requestMed.php
@@ -105,16 +105,16 @@
-
+
-
+
-
+
diff --git a/classes/Dbh.php b/classes/Dbh.php
index 0e41832..3d2f869 100644
--- a/classes/Dbh.php
+++ b/classes/Dbh.php
@@ -33,6 +33,41 @@ public function getConnection()
{
return $this->conn;
}
+ public function query($sql, $bind) {
+ $stmt = $this->conn->prepare($sql);
+
+ // Execute the statement
+ if (!$stmt) {
+ echo "EMPTY QUERY
";
+ return null;
+ }
+
+ if ($bind) {
+ // Bind parameters to the statement
+ foreach ($bind as $type => $values) {
+ foreach ($values as $value) {
+ $stmt->bind_param($type, $value);
+ }
+ }
+ }
+
+ $stmt->execute();
+
+ // Get the results
+ $result = $stmt->get_result();
+
+ // Fetch all rows
+ if ($result) {
+ $results = $result->fetch_all(MYSQLI_ASSOC);
+ }
+
+ // Free result and close statement
+ $stmt->close();
+
+ return $results;
+ }
+
+
// dbName => component
public function select($table, $items = '*', $where = null, $allFlag = false)
{
diff --git a/index.php b/index.php
index 77ae26d..65fce3b 100644
--- a/index.php
+++ b/index.php
@@ -1,3 +1,6 @@
+
@@ -44,6 +47,7 @@
+ ";?>
code test
dashboard Admin
staff home
diff --git a/staff/logout.php b/staff/logout.php
new file mode 100644
index 0000000..bc6fb20
--- /dev/null
+++ b/staff/logout.php
@@ -0,0 +1,4 @@
+   Home Page
-   Log out
+   Log out
+
\ No newline at end of file