Malicious Office (OOXML) — malware analysis report

Static analysis result for SHA-256 08db70a608e52f15…

MALICIOUS

Office (OOXML)

222.7 KB Created: 2020-04-03 06:37:00 UTC Authoring application: Microsoft Excel 14.0300 First seen: 2021-01-23
MD5: 102904eb7e1e9bb2b25e86f34d4bff85 SHA-1: 7ccdc178bd47105cb159fc7559fabf2b0234f35b SHA-256: 08db70a608e52f15325e1c1bf41e3a4cfc910f1ded89d5dd16bb697dc1c8eb65
176 Risk Score

Heuristics 6

  • VBA project inside OOXML medium 4 related findings OOXML_VBA
    Document contains a VBA project — VBA macros present
  • Potential Shell call in VBA critical OLE_VBA_SHELL
    Potential Shell call in VBA
    Matched line in script
        WK_処理ID = Shell(PM_処理, PM_実行方法)
  • CreateObject call high OLE_VBA_CREATEOBJ
    CreateObject call
    Matched line in script
        Set WK_FS = CreateObject("Scripting.FileSystemObject")
  • VBA p-code auto-exec with execution tokens high OLE_VBA_PCODE_AUTOEXEC_EXEC
    Compiled VBA/cache stream contains an auto-execution token together with shell/download/object-execution tokens. This catches p-code-only or source-extraction-failure macro documents where visible source is unavailable.
  • Auto_Open macro low OLE_VBA_AUTO
    Auto_Open macro
    Matched line in script
    Sub AUTO_OPEN()
  • Hidden worksheet (veryHidden) low OOXML_HIDDEN_SHEET
    Excel workbook contains 1 hidden sheet(s) — hidden sheets are commonly used to conceal macro code, staging data, or intermediate payload construction

Extracted artifacts 2

Files carved from inside the sample during analysis.

FilenameKindSourceSize
macros.bas vba-macro oletools.olevba.extract_macros (decoded VBA source from OOXML) 265989 bytes
SHA-256: 4863d7ebd6a74d6fce469a2ad4b27f94c687f9dc2cd2290151c3cee09cf73da4
Preview script
First 1,000 lines of the extracted script
Attribute VB_Name = "MDL_共通関数"
Option Explicit
'
' EX_経済連仕切書_01
'   商人物仕切書 処理
'
' PUBLIC変数設定
'
    
' ** 処理用
Public Type PS_処理フォルダー
    PS_基準_Fld             As String
    PS_サブ_Fld             As String
    PS_PDF_Fld              As String
    PS_CSV_Fld              As String
    PS_Excel_Fld            As String
