Quantcast
Channel: Microsoft Dynamics GP Forum - Recent Threads
Viewing all articles
Browse latest Browse all 32807

GP WebService: How to insert Cash or Check or CreditCard amount with Purchase Amount in Payable Transaction?

$
0
0

GP WebService: How to insert Cash or Check or CreditCard amount with Purchase Amount in Payable Invoice Transaction, please need help.

     The following code for Payable Invoice Transaction only with Purchase Amount, but i need to include Cash or Check or Creditcard amount.

CompanyKey companyKey;
            Context context;
            PayablesDocumentKey invoiceKey;
            BatchKey batchKey;
            VendorKey vendorKey;
            PayablesInvoice payablesInvoice;
            Policy payablesInvoiceCreatePolicy;

            // 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 payables document key object to identify the payables invoice
            invoiceKey = new PayablesDocumentKey();
            invoiceKey.Id = "00000000000001550";

            // Create a batch key
            batchKey = new BatchKey();
            batchKey.Id = "PAYABLES BATCH";

            // Create a vendor key
            vendorKey = new VendorKey();
            vendorKey.Id = "ADVANCED0001";

            // Create a money amount object for the transaction
            MoneyAmount purchaseAmount = new MoneyAmount();
            purchaseAmount.Currency = "USD";
            purchaseAmount.Value = 250m;

            // Create a payables invoice object
            payablesInvoice = new PayablesInvoice();

            // Populate the invoice properties
            payablesInvoice.Key = invoiceKey;
            payablesInvoice.BatchKey = batchKey;
            payablesInvoice.VendorKey = vendorKey;
            payablesInvoice.VendorDocumentNumber = "DOCUMENT 10";
            payablesInvoice.PurchasesAmount = purchaseAmount;

            // Get the create policy for payables invoices
            payablesInvoiceCreatePolicy = wsDynamicsGP.GetPolicyByOperation(
            "CreatePayablesInvoice", context);

            // Create the payables invoice
            wsDynamicsGP.CreatePayablesInvoice(payablesInvoice, context, payablesInvoiceCreatePolicy);

Thanks in Advance

Sekar V


Viewing all articles
Browse latest Browse all 32807

Trending Articles