Skip to content

Commit

Permalink
Merge pull request #170 from kulasinghet/supplier
Browse files Browse the repository at this point in the history
Supplier Filter Added
  • Loading branch information
Pawandi-W committed May 5, 2023
2 parents 0b61dec + 8c9aa29 commit eccbe0c
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions models/MedicineModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function getCount()
}


// Get ids of all Medicine (to compare unadded medicine for a supplier
// Get ids of all Medicine (to compare unadded medicine for a supplier)
public function getallMedid()
{
$db = (new Database())->getConnection();
Expand All @@ -134,12 +134,12 @@ public function getallMedid()
$result = $db->query($sql);
if ($result->num_rows > 0) {
return $result;
} else {
return false;
}

$db->close();
}

// Get ids of all Medicine (to compare unadded medicine for a supplier - filter
// Get ids of all Medicine (to compare unadded medicine for a supplier - filter)
public function getallMedidFilter($search)
{
$db = (new Database())->getConnection();
Expand All @@ -153,4 +153,17 @@ public function getallMedidFilter($search)
$db->close();
}

public function getMedicinePrice(mixed $id)
{
$db = (new Database())->getConnection();
$sql = "SELECT sellingPrice AS price FROM stock WHERE medId = '$id' ORDER BY id DESC LIMIT 1";
$result = $db->query($sql);
if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
return $row['price'];
}

$db->close();
}

}

0 comments on commit eccbe0c

Please sign in to comment.