Beispiel #1
0
        public TaxData TaxWithheld(double weeklySalary, int numDependents)
        {
            if (numDependents < 0)
            {
                throw new InvalidOperationException("Number dependents cannot be negative.");
            }
            else if (weeklySalary <= 0)
            {
                throw new InvalidOperationException("Weekly salary must be greater than zero.");
            }

            /*            var taxData = new TaxData();
             *          {
             *              taxData.ProvincialTaxWithheld = weeklySalary * 0.06;
             *              taxData.FederalTaxWithheld = weeklySalary / 25;
             *              taxData.DependentDeduction = weeklySalary * 0.02;
             *              taxData.TotalWithheld = (weeklySalary * 0.06) + (weeklySalary / 25) + (weeklySalary * 0.02);
             *              taxData.TotalTakeHome = weeklySalary - (weeklySalary * 0.06) + (weeklySalary / 25) + (weeklySalary * 0.02);
             *              return taxData;
             *
             *          };*/

            var taxData = new TaxData();

            taxData.ProvincialTaxWithheld = weeklySalary * 0.06;
            taxData.ProvincialTaxWithheld = weeklySalary * 0.06;
            taxData.FederalTaxWithheld    = weeklySalary / 25;
            taxData.DependentDeduction    = weeklySalary * 0.02;
            taxData.TotalWithheld         = (weeklySalary * 0.06) + (weeklySalary / 25) + (weeklySalary * 0.02);
            taxData.TotalTakeHome         = weeklySalary - (weeklySalary * 0.06) + (weeklySalary / 25) + (weeklySalary * 0.02);
            return(taxData);
        }
