SIM0921.php
3.49 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
<?PHP
//*****************************************************************************
//* プログラム名:大項目設定画面
//* プログラムID:SIM0921.php
//* 機能 :大項目設定画面
//*****************************************************************************
header("Content-type: text/html; charset=EUC-JP");
include("./inc/session_start.inc");
include("./inc/SessionChk.inc");
include("./inc/dbcon.inc");
include('./inc/smarty.conf');
include("./inc/const.inc");
$mode = $_GET["mode"];
$seq = $_GET["seq"];
if($mode == "add"){
//新規
$kName = "";
$kParent = edit_bunrui(0);
$kMode = 1;
$btnCap = "作成";
$seq = 0;
}else if($mode == "edt"){
//修正
$strSQL = "select * from koumoku_tbl where koumoku_seq = ".$seq;
$objRec = pg_exec($strSQL);
if($objRec==false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
$objData = pg_fetch_object($objRec, 0);
$kName = $objData->koumoku_name;
$kParent = edit_bunrui($objData->koumoku_parent);
$kMode = 1;
$btnCap = "修正";
}else if($mode == "del"){
//削除
$strSQL = "delete from koumoku_tbl where koumoku_seq = ".$seq;
$objRec = pg_exec($strSQL);
if($objRec==false){
echo("SQL実行に失敗しました(DELETE)");
exit;
}
//配下の中項目seq取得
$strSQL = "select * from koumoku_tbl where koumoku_mode = 2 and koumoku_parent = ".$seq;
$objRec = pg_exec($strSQL);
if($objRec==false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
if(pg_numrows($objRec) > 0){
for ($intCnt = 0; $intCnt < pg_numrows($objRec); $intCnt++) {
$objData = pg_fetch_object($objRec, $intCnt);
$delSeq[$intCnt] = $objData->koumoku_seq;
}
for ($intCnt = 0; $intCnt < count($delSeq); $intCnt++) {
//中項目削除
$strSQL2 = "delete from koumoku_tbl where koumoku_seq = ".$delSeq[$intCnt];
$objRec2 = pg_exec($strSQL2);
if($objRec2==false){
echo("SQL実行に失敗しました(DELETE)");
exit;
}
//入金データ削除
$strSQL2 = "delete from nyukin_tbl where koumoku_seq = ".$delSeq[$intCnt];
$objRec2 = pg_exec($strSQL2);
if($objRec2==false){
echo("SQL実行に失敗しました(DELETE)");
exit;
}
}
}
header("Location:./SIM0920.php");
exit;
}
//[0]システムURL、[1]HP URL、[2]マニュアルURL、[3]MTC HP URL、[4]マスタメールアドレス、
//[5]期間区分名、[6]大区分名、[7]小区分名、[8]支出名、[9]収入名、[10]消費税率(文字型)
$o_smarty->assign('DEFARR',$DEFARR);
$o_smarty->assign('PHP_SYSNAME',$PHP_SYSNAME);
$o_smarty->assign('PHP_GROUP_NAME',$PHP_GROUP_NAME);
$o_smarty->assign('PHP_BUMON_NAME',$PHP_BUMON_NAME);
$o_smarty->assign('PHP_USER_NAME',$PHP_USER_NAME);
$o_smarty->assign('PHP_USER_ADMIN',$PHP_USER_ADMIN);
$o_smarty->assign('PHP_USER_NYUKIN',$PHP_USER_NYUKIN);
$o_smarty->assign('PHP_USER_SHIKIN',$PHP_USER_SHIKIN);
$o_smarty->assign('kName',$kName);
$o_smarty->assign('kParent',$kParent);
$o_smarty->assign('kMode',$kMode);
$o_smarty->assign('btnCap',$btnCap);
$o_smarty->assign('seq',$seq);
$o_smarty->assign('mode',$mode);
$o_smarty->display('SIM0921.tpl');
function edit_bunrui($prm){
$strSQL = "select * from bunrui_tbl order by disp_rank";
$objRec = pg_exec($strSQL);
if($objRec==false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
for ($j = 0; $j < pg_numrows($objRec); $j++) {
$objData = pg_fetch_object($objRec, $j);
$bSeq[$j] = $objData->bunrui_seq;
$bName[$j] = $objData->bunrui_name;
}
$ret = "";
for($i=0;$i<count($bSeq);$i++){
if($bSeq[$i] == $prm){
$ret .= "<option value='".$bSeq[$i]."' selected>".$bName[$i]."</option>";
}else{
$ret .= "<option value='".$bSeq[$i]."'>".$bName[$i]."</option>";
}
}
return $ret;
}
?>