$sql = "SELECT SUM(`order_item`.`quantity`)as `total` FROM `order_item` WHERE `order_item`.`order_id` IN(SELECT orders.order_id FROM orders WHERE orders.order_date='$date') ;"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo $row["total"]; } } else { echo "0 results"; } ?>
Today Sold
$sql = "SELECT SUM(order_item.total-stock.Buying_Price*order_item.quantity)AS `profit`,(SUM(((order_item.total-stock.Buying_Price*order_item.quantity)/(stock.Buying_Price*order_item.quantity))*100)/COUNT(order_item.order_item_id))as`ExpectedProfit` FROM order_item,stock WHERE stock.id=order_item.stock_id AND order_item.order_id IN (SELECT orders.order_id FROM orders);"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo sprintf("%.2f",$row["ExpectedProfit"]); } } else { echo "0 results"; } ?>%
Profit Rate Today
$sql = "SELECT COUNT(`id`)as `totalCustomer` FROM `customers`;"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo $row["totalCustomer"]; } } else { echo "0 results"; } ?>
Total Customers
$sql = "SELECT SUM(`order_item`.`quantity`)as `total` FROM `order_item`;"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo $row["total"]; } } else { echo "0 results"; } ?>
Total Sold
Due Vs Paid
Calendar
| « | November 2021 | » | ||||
|---|---|---|---|---|---|---|
| Su | Mo | Tu | We | Th | Fr | Sa |
| 31 | 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 | 1 | 2 | 3 | 4 |
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |