-
Notifications
You must be signed in to change notification settings - Fork 0
/
Customer-Rent-Payement.php
172 lines (144 loc) · 6.43 KB
/
Customer-Rent-Payement.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?php include 'header.php';
//================ Get Field From Page Category =================
$Customer_RentID = get('id');
$RentItemID = get('RentItemID');
$Price=get('Price');
$UserID = $_SESSION['UserID'];
$PayYearMonth = get('getdatenotyetpay');
$PayDay = get('PayDate');
$txtPayDate = $PayYearMonth."/".$PayDay;
//==================== Insert New Branch =======================
if(isset($_POST['btnSave'])){
$txtRealPayDate = post('txtRealPayDate');
$txtPrice = post('txtPrice');
$txtElectric = post('txtElectric');
$txtWater = post('txtWater');
$txtGarbage = post('txtGarbage');
$txtOther = post('txtOther');
$txtTotal = post('txtTotal');
$payment=$db->query("CALL sp_Customer_Rent_Payment_Insert(
'".$Customer_RentID."',
'".$UserID."',
'".$RentItemID."',
'".$PayDay."',
'".$txtRealPayDate."',
".$txtPrice.",
".$txtElectric.",
".$txtWater.",
".$txtGarbage.",
".$txtOther.",
".$txtTotal."
)
");
if($payment){
cRedirect('Customer_Rent.php');
$db->query(" UPDATE tblcustomer_rent SET isPaid=0 WHERE Customer_RentID='".$Customer_RentID."'");
$db->query(" Update tblrentitem set isStatus=1 where RentItemID='".$RentItemID."'");
}
}
?>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="./css/jquery.datetimepicker.css"/>
<script language="javascript">
function checkInput(ob) {
var invalidChars = /[^0-9]/gi
if(invalidChars.test(ob.value)) {
ob.value = ob.value.replace(invalidChars,"");
}
}
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode != 46 && charCode > 31
&& (charCode < 48 || charCode > 57))
return false;
return true;
}
</script>
</head>
<body class="skin-blue">
<aside class="right-side">
<!-- Content Header (Page header) -->
<section class="content-header">
<div class="row" style="margin: 0 auto;>
<div class="col-xs-8">
<form role="form" method="post" enctype="multipart/form-data" id="myForm">
<label><h3><i class="glyphicon glyphicon-book">Payment</h3></i></label>
<div class="form-group">
<label>Pay Date</label>
<!-- <input name="txtPayDate" class="form-control" placeholder="Enter text" required /> -->
<input type="text" name="txtPayDate" class="form-control" value="<?php echo $txtPayDate ; ?>" readonly/>
</div>
<div class="form-group">
<label>Real Pay Date</label>
<!-- <input name="txtPayDate" class="form-control" placeholder="Enter text" required /> -->
<input type="text" id="RealPayDate" name="txtRealPayDate" class="form-control" <?php $datenow=date("Y-m-d"); echo 'value="'.$datenow.'"'; ?>/>
</div>
<?php $Price=get('Price'); ?>
<div class="form-group">
<label>Price</label>
<input name="txtPrice" id="Price" class="form-control" value="<?php echo $Price; ?>" required readonly />
</div>
<div class="form-group">
<label>Electric</label>
<input name="txtElectric" id="Electric" class="form-control" value="0" onkeypress="return isNumberKey(event)" required />
</div>
<div class="form-group">
<label>Water</label>
<input name="txtWater" id="Water" class="form-control" value="0" onkeypress="return isNumberKey(event)" required />
</div>
<div class="form-group">
<label>Garbage</label>
<input name="txtGarbage" id="Garbage" class="form-control" value="0" onkeypress="return isNumberKey(event)" required />
</div>
<div class="form-group">
<label>Other</label>
<input name="txtOther" id="Other" class="form-control" value="0" onkeypress="return isNumberKey(event)" required />
</div>
<div class="form-group">
<label>Total</label>
<input name="txtTotal" id="Total" class="form-control"
value="<?php echo $Price; ?>"
required readonly />
</div>
<input type="submit" name="btnSave" style="float:right;" class="btn btn-primary" value="Save" onClick='parent.jQuery.fn.colorbox.close();'/>
<button type="button" class="btn btn-default" style="float:right;" onClick='parent.jQuery.fn.colorbox.close();'>Close</button>
</form>
</div>
</div>
</section>
<!-- Main content -->
</aside><!-- /.right-side -->
</div><!-- ./wrapper -->
<!-- add new calendar event modal -->
</body>
<script src="./js/jquery.js"></script>
<script src="./js/jquery.datetimepicker.js"></script>
<script>
// ** show date and time picker
$('#RealPayDate').datetimepicker({
timepicker: false, //visible time = false
format: 'Y-m-d',
step: 10
});
</script>
<!-- Event KeyPress -->
<script type="text/javascript">
$("#myForm input").each(function(){
$(this).keyup(function(){
var Price = $("#Price").val();
var Electric = $("#Electric").val();
var Water = $("#Water").val();
var Garbage = $("#Garbage").val();
var Other = $("#Other").val();
Price = $.isNumeric(Price)?Price:0;
Electric = $.isNumeric(Electric)?Electric:0;
Water = $.isNumeric(Water)?Water:0;
Garbage = $.isNumeric(Garbage)?Garbage:0;
Other = $.isNumeric(Other)?Other:0;
$("#Total").val(parseFloat(Price)+parseFloat(Electric)+parseFloat(Water)+parseFloat(Garbage)+parseFloat(Other));
});
});
</script>
<?php include 'footer.php';?>