forked from lecnush/mangoO-Microfinance
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathloans_result.php
85 lines (79 loc) · 2.81 KB
/
loans_result.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
<!DOCTYPE HTML>
<?PHP
require 'functions.php';
checkLogin();
connect();
//Select from LOANS depending on Search or not Search
if (isset($_POST['loan_no'])){
$loan_search = sanitize($_POST['loan_no']);
$sql_loansearch = "SELECT * FROM loans LEFT JOIN loanstatus ON loans.loanstatus_id = loanstatus.loanstatus_id LEFT JOIN customer ON loans.cust_id = customer.cust_id WHERE loan_no LIKE '%$loan_search%'";
$query_loansearch = mysql_query($sql_loansearch);
checkSQL ($query_loansearch);
}
elseif (isset($_POST['loan_status'])){
$loan_search = sanitize($_POST['loan_status']);
$sql_loansearch = "SELECT * FROM loans LEFT JOIN loanstatus ON loans.loanstatus_id = loanstatus.loanstatus_id LEFT JOIN customer ON loans.cust_id = customer.cust_id WHERE loans.loanstatus_id = '$loan_search'";
$query_loansearch = mysql_query($sql_loansearch);
checkSQL ($query_loansearch);
}
else header('Location: start.php');
?>
<html>
<?PHP includeHead('Loans Search Result',1) ?>
<body>
<!-- MENU -->
<?PHP includeMenu(3); ?>
<div id="menu_main">
<a href="loan_search.php" id="item_selected">Search</a>
<a href="loans_act.php">Active Loans</a>
<a href="loans_pend.php">Pending Loans</a>
</div>
<div id="content_center">
<!-- SEARCH RESULTS -->
<table id="tb_table">
<colgroup>
<col width="7.5%" />
<col width="25%" />
<col width="10%" />
<col width="7.5%" />
<col width="15%" />
<col width="15%" />
<col width="10%" />
<col width="10%" />
</colgroup>
<tr>
<th class="title" colspan="8" >Loan Search Results</th>
</tr>
<tr>
<th>Loan No.</th>
<th>Customer</th>
<th>Status</th>
<th>Period</th>
<th>Principal</th>
<th>Interest</th>
<th>Applied for on</th>
<th>Issued</th>
</tr>
<?PHP
$color = 0;
while ($row_loansearch = mysql_fetch_assoc($query_loansearch)){
//Alternating row colors
tr_colored($color);
echo '<td><a href="loan.php?lid='.$row_loansearch['loan_id'].'">'.$row_loansearch['loan_no'].'</a></td>
<td>'.$row_loansearch['cust_name'].' (<a href="customer.php?cust='.$row_loansearch['cust_id'].'">'.$row_loansearch['cust_no'].'</a>)</td>
<td>'.$row_loansearch['loanstatus_status'].'</td>
<td>'.$row_loansearch['loan_period'].'</td>
<td>'.number_format($row_loansearch['loan_principal']).' '.$_SESSION['set_cur'].'</td>
<td>'.number_format(($row_loansearch['loan_repaytotal'] - $row_loansearch['loan_principal'])).' '.$_SESSION['set_cur'].'</td>
<td>'.date("d.m.Y",$row_loansearch['loan_date']).'</td>
<td>';
if ($row_loansearch['loan_dateout'] == 0) echo "No";
else echo date("d.m.Y", $row_loansearch['loan_dateout']);
echo '</td>
</tr>';
}
?>
</table>
</div>
</body>
</html>