Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 73760

Posting Purchase Invoice from C#

$
0
0

Hi,

I found this code on Becky Newell blog about using LedgerPurchaseInvoice service.

Here's the code with some small modifications:

 

var account = new AxdType_MultiTypeAccount() { Account = "CN-001", DisplayValue = "CN-001" };

var worker = new AxdEntity_HcmWorkerLineApprover() { PartyNumber = "000000033" };

var journalLine = new AxdEntity_LedgerJournalTrans()

{

AccountType = AxdEnum_LedgerJournalACType.Vend,

AccountTypeSpecified = true,

Company = "usmf",

LedgerDimension = account,

Invoice = "1235",

AmountCurDebit = 120,

AmountCurDebitSpecified = true,

HcmWorkerLineApprover = new[] { worker }

}

var journalHeader = new AxdEntity_LedgerJournalTable()

{

JournalName = "APInvReg", 

LedgerJournalTrans = new[] { journalLine }

};

var purchInvoice = new AxdPurchaseInvoice() { LedgerJournalTable = new[] { journalHeader } };

var client = new PurchaseInvoiceServiceClient();

client.create(null, purchInvoice);

 

This code works fine and it creates an entry in Invoice register under AP but how can I post it?

AxdEntity_LedgerJournalTable has Posted property but it seems like it's ignored. Do I have to create any other entities before setting it to Yes?

 

What is PartyNumber?

 

And most important question is where can I find more and detailed info about using AIF? msdn doesn't help much.

 


Viewing all articles
Browse latest Browse all 73760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>