-
Notifications
You must be signed in to change notification settings - Fork 6
/
input.php
250 lines (217 loc) · 9.51 KB
/
input.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
<?php
require_once 'connectvars.php';
//开启一个会话
session_start();
$msg = "";
if(!isset($_POST['InvoiceNum']) || $_POST['InvoiceNum'] == ''){
//$_SESSION['flag'] = "true";
} else {
// echo "user id: " . $_SESSION[user_id] . " user name: " . $_SESSION['user_name'];
// 创建连接
$conn = new mysqli($servername, $username, $password, $dbname);
// 检测连接
if ($conn->connect_error) {
die("连接失败: " . $conn->connect_error);
}
mysqli_query($conn, 'set names utf8');
$sql="INSERT INTO InvoiceInfo
(UserId,InvoiceNum,PurchaserName,
SellerName,AmountInFiguers,InvoiceDate,
InvoiceCode,SellerAddress,SellerRegisterNum)
VALUES
('$_SESSION[user_id]','$_POST[InvoiceNum]','$_POST[PurchaserName]',
'$_POST[SellerName]','$_POST[AmountInFiguers]','$_POST[InvoiceDate]',
'$_POST[InvoiceCode]','$_POST[SellerAddress]','$_POST[SellerRegisterNum]')";
if ($conn->query($sql) === TRUE) {
$msg = "新记录插入成功";
} else {
$msg ="Error: " . $sql . "<br>" . $conn->error;
}
$sql="INSERT INTO InvoiceCreateInfo
(UserId,InvoiceNum)
VALUES
('$_SESSION[user_id]','$_POST[InvoiceNum]')";
if ($conn->query($sql) === TRUE) {
$msg = "新记录插入成功";
} else {
$msg ="Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
}
?>
<!--
'$_SESSION[user_id]',
'$_SESSION[InvoiceNum]',
'$_SESSION[PurchaserName]',
'$_SESSION[SellerName]',
'$_SESSION[AmountInFiguers]',
'$_SESSION[InvoiceDate]',
'$_SESSION[InvoiceCode]',
'$_SESSION[SellerAddress]',
'$_SESSION[SellerRegisterNum]')
-->
<!doctype html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="./css/bootstrap/favicon.ico">
<title>发票信息输入</title>
<!-- Bootstrap core CSS -->
<link href="./css/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="./css/form-validation.css" rel="stylesheet">
</head>
<body class="bg-light">
<nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0">
<a class="navbar-brand" href="./features.php">
<img class="rounded-circle" src="./img/home.jpeg" width="25" height="25">
Home
</a>
<!-- <input class="form-control form-control-dark w-100" type="text" placeholder="Search" aria-label="Search"> -->
<ul class="navbar-nav px-3">
<li class="nav-item text-nowrap">
<a class="nav-link" href="./userState.php">
<img class="rounded-circle" src="./img/login.ico" width="25" height="25">
</a>
</li>
</ul>
</nav>
<div class="container">
<div class="py-5 text-center">
<img class="d-block mx-auto mb-4" src="./img/in_hand.ico" alt="" width="100" height="100">
<h2>输入发票信息
<a href="./features/speechRrecognition/in_voice.php">
<img class="rounded-circle" src="./img/speed.jpg" width="25" height="25">
</a>
</h2>
<!-- <p class="lead">Below is an example form built entirely with Bootstrap's form controls. Each required form group has a validation state that can be triggered by attempting to submit the form without completing it.</p> -->
<?php echo $msg; ?>
</div>
<div class="row">
<div class="col-md-12 order-md-1">
<!-- <h4 class="mb-3">发票信息</h4> -->
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" class="needs-validation" novalidate>
<div class="row">
<div class="col-md-6 mb-3">
<label for="PurchaserName">购买方名称</label>
<input type="text" class="form-control" name="PurchaserName" placeholder="购买方名称"
<?php
if(isset($_SESSION[PurchaserName]) && $_SESSION[PurchaserName] != '') {
echo "value = " . $_SESSION[PurchaserName] . " ";}
?> required>
<div class="invalid-feedback">
要求输入购买方名称
</div>
</div>
<div class="col-md-6 mb-3">
<label for="SellerName">销售方名称</label>
<input type="text" class="form-control" name="SellerName" placeholder="销售方名称"
<?php
if(isset($_SESSION[SellerName]) && $_SESSION[SellerName] != '') {
echo "value = " . $_SESSION[SellerName] . " ";}
?> required>
<div class="invalid-feedback">
要求输入销售方名称
</div>
</div>
</div>
<div class="mb-3">
<label for="InvoiceNum">发票号码</label>
<input type="text" class="form-control" name="InvoiceNum" placeholder="8位纯数字"
<?php
if(isset($_SESSION[InvoiceNum]) && $_SESSION[InvoiceNum] != '') {
echo "value = " . $_SESSION[InvoiceNum] . " ";}
?>>
</div>
<div class="mb-3">
<label for="AmountInFiguers">消费总额</label>
<input type="text" class="form-control" name="AmountInFiguers" placeholder="包括税款,可以带小数"
<?php
if(isset($_SESSION[AmountInFiguers]) && $_SESSION[AmountInFiguers] != '') {
echo "value = " . $_SESSION[AmountInFiguers] . " ";}
?>>
</div>
<div class="mb-3">
<label for="InvoiceDate">发票日期</label>
<input type="text" class="form-control" name="InvoiceDate" placeholder="开具发票的时间"
<?php
if(isset($_SESSION[InvoiceDate]) && $_SESSION[InvoiceDate] != '') {
echo "value = " . $_SESSION[InvoiceDate] . " ";}
?>>
</div>
<div class="mb-3">
<label for="InvoiceCode">发票代码</label>
<input type="text" class="form-control" name="InvoiceCode" placeholder="10位纯数字"
<?php
if(isset($_SESSION[InvoiceCode]) && $_SESSION[InvoiceCode] != '') {
echo "value = " . $_SESSION[InvoiceCode] . " ";}
?>>
</div>
<div class="mb-3">
<label for="SellerAddress">销售方地址电话</label>
<input type="text" class="form-control" name="SellerAddress" placeholder="销售方地址电话"
<?php
if(isset($_SESSION[SellerAddress]) && $_SESSION[SellerAddress] != '') {
echo "value = " . $_SESSION[SellerAddress] . " ";}
?>>
</div>
<div class="mb-3">
<label for="SellerRegisterNum">销售方纳税编号</label>
<input type="text" class="form-control" name="SellerRegisterNum" placeholder="数字英文混合的16位字符"
<?php
if(isset($_SESSION[SellerRegisterNum]) && $_SESSION[SellerRegisterNum] != '') {
echo "value = " . $_SESSION[SellerRegisterNum] . " ";}
?>>
</div>
<button class="btn btn-primary btn-lg btn-block" type="submit">提交</button>
</form>
</div>
</div>
<?php
$_SESSION[InvoiceNum] = '';
$_SESSION[PurchaserName] = '';
$_SESSION[SellerName] = '';
$_SESSION[AmountInFiguers] = '';
$_SESSION[InvoiceDate] = '';
$_SESSION[InvoiceCode] = '';
$_SESSION[SellerAddress] = '';
$_SESSION[SellerRegisterNum] = '';
?>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script>window.jQuery || document.write('<script src="./css/bootstrap/assets/js/vendor/jquery-slim.min.js"><\/script>')</script>
<script src="./css/bootstrap/assets/js/vendor/popper.min.js"></script>
<script src="./css/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="./css/bootstrap/assets/js/vendor/holder.min.js"></script>
<script>
// Example starter JavaScript for disabling form submissions if there are invalid fields
(function() {
'use strict';
window.addEventListener('load', function() {
// Fetch all the forms we want to apply custom Bootstrap validation styles to
var forms = document.getElementsByClassName('needs-validation');
// Loop over them and prevent submission
var validation = Array.prototype.filter.call(forms, function(form) {
form.addEventListener('submit', function(event) {
if (form.checkValidity() === false) {
event.preventDefault();
event.stopPropagation();
}
form.classList.add('was-validated');
}, false);
});
}, false);
})();
</script>
</body>
</html>
<!-- <script language="javascript" type="text/javascript">
// 以下方式定时跳转
setTimeout("javascript:location.href='./in_hand.html'", 3000);
</script> -->