| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| |
| <simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd"> |
| |
| <simple-method method-name="exampleComponentFormula" short-description="Formula that the number of linear components in bom"> |
| <set field="arguments" from-field="parameters.arguments"/> |
| <calculate field="totQuantity"> |
| <calcop operator="multiply"> |
| <calcop operator="get" field="arguments.neededQuantity"/> |
| <!-- This is the multiplier (k) --> |
| <number value="10"/> |
| </calcop> |
| </calculate> |
| <field-to-result field="totQuantity" result-name="quantity"/> |
| </simple-method> |
| |
| <simple-method method-name="linearComponentConsumptionFormula" short-description="Formula that the number of linear components in bom"> |
| <set field="arguments" from-field="parameters.arguments"/> |
| <calculate field="totQuantity"> |
| <calcop operator="multiply"> |
| <calcop operator="get" field="arguments.neededQuantity"/> |
| <calcop operator="get" field="arguments.amount"/> |
| </calcop> |
| </calculate> |
| <calculate field="quantityInt" type="Integer"> |
| <calcop operator="divide"> |
| <calcop operator="get" field="totQuantity"/> |
| <calcop operator="get" field="arguments.width"/> |
| </calcop> |
| </calculate> |
| <calculate field="quantityDou"> |
| <calcop operator="divide"> |
| <calcop operator="get" field="totQuantity"/> |
| <calcop operator="get" field="arguments.width"/> |
| </calcop> |
| </calculate> |
| <if-compare-field field="quantityInt" to-field="quantityDou" operator="less"> |
| <calculate field="quantity"> |
| <calcop operator="add"> |
| <calcop operator="get" field="quantityInt"/> |
| <number value="1"/> |
| </calcop> |
| </calculate> |
| <else> |
| <calculate field="quantity"> |
| <calcop operator="add"> |
| <calcop operator="get" field="quantityInt"/> |
| <number value="0"/> |
| </calcop> |
| </calculate> |
| </else> |
| </if-compare-field> |
| <field-to-result field="quantity" result-name="quantity"/> |
| </simple-method> |
| </simple-methods> |