22037: l_org_id NUMBER; -- CLM Controls Project changes
22038: BEGIN
22039:
22040: IF itemtype is not NULL and itemkey is not NULL THEN
22041: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head);
22042: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_draft_id'|| p_draft_id);
22043: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_header_id'|| p_header_id);
22044: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_contracting_officer'|| p_contracting_officer);
22045: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_online_report_id'|| p_online_report_id);
22038: BEGIN
22039:
22040: IF itemtype is not NULL and itemkey is not NULL THEN
22041: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head);
22042: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_draft_id'|| p_draft_id);
22043: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_header_id'|| p_header_id);
22044: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_contracting_officer'|| p_contracting_officer);
22045: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_online_report_id'|| p_online_report_id);
22046: PO_WF_DEBUG_PKG.insert_debug( itemtype, itemkey,l_log_head||'p_sequence'|| p_sequence);
22039:
22040: IF itemtype is not NULL and itemkey is not NULL THEN
22041: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head);
22042: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_draft_id'|| p_draft_id);
22043: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_header_id'|| p_header_id);
22044: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_contracting_officer'|| p_contracting_officer);
22045: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_online_report_id'|| p_online_report_id);
22046: PO_WF_DEBUG_PKG.insert_debug( itemtype, itemkey,l_log_head||'p_sequence'|| p_sequence);
22047:
22040: IF itemtype is not NULL and itemkey is not NULL THEN
22041: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head);
22042: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_draft_id'|| p_draft_id);
22043: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_header_id'|| p_header_id);
22044: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_contracting_officer'|| p_contracting_officer);
22045: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_online_report_id'|| p_online_report_id);
22046: PO_WF_DEBUG_PKG.insert_debug( itemtype, itemkey,l_log_head||'p_sequence'|| p_sequence);
22047:
22048: ELSE
22041: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head);
22042: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_draft_id'|| p_draft_id);
22043: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_header_id'|| p_header_id);
22044: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_contracting_officer'|| p_contracting_officer);
22045: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_online_report_id'|| p_online_report_id);
22046: PO_WF_DEBUG_PKG.insert_debug( itemtype, itemkey,l_log_head||'p_sequence'|| p_sequence);
22047:
22048: ELSE
22049: IF g_debug_stmt THEN
22042: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_draft_id'|| p_draft_id);
22043: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_header_id'|| p_header_id);
22044: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_contracting_officer'|| p_contracting_officer);
22045: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||'p_online_report_id'|| p_online_report_id);
22046: PO_WF_DEBUG_PKG.insert_debug( itemtype, itemkey,l_log_head||'p_sequence'|| p_sequence);
22047:
22048: ELSE
22049: IF g_debug_stmt THEN
22050: PO_DEBUG.debug_begin(l_log_head);
22112: FROM dual;
22113:
22114: po_debug.debug_stmt(l_log_head , l_progress, 'Contracting Officer is Invalid');
22115: IF itemtype is not NULL and itemkey is not NULL THEN
22116: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'Contracting Officer is not valid');
22117: END IF;
22118: x_return_status := FND_API.G_RET_STS_ERROR;
22119: END IF; -- l_valid_co = 'N'
22120: END IF; --p_contracting_officer IS NOT NULL
22138: IF l_ko_sign_required <> 'Y' THEN
22139: -- if Contract officer signature is not required, then there is no warrant check.
22140: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'Contracting Officer signature is not required');
22141: IF itemtype is not NULL and itemkey is not NULL THEN
22142: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'Contracting Officer signature is not required');
22143: END IF;
22144: return;
22145: END IF;
22146:
22173: , 'PO_CO_IS_NULL'
22174: , 'E');
22175: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'Contracting Officer is NULL');
22176: IF itemtype is not NULL and itemkey is not NULL THEN
22177: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'Contracting officer is NULL');
22178: END IF;
22179: x_return_status := FND_API.G_RET_STS_ERROR;
22180: RETURN;
22181:
22201: END;
22202:
22203: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'Warrant enabled for the style');
22204: IF itemtype is not NULL and itemkey is not NULL THEN
22205: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'Warrant enabled for the style');
22206: END IF;
22207: IF l_warrant_enabled_flag = 'Y' THEN
22208: l_progress := '040';
22209:
22269: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'l_rate '||l_rate);
22270: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'l_warrant_currency '||l_warrant_currency);
22271: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'l_warrant_amount '||l_warrant_amount);
22272: IF itemtype is not NULL and itemkey is not NULL THEN
22273: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'Warrant found');
22274: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_doc_currency '||l_doc_currency);
22275: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'l_type_lookup_code '||l_type_lookup_code);
22276: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'l_rate '||l_rate);
22277: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_warrant_currency '||l_warrant_currency);
22270: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'l_warrant_currency '||l_warrant_currency);
22271: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'l_warrant_amount '||l_warrant_amount);
22272: IF itemtype is not NULL and itemkey is not NULL THEN
22273: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'Warrant found');
22274: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_doc_currency '||l_doc_currency);
22275: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'l_type_lookup_code '||l_type_lookup_code);
22276: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'l_rate '||l_rate);
22277: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_warrant_currency '||l_warrant_currency);
22278: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_doc_amount '||l_doc_amount);
22273: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'Warrant found');
22274: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_doc_currency '||l_doc_currency);
22275: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'l_type_lookup_code '||l_type_lookup_code);
22276: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'l_rate '||l_rate);
22277: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_warrant_currency '||l_warrant_currency);
22278: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_doc_amount '||l_doc_amount);
22279: END IF;
22280:
22281: -- Getting the ledger currency
22274: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_doc_currency '||l_doc_currency);
22275: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'l_type_lookup_code '||l_type_lookup_code);
22276: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'l_rate '||l_rate);
22277: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_warrant_currency '||l_warrant_currency);
22278: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_doc_amount '||l_doc_amount);
22279: END IF;
22280:
22281: -- Getting the ledger currency
22282: po_core_s2.get_po_currency(p_header_id, l_currency_code, l_doc_currency);
22326: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'l_doc_amount '||l_doc_amount);
22327: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'l_warrant_currency '||l_warrant_currency);
22328: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'l_warrant_amount '||l_warrant_amount);
22329: IF itemtype is not NULL and itemkey is not NULL THEN
22330: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_doc_currency '||l_doc_currency);
22331: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_doc_amount '||l_doc_amount);
22332: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_warrant_currency '||l_warrant_currency);
22333: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_doc_amount '||l_doc_amount);
22334: END IF;
22327: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'l_warrant_currency '||l_warrant_currency);
22328: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'l_warrant_amount '||l_warrant_amount);
22329: IF itemtype is not NULL and itemkey is not NULL THEN
22330: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_doc_currency '||l_doc_currency);
22331: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_doc_amount '||l_doc_amount);
22332: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_warrant_currency '||l_warrant_currency);
22333: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_doc_amount '||l_doc_amount);
22334: END IF;
22335:
22328: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'l_warrant_amount '||l_warrant_amount);
22329: IF itemtype is not NULL and itemkey is not NULL THEN
22330: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_doc_currency '||l_doc_currency);
22331: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_doc_amount '||l_doc_amount);
22332: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_warrant_currency '||l_warrant_currency);
22333: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_doc_amount '||l_doc_amount);
22334: END IF;
22335:
22336: IF l_doc_currency <> l_warrant_currency AND l_currency_code <> l_warrant_currency THEN
22329: IF itemtype is not NULL and itemkey is not NULL THEN
22330: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_doc_currency '||l_doc_currency);
22331: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_doc_amount '||l_doc_amount);
22332: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_warrant_currency '||l_warrant_currency);
22333: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'l_doc_amount '||l_doc_amount);
22334: END IF;
22335:
22336: IF l_doc_currency <> l_warrant_currency AND l_currency_code <> l_warrant_currency THEN
22337: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'Warrant not found for the doc currency');
22335:
22336: IF l_doc_currency <> l_warrant_currency AND l_currency_code <> l_warrant_currency THEN
22337: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'Warrant not found for the doc currency');
22338: IF itemtype is not NULL and itemkey is not NULL THEN
22339: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'Warrant not found for the doc currency');
22340: END IF;
22341: p_sequence := p_sequence + 1;
22342: INSERT INTO PO_ONLINE_REPORT_TEXT_GT
22343: ( online_report_id
22389: , 'PO_WARRANT_NOT_ENOUGH'
22390: , 'E');
22391:
22392: IF itemtype is not NULL and itemkey is not NULL THEN
22393: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'Warrant amount less then document amount');
22394: END IF;
22395: x_return_status := FND_API.G_RET_STS_ERROR;
22396: END IF;
22397: ELSE
22396: END IF;
22397: ELSE
22398: PO_DEBUG.debug_stmt(l_log_head , l_progress, 'Warrant not found');
22399: IF itemtype is not NULL and itemkey is not NULL THEN
22400: PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_log_head || 'Warrant not found');
22401: END IF;
22402: p_sequence := p_sequence + 1;
22403: INSERT INTO PO_ONLINE_REPORT_TEXT_GT
22404: ( online_report_id