13:
14:
15: PROCEDURE create_vendor_agreement (
16: p_api_version IN NUMBER,
17: p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
18: p_hdr_rec IN program_header_rec,
19: p_parent_agreement_number IN VARCHAR2 DEFAULT NULL,
20: p_party_role_contact_tbl IN party_role_contact_tbl,
21: p_vendor_billing_rec IN VENDOR_BILLING_REC,
114: l_inv_fmt_id NUMBER;
115:
116: BEGIN
117: x_return_status := FND_API.G_RET_STS_SUCCESS;
118: x_return_status := OKL_API.START_ACTIVITY(p_api_name => l_api_name
119: ,p_init_msg_list => p_init_msg_list
120: ,p_api_type => '_PUB'
121: ,x_return_status => x_return_status);
122: IF x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR THEN
118: x_return_status := OKL_API.START_ACTIVITY(p_api_name => l_api_name
119: ,p_init_msg_list => p_init_msg_list
120: ,p_api_type => '_PUB'
121: ,x_return_status => x_return_status);
122: IF x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR THEN
123: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
124: ELSIF x_return_status = OKL_API.G_RET_STS_ERROR THEN
125: RAISE OKL_API.G_EXCEPTION_ERROR;
126: END IF;
119: ,p_init_msg_list => p_init_msg_list
120: ,p_api_type => '_PUB'
121: ,x_return_status => x_return_status);
122: IF x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR THEN
123: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
124: ELSIF x_return_status = OKL_API.G_RET_STS_ERROR THEN
125: RAISE OKL_API.G_EXCEPTION_ERROR;
126: END IF;
127:
120: ,p_api_type => '_PUB'
121: ,x_return_status => x_return_status);
122: IF x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR THEN
123: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
124: ELSIF x_return_status = OKL_API.G_RET_STS_ERROR THEN
125: RAISE OKL_API.G_EXCEPTION_ERROR;
126: END IF;
127:
128: /* Agreement Header */
121: ,x_return_status => x_return_status);
122: IF x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR THEN
123: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
124: ELSIF x_return_status = OKL_API.G_RET_STS_ERROR THEN
125: RAISE OKL_API.G_EXCEPTION_ERROR;
126: END IF;
127:
128: /* Agreement Header */
129: OKL_VENDOR_PROGRAM_PUB.create_program (p_api_version => p_api_version,
199: FOR i IN p_party_role_contact_tbl.FIRST..p_party_role_contact_tbl.LAST
200: LOOP
201: -- rabhupat BUG#4574673/#4593854 start
202: -- populate the contact table only when the contact information is provided
203: IF(p_party_role_contact_tbl(i).contact_role_code IS NOT NULL AND p_party_role_contact_tbl(i).contact_role_code <> OKL_API.G_MISS_CHAR AND
204: p_party_role_contact_tbl(i).contact_role_id IS NOT NULL AND p_party_role_contact_tbl(i).contact_role_id <> OKL_API.G_MISS_NUM) THEN
205: -- rabhupat BUG#4574673/#4593854 end
206: -- Get Party Role ID
207: OPEN get_party_role_id (p_party_role_contact_tbl(i).party_role_code,
200: LOOP
201: -- rabhupat BUG#4574673/#4593854 start
202: -- populate the contact table only when the contact information is provided
203: IF(p_party_role_contact_tbl(i).contact_role_code IS NOT NULL AND p_party_role_contact_tbl(i).contact_role_code <> OKL_API.G_MISS_CHAR AND
204: p_party_role_contact_tbl(i).contact_role_id IS NOT NULL AND p_party_role_contact_tbl(i).contact_role_id <> OKL_API.G_MISS_NUM) THEN
205: -- rabhupat BUG#4574673/#4593854 end
206: -- Get Party Role ID
207: OPEN get_party_role_id (p_party_role_contact_tbl(i).party_role_code,
208: p_party_role_contact_tbl(i).party_role_id,
288: END IF;
289:
290: /* Vendor Billing */
291: -- rabhupat bug#4520143/#4530455 added G_MISS check
292: IF (p_vendor_billing_rec.customer_id IS NOT NULL AND p_vendor_billing_rec.customer_id <> OKL_API.G_MISS_NUM AND
293: p_vendor_billing_rec.cust_acct_id IS NOT NULL AND p_vendor_billing_rec.cust_acct_id <> OKL_API.G_MISS_NUM AND
294: p_vendor_billing_rec.bill_to_site_use_id IS NOT NULL AND p_vendor_billing_rec.bill_to_site_use_id <> OKL_API.G_MISS_NUM) THEN
295:
296: l_cplv_rec.cust_acct_id := p_vendor_billing_rec.cust_acct_id;
289:
290: /* Vendor Billing */
291: -- rabhupat bug#4520143/#4530455 added G_MISS check
292: IF (p_vendor_billing_rec.customer_id IS NOT NULL AND p_vendor_billing_rec.customer_id <> OKL_API.G_MISS_NUM AND
293: p_vendor_billing_rec.cust_acct_id IS NOT NULL AND p_vendor_billing_rec.cust_acct_id <> OKL_API.G_MISS_NUM AND
294: p_vendor_billing_rec.bill_to_site_use_id IS NOT NULL AND p_vendor_billing_rec.bill_to_site_use_id <> OKL_API.G_MISS_NUM) THEN
295:
296: l_cplv_rec.cust_acct_id := p_vendor_billing_rec.cust_acct_id;
297: l_cplv_rec.bill_to_site_use_id := p_vendor_billing_rec.bill_to_site_use_id;
290: /* Vendor Billing */
291: -- rabhupat bug#4520143/#4530455 added G_MISS check
292: IF (p_vendor_billing_rec.customer_id IS NOT NULL AND p_vendor_billing_rec.customer_id <> OKL_API.G_MISS_NUM AND
293: p_vendor_billing_rec.cust_acct_id IS NOT NULL AND p_vendor_billing_rec.cust_acct_id <> OKL_API.G_MISS_NUM AND
294: p_vendor_billing_rec.bill_to_site_use_id IS NOT NULL AND p_vendor_billing_rec.bill_to_site_use_id <> OKL_API.G_MISS_NUM) THEN
295:
296: l_cplv_rec.cust_acct_id := p_vendor_billing_rec.cust_acct_id;
297: l_cplv_rec.bill_to_site_use_id := p_vendor_billing_rec.bill_to_site_use_id;
298: -- Get Party Role Record ID
338: l_rgr_tbl(j).rgd_code := 'LAVENB';
339: l_rgr_tbl(j).RULE_INFORMATION_CATEGORY := 'LAPMTH';
340: -- rabhupat BUG#4574673 start
341: -- populate the information if payment method is passed
342: IF(p_vendor_billing_rec.PAYMENT_METHOD IS NOT NULL AND p_vendor_billing_rec.PAYMENT_METHOD <> OKL_API.G_MISS_NUM) THEN
343: l_rgr_tbl(j).object1_id1:= p_vendor_billing_rec.PAYMENT_METHOD;
344: l_rgr_tbl(j).object1_id2:= '#';
345: l_rgr_tbl(j).jtot_object1_code:= 'OKX_RCPTMTH';
346: END IF;
352: l_rgr_tbl(j).rgd_code := 'LAVENB';
353: l_rgr_tbl(j).RULE_INFORMATION_CATEGORY := 'LABACC';
354: -- rabhupat BUG#4574673 start
355: -- populate the information if bank account is passed
356: IF(p_vendor_billing_rec.bank_account IS NOT NULL AND p_vendor_billing_rec.bank_account <> OKL_API.G_MISS_NUM) THEN
357: l_rgr_tbl(j).object1_id1:= p_vendor_billing_rec.bank_account;
358: l_rgr_tbl(j).object1_id2:= '#';
359: l_rgr_tbl(j).jtot_object1_code:= 'OKX_CUSTBKAC';
360: END IF;
382: l_rgr_tbl(j).template_yn := 'N';
383: -- Process Review Invoice flag
384: -- rabhupat BUG#4574673 start
385: -- if review invoice falg is not checked passing 'N'
386: IF(p_vendor_billing_rec.review_invoice IS NOT NULL AND p_vendor_billing_rec.review_invoice <> OKL_API.G_MISS_CHAR) THEN
387: l_rgr_tbl(j).rule_information4 := p_vendor_billing_rec.review_invoice;
388: ELSE
389: l_rgr_tbl(j).rule_information4 := 'N';
390: END IF;
401: l_rgr_tbl(j).template_yn := 'N';
402: -- Process Review Invoice Date
403: -- rabhupat BUG#4574673 start
404: -- populate the information if review until date is passed
405: IF(p_vendor_billing_rec.review_until_date IS NOT NULL AND p_vendor_billing_rec.review_until_date <> OKL_API.G_MISS_DATE) THEN
406: l_rgr_tbl(j).rule_information2 := p_vendor_billing_rec.review_until_date;
407: END IF;
408: -- Process Rule Groups and Rules for vendor billing
409: -- and associate it with the vendor party role
449: RAISE OKC_API.G_EXCEPTION_ERROR;
450: END IF;
451: END IF;
452:
453: OKL_API.END_ACTIVITY(x_msg_count => x_msg_count
454: ,x_msg_data => x_msg_data );
455:
456: EXCEPTION
457: WHEN OKC_API.G_EXCEPTION_ERROR THEN