<?php
include '../includes/connection.php';
$idd=$_GET['id'];
session_start();
$branch=$_SESSION['branch_id'];
$sql = "SELECT * FROM sales where receipt_no='$idd'";
$result = mysqli_query($conn, $sql);

if (mysqli_num_rows($result) > 0) {
$row = mysqli_fetch_assoc($result);
        if($row['paid']<$row['total_price']){
        	$total=$row['total_price'];
        $paid=$row['paid'];
        $balance=$total-$paid;
       // echo $balance;
        echo "<font color=blue>Total: Ugx ".number_format($total)."</font><br><font color=darkgreen> Paid: Ugx ".number_format($paid)."</font><br> <font color=darkorange>Balance: Ugx ".number_format($balance)."</font> |".$paid."|".$balance."|".$total;
        }
        else if($row['paid']=$row['total_price']){
        	echo "cleared";
        }
    
} else {
    echo "invalid";
}

?>