today I want to leave another post related to getting Acumatica. There is one more way of gettinc current company id. For this purpose you can use class of Acuamtica named SharedFunctions.
It has plenty of interesting staff, as well as getting Current company id. Take a look on it:
var companyId = SharedFunctions.GetCurrentCompanyId();