Book Image

Learning MS Dynamics AX 2012 Programming

By : Mohammed Rasheed, Erlend Dalen
Book Image

Learning MS Dynamics AX 2012 Programming

By: Mohammed Rasheed, Erlend Dalen

Overview of this book

<p>This tutorial has been carefully structured to guide you through the basic features of AX development and get you started as quickly as possible. With this book, you will soon be able to develop and maintain comprehensive management solutions to enhance your Dynamics AX 2012 application's performance. Starting with a tour of the development environment, you'll gain a deep understanding of Dynamics AX tools and architecture, before getting to grips with X++ for deeper customization. You will also learn how to search, manipulate, and integrate data.</p> <p>The practical examples in this book take you through sample AX development projects and help you learn to create forms, reports, menu&nbsp; items, menus, and navigation pages. The book also helps you work with MorphX. By the end of this book, you will have a better understanding of the inner workings of Microsoft Dynamics AX—making your development simpler and faster, and your applications fast, reliable, and robust.</p>
Table of Contents (21 chapters)
Learning MS Dynamics AX 2012 Programming
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Links
Debugger
Index

The voucher settlement


When a payment is made or received toward an invoice, either on the vendor side or on the customer side, the transactions have to settle against each other in order to close the transaction. Obviously, the standard functionality in AX lets the users take care of this in a very neat way using the payment journal form where they can enter the payment into AX and mark the invoices to settle the payment against, as shown in the following screenshot:

However, you might find yourself creating an integration that should take care of this automatically and then it would be nice to know how to do this using AX, right?

Ok, so let's assume that a payment has been registered by the customer account shown in the form shown previosly (3001), but the settlement hasn't been done yet and it is our task to write the code that takes care of it:

The following code should then do the trick:

static void settlePayment(Args _args)
{
  CustTable custTable;
  CustTrans invCustTrans, payCustTrans...