
create table dw_t_ar_receipt_mon_indicators(  
    receipt_header_id  bigint   comment ''
,   ou_code            varchar  comment ''
,   org_id             varchar  comment ''
,   org_name           varchar  comment ''
,   customer_code      varchar  comment ''
,   customer_name      varchar  comment ''
,   receipt_number     varchar  comment ''
,   receipt_amount     double   comment ''
,   receipt_date       varchar  comment ''
,   split_date         varchar  comment ''
,   date_turn          varchar  comment ''
,   payment_status     varchar  comment ''
,   balance_amount     number   comment ''
,   balance            varchar  comment ''
,   apply_date         date     comment ''
,   w_insert_date      date     comment ''
,   w_update_date      date     comment ''
);

create table mdm_customer_info(
    customer_id                      varchar comment ''    
,   mdm_level_id                     varchar comment ''
,   version                          varchar comment ''
,   bp_code                          varchar comment ''
,   bp_name                          varchar comment ''
,   social_credit_code               varchar comment ''
,   business_scope_code              varchar comment ''
,   business_scope                   varchar comment ''
,   duns_number                      varchar comment ''
,   country                          varchar comment ''
,   country_mdm                      varchar comment ''
,   province_mdm_code                varchar comment ''
,   province_mdm                     varchar comment ''
,   city_mdm_code                    varchar comment ''
,   city_mdm                         varchar comment ''
,   county_mdm                       varchar comment ''
,   add_mdm                          varchar comment ''
,   account_number                   varchar comment ''
,   mdm_code                         varchar comment ''
,   m_code                           varchar comment ''
,   party_number                     varchar comment ''
,   party_name                       varchar comment ''
,   jgzz_fiscal_code                 varchar comment ''
,   attribute4                       varchar comment ''
,   account_name                     varchar comment ''
,   rep_registration_number          varchar comment ''
,   customer_type_code               varchar comment ''
,   customer_type                    varchar comment ''
,   category_code_code               varchar comment ''
,   category_code_name               varchar comment ''
,   customer_class_code              varchar comment ''
,   customer_class_name              varchar comment ''
,   attribute10                      varchar comment ''
,   sales_channel_code               varchar comment ''
,   sales_channel_name               varchar comment ''
,   attribute2                       varchar comment ''
,   attribute7                       varchar comment ''
,   attribute8                       varchar comment ''
,   attribute9                       varchar comment ''
,   attribute99a                     varchar comment ''
,   attribute16                      varchar comment ''
,   attribute1616a                   varchar comment ''
,   status                           varchar comment ''
,   status_name                      varchar comment ''
,   attribute1                       varchar comment ''
,   attribute11a                     varchar comment ''
,   attribute5                       varchar comment ''
,   attribute6                       varchar comment ''
,   invoice_mailing_add              varchar comment ''
,   rlcust_type_code                 varchar comment ''
,   rlcust_type_name                 varchar comment ''
,   rlcust_code                      varchar comment ''
,   rlcust_role_code                 varchar comment ''
,   rlcust_role_name                 varchar comment ''
,   relation_start_date              varchar comment ''
,   registration_source_code         varchar comment ''
,   registration_source_name         varchar comment ''
,   rounding_rule_code               varchar comment ''
,   rounding_rule_name               varchar comment ''
,   exempt_reason_code               varchar comment ''
,   exempt_reason_name               varchar comment ''
,   exempt_effective_from            varchar comment ''
,   exemption_type_code              varchar comment ''
,   exemption_type_name              varchar comment ''
,   attribute11                      varchar comment ''
,   attribute12                      varchar comment ''
,   attribute13                      varchar comment ''
,   attribute14                      varchar comment ''
,   attribute15                      varchar comment ''
,   attribute17                      varchar comment ''
,   attribute18                      varchar comment ''
,   attribute19                      varchar comment ''
,   attribute20                      varchar comment ''
,   created_user_name                varchar comment ''
,   modi_user_name                   varchar comment ''
,   hospital_name                    varchar comment ''
,   hospital_code                    varchar comment ''
,   object_version_number            varchar comment ''
,   creation_date                    varchar comment ''
,   created_by                       varchar comment ''
,   last_updated_by                  varchar comment ''
,   last_update_date                 varchar comment ''
,   w_insert_date                    varchar comment ''
);

create table dim_day_workday_d(
    day_wid       varchar comment ''
,   day_code      varchar comment ''
,   day_date      varchar comment ''
,   week_days     varchar comment ''
,   days_flag     varchar comment ''
);

