コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: Account.cs プロジェクト: kgreed/SBD.GeneralLedger
 public override void OnCreated()
 {
     GstCategory = HandyDefaults.DefaultGstCategory(ObjectSpace, true);
     base.OnCreated();
 }