Ejemplo n.º 1
0
 public void Setup()
 {
     _savedTaxCode = null;
     _domainValidationException = null;
     _userContext = TestUserContext.Create(
         "*****@*****.**", "Graham Robertson", "Operations Manager", UserRole.Manager | UserRole.Member);
 }
Ejemplo n.º 2
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            int rowLine = gridTaxs.GetSelectedRows()[0];

            if (cmbTaxType.SelectedIndex == 0)
            {
                TaxCode tax = taxas[rowLine];
                if (tax.flagPrincipal)
                {
                    MessageBox.Show("Esta taxa não pode ser eliminada..!");
                }
                else
                {
                    _taxController.deleteFoId(tax.Id);
                    updateGrid();
                }
            }
            else
            {
                TaxReasonExemption ISE = motivos[rowLine];

                if (ISE.flagPrincipal)
                {
                    MessageBox.Show("Esta taxa não pode ser eliminada..!");
                }
                else
                {
                    _taxISEController.deleteFoId(ISE.Id);
                    updateGrid();
                }
            }
        }
Ejemplo n.º 3
0
        protected override decimal GetPayAdjustment(TaxCode taxCode, PayPeriods periods /*, int period*/)
        {
            if (taxCode.IsNoAdjustmentCode || !taxCode.TaxCodeNumber.HasValue || taxCode.TaxCodeNumber.Value == 0)
            {
                return(0);
            }

            var codeNumber = taxCode.TaxCodeNumber.Value;
            var remainder  = ((codeNumber - 1m) % 500) + 1m;
            var quotient   = Math.Floor(codeNumber - remainder) / 500m;

            var payPeriodForQuotient = (periods == PayPeriods.Monthly ? PayPeriods.Monthly : PayPeriods.Weekly);
            var quotientMult         = TaxMath.UpRound(500 * (10 / (decimal)payPeriodForQuotient), 2);

            remainder = ((remainder * 10) + 9) / (int)payPeriodForQuotient;
            remainder = Math.Ceiling(remainder * 100) / 100;
            //remainder *= Math.Round((decimal)payPeriodForQuotient / (decimal)periods);
            quotient = quotient * quotientMult;

            var adjustment = (quotient + remainder);// * period;

            adjustment *= Math.Round((decimal)payPeriodForQuotient / (decimal)periods);

            if (taxCode.IsPrefixCode)
            {
                adjustment *= -1;
            }

            return(adjustment);
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Create([FromForm] TaxCode taxCode)
        {
            if (ModelState.IsValid)
            {
                bool isCodeExist = _context.TaxCode.Any(m => m.Code.Equals(taxCode.Code));
                if (isCodeExist)
                {
                    ModelState.AddModelError("Code", "Code Already Exists!");
                    return(View(taxCode));
                    //return RedirectToAction(nameof(Create), new { error = "Code exists" });
                }

                string newJson      = JsonConvert.SerializeObject(taxCode);
                bool   isCodeExists = IsCodeExists(taxCode.Code);
                taxCode.CompanyId       = 123;
                taxCode.ChartOfAccount  = taxCode.ChartOfAccount;
                taxCode.IsUsed          = true;
                taxCode.CreatedBy       = _configuration.GetValue <string>("HardcodeValue:Createdby");
                taxCode.CreatedDatetime = DateTime.UtcNow;
                _context.Add(taxCode);
                await _context.SaveChangesAsync();

                AuditService.InsertActionLog(taxCode.CompanyId, taxCode.CreatedBy, "Create", "Tax Code", null, newJson);
                return(RedirectToAction(nameof(Index)));
            }
            return(View(taxCode));
        }
Ejemplo n.º 5
0
        public bool AddCommercialTax(TaxCode taxCode)
        {
            if (taxCode == null)
            {
                return(false);
            }

            if (CommercialTaxes == null)
            {
                CommercialTaxes = new List <CommercialTax>();
            }

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

            if (existCommercialTax == null)
            {
                var newCommercialTax = new CommercialTax()
                {
                    Id           = Guid.NewGuid(),
                    TaxCode      = taxCode,
                    Commercial   = this,
                    CommercialId = Id
                };

                CommercialTaxes.Add(newCommercialTax);
                ReCalculate();
                return(true);
            }
            return(false);
        }
Ejemplo n.º 6
0
        public void TaxCodeDetermination()
        {
            var taxCode = TaxCode.Parse("S1100L");

            Assert.AreEqual(true, taxCode.IsValidTaxCode);
            Assert.AreEqual(true, taxCode.IsScotlandTax);
            Assert.AreEqual(false, taxCode.IsNoAdjustmentCode);
            Assert.AreEqual(false, taxCode.IsPrefixCode);

            taxCode = TaxCode.Parse("D0");
            Assert.AreEqual(true, taxCode.IsValidTaxCode);
            Assert.AreEqual(false, taxCode.IsScotlandTax);
            Assert.AreEqual(true, taxCode.IsNoAdjustmentCode);
            Assert.AreEqual(false, taxCode.IsPrefixCode);

            taxCode = TaxCode.Parse("K666");
            Assert.AreEqual(true, taxCode.IsValidTaxCode);
            Assert.AreEqual(false, taxCode.IsScotlandTax);
            Assert.AreEqual(false, taxCode.IsNoAdjustmentCode);
            Assert.AreEqual(true, taxCode.IsPrefixCode);

            TaxCode.TryParse("!", out taxCode);
            Assert.AreEqual(false, taxCode.IsValidTaxCode);
            Assert.AreEqual(false, taxCode.IsScotlandTax);
            Assert.AreEqual(false, taxCode.IsNoAdjustmentCode);
            Assert.AreEqual(false, taxCode.IsPrefixCode);
        }
Ejemplo n.º 7
0
        public void TaxLetterSeparation()
        {
            // Standard
            Assert.AreEqual("L", TaxCode.Parse("1000L").TaxCodeLetter);
            Assert.AreEqual("L", TaxCode.Parse("S1000L").TaxCodeLetter);

            // Prefix Codes
            Assert.AreEqual("K", TaxCode.Parse("K944").TaxCodeLetter);
            Assert.AreEqual("K", TaxCode.Parse("K1000").TaxCodeLetter);
            Assert.AreEqual("K", TaxCode.Parse("SK1000").TaxCodeLetter);

            // Basic Rate
            Assert.AreEqual("BR", TaxCode.Parse("BR").TaxCodeLetter);
            Assert.AreEqual("BR", TaxCode.Parse("SBR").TaxCodeLetter);

            // D Codes
            Assert.AreEqual("D", TaxCode.Parse("D").TaxCodeLetter);
            Assert.AreEqual("D0", TaxCode.Parse("D0").TaxCodeLetter);
            Assert.AreEqual("D1", TaxCode.Parse("D1").TaxCodeLetter);
            Assert.AreEqual("D0", TaxCode.Parse("SD0").TaxCodeLetter);
            Assert.AreEqual("D2", TaxCode.Parse("SD2").TaxCodeLetter);

            // N* Codes
            Assert.AreEqual("NT", TaxCode.Parse("NT").TaxCodeLetter);
        }
Ejemplo n.º 8
0
        public override decimal CalculateTaxDueForPeriod(TaxCode taxCode, decimal gross, PayPeriods periods, int period, bool week1 = false, decimal grossToDate = 0, decimal taxToDate = 0)
        {
            CreateContainer(taxCode, gross, periods, period, week1, grossToDate, taxToDate);
            CalculateTax();

            return(CalculationContainer.ln);
        }
Ejemplo n.º 9
0
        protected void Page_Init(object sender, System.EventArgs e)
        {
            _ShipMethodId = AlwaysConvert.ToInt(Request.QueryString["ShipMethodId"]);
            _ShipMethod   = ShipMethodDataSource.Load(_ShipMethodId);
            if (_ShipMethod == null)
            {
                RedirectMe();
            }
            //BIND TAX CODES
            IList <TaxCode> taxCodes = AbleContext.Current.Store.TaxCodes;

            TaxCode.DataSource = taxCodes;
            TaxCode.DataBind();
            ListItem item = TaxCode.Items.FindByValue(_ShipMethod.TaxCodeId.ToString());

            if (item != null)
            {
                TaxCode.SelectedIndex = TaxCode.Items.IndexOf(item);
            }

            SurchargeTaxCode.DataSource = taxCodes;
            SurchargeTaxCode.DataBind();
            item = SurchargeTaxCode.Items.FindByValue(_ShipMethod.SurchargeTaxCodeId.ToString());
            if (item != null)
            {
                SurchargeTaxCode.SelectedIndex = SurchargeTaxCode.Items.IndexOf(item);
            }
        }
Ejemplo n.º 10
0
        public void TaxNumberSeparation()
        {
            // Standard
            Assert.AreEqual(944, TaxCode.Parse("944L").TaxCodeNumber);
            Assert.AreEqual(1000, TaxCode.Parse("1000L").TaxCodeNumber);
            Assert.AreEqual(1000, TaxCode.Parse("S1000L").TaxCodeNumber);

            // Prefix Codes
            Assert.AreEqual(944, TaxCode.Parse("K944").TaxCodeNumber);
            Assert.AreEqual(1000, TaxCode.Parse("K1000").TaxCodeNumber);
            Assert.AreEqual(1100, TaxCode.Parse("SK1100").TaxCodeNumber);

            // Basic Rate
            Assert.AreEqual(null, TaxCode.Parse("BR").TaxCodeNumber);
            //Assert.AreEqual(0, TaxCode.Parse("0BR").TaxCodeNumber);
            //Assert.AreEqual(0, TaxCode.Parse("BR0").TaxCodeNumber);

            // D Codes
            Assert.AreEqual(null, TaxCode.Parse("D").TaxCodeNumber);
            Assert.AreEqual(null, TaxCode.Parse("D0").TaxCodeNumber);
            Assert.AreEqual(null, TaxCode.Parse("D1").TaxCodeNumber);
            Assert.AreEqual(null, TaxCode.Parse("SD2").TaxCodeNumber);

            // N* Codes
            Assert.AreEqual(null, TaxCode.Parse("NT").TaxCodeNumber);
            Assert.AreEqual(null, TaxCode.Parse("N1").TaxCodeNumber);
        }
Ejemplo n.º 11
0
 public int insertTaxCodeKey(TaxCode key)
 {
     using (ManagerIORepository repo = RepositoryHelper.Instance.GetRepository())
     {
         return((int)repo.Insert(key));
     }
 }
Ejemplo n.º 12
0
        public Error InsertOrUpdateTaxCode(TaxCodeModel taxCode, UserModel user, string lockGuid)
        {
            var error = validateModel(taxCode);

            if (!error.IsError)
            {
                // Check that the lock is still current
                if (!db.IsLockStillValid(typeof(TaxCode).ToString(), taxCode.Id, lockGuid))
                {
                    error.SetError(EvolutionResources.errRecordChangedByAnotherUser, "TaxCode");
                }
                else
                {
                    TaxCode temp = null;
                    if (taxCode.Id != 0)
                    {
                        temp = db.FindTaxCode(taxCode.Id);
                    }
                    if (temp == null)
                    {
                        temp = new TaxCode();
                    }

                    mapToEntity(taxCode, temp);

                    db.InsertOrUpdateTaxCode(temp);
                    taxCode.Id = temp.Id;
                }
            }
            return(error);
        }
Ejemplo n.º 13
0
        public TaxCodeModel MapToModel(TaxCode item)
        {
            // The mapping handles TaxCode1 => TaxCode
            var model = Mapper.Map <TaxCode, TaxCodeModel>(item);

            return(model);
        }
Ejemplo n.º 14
0
        protected override void CreateContainer(TaxCode taxCode, decimal grossForPeriod, PayPeriods periods, int period = 1, bool week1 = false, decimal grossToDateExcludingPeriod = 0, decimal taxToDateExcludingPeriod = 0)
        {
            if (week1 || period == 1)
            {
                period = 1;
                grossToDateExcludingPeriod = 0;
                taxToDateExcludingPeriod   = 0;
            }

            CalculationContainer = new PayeCalculationContainer
            {
                TaxCode   = taxCode,
                Week1     = week1,
                Periods   = periods,
                TaxToDate = taxToDateExcludingPeriod,
                n         = period,
                pn        = grossForPeriod,
                Pn1       = grossToDateExcludingPeriod,
                Pn        = grossForPeriod + grossToDateExcludingPeriod,
                a1        = GetPayAdjustment(taxCode, periods),
                // Constants
                M = 50
            };

            CalculationContainer.na1 = CalculationContainer.a1 * CalculationContainer.n;
            CalculationContainer.Un  = CalculationContainer.Pn - CalculationContainer.na1;
            CalculationContainer.Tn  = TaxMath.Truncate(CalculationContainer.Un, 0);
        }
Ejemplo n.º 15
0
        protected void AddButton_Click(object sender, EventArgs e)
        {
            // DUPLICATE TAX CODE NAMES SHOULD NOT BE ALLOWED
            ICriteria criteria = NHibernateHelper.CreateCriteria <TaxCode>()
                                 .Add(Restrictions.Like("Name", StringHelper.SafeSqlString(AddTaxCodeName.Text)));
            IList <TaxCode> tempCollection = TaxCodeDataSource.LoadForCriteria(criteria);

            if (tempCollection.Count > 0)
            {
                // TAX RULE(S) WITH SAME NAME ALREADY EXIST
                CustomValidator customNameValidator = new CustomValidator();
                customNameValidator.ValidationGroup   = "Add";
                customNameValidator.ControlToValidate = "AddTaxCodeName";
                customNameValidator.Text         = "*";
                customNameValidator.ErrorMessage = "A Tax Code with the same name <strong>" + AddTaxCodeName.Text + "</strong> already exists.";
                customNameValidator.IsValid      = false;
                phNameValidator.Controls.Add(customNameValidator);

                return;
            }


            TaxCode t = new TaxCode();

            t.Name = AddTaxCodeName.Text;
            t.Save();
            TaxCodeGrid.DataBind();
            AddTaxCodeName.Text = string.Empty;
        }
Ejemplo n.º 16
0
        private void gridTaxs_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            int rowLine = e.RowHandle;

            decimal taxa = 0;

            if (e.Column.Name == "ClTaxaNor")
            {
                taxa = decimal.Parse(e.Value.ToString());
            }

            if (e.Value.ToString() == string.Empty)
            {
                updateGrid();
            }
            else
            {
                if (cmbTaxType.SelectedIndex == 0)
                {
                    TaxCode tax = taxas[rowLine];
                    if (tax.flagPrincipal)
                    {
                        MessageBox.Show("Esta taxa não pode ser Alterada..!");
                        updateGrid();
                    }
                    else
                    {
                        if (taxa > 0)
                        {
                            //_taxController.update(tax);
                            _tiposTaxa.update(_tiposTaxa.getOne(1));
                        }
                        else
                        {
                            MessageBox.Show("O valor da taxa não pode ser 0..!");
                        }
                    }
                }
                else
                {
                    TaxReasonExemption ISE = motivos[rowLine];
                    if (ISE.flagPrincipal)
                    {
                        if (e.Column.Name == "CLCodigoISE")
                        {
                            MessageBox.Show("Não pode alterar o codigo das Isentas principais.!");
                        }
                        else
                        {
                            // _taxISEController.update(ISE);
                            _tiposTaxa.update(_tiposTaxa.getOne(2));
                        }
                    }
                    else
                    {
                        _tiposTaxa.update(_tiposTaxa.getOne(2));
                    }
                }
            }
        }