End Type

    Public Const vb_ログファイル = "C:\LogFold\LogFile.TXT"
    Public PCM As New Cls_Comm_01
    
    '' モジュール変数設定
    Dim MWK_Iniファイル名 As String
    Dim MWK_AS400フォルダー As String
    Dim MWK_Pgmフォルダー As String
    Dim MWK_Imgフォルダー As String
    Dim MWK_Workフォルダー As String
    Dim MWK_送信フォルダー As PS_処理フォルダー
    Dim MWK_処理フォルダー As PS_処理フォルダー
    Dim MWK_履歴フォルダー As PS_処理フォルダー
    
    Dim MWK_個別ファイル名 As String
    Dim MWK_個別キー As String
    Dim MWK_前回個別ファイル名 As String
    Dim MWK_処理ファイル名 As String
    Dim MWK_処理ファイル As PS_TBLARY
    Dim MWK_AS400ファイル名 As String
    Dim MWK_xlsファイル名 As String
    Dim MWK_xlsレイアウト名 As String
    Dim MWK_Pgmファイル名 As String
    Dim MWK_プログラム As String
    
    '' ファイル名用
    Dim MWK_Fileファイル名 As String
    Dim MWK_File処理日付 As String
    Dim MWK_Fileパターン As String

    Dim MWK_レイアウト As Range
    Dim MWK_ページ行数 As Long
    Dim MWK_開始行数 As Long
    Dim MWK_終了行数 As Long

    Dim MWK_ページ長 As Long
    Dim MWK_先頭行 As Long
    Dim MWK_明細行 As Long
    Dim MWK_現在行 As Long
    Dim MWK_前行 As Long
    Dim MWK_Page As Long
    
    Dim MWK_印刷中 As Boolean   ' データ有り(最終処理用)
    Dim MWK_1P As Boolean  ' 最初のデータチェック用
    Dim MWK_L1 As Boolean
    Dim MWK_L2 As Boolean
    Dim MWK_L3 As Boolean
    Dim MWK_L4 As Boolean
    Dim MWK_L5 As Boolean
    Dim MWK_L6 As Boolean
    Dim MWK_L7 As Boolean
    Dim MWK_L8 As Boolean
    Dim MWK_L9 As Boolean
    Dim MWK_LR As Boolean
    
    Dim MWK_L1行 As Long
    Dim MWK_L2行 As Long
    Dim MWK_L3行 As Long
    Dim MWK_L4行 As Long
    Dim MWK_L5行 As Long
    Dim MWK_L6行 As Long
    Dim MWK_L7行 As Long
    Dim MWK_L8行 As Long
    Dim MWK_L9行 As Long
    Dim MWK_LR行 As Long
    
    Dim MW4_量目 As Currency
    Dim MW4_数量 As Long
    
    '' カラム位置
    Dim Cxl_処理日付        As Long  ' XLPDY1
    Dim Cdd_ID              As Long  ' DDID1
    Dim Cdd_受付日付        As Long  ' DDNDY1
    Dim Cdd_伝票番号        As Long  ' DDDPN1
    Dim Cdd_合計番号        As Long  ' DDHLN1
    Dim Cdd_入力番号        As Long  ' DDLIN1
    Dim Cdd_荷主コード      As Long  ' DDSRC1
    Dim Cdd_送り状番号      As Long  ' DDOKN1
    Dim Cdd_出荷日付        As Long  ' DDSDY1
    Dim Cdd_部課コード      As Long  ' DDBKC1
    Dim Cdd_担当者コード    As Long  ' DDTNC1
    Dim Cdd_単価区分        As Long  ' DDKBN1
    Dim Cdd_容器区分        As Long  ' DDKBN2
    Dim Cdd_品名コード      As Long  ' DDHNC1
    Dim Cdd_等級コード      As Long  ' DDTOK1
    Dim Cdd_階級コード      As Long  ' DDKAI1
    Dim Cdd_等級            As Long  ' DDTOK2
    Dim Cdd_階級            As Long  ' DDKAI2
    Dim Cdd_量目            As Long  ' DDRYO1
    Dim Cdd_買人コード      As Long  ' DDTKC1
    Dim Cdd_数量            As Long  ' DDSUR1
    Dim Cdd_単価            As Long  ' DDTNK1
    Dim Cdd_金額            As Long  ' DDKIN1
    Dim Cdd_容器数          As Long  ' DDYSU1
    Dim Cdd_備考            As Long  ' DDBKO1
    Dim Cdd_備考日付        As Long  ' DDCDY1
    Dim Cdd_事故区分        As Long  ' DDJKK1
    Dim Cdd_買人_荷主       As Long  ' DDTSC1
    Dim Cdd_売上口銭率      As Long  ' DDUKR1
    Dim Cdd_売上口銭額      As Long  ' DDUKK1
    Dim Cdd_消費税率        As Long  ' DDSZR1
    Dim Cdd_消費税          As Long  ' DDSZK1
    Dim Cdd_FILLER          As Long  ' DDFIL1
    Dim Cdd_WS名            As Long  ' DDWSN1
    Dim Cdd_更新日付        As Long  ' DDUDY1
    Dim Cdd_FLG1            As Long  ' DDFLG1
    Dim Cdd_FLG2            As Long  ' DDFLG2
    Dim Cdd_FLG3            As Long  ' DDFLG3
    Dim Cdd_FLG4            As Long  ' DDFLG4
    Dim Cdd_FLG5            As Long  ' DDFLG5
    Dim Cdd_FLG6            As Long  ' DDFLG6
    Dim Cdd_FLG7            As Long  ' DDFLG7
    Dim Cdd_FLG8            As Long  ' DDFLG8
    Dim Cdd_FLG9            As Long  ' DDFLG9
    Dim Cdd_FLGA            As Long  ' DDFLGA
    Dim Cdh_ID              As Long  ' DHID1
    Dim Cdh_受付日付        As Long  ' DHNDY1
    Dim Cdh_伝票番号        As Long  ' DHDPN1
    Dim Cdh_入力番号        As Long  ' DHLIN1
    Dim Cdh_荷主            As Long  ' DHSRC1
    Dim Cdh_出荷日付        As Long  ' DHSDY1
    Dim Cdh_販売日付        As Long  ' DHHDY1
    Dim Cdh_送り状番号      As Long  ' DHOKN1
    Dim Cdh_貨車番号        As Long  ' DHKSN1
    Dim Cdh_部課            As Long  ' DHBKC1
    Dim Cdh_担当者          As Long  ' DHTNC1
    Dim Cdh_産地            As Long  ' DHSNT1
    Dim Cdh_単価区分        As Long  ' DHKBN1
    Dim Cdh_容器区分        As Long  ' DHKBN2
    Dim Cdh_事故区分        As Long  ' DHKBN3
    Dim Cdh_理由区分        As Long  ' DHKBN4
    Dim Cdh_元仕切日        As Long  ' DHBSD1
    Dim Cdh_元仕切番号      As Long  ' DHBSN1
    Dim Cdh_備考            As Long  ' DHBKO1
    Dim Cdh_仕入蔬菜口銭率  As Long  ' DHSKR1
    Dim Cdh_仕入果実口銭率  As Long  ' DHSKR2
    Dim Cdh_仕入口銭額      As Long  ' DHSKK1
    Dim Cdh_売上口銭率      As Long  ' DHUKR1
    Dim Cdh_売上口銭額      As Long  ' DHUKK1
    Dim Cdh_運賃率          As Long  ' DHUTR1
    Dim Cdh_運賃額          As Long  ' DHUTK1
    Dim Cdh_預り金率        As Long  ' DHAZR1
    Dim Cdh_控除1           As Long  ' DHSKJ1
    Dim Cdh_控除2           As Long  ' DHSKJ2
    Dim Cdh_仕入金額        As Long  ' DHSKN1
    Dim Cdh_仕入消費税      As Long  ' DHSSZ1
    Dim Cdh_売上金額        As Long  ' DHUKN1
    Dim Cdh_売上消費税      As Long  ' DHUSZ1
    Dim Cdh_FILLER          As Long  ' DHFIL1
    Dim Cdh_WS名            As Long  ' DHWSN1
    Dim Cdh_更新日付        As Long  ' DHUDY1
    Dim Cdh_FLG1            As Long  ' DHFLG1
    Dim Cdh_FLG2            As Long  ' DHFLG2
    Dim Cdh_FLG3            As Long  ' DHFLG3
    Dim Cdh_FLG4            As Long  ' DHFLG4
    Dim Cdh_FLG5            As Long  ' DHFLG5
    Dim Ctk_仕入先コード    As Long  ' TKSRC1
    Dim Ctk_買人カナ        As Long  ' TKTKK1
    Dim Ctk_買人略称        As Long  ' TKTKR1
    Dim Ctk_買人名          As Long  ' TKTKN1
    Dim Ctk_カナ住所        As Long  ' TKADK1
    Dim Ctk_住所1           As Long  ' TKADR1
    Dim Ctk_住所2           As Long  ' TKADR2
    Dim Ctk_郵便番号        As Long  ' TKYUB1
    Dim Ctk_電話番号        As Long  ' TKTEL1
    Dim Ctk_FAX番号         As Long  ' TKFAX1
    Dim Ctk_FAX区分         As Long  ' TKFXK1
    Dim Ctk_合計請求書      As Long  ' TKGSK1
    Dim Ctk_メールアドレス  As Long  ' TKSML1
    Dim Csr_荷主コード      As Long  ' SRSRC1
    Dim Csr_荷主カナ        As Long  ' SRSRK1
    Dim Csr_荷主略称        As Long  ' SRSRR1
    Dim Csr_荷主名          As Long  ' SRSRN1
    Dim Csr_カナ住所        As Long  ' SRADK1
    Dim Csr_住所1           As Long  ' SRADR1
    Dim Csr_住所2           As Long  ' SRADR2
    Dim Csr_郵便番号        As Long  ' SRYUB1
    Dim Csr_電話番号        As Long  ' SRTEL1
    Dim Csr_FAX番号         As Long  ' SRFAX1
    Dim Csr_産地コード      As Long  ' SRSNT1
    Dim Csr_県連コード      As Long  ' SRKNR1
    Dim Csr_単協コード      As Long  ' SRTAN1
    Dim Csr_買人コード      As Long  ' SRTKC1
    Dim Csr_FAX区分         As Long  ' SRFXK1
    Dim Csr_メールアドレス  As Long  ' SRSML1
    Dim Chn_品名コード      As Long  ' HNHNC1
    Dim Chn_品名カナ        As Long  ' HNHNK1
    Dim Chn_品名略称        As Long  ' HNHNR1
    Dim Chn_品名            As Long  ' HNHNN1
    Dim Chn_単位            As Long  ' HNTNI1
    Dim Chn_タンイ          As Long  ' HNTNI2
    Dim Chn_経済連コード    As Long  ' HNKZC1
    Dim Chn_疏果区分        As Long  ' HNSKK1
    Dim Cxl_軽減対象額      As Long  ' XLKZKA
    Dim Cxl_軽減消費税      As Long  ' XLSZKA
    Dim Cxl_標準対象額      As Long  ' XLKZKB
    Dim Cxl_標準消費税      As Long  ' XLSZKB
    Dim Cxl_旧税対象額      As Long  ' XLKZKC
    Dim Cxl_旧税消費税      As Long  ' XLSZKC
    Dim Cxl_非課税対象額    As Long  ' XLKZKD
    Dim Cxl_非課税消費税    As Long  ' XLSZKD
    Dim Cxl_コメント1       As Long  ' XLSCM1
    Dim Cxl_コメント2       As Long  ' XLSCM2
    Dim Cxl_コメント3       As Long  ' XLSCM3
    Dim Cxl_コメント4       As Long  ' XLSCM4
    Dim Cxl_コメント5       As Long  ' XLSCM5
    Dim Cxl_コメント6       As Long  ' XLSCM6
    Dim Cxl_コメント7       As Long  ' XLSCM7
    Dim Cxl_コメント8       As Long  ' XLSCM8
    Dim Cxl_コメント9       As Long  ' XLSCM9
    Dim Cxl_分類1           As Long  ' XLSBR1
    Dim Cxl_分類2           As Long  ' XLSBR2
    Dim Cxl_分類3           As Long  ' XLSBR3
    Dim Cxl_分類4           As Long  ' XLSBR4
    Dim Cxl_分類5           As Long  ' XLSBR5
    Dim Cxl_分類6           As Long  ' XLSBR6
    Dim Cxl_分類7           As Long  ' XLSBR7
    Dim Cxl_分類8           As Long  ' XLSBR8
    Dim Cxl_分類9           As Long  ' XLSBR9
    Dim Cxl_区分1           As Long  ' XLSKB1
    Dim Cxl_区分2           As Long  ' XLSKB2
    Dim Cxl_区分3           As Long  ' XLSKB3
    Dim Cxl_区分4           As Long  ' XLSKB4
    Dim Cxl_区分5           As Long  ' XLSKB5
    Dim Cxl_区分6           As Long  ' XLSKB6
    Dim Cxl_区分7           As Long  ' XLSKB7
    Dim Cxl_区分8           As Long  ' XLSKB8
    Dim Cxl_区分9           As Long  ' XLSKB9
    Dim Cxl_数字1           As Long  ' XLNUM1
    Dim Cxl_数字2           As Long  ' XLNUM2
    Dim Cxl_数字3           As Long  ' XLNUM3
    Dim Cxl_数字4           As Long  ' XLNUM4
    Dim Cxl_数字5           As Long  ' XLNUM5
    Dim Cxl_数字6           As Long  ' XLNUM6
    Dim Cxl_数字7           As Long  ' XLNUM7
    Dim Cxl_数字8           As Long  ' XLNUM8
    Dim Cxl_数字9           As Long  ' XLNUM9
    '' DHSIRP1 追加分
    Dim Cdh_容器金額        As Long  ' DHYKG
    '' 控除額 追加分
    Dim Cxl_控除対象額      As Long  ' XLKJKA
    Dim Cxl_控除消費税      As Long  ' XLKJSA
    Dim Cxl_旧控除対象額    As Long  ' XLKJKB
    Dim Cxl_旧控除消費税    As Long  ' XLKJSB
    
    '' モジュール変数設定
    Dim MWK_ERR As Variant
    Dim MWK_ERR_MSG As String
    Dim MWK_SQL As String
    Dim MWK_答え As Variant
    Dim MWK_条件 As String
    
    Dim MWK_RST As PS_TBLARY
    Dim MWK_FLD As Variant

