1060: p_workorder_id IN NUMBER,
1061: p_operation_seq_num IN NUMBER) IS
1062: SELECT SUM((AWAS.assign_end_date - AWAS.assign_start_date) * 24)
1063: FROM AHL_WORKORDER_OPERATIONS WO, AHL_OPERATION_RESOURCES AOR,
1064: AHL_WORK_ASSIGNMENTS AWAS, BOM_RESOURCES BOM
1065: WHERE WO.workorder_operation_id = AOR.workorder_operation_id
1066: AND AOR.operation_resource_id = AWAS.operation_resource_id
1067: AND BOM.resource_id = AOR.resource_id
1068: AND BOM.resource_type = 2 -- Person
1074: CURSOR c_get_total_hours_op(p_workorder_id IN NUMBER,
1075: p_operation_seq_num IN NUMBER) IS
1076: SELECT SUM(NVL(AOR.duration, 0))
1077: FROM AHL_OPERATION_RESOURCES AOR,
1078: BOM_RESOURCES BOMR,
1079: AHL_WORKORDER_OPERATIONS AWOP
1080: WHERE AOR.RESOURCE_ID = BOMR.RESOURCE_ID
1081: AND BOMR.resource_type = 2 -- Person
1082: AND AOR.WORKORDER_OPERATION_ID = AWOP.WORKORDER_OPERATION_ID
1145: p_resource_id IN NUMBER,
1146: p_resource_seq_num IN NUMBER ) IS
1147: SELECT SUM((AWAS.assign_end_date - AWAS.assign_start_date) * 24)
1148: FROM AHL_WORKORDER_OPERATIONS WO, AHL_OPERATION_RESOURCES AOR,
1149: AHL_WORK_ASSIGNMENTS AWAS, BOM_RESOURCES BOM
1150: WHERE WO.workorder_operation_id = AOR.workorder_operation_id
1151: AND AOR.operation_resource_id = AWAS.operation_resource_id
1152: AND BOM.resource_id = AOR.resource_id
1153: AND BOM.resource_type = 2 -- Person
1162: p_resource_id IN NUMBER,
1163: p_resource_seq_num IN NUMBER ) IS
1164: SELECT SUM((AWAS.assign_end_date - AWAS.assign_start_date) * 24)
1165: FROM AHL_WORKORDER_OPERATIONS WO, AHL_OPERATION_RESOURCES AOR,
1166: AHL_WORK_ASSIGNMENTS AWAS, BOM_RESOURCES BOM
1167: WHERE WO.workorder_operation_id = AOR.workorder_operation_id
1168: AND AOR.operation_resource_id = AWAS.operation_resource_id
1169: AND BOM.resource_id = AOR.resource_id
1170: AND BOM.resource_type = 2 -- Person
1227: CURSOR c_get_res_txns_emp(p_wip_entity_id IN NUMBER,
1228: p_operation_seq_num IN NUMBER,
1229: p_employee_id IN NUMBER ) IS
1230: SELECT NVL( SUM( transaction_quantity ), 0 )
1231: FROM WIP_TRANSACTIONS WT, BOM_RESOURCES BRS
1232: WHERE WT.resource_id = BRS.resource_id
1233: AND BRS.resource_type = 2 -- person.
1234: AND wt.wip_entity_id = p_wip_entity_id
1235: AND wt.operation_seq_num = p_operation_seq_num
1239: CURSOR c_get_pend_res_txns_emp(p_wip_entity_id NUMBER,
1240: p_operation_seq_num NUMBER,
1241: p_employee_id NUMBER ) IS
1242: SELECT NVL( SUM( transaction_quantity ), 0 )
1243: FROM WIP_COST_TXN_INTERFACE wcti, bom_resources br, wip_operation_resources wor
1244: WHERE wcti.wip_entity_id = wor.wip_entity_id
1245: AND wcti.operation_seq_num = wor.operation_seq_num
1246: AND wcti.resource_seq_num = wor.resource_seq_num
1247: AND wcti.organization_id = wor.organization_id
1255: -- query to retrieve total hrs transacted by all employees.
1256: CURSOR c_get_res_txns_op(p_wip_entity_id IN NUMBER,
1257: p_operation_seq_num IN NUMBER) IS
1258: SELECT NVL( SUM( transaction_quantity ), 0 )
1259: FROM WIP_TRANSACTIONS WT, BOM_RESOURCES BRS
1260: WHERE WT.resource_id = BRS.resource_id
1261: AND BRS.resource_type = 2 -- person.
1262: AND WT.wip_entity_id = p_wip_entity_id
1263: AND WT.operation_seq_num = p_operation_seq_num;
1267: p_operation_seq_num NUMBER) IS
1268: -- Here we cannot join with wcti.resource_id column
1269: -- since this col can be null.
1270: SELECT NVL( SUM( transaction_quantity ), 0 )
1271: FROM WIP_COST_TXN_INTERFACE wcti, bom_resources br, wip_operation_resources wor
1272: WHERE wcti.wip_entity_id = wor.wip_entity_id
1273: AND wcti.operation_seq_num = wor.operation_seq_num
1274: AND wcti.resource_seq_num = wor.resource_seq_num
1275: AND wcti.organization_id = wor.organization_id
1354: p_operation_seq_num IN NUMBER,
1355: p_resource_seq_num IN NUMBER,
1356: p_employee_id IN NUMBER ) IS
1357: SELECT NVL( SUM( transaction_quantity ), 0 )
1358: FROM WIP_TRANSACTIONS WT, BOM_RESOURCES BRS
1359: WHERE WT.resource_id = BRS.resource_id
1360: AND BRS.resource_type = 2 -- person.
1361: AND WT.transaction_type = 1 -- resource txn.
1362: AND wt.wip_entity_id = p_wip_entity_id
1369: p_operation_seq_num NUMBER,
1370: p_resource_seq_num IN NUMBER,
1371: p_employee_id NUMBER ) IS
1372: SELECT NVL( SUM( transaction_quantity ), 0 )
1373: FROM WIP_COST_TXN_INTERFACE wcti, bom_resources br,
1374: wip_operation_resources wor
1375: WHERE wcti.wip_entity_id = wor.wip_entity_id
1376: AND wcti.operation_seq_num = wor.operation_seq_num
1377: AND wcti.resource_seq_num = wor.resource_seq_num
1389: CURSOR c_get_res_txns_res(p_wip_entity_id IN NUMBER,
1390: p_operation_seq_num IN NUMBER,
1391: p_resource_seq_num IN NUMBER) IS
1392: SELECT NVL( SUM( transaction_quantity ), 0 )
1393: FROM WIP_TRANSACTIONS WT, BOM_RESOURCES BRS
1394: WHERE WT.resource_id = BRS.resource_id
1395: AND BRS.resource_type = 2 -- person.
1396: AND WT.transaction_type = 1 -- resource txn.
1397: AND wt.wip_entity_id = p_wip_entity_id
1404: CURSOR c_get_pend_res_txns_res(p_wip_entity_id IN NUMBER,
1405: p_operation_seq_num IN NUMBER,
1406: p_resource_seq_num IN NUMBER) IS
1407: SELECT NVL( SUM( transaction_quantity ), 0 )
1408: FROM WIP_COST_TXN_INTERFACE wcti, bom_resources br,
1409: wip_operation_resources wor
1410: WHERE wcti.wip_entity_id = wor.wip_entity_id
1411: AND wcti.operation_seq_num = wor.operation_seq_num
1412: AND wcti.resource_seq_num = wor.resource_seq_num