AP未结应付发票一览

前端之家收集整理的这篇文章主要介绍了AP未结应付发票一览前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
--未结应付发票
select hou.name as "业务实体",aia.cust_registration_number as "客户纳税人标识",cux_bq_common.get_lookup_meaning('INVOICE TYPE',aia.invoice_type_lookup_code) as "类型",pha.segment1 as "PO编号",pv.vendor_name as "贸易伙伴",pv.segment1 as "供应商编号",pvs.vendor_site_code as "供应商地点名称",aia.invoice_date as "发票日期",aia.invoice_num as "发票编号",aia.invoice_currency_code as "发票币种",aia.invoice_amount as "发票额",aia.total_tax_amount as "税额",aia.control_amount as "税收控制金额",ap_invoices_pkg.get_amount_withheld(aia.invoice_id) as "预扣额",ap_prepay_utils_pkg.get_prepaid_amount(aia.invoice_id) as "预付额",aia.gl_date as "GL日期",aia.payment_currency_code as "付款币种",aia.payment_cross_rate_date as "付款汇率日期",aia.payment_cross_rate_type as "付款汇率类型",aia.payment_cross_rate as "付款汇率",dset.distribution_set_name as "分配集",aia.description as "摘要",aia.quick_credit as "快速贷项",decode(aia.credited_invoice_id,null,ap_invoices_utility_pkg.get_invoice_num(aia.credited_invoice_id)) as "贷记发票",decode(pvs.match_option,'I','发票','R','收款','P','采购订单') as "匹配活动",gdct.user_conversion_type as "汇率类型",aia.exchange_date as "汇兑日期",aia.exchange_rate as "汇率",aia.terms_date as "条件日期",at.name as "条件",iby1.payment_method_name as "付款方法",aia.pay_group_lookup_code as "支付组",decode(aia.invoice_type_lookup_code,'PREPAYMENT',decode(aia.earliest_settlement_date,'','PERMANENT','TEMPORARY')) as "预付款类型",aia.earliest_settlement_date as "结算日期",ft.territory_short_name as "征税国家(地区)",zbc.classification_name as "业务类别",ibybnk.bank_account_name as "汇入银行帐户名",ibybnk.masked_bank_account_num as "汇入银行帐号",aia.attribute6 as "外厂备用金户付款",aia.attribute7 as "员工工号",aia.attribute8 as "需保理发票号",flv.meaning as "状态",cux_bq_common.get_lookup_meaning('INVOICE PAYMENT STATUS',aia.payment_status_flag) as "付款",gl_currency_api.convert_amount(aia.payment_currency_code,aia.invoice_currency_code,aia.payment_cross_rate_date,aia.payment_cross_rate_type,nvl(aia.amount_paid,0)) as "已付金额",gcc.concatenated_segments as "负债帐户",xla_oa_functions_pkg.get_ccid_description(gcc.chart_of_accounts_id,gcc.code_combination_id) AS "负债说明",aia.payment_status_flag,aia.invoice_id,aia.payment_currency_code,aia.invoice_date,cux_bq_common.get_unpaid_amount(aia.payment_status_flag,aia.invoice_date) as "未付"
  from ap_invoices_all             aia,hr_operating_units          hou,po_headers_all              pha,po_vendors                  pv,po_vendor_sites_all         pvs,ap_distribution_sets        dset,gl_daily_conversion_types   gdct,ap_terms_tl                 at,iby_payment_methods_vl      iby1,zx_fc_business_categories_v zbc,iby_ext_bank_accounts       ibybnk,fnd_lookup_values           flv,fnd_territories_tl          ft,gl_code_combinations_kfv    gcc
 where 1 = 1
   --and aia.invoice_num = 'VAT:12587993-12588025'
   and aia.org_id = hou.organization_id
   and aia.po_header_id = pha.po_header_id(+)
   and aia.vendor_id = pv.vendor_id(+)
   and aia.vendor_site_id = pvs.vendor_site_id(+)
   and aia.distribution_set_id = dset.distribution_set_id(+)
   and aia.exchange_rate_type = gdct.conversion_type(+)
   and aia.terms_id = at.term_id(+)
   and at.language(+) = 'ZHS'
   and aia.payment_method_code = iby1.payment_method_code(+)
   and zbc.classification_code(+) = aia.trx_business_category
   and zbc.application_id(+) = 200
   and zbc.entity_code(+) = 'AP_INVOICES'
   and ibybnk.ext_bank_account_id(+) = aia.external_bank_account_id
   and flv.language = 'ZHS'
   and flv.lookup_type = 'INVOICE STATUS'
   and flv.view_application_id = 200
   and ap_invoices_utility_pkg.get_approval_status(aia.invoice_id,aia.invoice_amount,aia.invoice_type_lookup_code) =
       flv.lookup_code
   and aia.taxation_country = ft.territory_code(+)
   and ft.language(+) = 'ZHS'
   and aia.accts_pay_code_combination_id = gcc.code_combination_id(+)
      --筛选条件
   and aia.invoice_type_lookup_code <> 'PREPAYMENT'
   and aia.payment_status_flag <> 'Y'
   and ap_invoices_utility_pkg.get_approval_status(aia.invoice_id,aia.invoice_type_lookup_code) =
       'APPROVED'
   and cux_bq_common.get_unpaid_amount(aia.payment_status_flag,aia.invoice_date) <> 0    
 order by hou.name;
原文链接:https://www.f2er.com/oracle/211572.html

猜你在找的Oracle相关文章