public TaxGroup Put(TaxGroup item) { try { var identity = User.Identity as ClaimsIdentity; int compid = 0, userid = 0; foreach (Claim claim in identity.Claims) { if (claim.Type == "compid") { compid = int.Parse(claim.Value); } if (claim.Type == "userid") { userid = int.Parse(claim.Value); } } logger.Info("User ID : {0} , Company Id : {1}", compid, userid); return(context.PutTaxGroup(item)); } catch { return(null); } }
public override string GetTaxGroupText(TaxGroup taxGroup) { switch (taxGroup) { case TaxGroup.TaxGroup1: return("1"); case TaxGroup.TaxGroup2: return("2"); case TaxGroup.TaxGroup3: return("3"); case TaxGroup.TaxGroup4: return("4"); case TaxGroup.TaxGroup5: return("5"); case TaxGroup.TaxGroup6: return("6"); case TaxGroup.TaxGroup7: return("7"); case TaxGroup.TaxGroup8: return("8"); default: throw new StandardizedStatusMessageException($"Tax group {taxGroup} unsupported", "E411"); } }
public override (string, DeviceStatus) AddItem( string itemText, decimal unitPrice, TaxGroup taxGroup, decimal quantity = 0, decimal priceModifierValue = 0, PriceModifierType priceModifierType = PriceModifierType.None) { var itemData = new StringBuilder() .Append(itemText.WithMaxLength(Info.ItemTextMaxLength)) .Append('\t').Append(GetTaxGroupText(taxGroup)) .Append(unitPrice.ToString("F2", CultureInfo.InvariantCulture)); if (quantity != 0) { itemData .Append('*') .Append(quantity.ToString(CultureInfo.InvariantCulture)); } if (priceModifierType != PriceModifierType.None) { itemData .Append( priceModifierType == PriceModifierType.DiscountPercent || priceModifierType == PriceModifierType.SurchargePercent ? ',' : ';') .Append(( priceModifierType == PriceModifierType.DiscountPercent || priceModifierType == PriceModifierType.DiscountAmount ? -priceModifierValue : priceModifierValue).ToString("F2", CultureInfo.InvariantCulture)); } return(Request(CommandFiscalReceiptSale, itemData.ToString())); }
public override string GetTaxGroupText(TaxGroup taxGroup) { switch (taxGroup) { case TaxGroup.TaxGroup1: return("À"); case TaxGroup.TaxGroup2: return("Á"); case TaxGroup.TaxGroup3: return("Â"); case TaxGroup.TaxGroup4: return("Ã"); case TaxGroup.TaxGroup5: return("Ä"); case TaxGroup.TaxGroup6: return("Å"); case TaxGroup.TaxGroup7: return("Æ"); case TaxGroup.TaxGroup8: return("Ç"); default: throw new ArgumentOutOfRangeException($"tax group {taxGroup} unsupported"); } }
public override string GetTaxGroupText(TaxGroup taxGroup) { switch (taxGroup) { case TaxGroup.TaxGroup1: return("1"); case TaxGroup.TaxGroup2: return("2"); case TaxGroup.TaxGroup3: return("3"); case TaxGroup.TaxGroup4: return("4"); case TaxGroup.TaxGroup5: return("5"); case TaxGroup.TaxGroup6: return("6"); case TaxGroup.TaxGroup7: return("7"); case TaxGroup.TaxGroup8: return("8"); default: throw new ArgumentOutOfRangeException($"tax group {taxGroup} unsupported"); } }
public override string GetTaxGroupText(TaxGroup taxGroup) { switch (taxGroup) { case TaxGroup.TaxGroup1: return("А"); case TaxGroup.TaxGroup2: return("Б"); case TaxGroup.TaxGroup3: return("В"); case TaxGroup.TaxGroup4: return("Г"); case TaxGroup.TaxGroup5: return("Д"); case TaxGroup.TaxGroup6: return("Е"); case TaxGroup.TaxGroup7: return("Ж"); case TaxGroup.TaxGroup8: return("З"); default: throw new StandardizedStatusMessageException($"Tax group {taxGroup} unsupported", "E411"); } }
public void Create(TaxGroup taxGroup) { using (var db = new DatabaseContext()) { _taxGroupDa.Create(db, taxGroup); } }
public async Task <HttpResponseMessage> Create() { var requestContent = await Request.Content.ReadAsStringAsync(); TaxGroup taxGroup = JsonConvert.DeserializeObject <TaxGroup>(requestContent); return(Request.CreateResponse(HttpStatusCode.OK, _taxGroupManagement.Create(taxGroup))); }
public async Task <IActionResult> Add([Bind("TaxGroupId,Name,BusinessEntityId")] TaxGroup taxGroup, bool continueAdd) { if (ModelState.IsValid) { await _taxGroupServices.AddAsync(taxGroup); return(continueAdd ? RedirectToAction(nameof(Add)) : RedirectToAction(nameof(List))); } return(View(taxGroup)); }
public async Task Create_TaxGroupObjectNull_BadRequestStatusCode() { //Setup TaxGroup taxGroup = null; //Act var response = await _internalClient.PostAsJsonAsync("TaxGroup/Create", taxGroup); //Assert Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode, "Server responded with bad request code");//check if internal server error }
public async Task Create_ExistingTaxGroupObject_BadRequestStatusCode() { //Setup TaxGroup taxGroup = InvoiceTest.GetElementSeed().Item.IncomingTaxGroup; //Act var response = await _internalClient.PostAsJsonAsync("TaxGroup/Create", taxGroup); //Assert Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode, "Server responded with bad request code");//check if internal server error }
internal static TaxGroup getTaxGroup(HttpResponseMessage response) { var taxgroup = new TaxGroup(); var jsonObj = JsonConvert.DeserializeObject <Dictionary <string, object> >(response.Content.ReadAsStringAsync().Result); if (jsonObj.ContainsKey("tax_group")) { taxgroup = JsonConvert.DeserializeObject <TaxGroup>(jsonObj["tax_group"].ToString()); } return(taxgroup); }
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 override (string, DeviceStatus) AddItem( int department, string itemText, decimal unitPrice, TaxGroup taxGroup, decimal quantity = 0, decimal priceModifierValue = 0, PriceModifierType priceModifierType = PriceModifierType.None, int ItemCode = 999) // Protocol [<L1>][<Lf><L2>]<Tab><TaxCd><[Sign]Price>[*<Qwan>][,Perc|;Abs] { var itemData = new StringBuilder(); if (department <= 0) { itemData .Append(itemText.WithMaxLength(Info.ItemTextMaxLength)) .Append('\t').Append(GetTaxGroupText(taxGroup)) .Append(unitPrice.ToString("F2", CultureInfo.InvariantCulture)); } else { itemData .Append(itemText.WithMaxLength(Info.ItemTextMaxLength)) .Append('\t').Append(department).Append('\t') .Append(unitPrice.ToString("F2", CultureInfo.InvariantCulture)); } if (quantity != 0) { itemData .Append('*') .Append(quantity.ToString(CultureInfo.InvariantCulture)); } if (priceModifierType != PriceModifierType.None) { itemData .Append( priceModifierType == PriceModifierType.DiscountPercent || priceModifierType == PriceModifierType.SurchargePercent ? ',' : ';') .Append(( priceModifierType == PriceModifierType.DiscountPercent || priceModifierType == PriceModifierType.DiscountAmount ? -priceModifierValue : priceModifierValue).ToString("F2", CultureInfo.InvariantCulture)); } return(Request(CommandFiscalReceiptSale, itemData.ToString())); }
public override string GetTaxGroupText(TaxGroup taxGroup) { return(taxGroup switch { TaxGroup.TaxGroup1 => "А", TaxGroup.TaxGroup2 => "Б", TaxGroup.TaxGroup3 => "В", TaxGroup.TaxGroup4 => "Г", TaxGroup.TaxGroup5 => "Д", TaxGroup.TaxGroup6 => "Е", TaxGroup.TaxGroup7 => "Ж", TaxGroup.TaxGroup8 => "З", _ => throw new StandardizedStatusMessageException($"Tax group {taxGroup} unsupported", "E411"), });
public override string GetTaxGroupText(TaxGroup taxGroup) { return(taxGroup switch { TaxGroup.TaxGroup1 => "1", TaxGroup.TaxGroup2 => "2", TaxGroup.TaxGroup3 => "3", TaxGroup.TaxGroup4 => "4", TaxGroup.TaxGroup5 => "5", TaxGroup.TaxGroup6 => "6", TaxGroup.TaxGroup7 => "7", TaxGroup.TaxGroup8 => "8", _ => throw new StandardizedStatusMessageException($"Tax group {taxGroup} unsupported", "E411"), });
public async Task Create_TaxGroupObjectNull_IsSuccessStatusCodeAndResponseFalse() { //Setup TaxGroup taxGroup = null; //Act var response = await _client.PostAsJsonAsync("TaxGroup/Create", taxGroup); var deserializedResponse = JsonConvert.DeserializeObject <bool>(await response.Content.ReadAsStringAsync()); //Assert Assert.IsTrue(response.IsSuccessStatusCode); Assert.IsFalse(deserializedResponse); }
public async Task Create_ExistingTaxGroupObject_IsSuccessStatusCodeAndResponseFalse() { //Setup TaxGroup taxGroup = InvoiceTest.GetElementSeed().Item.IncomingTaxGroup; //Act var response = await _client.PostAsJsonAsync("TaxGroup/Create", taxGroup); var deserializedResponse = JsonConvert.DeserializeObject <bool>(await response.Content.ReadAsStringAsync()); //Assert Assert.IsTrue(response.IsSuccessStatusCode); Assert.IsFalse(deserializedResponse); }
public bool Create(TaxGroup taxGroup) { using (var db = new DatabaseContext()) { try { _taxGroupDa.Create(db, taxGroup); return(true); } catch { return(false); } } }
private void GetTaxes(string sVendorCode, string sLocationCode) { try { string errorMessage = string.Empty; string validationMessage = string.Empty; //TaxGroup tg = TaxApplication.GetApplicableTaxes(ItemID, "", m_fromStateId, m_toStateId, // Tax.TaxType.SOTAX.ToString(), "", m_isFormCApplicable, ref errorMessage, // ref validationMessage, sVendorCode, sLocationCode); TaxGroup tg = TaxApplication.GetApplicableTaxes(ItemID, "", m_fromStateId, m_toStateId, Tax.TaxType.POTAX.ToString(), "", m_isFormCApplicable, ref errorMessage, ref validationMessage, sVendorCode, sLocationCode); if (string.IsNullOrEmpty(errorMessage)) { //If no error message then process data if (tg != null && !(string.IsNullOrEmpty(tg.TaxGroupCode) && tg.TaxCodeList != null && tg.TaxCodeList.Count > 0)) { this.TaxGroupCode = tg.TaxGroupCode; this.PurchaseOrderTaxDetail = new List <PurchaseOrderTaxDetail>(); int rowno = 1; for (int i = 0; i < tg.TaxCodeList.Count; i++) { PurchaseOrderTaxDetail potd = new PurchaseOrderTaxDetail(); potd.TaxCode = tg.TaxCodeList[i].TaxCode; potd.TaxPercentage = tg.TaxCodeList[i].TaxPercent; potd.GroupOrder = tg.TaxCodeList[i].GroupOrder; potd.ItemID = ItemID; potd.Direction = (int)Tax.TaxDirection.In; potd.TaxGroup = tg.TaxGroupCode; potd.PONumber = PONumber; potd.RowNo = rowno++; potd.IsInclusive = tg.TaxCodeList[i].IsInclusive; this.PurchaseOrderTaxDetail.Add(potd); this.IsInclusive = potd.IsInclusive; } } } else { //Log error //Show message } } catch (Exception ex) { throw ex; } }
public static TaxGroupViewModel Detach(TaxGroup taxgroup) { TaxGroupViewModel taxgroupviewmodel = new TaxGroupViewModel(); taxgroupviewmodel.GroupId = taxgroup.GroupId; taxgroupviewmodel.GroupName = taxgroup.GroupName; taxgroupviewmodel.Status = taxgroup.Status; taxgroupviewmodel.CreatedBy = taxgroup.CreatedBy; taxgroupviewmodel.CreatedOn = taxgroup.CreatedOn; taxgroupviewmodel.UpdatedBy = taxgroup.UpdatedBy; taxgroupviewmodel.UpdatedOn = taxgroup.UpdatedOn; taxgroupviewmodel.CompanyId = taxgroup.CompanyId; taxgroupviewmodel.BranchId = taxgroup.BranchId; return(taxgroupviewmodel); }
public async Task <HttpResponseMessage> Create([FromBody] TaxGroup taxGroup) { try { if (taxGroup == null) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } _taxGroupManagement.Create(taxGroup); return(Request.CreateResponse(HttpStatusCode.OK)); } catch (DbUpdateException e) { return(Request.CreateResponse(HttpStatusCode.BadRequest, e.Message)); } }
public TaxGroup CreateNew(string name) { if (name == null) { name = "New TaxGroup"; } var newTaxGroup = new TaxGroup() { Id = Guid.NewGuid(), Name = name }; erpNodeDBContext.TaxGroups.Add(newTaxGroup); organization.SaveChanges(); return(newTaxGroup); }
public override (string, DeviceStatus) AddItem( string itemText, decimal unitPrice, TaxGroup taxGroup, decimal quantity = 0m, decimal priceModifierValue = 0m, PriceModifierType priceModifierType = PriceModifierType.None) { string PriceModifierTypeToProtocolValue() { switch (priceModifierType) { case PriceModifierType.None: return("0"); case PriceModifierType.DiscountPercent: return("2"); case PriceModifierType.DiscountAmount: return("4"); case PriceModifierType.SurchargePercent: return("1"); case PriceModifierType.SurchargeAmount: return("3"); default: return(""); } } // Protocol: {PluName}<SEP>{TaxCd}<SEP>{Price}<SEP>{Quantity}<SEP>{DiscountType}<SEP>{DiscountValue}<SEP>{Department}<SEP> var itemData = string.Join("\t", itemText.WithMaxLength(Info.ItemTextMaxLength), GetTaxGroupText(taxGroup), unitPrice.ToString("F2", CultureInfo.InvariantCulture), quantity.ToString(CultureInfo.InvariantCulture), PriceModifierTypeToProtocolValue(), priceModifierValue.ToString("F2", CultureInfo.InvariantCulture), "0", ""); return(Request(CommandFiscalReceiptSale, itemData)); }
public async Task Create_NewTaxGroupObject_SuccessStatusCode() { //Setup TaxGroup taxGroup = InvoiceTest.GetElementSeed().Item.IncomingTaxGroup; using (var db = new DatabaseContext()) { db.TaxGroups.Attach(taxGroup); db.Items.RemoveRange(db.Items.Where(x => x.IncomingTaxGroup_ID == taxGroup.ID || x.OutgoingTaxGroup_ID == taxGroup.ID)); db.TaxGroups.Remove(taxGroup); db.SaveChanges(); } //Act var response = await _internalClient.PostAsJsonAsync("TaxGroup/Create", taxGroup); //Assert Assert.IsTrue(response.IsSuccessStatusCode, "Server responded with Success code"); }
public virtual (string, DeviceStatus) AddItem( string uniqueSaleNumber, string itemText, decimal unitPrice, TaxGroup taxGroup, decimal quantity = 0m, decimal priceModifierValue = 0m, PriceModifierType priceModifierType = PriceModifierType.None, bool reversalReceipt = false) { var itemData = new StringBuilder() .Append(reversalReceipt ? "24": "44") .Append(uniqueSaleNumber) .Append(IcpDecimal(quantity, 8, 3)) .Append(IcpDecimal(999, 8, 0)) .Append(IcpDecimal(unitPrice, 8, 2)) .Append("0") .Append(GetTaxGroupText(taxGroup)) .Append("00") .Append(itemText.WithMaxLength(Info.ItemTextMaxLength)); var(response, status) = Request(itemData.ToString()); if (!status.Ok || priceModifierType == PriceModifierType.None) { return(response, status); } var priceModifierIsPercent = priceModifierType == PriceModifierType.DiscountPercent || priceModifierType == PriceModifierType.SurchargePercent; var priceModifierIsDiscount = priceModifierType == PriceModifierType.DiscountPercent || priceModifierType == PriceModifierType.DiscountAmount; var priceModifierData = new StringBuilder() .Append(priceModifierIsPercent ? "47" : "46") .Append(priceModifierIsDiscount ? "0": "1") .Append(IcpDecimal(priceModifierValue, priceModifierIsPercent ? 4 : 8, 2)); return(Request(priceModifierData.ToString())); }
public override (string, DeviceStatus) AddItem( int department, string itemText, decimal unitPrice, TaxGroup taxGroup, decimal quantity = 0, decimal priceModifierValue = 0, PriceModifierType priceModifierType = PriceModifierType.None, int ItemCode = 999) { if (department <= 0) { return(base.AddItem(department, itemText, unitPrice, taxGroup, quantity, priceModifierValue, priceModifierType)); } var itemData = new StringBuilder() .Append(department).Append("@") .Append(unitPrice.ToString("F2", CultureInfo.InvariantCulture)); if (quantity != 0) { itemData .Append('*') .Append(quantity.ToString(CultureInfo.InvariantCulture)); } if (priceModifierType != PriceModifierType.None) { itemData .Append( priceModifierType == PriceModifierType.DiscountPercent || priceModifierType == PriceModifierType.SurchargePercent ? ',' : '$') .Append(( priceModifierType == PriceModifierType.DiscountPercent || priceModifierType == PriceModifierType.DiscountAmount ? -priceModifierValue : priceModifierValue).ToString("F2", CultureInfo.InvariantCulture)); } return(Request(DaisyCommandFiscalReceiptSaleDepartment, itemData.ToString())); }
public IActionResult TaxGroups() { var taxGroupsDto = new List <TaxGroup>(); var taxGroups = _taxService.GetTaxGroups(); foreach (var group in taxGroups) { var groupDto = new TaxGroup() { Id = group.Id, Description = group.Description, IsActive = group.IsActive, TaxAppliedToShipping = group.TaxAppliedToShipping }; taxGroupsDto.Add(groupDto); } return(new ObjectResult(taxGroupsDto)); }
public async Task <IActionResult> Edit(int id, [Bind("TaxGroupId,Name,BusinessEntityId")] TaxGroup taxGroup, bool continueAdd) { if (id != taxGroup.TaxGroupId) { return(NotFound()); } if (ModelState.IsValid) { try { await _taxGroupServices.UpdateAsync(taxGroup); } catch (DbUpdateConcurrencyException) { throw; } return(continueAdd ? RedirectToAction(nameof(Edit), new { id = taxGroup.TaxGroupId }) : RedirectToAction(nameof(List))); } return(View(taxGroup)); }
public async Task Create_NewTaxGroupObject_IsSuccessStatusCodeAndResponseTrue() { //Setup TaxGroup taxGroup = InvoiceTest.GetElementSeed().Item.IncomingTaxGroup; using (var db = new DatabaseContext()) { db.TaxGroups.Attach(taxGroup); db.Items.RemoveRange(db.Items.Where(x => x.IncomingTaxGroup_ID == taxGroup.ID || x.OutgoingTaxGroup_ID == taxGroup.ID)); db.TaxGroups.Remove(taxGroup); db.SaveChanges(); } //Act var response = await _client.PostAsJsonAsync("TaxGroup/Create", taxGroup); var deserializedResponse = JsonConvert.DeserializeObject <bool>(await response.Content.ReadAsStringAsync()); //Assert Assert.IsTrue(response.IsSuccessStatusCode); Assert.IsTrue(deserializedResponse); }
public TaxGroup add(TaxGroup item) { logger.Info("start add TaxGroup: "); try { var identity = User.Identity as ClaimsIdentity; int compid = 0, userid = 0; // Access claims foreach (Claim claim in identity.Claims) { if (claim.Type == "compid") { compid = int.Parse(claim.Value); } if (claim.Type == "userid") { userid = int.Parse(claim.Value); } } item.CompanyId = compid; if (item == null) { throw new ArgumentNullException("item"); } logger.Info("User ID : {0} , Company Id : {1}", compid, userid); context.AddTaxGroup(item); logger.Info("End Add TaxGroup: "); return(item); } catch (Exception ex) { logger.Error("Error in Add TaxGroup " + ex.Message); logger.Info("End Add TaxGroup: "); return(null); } }
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 Tax(string code, decimal rate, TaxBasisType basistype, bool priceincltax, string formula, decimal abatementrate, TaxGroup tg) { Tax_Code = code; Tax_Rate = rate; Tax_Basis_Type = basistype; PriceInclTax = priceincltax; taxgroup = tg; FormulaItems = new List<Tuple<CalcOperator, CalcElem, string>>(); CalcFormula = formula; CalculationStatus = Status.NotStart; Abatement_Rate = abatementrate; tg.Taxes[code] = this; if (basistype == TaxBasisType.MRP) tg.TurnOnMRP(); }
private static TaxCalculationResult CalculateTax(TaxGroup tg) { decimal totaltax = tg.CalculateTaxes(); TaxCalculationResult result = new TaxCalculationResult(); result.TotalAmount = totaltax; int n=tg.Taxes.Count; result.TaxCodes = new string[n]; result.AmountOrigin = new decimal[n]; result.Percent = new decimal[n]; result.CalcTaxAmount = new decimal[n]; int i = 0; foreach (KeyValuePair<string, Tax> t in tg.Taxes) { Tax tax = t.Value; result.TaxCodes[i] = tax.Tax_Code; result.AmountOrigin[i] = tax.TaxBasisValue; result.Percent[i] = tax.Tax_Rate; result.CalcTaxAmount[i] = tax.TaxValue; i++; } return result; }