Sub AUTO_OPEN()
' @(f)
' 機能      :クラス開始時ルーチン
' 返り値    :無し
' 引き数    : ARG1 -
' 機能説明  :
' 備考      :
'           :
'           :
' ------------------------------------------------------------------------------
    On Error GoTo Jap_Err
   
    Sheets("コメント").Select
    Application.ScreenUpdating = False
    
    MWK_Pgmフォルダー = PCM.CFNC_フォルダー名(PCM.CFNC_ファイル名_分離(ThisWorkbook.FullName, PE_フォルダー))
    MWK_Pgmファイル名 = ThisWorkbook.Name
    MWK_プログラム = PCM.CFNC_ファイル名_分離(MWK_Pgmファイル名, PE_ファイル名)
    MWK_Iniファイル名 = MWK_Pgmフォルダー & "APP設定.INI"
   ' MWK_Pgmフォルダー = PCM.CFNC_フォルダー名(PCM.CFNC_INI読込("APP基本", "PGMフォルダー", MWK_Iniファイル名))
    MWK_AS400フォルダー = PCM.CFNC_フォルダー名(PCM.CFNC_INI読込("APP基本", "AS400CSVフォルダー", MWK_Iniファイル名))
    MWK_Pgmフォルダー = PCM.CFNC_フォルダー名(PCM.CFNC_INI読込("APP基本", "PGMフォルダー", MWK_Iniファイル名))
    MWK_Imgフォルダー = PCM.CFNC_フォルダー名(PCM.CFNC_INI読込("APP基本", "IMGフォルダー", MWK_Iniファイル名))
    MWK_Workフォルダー = PCM.CFNC_フォルダー名(PCM.CFNC_INI読込("APP基本", "WORKフォルダー", MWK_Iniファイル名))
    
    'MWK_Pdfフォルダー = PCM.CFNC_フォルダー名(PCM.CFNC_INI読込("APP基本", "PDFフォルダー", MWK_Iniファイル名))
    With MWK_処理フォルダー
        .PS_基準_Fld = PCM.CFNC_フォルダー名(PCM.CFNC_INI読込("APP基本", "PDFフォルダー", MWK_Iniファイル名))
        '.PS_サブ_Fld = PCM.CFNC_フォルダー名(PCM.CFNC_INI読込(MWK_プログラム, "サブフォルダー", MWK_Iniファイル名))
        .PS_サブ_Fld = PCM.CFNC_フォルダー名("経済連仕切書")
        .PS_CSV_Fld = PCM.CFNC_フォルダー名(.PS_基準_Fld & .PS_サブ_Fld & "CSV")
        .PS_Excel_Fld = PCM.CFNC_フォルダー名(.PS_基準_Fld & .PS_サブ_Fld & "Excel")
        .PS_PDF_Fld = PCM.CFNC_フォルダー名(.PS_基準_Fld & .PS_サブ_Fld & "PDF")
    End With

    'MWK_送信フォルダー = PCM.CFNC_フォルダー名(PCM.CFNC_INI読込("APP基本", "送信フォルダー", MWK_Iniファイル名))
    With MWK_送信フォルダー
        .PS_基準_Fld = PCM.CFNC_フォルダー名(PCM.CFNC_INI読込("APP基本", "送信フォルダー", MWK_Iniファイル名))
        '.PS_サブ_Fld = PCM.CFNC_フォルダー名(PCM.CFNC_INI読込(MWK_プログラム, "サブフォルダー", MWK_Iniファイル名))
        .PS_サブ_Fld = PCM.CFNC_フォルダー名("経済連仕切書")
        .PS_CSV_Fld = PCM.CFNC_フォルダー名(.PS_基準_Fld & .PS_サブ_Fld)
        .PS_Excel_Fld = PCM.CFNC_フォルダー名(.PS_基準_Fld & .PS_サブ_Fld)
        .PS_PDF_Fld = PCM.CFNC_フォルダー名(.PS_基準_Fld & .PS_サブ_Fld)
    End With

    'MWK_履歴フォルダー = PCM.CFNC_フォルダー名(PCM.CFNC_INI読込("APP基本", "履歴フォルダー", MWK_Iniファイル名))
    With MWK_履歴フォルダー
        .PS_基準_Fld = PCM.CFNC_フォルダー名(PCM.CFNC_INI読込("APP基本", "履歴フォルダー", MWK_Iniファイル名))
        '.PS_サブ_Fld = PCM.CFNC_フォルダー名(PCM.CFNC_INI読込(MWK_プログラム, "サブフォルダー", MWK_Iniファイル名))
        .PS_サブ_Fld = PCM.CFNC_フォルダー名("履歴")
        '.PS_CSV_Fld = PCM.CFNC_フォルダー名(.PS_基準_Fld & .PS_サブ_Fld & "CSV")
        '.PS_Excel_Fld = PCM.CFNC_フォルダー名(.PS_基準_Fld & .PS_サブ_Fld & "Excel")
        '.PS_PDF_Fld = PCM.CFNC_フォルダー名(.PS_基準_Fld & .PS_サブ_Fld & "PDF")
    End With

    ' 処理ファイル読込
    MWK_AS400ファイル名 = PCM.CFNC_INI読込(MWK_プログラム, "AS400CSVファイル名", MWK_Iniファイル名)
    MWK_処理ファイル = PCM.CFNC_CSV読込((MWK_AS400フォルダー & MWK_AS400ファイル名))
    Call FNC_カラム設定
    
    MWK_Fileファイル名 = PCM.CFNC_ファイル名_分離(MWK_AS400ファイル名, PE_ファイル名)
    MWK_File処理日付 = Format(Date, "yymmdd")
 '   MWK_File処理日付 = MWK_処理ファイル.PS_FLD(1, Clm_締日処理日付)
 '   MWK_Fileパターン = MWK_処理ファイル.PS_FLD(1, Clm_締日パターン)
    MWK_処理ファイル名 = PFNC_ファイル名_生成(MWK_プログラム, "SK")
    MWK_xlsファイル名 = MWK_処理ファイル名 & ".XLSX"
    MWK_xlsレイアウト名 = "レイアウト"
    
    MWK_ページ行数 = PCM.CvN(PCM.CFNC_INI読込(MWK_プログラム, "ページ行数", MWK_Iniファイル名))
    MWK_開始行数 = PCM.CvN(PCM.CFNC_INI読込(MWK_プログラム, "開始行数", MWK_Iniファイル名))
    MWK_終了行数 = PCM.CvN(PCM.CFNC_INI読込(MWK_プログラム, "終了行数", MWK_Iniファイル名))

    MWK_前回個別ファイル名 = ""
