Example of Use (SC Quoting Plugin)

Compensation Value

Get an estimated compensation value by using this method:

/** * Calculate estimated compensation value for each line item in quote, include: Max Compensation Estimate and Actual Compensation Estimate. 
*   - Max Compensation Estimate: calculated based on Recommended Price 
*   - Actual Compensation Estimate: calculated based on negotiated/invoice price 
* @param customerId - customerId 
* @param productId - productId 
* @param effectiveDate - effectiveDate from Quote 
* @param quoteCreator - quoteCreator(login username) from Quote 
* @param recommendedPrice - recommended price (should be recommended revenue = recommended Price * Quantity) 
* @param invoicePrice - invoice price (should be invoice revenue = unit Price * Quantity) 
* @param switchMonth - switch Month of current year, value as: Jan=0, Feb=1, Mar=2,...,Dec=11 
* @return Map [maxCompensation:<BigDecimal>, 
*              actualCompensation:<BigDecimal>] 
*/
Map getSalesCompensationEstimation(String customerId,
                                   String productId,
                                   Date effectiveDate,
                                   String quoteCreator,
                                   BigDecimal recommendedPrice,
                                   BigDecimal invoicePrice,
                                   Integer switchMonth)

This method is in the package SC_QuotingPluginLib.SalesCompensationEstimation.

Example:

return libs.SC_QuotingPluginLib.SalesCompensationEstimation.getSalesCompensationEstimation("CD-0001",
        "MB-0002",
        "2022-01-01",
        "vinh",
        100,
        80,
        4) 

ResultGauge

Show ResultGauge in a quote line item by using this method:

/** 
* Show a line score chart, Actual Compensation Estimate for the line expressed as % from Max Compensation Estimate 
* With Actual Compensation Estimate and Max Compensation Estimate got from SalesCompensationEstimation.getSalesCompensationEstimation 
* Chart setting read from configuration PP 
* @param maxCompensation - max compensation 
* @param actualCompensation - actual compensation 
* @return ResultGauge chart 
*/
ResultGauge createCompensationLineScore(BigDecimal maxCompensation, BigDecimal actualCompensation)

This method is in the package SC_QuotingPluginLib.ChartUtils.

Example:

return libs.SC_QuotingPluginLib.ChartUtils.createCompensationLineScore(100,50)

Pie HighChart

Show Pie HighChart in a quote header by using this method:

/** 
*  Create a pie chart of estimated compensations for line items (use on a quote header) 
* @param estimatedCompensations - estimated compensation for seller/quoteCreator,it's a list of estimated compensation for products 
*                                 estimated compensation for products is a Map[<sku>:<EstimatedCompensation>] 
*                                 EstimatedCompensation is created by method SalesCompensationEstimation.getSalesCompensationEstimation() 
*                                 EstimatedCompensation is  a Map [maxCompensation   :<BigDecimal>, 
*                                                                  actualCompensation:<BigDecimal>] 
* @param quoteCreator - quote creator 
* @param currencyCode - currency code as: USD, EUR ... 
* @return ResultHighchart 
*/
ResultHighchart createActualEstimatedCompensationChart(Map estimatedCompensations,
                                                       String quoteCreator,
                                                       String currencyCode = null) 

This method is in the package SC_QuotingPluginLib.ChartUtils.

Example:

Map estimatedCompensations = ["MB-001": [maxCompensation: 100, actualCompensation: 50],
                              "MB-002": [maxCompensation: 120, actualCompensation: 90],
                              "MB-003": [maxCompensation: 150, actualCompensation: 150],
                              "MB-004": [maxCompensation: 200, actualCompensation: 150]]
String quoteCreator = "vinh"return 
return libs.SC_QuotingPluginLib.ChartUtils.createActualEstimatedCompensationChart(estimatedCompensations, quoteCreator)