Skip to content

Commit

Permalink
Add support packages used in Budgets
Browse files Browse the repository at this point in the history
  • Loading branch information
jpangborn committed Mar 10, 2013
1 parent 81a7471 commit 409e1d5
Show file tree
Hide file tree
Showing 4 changed files with 263 additions and 0 deletions.
98 changes: 98 additions & 0 deletions Packages/mc_fa_budget-body.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
CREATE OR REPLACE PACKAGE BODY BANINST1.mc_fa_budget IS

-- Function and procedure implementations

-- Retreive the Art Fee
FUNCTION get_art_fee(aidy_in IN VARCHAR2,
btyp_in IN VARCHAR2)
RETURN NUMBER IS

fee NUMBER;

BEGIN
BEGIN
SELECT roralgs_amt
INTO fee
FROM roralgs
WHERE roralgs_aidy_code = aidy_in
AND roralgs_key_1 = 'BUDG'
AND roralgs_key_2 = 'ART_FEE'
AND roralgs_key_3 = btyp_in;
END;

RETURN fee;
END get_art_fee;

-- Retreive the Music Fee
FUNCTION get_music_fee(aidy_in IN VARCHAR2,
btyp_in IN VARCHAR2)
RETURN NUMBER IS

fee NUMBER;

BEGIN
BEGIN
SELECT roralgs_amt
INTO fee
FROM roralgs
WHERE roralgs_aidy_code = aidy_in
AND roralgs_key_1 = 'BUDG'
AND roralgs_key_2 = 'MUSIC_FEE'
AND roralgs_key_3 = btyp_in;
END;

RETURN fee;
END get_music_fee;

-- Retreive the Nursing Fee
FUNCTION get_nursing_fee(aidy_in IN VARCHAR2,
btyp_in IN VARCHAR2,
clas_in IN VARCHAR2)
RETURN NUMBER IS

clas VARCHAR2(2);
fee NUMBER;

BEGIN
IF clas_in IS NULL THEN
clas := 'FY';
ELSE
clas := clas_in;
END IF;

BEGIN
SELECT roralgs_amt
INTO fee
FROM roralgs
WHERE roralgs_aidy_code = aidy_in
AND roralgs_key_1 = 'BUDG'
AND roralgs_key_2 = 'NURSING_FEE'
AND roralgs_key_3 = btyp_in
AND roralgs_key_4 = clas;
END;

RETURN fee;
END get_nursing_fee;

-- Retreive the Loan Fees
FUNCTION get_loan_fees(aidy_in IN VARCHAR2,
btyp_in IN VARCHAR2)
RETURN NUMBER IS

fees NUMBER;

BEGIN
BEGIN
SELECT roralgs_amt
INTO fees
FROM roralgs
WHERE roralgs_aidy_code = aidy_in
AND roralgs_key_1 = 'BUDG'
AND roralgs_key_2 = 'LOAN_FEES'
AND roralgs_key_3 = btyp_in;
END;

RETURN fees;

END get_loan_fees;
END mc_fa_budget;
25 changes: 25 additions & 0 deletions Packages/mc_fa_budget-spec.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
CREATE OR REPLACE PACKAGE BANINST1.mc_fa_budget IS

-- Author : JPANGBORN
-- Created : 3/5/2013 8:48:04 AM
-- Purpose : Retreive or Calculate Budget Components

-- Public function and procedure declarations
FUNCTION get_art_fee(aidy_in IN VARCHAR2,
btyp_in IN VARCHAR2)
RETURN NUMBER;

FUNCTION get_music_fee(aidy_in IN VARCHAR2,
btyp_in IN VARCHAR2)
RETURN NUMBER;

FUNCTION get_nursing_fee(aidy_in IN VARCHAR2,
btyp_in IN VARCHAR2,
clas_in IN VARCHAR2)
RETURN NUMBER;

FUNCTION get_loan_fees(aidy_in IN VARCHAR2,
btyp_in IN VARCHAR2)
RETURN NUMBER;

END mc_fa_budget;
121 changes: 121 additions & 0 deletions Packages/mc_fa_util-body.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
CREATE OR REPLACE PACKAGE BODY BANINST1.mc_fa_util AS

