// Transactions AS01 / AS02 / AS03

// Some fields are transferred from tab "Net worth value"  
// to tab "General"


// Used InputScripts:
//
// AS_read.txt  Read data
// AS_save.txt  Save
// AS_check.txt Check
//-------------------------------------------

// All variables V[AS_*] are initialized on entry screen of transaction 

// To be sure variables are also initialized, if
// asset number has changed in case of call from lists etc.

if not V[AS_asset=&F[Asset]]
  Set V[AS_*] "" 
  Set V[AS_asset] "&F[Asset]"
endif


// Set readonly-flag for display, to allow  
// using the same InputField-commands for all transactions

if Q[Transaction=AS03]
  Set V[AS_readonly] "-readonly"
endif


// Read values first time when change or display
if Q[Transaction=AS02] or Q[Transaction=AS03]

  if not V[AS_read=X]
    Set V[AS_read] "X"
    Enter process="AS_read.txt"

    // Leave script since screen is not displayed
    Stop 

  endif

endif


// Rename tab, since only estate-fields are left
Text P[Net worth tax] "Estates"



// Tab General - display own fields
if Q[Page=General]


  // Suppress inner scrollbar 
  NoScrollBar

  // Start underneath last box
  offset G[Posting Information]+(5,0)



  box (0,0) (9,80) "Net worth value"

  pushbutton (1,78) "@0Q\Qdescription net worth value@" "=LTXTNETA"

  inputfield (1,1) "Classification key"   (1,24) size=4  name="AS_classification_key"    "&V[AS_readonly]"  techname="ANLA-VMGLI"
  Text (1,30) "&V[AS_classification_key_text]"  -border

  inputfield (2,1) "Net worth value"          (2,24) size=16 name="AS_man_value"         "&V[AS_readonly]"  -numerical   

  Box (4,1) (8,20) "Property indicator"
    radiobutton (5,2) "Property"       name="AS_property_indicator"  value="1"           "&V[AS_readonly]"
    radiobutton (6,2) "Leasing"        name="AS_property_indicator"  value="2"           "&V[AS_readonly]"
    radiobutton (7,2) "Share"          name="AS_property_indicator"  value="3"           "&V[AS_readonly]"

  Box (4,30) (8,49) "Reason for valuation"
    radiobutton (5,31) "Assessed value"  name="AS_man_reason"      value="003"           "&V[AS_readonly]" 
    radiobutton (6,31) "Rental value"    name="AS_man_reason"      value="001"           "&V[AS_readonly]"

endif


// Tab "Net worth tax", delete those fields that are on tab "General" now
if Q[Page=Net worth tax]
  del G[Net worth valuation]
  pos G[Real estate and similar rights]  (5,1)
endif



if Q[Transaction=AS01] or Q[Transaction=AS02]

  // When saving AS01/AS02 call own script
  on "/11"        process="AS_save.txt"
  on "/Menu=1,7"  process="AS_save.txt"

  // No save in pop-up, treat like /12 
  on "/3"   fcode="/12"
  on "/15"  fcode="/12"

  // On "Enter" in tab "General" check additional entries 
  if Q[Page=General]
    on Enter process="AS_check.txt"  
  endif

endif

