質問編集履歴
1
ソースコード全公開
test
CHANGED
File without changes
|
test
CHANGED
@@ -18,26 +18,390 @@
|
|
18
18
|
|
19
19
|
```import.php
|
20
20
|
|
21
|
+
<head>
|
22
|
+
|
23
|
+
<link rel="stylesheet" href="css/import.css" type="text/css">
|
24
|
+
|
25
|
+
<link href="https://fonts.googleapis.com/css?family=M+PLUS+1p&display=swap" rel="stylesheet">
|
26
|
+
|
27
|
+
<title>インポート確認</title>
|
28
|
+
|
29
|
+
<script type="text/javascript">
|
30
|
+
|
31
|
+
function submitChk () {
|
32
|
+
|
33
|
+
/* 確認ダイアログ表示 */
|
34
|
+
|
35
|
+
var flag = confirm ("この内容で登録して宜しいですか?\n\n登録したくない場合は[キャンセル]ボタンを押して下さい");
|
36
|
+
|
37
|
+
/* send_flg が TRUEなら送信、FALSEなら送信しない */
|
38
|
+
|
39
|
+
return flag;
|
40
|
+
|
41
|
+
}
|
42
|
+
|
43
|
+
function set2fig(num) {
|
44
|
+
|
45
|
+
// 桁数が1桁だったら先頭に0を加えて2桁に調整する
|
46
|
+
|
47
|
+
var ret;
|
48
|
+
|
49
|
+
if( num < 10 ) { ret = "0" + num; }
|
50
|
+
|
51
|
+
else { ret = num; }
|
52
|
+
|
53
|
+
return ret;
|
54
|
+
|
55
|
+
}//時計
|
56
|
+
|
57
|
+
function showClock2() {
|
58
|
+
|
59
|
+
var nowTime = new Date();
|
60
|
+
|
61
|
+
var nowHour = set2fig( nowTime.getHours() );
|
62
|
+
|
63
|
+
var nowMin = set2fig( nowTime.getMinutes() );
|
64
|
+
|
65
|
+
var nowSec = set2fig( nowTime.getSeconds() );
|
66
|
+
|
67
|
+
var msg = nowHour + ":" + nowMin + ":" + nowSec;
|
68
|
+
|
69
|
+
document.getElementById("RealtimeClockArea").innerHTML = msg;
|
70
|
+
|
71
|
+
}//時計
|
72
|
+
|
73
|
+
setInterval('showClock2()',1000);
|
74
|
+
|
75
|
+
</script>
|
76
|
+
|
77
|
+
</head>
|
78
|
+
|
79
|
+
<?php
|
80
|
+
|
81
|
+
try{
|
82
|
+
|
83
|
+
$pdo = new PDO('mysql:host=localhost;dbname=workinfo;charset=utf8', 'root','root',
|
84
|
+
|
85
|
+
array(PDO::ATTR_EMULATE_PREPARES => false));
|
86
|
+
|
87
|
+
} catch (PDOException $e) {
|
88
|
+
|
89
|
+
exit('データベース接続失敗。'.$e->getMessage());
|
90
|
+
|
91
|
+
}
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
//工場を取得
|
96
|
+
|
97
|
+
$location = $_REQUEST['location'];
|
98
|
+
|
99
|
+
//理念を取得'
|
100
|
+
|
101
|
+
$philosophy = $_REQUEST['philosophy'];
|
102
|
+
|
103
|
+
//変数に配列を代入
|
104
|
+
|
105
|
+
$data = array();
|
106
|
+
|
107
|
+
function add_person($workday, $workgroup, $personal, $product, $create, $unit, $exp, $remarks, $worktime, $breaktime)
|
108
|
+
|
109
|
+
{
|
110
|
+
|
111
|
+
global $data;
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
//配列にヘッダーの列名を代入
|
116
|
+
|
117
|
+
$data []= array(
|
118
|
+
|
119
|
+
'workday' => $workday,
|
120
|
+
|
121
|
+
'workgroup' => $workgroup,
|
122
|
+
|
123
|
+
'personal' => $personal,
|
124
|
+
|
125
|
+
'product' => $product,
|
126
|
+
|
127
|
+
'create' => $create,
|
128
|
+
|
129
|
+
'unit' => $unit,
|
130
|
+
|
131
|
+
'exp' => $exp,
|
132
|
+
|
133
|
+
'remarks' => $remarks,
|
134
|
+
|
135
|
+
'worktime' => $worktime,
|
136
|
+
|
137
|
+
'breaktime' => $breaktime
|
138
|
+
|
139
|
+
);
|
140
|
+
|
141
|
+
}
|
142
|
+
|
143
|
+
//ファイルの読み込み
|
144
|
+
|
145
|
+
if ( $_FILES['file']['tmp_name'] )
|
146
|
+
|
147
|
+
{
|
148
|
+
|
149
|
+
$dom = DOMDocument::load( $_FILES['file']['tmp_name'] );
|
150
|
+
|
151
|
+
$rows = $dom->getElementsByTagName( 'Row' );
|
152
|
+
|
153
|
+
//日付に項目がある場合の処理(基本)
|
154
|
+
|
155
|
+
$workday_row = true;
|
156
|
+
|
157
|
+
//繰り返し
|
158
|
+
|
159
|
+
foreach ($rows as $row){
|
160
|
+
|
161
|
+
if ( !$workday_row ){
|
162
|
+
|
163
|
+
$workday = "";
|
164
|
+
|
165
|
+
$workgroup = "";
|
166
|
+
|
167
|
+
$personal = "";
|
168
|
+
|
169
|
+
$product = "";
|
170
|
+
|
171
|
+
$create = "";
|
172
|
+
|
173
|
+
$unit = "";
|
174
|
+
|
175
|
+
$exp = "";
|
176
|
+
|
177
|
+
$remarks = "";
|
178
|
+
|
179
|
+
$worktime = "";
|
180
|
+
|
181
|
+
$breaktime = "";
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
$index = 1;
|
186
|
+
|
187
|
+
$cells = $row->getElementsByTagName( 'Cell' );
|
188
|
+
|
189
|
+
foreach( $cells as $cell ){
|
190
|
+
|
191
|
+
$ind = $cell->getAttribute( 'Index' );
|
192
|
+
|
193
|
+
if ( $ind != null ) $index = $ind;
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
if ( $index == 1 ) $workday = $cell->nodeValue;
|
198
|
+
|
199
|
+
if ( $index == 2 ) $workgroup = $cell->nodeValue;
|
200
|
+
|
201
|
+
if ( $index == 3 ) $personal = $cell->nodeValue;
|
202
|
+
|
203
|
+
if ( $index == 4 ) $product = $cell->nodeValue;
|
204
|
+
|
205
|
+
if ( $index == 5 ) $create = $cell->nodeValue;
|
206
|
+
|
207
|
+
if ( $index == 6 ) $unit = $cell->nodeValue;
|
208
|
+
|
209
|
+
if ( $index == 7 ) $exp = $cell->nodeValue;
|
210
|
+
|
211
|
+
if ( $index == 8 ) $remarks = $cell->nodeValue;
|
212
|
+
|
213
|
+
if ( $index == 9 ) $worktime= $cell->nodeValue;
|
214
|
+
|
215
|
+
if ( $index == 10) $breaktime = $cell->nodeValue;
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
$index += 1;
|
220
|
+
|
221
|
+
}/*
|
222
|
+
|
223
|
+
//SQL文
|
224
|
+
|
225
|
+
$sql = "INSERT INTO $location (workday, workgroup, personal, contents, product, worktime, breaktime) Values(:workday, :workgroup, :personal, :contents, :product, :worktime, :breaktime)";
|
226
|
+
|
227
|
+
$stmt = $pdo -> prepare($sql);
|
228
|
+
|
229
|
+
$workday = substr($workday,0,10);
|
230
|
+
|
231
|
+
//$stmt -> bindParam(':location',$location,PDO::PARAM_STR);
|
232
|
+
|
233
|
+
$stmt -> bindParam(':workday',$workday,PDO::PARAM_STR);
|
234
|
+
|
235
|
+
$stmt -> bindParam(':workgroup',$workgroup,PDO::PARAM_STR);
|
236
|
+
|
237
|
+
$stmt -> bindParam(':personal',$personal,PDO::PARAM_STR);
|
238
|
+
|
239
|
+
$stmt -> bindParam(':contents',$contents,PDO::PARAM_STR);
|
240
|
+
|
241
|
+
$stmt -> bindParam(':product',$product,PDO::PARAM_STR);
|
242
|
+
|
243
|
+
$stmt -> bindParam(':worktime',$worktime,PDO::PARAM_STR);
|
244
|
+
|
245
|
+
$stmt -> bindParam(':breaktime',$breaktime,PDO::PARAM_STR);
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
$stmt->execute();
|
250
|
+
|
251
|
+
*/
|
252
|
+
|
253
|
+
//var_dump($sql);
|
254
|
+
|
255
|
+
add_person($workday, $workgroup, $personal, $product, $create, $unit, $exp, $remarks, $worktime, $breaktime);
|
256
|
+
|
257
|
+
//var_dump($workday, $workgroup, $personal, $contents, $product, $worktime, $breaktime);
|
258
|
+
|
259
|
+
}
|
260
|
+
|
261
|
+
$workday_row = false;
|
262
|
+
|
263
|
+
}
|
264
|
+
|
265
|
+
}
|
266
|
+
|
267
|
+
?>
|
268
|
+
|
269
|
+
<html>
|
270
|
+
|
271
|
+
<body>
|
272
|
+
|
273
|
+
<!--
|
274
|
+
|
275
|
+
<ul class="link">
|
276
|
+
|
277
|
+
<li><a href="index.php">業務内容アップロード</a></li>
|
278
|
+
|
279
|
+
<li><a href="ogaki.php">大垣工場</a></li>
|
280
|
+
|
281
|
+
<li><a href="iga.php">伊賀工場</a></li>
|
282
|
+
|
283
|
+
</ul>
|
284
|
+
|
285
|
+
-->
|
286
|
+
|
287
|
+
<div id="header">
|
288
|
+
|
289
|
+
<img src="img/text-logo-new.png"class="titlelogo">
|
290
|
+
|
291
|
+
<img src="img/logo-new.png" class="logo">
|
292
|
+
|
293
|
+
<h1 class="title">生産計画表 製造場所:(
|
294
|
+
|
295
|
+
<?php if($location == 'ogaki'){
|
296
|
+
|
297
|
+
echo '大垣';
|
298
|
+
|
299
|
+
}else {
|
300
|
+
|
301
|
+
echo '伊賀';
|
302
|
+
|
303
|
+
}
|
304
|
+
|
305
|
+
; ?>)
|
306
|
+
|
307
|
+
</h1>
|
308
|
+
|
309
|
+
<!--日付+曜日+時計-->
|
310
|
+
|
311
|
+
<?php
|
312
|
+
|
313
|
+
$week = array( "日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日" );
|
314
|
+
|
315
|
+
?>
|
316
|
+
|
317
|
+
<h2>本日の日付:<?php echo date("Y/m/d").' '.'('.$week[date("w")].')';?>
|
318
|
+
|
319
|
+
<div class="clock">
|
320
|
+
|
321
|
+
<h2 style="display:inline" id="RealtimeClockArea"></h2>
|
322
|
+
|
323
|
+
</div>
|
324
|
+
|
325
|
+
<hr>
|
326
|
+
|
327
|
+
</div>
|
328
|
+
|
329
|
+
<marquee><h2 class="philosophy"><?php echo $philosophy; ?></h2></marquee>
|
330
|
+
|
331
|
+
<table border ="1" class="table">
|
332
|
+
|
333
|
+
<hr>
|
334
|
+
|
335
|
+
<tr>
|
336
|
+
|
337
|
+
<th>グループ</th>
|
338
|
+
|
339
|
+
<th>担当者</th>
|
340
|
+
|
341
|
+
<th>製造製品</th>
|
342
|
+
|
343
|
+
<th>生産量</th><!--単位も含める-->
|
344
|
+
|
345
|
+
<th>賞味期限</th>
|
346
|
+
|
347
|
+
<th>備考</th>
|
348
|
+
|
349
|
+
<th>就業時間</th>
|
350
|
+
|
351
|
+
<th>休憩時間</th>
|
352
|
+
|
353
|
+
</tr>
|
354
|
+
|
355
|
+
<?php foreach( $data as $row ) { ?>
|
356
|
+
|
357
|
+
<tr>
|
358
|
+
|
359
|
+
<td><?php echo( $row['workgroup'] ); ?></td>
|
360
|
+
|
361
|
+
<td><?php echo( $row['personal'] ); ?></td>
|
362
|
+
|
363
|
+
<td><?php echo( $row['product'] ); ?></td>
|
364
|
+
|
365
|
+
<td><?php echo( $row['create'].$row['unit'] ); ?></td>
|
366
|
+
|
367
|
+
<td><?php echo( $row['exp'] ); ?></td>
|
368
|
+
|
369
|
+
<td><?php echo( $row['remarks'] ); ?></td>
|
370
|
+
|
371
|
+
<td><?php echo( $row['worktime'] ); ?></td>
|
372
|
+
|
373
|
+
<td><?php echo( $row['breaktime'] ); ?></td>
|
374
|
+
|
375
|
+
</tr>
|
376
|
+
|
377
|
+
<?php } ?>
|
378
|
+
|
379
|
+
</table>
|
380
|
+
|
381
|
+
<form enctype="multipart/form-data" action="insert.php" method="post" onsubmit="return submitChk()">
|
382
|
+
|
383
|
+
<input type="hidden" name="workgroup" value=<?php echo $workgroup ?>>
|
384
|
+
|
385
|
+
<input type="hidden" name="personal" value=<?php echo $personal ?>>
|
386
|
+
|
387
|
+
<input type="submit" value="登録" />
|
388
|
+
|
389
|
+
</body>
|
390
|
+
|
391
|
+
</html>
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
```
|
396
|
+
|
397
|
+
```insert.php
|
398
|
+
|
21
399
|
省略///
|
22
400
|
|
23
|
-
<form enctype="multipart/form-data" action="insert.php" method="post">
|
24
|
-
|
25
401
|
$location = $_REQUEST['location'];
|
26
402
|
|
27
|
-
var_dump($location); →
|
403
|
+
var_dump($location); →null
|
28
404
|
|
29
405
|
省略////
|
30
406
|
|
31
407
|
```
|
32
|
-
|
33
|
-
```insert.php
|
34
|
-
|
35
|
-
省略///
|
36
|
-
|
37
|
-
$location = $_REQUEST['location'];
|
38
|
-
|
39
|
-
var_dump($location); →null
|
40
|
-
|
41
|
-
省略////
|
42
|
-
|
43
|
-
```
|