Deal Information From K3S-Replenish® to your PO System

Description:  Deal Information from K3S-Replenish(R) to your PO System

In the program you are developing that will read K3S approved purchase orders (files K_INTORDB header, K_INTORDD detail), you can
access the 'bill back' information by reading the K3S Deal files.
You will see two logical files against K_INTORDD giving you a choice of the sequence to populate your PO detail file. 
    K_INTORDDA if you need PO lines by your product ID sequence
    K_INTORDDB if you need PO lines by your product sequence field 
As you read a detail record in the K_INTORDD file, you'll see a field ID_DEAL. When that field is not blank, it will signal to you a deal is
active for that product, and below are the deal files. 
    K_DEALSUM Deal summary information
    K_DEALDET Deal detail information (products in deal)
    K_DEALALW Deal allowance information
File K_DEALSUM will provide the Begin and End dates for the deal.
Logical file K_DEALSUMA can be used with key DM_KEY 
    DM_COMP populate with 'A' for ABC Distributing
    DM_DEAL populate with ID_DEAL
File K_DEALALW will provide many of the values you are after for that product
Logical file K_DEALALWA can be used with DA_KEY 
    DA_COMP populate with 'A’ for ABC Distributing
    DA_LOCN populate with 'MIA' for Miami
    DA_DEAL populate with ID_DEAL
    DA_PROD populate with ID_PROD
Next you will want to READE with DA_KEY, since that product could have multiple 'bill back' allowances on the same deal.
The information you are after will be in the fields:
    DA_APPLY 'B' for 'bill back' or 'O' for 'off invoice'
    DA_FACTTYP '%' for percentage, 'D' for dollar difference, '$' for dollar value
    DA_FACTVAL contains the deal amount, either a percentage or dollar value
    DA_UNIT the cost divisor when not using '%' percentage
    DA_TYPE when DA_APPLY is 'B' for 'bill back', this will have your 3 types of '01 Advertising' or '02 Merchandising' or '03 Slotting'
The K3S deal files are time phased, with a Begin and End date.

Physical file – K_DEALPER for permanent deal information 

K3S also contains a file called K_DEALPER where Permanent Deals can be stored. These would remain in the file until a user removes them.
K3S customers can re-populate this file from their own database, or enter permanent deals through the K3S screens.

    DR_COMP        1          COLHDG('Company' 'ID')           
    DR_LOCN        5          COLHDG('Location' 'ID')          
    DR_SUPL       10          COLHDG('Supplier' 'ID')          
    DR_SUPLSUB    10          COLHDG('Sub' 'supplier' 'ID')    
    DR_PROD       25          COLHDG('Product' 'ID')           
    DR_BIRTH        L         COLHDG('Perm' 'deal' 'birth')    
    DR_LASTUPD      L         COLHDG('Perm' 'deal' 'last')     
    DR_MEMO       15          COLHDG('Memo')                   
    DR_PERMTYP     2          COLHDG('Permanent' 'type')       
    DR_TYPE        2          COLHDG('Deal' 'type')            
    DR_APPLY       1          COLHDG('Bill/Off/Auto' 'code')   
    DR_FACTTYP     1          COLHDG('Factor' 'type' '$,D,%')  
    DR_FACTVAL     9  4       COLHDG('Factor' 'value')         
    DR_UNIT        5  0       COLHDG('Unit for' 'dollars')     

Field explanations:

DR_COMP        1          COLHDG('Company' 'ID') 
This 1 character value is used throughout the K3S-Replenish system to identify the company being processed.
Examples:     B for Bindley Western
                J for JT Davenport   
                D for Dimmick Auto    

DR_LOCN        5          COLHDG('Location' 'ID')

     This 5 character value is used to identify the distribution center where this product is being replenished.
        Examples:     Loc ID   Location name

                        01      Charlotte, NC
                        02      Raleigh, NC
                        001     Columbia, SC
                        002     New York, NY 
                        TEX01   Houston, TX
                        TEX02   Dallas, TX

 DR_SUPL      10          COLHDG('Supplier' 'ID')

     This value contains the product’s regular supplier ID. 
        Examples:         Supplier ID      Supplier Name
                        ABCDEFGHIJ       ABC Company
                        00010            Wizzard Mfg

DR_SUPLSUB    10          COLHDG('Sub' 'supplier' 'ID')  
    This value will allow a supplier to be sub-divided into separate sections for review purposes. Leave this value blank if all products are
    to be reviewed together.

        Examples:      Supplier ID   Sub ID   Supplier Name
                       ABCDEFGHIJ    FROZEN   ABC Company A -Frozen   
                       ABCDEFGHIJ    FRIDGE   ABC Company B -Fridge
                       ABCDEFGHIJ    DRY      ABC Company C -Dry
                       00010         PINTS    Wizzard Mfg 3 -Pints
                       00010         QUARTS   Wizzard Mfg 2 -Quarts
                       00010         GALLONS  Wizzard Mfg 1 -Gallons

DR_PROD       25          COLHDG('Product' 'ID')
    This value contains the product ID.

        Examples:   Product ID          Product description 
                    200578              Dial soap
                    397346              Tooth paste
                    ABC-10/XYZ.047      Wrench
                    BCI*984/1Z497       Screw Driver

DR_BIRTH         L        COLHDG('Daily' 'trans' 'birth')
This value contains an *ISO date for the day this record was created.

        Examples: *ISO Birth date


DR_LASTUPD       L         COLHDG('Daily' 'trans' 'last')         
    This value contains an *ISO date for the day this record was last updated. It will contain the same value as the field IP_BIRTH.

DR_MEMO       15           COLHDG('Memo')
    This field represents a place for the user to enter a memo to describe the permanent deal.  

DR_PERMTYP     2           COLHDG('Permanent' 'type')       

        L1 Location – all products
            Type L1 will apply the deal to all products at a specified location. 
        P1 Product  - all locations
            Type P1 will apply the deal to a specified product at all locations.
        P2 Product  - this location
            Type P2 will apply the deal to a specified product at a specific location.
        S1 Supplier – all locations
            Type S1 will apply the deal to a specified supplier at all locations.
        S2 Supplier – this location
            Type S2 will apply the deal to a specified supplier at specified location. 

DR_TYPE        2           COLHDG('Deal' 'type') 
    There are several deal allowance types to choose from.  See types below:

       AD    Advertising                  OT Other                    
       BA    Buying allowance             PI Price increase
       BB    Billback supplier            PR Promotional 
       DS    Display                      QD Quantity discount                
       HA    Handling                     OI Off invoice
       ND    New distribution                     

 DR_APPLY            1                        COLHDG('Bill/Off/Auto' 'code')   

This value is the deal application type; it tells you how the deal is to be applied.  There are four choices:
       A      Automatic                                            
       B      Bill back                                            
       O      Off invoice                                          
       P      Price increase       

DR_FACTTYP         1                        COLHDG('Factor' 'type' '$,D,%')  

    The factor type defines how the value in field DR_FACTVAL is to be processed.

        $ - the entry is the actual deal value
        D – the entry is the actual difference from regular
        % - the entry is a percentage value

DR_FACTVAL          9  4                    COLHDG('Factor' 'value')

    The factor value is the deal amount, described by DR_FACTTYP.
DR_UNIT                  5  0                    COLHDG('Unit for' 'dollars')      
    The unit field works with the field DR_FACTVAL when it is a dollar value, and not a percentage value.
        Example: $2.50 per 12