376: lStmtNum := 10;
377:
378: select CAL.CALENDAR_DATE
379: into lEstRelDate
380: from bom_calendar_dates cal,
381: mtl_system_items msi,
382: bom_cto_order_lines bcol,
383: mtl_parameters mp
384: where msi.organization_id = pOrgId
391: and cal.seq_num =
392: (select cal2.prior_seq_num
393: - (ceil(nvl(msi.fixed_lead_time,0)
394: + nvl(msi.variable_lead_time,0) * bcol.ordered_quantity))
395: from bom_calendar_dates cal2
396: where cal2.calendar_code = mp.calendar_code
397: and cal2.exception_set_id = mp.calendar_exception_set_id
398: and cal2.calendar_date = trunc(bcol.schedule_ship_date));
399:
497: lStmtNum := 13;
498:
499: select CAL.CALENDAR_DATE
500: into lEstRelDate
501: from bom_calendar_dates cal,
502: mtl_system_items msi,
503: bom_cto_order_lines bcol,
504: mtl_parameters mp
505: where msi.organization_id = pOrgId
511: and cal.calendar_code = mp.calendar_code
512: and cal.exception_set_id = mp.calendar_exception_set_id
513: and cal.seq_num =
514: (select cal2.prior_seq_num - lTotLeadTime
515: from bom_calendar_dates cal2
516: where cal2.calendar_code = mp.calendar_code
517: and cal2.exception_set_id = mp.calendar_exception_set_id
518: and cal2.calendar_date = trunc(bcol.schedule_ship_date));
519: