If you have a comment on this topic, contact Aptify Documentation. If you want to return to the Aptify Community Site, please click here.

Sample Commissions SQL Views Code

In this topic, an excerpt of the SQL code for the Commissions Source Order Lines view is listed and identifies the Source Trigger Date aliases and Available Commission Base Formula aliases referenced in the documentation. To view the complete code for the vwCommissionSourceOrderLines, open the Source SQL View from the Commission Source record installed with Aptify Commissions.


The following excerpt of code is from the SQL select statement used in the vwCommissionSourceOrderLines view installed with the Commission & Royalty Management application.


CREATE VIEW vwCommissionSourceOrderLines AS
SELECT /*Required Fields for plugging into CommissionAgreements*/
       o.SalesRepID, /*To Join Commission Agreements*/
       od.OrderID SourceID,
       'Orders' AS SourceEntity, /*Entity Name as the Source*/
       1 Split, /*Represents 100% or no split.*/
       /*Date fields available for CommissionPeriod*/


The Source Trigger Date field aliases shown below require a # in the alias name

       o.OrderDate [#Order Date],
       o.DepositDate [#Deposit Date],
       o.PromiseDate [#Promise Date],
       o.ShipDate [#Ship Date],
       o.ArrivalDate [#Arrival Date],
       o.DueDate [#Due Date],
       /*Product Information*/
       p.ID AS ProductID,
       p.Name, od.Sequence,
       /*Commission Base Fields for Calculating On*/
       p.CurrentAverageCost [$Current Average Cost],


The Available Commission Base Formula field aliases shown below require a $ in the alias name

       od.Quantity [$Quantity],
       od.Price [$Price],
       od.Discount [$Discount],
       od.QuantityShipped [$Quantity Shipped],




Copyright © 2014-2019 Aptify - Confidential and Proprietary