Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Pending payment list

Posted on by 1,835

3324.UU.png

Hello All,

I manually prepared the mail functionality the name is 'Pending payment list'

I want to trace a data from customer ledger entry where document type is 'Invoice'. Here,  general voucher and posted general voucher are coming because its document type is also a 'Invoice'.
Is there any way I can trace only invoice data...from here

i am currently using the follwing filter:

CustLedgEntry.SETCURRENTKEY("Customer No.", Open, Positive, "Due Date", "Currency Code");
CustLedgEntry.SETRANGE(Open,TRUE);
CustLedgEntry.SETRANGE(CustLedgEntry."Document Type",CustLedgEntry."Document Type"::Invoice);

please suggect me to resolve this. I have attached the screenshot of the cust ledger entry.


regards,
manish

*This post is locked for comments

  • manish.yadav Profile Picture
    manish.yadav 1,835 on at
    RE: Pending payment list

    u r great sir.

    very thanx

    manish

    i write the code:

    SalesPerson.RESET;

    SalesPerson.SETRANGE(Code, CustLedgEntry."Salesperson Code");

      IF SalesPerson.FINDFIRST THEN BEGIN

       Mail.AppendBody('<td>'+FORMAT(SalesPerson.Name)+'</td>');

      END;

    it is working

    very thanx again...

  • Verified answer
    Binesh Profile Picture
    Binesh 7,885 on at
    RE: Pending payment list

    In your Code see the bellow line

    SalesPerson.GET(CustLedgEntry."Salesperson Code");

    This line given error, when ever CustLedgEntry."Salesperson Code" don't have value

    so better to write

    IF SalesPerson.GET(CustLedgEntry."Salesperson Code") THEN;

    -----------------------------------

    AND for NOT LIKE

    you can write like

    IF STRPOS('CURRENT','CURR') <> 0 THEN

     CURRREPORT.SKIP;

  • manish.yadav Profile Picture
    manish.yadav 1,835 on at
    RE: Pending payment list

    7317.UU.png

    I am using this code to trace the pending payment list. The code is :

    CLEAR(Mail);

    Mail.CreateMessage('MKU Private Limited','nav@mku.com','manish.yadav@mku.com','Pending Payment Invoice List.','',TRUE);

    Mail.AppendBody('Dear Sir / Madam');

    Mail.AppendBody('<br><br>');

    Mail.AppendBody('Please Find Pending Payments List.');

    Mail.AppendBody('<HR>');

    Mail.AppendBody('<table border="1">');

    Mail.AppendBody('<tr>');

    Mail.AppendBody('<th>Invoice No.</th>');

    Mail.AppendBody('<th>Invoice Date</th>');

    Mail.AppendBody('<th>Due Date</th>');

    Mail.AppendBody('<th>Currency</th>');

    Mail.AppendBody('<th>Invoice Amount</th>');

    Mail.AppendBody('<th>Balance Amount</th>');

    Mail.AppendBody('<th>Sales Region</th>');

    Mail.AppendBody('</tr>');

    CustLedgEntry.SETCURRENTKEY("Customer No.", Open, Positive, "Due Date", "Currency Code");

    CustLedgEntry.SETRANGE(CustLedgEntry."Customer No.", CustNo);

    CustLedgEntry.SETRANGE(Open,TRUE);

    CustLedgEntry.SETRANGE(CustLedgEntry."Document Type",CustLedgEntry."Document Type"::Invoice);

    CustLedgEntry.SETFILTER(CustLedgEntry."Document Type", 'Invoice');

    CustLedgEntry.SETFILTER(CustLedgEntry."Customer No.",'*@C-*');

    IF CustLedgEntry.FINDFIRST THEN REPEAT

    CustLedgEntry.CALCFIELDS("Amount (LCY)");

    CustLedgEntry.CALCFIELDS("Remaining Amt. (LCY)");

    Mail.AppendBody('<tr>');

    Mail.AppendBody('<td>'+FORMAT(CustLedgEntry."Document No.")+'</td>');

    Mail.AppendBody('<td align="center">'+FORMAT(CustLedgEntry."Posting Date")+'</td>');

    Mail.AppendBody('<td align="center">'+FORMAT(CustLedgEntry."Due Date")+'</td>');

    Mail.AppendBody('<td align="center">'+FORMAT(CustLedgEntry."Currency Code")+'</td>');

    Mail.AppendBody('<td align="right">'+FORMAT(CustLedgEntry."Amount (LCY)")+'</td>');

    Mail.AppendBody('<td align="right">'+FORMAT(CustLedgEntry."Remaining Amt. (LCY)")+'</td>');

    SalesPerson.GET(CustLedgEntry."Salesperson Code");

    Mail.AppendBody('<td>'+FORMAT(SalesPerson.Name)+'</td>');

    Mail.AppendBody('</tr>');

    UNTIL(CustLedgEntry.NEXT=0);

    Mail.AppendBody('</table>');

    Mail.AppendBody('<br>');

    Mail.AppendBody('Regards');

    Mail.AppendBody('<br>');

    Mail.AppendBody('MKU Sales Department');

    Mail.AppendBody(' ');

    Mail.AppendBody('<br><br>');

    Mail.AppendBody('<HR>');

    Mail.AppendBody('This is a system generated mail. Please do not reply to this email ID.');

    Mail.Send;

    Code is compiled, not showing any error messages. But when we run this code code, always getting error messages... I have attached the screenshots.

    I have declare the following variables:

    Name                                                    DataType Subtype Length

    Mail Codeunit SMTP Mail

    CustLedgEntry                                                                         Record Cust. Ledger Entry

    SMTPSetup Record SMTP Mail Setup

    SalesPerson Record Salesperson/Purchaser

    Customer Record Customer

    CustNo Text

  • manish.yadav Profile Picture
    manish.yadav 1,835 on at
    RE: Pending payment list

    [select * from [MKU Private Limited$Cust_ Ledger Entry] where [Document Type] = 2 and [Customer No_] not like '%CURR%']

    I want to use this condition in Cal coding.

    how to set it through filter. For Ex...

    CustLedgEntry.SETFILTER(CustLedgEntry."Document Type", 'Invoice');

    CustLedgEntry.SETFILTER(CustLedgEntry."Customer No.",'*@C-*');

    I am unable to set the not like condition here( '%CURR%').

    manish

  • Suggested answer
    Binesh Profile Picture
    Binesh 7,885 on at
    RE: Pending payment list

    what you want to filter just write in english/hindi language, then we will convert in C/AL code.

  • manish.yadav Profile Picture
    manish.yadav 1,835 on at
    RE: Pending payment list

    Thank you for your fast reply Sir.

    Do you have any idea about, how to set not like filter in cal coding.

    Detailed Customer Ledger Entry Table is not fulfilling my requirements. Pending invoice payment list  can not be capture there.

    manish.

  • RE: Pending payment list

    Hi,

    You should probably use Detailed Customer Ledger Entry Table.

    In Detailed Customer Ledger Entry Table, look at Entry Type and Initial Document Type fields.

    Check with your requirements and use the filterations accordingly.

    Hope it helps.

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans