setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $currentMonth = date('Y-m'); $stmt = $db->prepare(" SELECT e.customerId, c.name, e.emiAmount, e.emiDate, e.payStatus, e.outstanding FROM emi e JOIN customers c ON e.customerId = c.customerId WHERE DATE_FORMAT(e.emiDate, '%Y-%m') = :currentMonth ORDER BY e.emiDate ASC"); $stmt->bindParam(':currentMonth', $currentMonth); $stmt->execute(); $emiPlans = $stmt->fetchAll(PDO::FETCH_ASSOC); // Calculate total demand amount $totalDemand = array_sum(array_column($emiPlans, 'emiAmount')); } catch (PDOException $e) { die("Database error: " . $e->getMessage()); } ?>
Customer Name | EMI Amount | EMI Date | Pay Status | Outstanding |
---|---|---|---|---|
₹ | Pending Paid | ₹ | ||
No pending EMIs this month |