Ejemplo n.º 17
0
            private void AddTaxCode(RequestContext context, TaxableItem taxableItem, TaxCodeInterval taxCodeInterval, Dictionary <string, TaxCode> codes, SalesTransaction transaction)
            {
                TaxCode code = this.GetTaxCode(context, taxableItem, taxCodeInterval, transaction);

                codes.Add(code.Code, code);
                this.transactionTaxCodes.Add(code);
            }
Ejemplo n.º 18
0
            /// <summary>
            /// Get the PercentRate for a given Tax (takes Gross Taxes into account).
            /// </summary>
            /// <param name="code">The tax code.</param>
            /// <param name="taxBase">The tax base.</param>
            /// <param name="otherCodes">The other codes.</param>
            /// <returns>The percentage rate.</returns>
            private static decimal GetPercentPerTax(TaxCode code, decimal taxBase, ReadOnlyCollection <TaxCode> otherCodes)
            {
                decimal percent = decimal.Zero;

                if (code.TaxBase == TaxBase.PercentPerGross)
                {
                    decimal otherPercents = decimal.Zero;
                    foreach (TaxCode t in otherCodes.Where(c => (c.Code != code.Code && c.TaxBase != TaxBase.AmountByUnit)))
                    {
                        otherPercents += t.PercentPerTax(taxBase);
                    }

                    decimal grossPercent = code.PercentPerTax(taxBase);

                    // Gross Percent needs to be expressed with respect to the original item price:
                    // ActualPercent = GrossPercent * (full price + other taxes)/100
                    percent = grossPercent * (100 + otherPercents) / 100m;
                }
                else
                {
                    percent = code.PercentPerTax(taxBase);
                }

                return(percent);
            }
