How to know whether the sales order is invoiced or not based on sales id

How to know whether the sales order is invoiced or not based on sales id through the X++( i need query)

I got the answer…

this is the query

select custinvoicejour where custinvoicejour.SalesId == ‘salesid’;

info(strFmt(’%1’,custinvoicejour.InvoiceId));

I dont belive it will you the correct answer because your query will give you the result as (fully) invoiced even it is partillay invoiced.

Regards,

Hi Ishak Kallil

Is there any alternate query…pls explain me…

thanks for advance

Why cannot you get it from the salesTable itself by using SalesStatus field(when it is invoiced)?