-
Notifications
You must be signed in to change notification settings - Fork 0
/
transfer.php
125 lines (109 loc) · 4.76 KB
/
transfer.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
<!--
Developer : chintan khatri
Date : 01-10-2016
-->
<!DOCTYPE html>
<?php
include_once './class.php';
session_start();
if ($_SESSION['user']=== TRUE) {
} else {
header('location:login.php');
}
$db = new accounts();
$insert_transection = new transection();
$transfer_records = new tranfer();
if ($_POST) {
$transfer_records->new_transfer($_POST['tr_date'], $_POST['tr_amount'], $_POST['tr_des'], $_POST['tr_ac_id_from'], $_POST['tr_ac_id_to']);
$insert_transection->new_transection($_POST['tr_date'], 1, $_POST['tr_des'], $_POST['tr_amount'],15,$_POST['tr_ac_id_to'] );
$insert_transection->new_transection($_POST['tr_date'], 0, $_POST['tr_des'], $_POST['tr_amount'],15,$_POST['tr_ac_id_from'] );
$db->credit_account($_POST['tr_amount'], $_POST['tr_ac_id_from']);
$db->debit_account($_POST['tr_amount'], $_POST['tr_ac_id_to']);
}
?>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/>
<title>Alpha</title>
<!-- CSS -->
<?php
include_once './theme-part/top_head.php';
?>
</head>
<body>
<?php
include_once './theme-part/top_nav.php';
?>
<div class="container">
<div class="row">
<form class="col s12" method="POST">
<div class="row">
<div class="input-field col s12">
<input type="date" name="tr_date" class="datepicker">
<label for="date">Date</label>
</div>
<div class="input-field col s12">
<input id="amount" name="tr_amount" type="text" >
<label for="amount">amount</label>
</div>
<div class="input-field col s12">
<textarea id="textarea1" name="tr_des" class="materialize-textarea"></textarea>
<label for="textarea1">Description</label>
</div>
<div class="input-field col s12">
<select name="tr_ac_id_from">
<option value="" disabled selected>Choose Account From</option>
<?php
$array_accounts_from = $db->show_accounts();
foreach ($array_accounts_from as $data) {
?>
<option value="<?php echo $data['ac_id'] ?>"><?php echo $data['ac_name'] ?></option>
<?php
}
?>
</select>
</div>
<div class="input-field col s12">
<select name="tr_ac_id_to">
<option value="" disabled selected>Choose Account To</option>
<?php
$array_accounts_to = $db->show_accounts();
foreach ($array_accounts_to as $data) {
?>
<option value="<?php echo $data['ac_id'] ?>"><?php echo $data['ac_name'] ?></option>
<?php
}
?>
</select>
</div>
<button class="btn waves-effect waves-light" type="submit" name="action">Submit
<i class="material-icons right">submit</i>
</button>
</div>
</form>
</div>
<br><br>
<br><br>
</div>
<footer class="page-footer orange">
<?php
include_once './theme-part/footer_part.php';
?>
</footer>
<!-- Scripts-->
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="js/materialize.js"></script>
<script src="js/init.js"></script>
<script>
$('.datepicker').pickadate({
selectMonths: true, // Creates a dropdown to control month
selectYears: 15, // Creates a dropdown of 15 years to control year
format: 'yyyy-mm-dd'
});
$(document).ready(function () {
$('select').material_select();
});
</script>
</body>
</html>