The Orders Form

The form specification file orderform.per defines a form for the orders program, and displays fields containing the values of a single order from the orders table. The name of the store is retrieved from the customer table, using the column store_num, and displayed.

A screen array displays the associated rows from the items table. Although order_num is also one of the fields in the items table, it does not have to be included in the screen array or in the screen record, since the order number will be the same for all the items displayed for a given order. For each item displayed in the screen array, the values in the description and unit columns from the stock table are also displayed.

The values in FORMONLY fields are not retrieved from a database; they are calculated by the BDL program based on the entries in other fields. In this form FORMONLY fields are used to display the calculations made by the BDL program for item line totals and the order total. Their data type is defined as DECIMAL.

This form uses some of the attributes that can be assigned to fields in a form. See the ATTRIBUTES section in the Genero Business Development Language User Guide for a complete list of the available attributes.

The form defines a toolbar and a topmenu. The decoration of toolbar or topmenu action views is centralized in an ACTION DEFAULTS section.

Form orderform.per:
001 SCHEMA custdemo 
002 
003 ACTION DEFAULTS
004   ACTION find (TEXT="Find", IMAGE="find",
 COMMENT="Query database")
005   ACTION new (TEXT="New", IMAGE="new",
 COMMENT="New order")
006   ACTION save (TEXT="Save", IMAGE="disk",
 COMMENT="Check and save order info")
007   ACTION append (TEXT="Line", IMAGE="new",
 COMMENT="New order line")
008   ACTION delete (TEXT="Del", IMAGE="eraser",
 COMMENT="Delete current order line")
009   ACTION first (TEXT="First",
 COMMENT="Move to first order in list")
010   ACTION previous (TEXT="Prev",
 COMMENT="Move to previous order in list")
011   ACTION next (TEXT="Next",
 COMMENT="Move to next order in list")
012   ACTION last (TEXT="Last",
 COMMENT="Move to last order in list")
013   ACTION quit (TEXT="Quit",
 COMMENT="Exit the program", IMAGE="quit")
014 END
015
016 TOPMENU
017   GROUP ord (TEXT="Orders")
018     COMMAND find 
019     COMMAND new 
020     COMMAND save 
021     SEPARATOR
022      COMMAND quit 
023   END
024   GROUP ord (TEXT="Items")
025     COMMAND append 
026     COMMAND delete 
027   END
028   GROUP navi (TEXT="Navigation")
029     COMMAND first 
030     COMMAND previous 
031     COMMAND next 
032     COMMAND last 
033   END
034   GROUP help (TEXT="Help")
035     COMMAND about (TEXT="About")
036   END
037 END
038
039 TOOLBAR
040   ITEM find 
041   ITEM new 
042   ITEM save 
043   SEPARATOR
044   ITEM append 
045   ITEM delete 
046   SEPARATOR
047   ITEM first 
048   ITEM previous 
049   ITEM next 
050   ITEM last 
051   SEPARATOR
052   ITEM quit 
053 END
054 
055 LAYOUT 
056 VBOX
057 GROUP
058 GRID
059 {
060   Store #:[f01  ] [f02                                          ]
061   Order #:[f03  ]  Order Date:[f04         ] Ship By:[f06       ]
062   Factory:[f05  ]             [f07                              ]
063                                      Order Total:[f14           ]
064 }
065 END
066 END -- GROUP
067 TABLE
068 {
069  Stock#  Description       Qty     Unit    Price       Total 
070 [f08    |f09              |f10    |f11    |f12        |f13      ]
071 [f08    |f09              |f10    |f11    |f12        |f13      ]
072 [f08    |f09              |f10    |f11    |f12        |f13      ]
073 [f08    |f09              |f10    |f11    |f12        |f13      ]
074 }
075 END
076 END
077 END
078 
079 TABLES
080   customer, orders, items, stock 
081 END
082 
083 ATTRIBUTES
084  BUTTONEDIT f01 = orders.store_num, REQUIRED, ACTION=zoom1;
085  EDIT       f02 = customer.store_name, NOENTRY;
086  EDIT       f03 = orders.order_num, NOENTRY;
087  DATEEDIT   f04 = orders.order_date;
088  EDIT       f05 = orders.fac_code, UPSHIFT;
089  EDIT       f06 = orders.ship_instr;
090  CHECKBOX   f07 = orders.promo, TEXT="Promotional",
091                  VALUEUNCHECKED="N", VALUECHECKED="Y";
092  BUTTONEDIT f08 = items.stock_num, REQUIRED, ACTION=zoom2;
093  LABEL      f09 = stock.description;
094  EDIT       f10 = items.quantity, REQUIRED;
095  LABEL      f11 = stock.unit;
096  LABEL      f12 = items.price;
097  LABEL      f13 = formonly.line_total TYPE DECIMAL(9,2);
098  EDIT       f14 = formonly.order_total TYPE DECIMAL(9,2), NOENTRY;
099 END
100 
101 INSTRUCTIONS
102 SCREEN RECORD sa_items(
103   items.stock_num,
104   stock.description,
105   items.quantity,
106   stock.unit,
107   items.price,
108   line_total 
109 )
110 END
Note: