create view vi_voucher_v8 as (
SELECT V8.F3                                                                                                                   AS F3,
       V8.F60                                                                                                                  AS F60,
       V8.ID                                                                                                                   AS ID,
       V8.MODULE_NAME                                                                                                          AS MODULE_NAME,
       V8.DEPT_NAME                                                                                                            AS DEPT_NAME,
       V8.F1                                                                                                                   AS F1,
       V8.F15                                                                                                                  AS F15,
       V8.F2                                                                                                                   AS F2,
       V8.EVIDENCE_TYPE                                                                                                        AS EVIDENCE_TYPE,
       V8.V8_STATUS                                                                                                            AS V8_STATUS,
       V8.V8_FLAG                                                                                                              AS V8_FLAG,
       V8.DETAIL                                                                                                               AS DETAIL,
       V8.F21                                                                                                                  AS F21,
       V8.V8_MEMO                                                                                                              AS V8_MEMO,
       V8.F5                                                                                                                   AS F5,
       V8.EXP_DATE                                                                                                             AS EXP_DATE,
       date_format(V8.GENERATE_DATE, '%Y/%m/%d %H:%i:%s')                                                                      AS GENERATE_DATE,
       V8.F6                                                                                                                   AS F6,
       V8.F16                                                                                                                  AS F16,
       V8.F67                                                                                                                  AS F67,
       V8.F19                                                                                                                  AS F19,
       V8.F89                                                                                                                  AS F89,
       (CASE WHEN (NDR.FLAG = '1') THEN '传输成功' WHEN ((NDR.FLAG <> '1') AND (NDR.FLAG IS NOT NULL)) THEN '传输失败' ELSE '未传输' END) AS FLAG,
       NDR.BATCH                                                                                                               AS BATCH,
       date_format(NDR.CREATE_TIME, '%Y/%m/%d')                                                                                AS CREATE_TIME
FROM (((
    SELECT APZL.VOUCHER_V8.F3                 AS F3,
           max(APZL.VOUCHER_V8.F60)           AS F60,
           max(APZL.VOUCHER_V8.ID)            AS ID,
           max(APZL.VOUCHER_V8.MODULE_NAME)   AS MODULE_NAME,
           max(APZL.VOUCHER_V8.DEPT_NAME)     AS DEPT_NAME,
           max(APZL.VOUCHER_V8.F1)            AS F1,
           max(APZL.VOUCHER_V8.F15)           AS F15,
           max(APZL.VOUCHER_V8.F2)            AS F2,
           max(APZL.VOUCHER_V8.EVIDENCE_TYPE) AS EVIDENCE_TYPE,
           max(APZL.VOUCHER_V8.V8_STATUS)     AS V8_STATUS,
           max(APZL.VOUCHER_V8.V8_FLAG)       AS V8_FLAG,
           max('')                            AS DETAIL,
           max(APZL.VOUCHER_V8.F21)           AS F21,
           max(APZL.VOUCHER_V8.V8_MEMO)       AS V8_MEMO,
           max(APZL.VOUCHER_V8.F5)            AS F5,
           max(APZL.VOUCHER_V8.EXP_DATE)      AS EXP_DATE,
           max(APZL.VOUCHER_V8.GENERATE_DATE) AS GENERATE_DATE,
           max(APZL.VOUCHER_V8.F6)            AS F6,
           max(APZL.VOUCHER_V8.F16)           AS F16,
           max(APZL.VOUCHER_V8.F67)           AS F67,
           max(APZL.VOUCHER_V8.F19)           AS F19,
           max(APZL.VOUCHER_V8.F89)           AS F89
    FROM APZL.VOUCHER_V8
    GROUP BY APZL.VOUCHER_V8.F3
)
      ) V8
LEFT JOIN APZL.NCXML_DETAIL_RECORDS NDR ON ((NDR.BILLID = V8.ID)))
ORDER BY (substr(V8.F3, 2) + 0) DESC);

-- comment on column vi_voucher_v8.f3 not supported: 凭证编号

-- comment on column vi_voucher_v8.f60 not supported: 业务合同号

-- comment on column vi_voucher_v8.module_name not supported: 凭证名称

-- comment on column vi_voucher_v8.dept_name not supported: 部门名称

-- comment on column vi_voucher_v8.f1 not supported: 会计处理日

-- comment on column vi_voucher_v8.f15 not supported: 业务日期

-- comment on column vi_voucher_v8.f2 not supported: 科目编码

-- comment on column vi_voucher_v8.evidence_type not supported: 证明类别

-- comment on column vi_voucher_v8.v8_status not supported: 凭证状态

-- comment on column vi_voucher_v8.v8_flag not supported: 导入财务系统状态, 默认0

-- comment on column vi_voucher_v8.f21 not supported: 预留字段

-- comment on column vi_voucher_v8.v8_memo not supported: 凭证备注

-- comment on column vi_voucher_v8.f5 not supported: 摘要

-- comment on column vi_voucher_v8.exp_date not supported: 导出时间

-- comment on column vi_voucher_v8.f6 not supported: 科目表id

-- comment on column vi_voucher_v8.f16 not supported: 预留字段

-- comment on column vi_voucher_v8.f67 not supported: 租赁类型

-- comment on column vi_voucher_v8.f19 not supported: 预留字段

-- comment on column vi_voucher_v8.f89 not supported: 预留字段

-- comment on column vi_voucher_v8.BATCH not supported: 批次号

