Home » Developer & Programmer » Forms » CALCULATION (FORMS 6I)
CALCULATION [message #347925] Mon, 15 September 2008 01:48 Go to next message
sajidrazmi
Messages: 47
Registered: August 2008
Location: oman
Member
Hi Dear All
i have Written These Code into Block_level(When-Mouse_click) Trigger In This The Calculation is comming Properly
But I Want When Block Wakeup Data came Automatic Without Clicking The mouse So Which Trigger I have to Use?
When I use
When-Validate_Record or When-Validate_Item Trigger it Give error FRM-40737(Illegal Restricted Procedure)
But when I use When-Mouse-Click There Is No Error And all Calculation Is comming Properly

DECLARE 
TEMPM VARCHAR2 (12);
MOR_H NUMBER;
MOR_S NUMBER;
M_MIN NUMBER;
R_TEMPS NUMBER;
ETEMPM VARCHAR2(12);
E_MIN NUMBER;
EVEN_H NUMBER;
EVEN_S NUMBER;
TOTHRS_M NUMBER;
TOTHRS_H NUMBER;
TOTHRS_S NUMBER;
R_S NUMBER;

    	BEGIN
		BEGIN
			IF  NVL(:BLK_TAS_TEMP.TAS_TEMP_STATUS,'P') <> 'A'THEN
				TEMPM:=(TO_DATE(NVL(:BLK_TAS_TEMP.TAS_TEMP_LUNCH_OUT,'01:00 PM'),'HH:MI AM')-TO_DATE(NVL(:BLK_TAS_TEMP.TAS_TEMP_MORNING_IN,'08:00 AM'),'HH:MI AM'))*24*60 ;
				 M_MIN:=TO_NUMBER(TEMPM);
				 MOR_H:= TRUNC(NVL(M_MIN,'0') /60);
				 MOR_S:=(NVL(M_MIN,'0') / 60 - TRUNC(NVL(M_MIN,'0') / 60)) * 60;
				 R_TEMPS:=ROUND(NVL(MOR_S,0),2);					 
				 :BLK_TAS_TEMP.TAS_TEMP_TOT_MORNING := (TO_CHAR(NVL(MOR_H,'0'),'')||':'||TO_CHAR(NVL(R_TEMPS,'0'),''));
			ELSE
				:BLK_TAS_TEMP.TAS_TEMP_TOT_MORNING:=NULL;
			END IF;
			IF :BLK_TAS_TEMP.TAS_TEMP_EMP_CODE IS NULL THEN
			   :BLK_TAS_TEMP.TAS_TEMP_TOT_MORNING:=NULL;
			END IF;
			KEY_NEXT_ITEM;
			EXCEPTION WHEN OTHERS THEN
			MESSAGE (SQLERRM);
		END;
							
		BEGIN		
			IF 	NVL(:BLK_TAS_TEMP.TAS_TEMP_STATUS,'P') = 'P'THEN
				ETEMPM:=(TO_DATE(NVL(:BLK_TAS_TEMP.TAS_TEMP_EVENING_OUT,'06:00 PM'),'HH:MI AM')-TO_DATE(NVL(:BLK_TAS_TEMP.TAS_TEMP_POST_LUNCH_IN,'02:00 PM'),'HH:MI AM'))*24*60 ;
				E_MIN:=TO_NUMBER(ETEMPM);
				EVEN_H:= TRUNC(NVL(E_MIN,0) /60);
				EVEN_S:=(NVL(E_MIN,0) / 60 - TRUNC(NVL(E_MIN,0) / 60)) * 60;
				R_TEMPS:=ROUND(NVL(EVEN_S,0),2);
				:BLK_TAS_TEMP.TAS_TEMP_TOT_EVENING :=(TO_CHAR(NVL(EVEN_H,'0'),'')||':'||TO_CHAR(NVL(R_TEMPS,'0'),'')); 
                       ELSE
				:BLK_TAS_TEMP.TAS_TEMP_TOT_EVENING:=NULL;
		       END IF;
		       IF :BLK_TAS_TEMP.TAS_TEMP_EMP_CODE IS NULL THEN
			  :BLK_TAS_TEMP.TAS_TEMP_TOT_EVENING:=NULL;
		       END IF;
			NEXT_ITEM	;
			EXCEPTION WHEN OTHERS THEN
			MESSAGE (SQLERRM);
		END;
								
		BEGIN
			TOTHRS_M:=NVL(M_MIN,0)+NVL(E_MIN,0);
			TOTHRS_H:= TRUNC(NVL(TOTHRS_M,0) /60);
			TOTHRS_S:=(NVL(TOTHRS_M,0) / 60 - TRUNC(NVL(TOTHRS_M,0) / 60)) * 60;
			R_S:=ROUND(NVL(TOTHRS_S,0),2);
			:BLK_TAS_TEMP.TAS_TEMP_TOT_HRS :=(TO_CHAR(NVL(TOTHRS_H,'0'),'')||':'||TO_CHAR(NVL(R_S,'0'),''));
			IF	NVL(:BLK_TAS_TEMP.TAS_TEMP_STATUS,'A') = 'A'THEN
			        :BLK_TAS_TEMP.TAS_TEMP_TOT_HRS:=NULL;
			END IF;	
			IF 	:BLK_TAS_TEMP.TAS_TEMP_EMP_CODE IS NULL THEN
				:BLK_TAS_TEMP.TAS_TEMP_TOT_HRS:=NULL;
			END IF;
			NEXT_ITEM;
			EXCEPTION WHEN OTHERS THEN
			MESSAGE (SQLERRM);
			END;
			
		
	END;

[Updated on: Mon, 15 September 2008 01:53]

Report message to a moderator

Re: CALCULATION [message #347943 is a reply to message #347925] Mon, 15 September 2008 02:37 Go to previous messageGo to next message
sajidrazmi
Messages: 47
Registered: August 2008
Location: oman
Member
I Have Solve My Problem.
Re: CALCULATION [message #347947 is a reply to message #347943] Mon, 15 September 2008 02:52 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Pity you didn't solve your formatting at the same time.

David
Previous Topic: CANNOT START ANOTHER CALL FORM error
Next Topic: calculate items outside database
Goto Forum:
  


Current Time: Wed Dec 07 22:19:53 CST 2016

Total time taken to generate the page: 0.05650 seconds