Beispiel #2
0
        public decimal?GetTaxInfo(string city, DateTime date)
        {
            decimal?taxCost         = null;
            TaxData taxData         = _taxService.GetTaxData(city);
            var     dailySchedule   = taxData.Schedule.Where(i => i.ScheduleType.Equals(ScheduleType.Daily)).FirstOrDefault();
            var     weeklySchedule  = taxData.Schedule.Where(i => i.ScheduleType.Equals(ScheduleType.Weekly)).FirstOrDefault();
            var     monthlySchedule = taxData.Schedule.Where(i => i.ScheduleType.Equals(ScheduleType.Monthly)).FirstOrDefault();
            var     yearlySchedule  = taxData.Schedule.Where(i => i.ScheduleType.Equals(ScheduleType.Yearly)).FirstOrDefault();

            if (dailySchedule != null && CheckIfDateInRange(dailySchedule, date))
            {
                return(dailySchedule.TaxCost);
            }

            else if (weeklySchedule != null && CheckIfDateInRange(weeklySchedule, date))
            {
                return(weeklySchedule.TaxCost);
            }

            else if (monthlySchedule != null && CheckIfDateInRange(monthlySchedule, date))
            {
                return(monthlySchedule.TaxCost);
            }

            else if (yearlySchedule != null && CheckIfDateInRange(yearlySchedule, date))
            {
                return(yearlySchedule.TaxCost);
            }

            return(taxCost);
        }
 protected void ToString(List <string> toStringOutput)
 {
     toStringOutput.Add($"Type = {(Type == null ? "null" : Type.ToString())}");
     toStringOutput.Add($"Id = {(Id == null ? "null" : Id == string.Empty ? "" : Id)}");
     toStringOutput.Add($"UpdatedAt = {(UpdatedAt == null ? "null" : UpdatedAt == string.Empty ? "" : UpdatedAt)}");
     toStringOutput.Add($"Version = {(Version == null ? "null" : Version.ToString())}");
     toStringOutput.Add($"IsDeleted = {(IsDeleted == null ? "null" : IsDeleted.ToString())}");
     toStringOutput.Add($"CustomAttributeValues = {(CustomAttributeValues == null ? "null" : CustomAttributeValues.ToString())}");
     toStringOutput.Add($"CatalogV1Ids = {(CatalogV1Ids == null ? "null" : $"[{ string.Join(", ", CatalogV1Ids)} ]")}");
     toStringOutput.Add($"PresentAtAllLocations = {(PresentAtAllLocations == null ? "null" : PresentAtAllLocations.ToString())}");
     toStringOutput.Add($"PresentAtLocationIds = {(PresentAtLocationIds == null ? "null" : $"[{ string.Join(", ", PresentAtLocationIds)} ]")}");
     toStringOutput.Add($"AbsentAtLocationIds = {(AbsentAtLocationIds == null ? "null" : $"[{ string.Join(", ", AbsentAtLocationIds)} ]")}");
     toStringOutput.Add($"ImageId = {(ImageId == null ? "null" : ImageId == string.Empty ? "" : ImageId)}");
     toStringOutput.Add($"ItemData = {(ItemData == null ? "null" : ItemData.ToString())}");
     toStringOutput.Add($"CategoryData = {(CategoryData == null ? "null" : CategoryData.ToString())}");
     toStringOutput.Add($"ItemVariationData = {(ItemVariationData == null ? "null" : ItemVariationData.ToString())}");
     toStringOutput.Add($"TaxData = {(TaxData == null ? "null" : TaxData.ToString())}");
     toStringOutput.Add($"DiscountData = {(DiscountData == null ? "null" : DiscountData.ToString())}");
     toStringOutput.Add($"ModifierListData = {(ModifierListData == null ? "null" : ModifierListData.ToString())}");
     toStringOutput.Add($"ModifierData = {(ModifierData == null ? "null" : ModifierData.ToString())}");
     toStringOutput.Add($"TimePeriodData = {(TimePeriodData == null ? "null" : TimePeriodData.ToString())}");
     toStringOutput.Add($"ProductSetData = {(ProductSetData == null ? "null" : ProductSetData.ToString())}");
     toStringOutput.Add($"PricingRuleData = {(PricingRuleData == null ? "null" : PricingRuleData.ToString())}");
     toStringOutput.Add($"ImageData = {(ImageData == null ? "null" : ImageData.ToString())}");
     toStringOutput.Add($"MeasurementUnitData = {(MeasurementUnitData == null ? "null" : MeasurementUnitData.ToString())}");
     toStringOutput.Add($"SubscriptionPlanData = {(SubscriptionPlanData == null ? "null" : SubscriptionPlanData.ToString())}");
     toStringOutput.Add($"ItemOptionData = {(ItemOptionData == null ? "null" : ItemOptionData.ToString())}");
     toStringOutput.Add($"ItemOptionValueData = {(ItemOptionValueData == null ? "null" : ItemOptionValueData.ToString())}");
     toStringOutput.Add($"CustomAttributeDefinitionData = {(CustomAttributeDefinitionData == null ? "null" : CustomAttributeDefinitionData.ToString())}");
     toStringOutput.Add($"QuickAmountsSettingsData = {(QuickAmountsSettingsData == null ? "null" : QuickAmountsSettingsData.ToString())}");
 }
 /// <summary>
 /// Adds a TaxData object to the data list
 /// </summary>
 /// <param name="obj">The TaxData to add</param>
 public void Add(TaxData obj)
 {
     if (Data.Any(t => t.StateAbbreviation.ToLower() == obj.State.ToLower()))
     {
         return;
     }
     Data.Add(obj);
 }
 public void Update(TaxData obj)
 {
     for (int i = 0; i < Data.Count; i++)
     {
         if (Data[i].State.ToLower().Equals(obj.State.ToLower()))
         {
             Data[i] = obj;
         }
     }
 }
        /// <summary>
        /// Converts a TaxData object into a parseable string to be saved to data.
        /// </summary>
        /// <param name="data">The TaxData object to convert</param>
        /// <returns>A parseable TaxData string</returns>
        private string MapToRow(TaxData data)
        {
            string row = string.Empty;

            row += data.StateAbbreviation + Separator;
            row += data.State + Separator;
            row += data.TaxRate;

            return(row);
        }
