F4072CalculatePriceAdjustments

F4072 Calculate Price Adjustments

Major Business Rule

Object Name: B4500050

Parent DLL: CDIST

Location: Client/Server

Language: C



Functional Description


Purpose


To locate, calculate and apply special pricing adjustments to items sold during Sales Order 

Processing.



Setup Notes and Prerequisites


None.


Special Logic


When using this function in the grid to return a pointer multiple times pass the pointer in to the 

function rather than freeing memory each call.



Technical Specification


Related Tables 


Table Table Description


F4070Price Adjustment Schedule

F4072Price Adjustment Detail

F40UI74Adjustment Work File

F4071Price Adjustment Type




Related Business Functions


Source NameFunction Name


B4200800.CPricing Search Functions

Get Pricing Pref Hierarchy

Load Price Key by Preference

B4200800.C


Processing 


Preprocessing Setup


1.If A simple 'trade discount' calculation is desired (TRDC-parm <> 0), 

Calculate the discount:

UPRC-parm = 1-(TRDC / 100 ) *UPRC-parm

FUP-parm = 1-(TRDC / 100 ) *FUP-parm

Exit Program

end


2.If    The price effective date is zero (SDPEFJ), advanced pricing can not occur.

Pricing will occur at some future date.

Assign '1' to the temporary price flag (SDTPC).

This flag identifies lines which have not been processed by Advanced

Pricing.  Exit program.

end


3. HOUSEKEEPING - Initialize Variables


Advance the Revision Level if the parameter indicates to do so
If EV04 is equal to '1'

Add 1 to the Revision Level AREV-parm

end


Reset the 'Detached' adjustment flag

Detach_Flag = '1'


4.Adjustment location is dependent on the Unit of Measure within an order.  There

are three different Units of Measure associated with a sold item:  Transaction

(the measurement of product shipped, e.g. boxes sent on a truck), Pricing (the

measurement used to display the 'price per unit', e.g. the user wishes to see the

price per Each regardless of the form in which the goods are shipped - boxes,

cases, etc.), and Primary (the minimum unit stored in the warehouse, e.g. the

smallest amount we can sell is Each, or Pair).


The pricing system will use up to two of these measures when searching for adjustments.  The pricing 

administrator may specify any one of the three measures to use for locating price adjustments.  If the 

selected unit of measure fails to locate a record the system will attempt a second search with the 

Primary Unit of Measure (unless the administrator selected Primary Unit of Measure for the first search 

attempt).


The initial search Unit of Measure is specified in the General Constants file (F4009).

Get 'Sales Price Retrieval UOM'(UMB1) from system constants (F4009).

if UMB1 = ' '

Search UOM1-dwf = Primary UOM (SDUOM1)

Search UOM2-dwf = Not needed

if UMB1 = '1'

Search UOM1-dwf = Transaction UOM (SDUOM)

Search UOM2-dwf = Primary UOM(SDUOM1)

if UMB1 = '2'

Search UOM1-dwf = Pricing UOM(SDUOM4)

Search UOM2-dwf = Primary UOM(SDUOM1)


When searching for adjustments the server will attempt to locate a record with Search UOM1 first.

If a record is not found, the server will make a second attempt with Search UOM2 (unless Search 

UOM1-dwf and Search UOM2-dwf are the same).




Data Structure

D4500050 - F4072 Calculate Price Adjustment





Special Input Expected


Parameters:


Data Item Data Structure Description I/O RequiredNotes


CTID      Computer ID                    I   Y

JOBS      Job Number                   I/O   N      Will assign one if not

                                                            passed and return it

XLIN      Line Number                    I   N      Will use LNID from

                                                            F4211 if not passed

AREV      Revision Level             I/O   Y

ASN      szPriceAdjustmentSchedule  I   Y

CRCD      szCurrencyCodeFrom        I   Y      Domestic

CRDC      szCurrencyCodeTo              I   Y      Foreign

UPRC      mnAmtPricePerUnit             I/O   Y      Unit Price(in

                                                            domestic)

FUP      mnAmtForPricePerUnit       I/O      Unit Price (in

                                                            foreign)

MODE      Processing Mode              I   Y      1 = Sales

                                                            2 = Called by Check

                                                                Price

                                                            3 = Purchasing

OLVL      cAdjustmentLevel              I    N      1 = Line

                                                            2 = Basket

                                                            3 = Order

QTY      mnOrderQuantity              I    Y

EV01      cProcessFreeGoods              I   N      1 = Yes; 2 = No

