Class QuoteCalculation
Contains helper methods and utilities for implementors of Quote Connectors. Used by the QuoteConnectorBase to handle calculations.
Typically you would call CalculateQuoteAlternativeWithLines(QuoteAlternativeWithLinesInfo) from your connector to get the basic summation and discount calculations done. You could then add anything you were interested in on top of the standard calculations.Inherited Members
Namespace: SuperOffice.CRM
Assembly: SuperOffice.Plugins.dll
Syntax
public static class QuoteCalculation
Methods
CalculateAlternativeCost(QuoteLineInfo[])
Basically sum of quotelines( quantity * unitcost )
Declaration
public static double CalculateAlternativeCost(QuoteLineInfo[] quoteLines)
Parameters
Type | Name | Description |
---|---|---|
QuoteLineInfo[] | quoteLines |
Returns
Type | Description |
---|---|
double |
CalculateAlternativeMinimum(QuoteLineInfo[])
Basically sum of quotelines( quantity * unitminprice)
Declaration
public static double CalculateAlternativeMinimum(QuoteLineInfo[] quoteLines)
Parameters
Type | Name | Description |
---|---|---|
QuoteLineInfo[] | quoteLines |
Returns
Type | Description |
---|---|
double |
CalculateQuoteAlternativeSubTotal(QuoteLineInfo[])
Sum of quotelines (quantity * listprice)
Declaration
public static double CalculateQuoteAlternativeSubTotal(QuoteLineInfo[] quoteLines)
Parameters
Type | Name | Description |
---|---|---|
QuoteLineInfo[] | quoteLines |
Returns
Type | Description |
---|---|
double |
CalculateQuoteAlternativeWithLines(QuoteAlternativeWithLinesInfo)
Some formulaes:
SubTotal = Quantity * UnitListPrice TotalCost = Quantity * UnitCost TotalPrice = SubTotal - DiscountAmount TotalPrice = TotalCost + EarningAmount DiscountAmount = DiscountPercent * SubTotal / 100 DiscountPercent = DiscountAmount * 100 / SubTotal EarningAmount = EarningPercent * TotalCost / 100 EarningPercent = EarningAmount * 100 / TotalPrice Thus, you can change any of the 5: TotalPrice, DiscountAmount, DiscountPercent, EarningAmount and EarningPercent and calculate the other 4. Independently, you can change Quantity, UnitListPrice and UnitCost. Subscriptions imply that Quantity and SubscriptionQuantity are multiplied when calculating amounts.Declaration
public static QuoteAlternativeWithLinesInfo CalculateQuoteAlternativeWithLines(QuoteAlternativeWithLinesInfo alt)
Parameters
Type | Name | Description |
---|---|---|
QuoteAlternativeWithLinesInfo | alt | The Quote Alternative |
Returns
Type | Description |
---|---|
QuoteAlternativeWithLinesInfo | The alternative with new values filled in on the quote lines |
CalculateQuoteLineSubTotal(QuoteLineInfo)
Quantity * Unit List Price
Declaration
public static QuoteLineInfo CalculateQuoteLineSubTotal(QuoteLineInfo line)
Parameters
Type | Name | Description |
---|---|---|
QuoteLineInfo | line |
Returns
Type | Description |
---|---|
QuoteLineInfo | Quantity * Unit List Price |
CalculateQuoteLines(QuoteLineInfo[])
Loop through and perform calculation on each line in an alternative.
Declaration
public static QuoteLineInfo[] CalculateQuoteLines(QuoteLineInfo[] lines)
Parameters
Type | Name | Description |
---|---|---|
QuoteLineInfo[] | lines | The quote lines |
Returns
Type | Description |
---|---|
QuoteLineInfo[] | The same quote alternative, but with the new calculated values on the quote lines |
CalculateTotalPriceWithAlternativeDiscount(QuoteAlternativeWithLinesInfo)
Calculates Quoteline.TotalPriceWithAlternativeDiscount
Declaration
public static void CalculateTotalPriceWithAlternativeDiscount(QuoteAlternativeWithLinesInfo alt)
Parameters
Type | Name | Description |
---|---|---|
QuoteAlternativeWithLinesInfo | alt |
CalculateTotalPriceWithAlternativeDiscount(IEnumerable<QuoteLineInfo>, double)
Calculates Quoteline.TotalPriceWithAlternativeDiscount
Declaration
public static void CalculateTotalPriceWithAlternativeDiscount(IEnumerable<QuoteLineInfo> quoteLines, double discountPercent)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<QuoteLineInfo> | quoteLines | |
double | discountPercent | The alternatives discountpercent |
CalculateValues(QuoteAlternativeWithLinesInfo)
Calculates SubTotal, DiscountAmount, DiscountPercent, EarningAmount, EarningPercent and Total
Declaration
public static QuoteAlternativeWithLinesInfo CalculateValues(QuoteAlternativeWithLinesInfo alt)
Parameters
Type | Name | Description |
---|---|---|
QuoteAlternativeWithLinesInfo | alt |
Returns
Type | Description |
---|---|
QuoteAlternativeWithLinesInfo | The updated QuoteAlternative |
CalculateValues(QuoteLineInfo)
Calculates SubTotal, DiscountAmount, DiscountPercent, EarningAmount, EarningPercent and Total
Declaration
public static QuoteLineInfo CalculateValues(QuoteLineInfo line)
Parameters
Type | Name | Description |
---|---|---|
QuoteLineInfo | line |
Returns
Type | Description |
---|---|
QuoteLineInfo | The updated QuoteLine |
CalculateVat(QuoteAlternativeWithLinesInfo)
The VAT is computed from the sum of the quotelines TotalPriceWithAlternativeDiscount * VAT:
We assume that the VAT in the quotelines is saved as a percentage i.e. 12% is stored as 12. If any number is negative, we don't know what to do with it so we leave it alone.
Declaration
public static void CalculateVat(QuoteAlternativeWithLinesInfo alt)
Parameters
Type | Name | Description |
---|---|---|
QuoteAlternativeWithLinesInfo | alt |
CalculateVersionWithAlternatives(QuoteVersionContextInfo)
Contains helper methods and utilities for implementors of Quote Connectors. Used by the QuoteConnectorBase to handle calculations.
Typically you would call CalculateQuoteAlternativeWithLines(QuoteAlternativeWithLinesInfo) from your connector to get the basic summation and discount calculations done. You could then add anything you were interested in on top of the standard calculations.Declaration
public static QuoteVersionResponseInfo CalculateVersionWithAlternatives(QuoteVersionContextInfo context)
Parameters
Type | Name | Description |
---|---|---|
QuoteVersionContextInfo | context | The context |
Returns
Type | Description |
---|---|
QuoteVersionResponseInfo | Potentionaly changed context |