Ejemplo n.º 19
0
            /// <summary>
            /// Gets the priority of the specified tax code.
            /// </summary>
            /// <param name="code">The tax code.</param>
            /// <returns>A value indicating the priority of the tax code.</returns>
            protected static int TaxCodePriority(TaxCode code)
            {
                if (code == null)
                {
                    throw new ArgumentNullException("code");
                }

                // Return codes to be processed in the following order:
                // 1. Amount per unit & Percent of net & Percent Gross on net
                // 2. Percent of tax
                // 3. Percent of gross (single tax)
                // 4. Percent of gross (all taxes)
                switch (code.TaxBase)
                {
                case TaxBase.AmountByUnit:
                case TaxBase.PercentPerNet:
                case TaxBase.PercentGrossOnNet:
                    return(1);

                case TaxBase.PercentPerTax:
                    return(2);

                case TaxBase.PercentPerGross:
                    return(string.IsNullOrEmpty(code.TaxOnTax) ? MaxPriorityTaxCode : 3);

                default:
                    return(0);
                }
            }
Ejemplo n.º 20
0
        public async Task <IActionResult> Edit(int id, [FromForm] TaxCode taxCode)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    bool isCodeExist = _context.TaxCode.Any(m => m.Code.Equals(taxCode.Code) && !m.Id.Equals(id));
                    if (isCodeExist)
                    {
                        ModelState.AddModelError("Code", "Code Already Exists!");
                        return(View(taxCode));
                        //return RedirectToAction(nameof(Index), new { error = "Code exists" });
                    }

                    TaxCode db_taxCode = _context.TaxCode.FirstOrDefault(m => m.Id.Equals(taxCode.Id));
                    if (taxCode == null || id != taxCode.Id)
                    {
                        return(NotFound());
                    }

                    OldDataTax oldData = new OldDataTax();
                    oldData.Code           = db_taxCode.Code;
                    oldData.Name           = db_taxCode.Name;
                    oldData.ChartOfAccount = db_taxCode.ChartOfAccount;
                    oldData.Rate           = Convert.ToString(db_taxCode.Rate);
                    oldData.Remark         = db_taxCode.Remark;
                    oldData.Status         = db_taxCode.Status;

                    string oldJson = JsonConvert.SerializeObject(oldData);
                    string newJson = JsonConvert.SerializeObject(taxCode);

                    db_taxCode.Code             = taxCode.Code;
                    db_taxCode.Name             = taxCode.Name;
                    db_taxCode.ChartOfAccount   = taxCode.ChartOfAccount;
                    db_taxCode.Rate             = taxCode.Rate;
                    db_taxCode.Status           = taxCode.Status;
                    db_taxCode.Remark           = taxCode.Remark;
                    db_taxCode.ModifiedBy       = _configuration.GetValue <string>("HardcodeValue:Createdby");
                    db_taxCode.ModifiedDatetime = DateTime.UtcNow;
                    AuditService.InsertActionLog(db_taxCode.CompanyId, db_taxCode.CreatedBy, "Edit", "Tax Code", oldJson, newJson);

                    _context.Update(db_taxCode);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Tax_CodeExists(taxCode.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(taxCode));
        }
