-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmanage_payment.php
More file actions
156 lines (152 loc) · 6.4 KB
/
manage_payment.php
File metadata and controls
156 lines (152 loc) · 6.4 KB
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<?php
include 'db_connect.php';
if(isset($_GET['id'])){
$qry = $conn->query("SELECT * FROM payments where id= ".$_GET['id']);
foreach($qry->fetch_array() as $k => $val){
$$k=$val;
}
}
?>
<!-- Author Name: MH RONY.
GigHub Link: https://github.com/dev-mhrony
Facebook Link:https://www.facebook.com/dev.mhrony
Youtube Link: https://www.youtube.com/channel/UChYhUxkwDNialcxj-OFRcDw
for any PHP, Laravel, Python, Dart, Flutter work contact me at developer.mhrony@gmail.com
Visit My Website : developerrony.com
-->
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/2.0.5/css/dataTables.dataTables.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/3.0.2/css/buttons.dataTables.css">
<div class="container-fluid">
<form action="" id="manage-payment">
<input type="hidden" name="id" value="<?php echo isset($id) ? $id : '' ?>">
<div id="msg"></div>
<div class="form-group">
<label for="" class="control-label">Tenant</label>
<select name="tenant_id" id="tenant_id" class="custom-select select2">
<option value=""></option>
<?php
$tenant = $conn->query("SELECT *,concat(lastname,', ',firstname,' ',middlename) as name FROM tenants where status = 1 order by name asc");
while($row=$tenant->fetch_assoc()):
?>
<option value="<?php echo $row['id'] ?>" <?php echo isset($tenant_id) && $tenant_id == $row['id'] ? 'selected' : '' ?>><?php echo ucwords($row['name']) ?></option>
<?php endwhile; ?>
</select>
</div>
<div class="form-group" id="details">
<!-- Author Name: MH RONY.
GigHub Link: https://github.com/dev-mhrony
Facebook Link:https://www.facebook.com/dev.mhrony
Youtube Link: https://www.youtube.com/channel/UChYhUxkwDNialcxj-OFRcDw
for any PHP, Laravel, Python, Dart, Flutter work contact me at developer.mhrony@gmail.com
Visit My Website : developerrony.com
-->
</div>
<div class="form-group">
<label for="" class="control-label">Invoice: </label>
<input type="text" class="form-control" name="invoice" value="<?php echo isset($invoice) ? $invoice :'' ?>" >
</div>
<div class="form-group">
<label for="" class="control-label">Amount Paid: </label>
<input type="number" class="form-control text-right" step="any" name="amount" value="<?php echo isset($amount) ? $amount :'' ?>" >
</div>
</div>
</form>
</div>
<!-- Author Name: MH RONY.
GigHub Link: https://github.com/dev-mhrony
Facebook Link:https://www.facebook.com/dev.mhrony
Youtube Link: https://www.youtube.com/channel/UChYhUxkwDNialcxj-OFRcDw
for any PHP, Laravel, Python, Dart, Flutter work contact me at developer.mhrony@gmail.com
Visit My Website : developerrony.com
-->
<div id="details_clone" style="display: none">
<div class='d'>
<large><b>Details</b></large>
<hr>
<p>Tenant: <span class="tname"></span></p>
<p>Monthly Rental Rate: <span class="price"></span></p>
<p>Outstanding Balance: <span class="outstanding"></span></p>
<p>Total Paid: <span class="total_paid"></span></p>
<p>Rent Started: <span class='rent_started'></span></p>
<p>Payable Months: <span class="payable_months"></span></p>
<hr>
</div>
</div>
<script>
$(document).ready(function(){
if('<?php echo isset($id)? 1:0 ?>' == 1)
$('#tenant_id').trigger('change')
})
$('.select2').select2({
placeholder:"Please Select Here",
width:"100%"
})
$('#tenant_id').change(function(){
if($(this).val() <= 0)
return false;
start_load()
$.ajax({
url:'ajax.php?action=get_tdetails',
method:'POST',
data:{id:$(this).val(),pid:'<?php echo isset($id) ? $id : '' ?>'},
success:function(resp){
if(resp){
resp = JSON.parse(resp)
var details = $('#details_clone .d').clone()
details.find('.tname').text(resp.name)
details.find('.price').text(resp.price)
details.find('.outstanding').text(resp.outstanding)
details.find('.total_paid').text(resp.paid)
details.find('.rent_started').text(resp.rent_started)
details.find('.payable_months').text(resp.months)
console.log(details.html())
$('#details').html(details)
}
},
complete:function(){
end_load()
}
})
})
$('#manage-payment').submit(function(e){
e.preventDefault()
start_load()
$('#msg').html('')
$.ajax({
url:'ajax.php?action=save_payment',
data: new FormData($(this)[0]),
cache: false,
contentType: false,
processData: false,
method: 'POST',
type: 'POST',
success:function(resp){
if(resp==1){
alert_toast("Data successfully saved.",'success')
setTimeout(function(){
location.reload()
},1000)
}
}
})
})
</script>
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
<script src="https://cdn.datatables.net/2.0.5/js/dataTables.js"></script>
<script src="https://cdn.datatables.net/buttons/3.0.2/js/dataTables.buttons.js"></script>
<script src="https://cdn.datatables.net/buttons/3.0.2/js/buttons.dataTables.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/3.0.2/js/buttons.html5.min.js"></script>
<script>
new DataTable('#example', {
layout: {
topStart: {
buttons: ['copyHtml5', 'excelHtml5', 'csvHtml5', 'pdfHtml5']
}
}
});
</script><footer class="footer d-flex flex-column flex-md-row align-items-center justify-content-between px-4 py-3 border-top small">
<p class="text-muted mb-1 mb-md-0">Copyright © 2024 Tenant Management System Software - Design and Develop By <a href="https://www.facebook.com/dev.mhrony/" target="_blank"> MH RONY </a> </p>
</footer>