cafa lib.txt

Upload: jose-santos

Post on 02-Apr-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/27/2019 Cafa Lib.txt

    1/27

    /*Modification History--------------------

    Done by : Megasoft L.L.C. (Contractor), 07/16/1999On : 07/16/1999

    Purpose : Change certain messages to appear not as alerts*/

    procedure alert_message(opt1 in number, str in char) isal_id Alert;Button_no number;e_type char(4) := error_type;e_code number := error_code;m_type char(4) := message_type;m_code number := message_code;s_level number ;opt number := substr(to_char(opt1),1,1);str1 varchar2(200);

    function check_severe1 return number isbegin

    if e_code in (40010,40100,40101,40102,40110,40111,40400,40401,41000,41001,40405,42100,40659,40200) then

    return 1;

    end if;end ;

    function check_severe2 return number isbegin

    if e_code in (40101,40103,40201,40204,40206,40513,41007,40312,41824) or e_code between41002 and 41004 or e_code between 41802 and 41803 then

    return 1;end if;

    end ;

    function check_severe3 return number is

    begin if e_code in (40202,40203,40205,40207,40208,40652,40702,40744,40745) or e_code between 50001 and 50020or e_code between 91109 and 91119 thenreturn 1;

    end if;end;

    function check_severe4 return number isbegin

    if e_code in (40514,40602,40654,40700,40703,40704,40705,40714,40743,40800,41048,41062,41063,41065,41066,41067,41104,40212,41308,41900,47107) or e_code between 41050 and

    41060 or e_code between 41068 and 41080 or e_code between41083 and 41093 or e_code between 41201 and 41210 ore_code between 47109 and 47111 thenreturn 1;

    end if;end;

    function check_severe5 return number isbegin

    if e_code in (40801,40919,40908,41049) then

  • 7/27/2019 Cafa Lib.txt

    2/27

    return 1;end if;

    end;

    procedure maintain_status isbegin

    if e_type in ('ORA','FRM') and substr(to_char(opt1),1,1) = '1' thenstr1 := e_type||'-'||to_char(e_code)||': '||str;message(str1);bell;raise form_trigger_failure;

    elsereturn;

    end if;end;begin/* below if block is used to check if it is a message */if opt = 1 and e_code = 0 and m_code != 0 then

    opt := 2;end if;

    if length(to_char(opt1)) < 2 thens_level := 0;

    else

    s_level := substr(to_char(opt1),2);

    /* below if block added to set the severity default to 5 */if s_level = 0 then

    s_level := 5;end if;

    end if;default_value('0','global.button');if name_in('global.button') = 0 thenif opt = 1 then

    if e_type = 'FRM' thenif s_level = 5 then

    if check_severe1 = 1 then maintain_status; end if;

    elsif s_level = 10 thenif check_severe1 = 1 then maintain_status; end if;if check_severe2 = 1 then maintain_status; end if;

    elsif s_level = 15 thenif check_severe1 = 1 then maintain_status; end if;if check_severe2 = 1 then maintain_status; end if;if check_severe3 = 1 then maintain_status; end if;

    elsif s_level = 20 thenif check_severe1 = 1 then maintain_status; end if;if check_severe2 = 1 then maintain_status; end if;if check_severe3 = 1 then maintain_status; end if;if check_severe4 = 1 then maintain_status; end if;

    elsif s_level = 25 then

    if check_severe1 = 1 then maintain_status; end if;if check_severe2 = 1 then maintain_status; end if;if check_severe3 = 1 then maintain_status; end if;if check_severe4 = 1 then maintain_status; end if;if check_severe5 = 1 then maintain_status; end if;

    end if;end if;str1 := e_type||'-'||to_char(e_code)||': '||str;

    elsif opt = 2 thenstr1 := m_type||'-'||to_char(m_code)||': '||str;

  • 7/27/2019 Cafa Lib.txt

    3/27

    elsif opt IN (3, 4) thenstr1 := str;

    end if;

    IF OPT = 4 AND GET_APPLICATION_PROPERTY(USER_INTERFACE)= 'CHARMODE' THENMESSAGE(STR1);

    ELSIF OPT = 2 THENMESSAGE(STR1);BELL;

    ELSEal_id := Find_Alert('Alert1');if Id_Null(al_id) then

    Message('Alert Object missing call MegaSoft');Raise Form_Trigger_Failure;

    end if;Change_Alert_Message('alert1', str1);Button_no := show_alert('alert1');if Button_no = ALERT_BUTTON1 then

    change_alert_message('alert1','MegaSoft''s Default Message');end if;maintain_status;

    END IF;elsecopy ('2', 'global.button');

    end if;end alert_message;

    PROCEDURE BLOCK_TO_EDITOR_COPY IS-- cur_pos number := 1;-- lchar number := 0;-- c_len number := 0;-- temp_char char(1):= null;-- ecnt number := 0;-- cflag char := 'Y';

    copy_str varchar2(100) := NULL;

    c_val varchar2(10000);flag varchar2(10) := ' ';recordno number :=0;blockname varchar2(50) := ' ';

    BEGIN--alert_message(1,'cval is ' || c_val);--alert_message(1,'cur_item - ' || name_in('global.cur_item'));

    go_item(name_in('global.cur_item'));blockname := name_in('system.cursor_block');

    -- alert_message(1,blockname);flag := get_record_property(1,blockname,STATUS);

    -- alert_message(1,'flag is - ' || flag);if flag = 'NEW' then

    go_item('BLK_COPY.ITEM_COPY');else

    first_record;copy_str := ' ';recordno := 1;

    loopcopy_str := name_in(name_in('global.cur_item'));

    -- alert_message(1,'cur_item - ' || name_in('global.cur_item'));-- alert_message(1,'copy_str is - ' || copy_str);

    if recordno > 1 then

  • 7/27/2019 Cafa Lib.txt

    4/27

    c_val := c_val || chr(10) || copy_str;else

    c_val := c_val || copy_str;end if;

    -- alert_message(1,'cval is - ' || c_val);next_record;recordno := recordno + 1;flag := get_record_property(recordno,blockname,STATUS);

    -- alert_message(1,'flag is - ' || flag);exit when flag = 'NEW';

    end loop;if flag = 'NEW' then

    delete_record;end if;--alert_message(1,'out of record');first_record;copy('YES','global.block_to_editor');go_block('BLK_COPY');copy(c_val,'BLK_COPY.ITEM_COPY');--alert_message(1,c_val);end if;

    END;

    PROCEDURE copy_proc IScur_pos number := 1;lchar number := 0;copy_str varchar2(10000) := NULL;temp_char char(1):= null;ecnt number := 0;cflag char := 'Y';c_val varchar2(10000);c_len number := 0;

    begin

    c_val := name_in('global.cur_val') || name_in('BLK_COPY.ITEM_COPY');

    c_len := length(c_val);-- go_item('long.cause_cmnt');go_item(name_in('global.cur_item'));

    looptemp_char := substr(c_val,cur_pos,1);ecnt := ecnt + 1;cur_pos := cur_pos + 1;if ascii(temp_char) != 10 thencopy_str := copy_str || temp_char;lchar := lchar + 1;

    end if;if (ascii(temp_char) = 10 or lchar = 65) and copy_str is not null then

    copy(copy_str,name_in('global.cur_item'));-- :long.cause_cmnt := copy_str;

    create_record;copy_str := null;lchar := 0;cflag := 'N';

    end if;cflag := 'Y';exit when ecnt > c_len;

    end loop;

  • 7/27/2019 Cafa Lib.txt

    5/27

    if cflag = 'Y' thencopy(copy_str,name_in('global.cur_item'));

    -- :long.cause_cmnt := copy_str;end if;

    end;

    PROCEDURE copy_proc_seq IScur_pos number := 1;lchar number := 0;copy_str varchar2(10000) := NULL;temp_char char(1):= null;ecnt number := 0;cflag char := 'Y';c_val varchar2(10000);c_len number := 0;

    begin

    c_val := name_in('global.cur_val') || name_in('BLK_COPY.ITEM_COPY');

    c_len := length(c_val);-- go_item('long.cause_cmnt');

    go_item(name_in('global.cur_item'));

    looptemp_char := substr(c_val,cur_pos,1);ecnt := ecnt + 1;cur_pos := cur_pos + 1;if ascii(temp_char) != 10 thencopy_str := copy_str || temp_char;lchar := lchar + 1;

    end if;if (ascii(temp_char) = 10 or lchar = 65) and copy_str is not null then

    copy(copy_str,name_in('global.cur_item'));-- :long.cause_cmnt := copy_str;

    execute_trigger('SET_SEQ_NBR');

    create_record;copy_str := null;lchar := 0;cflag := 'N';

    end if;cflag := 'Y';exit when ecnt > c_len;

    end loop;

    if cflag = 'Y' thencopy(copy_str,name_in('global.cur_item'));

    -- :long.cause_cmnt := copy_str;end if;

    end;

    PROCEDURE disp_edit IS

    can_width number;can_height number;can_name varchar2(25);win_x number;win_y number;

  • 7/27/2019 Cafa Lib.txt

    6/27

    set_x number;set_y number;temp number;BEGINcan_name := get_item_property(name_in('system.cursor_item'),item_canvas);can_width := get_canvas_property(can_name,width);can_height := get_canvas_property(can_name,height);win_x := get_window_property('PAGE_1',x_pos);win_y := get_window_property('PAGE_1',y_pos);set_x := win_x ;set_y := win_y + floor((can_height - 7)/2) ;set_window_property('PAGE_COPY',X_POS,set_x);set_window_property('PAGE_COPY',Y_POS,set_y);if can_width 2 then

    set_window_property('PAGE_COPY',X_POS,set_x+temp);else

    set_window_property('PAGE_COPY',X_POS,set_x+1);end if;

    end if;END;

    PROCEDURE fa_err_msg (msg_txt in char, action in char) IS/*Description:

    This is the interface between application forms and the messagepopup form by the same name.

    Usage:Called with the msg_txt as parameter #1.Call with msg_txt = '0' for default SQL error messages.Call with any other number, displays that specified SQL error.Parameter #2 tells whether to raise a trigger failure or not and also

    passes the text to the error form for display on line 1. Values are'FAIL' (which translates to ERROR!!! on the screen and raises aform_trigger_failure) or anything else (which is no-fail condition,and which is also passed to the error screen for display on line 1.)Returns no values.

    Revisions:Michael Miller, 11-Sep-92 First Version.Michael Miller, 10-Nov-92 Added feature to pass parameter 2 to the

    error form.Modification History--------------------

    Done by : Megasoft L.L.C. (Contractor), 01/15/1999On : 01/15/1999

    Purpose : Upgraded to Forms 4.5 version (CHAR mode) as part of Server Consolidation

    Modifications were done to achieve the same using an ALERT instead of calling the FA_ERR_MSG form.*/

    al_id Alert;Button_no number;msg_nbr number;msg_str VARCHAR2(255);

  • 7/27/2019 Cafa Lib.txt

    7/27

    begindefault_value('0','global.button');if name_in('global.button') = 0 thenbeginselect to_number(msg_txt) into msg_nbr from dual;if msg_nbr = 0 then

    COPY(to_char(SQLCODE),'GLOBAL.MSG_NBR');COPY('ORACLE ERROR #','GLOBAL.MSG_TYP');COPY(SQLERRM(SQLCODE),'GLOBAL.MSG_TXT');

    elseCOPY(name_in('MSG_NBR'),'GLOBAL.MSG_NBR');COPY('ORACLE ERROR #','GLOBAL.MSG_TYP');COPY(SQLERRM(MSG_NBR),'GLOBAL.MSG_TXT');

    end if;exception

    when others thenif action = 'FAIL' then

    COPY('ERROR!!!','GLOBAL.MSG_TYP');else

    COPY(ACTION,'GLOBAL.MSG_TYP');end if;COPY(NULL,'GLOBAL.MSG_NBR');COPY(MSG_TXT,'GLOBAL.MSG_TXT');

    end;-- call ('$relfa/fa_err_msg', NO_HIDE);-- call_form ('$relfa/fa_err_msg', NO_HIDE,DO_REPLACE);

    al_id := Find_Alert('ERR_MSG_ALERT');if Id_Null(al_id) then

    Message('Alert Object missing call MegaSoft');Raise Form_Trigger_Failure;

    end if;msg_str := NAME_IN('global.msg_typ')||' '||NAME_IN('global.msg_nbr')||' : '||N

    AME_IN('global.msg_txt');Change_Alert_Message('ERR_MSG_ALERT', msg_str);Button_no := show_alert('ERR_MSG_ALERT');

    if Button_no = ALERT_BUTTON1 thenchange_alert_message('ERR_MSG_ALERT','MegaSoft''s Default Message');end if;

    elsecopy ('2', 'global.button');

    end if;

    erase ('GLOBAL.MSG_NBR');erase ('GLOBAL.MSG_TXT');erase ('GLOBAL.MSG_TYP');if action = 'FAIL' then

    raise form_trigger_failure;end if;

    end;

    PROCEDURE FA_PROC_BOLD IS/*Procedure to set a field characteristics to BOLD-INVERSE format. Usedin conjunction with PRE-FIELD triggers to bold a field as the cursorenters it (see procedure FA_PROC_NOBOLD).

    .Input Variables: noneOutput Variables: none

  • 7/27/2019 Cafa Lib.txt

    8/27

    .Maintenance Performed By Date------------------------------------------ ---------------- --------Swiped from Insight & made into a proc Jerry Klima 4/3/91

    Modification History--------------------

    Done by : Megasoft L.L.C. (Contractor), 01/15/1999On : 01/15/1999

    Purpose : Upgraded to Forms 4.5 version (CHAR mode) as part of Server Consolidation*/BEGIN-- IF FIELD_CHARACTERISTIC(:SYSTEM.TRIGGER_FIELD,ENTERABLE) = 'TRUE' THEN-- DISPLAY_FIELD(:SYSTEM.TRIGGER_FIELD,'BOLD-INVERSE');IF GET_ITEM_PROPERTY(NAME_IN('SYSTEM.TRIGGER_ITEM'),INSERT_ALLOWED) = 'TRUE' OR

    GET_ITEM_PROPERTY(NAME_IN('SYSTEM.TRIGGER_ITEM'),UPDATEABLE) = 'TRUE'THEN

    DISPLAY_ITEM(NAME_IN('SYSTEM.TRIGGER_ITEM'),'BOLD-INVERSE');END IF;

    END;

    PROCEDURE FA_PROC_CMNT IS

    /*Procedure to calculate a CMNT_SEQ_NBR for keeping comments in theappropriate sequence. Primarily does an interpolation between twoexisting CMNT_SEQ_NBRs to get the new number.

    .Input Variables: none NOTE: any screen which calls this procedureOutput Variables: none must have a field called CMNT_SEQ_NBR!

    .Maintenance Performed By Date------------------------------------------ ---------------- --------Originally written for the HDA version Jerry Klima 7/1/90Converted to a procedure Jerry Klima 4/27/91

    Modification History--------------------Done by : Megasoft L.L.C. (Contractor), 01/15/1999

    On : 01/15/1999Purpose : Upgraded to Forms 4.5 version (CHAR mode) as part of S

    erver Consolidation*/BEGINDECLARE

    PREV_SEQ_NBR NUMBER;NEXT_SEQ_NBR NUMBER;CUR_REC NUMBER;

    -- TEMP NUMBER;

    BEGINCUR_REC := TO_NUMBER(NAME_IN('SYSTEM.CURSOR_RECORD'));IF CUR_REC = 1 THEN

    -- TEMP := 1;COPY('1','CMNT_SEQ_NBR');

    ELSEGO_RECORD(CUR_REC - 1);PREV_SEQ_NBR := NAME_IN('CMNT_SEQ_NBR');GO_RECORD(CUR_REC);IF NAME_IN('SYSTEM.LAST_RECORD') = 'TRUE' THEN

  • 7/27/2019 Cafa Lib.txt

    9/27

    -- TEMP := PREV_SEQ_NBR + 1;COPY(TO_CHAR(PREV_SEQ_NBR + 1),'CMNT_SEQ_NBR');

    ELSEGO_RECORD(CUR_REC + 1);NEXT_SEQ_NBR := NAME_IN('CMNT_SEQ_NBR');GO_RECORD(CUR_REC);

    -- TEMP := PREV_SEQ_NBR+((NEXT_SEQ_NBR-PREV_SEQ_NBR)/2);COPY(TO_CHAR(PREV_SEQ_NBR+((NEXT_SEQ_NBR-PREV_SEQ_NBR)/2)),'CMNT_SEQ_NBR

    ');END IF;

    END IF;END;

    END;

    PROCEDURE FA_PROC_DISPTN IS/*This procedure updates the FA_PART table with the latest dispostion forthat part. It does this in one of two ways:If GLOBAL.DISPTN_FA_DISPTN_DT is NULL (the calling form had a deletion)

    Rebuilds the date by looking at table FA_PART_DISPTN.If GLOBAL.DISPTN_FA_DISPTN_DT is NOT NULL (the calling form had an add)

    Updates the table using the parameters passed to it..Input Variables: GLOBAL.DISPTN_PART_CTL_NBR

    GLOBAL.DISPTN_FA_DISPTN_DTGLOBAL.DISPTN_TO_FA_AREA_CD.Output Variables: None.Maintenance Performed By Date------------------------------------- -------------------- -------Initial Procedure Development Jerry Klima 6/1/91

    Modification History--------------------

    Done by : Megasoft L.L.C. (Contractor), 01/15/1999On : 01/15/1999

    Purpose : Upgraded to Forms 4.5 version (CHAR mode) as part of Server ConsolidationAlso changes were made to achieve YR2000 compliance by

    changing it to 4-digit year format*/BEGINDECLARE

    CNT NUMBER;FA_DISPTN_DT CHAR(20);TO_FA_AREA_CD CHAR(6);G_DISPTN_PART_CTL_NBR VARCHAR2(255) := NAME_IN('GLOBAL.DISPTN_PART_CTL

    _NBR');G_DISPTN_TO_FA_AREA_CD VARCHAR2(255) := NAME_IN('GLOBAL.DISPTN_TO_FA_AR

    EA_CD');G_DISPTN_FA_DISPTN_DT VARCHAR2(255) := NAME_IN('GLOBAL.DISPTN_FA_DISPT

    N_DT');CURSOR FA_PROC_DISPTN IS

    -- SELECT TO_CHAR(FA_DISPTN_DT,'DD-MON-YY'), TO_FA_AREA_CDSELECT TO_CHAR(FA_DISPTN_DT,'DD-MON-YYYY'), TO_FA_AREA_CDFROM FA_PART_DISPTNWHERE PART_CTL_NBR = G_DISPTN_PART_CTL_NBRAND FA_DISPTN_DT = (SELECT MAX(FA_DISPTN_DT)

    FROM FA_PART_DISPTN

  • 7/27/2019 Cafa Lib.txt

    10/27

    WHERE PART_CTL_NBR = G_DISPTN_PART_CTL_NBR);BEGIN

    -- IF NAME_IN('GLOBAL.DISPTN_FA_DISPTN_DT') IS NULL THENIF G_DISPTN_FA_DISPTN_DT IS NULL THENSELECT COUNT(*)INTO CNTFROM FA_PART_DISPTNWHERE PART_CTL_NBR = G_DISPTN_PART_CTL_NBR;IF CNT = 0 THEN

    UPDATE FA_PARTSET CURR_FA_AREA_CD = NULL,

    CURR_FA_DISPTN_DT = NULLWHERE PART_CTL_NBR = G_DISPTN_PART_CTL_NBR;

    ELSEOPEN FA_PROC_DISPTN;FETCH FA_PROC_DISPTN INTO FA_DISPTN_DT, TO_FA_AREA_CD;CLOSE FA_PROC_DISPTN;UPDATE FA_PART

    SET CURR_FA_AREA_CD = TO_FA_AREA_CD,-- CURR_FA_DISPTN_DT = TO_DATE(FA_DISPTN_DT,'DD-MON-YY')

    CURR_FA_DISPTN_DT = TO_DATE(FA_DISPTN_DT,'DD-MON-YYYY')WHERE PART_CTL_NBR = G_DISPTN_PART_CTL_NBR;

    END IF;ELSE

    UPDATE FA_PARTSET CURR_FA_AREA_CD = G_DISPTN_TO_FA_AREA_CD,-- CURR_FA_DISPTN_DT = TO_DATE(:GLOBAL.DISPTN_FA_DISPTN_DT,'DD-MON-YY')

    CURR_FA_DISPTN_DT = TO_DATE(G_DISPTN_FA_DISPTN_DT,'DD-MON-YYYY')WHERE PART_CTL_NBR = G_DISPTN_PART_CTL_NBR

    -- AND (TO_DATE(TO_CHAR(CURR_FA_DISPTN_DT,'DD-MON-YY')) l2 thens2_padded := s2 || rpad(' ',(l1-l2)*2);

    elses2_padded := s2;

    end if;

  • 7/27/2019 Cafa Lib.txt

    19/27

    COPY(upper(defalt),'global.fa_three_button_defalt');COPY(NULL,'GLOBAL.FA_THREE_BUTTON_ANSWER');

    -- call ('$relfa/fa_three_button',NO_HIDE);-- call_form ('$relfa/fa_three_button',NO_HIDE,NO_REPLACE);THREE_BUTTON_ALERT := FIND_ALERT('THREE_BUTTON');IF ID_NULL(THREE_BUTTON_ALERT) THEN

    MESSAGE('ALERT MISSING! CALL MEGASOFT');ELSE-- :GLOBAL.FA_THREE_BUTTON_ANSWER := '';-- COPY('','GLOBAL.FA_THREE_BUTTON_ANSWER');SET_ALERT_PROPERTY('THREE_BUTTON',TITLE,S1);

    -- SET_ALERT_PROPERTY('THREE_BUTTON',ALERT_MESSAGE_TEXT,S2);SET_ALERT_PROPERTY('THREE_BUTTON',ALERT_MESSAGE_TEXT,S2_padded);RESULT := SHOW_ALERT('THREE_BUTTON');

    IF RESULT = ALERT_BUTTON1 THEN-- :GLOBAL.FA_THREE_BUTTON_ANSWER := 'Y';

    COPY('Y','GLOBAL.FA_THREE_BUTTON_ANSWER');ELSIF RESULT = ALERT_BUTTON2 THEN-- :GLOBAL.FA_THREE_BUTTON_ANSWER := 'N';

    COPY('N','GLOBAL.FA_THREE_BUTTON_ANSWER');ELSIF RESULT = ALERT_BUTTON3 THEN-- :GLOBAL.FA_THREE_BUTTON_ANSWER := 'C';

    COPY('C','GLOBAL.FA_THREE_BUTTON_ANSWER');

    END IF;END IF;answer := name_in('global.fa_three_button_answer');erase ('global.fa_three_button_msg1');erase ('global.fa_three_button_msg2');erase ('global.fa_three_button_answer');erase ('global.fa_three_button_defalt');

    end;

    PROCEDURE fa_three_button_old (s1 in char, s2 in char, defalt in char,answer out char) is

    /*Description:

    this is the interface between a three button yes/no/cancel typeof alert box that pops up in the middle of the screen, you mustcall it with four string parameters, one that is the general alertmsg, such as "STOP", "WARNING" etc, the second is your message tothe user and the third is the default answer and the fourth isthe answer returned.

    Usage:fa_three_button(s1, s2, s3, s4);Returns s3 as a parameter in the form of "Y", "N" or "C".

    Revisions:George Laframboise, 05-May-92: First version.George Laframboise, 17-jun-92: modified to position the

    cursor on a default answer.

    Michael Miller, 07-Dec-92: adapted to FA.

    Modification History--------------------

    Done by : Megasoft L.L.C. (Contractor), 01/15/1999On : 01/15/1999

    Purpose : Upgraded to Forms 4.5 version (CHAR mode) as part of Server Consolidation

    Also changes were made to achieve YR2000 compliance bychanging it to 4-digit year format

  • 7/27/2019 Cafa Lib.txt

    20/27

    Renamed this to have a backup copy as it has now beenchanged to an ALERT.*/begin

    COPY(s1,'global.fa_three_button_msg1');COPY(s2,'global.fa_three_button_msg2');COPY(upper(defalt),'global.fa_three_button_defalt');

    -- call ('$relfa/fa_three_button',NO_HIDE);call_form ('$relfa/fa_three_button',NO_HIDE,NO_REPLACE);answer := name_in('global.fa_three_button_answer');erase ('global.fa_three_button_msg1');erase ('global.fa_three_button_msg2');erase ('global.fa_three_button_answer');erase ('global.fa_three_button_defalt');

    end;

    PROCEDURE FA_TWO_BUTTON (s1 in char, s2 in char, defalt in char,answer out char) IS

    /*Description:

    this is the interface between a two button yes/no type of alertbox that pops up in the middle of the screen, you must call itwith four string parameters, one that is the general alert msg,such as "STOP", "WARNING", etc a second that is your message to

    the user and a third that will be the default answer and thefourth is the answer to be returned by the procedure. obviouslythe third parameter should be a local one declared in your form.for example:fa_two_button('Stop', 'Are You Sure ?', 'Y', answer_return);

    Usage:fa_two_button(s1, s2, s3);Returns: answer as a parameter in the form of "Y" or "N".

    Revisions:George Laframboise, 05-May-92: First version.George Laframboise, 07-jun-92: modified to position the

    cursor on a default answer.Michael Miller, 08-Nov-92: adapted to FA.

    Modification History--------------------

    Done by : Megasoft L.L.C. (Contractor), 01/15/1999On : 01/15/1999

    Purpose : Upgraded to Forms 4.5 version (CHAR mode) as part of Server Consolidation*/

    TWO_BUTTON_ALERT ALERT;RESULT NUMBER;MSG VARCHAR2(255);

    l1 NUMBER := length(s1);l2 NUMBER := length(s2);

    s2_padded VARCHAR2(255);

    begincopy(s1,'global.fa_two_button_msg1');copy(s2,'global.fa_two_button_msg2');copy(upper(defalt),'global.fa_two_button_defalt');if l1 > l2 then

  • 7/27/2019 Cafa Lib.txt

    21/27

    s2_padded := s2 || rpad(' ',(l1-l2)*2);else

    s2_padded := s2;end if;

    COPY(NULL,'GLOBAL.FA_TWO_BUTTON_ANSWER');

    --call ('$relfa/fa_two_button', NO_HIDE);-- call_form ('$relfa/fa_two_button', NO_HIDE,NO_REPLACE);

    TWO_BUTTON_ALERT := FIND_ALERT('TWO_BUTTON');IF ID_NULL(TWO_BUTTON_ALERT) THEN

    MESSAGE('ALERT MISSING');ELSE-- COPY('','GLOBAL.FA_TWO_BUTTON_ANSWER');

    set_alert_property('TWO_BUTTON',TITLE,S1);SET_ALERT_PROPERTY('TWO_BUTTON',ALERT_MESSAGE_TEXT,S2_padded);RESULT := SHOW_ALERT('TWO_BUTTON');IF RESULT = ALERT_BUTTON1 THEN

    -- :GLOBAL.FA_TWO_BUTTON_ANSWER := 'Y';COPY('Y','GLOBAL.FA_TWO_BUTTON_ANSWER');

    ELSIF RESULT = ALERT_BUTTON2 THEN-- :GLOBAL.FA_TWO_BUTTON_ANSWER := 'N';

    COPY('N','GLOBAL.FA_TWO_BUTTON_ANSWER');END IF;

    END IF;

    answer := name_in('global.fa_two_button_answer');erase ('global.fa_two_button_msg1');erase ('global.fa_two_button_msg2');erase ('global.fa_two_button_answer');erase ('global.fa_two_button_defalt');

    end;

    PROCEDURE fa_two_button_old (s1 in char, s2 in char, defalt in char,answer out char) IS

    /*Description:

    this is the interface between a two button yes/no type of alert

    box that pops up in the middle of the screen, you must call itwith four string parameters, one that is the general alert msg,such as "STOP", "WARNING", etc a second that is your message tothe user and a third that will be the default answer and thefourth is the answer to be returned by the procedure. obviouslythe third parameter should be a local one declared in your form.for example:fa_two_button('Stop', 'Are You Sure ?', 'Y', answer_return);

    Usage:fa_two_button(s1, s2, s3);Returns: answer as a parameter in the form of "Y" or "N".

    Revisions:George Laframboise, 05-May-92: First version.

    George Laframboise, 07-jun-92: modified to position thecursor on a default answer.

    Michael Miller, 08-Nov-92: adapted to FA.

    Modification History--------------------

    Done by : Megasoft L.L.C. (Contractor), 01/15/1999On : 01/15/1999

    Purpose : Upgraded to Forms 4.5 version (CHAR mode) as part of Server Consolidation

  • 7/27/2019 Cafa Lib.txt

    22/27

    Renamed this to have a backup copy as it has now beenchanged to an ALERT.*/begincopy(s1,'global.fa_two_button_msg1');copy(s2,'global.fa_two_button_msg2');copy(upper(defalt),'global.fa_two_button_defalt');

    --call ('$relfa/fa_two_button', NO_HIDE);call_form ('$relfa/fa_two_button', NO_HIDE,NO_REPLACE);answer := name_in('global.fa_two_button_answer');erase ('global.fa_two_button_msg1');erase ('global.fa_two_button_msg2');erase ('global.fa_two_button_answer');erase ('global.fa_two_button_defalt');

    end;

    /*Creation History----------------

    Created by : Megasoft L.L.C. (Contractor)On : 23-FEB-1999

    Purpose : Created to assign the header block values with Heading as input.

    Also changes were made to achieve Y2K.

    */

    PROCEDURE head_on_clear(str in char) ISform_desc VARCHAR2(80) := str;d date;len_desc NUMBER := LENGTH(form_desc);

    begin-- :head_blk.form_name := get_application_property(CURRENT_FORM_NAME);copy(get_application_property(CURRENT_FORM_NAME),'head_blk.form_name');select to_date(to_char(SYSDATE,'DD-MON-YYYY'),'DD-MON-YYYY') into d from dual;copy(to_char(d,'DD-MON-YYYY'),'head_blk.sys_head_date');copy(form_desc,'head_blk.form_desc');set_item_property('HEAD_BLK.FORM_DESC',WIDTH,len_desc);

    set_item_property('HEAD_BLK.FORM_DESC',X_POS,(80-len_desc)/2+2);END;

    PACKAGE HINT IS

    PROCEDURE ShowButtonHelp( timedelay NUMBER := 500);

    PROCEDURE ShowButtonHelpHandler;

    PROCEDURE HideButtonHelp;

    END HINT;

    PACKAGE BODY HINT IS---- SMUENCH/DNAVAS, 1994--BUTTONHELPTIMER CONSTANT VARCHAR2(80) := 'SHOWBUTTONHELP__X';hint_is_displayed BOOLEAN := FALSE;on_windows_flag BOOLEAN := NULL;rc PLS_INTEGER;mouse_item VARCHAR2(80);

  • 7/27/2019 Cafa Lib.txt

    23/27

    mouse_canvas VARCHAR2(80);mouse_item_hint VARCHAR2(200);appInst PLS_INTEGER;HWind PLS_INTEGER;lh_SHOWHINT ora_ffi.libHandleType;fh_DisplayHint ora_ffi.funcHandleType;

    FUNCTION i_DisplayHint(funcHandle IN ora_ffi.funcHandleType,AppInstance IN PLS_INTEGER,HWnd IN PLS_INTEGER,PosSq IN PLS_INTEGER,x IN PLS_INTEGER,y IN PLS_INTEGER,message IN OUT VARCHAR2)RETURN PLS_INTEGER;

    PRAGMA INTERFACE(C,i_DisplayHint,11265);

    FUNCTION DisplayHint(AppInstance IN PLS_INTEGER,HWnd IN PLS_INTEGER,PosSq IN PLS_INTEGER,x IN PLS_INTEGER,

    y IN PLS_INTEGER,message IN VARCHAR2)RETURN PLS_INTEGER ISAppInstance_l PLS_INTEGER := AppInstance;HWnd_l PLS_INTEGER := HWnd;PosSq_l PLS_INTEGER := PosSq;x_l PLS_INTEGER := x;y_l PLS_INTEGER := y;message_l VARCHAR2(512) := message;BEGIN

    rc := i_DisplayHint(fh_DisplayHint,AppInstance_l,HWnd_l,

    PosSq_l,x_l,y_l,message_l);

    RETURN (rc);END ;

    FUNCTION on_windows RETURN BOOLEAN ISui varchar2(255);

    BEGINIF on_windows_flag IS NULL THENui := Get_Application_Property(USER_INTERFACE);

    on_windows_flag := ui ='MSWINDOWS' orui ='MSWINDOWS32' ; --19JAN96 CZ

    END IF;RETURN on_windows_flag;

    END;

    PROCEDURE sync_mouse_info ISBEGIN

    mouse_item := Name_In('SYSTEM.MOUSE_ITEM');mouse_canvas := Name_In('SYSTEM.MOUSE_CANVAS');

  • 7/27/2019 Cafa Lib.txt

    24/27

    appInst := TO_PLS_INTEGER(Get_Application_Property(APPLICATION_INSTANCE));

    IF mouse_item IS NOT NULL THENhWind := TO_PLS_INTEGER(

    Get_Item_Property(mouse_item,WINDOW_HANDLE));mouse_item_hint := Get_Item_Property(mouse_item,HINT_TEXT);IF SUBSTR(mouse_item_hint,1,1) = CHR(0) THEN

    mouse_item_hint := NULL;END IF;

    ELSEhWind := NULL;

    END IF;END;

    FUNCTION mouse_item_label RETURN VARCHAR2 IStmp VARCHAR(200) := Get_Item_Property(mouse_item,LABEL);

    BEGINIF SUBSTR(tmp,1,1) = CHR(0) THENRETURN NULL;

    ELSERETURN tmp;

    END IF;END;

    FUNCTION mouse_item_is_iconic_button RETURN BOOLEAN ISBEGINRETURN Get_Item_Property(mouse_item,ITEM_TYPE) LIKE '%BUTTON%'

    AND Get_Item_Property(mouse_item,ICON_NAME) IS NOT NULL;END;

    FUNCTION mouse_window RETURN VARCHAR2 ISBEGIN

    RETURN Get_View_Property(mouse_canvas,WINDOW_NAME);END;

    FUNCTION relative_hint_pos RETURN PLS_INTEGER ISleft NUMBER;

    right NUMBER;win VARCHAR2(80);BEGIN

    left := Get_Item_Property(mouse_item,X_POS);right := left + TO_NUMBER(Get_Item_Property(mouse_item,WIDTH));win := Get_Window_Property(mouse_window,WIDTH);IF left/win < 0.05 THENRETURN 16;

    ELSIF right/win > .95 THENRETURN -16;

    ELSERETURN 0;

    END IF;

    END;

    PROCEDURE HideButtonHelp ISt Timer := Find_Timer(BUTTONHELPTIMER);

    BEGINIF NOT on_windows THENRETURN;

    END IF;IF NOT Id_Null(t) THENDelete_Timer(t);

  • 7/27/2019 Cafa Lib.txt

    25/27

    END IF;IF hint_is_displayed THENrc := DisplayHint(NULL,NULL,7,0,0,NULL);Clear_Message;hint_is_displayed := FALSE;

    END IF;END;

    PROCEDURE ShowButtonHelp( timedelay NUMBER := 500) ISt Timer := Find_Timer(BUTTONHELPTIMER);

    BEGINIF NOT on_windows THENRETURN;

    END IF;IF NOT Id_Null(t) THENDelete_Timer(t);

    END IF;sync_mouse_info;IF mouse_item IS NOT NULL AND

    mouse_item_is_iconic_button THENIF mouse_item_label IS NOT NULL THEN

    t := Create_Timer(BUTTONHELPTIMER,timedelay,NO_REPEAT);END IF;

    ELSE

    HideButtonHelp;END IF;END;

    PROCEDURE ShowButtonHelpHandler ISt Timer := Find_Timer(BUTTONHELPTIMER);tn VARCHAR2(80) := Get_Application_Property(TIMER_NAME);

    BEGINIF NVL(tn,'x') = BUTTONHELPTIMER THENIF NOT on_windows THEN

    RETURN;END IF;IF NOT Id_Null(t) THEN

    Delete_Timer(t);END IF;if name_in('system.mouse_canvas') in ('VERT_TOOL_BAR') then

    rc := DisplayHint(appInst,HWind,7,relative_hint_pos+20,-19,mouse_item_label);

    elsif name_in('system.mouse_canvas') in ('TOOL_BLK','SAMPLE1') thenrc := DisplayHint(appInst,HWind,7,relative_hint_pos+5,-19,

    mouse_item_label);else

    rc := DisplayHint(appInst,HWind,7,relative_hint_pos+3,0,mouse_item_label);

    end if;IF mouse_item_hint IS NOT NULL THEN

    Message(mouse_item_hint,NO_ACKNOWLEDGE);END IF;hint_is_displayed := TRUE;

    END IF;END;

    BEGINIF on_windows THEN

    BEGIN

  • 7/27/2019 Cafa Lib.txt

    26/27

    IF Get_Application_Property(USER_INTERFACE) ='MSWINDOWS' THENlh_SHOWHINT := ora_ffi.find_library('SHOWHINT.DLL');

    ELSElh_SHOWHINT := ora_ffi.find_library('SHWHNT32.DLL'); --19JAN96 CZ

    END IF;

    EXCEPTION WHEN ora_ffi.FFI_ERROR THENIF Get_Application_Property(USER_INTERFACE) ='MSWINDOWS' THEN

    lh_SHOWHINT := ora_ffi.load_library(NULL, 'SHOWHINT.DLL');ELSE

    lh_SHOWHINT := ora_ffi.load_library(NULL, 'SHWHNT32.DLL'); --19JAN96CZ

    END IF;

    END ;fh_DisplayHint := ora_ffi.register_function(lh_SHOWHINT,

    'DisplayHint',ora_ffi.C_STD);ora_ffi.register_parameter(fh_DisplayHint,ORA_FFI.C_INT);ora_ffi.register_parameter(fh_DisplayHint,ORA_FFI.C_INT);ora_ffi.register_parameter(fh_DisplayHint,ORA_FFI.C_INT);ora_ffi.register_parameter(fh_DisplayHint,ORA_FFI.C_INT);ora_ffi.register_parameter(fh_DisplayHint,ORA_FFI.C_INT);ora_ffi.register_parameter(fh_DisplayHint,ORA_FFI.C_CHAR_PTR);ora_ffi.register_return(fh_DisplayHint,ORA_FFI.C_INT);

    END IF;END HINT;

    procedure messagebox(str in Varchar) isal_id Alert;Alert_no number;

    Beginal_id := Find_Alert('Alert1');if Id_Null(al_id) then

    Message('Alert Object missing call MegaSoft');Raise Form_Trigger_Failure;

    end if;change_alert_message('alert1',str);Alert_no := show_alert('alert1');

    End messagebox;

    PROCEDURE proc_help (form_name in char, col_name in char) IS

    tmpname varchar2(40);/*

    Description:This procedure is used to call the help screen.

    Usage:Form_name is the first parameter passed. This is the actual name

    of the form that is calling the Help screen.Col_name is the second parameter passed. The :system.cursor_fieldis what is passed to this paramter that is calling the Help screen.

    Modification History--------------------

    Done by : Megasoft L.L.C. (Contractor), 01/15/1999On : 01/15/1999

    Purpose : Upgraded to Forms 4.5 version (CHAR mode) as part of Server Consolidation

  • 7/27/2019 Cafa Lib.txt

    27/27

    */

    begintmpname := upper(form_name) || '.' ||substr(col_name,(instr(col_name,'.')+1))

    ;copy(TMPNAME,'global.form_column_name') ;

    -- call('$relca/ca_win_help');call_form('$relca/ca_win_help',HIDE,NO_REPLACE);erase('global.form_column_name');

    end;

    PROCEDURE window_title(win_title in char) ISBEGIN

    set_window_property('MAIN_WINDOW',title,win_title);set_window_property('MAIN_WINDOW',WINDOW_STATE,MAXIMIZE);

    END;