[Home] [Help]
224: log_message(x_progress);
225: end if;
226:
227: -- Call procedure to split req lines and update
228: -- pon_award_allocations with split_req_id
229:
230: SPLIT_REQ_LINES(p_auction_header_id,
231: x_split_result,
232: x_split_failure_reason,
566: -- rescheduling has rescheduled the req quantity to a value lower than
567: -- the alloc quantity
568: CURSOR reqRescheduledSingleSupplier IS
569: SELECT paa.orig_req_line_id, prlsv.requisition_quantity
570: FROM pon_award_allocations paa, po_req_lines_in_pool_src_v prlsv,
571: pon_auction_item_prices_all paip
572: WHERE paa.allocated_qty > prlsv.requisition_quantity AND
573: paa.auction_header_id = p_auction_header_id AND
574: nvl(paa.split_req_line_id, -999)= -999 AND
585: -- which the req qty is lower than the allocated qty as a result
586: -- of mrp rescheduling
587: CURSOR reqRescheduledMultSupplier IS
588: SELECT paa.orig_req_line_id
589: FROM pon_award_allocations paa, po_req_lines_in_pool_src_v prlsv,
590: pon_auction_item_prices_all paip
591: WHERE paa.auction_header_id = p_auction_header_id AND
592: nvl(paa.split_req_line_id, -999)= -999 AND
593: nvl(paa.allocated_qty,0) > 0 AND
606: SELECT distinct paa.bid_line_number, itm.item_number, itm.item_revision, itm.item_description,
607: itm.requisition_number, pjo.name
608: FROM pon_auction_item_prices_all itm,
609: per_jobs pjo,
610: pon_award_allocations paa
611: WHERE paa.auction_header_id = itm.auction_header_id AND
612: paa.bid_line_number = itm.line_number AND
613: paa.orig_req_line_id = p_orig_req_line_id AND
614: itm.auction_header_id = p_auction_header_id AND
731: FETCH reqRescheduledSingleSupplier
732: INTO l_orig_req_line, l_req_qty;
733: EXIT WHEN reqRescheduledSingleSupplier%NOTFOUND;
734:
735: UPDATE PON_AWARD_ALLOCATIONS
736: SET allocated_qty = l_req_qty,
737: last_update_date = sysdate,
738: last_updated_by = l_user_id
739: WHERE orig_req_line_id = l_orig_req_line;
749: UPDATE po_requisition_lines_all prl
750: set bid_number = -1, bid_line_number = -1
751: where prl.requisition_line_id in
752: (select distinct orig_req_line_id
753: from pon_award_allocations alloc
754: where alloc.auction_header_id = p_auction_header_id);
755:
756: if(l_debug_enabled = 'Y') then
757: x_progress := ++l_progress || l_api_name || ' : Federal document : Updated po_requisition_lines_all with -1 :';
774: paa.bid_line_number,
775: paa.orig_req_header_id,
776: paa.orig_req_line_id,
777: paa.allocated_qty
778: FROM pon_award_allocations paa
779: WHERE paa.auction_header_id = p_auction_header_id AND
780: nvl(paa.split_req_line_id, -999)= -999 AND
781: nvl(paa.allocated_qty,0) > 0;
782:
820: x_progress := ++l_progress || l_api_name || ' : p_split_result is successful :';
821: log_message(x_progress);
822: end if;
823:
824: UPDATE PON_AWARD_ALLOCATIONS PAA
825: SET split_req_line_id=
826: (select new_req_line_id
827: from po_req_split_lines_gt prlst
828: where prlst.requisition_line_id = PAA.orig_req_line_id
838: nvl(paa.split_req_line_id, -999)= -999 AND
839: nvl(paa.allocated_qty,0) > 0;
840:
841: if(l_debug_enabled = 'Y') then
842: x_progress := ++l_progress || l_api_name || ' : after updating pon_award_allocations with split_req_line_id :';
843: log_message(x_progress);
844: end if;
845:
846:
1160: l_login_id := fnd_global.login_id;
1161:
1162: -- doing bulk insert
1163: FORALL l_count IN 1..l_bid_number_insertcol.COUNT
1164: INSERT INTO pon_award_allocations(bid_number, bid_line_number, orig_req_line_id, orig_req_header_id, allocated_qty, split_req_line_id, auction_header_id, created_by, last_update_date, last_updated_by, last_update_login, creation_date)
1165: VALUES(l_bid_number_insertcol(l_count),
1166: l_bid_line_number_insertcol(l_count),
1167: l_orig_req_line_insertcol(l_count),
1168: l_orig_req_header_insertcol(l_count),
1980: paip.line_origination_code = 'REQUISITION';
1981:
1982:
1983: /* queries the allocation table to get req lines and the allocated quantity backing that particular bid and bid line.*/
1984: /* Clin Slin Changes -- Info Clin lines will be there in the pon_award_allocations, but they will never cause a split on
1985: the backing req line. */
1986: /* Bug : 13584934 : For clm, we donot split req lines. So same req line can be backing multiple award lines.
1987: * Use orig_req_line_id column.
1988: */
1987: * Use orig_req_line_id column.
1988: */
1989: CURSOR reqBackingBidItem IS
1990: SELECT Decode(Nvl(l_is_fed,'N'),'Y', paa.orig_req_line_id, paa.split_req_line_id), paa.allocated_qty
1991: FROM pon_award_allocations paa, pon_auction_item_prices_all paip
1992: WHERE paa.auction_header_id = p_auction_header_id and
1993: paa.bid_number = p_bid_number AND
1994: paa.auction_header_id = paip.auction_header_id and
1995: paa.bid_line_number = paip.line_number AND
2014:
2015: */
2016: CURSOR sumOfReqAllocQuantities is
2017: SELECT PAIP.line_number, nvl(sum(nvl(PAA.allocated_qty,0)), 0)
2018: FROM PON_AWARD_ALLOCATIONS PAA, PON_AUCTION_ITEM_PRICES_ALL PAIP
2019: WHERE PAIP.auction_header_id = p_auction_header_id
2020: AND PAIP.award_status = 'COMPLETED'
2021: AND ((Nvl(clm_info_flag,'N')='Y') OR (Nvl(clm_info_flag,'N') = 'N' and nvl(PAIP.awarded_quantity,0) > 0))
2022: AND PAA.auction_header_id(+) = PAIP.auction_header_id
2029: * To find the sum of allocation quantities, use orig_req_line_id column.
2030: */
2031: CURSOR clm_sumOfReqAllocQuantities is
2032: SELECT PAIP.line_number, nvl(sum(nvl(PAA.allocated_qty,0)), 0)
2033: FROM PON_AWARD_ALLOCATIONS PAA, PON_AUCTION_ITEM_PRICES_ALL PAIP
2034: WHERE PAIP.auction_header_id = p_auction_header_id
2035: AND PAIP.award_status = 'COMPLETED'
2036: AND ((Nvl(clm_info_flag,'N')='Y') OR (Nvl(clm_info_flag,'N') = 'N' and nvl(PAIP.awarded_quantity,0) > 0))
2037: AND PAA.auction_header_id(+) = PAIP.auction_header_id
2962: x_pdoi_header.document_number, -- document_number
2963: paip.line_number, -- auction_line_number,
2964: pbip.bid_number, -- bid_number
2965: pbip.line_number, -- bid_line_number
2966: Decode('Y', (SELECT is_linked_pr_line_yn FROM pon_award_allocations paa
2967: WHERE paa.bid_number = pbip.bid_number AND paa.bid_line_number = pbip.line_number AND paa.is_linked_pr_line_yn = 'Y' AND ROWNUM <2),
2968: 'S', 'N'), -- orig_from_req_flag
2969: paip.job_id, -- job_id
2970: decode(paip.order_type_lookup_code,'FIXED PRICE', pbip.bid_currency_unit_price, TO_NUMBER(NULL)) -- amount
5710: /*Line Type and Structure Changes project*/
5711: IF(l_resultout = 'SUCCESS') THEN
5712:
5713: if(l_debug_enabled = 'Y') then
5714: x_progress := ++l_progress || l_api_name || ' : call API TO populate fund allocations to PON_AWARD_ALLOCATIONS table';
5715: log_message(x_progress);
5716: end if;
5717:
5718: BEGIN
5715: log_message(x_progress);
5716: end if;
5717:
5718: BEGIN
5719: --API call TO populate fund allocations to PON_AWARD_ALLOCATIONS table
5720: SELECT 'Y' INTO l_linked_pr_line_exists
5721: FROM pon_bid_backing_requisitions
5722: WHERE auction_header_id = p_auction_header_id
5723: AND ROWNUM <2;
6055: x_progress := ++l_progress || l_api_name || ' : l_login_id : ' || l_login_id;
6056: log_message(x_progress);
6057: end if;
6058:
6059: DELETE FROM pon_award_allocations WHERE bid_number IN (
6060: SELECT bid_number FROM pon_bid_headers
6061: WHERE auction_header_id = p_auction_header_id
6062: AND po_header_id IS NULL)
6063: AND IS_LINKED_PR_LINE_YN = 'Y';
6075: 1. Sol lines PR Ref
6076: 2. Unsol Lines Pr Ref
6077: 3. Unsol lines Linked to Sol lines - Linked PR Ref */
6078:
6079: INSERT INTO pon_award_allocations(bid_number,
6080: bid_line_number,
6081: orig_req_line_id,
6082: orig_req_header_id,
6083: auction_header_id,
6175: log_message(x_progress);
6176: end if;
6177:
6178: IF(l_count > 0) THEN
6179: UPDATE pon_award_allocations paa
6180: SET allocated_funds = (SELECT CASE
6181: WHEN (tot_amt_per_bid.allocated_funds > (pbip.award_quantity * pbip.award_price) )
6182: --equate allocated funds to bid_line_amount
6183: THEN ((paa.allocated_funds * (pbip.award_quantity * pbip.award_price ))/tot_amt_per_bid.allocated_funds )
6184: ELSE paa.allocated_funds
6185: END
6186: FROM pon_bid_item_prices pbip,
6187: (SELECT paa1.bid_number, paa1.bid_line_number, Sum(paa1.allocated_funds) AS allocated_funds
6188: FROM pon_award_allocations paa1
6189: GROUP BY (paa1.bid_number, paa1.bid_line_number)) tot_amt_per_bid
6190: WHERE paa.auction_header_id = p_auction_header_id
6191: AND pbip.bid_number = paa.bid_number
6192: AND pbip.line_number = paa.bid_line_number