Retrieves a list of cash receipt summary objects that match the specified criteria.
Parameter |
Type |
Description |
---|---|---|
criteria |
The cash receipt criteria object that specifies which cash receipt summary objects are returned. |
|
context |
Specifies information about how the method will be called. |
Value |
Type |
Description |
---|---|---|
GetCashReceiptListResult |
The list of cash receipt summary objects that match the specified criteria. |
The following C# example retrieves the list of cash receipt summary objects for the customer with the ID “AARONFIT0001”. A second restriction is used to only retrieve the customer’s cash receipt documents with a transaction state of “Work”. A message box displays the Date and Amount from each cash receipt summary that was returned.
Legacy endpoint
using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using DynamicsGPWebServiceSample.DynamicsGPService; namespace DynamicsGPWebServiceSample { class Program { static void Main(string[] args) { CompanyKey companyKey; Context context; LikeRestrictionOfString customerIdRestriction; ListRestrictionOfNullableOfReceivablesTransactionState transactionStateRestriction; CashReceiptCriteria cashReceiptCriteria; CashReceiptSummary[] cashReceiptSummaries; // Create an instance of the service DynamicsGP wsDynamicsGP = new DynamicsGP(); // Be sure the default credentials are used wsDynamicsGP.UseDefaultCredentials = true; // Create a context with which to call the service context = new Context(); // Specify which company to use (sample company) companyKey = new CompanyKey(); companyKey.Id = (-1); // Set up the context object context.OrganizationKey = (OrganizationKey)companyKey; // Create the restriction objects // Retrieve cash receipts for customer with customer ID of 'AARONFIT0001' customerIdRestriction = new LikeRestrictionOfString(); customerIdRestriction.EqualValue = "AARONFIT0001"; // Only retrieve cash receipts with a transaction state of 'Work' transactionStateRestriction = new ListRestrictionOfNullableOfReceivablesTransactionState(); transactionStateRestriction.EqualValue = ReceivablesTransactionState.Work; // Create the cash receipt criteria object cashReceiptCriteria = new CashReceiptCriteria(); cashReceiptCriteria.CustomerId = customerIdRestriction; cashReceiptCriteria.TransactionState = transactionStateRestriction; // Retrieve the list of cash receipt summary objects cashReceiptSummaries = wsDynamicsGP.GetCashReceiptList(cashReceiptCriteria, context); // Display the ID and amount of each member of the summary object list StringBuilder summaryList = new StringBuilder(); foreach (CashReceiptSummary a in cashReceiptSummaries) { summaryList.AppendLine("Date: " + a.Date.Value.ToShortDateString() + " Cash amount: " + a.Amount.Value.ToString("C")); } MessageBox.Show(summaryList.ToString()); } } }
Native endpoint
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using DynamicsGPWebServiceSample.DynamicsGPService; namespace DynamicsGPWebServiceSample { class Program { static void Main(string[] args) { CompanyKey companyKey; Context context; LikeRestrictionOfstring customerIdRestriction; ListRestrictionOfNullableOfReceivablesTransactionState transactionStateRestriction; CashReceiptCriteria cashReceiptCriteria; CashReceiptSummary[] cashReceiptSummaries; // Create an instance of the service DynamicsGPClient wsDynamicsGP = new DynamicsGPClient(); // Create a context with which to call the service context = new Context(); // Specify which company to use (sample company) companyKey = new CompanyKey(); companyKey.Id = (-1); // Set up the context object context.OrganizationKey = (OrganizationKey)companyKey; // Create the restriction objects // Retrieve cash receipts for customer with customer ID of 'AARONFIT0001' customerIdRestriction = new LikeRestrictionOfstring(); customerIdRestriction.EqualValue = "AARONFIT0001"; // Only retrieve cash receipts with a transaction state of 'Work' transactionStateRestriction = new ListRestrictionOfNullableOfReceivablesTransactionState(); transactionStateRestriction.EqualValue = ReceivablesTransactionState.Work; // Create the cash receipt criteria object cashReceiptCriteria = new CashReceiptCriteria(); cashReceiptCriteria.CustomerId = customerIdRestriction; cashReceiptCriteria.TransactionState = transactionStateRestriction; // Retrieve the list of cash receipt summary objects cashReceiptSummaries = wsDynamicsGP.GetCashReceiptList(cashReceiptCriteria, context); // Display the ID and amount of each member of the summary object list StringBuilder summaryList = new StringBuilder(); foreach (CashReceiptSummary a in cashReceiptSummaries) { summaryList.AppendLine("Date: " + a.Date.Value.ToShortDateString() + " Cash amount: " + a.Amount.Value.ToString("C")); } MessageBox.Show(summaryList.ToString()); // Close the service if(wsDynamicsGP.State != CommunicationState.Faulted) { wsDynamicsGP.Close(); } } } }