[Home] [Help]
295: ,sum(decode(com.parent_bc_packet_id, NULL,(nvl(com.accounted_dr,0) - nvl(com.accounted_cr,0)),0)
296: ) ComRawAmt
297: Into l_combdamt
298: ,l_comrawamt
299: from pa_bc_commitments_all com
300: where com.project_id = p_project_id
301: and com.task_id = p_task_id
302: and com.budget_version_id = p_budget_version_id
303: and com.document_line_id = p_document_line_id
640: select 'Y'
641: from dual
642: Where exists
643: (select null
644: from pa_bc_commitments_all comm
645: where comm.project_id = l_project_id
646: and comm.task_id = l_task_id
647: and comm.budget_version_id = l_budget_version_id
648: and comm.document_line_id = l_document_line_id
800: CLOSE cur_cwk_amts;
801: pa_funds_control_pkg.log_message(p_msg_token1 => 'CommRawAmt['||l_comm_raw_amt||']CommbdAmt['||l_comm_bd_amt||
802: ']RelvdComm['||l_relvd_comm_raw_amt||']RelvdBd['||l_relvd_comm_bd_amt||']');
803: l_rows_updated := 0;
804: UPDATE pa_bc_commitments_all com
805: SET com.comm_tot_raw_amt = nvl(com.comm_tot_raw_amt,0) +
806: decode(p_calling_module,'GL',decode(cwk.line_type,'RAW',nvl(l_comm_raw_amt,0),0),0)
807: ,com.comm_tot_bd_amt = nvl(com.comm_tot_bd_amt,0) +
808: decode(p_calling_module,'GL'
993: If l_cwk_multiplier is NOT NULL Then
994: l_cwk_multiplier := pa_currency.round_trans_currency_amt
995: (l_cwk_multiplier,g_acct_currency_code);
996: End If;
997: UPDATE pa_bc_commitments_all cmt
998: SET cmt.compiled_multiplier = decode (cmt.document_line_id,NULL,cmt.compiled_multiplier,
999: l_cwk_multiplier)
1000: WHERE cmt.summary_record_flag = 'Y'
1001: AND cmt.document_line_id is NOT NULL
1449: END create_unrsvd_lines;
1450:
1451: ------------------------------------------------------------------------------------
1452: --This Api checks whether the Purchase order is based on the requisiton if
1453: -- the period and commitment id from pa_bc_commitments
1454: ------------------------------------------------------------------------------------
1455: FUNCTION is_req_based_po( p_req_distribution_id IN NUMBER
1456: ,p_req_header_id IN NUMBER
1457: ,p_req_prevent_enc_flipped IN VARCHAR2
1478: CURSOR c_req_raw_burden IS
1479: SELECT parent_bc_packet_id
1480: FROM ( SELECT comm.bc_commitment_id,
1481: comm.parent_bc_packet_id
1482: FROM pa_bc_commitments comm
1483: WHERE comm.document_distribution_id = p_req_distribution_id
1484: AND comm.document_header_id = p_req_header_id
1485: AND comm.document_type = 'REQ'
1486: UNION ALL
1579:
1580: --------------------------------------------------------------------------------
1581: --This api checks whether the Invoice is based on the Purchase order
1582: -- if so then it takes the po_header_id,po_distribution_id,period_name
1583: -- and bc_commitment_id from pa_bc_commitments
1584: --------------------------------------------------------------------------------
1585: FUNCTION is_po_based_invoice( p_po_distribution_id IN NUMBER
1586: ,p_po_header_id IN NUMBER
1587: ,p_po_release_id IN NUMBER
1598: L_PO_DESTINATION_TYPE PO_DISTRIBUTIONS_ALL.DESTINATION_TYPE_CODE%TYPE;
1599: L_CC_DISTRIBUTION_ID NUMBER;
1600:
1601: -- this cursor checks whehter the AP is based on Purchase Order if so then
1602: -- take the calculated burden amount from pa_bc_commitments table
1603: CURSOR po_cur is
1604: SELECT po.req_header_reference_num
1605: ,po.req_line_reference_num
1606: ,po.destination_type_code
1618: p_header_id NUMBER,
1619: p_document_type VARCHAR2) IS
1620: SELECT parent_bc_packet_id
1621: FROM ( SELECT comm.parent_bc_packet_id
1622: FROM pa_bc_commitments comm
1623: WHERE comm.document_distribution_id = p_distribution_id
1624: AND comm.document_header_id = p_header_id
1625: AND comm.document_type = p_document_type
1626: AND NVL(comm.document_header_id_2 ,-99) = NVL(p_po_release_id,-99)
4576: l_amt_balance_tab,
4577: g_bdamt_balance_tab,
4578: g_doc_line_id_tab,
4579: g_burden_type_tab
4580: from pa_bc_commitments pbc,
4581: pa_projects_all pp,
4582: pa_project_types ppt
4583: where pbc.document_type = 'PO'
4584: and pbc.summary_record_flag = 'Y'
5120: --
5121: -- Bug : 3703180
5122: -- PJ.M:B5:P1:QA:CWK: PAXBLRSL- -VE COMMITMENT CREATED WHEN PO CANCELLED AFTER
5123: -- Resolution : Compare the burden cost calculated with the summary record in
5124: -- pa_bc_packets /pa_bc_commitments_all. We are using the amounts in the summary
5125: -- table if summary has amounts less than the calculated in pa bc packets.
5126: -- If we have zero burden in pa bc packets then we use the entire amounts in
5127: -- the summary record.
5128: --
5234:
5235: --
5236: -- BUG 3703180
5237: -- Different line burdening setup.
5238: -- We determine the summary record from pa bc packets or pa bc commitments all table.
5239: -- compare the summary amounts with the pa bc packets burden and use the one less than
5240: -- the other. If pa bc packets burden cost is ZERO than we use the burden cost from the
5241: -- summary table record.
5242: --
5260:
5261: IF l_exp_type_tab.count > 0 THEN
5262: --
5263: -- BUG 3703180
5264: -- Determine the summary amounts from pa bc packets or pa bc commitments table.
5265: --
5266: for indx in 1..l_exp_type_tab.count loop
5267:
5268: g_bdamt_balance_tab.delete ;
5285:
5286: IF g_bdamt_balance_tab.count = 0 THEN
5287: select (nvl(comm_tot_bd_amt,0) - nvl(comm_bd_amt_relieved,0) ) bd_amount
5288: bulk collect into g_bdamt_balance_tab
5289: from pa_bc_commitments
5290: where document_type = 'PO'
5291: and summary_record_flag = 'Y'
5292: -- and burden_cost_flag = 'O'
5293: and parent_bc_packet_id is not NULL
5532: pa_funds_control_pkg.log_message(p_msg_token1 =>'Use Existing Multiplier Credit found :'||l_prev_multiplier);
5533:
5534: select NVL(max(pbc.packet_id) ,0)
5535: into l_max_packet_id
5536: from pa_bc_commitments pbc
5537: where pbc.document_header_id = l_doc_header_id
5538: and pbc.document_distribution_id = l_doc_distribution_id
5539: and pbc.document_type = p_doc_type
5540: and pbc.packet_id <> p_packet_id ;
5538: and pbc.document_distribution_id = l_doc_distribution_id
5539: and pbc.document_type = p_doc_type
5540: and pbc.packet_id <> p_packet_id ;
5541:
5542: pa_funds_control_pkg.log_message(p_msg_token1 =>'OLD Multiplier: pa_bc_commitments packet id '||l_max_packet_id);
5543:
5544: select max(packet_id)
5545: into l_max_packet_id_b
5546: from pa_bc_packets gbc1
5559: select compiled_multiplier ,
5560: expenditure_type
5561: bulk collect into l_tab_multiplier,
5562: l_tab_icc_exp_type
5563: from pa_bc_commitments
5564: where packet_id = l_max_packet_id
5565: and document_header_id = l_doc_header_id
5566: and document_distribution_id = l_doc_distribution_id
5567: and document_type = p_doc_type
5570: -- pa_bc_packets/bc commitments with same header_id and distribution_id.In such scenario
5571: -- we should pick burden lines against one of the raw line else it will result in burden
5572: -- duplication
5573: and parent_bc_packet_id IN ( SELECT bc1.bc_packet_id -- SQL to fetch single raw record
5574: FROM pa_bc_commitments bc1
5575: WHERE bc1.packet_id = l_max_packet_id
5576: AND bc1.document_header_id = l_doc_header_id
5577: AND bc1.document_distribution_id = l_doc_distribution_id
5578: AND bc1.document_type = p_doc_type
5578: AND bc1.document_type = p_doc_type
5579: AND bc1.parent_bc_packet_id IS NULL
5580: AND ROWNUM = 1 );
5581:
5582: pa_funds_control_pkg.log_message(p_msg_token1 =>'OLD Multiplier: pa_bc_commitments multiplier used');
5583: ELSE
5584:
5585: select compiled_multiplier ,
5586: expenditure_type
5997: pbc.status_code,
5998: /* Incorrect Burden amts Bug fix:
5999: pa_currency.round_trans_currency_amt
6000: (p_entered_cr,g_acct_currency_code),
6001: -- amount from pa_bc_commitments (flip the amts)
6002: pa_currency.round_trans_currency_amt
6003: (p_entered_dr,g_acct_currency_code), -- amount from pa_bc_commitments
6004: pa_currency.round_trans_currency_amt
6005: (p_accounted_cr,g_acct_currency_code),-- amount from pa_bc_commitments
5999: pa_currency.round_trans_currency_amt
6000: (p_entered_cr,g_acct_currency_code),
6001: -- amount from pa_bc_commitments (flip the amts)
6002: pa_currency.round_trans_currency_amt
6003: (p_entered_dr,g_acct_currency_code), -- amount from pa_bc_commitments
6004: pa_currency.round_trans_currency_amt
6005: (p_accounted_cr,g_acct_currency_code),-- amount from pa_bc_commitments
6006: pa_currency.round_trans_currency_amt
6007: (p_accounted_dr,g_acct_currency_code), -- amount from pa_bc_commitments
6001: -- amount from pa_bc_commitments (flip the amts)
6002: pa_currency.round_trans_currency_amt
6003: (p_entered_dr,g_acct_currency_code), -- amount from pa_bc_commitments
6004: pa_currency.round_trans_currency_amt
6005: (p_accounted_cr,g_acct_currency_code),-- amount from pa_bc_commitments
6006: pa_currency.round_trans_currency_amt
6007: (p_accounted_dr,g_acct_currency_code), -- amount from pa_bc_commitments
6008: End Of bug fix: */
6009: pa_currency.round_trans_currency_amt
6003: (p_entered_dr,g_acct_currency_code), -- amount from pa_bc_commitments
6004: pa_currency.round_trans_currency_amt
6005: (p_accounted_cr,g_acct_currency_code),-- amount from pa_bc_commitments
6006: pa_currency.round_trans_currency_amt
6007: (p_accounted_dr,g_acct_currency_code), -- amount from pa_bc_commitments
6008: End Of bug fix: */
6009: pa_currency.round_trans_currency_amt
6010: (p_entered_dr,g_acct_currency_code),
6011: pa_currency.round_trans_currency_amt
6371: pbc.status_code,
6372: /* Incorrect Burden amts Bug fix:
6373: pa_currency.round_trans_currency_amt
6374: (p_entered_cr,g_acct_currency_code),
6375: -- amount from pa_bc_commitments (flip amts)
6376: pa_currency.round_trans_currency_amt
6377: (p_entered_dr,g_acct_currency_code), -- amount from pa_bc_commitments
6378: pa_currency.round_trans_currency_amt
6379: (p_accounted_cr,g_acct_currency_code), -- amount from pa_bc_commitments
6373: pa_currency.round_trans_currency_amt
6374: (p_entered_cr,g_acct_currency_code),
6375: -- amount from pa_bc_commitments (flip amts)
6376: pa_currency.round_trans_currency_amt
6377: (p_entered_dr,g_acct_currency_code), -- amount from pa_bc_commitments
6378: pa_currency.round_trans_currency_amt
6379: (p_accounted_cr,g_acct_currency_code), -- amount from pa_bc_commitments
6380: pa_currency.round_trans_currency_amt
6381: (p_accounted_dr,g_acct_currency_code), -- amount from pa_bc_commitments
6375: -- amount from pa_bc_commitments (flip amts)
6376: pa_currency.round_trans_currency_amt
6377: (p_entered_dr,g_acct_currency_code), -- amount from pa_bc_commitments
6378: pa_currency.round_trans_currency_amt
6379: (p_accounted_cr,g_acct_currency_code), -- amount from pa_bc_commitments
6380: pa_currency.round_trans_currency_amt
6381: (p_accounted_dr,g_acct_currency_code), -- amount from pa_bc_commitments
6382: End of Bug fix: */
6383: pa_currency.round_trans_currency_amt
6377: (p_entered_dr,g_acct_currency_code), -- amount from pa_bc_commitments
6378: pa_currency.round_trans_currency_amt
6379: (p_accounted_cr,g_acct_currency_code), -- amount from pa_bc_commitments
6380: pa_currency.round_trans_currency_amt
6381: (p_accounted_dr,g_acct_currency_code), -- amount from pa_bc_commitments
6382: End of Bug fix: */
6383: pa_currency.round_trans_currency_amt
6384: (p_entered_dr,g_acct_currency_code),
6385: pa_currency.round_trans_currency_amt
6456: END create_ap_po_bdn_lines;
6457:
6458: ------------------------------------------------------------------------------------------------------------------
6459: --This Api insert new records into pa bc packets if the project type is burdened.If the PO is based on REQ, or
6460: --Invoice is based on PO then it takes the burden amount for the REQ or PO from pa_bc_commitments table
6461: --and ensures that for req or po the old burden amount is used when reversing lines are passed in gl_bc_packets
6462: ------------------------------------------------------------------------------------------------------------------
6463: PROCEDURE Populate_burden_cost
6464: (p_packet_id IN NUMBER
6507: /*** Bug Fix : 1904319 added this for burden proportional calculations
6508: * cursor po_amount and pkt_po_amount is modified to calculate burden cost
6509: * if the invoice line is partially matched to purchase order
6510: **/
6511: -- this cursor picks up the burden amount and details from pa_bc_commitments table
6512: -- for the given distribution id ,document type and document header id
6513: CURSOR pkt_po_amount(l_req_id NUMBER,
6514: l_bc_packet_id NUMBER,
6515: l_po_header_id NUMBER,
6551: * nvl(pkttrx.accounted_cr,0) accounted_cr,
6552: /* End : Bug 13911609*/
6553: pktburd.expenditure_type,
6554: pktburd.compiled_multiplier
6555: FROM pa_bc_commitments_all pktburd
6556: ,pa_bc_commitments_all pktraw
6557: ,pa_bc_packets pkttrx
6558: WHERE pktburd.document_distribution_id = l_req_id
6559: AND pktburd.document_header_id = l_po_header_id
6552: /* End : Bug 13911609*/
6553: pktburd.expenditure_type,
6554: pktburd.compiled_multiplier
6555: FROM pa_bc_commitments_all pktburd
6556: ,pa_bc_commitments_all pktraw
6557: ,pa_bc_packets pkttrx
6558: WHERE pktburd.document_distribution_id = l_req_id
6559: AND pktburd.document_header_id = l_po_header_id
6560: AND pktburd.document_type = l_comm_doc_type
6560: AND pktburd.document_type = l_comm_doc_type
6561: AND pktburd.parent_bc_packet_id is NOT NULL
6562: AND (pktburd.packet_id ,pktburd.parent_bc_packet_id ) in
6563: ( SELECT max(comm.packet_id),max(comm.bc_packet_id)
6564: FROM pa_bc_commitments comm
6565: WHERE comm.document_distribution_id = pktburd.document_distribution_id
6566: ANd comm.document_header_id = pktburd.document_header_id
6567: AND comm.document_type = pktburd.document_type
6568: AND comm.parent_bc_packet_id is NULL
8429: AND gl.set_of_books_id = pbc.set_of_books_id
8430: AND gl.period_name = pbc.period_name) gl_start_date,
8431: pbc.exp_item_id,
8432: pbc.transfer_status_code
8433: FROM pa_bc_commitments_all pbc,
8434: pa_tasks pt,
8435: pa_budget_versions bv,
8436: pa_budget_entry_methods pm
8437: WHERE pbc.document_header_id = p_doc_header_id
8493: End if;
8494:
8495: -----------------------------------------------------------------------------------+
8496: -- Invoke the Sweeper process to sweep all the encumbrance etries
8497: -- from PA_BC_PACKETS to PA_BC_BALANCES and PA_BC_COMMITMENTS
8498: -----------------------------------------------------------------------------------+
8499: PA_Sweeper.Update_Act_Enc_Balance (
8500: X_Return_Status => l_Return_Status,
8501: X_Error_Message_Code => l_Msg_Data
8584: -- Table name column name Prior FP.M In FP.M
8585: -- -----------------------------------------------------------------------------
8586: -- pa_cost_distribution_line budget_version_id Not Supported Not Supported
8587: -- budget_line_id Not Supported Not Supported
8588: -- pa_bc_commitments budget_line_id Not Supported Not Supported
8589: -- exp_item_id Not Supported Supported
8590:
8591: -- Below logic has been added to populate above columns for expenditures interfaced to
8592: -- projects prior R12
8667:
8668: END IF;
8669:
8670: FORALL i in 1..l_bc_commitment_id_tbl.count
8671: UPDATE pa_bc_commitments
8672: SET budget_line_id = l_budget_line_id
8673: WHERE bc_commitment_id = l_bc_commitment_id_tbl(i)
8674: AND budget_line_id IS NULL;
8675:
8726: pa_funds_control_pkg.log_message(p_msg_token1 => 'INTERFACE_TBC_BTC_COMT_UPDATE : # of cdl records updated'||SQL%ROWCOUNT);
8727: End if;
8728:
8729: FORALL i in 1..l_bc_commitment_id_tbl.count
8730: UPDATE pa_bc_commitments
8731: SET exp_item_id = l_Exp_Item_Id_tbl(cdl_rec)
8732: WHERE bc_commitment_id = l_bc_commitment_id_tbl(i)
8733: AND exp_item_id IS NULL
8734: AND transfer_status_code in ('P','R','X');
8745: pa_funds_control_pkg.log_message(p_msg_token1 => 'INTERFACE_TBC_BTC_COMT_UPDATE : updating eligible AP commitments for liq encumbrance ');
8746: End if;
8747:
8748: FORALL i in 1..l_count_of_records
8749: UPDATE pa_bc_commitments bc_cm
8750: SET bc_cm.bc_event_id = l_cdl_acct_event_id_tbl(i),
8751: bc_cm.transfer_status_code = 'A',
8752: bc_cm.request_id = p_request_id,
8753: bc_cm.transferred_date = SYSDATE,
8851: pa_funds_control_pkg.log_message(p_msg_token1 => 'INTERFACE_TBC_BTC_COMT_UPDATE : updating eligible AP commitments for liq encumbrance ');
8852: End if;
8853:
8854: FORALL i in 1..l_count_of_records
8855: UPDATE pa_bc_commitments bc_cm
8856: SET bc_cm.bc_event_id = l_cdl_acct_event_id_tbl(i),
8857: bc_cm.transfer_status_code = 'A',
8858: bc_cm.request_id = p_request_id,
8859: bc_cm.transferred_date = SYSDATE,
9043: decode(p_dr_cr,'A',abs(nvl(accounted_dr,0)-nvl(accounted_cr,0)),
9044: 'E',abs(nvl(entered_dr,0)-nvl(entered_cr,0)))
9045: ,0))
9046: INTO l_ratio
9047: FROM pa_bc_commitments comm1
9048: WHERE comm1.packet_id = ( SELECT max(comm.packet_id)
9049: FROM pa_bc_commitments comm
9050: WHERE comm.document_distribution_id = l_document_distribution_id
9051: AND comm.document_header_id = l_document_header_id
9045: ,0))
9046: INTO l_ratio
9047: FROM pa_bc_commitments comm1
9048: WHERE comm1.packet_id = ( SELECT max(comm.packet_id)
9049: FROM pa_bc_commitments comm
9050: WHERE comm.document_distribution_id = l_document_distribution_id
9051: AND comm.document_header_id = l_document_header_id
9052: AND comm.document_type = l_document_type
9053: AND comm.parent_bc_packet_id is NULL)