18: -- Function Name
19: -- collection_required
20: -- Purpose
21: -- This function tells the caller whether a new line needs to be
22: -- added to CN_NOT_TRX_ALL to cause collection ofthe specified
23: -- source_trx_line. If the specified line is currently unknown to
24: -- cn_not_trx_all, or the latest entry for that line has collected_flag
25: -- set to 'Y', then 'Y' is returned to indicated that a new line
26: -- should indeed be registered in cn_not_trx_all.
20: -- Purpose
21: -- This function tells the caller whether a new line needs to be
22: -- added to CN_NOT_TRX_ALL to cause collection ofthe specified
23: -- source_trx_line. If the specified line is currently unknown to
24: -- cn_not_trx_all, or the latest entry for that line has collected_flag
25: -- set to 'Y', then 'Y' is returned to indicated that a new line
26: -- should indeed be registered in cn_not_trx_all.
27: --
28: -- History
22: -- added to CN_NOT_TRX_ALL to cause collection ofthe specified
23: -- source_trx_line. If the specified line is currently unknown to
24: -- cn_not_trx_all, or the latest entry for that line has collected_flag
25: -- set to 'Y', then 'Y' is returned to indicated that a new line
26: -- should indeed be registered in cn_not_trx_all.
27: --
28: -- History
29: -- 04-07-00 D.Maskell Created
30:
30:
31: FUNCTION collection_required(
32: p_org_id NUMBER,
33: p_line_id NUMBER,
34: p_source_doc_type cn_not_trx_all.source_doc_type%TYPE) RETURN VARCHAR2 IS
35: l_col_flag VARCHAR2(1) := 'Y';
36: BEGIN
37: SELECT collected_flag
38: INTO l_col_flag
35: l_col_flag VARCHAR2(1) := 'Y';
36: BEGIN
37: SELECT collected_flag
38: INTO l_col_flag
39: FROM cn_not_trx_all cnt
40: WHERE cnt.source_trx_line_id = p_line_id
41: AND NVL(cnt.org_id,-99) = NVL(p_org_id,-99)
42: AND cnt.source_doc_type = p_source_doc_type
43: AND cnt.not_trx_id = (SELECT max(cnt1.not_trx_id)
40: WHERE cnt.source_trx_line_id = p_line_id
41: AND NVL(cnt.org_id,-99) = NVL(p_org_id,-99)
42: AND cnt.source_doc_type = p_source_doc_type
43: AND cnt.not_trx_id = (SELECT max(cnt1.not_trx_id)
44: FROM cn_not_trx_all cnt1
45: WHERE cnt1.source_trx_line_id = p_line_id );
46: RETURN l_col_flag;
47:
48: EXCEPTION
253: FROM DUAL;
254: END IF;
255:
256: -- Call to Collection_Required makes sure that there is not
257: -- already a 'to-be-collected' record for the line in CN_NOT_TRX_ALL.
258: IF Collection_Required
259: (p_org_id => p_org_id,
260: p_line_id => p_line_id,
261: p_source_doc_type => p_source_doc_type) = 'Y' THEN
284: INTO l_batch_id,
285: l_not_trx_id
286: FROM DUAL;
287: --+
288: -- Insert a new row for this source_trx_line into cn_not_trx_all,
289: -- with collected_flag = 'N'
290: --+
291: INSERT INTO cn_not_trx_all (
292: org_id,
287: --+
288: -- Insert a new row for this source_trx_line into cn_not_trx_all,
289: -- with collected_flag = 'N'
290: --+
291: INSERT INTO cn_not_trx_all (
292: org_id,
293: not_trx_id,
294: batch_id,
295: notified_date,