Skip to main content

Notifications

Microsoft Dynamics GP (Archived)

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

Posted on by 1,145

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

*This post is locked for comments

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans