--===========================================================================
-- Copywright 2002:  joel crainshaw & chet  west
--============================================================================
--
--DBLENTRY.fmb
--	generic form to require user to enter field data twice
--	similar to password change validation
--
--	requirements:
--		button or other trigger field on calling form
--		when-button-pressed code example is in this zip
--
--	defaults to Alpha-Numeric, Fixed-length 20 characters.
--============================================================================
-- MODIFICATION HISTORY
-- Person      Date       Comments
-- ---------   ---------- -------------------------------------------
-- joel        03/15/2001 Initial Creation
--============================================================================

DECLARE
  pl_id        PARAMLIST;
  theformname  VARCHAR2(20);
  old_accountnumber varchar2(80) := nvl(:clients.account_number,'-999');
BEGIN
  theformname := 'DBLENTRY';

  pl_id := Get_Parameter_List('DBLENTRY');
  IF NOT Id_Null(pl_id) THEN 
    Destroy_Parameter_List(pl_id); 
  END IF; 

	-------------------
	-- P_DATATYPE, char 20, default = FX
	-- 		V = variable length
	-- 		F = fixed length
	--
	-- 		X = alpha-num
	-- 		A = alpha
	-- 		N = number
	--
	-- 		EX:  VN = variable length, number
        --              valid data types
        --              FX-- fixed alpha-num
        --              VX-- var alpha-num
        --              FA-- fixed alpha
        --              VA-- var alpha
        --              FN-- fixed num
        --              VN-- var num
        --
	-- P_FIELDNAME, char 80, default = UNKNOWN
	--		name of field for display purposes
	-- P_LENGTH, number, default = 20
	--		maximum field length
	-- 
	-- passes back  :global.dbl_value
	--  :global.dbl_value is null if form is cancelled or on error
	--  :global.dbl_value = validated double-entry value
	-- 
	--------------------

	pl_id := Create_Parameter_List('DBLENTRY');
  Add_Parameter(pl_id,'p_fieldname',TEXT_PARAMETER,'Bank Account Number'); 
  Add_Parameter(pl_id,'p_length',TEXT_PARAMETER,'17');
  Add_Parameter(pl_id,'p_datatype',TEXT_PARAMETER,'VN');  

  CALL_FORM(theformname,no_hide,no_replace,no_query_only,pl_id);
  
  if :global.dbl_value is not null then
  	if old_accountnumber != :global.dbl_value then
  		:clients.account_number := :global.dbl_value;
  	end if;
  end if;
END;