'Stop
   ' Call FNC_初期処理_01(ActiveSheet)
   ' Call FNC_初期処理_01(Sheets("処理シート").Select)
    Call FNC_履歴処理
    Call FNC_シート作成
    Call FNC_初期処理_01(ActiveSheet)
    Call FNC_印刷処理
   ' Call FNC_PDF出力
    Application.ScreenUpdating = True
   
    Call FNC_終了処理
    
Jap_Exit:
    Exit Sub

Jap_Err:
    '' エラー表示
    MWK_ERR_MSG = ("Error [ " & Err & " ] " & Err.Description)
    Call PCM.CFNC_メッセージログ(vbOKOnly, , , _
                               , ("[ AUTO_OPEN ] "), MWK_ERR_MSG _
                               , "")
    Resume Jap_Exit
    Resume Next

End Sub

Function FNC_シート作成() As Boolean
' @(f)
' 機能      : シート作成
' 返り値    : 無し
' 引き数    : ARG1 -
' 機能説明  :
' 備考      :
'           :
'           :
' ------------------------------------------------------------------------------
    On Error GoTo Jap_Err

'  処理シートあったら削除
    On Error GoTo NOT_FOUND        '  該当シート無ければ次へ
    Sheets("処理シート").Select
    Application.DisplayAlerts = False
    ActiveWindow.SelectedSheets.Delete
NOT_FOUND:
    On Error GoTo 0
'    ActiveWorkbook.Names("処理シート!" + MWK_xlsレイアウト名).Delete

    Sheets("レイアウト").Select
    Sheets("レイアウト").Copy before:=Sheets(2)
    Sheets("レイアウト (2)").Select
    Sheets("レイアウト (2)").Name = "処理シート"
    Selection.Clear
    ActiveWorkbook.Names("レイアウト").Delete

    '  行設定
    MWK_先頭行 = 1
   'MWK_現在行 = 0
    MWK_明細行 = 0

'  ページサイズ設定
'    Application.Run Macro:="EX_STR.XLS!PRINTER_SET"
    Call FNC_レイアウト追加
    
Jap_Exit:
    Exit Function

Jap_Err:
    '' エラー表示
    MWK_ERR_MSG = ("Error [ " & Err & " ] " & Err.Description)
    Call PCM.CFNC_メッセージログ(vbOKOnly, , , _
                               , ("[ FNC_シート作成 ] "), MWK_ERR_MSG _
                               , "")
    Resume Jap_Exit
    Resume Next

End Function

Private Function FNC_レイアウト追加() As Boolean
' @(f)
' 機能      : レイアウト追加
' 返り値    : 無し
' 引き数    : ARG1 -
' 機能説明  :
' 備考      :
'           :
'           :
' ------------------------------------------------------------------------------
    
    Dim I1 As Long
    Dim I2 As Long
    Dim I3 As Long
    Dim I4 As Long
    Dim I5 As Long
    
    On Error GoTo Jap_Err
    
'    MWK_先頭行 = MWK_先頭行 + MWK_ページ行数
'    Application.Goto Reference:=MWK_xlsレイアウト名
'    Selection.Copy
'    Sheets("処理シート").Select
'    Range(Cells(MWK_先頭行, 1), Cells(MWK_先頭行, 1)).Select
'    ActiveSheet.Paste
'    ActiveCell.SpecialCells(xlLastCell).Select
'    Selection.End(xlToLeft).Select
'    Application.CutCopyMode = False
'    ActiveCell.PageBreak = xlManual

    Application.GoTo Reference:="レイアウト"
    Selection.Copy
    Sheets("処理シート").Select
    'Range("A100").Select
    Range(Cells(MWK_先頭行, 1), Cells(MWK_先頭行, 1)).Select
    ActiveSheet.Paste
   ' Call Selection.PasteSpecial(xlPasteAll)

    ' * 書式コピーできないもの有るので強制指定
  '  Rows(MWK_先頭行 + 2 - 1).Select
    Rows(MWK_先頭行 + 9 - 1).Select
  '  Selection.RowHeight = 28.25
    Rows(MWK_先頭行 + 4 - 1).Select
  '  Selection.RowHeight = 20
    Rows(MWK_先頭行 + 45 - 1).Select
  '  Selection.RowHeight = 23.5
    Rows(MWK_先頭行 + 52).Select
    ActiveWindow.SelectedSheets.HPageBreaks.Add before:=ActiveCell

Jap_Exit:
    Exit Function

Jap_Err:
    '' エラー表示
    MWK_ERR_MSG = ("Error [ " & Err & " ] " & Err.Description)
    Call PCM.CFNC_メッセージログ(vbOKOnly, , , _
                               , ("[ FNC_レイアウト追加 ] "), MWK_ERR_MSG _
                               , "")
    Resume Jap_Exit
    Resume Next
    
End Function


