public static Account CreateAccount(string code, GLCategoryEnum type, IObjectSpace os) { var account = os.CreateObject <Account>(); var glCriteria = CriteriaOperator.Parse("[Category] == ? ", type); var glCategories = os.GetObjects <GLCategory>(glCriteria); var glCategory = glCategories.FirstOrDefault(); var criteria = CriteriaOperator.Parse("Parent_ID == null && [GLCategory_Id] == ? ", glCategory.Id); var rootExpenseAccount = os.FindObject <Account>(criteria); account.Parent = rootExpenseAccount; account.Category = glCategory; var isPandL = type == GLCategoryEnum.CostOfSales || type == GLCategoryEnum.Income || type == GLCategoryEnum.Expense || type == GLCategoryEnum.OtherExpense || type == GLCategoryEnum.OtherIncome; account.GstCategory = HandyDefaults.DefaultGstCategory(os, isPandL); account.Code = code; os.ModifiedObjects.Add(account); return(account); }
public override void OnCreated() { GstCategory = HandyDefaults.DefaultGstCategory(ObjectSpace, true); base.OnCreated(); }