จริงใช้ Notify ผมว่าง่ายกว่านะครับ
แต่ถ้าต้องการใช้ ผมมีตัวอย่าง Code
var fonlineid,fvn,fcomputername,fdepcode:string;
begin
fonlineid:=get_onlineid;
fvn:= GetGlobalValue('VN');
fcomputername := getsqldata('select servername from onlineuser where onlineid="'+fonlineid+'"');
fdepcode := getsqldata('select depcode from onlineuser o '+
'left outer join kskdepartment b on o.department=b.department '+
'where onlineid="'+fonlineid+'" '+
'and b.depcode in("019","020","021")');
//showmessage('OnlineID = '+fonlineid+' , Current VN = '+fvn+' , ComputerName = '+fcomputername+' , Department = '+fdepcode);
if fdepcode='' then exit;
if Getsqldata('select count(d.drugaccount)as cd from opitemrece o '+
' left outer join drugitems d on d.icode=o.icode'+
' where o.vn="'+fvn+'" and o.icode like "1%" and d.drugaccount="" '+
'and o.pttype in("20","21") and o.paidst in("01","02")')>0 then
begin
showmessage('¼Ùé»èÇÂÁÕÃÒ¡ÒÃÂҹ͡ºÑªÕÂÒËÅÑ¡áËè§ªÒµÔ ¨Óà»ç¹µéͧ¾ÔÁ¾ìãºÃѺÃͧÂҹ͡ºÑªÕ'+#13
+'à¾×èÍãËé¼Ùé»èǹÓä»»ÃСͺ¡ÒÃàºÔ¡¤èÒÃÑ¡ÉÒ´éǹФÐ'+#13+'***** ¢Íº¤Ø³¤Ð *****');
PrintReportToPrinterWithParam('CUSTOM-˹ѧÊ×ÍÃѺÃͧÂҹ͡ ¼Ùé»èǹ͡',fvn,'','','','','','','','','','Printing....')
end;
end;