Private Function FNC_初期処理_01(PM_シート As Worksheet) As Boolean

    On Error GoTo Jap_Err
    FNC_初期処理_01 = False

    '' シートの削除
    'Sheets("処理シート").Select
    'ActiveWindow.SelectedSheets.Delete
    
    '' 用紙設定
    Application.PrintCommunication = False
    With PM_シート.PageSetup
        .PrintTitleRows = ""
        .PrintTitleColumns = ""
    End With
    Application.PrintCommunication = True
    PM_シート.PageSetup.PrintArea = ""
    ' ** 1004 エラーのため
    'Application.PrintCommunication = False
    With PM_シート.PageSetup
        .LeftHeader = ""
        .CenterHeader = ""
        .RightHeader = ""
        .LeftFooter = ""
        .CenterFooter = ""
        .RightFooter = ""
        .LeftMargin = Application.InchesToPoints(0.236220472440945)
        .RightMargin = Application.InchesToPoints(0.236220472440945)
        .TopMargin = Application.InchesToPoints(0.393700787401575)
        .BottomMargin = Application.InchesToPoints(0.393700787401575)
        .HeaderMargin = Application.InchesToPoints(0)
        .FooterMargin = Application.InchesToPoints(0)
        .PrintHeadings = False
        .PrintGridlines = False
        .PrintComments = xlPrintNoComments
       ' .PrintQuality = 600
        .CenterHorizontally = False
        .CenterVertically = False
        .Orientation = xlPortrait   ' 縦
       ' .Orientation = xlLandscape  ' 横
        .Draft = False
       ' .PaperSize = xlPaper11x17
       ' .PaperSize = xlPaperA4
       ' .PaperSize = xlPaperA5
        .PaperSize = xlPaperA4
       ' .PaperSize = xlPaperB4
       ' .PaperSize = xlPaperB5
       ' .PaperSize = xlpaperlegal
       ' .PaperSize = xlPaperLetter
        .FirstPageNumber = xlAutomatic
        .Order = xlDownThenOver
        .BlackAndWhite = False
        .Zoom = 100
        .PrintErrors = xlPrintErrorsDisplayed
        .OddAndEvenPagesHeaderFooter = False
        .DifferentFirstPageHeaderFooter = False
        .ScaleWithDocHeaderFooter = True
        .AlignMarginsHeaderFooter = False
        .EvenPage.LeftHeader.Text = ""
        .EvenPage.CenterHeader.Text = ""
        .EvenPage.RightHeader.Text = ""
        .EvenPage.LeftFooter.Text = ""
        .EvenPage.CenterFooter.Text = ""
        .EvenPage.RightFooter.Text = ""
        .FirstPage.LeftHeader.Text = ""
        .FirstPage.CenterHeader.Text = ""
        .FirstPage.RightHeader.Text = ""
        .FirstPage.LeftFooter.Text = ""
        .FirstPage.CenterFooter.Text = ""
        .FirstPage.RightFooter.Text = ""
    End With
    ' ** 1004 エラーのため
    'Application.PrintCommunication = True
    
    FNC_初期処理_01 = True
    
Jap_Exit:
    Exit Function
    
Jap_Err:
    MWK_ERR_MSG = ("Error [ " & Err.Source & "-" & Err & " ] " & Err.Description)
    Call PCM.CFNC_メッセージログ(vbOKOnly, , , ("[FNC_見出し処理_01] ") _
                                       , MWK_ERR_MSG)
    FNC_初期処理_01 = False
    Resume Jap_Exit
    Resume Next
    
End Function

' ---------------------------------------------------------------------
Private Function FNC_印刷処理() As Boolean
    
    Dim WK_見出条件 As Boolean
    Dim WK_合計条件 As Boolean
    
    Dim I1 As Long
    Dim I2 As Long
    Dim I3 As Long
    Dim I4 As Long
    Dim I5 As Long
    
    On Error GoTo Jap_Err
    FNC_印刷処理 = False
    
    With MWK_処理ファイル
        MWK_Page = 1
        MWK_前行 = 0
        MWK_1P = True
        MWK_LR = False

        ' 最後のレコードまで繰り返し
        For MWK_現在行 = 0 To (.PS_行数 - 1)
            '* 最終レコードチェック
            If (MWK_現在行 >= (.PS_行数 - 1)) Then
                MWK_LR = True
              End If
            '* 不要レコード読み飛ばし
            If (PCM.CvT(.PS_FLD(MWK_現在行, Cdd_ID)) = "") Then
                '** 最終データは合計に
                If (MWK_LR = True) Then
                    GoTo Jap_合計処理
                  End If
                GoTo Jap_Next
              End If
            
            '* 制御の切れ目チェック
Jap_制御処理:
            MWK_L9 = False: MWK_L8 = False: MWK_L7 = False: MWK_L6 = False: MWK_L5 = False: MWK_L4 = False: MWK_L3 = False: MWK_L2 = False: MWK_L1 = False
            If (MWK_1P = True) Then
                MWK_L9 = True: MWK_L8 = True: MWK_L7 = True: MWK_L6 = True: MWK_L5 = True: MWK_L4 = True: MWK_L3 = True: MWK_L2 = True: MWK_L1 = True
                MWK_L9行 = MWK_現在行
                MWK_L8行 = MWK_現在行
                MWK_L7行 = MWK_現在行
                MWK_L6行 = MWK_現在行
                MWK_L5行 = MWK_現在行
                MWK_L4行 = MWK_現在行
                MWK_L3行 = MWK_現在行
                MWK_L2行 = MWK_現在行
                MWK_L1行 = MWK_現在行
              ElseIf (.PS_FLD(MWK_現在行, Cdd_荷主コード) <> .PS_FLD((MWK_前行), Cdd_荷主コード)) Then
                MWK_L5 = True: MWK_L4 = True: MWK_L3 = True: MWK_L2 = True: MWK_L1 = True
              ElseIf (.PS_FLD(MWK_現在行, Cdd_受付日付) <> .PS_FLD((MWK_前行), Cdd_受付日付)) _
                  Or (.PS_FLD(MWK_現在行, Cdd_送り状番号) <> .PS_FLD((MWK_前行), Cdd_送り状番号)) _
                  Or (.PS_FLD(MWK_現在行, Cdd_伝票番号) <> .PS_FLD((MWK_前行), Cdd_伝票番号)) Then
                MWK_L4 = True: MWK_L3 = True: MWK_L2 = True: MWK_L1 = True
              ElseIf (.PS_FLD(MWK_現在行, Cdd_品名コード) <> .PS_FLD((MWK_前行), Cdd_品名コード)) Then
                MWK_L3 = True: MWK_L2 = True: MWK_L1 = True
              ElseIf (.PS_FLD(MWK_現在行, Cdd_等級) <> .PS_FLD((MWK_前行), Cdd_等級)) _
                  Or (.PS_FLD(MWK_現在行, Cdd_階級) <> .PS_FLD((MWK_前行), Cdd_階級)) _
                  Or (.PS_FLD(MWK_現在行, Cdd_量目) <> .PS_FLD((MWK_前行), Cdd_量目)) Then
                MWK_L2 = True: MWK_L1 = True
              ElseIf (.PS_FLD(MWK_現在行, Cdd_単価) <> .PS_FLD((MWK_前行), Cdd_単価)) _
                  Or (.PS_FLD(MWK_現在行, Cdd_事故区分) <> .PS_FLD((MWK_前行), Cdd_事故区分)) _
                  Or (.PS_FLD(MWK_現在行, Cdd_単価区分) <> .PS_FLD((MWK_前行), Cdd_単価区分)) _
                  Or (.PS_FLD(MWK_現在行, Cdd_容器区分) <> .PS_FLD((MWK_前行), Cdd_容器区分)) Then
                MWK_L1 = True
              End If

        ' ** ---------------------------------------------------------------------
        ' ** (合計処理)
