Exemple #1
0
        public void AppsOnDeriveCurrentObjectState(IDerivation derivation)
        {
            if (this.ExistSalesInvoiceWhereSalesInvoiceItem)
            {
                var invoice = this.SalesInvoiceWhereSalesInvoiceItem;

                if (invoice.CurrentObjectState.Equals(new SalesInvoiceObjectStates(this.Strategy.Session).Cancelled))
                {
                    this.AppsCancel(derivation);
                }

                if (invoice.CurrentObjectState.Equals(new SalesInvoiceObjectStates(this.Strategy.Session).WrittenOff))
                {
                    this.AppsWriteOff(derivation);
                }
            }

            if (this.ExistCurrentObjectState && !this.CurrentObjectState.Equals(this.LastObjectState))
            {
                var currentStatus = new SalesInvoiceItemStatusBuilder(this.Strategy.Session).WithSalesInvoiceItemObjectState(this.CurrentObjectState).Build();
                this.AddInvoiceItemStatus(currentStatus);
                this.CurrentInvoiceItemStatus = currentStatus;
            }
        }
Exemple #2
0
        public void AppsPaymentReceived(IDerivation derivation)
        {
            if (this.AmountPaid < this.TotalIncVat)
            {
                this.CurrentObjectState = new SalesInvoiceItemObjectStates(this.Strategy.Session).PartiallyPaid;
            }
            else
            {
                this.CurrentObjectState = new SalesInvoiceItemObjectStates(this.Strategy.Session).Paid;
            }

            if (this.ExistCurrentObjectState)
            {
                var currentStatus = new SalesInvoiceItemStatusBuilder(this.Strategy.Session).WithSalesInvoiceItemObjectState(this.CurrentObjectState).Build();
                this.AddInvoiceItemStatus(currentStatus);
                this.CurrentInvoiceItemStatus = currentStatus;
            }
        }