The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT MIN(disp_line_number)
INTO x_min_disp_line_num
FROM PON_AUCTION_ITEM_PRICES_ALL
WHERE AUCTION_HEADER_ID = p_auction_header_id
AND GROUP_TYPE IN ('LOT', 'GROUP', 'LINE')
AND SUB_LINE_SEQUENCE_NUMBER > p_value;
SELECT MAX(DISP_LINE_NUMBER)
INTO x_max_disp_line_num
FROM PON_AUCTION_ITEM_PRICES_ALL
WHERE AUCTION_HEADER_ID = p_auction_header_id
AND GROUP_TYPE IN ('LOT', 'LINE', 'GROUP')
AND SUB_LINE_SEQUENCE_NUMBER < p_value;
SELECT GROUP_TYPE, LINE_NUMBER
INTO l_group_type, l_line_number
FROM PON_AUCTION_ITEM_PRICES_ALL
WHERE AUCTION_HEADER_ID = p_auction_header_id
AND DISP_LINE_NUMBER = x_max_disp_line_num;
SELECT NVL (MAX(DISP_LINE_NUMBER), x_max_disp_line_num)
INTO x_max_disp_line_num
FROM PON_AUCTION_ITEM_PRICES_ALL
WHERE AUCTION_HEADER_ID = p_auction_header_id
AND PARENT_LINE_NUMBER = l_line_number;
SELECT REQUEST_ID
INTO x_request_id
FROM PON_AUCTION_HEADERS_ALL
WHERE AUCTION_HEADER_ID = p_auction_header_id;
SELECT
LINE_NUMBER
INTO
l_line_number
FROM
PON_PRICE_ELEMENTS
WHERE
AUCTION_HEADER_ID = p_auction_header_id AND
(PRICING_BASIS = 'FIXED_AMOUNT' OR PRICING_BASIS = 'PER_UNIT') AND
ROWNUM = 1;
SELECT
PAIP.LINE_NUMBER
INTO
l_line_number
FROM
PON_AUCTION_ITEM_PRICES_ALL PAIP,
PON_PRICE_ELEMENTS PPE
WHERE
PAIP.AUCTION_HEADER_ID = p_auction_header_id AND
PPE.AUCTION_HEADER_ID = p_auction_header_id AND
PAIP.LINE_NUMBER = PPE.LINE_NUMBER AND
PAIP.PURCHASE_BASIS = 'GOODS' AND
PPE.PRICING_BASIS = 'FIXED_AMOUNT' AND
ROWNUM = 1;
SELECT
NVL (number_of_lines, 0),
NVL (max_internal_line_num, 0),
NVL (max_document_line_num, 0)
INTO
l_number_of_lines,
x_max_internal_line_num,
x_max_document_line_num
FROM
pon_auction_headers_all
WHERE
auction_header_id = p_auction_header_id;
SELECT
GREATEST (x_max_internal_line_num, NVL(MAX(items.line_number),0)),
GREATEST (x_max_document_line_num, NVL(MAX(DECODE (items.group_type, 'LOT_LINE', 0, 'GROUP_LINE', 0, items.sub_line_sequence_number)),0)),
NVL (MAX(items.disp_line_number), 0)
INTO
x_max_internal_line_num,
x_max_document_line_num,
x_max_disp_line_num
FROM
pon_auction_item_prices_all items
WHERE
items.auction_header_id = p_auction_header_id;
SELECT
COUNT(LINE_NUMBER)
INTO
x_number_of_lines
FROM
PON_AUCTION_ITEM_PRICES_ALL
WHERE
AUCTION_HEADER_ID = p_auction_header_id;
SELECT
LINE_NUMBER
INTO
l_line_number
FROM
PON_AUCTION_ITEM_PRICES_ALL
WHERE
AUCTION_HEADER_ID = p_auction_header_id AND
ROWNUM = 1;
SELECT MAX(LINE_NUMBER)
INTO l_max_line_number
FROM PON_AUCTION_ITEM_PRICES_ALL
WHERE AUCTION_HEADER_ID=p_auction_header_id;
DELETE FROM
pon_attribute_scores
WHERE
auction_header_id = p_auction_header_id AND
line_number >= l_batch_start AND
line_number <= l_batch_end;
DELETE FROM
pon_auction_attributes
WHERE
auction_header_id = p_auction_header_id AND
sequence_number < 0 AND
line_number >= l_batch_start AND
line_number <= l_batch_end;
UPDATE
pon_auction_attributes
SET
scoring_type = 'NONE',
weight = 0,
last_update_date = sysdate,
last_updated_by = FND_GLOBAL.user_id
WHERE
auction_header_id = p_auction_header_id AND
line_number >= l_batch_start AND
line_number <= l_batch_end;
SELECT
'Y'
INTO
x_has_price_elements
FROM
pon_price_elements
WHERE
auction_header_id = p_auction_header_id AND
rownum = 1;
SELECT
'Y'
INTO
x_has_supplier_price_elements
FROM
pon_price_elements
WHERE
auction_header_id = p_auction_header_id AND
pf_type = 'SUPPLIER' AND
rownum = 1;
SELECT
'Y'
INTO
x_has_buyer_price_elements
FROM
pon_price_elements
WHERE
auction_header_id = p_auction_header_id AND
pf_type = 'BUYER' AND
rownum = 1;
being deleted. This method can be called once
after a set of lines have been deleted and it will do
the sync for all.
3. p_add_pf - 'Y' implies the new price factors have to be added
else it is 'N'
4. p_del_pf - 'Y' implies the deleted price factors have to be removed
else it is 'N'
5. x_result - return status.
6. x_error_code - error code
7. x_error_message - The actual error message
COMMENT : This procedure will synchronise the price factor
values table when the price factors of a line is added/deleted/modified
====================================================================================*/
PROCEDURE SYNC_PF_VALUES_ITEM_PRICES(
p_auction_header_id IN NUMBER,
p_line_number IN NUMBER,
p_add_pf IN VARCHAR2,
p_del_pf IN VARCHAR2,
x_result OUT NOCOPY VARCHAR2,
x_error_code OUT NOCOPY VARCHAR2,
x_error_message OUT NOCOPY VARCHAR2)
is
l_module_name VARCHAR2 (30);
message => 'Inserting newly added/modified price factors...'
);
insert into PON_LARGE_NEG_PF_VALUES (auction_header_id,price_element_type_id,pricing_basis,
supplier_seq_number,value,creation_date,created_by,last_update_date,last_updated_by,last_update_login)
select distinct PPE.auction_header_id,PPE.price_element_type_id,PPE.pricing_basis,
PBP.sequence,null,sysdate,fnd_global.user_id,sysdate,fnd_global.user_id,fnd_global.login_id
from
PON_PRICE_ELEMENTS PPE, PON_BIDDING_PARTIES PBP
where
PPE.auction_header_id = p_auction_header_id and
PBP.auction_header_id = p_auction_header_id and
PPE.line_number = p_line_number and
PPE.pf_type = 'BUYER' and
not exists (
select pf_values.price_element_type_id,pf_values.pricing_basis
from
PON_LARGE_NEG_PF_VALUES pf_values
where auction_header_id = p_auction_header_id
and PPE.price_element_type_id = pf_values.price_element_type_id
and PPE.pricing_basis = pf_values.pricing_basis
and rownum = 1);
message => 'Removing the deleted/modified price factors...'
);
delete from PON_LARGE_NEG_PF_VALUES pf_values
where
auction_header_id = p_auction_header_id and
not exists (
select PPE.price_element_type_id,PPE.pricing_basis
from
PON_PRICE_ELEMENTS PPE
where auction_header_id = p_auction_header_id
and PPE.price_element_type_id = pf_values.price_element_type_id
and PPE.pricing_basis = pf_values.pricing_basis
and PPE.pf_type = 'BUYER'
and rownum = 1);
DELETE_SUPPLIER => Delete the price factor values for a supplier
who is deleted
4. x_result - return status.
5. x_error_code - error code
6. x_error_message - The actual error message
COMMENT : This procedure will synchronise the price factor
values when a supplier is added/deleted
====================================================================================*/
PROCEDURE SYNC_PF_VALUES_BIDDING_PARTIES(
p_auction_header_id IN NUMBER,
p_supplier_seq_num IN NUMBER,
p_action IN VARCHAR2,
x_result OUT NOCOPY VARCHAR2,
x_error_code OUT NOCOPY VARCHAR2,
x_error_message OUT NOCOPY VARCHAR2)
is
l_supplier_seq_num NUMBER := null;
SELECT 'Y'
INTO l_supplier_exists
FROM pon_large_neg_pf_values
WHERE auction_header_id = p_auction_header_id and supplier_seq_number = p_supplier_seq_num and rownum = 1;
select supplier_seq_number into l_supplier_seq_num from PON_LARGE_NEG_PF_VALUES
where auction_header_id = p_auction_header_id
and rownum = 1;
insert into PON_LARGE_NEG_PF_VALUES (auction_header_id,price_element_type_id,pricing_basis,
supplier_seq_number,value,creation_date,created_by,last_update_date,last_updated_by,last_update_login)
select auction_header_id,price_element_type_id,pricing_basis,
p_supplier_seq_num,null,sysdate,fnd_global.user_id,sysdate,fnd_global.user_id,fnd_global.login_id
from
PON_LARGE_NEG_PF_VALUES
where
auction_header_id = p_auction_header_id and
supplier_seq_number = l_supplier_seq_num;
insert into PON_LARGE_NEG_PF_VALUES (auction_header_id,price_element_type_id,pricing_basis,
supplier_seq_number,value,creation_date,created_by,last_update_date,last_updated_by,last_update_login)
select distinct auction_header_id,price_element_type_id,pricing_basis,
p_supplier_seq_num,null,sysdate,fnd_global.user_id,sysdate,fnd_global.user_id,fnd_global.login_id
from
PON_PRICE_ELEMENTS
where
auction_header_id = p_auction_header_id and
pf_type = 'BUYER';
elsif p_action = 'DELETE_SUPPLIER' then
IF (FND_LOG.level_statement >= FND_LOG.g_current_runtime_level) THEN
FND_LOG.string (log_level => FND_LOG.level_statement,
module => g_module_prefix || l_module_name,
message => 'deleting price factors for the deleted supplier with sequence number: '||p_supplier_seq_num
);
delete from PON_LARGE_NEG_PF_VALUES
where
auction_header_id = p_auction_header_id AND
supplier_seq_number = p_supplier_seq_num;
PROCEDURE Delete_Payment_Attachments (
p_auction_header_id IN NUMBER,
p_curr_from_line_number IN NUMBER,
p_curr_to_line_number IN NUMBER
) IS
l_module_name VARCHAR2 (30);
CURSOR delete_attachments IS
SELECT distinct (TO_NUMBER(pk2_value)) line_number
FROM FND_ATTACHED_DOCUMENTS fnd
WHERE
fnd.pk1_value = p_auction_header_id
AND fnd.pk2_value between to_char(p_curr_from_line_number) and to_char(p_curr_to_line_number)
AND fnd.entity_name = 'PON_AUC_PAYMENTS_SHIPMENTS';
l_module_name := 'Delete_Payment_Attachments';
message => 'before Call FND_ATTACHED_DOCUMENTS2_PKG.DELETE_ATTACHMENTS = ' || l_module_name);
FOR delete_attachments_rec IN delete_attachments LOOP
IF (FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level) THEN
FND_LOG.string (log_level => FND_LOG.level_procedure,
module => g_module_prefix || l_module_name,
message => 'Deleting fnd attachments for all the payments for line ' ||delete_attachments_rec.line_number||'='|| l_module_name);
FND_ATTACHED_DOCUMENTS2_PKG.DELETE_ATTACHMENTS
(x_entity_name => 'PON_AUC_PAYMENTS_SHIPMENTS',
x_pk1_value => p_auction_header_id,
x_pk2_value => delete_attachments_rec.line_number,
x_delete_document_flag => 'Y');
message => 'After Call FND_ATTACHED_DOCUMENTS2_PKG.DELETE_ATTACHMENTS = ' || l_module_name);
END Delete_Payment_Attachments;
PROCEDURE : delete_all_lines
PARAMETERS: 1. x_result - return status.
2. x_error_code - error code
3. x_error_message - The actual error message
4. p_auction_header_id - The auction header id
COMMENT : This procedure deletes all the lines in the negotiation
and also its children
======================================================================*/
PROCEDURE delete_all_lines (
x_result OUT NOCOPY VARCHAR2,
x_error_code OUT NOCOPY VARCHAR2,
x_error_message OUT NOCOPY VARCHAR2,
p_auction_header_id IN NUMBER
) IS
--Cursor to find out lines that have attachments
CURSOR lines_with_attachements IS
SELECT
DISTINCT (TO_NUMBER(pk2_value)) line_number
FROM
fnd_attached_documents
WHERE
entity_name = 'PON_AUCTION_ITEM_PRICES_ALL' AND
pk1_value = to_char(p_auction_header_id) AND
pk2_value IS NOT NULL;
SELECT
line_number, org_id
FROM
pon_auction_item_prices_all
WHERE
auction_header_id = t_auction_header_id AND
requisition_number IS NOT NULL;
l_module_name := 'delete_all_lines';
SELECT
paha.bid_ranking,
paha.line_attribute_enabled_flag,
pad.doctype_group_name,
paha.rfi_line_enabled_flag,
paha.pf_type_allowed,
paha.contract_type,
paha.global_agreement_flag,
paha.large_neg_enabled_flag,
paha.auction_origination_code,
paha.progress_payment_type,
paha.price_tiers_indicator,
paha.doctype_Id -- Federal Fields Project
INTO
l_bid_ranking,
l_line_attribute_enabled_flag,
l_doctype_group_name,
l_rfi_line_enabled_flag,
l_pf_type_allowed,
l_contract_type,
l_global_agreement_flag,
l_large_neg_enabled_flag,
l_auction_origination_code,
l_progress_payment_type,
l_price_tiers_indicator,
l_doctype_id
FROM
pon_auction_headers_all paha,
pon_auc_doctypes pad
WHERE
paha.auction_header_id = p_auction_header_id AND
paha.doctype_id = pad.doctype_id;
SELECT NVL (MAX (line_number), 0)
INTO l_max_line_number
FROM pon_auction_item_prices_all
where auction_header_id = p_auction_header_id;
message => 'Found that this auction is a federal auction. Call delete all lines APi for Federal docs');
po_negotiations_sv1.update_sol_ref_delete_all(p_auction_header_id => p_auction_header_id,
x_return_status => x_result,
x_error_msg => x_error_message,
x_error_code => x_error_code);
PON_AUCTION_PKG.delete_negotiation_line_ref(
x_negotiation_id => p_auction_header_id,
x_negotiation_line_num => backing_req_line.line_number,
x_org_id => backing_req_line.org_id,
x_error_code => x_error_code);
FND_ATTACHED_DOCUMENTS2_PKG.delete_attachments (
x_entity_name =>'PON_AUCTION_ITEM_PRICES_ALL',
x_pk1_value => p_auction_header_id,
x_pk2_value => attachment_line.line_number,
x_pk3_value => NULL,
x_pk4_value => NULL,
x_pk5_value => NULL);
message => 'Before call Delete_Payment_Attachments = ' || l_module_name);
Delete_Payment_Attachments(
p_auction_header_id => p_auction_header_id,
p_curr_from_line_number => l_batch_start,
p_curr_to_line_number => l_batch_end);
DELETE FROM
pon_auc_payments_shipments
WHERE
auction_header_id = p_auction_header_id AND
line_number >= l_batch_start AND
line_number <= l_batch_end;
DELETE FROM
pon_attribute_scores
WHERE
auction_header_id = p_auction_header_id AND
line_number >= l_batch_start AND
line_number <= l_batch_end;
DELETE FROM
pon_auction_attributes
WHERE
auction_header_id = p_auction_header_id AND
line_number >= l_batch_start AND
line_number <= l_batch_end;
DELETE FROM
pon_price_elements
WHERE
auction_header_id = p_auction_header_id AND
line_number >= l_batch_start AND
line_number <= l_batch_end;
DELETE FROM
pon_pf_supplier_values
WHERE
auction_header_id = p_auction_header_id AND
line_number >= l_batch_start AND
line_number <= l_batch_end;
message => 'Price tiers indicator is not none , so need to delete Price tiers.');
DELETE FROM
pon_auction_shipments_all
WHERE
auction_header_id = p_auction_header_id AND
line_number >= l_batch_start AND
line_number <= l_batch_end;
DELETE FROM
pon_price_differentials
WHERE
auction_header_id = p_auction_header_id AND
line_number >= l_batch_start AND
line_number <= l_batch_end;
DELETE FROM
pon_party_line_exclusions
WHERE
auction_header_id = p_auction_header_id AND
line_number >= l_batch_start AND
line_number <= l_batch_end;
DELETE FROM
pon_auction_item_prices_ext_b
WHERE
auction_header_id = p_auction_header_id AND
line_number >= l_batch_start AND
line_number <= l_batch_end;
DELETE FROM pon_auction_attr_mapping_b
WHERE auction_header_id = p_auction_header_id
AND line_number >= l_batch_start
AND line_number <= l_batch_end
AND mapping_type IN ('ITEM_LINE', 'CAT_LINE');
DELETE FROM
pon_auction_item_prices_all
WHERE
auction_header_id = p_auction_header_id AND
line_number >= l_batch_start AND
line_number <= l_batch_end;
DELETE FROM
pon_large_neg_pf_values
WHERE
auction_header_id = p_auction_header_id;
DELETE FROM
pon_auction_exhibit_details
WHERE auction_header_id = p_auction_header_id
AND IS_CDRL='N';
UPDATE
pon_bidding_parties
SET
access_type = 'FULL'
WHERE
auction_header_id = p_auction_header_id AND
access_type = 'RESTRICTED' AND
(trading_partner_id, vendor_site_id) NOT IN
(SELECT trading_partner_id, vendor_site_id
FROM pon_party_line_exclusions
WHERE auction_header_id = p_auction_header_id);
END delete_all_lines;
PROCEDURE : delete_single_line
PARAMETERS: 1. x_result - return status.
2. x_error_code - error code
3. x_error_message - The actual error message
4. p_auction_header_id - The auction header id
5. p_line_number - The line to be deleted
6. p_group_type - The group type of the line to be
deleted.
7. p_origination_code - The origination code for this line
8. p_org_id - The org id for this line
9. p_parent_line_number - The parent line number for
this line
10. p_sub_line_sequence_number - The sub line sequence
number for this line
COMMENT : This procedure will delete the given line. If it is a lot
or a group then all the lot line and group lines will
also be deleted.
======================================================================*/
PROCEDURE delete_single_line (
x_result OUT NOCOPY VARCHAR2, --1
x_error_code OUT NOCOPY VARCHAR2, --2
x_error_message OUT NOCOPY VARCHAR2, --3
p_auction_header_id IN NUMBER, --4
p_line_number IN NUMBER, --5
p_group_type IN VARCHAR2, --6
p_origination_code IN VARCHAR2, --7
p_org_id IN NUMBER, --8
p_parent_line_number IN NUMBER, --9
p_sub_line_sequence_number IN NUMBER, --10
x_number_of_lines_deleted IN OUT NOCOPY NUMBER --11
) IS
l_module_name VARCHAR2 (30);
SELECT
DISTINCT (TO_NUMBER(fad.pk2_value)) line_number
FROM
fnd_attached_documents fad,
pon_auction_item_prices_all paip
WHERE
fad.entity_name = 'PON_AUCTION_ITEM_PRICES_ALL' AND
fad.pk1_value = TO_CHAR(p_auction_header_id) AND
paip.auction_header_id = p_auction_header_id AND
fad.pk2_value = paip.line_number AND
(paip.line_number = p_line_number OR paip.parent_line_number = p_line_number);
SELECT
line_number, org_id
FROM
pon_auction_item_prices_all
WHERE
auction_header_id = p_auction_header_id AND
(line_number = p_line_number OR parent_line_number = p_line_number) AND
requisition_number IS NOT NULL;
CURSOR delete_payments_attachments IS
SELECT
DISTINCT (TO_NUMBER(fad.pk2_value)) line_number
FROM
fnd_attached_documents fad,
pon_auction_item_prices_all paip
WHERE
fad.entity_name = 'PON_AUC_PAYMENTS_SHIPMENTS' AND
fad.pk1_value = TO_CHAR(p_auction_header_id) AND
paip.auction_header_id = p_auction_header_id AND
fad.pk2_value = paip.line_number AND
(paip.line_number = p_line_number OR paip.parent_line_number = p_line_number);
l_module_name := 'delete_single_line';
SELECT
paha.bid_ranking,
paha.line_attribute_enabled_flag,
pad.doctype_group_name,
paha.rfi_line_enabled_flag,
paha.pf_type_allowed,
paha.contract_type,
paha.global_agreement_flag,
paha.large_neg_enabled_flag,
paha.auction_origination_code,
paha.amendment_number,
paha.auction_round_number,
paha.progress_payment_type,
paha.price_tiers_indicator,
paha.doctype_id
INTO
l_bid_ranking,
l_line_attribute_enabled_flag,
l_doctype_group_name,
l_rfi_line_enabled_flag,
l_pf_type_allowed,
l_contract_type,
l_global_agreement_flag,
l_large_neg_enabled_flag,
l_auction_origination_code,
l_amendment_number,
l_auction_round_number,
l_progress_payment_type,
l_price_tiers_indicator,
l_doctype_id
FROM
pon_auction_headers_all paha,
pon_auc_doctypes pad
WHERE
paha.auction_header_id = p_auction_header_id AND
paha.doctype_id = pad.doctype_id;
SELECT
max_document_line_num
INTO
l_header_max_document_line_num
FROM
pon_auction_headers_all
WHERE
auction_header_id = p_auction_header_id;
message => 'The selected row is of type LINE/LOT_LINE/GROUP_LINE');
SELECT
line_number
INTO
l_line_number
FROM
pon_auction_item_prices_all
WHERE
auction_header_id = p_auction_header_id and
line_number = p_line_number;
x_number_of_lines_deleted := 0;
DELETE FROM
pon_attribute_scores
WHERE
auction_header_id = p_auction_header_id AND
line_number = p_line_number;
message => 'Deleted the entry in pon_attribute_scores');
DELETE FROM
pon_auction_attributes
WHERE
auction_header_id = p_auction_header_id and
line_number = p_line_number;
message => 'Entry in pon_auction_attributes deleted');
DELETE FROM
pon_pf_supplier_values
WHERE
auction_header_id = p_auction_header_id AND
line_number = p_line_number;
message => 'Deleted the entry in pon_pf_supplier_values');
DELETE FROM
pon_price_elements
WHERE
auction_header_id = p_auction_header_id AND
line_number = p_line_number;
message => 'Deleted the entry in pon_price_elements');
DELETE FROM
pon_price_differentials
WHERE
auction_header_id = p_auction_header_id AND
line_number = p_line_number;
message => 'Deleted the entry in pon_price_differentials');
DELETE FROM
pon_auction_shipments_all
WHERE
auction_header_id = p_auction_header_id AND
line_number = p_line_number;
message => 'Deleted the entry in pon_auction_shipments_all');
message => 'Delete attachments for pon_auc_payments_shipments');
Delete_Payment_Attachments(
p_auction_header_id => p_auction_header_id,
p_curr_from_line_number => p_line_number,
p_curr_to_line_number => p_line_number);
message => 'Deleted the attachments for pon_auc_payments_shipments');
DELETE FROM
pon_auc_payments_shipments
WHERE
auction_header_id = p_auction_header_id AND
line_number = p_line_number;
message => 'Deleted the entry in pon_auc_payments_shipments');
DELETE FROM
pon_party_line_exclusions
WHERE
auction_header_id = p_auction_header_id AND
line_number = p_line_number;
message => 'Deleted the entry in PON_PARTY_LINE_EXCLUSIONS');
DELETE FROM
pon_auction_item_prices_ext_b
WHERE
auction_header_id = p_auction_header_id AND
line_number = p_line_number;
DELETE FROM pon_auction_attr_mapping_b
WHERE auction_header_id = p_auction_header_id
AND line_number = p_line_number
AND mapping_type IN ('ITEM_LINE', 'CAT_LINE');
SELECT exhibit_number
INTO l_exhibit_number
FROM pon_auction_item_prices_all
WHERE auction_header_id = p_auction_header_id AND
line_number = p_line_number;
DELETE FROM
pon_auction_item_prices_all
WHERE
auction_header_id = p_auction_header_id AND
line_number = p_line_number;
message => 'Deleted the entry in pon_auction_headers_all');
Deleting Exhibit Details whenever an ELIN is deleted.
The API will handle whether Exhibit Details should be deleted or not.
*/
IF(l_exhibit_number IS NOT NULL) THEN
BEGIN
PON_EXHIBITS_PKG.DELETE_EXHIBIT_DETAILS(p_auction_header_id,l_exhibit_number);
whenever a line is deleted
*/
IF(l_exhibit_number IS NULL) THEN
BEGIN
PON_EXHIBITS_PKG.UPDATE_EXHIBIT_DETAILS(p_auction_header_id,p_line_number);
FND_ATTACHED_DOCUMENTS2_PKG.delete_attachments (
x_entity_name => 'PON_AUCTION_ITEM_PRICES_ALL',
x_pk1_value => p_auction_header_id,
x_pk2_value => p_line_number);
message => 'Deleted the line attachments');
message => 'Found that this auction is a federal auction. Call delete all lines APi for Federal docs');
po_negotiations_sv1.update_sol_ref_delete_line(p_auction_header_id => p_auction_header_id,
p_auction_line_number => p_line_number,
x_return_status => x_result,
x_error_msg => x_error_message,
x_error_code => x_error_code);
PON_AUCTION_PKG.delete_negotiation_line_ref(
x_negotiation_id => p_auction_header_id,
x_negotiation_line_num => p_line_number,
x_org_id => p_org_id,
x_error_code => x_error_code);
message => 'Deleted the line backing requisitions if any');
UPDATE
pon_auction_item_prices_all
SET
modified_flag = 'Y',
modified_date = sysdate,
last_amendment_update = l_amendment_number
WHERE
auction_header_id = p_auction_header_id AND
line_number = p_parent_line_number;
UPDATE
PON_AUCTION_ITEM_PRICES_ALL
SET
MODIFIED_FLAG = 'Y',
MODIFIED_DATE = SYSDATE
WHERE
AUCTION_HEADER_ID = p_auction_header_id AND
LINE_NUMBER = p_parent_line_number;
x_number_of_lines_deleted := 1;
SELECT
count(line_number)
INTO
x_number_of_lines_deleted
FROM
pon_auction_item_prices_all
WHERE
auction_header_id = p_auction_header_id AND
(line_number = p_line_number OR parent_line_number = p_line_number);
message => 'This is an MAS auction so need to delete scores');
DELETE FROM
pon_attribute_scores pas
WHERE
pas.auction_header_id = p_auction_header_id AND
(
pas.line_number = p_line_number OR
EXISTS
(
SELECT
paip.line_number
FROM
pon_auction_item_prices_all paip
WHERE
paip.parent_line_number = p_line_number AND
paip.auction_header_id = p_auction_header_id AND
paip.line_number = pas.line_number
)
);
DELETE FROM
pon_auction_attributes paa
WHERE
paa.auction_header_id = p_auction_header_id AND
(
paa.line_number = p_line_number OR
EXISTS
(
SELECT
paip.line_number
FROM
pon_auction_item_prices_all paip
WHERE
paip.parent_line_number = p_line_number AND
paip.auction_header_id = p_auction_header_id AND
paip.line_number = paa.line_number
)
);
DELETE FROM
pon_pf_supplier_values ppsv
WHERE
ppsv.auction_header_id = p_auction_header_id AND
(
ppsv.line_number = p_line_number OR
EXISTS
(
SELECT
paip.line_number
FROM
pon_auction_item_prices_all paip
WHERE
paip.parent_line_number = p_line_number AND
paip.auction_header_id = p_auction_header_id AND
paip.line_number = ppsv.line_number
)
);
DELETE FROM
pon_price_elements ppe
WHERE
ppe.auction_header_id = p_auction_header_id AND
(
ppe.line_number = p_line_number OR
EXISTS
(
SELECT
paip.line_number
FROM
pon_auction_item_prices_all paip
WHERE
paip.parent_line_number = p_line_number AND
paip.auction_header_id = p_auction_header_id AND
paip.line_number = ppe.line_number
)
);
message => 'Delete attachments for pon_auc_payments_shipments');
FOR delete_attachments_rec IN delete_payments_attachments LOOP
IF (FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level) THEN
FND_LOG.string (log_level => FND_LOG.level_procedure,
module => g_module_prefix || l_module_name,
message => 'Deleting fnd attachments for payments for line number ' ||delete_attachments_rec.line_number||'='|| l_module_name);
FND_ATTACHED_DOCUMENTS2_PKG.DELETE_ATTACHMENTS
(x_entity_name => 'PON_AUC_PAYMENTS_SHIPMENTS',
x_pk1_value => p_auction_header_id,
x_pk2_value => delete_attachments_rec.line_number,
x_delete_document_flag => 'Y');
message => 'Deleted the attachments for pon_auc_payments_shipments');
DELETE FROM
pon_auc_payments_shipments paps
WHERE
paps.auction_header_id = p_auction_header_id AND (
paps.line_number = p_line_number OR
EXISTS
(
SELECT
paip.line_number
FROM
pon_auction_item_prices_all paip
WHERE
paip.parent_line_number = p_line_number AND
paip.auction_header_id = p_auction_header_id AND
paip.line_number = paps.line_number
)
);
message => 'Deleted the entry in pon_auc_payments_shipments');
message => 'Price tiers indicator is not none , so need to delete Price tiers.');
DELETE FROM
pon_auction_shipments_all pasa
WHERE
pasa.auction_header_id = p_auction_header_id AND
(
pasa.line_number = p_line_number OR
EXISTS
(
SELECT
paip.line_number
FROM
pon_auction_item_prices_all paip
WHERE
paip.parent_line_number = p_line_number AND
paip.auction_header_id = p_auction_header_id AND
paip.line_number = pasa.line_number
)
);
message => 'This is an RFI or Global Agreement. Need to delete price diffs.');
DELETE FROM
pon_price_differentials ppd
WHERE
ppd.auction_header_id = p_auction_header_id AND
(
ppd.line_number = p_line_number OR
EXISTS
(
SELECT
paip.line_number
FROM
pon_auction_item_prices_all paip
WHERE
paip.parent_line_number = p_line_number AND
paip.auction_header_id = p_auction_header_id AND
paip.line_number = ppd.line_number
)
);
DELETE FROM
pon_party_line_exclusions pple
WHERE
pple.auction_header_id = p_auction_header_id AND
(
pple.line_number = p_line_number OR
EXISTS
(
SELECT
paip.line_number
FROM
pon_auction_item_prices_all paip
WHERE
paip.parent_line_number = p_line_number AND
paip.auction_header_id = p_auction_header_id AND
paip.line_number = pple.line_number
)
);
FND_ATTACHED_DOCUMENTS2_PKG.delete_attachments (
x_entity_name =>'PON_AUCTION_ITEM_PRICES_ALL',
x_pk1_value => p_auction_header_id,
x_pk2_value => attachment_line.line_number,
x_pk3_value => NULL,
x_pk4_value => NULL,
x_pk5_value => NULL);
PON_AUCTION_PKG.delete_negotiation_line_ref(
x_negotiation_id => p_auction_header_id,
x_negotiation_line_num => backing_req_line.line_number,
x_org_id => backing_req_line.org_id,
x_error_code => x_error_code);
DELETE FROM pon_auction_attr_mapping_b
WHERE auction_header_id = p_auction_header_id
AND (line_number = p_line_number OR
( line_number IN ( SELECT line_number
FROM pon_auction_item_prices_all
WHERE auction_header_id = p_auction_header_id
AND parent_line_number = p_line_number) ) )
AND mapping_type IN ('ITEM_LINE', 'CAT_LINE');
DELETE FROM
pon_auction_item_prices_all
WHERE
auction_header_id = p_auction_header_id AND
(line_number = p_line_number OR parent_line_number = p_line_number);
UPDATE
pon_bidding_parties
SET
access_type = 'FULL'
WHERE
auction_header_id = p_auction_header_id AND
access_type = 'RESTRICTED' AND
(trading_partner_id, vendor_site_id) NOT IN
(SELECT distinct trading_partner_id, vendor_site_id
FROM pon_party_line_exclusions
WHERE auction_header_id = p_auction_header_id);
END delete_single_line;
message => 'Selecting the maximum sub_line_sequence_number from the header');
SELECT
NVL(MAX_DOCUMENT_LINE_NUM,0)
INTO
l_max_document_line_num
FROM
PON_AUCTION_HEADERS_ALL
WHERE
AUCTION_HEADER_ID = p_auction_header_id;
SELECT
LINE_NUMBER
BULK COLLECT INTO
l_line_number
FROM
PON_AUCTION_ITEM_PRICES_ALL
WHERE
AUCTION_HEADER_ID = p_auction_header_id AND
GROUP_TYPE IN ('LOT', 'GROUP', 'LINE') AND
SUB_LINE_SEQUENCE_NUMBER > l_max_document_line_num AND
DISP_LINE_NUMBER > p_min_disp_line_number_parent
ORDER BY
DISP_LINE_NUMBER;
SELECT
NVL (MAX (SUB_LINE_SEQUENCE_NUMBER), 0)
INTO
l_max_sub_line_sequence_number
FROM
PON_AUCTION_ITEM_PRICES_ALL
WHERE
AUCTION_HEADER_ID = p_auction_header_id AND
DISP_LINE_NUMBER < p_min_disp_line_number_parent AND
GROUP_TYPE IN ('LINE','LOT', 'GROUP');
UPDATE
PON_AUCTION_ITEM_PRICES_ALL
SET
SUB_LINE_SEQUENCE_NUMBER = l_sub_line_seq_number (x),
DOCUMENT_DISP_LINE_NUMBER = l_sub_line_seq_number (x),
LAST_UPDATE_DATE = SYSDATE,
LAST_UPDATE_LOGIN = l_login_id,
LAST_UPDATED_BY = l_user_id
WHERE
AUCTION_HEADER_ID = p_auction_header_id AND
LINE_NUMBER = l_line_number (x);
SELECT
CHILDREN.LINE_NUMBER,
NVL (PARENT.MAX_SUB_LINE_SEQUENCE_NUMBER, 0),
CHILDREN.PARENT_LINE_NUMBER,
PARENT.DOCUMENT_DISP_LINE_NUMBER
BULK COLLECT INTO
l_line_number,
l_parent_max_sub_line_seq_num,
l_parent_line_number,
l_parent_doc_disp_line_number
FROM
PON_AUCTION_ITEM_PRICES_ALL CHILDREN,
PON_AUCTION_ITEM_PRICES_ALL PARENT
WHERE
CHILDREN.AUCTION_HEADER_ID = p_auction_header_id AND
PARENT.AUCTION_HEADER_ID = p_auction_header_id AND
PARENT.LINE_NUMBER = CHILDREN.PARENT_LINE_NUMBER AND
CHILDREN.GROUP_TYPE IN ('LOT_LINE', 'GROUP_LINE') AND
CHILDREN.SUB_LINE_SEQUENCE_NUMBER > NVL(PARENT.MAX_SUB_LINE_SEQUENCE_NUMBER,0) AND
(CHILDREN.DISP_LINE_NUMBER > p_min_disp_line_number_child OR
CHILDREN.DISP_LINE_NUMBER > p_min_disp_line_number_parent)
ORDER BY
CHILDREN.DISP_LINE_NUMBER;
SELECT
NVL (MAX (SUB_LINE_SEQUENCE_NUMBER), 0)
INTO
l_current_max_sub_line_seq
FROM
PON_AUCTION_ITEM_PRICES_ALL
WHERE
AUCTION_HEADER_ID = p_auction_header_id AND
PARENT_LINE_NUMBER = p_min_child_parent_line_num AND
DISP_LINE_NUMBER < p_min_disp_line_number_child;
UPDATE PON_AUCTION_ITEM_PRICES_ALL
SET
SUB_LINE_SEQUENCE_NUMBER = l_sub_line_seq_number (x),
DOCUMENT_DISP_LINE_NUMBER = l_document_disp_line_number (x),
LAST_UPDATE_DATE = SYSDATE,
LAST_UPDATE_LOGIN = l_login_id,
LAST_UPDATED_BY = l_user_id
WHERE
AUCTION_HEADER_ID = p_auction_header_id AND
LINE_NUMBER = l_line_number (x);
SELECT
LINE_NUMBER
BULK COLLECT INTO
l_line_number
FROM
PON_AUCTION_ITEM_PRICES_ALL
WHERE
AUCTION_HEADER_ID = p_auction_header_id AND
DISP_LINE_NUMBER > l_min_disp_line_number
ORDER BY
DISP_LINE_NUMBER;
SELECT
MAX(sub_line_sequence_number)
INTO
l_temp_char
FROM
pon_auction_item_prices_all
WHERE
auction_header_id = p_auction_header_id and
group_type IN ('LOT', 'LINE', 'GROUP');
message => 'Calling bulk update to set the new disp_line_number');
UPDATE PON_AUCTION_ITEM_PRICES_ALL
SET DISP_LINE_NUMBER = l_new_disp_line_number (x)
WHERE LINE_NUMBER = l_line_number(x)
AND AUCTION_HEADER_ID = p_auction_header_id;
SELECT
MAX(sub_line_sequence_number)
INTO
x_last_line_number
FROM
pon_auction_item_prices_all
WHERE
auction_header_id = p_auction_header_id and
group_type IN ('LOT', 'LINE', 'GROUP');
SELECT MIN(disp_line_number)
INTO x_curr_min_disp_line_num
FROM PON_AUCTION_ITEM_PRICES_ALL
WHERE AUCTION_HEADER_ID = p_curr_auction_header_id
AND GROUP_TYPE IN ('LOT', 'GROUP', 'LINE')
AND SUB_LINE_SEQUENCE_NUMBER > p_value;
SELECT MIN(disp_line_number)
INTO x_prev_min_disp_line_num
FROM PON_AUCTION_ITEM_PRICES_ALL
WHERE AUCTION_HEADER_ID = p_prev_auction_header_id
AND GROUP_TYPE IN ('LOT', 'GROUP', 'LINE')
AND SUB_LINE_SEQUENCE_NUMBER > p_value;
SELECT MAX(DISP_LINE_NUMBER)
INTO x_curr_max_disp_line_num
FROM PON_AUCTION_ITEM_PRICES_ALL
WHERE AUCTION_HEADER_ID = p_curr_auction_header_id
AND GROUP_TYPE IN ('LOT', 'LINE', 'GROUP')
AND SUB_LINE_SEQUENCE_NUMBER < p_value;
SELECT MAX(DISP_LINE_NUMBER)
INTO x_prev_max_disp_line_num
FROM PON_AUCTION_ITEM_PRICES_ALL
WHERE AUCTION_HEADER_ID = p_prev_auction_header_id
AND GROUP_TYPE IN ('LOT', 'LINE', 'GROUP')
AND SUB_LINE_SEQUENCE_NUMBER < p_value;
SELECT GROUP_TYPE, LINE_NUMBER
INTO l_curr_group_type, l_curr_line_number
FROM PON_AUCTION_ITEM_PRICES_ALL
WHERE AUCTION_HEADER_ID = p_curr_auction_header_id
AND DISP_LINE_NUMBER = x_curr_max_disp_line_num;
SELECT GROUP_TYPE, LINE_NUMBER
INTO l_prev_group_type, l_prev_line_number
FROM PON_AUCTION_ITEM_PRICES_ALL
WHERE AUCTION_HEADER_ID = p_prev_auction_header_id
AND DISP_LINE_NUMBER = x_prev_max_disp_line_num;
SELECT NVL (MAX(DISP_LINE_NUMBER), x_curr_max_disp_line_num)
INTO x_curr_max_disp_line_num
FROM PON_AUCTION_ITEM_PRICES_ALL
WHERE AUCTION_HEADER_ID = p_curr_auction_header_id
AND PARENT_LINE_NUMBER = l_curr_line_number;
SELECT NVL (MAX(DISP_LINE_NUMBER), x_prev_max_disp_line_num)
INTO x_prev_max_disp_line_num
FROM PON_AUCTION_ITEM_PRICES_ALL
WHERE AUCTION_HEADER_ID = p_prev_auction_header_id
AND PARENT_LINE_NUMBER = l_prev_line_number;
PROCEDURE : DELETE_DISCUSSIONS
PARAMETERS: 1. x_result - return status.
2. x_error_code - error code
3. x_error_message - The actual error message
4. p_auction_header_id - The auction header id
COMMENT : This procedure deletes all the discussions in the negotiation
and also its children
======================================================================*/
PROCEDURE DELETE_DISCUSSIONS (
x_result OUT NOCOPY VARCHAR2,
x_error_code OUT NOCOPY VARCHAR2,
x_error_message OUT NOCOPY VARCHAR2,
p_auction_header_id IN NUMBER
) IS
l_module_name VARCHAR2 (30);
l_module_name := 'DELETE_DISCUSSIONS';
SELECT discussion_id
INTO l_discussion_id
FROM pon_discussions
WHERE pk1_value = p_auction_header_id;
DELETE FROM
PON_TE_RECIPIENTS
WHERE
ENTRY_ID IN ( SELECT ENTRY_ID
FROM PON_THREAD_ENTRIES
WHERE DISCUSSION_ID = l_discussion_id);
message => 'PON_TE_RECIPIENTS records deleted');
DELETE FROM
PON_TE_VIEW_AUDIT
WHERE
ENTRY_ID IN ( SELECT ENTRY_ID
FROM PON_THREAD_ENTRIES
WHERE DISCUSSION_ID = l_discussion_id);
message => 'PON_TE_VIEW_AUDIT records deleted');
DELETE FROM
PON_THREAD_ENTRIES
WHERE
DISCUSSION_ID = l_discussion_id;
message => 'PON_THREAD_ENTRIES records deleted');
DELETE FROM
PON_THREADS
WHERE
DISCUSSION_ID = l_discussion_id;
message => 'PON_THREADS records deleted');
DELETE FROM
PON_DISCUSSIONS
WHERE
DISCUSSION_ID = l_discussion_id;
message => 'PON_DISCUSSIONS records deleted');
END DELETE_DISCUSSIONS;
PROCEDURE : UPDATE_STAG_LINES_CLOSE_DATES
PARAMETERS: 1. p_auction_header_id - The auction header id
2. p_first_line_close_date - The staggered closing interval
3. p_staggered_closing_interval - The auction header id
4. x_last_line_close_date - The close date of the last line
5. x_result - return status.
6. x_error_code - error code
7. x_error_message - The actual error message
COMMENT : This procedure updates the close dates of the lines when
the draft negotiation is saved
======================================================================*/
PROCEDURE UPDATE_STAG_LINES_CLOSE_DATES(
x_result OUT NOCOPY VARCHAR2,
x_error_code OUT NOCOPY VARCHAR2,
x_error_message OUT NOCOPY VARCHAR2,
p_auction_header_id in Number,
p_first_line_close_date in date,
p_staggered_closing_interval in number,
p_start_disp_line_number in number,
x_last_line_close_date out nocopy date
)
is
l_line_number PON_NEG_COPY_DATATYPES_GRP.NUMBER_TYPE;
module => g_module_prefix || 'UPDATE_STAG_LINES_CLOSE_DATES',
message => 'Entered PON_NEGOTIATION_HELPER_PVT.UPDATE_LINES_CLOSE_DATES'
|| ', p_auction_header_id = ' || p_auction_header_id
|| ', p_first_line_close_date = ' || p_first_line_close_date
|| ', p_staggered_closing_interval = ' || p_staggered_closing_interval
|| ', p_start_disp_line_number = ' || p_start_disp_line_number
);
SELECT max(disp_line_number)
INTO l_max_line_number
FROM pon_auction_item_prices_all WHERE auction_header_id = p_auction_header_id;
module => g_module_prefix || 'UPDATE_STAG_LINES_CLOSE_DATES',
message => 'l_max_line_number : ' || l_max_line_number
);
module => g_module_prefix || 'UPDATE_STAG_LINES_CLOSE_DATES',
message => 'p_start_disp_line_number > l_max_line_number; so returning'
select nvl (max(close_bidding_date), p_first_line_close_date)
into x_last_line_close_date
from pon_auction_item_prices_all
where auction_header_id = p_auction_header_id;
select nvl (max(close_bidding_date), (p_first_line_close_date - l_stag_interval))
into l_curr_close_date
from pon_auction_item_prices_all
where auction_header_id = p_auction_header_id
and disp_line_number < p_start_disp_line_number;
module => g_module_prefix || 'UPDATE_STAG_LINES_CLOSE_DATES',
message => 'l_batch_size : ' || l_batch_size
||'; l_stag_interval : ' || l_stag_interval
module => g_module_prefix || 'UPDATE_STAG_LINES_CLOSE_DATES',
message => 'Finished setting the batching loop limits; l_batch_start : '||l_batch_start
module => g_module_prefix || 'UPDATE_STAG_LINES_CLOSE_DATES',
message => 'Processing the batch from l_batch_start : ' || l_batch_start
||' to l_batch_end : ' || l_batch_end || ' ; bulk collecting the records now'
select line_number, close_bidding_date, group_type
bulk collect into
l_line_number, l_close_date, l_group_type
from pon_auction_item_prices_all
WHERE auction_header_id = p_auction_header_id
AND disp_line_number >= l_batch_start
AND disp_line_number <= l_batch_end
order by disp_line_number;
module => g_module_prefix || 'UPDATE_STAG_LINES_CLOSE_DATES',
message => 'setting up the close dates array'
);
module => g_module_prefix || 'UPDATE_STAG_LINES_CLOSE_DATES',
message => 'Last close date for this batch is x_last_line_close_date : ' || to_char (x_last_line_close_date, 'dd-mon-yyyy hh24:mi:ss')
||'; now bulk updating the PON_AUCTION_ITEM_PRICES_ALL'
UPDATE PON_AUCTION_ITEM_PRICES_ALL
set close_bidding_date = l_close_date(x)
WHERE auction_header_id = p_auction_header_id
AND line_number = l_line_number(x);
module => g_module_prefix || 'UPDATE_STAG_LINES_CLOSE_DATES',
message => 'Committing the batch now'
);
module => g_module_prefix || 'UPDATE_STAG_LINES_CLOSE_DATES',
message => 'Updating the batch limits for next iteration'
);
module => g_module_prefix || 'UPDATE_STAG_LINES_CLOSE_DATES',
message => 'New limits are l_batch_start : ' || l_batch_start
|| '; l_batch_end : ' || l_batch_end
module => g_module_prefix || 'UPDATE_STAG_LINES_CLOSE_DATES',
message => 'Exitting the method with '
|| 'x_last_line_close_date : '||x_last_line_close_date
|| '; x_result : '||x_result
SELECT Count(1) into l_lines_lots_groups_count
FROM pon_auction_item_prices_all
WHERE group_type IN ('LINE', 'LOT', 'GROUP')
AND auction_header_id = p_auction_header_id;
SELECT
'Y'
INTO
x_has_price_tiers
FROM
pon_auction_shipments_all
WHERE
auction_header_id = p_auction_header_id AND
rownum = 1;
* 5. p_delete_price_tiers -- Flag to indicate if price tiers to be removed or not
* COMMENT : This methods deletes all the lines in the DB table PON_AUCTION_SHIPMENTS_ALL,
* for the given auction header id, sets the modify falg for new round and amendments
* and sets the default price break settings.
*======================================================================*/
PROCEDURE HANDLE_CHANGE_PRICE_TIERS (
x_result OUT NOCOPY VARCHAR2,
x_error_code OUT NOCOPY VARCHAR2,
x_error_message OUT NOCOPY VARCHAR2,
p_auction_header_id IN NUMBER,
p_delete_price_tiers IN VARCHAR2
) IS
l_module_name VARCHAR2 (30);
message => 'Entered the procedure ; p_auction_header_id : ' || p_auction_header_id || ' ; p_delete_price_tiers : '|| p_delete_price_tiers);
SELECT price_tiers_indicator,
amendment_number,
auction_round_number
INTO l_prev_price_tiers_indicator,
l_amendment_number,
l_round_number
FROM pon_auction_headers_all
WHERE auction_header_id = p_auction_header_id;
SELECT MAX(LINE_NUMBER)
INTO l_max_line_number
FROM PON_AUCTION_ITEM_PRICES_ALL
WHERE AUCTION_HEADER_ID=p_auction_header_id;
IF (p_delete_price_tiers = 'Y') THEN--{
--
--Check if the auction is an amendment or new round.
--If yes, fetch the max line number of the previous round.
--
IF (l_amendment_number > 0) THEN
--this is an amendment
l_is_amendment := true;
SELECT max_internal_line_num
INTO l_parent_auc_max_line_number
FROM pon_auction_headers_all
WHERE auction_header_id =
(SELECT auction_header_id_prev_amend
FROM pon_auction_headers_all
WHERE auction_header_id = p_auction_header_id);
SELECT max_internal_line_num
INTO l_parent_auc_max_line_number
FROM pon_auction_headers_all
WHERE auction_header_id =
(SELECT auction_header_id_prev_round
FROM pon_auction_headers_all
WHERE auction_header_id = p_auction_header_id);
UPDATE pon_auction_item_prices_all
SET price_break_type = 'NONE',
price_break_neg_flag = 'Y'
WHERE auction_header_id = p_auction_header_id
AND line_number >= l_batch_start
AND line_number <= l_batch_end;
IF (p_delete_price_tiers = 'Y') THEN--{
--
-- Delete the entries from the shipments table for this auction
--
IF (FND_LOG.level_statement>= FND_LOG.g_current_runtime_level) THEN
FND_LOG.string(log_level => FND_LOG.level_statement,
module => g_module_prefix || l_module_name,
message => 'Deleting the entries from the shipments table for negotiation ' || p_auction_header_id
|| ' and line_number between ' || l_batch_start ||' and ' || l_batch_end );
DELETE FROM
pon_auction_shipments_all
WHERE
auction_header_id = p_auction_header_id AND
line_number >= l_batch_start AND
line_number <= l_batch_end;
DELETE FROM
pon_price_differentials
WHERE
auction_header_id = p_auction_header_id AND
shipment_number > -1 AND
line_number >= l_batch_start AND
line_number <= l_batch_end;
UPDATE pon_auction_item_prices_all
SET has_quantity_tiers = 'N',
has_shipments_flag = 'N',
modified_flag = decode(least(line_number,l_parent_auc_max_line_number),
line_number,'Y', modified_flag),
modified_date = SYSDATE
WHERE
auction_header_id = p_auction_header_id AND
(has_quantity_tiers = 'Y' OR has_shipments_flag = 'Y') AND
line_number >= l_batch_start AND
line_number <= l_batch_end;
UPDATE pon_auction_item_prices_all
SET has_quantity_tiers = 'N',
has_shipments_flag = 'N'
WHERE
auction_header_id = p_auction_header_id AND
(has_quantity_tiers = 'Y' OR has_shipments_flag = 'Y') AND
line_number >= l_batch_start AND
line_number <= l_batch_end;
END IF; --} --p_delete_price_tiers = 'Y'
SELECT name
INTO
v_doctype_name
FROM
pon_auc_doctypes_tl
WHERE
doctype_id = p_doctype_id and
language = 'US';