Beispiel #7
0
        public void GivenDonation_ReturnsGiftAid()
        {
            var taxData = new TaxData {
                Country = "UK", TaxRate = 20
            };

            var giftAid = _serviceUnderTest.Calculate(100, "UK", taxData);

            giftAid.ShouldBe(30);
        }
Beispiel #8
0
        public async Task AddTaxRecord(TaxData taxData)
        {
            var taxDataContext = _context.TaxData.Where(i => i.City == taxData.City).FirstOrDefault();

            if (taxDataContext != null)
            {
                _context.TaxData.Remove(taxDataContext);
            }
            _context.TaxData.Add(taxData);

            await _context.SaveChangesAsync();
        }
        /// <summary>
        /// Splits a string into individual values and parses them into a TaxData object.
        /// </summary>
        /// <param name="s">The string to parse</param>
        /// <returns>A TaxData object based on the values</returns>
        private TaxData MapToData(string s)
        {
            string[] split = s.Split(Convert.ToChar(Separator));
            if (split.Length != 3)
            {
                return(null);
            }

            TaxData data = new TaxData();

            data.StateAbbreviation = split[0];
            data.State             = split[1];
            data.TaxRate           = decimal.Parse(split[2]);

            return(data);
        }
Beispiel #10
0
        public void Setup()
        {
            _giftAidCalculatorFinder     = new Mock <IGiftAidCalculatorFinder>();
            _taxRepository               = new Mock <ITaxRepository>();
            _mockGiftAidCalculator       = new Mock <IGiftAidCalculator>();
            _giftAidOrchestrationService = new GiftAidOrchestrationService(_taxRepository.Object, _giftAidCalculatorFinder.Object);

            _taxData = new TaxData {
                Country = "UK", TaxRate = 20
            };
            _taxList = new List <TaxData> {
                _taxData
            };

            _taxRepository.Setup(x => x.GetTaxRate("UK"))
            .Returns(Task.FromResult(_taxList));
        }
Beispiel #11
0
        /// <summary>
        /// Creates sample data for the repository
        /// </summary>
        private void GenerateTestOrder()
        {
            TaxData tax = new TaxData();

            tax.State             = "Ohio";
            tax.StateAbbreviation = "OH";
            tax.TaxRate           = 6.25M;

            Product product = new Product();

            product.ProductType            = "Carpet";
            product.CostPerSquareFoot      = 2.25M;
            product.LaborCostPerSquareFoot = 2.10M;

            Order order = Order.CreateOrder("Test Customer", 200M, tax, product, Data);

            Data.Add(order);
        }
