Creating Invoices for Orders
createInvoicesforOrder API is used to create invoices for given orders. It accepts a List of order IDs as input and produces invoices for each order ID.
API |
Signature |
---|---|
createInvoicesForOrder |
|
This API is used to create invoices for given order ID. It accepts the order ID, targetDateTime and invoiceDate as input parameters. It creates invoices for the billing schedules that have status as pending billing and end date less than targetDateTime. All the new invoices are created with Invoice Date as the value mentioned in invoiceDate.
Request |
|||
---|---|---|---|
Field |
Type |
Required? |
Description |
orderId |
ID |
Yes |
Order Id |
targetDateTime |
Datetime |
Yes |
Invoice Process Through Date |
invoiceDate |
Date |
Yes |
Invoice Creation Date |
Response |
||
---|---|---|
Field |
Type |
Description |
Apttus_Config2__Invoice_c |
List of Invoice objects |
Invoices created for each order ID |
ID orderID = new ID();
Date invoiceDate = Date.newInstance(2017, 1, 1);
Date myDate = Date.newInstance(2017, 1, 1);
Time myTime = Time.newInstance(3, 3, 3, 0);
DateTime targetDateTime= DateTime.newInstance(myDate, myTime);
List <Invoice_c> invoices = Apttus_Billing.BillingService.createInvoicesForOrder(orderID, targetDateTime, invoiceDate);
API |
Signature |
---|---|
createInvoicesForOrder |
|
This API is used to create invoices for the given order ID. It accepts the order IDs and a class containing invoice creation options. the class contains options that influence the creation of an Invoice such as Invoice Date, Invoice Through Date and Auto Approve. It returns a list of invoices.
Request |
|||
---|---|---|---|
Field |
Type |
Required? |
Description |
orderId |
ID |
Yes |
Order Id |
options |
Apttus_Billing.InvoiceCreationOptions |
Yes |
Class holding the Invoice Creation Options |
Response |
||
---|---|---|
Field |
Type |
Description |
Apttus_Config2__Invoice_c |
List of Invoice objects |
Invoices created for each order ID |
DataObject - Billing.InvoiceCreationOptions |
|||
---|---|---|---|
Field |
Type |
Option Type |
Description |
abort |
Boolean |
Output |
If the process is aborted. |
autoApprove |
Boolean |
Input |
Mandatory Constructor. If autoApprove for Invoice is set to true. |
autoApproveAmount |
Decimal |
Input |
Mandatory Constructor. The amount provided for auto approval. |
autoApproveCreditMemo |
Boolean |
Input |
Mandatory Constructor. If autoApproveCreditMemo is set to true |
autoApproveOperator |
String |
Input |
Mandatory Constructor. The selected autoApproveOperator such as Greater than, Less than etc. |
invoiceDate |
Date |
Input |
Mandatory Constructor. The Invoice Date. |
invoiceDateType |
String |
Input |
The Invoice Date Type such as month or year. |
invoiceRun |
Apttus_Billing__ InvoiceRun__c |
Input |
The Invoice Run Object API Name. |
invoiceRunResult |
Apttus_Billing__ InvoiceRun Result__c |
Input/Output |
The Invoice Run Result Object API Name. |
numberAccountsProcessed |
Integer |
Output |
The number of accounts processed as part of the Invoice Runs. |
numberCreditMemos Genenerated |
Integer |
Output |
The number of Credit Memos generated. |
numberInvoicesGenenerated |
Integer |
Output |
The number of Invoices generated. |
numberOfAccountsThat GeneratedCreditMemos |
Integer |
Output |
Number of accounts for which Credit Memos are generated. |
numberOfAccountsThat GeneratedInvoices |
Integer |
Output |
Number of accounts for which Invoices are generated. |
numberOfAutoApprovedInvoices |
Integer |
Output |
Number of Invoices that are auto-approved. |
numberOfCreditMemos AutoApproved |
Integer |
Output |
Number of Credit Memos that are auto-approved. |
numberOfSuppressedInvoices |
Integer |
Output |
Number of Invoices that are suppressed. |
processThruDate |
Date |
Input |
Mandatory Constructor. The Process through date for invoice |
splitInvoicesByOrder |
Boolean |
Input |
Mandatory Constructor. If Split Invoices By Order is set to true. |
suppressInvoicesAmount |
Decimal |
Input |
Mandatory Constructor. The amount till which you want to suppress invoices. |
suppressInvoicesOperator |
String |
Input |
Mandatory Constructor.The selected Suppress Invoices operator such as Greater than, Less than etc. |
taxCallbackStatus |
String |
Output |
The status of Tax Callback. |
ID orderID = new ID();
Date invoiceDate = Date.newInstance(2017, 1, 1);
Date processThruDate = Date.newInstance(2017, 1, 1);
Boolean autoApprove = true;
Boolean splitInvoicesByOrder = true;
String autoApproveOperator = 'Greater than';
Decimal autoApproveAmount = 5.00 ;
String suppressInvoicesOperator = 'Less than';
Decimal suppressInvoicesAmount = 2.00;
Boolean autoApproveCreditMemo = true;
Apttus_Billing.InvoiceCreationOptions options = new Apttus_Billing.InvoiceCreationOptions(
invoiceDate,
processThruDate,
autoApprove,
splitInvoicesByOrder,
autoApproveOperator,
autoApproveAmount,
suppressInvoicesOperator,
suppressInvoicesAmount,
autoApproveCreditMemo);
Apttus_Billing.BillingService.createInvoicesForOrder(orderID, options);