create table ar_receipt_header(
    receipt_header_id           varchar comment ''
,   ou_code                     varchar comment ''
,   customer_code               varchar comment ''
,   receipt_number              varchar comment ''
,   receipt_date                varchar comment ''
,   currency                    varchar comment ''
,   receipt_amount              varchar comment ''
,   source_system               varchar comment ''
,   receipt_type                varchar comment ''
,   receipt_status              varchar comment ''
,   unidentified_cus_status     varchar comment ''
,   customer_bank               varchar comment ''
,   customer_bank_account       varchar comment ''
,   customer_bank_province      varchar comment ''
,   customer_bank_city          varchar comment ''
,   split_status                varchar comment ''
,   operator_id                 varchar comment ''
,   legal_entity_id             varchar comment ''
,   tenant_id                   varchar comment ''
,   object_version_number       varchar comment ''
,   creation_date               varchar comment ''
,   created_by                  varchar comment ''
,   last_updated_by             varchar comment ''
,   last_update_date            varchar comment ''
,   maturity_date               varchar comment ''
,   erp_status                  varchar comment ''
,   write_off_flag              varchar comment ''
,   bill_number                 varchar comment ''
,   w_insert_date               varchar comment ''
);

create table dw_customer_balance_f(
    month_wid                      varchar comment ''
,   company_wid                    varchar comment ''
,   org_id                         varchar comment ''
,   customer_wid                   varchar comment ''
,   cust_account_id                varchar comment ''
,   account_number                 varchar comment ''
,   account_name                   varchar comment ''
,   sales_channel_wid              varchar comment ''
,   sales_channel_code             varchar comment ''
,   sales_channel_name             varchar comment ''
,   product_line_wid               varchar comment ''
,   product_line_code              varchar comment ''
,   product_line_name              varchar comment ''
,   channel_code                   varchar comment ''
,   channel_name                   varchar comment ''
,   receipt_type_code              varchar comment ''
,   receipt_type_name              varchar comment ''
,   detail_type_code               varchar comment ''
,   detail_type_name               varchar comment ''
,   bp_date                        varchar comment ''
,   bp_doc_num                     varchar comment ''
,   bp_amount                      varchar comment ''
,   wsh_date                       varchar comment ''
,   order_number                   varchar comment ''
,   oms_number                     varchar comment ''
,   order_amount                   varchar comment ''
,   applied_amount                 varchar comment ''
,   rebate_applied_amt             varchar comment ''
,   period_applied_amt             varchar comment ''
,   balance_amount                 varchar comment ''
,   w_insert_date                  varchar comment ''
,   w_update_date                  varchar comment ''
,   datasource_num_id              varchar comment ''
,   integration_id                 varchar comment ''
);

create table mdm_legal_entity_info(
    id                          varchar comment ''
,   legal_entity_id             varchar comment ''
,   legal_entity_identifier     varchar comment ''
,   legal_entity_name           varchar comment ''
,   org_id                      varchar comment ''
,   org_name                    varchar comment ''
,   org_code                    varchar comment ''
,   org_date_from               varchar comment ''
,   org_date_to                 varchar comment ''
,   organization_id             varchar comment ''
,   organization_name           varchar comment ''
,   organization_code           varchar comment ''
,   organization_date_from      varchar comment ''
,   organization_date_to        varchar comment ''
,   enable_flag                 varchar comment ''
,   object_version_number       varchar comment ''
,   attribute_category          varchar comment ''
,   attribute1                  varchar comment ''
,   attribute2                  varchar comment ''
,   attribute3                  varchar comment ''
,   attribute4                  varchar comment ''
,   attribute5                  varchar comment ''
,   attribute6                  varchar comment ''
,   attribute7                  varchar comment ''
,   attribute8                  varchar comment ''
,   attribute9                  varchar comment ''
,   attribute10                 varchar comment ''
,   attribute11                 varchar comment ''
,   attribute12                 varchar comment ''
,   attribute13                 varchar comment ''
,   attribute14                 varchar comment ''
,   attribute15                 varchar comment ''
,   creation_date               varchar comment ''
,   created_by                  varchar comment ''
,   last_updated_by             varchar comment ''
,   last_update_date            varchar comment ''
,   w_insert_date               varchar comment ''
);

create table ar_receipt_apply(
    receitp_apply_id
,   receipt_header_id
,   receipt_line_id
,   order_header_id
,   apply_amount
,   apply_type
,   tenant_id
,   object_version_number
,   creation_date
,   created_by
,   last_updated_by
,   last_update_date
,   apply_status
,   apply_date
,   cancel_apply_date
,   return_order_id
,   return_apply_amount
,   original_receitp_apply_id
,   is_create_payment_plan_flag
,   receipt_apply_number
,   transfer_erp_status
,   calculat_margin_flag
,   apply_balance_amount
,   hexiao_center_flag
,   hexiao_bill_no
,   hexiao_user_choose
,   w_insert_date
);

create table ar_receipt_line(
    receipt_line_id
,   receipt_header_id
,   ou_code
,   customer_code
,   receipt_number
,   receipt_date
,   receipt_amount
,   using_type
,   split_date
,   tenant_id
,   object_version_number
,   creation_date
,   created_by
,   last_updated_by
,   last_update_date
,   transfer_erp_status
,   balance
,   save_flag
,   order_flag
,   ebs_error_message
,   source
,   write_off_flag
,   receipt_discount_date
,   doc_number
,   calculat_margin_flag
,   hexiao_center_flag
,   delete_flag
,   hexiao_bill_no
,   order_number
,   cpx_code
,   cpx_name
,   market_code
,   market_name
,   w_insert_date
);