TRDC      mnDiscountTrade              I   N

GENLNG Pointer to Order Detail

            (F4211)                        I/O   Y

GENLNGPointer to Item/Branch

            record (F4102)              I   Y

EV03      cSuppressErrorMessage        I   N       1 = Suppress error

                                                                 message

EV04      cIncrementAdjLevel        I        1 = Yes

EV05      cSuppressWorkfileWriteFlag  I   N       '1' = Don't write to

                                                                   F40UI74

                                                             ' ' = Write to

                                                                   F40UI74


Special Output Returned


Parameters:


Data Item Data Structure Description I/ORequiredNotes


JOBS      Job Number                   I/O   N      Will assign one if not

                                                            passed and return it

AREV      Revision Level             I/O   Y

UPRC      mnAmtPricePerUnit             I/O   Y      Unit Price(in

                                                            domestic)

FUP      mnAmtForPricePerUnit       I/O      Unit Price (in

                                                            foreign)


EV02      First Adjustment was Override

            flag                          O      1 = True; 0 = False

GENLNG Pointer to Order Detail

            (F4211)                        I/O   Y

DTAI      szErrorMessageID              O

UPRC      mnDetachedPrice              O       Domestic sum of

                                                             Detached Adjustments

FUP      mnDetachedForPrice        O       Foreign sum of

                                                             Detached Adjustments



^

Parameter NameData ItemData TypeReq/OptI/O/Both
szComputerIDCTIDcharNONENONE

mnJobNoJOBSMATH_NUMERICNONENONE

The job number (work station ID) which executed the particular job.

mnSOWorkFileLineNoXLINMATH_NUMERICNONENONE

Line number.

szPriceAdjScheduleASNcharNONENONE

A user defined code (40/AS) that identifies a price and adjustment schedule. A price and adjustment schedule contains one or more 
adjustment types for which a customer or an item might be eligible. The system applies the adjustments in the sequence that you specify in the 
schedule. You link customers to a price and adjustment schedule through the customer billing instructions. When you enter a sales order, the 
system copies the schedule attached to the sold to address into the order header. You can override this schedule at the detail line level. For 
Agreement Management, this is the Agreement Penalty Schedule. The information in the Agreement Penalty Schedule provides the system 
with the criteria for an agreement to have penalty conditions.

szCurrencyCodeFromCRCDcharNONENONE

A code that identifies the currency of a transaction. 

szCurrencyCodeToCRDCcharNONENONE

A code that identifies the domestic (base) currency of the company on a transaction. 

mnUnitPriceUPRCMATH_NUMERICNONENONE

The list or base price to be charged for one unit of this item. In sales order entry, all prices must be set up in the Item Base Price File table 
(F4106).

mnForeignUnitPriceFUPMATH_NUMERICNONENONE

The foreign price per unit.

cProcessingModeMODEcharNONENONE

The processing mode used in Purchase Order Consolidator to signify when specific orders are being processed.

cAdjustmentLevelOLVLcharNONENONE

A code that specifies the level at which the system calculates price adjustments. Valid values are: 1 Line level - The system calculates the 
adjustment based on information in the sales order detail line. 2    Basket level - The system calculates the adjustment based on information 
accumulated from all sales order detail lines that you have identified as a basket pricing group. You define the basket reprice group on the 
Additional Information tab on the Item Branch Information form in the Item branch program (P41026). If you are defining a basket or order level 
adjustment, leave the Item Group and Order Detail Group fields blank.  3 Order level - The system calculates the adjustment based on 
information accumulated from all the sales order detail lines you have identified as an order pricing group. You define the order reprice group on the 
Additional Information tab on the Item Branch Information form in the Item branch program. If you are defining a basket or order level 
adjustment, leave the Item Group and Order Detail Group fields blank.  4 Volume incentive level - The system calculates the adjustment based on the 
accumulated value of multiple sales orders. The accumulated value is based on how you define the adjustment in the Price Adjustment 
Type program (P4071). If you are working with the Agreement Management system, for Agreement Penalty Schedules, enter 1 to calculate the 
penalty at the sales order detail-line level.

mnOrderedQuantityQTYMATH_NUMERICNONENONE

The number of units associated with an asset.

cFirstAdjOverrideFlagEV02charNONENONE




   1 = True

   0 = False



^

mnTradeDiscountTRDCMATH_NUMERICNONENONE

