Options

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

terry823terry823 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);

Best Answer

  • Options
    terry823terry823 Member Posts: 4
    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.

Answers

  • Options
    terry823terry823 Member Posts: 4
    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.
Sign In or Register to comment.