Quantcast
Channel: Microsoft Dynamics NAV Forum - Recent Threads
Viewing all articles
Browse latest Browse all 18803

Purchase Order

$
0
0

Dear sir,

Now i have a one another concern

I want to send the all released po(in one wrking day) to the concern person..I have write the code in sendmail function in my purchase order page. And I m calling this function to codeunit for job que. But result is showing nothing...

please check my code sir, where I m doing mistake....

the complete code is :

Mail.CreateMessage('manish yadav','manish.yadav@mku.com','manish.yadav@mku.com','Purchase Order Statistics','',TRUE);

//Mail.AddCC('rakesh.gupta@mku.com');

//Mail.AddBCC('prachi.gupta@mku.com');

//Mail.AddAttachment('E:\UAT');

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

Mail.AppendBody('<br>');

Mail.AppendBody('Please Approve this document,');

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

Mail.AppendBody('<HR>');       //new

Mail.AppendBody((STRSUBSTNO('Purchase Order No.:- %1, Order Date:- %2', Rec."No.", FORMAT(Rec."Order Date"))));

Mail.AppendBody('<br>');

Mail.AppendBody((STRSUBSTNO('Vendor Name:- %1', "Buy-from Vendor Name")));

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

///////////////////////////////////////////

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

Mail.AppendBody('<tr>');

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

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

Mail.AppendBody('<th>Item Description</th>');

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

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

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

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

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

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

/////////////////////////////////////////

CLEAR(DocNo);

recPurchaseHeader.RESET;

recPurchaseHeader.SETRANGE(recPurchaseHeader."Document Date", TODAY);

recPurchaseHeader.SETRANGE(recPurchaseHeader.Status, 1);  

IF recPurchaseHeader.FINDSET THEN BEGIN

DocNo:=recPurchaseHeader."No."

END;

PurchLine.RESET;

PurchLine.SETRANGE(PurchLine."Document No.", DocNo);

IF PurchLine.FINDSET THEN BEGIN

 REPEAT

 Mail.AppendBody('<tr>');

 Mail.AppendBody('<br>');

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

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

 Mail.AppendBody('<td>'+FORMAT(PurchLine.Description)+'</td>');

 Mail.AppendBody('<td align="right">'+FORMAT(PurchLine.Quantity)+'</td>');

 Mail.AppendBody('<td>'+FORMAT(PurchLine."Unit of Measure Code")+'</td>');

 Mail.AppendBody('<td>'+FORMAT(PurchLine."Expected Receipt Date")+'</td>');

 Mail.AppendBody('<td>'+FORMAT(PurchLine."Promised Receipt Date")+'</td>');

 Mail.AppendBody('<td>'+FORMAT(PurchLine."Planned Receipt Date")+'</td>');

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

UNTIL PurchLine.NEXT = 0

END;

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

Mail.AppendBody('<br>');

Mail.AppendBody('<HR>');

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

Mail.AppendBody('Regards');

Mail.AppendBody('<br>');

Mail.AppendBody('MKU Purchase Dept.');l.AppndBody('  ');

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

Mail.Send;

MESSAGE('Mail Sent Successfully..!!!!');

___________________________________________________________

best regards,

manish


Viewing all articles
Browse latest Browse all 18803


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>