public AnnualPolicy(Age age, Sex gender, Destination destination, Tax tax) { this.age = age; this.gender = gender; this.destination = destination; this.tax = tax; }
public void UpdateTaxTest() { string name = NewName(); Tax rec = new Tax { Name = name }; TaxIdentity id = Service.Create(new TaxRequest { Tax = rec }); try { rec = Service.Get(id).Tax; Assert.AreEqual(name, rec.Name); Service.Update( new TaxRequest { Tax = new Tax(rec) { Number = "6277272474", Compound = true, Rate = 5.25, } }); Tax fetched = Service.Get(id).Tax; Assert.AreEqual(name, fetched.Name); Assert.AreEqual("6277272474", fetched.Number); Assert.AreEqual(true, fetched.Compound); Assert.AreEqual(5.25, fetched.Rate); } finally { Service.Delete(id); } }
public static string GetFullTaxName(Models.FlightsDb.Country country, Tax tax) { string name = null; switch (tax.TaxID) { case 1: name = tax.Name; break; case 2: name = tax.Name; break; case 3: name = tax.Name; break; case 4: name = tax.Name; break; case 5: name = string.Format("{0} {1}", country.Name, tax.Name); break; case 6: name = string.Format("{0} {1}", country.Name, tax.Name); break; case 7: break; } return name; }
public static decimal GetPrice(Flight flight, Tax tax) { if (tax.Price != 0) return tax.Price; return flight.BasePrice*(tax.Percentage/100); }
public SingleTripPolicy(Age age, Sex gender, Destination destination, PeriodOfTravel duration, Tax tax) { this.age = age; this.gender = gender; this.destination = destination; this.duration = duration; this.tax = tax; }
public void FirstNameTest() { //arrange Person peep = PersonMaker("james", "Rick", 33); Tax tax = new Tax(); decimal amountToTax = 10.00m; //act decimal result = tax.Calculate(peep, amountToTax); //assert Assert.AreEqual(1.60m, result); }
public void TestIfThursday() { //arrange Person peep = PersonMaker("Wayne", "Bradey", 33); Tax tax = new Tax(); decimal amountToTax = 10.00m; //act decimal result = tax.Calculate(peep, amountToTax); //assert Assert.AreEqual(0.80m, result); }
public void TestIsThursday() { //Arrange Tax ErehwonTaxes = new Tax(); //Act ErehwonTaxes.IsThursday(); //Assert Assert.AreEqual(0.08m, ErehwonTaxes.TaxRate); }
public void TestIsLessThanFive() { //Arrange Citizen billy = new Citizen("Bill", "McMurray", Convert.ToDateTime("01/05/2014")); Tax ErehwonTaxes = new Tax(); //Act ErehwonTaxes.IsLessThanFive(billy.BirthDate); //Assert Assert.AreEqual(0, ErehwonTaxes.TaxRate); }
public void TestIsFirstNameJ() { //Arrange Citizen jimmy = new Citizen("James", "McMurray", Convert.ToDateTime("01/05/1990")); Tax ErehwonTaxes = new Tax(); //Act ErehwonTaxes.IsFirstNameJ(jimmy.FirstName); //Assert Assert.AreEqual(0.16m, ErehwonTaxes.TaxRate); }
public void TestIsLastNameW() { //Arrange Citizen billy = new Citizen("Bill", "Walters", Convert.ToDateTime("01/05/1990")); Tax ErehwonTaxes = new Tax(); //Act ErehwonTaxes.IsLastNameW(billy.LastName); //Assert Assert.AreEqual(1, ErehwonTaxes.TaxDiscount); }
public void AgeLessThanFive() { //arrange Person peep = PersonMaker("billy", "bob", 6); Tax tax = new Tax(); decimal amountToTax = 100.00m; //act decimal result = tax.Calculate(peep, amountToTax); //assert Assert.AreEqual(0, result); }
public void TestCalculate1() { //Arrange Citizen billy = new Citizen("Bill", "McMurray", Convert.ToDateTime("01/05/1990")); Tax ErehwonTaxes = new Tax(); decimal price = 100.00m; //Act decimal total = ErehwonTaxes.Calculate(billy, price); //Assert Assert.AreEqual(108.00m, total); }
public void TestIsTaxNonNegative() { //Arrange Citizen billy = new Citizen("Bill", "Walters", Convert.ToDateTime("01/05/1990")); Tax ErehwonTaxes = new Tax(); decimal price = 1.00m; //Act ErehwonTaxes.IsLastNameW(billy.LastName); ErehwonTaxes.IsTaxNonNegative(price); //Assert Assert.AreEqual(0, ErehwonTaxes.TaxDiscount); }
public void TestCalculateAgeLessFive() { //Arrange Tax tax = new Tax(new ErehwonCitizen { BirthDate = DateTime.Parse("2010-06-01"), FirstName = "Test", LastName = "Person" }); //Act decimal taxAmount = tax.Calculate(100); //Assert Assert.AreEqual(0, taxAmount); }
public int Add(TaxRequestTransferModel model) { var tax = new Tax { Name = model.Name, Price = model.Price, Deadline = model.Deadline, Description = model.Description, CommunityId = model.CommunityId }; taxes.Add(tax); taxes.SaveChanges(); return tax.Id; }
public int AddByCommunityId(int communityId, TaxDataTransferModel model) { var tax = new Tax { Name = model.Name, Price = model.Price, Deadline = model.Deadline, Description = model.Description, CommunityId = communityId }; taxes.Add(tax); taxes.SaveChanges(); return tax.Id; }
public void CreateTaxTest() { string name = NewName(); Tax rec = new Tax {Name = name}; TaxIdentity id = Service.Create(new TaxRequest {Tax = rec}); try { Tax fetched = Service.Get(id).Tax; Assert.AreEqual(name, fetched.Name); } finally { Service.Delete(id); } }
public void TestCalculateTodayIsThursday() { DateTime thursday = DateTime.Now; for (int i = 1; i < 8; i++) { if (thursday.DayOfWeek == DayOfWeek.Tuesday) return; thursday = thursday.AddDays(1); } Tax tax = new Tax(thursday); decimal result = tax.Calculate(100, DateTime.Parse("1998-05-18"), "John", "doe"); Assert.AreEqual(32, result); }
public void TestCalculateTodayIsThursday() { DateTime nextThursday = DateTime.Now; for (var i = 1; i < 8; i++) { if (nextThursday.DayOfWeek == DayOfWeek.Thursday) return; nextThursday = nextThursday.AddDays(i); } Tax tax = new Tax(new ErehwonCitizen { BirthDate = DateTime.Parse("1999-04-30"), FirstName = "Test", LastName = "Person" }, nextThursday); //Act decimal taxAmount = tax.Calculate(100); //Assert Assert.AreEqual(16m, taxAmount); }
private void button4_Click(object sender, EventArgs e) { Tax obj = new Tax(); obj.Show(); }
protected override List <object> SelectTaxes <Where>(PXGraph graph, object row, PXTaxCheck taxchk, params object[] parameters) { Dictionary <string, PXResult <Tax, TaxRev> > tail = new Dictionary <string, PXResult <Tax, TaxRev> >(); object[] currents = new object[] { row }; foreach (PXResult <Tax, TaxRev> record in PXSelectReadonly2 <Tax, LeftJoin <TaxRev, On <TaxRev.taxID, Equal <Tax.taxID>, And <TaxRev.outdated, Equal <boolFalse>, And2 <Where <TaxRev.taxType, Equal <TaxType.purchase>, And <Tax.reverseTax, Equal <boolFalse>, Or <TaxRev.taxType, Equal <TaxType.sales>, And <Tax.reverseTax, Equal <boolTrue>, Or <Tax.taxType, Equal <CSTaxType.use>, Or <Tax.taxType, Equal <CSTaxType.withholding> > > > > > >, And <Current <EPExpenseClaimDetails.expenseDate>, Between <TaxRev.startDate, TaxRev.endDate> > > > > >, Where> .SelectMultiBound(graph, currents, parameters)) { Tax adjdTax = AdjustTaxLevel(graph, (Tax)record); tail[((Tax)record).TaxID] = new PXResult <Tax, TaxRev>(adjdTax, (TaxRev)record); } List <object> ret = new List <object>(); switch (taxchk) { case PXTaxCheck.Line: case PXTaxCheck.RecalcLine: var cmdEPTax = new PXSelect <EPTax, Where <EPTax.claimDetailID, Equal <Current <EPExpenseClaimDetails.claimDetailID> > > >(graph); if (IsTaxTipAttribute()) { cmdEPTax.WhereAnd <Where <EPTax.isTipTax, Equal <True> > >(); } else { cmdEPTax.WhereAnd <Where <EPTax.isTipTax, Equal <False> > >(); } foreach (EPTax record in cmdEPTax.Select(currents)) { PXResult <Tax, TaxRev> line; if (tail.TryGetValue(record.TaxID, out line)) { int idx; for (idx = ret.Count; (idx > 0) && String.Compare(((Tax)(PXResult <EPTax, Tax, TaxRev>)ret[idx - 1]).TaxCalcLevel, ((Tax)line).TaxCalcLevel) > 0; idx--) { ; } ret.Insert(idx, new PXResult <EPTax, Tax, TaxRev>(record, (Tax)line, (TaxRev)line)); } } break; case PXTaxCheck.RecalcTotals: var cmdEPTaxTran = new PXSelect <EPTaxTran, Where <EPTaxTran.claimDetailID, Equal <Current <EPExpenseClaimDetails.claimDetailID> > > >(graph); if (IsTaxTipAttribute()) { cmdEPTaxTran.WhereAnd <Where <EPTaxTran.isTipTax, Equal <True> > >(); } else { cmdEPTaxTran.WhereAnd <Where <EPTaxTran.isTipTax, Equal <False> > >(); } foreach (EPTaxTran record in cmdEPTaxTran.Select(currents)) { PXResult <Tax, TaxRev> line; if (tail.TryGetValue(record.TaxID, out line)) { int idx; for (idx = ret.Count; (idx > 0) && String.Compare(((Tax)(PXResult <EPTaxTran, Tax, TaxRev>)ret[idx - 1]).TaxCalcLevel, ((Tax)line).TaxCalcLevel) > 0; idx--) { ; } ret.Insert(idx, new PXResult <EPTaxTran, Tax, TaxRev>(record, (Tax)line, (TaxRev)line)); } } break; } return(ret); }
public Tax_orderModel() { _tax = new Tax(); _order = new Order(); _tax_order = new Tax_order(); }
public virtual void UpdateTaxRecord(Tax tax) { context.Entry(tax).State = EntityState.Modified; }
/// <summary> /// Fill aggregated tax detail for per unit tax. Do nothing for retained tax. /// </summary> protected override TaxDetail FillAggregatedTaxDetailForPerUnitTax(PXCache rowCache, object row, Tax tax, TaxRev taxRevision, TaxDetail aggrTaxDetail, List <object> taxItems) { return(aggrTaxDetail); }
public async Task <ReceiptModel> Handle(ImportReceipt request, CancellationToken cancellationToken) { Store store = await dbContext.Stores .Include(x => x.Products).ThenInclude(x => x.Article) .SingleOrDefaultAsync(x => x.Uuid == request.Model.StoreId, cancellationToken) ?? throw new NotFoundException(nameof(request.Model.StoreId)); if (store.AccountId != appContext.Account !.Id) { throw new ForbiddenException(); } Dictionary <long, Article> articles = await dbContext.Articles .Where(x => x.AccountId == appContext.Account.Id && x.Gtin.HasValue) .ToDictionaryAsync(x => x.Gtin !.Value, x => x, cancellationToken); Dictionary <string, Department> departments = await dbContext.Departments .Where(x => x.StoreId == store.Id && x.Number != null) .ToDictionaryAsync(x => x.Number !, x => x, cancellationToken); Dictionary <int, Product> productsByArticle = store.Products .ToDictionary(x => x.ArticleId, x => x); Dictionary <string, Product> productsBySku = store.Products .Where(x => x.Sku != null) .ToDictionary(x => x.Sku !, x => x); DateTimeOffset now = dateTimeOffset.Now; var receipt = new Receipt { CreatedAt = now, IssuedAt = request.Model.IssuedAt ?? now, Number = request.Model.Number?.CleanTrim(), Store = store, StoreId = store.Id, UpdatedAt = now, Uuid = guid.NewGuid() }; var gst = new Tax { Code = "GST", Rate = taxOptions.Gst }; receipt.Taxes.Add(gst); var qst = new Tax { Code = "QST", Rate = taxOptions.Qst }; receipt.Taxes.Add(qst); IEnumerable <LineInfo> lines = parser.Execute(request.Model.Lines); foreach (LineInfo line in lines) { Article? article = null; Department?department = null; Product? product = null; if (line.Department != null) { if (!departments.TryGetValue(line.Department.Number, out department)) { department = new Department { CreatedAt = now, Name = line.Department.Name, Number = line.Department.Number, Store = store, StoreId = store.Id, UpdatedAt = now, Uuid = guid.NewGuid() }; departments.Add(department.Number, department); dbContext.Departments.Add(department); await dbContext.SaveChangesAsync(cancellationToken); } } string?sku = null; long? gtin = ParseGtin(line.Id); if (gtin.HasValue) { if (articles.TryGetValue(gtin.Value, out article)) { productsByArticle.TryGetValue(article.Id, out product); } } else { sku = line.Id; productsBySku.TryGetValue(sku, out product); } if (product == null) { if (article == null) { article = new Article { AccountId = appContext.Account.Id, CreatedAt = now, Gtin = gtin, Name = line.ToString(), UpdatedAt = now, Uuid = guid.NewGuid() }; dbContext.Articles.Add(article); if (gtin.HasValue) { articles.Add(gtin.Value, article); } } product = new Product { CreatedAt = now, Department = department, DepartmentId = department?.Id, Flags = line.Flags, Label = line.Label, Sku = sku, Store = store, StoreId = store.Id, UnitPrice = line.UnitPrice, UpdatedAt = now, Uuid = guid.NewGuid() }; article.Products.Add(product); if (sku != null) { productsBySku.Add(sku, product); } await dbContext.SaveChangesAsync(cancellationToken); productsByArticle.Add(article.Id, product); } receipt.Items.Add(new Item { Price = line.Price, Product = product, ProductId = product.Id, Quantity = line.Quantity ?? 1, UnitPrice = line.UnitPrice ?? line.Price, Uuid = guid.NewGuid() }); receipt.SubTotal += line.Price; if (product.Flags?.Any(x => x.Contains("F")) == true) { gst.TaxableAmount += line.Price; } if (product.Flags?.Any(x => x.Contains("P")) == true) { qst.TaxableAmount += line.Price; } } receipt.Total = receipt.SubTotal; foreach (Tax tax in receipt.Taxes) { tax.Amount = tax.TaxableAmount * (decimal)tax.Rate; receipt.Total += tax.Amount; } dbContext.Receipts.Add(receipt); await dbContext.SaveChangesAsync(cancellationToken); return(mapper.Map <ReceiptModel>(receipt)); }
protected static void ApplyAvalaraTax(OpportunityMaint rg, CROpportunity order, GetTaxResult result) { var avalaraSetup = (TXAvalaraSetup)PXSetupOptional <TXAvalaraSetup> .Select(rg); TaxZone taxZone = (TaxZone)PXSetup <TaxZone, Where <TaxZone.taxZoneID, Equal <Required <CROpportunity.taxZoneID> > > > .Select(rg, order.TaxZoneID); AP.Vendor vendor = PXSelect <AP.Vendor, Where <AP.Vendor.bAccountID, Equal <Required <AP.Vendor.bAccountID> > > > .Select(rg, taxZone.TaxVendorID); if (vendor == null) { throw new PXException("Tax Vendor is required but not found for the External TaxZone."); } Dictionary <string, CRTaxTran> existingRows = new Dictionary <string, CRTaxTran>(); foreach (PXResult <CRTaxTran, Tax> res in rg.Taxes.View.SelectMultiBound(new object[] { order })) { CRTaxTran taxTran = (CRTaxTran)res; existingRows.Add(taxTran.TaxID.Trim().ToUpperInvariant(), taxTran); } rg.Views.Caches.Add(typeof(Tax)); for (int i = 0; i < result.TaxSummary.Count; i++) { string taxID = result.TaxSummary[i].TaxName.ToUpperInvariant(); //Insert Tax if not exists - just for the selectors sake Tax tx = PXSelect <Tax, Where <Tax.taxID, Equal <Required <Tax.taxID> > > > .Select(rg, taxID); if (tx == null) { tx = new Tax(); tx.TaxID = taxID; //tx.Descr = string.Format("Avalara {0} {1}%", taxID, Convert.ToDecimal(result.TaxSummary[i].Rate)*100); tx.Descr = string.Format("Avalara {0}", taxID); tx.TaxType = CSTaxType.Sales; tx.TaxCalcType = CSTaxCalcType.Doc; tx.TaxCalcLevel = avalaraSetup.IsInclusiveTax == true ? CSTaxCalcLevel.Inclusive : CSTaxCalcLevel.CalcOnItemAmt; tx.TaxApplyTermsDisc = CSTaxTermsDiscount.ToTaxableAmount; tx.SalesTaxAcctID = vendor.SalesTaxAcctID; tx.SalesTaxSubID = vendor.SalesTaxSubID; tx.ExpenseAccountID = vendor.TaxExpenseAcctID; tx.ExpenseSubID = vendor.TaxExpenseSubID; tx.TaxVendorID = taxZone.TaxVendorID; rg.Caches[typeof(Tax)].Insert(tx); } CRTaxTran existing = null; existingRows.TryGetValue(taxID, out existing); if (existing != null) { existing.TaxAmt = Math.Abs(result.TaxSummary[i].Tax); existing.CuryTaxAmt = Math.Abs(result.TaxSummary[i].Tax); existing.TaxableAmt = Math.Abs(result.TaxSummary[i].Taxable); existing.CuryTaxableAmt = Math.Abs(result.TaxSummary[i].Taxable); existing.TaxRate = Convert.ToDecimal(result.TaxSummary[i].Rate); rg.Taxes.Update(existing); existingRows.Remove(existing.TaxID.Trim().ToUpperInvariant()); } else { CRTaxTran tax = new CRTaxTran(); tax.OpportunityID = order.OpportunityID; tax.TaxID = taxID; tax.TaxAmt = Math.Abs(result.TaxSummary[i].Tax); tax.CuryTaxAmt = Math.Abs(result.TaxSummary[i].Tax); tax.TaxableAmt = Math.Abs(result.TaxSummary[i].Taxable); tax.CuryTaxableAmt = Math.Abs(result.TaxSummary[i].Taxable); tax.TaxRate = Convert.ToDecimal(result.TaxSummary[i].Rate); rg.Taxes.Insert(tax); } } foreach (CRTaxTran taxTran in existingRows.Values) { rg.Taxes.Delete(taxTran); } rg.Opportunity.SetValueExt <CROpportunity.curyTaxTotal>(order, Math.Abs(result.TotalTax)); try { rg.SkipAvalaraTaxProcessing = true; rg.Save.Press(); } finally { rg.SkipAvalaraTaxProcessing = false; } }
public void Remove(Tax entity) { _dbContext.Tax.Remove(entity); }
public static Tax CreateTax(int code, bool enable, double value) { Tax tax = new Tax(); tax.Code = code; tax.Enable = enable; tax.Value = value; return tax; }
public static string TaxToString(Tax tax) { return($"{tax.StateAbbreviation}::{tax.StateName}::{tax.TaxRate}"); }
public void Add(Tax entity) { _dbContext.Tax.Add(entity); }
//Get list of records public static List <eAmenityDisp> getRecordForSearch(OneFineRateAppUtil.jQueryDataTableParamModel param, out int TotalCount) { using (OneFineRateEntities db = new OneFineRateEntities()) { List <eAmenityDisp> Amenitylst = new List <eAmenityDisp>(); param.sSearch = param.sSearch == null ? "" : param.sSearch; var objTblAmenity = (from s in db.tblAmenityMs join c in db.tblUserMs on s.iActionBy equals c.iUserId into Tax from T in Tax.DefaultIfEmpty() select new { s.iAmenityId, s.sAmenityName, s.dtActionDate, cStatus = s.cStatus == "A" ? "Live" : "Disable", ActionBy = T.sFirstName + " " + T.sLastName }).Where(u => u.sAmenityName.Contains(param.sSearch)).AsQueryable(); //get Total Count for show total records TotalCount = objTblAmenity.Count(); //for sorting switch (param.iSortingCols) { case 0: objTblAmenity = param.sortDirection == "asc" ? objTblAmenity.OrderBy(u => u.sAmenityName) : objTblAmenity.OrderByDescending(u => u.sAmenityName); break; case 1: objTblAmenity = param.sortDirection == "asc" ? objTblAmenity.OrderBy(u => u.cStatus) : objTblAmenity.OrderByDescending(u => u.cStatus); break; } ////implemented paging var lstUser = objTblAmenity.Skip(param.iDisplayStart).Take(param.iDisplayLength).ToList(); //convert bll entity object to db entity object foreach (var item in lstUser) { Amenitylst.Add((eAmenityDisp)OneFineRateAppUtil.clsUtils.ConvertToObject(item, new eAmenityDisp())); } return(Amenitylst); // SqlParameter[] MyParam = new SqlParameter[5]; // MyParam[0] = new SqlParameter("@Amenity", param.sSearch + "%"); // MyParam[1] = new SqlParameter("@DisplayLength", param.iDisplayLength); // MyParam[2] = new SqlParameter("@DisplayStart", param.iDisplayStart); // MyParam[3] = new SqlParameter("@SortDirection", param.sortDirection == "asc" ? "A" : "D"); // MyParam[4] = new SqlParameter("@TotalCount", 0); // MyParam[4].Direction = System.Data.ParameterDirection.Output; // //var objTblUser = db.Database.SqlQuery<eAmenityDisp>("uspGetAmenitiesByName @Amenity, @DisplayLength, @DisplayStart, @SortDirection", new SqlParameter("@Amenity", param.sSearch + "%"),new SqlParameter("@DisplayLength", param.iDisplayLength),new SqlParameter("@DisplayStart", param.iDisplayStart),new SqlParameter("@SortDirection", param.sortDirection == "asc" ? "A" : "D")); // user = db.Database.SqlQuery<eAmenityDisp>("uspGetAmenitiesByName @Amenity, @DisplayLength, @DisplayStart, @SortDirection, @TotalCount out", MyParam).ToList(); // //var objTblUser = db.tblAmenityMs.Include("tblExtranetUserM").Where(u => u.sChainName.Contains(param.sSearch)).AsQueryable(); // //for searching // //var objTblUser = db.tblAmenityMs.Where(u => u.sAmenityName.Contains(param.sSearch)).AsQueryable(); // //get Total Count for show total records // TotalCount = Convert.ToInt16(MyParam[4].Value); //user.Count(); // //for sorting // //switch (param.iSortingCols) // //{ // // case 0: // // objTblUser = param.sortDirection == "asc" ? objTblUser.OrderBy(u => u.sAmenityName) : objTblUser.OrderByDescending(u => u.sAmenityName); // // break; // //} // ////implemented paging //// List<tblAmenityM> lstUser = objTblUser.Skip(param.iDisplayStart).Take(param.iDisplayLength).ToList(); // //convert bll entity object to db entity object // //foreach (var item in objTblUser) // //{ // // user.Add((eAmenityDisp)OneFineRateAppUtil.clsUtils.ConvertToObject(item, new eAmenityDisp())); // //} // return user; } }
protected void ApplyTax(CROpportunity order, GetTaxResult result) { TaxZone taxZone = null; AP.Vendor vendor = null; if (result.TaxSummary.Length > 0) { taxZone = (TaxZone)PXSetup <TaxZone, Where <TaxZone.taxZoneID, Equal <Required <CROpportunity.taxZoneID> > > > .Select(Base, order.TaxZoneID); vendor = (AP.Vendor) PXSelect <AP.Vendor, Where <AP.Vendor.bAccountID, Equal <Required <AP.Vendor.bAccountID> > > > .Select(Base, taxZone.TaxVendorID); if (vendor == null) { throw new PXException(Messages.ExternalTaxVendorNotFound); } } //Clear all existing Tax transactions: foreach (PXResult <CRTaxTran, Tax> res in Base.Taxes.View.SelectMultiBound(new object[] { order })) { CRTaxTran taxTran = (CRTaxTran)res; Base.Taxes.Delete(taxTran); } Base.Views.Caches.Add(typeof(Tax)); for (int i = 0; i < result.TaxSummary.Length; i++) { string taxID = GetTaxID(result.TaxSummary[i]); //Insert Tax if not exists - just for the selectors sake Tax tx = PXSelect <Tax, Where <Tax.taxID, Equal <Required <Tax.taxID> > > > .Select(Base, taxID); if (tx == null) { tx = new Tax(); tx.TaxID = taxID; tx.Descr = PXMessages.LocalizeFormatNoPrefixNLA(TX.Messages.ExternalTaxProviderTaxId, taxID); tx.TaxType = CSTaxType.Sales; tx.TaxCalcType = CSTaxCalcType.Doc; tx.TaxCalcLevel = result.TaxSummary[i].TaxCalculationLevel.ToCSTaxCalcLevel(); tx.TaxApplyTermsDisc = CSTaxTermsDiscount.ToTaxableAmount; tx.SalesTaxAcctID = vendor.SalesTaxAcctID; tx.SalesTaxSubID = vendor.SalesTaxSubID; tx.ExpenseAccountID = vendor.TaxExpenseAcctID; tx.ExpenseSubID = vendor.TaxExpenseSubID; tx.TaxVendorID = taxZone.TaxVendorID; tx.IsExternal = true; Base.Caches[typeof(Tax)].Insert(tx); } CRTaxTran tax = new CRTaxTran(); tax.QuoteID = order.QuoteNoteID; tax.TaxID = taxID; tax.CuryTaxAmt = Math.Abs(result.TaxSummary[i].TaxAmount); tax.CuryTaxableAmt = Math.Abs(result.TaxSummary[i].TaxableAmount); tax.TaxRate = Convert.ToDecimal(result.TaxSummary[i].Rate) * 100; Base.Taxes.Insert(tax); } Base.Opportunity.SetValueExt <CROpportunity.curyTaxTotal>(order, Math.Abs(result.TotalTaxAmount)); decimal?СuryProductsAmount = order.ManualTotalEntry == true ? order.CuryAmount - order.CuryDiscTot : order.CuryLineTotal - order.CuryDiscTot + order.CuryTaxTotal; Base.Opportunity.SetValueExt <CROpportunity.curyProductsAmount>(order, СuryProductsAmount ?? 0m); }
public POLandedCostTax_Tax_Split(POLandedCostTax pOLandedCostTax, Tax tax, TSplit split) { POLandedCostTax = pOLandedCostTax; Tax = tax; Split = split; }
private void SubstractFromTaxTotal(Tax tax, Price price, int quantity) { sale.TransactionTaxTotal = sale.TransactionTaxTotal - ((price.SellingPrice * tax.SGST) + (price.SellingPrice * tax.CGST)) * quantity; }
public void AddNewTax(Tax tax) { _taxRepo.Insert(tax); }
//Printing internal void printEmployee() { Console.WriteLine("Name: {0} \n Alias: {1} \n Salary: {2} ", name, alias, salary); //Passing the object to the CalcTax method by using 'this'" Console.WriteLine("Taxes: {0:C} \n", Tax.CalcTax(this)); }
public void ListTaxesTest() { string name = NewName(); Tax rec = new Tax { Name = name }; TaxIdentity id = Service.Create(new TaxRequest { Tax = rec }); try { IList<Tax> items = Service.List(new TaxesRequest()).Taxes.TaxList; Assert.AreNotEqual(0, items.Count); Assert.AreEqual(1, items.Count(x => x.TaxId == id.TaxId)); } finally { Service.Delete(id); } }
public string FTP_INMarion(string address, string ownername, string parcelNumber, string searchType, string orderNumber, string directParcel) { GlobalClass.global_orderNo = orderNumber; HttpContext.Current.Session["orderNo"] = orderNumber; GlobalClass.global_parcelNo = parcelNumber; var driverService = PhantomJSDriverService.CreateDefaultService(); driverService.HideCommandPromptWindow = true; using (driver = new PhantomJSDriver()) { try { if (searchType == "titleflex") { gc.TitleFlexSearch(orderNumber, "", ownername, address, "IN", "Marion"); if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes")) { driver.Quit(); return("MultiParcel"); } else if (HttpContext.Current.Session["titleparcel"].ToString() == "") { HttpContext.Current.Session["Nodata_INMarion"] = "Yes"; driver.Quit(); return("No Data Found"); } } if (searchType == "parcel") { if (GlobalClass.titleparcel != "") { parcelNumber = GlobalClass.titleparcel; } driver.Navigate().GoToUrl("http://maps.indy.gov/AssessorPropertyCards/"); Thread.Sleep(4000); driver.FindElement(By.Id("dojox_mobile_Button_0")).Click(); Thread.Sleep(4000); driver.FindElement(By.Id("ParcelNumberListItem")).Click(); Thread.Sleep(4000); IList <IWebElement> inputParcel = driver.FindElements(By.TagName("input")); foreach (IWebElement Parcel in inputParcel) { string id = Parcel.GetAttribute("id"); if (id == "parcelNumberTextBox") { Parcel.SendKeys(parcelNumber); break; } } gc.CreatePdf(orderNumber, parcelNumber, "ParcelSearch", driver, "IN", "Marion"); Thread.Sleep(4000); driver.FindElement(By.Id("parcelNumberButton")).Click(); Thread.Sleep(4000); gc.CreatePdf(orderNumber, parcelNumber, "ParcelSearch11", driver, "IN", "Marion"); try { IWebElement INodata = driver.FindElement(By.Id("dojox_mobile_Pane_0")); if (INodata.Text.Contains("No Results")) { HttpContext.Current.Session["Nodata_INMarion"] = "Yes"; driver.Quit(); return("No Data Found"); } } catch { } //Tax Information driver.Navigate().GoToUrl("https://www.invoicecloud.com/portal/(S(gpe11qcgppiihpmzc5g2kcx5))/2/customerlocator.aspx?iti=8&bg=3a912998-0175-4640-a401-47fabc0fc06b&vsii=1"); Thread.Sleep(4000); driver.FindElement(By.Id("ctl00_ctl00_cphBody_cphBodyLeft_rptInputs_ctl01_txtValue")).SendKeys(parcelNumber); gc.CreatePdf(orderNumber, parcelNumber, "TaxInfoSearch", driver, "IN", "Marion"); driver.FindElement(By.XPath("//*[@id='ctl00_ctl00_cphBody_cphBodyLeft_btnSearch']")).Click(); Thread.Sleep(4000); try { IWebElement TaxTable = driver.FindElement(By.XPath("/html/body/div[2]/form/table/tbody/tr/td[1]/div[6]/div/div/table/tbody")); IList <IWebElement> TaxTR = TaxTable.FindElements(By.TagName("tr")); IList <IWebElement> TaxTD; foreach (IWebElement Tax in TaxTR) { TaxTD = Tax.FindElements(By.TagName("td")); if (TaxTD.Count != 0 && TaxTD.Count != 1) { Tax_Year = TaxTD[2].GetAttribute("textContent"); Account_Number = TaxTD[3].GetAttribute("textContent"); Owner_Name = TaxTD[4].GetAttribute("textContent"); Property_Address = TaxTD[5].GetAttribute("textContent"); Due_Date = TaxTD[6].GetAttribute("textContent"); Amount = TaxTD[7].GetAttribute("textContent"); Invoice_Number = TaxTD[8].GetAttribute("textContent"); Tax_Details = Tax_Year + "~" + Account_Number + "~" + Owner_Name + "~" + Property_Address + "~" + Due_Date + "~" + Amount + "~" + Invoice_Number; gc.insert_date(orderNumber, parcelNumber, 299, Tax_Details, 1, DateTime.Now); } } //View Invoice Download IWebElement ViewInvoice = driver.FindElement(By.XPath("/html/body/div[2]/form/table/tbody/tr/td[1]/div[6]/div/div/table/tbody/tr[1]/td[10]/a[1]")); string ViewTaxInvoice = ViewInvoice.GetAttribute("href"); gc.downloadfile(ViewTaxInvoice, orderNumber, parcelNumber, "View_Invoice.pdf", "IN", "Marion"); } catch { } } driver.Quit(); //megrge pdf files gc.mergpdf(orderNumber, "IN", "Marion"); return("Data Inserted Successfully"); } catch (Exception ex) { driver.Quit(); throw ex; } } }
public override string ToString() { return($"Basic payment: {BasicPayment.ToString("F2", CultureInfo.InvariantCulture)} \nTax: {Tax.ToString("F2", CultureInfo.InvariantCulture)} \nTotal payment: {TotalPayment.ToString("F2", CultureInfo.InvariantCulture)}"); }
public ValidTax(Tax tax) : base(tax.Id, tax.Account, tax.Description, tax.CurrencyCode, tax.Amount) { }
public static void InitTax() { // NOTE: each tax should have its own tax account. var salesTaxAccount = _context.Accounts.Where(a => a.AccountCode == "20300").FirstOrDefault(); var purchaseTaxAccount = _context.Accounts.Where(a => a.AccountCode == "50700").FirstOrDefault(); var vat5 = new Tax() { TaxCode = "VAT5%", TaxName = "VAT 5%", Rate = 5, IsActive = true, SalesAccountId = salesTaxAccount.Id, PurchasingAccountId = purchaseTaxAccount.Id, }; var vat10 = new Tax() { TaxCode = "VAT10%", TaxName = "VAT 10%", Rate = 10, IsActive = true, SalesAccountId = salesTaxAccount.Id, PurchasingAccountId = purchaseTaxAccount.Id, }; var evat12 = new Tax() { TaxCode = "VAT12%", TaxName = "VAT 12%", Rate = 12, IsActive = true, SalesAccountId = salesTaxAccount.Id, PurchasingAccountId = purchaseTaxAccount.Id, }; var exportTax1 = new Tax() { TaxCode = "exportTax1%", TaxName = "Export Tax 1%", Rate = 1, IsActive = true, SalesAccountId = salesTaxAccount.Id, PurchasingAccountId = purchaseTaxAccount.Id, }; _context.Taxes.Add(vat5); _context.Taxes.Add(vat10); _context.Taxes.Add(evat12); _context.Taxes.Add(exportTax1); var taxGroupVAT = new TaxGroup() { Description = "VAT", TaxAppliedToShipping = false, IsActive = true, }; var taxGroupExport = new TaxGroup() { Description = "Export", TaxAppliedToShipping = false, IsActive = true, }; _context.TaxGroups.Add(taxGroupVAT); _context.TaxGroups.Add(taxGroupExport); var itemTaxGroupRegular = new ItemTaxGroup() { Name = "Regular", IsFullyExempt = false, }; var itemTaxGroupRegularPreferenced = new ItemTaxGroup() { Name = "Preferenced", IsFullyExempt = false, }; _context.ItemTaxGroups.Add(itemTaxGroupRegular); _context.ItemTaxGroups.Add(itemTaxGroupRegularPreferenced); vat5.TaxGroupTaxes.Add(new TaxGroupTax() { TaxGroup = taxGroupVAT, }); evat12.TaxGroupTaxes.Add(new TaxGroupTax() { TaxGroup = taxGroupVAT, }); exportTax1.TaxGroupTaxes.Add(new TaxGroupTax() { TaxGroup = taxGroupExport, }); vat5.ItemTaxGroupTaxes.Add(new ItemTaxGroupTax() { ItemTaxGroup = itemTaxGroupRegular, IsExempt = false, }); evat12.ItemTaxGroupTaxes.Add(new ItemTaxGroupTax() { ItemTaxGroup = itemTaxGroupRegularPreferenced, IsExempt = false, }); _context.SaveChanges(); }
public override void FillCongressVotingArguments(CongressVoting voting) { voting.Argument1 = Tax.ToString(); }
/// <summary> /// Fill tax details for line for per unit taxes. Do nothing for retained tax. /// </summary> protected override void TaxSetLineDefaultForPerUnitTaxes(PXCache rowCache, object row, Tax tax, TaxRev taxRevision, TaxDetail taxDetail) { }
public override string ToString() { return("Basic payment: " + BasicPayment.ToString("F2", CultureInfo.InvariantCulture) + "\nTax: " + Tax.ToString("F2", CultureInfo.InvariantCulture) + "\nTotal payment: " + TotalPayment.ToString("F2", CultureInfo.InvariantCulture)); }
public void TaxCannotBeCreatedWithNullTaxType() { var tax = new Tax(null, DateTime.Today.AddDays(1), DateTime.Today.AddYears(1), JurisdictionEnum.City); }
public void TaxCannotBeCreatedWithNullStartDate() { var tax = new Tax("PST", null, DateTime.Today.AddYears(1), JurisdictionEnum.City); }
public void TaxCannotBeCreatedWithNullEndDate() { var tax = new Tax("PST", DateTime.Today.AddDays(1), null, JurisdictionEnum.City); }
public static LineItemDetail SetLevel3Data() { LineItemDetail LID = new LineItemDetail(); LID.Amount = 2.00M; //Required : Line item total cost. See DiscountInd and TaxInd to determine whether this amount is inclusive of DiscountAmt and Tax. LID.CommodityCode = "123456789012"; //Optional : Line item commodity code. LID.Description = "PartXYZ"; //Optional : Line item description. LID.DiscountAmount = 1.00M; //Optional : Discount amount for this line item. LID.DiscountIncluded = true; //Conditional : Indicates whether Amt is inclusive of discount. Conditional, required if DiscountAmt is specified. LID.ProductCode = "xyz123"; //Optional : Line item product code. LID.Quantity = 1.00M; //Required : Quantity of item. schemas.ipcommerce.com.Ipc.General.WCF.Contracts.Common.External.Txn.Tax tx = new Tax(); tx.Amount = 0.15M; //Required : Total amount of tax applied. tx.InvoiceNumber = "IONum"; //Optional : Tax invoice number. //List<ItemizedTax> ITxs = new List<ItemizedTax>(); //Optional : Collection of itemized tax information. //ItemizedTax ITX = new ItemizedTax(); //ITX.Amount = 0.05M; //Required : Amount of specified tax applied. //ITX.Rate = 0.02M; //Optional : Rate for tax specified. //ITX.Type = TypeTaxType.StateSalesTax; //Required : Type of tax specified. //ITxs.Add(ITX); LID.Tax = tx; LID.TaxIncluded = true;//Required: Specifies whether Amt is inclusive of tax. LID.UnitOfMeasure = TypeUnitOfMeasure.Ounce; //Optional : Units used to measure quantity. LID.UnitPrice = 0.80M; //Required : Price per unit of line item. LID.UPC = "UPC123"; //Optional : Line item UPC code. return LID; }
public void TaxCannotBeCreatedWithAnUnspecifiedJurisdiction() { var tax = new Tax("PST", DateTime.Today.AddDays(1), null, JurisdictionEnum.Unspecified); }
public override string ToString() { return("Basic Payment: " + BasicPayment.ToString("F2") + "\nTax: " + Tax.ToString("F2") + "\nTotalPayment: " + TotalPayment.ToString("F2")); }
public void TaxCanBeCreatedWhenAllPropertiesSupplied() { var tax = new Tax("PST", DateTime.Today.AddDays(1), DateTime.Today.AddYears(1), JurisdictionEnum.City); Assert.IsNotNull(tax); }
public static TaxCalculationResult CalculateTax(ItemSalesTaxGroup_IN itg,decimal price, decimal assessval, decimal mrp, Direction direction, Dictionary<string,decimal> misccharges,Dictionary<string,decimal> taxcoderates) { Dictionary<string, decimal> newmisccharges = new Dictionary<string, decimal>(); switch(direction) { case Direction.AP: foreach (KeyValuePair<string, decimal> charge in misccharges) { newmisccharges[ConvertToAPChargeCode(charge.Key)] = charge.Value; } break; case Direction.AR: foreach (KeyValuePair<string, decimal> charge in misccharges) { newmisccharges[ConvertToARChargeCode(charge.Key)] = charge.Value; } break; } TaxGroup tg = new TaxGroup(price, assessval, mrp, newmisccharges); foreach (ItemSalesTaxGroup_IN.FormulaDesignerIndirectTax t in itg.FormulaDesigner) { TaxBasisType basistype = TaxBasisType.Line; switch(t.TaxableBasis) { case Enums.TaxableBasis_IN.LineAmount: basistype = TaxBasisType.Line; break; case Enums.TaxableBasis_IN.Assessable: basistype = TaxBasisType.ASSESS; break; case Enums.TaxableBasis_IN.MRP: basistype = TaxBasisType.MRP; break; case Enums.TaxableBasis_IN.ExclAmount: basistype = TaxBasisType.EXLine; break; } decimal abatement = 0.0M; foreach (ItemSalesTaxGroup_IN.ItemSalesTaxGroupCode_IN tc in itg.ItemSalesTaxGroupCodes_IN) { if (t.SalesTaxCode.Equals(tc.SalesTaxCode)) { abatement = tc.AbatementPercent == null ? 0.0M : tc.AbatementPercent.Value / 100M; break; } } bool priceincl = t.PriceInclTax == null ? false : t.PriceInclTax.Value; Tax tax = new Tax(t.SalesTaxCode, taxcoderates[t.SalesTaxCode], basistype, priceincl, t.CalcExp1, abatement, tg); } return CalculateTax(tg); }
public void TaxStartDateCannotBeGreaterThanEndDate() { var tax = new Tax("PST", DateTime.Today.AddYears(1).AddDays(1), DateTime.Today.AddYears(1), JurisdictionEnum.City); Assert.IsNotNull(tax); }
public void Update(Tax entity) { var a = _dbContext.Entry(entity).State = EntityState.Modified; }
private void AddToTaxTotal(Tax tax, decimal price, decimal quantity) { sale.TransactionTaxTotal = sale.TransactionTaxTotal + ((price * tax.SGST) + (price * tax.CGST)) * quantity; }
public void AddToTaxes(Tax tax) { base.AddObject("Taxes", tax); }
private static void AddTaxesAndApplications(ARInvoiceEntry ie, PendingPPDCreditMemoApp doc, Customer customer, ARInvoice invoice) { ARTaxTran artaxMax = null; decimal? TaxTotal = 0m; decimal? InclusiveTotal = 0m; decimal? DiscountedTaxableTotal = 0m; decimal? DiscountedPriceTotal = 0m; decimal CashDiscPercent = (decimal)(doc.CuryAdjdPPDAmt / doc.InvCuryOrigDocAmt); PXResultset <ARTaxTran> taxes = PXSelectJoin <ARTaxTran, InnerJoin <Tax, On <Tax.taxID, Equal <ARTaxTran.taxID> > >, Where <ARTaxTran.module, Equal <BatchModule.moduleAR>, And <ARTaxTran.tranType, Equal <Required <ARTaxTran.tranType> >, And <ARTaxTran.refNbr, Equal <Required <ARTaxTran.refNbr> > > > > > .Select(ie, doc.AdjdDocType, doc.AdjdRefNbr); //add taxes foreach (PXResult <ARTaxTran, Tax> res in taxes) { Tax tax = res; ARTaxTran artax = PXCache <ARTaxTran> .CreateCopy(res); ARTaxTran artaxNew = ie.Taxes.Search <ARTaxTran.taxID>(artax.TaxID); if (artaxNew == null) { artax.TranType = null; artax.RefNbr = null; artax.TaxPeriodID = null; artax.Released = false; artax.Voided = false; artax.CuryInfoID = invoice.CuryInfoID; TaxBaseAttribute.SetTaxCalc <ARTran.taxCategoryID, ARTaxAttribute>(ie.Transactions.Cache, null, TaxCalc.NoCalc); artaxNew = ie.Taxes.Insert(artax); artaxNew.CuryTaxableAmt = 0m; artaxNew.CuryTaxAmt = 0m; artaxNew.TaxRate = artax.TaxRate; } bool isTaxable = CalculateDiscountedTaxes(ie.Taxes.Cache, artax, CashDiscPercent); DiscountedPriceTotal += artax.CuryDiscountedPrice; decimal?CuryTaxableAmt = artax.CuryTaxableAmt - artax.CuryDiscountedTaxableAmt; decimal?CuryTaxAmt = artax.CuryTaxAmt - artax.CuryDiscountedPrice; artaxNew.CuryTaxableAmt += CuryTaxableAmt; artaxNew.CuryTaxAmt += CuryTaxAmt; TaxBaseAttribute.SetTaxCalc <ARTran.taxCategoryID, ARTaxAttribute>(ie.Transactions.Cache, null, TaxCalc.ManualCalc); ie.Taxes.Update(artaxNew); if (isTaxable) { DiscountedTaxableTotal += artax.CuryDiscountedTaxableAmt; if (artaxMax == null || artaxNew.CuryTaxableAmt > artaxMax.CuryTaxableAmt) { artaxMax = artaxNew; } } if (tax.TaxCalcLevel == CSTaxCalcLevel.Inclusive) { InclusiveTotal += CuryTaxAmt; } else { TaxTotal += CuryTaxAmt; } } //adjust taxes according to parent ARInvoice decimal?DiscountedInvTotal = doc.InvCuryOrigDocAmt - doc.InvCuryOrigDiscAmt; decimal?DiscountedDocTotal = DiscountedTaxableTotal + DiscountedPriceTotal; if (doc.InvCuryOrigDiscAmt == doc.CuryAdjdPPDAmt && artaxMax != null && doc.InvCuryVatTaxableTotal + doc.InvCuryTaxTotal == doc.InvCuryOrigDocAmt && DiscountedDocTotal != DiscountedInvTotal) { artaxMax.CuryTaxableAmt += DiscountedDocTotal - DiscountedInvTotal; TaxBaseAttribute.SetTaxCalc <ARTran.taxCategoryID, ARTaxAttribute>(ie.Transactions.Cache, null, TaxCalc.ManualCalc); ie.Taxes.Update(artaxMax); } //add document details ARTran tranNew = ie.Transactions.Insert(); tranNew.BranchID = doc.AdjdBranchID; using (new PXLocaleScope(customer.LocaleName)) tranNew.TranDesc = string.Format("{0} {1}, {2} {3}", PXMessages.LocalizeNoPrefix(DocTypes[doc.AdjdDocType]), doc.AdjdRefNbr, PXMessages.LocalizeNoPrefix(Messages.Payment), doc.AdjgRefNbr); tranNew.CuryExtPrice = doc.CuryAdjdPPDAmt - TaxTotal; tranNew.CuryTaxableAmt = tranNew.CuryExtPrice - InclusiveTotal; tranNew.CuryTaxAmt = TaxTotal + InclusiveTotal; tranNew.AccountID = customer.DiscTakenAcctID; tranNew.SubID = customer.DiscTakenSubID; tranNew.TaxCategoryID = null; tranNew.IsFree = true; tranNew.ManualDisc = true; tranNew.CuryDiscAmt = 0m; tranNew.DiscPct = 0m; tranNew.GroupDiscountRate = 1m; tranNew.DocumentDiscountRate = 1m; if (taxes.Count == 1) { ARTaxTran artax = taxes[0]; ARTran artran = PXSelectJoin <ARTran, InnerJoin <ARTax, On <ARTax.tranType, Equal <ARTran.tranType>, And <ARTax.refNbr, Equal <ARTran.refNbr>, And <ARTax.lineNbr, Equal <ARTran.lineNbr> > > > >, Where <ARTax.tranType, Equal <Required <ARTax.tranType> >, And <ARTax.refNbr, Equal <Required <ARTax.refNbr> >, And <ARTax.taxID, Equal <Required <ARTax.taxID> > > > >, OrderBy <Asc <ARTran.lineNbr> > > .SelectSingleBound(ie, null, artax.TranType, artax.RefNbr, artax.TaxID); if (artran != null) { tranNew.TaxCategoryID = artran.TaxCategoryID; } } ie.Transactions.Update(tranNew); //add applications ARAdjust adj = new ARAdjust(); adj.AdjdDocType = doc.AdjdDocType; adj.AdjdRefNbr = doc.AdjdRefNbr; adj = ie.Adjustments_1.Insert(adj); adj.CuryAdjgAmt = doc.InvCuryDocBal; ie.Adjustments_1.Update(adj); }
public void UpdateTax(Tax tax) { _taxRepo.Update(tax); }
public void TaxCannotBeCreatedWithAllNullProperties() { var tax = new Tax(null, null, null, JurisdictionEnum.Unspecified); }