Dear Experts,
I prepared the mail functionality for daily posted general voucher entry in navision system.
Here I have tried to show the opening balance in 'Shift Start' but it is always showing the zero.
Please help me resolve this issue. The Code is below:
Mail.CreateMessage('MKU Limited','nav@mku.com','test2@mku.com','General Voucher Summary','',TRUE) ;
Mail.AppendBody('Dear Sir / Madam,');
Mail.AppendBody('<br>');
Mail.AppendBody('Please Find The General Voucher Details:');
Mail.AppendBody('<br><br>');
Mail.AppendBody('<table border="1">');
Mail.AppendBody('<tr>');
Mail.AppendBody('<th>Document No.</th>');
Mail.AppendBody('<th>Posting Date</th>');
Mail.AppendBody('<th align="left">Description</th>');
Mail.AppendBody('<th>Debit Amount</th>');
Mail.AppendBody('<th>Credit Amount</th>');
Mail.AppendBody('<th>Unit</th>');
Mail.AppendBody('</tr>');
GLEntry.RESET;
GLEntry.SETFILTER(GLEntry."Posting Date",'%1..%2',0D,TODAY-1);
GLEntry.CALCSUMS(Amount);
IF GLEntry.Amount > 0 THEN
OpeningDRBal := GLEntry.Amount;
IF GLEntry.Amount < 0 THEN
OpeningCRBal := -GLEntry.Amount;
Mail.AppendBody('<th align="right" colspan="3">Opening Balance</th><th colspan="3">'+FORMAT(OpeningDRBal)+'</th>');
Mail.AppendBody('</tr>');
recGLEntry.RESET;
recGLEntry.SETRANGE(recGLEntry."Posting Date",TODAY);
recGLEntry.SETFILTER(recGLEntry."Source Code",'GENJNL');
IF recGLEntry.FINDFIRST THEN
BEGIN
REPEAT
Mail.AppendBody('<tr>');
Mail.AppendBody('<td>'+FORMAT(recGLEntry."Document No.")+'</td>');
Mail.AppendBody('<td align="center">'+FORMAT(recGLEntry."Posting Date")+'</td>');
Mail.AppendBody('<td align="left">'+FORMAT(recGLEntry.Description)+'</td>');
Mail.AppendBody('<td align="right">'+FORMAT(recGLEntry."Debit Amount")+('.00')+('</td>'));
Mail.AppendBody('<td align="right">'+FORMAT(recGLEntry."Credit Amount")+('.00')+('</td>'));
Mail.AppendBody('<td align="center">'+FORMAT(recGLEntry."Global Dimension 1 Code")+'</td>');
Mail.AppendBody('</tr>');
UNTIL(recGLEntry.NEXT=0);
END;
Mail.AppendBody('</table>');
Mail.AppendBody('<br>');
Mail.AppendBody('<b>From</b>');
Mail.AppendBody('<br>');
Mail.AppendBody('NAVISION ERP System');
Mail.AppendBody('<HR>');
Mail.AppendBody('This is a system generated mail. Please do not reply to this email ID.');
Mail.Send;
*This post is locked for comments