sql “表单”构建器中的确认,取消和关闭按钮

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql “表单”构建器中的确认,取消和关闭按钮相关的知识,希望对你有一定的参考价值。

declare
	v_show_alert	varchar2(100);
begin	
	if :hrs_salarytransfer_trans.status = 2 then	
		if :parameter.p_lang_id = 1 then
		  set_alert_property('commit_alr', alert_message_text, 'åá ÇäÊ ãÊÇßÏ ãä ÅÛáÇÞ ÇáÍÑßÉ¿');
		else
		  set_alert_property('commit_alr', alert_message_text, 'The Transaction Will Be Closed, Are You Sure?' );
		end if;
		v_show_alert	:= show_alert('commit_alr');
		if v_show_alert = alert_button3 then
			return;
		elsif v_show_alert = alert_button1 then
			set_block_property('hrs_salarytransfer_trans',update_allowed, property_true);
		  :hrs_salarytransfer_trans.end_date := last_day(sysdate);
		  :hrs_salarytransfer_trans.status   := 3;
		  :system.message_level := 5;
		  commit;     	              
		  :system.message_level := 0;
			if	:parameter.p_lang_id = 2 then 
				show_usr_msg('The Transaction Has Been Closed',3);
			else
				show_usr_msg('Êã ÅÛáÇÞ ÇáÍÑßÉ ÈäÌÇÍ',3);
			end if;
			---
			go_block('hrs_salarytransfer_trans');
			execute_trigger('WHEN-NEW-RECORD-INSTANCE');
		end if;     
	elsif :hrs_salarytransfer_trans.status = 1 then
		if :parameter.p_lang_id = 2 then 
			show_usr_msg('New Transaction Can Not be Closed',1);
		else
			show_usr_msg('áÇ íãßä ÅÛáÇÞ ÍÑßÉ ÛíÑ ãæÇÝÞ ÚáíåÇ',1);
		end if;		
	elsif :hrs_salarytransfer_trans.status = 4 then
		if :parameter.p_lang_id = 2 then 
			show_usr_msg('Canceled Transaction Can Not Be Closed',1);
		else
			show_usr_msg('áÇ íãßä ÅÛáÇÞ ÇáÍÑßÉ ÇáãáÛÇÉ',1);
		end if;		
	end if;	
end;
declare
	v_show_alert	varchar2(100);
	v_exists			number;
begin	
	if :hrs_salarytransfer_trans.serial_no is null or :system.record_status != 'QUERY' then
		if :parameter.p_lang_id = 2 then 
	  	show_usr_msg('Please Save The Transaction First',1);
		else
			show_usr_msg('ÇáÑÌÇÁ ÍÝÙ ÇáÍÑßÉ ÇæáÇ',1);		
		end if;  
		raise form_trigger_failure;
	end if;		
	--
	if :hrs_salarytransfer_trans.status = 1 then
		if :parameter.p_lang_id = 1 then
			set_alert_property('commit_alr', alert_message_text, 'åá ÇäÊ ãÊÇßÏ ãä ÅáÛÇÁ ÇáÍÑßÉ¿');
		else
		  set_alert_property('commit_alr', alert_message_text, 'The Transaction Will Be Canceled, Are You Sure?' );
		end if;
		v_show_alert	:= show_alert('commit_alr');
		if v_show_alert = alert_button3 then
			return;
		elsif v_show_alert = alert_button1 then	  
			set_block_property('hrs_salarytransfer_trans',update_allowed, property_true);
		  :hrs_salarytransfer_trans.status := 4;
		  :system.message_level := 5;
		  commit;     	              
		  :system.message_level := 0;
			if :parameter.p_lang_id = 2 then 
				show_usr_msg('The Transaction Has Been Canceled',3);
			else
				show_usr_msg('Êã ÅáÛÇÁ ÇáÍÑßÉ ÈäÌÇÍ',3);
			end if;
			---
			go_block('hrs_salarytransfer_trans');
			execute_trigger('WHEN-NEW-RECORD-INSTANCE');
		end if;
	elsif  :hrs_salarytransfer_trans.status = 2 then  
		select   count(1) 
		into     v_exists
		from     hrs_monthly_salary 
		where    status != 2 
		and      month   = to_number(to_char(:hrs_salarytransfer_trans.start_date,'mm')) 
		and      year    = to_number(to_char(:hrs_salarytransfer_trans.start_date,'yyyy'));
		if v_exists > 0 then 
			if :parameter.p_lang_id = 2 then 
				show_usr_msg('Cannot Cancel Confirmed Transaction On Calculated Period',1);
	  		raise Form_Trigger_Failure;
			else
				show_usr_msg('áÇ íÌæÒ ÅáÛÇÁ ÍÑßÉ ãæÇÝÞ ÚáíåÇ æ ÊÇÑíÎåÇ Ýí ÝÊÑÉ ãÍÊÓÈÉ ',1);		
				raise Form_Trigger_Failure;
			end if;
		else
			if :parameter.p_lang_id = 1 then
		  	set_alert_property('commit_alr', alert_message_text, 'åá ÇäÊ ãÊÇßÏ ãä ÅáÛÇÁ ÇáÍÑßÉ¿');
			else
		  	set_alert_property('commit_alr', alert_message_text, 'The Transaction Will Be Canceled, Are You Sure?' );
			end if;
			v_show_alert	:= show_alert('commit_alr');
			if v_show_alert = alert_button3 then
				return;
			elsif v_show_alert = alert_button1 then	  
				set_block_property('hrs_salarytransfer_trans',update_allowed, property_true);
		  	:hrs_salarytransfer_trans.status := 4;
		  	:system.message_level := 5;
		  	commit;     	              
		  	:system.message_level := 0;
				if :parameter.p_lang_id = 2 then 
					show_usr_msg('The Transaction Has Been Canceled',3);
				else
					show_usr_msg('Êã ÅáÛÇÁ ÇáÍÑßÉ ÈäÌÇÍ',3);
				end if;
				---
				go_block('hrs_salarytransfer_trans');
				execute_trigger('WHEN-NEW-RECORD-INSTANCE');
			end if;
		end if;
	elsif :hrs_salarytransfer_trans.status = 3 then
		if :parameter.p_lang_id = 2 then 
			show_usr_msg('Closed Transaction Cannot Be Canceled',1);
		else
			show_usr_msg('áÇ íãßä ÅáÛÇÁ ÍÑßÉ ãÛáÞÉ',1);
		end if;		
	end if;	
