Get Current Company in AXBelow is the example on how to get current company in AX 2009.
In AOT > Jobs, paste the following code:
static void curExtExample(Args _arg)
// Sets curCompany to the extension of the current company.
print "Current extension is " + curCompany;
You can use this code in your forms and reports also to parameterized your reports/Forms.