%
'
'
%>
<%
main()
Sub main()
If Not(SessionCheck()) Then
Exit Sub
End If
Session(HomeAlias & "Kantan") = "0"
'会社セッション初期化(演習状況記帳チェック後の対処)
KaisyaCD = ""
GB_KaisyaCD = ""
KaisyaMeisyo = ""
GB_KaisyaMeisyo = ""
KaisyaRyakuMeisyo = ""
GB_KaisyaRyakuMeisyo = ""
Session(HomeAlias & "KaisyaCD") = ""
Session(HomeAlias & "Gyosyu") = ""
Session(HomeAlias & "GyosyuMeisyo") = ""
Session(HomeAlias & "KaisyaMeisyo") = ""
Session(HomeAlias & "KaisyaRyakuMeisyo") = ""
Session(HomeAlias & "JisyaFlag") = ""
Session(HomeAlias & "ShijyoCD") = ""
Session(DBName & "AdminPC") = 1
Session(HomeAlias & "ShowPrintHeader") = 1
Dim Query
Dim Content
Dim Content2
Dim KyotsuPath
Query = "exec SPMシステム情報取得 '" & GB_SystemCD & "'"
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
KyotsuPath = Content.Fields("共通データパス")
End If
Dim JikkyoTextAry(2)
JikkyoTextAry(1) = "jikkyotext01"
JikkyoTextAry(2) = "jikkyotext02"
Dim Cnt
Call Application.Lock()
For Cnt = 1 To 2
'「Webで学ぶ総合実践@」演習のデータ更新処理(会計年度変更)
Query = "exec SPM演習取得 '" & GB_SystemCD & "', '" & JikkyoTextAry(Cnt) & "'"
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
Dim NendoGenzai
Dim NendoData
Dim NendoSa
NendoGenzai = Year(Now)
If Month(Now) < 4 Then
NendoGenzai = NendoGenzai - 1
End If
' NendoSa = 0
' If DateDiff("d", Content.Fields("会計終了日"), Now) > 0 Then
'会計開始日からの月差を調べ12で割る(会計期間が1日〜月末であるためこの方法で正確)。
'12〜23(1以上2未満)で1年、24〜35(2以上3未満)で2年となる。
' NendoSa = Fix(DateDiff("m", Content.Fields("会計開始日"), Now) / 12)
'Response.Write(DateDiff("m", Content.Fields("会計開始日"), Now) & "ヶ月
")
'Response.Write(NendoSa & "年")
'Exit Sub
' If NendoSa > 0 Then '不要だが念のため
Dim Target
Target = " WHERE 演習CD = '" & JikkyoTextAry(Cnt) & "' "
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TGA入出庫TRN "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("処理日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TGA入出庫TRN "
Query = Query & " SET " & SetWord("処理日", NendoSa)
Query = Query & " , " & SetWord("先方処理日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TGA契約書F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("処理日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TGA契約書F "
Query = Query & " SET " & SetWord("処理日", NendoSa)
Query = Query & " , " & SetWord("開始日", NendoSa)
Query = Query & " , " & SetWord("終了日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TGA手形F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TGA手形F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & " , " & SetWord("支払期日", NendoSa)
Query = Query & " , " & SetWord("顛末日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TGA手形明細F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TGA手形明細F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TGB銀行口座入出金TRN "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("処理日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TGB銀行口座入出金TRN "
Query = Query & " SET " & SetWord("処理日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TGC保険契約F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("申込年月日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TGC保険契約F "
Query = Query & " SET " & SetWord("申込年月日", NendoSa)
Query = Query & " , " & SetWord("保険開始年月日", NendoSa)
Query = Query & " , " & SetWord("保険終了年月日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TGC出庫F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("出庫年月日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TGC出庫F "
Query = Query & " SET " & SetWord("出庫年月日", NendoSa)
Query = Query & " , " & SetWord("請求書発行日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TGC寄託在庫F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("処理日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TGC寄託在庫F "
Query = Query & " SET " & SetWord("寄託開始年月日", NendoSa)
Query = Query & " , " & SetWord("寄託保管期日", NendoSa)
Query = Query & " , " & SetWord("入庫年月日", NendoSa)
Query = Query & " , " & SetWord("処理日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TGC寄託在庫明細F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("倉荷証券回収日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TGC寄託在庫明細F "
Query = Query & " SET " & SetWord("倉荷証券回収日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TGC寄託者TRN "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("処理日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TGC寄託者TRN "
Query = Query & " SET " & SetWord("処理日", NendoSa)
Query = Query & " , " & SetWord("先方処理日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TGC寄託者台帳F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("寄託開始年月日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TGC寄託者台帳F "
Query = Query & " SET " & SetWord("寄託開始年月日", NendoSa)
Query = Query & " , " & SetWord("寄託保管期日", NendoSa)
Query = Query & " , " & SetWord("入庫年月日", NendoSa)
Query = Query & " , " & SetWord("倉荷証券回収日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TGC運送契約F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("申込年月日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TGC運送契約F "
Query = Query & " SET " & SetWord("申込年月日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TGD製造指図書F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("処理日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TGD製造指図書F "
Query = Query & " SET " & SetWord("処理日", NendoSa)
Query = Query & " , " & SetWord("完了日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TGK現金入出金TRN "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("処理日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TGK現金入出金TRN "
Query = Query & " SET " & SetWord("処理日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TKH小売販売TTL "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("買上日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TKH小売販売TTL "
Query = Query & " SET " & SetWord("買上日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSA仕入売上書類F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("処理日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSA仕入売上書類F "
Query = Query & " SET " & SetWord("処理日", NendoSa)
Query = Query & " , " & SetWord("先方処理日", NendoSa)
Query = Query & " , " & SetWord("納入期日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSA領収書F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSA領収書F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSB銀行取引申込書類F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("処理日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSB銀行取引申込書類F "
Query = Query & " SET " & SetWord("処理日", NendoSa)
Query = Query & " , " & SetWord("手形支払期日", NendoSa)
Query = Query & " , " & SetWord("先方処理日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSC運送書類F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("処理日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSC運送書類F "
Query = Query & " SET " & SetWord("処理日", NendoSa)
Query = Query & " , " & SetWord("納入期日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSC運送費請求書F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("処理日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSC運送費請求書F "
Query = Query & " SET " & SetWord("処理日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSC運送費請求書手動F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("処理日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSC運送費請求書手動F "
Query = Query & " SET " & SetWord("処理日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSC運送費請求書手動明細F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("運送日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSC運送費請求書手動明細F "
Query = Query & " SET " & SetWord("運送日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSK伝票F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSK伝票F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSK伝票仕入売上明細F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSK伝票仕入売上明細F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSK帳簿_仕訳帳F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSK帳簿_仕訳帳F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSK帳簿_仕訳日記帳F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSK帳簿_仕訳日記帳F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSK帳簿_仕訳集計表F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSK帳簿_仕訳集計表F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSK帳簿_合計残高試算表F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSK帳簿_合計残高試算表F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSK帳簿_損益計算書F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSK帳簿_損益計算書F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSK帳簿_総勘定元帳F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSK帳簿_総勘定元帳F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSK帳簿_貸借対照表F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSK帳簿_貸借対照表F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSK補助簿_仕入帳F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSK補助簿_仕入帳F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSK補助簿_受取手形記入帳F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSK補助簿_受取手形記入帳F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & " , " & SetWord("振出日", NendoSa)
Query = Query & " , " & SetWord("満期日", NendoSa)
Query = Query & " , " & SetWord("顛末日付", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSK補助簿_商品有高帳F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSK補助簿_商品有高帳F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSK補助簿_売上帳F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSK補助簿_売上帳F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSK補助簿_売掛金元帳F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSK補助簿_売掛金元帳F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSK補助簿_小口現金出納帳F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSK補助簿_小口現金出納帳F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSK補助簿_当座預金出納帳F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSK補助簿_当座預金出納帳F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSK補助簿_支払手形記入帳F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSK補助簿_支払手形記入帳F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & " , " & SetWord("振出日", NendoSa)
Query = Query & " , " & SetWord("満期日", NendoSa)
Query = Query & " , " & SetWord("顛末日付", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSK補助簿_材料仕入帳F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSK補助簿_材料仕入帳F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSK補助簿_材料元帳F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSK補助簿_材料元帳F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSK補助簿_現金出納帳F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSK補助簿_現金出納帳F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TSK補助簿_買掛金元帳F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("取引日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TSK補助簿_買掛金元帳F "
Query = Query & " SET " & SetWord("取引日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
If 0=1 Then '個人情報は保留
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TTA社員台帳M "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("入社年月日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TTA社員台帳M "
Query = Query & " SET " & SetWord("生年月日", NendoSa)
Query = Query & " , " & SetWord("入社年月日", NendoSa)
Query = Query & " , " & SetWord("離職年月日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TTA給与明細F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("支給年月日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TTA給与明細F "
Query = Query & " SET " & SetWord("支給年月日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TTXFAXF "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("作成日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TTXFAXF "
Query = Query & " SET " & SetWord("作成日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TTXメールF "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("作成日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TTXメールF "
Query = Query & " SET " & SetWord("作成日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TTX文書F "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("処理日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TTX文書F "
Query = Query & " SET " & SetWord("処理日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
Query = ""
Query = Query & " SELECT TOP 1 * "
Query = Query & " FROM TC2演習M "
Query = Query & Target
Set Content = OpenQuery(Query)
If Not(Content.BOF Or Content.EOF) Then
NendoSa = 0
NendoData = Content.Fields("会計開始日")
If Month(NendoData) < 4 Then
NendoData = Year(NendoData) - 1
Else
NendoData = Year(NendoData)
End If
NendoSa = NendoGenzai - NendoData
If NendoSa > 0 Then
Query = ""
Query = Query & " UPDATE TC2演習M "
Query = Query & " SET " & SetWord("会計開始日", NendoSa)
Query = Query & " , " & SetWord("会計終了日", NendoSa)
Query = Query & Target
Set Content = OpenQuery(Query)
' Response.Write(Query)
' Exit Sub
End If
End If
End If
Next
Call Application.Unlock()
'消費税率マスタ辻褄合わせ(191015小野)
Call Application.Lock()
Query = ""
Query = Query & " SELECT TC2演習M.演習CD, TC2演習M.消費税, TDA消費税率M.消費税率 "
Query = Query & " FROM TC2演習M "
Query = Query & " LEFT OUTER JOIN TDA消費税率M "
Query = Query & " ON TC2演習M.システムCD = TDA消費税率M.システムCD "
Query = Query & " AND TC2演習M.演習CD = TDA消費税率M.演習CD "
Query = Query & " WHERE TDA消費税率M.演習CD IS NULL "
Set Content = OpenQuery(Query)
Do While Not(Content.BOF Or Content.EOF)
Query = ""
Query = Query & " "
Query = Query & " if not(exists(select * from TDA消費税率M WHERE システムCD = '" & GB_SystemCD & "' AND 演習CD = '" & Content.Fields("演習CD") & "')) "
Query = Query & " begin "
Query = Query & " INSERT INTO TDA消費税率M (システムCD, 演習CD, 消費税率, 標準, 運送費標準) "
Query = Query & " VALUES ('" & GB_SystemCD & "', '" & Content.Fields("演習CD") & "', " & Content.Fields("消費税") & ", '1', '1') "
Query = Query & " end "
Set Content2 = OpenQuery(Query)
Content.MoveNext
Loop
Call Application.Unlock()
'口座の存在しないゴミ残高の削除(201104小野)
Call Application.Lock()
Query = ""
Query = Query & " DELETE TGB銀行口座入出金TRN "
Query = Query & " FROM TGB銀行口座入出金TRN "
Query = Query & " LEFT OUTER JOIN TGB銀行口座F "
Query = Query & " ON TGB銀行口座入出金TRN.システムCD = TGB銀行口座F.システムCD "
Query = Query & " AND TGB銀行口座入出金TRN.演習CD = TGB銀行口座F.演習CD "
Query = Query & " AND TGB銀行口座入出金TRN.銀行CD = TGB銀行口座F.銀行CD "
Query = Query & " AND TGB銀行口座入出金TRN.口座区分 = TGB銀行口座F.口座区分 "
Query = Query & " AND TGB銀行口座入出金TRN.口座番号 = TGB銀行口座F.口座番号 "
Query = Query & " WHERE TGB銀行口座F.システムCD IS NULL "
Set Content = OpenQuery(Query)
Call Application.Unlock()
%>
<% = HtmlHeader("") %>