Percentage by which the system reduces the price of each item. This is the only discount that will be applied. You can override it if you 
enter a price. Enter the percentage as a whole number (that is, 5 for 5%).

idF4211RowPtrGENLNGIDNONENONE

General purpose ID variable.

idF4102RowPtrGENLNGIDNONENONE

General purpose ID variable.

cSuppressErrorMesgEV03charNONENONE




   1 = Suppress error message



^

szErrorMesgIDDTAIcharNONENONE

A code that identifies and defines a unit of information. It is an alphanumeric code up to 8 characters long that does not allow blanks or 
special characters such as %, &, or +. You create new data items using system codes 55-59. You cannot change the alias.

cSalesPriceRetUOMUMB1charNONENONE

A code that specifies the unit of measure that the system uses for retrieving base prices and price adjustments for sales order processing, 
service and warranty management, and ship and debit processing. The system allows users to define base prices in the Item Base Price 
File table (F4106) and price adjustments in the Price Adjustment Detail table (F4072) in various units of measure. If the base price or price 
adjustments are not found in the specified unit of measure, then the system uses the primary unit of measure for the item.

cCostLevelCLEVcharNONENONE

A code that indicates whether the system maintains one overall inventory cost for the item, a different cost for each branch/plant, or a 
different cost for each location and lot within a branch/plant. The system maintains inventory costs in the Inventory Cost table (F4105). Valid codes 
are:    1   Item level    2   Item/Branch level    3   Item/Branch/Location level

szStandardUOMConversionTFLAcharNONENONE

Allows you to bypass the item-specific unit of measure and use the standard unit of measure. Valid values are:    blank Use the item-specific 
unit of measure    1       Bypass the item-specific unit of measure and use the standard unit of measure

szCostMethodLEDGcharNONENONE

A user defined code (40/CM) that specifies the basis for calculating item costs. Cost methods 01 through 19 are reserved for J.D. Edwards 
use.

szSoldToCustGrpCPGPcharNONENONE

A user defined code (40/PC) that identifies a customer group. You can group customers with similar characteristics, such as comparable 
pricing.

szShipToCustGrpPRGRcharNONENONE

A user defined code (system 40/type PI) that identifies an inventory price group for an item. Inventory price groups have unique pricing 
structures that direct the system to incorporate discounts or markups on items on sales and purchase orders. The discounts or markups are 
based on the quantity, dollar amount, or weight of the item ordered. When you assign a price group to an item, the item takes on the same pricing 
structure defined for the inventory price group. You must assign an inventory price group to the supplier or customer, as well as to the item, for 
the system to interactively calculate discounts and markups on sales orders and purchase orders.

mnAdjustmentRevLvlAREVMATH_NUMERICNONENONE

This field maintains the current revision level of Advanced Pricing adjustments awarded within a sales order. Adjustments associated with 
a revision level below the current level are considered obsolete.

cAdvanceRevLvlEV04charNONENONE




  1 = Yes



^

mnDomesticDetachedAdjDETDMATH_NUMERICNONENONE

The total sum of Detached Adjustments which relate to a Sales Order Detail line. This amount is expressed in the domestic currency.

mnForeignDetachedAdjDETFMATH_NUMERICNONENONE

The total sum of Detached Adjustments which relate to a Sales Order Detail line. This amount is expressed in the foreign currency.

cFreeGoodsFlagFGYcharNONENONE

If a price adjustment is associated with any free goods information, this flag will be set to Y.  Moreover, the option field in the Price 
Adjustment Detail Revisions will be displayed in reverse image to signify that the record is associated with free good information.

mnLastLineNoAssignedLNIDMATH_NUMERICNONENONE

A number that identifies multiple occurrences, such as line numbers on a purchase order or other document. Generally, the system assigns 
this number,but in some cases you can override it.

cSuppressWorkfileWriteFlagEV05charNONENONE




  '1' = Don't write to F40UI74

  ' ' = Write to F40UI74



^

mnTriangulationRateFromTRR1MATH_NUMERICOPTNONE

The triangulation currency rate used to convert the From currency code to the Triangulation currency code.

mnTriangulationRateToTRR2MATH_NUMERICOPTNONE

The triangulation currency rate that used to convert from the Triangulation currency code to the To currency code.

cCurrencyConversionMethodCRCMcharOPTNONE

A value that specifies which method to use when converting from one currency to another. Valid values are:  Y  Multiplier method. The 
system multiplies the foreign amount by the multiplier exchange rate to calculate the domestic amount. Z Divisor method. The system divides the 
foreign amount by the divisor exchange rate to calculate the domestic amount.