Ejemplo n.º 21
0
        public void TaxCodeVoidAsyncTestsUsingoAuth()
        {
            //Creating the TaxCode for Adding
            //TaxCode entity = QBOHelper.CreateTaxCode(qboContextoAuth);
            //Adding the TaxCode
            TaxCode added = Helper.FindOrAdd <TaxCode>(qboContextoAuth, new TaxCode());

            Helper.VoidAsync <TaxCode>(qboContextoAuth, added);
        }
Ejemplo n.º 22
0
        public void TaxCodeAddAsyncTestsUsingoAuth()
        {
            //Creating the TaxCode for Add
            TaxCode entity = QBOHelper.CreateTaxCode(qboContextoAuth);

            TaxCode added = Helper.AddAsync <TaxCode>(qboContextoAuth, entity);

            QBOHelper.VerifyTaxCode(entity, added);
        }
Ejemplo n.º 23
0
        public void TaxCodeAddTestUsingoAuth()
        {
            //Creating the TaxCode for Add
            TaxCode taxCode = QBOHelper.CreateTaxCode(qboContextoAuth);
            //Adding the TaxCode
            TaxCode added = Helper.Add <TaxCode>(qboContextoAuth, taxCode);

            //Verify the added TaxCode
            QBOHelper.VerifyTaxCode(taxCode, added);
        }
