Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Description
This method creates a new cash receipt.
Parameters
Parameter |
Type |
Description |
|---|---|---|
cashReceipt |
The cash receipt object being created. |
|
context |
Specifies information about how the method will be called. |
|
policy |
Specifies the set of behaviors and behavior options to be applied during the operation. |
Interfaces
- Dynamics GP
- Sales
Examples
The following C# example creates a new cash receipt with a key value "WSPYMNT0000000010". The cash receipt key, customer key, and cash amount properties are set. All other properties use default values.
** Legacy endpoint**
using System;
using System.Collections.Generic;
using System.Text;
using DynamicsGPWebServiceSample.DynamicsGPService;
namespace DynamicsGPWebServiceSample
{
class Program
{
static void Main(string[] args)
{
CompanyKey companyKey;
Context context;
CustomerKey customerKey;
MoneyAmount cashAmount;
ReceivablesDocumentKey cashReceiptKey;
CashReceipt cashReceipt;
Policy cashReceiptCreatePolicy;
// 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 receivables document key to identify the cash receipt
cashReceiptKey = new ReceivablesDocumentKey();
cashReceiptKey.Id = "WSPYMNT0000000010";
// Create a customer key object to specify the customer for the cash receipt
customerKey = new CustomerKey();
customerKey.Id = "AARONFIT0001";
// Create a money amount object to specify the amount of the cash receipt
cashAmount = new MoneyAmount();
cashAmount.Currency = "USD";
cashAmount.Value = 10m;
// Create the cash receipt object and populate the required properties
cashReceipt = new CashReceipt();
cashReceipt.Key = cashReceiptKey;
cashReceipt.CustomerKey = customerKey;
cashReceipt.Amount = cashAmount;
// Get the create policy for cash receipts
cashReceiptCreatePolicy = wsDynamicsGP.GetPolicyByOperation("CreateCashReceipt", context);
// Create the cash receipt
wsDynamicsGP.CreateCashReceipt(cashReceipt, context, cashReceiptCreatePolicy);
}
}
}
** Native endpoint **
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using DynamicsGPWebServiceSample.DynamicsGPService;
namespace DynamicsGPWebServiceSample
{
class Program
{
static void Main(string[] args)
{
CompanyKey companyKey;
Context context;
CustomerKey customerKey;
MoneyAmount cashAmount;
ReceivablesDocumentKey cashReceiptKey;
CashReceipt cashReceipt;
Policy cashReceiptCreatePolicy;
// 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 receivables document key to identify the cash receipt
cashReceiptKey = new ReceivablesDocumentKey();
cashReceiptKey.Id = "WSPYMNT0000000010";
// Create a customer key object to specify the customer for the cash receipt
customerKey = new CustomerKey();
customerKey.Id = "AARONFIT0001";
// Create a money amount object to specify the amount of the cash receipt
cashAmount = new MoneyAmount();
cashAmount.Currency = "USD";
cashAmount.Value = 10m;
// Create the cash receipt object and populate the required properties
cashReceipt = new CashReceipt();
cashReceipt.Key = cashReceiptKey;
cashReceipt.CustomerKey = customerKey;
cashReceipt.Amount = cashAmount;
// Get the create policy for cash receipts
cashReceiptCreatePolicy = wsDynamicsGP.GetPolicyByOperation("CreateCashReceipt", context);
// Create the cash receipt
wsDynamicsGP.CreateCashReceipt(cashReceipt, context, cashReceiptCreatePolicy);
// Close the service
if(wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
}
}