This functionality is used at the vehicle offer creation step.

Sales Incentives are essentially discounts that are being added automatically when creating an offer.

Entity

2 new entities were created:

  • IDMS_SalesIncentive: stores the details of a sales incentive
  • IDMS_SalesIncentive_NotCombinableCodes: stores the "not combinable" sales incentives. Behaves much like a sub-collection

The equivalent tables are the following:

  • @IDMS_SALESINCENTIVE
  • @IDMS_SLSINC_NOTCOMB

Because Sales Incentives are behaving much like document items a new sub-collection for the IDMS_DOCUMENT entity was created:

  • IDMS_DocumentSalesIncentives

The equivalent tables are the following:

  • @IDMS_DOCSALESINC

Setup

A new setup page was created which is used to manage the data of the sales incentives. The URL and Business Case are the following:

  • ~/SetupEntities/SalesIncentivesGridList
  • BC: 1972

The class SalesIncentivesGridListPage serves as the base class which is used for the management of sales incentives. A new class SalesIncentivesGridListPageFromOffer was created which is used for the manual addition of sales incentives at the offer sheet.

The form SalesIncentivesForm is a simple XML file used at the addition/edit of a sales incentive.

The creation or update action is implemented at the DocumentActionController and the method CreateOrUpdateEntitySalesIncentive.

The following validations exist:

  • Start Date must be before the End Date or vice versa
  • Model Year From must be before the Model Year To or vice versa
  • Receipt Date From must be before the Receipt Date To or vice versa
  • Overlapping Make Code – Family Code – Model Code – Sales Incentive Code – Date Period check

    • If the provided Make Code, Family Code, Model Code and Sales Incentive Code match an existing record (or the these DB fields are empty) then the matching records must not overlap with the given Start/End Date periods
      • given Start date >= existing Start Date && existing End Date <= given Start Date

      • given End Date >= existing Start Date && existing End Date <= given End Date

      • given End Date <= existing Start Date && given End Date >= existing End Date

      • given Start Date >= existing Start Date && given End Date <= existing End Date

Activation/Deactivation of the functionality

Because there was a need to activate/deactivate the sales incentives functionality per company (and not by the usual setup key functionality), a new setup page was created to support this. The URL and Business Case are the following:

  • ~/SetupEntities/SalesIncentivesActivationSetupPage
  • BC: 1972

The class SalesIncentivesActivationSetupPage inherits from the OneDealerPage and renders a simple view (~/Views/Common/SalesIncentives/SalesIncentivesActivationSetupPageView.cshtml).

For the save operation, a new manager and action controller was created to handle this.

  • SalesIncentivesActivationConfigurationManager
  • SalesIncentivesActivationSetupActionController
The SalesIncentivesActivationConfigurationManager is being used at the SimplySalesDocumentOfferView.cshtml in order to show or hide the Sales Incentives section at the offer sheet.

If no configuration was made, then when opening the page, the current company that the user used to login is shown with the options to activate or deactivate the sales incentives functionality for that company only.

Import Sales Incentives

Apart from the usual addition of Sales Incentives via the "plus" sign on the top-right of the page, there is an import functionality based on a template that can be used for this purpose.

2 methods at the SetupEntitiesController were created for this purpose:

  • ImportSalesIncentivesPopup
  • DownloadImportTemplate
    • The file path of the import template is ~/Files/Temp/SLSINC_ImportTemplate.xls

Process

Adding manually in the Sales Offer

Sales Incentive(s) can be manually added by clicking the Add-Button ("+") (like for Item Lines) at the far-right.


A grid list was created (URL: ~/SetupEntities/SalesIncentivesGridListFromOffer) (similar to the items list) from which the user can manually add the desired sales incentives.

