CalculateCostBucketCostedBill

Calculate Cost Bucket Costed Bill

Major Business Rule

Object Name: B3000320

Parent DLL: CMFGBASE

Location: Client/Server

Language: C

1.Functional Description

1.1Purpose


If this business function is called for a parent item, it will calculate "net added - mfg." 
costs for the parent and those costs will be returned in cost buckets #B1-B6.  "Total - cost 

rollup" costs will be calculated and returned in cost buckets #TB1-#TB6.  The costs are calculated by 

multiplying the cost in the Cost Component file F30026 by the transaction quantity requested for 

the parent.



2.Technical Specifications

2.4Processing 


1.0  Loop until no more records matching the key - Read Cost Component records F30026 by kit, mmcu, 

blank location, blank lot, and ledg.  This will give you a F30026pointer  (if the fetch is 

unsuccessful,  return zeros into the cost buckets as indicated by step 5.0).


Process for each cost component record read

2.0  Get cost bucket information:

2.a.  Put the F30026pointer COST just read from the cost components file into KY, '30' into SY, 

and 'CB' into RT. Use Get UDC X0005 business function and get description 1 (DL01).

2a1.  Test the description just retrieved.  If it is Less Than 0 or Greater To 6 stop 

processing the cost component record just read, (meaning skip the following steps and return to step 1.0 

starting the loop all over again.).  You will use the description 1 just retrieved for the following 

if statements, therefore, you might want to save the description into  a work field.  In this document 

I will refer to it as $C.


3.0  Process this step according to the value in $C.  This step is accumulating the costs x qty fro 

each cost bucket.



If COST NE 'B2'

or DS VC01A mode = ' ' 


If $C = 1

if VC01A = '1' 

#B1 = (F30026pointer STDC * $TRQT) + #B1

#TB1= (F30026pointer CSL * $TRQT) + #TB1

if VC01A = ' '

#B1 = (F30026pointer XSMC * $TRQT) + #B1

#TB1 = (F30026pointer XSCR * $TRQT) + #TB1


If $C = 2

if VC01A = '1'

#B2 = (F30026pointer STDC * $TRQT) + #B2

#TB2= (F30026pointer CSL * $TRQT) + #TB2

if VC01A = ' '

#B2 = (F30026pointer XSMC * $TRQT) + #B2

#TB2 = (F30026pointer XSCR * $TRQT) + #TB2


If $C = 3

if VC01A = '1'

#B3 = (F30026pointer STDC * $TRQT) + #B3

#TB3= (F30026pointer CSL * $TRQT) + #TB3

if VC01A = ' '

#B3 = (F30026pointer XSMC * $TRQT) + #B3

#TB3 = (F30026pointer XSCR * $TRQT) + #TB3


If $C = 4

if VC01A = '1'

#B4 = (F30026pointer STDC * $TRQT) + #B4

#TB4= (F30026pointer CSL * $TRQT) + #TB4

if VC01A = ' '

#B4 = (F30026pointer XSMC * $TRQT) + #B4

#TB4 = (F30026pointer XSCR * $TRQT) + #TB4


If $C =5

if VC01A = '1'

#B5 = (F30026pointer STDC * $TRQT) + #B5

#TB5= (F30026pointer CSL * $TRQT) + #TB5

if VC01A = ' '

#B5 = (F30026pointer XSMC * $TRQT) + #B5

#TB5 = (F30026pointer XSCR * $TRQT) + #TB5


Do this, no matter what the value of $C is:

if VC01A = '1'

#B6 = (F30026pointer STDC * $TRQT) + #B6

#TB6= (F30026pointer CSL * $TRQT) + #TB6

if VC01A = ' '

#B6 = (F30026pointer XSMC * $TRQT) + #B6

#TB6 = (F30026pointer XSCR * $TRQT) + #TB6

End 



If COST = 'B2'

And DS VC01A mode = '1'


please note $B2MFG and $B2CST are simply work fields used on the AS/400, you may want to use your own 

work fields.

if VC01A = '1'

$B2MFG = STDC

$B2CST = CSL - STDC

if VC01A = ''

$B2MFG = XSMC

$B2CST = XSCR - XSMC


If $C = 1

#B1 = ($B2MFG * DS ACQ) + #B1

#TB1 = ($B2MFG * DS ACQ) + #TB1

#TB1 = ($B2CST * $TRQT) + #TB1


If $C = 2

#B2 = ($B2MFG * DS ACQ) + #B2

#TB2 = ($B2MFG * DS ACQ) + #TB2

#TB2 = ($B2CST * $TRQT) + #TB2


If $C = 3

#B3 = ($B2MFG * DS ACQ) + #B3

#TB3 = ($B2MFG * DS ACQ) + #TB3

#TB3 = ($B2CST * $TRQT) + #TB3


