Cash receipt journal payment applying to multiple customer entries (invoice) in code

terry823
Member Posts: 4
Hello,
I'm having trouble applying a payment in Cash Receipt Journal for customer account to multiple invoices. The posting is done manually. The record in the Cash Receipt Journal and applying of entries is done in code. 1:1 works fine because in this case I'm setting the "Applies to Doc type" and "Applies to Doc no." fields.
When payment posted without opening the "Apply Entries" window no application entry is made. The payment entry is logged on the cust ledger original amount, amount, amount remaining are the same initial values. Nothing is applied. When I click the "applied entries" action up top the window opens with nothing.
Now prior to posting if I open up the apply customer entries window - select the entries, "Set applies to ID" action, and change the apply amount value for what I want to set for each, click ok. Post. It works fine.
I hope someone can shine some light on this for me. Perhaps I've missed a crucial step somewhere... Thanks!
Below is code snippet:
GenJrnlLine //for payment is INIT with the relevant info
For loop for lrecCustLedgerEntry //Invoice entries
//Inside loop
ApplyingCustLedgEntry."Entry No." := 1;
ApplyingCustLedgEntry."Applying Entry" := TRUE;
ApplyingCustLedgEntry."Posting Date" := GenJrnlLine."Posting Date";
ApplyingCustLedgEntry."Document Type" := GenJrnlLine."Document Type";
ApplyingCustLedgEntry."Document No." := GenJrnlLine."Document No.";
ApplyingCustLedgEntry."Customer No." := GenJrnlLine."Account No.";
ApplyingCustLedgEntry.Description := GenJrnlLine.Description;
ApplyingCustLedgEntry."Currency Code" := GenJrnlLine."Currency Code";
ApplyingCustLedgEntry.Amount := lAmt;
ApplyingCustLedgEntry."Remaining Amount" := lRemAmtRunningT;
CustLedger.VALIDATE("Amount to Apply", ePayDotNetInvoicePayment.PaymentAmount);
CustSetApply.SetApplId(CustLedger, ApplyingCustLedgEntry, lrecCustLedgerEntry."Document No.");
lrecCustLedgerEntry.MODIFY(TRUE);
//End loop
GenJrnLine.INSERT(TRUE);
I'm having trouble applying a payment in Cash Receipt Journal for customer account to multiple invoices. The posting is done manually. The record in the Cash Receipt Journal and applying of entries is done in code. 1:1 works fine because in this case I'm setting the "Applies to Doc type" and "Applies to Doc no." fields.
When payment posted without opening the "Apply Entries" window no application entry is made. The payment entry is logged on the cust ledger original amount, amount, amount remaining are the same initial values. Nothing is applied. When I click the "applied entries" action up top the window opens with nothing.
Now prior to posting if I open up the apply customer entries window - select the entries, "Set applies to ID" action, and change the apply amount value for what I want to set for each, click ok. Post. It works fine.
I hope someone can shine some light on this for me. Perhaps I've missed a crucial step somewhere... Thanks!
Below is code snippet:
GenJrnlLine //for payment is INIT with the relevant info
For loop for lrecCustLedgerEntry //Invoice entries
//Inside loop
ApplyingCustLedgEntry."Entry No." := 1;
ApplyingCustLedgEntry."Applying Entry" := TRUE;
ApplyingCustLedgEntry."Posting Date" := GenJrnlLine."Posting Date";
ApplyingCustLedgEntry."Document Type" := GenJrnlLine."Document Type";
ApplyingCustLedgEntry."Document No." := GenJrnlLine."Document No.";
ApplyingCustLedgEntry."Customer No." := GenJrnlLine."Account No.";
ApplyingCustLedgEntry.Description := GenJrnlLine.Description;
ApplyingCustLedgEntry."Currency Code" := GenJrnlLine."Currency Code";
ApplyingCustLedgEntry.Amount := lAmt;
ApplyingCustLedgEntry."Remaining Amount" := lRemAmtRunningT;
CustLedger.VALIDATE("Amount to Apply", ePayDotNetInvoicePayment.PaymentAmount);
CustSetApply.SetApplId(CustLedger, ApplyingCustLedgEntry, lrecCustLedgerEntry."Document No.");
lrecCustLedgerEntry.MODIFY(TRUE);
//End loop
GenJrnLine.INSERT(TRUE);
0
Best Answer
-
After day of debugging I've managed to fix the issue. I'm inserting the GenJrnLine (payment) to cash receipt journal as I populate it with info. Then I'm also setting the "Applies to ID" of this GenJrnLine (payment)to the "Document No." of this GenJrnLine(payment).
I'm also passing in the payment No in the SetAppId instead of the invoice no. which is what I was doing before.
It seems to be working fine. Figured I'd share the solution in case someone else runs into the same issue.0
Answers
-
After day of debugging I've managed to fix the issue. I'm inserting the GenJrnLine (payment) to cash receipt journal as I populate it with info. Then I'm also setting the "Applies to ID" of this GenJrnLine (payment)to the "Document No." of this GenJrnLine(payment).
I'm also passing in the payment No in the SetAppId instead of the invoice no. which is what I was doing before.
It seems to be working fine. Figured I'd share the solution in case someone else runs into the same issue.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions