forked from mangoO-Microfinance/mangoO-Microfinance
-
Notifications
You must be signed in to change notification settings - Fork 1
/
loans_pend.php
97 lines (87 loc) · 3.09 KB
/
loans_pend.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
<!DOCTYPE HTML>
<?PHP
require 'functions.php';
checkLogin();
connect();
$rep_year = date("Y",time());
$rep_month = date("m",time());
//Make array for exporting data
$_SESSION['rep_export'] = array();
$_SESSION['rep_exp_title'] = $rep_year.'-'.$rep_month.'_loans-pending';
//Select Pending Loans from LOANS
$sql_loanpend = "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 = 1 ORDER BY loan_date, loan_no";
$query_loanpend = mysql_query($sql_loanpend);
checkSQL ($query_loanpend);
?>
<html>
<?PHP includeHead('Pending Loans',1) ?>
<body>
<!-- MENU -->
<?PHP
includeMenu(3);
?>
<!-- MENU MAIN -->
<div id="menu_main">
<a href="loan_search.php">Search</a>
<a href="loans_act.php">Active Loans</a>
<a href="loans_pend.php" id="item_selected">Pending Loans</a>
</div>
<!-- CONTENT: Pending Loans -->
<div class="content-center">
<table id="tb_table">
<colgroup>
<col width="10%"/>
<col width="30%"/>
<col width="10%"/>
<col width="10%"/>
<col width="15%"/>
<col width="15%"/>
<col width="10%"/>
</colgroup>
<tr>
<form class="export" action="rep_export.php" method="post">
<th class="title" colspan="7">Pending Loans
<!-- Export Button -->
<input type="submit" name="export_rep" value="Export" />
</th>
</form>
</tr>
<tr>
<th>Loan No.</th>
<th>Customer</th>
<th>Status</th>
<th>Loan Period</th>
<th>Principal</th>
<th>Interest</th>
<th>Applied for on</th>
</tr>
<?PHP
$total_loanpend = 0;
$color = 0;
$count = 0;
while($row_loanpend = mysql_fetch_assoc($query_loanpend)){
tr_colored($color);
echo ' <td><a href="loan.php?lid='.$row_loanpend['loan_id'].'">'.$row_loanpend['loan_no'].'</a></td>
<td>'.$row_loanpend['cust_name'].' ('.$row_loanpend['cust_no'].')</td>
<td>'.$row_loanpend['loanstatus_status'].'</td>
<td>'.$row_loanpend['loan_period'].'</td>
<td>'.number_format($row_loanpend['loan_principal']).' '.$_SESSION['set_cur'].'</td>
<td>'.number_format(($row_loanpend['loan_repaytotal'] - $row_loanpend['loan_principal'])).' '.$_SESSION['set_cur'].'</td>
<td>'.date("d.m.Y",$row_loanpend['loan_date']).'</td>
</tr>';
array_push($_SESSION['rep_export'], array("Loan No." => $row_loanpend['loan_no'], "Customer" => $row_loanpend['cust_name'].' ('.$row_loanpend['cust_no'].')', "Status" => $row_loanpend['loanstatus_status'], "Loan Period" => $row_loanpend['loan_period'], "Principal" => $row_loanpend['loan_principal'], "Interest" => ($row_loanpend['loan_repaytotal'] - $row_loanpend['loan_principal']), "Repay Total" => $row_loanpend['loan_repaytotal'], "Applied for on" => date("d.m.Y",$row_loanpend['loan_date'])));
$count++;
}
?>
<tr class="balance">
<td colspan="7">
<?PHP
echo $count.' pending loan';
if ($count != 1) echo 's';
?>
</td>
</tr>
</table>
</div>
</body>
</html>