Hi Jeff,
Here are some notes that may help.
1. regarding the first question, what you have seen is in xml containing
calcop element ,
     for ofbiz its called Minilang which you can call it an intermediate
programming language that you can use it to make small programming tasks
(business logic),
     and later this XML element will be interpreted by Java code, and for
your information this MINIALNG will be deprecated as per the ofbiz
community and will be replaced by groovy scripts.
( 2. & 3 ) . regarding  to the second and third question I know that you
seem to be very new to the OFBIZ like me , so take the time to read the
getting started for both developers and business users,
Here is a link
https://cwiki.apache.org/confluence/display/OFBIZ/Home


On Sat, Jul 13, 2024 at 9:18 PM Jeff Christensen <[email protected]>
wrote:

> Hi Emad,
>
> I really appreciate the answer especially when I wasn't clear with my
> screen shot. You answered my question.
>
> I have some follow up questions:
>
> 1) The productCostPercentageFormula definition does the calculation via
> the "calcop" element. Where can I find information regarding how this
> mechanism works? i.e. What operations are allowed and syntax?
>
>  2) I am trying to undestand the Ofbiz theory of cost calculations. I can
> see the screens for "Costs" in the Product listing. There is a lot of
> functionality there. Is there any good documentation on how to use that
> functionality?
>
> 3) Another qustion about custom extensions. When I look at the example
> Routing Tasks call TASK_COST there is an Estimate Calc Method called "
> Example task formula (qty * estimatedMilliSeconds * 10)". I have only found
> the string localization for this in CustomMethod.description.6000. But I
> don't know where the actual custom method is?
>
> Thanks.
>
> -----Original Message-----
> From: Emad Radwan <[email protected]>
> Sent: Saturday, July 13, 2024 2:21 AM
> To: [email protected]
> Subject: Re: Cost calculations for product manufacturing
>
> Hello Jeff,
>
> The screenshot you included isn't visible to me so I'll assume that you're
> talking about cost component calculation 'GEN_COST_CALC' with the
> description 'Overhead cost (5 percent of total cost) for general costs'.
>
> This cost calculation references custom method 'Formula that creates a
> cost component equal to a percentage of total product cost'  that needs to
> be defined first in the CustomMethods entity. I'm not sure if there's a
> screen to maintain that but you can see this from web tools.
>
>
> https://demo-stable.ofbiz.apache.org/webtools/control/FindGeneric?entityName=CustomMethod
>
> One of the fields in the custom method is CustomMethodName which in this
> case 'productCostPercentageFormula' for custom method 'PROD_PERC_FORMULA'.
>
> If you search in the code you'll find it as follows:
>
> <service name="productCostPercentageFormula" engine="simple"
>
> location="component://product/minilang/product/cost/CostServices.xml"
> invoke="productCostPercentageFormula" auth="true">
>     <description>Formula that creates a cost component equal to a
> percentage of total product cost</description>
>     <implements service="productCostCalcInterface"/>
> </service>
>
>
> <simple-method method-name="productCostPercentageFormula"
> short-description="Formula that creates a cost component equal to a
> percentage of total product cost">
>     <set field="productCostComponentCalc"
> from-field="parameters.productCostComponentCalc"/>
>     <set field="costComponentCalc"
> from-field="parameters.costComponentCalc"/>
>     <set field="inputMap.productId"
> from-field="productCostComponentCalc.productId"/>
>     <set field="inputMap.currencyUomId"
> from-field="parameters.currencyUomId"/>
>     <set field="inputMap.costComponentTypePrefix"
> from-field="parameters.costComponentTypePrefix"/>
>     <call-service service-name="getProductCost" in-map-name="inputMap">
>         <result-to-field result-name="productCost"/>
>     </call-service>
>     <!--set field="productCostAdjustment" value="${parameters.baseCost
> * costComponentCalc.fixedCost}" type="BigDecimal"/-->
>     <calculate field="productCostAdjustment" type="BigDecimal"
> decimal-scale="6">
>         <calcop operator="multiply" field="costComponentCalc.fixedCost">
>             <calcop operator="get" field="parameters.baseCost"/>
>         </calcop>
>     </calculate>
>     <field-to-result field="productCostAdjustment"/> </simple-method>
>
>
> So I believe this is the workflow for adding and using
>
> mew custom methods.
>
>
> Regards,
>
> Emad
>
>
> On Sat, Jul 13, 2024 at 12:14 AM Jeff Christensen <[email protected]>
> wrote:
>
> > I am trying to understand how Ofbiz can use custom cost calculations.
> > This is probably a big picture question where I don’t understand how
> > custom functions are created and installed.
> >
> >
> >
> > If I look at the demo data I see that there is an option for “Cost
> > Custom Method ID”
> >
> >
> >
> >
> >
> > Where is that function defined?
> >
> >
> >
> > How could I make my own?
> >
> >
> >
> > Thanks
> >
> >
> >
> >
> >
> >
> >
>


-- 

*عـمــر عـبد الــوهــــاب*

*جــوال : 0550677295*

Reply via email to