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],



Related Topics

Using Commission and Royalty Management

Installing the Commission and Royalty Management Application

Setting Up Commission and Royalty Management

Managing Commissions and Royalties


Was this article helpful?
0 out of 0 found this helpful



Please sign in to leave a comment.