Jap_合計処理:
            
        ' * (合計処理) 制御の切れ目
        ' * 最初のレコードは合計処理しない
            If (MWK_1P = False) Then
                If (MWK_L4 = True) Then
                   ' Call FNC_脚注処理_04(MWK_前行)
                    Call FNC_脚注処理_04(MWK_L4行)
                    MWK_File処理日付 = MWK_処理ファイル.PS_FLD(MWK_L4行, Cxl_処理日付)
                    MWK_個別キー = ("SK" & Format(.PS_FLD((MWK_L4行), Cdd_荷主コード), "00000"))
                    MWK_個別ファイル名 = PFNC_ファイル名_生成(MWK_プログラム, MWK_個別キー)
                    ' *** ファイル名の秒数進めるため 1秒止める
                    If (MWK_個別ファイル名 = MWK_前回個別ファイル名) Then
                        Application.Wait Now() + TimeValue("00:00:01")
                        MWK_個別キー = ("SK" & Format(.PS_FLD((MWK_L4行), Cdd_荷主コード), "00000"))
                        MWK_個別ファイル名 = PFNC_ファイル名_生成(MWK_プログラム, MWK_個別キー)
                        MWK_前回個別ファイル名 = MWK_個別ファイル名
                    End If
                
                    Call FNC_PDF出力
                    Call FNC_ini出力(MWK_L4行)
                    MWK_印刷中 = False
                  End If
              End If

        ' ** ---------------------------------------------------------------------
        ' ** (明細処理)
Jap_明細処理:
            '* 見出し出力
            If (MWK_L4 = True) _
              Or (MWK_1P = True) Then
                Call FNC_シート作成
                MWK_File処理日付 = MWK_処理ファイル.PS_FLD(1, Cxl_処理日付)
                Call FNC_見出し処理_01(MWK_現在行)
                MWK_印刷中 = True
              Else
                If (MWK_明細行 > MWK_終了行数) Then
                    '** 1ページ目は改ページしない
                    If (MWK_現在行 > 0) Then
                        MWK_先頭行 = MWK_先頭行 + MWK_ページ行数
                        Call FNC_レイアウト追加
                        MWK_File処理日付 = MWK_処理ファイル.PS_FLD(1, Cxl_処理日付)
                        Call FNC_見出し処理_01(MWK_現在行)
                        MWK_印刷中 = True
                    End If
                End If
              End If
            
            '* (明細) 制御の切れ目の演算
            If (MWK_L4 = True) Then
                MW4_量目 = 0
                MW4_数量 = 0
              End If

            Call FNC_明細処理_01(MWK_現在行)
        
        ' ** ---------------------------------------------------------------------
        ' ** 制御の切れ目 位置セット
Jap_位置セット:
            If (MWK_L9 = True) Then MWK_L9行 = MWK_現在行
            If (MWK_L8 = True) Then MWK_L8行 = MWK_現在行
            If (MWK_L7 = True) Then MWK_L7行 = MWK_現在行
            If (MWK_L6 = True) Then MWK_L6行 = MWK_現在行
            If (MWK_L5 = True) Then MWK_L5行 = MWK_現在行
            If (MWK_L4 = True) Then MWK_L4行 = MWK_現在行
            If (MWK_L3 = True) Then MWK_L3行 = MWK_現在行
            If (MWK_L2 = True) Then MWK_L2行 = MWK_現在行
            If (MWK_L1 = True) Then MWK_L1行 = MWK_現在行
        
            MWK_1P = False

Jap_Next:
            MWK_前行 = MWK_現在行
          Next MWK_現在行
            
        ' ** 最終の印刷対象データ有り
        If (MWK_印刷中 = True) Then
            Call FNC_脚注処理_04(MWK_L4行)
            
            MWK_File処理日付 = MWK_処理ファイル.PS_FLD(MWK_L4行, Cxl_処理日付)
            MWK_個別キー = ("SK" & Format(.PS_FLD((MWK_L4行), Cdd_荷主コード), "00000"))
            MWK_個別ファイル名 = PFNC_ファイル名_生成(MWK_プログラム, MWK_個別キー)
            Call FNC_PDF出力
            Call FNC_ini出力(MWK_L4行)
            MWK_印刷中 = False
          End If
      End With
    
    ' ** 処理ファイル移動
    Call FNC_終了処理
    
    FNC_印刷処理 = True
    
Jap_Exit:
    Exit Function
    
Jap_Err:
    '' エラー表示
    MWK_ERR_MSG = ("Error [ " & Err.Source & "-" & Err & " ] " & Err.Description)
    Call PCM.CFNC_メッセージログ(vbOKOnly, , , ("[FNC_印刷処理] ") _
                                       , MWK_ERR_MSG)
    FNC_印刷処理 = False
    Resume Jap_Exit
    Resume Next
    
End Function
    
Private Function FNC_見出し処理_01(ByVal PM_行数 As Long _
                                   ) As Boolean
    
    Dim WK_イメージ As String
    Dim WK_産地 As Long
    Dim I1 As Long
    Dim I2 As Long
    Dim I3 As Long
    Dim I4 As Long
    Dim I5 As Long
    
    With MWK_処理ファイル
        ' 見出し部分出力
        I1 = MWK_先頭行 - 1
        Cells((I1 + 2), 16).Value = "Page." & Format(MWK_Page, "0000")
        
        Cells((I1 + 4), 2).Value = PCM.CvN(.PS_FLD(PM_行数, Cdh_伝票番号))
        ' ** 7ケタ郵便番号 カナ住所にセットして有る
        'Cells((I1 + 4), 2).Value = .PS_FLD(PM_行数, Csr_郵便番号)
        Cells((I1 + 4), 6).Value = "〒 " & .PS_FLD(PM_行数, Csr_カナ住所) '* 郵便番号
        
        Cells((I1 + 6), 2).Value = PCM.CvN(.PS_FLD(PM_行数, Cdd_荷主コード))
        Cells((I1 + 6), 6).Value = .PS_FLD(PM_行数, Csr_住所1)
        Cells((I1 + 8), 6).Value = .PS_FLD(PM_行数, Csr_住所2)
        Cells((I1 + 10), 6).Value = .PS_FLD(PM_行数, Csr_荷主名) & " 様"
      
        Cells((I1 + 12), 16).Value = PCM.CvD(.PS_FLD(PM_行数, Cxl_処理日付))
        
        Cells((I1 + 13), 5).Value = PCM.CvN(.PS_FLD(PM_行数, Cdd_合計番号))
        Cells((I1 + 13), 10).Value = PCM.CvN(.PS_FLD(PM_行数, Csr_単協コード))
      End With
    
    MWK_Page = MWK_Page + 1
    MWK_明細行 = MWK_開始行数
    
    FNC_見出し処理_01 = True
    
Jap_Exit:
    Exit Function
    
Jap_Err:
    MWK_ERR_MSG = ("Error [ " & Err.Source & "-" & Err & " ] " & Err.Description)
    Call PCM.CFNC_メッセージログ(vbOKOnly, , , ("[FNC_見出し処理_01] ") _
                                       , MWK_ERR_MSG)
    FNC_見出し処理_01 = False
    Resume Jap_Exit
    Resume Next
    
End Function
    
