TIM900.php
2.26 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
<?php
//*****************************************************************************
//*
//* プログラム名:タイムカード更新
//* プログラムID:TIM900.php
//* 機能 :タイムカード 更新
//* 作成者 :
//*
//*****************************************************************************
header("Content-type: text/html; charset=EUC-JP");
include("include/session_start.inc");
include("include/SessionChk.inc");
$strDBinc="include/dbcon.inc";
include($strDBinc);
if($mode == "999"){
//一括更新 delete ⇒ insert
$strSQL="delete from tim_tbl where syain_cd = '".$sid."' and tim_year = '".$y."' and tim_month = '".sprintf('%02d', $m)."'";
$objRecSet = pg_exec($strSQL);
if($objRecSet==false){
echo("SQL実行に失敗しました(DELETE)");
exit;
}
for($i=0;$i<count($sH);$i++){
$strSQL = "insert into tim_tbl ";
$strSQL .= "(syain_cd, tim_year, tim_month, tim_day, start_h, start_m, end_h, end_m, tim_bikou, tim_yobi1, tim_yobi2, tim_yobi3) ";
$strSQL .= "values('".$sid."', '".$y."', '".sprintf('%02d', $m)."', '".sprintf('%02d', ($i+1))."', '".cnvNum2($sH[$i])."', '".cnvNum2($sM[$i])."', '".($eH[$i])."', '".cnvNum2($eM[$i])."', '".mb_convert_encoding(addslashes($com[$i]), "eucjp-win", "auto")."', '', '', '') ";
$objRecSet = pg_exec($strSQL);
if($objRecSet==false){
echo("SQL実行に失敗しました(INSERT)");
exit;
}
}
}else{
//単一更新 delete ⇒ insert
$strSQL="delete from tim_tbl where syain_cd = '".$sid."' and tim_year = '".$y."' and tim_month = '".sprintf('%02d', $m)."' and tim_day = '".sprintf('%02d', $mode)."'";
$objRecSet = pg_exec($strSQL);
if($objRecSet==false){
echo("SQL実行に失敗しました(DELETE)");
exit;
}
$strSQL = "insert into tim_tbl ";
$strSQL .= "(syain_cd, tim_year, tim_month, tim_day, start_h, start_m, end_h, end_m, tim_bikou, tim_yobi1, tim_yobi2, tim_yobi3) ";
$strSQL .= "values('".$sid."', '".$y."', '".sprintf('%02d', $m)."', '".sprintf('%02d', $mode)."', '".cnvNum2($sH)."', '".cnvNum2($sM)."', '".cnvNum2($eH)."', '".cnvNum2($eM)."', '".mb_convert_encoding(addslashes($com), "eucjp-win", "auto")."', '', '', '') ";
$objRecSet = pg_exec($strSQL);
if($objRecSet==false){
echo("SQL実行に失敗しました(INSERT)");
exit;
}
}
function cnvNum2($str){
if(trim($str) != ""){
return sprintf('%02d', $str);
}else{
return "";
}
}
?>