Module INVT.DD

     1//DDB-FileStart
     2//DDB-HeaderStart
     3
     4// File Name : INVT.DD
     5// Class Name: Invt_DataDictionary
     6// Revision  : 4
     7
     8Use  Windows           // Basic Definitions
     9Use  DataDict          // DataDictionary Class Definition
    10Use  DDvalTbl          // Validation Table Class Definitions
    11
    12Open Invt
    13Open Orderdtl
    14Open Vendor
    15
    16//DDB-HeaderEnd
    17//DDB-SelectionStart
    18//DDB/ ExternalSelectionList Invt_sl  Invt.sl
    19Register_Object Invt_sl
    20//DDB-SelectionEnd
    21
    22Class Invt_DataDictionary is a DataDictionary
    23
    24    Procedure Define_Fields
    25        Forward Send Define_Fields
    26        //DDB-DefineFieldStart
    27
    28        Set Main_File            To Invt.File_Number
    29        Set Cascade_Delete_State To FALSE
    30
    31        Set Foreign_Field_Options  DD_KEYFIELD   To DD_FINDREQ
    32        Set Foreign_Field_Options  DD_INDEXFIELD To DD_NOPUT
    33        Set Foreign_Field_Options  DD_DEFAULT    To DD_DISPLAYONLY
    34
    35        // Child (Client) file structure................
    36        Send Add_Client_File  Orderdtl.File_Number
    37
    38        // Parent (Server) file structure...............
    39        Send Add_Server_File  Vendor.File_Number
    40
    41        // Field-based properties.......................
    42
    43        // Invt.Item_Id
    44        Set Field_Label_Long       Field Invt.Item_Id             To "Invt. Item ID"
    45        Set Field_Label_Short      Field Invt.Item_Id             To "Item ID"
    46        Set Field_Options          Field Invt.Item_Id             To DD_AUTOFIND    DD_CAPSLOCK
    47        Set Field_Prompt_Object    Field Invt.Item_Id             To (Invt_sl(self))
    48        Set Key_Field_State        Field Invt.Item_Id             To TRUE
    49        Set Status_Help            Field Invt.Item_Id             To "Inventory Item Id - user defined identification"
    50
    51        // Invt.Description
    52        Set Field_Label_Long       Field Invt.Description         To "Invt. Description"
    53        Set Field_Label_Short      Field Invt.Description         To "Description"
    54        Set Status_Help            Field Invt.Description         To "Inventory Part Desription"
    55
    56        // Invt.Vendor_Id
    57        Set Field_Options          Field Invt.Vendor_Id           To DD_CAPSLOCK
    58        Set Status_Help            Field Invt.Vendor_Id           To "Vendor Number"
    59
    60        // Invt.Vendor_Part_Id
    61        Set Status_Help            Field Invt.Vendor_Part_Id      To "Vendor ID name for this item"
    62
    63        // Invt.Unit_Price
    64        Set Field_Mask_Type        Field Invt.Unit_Price          To MASK_CURRENCY_WINDOW
    65        Set Field_Value_Range      Field Invt.Unit_Price          To 0 999999.99
    66        Set Status_Help            Field Invt.Unit_Price          To "Retail unit price"
    67
    68        // Invt.On_Hand
    69        //DDB/ Comment_Short       Field Invt.On_Hand             To "This is adjusted by the OrderDtl DD"
    70        Set Field_Value_Range      Field Invt.On_Hand             To -999999 999999
    71        Set Status_Help            Field Invt.On_Hand             To "Units currently available"
    72
    73        //DDB-DefineFieldEnd
    74    End_Procedure  //  Define_Fields
    75
    76  Function Validate_Save Returns integer
    77    Integer rVal
    78
    79    Forward Get Validate_Save to rVal
    80    If rval Function_return rval
    81
    82    If Invt.On_Hand lt 0 Begin
    83       Error 300 "Insufficient Inventory stock"
    84       Function_return 1
    85    end
    86  End_function  // validate_save
    87
    88
    89    // Field_Defaults:
    90    // This procedure is used to establish default field values.
    91
    92    Procedure Field_Defaults
    93        Forward Send Field_Defaults
    94        //DDB-FieldDefaultStart
    95        //DDB-FieldDefaultEnd
    96    End_Procedure    // Field_Defaults
    97End_Class    //  Invt_DataDictionary
    98
    99//DDB-Selection-pkg-Start
   100Use Invt.sl          // Invt_sl
   101//DDB-Selection-pkg-End
   102//DDB-FileEnd
   103