Private Function FNC_明細処理_01(ByVal PM_行数 As Long _
                                 ) As Boolean
    
    Dim I1 As Long
    Dim I2 As Long
    Dim I3 As Long
    Dim I4 As Long
    Dim I5 As Long
    
    Dim WK_入金 As Currency
    
    On Error GoTo Jap_Err
    FNC_明細処理_01 = False
    
    'I1 = MWK_先頭行 + MWK_開始行数 + MWK_明細行 - 1
    I1 = MWK_先頭行 + MWK_明細行 - 1
    With MWK_処理ファイル
        Cells(I1, 2).Value = PCM.CvN(.PS_FLD(PM_行数, Cdd_品名コード))
        Cells(I1, 3).Value = PCM.CvT(.PS_FLD(PM_行数, Cxl_分類4))       ' 荷印
        Cells(I1, 5).Value = PCM.CvT(.PS_FLD(PM_行数, Cxl_コメント2))   ' 品名
        Cells(I1, 10).Value = PCM.CvT(.PS_FLD(PM_行数, Cxl_分類4))      ' 荷印
        If (PCM.CvN(.PS_FLD(PM_行数, Cdd_量目)) <> 0) Then
            Cells(I1, 11).Value = PCM.CvN(.PS_FLD(PM_行数, Cdd_量目))
        End If
        Cells(I1, 12).Value = PCM.CvT(.PS_FLD(PM_行数, Cdd_等級))
        Cells(I1, 13).Value = PCM.CvT(.PS_FLD(PM_行数, Cdd_階級))
        Cells(I1, 14).Value = PCM.CvN(.PS_FLD(PM_行数, Cdd_数量))
        Cells(I1, 15).Value = PCM.CvN(.PS_FLD(PM_行数, Cdd_単価))
        Cells(I1, 16).Value = PCM.CvN(.PS_FLD(PM_行数, Cdd_金額))
       ' Cells(I1, 11).Value = PCM.CvT(.PS_FLD(PM_行数, Cxl_区分1)) _
                            & PCM.CvT(.PS_FLD(PM_行数, Cxl_区分2)) _
                            & PCM.CvT(.PS_FLD(PM_行数, Cxl_分類3))
        MWK_明細行 = MWK_明細行 + 1
        
        ' * 集計処理
        '* 容量・数量計算
        MW4_量目 = MW4_量目 + (PCM.CvN(.PS_FLD(MWK_現在行, Cdd_量目)) * PCM.CvN(.PS_FLD(MWK_現在行, Cdd_数量)))
        MW4_数量 = MW4_数量 + PCM.CvN(.PS_FLD(MWK_現在行, Cdd_数量))
            
      End With
    
    FNC_明細処理_01 = True
    
Jap_Exit:
    Exit Function
    
Jap_Err:
    '' エラー表示
    MWK_ERR_MSG = ("Error [ " & Err.Source & "-" & Err & " ] " & Err.Description)
    Call PCM.CFNC_メッセージログ(vbOKOnly, , , ("[FNC_明細処理_01] ") _
                                       , MWK_ERR_MSG)
    FNC_明細処理_01 = False
    Resume Jap_Exit
    Resume Next
    
End Function
    