Ejemplo n.º 24
0
        public void TaxCodeQueryUsingoAuth()
        {
            QueryService <TaxCode> entityQuery = new QueryService <TaxCode>(qboContextoAuth);
            TaxCode added   = Helper.FindOrAdd <TaxCode>(qboContextoAuth, new TaxCode());
            TaxCode taxCode = Helper.FindAll <TaxCode>(qboContextoAuth, new TaxCode())[3];
            //List<TaxCode> entities = entityQuery.Where(c => c.Id == taxCode.Id).ToList();
            List <TaxCode> entities = entityQuery.ExecuteIdsQuery("SELECT * FROM TaxCode").ToList <TaxCode>();

            Assert.IsTrue(entities.Count() > 0);
        }
Ejemplo n.º 25
0
        private void OnSellTaxCodeChanged(object sender, EventArgs args)
        {
            TaxCode item = (TaxCode)cboSellTaxCode.SelectedItem;

            if (item == null)
            {
                return;
            }
            txtSellTaxCodeID.Text = item.TaxCodeDescription;
        }
Ejemplo n.º 26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _TaxRuleId = AlwaysConvert.ToInt(Request.QueryString["TaxRuleId"]);
            _TaxRule   = TaxRuleDataSource.Load(_TaxRuleId);
            if (_TaxRule == null)
            {
                Response.Redirect("TaxRules.aspx");
            }
            Caption.Text = string.Format(Caption.Text, _TaxRule.Name);
            if (!Page.IsPostBack)
            {
                Name.Text = _TaxRule.Name;
                foreach (ListItem taxCodeItem in this.TaxCodes.Items)
                {
                    TaxCode taxCode = TaxCodeDataSource.Load(AlwaysConvert.ToInt(taxCodeItem.Value));
                    taxCodeItem.Selected = (_TaxRule.TaxCodes.IndexOf(taxCode) > -1);
                }
                TaxRate.Text           = string.Format("{0:0.00##}", _TaxRule.TaxRate);
                ZoneRule.SelectedIndex = (_TaxRule.ShipZones.Count == 0) ? 0 : 1;
                foreach (ShipZone item in _TaxRule.ShipZones)
                {
                    ListItem listItem = ZoneList.Items.FindByValue(item.Id.ToString());
                    if (listItem != null)
                    {
                        listItem.Selected = true;
                    }
                }
                UseBillingAddress.SelectedIndex = _TaxRule.UseBillingAddress ? 1 : 0;
                GroupRule.SelectedIndex         = _TaxRule.GroupRuleId;
                foreach (Group item in _TaxRule.Groups)
                {
                    ListItem listItem = GroupList.Items.FindByValue(item.Id.ToString());
                    if (listItem != null)
                    {
                        listItem.Selected = true;
                    }
                }
                ListItem selectedCode = TaxCode.Items.FindByValue(_TaxRule.TaxCodeId.ToString());
                if (selectedCode != null)
                {
                    selectedCode.Selected = true;
                }
                Priority.Text = _TaxRule.Priority.ToString();


                ListItem roundingRuleItem = RoundingRule.Items.FindByValue(_TaxRule.RoundingRuleId.ToString());
                if (roundingRuleItem != null)
                {
                    RoundingRule.SelectedItem.Selected = false;
                    roundingRuleItem.Selected          = true;
                }

                PerUnitCalculation.Checked = _TaxRule.UsePerItemTax;
            }
        }
