public async Task <ActionResult <Taxes> > PostTaxes(Taxes taxes)
        {
            _context.Taxes.Add(taxes);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTaxes", new { id = taxes.Id }, taxes));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("value,id,name,c_date,seo_url,is_active,is_delete")] Taxes taxes)
        {
            if (id != taxes.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(taxes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TaxesExists(taxes.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(taxes));
        }
Beispiel #3
0
        private static object GetTax(dynamic _)
        {
            int year;
            int month;
            int day;

            try
            {
                year  = int.Parse(_.year);
                month = int.Parse(_.month);
                day   = int.Parse(_.day);
            }
            catch (Exception e)
            {
                return(Helper.ErrorResponse(e, HttpStatusCode.InternalServerError));
            }

            try
            {
                return(Taxes.GetTax(_.municipality.ToString(), new DateTime(year, month, day)));
            }
            catch (Exception e)
            {
                return(Helper.ErrorResponse(e, HttpStatusCode.InternalServerError));
            }
        }
        public async Task <IActionResult> PutTaxes(int id, Taxes taxes)
        {
            if (id != taxes.Id)
            {
                return(BadRequest());
            }

            _context.Entry(taxes).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TaxesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #5
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(amountTxt.Text))
            {
                amountTxt.BackColor = Color.Red;
                return;
            }
            if (string.IsNullOrEmpty(itemTxt.Text))
            {
                itemTxt.BackColor = Color.Red;
                return;
            }
            if (!string.IsNullOrEmpty(existingID))
            {
                if (MessageBox.Show("YES or No?", "Are you sure you want to update the current existing information  ? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    Taxes j = new Taxes(existingID, Convert.ToDateTime(dateTxt.Text).Year.ToString(), Convert.ToInt32(weekLbl.Text), startLbl.Text, endLbl.Text, itemTxt.Text, Convert.ToDouble(amountTxt.Text), month);
                    DBConnect.Update(j, existingID);
                    existingID = "";
                }
                return;
            }
            existingID = "";
            string ID = Guid.NewGuid().ToString();
            Taxes  i  = new Taxes(ID, Convert.ToDateTime(dateTxt.Text).Year.ToString(), Convert.ToInt32(weekLbl.Text), startLbl.Text, endLbl.Text, itemTxt.Text, Convert.ToDouble(amountTxt.Text), month);

            DBConnect.Insert(i);
            MessageBox.Show("Information Saved ");
            itemTxt.Text   = "";
            amountTxt.Text = "";
        }
Beispiel #6
0
 private void itemTxt_Leave(object sender, EventArgs e)
 {
     try
     {
         amountTxt.Text = Taxes.List("SELECT * from taxes WHERE name='" + itemTxt.Text + "' AND week = '" + weekLbl.Text + "' AND date = '" + Convert.ToDateTime(dateTxt.Text).Year.ToString() + "'").First().Amount.ToString();
     }
     catch (Exception y)
     {
         // Helper.Exceptions(y.Message, "on adding inventory auto fill the category list selected item");
     }
     try
     {
         month = Taxes.List("SELECT * from taxes WHERE name='" + itemTxt.Text + "' AND week = '" + weekLbl.Text + "' AND date = '" + Convert.ToDateTime(dateTxt.Text).Year.ToString() + "'").First().Month;
     }
     catch (Exception y)
     {
         // Helper.Exceptions(y.Message, "on adding inventory auto fill the category list selected item");
     }
     try
     {
         existingID = Taxes.List("SELECT * from taxes WHERE name='" + itemTxt.Text + "' AND week = '" + weekLbl.Text + "' AND date = '" + Convert.ToDateTime(dateTxt.Text).Year.ToString() + "'").First().Id.ToString();
     }
     catch (Exception y)
     {
         // Helper.Exceptions(y.Message, "on adding inventory auto fill the category list selected item");
     }
 }
Beispiel #7
0
        public static List <Taxes> GetTaxes()
        {
            string filePath = @"C:\Data\FlooringMastery\Taxes.txt";

            List <Taxes> taxes = new List <Taxes>();

            using (StreamReader sr = new StreamReader(filePath))
            {
                sr.ReadLine();

                List <string> lines = new List <string>();

                while (!sr.EndOfStream)
                {
                    lines.Add(sr.ReadLine());
                }
                foreach (var p in lines)
                {
                    Taxes tax = new Taxes();

                    string[] columns = p.Split(',');

                    tax.StateAbbreviation = columns[0];

                    tax.StateName = columns[1];

                    tax.TaxRate = decimal.Parse(columns[2]);

                    taxes.Add(tax);
                }
                return(taxes);
            }
        }
Beispiel #8
0
        public static List <Taxes> LoadTaxes()
        {
            List <Taxes> results = new List <Taxes>();

            StreamReader sr = null;

            try
            {
                sr = new StreamReader(@"C:\Users\camer\source\repos\SWC Corp\SWC Corp.UI\bin\Debug\Taxes.txt");
                sr.ReadLine();
                string row = "";
                while ((row = sr.ReadLine()) != null)
                {
                    Taxes t = TaxMapper.ToTaxes(row);
                    results.Add(t);
                }
                taxes = results;
            }
            catch (FileNotFoundException filenNotFound)
            {
                Console.WriteLine(filenNotFound.FileName + " was not found");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                if (sr != null)
                {
                    sr.Close();
                }
            }
            return(results);
        }
Beispiel #9
0
        public override void _(Events.RowPersisting <EntityWithTaxCalcMode> e)
        {
            if (SkipValidation || Taxes.Count() == 0)
            {
                return;
            }

            PXSetPropertyException pex = null;

            foreach (EPExpenseClaimDetails row in Base.ExpenseClaimDetails.Select())
            {
                try
                {
                    VerifyTransactions(row.TaxCalcMode, Base.Tax_Rows.Select(row.ClaimDetailID).RowCast <Tax>());
                }
                catch (PXException ex)
                {
                    pex = new PXSetPropertyException(ex.Message);
                    Base.ExpenseClaimDetails.Cache.RaiseExceptionHandling <EPExpenseClaimDetails.curyTaxTotal>(row, row.CuryTaxTotal, pex);
                }
            }

            if (pex != null)
            {
                throw pex;
            }
        }
Beispiel #10
0
        protected virtual void AddInvoiceProc()
        {
            foreach (APInvoice item in DocumentList.Cache.Updated)
            {
                try
                {
                    if (item.Selected == true)
                    {
                        APTaxTran tran = new APTaxTran();
                        tran.TranType     = Document.Current.DocType;
                        tran.RefNbr       = Document.Current.RefNbr;
                        tran.OrigTranType = item.DocType;
                        tran.OrigRefNbr   = item.RefNbr;
                        tran.TaxID        = Filter.Current.TaxID;

                        Taxes.Insert(tran);
                    }
                }
                finally
                {
                    DocumentList.Cache.SetStatus(item, PXEntryStatus.Notchanged);
                    DocumentList.Cache.Remove(item);
                }
            }
        }
Beispiel #11
0
        public TaxesRepo()
        {
            if (File.Exists(filePath))
            {
                using (StreamReader sr = new StreamReader(filePath))
                {
                    sr.ReadLine();
                    string line;

                    while ((line = sr.ReadLine()) != null)
                    {
                        Taxes newTaxInfo = new Taxes();

                        string[] columns = line.Split(',');

                        newTaxInfo.StateAbbreviation = columns[0];
                        newTaxInfo.State             = columns[1];
                        newTaxInfo.TaxRate           = decimal.Parse(columns[2]);

                        taxList.Add(newTaxInfo);
                    }
                    //response.TaxList = taxList;
                    //response.Success = true;
                    //response.Message = "taxes added from file";
                }
            }
        }
Beispiel #12
0
        // generates Tax Repository
        private List <Taxes> TaxesRepositoryList()
        {
            List <Taxes> taxes = new List <Taxes>();

            if (File.Exists(_taxPath))
            {
                using (StreamReader sr = new StreamReader(_taxPath))
                {
                    sr.ReadLine();
                    string line;

                    while ((line = sr.ReadLine()) != null)
                    {
                        Taxes newTaxes = new Taxes();

                        string[] columns = line.Split(',');

                        newTaxes.StateAbbreviation = columns[0];
                        newTaxes.StateName         = columns[1];
                        newTaxes.TaxRate           = Convert.ToDecimal(columns[TWO]);

                        taxes.Add(newTaxes);
                    }
                }
                return(taxes);
            }
            else
            {
                return(null);
            }
        }
Beispiel #13
0
        public IEnumerable <Taxes> TaxInfo()
        {
            FileInfo taxData = new FileInfo(@".\Taxes.txt");

            if (!File.Exists(@".\Taxes.txt"))
            {
                File.Create(@".\Taxes.txt");
            }
            using (TextReader taxGet = taxData.OpenText())
            {
                string line = taxGet.ReadLine();
                while ((line = taxGet.ReadLine()) != null)
                {
                    line = line.Replace("\"", "");
                    string[] column = line.Split(',');
                    Taxes    a      = new Taxes();
                    a.StateAbbreviation = column[0];
                    a.StateName         = column[1];
                    a.TaxRate           = decimal.Parse(column[2]);

                    _taxes.Add(a);
                }
            }
            return(_taxes);
        }
        private decimal CalculateTaxes(int basketId)
        {
            decimal totalTaxes = 0;

            using (var sr = new StreamReader($"basket.json"))
            {
                var json    = sr.ReadToEnd();
                var baskets = JsonConvert.DeserializeObject <List <Basket> >(json);
                var basket  = baskets.FirstOrDefault(b => b.BasketId == basketId);

                foreach (var product in basket.Products)
                {
                    decimal tax = 0;
                    if (product.Taxable)
                    {
                        tax += Taxes.GetRegularTax(product.Price);
                    }
                    if (product.Imported)
                    {
                        tax += Taxes.GetImportationTax(product.Price);
                    }
                    decimal taxProduct = Calculate.Round(tax);
                    totalTaxes += taxProduct;
                }
            }
            return(totalTaxes);
        }
Beispiel #15
0
        /// <summary>
        /// This method is used to get new PQ
        /// </summary>
        public void GetNewPQ()
        {
            IsNew = true;
            ID    = 0;
            SelectedSupplierID = 0;
            BillToAddress      = string.Empty;
            ShipToAddress      = string.Empty;
            // ValidForDays = 0;
            InvoiceNo = string.Empty;
            // PQDetailsEntity.Clear();
            this.OurPONo           = GenerateNewInvoiceNo();
            TotalBeforeTax         = 0;
            TotalTax               = 0;
            TotalAfterTax          = 0;
            TotalBeforeTaxStr      = Convert.ToString(0);
            TotalTaxStr            = Convert.ToString(0);
            TotalAfterTaxStr       = Convert.ToString(0);
            PQErrors               = string.Empty;
            AllFieldsEnabled       = true;
            AllFieldsReadonly      = false;
            this.PaymentDueDateStr = null;
            this.InvoiceNo         = "PI-" + pqRepository.GetNewLatestInvoiceNo();
            PurchaseInvoiceEntity  = new PurchaseInvoiceEntity();
            BEDetailsEntity.Clear();
            LstSuppliers = supplierRepository.GetAllSupplier().Where(s => s.IsInActive != "Y").ToList();

            Accounts = Accounts.OrderBy(x => x.AccountName).Where(x => x.IsInactive == "N").ToObservable();
            //PQDetailsEntity = new ObservableCollection<DataGridViewModel>();
            var row = new AccountDataGridViewModel(AccountsList.Where(x => x.IsInactive == "N").ToList());

            row.TaxList = Taxes.ToList();;
            BEDetailsEntity.Add(row);
            OnPropertyChanged("BEDetailsEntity");
        }
        public List <Taxes> LoadStates()
        {
            string file = _filePath;

            List <Taxes> States = new List <Taxes>();

            using (StreamReader sr = new StreamReader(file))
            {
                sr.ReadLine();
                string line;

                while ((line = sr.ReadLine()) != null)
                {
                    Taxes newState = new Taxes();

                    string[] columns = line.Split(',');

                    newState.StateAbbreviation = columns[0];
                    newState.StateName         = columns[1];
                    newState.TaxRate           = decimal.Parse(columns[2]);

                    States.Add(newState);
                }
            }
            return(States);
        }
 public CategoryEntity(Category Category, params object[] args) : base(Category)
 {
     foreach (object arg in args)
     {
         if (arg is Category Parent)
         {
             ParentEntity = new CategoryEntity(Parent);
         }
         if (arg is ICollection <CategoryName> CategoryNames)
         {
             CategoryNameEntities = CategoryNames.Select(model => new CategoryNameEntity(model, model.Language)).ToList();
         }
         if (arg is ICollection <Category> InverseParent)
         {
             InverseParentEntities = InverseParent.Select(model => new CategoryEntity(model)).ToList();
         }
         if (arg is ICollection <ProductAttribute> ProductAttributes)
         {
             ProductAttributeEntities = ProductAttributes.Select(model => new ProductAttributeEntity(model)).ToList();
         }
         if (arg is ICollection <Product> Products)
         {
             ProductEntities = Products.Select(model => new ProductEntity(model, model.Manufacturer)).ToList();
         }
         if (arg is ICollection <Tax> Taxes)
         {
             TaxEntities = Taxes.Select(model => new TaxEntity(model, model.Country)).ToList();
         }
     }
 }
        static void Main(string[] args)
        {
            Taxes govt = new Taxes();
            // Account acc = new Account();
            Account accevent = new Account();

            //acc.Balance = 5000;
            //acc.Deposit(100);
            //Authority revenue = new Authority(govt.IncomeTax);
            //Authority commerce = new Authority(govt.ProfessionalTax);
            //Authority sales = new Authority(govt.GSTTax);
            //revenue();
            //commerce();
            //sales();

            // Console.WriteLine(acc.Balance);
            accevent.Overbalance  += govt.IncomeTax;
            accevent.Overbalance  += govt.ProfessionalTax;
            accevent.Overbalance  += govt.GSTTax;
            accevent.Underbalance += BlockAcc;

            accevent.Balance = 5051;
            accevent.WithDraw(100);

            Console.WriteLine(accevent.Balance);
            Console.Read();
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

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

            return(obj is V1PaymentItemization other &&
                   ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) &&
                   ((Quantity == null && other.Quantity == null) || (Quantity?.Equals(other.Quantity) == true)) &&
                   ((ItemizationType == null && other.ItemizationType == null) || (ItemizationType?.Equals(other.ItemizationType) == true)) &&
                   ((ItemDetail == null && other.ItemDetail == null) || (ItemDetail?.Equals(other.ItemDetail) == true)) &&
                   ((Notes == null && other.Notes == null) || (Notes?.Equals(other.Notes) == true)) &&
                   ((ItemVariationName == null && other.ItemVariationName == null) || (ItemVariationName?.Equals(other.ItemVariationName) == true)) &&
                   ((TotalMoney == null && other.TotalMoney == null) || (TotalMoney?.Equals(other.TotalMoney) == true)) &&
                   ((SingleQuantityMoney == null && other.SingleQuantityMoney == null) || (SingleQuantityMoney?.Equals(other.SingleQuantityMoney) == true)) &&
                   ((GrossSalesMoney == null && other.GrossSalesMoney == null) || (GrossSalesMoney?.Equals(other.GrossSalesMoney) == true)) &&
                   ((DiscountMoney == null && other.DiscountMoney == null) || (DiscountMoney?.Equals(other.DiscountMoney) == true)) &&
                   ((NetSalesMoney == null && other.NetSalesMoney == null) || (NetSalesMoney?.Equals(other.NetSalesMoney) == true)) &&
                   ((Taxes == null && other.Taxes == null) || (Taxes?.Equals(other.Taxes) == true)) &&
                   ((Discounts == null && other.Discounts == null) || (Discounts?.Equals(other.Discounts) == true)) &&
                   ((Modifiers == null && other.Modifiers == null) || (Modifiers?.Equals(other.Modifiers) == true)));
        }
        public List <Taxes> LoadTax()
        {
            List <Taxes> taxList = new List <Taxes>();

            if (File.Exists(_path2file))
            {
                using (StreamReader reader = new StreamReader(_path2file))
                {
                    reader.ReadLine();
                    string line;

                    while ((line = reader.ReadLine()) != null)
                    {
                        Taxes tax = new Taxes();

                        string[] columns = line.Split(',');

                        tax.StateAbbreviation = columns[0];
                        tax.StateName         = columns[1];
                        tax.TaxRate           = decimal.Parse(columns[2]);

                        taxList.Add(tax);
                    }
                }
            }
            else
            {
                throw new Exception("File does not exist");
            }

            return(taxList);
        }
        public void ShouldCalculateTaxOnPerfume2()
        {
            var perfume = new Perfume {
                Id = 6, Name = "perfume", Price = 27.99m, IsImported = true
            };

            Assert.AreEqual(4.2m, Taxes.ComputeSalesTax(perfume));
        }
        public void ShouldCalculateTaxOnPerfume()
        {
            var perfume = new Perfume {
                Id = 5, Name = "perfume", Price = 47.5m, IsImported = true
            };

            Assert.AreEqual(7.15m, Taxes.ComputeSalesTax(perfume));
        }
        public void ShouldCalculateTaxOnImportedChocolates()
        {
            var chocolates = new Food {
                Id = 4, Name = "chocolates", Price = 10.0m, IsImported = true
            };

            Assert.AreEqual(0.5m, Taxes.ComputeSalesTax(chocolates));
        }
        public void ShouldCalculateTaxOnMusic()
        {
            var musicCd = new Music {
                Id = 2, Name = "music CD", Price = 14.99m
            };

            Assert.AreEqual(1.5m, Taxes.ComputeSalesTax(musicCd));
        }
Beispiel #25
0
        public ActionResult DeleteConfirmed(int id)
        {
            Taxes taxes = db.Taxes.Find(id);

            db.Taxes.Remove(taxes);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #26
0
 public PaycheckContext(EmployeeInfo employeeInfo, Earnings earnings, Deductions deductions, Taxes taxes, Benefits benefits)
 {
     EmployeeInfo = employeeInfo;
     Earnings     = earnings;
     Deductions   = deductions;
     Taxes        = taxes;
     Benefits     = benefits;
 }
Beispiel #27
0
        public void Put(int id, [FromBody] Taxes value)
        {
            var w = tax.Taxes.FirstOrDefault(e => e.Pid == id);

            w.Pid = value.Pid;
            w.Gst = value.Gst;
            tax.SaveChanges();
        }
Beispiel #28
0
        public Taxes GetStateTax(string stateabrv)
        {
            Taxes stateTax = new Taxes();

            stateTax = taxList.SingleOrDefault(t => t.StateAbbreviation == stateabrv);

            return(stateTax);
        }
Beispiel #29
0
        public TaxesVm GetTaxaJuros()
        {
            taxes = new Taxes();

            return(new TaxesVm()
            {
                Interest = taxes.Interest
            });
        }
        public Taxes Get(Int64 ixTax)
        {
            Taxes taxes = _context.Taxes.AsNoTracking().Where(x => x.ixTax == ixTax).First();

            taxes.Countries           = _context.Countries.Find(taxes.ixCountry);
            taxes.CountrySubDivisions = _context.CountrySubDivisions.Find(taxes.ixCountrySubDivision);

            return(taxes);
        }
        public string OutputReport(List<IInvoiceEntry> invoiceEntries)
        {
            var reportLine = new StringBuilder();
            var st = 0;
            var ec = 0;
            var frt = 0;
            foreach (var invoiceEntry in invoiceEntries)
            {
                var key = invoiceEntry.InvoiceDate.ToString("mm-yyyy");
                if (!this.rolledUpInvoices.ContainsKey(key))
                    this.rolledUpInvoices.Add(key, new Taxes());
                rolledUpInvoices[key].Amount += invoiceEntry.Amount;
                if (invoiceEntry.Client.StartsWith("D"))
                {
                    rolledUpInvoices[key].ST +=
                        domesticCalculator.TaxesDue.First(x => x.Name == "Service Tax")
                                          .CalculateTaxDue(invoiceEntry.Amount);
                    rolledUpInvoices[key].EC +=
                        domesticCalculator.TaxesDue.First(x => x.Name == "Education Cess")
                                          .CalculateTaxDue(invoiceEntry.Amount);
                }
                else
                {
                    rolledUpInvoices[key].FRT +=
                        internationalTaxCalculator.TaxesDue.First(x => x.Name == "Foreign Remittance Tax")
                                                  .CalculateTaxDue(invoiceEntry.Amount);
                }

            }

            var total = new Taxes();
            foreach (var month in rolledUpInvoices)
            {
                reportLine.AppendLine(string.Format("{0} | {1} | {2} | {3} | {4}", month.Key, month.Value.Amount, month.Value.ST,
                                                    month.Value.EC, month.Value.FRT));
                total.Amount += month.Value.Amount;
                total.EC += month.Value.EC;
                total.ST += month.Value.ST;
                total.FRT += month.Value.FRT;
            }
            reportLine.AppendLine(string.Format("Total | {0} | {1} | {2} | {3}", total.Amount, total.ST, total.EC, total.FRT));

            return reportLine.ToString();
        }