Private Function FNC_脚注処理_04(ByVal PM_行数 As Long _
                                 ) As Boolean
    
    Dim I1 As Long
    Dim I2 As Long
    Dim I3 As Long
    Dim I4 As Long
    Dim I5 As Long
    
    On Error GoTo Jap_Err
    FNC_脚注処理_04 = False
    
    I1 = MWK_先頭行 - 1
    With MWK_処理ファイル
        ' * 合計行出力
        Cells(I1 + 32, 10).Value = MW4_量目
        Cells(I1 + 32, 14).Value = MW4_数量
        
        ' *
        Cells(I1 + 34, 4).Value = PCM.CvD(.PS_FLD(PM_行数, Cdh_出荷日付))
        Cells(I1 + 36, 4).Value = PCM.CvT(.PS_FLD(PM_行数, Cdh_貨車番号))
        Cells(I1 + 38, 4).Value = PCM.CvT(.PS_FLD(PM_行数, Cdd_送り状番号))
        Cells(I1 + 39, 4).Value = PCM.CvT(.PS_FLD(PM_行数, Cdh_備考))
        
        ' * 蔬菜・果実区分と口銭率
        If (PCM.CvT(.PS_FLD(PM_行数, Cdh_FLG1)) = "1") Then
            Cells(I1 + 38, 10).Value = "*"
            Cells(I1 + 35, 14).Value = PCM.CvN(.PS_FLD(PM_行数, Cdh_仕入蔬菜口銭率)) * 100
        ElseIf (PCM.CvT(.PS_FLD(PM_行数, Cdh_FLG1)) = "2") Then
            Cells(I1 + 38, 11).Value = "*"
            Cells(I1 + 35, 14).Value = PCM.CvN(.PS_FLD(PM_行数, Cdh_仕入果実口銭率)) * 100
        Else
            Cells(I1 + 38, 12).Value = "*"
            Cells(I1 + 35, 14).Value = PCM.CvN(.PS_FLD(PM_行数, Cdh_仕入蔬菜口銭率)) * 100
        End If
        ' * 合計金額
        Cells(I1 + 32, 16).Value = PCM.CvN(.PS_FLD(PM_行数, Cdh_仕入金額)) - PCM.CvN(.PS_FLD(PM_行数, Cdh_容器金額))
        Cells(I1 + 33, 16).Value = PCM.CvN(.PS_FLD(PM_行数, Cdh_仕入消費税))
        Cells(I1 + 34, 16).Value = PCM.CvN(.PS_FLD(PM_行数, Cdh_仕入金額)) - PCM.CvN(.PS_FLD(PM_行数, Cdh_容器金額)) + PCM.CvN(.PS_FLD(PM_行数, Cdh_仕入消費税))
        Cells(I1 + 35, 16).Value = PCM.CvN(.PS_FLD(PM_行数, Cdh_仕入口銭額))
        Cells(I1 + 36, 16).Value = PCM.CvN(.PS_FLD(PM_行数, Cdh_運賃額))
        Cells(I1 + 37, 16).Value = PCM.CvN(.PS_FLD(PM_行数, Cdh_控除1)) + PCM.CvN(.PS_FLD(PM_行数, Cdh_控除2))
        'Cells(I1 + 40, 7).Value = PCM.CvN(.PS_FLD(PM_行数, Cdh_仕入金額))
        If (PCM.CvN(.PS_FLD(PM_行数, Cdh_容器金額)) <> 0) Then
            Cells(I1 + 38, 14).Value = "容器代"
            Cells(I1 + 38, 16).Value = PCM.CvN(.PS_FLD(PM_行数, Cdh_容器金額))
          End If
        Cells(I1 + 40, 16).Value = PCM.CvN(.PS_FLD(PM_行数, Cdh_仕入金額)) - PCM.CvN(.PS_FLD(PM_行数, Cdh_容器金額)) + PCM.CvN(.PS_FLD(PM_行数, Cdh_仕入消費税)) _
                                 - PCM.CvN(.PS_FLD(PM_行数, Cdh_仕入口銭額)) - PCM.CvN(.PS_FLD(PM_行数, Cdh_運賃額)) _
                                 - PCM.CvN(.PS_FLD(PM_行数, Cdh_控除1)) - PCM.CvN(.PS_FLD(PM_行数, Cdh_控除2)) _
                                 + PCM.CvN(.PS_FLD(PM_行数, Cdh_容器金額))
        
        ' * 蔬菜・果実区分と口銭率
        Cells(I1 + 43, 3).Value = PCM.CvT(.PS_FLD(PM_行数, Cxl_区分1))
        Cells(I1 + 43, 4).Value = PCM.CvT(.PS_FLD(PM_行数, Cxl_区分2))
        Cells(I1 + 43, 5).Value = PCM.CvT(.PS_FLD(PM_行数, Cxl_区分3))
        Cells(I1 + 43, 6).Value = PCM.CvT(.PS_FLD(PM_行数, Cxl_区分4))
        Cells(I1 + 43, 7).Value = PCM.CvT(.PS_FLD(PM_行数, Cxl_区分5))
        Cells(I1 + 43, 8).Value = PCM.CvT(.PS_FLD(PM_行数, Cxl_区分6))
        Cells(I1 + 43, 9).Value = PCM.CvT(.PS_FLD(PM_行数, Cxl_区分7))
        Cells(I1 + 43, 11).Value = PCM.CvT(.PS_FLD(PM_行数, Cdd_担当者コード))
        
        If (PCM.CvN(.PS_FLD(PM_行数, Cdh_事故区分)) <> 0) Then
            Cells(I1 + 46, 2).Value = PCM.CvN(.PS_FLD(PM_行数, Cdh_事故区分))
          End If
        If (PCM.CvN(.PS_FLD(PM_行数, Cdh_理由区分)) <> 0) Then
            Cells(I1 + 46, 4).Value = PCM.CvN(.PS_FLD(PM_行数, Cdh_理由区分))
          End If
        If (PCM.CvN(.PS_FLD(PM_行数, Cdh_元仕切日)) <> 0) Then
            Cells(I1 + 46, 7).Value = PCM.CvN(.PS_FLD(PM_行数, Cdh_元仕切日))
          End If
        If (PCM.CvN(.PS_FLD(PM_行数, Cdh_元仕切番号)) <> 0) Then
            Cells(I1 + 46, 10).Value = PCM.CvN(.PS_FLD(PM_行数, Cdh_元仕切番号))
          End If
        
        ' * 消費税関係出力
        Cells(I1 + 49, 10).Value = PCM.CvN(.PS_FLD(PM_行数, Cxl_軽減対象額))
        Cells(I1 + 50, 10).Value = PCM.CvN(.PS_FLD(PM_行数, Cxl_軽減消費税))
        Cells(I1 + 51, 10).Value = PCM.CvN(.PS_FLD(PM_行数, Cxl_軽減対象額)) + PCM.CvN(.PS_FLD(PM_行数, Cxl_軽減消費税))
        Cells(I1 + 49, 12).Value = PCM.CvN(.PS_FLD(PM_行数, Cxl_標準対象額))
        Cells(I1 + 50, 12).Value = PCM.CvN(.PS_FLD(PM_行数, Cxl_標準消費税))
        Cells(I1 + 51, 12).Value = PCM.CvN(.PS_FLD(PM_行数, Cxl_標準対象額)) + PCM.CvN(.PS_FLD(PM_行数, Cxl_標準消費税))
        Cells(I1 + 49, 14).Value = PCM.CvN(.PS_FLD(PM_行数, Cxl_旧税対象額))
        Cells(I1 + 50, 14).Value = PCM.CvN(.PS_FLD(PM_行数, Cxl_旧税消費税))
        Cells(I1 + 51, 14).Value = PCM.CvN(.PS_FLD(PM_行数, Cxl_旧税対象額)) + PCM.CvN(.PS_FLD(PM_行数, Cxl_旧税消費税))
        Cells(I1 + 49, 15).Value = PCM.CvN(.PS_FLD(PM_行数, Cxl_非課税対象額))
        Cells(I1 + 50, 15).Value = PCM.CvN(.PS_FLD(PM_行数, Cxl_非課税消費税))
        Cells(I1 + 51, 15).Value = PCM.CvN(.PS_FLD(PM_行数, Cxl_非課税対象額)) + PCM.CvN(.PS_FLD(PM_行数, Cxl_非課税消費税))
        Cells(I1 + 49, 16).Value = 0 - (PCM.CvN(.PS_FLD(PM_行数, Cxl_控除対象額)) + PCM.CvN(.PS_FLD(PM_行数, Cxl_旧控除対象額)))
        Cells(I1 + 50, 16).Value = 0 - (PCM.CvN(.PS_FLD(PM_行数, Cxl_控除消費税)) + PCM.CvN(.PS_FLD(PM_行数, Cxl_旧控除消費税)))
        Cells(I1 + 51, 16).Value = 0 - (PCM.CvN(.PS_FLD(PM_行数, Cxl_控除対象額)) + PCM.CvN(.PS_FLD(PM_行数, Cxl_旧控除対象額)) _
                                      + PCM.CvN(.PS_FLD(PM_行数, Cxl_控除消費税)) + PCM.CvN(.PS_FLD(PM_行数, Cxl_旧控除消費税)))
      
      End With
       
    ' * 合計フィールドクリアー。本来いらない
    MW4_量目 = 0
    MW4_数量 = 0
    
    FNC_脚注処理_04 = True
    
Jap_Exit:
    Exit Function
    
Jap_Err:
    '' エラー表示
    MWK_ERR_MSG = ("Error [ " & Err.Source & "-" & Err & " ] " & Err.Description)
    Call PCM.CFNC_メッセージログ(vbOKOnly, , , ("[FNC_脚注処理_04] ") _
                                       , MWK_ERR_MSG)
    FNC_脚注処理_04 = False
    Resume Jap_Exit
    Resume Next
    
End Function

Private Function FNC_ini出力(ByVal PM_行数 As Long _
                                   ) As Boolean
    
    Dim WK_フォルダー名 As String
    Dim WK_ファイル名 As String
    
    Dim I1 As Long
    Dim I2 As Long
    Dim I3 As Long
    Dim I4 As Long
    Dim I5 As Long
    
    FNC_ini出力 = False
    
    With MWK_処理ファイル
        WK_フォルダー名 = PCM.CFNC_フォルダー名_1(MWK_送信フォルダー.PS_CSV_Fld)
        WK_ファイル名 = MWK_送信フォルダー.PS_CSV_Fld & MWK_個別ファイル名 & ".INI"
        If (PCM.CFNC_フォルダー存在(WK_フォルダー名) = False) Then Call PCM.CFNC_フォルダー作成(WK_フォルダー名)
        ' 送信用データ出力
        Call PCM.CFNC_INI出力("送信設定", "個別キー", MWK_個別キー, WK_ファイル名)
        Call PCM.CFNC_INI出力("送信設定", "処理区分", "仕切書", WK_ファイル名)
        Call PCM.CFNC_INI出力("送信設定", "コード", PCM.CvT(.PS_FLD(PM_行数, Cdd_荷主コード)), WK_ファイル名)
        Call PCM.CFNC_INI出力("送信設定", "処理日付", PCM.CvT(.PS_FLD(PM_行数, Cxl_処理日付)), WK_ファイル名)
        Call PCM.CFNC_INI出力("送信設定", "名前", PCM.CvT(.PS_FLD(PM_行数, Csr_荷主名)), WK_ファイル名)
        Call PCM.CFNC_INI出力("送信設定", "FAX区分", PCM.CvT(.PS_FLD(PM_行数, Csr_FAX区分)), WK_ファイル名)
…
vbaProject_00.bin vba-project OOXML VBA project: xl/vbaProject.bin 483328 bytes
SHA-256: 69d8bbf006b16c7907edecc11fc66f099c386e13c76b98777320f49084130de2