TIM004.php
11.7 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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
<?php
//*****************************************************************************
//*
//* プログラム名:タイムカードCSVダウンロード
//* プログラムID:TIM004.php
//* 機能 :タイムカード CSVダウンロード
//* 作成者 :
//*
//*****************************************************************************
header("Content-type: text/html; charset=EUC-JP");
include("include/session_start.inc");
include("include/SessionChk.inc");
include('include/smarty.conf');
$strDBinc="include/dbcon.inc";
include($strDBinc);
//社員情報取得
$strSQL="SELECT syain_cd,name_kj_sei,name_kj_mei".
" FROM syain_tbl Where del_flg=true Order By Disp_rank";
$objData = pg_exec($strSQL);
for($intCnt = 0; $intCnt < pg_numrows($objData) ; $intCnt++) {
$objRecData = pg_fetch_object($objData, $intCnt);
$strSyain[$intCnt][0]=$objRecData->syain_cd;
$strSyain[$intCnt][1]=$objRecData->name_kj_sei.$objRecData->name_kj_mei;
$strSyain[$intCnt][2]="";
$strSQL = "SELECT * From syozoku_tbl Where syain_cd='".$strSyain[$intCnt][0]."' ";
$objBumon = pg_exec($strSQL);
for($i = 0; $i < pg_numrows($objBumon) ; $i++) {
$objRecBumon = pg_fetch_object($objBumon, $i);
$strSyain[$intCnt][2].=$objRecBumon->syozoku_cd."/";
}
}
//全部門
$strSQL = "SELECT syozoku_cd,bumon_name,disp_rank From mst_bumon Where del_flg=0 Order By disp_rank";
$objBumon = pg_exec($strSQL);
for($intCnt = 0; $intCnt < pg_numrows($objBumon) ; $intCnt++) {
$objRecBumon = pg_fetch_object($objBumon, $intCnt);
$strBumon[$intCnt][0]=$objRecBumon->syozoku_cd;
$strBumon[$intCnt][1]=$objRecBumon->bumon_name;
}
$calYMD1 = date("Y")."/".date("m")."/".date("d");
$calYMD2 = date("Y")."/".date("m")."/".date("d");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=EUC-JP">
<META http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" type="text/css" href="basefont.css">
<TITLE>E-グルPro</TITLE>
<!--カレンダーScriptの設定-->
<script type="text/javascript" src="./lib/jkl-calendar.js" charset="Shift_JIS"></script>
<script type="text/javascript" src="./lib/jslb_ajax.js"></script>
<script type="text/javascript" src="xmlhttp.js"></script>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--
function cal_load(){
Select_visibility(1);
if(document.getElementById("calid") != null){
document.getElementById("calid").style.display="none";
document.getElementById("calid").innerHTML="";
}
if(document.getElementById("calid2") != null){
document.getElementById("calid2").style.display="none";
document.getElementById("calid2").innerHTML="";
}
}
function Select_visibility(flg){
var MaxCount = document.e_gru.getElementsByTagName("select").length;
for(i=0;i<MaxCount;i++){
if(flg==0){
document.e_gru.getElementsByTagName("select")[i].style.visibility = "hidden";
}else{
document.e_gru.getElementsByTagName("select")[i].style.visibility = "";
}
}
}
//--------------------------
// オールチェック
//--------------------------
function All_chk(intSts){
if (document.e_gru.syain_chk.length){
if (intSts==1){
for(i = 0 ; i <= document.e_gru.syain_chk.length-1; i++ ){
document.e_gru.syain_chk[i].checked=false;
}
}else{
for(i = 0 ; i <= document.e_gru.syain_chk.length-1; i++ ){
document.e_gru.syain_chk[i].checked=true;
}
}
}else{
if (intSts==1){
document.e_gru.syain_chk.checked=false;
}else{
document.e_gru.syain_chk.checked=true;
}
}
}
//--------------------------
// 部門チェック
//--------------------------
function All_chk2(){
All_chk(1);
if (document.e_gru.syain_chk.length){
for(i = 0 ; i <= document.e_gru.syain_chk.length-1; i++ ){
arr = (document.e_gru.syain_hid[i].value).split("/");
for(j=0;j<arr.length;j++){
if (document.e_gru.bumon.value==arr[j]){
document.e_gru.syain_chk[i].checked=true;
break;
}
}
}
}else{
arr = (document.e_gru.syain_hid.value).split("/");
for(j=0;j<arr.length;j++){
if (document.e_gru.bumon.value==arr[j]){
document.e_gru.syain_chk.checked=true;
break;
}
}
}
}
//--------------------------
// CSVダウンロード
//--------------------------
function CSVDownLoad(){
//開始年月日入力チェック
if(document.e_gru.st_year.value=="" && document.e_gru.st_mon.value != ""){
alert("開始年を選択してください");
return false;
}
if(document.e_gru.st_year.value=="" && document.e_gru.st_mon.value==""&& document.e_gru.st_day.value != ""){
alert("開始年、開始月を選択してください");
return false;
}
if(document.e_gru.st_year.value!="" && document.e_gru.st_mon.value==""&& document.e_gru.st_day.value != ""){
alert("開始月を選択してください");
return false;
}
//終了年月日入力チェック
if(document.e_gru.ed_year.value=="" && document.e_gru.ed_mon.value != ""){
alert("終了年を選択してください");
return false;
}
if(document.e_gru.ed_year.value=="" && document.e_gru.ed_mon.value==""&& document.e_gru.ed_day.value != ""){
alert("終了年、終了月を選択してください");
return false;
}
if(document.e_gru.ed_year.value!="" && document.e_gru.ed_mon.value==""&& document.e_gru.ed_day.value != ""){
alert("終了月を選択してください");
return false;
}
prm = "";
prm_list="";
if (document.e_gru.syain_chk.length){
for(i = 0 ; i <= document.e_gru.syain_chk.length-1; i++ ){
if (document.e_gru.syain_chk[i].checked==true){
prm_list+=document.e_gru.syain_chk[i].value+",";
}
}
}else{
prm_list+=document.e_gru.syain_chk.value+",";
}
if (prm_list==""){
alert("社員を最低一人を選択してください。");
return false;
}
prm = "lst_data="+prm_list;
prm += "&st_year="+document.e_gru.st_year.value;
prm += "&st_mon="+document.e_gru.st_mon.value;
prm += "&st_day="+document.e_gru.st_day.value;
prm += "&ed_year="+document.e_gru.ed_year.value;
prm += "&ed_mon="+document.e_gru.ed_mon.value;
prm += "&ed_day="+document.e_gru.ed_day.value;
document.e_gru.action = "TIM902.php?"+prm;
location.href = document.e_gru.action;
}
//カレンダー表示
function cal_get(strDate, divid){
arrYMD = strDate.split("/");
if(divid == "calid"){
document.getElementById("calid").style.display="";
objY = document.e_gru.st_year;
objM = document.e_gru.st_mon;
objD = document.e_gru.st_day;
}else if(divid == "calid2"){
document.getElementById("calid2").style.display="";
objY = document.e_gru.ed_year;
objM = document.e_gru.ed_mon;
objD = document.e_gru.ed_day;
}
//年
for(i=0;i<objY.options.length;i++){
if(objY.options[i].value == eval(arrYMD[0])){
objY.selectedIndex = i;
break;
}
}
//月
for(i=0;i<objM.options.length;i++){
if(objM.options[i].value == arrYMD[1]){
objM.selectedIndex = i;
break;
}
}
//日
for(i=0;i<objD.options.length;i++){
if(objD.options[i].value == arrYMD[2]){
objD.selectedIndex = i;
break;
}
}
cal = new JKL.Calendar("calid","e_gru","colname1");
cal2 = new JKL.Calendar("calid2","e_gru","colname2");
}
document.onclick=function(){
Select_visibility(1);
if(document.getElementById("calid") != null){
document.getElementById("calid").style.display="none";
document.getElementById("calid").innerHTML="";
}
if(document.getElementById("calid2") != null){
document.getElementById("calid2").style.display="none";
document.getElementById("calid2").innerHTML="";
}
}
var cal = new JKL.Calendar("calid","e_gru","colname1");
var cal2 = new JKL.Calendar("calid2","e_gru","colname2");
-->
</script>
</HEAD>
<BODY onLoad="cal_load();">
<form name="e_gru">
<?php
$intLoop=date("Y")-2004+3;
?>
<br>
<TABLE width="580">
<TR>
<TD>
<TABLE cellspacing="1" cellpadding="1" width="100%" align="center" class="mainColor" border="0">
<TR>
<TD width=95 height=25 class="toneDown"><span class=Normalfont>出力期間</span></TD>
<TD height=25 bgcolor="#ffffff">
開始日
<SELECT name=st_year>
<option value="" selected>----</option>;
<?php
for ($i = 0 ; $i <= $intLoop ; $i++) {
$intSetValue=2004+$i;
echo '<option value='.$intSetValue.'>'.$intSetValue.'</option>';
}
?>
</SELECT>年
<SELECT name=st_mon>
<option value="" selected>---</option>;
<?php
for ($i = 1 ; $i <= 12 ; $i++) {
echo '<option value="'.sprintf('%02d',$i).'">'.$i.'</option>';
}
?>
</SELECT>月
<SELECT name=st_day>
<option value="" selected>---</option>;
<?php
for ($i = 1 ; $i <= 31 ; $i++) {
echo '<option value="'.sprintf('%02d',$i).'">'.$i.'</option>';
}
?>
</SELECT>日
<!--カレンダー表示-->
<a href="javascript:cal.write();">
<img id="dateLink1" src="./image/calendar.gif" alt="日付選択" border="0" style="vertical-align:middle;margin:5px"/>
</a>
<input type="hidden" name="colname1" value="<?php echo $calYMD2 ;?>">
<div id="calid" ></div>
<br>終了日
<SELECT name=ed_year>
<option value="">----</option>;
<?php
for ($i = 0 ; $i <= $intLoop ; $i++) {
$intSetValue=2004+$i;
echo '<option value="'.$intSetValue.'" ';
if (date("Y") == $intSetValue) {
echo 'selected';
}
echo '>'.$intSetValue.'</option>';
}
?>
</SELECT>年
<SELECT name=ed_mon>
<option value="">---</option>;
<?php
for ($i = 1 ; $i <= 12 ; $i++) {
echo '<option value="'.sprintf('%02d',$i).'" ';
if (date("n") == $i) {
echo 'selected';
}
echo '>'.$i.'</option>';
}
?>
</SELECT>月
<SELECT name=ed_day>
<option value="" selected>---</option>;
<?php
for ($i = 1 ; $i <= 31 ; $i++) {
echo '<option value="'.sprintf('%02d',$i).'" ';
if (date("d") == $i) {
echo 'selected';
}
echo '>'.$i.'</option>';
}
?>
</SELECT>日
<!--カレンダー表示-->
<a href="javascript:cal2.write();">
<img id="dateLink2" src="./image/calendar.gif" alt="日付選択" border="0" style="vertical-align:middle;margin:5px"/>
</a>
<input type="hidden" name="colname2" value="<?php echo $calYMD2 ;?>">
<div id="calid2" ></div>
<span class=Normalfont> </span><br>
</TD>
</TR>
<TR>
<TD width=95 height=25 class="toneDown"><span class=Normalfont>出力部門</span></TD>
<TD height=25 bgcolor="#ffffff">
<select name="bumon" onchange="All_chk2();">
<?php
for($intCnt = 0; $intCnt < count($strBumon) ; $intCnt++) {
echo '<option value="'.$strBumon[$intCnt][0].'">'.$strBumon[$intCnt][1].'</option>';
}
?>
</select>
</TD>
</TR>
<TR>
<TD width=95 height=25 class="toneDown"><span class=Normalfont>出力社員</span></TD>
<TD height=25 bgcolor="#ffffff">
<INPUT type="button" onclick="All_chk(0);" value="全選択">
<INPUT type="button" onclick="All_chk(1);" value="全解除"><BR>
<?php
for($intCnt = 0; $intCnt < count($strSyain) ; $intCnt++) {
echo '<input type="checkbox" name="syain_chk" id="'.$strSyain[$intCnt][0].'" value="'.$strSyain[$intCnt][0].'">';
echo '<label for="'.$strSyain[$intCnt][0].'">';
echo '<span class="Normalfont">'.$strSyain[$intCnt][1].'</span>';
echo '</label><BR>';
echo '<input type="hidden" name="syain_hid" value="'.$strSyain[$intCnt][2].'">';
}
?>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
<input type="button" onClick="CSVDownLoad();" name = "btnCsv" value="ダウンロード"> <input type="button" onClick="javascript:window.close();" name = "btnCsv" value="閉じる">
</form>
</BODY>
</HTML>