Compartilhar via


GetCustomerReceivablesSummaryList

Description

Retrieves a list of customer receivables summary objects that match the specified criteria.

Parameters

Parameter

Type

Description

criteria

CustomerReceivablesSummaryCriteria

The customer receivables summary criteria object that specifies which customer receivables summary objects are returned.

context

Context

Specifies information about how the method will be called.

Return Value:

Value

Type

Description

GetCustomerReceivablesSummaryList
Result

ArrayOfCustomerReceivablesSummary

The list of customer receivables summary objects that match the specified criteria.

Interfaces

  • Dynamics GP
  • Sales

Examples

The following C# example retrieves the list of customer receivables summary objects where the salesperson ID is equal to "Paul W.". A message box displays the customer number and on order amount of each customer that has an on order balance.

Cc508689.LegacyEndpoint(en-us,MSDN.10).gif** 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 salespersonIdRestriction;
            CustomerReceivablesSummaryCriteria customerReceivablesSummaryCriteria;
            CustomerReceivablesSummary[] customerReceivablesSummaryList;

            // 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 a restriction object
            // Retrieve all customer receivables summary objects where 'Paul W.' is the specified salesperson
            salespersonIdRestriction = new LikeRestrictionOfString();
            salespersonIdRestriction.EqualValue = "PAUL W.";

            // Create the criteria object and specify the criteria restriction
            customerReceivablesSummaryCriteria = new CustomerReceivablesSummaryCriteria();
            customerReceivablesSummaryCriteria.SalespersonId = salespersonIdRestriction;

            // Retrieve the list of customer receivables summary objects
            customerReceivablesSummaryList = wsDynamicsGP.GetCustomerReceivablesSummaryList
                (customerReceivablesSummaryCriteria, context);

            // Display the customer number and on order amount for members of the
            // customer receivables summary list that have an on order balance
            StringBuilder summaryList = new StringBuilder();
            foreach (CustomerReceivablesSummary a in customerReceivablesSummaryList)
            {
                if (a.OnOrderAmount.Value > 0)
                {
                    summaryList.AppendLine("Customer: " + a.Key.Id
                        + "   On order amount: " + a.OnOrderAmount.Value.ToString("C"));
                }
            }
            MessageBox.Show(summaryList.ToString());

    }
}

Cc508689.NativeEndpoint(en-us,MSDN.10).gif** Native endpoint **

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Windows.Forms;
using DynamicsGPWebServiceSample.DynamicsGPService;

namespace DynamicsGPWebServiceSample
{
    class Program
    {
        static void Main(string[] args)
        {
            CompanyKey companyKey;
            Context context;
            LikeRestrictionOfstring salespersonIdRestriction;
            CustomerReceivablesSummaryCriteria customerReceivablesSummaryCriteria;
            CustomerReceivablesSummary[] customerReceivablesSummaryList;

            // 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 a restriction object
            // Retrieve all customer receivables summary objects where 'Paul W.' is the specified salesperson
            salespersonIdRestriction = new LikeRestrictionOfstring();
            salespersonIdRestriction.EqualValue = "PAUL W.";

            // Create the criteria object and specify the criteria restriction
            customerReceivablesSummaryCriteria = new CustomerReceivablesSummaryCriteria();
            customerReceivablesSummaryCriteria.SalespersonId = salespersonIdRestriction;

            // Retrieve the list of customer receivables summary objects
            customerReceivablesSummaryList = wsDynamicsGP.GetCustomerReceivablesSummaryList
                (customerReceivablesSummaryCriteria, context);

            // Display the customer number and on order amount for members of the
            // customer receivables summary list that have an on order balance
            StringBuilder summaryList = new StringBuilder();
            foreach (CustomerReceivablesSummary a in customerReceivablesSummaryList)
            {
                if (a.OnOrderAmount.Value > 0)
                {
                    summaryList.AppendLine("Customer: " + a.Key.Id
                        + "   On order amount: " + a.OnOrderAmount.Value.ToString("C"));
                }
            }
            MessageBox.Show(summaryList.ToString());

            // Close the service
            if(wsDynamicsGP.State != CommunicationState.Faulted)
            {
                wsDynamicsGP.Close();
            }

    }
}