c2g.BackgroundMatchingService
global with sharing class BackgroundMatchingService
The service class relating to Background Matching.
Enums
MatchType
Specifies whether matching should be performed based on Customer Reference or Invoice Number.
DocumentReference |
Match cash entries and sales invoices/credit notes based on Customer Reference. |
DocumentNumber |
Match cash entries and sales invoices/credit notes based on Invoice Number. |
MatchMode
Specifies how any available outstanding cash should be automatically matched to other sales invoices/credit notes for the same account.
ExactOnly |
Cash will be matched to sales invoices/credit notes only if they have the correct reference. This is the default option. |
DocumentNumberOldestFirst |
Cash will be matched to sales invoices/credit notes starting from the oldest document number. For example, an invoice with the number SIN000067 will be matched before an invoice with the number SIN000100. |
DocumentNumberNewestFirst |
Cash will be matched to sales invoices/credit notes starting from the newest document number. For example, an invoice with the number SIN000100 will be matched before an invoice with the number SIN000067. |
OutstandingValueHighestFirst |
Cash will be matched to sales invoices/credit notes starting from the invoice with the highest outstanding value. For example, an invoice with an outstanding value of 300.00 will be matched before an invoice with an outstanding value of 150.00. |
OutstandingValueLowestFirst |
Cash will be matched to sales invoices/credit notes starting from the invoice with the lowest outstanding value. For example, an invoice with an outstanding value of 150.00 will be matched before an invoice with an outstanding value of 300.00. |
DateOldestFirst |
Cash will be matched to sales invoices/credit notes starting from the oldest invoice date. For example, an invoice with a date of May 30 2015 will be matched before an invoice with a date of June 1 2015. |
DateNewestFirst |
Cash will be matched to sales invoices/credit notes starting from the newest invoice date. For example, an invoice with a date of June 1 2015 will be matched before an invoice with a date of May 30 2015. |
CurrencyMode
Indicates whether matching should be in the currency of the account, or the currency of the posted document.
Document |
Document currency |
Account |
Account currency |
Methods
match
global static Id match(c2g.BackgroundMatchingService.Configuration configuration)
This service allows you to match outstanding transactions. See "About Background Matching" in the FinancialForce Help for more details.
Input Parameters
Return Value
This service returns a c2g.BackgroundMatchingService.MatchResult object.
matchCash
global static Id matchCash(c2g.BackgroundMatchingService.Configuration configuration)
This service allows you to match outstanding transactions. See "About Background Matching" in the FinancialForce Help for more details.
Input Parameters
configuration |
c2g.BackgroundMatchingService.Configuration |
Starts an AsyncApexJob that matches Cash Entry Lines to Invoice/Credit Note Lines based on the provided configuration using Async API Framework. If nothing is passed in configuration it will be defaulted to company defaults if applicable except Match Mode and Matching Date. Matching Date will be set to current date and Match Mode will be Exact Only if not passed. |
Return Value
This service returns the ID of a Process Run object.
matchCash
global static c2g.BackgroundMatchingService.MatchResult matchCash(c2g.BackgroundMatchingService.Configuration configuration, List<Id> transactionLines)
This service allows you to match outstanding transactions. See "About Background Matching" in the FinancialForce Help for more details.
Input Parameters
configuration |
c2g.BackgroundMatchingService.Configuration |
Starts an AsyncApexJob that matches cash entries to invoices based on the provided configuration. |
transactionLines |
List<Id> |
Matches cash transaction lines, specified by their IDs, to invoice or credit notes based on the provided configuration. |
Return Value
This service returns a c2g.BackgroundMatchingService.MatchResult object.
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.
Standard data setup.
1 - Create and select company.
2 - Setup accounting currencies, GLAs and Years and periods, tax codes, bank account etc.
3 - Create and post cash entries and invoices.
4 - Find out the ids of the transaction lines that relate to the cash lines you have created.
// Create the configuration
BackGroundMatchingService.Configuration configuration = new BackGroundMatchingService.Configuration();
// Set the Match Type
configuration.MatchType = BackGroundMatchingService.MatchType.DocumentReference;
// Do the Matching
BackgroundMatchingService.MatchResult matchResult = BackgroundMatchingService.matchCash( configuration, transactionLineIds);
This performs background matching for all the cash transaction lines retrieved using the passed IDs and applying the following conditions:
MatchingStatus = 'Available'
LineType__c = 'Account'
Transaction__r.TransactionType__c = 'Cash'
OwnerCompany__c = current company
match
global static c2g.BackgroundMatchingService.MatchResult match(c2g.BackgroundMatchingService.Configuration configuration, List<Id> transactionLines)
This service allows you to match outstanding transactions. See "About Background Matching" in the FinancialForce Help for more details.
Input Parameters
configuration |
c2g.BackgroundMatchingService.Configuration |
Starts an AsyncApexJob that matchs invoices to cash based on the provided configuration. |
transactionLines |
List<Id> |
Matches invoice transaction lines, specified by their IDs, to cash based on the provided configuration. |
Return Value
This service returns a c2g.BackgroundMatchingService.MatchResult object.
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.
Standard data setup.
1 - Create and select company.
2 - Setup accounting currencies, GLAs and Years and periods, tax codes, bank account etc.
3 - Create and post cash entries and invoices.
4 - Find out the ids of the transaction lines that relate to the invoice lines you have created.
// Create the configuration
BackGroundMatchingService.Configuration configuration = new BackGroundMatchingService.Configuration();
// Set the Match Type
configuration.MatchType = BackGroundMatchingService.MatchType.DocumentReference;
// Do the Matching
BackgroundMatchingService.MatchResult matchResult = BackgroundMatchingService.match( configuration, transactionLineIds);
This performs background matching for all the invoice transaction lines retrieved using the passed IDs and applying the following conditions:
MatchingStatus = 'Available'
LineType__c = 'Account'
Transaction__r.TransactionType__c = 'Invoice'
OwnerCompany__c = current company
c2g.BackgroundMatchingService.Configuration
global class Configuration
Holds parameters used by the background matching process.
Properties
MatchType |
c2g.BackgroundMatchingService.MatchType |
Specifies whether matching should be performed based on Customer Reference or Invoice Number.
|
PartialPayment |
Boolean |
If true, two transaction lines can be matched, even if their amounts do not.
|
MatchingDate |
Date |
The matching date. Current date is used by default.
|
MatchUptoDate |
Date |
The date to match up to. Any cash entries, sales invoices and sales credit notes with a document date later than this date will not be matched. Current date is used by default.
|
Mode |
c2g.BackgroundMatchingService.MatchMode |
Specifies how any available outstanding cash should be automatically matched to other sales invoices for the same account.
|
AccountIds |
Set<Id> |
Identifies the accounts whose transactions you want to match. By default background matching is performed for all accounts.
|
CashEntryIds |
Set<Id> |
Identifies the CashEntry whose transactions you want to match.
|
CurrencyMode |
c2g.BackgroundMatchingService.CurrencyMode |
Specifies whether matching should be in the currency of the account, or the currency of the posted document.
|
MatchCurrency |
String |
Specifies whether you are interested in one particular currency, or all currencies. The default is all currencies.
|
c2g.BackgroundMatchingService.MatchDetails
global class MatchDetails
Holds summary values for all the lines of the TransactionType.
Properties
TransactionType |
c2g.CommonService.TransactionType |
The type of transaction for which the details relate.
|
TotalMatchValue |
Decimal |
The total value matched for this TransactionType. The value could be postive or negative based on the type of document: SIN: Positive SCN: Negative CSH(Receipt): Negative CSH(Refund): Positive
|
Discount |
Decimal |
The total discount applied for the TransactionType.
|
Matches |
Integer |
The total number of matches performed for this TransactionType.
|
DocumentNumbers |
Set<String> |
The document numbers which are matched.
|
c2g.BackgroundMatchingService.MatchResult
global class MatchResult
Holds the details of the match.
Properties
MatchDetails |
List<c2g.BackgroundMatchingService.MatchDetails> |
The details of the match separated by TransactionType.
|
CashMatchingReferences |
List<Id> |
The IDs of the cash matching references created during the match.
|
UnProcessedTransactionLineIdSet |
List<Id> |
Contains transaction line IDs which are to be matched but were not processed because the number of matching references created exceeds the custom setting "Cash Matching Settings (FF) - Background Matching References Threshold", or a service limitation is reached.
|
|