The following lines contain the word 'select', 'insert', 'update' or 'delete':
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'*** In Procedure: chord_shipments ***' );
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'*** Finish: chord_shipments ***' );
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'*** In procedure: check_shipments_change ***' );
SELECT DISTINCT 'Y'
INTO x_shipments_control.shipment_num
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_header_id = x_po_header_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.shipment_num <> POLLA.shipment_num)
OR (POLL.shipment_num IS NULL AND POLLA.shipment_num IS NOT NULL)
OR (POLL.shipment_num IS NOT NULL AND POLLA.shipment_num IS NULL)
)
AND poll.po_release_id is NULL; -- Bug 4016493 : Ignore release shipments
SELECT DISTINCT 'Y'
INTO x_shipments_control.shipment_num
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_release_id = x_po_release_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.shipment_num <> POLLA.shipment_num)
OR (POLL.shipment_num IS NULL AND POLLA.shipment_num IS NOT NULL)
OR (POLL.shipment_num IS NOT NULL AND POLLA.shipment_num IS NULL)
);
SELECT DISTINCT 'Y'
INTO x_shipments_control.ship_to_organization_id
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_header_id = x_po_header_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.ship_to_organization_id <> POLLA.ship_to_organization_id)
OR (POLL.ship_to_organization_id IS NULL
AND POLLA.ship_to_organization_id IS NOT NULL)
OR (POLL.ship_to_organization_id IS NOT NULL
AND POLLA.ship_to_organization_id IS NULL)
)
AND poll.po_release_id is NULL; -- Bug 4016493 : Ignore release shipments
SELECT DISTINCT 'Y'
INTO x_shipments_control.ship_to_organization_id
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_release_id = x_po_release_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.ship_to_organization_id <> POLLA.ship_to_organization_id)
OR (POLL.ship_to_organization_id IS NULL
AND POLLA.ship_to_organization_id IS NOT NULL)
OR (POLL.ship_to_organization_id IS NOT NULL
AND POLLA.ship_to_organization_id IS NULL)
);
SELECT DISTINCT 'Y'
INTO x_shipments_control.ship_to_location_id
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_header_id = x_po_header_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.ship_to_location_id <> POLLA.ship_to_location_id)
OR (POLL.ship_to_location_id IS NULL
AND POLLA.ship_to_location_id IS NOT NULL)
OR (POLL.ship_to_location_id IS NOT NULL
AND POLLA.ship_to_location_id IS NULL)
)
AND poll.po_release_id is NULL; -- Bug 4016493 : Ignore release shipments
SELECT DISTINCT 'Y'
INTO x_shipments_control.ship_to_location_id
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_release_id = x_po_release_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.ship_to_location_id <> POLLA.ship_to_location_id)
OR (POLL.ship_to_location_id IS NULL
AND POLLA.ship_to_location_id IS NOT NULL)
OR (POLL.ship_to_location_id IS NOT NULL
AND POLLA.ship_to_location_id IS NULL)
);
SELECT DISTINCT 'Y'
INTO x_shipments_control.promised_date
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_header_id = x_po_header_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.promised_date <> POLLA.promised_date)
OR (POLL.promised_date IS NULL
AND POLLA.promised_date IS NOT NULL)
OR (POLL.promised_date IS NOT NULL
AND POLLA.promised_date IS NULL)
)
AND poll.po_release_id is NULL;
SELECT max(trunc(POLL.promised_date-POLLA.promised_date))
INTO x_shipments_control.promised_date_change
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE POLL.po_header_id = x_po_header_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND poll.po_release_id is NULL
AND (POLL.promised_date IS NOT NULL OR POLLA.promised_date IS NOT NULL);
SELECT DISTINCT 'Y'
INTO x_shipments_control.promised_date
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_release_id = x_po_release_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.promised_date <> POLLA.promised_date)
OR (POLL.promised_date IS NULL
AND POLLA.promised_date IS NOT NULL)
OR (POLL.promised_date IS NOT NULL
AND POLLA.promised_date IS NULL)
);
SELECT max(trunc(POLL.promised_date-POLLA.promised_date))
INTO x_shipments_control.promised_date_change
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE POLL.po_release_id = x_po_release_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (POLL.promised_date IS NOT NULL OR POLLA.promised_date IS NOT NULL);
SELECT DISTINCT 'Y'
INTO x_shipments_control.need_by_date
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_header_id = x_po_header_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.need_by_date <> POLLA.need_by_date)
OR (POLL.need_by_date IS NULL
AND POLLA.need_by_date IS NOT NULL)
OR (POLL.need_by_date IS NOT NULL
AND POLLA.need_by_date IS NULL)
)
AND poll.po_release_id is NULL;
SELECT max(trunc(POLL.need_by_date-POLLA.need_by_date))
INTO x_shipments_control.need_by_date_change
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE POLL.po_header_id = x_po_header_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND poll.po_release_id is NULL -- Bug 4016493 : Ignore release shipments
AND (POLL.need_by_date IS NOT NULL OR POLLA.need_by_date IS NOT NULL);
SELECT DISTINCT 'Y'
INTO x_shipments_control.need_by_date
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_release_id = x_po_release_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.need_by_date <> POLLA.need_by_date)
OR (POLL.need_by_date IS NULL
AND POLLA.need_by_date IS NOT NULL)
OR (POLL.need_by_date IS NOT NULL
AND POLLA.need_by_date IS NULL)
);
SELECT max(trunc(POLL.need_by_date-POLLA.need_by_date))
INTO x_shipments_control.need_by_date_change
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE POLL.po_release_id = x_po_release_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (POLL.need_by_date IS NOT NULL OR POLLA.need_by_date IS NOT NULL);
SELECT DISTINCT 'Y'
INTO x_shipments_control.last_accept_date
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_header_id = x_po_header_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.last_accept_date <> POLLA.last_accept_date)
OR (POLL.last_accept_date IS NULL AND POLLA.last_accept_date IS NOT NULL)
OR (POLL.last_accept_date IS NOT NULL AND POLLA.last_accept_date IS NULL)
)
AND poll.po_release_id is NULL; -- Bug 4016493 : Ignore release shipments
SELECT DISTINCT 'Y'
INTO x_shipments_control.last_accept_date
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_release_id = x_po_release_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.last_accept_date <> POLLA.last_accept_date)
OR (POLL.last_accept_date IS NULL AND POLLA.last_accept_date IS NOT NULL)
OR (POLL.last_accept_date IS NOT NULL AND POLLA.last_accept_date IS NULL)
);
SELECT DISTINCT 'Y'
INTO x_shipments_control.taxable_flag
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_header_id = x_po_header_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.taxable_flag <> POLLA.taxable_flag)
OR (POLL.taxable_flag IS NULL AND POLLA.taxable_flag IS NOT NULL)
OR (POLL.taxable_flag IS NOT NULL AND POLLA.taxable_flag IS NULL)
)
AND poll.po_release_id is NULL; -- Bug 4016493 : Ignore release shipments
SELECT DISTINCT 'Y'
INTO x_shipments_control.taxable_flag
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_release_id = x_po_release_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.taxable_flag <> POLLA.taxable_flag)
OR (POLL.taxable_flag IS NULL AND POLLA.taxable_flag IS NOT NULL)
OR (POLL.taxable_flag IS NOT NULL AND POLLA.taxable_flag IS NULL)
);
SELECT DISTINCT 'Y'
INTO x_shipments_control.cancel_flag
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_header_id = x_po_header_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.cancel_flag <> POLLA.cancel_flag)
OR (POLL.cancel_flag IS NULL AND POLLA.cancel_flag IS NOT NULL)
OR (POLL.cancel_flag IS NOT NULL AND POLLA.cancel_flag IS NULL)
)
AND poll.po_release_id is NULL; -- Bug 4016493 : Ignore release shipments
SELECT DISTINCT 'Y'
INTO x_shipments_control.cancel_flag
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_release_id = x_po_release_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.cancel_flag <> POLLA.cancel_flag)
OR (POLL.cancel_flag IS NULL AND POLLA.cancel_flag IS NOT NULL)
OR (POLL.cancel_flag IS NOT NULL AND POLLA.cancel_flag IS NULL)
);
SELECT DISTINCT 'Y'
INTO x_shipments_control.closed_code
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_header_id = x_po_header_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.closed_code <> POLLA.closed_code)
OR (POLL.closed_code IS NULL AND POLLA.closed_code IS NOT NULL)
OR (POLL.closed_code IS NOT NULL AND POLLA.closed_code IS NULL)
)
AND poll.po_release_id is NULL; -- Bug 4016493 : Ignore release shipments
SELECT DISTINCT 'Y'
INTO x_shipments_control.closed_code
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_release_id = x_po_release_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.closed_code <> POLLA.closed_code)
OR (POLL.closed_code IS NULL AND POLLA.closed_code IS NOT NULL)
OR (POLL.closed_code IS NOT NULL AND POLLA.closed_code IS NULL)
);
SELECT max(trunc(POLL.start_date-POLLA.start_date))
INTO x_shipments_control.start_date_change
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE POLL.po_header_id = x_po_header_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND poll.po_release_id is NULL; -- Bug 4016493 : Ignore release shipments
SELECT max(trunc(POLL.start_date-POLLA.start_date))
INTO x_shipments_control.start_date_change
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE POLL.po_release_id = x_po_release_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y';
SELECT max(trunc(POLL.end_date-POLLA.end_date))
INTO x_shipments_control.end_date_change
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE POLL.po_header_id = x_po_header_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND poll.po_release_id is NULL; -- Bug 4016493 : Ignore release shipments
SELECT max(trunc(POLL.end_date-POLLA.end_date))
INTO x_shipments_control.end_date_change
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE POLL.po_release_id = x_po_release_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y';
SELECT DISTINCT 'Y'
INTO x_shipments_control.payment_type
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE POLL.po_header_id = x_po_header_id
AND NVL(POLL.payment_type, 'NONE') NOT IN ('DELIVERY', 'ADVANCE')
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.payment_type <> POLLA.payment_type)
OR (POLL.payment_type IS NULL AND POLLA.payment_type IS NOT NULL)
OR (POLL.payment_type IS NOT NULL AND POLLA.payment_type IS NULL)
)
AND poll.po_release_id is NULL;
SELECT DISTINCT 'Y'
INTO x_shipments_control.description
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE POLL.po_header_id = x_po_header_id
AND NVL(POLL.payment_type, 'NONE') NOT IN ('DELIVERY', 'ADVANCE')
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.description <> POLLA.description)
OR (POLL.description IS NULL AND POLLA.description IS NOT NULL)
OR (POLL.description IS NOT NULL AND POLLA.description IS NULL)
)
AND poll.po_release_id is NULL;
SELECT DISTINCT 'Y'
INTO x_shipments_control.work_approver_id
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE POLL.po_header_id = x_po_header_id
AND NVL(POLL.payment_type, 'NONE') NOT IN ('DELIVERY', 'ADVANCE')
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.work_approver_id <> POLLA.work_approver_id)
OR (POLL.work_approver_id IS NULL AND POLLA.work_approver_id IS NOT NULL)
OR (POLL.work_approver_id IS NOT NULL AND POLLA.work_approver_id IS NULL)
)
AND poll.po_release_id is NULL;
SELECT DISTINCT 'Y'
INTO x_shipments_control.price_override
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_header_id = x_po_header_id
AND NVL(POLL.payment_type, 'NONE') <> 'DELIVERY' --
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.price_override <> POLLA.price_override)
OR (POLL.price_override IS NULL AND POLLA.price_override IS NOT NULL)
OR (POLL.price_override IS NOT NULL AND POLLA.price_override IS NULL)
)
AND poll.po_release_id is NULL; -- Bug 4016493 : Ignore release shipments
SELECT DISTINCT 'Y'
INTO x_shipments_control.price_override
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_release_id = x_po_release_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.price_override <> POLLA.price_override)
OR (POLL.price_override IS NULL AND POLLA.price_override IS NOT NULL)
OR (POLL.price_override IS NOT NULL AND POLLA.price_override IS NULL)
);
SELECT max(po_chord_wf0.percentage_change(
POLLA.quantity, POLL.quantity))
INTO x_shipments_control.quantity_change
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE POLL.po_header_id = x_po_header_id
AND NVL(POLL.payment_type, 'NONE') <> 'DELIVERY' --
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND poll.po_release_id is NULL; -- Bug 4016493 : Ignore release shipments
SELECT max(po_chord_wf0.percentage_change(
POLLA.quantity, POLL.quantity))
INTO x_shipments_control.quantity_change
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_release_id = x_po_release_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y';
SELECT max(po_chord_wf0.percentage_change(
POLLA.price_override, POLL.price_override))
INTO x_shipments_control.price_override_change
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE POLL.po_header_id = x_po_header_id
AND NVL(POLL.payment_type, 'NONE') <> 'DELIVERY' --
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND poll.po_release_id is NULL; -- Bug 4016493 : Ignore release shipments
SELECT max(po_chord_wf0.percentage_change(
POLLA.price_override, POLL.price_override))
INTO x_shipments_control.price_override_change
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_release_id = x_po_release_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y';
SELECT poh.currency_code
INTO l_currency_code
FROM po_headers_all poh
WHERE poh.po_header_id = x_po_header_id;
SELECT max(po_chord_wf0.percentage_change(
round(
decode(POLLA.value_basis, 'RATE',POLLA.amount,'FIXED PRICE', POLLA.amount,
(POLLA.quantity*POLLA.price_override)) / l_min_acct_unit )* l_min_acct_unit ,
round(
decode(POLL.value_basis, 'RATE',POLL.amount,'FIXED PRICE', POLL.amount,
(POLL.quantity*POLL.price_override)) / l_min_acct_unit )* l_min_acct_unit
))
INTO x_shipments_control.amount_change
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE POLL.po_header_id = x_po_header_id
-- : "line level" info should be ignored.
AND NVL(POLL.payment_type, 'NONE') NOT IN ('DELIVERY', 'ADVANCE')
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND poll.po_release_id is NULL; -- Bug 4016493 : Ignore release shipments
SELECT max(po_chord_wf0.percentage_change(
round(
decode(POLLA.value_basis, 'RATE',POLLA.amount,'FIXED PRICE', POLLA.amount,
(POLLA.quantity*POLLA.price_override)) ,l_precision ) ,
round(
decode(POLL.value_basis, 'RATE',POLL.amount,'FIXED PRICE', POLL.amount,
(POLL.quantity*POLL.price_override) ),l_precision )
))
INTO x_shipments_control.amount_change
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE POLL.po_header_id = x_po_header_id
AND NVL(POLL.payment_type, 'NONE') NOT IN ('DELIVERY', 'ADVANCE')
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND poll.po_release_id is NULL;
SELECT poh.currency_code
INTO l_currency_code
FROM po_releases_all por,
po_headers_all poh
WHERE por.po_release_id = x_po_release_id
AND poh.po_header_id = por.po_header_id;
SELECT max(po_chord_wf0.percentage_change(
round(
decode(POLLA.value_basis,'FIXED PRICE', POLLA.amount,
(POLLA.quantity*POLLA.price_override)) / l_min_acct_unit )* l_min_acct_unit ,
round(
decode(POLL.value_basis, 'FIXED PRICE', POLL.amount,
(POLL.quantity*POLL.price_override) ) / l_min_acct_unit )* l_min_acct_unit
))
INTO x_shipments_control.amount_change
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE POLL.po_release_id = x_po_release_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y';
SELECT max(po_chord_wf0.percentage_change(
round(
decode(POLLA.value_basis,'FIXED PRICE', POLLA.amount,
(POLLA.quantity*POLLA.price_override)) ,l_precision ) ,
round(
decode(POLL.value_basis, 'FIXED PRICE', POLL.amount,
(POLL.quantity*POLL.price_override) ),l_precision )
))
INTO x_shipments_control.amount_change
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE POLL.po_release_id = x_po_release_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y';
SELECT DISTINCT 'Y'
INTO x_shipments_control.days_late_rcpt_allowed
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_header_id = x_po_header_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.days_late_receipt_allowed <> POLLA.days_late_receipt_allowed)
OR (POLL.days_late_receipt_allowed IS NULL
AND POLLA.days_late_receipt_allowed IS NOT NULL)
OR (POLL.days_late_receipt_allowed IS NOT NULL
AND POLLA.days_late_receipt_allowed IS NULL)
)
AND poll.po_release_id is NULL;
SELECT DISTINCT 'Y'
INTO x_shipments_control.days_late_rcpt_allowed
FROM PO_LINE_LOCATIONS_ALL POLL,
PO_LINE_LOCATIONS_ARCHIVE_ALL POLLA
WHERE
POLL.po_release_id = x_po_release_id
AND POLL.line_location_id = POLLA.line_location_id (+)
AND POLLA.latest_external_flag (+) = 'Y'
AND (
(POLLA.line_location_id is NULL)
OR (POLL.days_late_receipt_allowed <> POLLA.days_late_receipt_allowed)
OR (POLL.days_late_receipt_allowed IS NULL
AND POLLA.days_late_receipt_allowed IS NOT NULL)
OR (POLL.days_late_receipt_allowed IS NOT NULL
AND POLLA.days_late_receipt_allowed IS NULL)
);
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'*** Finish: check_shipments_change ***' );
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'*** In procedure: set_wf_shipments_control ***');
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'*** In procedure: set_wf_shipments_control ***');
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'*** In procedure: set_wf_shipments_control ***');
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'*** Finish: set_wf_shipments_control ***');
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'*** In procedure: get_wf_shipments_control ***');
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'*** Finish: get_wf_shipments_control ***');
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'*** In procedure get_wf_shipments_parameters ***');
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'po_header_id = ' || to_char(x_shipments_parameters.po_header_id));
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'po_release_id = '|| to_char(x_shipments_parameters.po_release_id));
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'*** FINISH: get_wf_shipments_parameters ***');
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'***set_wf_shipments_control exception e_invalid_setup *** ');
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'*** set_wf_shipments_control exception others ***');
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'*** In procedure: debug_shipments_control ***');
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'shipment_num : '||x_shipments_control.shipment_num);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'ship_to_organization_id : '||x_shipments_control.ship_to_organization_id);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'ship_to_location_id : '||x_shipments_control.ship_to_location_id);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'promised_date : '||x_shipments_control.promised_date);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'need_by_date : '||x_shipments_control.need_by_date);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'last_accept_date : '||x_shipments_control.last_accept_date);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'taxable_flag : '||x_shipments_control.taxable_flag);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'price_discount : '||x_shipments_control.price_discount);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'cancel_flag : '||x_shipments_control.cancel_flag );
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'closed_code : '||x_shipments_control.closed_code );
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'payment_type : '||x_shipments_control.payment_type );
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'work_approver_id : '||x_shipments_control.work_approver_id );
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'description : '||x_shipments_control.description );
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'quantity_change : '||to_char(x_shipments_control.quantity_change));
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'price_override_change : '||to_char(x_shipments_control.price_override_change));
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'start_date : '||x_shipments_control.start_date );
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'end_date : '||x_shipments_control.end_date );
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'price_override : '||x_shipments_control.price_override);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'amount_change : '||x_shipments_control.amount_change );
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'start_date_change : '||x_shipments_control.start_date_change );
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'end_date_change : '||x_shipments_control.end_date_change );
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'need_by_date_change : '||x_shipments_control.need_by_date_change );
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,
'promised_date_change : '||x_shipments_control.promised_date_change );
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'*** Finished: debug_shipments_control ***');