end;



	
declare
	v_show_alert	varchar2(100);
	v_status 			number;
	v_exists			number;
begin	
	if :hrs_salarytransfer_trans.serial_no is null or :system.record_status != 'QUERY' then
		if :parameter.p_lang_id = 2 then 
	  	show_usr_msg('Please Save The Transaction First',1);
		else
			show_usr_msg('ÇáÑÌÇÁ ÍÝÙ ÇáÍÑßÉ ÇæáÇ',1);		
		end if;  
		raise form_trigger_failure;
	end if;				
	--	
	if :hrs_salarytransfer_trans.status = 1 then
		select   count(1) 
		into     v_exists
		from     hrs_monthly_salary 
		where    status != 2 
		and      month   = to_number(to_char(sysdate,'mm')) 
		and      year    = to_number(to_char(sysdate,'yyyy'));
		if v_exists >= 1	then 
			if :parameter.p_lang_id = 2 then 
  			show_usr_msg('Cannot Confirm Transaction On Calculated Period',1);
    		raise Form_Trigger_Failure;
			else
				show_usr_msg('áÇ íÌæÒ ÇÚÊãÇÏ ÍÑßÉ ÊÇÑíÎåÇ Ýí ÝÊÑÉ ãÍÊÓÈÉ ',1);		
				raise Form_Trigger_Failure;
			end if;
		end if;		
		if :parameter.p_lang_id = 1 then
			set_alert_property('commit_alr', alert_message_text, 'åá ÃäÊ ãÊÇßÏ ãä ÇáãæÇÝÞÉ¿');
		else
			set_alert_property('commit_alr', alert_message_text, 'The Transaction Will Be Confirmed, Are You Sure?' );
		end if;
		v_show_alert	:= show_alert('commit_alr');
		if v_show_alert = alert_button3 then
			return;
		elsif  v_show_alert = alert_button1 then
			:hrs_salarytransfer_trans.status := 2;
      :system.message_level:= 5;
	 	  commit;     	              
	  	:system.message_level:= 0;
			if :parameter.p_lang_id = 2 then 
				show_usr_msg('The Transaction Has Been Confirmed',3);
			else
				show_usr_msg('Êã ÇáãæÇÝÞÉ Úáì ÇáÍÑßÉ ÈäÌÇÍ',3);
			end if;
			go_block('hrs_salarytransfer_trans');
			execute_trigger('WHEN-NEW-RECORD-INSTANCE');
		end if;        
	elsif :hrs_salarytransfer_trans.status = 3 then
		if :parameter.p_lang_id = 2 then 
			show_usr_msg('Closed Transaction Cannot Be Confirmed',1);
		else
			show_usr_msg('áÇ íãßä ÇáãæÇÝÞÉ Úáì ÇáÍÑßÉ ÇáãÛáÞÉ',1);
		end if;
	elsif :hrs_salarytransfer_trans.status = 4 then
		if :parameter.p_lang_id = 2 then 
			show_usr_msg('Canceled Transaction Cannot Be Confirmed',1);
		else
			show_usr_msg('áÇ íãßä ÇáãæÇÝÞÉ Úáì ÇáÍÑßÉ ÇáãáÛÇÉ',1);
		end if;		
	end if;	
end;




以上是关于sql “表单”构建器中的确认,取消和关闭按钮的主要内容,如果未能解决你的问题,请参考以下文章

MsgBox 确认退出 Access 中的表单

有状态的 Winform 和取消按钮

如何取消IDEA中有弹窗时,鼠标自动跳转到确认按钮。

动态表单构建器——建造者模式

关闭c++MFC的主窗体,先弹出对话框询问“是不是要关闭”,点击确定取消按钮进行确认。

PyQt5 closeEvent 方法