Beispiel #12
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            try
            {
                if (SupporterIdTextBox.Text == "")
                {
                    throw new Exception("Please enter a Supporter ID number.");
                }

                if (!PrivacyPolicyCheckBox.Checked)
                {
                    throw new Exception("Please check the 'I have read the Privacy Policy'");
                }

                //if (Request["taxyear"] == null)
                //    throw new Exception("There is an error with the tax year, please contact SPLC for support.");

                //int intYear = int.Parse(Request["taxyear"].ToString());

                TaxData taxD = new TaxData(_ConnStr);
                taxD.TaxYear        = intTaxYear;
                taxD.TAX_RECEIPT_ID = SupporterIdTextBox.Text.ToString();
                taxD.Load();

                string strDT = taxD.Downloaded_DateTIme.ToString();


                if (!taxD.IsValid)
                {
                    throw new Exception("The Supporter ID you entered is not valid.");
                }
                else
                {
                    taxD.Downloaded_DateTIme = DateTime.Now;
                    taxD.Update();

                    Response.Redirect("TaxForm.aspx?taxyear=" + intTaxYear.ToString() + "&id=" + SupporterIdTextBox.Text.ToString());
                }
            }
            catch (Exception EX)
            {
                lblMessage.Text = EX.Message;
            }
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is CatalogObject other &&
                   ((Type == null && other.Type == null) || (Type?.Equals(other.Type) == true)) &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true)) &&
                   ((Version == null && other.Version == null) || (Version?.Equals(other.Version) == true)) &&
                   ((IsDeleted == null && other.IsDeleted == null) || (IsDeleted?.Equals(other.IsDeleted) == true)) &&
                   ((CustomAttributeValues == null && other.CustomAttributeValues == null) || (CustomAttributeValues?.Equals(other.CustomAttributeValues) == true)) &&
                   ((CatalogV1Ids == null && other.CatalogV1Ids == null) || (CatalogV1Ids?.Equals(other.CatalogV1Ids) == true)) &&
                   ((PresentAtAllLocations == null && other.PresentAtAllLocations == null) || (PresentAtAllLocations?.Equals(other.PresentAtAllLocations) == true)) &&
                   ((PresentAtLocationIds == null && other.PresentAtLocationIds == null) || (PresentAtLocationIds?.Equals(other.PresentAtLocationIds) == true)) &&
                   ((AbsentAtLocationIds == null && other.AbsentAtLocationIds == null) || (AbsentAtLocationIds?.Equals(other.AbsentAtLocationIds) == true)) &&
                   ((ImageId == null && other.ImageId == null) || (ImageId?.Equals(other.ImageId) == true)) &&
                   ((ItemData == null && other.ItemData == null) || (ItemData?.Equals(other.ItemData) == true)) &&
                   ((CategoryData == null && other.CategoryData == null) || (CategoryData?.Equals(other.CategoryData) == true)) &&
                   ((ItemVariationData == null && other.ItemVariationData == null) || (ItemVariationData?.Equals(other.ItemVariationData) == true)) &&
                   ((TaxData == null && other.TaxData == null) || (TaxData?.Equals(other.TaxData) == true)) &&
                   ((DiscountData == null && other.DiscountData == null) || (DiscountData?.Equals(other.DiscountData) == true)) &&
                   ((ModifierListData == null && other.ModifierListData == null) || (ModifierListData?.Equals(other.ModifierListData) == true)) &&
                   ((ModifierData == null && other.ModifierData == null) || (ModifierData?.Equals(other.ModifierData) == true)) &&
                   ((TimePeriodData == null && other.TimePeriodData == null) || (TimePeriodData?.Equals(other.TimePeriodData) == true)) &&
                   ((ProductSetData == null && other.ProductSetData == null) || (ProductSetData?.Equals(other.ProductSetData) == true)) &&
                   ((PricingRuleData == null && other.PricingRuleData == null) || (PricingRuleData?.Equals(other.PricingRuleData) == true)) &&
                   ((ImageData == null && other.ImageData == null) || (ImageData?.Equals(other.ImageData) == true)) &&
                   ((MeasurementUnitData == null && other.MeasurementUnitData == null) || (MeasurementUnitData?.Equals(other.MeasurementUnitData) == true)) &&
                   ((SubscriptionPlanData == null && other.SubscriptionPlanData == null) || (SubscriptionPlanData?.Equals(other.SubscriptionPlanData) == true)) &&
                   ((ItemOptionData == null && other.ItemOptionData == null) || (ItemOptionData?.Equals(other.ItemOptionData) == true)) &&
                   ((ItemOptionValueData == null && other.ItemOptionValueData == null) || (ItemOptionValueData?.Equals(other.ItemOptionValueData) == true)) &&
                   ((CustomAttributeDefinitionData == null && other.CustomAttributeDefinitionData == null) || (CustomAttributeDefinitionData?.Equals(other.CustomAttributeDefinitionData) == true)) &&
                   ((QuickAmountsSettingsData == null && other.QuickAmountsSettingsData == null) || (QuickAmountsSettingsData?.Equals(other.QuickAmountsSettingsData) == true)));
        }