Ejemplo n.º 27
0
        public void TaxCode_ValidInput_Deserialises(string input, TaxCode expected)
        {
            var response = new RestResponse();

            response.Content = $@"""{input}""";

            var deserializer = new CustomJsonCodec(new Configuration());
            var actual       = deserializer.Deserialize <TaxCode>(response);

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 28
0
 protected void Page_Init(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         AbleCommerce.Code.PageHelper.SetPickImageButton(ThumbnailUrl, BrowseThumbnailUrl);
         AbleCommerce.Code.PageHelper.SetPickImageButton(ImageUrl, BrowseImageUrl);
         //BIND TAXES
         TaxCode.DataSource = TaxCodeDataSource.LoadAll();
         TaxCode.DataBind();
     }
 }
Ejemplo n.º 29
0
        public void TaxCodeFindByIdAsyncTestsUsingoAuth()
        {
            //Creating the TaxCode for Adding
            //TaxCode entity = QBOHelper.CreateTaxCode(qboContextoAuth);
            //Adding the TaxCode
            TaxCode added   = Helper.FindOrAdd <TaxCode>(qboContextoAuth, new TaxCode());
            TaxCode taxCode = Helper.FindAll <TaxCode>(qboContextoAuth, new TaxCode())[3];

            //FindById and verify
            Helper.FindByIdAsync <TaxCode>(qboContextoAuth, taxCode);
        }
Ejemplo n.º 30
0
        protected string GetTaxCodeName(object dataItem)
        {
            TaxRule rule = (TaxRule)dataItem;
            TaxCode code = rule.TaxCode;

            if (code == null)
            {
                return(string.Empty);
            }
            return(code.Name);
        }