<!--#include file="kenshu.inc"-->
<%
Dim strShainCode, strDateFrom, strDateTo, strDateShime
If Request.Cookies("kenshu")("CODE") = "" then
'---- クッキーがなければ認証エラー画面表示 ----
Call DispError("", "")
Else
'---- 共通ヘッダ表示 ----
Call DispHeader("研修内容詳細", "")
'---- 社員コードを取得する ----
strShainCode = GetShainCode
'---- 申込者を表示 ----
If DispShain = 0 Then
'---- 登録・更新・削除 ----
Call ExecuteSQL
'---- 研修内容を表示 ----
Call DispKenshu
End If
'---- 研修一覧へ戻るボタン ----
Call DispButton
'---- 共通フッタ表示 ----
Call DispFooter("1")
End if
'**************************************
'申込者の表示
'**************************************
Function DispShain()
Dim strShainName, strSoshikiName
'---- レコードセットを作成 ----
strSQL = "SELECT * FROM 社員マスタ A, 組織マスタ B
" & _
"WHERE A.社員コード
= '" & strShainCode & "' " & _
"AND A.組織コード
= B.組織コード"
objRec.Open strSQL, objDBCon
If objRec.EOF And objRec.BOF Then
Response.Write "正しい社員コードを入力して下さい。"
DispShain = -1
objRec.Close
Exit Function
End If
objRec.MoveFirst
strShainName = objRec.Fields("氏名漢字").Value &
"(" & objRec.Fields("氏名カナ").Value & ")"
strSoshikiName = objRec.Fields("組織名").Value
objRec.Close
'---- 申込者の表示 ----
%>
申込者:
<table border="0" bgcolor="<%=GRND%>"
cellpadding="3">
<tr>
<th bgcolor="<%=GRNH%>">社員コード</th>
<td><%=strShainCode%></td>
</tr>
<tr>
<th bgcolor="<%=GRNH%>">社員名</th>
<td><%=strShainName%></td>
</tr>
<tr>
<th bgcolor="<%=GRNH%>">所属部</th>
<td><%=strSoshikiName%></td>
</tr>
</table>
<%
DispShain = 0
End Function
'**************************************
'登録・更新・削除
'**************************************
Sub ExecuteSQL()
'---- 申込データのチェック ----
strSQL = "SELECT * FROM 申込データ " & _
"WHERE
研修コード = '" & Request.Form("KenshuCode") & "' "
& _
"AND
社員コード = '" & Request.Form("ShainCode") & "'"
objDBCon.BeginTrans
objRec.Open strSQL, objDBCon, 1, 2
If objRec.EOF And objRec.BOF Then
If Request.Form("ShoriCode") =
"1" Then
If
Request.Form("Toroku") = "1" Then
'----
新規登録 ----
objRec.AddNew
objRec.Fields("研修コード")
= Request.Form("KenshuCode")
objRec.Fields("社員コード")
= strShainCode
objRec.Fields("状態コード")
= "01"
objRec.Fields("登録者コード")
= Request.Cookies("Kenshu")("CODE")
objRec.Fields("更新日")
= Date()
objRec.Update
Response.Write
"<H3>以下の研修に申し込みました。</H3>"
Else
Call
DispForm("申し込み", "をします。")
End If
Else
Response.Write
"<H3>以下の研修にまだ申し込んでいません。</H3>"
End If
Else
If Request.Form("ShoriCode") =
"1" Then
Response.Write
"<H3>以下の研修には既に申し込み済です。</H3>"
Else
objRec.MoveFirst
If objRec.Fields("状態コード")
= "01" Then
If
Request.Cookies("Kenshu")("CODE") <>
Request.Form("ShainCode") Then
Response.Write
"<H3>研修の申込取り消しは本人が行なって下さい。</H3>"
Else
If
Request.Form("Toroku") = "1" Then
'----
取り消し ----
objRec.Delete
Response.Write
"<H3>以下の研修の申込を取り消しました。</H3>"
Else
Call
DispForm("申込を取り消し", "します。")
End
If
End
If
Else
If
Request.Form("Toroku") = "1" Then
'----
キャンセル ----
objRec.Fields("状態コード")
= "13"
objRec.Fields("更新者コード")
= Request.Cookies("Kenshu")("CODE")
objRec.Fields("更新日")
= Date()
objRec.Update
Response.Write
"<H3>以下の研修の申込をキャンセルしました。</H3>"
Else
Call
DispForm("キャンセル", "します。")
End
If
End If
End If
End If
objRec.Close
objDBCon.CommitTrans
End Sub
'**************************************
'フォームの表示
'**************************************
Sub DispForm(strValue, strEnd)
%>
<form action="kenshu03.asp" method="post">
<input type="hidden" name="ShainCode"
value="<%=strShainCode%>">
<input type="hidden" name="KenshuCode"
value="<%=Request.Form("KenshuCode")%>">
<input type="hidden" name="ShoriCode"
value="<%=Request.Form("ShoriCode")%>">
<input type="hidden" name="Toroku" value="1">
<h3>以下の研修について <input type="submit"
value="<%=strValue%>"> <%=strEnd%></h3>
</form>
<%
End Sub
'**************************************
'研修内容の表示
'**************************************
Sub DispKenshu()
strSQL = "SELECT * FROM 研修データ A, 社員マスタ B
" & _
"WHERE
A.研修コード = '" & Request.Form("KenshuCode") & "'
" & _
"AND
A.講師コード = B.社員コード"
objRec.Open strSQL, objDBCon, 3, 3
'---- 日付の変換 ----
Call EditDispDate(objRec, strDateFrom, strDateTo, strDateShime)
%>
<table border="0" bgcolor="<%=REDD%>"
cellpadding="3">
<tr>
<th bgcolor="<%=REDH%>">研修コード</th>
<td><%=Request.Form("KenshuCode")%></td>
</tr>
<tr>
<th bgcolor="<%=REDH%>">研修名称</th>
<td><%=Server.HTMLEncode(objRec.Fields("研修名称").Value)%></td>
</tr>
<tr>
<th bgcolor="<%=REDH%>">日程</th>
<td><%=strDateFrom &
strDateTo%></td>
</tr>
<tr>
<th bgcolor="<%=REDH%>">時間</th>
<td><%=Server.HTMLEncode(objRec.Fields("時間").Value)%></td>
</tr>
<tr>
<th bgcolor="<%=REDH%>">場所</th>
<td><%=Server.HTMLEncode(objRec.Fields("場所").Value)%></td>
</tr>
<tr>
<th bgcolor="<%=REDH%>">定員</th>
<td><%=objRec.Fields("定員")%></td>
</tr>
<tr>
<th bgcolor="<%=REDH%>">講師</th>
<td><%=Server.HTMLEncode(objRec.Fields("氏名漢字").Value)%></td>
</tr>
<tr>
<th bgcolor="<%=REDH%>">申込締切日</th>
<td><%=strDateShime%></td>
</tr>
<tr>
<th bgcolor="<%=REDH%>">内容詳細</th>
<td><%=objRec.Fields("内容詳細").Value%></td>
</tr>
</table>
<%
objRec.Close
End Sub
%>