[Home] [Help]
1158:
1159: select
1160: cc.counter_id
1161: from
1162: csi_counters_vl cc,
1163: csi_counter_associations cca,
1164: ahl_unit_effectivities_b ue
1165: where
1166: cc.counter_id (+) = cca.counter_id
1226:
1227: select
1228: cc.counter_id
1229: from
1230: csi_counters_vl cc,
1231: csi_counter_associations cca,
1232: ahl_unit_effectivities_b ue
1233: where
1234: cc.counter_id (+) = cca.counter_id
1784: -- Added for R12 IB Uptake. If counter does not have any reading,
1785: -- csi_counter_values_v does not retrieve any row.
1786: -- split above cursor into 2 cursors.
1787: SELECT 'x'
1788: FROM CSI_COUNTERS_VL CC, csi_counter_associations cca, AHL_UNIT_EFFECTIVITIES_APP_V UE
1789: WHERE cca.source_object_code = 'CP'
1790: AND cca.source_object_id = ue.csi_item_instance_id
1791: AND cca.counter_id = cc.counter_id
1792: AND ue.unit_effectivity_id = p_ue_id
1795: -- Added for R12 bug# 6080133.
1796: CURSOR get_ctr_reading_csr(p_counter_id IN NUMBER) IS
1797: SELECT NVL(CCR.net_reading, 0)
1798: FROM
1799: CSI_COUNTERS_VL CC,
1800: CSI_COUNTER_READINGS CCR
1801: WHERE
1802: CCR.COUNTER_ID = CC.COUNTER_ID
1803: AND CC.COUNTER_ID = p_counter_id
1966: -- Added for R12 IB Uptake. If counter does not have any reading,
1967: -- csi_counter_values_v does not retrieve any row.
1968: -- split above cursor into 2 cursors.
1969: SELECT 'x'
1970: FROM CSI_COUNTERS_VL CC, csi_counter_associations cca, AHL_UNIT_EFFECTIVITIES_APP_V UE
1971: WHERE cca.source_object_code = 'CP'
1972: AND cca.source_object_id = ue.csi_item_instance_id
1973: AND cca.counter_id = cc.counter_id
1974: AND ue.unit_effectivity_id = p_ue_id
1978: CURSOR get_ctr_reading_csr(p_counter_id IN NUMBER,
1979: p_accomplishment_date IN DATE) IS
1980: SELECT NVL(CCR.net_reading, 0)
1981: FROM
1982: CSI_COUNTERS_VL CC,
1983: CSI_COUNTER_READINGS CCR
1984: WHERE
1985: CCR.COUNTER_ID = CC.COUNTER_ID
1986: AND CC.COUNTER_ID = p_counter_id
1992: CURSOR get_max_ctr_reading_csr(p_counter_id IN NUMBER,
1993: p_accomplishment_date IN DATE) IS
1994: SELECT NVL(CCR.net_reading, 0)
1995: FROM
1996: CSI_COUNTERS_VL CC,
1997: CSI_COUNTER_READINGS CCR
1998: WHERE
1999: CCR.COUNTER_ID = CC.COUNTER_ID
2000: AND CC.COUNTER_ID = p_counter_id
3632: select distinct name counter_name from csi_counter_template_vl co, ahl_mr_intervals mr
3633: where co.counter_id = mr.counter_id
3634: and mr.mr_effectivity_id = p_mr_effectivity_id
3635: intersect
3636: /* Fix for bug# 6956784. Replace CS_COUNTERS with CSI_COUNTERS_VL.
3637: * Use COUNTER_TEMPLATE_NAME for counter name
3638: * Uptake R12 Counters Changes.
3639: SELECT c.name
3640: FROM CS_COUNTERS C, CS_COUNTER_GROUPS CTRGRP, CSI_ITEM_INSTANCES CII--, MTL_SYSTEM_ITEMS_KFV MSITEM
3645: --AND MSITEM.ORGANIZATION_ID = CII.INV_MASTER_ORGANIZATION_ID
3646: AND CII.INSTANCE_ID = p_instance_id
3647: */
3648: SELECT cc.COUNTER_TEMPLATE_NAME counter_name
3649: FROM csi_counters_vl cc,
3650: csi_counter_associations cca --, CSI_ITEM_INSTANCES CII
3651: WHERE cc.counter_id = cca.counter_id
3652: and cca.source_object_code = 'CP'
3653: and cca.source_object_id = p_instance_id
3654: MINUS
3655: --SELECT c.name counter_name
3656: SELECt c.COUNTER_TEMPLATE_NAME counter_name
3657: --FROM CS_COUNTERS C, ahl_unit_accomplishmnts ua
3658: FROM csi_counters_vl C, ahl_unit_accomplishmnts ua
3659: WHERE c.COUNTER_ID = UA.COUNTER_ID
3660: AND UA.unit_effectivity_id = p_unit_effectivity_id;
3661:
3662: BEGIN
3713: l_fmp_sql := l_fmp_sql || ' mr.mr_effectivity_id in ' || l_fmp_eff;
3714:
3715: -- Counters for the given item instance
3716: --l_inst_sql := ' select distinct counter_name from csi_cp_counters_v';
3717: l_inst_sql := ' select distinct counter_template_name counter_name from csi_counters_vl cc, csi_counter_associations cca ';
3718: l_inst_sql := l_inst_sql || ' where cc.counter_id = cca.counter_id and cca.source_object_code = ''CP'' and cca.source_object_id = :1';
3719:
3720: -- Counters for the Accomplishment
3721: --l_acc_sql := ' select distinct counter_name from csi_cp_counters_v co, ahl_unit_accomplishmnts ua';
3718: l_inst_sql := l_inst_sql || ' where cc.counter_id = cca.counter_id and cca.source_object_code = ''CP'' and cca.source_object_id = :1';
3719:
3720: -- Counters for the Accomplishment
3721: --l_acc_sql := ' select distinct counter_name from csi_cp_counters_v co, ahl_unit_accomplishmnts ua';
3722: l_acc_sql := ' select distinct counter_template_name counter_name from csi_counters_vl cc, ahl_unit_accomplishmnts ua';
3723: l_acc_sql := l_acc_sql || ' where ua.unit_effectivity_id = :2';
3724: l_acc_sql := l_acc_sql || ' and ua.counter_id = cc.counter_id';
3725: l_acc_sql := l_acc_sql || ' order by counter_name ';
3726: