2309: AND SITE.CUST_ACCT_SITE_ID = ACCT_SITE.CUST_ACCT_SITE_ID
2310: AND SITE.STATUS = 'A'
2311: AND ACCT_SITE.STATUS ='A' AND --bug 2752321
2312: ACCT_SITE.CUST_ACCOUNT_ID in (
2313: SELECT p_sold_to_org_id FROM DUAL
2314: UNION
2315: SELECT CUST_ACCOUNT_ID FROM
2316: HZ_CUST_ACCT_RELATE_ALL h WHERE
2317: RELATED_CUST_ACCOUNT_ID = p_sold_to_org_id
2391: AND SITE.CUST_ACCT_SITE_ID = ACCT_SITE.CUST_ACCT_SITE_ID
2392: AND SITE.STATUS = 'A'
2393: AND ACCT_SITE.STATUS ='A' AND --bug 2752321
2394: ACCT_SITE.CUST_ACCOUNT_ID in (
2395: SELECT p_sold_to_org_id FROM DUAL
2396: UNION
2397: SELECT CUST_ACCOUNT_ID FROM
2398: HZ_CUST_ACCT_RELATE_ALL h WHERE
2399: RELATED_CUST_ACCOUNT_ID = p_sold_to_org_id
2487: and ratrx.cust_trx_type_id = ractt.cust_trx_type_id
2488: and ractt.org_id = p_line_rec.org_id)
2489: and ratrx.bill_to_customer_id
2490: in (select to_number(p_line_rec.sold_to_org_id )
2491: from sys.dual
2492: union
2493: select cust_account_id customer_id
2494: from hz_cust_acct_relate
2495: where related_cust_account_id = p_line_rec.sold_to_org_id
2510: into l_exists
2511: from ra_customer_trx ratrx
2512: where ratrx.bill_to_customer_id in
2513: (select p_line_rec.sold_to_org_id
2514: from sys.dual
2515: union
2516: select cust_account_id customer_id
2517: from hz_cust_acct_relate_all h
2518: where related_cust_account_id = p_line_rec.sold_to_org_id
4288: --end bug 3323610
4289: END IF; --bug3412008
4290:
4291: -- OPM 02/JUN/00 START
4292: -- For a dual control process item, check qty1/2 both present and sync'd
4293: -- =====================================================================
4294: IF l_debug_level > 0 THEN
4295: oe_debug_pub.add('Entity DUAL X-VAL start', 1);
4296: END IF;
4291: -- OPM 02/JUN/00 START
4292: -- For a dual control process item, check qty1/2 both present and sync'd
4293: -- =====================================================================
4294: IF l_debug_level > 0 THEN
4295: oe_debug_pub.add('Entity DUAL X-VAL start', 1);
4296: END IF;
4297: IF OE_Line_Util.dual_uom_control
4298: (p_line_rec.inventory_item_id
4299: ,p_line_rec.ship_from_org_id
4293: -- =====================================================================
4294: IF l_debug_level > 0 THEN
4295: oe_debug_pub.add('Entity DUAL X-VAL start', 1);
4296: END IF;
4297: IF OE_Line_Util.dual_uom_control
4298: (p_line_rec.inventory_item_id
4299: ,p_line_rec.ship_from_org_id
4300: ,l_item_rec)
4301: THEN
4298: (p_line_rec.inventory_item_id
4299: ,p_line_rec.ship_from_org_id
4300: ,l_item_rec)
4301: THEN
4302: --IF l_item_rec.dualum_ind in (1,2,3) THEN INVCONV
4303: IF l_debug_level > 0 THEN
4304: oe_debug_pub.add('DUAL X-VAL dualum is true', 2);
4305: END IF;
4306:
4300: ,l_item_rec)
4301: THEN
4302: --IF l_item_rec.dualum_ind in (1,2,3) THEN INVCONV
4303: IF l_debug_level > 0 THEN
4304: oe_debug_pub.add('DUAL X-VAL dualum is true', 2);
4305: END IF;
4306:
4307: IF (p_line_rec.ordered_quantity <> FND_API.G_MISS_NUM OR
4308: p_line_rec.ordered_quantity IS NOT NULL) AND
4308: p_line_rec.ordered_quantity IS NOT NULL) AND
4309: (p_line_rec.ordered_quantity2 = FND_API.G_MISS_NUM OR
4310: p_line_rec.ordered_quantity2 IS NULL) THEN
4311: IF l_debug_level > 0 THEN
4312: oe_debug_pub.add('dual X-VAL qty 1 not empty', 2);
4313: END IF;
4314: l_return_status := FND_API.G_RET_STS_ERROR;
4315: fnd_message.set_name('ONT','OE_ATTRIBUTE_REQUIRED');
4316: FND_MESSAGE.SET_TOKEN('ATTRIBUTE','Ordered_Quantity2');
4330:
4331: /* If qty1/qty2 both populated, check tolerances
4332: ================================================*/
4333: IF l_debug_level > 0 THEN
4334: oe_debug_pub.add('dual - start tolerance check', 2);
4335: END IF;
4336:
4337: IF l_item_rec.secondary_default_ind in ('D','N') THEN -- INVCONV
4338: --IF l_item_rec.dualum_ind in (2,3) THEN
4334: oe_debug_pub.add('dual - start tolerance check', 2);
4335: END IF;
4336:
4337: IF l_item_rec.secondary_default_ind in ('D','N') THEN -- INVCONV
4338: --IF l_item_rec.dualum_ind in (2,3) THEN
4339: IF (p_line_rec.ordered_quantity <> FND_API.G_MISS_NUM AND
4340: p_line_rec.ordered_quantity IS NOT NULL) AND
4341: (p_line_rec.ordered_quantity2 <> FND_API.G_MISS_NUM AND
4342: p_line_rec.ordered_quantity2 IS NOT NULL)
4345:
4346: THEN
4347:
4348: IF l_debug_level > 0 THEN
4349: oe_debug_pub.add('Entity - DUAL X-Val. ordered_quantity = ' || p_line_rec.ordered_quantity ,1);
4350: oe_debug_pub.add('Entity - DUAL X-Val. ordered_quantity2 = ' || p_line_rec.ordered_quantity2 ,1);
4351: END IF;
4352: -- OPM BEGIN 06/22
4353: /* Get the OPM equivalent code for order_quantity_uom
4346: THEN
4347:
4348: IF l_debug_level > 0 THEN
4349: oe_debug_pub.add('Entity - DUAL X-Val. ordered_quantity = ' || p_line_rec.ordered_quantity ,1);
4350: oe_debug_pub.add('Entity - DUAL X-Val. ordered_quantity2 = ' || p_line_rec.ordered_quantity2 ,1);
4351: END IF;
4352: -- OPM BEGIN 06/22
4353: /* Get the OPM equivalent code for order_quantity_uom
4354: ===================================================== -- INVCONV
4378:
4379: IF l_return = 0 -- (false)
4380: then
4381: IF l_debug_level > 0 THEN
4382: oe_debug_pub.add('Entity - dual UM with tolerance error 1. return = '|| l_return ,1);
4383: END IF;
4384:
4385: l_msg_data := FND_MSG_PUB.GET(p_msg_index => FND_MSG_PUB.G_LAST, -- INVCONV
4386: p_encoded => 'F');
4392:
4393: else
4394:
4395: IF l_debug_level > 0 THEN
4396: oe_debug_pub.add('Entity - dual UM with no tolerance error ',1);
4397: END IF; -- INVCONV
4398:
4399: --Begin Bug 2639667
4400: -- Code added till End Bug 2639667 comment.
4441:
4442: IF l_return = 0 -- (false) -- INVCONV
4443: then
4444: IF l_debug_level > 0 THEN
4445: oe_debug_pub.add('Entity - dual UM with tolerance error 2. return = '|| l_return ,1);
4446: END IF;
4447:
4448: l_msg_data := FND_MSG_PUB.GET(p_msg_index => FND_MSG_PUB.G_LAST, -- INVCONV
4449: p_encoded => 'F');
5511: AND SITE.CUST_ACCT_SITE_ID = ACCT_SITE.CUST_ACCT_SITE_ID
5512: AND SITE.STATUS = 'A'
5513: AND ACCT_SITE.STATUS ='A' AND --bug 2752321
5514: ACCT_SITE.CUST_ACCOUNT_ID in (
5515: SELECT p_line_rec.sold_to_org_id FROM DUAL
5516: UNION
5517: SELECT CUST_ACCOUNT_ID FROM
5518: HZ_CUST_ACCT_RELATE_ALL h WHERE
5519: RELATED_CUST_ACCOUNT_ID = p_line_rec.sold_to_org_id
6100:
6101: BEGIN
6102: SELECT 'VALID'
6103: INTO l_dummy
6104: FROM dual
6105: WHERE exists(
6106: select 'x' from
6107: hz_cust_acct_relate where
6108: related_cust_account_id = p_line_rec.sold_to_org_id
6293: FROM oe_agreements oa
6294: WHERE price_list_id = p_line_rec.price_list_id
6295: AND sold_to_org_id IN
6296: (select -1
6297: from dual
6298: union
6299: select p_line_rec.sold_to_org_id
6300: from dual
6301: union
6296: (select -1
6297: from dual
6298: union
6299: select p_line_rec.sold_to_org_id
6300: from dual
6301: union
6302: select r.cust_account_id
6303: from hz_cust_acct_relate r
6304: where r.related_cust_account_id = p_line_rec.sold_to_org_id);