Beispiel #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    TaxData   taxD    = new TaxData(_ConnStr);
                    DataTable dtDonor = new DataTable();
                    //dtDonor = taxD.Load(Request["id"].ToString(), int.Parse(Request["taxyear"].ToString()));

                    // Check if they have already accessed the file


                    rvTaxReceipt.ProcessingMode         = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                    rvTaxReceipt.LocalReport.ReportPath = Server.MapPath("Templates/TaxReport.rdlc");

                    GetDonorData(dtDonor);
                }
                catch (Exception EX)
                {}
            }
        }
        /// <summary>
        /// Maps each line of the file within the file path to a TaxData object & compiles a list.
        /// </summary>
        /// <returns>List of products from the file</returns>
        public List <TaxData> GetAll()
        {
            List <TaxData> data = new List <TaxData>();

            using (StreamReader reader = new StreamReader(FilePath))
            {
                string line = string.Empty;
                while ((line = reader.ReadLine()) != null)
                {
                    if (line.ToLower().Equals(FileHeader.ToLower()))
                    {
                        continue;
                    }
                    TaxData tax = MapToData(line);
                    if (tax != null)
                    {
                        data.Add(tax);
                    }
                }
            }

            return(data);
        }
        /// <summary>
        /// Attempts to edit an order within the current IOrderRepository data
        /// </summary>
        /// <param name="inputtedDate"></param>
        /// <param name="orderNumber"></param>
        /// <param name="newCustomerName"></param>
        /// <param name="newState"></param>
        /// <param name="newProductType"></param>
        /// <param name="newArea"></param>
        /// <returns></returns>
        public EditOrderResponse EditOrder(string inputtedDate, int orderNumber, string newCustomerName, string newState,
                                           string newProductType, decimal newArea)
        {
            EditOrderResponse response = new EditOrderResponse();
            DateTime          date     = ParseDate(response, inputtedDate);

            if (response.ResponseType.Equals(ResponseType.Invalid))
            {
                return(response);
            }

            Order order = OrderRepository.GetByValue(orderNumber);

            if (order == null)
            {
                response.ResponseType = ResponseType.Fail;
                response.Message      = "Couldn't find order with that number.";
                return(response);
            }
            if (!ValidNameInput(newCustomerName))
            {
                response.ResponseType = ResponseType.Fail;
                response.Message      = "Invalid customer name. Check special characters.";
                return(response);
            }
            TaxData tax     = TaxRepository.GetByValue(newState);
            Product product = ProductRepository.GetByValue(newProductType);

            if (tax == null)
            {
                response.ResponseType = ResponseType.Fail;
                response.Message      = "Invalid state.";
                return(response);
            }
            if (product == null)
            {
                response.ResponseType = ResponseType.Fail;
                response.Message      = "Invalid product type.";
                return(response);
            }

            if (newArea < 0)
            {
                response.ResponseType = ResponseType.Fail;
                response.Message      = "Area must be a positive decimal.";
                return(response);
            }

            if (newArea < 100)
            {
                response.ResponseType = ResponseType.Fail;
                response.Message      = "Area must be at least 100 sq ft.";
                return(response);
            }

            Order updated = Order.CreateOrder(newCustomerName, newArea, tax, product, orderNumber);

            OrderRepository.Update(updated);

            response.NewOrder     = updated;
            response.Date         = date;
            response.ResponseType = ResponseType.Success;
            return(response);
        }