cRebateProcessingOnlyEV06charOPTNONE

An option that specifies the type of processing for an event.

mnProcessIDPEIDMATH_NUMERICOPTNONE

A code that identifies the Inter-Process Communication ID.

mnTransactionIDTCIDMATH_NUMERICOPTNONE

mnGrossProfitPercentPRMGMATH_NUMERICOPTNONE

This value indicates the profit margin percentage for the order detail line. This is calculated by ((Price - Cost) / Price) * 100.

szReasonCodeRCDcharOPTNONE

A user defined code (42/RC) that explains the purpose for a transaction. For example, you can indicate the reason that you are returning 
items.

cVolumeProcessingEV01charOPTNONE

An option that specifies the type of processing for an event.

idVIDDetailCodeRowPtrGENLNGIDOPTNONE

General purpose ID variable.

szOrderSuffixSFXOcharOPTNONE

In the A/R and A/P systems, a code that corresponds to the pay item. In the Sales Order and Procurement systems, this code identifies 
multiple transactions for an original order. For purchase orders, the code is always 000. For sales orders with multiple partial receipts against an 
order, the first receiver used to record receipt has a suffix of 000, the next has a suffix of 001, the next 002, and so on.

mnPriceHistoryAltKeyAKIDMATH_NUMERICOPTNONE

A value that specifies an alternate key in the Price Adjustment Ledger File table (F4074). 

szPriceHistoryAltKeySourceSRCFDcharOPTNONE

A user defined code that you enter to indicate the JD Edwards system,such as Service Warranty Management etc,that the price adjustment 
supports.

mnOverrideBasePriceOVBPRCMATH_NUMERICOPTNONE

The foreign base price that the system calculates when no base price exists in the Item Base Price File table (F4106). The system 
calculates this value when all of the following conditions apply:   o  The base price for the item in the Item Base Price File table is zero.   o  The first 
adjustment is an override adjustment.   o  The currency mode is foreign (F).

mnOverrideForeignBasePriceOVFBPRCMATH_NUMERICOPTNONE

The foreign base price that the system calculates when no base price exists in the Item Base Price File table (F4106). The system 
calculates this value when all of the following conditions apply:   o  The base price for the item in the Item Base Price File table is zero.   o  The first 
adjustment is an override adjustment.   o  The currency mode is foreign (F).

szAdvancedPreferenceTypeAPTYPEcharOPTNONE

A user defined code (40/AP) that specifies how the system processes an advanced preference price adjustment.

cPreferenceFoundEV01charOPTNONE

An option that specifies the type of processing for an event.

cItemLevelEV02charOPTNONE

An option that specifies the type of processing for an event.

mnVolumeTolerancePercentageINCRAMMATH_NUMERICOPTNONE

This field is for the percentage amount of increase.

mnDualQtySQORMATH_NUMERICOPTNONE

If the secondary unit of measure option in Inventory Constants is selected,this field will display on data entry screens.

szDualUOMUOM2charOPTNONE

A user defined code (00/UM) that indicates an alternate unit of measure for the item.

szSOEMBFInternalFlagsSOEFcharOPTNONE

This field is broken down into 30 different flags which are passed in and out of the sales order entry MBF - F4211 Begin Doc, F4211 Pre 
Processor, F4211 Edit Line, and F4211 End Doc.

cPreservePOEManualAdjEV01charOPTNONE

An option that specifies the type of processing for an event.

cProcessFreeGoodsEV01charOPTNONE

An option that specifies the type of processing for an event.

Related Functions

B0000033 Get Exchange Rate
B4000520 Get Item UoM Conversion Factor
B4000530 Get Distribution Constants
B4002000 Compute Unit Or Extended Amount
B4200800 F40073 Get Pricing Preference Hierarchy
B4500130 F4076 Calculate Algebraic Expression
B4500210 Calculate Price Adjustments Test Function
B4501300 Cache Upselling Adjustments
B9800181 Environment List Business Functions
N4500190 F4073 Calculate Free Goods
X4101 Validate and Retrieve Item Master
XF4105 Item Cost I/O

Related Tables

F4070 Price Adjustment Schedule
F4071 Price Adjustment Type
F4072 Price Adjustment Detail
F4075 Price Variable Table
F4076 Price Formula Master
F40UI74 Price Adjustment History Work File
F4102 Item Branch File
F4211 Sales Order Detail File
F43121 Purchase Order Receiver File