示例#1
0
        public void EnableEconomy(Currency currency)
        {
            if (IsEconomyEnabled)
            {
                throw new InvalidOperationException("Economy data already enabled");
            }

            // First, set hardwired accounts

            FinancialAccounts[OrganizationFinancialAccountType.AssetsBankAccountMain] =
                FinancialAccount.Create(this, "[LOC]Asset_BankAccounts", FinancialAccountType.Asset, null);
            FinancialAccounts[OrganizationFinancialAccountType.AssetsOutboundInvoices] =
                FinancialAccount.Create(this, "[LOC]Asset_OutboundInvoices", FinancialAccountType.Asset, null);
            FinancialAccounts[OrganizationFinancialAccountType.AssetsOutstandingCashAdvances] =
                FinancialAccount.Create(this, "[LOC]Asset_CashAdvances", FinancialAccountType.Asset, null);
            FinancialAccounts[OrganizationFinancialAccountType.AssetsTaxAdvances] =
                FinancialAccount.Create(this, "[LOC]Asset_TaxAdvances", FinancialAccountType.Asset, null);

            FinancialAccount shortTermAssets = FinancialAccount.Create(this, "[LOC]Asset_ShortTerm",
                                                                       FinancialAccountType.Asset, null);

            FinancialAccounts[OrganizationFinancialAccountType.AssetsShortTerm]           = shortTermAssets;
            FinancialAccounts[OrganizationFinancialAccountType.AssetsTransfersInProgress] =
                FinancialAccount.Create(this, "[LOC]Asset_TransfersInProgress", FinancialAccountType.Asset,
                                        shortTermAssets);

            FinancialAccounts [OrganizationFinancialAccountType.AssetsBitcoinHot] =
                FinancialAccount.Create(this, "[LOC]Asset_BitcoinHot",
                                        FinancialAccountType.Asset, null);


            FinancialAccounts[OrganizationFinancialAccountType.CostsAllocatedFunds] =
                FinancialAccount.Create(this, "[LOC]Cost_AllocatedFunds", FinancialAccountType.Cost, null);
            FinancialAccounts[OrganizationFinancialAccountType.CostsInfrastructure] =
                FinancialAccount.Create(this, "[LOC]Cost_IctInfrastructure", FinancialAccountType.Cost, null);
            FinancialAccounts[OrganizationFinancialAccountType.CostsYearlyResult] =
                FinancialAccount.Create(this, "[LOC]Cost_AnnualResult", FinancialAccountType.Cost, null);
            FinancialAccounts[OrganizationFinancialAccountType.DebtsEquity] =
                FinancialAccount.Create(this, "[LOC]Debt_Equity", FinancialAccountType.Debt, null);
            FinancialAccounts[OrganizationFinancialAccountType.DebtsExpenseClaims] =
                FinancialAccount.Create(this, "[LOC]Debt_ExpenseClaims", FinancialAccountType.Debt, null);
            FinancialAccounts[OrganizationFinancialAccountType.DebtsInboundInvoices] =
                FinancialAccount.Create(this, "[LOC]Debt_InboundInvoices", FinancialAccountType.Debt, null);
            FinancialAccounts[OrganizationFinancialAccountType.DebtsOther] =
                FinancialAccount.Create(this, "[LOC]Debt_General", FinancialAccountType.Debt, null);
            FinancialAccounts[OrganizationFinancialAccountType.DebtsSalary] =
                FinancialAccount.Create(this, "[LOC]Debt_Salaries", FinancialAccountType.Debt, null);
            FinancialAccounts[OrganizationFinancialAccountType.DebtsTax] =
                FinancialAccount.Create(this, "[LOC]Debt_Taxes", FinancialAccountType.Debt, null);

            FinancialAccount financialFeesMaster = FinancialAccount.Create(this, "[LOC]Cost_FinancialFees",
                                                                           FinancialAccountType.Cost, null);

            FinancialAccounts[OrganizationFinancialAccountType.CostsBankFees] =
                FinancialAccount.Create(this, "[LOC]Cost_BankFees", FinancialAccountType.Cost, financialFeesMaster);
            FinancialAccounts[OrganizationFinancialAccountType.CostsBitcoinFees] =
                FinancialAccount.Create(this, "[LOC]Cost_BitcoinFees", FinancialAccountType.Cost, financialFeesMaster);

            FinancialAccounts[OrganizationFinancialAccountType.IncomeDonations] =
                FinancialAccount.Create(this, "[LOC]Income_Donations", FinancialAccountType.Income, null);
            FinancialAccounts[OrganizationFinancialAccountType.IncomeSales] =
                FinancialAccount.Create(this, "[LOC]Income_Sales", FinancialAccountType.Income, null);

            // Then, create various cost accounts that are probably needed, or that could be used as a starting point

            FinancialAccount officeMaster = FinancialAccount.Create(this, "[LOC]Cost_Offices", FinancialAccountType.Cost, null);

            FinancialAccount.Create(this, "[LOC]Cost_OfficeSpace", FinancialAccountType.Cost, officeMaster);
            FinancialAccount.Create(this, "[LOC]Cost_OfficeEquipment", FinancialAccountType.Cost, officeMaster);
            FinancialAccount.Create(this, "[LOC]Cost_OfficeSupplies", FinancialAccountType.Cost, officeMaster);

            FinancialAccount.Create(this, "[LOC]Cost_BusinessServices", FinancialAccountType.Cost, null);

            FinancialAccount.Create(this, "[LOC]Cost_Unforeseen", FinancialAccountType.Cost, null);
            FinancialAccount.Create(this, "[LOC]Cost_MarketingCampaigns", FinancialAccountType.Cost, null);
            FinancialAccount.Create(this, "[LOC]Cost_ResearchDevelopment", FinancialAccountType.Cost, null);

            FinancialAccount staffMaster = FinancialAccount.Create(this, "[LOC]Cost_Staff", FinancialAccountType.Cost, null);

            FinancialAccount.Create(this, "[LOC]Cost_StaffSalaries", FinancialAccountType.Cost, staffMaster);
            FinancialAccount.Create(this, "[LOC]Cost_StaffExpenses", FinancialAccountType.Cost, staffMaster);
            FinancialAccount.Create(this, "[LOC]Cost_StaffBenefits", FinancialAccountType.Cost, staffMaster);


            FinancialAccount travelMaster = FinancialAccount.Create(this, "[LOC]Cost_Travel", FinancialAccountType.Cost,
                                                                    null);
            FinancialAccount airfare = FinancialAccount.Create(this, "[LOC]Cost_Airfare", FinancialAccountType.Cost, travelMaster);

            FinancialAccount.Create(this, "[LOC]Cost_AirfareBusiness", FinancialAccountType.Cost, airfare);
            FinancialAccount.Create(this, "[LOC]Cost_AirfareCoach", FinancialAccountType.Cost, airfare);
            FinancialAccount.Create(this, "[LOC]Cost_TaxiTransport", FinancialAccountType.Cost, travelMaster);
            FinancialAccount.Create(this, "[LOC]Cost_PublicTransit", FinancialAccountType.Cost, travelMaster);
            FinancialAccount lodging = FinancialAccount.Create(this, "[LOC]Cost_TravelLodging", FinancialAccountType.Cost, travelMaster);

            FinancialAccount.Create(this, "[LOC]Cost_LodgingHostel", FinancialAccountType.Cost, lodging);
            FinancialAccount.Create(this, "[LOC]Cost_LodgingShared", FinancialAccountType.Cost, lodging);
            FinancialAccount.Create(this, "[LOC]Cost_LodgingThreeStar", FinancialAccountType.Cost, lodging);
            FinancialAccount.Create(this, "[LOC]Cost_LodgingFourStar", FinancialAccountType.Cost, lodging);
            FinancialAccount.Create(this, "[LOC]Cost_LodgingFiveStar", FinancialAccountType.Cost, lodging);
            FinancialAccount.Create(this, "[LOC]Cost_TrainsFerries", FinancialAccountType.Cost, travelMaster);
            FinancialAccount.Create(this, "[LOC]Cost_TravelPerDiem", FinancialAccountType.Cost, travelMaster);
            FinancialAccount.Create(this, "[LOC]Cost_EventTickets", FinancialAccountType.Cost, travelMaster);

            FinancialAccount.Create(this, "[LOC]Cost_Taxes", FinancialAccountType.Cost, null);

            // Finally, create the first conference parent

            FinancialAccount conferenceBase = FinancialAccount.Create(this, "[LOC]Cost_Conferences",
                                                                      FinancialAccountType.Cost, null);

            conferenceBase.IsConferenceParent = true;

            // Set the currency

            OptionalData.SetOptionalDataString(ObjectOptionalDataType.OrgCurrency, currency.Code);

            // If presentation currency is something else than bitcoin cash, then we also
            // need forex gain/loss accounts to account for (at least) the hotwallet

            if (!currency.IsBitcoinCash)
            {
                this.FinancialAccounts.IncomeCurrencyFluctuations =
                    FinancialAccount.Create(this, "[LOC]Income_ForexGains",
                                            FinancialAccountType.Income, null);
                this.FinancialAccounts.CostsCurrencyFluctuations =
                    FinancialAccount.Create(this, "[LOC]Cost_ForexLosses",
                                            FinancialAccountType.Cost, null);
            }

            // Set current year to first fiscal year

            OptionalData.SetOptionalDataInt(ObjectOptionalDataType.OrgFirstFiscalYear, DateTime.Today.Year);

            // Finally, flag the org as enabled

            OptionalData.SetOptionalDataBool(ObjectOptionalDataType.OrgEconomyEnabled, true);
        }