Beispiel #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            TaxYear TYear = new TaxYear(_ConnStr, int.Parse(Request["taxyear"].ToString()));

            TaxData   TaxD       = new TaxData(_ConnStr);
            DataTable pDonorData = TaxD.LoadTable(Request["id"].ToString(), TYear._TaxYear);

            DataTable dtTaxYear = new DataTable();

            dtTaxYear = TYear.GetTaxYear(int.Parse(Request["taxyear"].ToString()));

            // Create a Document object
            var document = new Document(PageSize.A4, 60, 25, 50, 10);

            // Create a new PdfWrite object, writing the output to a MemoryStream
            var output = new MemoryStream();
            var writer = PdfWriter.GetInstance(document, output);

            // Open the Document for writing
            document.Open();

            var HeaderFont    = FontFactory.GetFont("Helvetica", 7, Font.NORMAL);
            var HeaderFontRed = FontFactory.GetFont("Helvetica", 7, Font.NORMAL, new BaseColor(138, 8, 8));
            var BodyFont      = FontFactory.GetFont("Helvetica", 10, Font.NORMAL);
            var BodyFontBold  = FontFactory.GetFont("Helvetica", 10, Font.BOLD);
            var BodyOblique   = FontFactory.GetFont("Helvetica Oblique", 10, Font.ITALIC);

            var TableFontHr = FontFactory.GetFont("Helvetica", 10, Font.BOLD);
            var TableFont   = FontFactory.GetFont("Helvetica", 10, Font.NORMAL);

            // You can add additional elements to the document. Let's add an image in the upper right corner
            var logo = iTextSharp.text.Image.GetInstance(Server.MapPath("~/Images/SPLC_LOGO.png"));

            logo.SetAbsolutePosition(45, 750);
            logo.ScalePercent(25.0f, 25.0f);
            document.Add(logo);

            int intIndent = 380;

            var Header = new Paragraph("Fighting Hate", HeaderFontRed);

            Header.IndentationLeft = intIndent;
            document.Add(Header);
            Header = new Paragraph("Teaching Tolerance", HeaderFontRed);
            Header.IndentationLeft = intIndent;
            document.Add(Header);
            Header = new Paragraph("Seeking Justice", HeaderFontRed);
            Header.IndentationLeft = intIndent;
            document.Add(Header);

            Header = new Paragraph("   ", HeaderFontRed);
            Header.IndentationLeft = intIndent;
            document.Add(Header);

            Header = new Paragraph("Southern Poverty Law Center", HeaderFont);
            Header.IndentationLeft = intIndent;
            document.Add(Header);
            Header = new Paragraph("400 Washington Avenue", HeaderFont);
            Header.IndentationLeft = intIndent;
            document.Add(Header);
            Header = new Paragraph("Montgomery, AL 36104", HeaderFont);
            Header.IndentationLeft = intIndent;
            document.Add(Header);
            Header = new Paragraph("334.956.8200", HeaderFont);
            Header.IndentationLeft = intIndent;
            document.Add(Header);
            Header = new Paragraph("splcenter.org", HeaderFont);
            Header.IndentationLeft = intIndent;
            document.Add(Header);

            string strCONST = pDonorData.Rows[0]["CONSTITUENT1"].ToString();

            if (pDonorData.Rows[0]["CONSTITUENT2"].ToString().Length > 0)
            {
                strCONST += " and " + pDonorData.Rows[0]["CONSTITUENT2"].ToString();
            }

            Paragraph pStart = new Paragraph(strCONST, BodyFont);

            pStart.SpacingBefore = 40;
            document.Add(pStart);

            document.Add(new Paragraph(pDonorData.Rows[0]["ADDRESSLINE1"].ToString(), BodyFont));

            if (pDonorData.Rows[0]["ADDRESSLINE2"].ToString().Length > 0)
            {
                document.Add(new Paragraph(pDonorData.Rows[0]["ADDRESSLINE2"].ToString(), BodyFont));
            }

            document.Add(new Paragraph(pDonorData.Rows[0]["CITY"].ToString() + ", " + pDonorData.Rows[0]["STATE"].ToString() + "  " + pDonorData.Rows[0]["ZIP"].ToString(), BodyFont));

            document.Add(new Paragraph("2014 Support — Southern Poverty Law Center", BodyFontBold));

            PdfPTable tbl = new PdfPTable(2);

            tbl.WidthPercentage     = 61;
            tbl.HorizontalAlignment = 0;
            tbl.SpacingBefore       = 10;
            tbl.SpacingAfter        = 20;

            PdfPCell clDateHr = new PdfPCell(new Phrase("Donation Date", TableFontHr));

            clDateHr.HorizontalAlignment = 1;
            tbl.AddCell(clDateHr);

            PdfPCell clAmountHr = new PdfPCell(new Phrase("Amount", TableFontHr));

            clAmountHr.HorizontalAlignment = 1;
            tbl.AddCell(clAmountHr);


            DataTable dtRows = GetDonorData(pDonorData);

            float flTotal = 0;

            foreach (DataRow dr in dtRows.Rows)
            {
                PdfPCell clDate = new PdfPCell(new Phrase(DateTime.Parse(dr["Donation_Date"].ToString()).ToShortDateString(), TableFont));
                clDate.HorizontalAlignment = 2;
                clDate.RightIndent         = 5;
                tbl.AddCell(clDate);

                PdfPCell clAmount = new PdfPCell(new Phrase(float.Parse(dr["Amount"].ToString()).ToString("C2"), TableFont));
                clAmount.HorizontalAlignment = 2;
                clAmount.RightIndent         = 45;
                tbl.AddCell(clAmount);

                flTotal += float.Parse(dr["Amount"].ToString());
            }

            PdfPCell clTotal = new PdfPCell(new Phrase("TOTAL", TableFontHr));

            clTotal.HorizontalAlignment = 2;
            clTotal.Border = 0;
            tbl.AddCell(clTotal);

            PdfPCell clAmountTl = new PdfPCell(new Phrase(flTotal.ToString("C2"), TableFontHr));

            clAmountTl.HorizontalAlignment = 2;
            clAmountTl.RightIndent         = 45;
            tbl.AddCell(clAmountTl);


            document.Add(tbl);

            document.Add(new Paragraph("This will serve as your receipt for tax purposes.", BodyOblique));
            document.Add(new Paragraph("The Southern Poverty Law Center is a 501(c)(3) organization.", BodyOblique));
            document.Add(new Paragraph("Gifts to the Center are fully tax-deductible.", BodyOblique));
            document.Add(new Paragraph("No goods or services are ever sent in exchange for gifts.", BodyOblique));

            document.Add(new Paragraph("    ", BodyOblique));

            document.Add(new Paragraph("The information on this receipt is accurate as of " + TYear.Start_DateTime.ToShortDateString() + ".", BodyFont));

            document.Close();

            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-Disposition", string.Format("attachment;filename=Receipt-{0}.pdf", "123456"));
            Response.BinaryWrite(output.ToArray());
        }
