Exemple #1
0
        public void AddTaxInfo(SalesTaxInfo salesTax)
        {
            var taxtInfo = FindRecord(salesTax.Country, salesTax.Province);

            if (taxtInfo != null)
            {
                throw new ArgumentException("A record for the same country and province already exists.");
            }

            db.Taxes.Add(salesTax);
            db.SaveChanges();
        }
Exemple #2
0
        static m.Business MakeBusiness(AccountingDb db, string name)
        {
            var b = m.Business.Create(name);

            db.Businesses.Add(b);
            db.SaveChanges();
            return(b);
        }
Exemple #3
0
        private static void MakeAccounts(AccountingDb db, string name)
        {
            var b = MakeBusiness(db, name);

            db.BusinessId = b.Id;

            var ba = new m.Account(name, m.Account.Default)
            {
                IsSummaryAccount = true
            };

            var a = new m.Account("Assets", ba, "Tangible and intangible items that the company owns that have value.")
            {
                IsSummaryAccount = true, Type = m.AccountType.Asset
            };
            var l = new m.Account("Liabilities", ba, "Money that the company owes to others.")
            {
                IsSummaryAccount = true, Type = m.AccountType.Liability
            };
            var q = new m.Account("Equity", ba, "That portion of the total assets that the owners or stockholders of the company fully own; have paid for outright.")
            {
                IsSummaryAccount = true, Type = m.AccountType.Equity
            };
            var r = new m.Account("Revenues", ba, "Money the company earns from its sales of products or services, and interest and dividends earned from marketable securities.")
            {
                IsSummaryAccount = true, Type = m.AccountType.Revenue
            };
            var x = new m.Account("Expences", ba, "Money the company spends to produce the goods or services that it sells.")
            {
                IsSummaryAccount = true, Type = m.AccountType.Expence
            };

            db.Accounts.AddRange(a, l, q, r, x);

            var ca = new m.Account("Current Assets", a)
            {
                IsSummaryAccount = true
            };
            var bk = new m.Account("Bank Accounts", ca)
            {
                IsSummaryAccount = true
            };

            for (int i = 0; i < 4; i++)
            {
                db.Accounts.Add(new m.Account($"Bank account #{i + 1}", bk));
            }
            foreach (string s in new [] { "Cash on hand", "Petty Cash", "Debtors", "Stock on hand" })
            {
                db.Accounts.Add(new m.Account(s, ca));
            }

            b.Detail.ABN = 2498345633;
            b.Detail.ACN = 98345633;
            db.SaveChanges();
        }
 public void AddPayment(PaymentInfo payment)
 {
     db.Payments.Add(payment);
     db.SaveChanges();
 }