752: p_from_date in date,
753: p_to_date in date,
754: p_agency_code in varchar2)
755: IS
756: CURSOR cur_p4(c_from_date date, c_to_date date, c_claim GHR_COMPL_CLAIMS.claim%type, c_basis GHR_COMPL_BASES.basis%type, c_value GHR_COMPL_BASES.value%type,c_agency_code ghr_complaints2.agency_code%type) IS
757: SELECT COUNT(*) p4_cnt
758: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
759: WHERE bases.compl_claim_id = claims.compl_claim_id
760: AND claims.complaint_id = cmp.complaint_id
754: p_agency_code in varchar2)
755: IS
756: CURSOR cur_p4(c_from_date date, c_to_date date, c_claim GHR_COMPL_CLAIMS.claim%type, c_basis GHR_COMPL_BASES.basis%type, c_value GHR_COMPL_BASES.value%type,c_agency_code ghr_complaints2.agency_code%type) IS
757: SELECT COUNT(*) p4_cnt
758: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
759: WHERE bases.compl_claim_id = claims.compl_claim_id
760: AND claims.complaint_id = cmp.complaint_id
761: AND claims.claim = c_claim
762: AND claims.phase IN (20,30)
764: AND bases.value = c_value
765: AND cmp.agency_code = c_agency_code
766: AND cmp.formal_com_filed BETWEEN c_from_date AND c_to_date;
767:
768: CURSOR cur_p4_novalue(c_from_date date, c_to_date date, c_claim GHR_COMPL_CLAIMS.claim%type, c_basis GHR_COMPL_BASES.basis%type,c_agency_code ghr_complaints2.agency_code%type) IS
769: SELECT COUNT(*) p4_cnt
770: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
771: WHERE bases.compl_claim_id = claims.compl_claim_id
772: AND claims.complaint_id = cmp.complaint_id
766: AND cmp.formal_com_filed BETWEEN c_from_date AND c_to_date;
767:
768: CURSOR cur_p4_novalue(c_from_date date, c_to_date date, c_claim GHR_COMPL_CLAIMS.claim%type, c_basis GHR_COMPL_BASES.basis%type,c_agency_code ghr_complaints2.agency_code%type) IS
769: SELECT COUNT(*) p4_cnt
770: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
771: WHERE bases.compl_claim_id = claims.compl_claim_id
772: AND claims.complaint_id = cmp.complaint_id
773: AND claims.claim = c_claim
774: AND claims.phase IN (20,30)
805: AND cmp.formal_com_filed BETWEEN c_from_date AND c_to_date;
806:
807: /*CURSOR cur_p4_tot_harass_issue(c_from_date date, c_to_date date,c_agency_code ghr_complaints2.agency_code%type) IS
808: SELECT COUNT(distinct nvl(cmp.complainant_person_id,0)) p4_prsn_cnt, COUNT(distinct cmp.complaint_id) p4_cnt
809: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
810: WHERE bases.compl_claim_id = claims.compl_claim_id
811: AND claims.complaint_id = cmp.complaint_id
812: AND claims.claim IN ('130','140')
813: AND claims.phase IN (20,30)
824: AND claims.phase IN (20,30)
825: AND cmp.agency_code = c_agency_code
826: AND cmp.formal_com_filed BETWEEN c_from_date AND c_to_date;
827:
828: CURSOR cur_p4_totprsn_basis(c_from_date date, c_to_date date, c_basis GHR_COMPL_BASES.basis%type,c_agency_code ghr_complaints2.agency_code%type) IS
829: SELECT COUNT(distinct nvl(cmp.complainant_person_id,0)) p4_prsn_cnt, COUNT(distinct cmp.complaint_id) p4_cnt
830: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
831: WHERE bases.compl_claim_id = claims.compl_claim_id
832: AND claims.complaint_id = cmp.complaint_id
826: AND cmp.formal_com_filed BETWEEN c_from_date AND c_to_date;
827:
828: CURSOR cur_p4_totprsn_basis(c_from_date date, c_to_date date, c_basis GHR_COMPL_BASES.basis%type,c_agency_code ghr_complaints2.agency_code%type) IS
829: SELECT COUNT(distinct nvl(cmp.complainant_person_id,0)) p4_prsn_cnt, COUNT(distinct cmp.complaint_id) p4_cnt
830: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
831: WHERE bases.compl_claim_id = claims.compl_claim_id
832: AND claims.complaint_id = cmp.complaint_id
833: AND claims.phase IN (20,30)
834: AND bases.basis = c_basis
834: AND bases.basis = c_basis
835: AND cmp.agency_code = c_agency_code
836: AND cmp.formal_com_filed BETWEEN c_from_date AND c_to_date;
837:
838: CURSOR cur_p4_totprsn_basis_value(c_from_date date, c_to_date date, c_basis GHR_COMPL_BASES.basis%type,c_value GHR_COMPL_BASES.value%type, c_agency_code ghr_complaints2.agency_code%type) IS
839: SELECT COUNT(distinct nvl(cmp.complainant_person_id,0)) p4_prsn_cnt,COUNT(distinct cmp.complaint_id) p4_cnt
840: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
841: WHERE bases.compl_claim_id = claims.compl_claim_id
842: AND claims.complaint_id = cmp.complaint_id
836: AND cmp.formal_com_filed BETWEEN c_from_date AND c_to_date;
837:
838: CURSOR cur_p4_totprsn_basis_value(c_from_date date, c_to_date date, c_basis GHR_COMPL_BASES.basis%type,c_value GHR_COMPL_BASES.value%type, c_agency_code ghr_complaints2.agency_code%type) IS
839: SELECT COUNT(distinct nvl(cmp.complainant_person_id,0)) p4_prsn_cnt,COUNT(distinct cmp.complaint_id) p4_cnt
840: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
841: WHERE bases.compl_claim_id = claims.compl_claim_id
842: AND claims.complaint_id = cmp.complaint_id
843: AND claims.phase IN (20,30)
844: AND bases.basis = c_basis
850: -- Total By issues
851: -- For Most of the issues except pay including overtime, harassment, reassignment
852: CURSOR cur_p4_totprsn_issue(c_from_date date, c_to_date date, c_claim GHR_COMPL_CLAIMS.claim%type,c_agency_code ghr_complaints2.agency_code%type) IS
853: SELECT COUNT(distinct nvl(cmp.complainant_person_id,0)) p4_prsn_cnt, COUNT(distinct cmp.complaint_id) p4_cnt
854: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
855: WHERE bases.compl_claim_id = claims.compl_claim_id
856: AND claims.complaint_id = cmp.complaint_id
857: AND claims.claim = c_claim
858: AND claims.phase IN (20,30)
862:
863: -- For harassment Sexual
864: CURSOR cur_p4_tot_harass_sex_issue(c_from_date date, c_to_date date, c_claim GHR_COMPL_CLAIMS.claim%type,c_agency_code ghr_complaints2.agency_code%type) IS
865: SELECT COUNT(distinct nvl(cmp.complainant_person_id,0)) p4_prsn_cnt, COUNT(distinct cmp.complaint_id) p4_cnt
866: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
867: WHERE bases.compl_claim_id = claims.compl_claim_id
868: AND claims.complaint_id = cmp.complaint_id
869: AND claims.claim = c_claim
870: AND claims.phase IN (20,30)
874:
875: -- for reasonable accommodation
876: CURSOR cur_p4_tot_reacc_issue(c_from_date date, c_to_date date, c_claim GHR_COMPL_CLAIMS.claim%type,c_agency_code ghr_complaints2.agency_code%type) IS
877: SELECT COUNT(distinct nvl(cmp.complainant_person_id,0)) p4_prsn_cnt, COUNT(distinct cmp.complaint_id) p4_cnt
878: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
879: WHERE bases.compl_claim_id = claims.compl_claim_id
880: AND claims.complaint_id = cmp.complaint_id
881: AND claims.claim = c_claim
882: AND claims.phase IN (20,30)
885: AND cmp.formal_com_filed BETWEEN c_from_date AND c_to_date;
886:
887: -- For Race, National Origin
888:
889: CURSOR cur_p4_totprsn_rcno_value(c_from_date date, c_to_date date, c_basis GHR_COMPL_BASES.basis%type,c_value GHR_COMPL_BASES.value%type, c_agency_code ghr_complaints2.agency_code%type) IS
890: SELECT COUNT(distinct nvl(cmp.complainant_person_id,0)) p4_prsn_cnt,COUNT(distinct cmp.complaint_id) p4_cnt
891: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
892: WHERE bases.compl_claim_id = claims.compl_claim_id
893: AND claims.complaint_id = cmp.complaint_id
887: -- For Race, National Origin
888:
889: CURSOR cur_p4_totprsn_rcno_value(c_from_date date, c_to_date date, c_basis GHR_COMPL_BASES.basis%type,c_value GHR_COMPL_BASES.value%type, c_agency_code ghr_complaints2.agency_code%type) IS
890: SELECT COUNT(distinct nvl(cmp.complainant_person_id,0)) p4_prsn_cnt,COUNT(distinct cmp.complaint_id) p4_cnt
891: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
892: WHERE bases.compl_claim_id = claims.compl_claim_id
893: AND claims.complaint_id = cmp.complaint_id
894: AND claims.phase IN (20,30)
895: AND claims.claim NOT IN ('140','200')
898: AND cmp.agency_code = c_agency_code
899: AND cmp.formal_com_filed BETWEEN c_from_date AND c_to_date;
900:
901: --Color, Age
902: CURSOR cur_p4_tot_colage_basis(c_from_date date, c_to_date date, c_basis GHR_COMPL_BASES.basis%type,c_agency_code ghr_complaints2.agency_code%type) IS
903: SELECT COUNT(distinct nvl(cmp.complainant_person_id,0)) p4_prsn_cnt, COUNT(distinct cmp.complaint_id) p4_cnt
904: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
905: WHERE bases.compl_claim_id = claims.compl_claim_id
906: AND claims.complaint_id = cmp.complaint_id
900:
901: --Color, Age
902: CURSOR cur_p4_tot_colage_basis(c_from_date date, c_to_date date, c_basis GHR_COMPL_BASES.basis%type,c_agency_code ghr_complaints2.agency_code%type) IS
903: SELECT COUNT(distinct nvl(cmp.complainant_person_id,0)) p4_prsn_cnt, COUNT(distinct cmp.complaint_id) p4_cnt
904: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
905: WHERE bases.compl_claim_id = claims.compl_claim_id
906: AND claims.complaint_id = cmp.complaint_id
907: AND claims.phase IN (20,30)
908: AND claims.claim NOT IN ('140','200')
910: AND cmp.agency_code = c_agency_code
911: AND cmp.formal_com_filed BETWEEN c_from_date AND c_to_date;
912:
913: -- For Religion
914: CURSOR cur_p4_tot_rel_basis(c_from_date date, c_to_date date, c_basis GHR_COMPL_BASES.basis%type,c_agency_code ghr_complaints2.agency_code%type) IS
915: SELECT COUNT(distinct nvl(cmp.complainant_person_id,0)) p4_prsn_cnt, COUNT(distinct cmp.complaint_id) p4_cnt
916: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
917: WHERE bases.compl_claim_id = claims.compl_claim_id
918: AND claims.complaint_id = cmp.complaint_id
912:
913: -- For Religion
914: CURSOR cur_p4_tot_rel_basis(c_from_date date, c_to_date date, c_basis GHR_COMPL_BASES.basis%type,c_agency_code ghr_complaints2.agency_code%type) IS
915: SELECT COUNT(distinct nvl(cmp.complainant_person_id,0)) p4_prsn_cnt, COUNT(distinct cmp.complaint_id) p4_cnt
916: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
917: WHERE bases.compl_claim_id = claims.compl_claim_id
918: AND claims.complaint_id = cmp.complaint_id
919: AND claims.phase IN (20,30)
920: AND claims.claim NOT IN ('140')
922: AND cmp.agency_code = c_agency_code
923: AND cmp.formal_com_filed BETWEEN c_from_date AND c_to_date;
924:
925: -- Disability
926: CURSOR cur_p4_totprsn_disab_value(c_from_date date, c_to_date date, c_basis GHR_COMPL_BASES.basis%type,c_value GHR_COMPL_BASES.value%type, c_agency_code ghr_complaints2.agency_code%type) IS
927: SELECT COUNT(distinct nvl(cmp.complainant_person_id,0)) p4_prsn_cnt,COUNT(distinct cmp.complaint_id) p4_cnt
928: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
929: WHERE bases.compl_claim_id = claims.compl_claim_id
930: AND claims.complaint_id = cmp.complaint_id
924:
925: -- Disability
926: CURSOR cur_p4_totprsn_disab_value(c_from_date date, c_to_date date, c_basis GHR_COMPL_BASES.basis%type,c_value GHR_COMPL_BASES.value%type, c_agency_code ghr_complaints2.agency_code%type) IS
927: SELECT COUNT(distinct nvl(cmp.complainant_person_id,0)) p4_prsn_cnt,COUNT(distinct cmp.complaint_id) p4_cnt
928: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
929: WHERE bases.compl_claim_id = claims.compl_claim_id
930: AND claims.complaint_id = cmp.complaint_id
931: AND claims.phase IN (20,30)
932: AND claims.claim NOT IN ('140')
935: AND cmp.agency_code = c_agency_code
936: AND cmp.formal_com_filed BETWEEN c_from_date AND c_to_date;
937:
938: -- For Sex
939: CURSOR cur_p4_tot_sex_basis(c_from_date date, c_to_date date, c_basis GHR_COMPL_BASES.basis%type,c_value GHR_COMPL_BASES.value%type, c_agency_code ghr_complaints2.agency_code%type) IS
940: SELECT COUNT(distinct nvl(cmp.complainant_person_id,0)) p4_prsn_cnt, COUNT(distinct cmp.complaint_id) p4_cnt
941: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
942: WHERE bases.compl_claim_id = claims.compl_claim_id
943: AND claims.complaint_id = cmp.complaint_id
937:
938: -- For Sex
939: CURSOR cur_p4_tot_sex_basis(c_from_date date, c_to_date date, c_basis GHR_COMPL_BASES.basis%type,c_value GHR_COMPL_BASES.value%type, c_agency_code ghr_complaints2.agency_code%type) IS
940: SELECT COUNT(distinct nvl(cmp.complainant_person_id,0)) p4_prsn_cnt, COUNT(distinct cmp.complaint_id) p4_cnt
941: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
942: WHERE bases.compl_claim_id = claims.compl_claim_id
943: AND claims.complaint_id = cmp.complaint_id
944: AND claims.phase IN (20,30)
945: AND claims.claim NOT IN ('200')
949: AND cmp.formal_com_filed BETWEEN c_from_date AND c_to_date;
950:
951:
952: -- For equal pay act
953: CURSOR cur_p4_tot_eqpay_basis(c_from_date date, c_to_date date, c_basis GHR_COMPL_BASES.basis%type,c_value GHR_COMPL_BASES.value%type,c_agency_code ghr_complaints2.agency_code%type) IS
954: SELECT COUNT(distinct nvl(cmp.complainant_person_id,0)) p4_prsn_cnt, COUNT(distinct cmp.complaint_id) p4_cnt
955: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
956: WHERE bases.compl_claim_id = claims.compl_claim_id
957: AND claims.complaint_id = cmp.complaint_id
951:
952: -- For equal pay act
953: CURSOR cur_p4_tot_eqpay_basis(c_from_date date, c_to_date date, c_basis GHR_COMPL_BASES.basis%type,c_value GHR_COMPL_BASES.value%type,c_agency_code ghr_complaints2.agency_code%type) IS
954: SELECT COUNT(distinct nvl(cmp.complainant_person_id,0)) p4_prsn_cnt, COUNT(distinct cmp.complaint_id) p4_cnt
955: FROM GHR_COMPLAINTS2 cmp,GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
956: WHERE bases.compl_claim_id = claims.compl_claim_id
957: AND claims.complaint_id = cmp.complaint_id
958: AND claims.phase IN (20,30)
959: AND claims.claim = '160'
2909: p_from_date in date,
2910: p_to_date in date,
2911: p_agency_code in varchar2)
2912: IS
2913: CURSOR cur_p5(c_from_date date, c_to_date date, c_statute ghr_compl_bases.statute%type,c_agency_code ghr_complaints2.agency_code%type) IS
2914: SELECT COUNT(*) p5_cnt
2915: FROM GHR_COMPLAINTS2 cmp, GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
2916: WHERE bases.compl_claim_id = claims.compl_claim_id
2917: AND claims.complaint_id = cmp.complaint_id
2911: p_agency_code in varchar2)
2912: IS
2913: CURSOR cur_p5(c_from_date date, c_to_date date, c_statute ghr_compl_bases.statute%type,c_agency_code ghr_complaints2.agency_code%type) IS
2914: SELECT COUNT(*) p5_cnt
2915: FROM GHR_COMPLAINTS2 cmp, GHR_COMPL_CLAIMS claims, GHR_COMPL_BASES bases
2916: WHERE bases.compl_claim_id = claims.compl_claim_id
2917: AND claims.complaint_id = cmp.complaint_id
2918: AND claims.phase IN (20,30)
2919: AND cmp.complaint_closed BETWEEN c_from_date AND c_to_date