The items at this grid list contains only valid items are filtered based on the following criteria:

  • Only Sales Incentives where:
    • Make = Make from the Vehicle, Family = Family from the Vehicle, Model = Model from the Vehicle
      Sales Incentives especially for the Family/Model
    • Or Make = Make from the Vehicle, Family = Family from the Vehicle, Model = Empty
      General Sales Incentives for the corresponding Make and Family
    • Or Make = Make from the Vehicle, Family = Empty, Model = Empty
      General Sales Incentives for the corresponding Make
    • Or Make = empty, Family = Empty, Model = Empty
      General Sales Incentives valid for all Makes of the Dealer
  • Only Sales Incentives should be shown where the Industry Group = empty or Industry Group = Industry Group from the Business Partner
  • Only Sales Incentives should be shown where Customer Group = empty or Customer Group = Customer Group from the Business Partner
  • Only Sales Incentives should be shown where Sales Type = empty or Sales Type = Sales Type from the Sales Lead
  • Only Sales Incentives should be shown where Vehicle Status = empty or Vehicle Status = Vehicle Status from the offered Vehicle
  • Only Sales Incentives with a valid Time Period (Offer Date must be between Start Date and End Date)
  • If the Sales Offer is being created for a Vehicle on Stock then the following addition Filter should be applied:
    • Only Sales Incentives should be shown where Model Year from / to = empty or Model Year (Field Year in the Vehicle Entity) of the Vehicle is between Model Year from and Model Year to from the Sales Incentive
    • Only Sales Incentives should be shown where the Receipt Date from / to = empty or the Receipt Date of the Vehicle is between Receipt Date from and Receipt Date to from the Sales Incentive.
  • A Trade In validation is being added as well, if only the the Lead/Opportunity contains a a Trade-in vehicle.

This criteria are applied as an expression of type Expression<Func<IDMS_SalesIncentiveView, bool>> and is generated at the method GetSalesIncentivesFilterExpressionView of the SalesDocumentOfferManager.

After the user has confirmed the addition of the items via the "arrow" button the following validation is applied:

  • Does selected Sales Incentive collide with other Sales Incentives (Cross Check with field Not combinable with Sales Incentive Code)
    • This validation is executed to both the selected sales incentives as well as the already added sales incentives at the offer (either automatically or manually added)

The validation is executed at the method ValidateNotCombinableSalesIncentives at the SalesDocumentController.

Adding automatically when creating the Sales Offer

All Sales Incentives that are marked as Automatic Insert = Yes and match to the Vehicle then the Sales Incentives should be added automatically to the Sales Offer, similar to the Automatic Document Lines. The criteria that are being used are the same as seen above. with the addition of the Automatic Insert flag.

The creation of the automatic sales incentive lines is done via AJAX request to the method GetAutomaticallyAddedSalesIncentives of the SalesDocumentController.

Here, the above criteria are constructed to an expression of type Func<IDMS_SalesIncentive, bool> and is generated at the method GetSalesIncentivesFilterExpression of the SalesDocumentOfferManager. Finally the expression is applied to the AddSalesIncentiveLines method of the SalesDocumentOfferManager.

It should be noted that the the data for the criteria are gathered partially at the SimplySalesDocumentOfferView which already provides a few of them for use in the CreateDefaultDocumentLines method. The rest of the data are generated at the GetAutomaticallyAddedSalesIncentives method. Then these data are returned to the client for later use. The model that contains this data is the DocumentSalesIncentivesCriteria.

Calculation totals at the totaling block

Due the addition of the Sales Incentives functionality the totaling has been revamped to handle the Sales Incentives and generally analyze better the equivalent costs and discounts.

Most of the calculations are made mainly at the DocumentOfferManager.js file which is responsible for these at the offer sheet.

Validations at the existing offer selection and offer → order processes

As in the case of the Automatic Document Lines, a validation of the added lines (either automatically or manually) is executed at both processes. Below is described in a tree list manner the flow of the validations which in some cases includes the Automatic Document Lines.

The validation flow was implemented at the SalesProcessPageManager.js. The affected methods are:

  • PreviewDocumentOffer
  • PreviewDocumentOfferForAccept
    • The above 2 methods are used for the select existing offer (copy offer) and the accept offer (offer → order) steps, respectively
  • ValidateDocumentOfferLines
  • ValidateDocumentOfferSalesIncentives
    • The above 2 methods describe the validation flow
    • The first one contains logic for the automatic document lines validation and in turn calls the second method which contains the logic of the sales incentives validation.


For more info on the process check Sales Incentives article.

Related Issues

AVGA-485 - Getting issue details... STATUS

AVGA-586 - Getting issue details... STATUS

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.