SCM

scmc.RebateService

global with sharing class RebateService

Service which provides rebate assignment based on item master IDs and associated criteria.

Author

Financial Force, Inc.

Date

09/24/2014

Methods

createSalesOrderRebates

global String createSalesOrderRebates(Id[] soIdList)

Creates all applicable item rebates for a given sales order.

Input Parameters

Name Type Description
soIdList Id[] An array of Sales_Order__c ids that need rebates.

Return Value

A code indicating success or failure reason.

createSalesOrderLineItemRebates

global String createSalesOrderLineItemRebates(Id[] soLineItemIdList)

Creates all applicable item rebates for a given sales order line item.

Input Parameters

Name Type Description
soLineItemIdList Id[] An array Sales_Order_Line_Item__c ids that need rebates.

Return Value

A code indicating success or failure reason

createCustomerQuotationRebatesFromLines

global String createCustomerQuotationRebatesFromLines(List<scmc__Customer_Quotation_Line__c> cqLineList)

Creates all applicable item rebates for the List of Customer_Quotation_Line__c records.

Input Parameters

Name Type Description
cqLineList List<scmc__Customer_Quotation_Line__c> A List of Customer_Quotation_Line__c that need rebates.

Return Value

A code indicating success or failure reason

createCustomerQuotationRebates

global String createCustomerQuotationRebates(Id[] cqIdList)

Creates all applicable item rebates for a given customer quotation.

Input Parameters

Name Type Description
cqIdList Id[] An array of Customer_Quotation__c ids that need rebates.

Return Value

A code indicating success or failure reason

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

List<Id> customerQuotationIdList = new List<Id>{'b00000000000BBB'};
SCMC.RebateService service = new SCMC.RebateService();
String statusResult = service.createCustomerQuotationRebates(customerQuotationIdList);

if(statusResult == 'SUCCESS') {
    // do something in case of success ...
} else {
    throw new Exception(statusResult);
}

createCustomerQuotationLineRebates

global String createCustomerQuotationLineRebates(Id[] cqLineIdList)

Creates all applicable item rebates for a given customer quotation line.

Input Parameters

Name Type Description
cqLineIdList Id[] An array of Customer_Quotation_Line__c ids that need rebates.

Return Value

A code indicating success or failure reason

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

List<Id> customerQuotationLineIdList = new List<Id>{'c00000000000CCC'};
SCMC.RebateService service = new SCMC.RebateService();
String statusResult = service.createCustomerQuotationLineRebates(customerQuotationLineIdList);

if(statusResult == 'SUCCESS') {
    // do something in case of success ...
} else {
    throw new Exception(statusResult);
}

createPurchaseOrderRebates

global String createPurchaseOrderRebates(Id[] poIdList)

Creates all applicable item rebates for a given purchase order.

Input Parameters

Name Type Description
poIdList Id[] An array of <b>Purchase_Order__c</b> ids that need rebates.

Return Value

A code indicating success or failure reason

createPurchaseOrderLineItemRebates

global String createPurchaseOrderLineItemRebates(Id[] poLineItemIdList)

Creates all applicable item rebates for a given purchase order line item.

Input Parameters

Name Type Description
poLineItemIdList Id[] An array of Purchase_Order_Line_Item__c ids that need rebates.

Return Value

A code indicating success or failure reason

RebateService

global RebateService()

Initialize the service.

RebateService

global RebateService(List<scmc__Customer_Quotation_Line__c> customerQuotationLines)

Initialize the service with a List of Customer_Quotation_Line__c objects. Respects combinability rules.

Input Parameters

Name Type Description
customerQuotationLines List<scmc__Customer_Quotation_Line__c> A List of Customer_Quotation_Line__c objects to pull rebates for.

RebateService

global RebateService(List<scmc__Customer_Quotation_Line__c> customerQuotationLines, Boolean checkCombinability)

Initialize the service with a List of Customer_Quotation_Line__c objects.

Input Parameters

Name Type Description
customerQuotationLines List<scmc__Customer_Quotation_Line__c> A List of Customer_Quotation_Line__c objects to pull rebates for.
checkCombinability Boolean Set to false to skip the combinability rule check for rebates.

RebateService

global RebateService(List<scmc__Sales_Order_Line_Item__c> salesOrderLineItems)

Initialize the service with a List of Sales_Order_Line_Item__c objects.

Input Parameters

Name Type Description
salesOrderLineItems List<scmc__Sales_Order_Line_Item__c> A List of Sales_Order_Line_Item__c objects to pull rebates for.

RebateService

global RebateService(List<scmc__Purchase_Order_Line_Item__c> purchaseOrderLineItems)

Initialize the service with a List of Purchase_Order_Line_Item__c objects.

Input Parameters

Name Type Description
purchaseOrderLineItems List<scmc__Purchase_Order_Line_Item__c> A List of Purchase_Order_Line_Item__c objects to pull rebates for.

RebateService

global RebateService(List<scmc__Invoice_Line_Item__c> invoiceLineItems)

Initialize the service with a List of Invoice_Line_Item__c objects.

Input Parameters

Name Type Description
invoiceLineItems List<scmc__Invoice_Line_Item__c> A List of Invoice_Line_Item__c objects to pull rebates for.

getRebatesApplied

global List<RebateAppliedLine> getRebatesApplied(Id[] lineIdArray)

Determine all rebates associated with the array of object ids.

Input Parameters

Name Type Description
lineIdArray Id[] An array of object ids that may have rebates. These ids can reference customer quotation lines, sales order lines or purchase order lines depending on how the constructor was invoked.

Return Value

A List of RebateAppliedLine objects associated with the array of ids using an effective date of today.

getRebatesApplied

global List<RebateAppliedLine> getRebatesApplied(Id lineId)

Determine rebate that applies to a single object id.

Input Parameters

Name Type Description
lineId Id A single ID that can reference a customer quotation line, a sales order line, purchase order line, depending on how constructor was invoked using an effective date of today. Note - a drawback of using this method is it just examines rebates applicable to a single line, not taking into account if a rebate had already been applied to a different line containing the same item. To check that, use the getRebatesApplied() method and pass the full array of line IDs.

Return Value

A list of RebateAppliedLine objects that apply to a single ID.

getRebatesApplied

global List<RebateAppliedLine> getRebatesApplied(Id lineId, Date effectiveDate)

Determine applicable rebates for a single object for a specific date.

Input Parameters

Name Type Description
lineId Id A single ID that can reference a customer quotation line, sales order line or a purchase order line, depending on how the constructor was invoked using an date of the parameter effectiveDate.
effectiveDate Date A date indicating the effective date to check.

Return Value

Returns a List of RebateAppliedLine objects for a single line ID (customer quotation line, sales order line, purchase order line, depending on how constructor was invoked) using the requested effective date.

© Copyright 2009–2019 FinancialForce.com, inc. All rights reserved. Various trademarks held by their respective owners.