Dear All,
I have developed a mail report to one of the company concern person. Through this report I want to send the daily output report. But here I am unable to add the quantity. Here i want to show the sum of the quantity. here multiple lines are coming. What i am doing wrong. Please help me to resolve it.
I have attached the screenshot. and related code.
Mail.CreateMessage('XYZ Limited','nav@XYZ.com','test2@XYZ.com','OUTPUT Details','',TRUE);
Mail.AppendBody('Dear Sir / Madam,');
Mail.AppendBody('<br>');
Mail.AppendBody('Please find the daily Output details:');
Mail.AppendBody('<HR>');
Mail.AppendBody('<table border="1">');
Mail.AppendBody('<tr>');
Mail.AppendBody('<th>RPO No.</th>');
Mail.AppendBody('<th>Output Dt.</th>');
Mail.AppendBody('<th>Item No.</th>');
Mail.AppendBody('<th>Description</th>');
Mail.AppendBody('<th>Variant Code</th>');
Mail.AppendBody('<th>Qty.</th>');
Mail.AppendBody('<th>Unit</th>');
Mail.AppendBody('</tr>');
ILE.RESET;
ILE.SETRANGE(ILE."Posting Date",TODAY);
ILE.SETRANGE(ILE."Entry Type",ILE."Entry Type"::Output);
ILE.SETRANGE(ILE."Order Type",ILE."Order Type"::Production);
IF ILE.FINDSET THEN
REPEAT
CLEAR(grandtotal);
recILE.RESET;
recILE.SETRANGE("Entry No.",ILE."Entry No.");
recILE.SETRANGE("Item No.",ILE."Item No.");
IF recILE.FIND('-') THEN
REPEAT
grandtotal+= recILE.Quantity;
UNTIL recILE.NEXT = 0;
Mail.AppendBody('<tr>');
Mail.AppendBody('<br>');
Mail.AppendBody('<td align="center">'+FORMAT(ILE."Order No.")+'</td>');
Mail.AppendBody('<td align="center">'+FORMAT(ILE."Posting Date")+'</td>');
Mail.AppendBody('<td align="center">'+FORMAT(ILE."Item No.")+'</td>');
Item.RESET;
Item.SETRANGE("No.", ILE."Item No.");
IF Item.FINDFIRST THEN BEGIN
Mail.AppendBody('<td>'+FORMAT(Item.Description)+'</td>');
END;
Mail.AppendBody('<td align="center">'+FORMAT(ILE."Variant Code")+'</td>');
Mail.AppendBody('<td align="center">'+FORMAT(grandtotal)+'</td>');
Mail.AppendBody('<td align="center">'+FORMAT(ILE."Global Dimension 1 Code")+'</td>');
Mail.AppendBody('</tr>');
UNTIL ILE.NEXT = 0;
Mail.AppendBody('</table>');
Mail.AppendBody('<HR>');
Mail.AppendBody('<br>');
Mail.AppendBody('Regards');
Mail.AppendBody('<br>');
Mail.AppendBody('Production Department');
Mail.AppendBody(' ');
Mail.AppendBody('<br><br>'); //// e-mail code
Mail.Send;
NOte: here "grandtotal" is a decimal type variable.
Output is coming in this form

Report should come the below format:
