;;====================================================================================
;; Field VCH Optional 
;; ------------------
;; 1) Mark Voucher as Deleted 
;; 2) Restore Deleted Voucher
;;=====================================================================================
;; Show message "Voucher is Marked for Deletion. Press any key." - Voucher entry screen 
;;=====================================================================================
[#Field: VCH Optional]
  Option: Rbin VCH Delete: ##OptionalFlag and NOT ##IsRestoreMode
  Option: Rbin VCH Restore: ##OptionalFlag and ##IsRestoreMode 

[!Field: Rbin VCH Delete]
  ;;Mark voucher as deleted 
  ;;=======================
  Style: My Style
  Set as: if #Recyclebin then "Press ENTER-KEY to send this voucher to the RECYCLE-BIN." else @UseOptStr
  Skip: if #Recyclebin then No else Yes

[Style: My Style]
  Font: Verdana
  Height: 18
  Bold: Yes

[!Field: Rbin VCH Restore]
  ;;Restore the Voucher
  ;;===================

  Add: Fields: Long Prompt,fldConfirmation,SetRecyclebinFlag,SetRecyclebinField,SetOptionalFlag,SetOptionalField
  Local: Field: Long Prompt: Info: "About to RESTORE Voucher. Press ENTER-key to confirm."
  Local: Field: Long Prompt: Full Width: Yes
  Local: Field: Long Prompt: Align: Right
  Local: Field: Long Prompt: Style: My Style

[Field: SetRecyclebinFlag]
  Use: Logical field
  Type: Logical : Forced
  Modifies: RecyclebinFlag
  Set as: NOT #fldConfirmation
  Set Always: Yes                                         ;; If this is removed it does not work
  Invisible: Yes
  Skip: Yes

[Field: SetRecyclebinField]
  Use: Logical field
  Type: Logical 
  Storage: fldDeleted
  Set as: #SetRecyclebinFlag
  Set Always: Yes                                         ;; If this is removed it does not work
  Invisible: Yes
  Skip: Yes

[Field: SetOptionalFlag]
  Use: Logical field
  Type: Logical 
  Modifies: OptionalFlag
  Set as: #SetRecyclebinFlag
  Set Always: Yes                                         ;; If this is removed it does not work
  Invisible: Yes
  Skip: Yes

[Field: SetOptionalField]
  Use         : Logical Field
  Storage     : Is Optional
  Set as      : #SetOptionalFlag
  Set always  : Yes
  Invisible   : Yes
  Skip        : Yes

;;================================================
;; Modify Voucher entry screen 
;;================================================
[#Form: Voucher]
  Option: RbinVoucher: ##OptionalFlag

[!Form: RbinVoucher]
  Key: SaveVoucher

[Key: SaveVoucher]
  Key: Enter
  Action: Form Accept

[#Field: Plain VCH Date]
  Option: Rbin Plain VCH Date: ##OptionalFlag

[!Field: RBin Plain VCH Date]
  Skip: if #RecycleBin then Yes else No
