<%
End If
Dim Query
Dim Content,Content2
Dim ii, dd, kk
Dim DenpyoPageCnt() '伝票ページカウント配列
Dim PageCnt 'ページカウンタ
Dim DenpyoRowCnt '伝票行数カウンタ
Dim RowCnt '全体行数カウンタ
Dim ShokuchiFlg '諸口表示用フラグ配列(0=無し:1=左側:2=右側:3=両側)
ReDim ShokuchiFlg(0) '諸口表示用フラグ配列(0=無し:1=左側:2=右側:3=両側)
Dim KarikataCnt,KashikataCnt '借方・貸方カウンタ
Dim SentogyoFlg
RowCnt = 0
PageCnt = 0
DenpyoRowCnt = 0
ii = 0
dd = ""
kk = ""
KarikataCnt = 0
KashikataCnt = 0
Dim TmpDenpyoNo
Dim TmpDenpyoKubun
Dim MoveFirstFlg '先頭がEOFでない場合のみMoveFirstするフラグ(例外対策)
MoveFirstFlg = 0
'↓↓↓諸口表示・改ページ用フラグ配列作成(061204小野)
Do While Not(Content.BOF Or Content.EOF)
MoveFirstFlg = 1
TmpDenpyoNo = "" & Content.Fields("伝票番号")
If AutoFlg = 1 Then
TmpDenpyoKubun = "" & Content.Fields("伝票区分") '自動仕訳帳のみ伝票区分毎に分ける
End If
If dd <> "" And kk <> "" And (dd <> TmpDenpyoNo Or kk <> TmpDenpyoKubun) Then
RowCnt = RowCnt + 1 '伝票の最後に小書き行が付加されるので全体行数+1
DenpyoRowCnt = DenpyoRowCnt + 1 '同じく小書き行で直前伝票行数+1
If ShokuchiFlg(ii) = 1 Then
DenpyoRowCnt = DenpyoRowCnt + 1 '直前伝票が諸口フラグ両側なら直前伝票行数+1
RowCnt = RowCnt + 1 '同じく全体行数+1
End If
ReDim Preserve DenpyoPageCnt(ii) '直前伝票ページ配列作成
If RowCnt => RowBreakNum Then
PageCnt = PageCnt + 1 'ページカウントアップ
RowCnt = DenpyoRowCnt '全体行数カウントに直前伝票行数+1をセット
RowCnt = RowCnt + 1 '先頭行の「前ページから」表記のため
End If
DenpyoRowCnt = 1 '伝票行数カウンタリセット+1
DenpyoPageCnt(ii) = PageCnt '直前伝票ページ配列にページカウントをセット
End If
If dd <> TmpDenpyoNo Or kk <> TmpDenpyoKubun Then
dd = TmpDenpyoNo
kk = TmpDenpyoKubun
KarikataCnt = 0
KashikataCnt = 0
ii = ii + 1
ReDim Preserve ShokuchiFlg(ii)
End If
If Content.Fields("借方金額") <> 0 Then
KarikataCnt = KarikataCnt + 1
Else
KashikataCnt = KashikataCnt + 1
End If
If KarikataCnt > 1 And KashikataCnt > 1 Then
ShokuchiFlg(ii) = 1 '諸口フラグ両側
ElseIf KarikataCnt > 1 Then
ShokuchiFlg(ii) = 3 '諸口フラグ左側(SPK自動転記帳簿_仕訳帳照会_伝票貸方で伝票再取得)
ElseIf KashikataCnt > 1 Then
ShokuchiFlg(ii) = 2 '諸口フラグ右側
Else
ShokuchiFlg(ii) = 0 '諸口フラグ無し
End If
RowCnt = RowCnt + 1 '全体行数+1
DenpyoRowCnt = DenpyoRowCnt + 1 '伝票行数+1
Content.MoveNext
Loop
'↓最終伝票の処理
If MoveFirstFlg <> 0 Then 'ループ処理が発生した場合のみ行う(例外対策)
RowCnt = RowCnt + 1 '伝票の最後に小書き行が付加されるので全体行数+1
DenpyoRowCnt = DenpyoRowCnt + 1 '同じく小書き行で直前伝票行数+1
If ShokuchiFlg(ii) = 1 Then
DenpyoRowCnt = DenpyoRowCnt + 1 '直前伝票が諸口フラグ両側なら直前伝票行数+1
RowCnt = RowCnt + 1 '同じく全体行数+1
End If
ReDim Preserve DenpyoPageCnt(ii) '直前伝票ページ配列作成
If RowCnt => RowBreakNum Then
PageCnt = PageCnt + 1 'ページカウントアップ
End If
DenpyoPageCnt(ii) = PageCnt '直前伝票ページ配列にページカウントをセット
'↓EOF
ReDim Preserve ShokuchiFlg(ii+1)
ShokuchiFlg(ii+1) = "EOF"
ReDim Preserve DenpyoPageCnt(ii+1)
DenpyoPageCnt(ii+1) = "EOF"
Content.MoveFirst
End If
'↑↑↑諸口表示・改ページ用フラグ配列作成(061204小野)
'Response.Write(KarikataCnt & vbCrLf)
'Response.Write(KashikataCnt & vbCrLf)
'Exit Function
Dim HeightCell
Dim WidthCell1 '取引日
Dim WidthCell2 '摘要
Dim WidthCell3 '伝票番号
Dim WidthCell4 '元丁
Dim WidthCell5 '金額
Dim FontCell '科目名称
Dim WidthParent
If PrintFlg = 0 Then
HeightCell = 23
WidthCell1 = 82
WidthCell2 = 340
WidthCell3 = 98
WidthCell4 = 50
WidthCell5 = 91
FontCell = 11
WidthParent = 780
Else
HeightCell = 20
WidthCell1 = 72
WidthCell2 = 310
WidthCell3 = 86
WidthCell4 = 43
WidthCell5 = 83
FontCell = 10
WidthParent = 686
End If
For Page = 1 To MaxPage
RowCount = 0
If Page <> 1 Then
Response.Write(PageBreakBefore)
End If
%>
<%
If PrintFlg = 1 Then
Response.Write(PrintHeader1(AutoFlg)) '印刷ヘッダ
End if
%>
|
<% = SetStringInsertSpace(SyoruiMei) %> |
<% If AutoFlg <> -1 And PrintFlg = 1 Then %><% = Page %>ページ<% End If %> |
|
取引日 |
摘 要 |
(<% If PackageMode = 1 Then %>仕訳<% Else %>伝票<% End If %>番号) |
元丁 |
借方金額 |
貸方金額 |
<%
GB_CSVOutput = GB_CSVOutput & "取引日"
GB_CSVOutput = GB_CSVOutput & ",摘要"
If PackageMode = 1 Then
GB_CSVOutput = GB_CSVOutput & ",(仕訳番号)"
Else
GB_CSVOutput = GB_CSVOutput & ",(伝票番号)"
End If
GB_CSVOutput = GB_CSVOutput & ",元丁"
GB_CSVOutput = GB_CSVOutput & ",借方金額"
GB_CSVOutput = GB_CSVOutput & ",貸方金額"
GB_CSVOutput = GB_CSVOutput & "kaigyooygiakaigyooygiakaigyooygiakaigyooygiak"
%>
|
|
<% If PrintFlg <> 1 Then %>
<% End If %>
<% If Page <> 1 Then %>
|
前ページから |
|
|
<% = SetMoney(DbKarikataKingakuTotal, false, true) %> |
<% = SetMoney(DbKashikataKingakuTotal, false, true) %> |
<% RowCount = RowCount + 1 %>
<% End If %>
<%
Dim iiDef
iiDef = -1
ii = 0
dd = ""
kk = ""
SentogyoFlg = 1
Dim TmpDbTorihikibi '諸口両側の場合にCSV出力で日付が消えてしまうための処置
TmpDbTorihikibi = ""
Do While Not(Content.BOF Or Content.EOF)
Dim Denpyo, Tekiyo, Tekiyo2, DenpyoTekiyo, DenpyoTekiyo2
Dim DbDenpyoNo, DbDenpyoKubun, DbDenpyoSyoriKubun
Dim DbTorihikibi, DbKanjyoCD, DbKarikataKingaku, DbKashikataKingaku
Dim DbKanjyoMeisyo
TmpDenpyoNo = "" & Content.Fields("伝票番号")
If AutoFlg = 1 Then
TmpDenpyoKubun = "" & Content.Fields("伝票区分") '自動仕訳帳のみ伝票区分毎に分ける
End If
'表示位置を取得
If iiDef = -1 And TmpDenpyoNo = Param1 Then
iiDef = RowCount
End If
If dd <> TmpDenpyoNo Or kk <> TmpDenpyoKubun Then '小書き入力部
If (AutoFlg <> 1 And dd <> "") Or (AutoFlg = 1 And dd <> "" And kk <> "") Then '初回ループはスルー
If Tekiyo2 = "" Then
Tekiyo2 = DenpyoTekiyo2
End If
RowCount = RowCount + 1 '行数カウント
Response.Write("" & vbCrLf)
Response.Write("" & DbTorihikibi & " | " & vbCrLf)
If PageCnt > DenpyoPageCnt(jj) And DenpyoPageCnt(jj) <> DenpyoPageCnt(jj+1) Then
Response.Write("" & DenpyoTekiyo & " | " & vbCrLf)
Else
Response.Write("" & DenpyoTekiyo & " | " & vbCrLf)
End If
Response.Write(" | " & vbCrLf)
Response.Write(" | " & vbCrLf)
Response.Write(" | " & vbCrLf)
Response.Write(" | " & vbCrLf)
GB_CSVOutput = GB_CSVOutput & "" & DbTorihikibi & "," & DenpyoTekiyo & ",,,," & "kaigyooygiakaigyooygiakaigyooygiakaigyooygiak"
Response.Write(" ")
Tekiyo2 = ""
DenpyoTekiyo2 = ""
SentogyoFlg = 1
If PageCnt > DenpyoPageCnt(jj) And DenpyoPageCnt(jj) <> DenpyoPageCnt(jj+1) Then
dd = TmpDenpyoNo
kk = TmpDenpyoKubun
Exit Do '改ページ
End If
End If
jj = jj + 1
dd = TmpDenpyoNo
kk = TmpDenpyoKubun
End If
If AutoFlg = 1 Then
DbDenpyoKubun = Content.Fields("伝票区分名称")
DbDenpyoSyoriKubun = Content.Fields("伝票処理区分")
If DbDenpyoSyoriKubun = 0 Then
Denpyo = "繰越残高"
ElseIf DbDenpyoSyoriKubun = 9 Then
Denpyo = "整理記入"
ElseIf DbDenpyoSyoriKubun = 1 Then
Denpyo = DbDenpyoKubun & " " & DbDenpyoNo
End If
Tekiyo = Content.Fields("摘要")
Tekiyo = Content.Fields("摘要会社名称") & Content.Fields("摘要")
DenpyoTekiyo = Content.Fields("伝票摘要")
'サイバー会計モードでは取引先を付加
If PackageMode = 1 And "" & Content.Fields("摘要会社名称") <> "" Then
If DenpyoTekiyo <> "" Then
DenpyoTekiyo = ":" & DenpyoTekiyo
End If
DenpyoTekiyo = Content.Fields("摘要会社名称") & DenpyoTekiyo
End If
Else
Denpyo = Content.Fields("伝票番号")
Tekiyo = Content.Fields("摘要")
DenpyoTekiyo = Content.Fields("摘要")
End If
Tekiyo2 = ""
DbDenpyoNo = Content.Fields("伝票番号")
DbTorihikibi = SetTimeYYYYMMDD(Content.Fields("取引日"))
DbKanjyoCD = Content.Fields("勘定CD")
DbKanjyoMeisyo = Content.Fields("勘定名称")
DbKarikataKingaku = Content.Fields("借方金額")
DbKashikataKingaku = Content.Fields("貸方金額")
If SentogyoFlg = 1 Then
SentogyoFlg = 0
Else
DbTorihikibi = ""
DbDenpyoNo = ""
End If
If DbKarikataKingaku <> "" Then
DbKarikataKingakuTotal = DbKarikataKingakuTotal + DbKarikataKingaku
End If
If DbKashikataKingaku <> "" Then
DbKashikataKingakuTotal = DbKashikataKingakuTotal + DbKashikataKingaku
End If
'If AscLen(Tekiyo) > 11 Then
' Tekiyo = AscLeft(Tekiyo,11) '摘要を11byteで切捨て(061027小野)
'End If
RowCount = RowCount + 1 '行数カウント
If ShokuchiFlg(jj) = 1 Then
TmpDbTorihikibi = DbTorihikibi
Response.Write("" & vbCrLf) '諸口両側
Response.Write("" & DbTorihikibi & " | " & vbCrLf)
Response.Write(" | " & vbCrLf)
Response.Write("" & DbDenpyoNo & " | " & vbCrLf)
Response.Write(" | " & vbCrLf)
Response.Write(" | " & vbCrLf)
Response.Write(" | " & vbCrLf)
Response.Write(" ")
RowCount = RowCount + 1 '行数カウント
ShokuchiFlg(jj) = 0
SentogyoFlg = 0
DbTorihikibi = ""
DbDenpyoNo = ""
End If
Response.Write("" & vbCrLf)
Response.Write("" & DbTorihikibi & " | " & vbCrLf)
If ShokuchiFlg(jj) > 2 Then '諸口左側時の処理(貸方優先ソート)
If ShokuchiFlg(jj) = "3" Then
If AutoFlg = 1 Then
Query = "exec SPK自動転記帳簿_仕訳帳照会_伝票貸方 '" & GB_SystemCD & "','" & EnshuCD & "', '" & KaisyaCD & "','" & KaikeiKaishibi & "','" & KaikeiSyuryobi & "','" & DbDenpyoNo & "','" & TmpDenpyoKubun & "'"
Else
Query = "exec SPK帳簿_仕訳帳取得伝票貸方 '" & GB_SystemCD & "','" & EnshuCD & "', '" & KaisyaCD & "', '" & DbDenpyoNo & "'"
End If
'Response.Write(Query)
'Exit Function
Set Content2 = OpenQuery(Query)
DbKanjyoMeisyo = Content2.Fields("勘定名称")
Response.Write("諸 口 | " & KintouWaritsuke(Content2.Fields("勘定名称"), FontCell) & " | |
| " & vbCrLf)
ShokuchiFlg(jj) = 4 'クエリ・諸口記入終了フラグ
Else
DbKanjyoMeisyo = Content2.Fields("勘定名称")
If Content2.Fields("貸方金額") <> "0" Then
Response.Write(" | " & KintouWaritsuke(Content2.Fields("勘定名称"), FontCell) & " |
| " & vbCrLf)
Else
' Response.Write("" & KintouWaritsuke(Content2.Fields("勘定名称"), FontCell) & " | | " & vbCrLf)
Response.Write("" & KintouWaritsuke(Content2.Fields("勘定名称"), FontCell) & " | |
| " & vbCrLf)
End If
End If
Tekiyo = ""
If AutoFlg = 1 Then
' DbDenpyoNo = Content2.Fields("伝票番号")
DbDenpyoKubun = Content2.Fields("伝票区分名称")
DbDenpyoSyoriKubun = Content2.Fields("伝票処理区分")
If DbDenpyoSyoriKubun = 0 Then
Denpyo = "繰越残高"
ElseIf DbDenpyoSyoriKubun = 9 Then
Denpyo = "整理記入"
ElseIf DbDenpyoSyoriKubun = 1 Then
Denpyo = DbDenpyoKubun & " " & DbDenpyoNo
End If
Tekiyo = Content2.Fields("摘要")
Tekiyo = Content2.Fields("摘要会社名称") & Content2.Fields("摘要")
DenpyoTekiyo = Content2.Fields("伝票摘要")
'サイバー会計モードでは取引先を付加
If PackageMode = 1 And "" & Content2.Fields("摘要会社名称") <> "" Then
If DenpyoTekiyo <> "" Then
DenpyoTekiyo = ":" & DenpyoTekiyo
End If
DenpyoTekiyo = Content2.Fields("摘要会社名称") & DenpyoTekiyo
End If
Else
Denpyo = Content2.Fields("伝票番号")
Tekiyo = Content2.Fields("摘要")
DenpyoTekiyo = Content2.Fields("摘要")
End If
DbKanjyoCD = Content2.Fields("勘定CD")
DbKarikataKingaku = Content2.Fields("借方金額")
DbKashikataKingaku = Content2.Fields("貸方金額")
Content2.MoveNext
ElseIf DbKarikataKingaku <> "0" And ShokuchiFlg(jj) = 2 Then '諸口右側時の処理
Response.Write("" & KintouWaritsuke(DbKanjyoMeisyo, FontCell) & " | 諸 口 | |
| " & vbCrLf)
ShokuchiFlg(jj) = 0
ElseIf DbKarikataKingaku <> "0" Then
Response.Write("" & KintouWaritsuke(DbKanjyoMeisyo, FontCell) & " | | |
| " & vbCrLf)
Else
Response.Write(" | " & KintouWaritsuke(DbKanjyoMeisyo, FontCell) & " | |
| " & vbCrLf)
End If
Response.Write("" & DbDenpyoNo & " | " & vbCrLf)
Response.Write("" & DbKanjyoCD & " | " & vbCrLf)
Response.Write("" & ConvIntToMoney(DbKarikataKingaku, false, true) & " | " & vbCrLf)
Response.Write("" & ConvIntToMoney(DbKashikataKingaku, false, true) & " | " & vbCrLf)
Response.Write(" ")
If TmpDbTorihikibi <> "" Then '諸口両側の場合は仕訳1行目の日付が無いのでテンポラリから
GB_CSVOutput = GB_CSVOutput & "" & TmpDbTorihikibi
TmpDbTorihikibi = "" 'クリア
Else
GB_CSVOutput = GB_CSVOutput & "" & DbTorihikibi
End If
GB_CSVOutput = GB_CSVOutput & "," & DbKanjyoMeisyo
GB_CSVOutput = GB_CSVOutput & "," & DbDenpyoNo
GB_CSVOutput = GB_CSVOutput & "," & DbKanjyoCD
GB_CSVOutput = GB_CSVOutput & ","
If "" & DbKarikataKingaku <> "0" Then
GB_CSVOutput = GB_CSVOutput & DbKarikataKingaku
End If
GB_CSVOutput = GB_CSVOutput & ","
If "" & DbKashikataKingaku <> "0" Then
GB_CSVOutput = GB_CSVOutput & DbKashikataKingaku
End If
GB_CSVOutput = GB_CSVOutput & "kaigyooygiakaigyooygiakaigyooygiakaigyooygiak"
Content.MoveNext
Loop
If Content.BOF Or Content.EOF Then
RowCount = RowCount + 1 '行数カウント
If SentogyoFlg = 1 Then
SentogyoFlg = 0
Else
DbTorihikibi = ""
DbDenpyoNo = ""
End If
Response.Write("" & vbCrLf) '最後の小書き入力部
Response.Write("" & DbTorihikibi & " | " & vbCrLf)
Response.Write("" & DenpyoTekiyo & " | " & vbCrLf)
Response.Write(" | " & vbCrLf)
Response.Write(" | " & vbCrLf)
Response.Write(" | " & vbCrLf)
Response.Write(" | " & vbCrLf)
GB_CSVOutput = GB_CSVOutput & "" & DbTorihikibi & "," & DenpyoTekiyo & ",,,," & "kaigyooygiakaigyooygiakaigyooygiakaigyooygiak"
Response.Write(" ")
Tekiyo2 = ""
DenpyoTekiyo2 = ""
End If
If RowCount < RowBreakNum Then
For ii = RowCount + 1 To Max(30, Max(RowBreakNum, (Int((RowCount - 1) / RowBreakNum) + 1) * RowBreakNum) * PrintFlg)
Response.Write("" & vbCrLf)
Response.Write(" | " & vbCrLf)
Response.Write(" | " & vbCrLf)
Response.Write(" | " & vbCrLf)
Response.Write(" | " & vbCrLf)
Response.Write(" | " & vbCrLf)
Response.Write(" | " & vbCrLf)
Response.Write(" ")
Next
End if
%>
<% If PrintFlg <> 1 Then %>
<% End If %>
|
<% If Content.BOF Or Content.EOF Then %>
合計 |
<% = SetMoney(DbKarikataKingakuTotal, false, true) %> |
<% = SetMoney(DbKashikataKingakuTotal, false, true) %> |
|
<% Else %>
|
次ページへ |
|
|
<% = SetMoney(DbKarikataKingakuTotal, false, true) %> |
<% = SetMoney(DbKashikataKingakuTotal, false, true) %> |
|
<% End If %>
<% GB_CSVOutput = GB_CSVOutput & ", 合 計,,," & DbKarikataKingakuTotal & "," & DbKashikataKingakuTotal & "kaigyooygiakaigyooygiakaigyooygiakaigyooygiak" %>
<%
If PrintFlg = 1 Then
Response.Write(PrintFooter())
End If
%>
|
|
<%
If (Content.BOF Or Content.EOF) Then
Exit For
End If
Next
If PrintFlg = 0 Then
%>
|
|