Module Invt.DD

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