-- Return the Latest Decision Code for an Admissions Application
FUNCTION get_decision(pidm_in IN NUMBER,
term_in IN VARCHAR,
appl_in IN NUMBER)
RETURN VARCHAR2 IS

a_apdc sarappd.sarappd_apdc_code%TYPE;

CURSOR sarappd_list IS
SELECT sarappd_apdc_code
FROM sarappd
WHERE sarappd_pidm = pidm_in
AND sarappd_term_code_entry = term_in
AND sarappd_appl_no = appl_in
ORDER BY sarappd_apdc_date DESC,
sarappd_seq_no DESC;

BEGIN
OPEN sarappd_list;
FETCH sarappd_list into a_apdc;

IF sarappd_list%NOTFOUND then
a_apdc := NULL;
END IF;

CLOSE sarappd_list;

RETURN a_apdc;
END get_decision;

-- Return the Term Code of the Student Record associated with a given Period
FUNCTION get_stu_rec_term(pidm_in IN NUMBER,
period_in IN VARCHAR)
RETURN VARCHAR2 IS

term_code VARCHAR2(8);

BEGIN
BEGIN
SELECT MAX(sgbstdn_term_code_eff)
INTO term_code
FROM sgbstdn
WHERE sgbstdn_pidm = pidm_in
AND sgbstdn_term_code_eff <= (SELECT rorprds_term_code
FROM rorprds
WHERE rorprds_period = period_in
AND rorprds_student_ind = 'Y');
END;

RETURN term_code;
END get_stu_rec_term;

-- Return the Row ID of the Student Record assocaited with a Period.
FUNCTION get_stu_rec(pidm_in IN NUMBER,
period_in IN VARCHAR)
RETURN ROWID IS

r_id ROWID;

CURSOR sgbstdn_list IS
SELECT sgbstdn.rowid
FROM sgbstdn
WHERE sgbstdn_pidm = pidm_in
AND sgbstdn_term_code_eff <= (SELECT rorprds_term_code
FROM rorprds
WHERE rorprds_period = period_in
AND rorprds_student_ind = 'Y')
ORDER BY sgbstdn_term_code_eff desc;

BEGIN
BEGIN
OPEN sgbstdn_list;
FETCH sgbstdn_list INTO r_id;

IF sgbstdn_list%NOTFOUND THEN
r_id:= NULL;
END IF;

CLOSE sgbstdn_list;
END;

RETURN r_id;

END get_stu_rec;

-- Return the Row ID of the Admissions Application assocaited with a Period.
FUNCTION get_adm_rec(pidm_in IN NUMBER,
period_in IN VARCHAR)
RETURN ROWID IS

r_id ROWID;

CURSOR saradap_list IS
SELECT saradap.rowid
FROM saradap
WHERE saradap_pidm = pidm_in
AND saradap_term_code_entry = (SELECT rorprds_term_code
FROM rorprds
WHERE rorprds_period = period_in
AND rorprds_student_ind = 'Y')
ORDER BY saradap_term_code_entry desc,
saradap_appl_no desc;

BEGIN
BEGIN
OPEN saradap_list;
FETCH saradap_list INTO r_id;

IF saradap_list%NOTFOUND THEN
r_id := NULL;
END IF;

CLOSE saradap_list;
END;

RETURN r_id;

END get_adm_rec;
END mc_fa_util;
19 changes: 19 additions & 0 deletions Packages/mc_fa_util-spec.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
CREATE OR REPLACE PACKAGE BANINST1.mc_fa_util AS

FUNCTION get_decision(pidm_in in NUMBER,
term_in in VARCHAR,
appl_in IN NUMBER)
RETURN VARCHAR2;

FUNCTION get_stu_rec_term(pidm_in IN NUMBER,
period_in IN VARCHAR)
RETURN VARCHAR2;

FUNCTION get_stu_rec(pidm_in IN NUMBER,
period_in IN VARCHAR)
RETURN ROWID;

FUNCTION get_adm_rec(pidm_in IN NUMBER,
period_in IN VARCHAR)
RETURN ROWID;
END mc_fa_util;

0 comments on commit 409e1d5

Please sign in to comment.