Calculating the price of a bundle component
From AvectraWiki, the wiki of Avectra netFORUM
Calculating the Price of a Bundle Component
If the price of a component in a Bundle is to be calculated based on some information in the netFORUM database an extension or component can be added to accomplish this.
When the calculate? checkbox on the bundle component page is checked, the calculation text box will display. The price of the component entered on the product setup is disregarded. Enter the .NET method that will be called in the following format:
dllName|TypeName|MethodName
For example:
extension|Avectra.netForum.Extension.CustomCalculationClass|CustomCalculationMethod
The .NET method should have only one parameter and that has to be the InvoiceDetail object.
For example: CalculatePrice(InvoiceDetail oDetail))
The return type of the method must be decimal.
Code Sample
namespace BundleComponents
{
class BundlePriceCalculation
{
public decimal CalculatePrice(InvoiceDetail oDetail)
{
//Calculate the price of the component
// You can use the GetValue method to get information about the product, price, customer, etc.:
string szRate = oDetail.GetValue("cst_rate_ext");
// final return statement must return a decimal
return 2 * 100.00m;
}
}
}



