Current AR Billing Process 1
-
Upload
sgiridharan -
Category
Documents
-
view
233 -
download
7
Transcript of Current AR Billing Process 1
Inventory inv organization of two meanings: 1. Business units, a / b / c branch, a below a1, a2 and other factories, the theme of this goal is to organize independent accounting org, org_id; 2. Inventory organizations, such as the manufacturer's warehouse, for example, a1, a2 and other factories organization_id;
hr_organization_units - org_organization_definitions mtl_subinventory_ organizational unit inventory mtl_parameters - Inventory Organization parameter (useless id, the direct use of name) mtl_system_items_b - material information (ibid., application inventory organization name) mtl_secondary_inventories - Sub-Inventory Organization - mtl_item_locattions - cargo space - subinventroy_code
mtl_material_transactions - (stock) material things in the table Cost mtl_transaction_accounts transaction_cost the cost of things; actual_cost calculated by the cost of the actual cost method, the main unit of measurement
Existing capacity Summary history (positive and negative combined) mtl_material_transactions mtl_onhand_quantities the existing scale, organization / sub-stock / cargo space / items may be on a pick-to-FIFO summary statistics, if you set the "do not allow negative inventory", which can not be negative
po Requisition header table po_requisition_headers_all Row table po_requisition_lines_all Purchase Order po_header_all po_lines_all Purchasing Reception - Return / inter-organizational transfer / normal state are required to use this module rcv_transactions 1. Received 100 units of goods into the "to be quality," cargo space 2. To accept / reject
3. Stock / back There are three different states! For example: to receive 100, 80 receiving storage, 20 back, you accept the transaction 80 / 20 things to return select transaction_type, destination_type_code from rcv_transactions It can be seen the following stages: a1.receive - receiving a2.accept - receiving a3.deliery - invetory (amount of stock available)
If the normal mode, the final trigger generation mtl_material_transactions
Sales Order oe_order_headers_all sold_from_org_id sold_to_org_id is the client tier ship_from_org_id ship_to_org_id is the customer receiving layer invoice_to_org_id is the customer received single deliver_to_org_id And the customer structure of Customer ra_customers Customer address ra_addresses goods arrived in site ra_site_uses_all address address the invoice to arrive site oe_order_lines_all
gl certificate gl_je_batches Certificate Date: default_effective_date Accounting period: default_period_name The original certificate approved lenders currency summary: running_total_dr / cr such as U.S. dollars Currency certificates approved lenders summary: running_total_accounted_dr / cr
gl_je_headers journal header Lot: je_batch_id Accounting period: period_name Currency: currency_code Rate Type: currency_conversion_type Exchange Rate Date: currency_conversion_date Set of books: set_of_books_id reference gl_sets_of_books Document Type: je_category reference gl_je_sources Certificate Source: je_source
gl_je_lines journal body information
code_combination_id subject combination code
gl_balances general ledger balance period_net_dr / cr net begin_balance_dr / cr at the beginning places
ar invoice receivable ra_customer_trx_all customer_trx_id invoice number bill_to_site_use_id Customer Bill To Number primary_sales_id Seller oracle provides an external reference is the number input box, but due to versioning issues and length (<= 30), does not recommend users to use, if you want to use an external number, use the Descriptive Flexfield
ra_customer_trx_lines_all line_id line number inventory_item_id can be empty, such as non-material services, only appear in the description / tax row description quantity_invoice Billing Number line_type line type (general / tax) extend_price the amount the Bank Note: The tax line is hidden lines, so at least there will be two lines
Collections ar_cash_receipts_all (also includes non-payment information) cash_receipt_id internal code receipt_number Collection No. Collection date receipt_date Total amount receipt_type Cash / Miscellaneous cash / misc functional_amount stoichiometric amount of currency ui for the receipts Write-off relationship is not one to one, nor is it a write off 100%, ui application button on the lower right ar_receivable_applications_all applied_customer_trx_id invoice number applied_customer_trx_line_id Invoice Line Number
status app that write-off / unapp indicates that no write-off amount_applied match the amount of Note: red red collection plan period of time the problem statement; to be associated check ar_cash_receipts_all and ar_cash_receipt_history_all
ap
Accounts payable (which is our personnel in accordance with the supplier invoice information into the paper) ui on the invoice ap_invoices_all
Payment of actual payment ap_checks_all
Write-off relationship with the ar, the payment button on the lower right ap_invoice_payments_all customer balances, the situation is more complex: for example, merging two users, accounts payable balance, advances
Asset information fa_additions Asset classes fa_categories
Asset book fa_book_controls What is the relationship and the accounting books? fa_books The inquiry ui mothed is the depreciation method (straight-line method / output method)
fa_distribution_history distribution of assignment, to any number of departments location_id sector joint investigation fa_locations
Depreciation information (allocation method) fa_deprn_detail period_counter depreciation period number
Depreciation Affairs (new, renewal, transfer, retirement) fa_transaction_headers
select fnd_profile.value ('org_id') from dual select * from hr_operating_units hou where hou.organization_id = 204 - Fnd select * from fnd_application select * from fnd_application_tl where application_id = 101 select * from fnd_application_vl where application_id = 101 ---- Value Set select * from fnd_flex_value_sets select * from fnd_flex_values select * from fnd_flex_values_vl ---- Flexfield select * from fnd_id_flexs select * from fnd_id_flex_structures where id_flex_code = 'gl #' select * from fnd_id_flex_segments where id_flex_code = 'gl #' and id_flex_num = 50671
select * from fnd_profile_options_vl select * from fnd_concurrent_programs PROGRAMME select * from fnd_concurrent_requests Request Form select * from fnd_concurrent_processes process table
- Inv select * from org_organization_definitions Inventory Organization select * from mtl_parameters tissue parameters select * from mtl_system_items_b where inventory_item_id = 171 and organization_id = 204 BOM select * from mtl_secondary_inventories subinventory select * from mtl_item_locations Locator select * from mtl_lot_numbers batch select * from mtl_onhand_quantities existing scale select * from mtl_serial_numbers sequence select * from mtl_material_transactions material transaction records select * from mtl_transaction_accounts accounting entries select * from mtl_transaction_types transaction type select * from mtl_txn_source_types transaction source type select * from mfg_lookups ml where ml.lookup_type = 'mtl_transaction_action'
- Po select * from po_requisition_headers_all request header select * from po_requisition_lines_all request line select * from po_headers_all order header select * from po_lines_all Order Line select * from po_line_locations_all select * from po_distributions_all distribution select * from po_releases_all Send select * from rcv_shipment_headers procurement receiver select * from rcv_shipment_lines receiving bank purchase select * from rcv_transactions receiving transaction select * from po_agents select * from po_vendors Order select * from po_vendor_sites_all
- Oe select * from ra_customers customers select * from ra_addresses_all Address select * from ra_site_uses_all Users
select * from oe_order_headers_all sales head select * from oe_order_lines_all sales line
select * from wsh_new_deliveries Send select * from wsh_delivery_details
select * from wsh_delivery_assignments
- Gl select * from gl_sets_of_books Ledger select * from gl_code_combinations gcc where gcc.summary_flag = 'y' subject combinations select * from gl_balances account balance select * from gl_je_batches certificate awarded select * from gl_je_headers first certificate select * from gl_je_lines line certificate select * from gl_je_categories classification certificate select * from gl_je_sources evidence sources select * from gl_summary_templates Subject Summary Template select * from gl_account_hierarchies Subject Summary Templates Hierarchy
- Ar select * from ar_batches_all transaction approved select * from ra_customer_trx_all invoice header select * from ra_customer_trx_lines_all invoice line select * from ra_cust_trx_line_gl_dist_all invoice distribution select * from ar_cash_receipts_all receivables select * from ar_receivable_applications_all verification select * from ar_payment_schedules_all Invoice Adjustment select * from ar_adjustments_all accounting entries select * from ar_distributions_all payment plans
- Ap select * from ap_invoices_all invoice header select * from ap_invoice_distributions_all invoice line select * from ap_payment_schedules_all payment plans select * from ap_check_stocks_all documents select * from ap_checks_all payment select * from ap_bank_branches Bank select * from ap_bank_accounts_all bank account select * from ap_invoice_payments_all verification
SELECT AR.customer_number, AR.customer_name, NVL (SUM (AR.entered_dr), 0) entered_dr, NVL (SUM (AR.entered_cr), 0) entered_cr, NVL (SUM (AR.accounted_dr), 0) accounted_dr, NVL (SUM (AR.accounted_cr), 0) accounted_cr, AR.TYPE FROM (-- Debit Memo SELECT ct.bill_to_customer_id, rc.customer_number, rc.customer_name,
ct.trx_number original_trx_number, NULL apply_trx_number, ctlg.gl_date, ctlg.account_class, gc.segment4 ACCOUNT, ct.attribute1 commercial_number, ct.ct_reference sales_order, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.amount, 0)), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, -NVL (ctlg.amount, 0), NULL))) entered_dr, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, -NVL (ctlg.amount, 0), NULL), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.amount, 0)))) entered_cr, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.acctd_amount, 0)), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, -NVL (ctlg.acctd_amount, 0), NULL))) accounted_dr, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, -NVL (ctlg.acctd_amount, 0), NULL), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.acctd_amount, 0)))) accounted_cr, 'DM' TYPE FROM ar.ra_customer_trx_all ct, ar.ra_cust_trx_line_gl_dist_all ctlg, gl.gl_code_combinations gc, apps.ra_customers rc WHERE ct.set_of_books_id = 63 AND ct.customer_trx_id = ctlg.customer_trx_id AND gc.code_combination_id = ctlg.code_combination_id
AND ctlg.account_class = 'REC' AND rc.customer_id = ct.bill_to_customer_id AND EXISTS (SELECT 'True' FROM apps.ra_cust_trx_types_all rctt WHERE rctt.org_id = 211 AND rctt.end_date IS NULL AND rctt.TYPE IN ('DM') AND rctt.cust_trx_type_id = ct.cust_trx_type_id) AND gc.segment4 = '13110 ' -- AND TO_CHAR (ctlg.gl_date, 'YYYY-MM') BETWEEN '& START_GL_DATE' AND -- '& END_GL_DATE' UNION ALL --Invoice SELECT ct.bill_to_customer_id, rc.customer_number, rc.customer_name, ct.trx_number original_trx_number, NULL apply_trx_number, ctlg.gl_date, ctlg.account_class, gc.segment4 ACCOUNT, ct.attribute1 commercial_number, ct.ct_reference sales_order, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.amount, 0)), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, -NVL (ctlg.amount, 0), NULL))) entered_dr, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, -NVL (ctlg.amount, 0), NULL), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.amount, 0)))) entered_cr, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.acctd_amount, 0)), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, -NVL (ctlg.acctd_amount, 0), NULL))) accounted_dr, TO_NUMBER (DECODE (ctlg.account_class,
'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, -NVL (ctlg.acctd_amount, 0), NULL), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.acctd_amount, 0)))) accounted_cr, 'INV' TYPE FROM ar.ra_customer_trx_all ct, ar.ra_cust_trx_line_gl_dist_all ctlg, gl.gl_code_combinations gc, apps.ra_customers rc WHERE ct.set_of_books_id = 63 AND ct.customer_trx_id = ctlg.customer_trx_id AND gc.code_combination_id = ctlg.code_combination_id AND ctlg.account_class = 'REC' AND rc.customer_id = ct.bill_to_customer_id AND EXISTS (SELECT 'True' FROM apps.ra_cust_trx_types_all rctt WHERE rctt.org_id = 211 AND rctt.end_date IS NULL AND rctt.TYPE IN ('INV') AND rctt.cust_trx_type_id = ct.cust_trx_type_id) AND gc.segment4 = '13110 ' -- AND TO_CHAR (ctlg.gl_date, 'YYYY-MM') BETWEEN '& START_GL_DATE' AND -- '& END_GL_DATE' UNION ALL --Credit Memo SELECT ct.bill_to_customer_id, rc.customer_number, rc.customer_name, ct.trx_number original_trx_number, NULL apply_trx_number, ctlg.gl_date, ctlg.account_class, gc.segment4 ACCOUNT, ct.attribute1 commercial_number, ct.ct_reference sales_order, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.amount, 0)), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, -NVL (ctlg.amount, 0), NULL))) entered_dr, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1,
-NVL (ctlg.amount, 0), NULL), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.amount, 0)))) entered_cr, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.acctd_amount, 0)), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, -NVL (ctlg.acctd_amount, 0), NULL))) accounted_dr, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, -NVL (ctlg.acctd_amount, 0), NULL), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.acctd_amount, 0)))) accounted_cr, 'CM' TYPE FROM ar.ra_customer_trx_all ct, ar.ra_cust_trx_line_gl_dist_all ctlg, gl.gl_code_combinations gc, apps.ra_customers rc WHERE ct.set_of_books_id = 63 AND ct.customer_trx_id = ctlg.customer_trx_id AND gc.code_combination_id = ctlg.code_combination_id AND ctlg.account_class = 'REC' AND rc.customer_id = ct.bill_to_customer_id AND EXISTS (SELECT 'True' FROM apps.ra_cust_trx_types_all rctt --WHERE rctt.org_id = 211 AND rctt.end_date IS NULL AND rctt.TYPE IN ('CM') AND rctt.cust_trx_type_id = ct.cust_trx_type_id) -- AND gc.segment4 = '13110 ' -- AND TO_CHAR (ctlg.gl_date, 'YYYY-MM') BETWEEN '& START_GL_DATE' AND -- '& END_GL_DATE' UNION ALL -- Adjustment SELECT ct.bill_to_customer_id, rc.customer_number, rc.customer_name, ct.trx_number original_trx_number, adj.adjustment_number, adj.gl_date,
dis.source_type, gc.segment4, NULL, NULL, dis.amount_dr entered_dr, dis.amount_cr entered_cr, dis.acctd_amount_dr amount_dr, dis.acctd_amount_cr amount_cr, 'ADJ' TYPE FROM ar.ar_adjustments_all adj, ar.ar_distributions_all dis, ar.ra_customer_trx_all ct, apps.ra_customers rc, gl.gl_code_combinations gc WHERE adj.set_of_books_id = 63 AND dis.source_table = 'ADJ' AND dis.source_type = 'REC' AND adj.adjustment_id = dis.source_id AND ct.customer_trx_id = adj.customer_trx_id AND ct.bill_to_customer_id = rc.customer_id AND gc.code_combination_id = dis.code_combination_id AND gc.segment4 = '13110 ' AND TO_CHAR (adj.gl_date, 'YYYY-MM') BETWEEN '& START_GL_DATE' AND '& END_GL_DATE' UNION ALL --Apply for Transactions SELECT ct.bill_to_customer_id, rc.customer_number, rc.customer_name, ct.trx_number, cr.receipt_number, rec.gl_date, dis.source_type, gc.segment4, NULL, NULL, dis.amount_dr entered_dr, dis.amount_cr entered_cr, dis.acctd_amount_dr amount_dr, dis.acctd_amount_cr amount_cr, 'APP' TYPE FROM ar.ar_distributions_all dis, ar.ar_receivable_applications_all rec, ar.ra_customer_trx_all ct, apps.ra_customers rc, gl.gl_code_combinations gc, ar.ar_cash_receipts_all cr WHERE rec.set_of_books_id = 63 AND rec.receivable_application_id = dis.source_id AND dis.source_table = 'RA' AND rec.applied_customer_trx_id = ct.customer_trx_id AND rc.customer_id = ct.bill_to_customer_id AND gc.code_combination_id = dis.code_combination_id AND rec.application_type = 'CASH' AND rec.display = 'Y' AND cr.cash_receipt_id = rec.cash_receipt_id
AND gc.segment4 = '13110 ' AND TO_CHAR (rec.gl_date, 'YYYY-MM') BETWEEN '& START_GL_DATE' AND '& END_GL_DATE') AR WHERE AR.TYPE IN ('INV', 'DM', 'CM', 'ADJ') GROUP BY AR.customer_number, AR.customer_name, AR.TYPE UNION ALL SELECT REC.customer_number, REC.customer_name, NVL (SUM (REC.entered_dr), 0) entered_dr, NVL (SUM (REC.entered_cr), 0) entered_cr, NVL (SUM (REC.amount_dr), 0) amount_dr, NVL (SUM (REC.amount_cr), 0) amount_cr, 'Receipts' TYPE FROM (SELECT cr.pay_from_customer customer_id, rc.customer_number, rc.customer_name, cr.receipt_number, cr.status, ct.trx_number applied_trx_number, ard.source_table, ard.source_type, ard.amount_cr entered_dr, - ard.amount_dr entered_cr, - ard.acctd_amount_cr amount_dr, - ard.acctd_amount_dr amount_cr, - gc.segment4, rec.gl_date FROM apps.ar_cash_receipts_all cr, apps.ar_receivable_applications_all rec, apps.ar_distributions_all ard, apps.ra_customers rc, apps.ra_customer_trx_all ct, gl.gl_code_combinations gc WHERE cr.set_of_books_id = 63 AND cr.cash_receipt_id = rec.cash_receipt_id AND ard.source_table = 'RA' AND rec.receivable_application_id = ard.source_id AND cr.pay_from_customer = rc.customer_id (+) AND ct.customer_trx_id (+) = rec.applied_customer_trx_id AND gc.code_combination_id = ard.code_combination_id AND TO_CHAR (rec.gl_date, 'YYYY-MM') BETWEEN '& START_GL_DATE' AND '& END_GL_DATE' UNION ALL SELECT cr.pay_from_customer customer_id, rc.customer_number, rc.customer_name, cr.receipt_number, cr.status, NULL trx_number, ard.source_table, ard.source_type, ard.amount_cr entered_dr, ard.amount_dr entered_cr, ard.acctd_amount_cr amount_dr, ard.acctd_amount_dr amount_cr,
gc.segment4, crh.gl_date FROM apps.ar_cash_receipts_all cr, apps.ar_cash_receipt_history_all crh, apps.ar_distributions_all ard, apps.ra_customers rc, gl.gl_code_combinations gc WHERE cr.set_of_books_id = 63 AND cr.cash_receipt_id = crh.cash_receipt_id AND crh.cash_receipt_history_id = ard.source_id AND ard.source_table = 'CRH' AND cr.pay_from_customer = rc.customer_id (+) AND gc.code_combination_id = ard.code_combination_id AND TO_CHAR (crh.gl_date, 'YYYY-MM') BETWEEN '& START_GL_DATE' AND '& END_GL_DATE') rec WHERE REC.source_type IN ('REMITTANCE', 'CONFIRMATION') -- The above debit / credit swaps, the main subject when taking a bank, so to be converted into a collection subjects. GROUP BY REC.customer_number, REC.customer_name, 'Receipts'
Charges did not talk much to say, serve.
SELECT AR.customer_number, AR.customer_name, NVL (SUM (AR.entered_dr), 0) entered_dr, NVL (SUM (AR.entered_cr), 0) entered_cr, NVL (SUM (AR.accounted_dr), 0) accounted_dr, NVL (SUM (AR.accounted_cr), 0) accounted_cr, AR.TYPE FROM (- Debit Memo SELECT ct.bill_to_customer_id, rc.customer_number, rc.customer_name, ct.trx_number original_trx_number, NULL apply_trx_number, ctlg.gl_date, ctlg.account_class, gc.segment4 ACCOUNT, ct.attribute1 commercial_number, ct.ct_reference sales_order, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.amount, 0)), DECODE (SIGN (NVL (ctlg.amount, 0)), -1,
-NVL (ctlg.amount, 0), NULL))) entered_dr, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, -NVL (ctlg.amount, 0), NULL), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.amount, 0)))) entered_cr, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.acctd_amount, 0)), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, -NVL (ctlg.acctd_amount, 0), NULL))) accounted_dr, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, -NVL (ctlg.acctd_amount, 0), NULL), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.acctd_amount, 0)))) accounted_cr, 'DM' TYPE FROM ar.ra_customer_trx_all ct, ar.ra_cust_trx_line_gl_dist_all ctlg, gl.gl_code_combinations gc, apps.ra_customers rc WHERE ct.set_of_books_id = 63 AND ct.customer_trx_id = ctlg.customer_trx_id AND gc.code_combination_id = ctlg.code_combination_id AND ctlg.account_class = 'REC' AND rc.customer_id = ct.bill_to_customer_id AND EXISTS (SELECT 'True' FROM apps.ra_cust_trx_types_all rctt WHERE rctt.org_id = 211
AND rctt.end_date IS NULL AND rctt.TYPE IN ('DM') AND rctt.cust_trx_type_id = ct.cust_trx_type_id) AND gc.segment4 = '13110 ' AND TO_CHAR (ctlg.gl_date, 'YYYY-MM') BETWEEN '& START_GL_DATE' AND '& END_GL_DATE' UNION ALL - Invoice SELECT ct.bill_to_customer_id, rc.customer_number, rc.customer_name, ct.trx_number original_trx_number, NULL apply_trx_number, ctlg.gl_date, ctlg.account_class, gc.segment4 ACCOUNT, ct.attribute1 commercial_number, ct.ct_reference sales_order, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.amount, 0)), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, -NVL (ctlg.amount, 0), NULL))) entered_dr, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, -NVL (ctlg.amount, 0), NULL), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.amount, 0)))) entered_cr, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.acctd_amount, 0)), DECODE (SIGN (NVL (ctlg.amount, 0)),
-1, -NVL (ctlg.acctd_amount, 0), NULL))) accounted_dr, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, -NVL (ctlg.acctd_amount, 0), NULL), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.acctd_amount, 0)))) accounted_cr, 'INV' TYPE FROM ar.ra_customer_trx_all ct, ar.ra_cust_trx_line_gl_dist_all ctlg, gl.gl_code_combinations gc, apps.ra_customers rc WHERE ct.set_of_books_id = 63 AND ct.customer_trx_id = ctlg.customer_trx_id AND gc.code_combination_id = ctlg.code_combination_id AND ctlg.account_class = 'REC' AND rc.customer_id = ct.bill_to_customer_id AND EXISTS (SELECT 'True' FROM apps.ra_cust_trx_types_all rctt WHERE rctt.org_id = 211 AND rctt.end_date IS NULL AND rctt.TYPE IN ('INV') AND rctt.cust_trx_type_id = ct.cust_trx_type_id) AND gc.segment4 = '13110 ' AND TO_CHAR (ctlg.gl_date, 'YYYY-MM') BETWEEN '& START_GL_DATE' AND '& END_GL_DATE' UNION ALL - Credit Memo SELECT ct.bill_to_customer_id, rc.customer_number, rc.customer_name, ct.trx_number original_trx_number, NULL apply_trx_number, ctlg.gl_date, ctlg.account_class, gc.segment4 ACCOUNT, ct.attribute1 commercial_number, ct.ct_reference sales_order,
TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.amount, 0)), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, -NVL (ctlg.amount, 0), NULL))) entered_dr, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, -NVL (ctlg.amount, 0), NULL), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.amount, 0)))) entered_cr, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.acctd_amount, 0)), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, -NVL (ctlg.acctd_amount, 0), NULL))) accounted_dr, TO_NUMBER (DECODE (ctlg.account_class, 'REC', DECODE (SIGN (NVL (ctlg.amount, 0)), -1, -NVL (ctlg.acctd_amount, 0), NULL), DECODE (SIGN (NVL (ctlg.amount, 0)), -1, NULL, NVL (ctlg.acctd_amount, 0)))) accounted_cr, 'CM' TYPE FROM ar.ra_customer_trx_all ct, ar.ra_cust_trx_line_gl_dist_all ctlg, gl.gl_code_combinations gc, apps.ra_customers rc WHERE ct.set_of_books_id = 63
AND ct.customer_trx_id = ctlg.customer_trx_id AND gc.code_combination_id = ctlg.code_combination_id AND ctlg.account_class = 'REC' AND rc.customer_id = ct.bill_to_customer_id AND EXISTS (SELECT 'True' FROM apps.ra_cust_trx_types_all rctt WHERE rctt.org_id = 211 AND rctt.end_date IS NULL AND rctt.TYPE IN ('CM') AND rctt.cust_trx_type_id = ct.cust_trx_type_id) AND gc.segment4 = '13110 ' AND TO_CHAR (ctlg.gl_date, 'YYYY-MM') BETWEEN '& START_GL_DATE' AND '& END_GL_DATE' UNION ALL - Adjustment SELECT ct.bill_to_customer_id, rc.customer_number, rc.customer_name, ct.trx_number original_trx_number, adj.adjustment_number, adj.gl_date, dis.source_type, gc.segment4, NULL, NULL, dis.amount_dr entered_dr, dis.amount_cr entered_cr, dis.acctd_amount_dr amount_dr, dis.acctd_amount_cr amount_cr, 'ADJ' TYPE FROM ar.ar_adjustments_all adj, ar.ar_distributions_all dis, ar.ra_customer_trx_all ct, apps.ra_customers rc, gl.gl_code_combinations gc WHERE adj.set_of_books_id = 63 AND dis.source_table = 'ADJ' AND dis.source_type = 'REC' AND adj.adjustment_id = dis.source_id AND ct.customer_trx_id = adj.customer_trx_id AND ct.bill_to_customer_id = rc.customer_id AND gc.code_combination_id = dis.code_combination_id AND gc.segment4 = '13110 ' AND TO_CHAR (adj.gl_date, 'YYYY-MM') BETWEEN '&
START_GL_DATE' AND '& END_GL_DATE' UNION ALL - Apply for Transactions SELECT ct.bill_to_customer_id, rc.customer_number, rc.customer_name, ct.trx_number, cr.receipt_number, rec.gl_date, dis.source_type, gc.segment4, NULL, NULL, dis.amount_dr entered_dr, dis.amount_cr entered_cr, dis.acctd_amount_dr amount_dr, dis.acctd_amount_cr amount_cr, 'APP' TYPE FROM ar.ar_distributions_all dis, ar.ar_receivable_applications_all rec, ar.ra_customer_trx_all ct, apps.ra_customers rc, gl.gl_code_combinations gc, ar.ar_cash_receipts_all cr WHERE rec.set_of_books_id = 63 AND rec.receivable_application_id = dis.source_id AND dis.source_table = 'RA' AND rec.applied_customer_trx_id = ct.customer_trx_id AND rc.customer_id = ct.bill_to_customer_id AND gc.code_combination_id = dis.code_combination_id AND rec.application_type = 'CASH' AND rec.display = 'Y' AND cr.cash_receipt_id = rec.cash_receipt_id AND gc.segment4 = '13110 ' AND TO_CHAR (rec.gl_date, 'YYYY-MM') BETWEEN '& START_GL_DATE' AND '& END_GL_DATE') AR - WHERE AR.TYPE IN ('INV', 'DM', 'CM', 'ADJ') GROUP BY AR.customer_number, AR.customer_name, AR.TYPE UNION ALL SELECT REC.customer_number, REC.customer_name, NVL (SUM (REC.entered_dr), 0) entered_dr, NVL (SUM (REC.entered_cr), 0) entered_cr, NVL (SUM (REC.amount_dr), 0) amount_dr,
NVL (SUM (REC.amount_cr), 0) amount_cr, 'Receipts' TYPE FROM (SELECT cr.pay_from_customer customer_id, rc.customer_number, rc.customer_name, cr.receipt_number, cr.status, ct.trx_number applied_trx_number, ard.source_table, ard.source_type, ard.amount_cr entered_dr, - ard.amount_dr entered_cr, - ard.acctd_amount_cr amount_dr, - ard.acctd_amount_dr amount_cr, - gc.segment4, rec.gl_date FROM apps.ar_cash_receipts_all cr, apps.ar_receivable_applications_all rec, apps.ar_distributions_all ard, apps.ra_customers rc, apps.ra_customer_trx_all ct, gl.gl_code_combinations gc WHERE cr.set_of_books_id = 63 AND cr.cash_receipt_id = rec.cash_receipt_id AND ard.source_table = 'RA' AND rec.receivable_application_id = ard.source_id AND cr.pay_from_customer = rc.customer_id (+) AND ct.customer_trx_id (+) = rec.applied_customer_trx_id AND gc.code_combination_id = ard.code_combination_id AND TO_CHAR (rec.gl_date, 'YYYY-MM') BETWEEN '& START_GL_DATE' AND '& END_GL_DATE' UNION ALL SELECT cr.pay_from_customer customer_id, rc.customer_number, rc.customer_name, cr.receipt_number, cr.status, NULL trx_number, ard.source_table, ard.source_type, ard.amount_cr entered_dr, - ard.amount_dr entered_cr, - ard.acctd_amount_cr amount_dr, - ard.acctd_amount_dr amount_cr, - gc.segment4,
crh.gl_date FROM apps.ar_cash_receipts_all cr, apps.ar_cash_receipt_history_all crh, apps.ar_distributions_all ard, apps.ra_customers rc, gl.gl_code_combinations gc WHERE cr.set_of_books_id = 63 AND cr.cash_receipt_id = crh.cash_receipt_id AND crh.cash_receipt_history_id = ard.source_id AND ard.source_table = 'CRH' AND cr.pay_from_customer = rc.customer_id (+) AND gc.code_combination_id = ard.code_combination_id AND TO_CHAR (crh.gl_date, 'YYYY-MM') BETWEEN '& START_GL_DATE' AND '& END_GL_DATE') rec WHERE REC.source_type IN ('REMITTANCE', 'CONFIRMATION')
- The above debit / credit swaps, the main subject when taking a bank, so to be converted into a collection subjects.
GROUP BY REC.customer_number, REC.customer_name, 'Receipts'