If $C = 4

#B4 = ($B2MFG * DS ACQ) + #B4

#TB4 = ($B2MFG * DS ACQ) + #TB4

#TB4 = ($B2CST * $TRQT) + #TB4


If $C = 5

#B5 = ($B2MFG * DS ACQ) + #B5

#TB5 = ($B2MFG * DS ACQ) + #TB5

#TB5 = ($B2CST * $TRQT) + #TB5


Do this, no matter what the value of $C is:

#B6 = ($B2MFG * DS ACQ) + #B6

#TB6 = ($B2MFG * DS ACQ) + #TB6

#TB6 = ($B2CST * $TRQT) + #TB6


End 



4.0  Return to 1.0 until all cost component records have been processed.





5.0  When all cost component records have been processed, return the totals in the appropriate return 

fields.



(#B1)==>Cost Bucket 1XSMC

(#B2)==>Cost Bucket 2XSMC

(#B3)==>Cost Bucket 3XSMC

(#B4)==>Cost Bucket 4XSMC

(#B5)==>Cost Bucket 5XSMC

(#B6)==>Cost Bucket 6XSMC



(#TB1)==>Total Cost Bucket 1XSMC

(#TB2)==>Total Cost Bucket 2XSMC

(#TB3)==>Total Cost Bucket 3XSMC

(#TB4)==>Total Cost Bucket 4XSMC

(#TB5)==>Total Cost Bucket 5XSMC

(#TB6)==>Total Cost Bucket 6XSMC



Retrievals:


Cost Components File F30026:

Item number shortITM

Cost CenterMMCU

LocationLOCN

Lot numberLOTN

Cost MethodLEDG

Cost TypeCOST





Data Structure

D3000320 - Calculate Cost Bucket Costed Bill

Parameter NameData ItemData TypeReq/OptI/O/Both
szCostCenterMMCUcharNONENONE

A code that represents a high-level business unit. Use this code to refer to a branch or plant that might have departments or jobs, which 
represent lower-level business units, subordinate to it. For example:     o Branch/Plant (MMCU)     o Dept A (MCU)     o Dept B (MCU)     o Job 123 
(MCU) Business unit security is based on the higher-level business unit.

mnItemNumberShortKITMATH_NUMERICNONENONE

The system provides for three separate item numbers.    1.   Item Number (short) - An eight-digit, computer assigned, completely 
non-significant item number.    2.   2nd Item Number - The 25-digit, free form, user defined alphanumeric item number.    3.   3rd Item Number - Another 
25-digit, free form, user defined alphanumeric item number.

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.

cFrozenSimulatedModeVC01AcharNONENONE

This is a generic field used for video constants display.

mnTransactionQuantityTRQTMATH_NUMERICNONENONE

A value that represents the available quantity, which might consist of the on-hand balance minus commitments, reservations, and 
backorders. You enter this value in the Branch/Plant Constants program (P41001).

mnAccountingCostQtyACQMATH_NUMERICNONENONE

An amount that the system uses in the Cost Rollup program to determine the allocation of setup costs. The system totals the setup costs 
and divides the sum by this quantity to determine a unit setup cost. The default is 1.

mnCostBucket1XSMCMATH_NUMERICNONENONE

Used to calculate cost during the simulation process.

mnCostBucket2XSMCMATH_NUMERICNONENONE

Used to calculate cost during the simulation process.

mnCostBucket3XSMCMATH_NUMERICNONENONE

Used to calculate cost during the simulation process.

mnCostBucket4XSMCMATH_NUMERICNONENONE

Used to calculate cost during the simulation process.

mnCostBucket5XSMCMATH_NUMERICNONENONE

Used to calculate cost during the simulation process.

mnCostBucket6XSMCMATH_NUMERICNONENONE

Used to calculate cost during the simulation process.

mnTotalCostBucket1XSMCMATH_NUMERICNONENONE

Used to calculate cost during the simulation process.

mnTotalCostBucket2XSMCMATH_NUMERICNONENONE

Used to calculate cost during the simulation process.

mnTotalCostBucket3XSMCMATH_NUMERICNONENONE

Used to calculate cost during the simulation process.

mnTotalCostBucket4XSMCMATH_NUMERICNONENONE

Used to calculate cost during the simulation process.

mnTotalCostBucket5XSMCMATH_NUMERICNONENONE

Used to calculate cost during the simulation process.

mnTotalCostBucket6XSMCMATH_NUMERICNONENONE

Used to calculate cost during the simulation process.

cModeVC01AcharNONENONE

This is a generic field used for video constants display.

cBaseFixedCostsOnEV01charOPTNONE

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

Related Functions

B4000460 Free Ptr To Data Structure
X0005 Get User Defined Codes

Related Tables

F30026 Item Cost Component Add-Ons