private void bttnAddRewards_Click(object sender, EventArgs e) { ///////////////////////////////////////////// txtBoxPreTaxTot.Text = ""; txtBoxSalesTaxTotal.Text = ""; txtBoxRewardsFromOrder.Text = ""; txtBoxTotal.Text = ""; richTextBoxOrderSummary.Text = ""; int.TryParse(txtBoxSmoothieQty.Text, out SmoothieQty); int.TryParse(txtBoxBowlQty.Text, out BowlQty); int.TryParse(txtBoxShootersQty.Text, out ShooterQty); double RewardsFromOrderTotal; PreTaxTotal = ((double)SmoothieTotalPrice + (double)BowlTotalPrice + (double)ShooterTotalPrice) * 0.9; SalesTax = PreTaxTotal * 0.001; Total = PreTaxTotal + SalesTax; RewardsFromOrderTotal = PreTaxTotal * .1; txtBoxPreTaxTot.Text = PreTaxTotal.ToString("C"); txtBoxSalesTaxTotal.Text = SalesTax.ToString("C"); txtBoxRewardsFromOrder.Text = RewardsFromOrderTotal.ToString("C"); txtBoxTotal.Text = Total.ToString("C"); richTextBoxOrderSummary.Text = "You have ordered " + SmoothieQty.ToString() + " of " + drpDownSmoothies.SelectedItem.ToString() + " -" + SmoothieTotalPrice.ToString("C") + ", \n" + BowlQty.ToString() + " of " + drpDownBowls.SelectedItem.ToString() + " -" + BowlTotalPrice.ToString("C") + ", and \n" + ShooterQty.ToString() + " of " + drpDownShooters.SelectedItem.ToString() + " -" + ShooterTotalPrice.ToString("C") + ". \n Rewards Added - 10% off"; ///////////////////////////////////////////// }
/// <summary> /// Creator: Jaeho Kim /// Created: 2020/04/13 /// APPROVER: Rob Holmes /// /// Implementation for Inserting Sales Tax Data. /// </summary> /// <remarks> /// Updater: NA /// Updated: NA /// Update: NA /// </remarks> /// <param name="salesTax"></param> /// <returns>rows effected.</returns> public int InsertSalesTax(SalesTax salesTax) { int rows = 0; var conn = DBConnection.GetConnection(); var cmd = new SqlCommand("sp_insert_sales_tax", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ZipCode", salesTax.ZipCode); cmd.Parameters.AddWithValue("@TaxRate", salesTax.TaxRate); cmd.Parameters.AddWithValue("@SalesTaxDate", salesTax.TaxDate); try { conn.Open(); rows = cmd.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } finally { conn.Close(); } return(rows); }
public static void Create(SalesTaxEditModel salesTaxEditModel, SalesTax salesTax, string userId) { salesTax.Code = salesTaxEditModel.Code; salesTax.Description = salesTaxEditModel.Description; salesTax.TaxPercentage = salesTaxEditModel.TaxPercentage; salesTax.UpdatedBy = userId; salesTax.UpdatedOn = Utilities.Utility.GetDateTime(); }
public bool Equals(TaxInfo other) { if (other == null) { return(false); } return(ShippingTax.Equals(other.ShippingTax) && SalesTax.Equals(other.SalesTax)); }
internal Line(SalesOrderId salesOrder, ProductId product, Quantity quantity, UnitPrice price, SalesTax tax) { Id = new LineId(Guid.NewGuid()); SalesOrder = salesOrder; Quantity = quantity; Product = product; Price = price; Tax = tax; }
public void AddSalesTax(SalesTax tax) { string command = "INSERT INTO dbo.SalesTax(SalesTaxName,SalesTaxValue) VALUES(@SalesTaxName,@SalesTaxValue)"; SqlParameter[] param = new SqlParameter[2]; param[0] = new SqlParameter("@SalesTaxName", tax.SalesTaxName); param[1] = new SqlParameter("@SalesTaxValue", tax.SalesTaxValue); da.Insert(param, command); }
public void AddSalesTaxShouldAddTaxtoGoodsItems() { Item item = new Goods("Wine", 40.00M); decimal expectedPrice = 44.00M; item.Price += SalesTax.AddSalesTax(item); Assert.AreEqual(expectedPrice, item.Price); }
public void AddSalesTaxShouldNotAddTaxtoMedicalItems() { Item item = new Medical("heart moniter", 5000M); decimal expectedItemPrice = 5000.00M; item.Price += SalesTax.AddSalesTax(item); Assert.AreEqual(expectedItemPrice, item.Price); }
public void AddSalesTaxShouldNotAddTaxToFoodItems() { Item item = new Food("berries", 3.50M); decimal expectedItemPrice = 3.50M; item.Price += SalesTax.AddSalesTax(item); Assert.AreEqual(expectedItemPrice, item.Price); }
public void AddSalesTaxShouldNotAddTaxToBookItems() { Item newBook = new Book("the book", 10.00M); decimal expected = 10.00M; newBook.Price += SalesTax.AddSalesTax(newBook); Assert.AreEqual(expected, newBook.Price); }
/// <summary> /// Creator: Jaeho Kim /// Created: 03/22/2020 /// Approver: Rasha Mohammed /// /// Implementation of CalculateSubTotal method. /// The subTotalTaxable is multiplied by the /// salesTax rate. This number is then added /// to the subTotal. After this calculation, /// the total is yielded. /// </summary> /// <remarks> /// Updater: Robert Holmes /// Updated: 04/20/2020 /// Update: Rounds to the nearest penny. /// </remarks> /// <returns>decimal</returns> public decimal CalculateTotal(decimal subTotal, decimal subTotalTaxable, SalesTax salesTax) { decimal tax = subTotalTaxable * salesTax.TaxRate; decimal total = subTotal + tax; total = Decimal.Round(total, 2); return(total); }
/// <summary> /// Creator: Jaeho Kim /// Created: 2020/04/13 /// Approver: Rob Holmes /// /// Interface implementation for inserting sales tax. /// </summary> /// <remarks> /// Updater: NA /// Updated: NA /// Update: NA /// </remarks> /// <param name="salesTax"></param> /// <returns>returns if success or failure</returns> public bool AddSalesTax(SalesTax salesTax) { try { return(1 == _salesTaxAccessor.InsertSalesTax(salesTax)); } catch (Exception ex) { throw new ApplicationException("Data not added.", ex); } }
public Line Add(ProductId product, Quantity quantity, UnitPrice price, SalesTax tax) { AssureSameLineCurrency(price.Currency); OrderStatus.AssureChangeToOrderIsAllowed(); var line = new Line(SalesOrder, product, quantity, price, tax); _lines.Add(line); return(line); }
public void updateSalesTax(SalesTax tax) { string command = "UPDATE SalesTax SET SalesTaxName=@SalesTaxName,SalesTaxValue=@SalesTaxValue WHERE Id=@Id"; SqlParameter[] param = new SqlParameter[3]; param[0] = new SqlParameter("@Id", tax.Id); param[1] = new SqlParameter("@SalesTaxName", tax.SalesTaxName); param[2] = new SqlParameter("@SalesTaxValue", tax.SalesTaxValue); da.Insert(param, command); }
public Item( string description, decimal listPrice, SalesTax.BasicExempt exemption, bool imported = false) { ItemId = _itemId++; Description = description; ListPrice = listPrice; ItemSalesTax = SalesTax.CalcTax(ListPrice, exemption, imported); }
public override string ToString() { string output = ""; foreach (var pair in Items) { output += pair.Value + " " + pair.Key + "\n"; } output += "Sales Taxes: " + SalesTax.ToString("n2") + "\n"; output += "Total: " + Total.ToString("n2"); return(output); }
/// <summary> /// Creator: Jaeho Kim /// Created: 4/04/2020 /// Approver: Rasha Mohammed /// /// Method to test select tax rate by zip code and latest date retrieved. /// </summary> /// <remarks> /// Updater: NA /// Updated: NA /// </remarks> /// <param name="zipCode">the zip code of the tax rate</param> /// <param name="salesTaxDate">the date of the tax rate</param> /// <returns>the tax rate</returns> public decimal SelectTaxRateBySalesTaxDateAndZipCode(string zipCode, DateTime salesTaxDate) { SalesTax salesTax = null; foreach (var aSalesTax in salesTaxes) { if (aSalesTax.ZipCode.Equals(zipCode) && aSalesTax.TaxDate.Equals(salesTaxDate)) { salesTax = aSalesTax; } } return(salesTax.TaxRate); }
public void CalcTax_BasicTaxTest() { //Basic sales tax applies to all items at a rate of 10% of the item’s list price, with the exception of books, food, and medical products. // Test no rounding decimal tax = SalesTax.CalcTax(50.00m, SalesTax.BasicExempt.None, false); Assert.AreEqual(5.00m, tax, "No rounding"); // Test round up tax = SalesTax.CalcTax(19.90m, SalesTax.BasicExempt.None, false); Assert.AreEqual(2.00m, tax, "Round up"); }
public Collection <ListItem> GetSalesTaxes(string tranBook) { int officeId = CurrentSession.GetOfficeId(); Collection <ListItem> values = new Collection <ListItem>(); foreach (Net.Entities.Core.SalesTax salesTax in SalesTax.GetSalesTaxes(tranBook, officeId)) { values.Add(new ListItem(salesTax.SalesTaxCode, salesTax.SalesTaxId.ToString(CultureInfo.InvariantCulture))); } return(values); }
/// <summary> /// Creator: Jaeho Kim /// Created: 4/04/2020 /// Approver: Rasha Mohammed /// /// Method to test select latest sales tax date /// </summary> /// <remarks> /// Updater: NA /// Updated: NA /// </remarks> /// <param name="zipCode">The zip code of the sales tax rate</param> /// <returns>The Exact Date of the Sales Tax Rate of the Zip Code</returns> public DateTime SelectLatestSalesTaxDateByZipCode(string zipCode) { SalesTax salesTax = null; foreach (var aSalesTax in salesTaxes) { if (aSalesTax.ZipCode.Equals(zipCode)) { salesTax = aSalesTax; } } return(salesTax.TaxDate); }
//[HttpPost] public ActionResult EditSalesTax(SalesTax st) { if (ModelState.IsValid) { if (st != null) { taxOperations.updateSalesTax(st); ModelState.Clear(); ViewBag.Message = " Sales Tax Updated successfully !!! "; } } return(RedirectToAction("FindSalesTax")); }
public ActionResult SalesTax(SalesTax sales) { if (ModelState.IsValid) { if (sales != null) { taxOperations.AddSalesTax(sales); ModelState.Clear(); ViewBag.Message = " Sales Tax Updated successfully !!! "; } } return(View(sales)); }
public Collection <ListItem> GetSalesTaxes(string tranBook) { int officeId = AppUsers.GetCurrent().View.OfficeId.ToInt(); Collection <ListItem> values = new Collection <ListItem>(); foreach (Net.Entities.Core.SalesTax salesTax in SalesTax.GetSalesTaxes(AppUsers.GetCurrentUserDB(), tranBook, officeId)) { values.Add(new ListItem(salesTax.SalesTaxCode, salesTax.SalesTaxId.ToString(CultureInfo.InvariantCulture))); } return(values); }
public void CalcTax_ExceptionsTest() { //Basic sales tax applies to all items at a rate of 10% of the item’s list price, with the exception of books, food, and medical products. decimal tax = SalesTax.CalcTax(5.60m, SalesTax.BasicExempt.Book, false); Assert.AreEqual(0.0m, tax, "Exception - Book Test"); tax = SalesTax.CalcTax(5.60m, SalesTax.BasicExempt.Food, false); Assert.AreEqual(0.0m, tax, "Exception - Food Test"); tax = SalesTax.CalcTax(5.60m, SalesTax.BasicExempt.Medicine, false); Assert.AreEqual(0.0m, tax, "Exception - Medicine Test"); }
public static void Operation() { var banana = new Banana(); var tariffTax = new TariffTax(); var salesTax = new SalesTax(); var clearanceSale = new ClearancePriceDecorator(); clearanceSale.SetItem(banana); salesTax.SetItem(clearanceSale); tariffTax.SetItem(salesTax); Printer.PrintLine($"{tariffTax.CalculatePrice()}"); }
/// <summary> /// Creator: Jaeho Kim /// Created: 2020/04/13 /// Approver: Rob Holmes /// /// This fake method is called to insert the sales tax. /// </summary> /// <remarks> /// Updater: NA /// Updated: NA /// Update: NA /// </remarks> /// <param name="salesTax"></param> /// <returns>rows effected</returns> public int InsertSalesTax(SalesTax salesTax) { int result = 0; FakeSalesTaxAccessor fakeSalesTaxAccessor = new FakeSalesTaxAccessor(); List <SalesTax> salesTaxes = _salesTaxes; if (!salesTaxes.Contains(salesTax)) { salesTaxes.Add(salesTax); result = 1; } return(result); }
public static SalesTax Create(SalesTaxAddModel addModel, string userId, int accId) { var salesTax = new SalesTax { Code = addModel.Code, Description = addModel.Description, TaxPercentage = addModel.TaxPercentage, CreatedBy = userId, CreatedOn = Utilities.Utility.GetDateTime(), Status = Utilities.Constants.RecordStatus.Active, BankAccountId = accId }; return(salesTax); }
protected void btnAllowenceTxtOutput_Click(object sender, EventArgs e) { string startdt = tbxStartDateAllowence.Text; string enddt = tbxEndDateAllowence.Text; string updStartdt = tbxUpdStartDateAllowence.Text; string updEnddt = tbxUpdEndDateAllowence.Text; lblLog.Text = _checkAllowenceInvoiceCreation(); if (lblLog.Text.Length > 0) { return; } SalesTax st = new SalesTax(); st.ExportAllowenceInvoiceTxtFile(startdt, enddt, "cancelonly", updStartdt, updEnddt); }
public void SaleTaxExcludeInclude() { int tenpercent = 10; List<GoodCategory> all = new List<GoodCategory>(); all.Add(cat1); all.Add(cat3); all.Add(cat2); SalesTax saletaxobject = new SalesTax("Basic sales tax", tenpercent, all); Assert.IsFalse(saletaxobject.IsAppliableTo(cat4)); Assert.IsTrue(saletaxobject.IsAppliableTo(cat1)); Assert.IsTrue(saletaxobject.IsAppliableTo(cat2)); saletaxobject.ExcludeGoodCategory(cat3); Assert.IsFalse(saletaxobject.IsAppliableTo(cat3)); }
public void TestRetrieveLatestSalesTaxDateByZipCode() { ITransactionManager transactionManager = new TransactionManager(_transactionAccessor); DateTime salesTaxDate = new DateTime(2002, 10, 18); SalesTax salesTax = new SalesTax() { TaxDate = salesTaxDate, TaxRate = 0.0025M, ZipCode = "1111" }; DateTime anotherSalesTaxDate = transactionManager.RetrieveLatestSalesTaxDateByZipCode(salesTax.ZipCode); Assert.AreEqual(salesTax.TaxDate, anotherSalesTaxDate); }
protected void btnInvoiceTxtOutput_Click(object sender, EventArgs e) { string startdt = tbxStartDateIssuance.Text; string enddt = tbxEndDateIssuance.Text; string updStartdt = tbxUpdStartDateIssuance.Text; string updEnddt = tbxUpdEndDateIssuance.Text; string cancelType = ddlIssuanceCancelType.Text; lblLog.Text = _checkInvoiceCreation(); if (lblLog.Text.Length > 0) { return; } SalesTax st = new SalesTax(); st.ExportSalesInvoiceTxtFile(startdt, enddt, cancelType, updStartdt, updEnddt); }