-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
59acc9b
commit 76f01e8
Showing
649 changed files
with
12,029 additions
and
23,963 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
87 changes: 87 additions & 0 deletions
87
AP Final Payment Register 11i/AP Final Payment Register 11i.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/*************************************************************************/ | ||
/* */ | ||
/* (c) 2010-2024 Enginatics GmbH */ | ||
/* www.enginatics.com */ | ||
/* */ | ||
/*************************************************************************/ | ||
-- Report Name: AP Final Payment Register 11i | ||
-- Description: Imported from Concurrent Program | ||
Application: Payables | ||
Source: Final Payment Register | ||
Short Name: APXPBFPR | ||
-- Excel Examle Output: https://www.enginatics.com/example/ap-final-payment-register-11i/ | ||
-- Library Link: https://www.enginatics.com/reports/ap-final-payment-register-11i/ | ||
-- Run Report: https://demo.enginatics.com/ | ||
|
||
select | ||
-- payment batch | ||
gsob.name set_of_books, | ||
aisc.checkrun_name payment_batch_name, | ||
aisc.bank_account_name bank_account, | ||
acs.name payment_document, | ||
trunc(aisc.check_date) payment_date, | ||
xxen_util.meaning(aisc.status,'CHECK BATCH STATUS',200) payment_batch_status, | ||
xxen_util.meaning(aisc.document_order_lookup_code,'DOCUMENT ORDER',200) document_order, | ||
aisc.max_outlay maximum_outlay, | ||
aisc.max_payment_amount maximum_payment, | ||
aisc.min_check_amount minimum_payment, | ||
xxen_util.meaning(aisc.payment_method_lookup_code,'PAYMENT METHOD',200) payment_method, | ||
xxen_util.meaning(aisc.pay_only_when_due_flag,'YES_NO',0) pay_only_when_due, | ||
aisc.pay_thru_date pay_through_date, | ||
xxen_util.meaning(aisc.zero_amounts_allowed,'YES_NO',0) zero_payments_allowed, | ||
xxen_util.meaning(aisc.zero_invoices_allowed,'YES_NO',0) zero_invoices_allowed, | ||
aba.currency_code bank_account_currency, | ||
aisc.currency_code payment_batch_currency, | ||
aisc.vendor_pay_group pay_group, | ||
aisc.low_payment_priority priority_range_low, | ||
aisc.hi_payment_priority priority_range_high, | ||
gdct.user_conversion_type exchange_rate_type, | ||
aisc.exchange_rate exchange_rate, | ||
-- payment batch totals | ||
sum(ac.amount) over (partition by aisc.checkrun_name) payment_batch_total, | ||
sum(decode(ac.status_lookup_code,'SET UP',1,0)) over (partition by aisc.checkrun_name) setup_document_count, | ||
sum(decode(ac.status_lookup_code,'OVERFLOW',1,0)) over (partition by aisc.checkrun_name) overflow_documnent_count, | ||
sum(decode(ac.status_lookup_code,'SPOILED',0, 'SET UP', 0, 'OVERFLOW',0,1)) over (partition by aisc.checkrun_name) negotiable_document_count, | ||
-- checks | ||
ac.check_number document_number, | ||
nvl(ac.doc_sequence_value,ac.check_voucher_num) voucher_number, | ||
xxen_util.meaning(ac.status_lookup_code,'CHECK STATE',200) document_status, | ||
decode(ac.status_lookup_code, 'SET UP',xxen_util.meaning(ac.status_lookup_code,'CHECK STATE',200), ac.vendor_name) supplier_name, | ||
decode(ac.status_lookup_code, 'SET UP',xxen_util.meaning(ac.status_lookup_code,'CHECK STATE',200), ac.vendor_site_code) supplier_site, | ||
decode(ac.status_lookup_code, 'SET UP',xxen_util.meaning(ac.status_lookup_code,'CHECK STATE',200), ac.address_line1) address1, | ||
decode(ac.status_lookup_code,'SET UP','',ac.address_line2) address2, | ||
decode(ac.status_lookup_code,'SET UP','',ac.address_line3) address3, | ||
decode(ac.status_lookup_code,'SET UP','',ac.city) city, | ||
decode(ac.status_lookup_code,'SET UP','',ac.state) state, | ||
decode(ac.status_lookup_code,'SET UP','', ac.zip) zip, | ||
decode(ac.status_lookup_code,'SET UP','',ac.province) province, | ||
decode(ac.status_lookup_code,'SET UP','',ft.territory_short_name) territory, | ||
nvl(ac.bank_account_num, aba2.bank_account_num) supplier_bank_account, | ||
ac.amount document_amount | ||
from | ||
ap_invoice_selection_criteria aisc, | ||
ap_check_stocks acs, | ||
ap_bank_accounts aba, | ||
ap_system_parameters asp, | ||
gl_sets_of_books gsob, | ||
gl_daily_conversion_types gdct, | ||
-- | ||
ap_checks ac, | ||
fnd_territories_vl ft, | ||
ap_bank_accounts aba2 | ||
where | ||
1=1 and | ||
aisc.status = 'CONFIRMED' and | ||
acs.check_stock_id = aisc.check_stock_id and | ||
aba.bank_account_id = acs.bank_account_id and | ||
asp.set_of_books_id = gsob.set_of_books_id and | ||
gdct.conversion_type(+) = aisc.exchange_rate_type and | ||
-- | ||
aisc.checkrun_name = ac.checkrun_name (+) and | ||
ac.country = ft.territory_code(+) and | ||
ac.external_bank_account_id = aba2.bank_account_id(+) | ||
order by | ||
gsob.name, | ||
aisc.check_date, | ||
aisc.checkrun_name, | ||
ac.check_number |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
238 changes: 238 additions & 0 deletions
238
AP Invoice Approval Status/AP Invoice Approval Status.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,238 @@ | ||
/*************************************************************************/ | ||
/* */ | ||
/* (c) 2010-2024 Enginatics GmbH */ | ||
/* www.enginatics.com */ | ||
/* */ | ||
/*************************************************************************/ | ||
-- Report Name: AP Invoice Approval Status | ||
-- Description: Imported from Concurrent Program | ||
Application: Payables | ||
Source: Invoice Approval Status | ||
Short Name: APXAPRST | ||
-- Excel Examle Output: https://www.enginatics.com/example/ap-invoice-approval-status/ | ||
-- Library Link: https://www.enginatics.com/reports/ap-invoice-approval-status/ | ||
-- Run Report: https://demo.enginatics.com/ | ||
|
||
select | ||
x.c_legal_entity legal_entity, | ||
x.c_operating_unit operating_unit, | ||
x.c_vendor_name supplier, | ||
x.c_vendor_site supplier_site, | ||
x.c_invoice_number invoice_number, | ||
trunc(x.c_invoice_date) invoice_date, | ||
x.c_inv_curr currency, | ||
x.c_approval_context approval_context, | ||
x.c_line_number line_number, | ||
x.c_status status, | ||
x.c_action_date action_date, | ||
x.c_action action, | ||
x.c_approver approver, | ||
x.c_applicable_amount applicable_amount, | ||
x.c_amount reviewed_amount, | ||
-- | ||
case | ||
when :p_sort_by = 'T' and 1 = row_number() over (partition by x.c_invoice_id order by x.c_action_date desc,x.c_approval_history_id desc) | ||
then case when x.c_status_code in ('INITIATED','SENT','NEEDS WFREAPPROVAL') then x.c_invoice_amount else 0 end | ||
when :p_sort_by = 'A' | ||
then case when x.c_action_code in ('SENT') then x.c_amount else 0 end | ||
else null | ||
end pending_amount, | ||
case | ||
when :p_sort_by = 'T' and 1 = row_number() over (partition by x.c_invoice_id order by x.c_action_date desc,x.c_approval_history_id desc) | ||
then case when x.c_status_code in ('REJECTED','REJECT','STOPPED') then x.c_invoice_amount else 0 end | ||
when :p_sort_by = 'A' | ||
then case when x.c_action_code in ('REJECT','REJECTED','STOPPED') then x.c_amount else 0 end | ||
else null | ||
end rejected_amount, | ||
case | ||
when :p_sort_by = 'T' and 1 = row_number() over (partition by x.c_invoice_id order by x.c_action_date desc,x.c_approval_history_id desc) | ||
then case when x.c_status_code in ('WFAPPROVED','MANUALLY APPROVED') then x.c_invoice_amount else 0 end | ||
when :p_sort_by = 'A' | ||
then case when x.c_action_code in ('APPROVED','MANUALLY APPROVED') then x.c_amount else 0 end | ||
else null | ||
end approved_amount, | ||
-- | ||
x.c_approval_history_id approval_history_id | ||
from | ||
( | ||
select -- Q1 By Approver/By Trading Partner - Document Approval | ||
le.name c_legal_entity, | ||
mo_global.get_ou_name(ai.org_id) c_operating_unit, | ||
ai.vendor_id c_vendor_id, | ||
hzp.party_name c_vendor_name, | ||
ai.vendor_site_id c_vendor_site_id, | ||
pos.vendor_site_code c_vendor_site, | ||
ai.wfapproval_status c_status_code, | ||
ai.invoice_currency_code c_inv_curr, | ||
fc.precision c_precision, | ||
ai.invoice_num c_invoice_number, | ||
his.amount_approved c_amount, | ||
his.approver_name c_approver, | ||
alc2.displayed_field c_action, | ||
his.last_update_date c_action_date, | ||
his.iteration c_iteration, | ||
alc.displayed_field c_status, | ||
ai.invoice_id c_invoice_id, | ||
ai.invoice_date c_invoice_date, | ||
ai.invoice_amount c_invoice_amount, | ||
ai.invoice_amount c_applicable_amount, | ||
nvl(alc3.displayed_field,'Document Approval') c_approval_context, /* bug 6002946 added nvl to display approver context */ | ||
his.response c_action_code, | ||
to_number(null) c_line_number, | ||
his.approval_history_id c_approval_history_id | ||
from | ||
ap_inv_aprvl_hist_all his, | ||
ap_invoices_all ai, | ||
gl_ledgers gl, | ||
ap_suppliers pov, | ||
ap_supplier_sites_all pos, | ||
hz_parties hzp, | ||
fnd_currencies fc, | ||
xle_entity_profiles le, | ||
ap_lookup_codes alc, | ||
ap_lookup_codes alc2, | ||
ap_lookup_codes alc3 | ||
where | ||
:p_reporting_level = :p_reporting_level and | ||
nvl(:p_status,'?') = nvl(:p_status,'?') and | ||
1=1 and | ||
2=2 and | ||
ai.org_id in (select mgoat.organization_id from mo_glob_org_access_tmp mgoat union select fnd_global.org_id from dual where fnd_release.major_version=11) and | ||
his.invoice_id = ai.invoice_id and | ||
ai.set_of_books_id = gl.ledger_id and | ||
ai.invoice_currency_code = fc.currency_code and | ||
hzp.party_id=ai.party_id and | ||
pov.vendor_id(+) = ai.vendor_id and | ||
pos.vendor_site_id(+) = ai.vendor_site_id and | ||
le.legal_entity_id (+) = ai.legal_entity_id and | ||
alc.lookup_code = ai.wfapproval_status and | ||
alc.lookup_type = 'AP_WFAPPROVAL_STATUS' and | ||
alc2.lookup_code (+) = his.response and | ||
alc2.lookup_type (+) = 'AP_WFAPPROVAL_STATUS' and | ||
alc3.lookup_type (+) = 'AP_WFAPPROVAL_CONTEXT' and | ||
alc3.lookup_code (+) = his.history_type and | ||
(his.history_type is null or /* bug 6002946 , added or condition */ | ||
his.history_type= 'DOCUMENTAPPROVAL' | ||
) | ||
union | ||
select -- Q2 By Approver/By Trading Partner - Line Approval | ||
le.name c_legal_entity, | ||
mo_global.get_ou_name(ai.org_id) c_operating_unit, | ||
ai.vendor_id c_vendor_id, | ||
hzp.party_name c_vendor_name, | ||
ai.vendor_site_id c_vendor_site_id, | ||
pos.vendor_site_code c_vendor_site, | ||
ail.wfapproval_status c_status_code, | ||
ai.invoice_currency_code c_inv_curr, | ||
fc.precision c_precision, | ||
ai.invoice_num c_invoice_number, | ||
his.amount_approved c_amount, | ||
his.approver_name c_approver, | ||
alc2.displayed_field c_action, | ||
his.last_update_date c_action_date, | ||
his.iteration c_iteration, | ||
alc.displayed_field c_status, | ||
ai.invoice_id c_invoice_id, | ||
ai.invoice_date c_invoice_date, | ||
decode(ai.wfapproval_status,'INITIATED',0,ai.invoice_amount) c_invoice_amount, | ||
ail.amount c_applicable_amount, | ||
alc3.displayed_field c_approval_context, | ||
his.response c_action_code, | ||
his.line_number c_line_number, | ||
his.approval_history_id c_approval_history_id | ||
from | ||
ap_inv_aprvl_hist_all his, | ||
ap_invoice_lines_all ail, | ||
ap_invoices_all ai, | ||
gl_ledgers gl, | ||
ap_suppliers pov, | ||
ap_supplier_sites_all pos, | ||
hz_parties hzp, | ||
fnd_currencies fc, | ||
xle_entity_profiles le, | ||
ap_lookup_codes alc, | ||
ap_lookup_codes alc2, | ||
ap_lookup_codes alc3 | ||
where | ||
1=1 and | ||
2=2 and | ||
ai.org_id in (select mgoat.organization_id from mo_glob_org_access_tmp mgoat union select fnd_global.org_id from dual where fnd_release.major_version=11) and | ||
ai.invoice_id=ail.invoice_id and | ||
his.invoice_id = ail.invoice_id and | ||
his.line_number = ail.line_number and | ||
his.history_type = 'LINESAPPROVAL' and | ||
ai.set_of_books_id = gl.ledger_id and | ||
ai.invoice_currency_code = fc.currency_code and | ||
hzp.party_id=ai.party_id and | ||
alc.lookup_code = ail.wfapproval_status and | ||
alc.lookup_type = 'AP_WFAPPROVAL_STATUS' and | ||
pov.vendor_id(+) = ai.vendor_id and | ||
pos.vendor_site_id(+) = ai.vendor_site_id and | ||
le.legal_entity_id (+) = ai.legal_entity_id and | ||
alc2.lookup_code (+) = his.response and | ||
alc2.lookup_type (+) = 'AP_WFAPPROVAL_STATUS' and | ||
alc3.lookup_type (+) = 'AP_WFAPPROVAL_CONTEXT' and | ||
alc3.lookup_code (+) = his.history_type | ||
union | ||
select --Q3 By Trading Partner | ||
le.name c_legal_entity, | ||
mo_global.get_ou_name(ai.org_id) c_operating_unit, | ||
ai.vendor_id c_vendor_id, | ||
hzp.party_name c_vendor_name, | ||
ai.vendor_site_id c_vendor_site_id, | ||
pos.vendor_site_code c_vendor_site, | ||
ai.wfapproval_status c_status_code, | ||
ai.invoice_currency_code c_inv_curr, | ||
fc.precision c_precision, | ||
ai.invoice_num c_invoice_number, | ||
0 c_amount, | ||
'N/A' c_approver, | ||
'Required' c_action, | ||
null c_action_date, | ||
null c_iteration, | ||
'Required' c_status, | ||
ai.invoice_id c_invoice_id, | ||
ai.invoice_date c_invoice_date, | ||
ai.invoice_amount c_invoice_amount, | ||
ai.invoice_amount c_applicable_amount, | ||
'Invoice Approval' c_approval_context, | ||
'N/A' c_action_code, | ||
to_number(null) c_line_number, | ||
0 c_approval_history_id | ||
from | ||
ap_invoices_all ai, | ||
gl_ledgers gl, | ||
ap_suppliers pov, | ||
ap_supplier_sites_all pos, | ||
hz_parties hzp, | ||
fnd_currencies fc, | ||
xle_entity_profiles le, | ||
ap_lookup_codes alc | ||
where | ||
:p_sort_by = 'T' and | ||
1=1 and | ||
3=3 and | ||
ai.org_id in (select mgoat.organization_id from mo_glob_org_access_tmp mgoat union select fnd_global.org_id from dual where fnd_release.major_version=11) and | ||
ai.set_of_books_id = gl.ledger_id and | ||
ai.invoice_currency_code = fc.currency_code and | ||
hzp.party_id=ai.party_id and | ||
pov.vendor_id(+) = ai.vendor_id and | ||
pos.vendor_site_id(+) = ai.vendor_site_id and | ||
le.legal_entity_id(+) = ai.legal_entity_id and | ||
alc.lookup_code = ai.wfapproval_status and | ||
alc.lookup_type='AP_WFAPPROVAL_STATUS' | ||
) x | ||
order by | ||
x.c_legal_entity, | ||
x.c_operating_unit, | ||
decode(:p_sort_by,'A',x.c_approver,null), | ||
decode(:p_sort_by,'A',x.c_inv_curr,null), | ||
decode(:p_sort_by,'A',x.c_approval_context,null), | ||
decode(:p_sort_by,'A',x.c_action_date,null) desc, | ||
decode(:p_sort_by,'T',x.c_vendor_name,null), | ||
decode(:p_sort_by,'T',x.c_vendor_site,null), | ||
decode(:p_sort_by,'T',x.c_inv_curr,null), | ||
x.c_invoice_date, | ||
x.c_invoice_number, | ||
x.c_action_date desc, | ||
x.c_approval_history_id desc |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.