Repository navigation
Expand file tree
/
Copy pathwebBack_caseReturn.php
More file actions
283 lines (223 loc) · 7.56 KB
/
Copy pathwebBack_caseReturn.php
File metadata and controls
283 lines (223 loc) · 7.56 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
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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<?php
ob_start();
session_start();
?>
<!DOCTYPE html>
<html lang="UTF-8">
<head>
<meta charset="UTF-8">
<title>後台::案件回報</title>
<link rel="stylesheet" href="css/webBack_caseReturn.css">
<link rel="stylesheet" type="text/css" href="css/web_back_frame.css">
<!-- 自己的css擺這裡 -->
<link rel="stylesheet" href="css/webBack_caseReturn.css">
<!-- 不准動的部分,以下三行 -->
<link rel="stylesheet" type="text/css" href="css/web_back_frame.css">
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> -->
<script src="js/jquery.min.js"></script>
<script src="js/web_back_frame/web_back_frame.js"></script>
<!-- 自己的css擺這裡 -->
</head>
<body>
<?php require_once('web_back_frame_top.php') ?>
<nav>
<div class="nav_item">
<h2>案件回報</h2>
</div>
<div class="nav_item ">
<div class="search">
<input type="text" name="" placeholder="搜尋">
<button><img src="src/image/web_back_frame/seaech.png"></button>
<button><img src="src/image/web_back_frame/erase.png"></button>
</div>
</div>
<div class="nav_item select">
<span>類別:</span>
<select>
<option value="">不限</option>
<option value="">不限</option>
<option value="">不限</option>
</select>
</div>
<div class="nav_item select">
<span>類別:</span>
<select>
<option value="">全部</option>
<option value="">種子</option>
<option value="">魚缸</option>
</select>
</div>
<div class="clearfix"></div>
</nav>
<div class="myForm">
<?php
$i=0;
try{
require_once("php/connectGrowing_hope.php");
$sql = "select *
from bd102g1.return
where return_status in ('N')";
$return = $pdo ->query($sql);
?>
<table cellspacing="1">
<tr>
<th></th>
<th>案件編號</th> <!-- event_no -->
<th>撥款金額</th> <!-- event_title -->
<th>回報日期</th> <!-- event_need -->
<th>回報說明</th> <!-- event_period -->
<th>回報內容</th> <!-- event_allowdate -->
<th>撥款日期</th> <!-- event_status -->
<th>回報審核</th>
<th>確認通過</th>
</tr>
<?php while ( $returnRow = $return->fetchObject()) {
$i++;
$return_no = $returnRow -> return_no;
?>
<!-- <from action="webBack_caseStatus_update.php" method="get"> -->
<tr class="tdRow">
<input type="hidden" name="return_no" class="return_no" value="<?php echo $return_no; ?>">
<td><?php echo $i; ?></td>
<td class="event_no"><?php echo $returnRow -> event_no; ?></td>
<td><?php echo $returnRow -> return_paymoney; ?></td>
<td><?php echo $returnRow -> return_date; ?></td>
<td><?php echo $returnRow -> return_remark; ?></td>
<td><button class="btn detail">查看詳情</button></td>
<td class="paydate">
<input type="date" class="date" name="reutrn_paydate">
</td>
<td class="status">
<select name="status" class="date status">
<option>請選擇</option>
<option value="Y">審核通過</option>
<option value="R">回報退回</option>
</select>
</td>
<td><input type="button" value="確定" class="btn yes"></td>
<!-- <?php //if($status <>"P" echo "disabled";) ?> -->
</tr>
<tr class="tdRow tddisplay">
<td colspan="9">
<?php $type = $returnRow -> return_frame; ?>
<select name="frame" class="date frame change">
<option value="type">選擇版型</option>
<option value="type_1" <?php if ($type == "type_1") echo "selected"; ?>>版型A</option>
<option value="type_2" <?php if ($type == "type_2") echo "selected"; ?>>版型B</option>
<option value="type_3" <?php if ($type == "type_3") echo "selected"; ?>>版型C</option>
</select>
<div class="return">
<div class="type">
<div class="type_img">
<img src="src/image/funded/<?php echo $returnRow -> return_pho; ?>">
</div>
<div class="type_txt">
<p class="title">
<input type="text" class="change" name="return_remark" value="<?php echo $returnRow -> return_remark; ?>">
<span class="date"><?php echo $returnRow -> return_date; ?></span>
</p>
<p class="content">
<textarea class="change">
<?php echo $returnRow -> return_info; ?>
</textarea>
</p>
<div class="clear"></div>
</div>
<input type="hidden" name="return_no" class="return_no" value="<?php echo $return_no; ?>">
<div class="clear"></div>
</div>
<button class="edit" disabled="disabled">確定修改</button>
</div>
</td>
</tr>
<!-- </from> -->
<?php
}
echo "</table>
</div>";
}catch (PDOException $e) {
echo "錯誤行號 : ", $e->getLine(), "<br>";
echo "錯誤訊息 : ", $e->getMessage(), "<br>";
}
?>
<?php require_once('web_back_frame_bottom.php') ?>
<script>
function $id(id){
return document.getElementById(id);
}
$('.detail').click(function(){
$(this).parent().parent().find('+.tddisplay').slideToggle();
});
$('.frame').change(function(){
$type = $(this).val();
$old = $(this).parent().children('.return').children().first().attr('class');
$(this).parent().children('.return').children().first().removeClass($old).addClass($type);
});
$('.change').change(function(){
$('.edit').text('確定修改');
$('.edit').removeAttr('disabled');
$('.edit').addClass('btn');
});
$('.edit').click(function(){
var returnObj = {};
returnObj.return_frame = $(this).parent().parent().children('.frame').val();
returnObj.return_no = $(this).parent().children().children('.return_no').val();
returnObj.return_title = $(this).parent().children('').children('.type_txt').children('.title').children('.change').val();
returnObj.return_info = $(this).parent().children('').children('.type_txt').children('.content').children('.change').val();
//================
var xhr = new XMLHttpRequest();
xhr.onreadystatechange=function (){
if( xhr.readyState == 4){
if( xhr.status == 200 ){
// alert(xhr.responseText);
alert('修改成功!');
location.reload();
}else{
alert( xhr.status );
}
}
}
var data_info = "jsonStr=" + JSON.stringify(returnObj);
alert(data_info);
console.log( data_info);
var url = "webBack_returnEdit.php?" + data_info;
xhr.open("Get", url, true);
xhr.send(null);
$(this).text('修改成功');
$(this).attr('disabled');
$(this).removeClass('btn');
});
$(".yes").click(function(){
var status = $(this).parent().parent().children('.status').children().val();
if (status == 'Y') {
$payday = $(this).parent().parent().children('.paydate').children('.date').val();
if (($payday != null) && ($payday != '0000-00-00') && ($payday != '')) {
var upObj = {};//retrun_paydate
upObj.event_no = $(this).parent().parent().children('.event_no').text();
upObj.return_no = $(this).parent().parent().children('.return_no').val();
upObj.return_paydate = $payday;
var xhr = new XMLHttpRequest();
xhr.onreadystatechange=function (){
if( xhr.readyState == 4){
if( xhr.status == 200 ){
location.reload();
}else{
alert( xhr.status );
}
}
}
var data_info = "jsonStr=" + JSON.stringify(upObj);
console.log( data_info);
var url = "webBack_returnUp.php?" + data_info;
xhr.open("Get", url, true);
xhr.send(null);
}else{
alert("請選擇撥款日期!");
}
}else{
alert('請選擇是否通過!');
}
});
</script>
</body>
</html>