예제 #1
0
        public bool RemoveCommercialTax(TaxCode taxCode)
        {
            if (taxCode == null)
            {
                throw new NotImplementedException("TaxCode is null");
            }


            var existCommercialTax = CommercialTaxes
                                     .Where(ct => ct.TaxCodeId == taxCode.Id)
                                     .FirstOrDefault();


            if (existCommercialTax != null && existCommercialTax.TaxPeriodId == null)
            {
                CommercialTaxes.Remove(existCommercialTax);

                ReCalculate();
                return(true);
            }

            throw new NotImplementedException("Cannot Remove");
        }
예제 #2
0
        public bool RemoveCommercialTaxs()
        {
            if (PostStatus == LedgerPostStatus.Posted)
            {
                throw new Exception("Transaction is posted");
            }

            var CommercialTaxs = CommercialTaxes.ToList();

            CommercialTaxs.ForEach(ct =>
            {
                if (ct.TaxPeriodId != null)
                {
                    throw new Exception("Transaction is areardy assign to tax period");
                }
                else
                {
                    CommercialTaxes.Remove(ct);
                }
            });
            ReCalculate();

            return(true);
        }