-
Notifications
You must be signed in to change notification settings - Fork 0
Administration Setup Precalculation Calculation schema Calculation objects Scripting Scripting Pre calculation
Scripting for calculation of surcharges in Pre-calculation. Entered in Script administration - Edit - upper window For Pre- and for Post-calculation the scripts need to be created separately.
See Calculation objects - Scripting Scripting Scripting post-calculation
Create script 3 writable variables are available for marginal costs, full costs and description. Special variables are available for accessing calculation results.
Writeable variables: fccost set full costs for current object Example: setvar=fccost=<sum.fc.labor> mccost set marginal costs description hmtoggle_plus1 Set description
hmtoggle_plus1 Example: set L+M costs
[vbs] function ppercent (s) ppercent=<sum.material,num(6)>/100*s end function
[/vbs] setvar=fccost=<vbs.ppercent(5)> setvar=mccost= setvar=description=Material Overhead 5% from <sum.material,#0.00> = <fccost,#0.00>
Variables: you can access the following special variables
<sum.material>
Material costs without costs for external operation
<sum.manufacturing>
External operation costs
<sum.materialoverheads>
Material surcharge
<sum.mc.labor>
L+M costs at marginal costs
<sum.fc.labor>
L+M costs at full costs
<sum.mc.production>
Material + External operation + L+M cost at marginal costs
<sum.fc.production>
Material + External operation + L+M cost at marginal costs
<timetype.fc/mc/fx.[timetype]>
hmtoggle_plus1 Costs of a time type at full costs (fc), marginal costs (mc) or fixed costs (fx)
<calc.lotsize>
Currently calculated lot size
<calc.line>
Current assembly to be calculated (usually 1)
<calc.docentry>
Calculation number. If <= 0, temporary calculation
<calc.precalcnr>
Calculation number, linked to an offer, sales order or advance invoice via field „u_beas_precalcnr
There is no 1:1-linkage to a customer order. A calculation can be stored in several documents.
<calc.cardcode>
Client number, stored in calculation
Place holders return values in Windows regional format with 6 digits.
hmtoggle_plus1 Example
Setup time time type „Machine“ at full costs setvar=fccost=<timetype.fctr.machine> Processing costs time type “Personnel” + “Labor” at marginal costs setvar=mccost=%numadd(<timetype.mcte.labor>,<timetype.mcte.personell>) Example with declared variables // If no variable is declared with „dec“ or „decimal“, // you can continue to calculate with these in „datawindow-Syntax“ // but a conversion into international format is necessary
dec fcsum fcsum=<timetype.fc.machine,num(6)> fcsum=<fcsum,num(6)> + (<fcsum,num(6)> / 100 * 5) setvar=fccost=<fcsum,#0.000000> Example with VB Script // Working with beas-Script-Formula system, SQL-Script, // VB-Script or JavaScript, variables nmeed to be converted by num(x)
[vbs] function ppercent (s) ppercent=<sum.material,num(6)>/100*s end function [/vbs]
setvar=fccost=<vbs.ppercent(5)> setvar=mccost= setvar=description=Material Overhead 5% from <sum.material,#0.00> = <fccost,#0.00>
Complex example: "Item amount in sales units"
- value from item value "SWW"
- Cost rate from first operation
- current lot size
// Amount in sales units of the item to be produced // (First row of DW_1) select "NumInSale" into :ll_numinsale from "OITM" where "ItemCode" = <dw_1.item.st_itemcode:1.value,dbstring> // Position first operation // (row type) // "find" is easier than for - next dw_1.find=art=52 setvar=ll_row= if <ll_row> n= 0 then return success end if // Use SQL statement to compute the value, write with "into" directly to // the correct variable // from BEAS_DUMMY is important, as without "from" "into" does not work // Marginal/Full costs are taken from the operation [ll_row]
select <dw_1.item.st_sww:1.value,num(6)> &
- <ll_numinsale,num(6)> &
- <dw_1.item.ag_grenzkosten:[ll_row].value,num(6)> &
- <calc.lotsize,num(6)> & into mccost & from "BEAS_DUMMY"
select <dw_1.item.st_sww:1.value,num(6)> &
- <ll_numinsale,num(6)> &
- <dw_1.item.ag_vollkosten:[ll_row].value,num(6)> &
- <calc.lotsize,num(6)> & into mccost & from "BEAS_DUMMY"
hmtoggle_plus1 Complete example of use
The calculation shall put out the setup time of a machine + setup time of employee and processing time of machine + processing time of employee separately. In this example 3 cost types have been registered. Also one cost type would be sufficient. Cost elements have been extended to 2, and personnel costs are valued separately. Cost types are assigned and cost centers have been stored. 2 formulas have been entered.
Setup:
// setup-time from machine and personnel setvar=fccost=%numadd(<timetype.fctr.machine>,<timetype.fctr.personell>) setvar=mccost=%numadd(<timetype.mctr.machine>,<timetype.mctr.personell>) setvar=description=Total setup Time <timetype.trtime.machine,#0> Min
Processing:
// Edit-Time from labor and personnel setvar=fccost=%numadd(<timetype.fcte.labor>,<timetype.fcte.personell>) setvar=mccost=%numadd(<timetype.mcte.labor>,<timetype.mcte.personell>) setvar=description=Total Processing Time <timetype.tetime.labor,#0> Min
Afterwards, surcharge objects need to be defined, in which these formulas are stored. Then, the requested result is put out correctly.
返回 主页