PROCEDURE PRC_SEARCH IS
V_WHERE varchar2(4000);
BEGIN
V_WHERE := 'COMPANY_NO=:GLOBAL.G_COMPANY_NO';
IF :CTRL_SEARCH.SLOT_GROUP IS NOT NULL THEN
V_WHERE := V_WHERE||' AND SLOT_GROUP = :CTRL_SEARCH.SLOT_GROUP';
END IF;
IF :CTRL_SEARCH.SURGERY_NAME IS NOT NULL THEN
V_WHERE := V_WHERE||' AND SURGERY_NO IN (SELECT PROCEDURE_ID FROM OT_PROCEDURE WHERE UPPER(PROCEDURE_NAME) LIKE ''%'||UPPER(:CTRL_SEARCH.SURGERY_NAME)||'%'')';
END IF;
IF :CTRL_SEARCH.PRIORITY IS NOT NULL THEN
V_WHERE := V_WHERE||' AND UPPER(PRIORITY) LIKE ''%''||UPPER(:CTRL_SEARCH.PRIORITY)||''%''';
END IF;
IF :CTRL_SEARCH.PRIORITY IS NULL THEN
V_WHERE := V_WHERE ;
END IF;
IF :CTRL_SEARCH.REG_NO IS NOT NULL THEN
V_WHERE := V_WHERE||' AND REG_NO = :CTRL_SEARCH.REG_NO';
END IF;
IF :CTRL_SEARCH.ADMISSION_NO IS NOT NULL THEN
V_WHERE := V_WHERE||' AND ADMISSION_NO = :CTRL_SEARCH.ADMISSION_NO';
END IF;
IF :CTRL_SEARCH.CONSULT_NO IS NOT NULL THEN
V_WHERE := V_WHERE||' AND CONSULT_NO = :CTRL_SEARCH.CONSULT_NO';
END IF;
SET_BLOCK_PROPERTY('OT_BOOKINGMST',DEFAULT_WHERE,V_WHERE ||' AND BILL_FLAG ='||'''Y''' );
GO_BLOCK('OT_BOOKINGMST');
CLEAR_BLOCK(NO_VALIDATE);
:SYSTEM.MESSAGE_LEVEL :=5;
EXECUTE_QUERY;
:SYSTEM.MESSAGE_LEVEL :=0;
END;
ANOTHER WORKABLE CONDITION:
Set_Block_Property('OT_BOOKINGMST',DEFAULT_WHERE, 'BILL_FLAG ='''||'Y'||''' and '||'SURGERY_DATE>='''||to_date(sysdate)||'''');
V_WHERE varchar2(4000);
BEGIN
V_WHERE := 'COMPANY_NO=:GLOBAL.G_COMPANY_NO';
IF :CTRL_SEARCH.SLOT_GROUP IS NOT NULL THEN
V_WHERE := V_WHERE||' AND SLOT_GROUP = :CTRL_SEARCH.SLOT_GROUP';
END IF;
IF :CTRL_SEARCH.SURGERY_NAME IS NOT NULL THEN
V_WHERE := V_WHERE||' AND SURGERY_NO IN (SELECT PROCEDURE_ID FROM OT_PROCEDURE WHERE UPPER(PROCEDURE_NAME) LIKE ''%'||UPPER(:CTRL_SEARCH.SURGERY_NAME)||'%'')';
END IF;
IF :CTRL_SEARCH.PRIORITY IS NOT NULL THEN
V_WHERE := V_WHERE||' AND UPPER(PRIORITY) LIKE ''%''||UPPER(:CTRL_SEARCH.PRIORITY)||''%''';
END IF;
IF :CTRL_SEARCH.PRIORITY IS NULL THEN
V_WHERE := V_WHERE ;
END IF;
IF :CTRL_SEARCH.REG_NO IS NOT NULL THEN
V_WHERE := V_WHERE||' AND REG_NO = :CTRL_SEARCH.REG_NO';
END IF;
IF :CTRL_SEARCH.ADMISSION_NO IS NOT NULL THEN
V_WHERE := V_WHERE||' AND ADMISSION_NO = :CTRL_SEARCH.ADMISSION_NO';
END IF;
IF :CTRL_SEARCH.CONSULT_NO IS NOT NULL THEN
V_WHERE := V_WHERE||' AND CONSULT_NO = :CTRL_SEARCH.CONSULT_NO';
END IF;
SET_BLOCK_PROPERTY('OT_BOOKINGMST',DEFAULT_WHERE,V_WHERE ||' AND BILL_FLAG ='||'''Y''' );
GO_BLOCK('OT_BOOKINGMST');
CLEAR_BLOCK(NO_VALIDATE);
:SYSTEM.MESSAGE_LEVEL :=5;
EXECUTE_QUERY;
:SYSTEM.MESSAGE_LEVEL :=0;
END;
ANOTHER WORKABLE CONDITION:
Set_Block_Property('OT_BOOKINGMST',DEFAULT_WHERE, 'BILL_FLAG ='''||'Y'||''' and '||'SURGERY_DATE>='''||to_date(sysdate)||'''');
0 comments:
Post a Comment