Ejemplo n.º 1
0
        public void CreateCashFlows()
        {
            var activity1 = ObjectSpace.FindObject <Activity>(CriteriaOperator.Parse(
                                                                  "Name = ?", "ANZ Bank Fee"));

            if (activity1 == null)
            {
                activity1            = ObjectSpace.CreateObject <Activity>();
                activity1.Name       = "ANZ Bank Fee";
                activity1.ActivityL1 = "Non-Capex Payments";
                activity1.ActivityL2 = "OPEX";
                activity1.ActivityL3 = "Finance";
                activity1.Save();
            }

            var activity2 = ObjectSpace.FindObject <Activity>(CriteriaOperator.Parse(
                                                                  "Name = ?", "Interconnect Rcpt"));

            if (activity2 == null)
            {
                activity2            = ObjectSpace.CreateObject <Activity>();
                activity2.Name       = "Interconnect Rcpt";
                activity2.ActivityL1 = "Receipts";
                activity2.ActivityL2 = "Interconnect & Roaming";
                activity2.ActivityL3 = "Interconnect";
                activity2.Save();
            }

            CashFlow cf;

            cf = ObjectSpace.CreateObject <CashFlow>();
            cf.InitDefaultValues();
            cf.TranDate         = new DateTime(2014, 5, 6);
            cf.Account          = ObjectSpace.FindObject <Account>(null);
            cf.Counterparty     = ObjectSpace.FindObject <Counterparty>(null);
            cf.Activity         = activity1;
            cf.AccountCcyAmt    = -1000;
            cf.FunctionalCcyAmt = -1000;
            cf.CounterCcyAmt    = -1000;
            cf.Save();

            cf = ObjectSpace.CreateObject <CashFlow>();
            cf.InitDefaultValues();
            cf.TranDate         = new DateTime(2014, 5, 6);
            cf.Account          = ObjectSpace.FindObject <Account>(null);
            cf.Counterparty     = ObjectSpace.FindObject <Counterparty>(null);
            cf.Activity         = activity2;
            cf.AccountCcyAmt    = 1000;
            cf.FunctionalCcyAmt = 1000;
            cf.CounterCcyAmt    = 1000;
            cf.Save();

            ObjectSpace.CommitChanges();
            var shot = new SaveForecastSnapshot((XPObjectSpace)ObjectSpace);

            shot.Process();
        }
        private void SaveForecast()
        {
            var objSpace = (XPObjectSpace)Application.CreateObjectSpace();
            var logic    = new SaveForecastSnapshot(objSpace);

            logic.Process();
            new GenericMessageBox(
                "ACTION COMPLETED : Save Forecast",
                "ACTION COMPLETED");
        }
Ejemplo n.º 3
0
        public void SaveSnapshot()
        {
            #region Arrange
            var ccyAUD = ObjectSpace.FindObject <Currency>(CriteriaOperator.Parse("Name = ?", "AUD"));

            var account = ObjectSpace.CreateObject <Account>();
            account.Name     = "VHA ANZ AUD";
            account.Currency = ccyAUD;

            var activity = ObjectSpace.CreateObject <Activity>();
            activity.Name = "AR Rcpt";
            #endregion

            #region Actions
            var     tranDate = new DateTime(2014, 03, 31);
            decimal amount   = 1000;
            int     loops    = 2;

            for (int i = 0; i < loops; i++)
            {
                var cf1 = ObjectSpace.CreateObject <CashFlow>();
                cf1.TranDate      = tranDate;
                cf1.Account       = account;
                cf1.Activity      = activity;
                cf1.AccountCcyAmt = amount;
            }

            ObjectSpace.CommitChanges();

            var logic = new SaveForecastSnapshot(ObjectSpace);
            logic.Process();
            ObjectSpace.Refresh();

            var snapshot = ObjectSpace.FindObject <CashFlowSnapshot>(null);
            #endregion

            #region Asserts
            var sCfs = snapshot.CashFlows;
            Assert.AreEqual(amount * loops, sCfs.Sum(x => x.AccountCcyAmt));
            #endregion
        }