-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.php
139 lines (123 loc) · 7.16 KB
/
home.php
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?php include 'db_connect.php' ?>
<style>
</style>
<div class="containe-fluid">
<div class="row">
<div class="col-lg-12">
</div>
</div>
<div class="row mt-3 ml-3 mr-3">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<?php echo "Welcome back ".($_SESSION['login_type'] == 3 ? "Dr. ".$_SESSION['login_name'].','.$_SESSION['login_name_pref'] : $_SESSION['login_name'])."!" ?>
</div>
<hr>
<div class="row ml-2 mr-2">
<div class="col-md-3">
<div class="card bg-primary text-white mb-3">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div class="mr-3">
<div class="text-white-75 small">Payments Today</div>
<div class="text-lg font-weight-bold">
<?php
$payments = $conn->query("SELECT sum(amount) as total FROM payments where date(date_created) = '".date("Y-m-d")."'");
echo $payments->num_rows > 0 ? number_format($payments->fetch_array()['total'],2) : "0.00";
?>
</div>
</div>
<i class="fa fa-calendar"></i>
</div>
</div>
<div class="card-footer d-flex align-items-center justify-content-between">
<a class="small text-white stretched-link" href="index.php?page=payments">View Payments</a>
<div class="small text-white">
<i class="fas fa-angle-right"></i>
</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card bg-success text-white mb-3">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div class="mr-3">
<div class="text-white-75 small">Borrowers</div>
<div class="text-lg font-weight-bold">
<?php
$borrowers = $conn->query("SELECT * FROM borrowers");
echo $borrowers->num_rows > 0 ? $borrowers->num_rows : "0";
?>
</div>
</div>
<i class="fa fa-user-friends"></i>
</div>
</div>
<div class="card-footer d-flex align-items-center justify-content-between">
<a class="small text-white stretched-link" href="index.php?page=borrowers">View Borrowers</a>
<div class="small text-white">
<i class="fas fa-angle-right"></i>
</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card bg-warning text-white mb-3">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div class="mr-3">
<div class="text-white-75 small">Active Loans</div>
<div class="text-lg font-weight-bold">
<?php
$loans = $conn->query("SELECT * FROM loan_list where status = 2");
echo $loans->num_rows > 0 ? $loans->num_rows : "0";
?>
</div>
</div>
<i class="fa fa-user-friends"></i>
</div>
</div>
<div class="card-footer d-flex align-items-center justify-content-between">
<a class="small text-white stretched-link" href="index.php?page=loans">View Loan List</a>
<div class="small text-white">
<i class="fas fa-angle-right"></i>
</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card bg-info text-white mb-3">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div class="mr-3">
<div class="text-white-75 small">Total Receivable</div>
<div class="text-lg font-weight-bold">
<?php
$payments = $conn->query("SELECT sum(amount - penalty_amount) as total FROM payments where date(date_created) = '".date("Y-m-d")."'");
$loans = $conn->query("SELECT sum(l.amount + (l.amount * (p.interest_percentage/100))) as total FROM loan_list l inner join loan_plan p on p.id = l.plan_id where l.status = 2");
$loans = $loans->num_rows > 0 ? $loans->fetch_array()['total'] : "0";
$payments = $payments->num_rows > 0 ? $payments->fetch_array()['total'] : "0";
echo number_format($loans - $payments,2);
?>
</div>
</div>
<i class="fa fa-user-friends"></i>
</div>
</div>
<div class="card-footer d-flex align-items-center justify-content-between">
<a class="small text-white stretched-link" href="index.php?page=loans">View Loan List</a>
<div class="small text-white">
<i class="fas fa-angle-right"></i>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
</script>