Beispiel #18
0
        public decimal Calculate(decimal donationAmount, string country, TaxData giftTax)
        {
            var giftAidAmount = (donationAmount * giftTax.TaxRate) / (100 - giftTax.TaxRate);

            return(giftAidAmount + (donationAmount * 5 / 100));
        }
Beispiel #19
0
        public async Task <IActionResult> TaxDataUpload([FromBody] TaxData taxData)
        {
            await _taxService.AddTaxRecord(taxData);

            return(Created(HttpContext.Request.Path, "Uploaded successfully"));
        }
        /// <summary>
        /// Attempts to add an order to the current IOrderRepository data
        /// </summary>
        /// <param name="customerName">The customer name</param>
        /// <param name="state">The state</param>
        /// <param name="productType">The product type</param>
        /// <param name="area">The sq ft area</param>
        /// <returns>A validated response</returns>
        public AddOrderResponse AddOrder(string customerName, string state, string productType, decimal area)
        {
            AddOrderResponse response = new AddOrderResponse();
            DateTime         date     = ParseDate(response, OrderRepository.OrderDate);

            //If the date couldn't be parsed...
            if (response.ResponseType.Equals(ResponseType.Invalid))
            {
                return(response);
            }

            TaxData tax     = TaxRepository.GetByValue(state);
            Product product = ProductRepository.GetByValue(productType);

            if (tax == null)
            {
                response.ResponseType = ResponseType.Fail;
                response.Message      = $"We can't sell to the state: {state}";
            }
            else if (product == null)
            {
                response.ResponseType = ResponseType.Fail;
                response.Message      = $"Product doesn't exist: {productType}";
            }
            else if (!(date > DateTime.Now.Date))
            {
                response.ResponseType = ResponseType.Fail;
                response.Message      = $"Date must be later than today's date: {DateTime.Today.Date:MM/dd/yyyy}";
            }
            else if (!ValidNameInput(customerName))
            {
                response.ResponseType = ResponseType.Fail;
                response.Message      = "Invalid customer name input.";
            }
            else if (area < 0)
            {
                response.ResponseType = ResponseType.Fail;
                response.Message      = "Area value must be a positive decimal.";
            }
            else if (area < 100)
            {
                response.ResponseType = ResponseType.Fail;
                response.Message      = "Area value must be 100 or higher.";
            }

            if (response.ResponseType != ResponseType.Fail && response.ResponseType != ResponseType.Invalid)
            {
                Order order = Order.CreateOrder(customerName, area, tax, product, OrderRepository.Data);
                OrderRepository.Add(order);

                response.Order        = order;
                response.Date         = date;
                response.ResponseType = ResponseType.Success;
            }
            else
            {
                if (OrderRepository.Data.Count <= 0)
                {
                    FileManager.DeleteFile(FileManager.OrdersPath, date);
                }
            }
            return(response);
        }