示例#2
0
        public void EnableEconomy(Currency currency)
        {
            if (IsEconomyEnabled)
            {
                throw new InvalidOperationException("Economy data already enabled");
            }

            // First, set hardwired accounts


            // TODO: Set names according to org default culture

            FinancialAccounts[OrganizationFinancialAccountType.AssetsBankAccountMain] =
                FinancialAccount.Create(this, "Bank Account", FinancialAccountType.Asset, null);
            FinancialAccounts[OrganizationFinancialAccountType.AssetsOutboundInvoices] =
                FinancialAccount.Create(this, "Outbound Invoices", FinancialAccountType.Asset, null);
            FinancialAccounts[OrganizationFinancialAccountType.AssetsOutstandingCashAdvances] =
                FinancialAccount.Create(this, "Cash Advances", FinancialAccountType.Asset, null);
            //FinancialAccounts[OrganizationFinancialAccountType.AssetsPaypal] =
            //    FinancialAccount.Create(this, "Paypal Account", FinancialAccountType.Asset, null);
            //FinancialAccounts[OrganizationFinancialAccountType.AssetsBitcoinHot] =
            //    FinancialAccount.Create(this, "Bitcoin Holdings (Hot)", FinancialAccountType.Asset, null);
            //FinancialAccounts[OrganizationFinancialAccountType.AssetsBitcoinCold] =
            //    FinancialAccount.Create(this, "Bitcoin Cold Storage", FinancialAccountType.Asset, null);
            //FinancialAccounts[OrganizationFinancialAccountType.AssetsVatInbound] =
            //    FinancialAccount.Create(this, "Inbound Value Added Tax", FinancialAccountType.Asset, null);
            FinancialAccounts[OrganizationFinancialAccountType.CostsAllocatedFunds] =
                FinancialAccount.Create(this, "Allocated funds", FinancialAccountType.Cost, null);
            FinancialAccounts[OrganizationFinancialAccountType.CostsBankFees] =
                FinancialAccount.Create(this, "Bank Fees", FinancialAccountType.Cost, null);
            FinancialAccounts[OrganizationFinancialAccountType.CostsInfrastructure] =
                FinancialAccount.Create(this, "ICT and Infrastructure", FinancialAccountType.Cost, null);
            FinancialAccounts[OrganizationFinancialAccountType.CostsYearlyResult] =
                FinancialAccount.Create(this, "Yearly result", FinancialAccountType.Cost, null);
            FinancialAccounts[OrganizationFinancialAccountType.DebtsEquity] =
                FinancialAccount.Create(this, "Equity", FinancialAccountType.Debt, null);
            FinancialAccounts[OrganizationFinancialAccountType.DebtsExpenseClaims] =
                FinancialAccount.Create(this, "Expense Claims", FinancialAccountType.Debt, null);
            FinancialAccounts[OrganizationFinancialAccountType.DebtsInboundInvoices] =
                FinancialAccount.Create(this, "Inbound Invoices", FinancialAccountType.Debt, null);
            FinancialAccounts[OrganizationFinancialAccountType.DebtsOther] =
                FinancialAccount.Create(this, "General Debt", FinancialAccountType.Debt, null);
            FinancialAccounts[OrganizationFinancialAccountType.DebtsSalary] =
                FinancialAccount.Create(this, "Salaries Due", FinancialAccountType.Debt, null);
            FinancialAccounts[OrganizationFinancialAccountType.DebtsTax] =
                FinancialAccount.Create(this, "Taxes Due", FinancialAccountType.Debt, null);
            //FinancialAccounts[OrganizationFinancialAccountType.DebtsVatOutbound] =
            //    FinancialAccount.Create(this, "Outbound Value Added Tax", FinancialAccountType.Debt, null);

            FinancialAccounts[OrganizationFinancialAccountType.IncomeDonations] =
                FinancialAccount.Create(this, "Donations", FinancialAccountType.Income, null);
            FinancialAccounts[OrganizationFinancialAccountType.IncomeSales] =
                FinancialAccount.Create(this, "Sales", FinancialAccountType.Income, null);


            // Then, create various cost accounts that are probably needed, or that could be used as a starting point

            FinancialAccount.Create(this, "Offices", FinancialAccountType.Cost, null);
            FinancialAccount.Create(this, "Unforeseen", FinancialAccountType.Cost, null);
            FinancialAccount.Create(this, "Staff", FinancialAccountType.Cost, null);
            FinancialAccount.Create(this, "Marketing and Campaigns", FinancialAccountType.Cost, null);
            FinancialAccount.Create(this, "Research and Development", FinancialAccountType.Cost, null);

            // Finally, create the first conference parent

            FinancialAccount conferenceBase = FinancialAccount.Create(this, "Conferences",
                                                                      FinancialAccountType.Cost, null);

            conferenceBase.IsConferenceParent = true;

            // Set the currency

            OptionalData.SetOptionalDataString(ObjectOptionalDataType.OrgCurrency, currency.Code);

            // Set current year to first fiscal year

            OptionalData.SetOptionalDataInt(ObjectOptionalDataType.OrgFirstFiscalYear, DateTime.Today.Year);

            // Finally, flag the org as enabled

            OptionalData.SetOptionalDataBool(ObjectOptionalDataType.OrgEconomyEnabled, true);
        }