Beispiel #21
0
 public decimal Calculate(decimal donationAmount, string country, TaxData giftPercent)
 {
     return((donationAmount * giftPercent.TaxRate) / (100 - giftPercent.TaxRate));
 }
        public override int GetHashCode()
        {
            int hashCode = -1814270990;

            if (Type != null)
            {
                hashCode += Type.GetHashCode();
            }

            if (Id != null)
            {
                hashCode += Id.GetHashCode();
            }

            if (UpdatedAt != null)
            {
                hashCode += UpdatedAt.GetHashCode();
            }

            if (Version != null)
            {
                hashCode += Version.GetHashCode();
            }

            if (IsDeleted != null)
            {
                hashCode += IsDeleted.GetHashCode();
            }

            if (CustomAttributeValues != null)
            {
                hashCode += CustomAttributeValues.GetHashCode();
            }

            if (CatalogV1Ids != null)
            {
                hashCode += CatalogV1Ids.GetHashCode();
            }

            if (PresentAtAllLocations != null)
            {
                hashCode += PresentAtAllLocations.GetHashCode();
            }

            if (PresentAtLocationIds != null)
            {
                hashCode += PresentAtLocationIds.GetHashCode();
            }

            if (AbsentAtLocationIds != null)
            {
                hashCode += AbsentAtLocationIds.GetHashCode();
            }

            if (ImageId != null)
            {
                hashCode += ImageId.GetHashCode();
            }

            if (ItemData != null)
            {
                hashCode += ItemData.GetHashCode();
            }

            if (CategoryData != null)
            {
                hashCode += CategoryData.GetHashCode();
            }

            if (ItemVariationData != null)
            {
                hashCode += ItemVariationData.GetHashCode();
            }

            if (TaxData != null)
            {
                hashCode += TaxData.GetHashCode();
            }

            if (DiscountData != null)
            {
                hashCode += DiscountData.GetHashCode();
            }

            if (ModifierListData != null)
            {
                hashCode += ModifierListData.GetHashCode();
            }

            if (ModifierData != null)
            {
                hashCode += ModifierData.GetHashCode();
            }

            if (TimePeriodData != null)
            {
                hashCode += TimePeriodData.GetHashCode();
            }

            if (ProductSetData != null)
            {
                hashCode += ProductSetData.GetHashCode();
            }

            if (PricingRuleData != null)
            {
                hashCode += PricingRuleData.GetHashCode();
            }

            if (ImageData != null)
            {
                hashCode += ImageData.GetHashCode();
            }

            if (MeasurementUnitData != null)
            {
                hashCode += MeasurementUnitData.GetHashCode();
            }

            if (SubscriptionPlanData != null)
            {
                hashCode += SubscriptionPlanData.GetHashCode();
            }

            if (ItemOptionData != null)
            {
                hashCode += ItemOptionData.GetHashCode();
            }

            if (ItemOptionValueData != null)
            {
                hashCode += ItemOptionValueData.GetHashCode();
            }

            if (CustomAttributeDefinitionData != null)
            {
                hashCode += CustomAttributeDefinitionData.GetHashCode();
            }

            if (QuickAmountsSettingsData != null)
            {
                hashCode += QuickAmountsSettingsData.GetHashCode();
            }

            return(hashCode);
        }