public decimal TaxAssessment(TaxQuery taxQuery) { TaxAssessment taxAssessment = null; TaxType taxType = null; decimal result = 0; try { //execute the document channel event result = _taxController.ExecuteEvent(taxQuery.PostalCode, taxQuery.Amount); //get tax type id taxType = _taxDataAccess.GetTaxTypeByPostalCode(taxQuery.PostalCode); taxAssessment = new TaxAssessment { NettIncome = taxQuery.Amount, IncomeTax = result, TaxTypeId = taxType.TaxTypeId, DateCreated = DateTime.Now, UserCreated = "System" }; //save assessment calculation _taxDataAccess.AddTaxAssessment(taxAssessment); } catch (Exception) { throw; } return(result); }
public bool CheckTaxTypeNameExist(TaxType taxType) { try { using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[PSA].[CheckTaxTypeNameExist]"; cmd.Parameters.Add("@Code", SqlDbType.Int).Value = taxType.Code; cmd.Parameters.Add("@Description", SqlDbType.NVarChar, -1).Value = taxType.Description; cmd.CommandType = CommandType.StoredProcedure; Object res = cmd.ExecuteScalar(); return(res.ToString() == "Exists" ? true : false); } } } catch (Exception ex) { throw ex; } }
public static decimal Round(decimal basePrice, TaxType type) { var proRatedPrice = basePrice * 20; var taxAmount = type == TaxType.Base ? Base : Import; return(Math.Ceiling((proRatedPrice * taxAmount)) / 20); }
protected void Page_Init(object sender, EventArgs e) { ctx = new AriClinicContext("AriClinicContext"); // security control, it must be a user logged if (Session["User"] == null) { Response.Redirect("Default.aspx"); } else { user = CntAriCli.GetUser((Session["User"] as User).UserId, ctx); Process proc = (from p in ctx.Processes where p.Code == "taxt" select p).FirstOrDefault <Process>(); per = CntAriCli.GetPermission(user.UserGroup, proc, ctx); btnAccept.Visible = per.Modify; } // if (Request.QueryString["TaxTypeId"] != null) { taxTypeId = Int32.Parse(Request.QueryString["TaxTypeId"]); taxt = CntAriCli.GetTaxType(taxTypeId, ctx); LoadData(taxt); } }
private void ItemGroup_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { TaxType.Focus(); } }
public async Task <bool> Delete(TaxType TaxType) { if (await ValidateId(TaxType)) { } return(TaxType.IsValidated); }
public override Taxes TaxAmount(TaxType type, double BillAmount, double rate) { //TODO: Check and verify for GST Tax Calculation. if (type == TaxType.Gst) { CGSTRate = rate / 2; SGSTRate = rate / 2; TotalTaxAmount = BillAmount - ((BillAmount * rate) / 100); CGSTAmount = TotalTaxAmount / 2; SGSTAmount = CGSTAmount; return(this); } else if (type == TaxType.SGST || type == TaxType.CGST) { CGSTRate = rate / 2; SGSTRate = rate / 2; TotalTaxAmount = BillAmount - ((BillAmount * rate) / 100); CGSTAmount = TotalTaxAmount / 2; SGSTAmount = CGSTAmount; return(this); } else if (type == TaxType.IGST) { TotalTaxAmount = BillAmount - ((BillAmount * rate) / 100); return(this); } else { return(null); } }
public async Task <SharedLookUpResponse> AddComponentAsync(AddTaxType addComponent, int instituteId) { if (!await iMSDbContext.TaxTypes.AnyAsync(x => x.InstituteId == instituteId && x.Code.ToLowerInvariant() == addComponent.Code.ToLowerInvariant())) { var componentGroup = new TaxType() { CreatedOn = DateTime.UtcNow, InstituteId = instituteId, Name = addComponent.Name, Code = addComponent.Code, Type = addComponent.Type, Value = addComponent.Value, Status = addComponent.Status }; iMSDbContext.TaxTypes.Add(componentGroup); await iMSDbContext.SaveChangesAsync(); return(new SharedLookUpResponse() { HasError = false, Message = "Tax Type added successfully" }); } else { return(new SharedLookUpResponse() { HasError = true, ErrorType = SharedLookUpResponseType.Code, Message = "Tax Type with same code is already existed" }); } }
/// <summary> /// Creates credit items and return them /// </summary> /// <param name="grossNetType"></param> /// <param name="taxType"></param> /// <param name="amount"></param> /// <param name="costAccount"></param> /// <param name="description"></param> /// <returns></returns> public List <Credit> CreateCredits(GrossNetType grossNetType, TaxType taxType, decimal amount, CostAccount costAccount, string description = "") { if (costAccount == null) { throw new Exception("Bitte Kontenrahmen angeben."); } List <Credit> credits = new List <Credit>(); Credit credit = new Credit(amount, costAccount.CostAccountId, 0); credit.CostAccount = costAccount; CalculateTax(grossNetType, taxType, amount, out decimal tax, out decimal amountWithoutTax); credit.CreditId = tempCreditDebitId; if (tax > 0) { Credit creditTax = new Credit(tax, taxType.RefCostAccount, 0); creditTax.CostAccount = CostAccounts.GetById(taxType.RefCostAccount); creditTax.RefCreditId = tempCreditDebitId; creditTax.CreditId = ++tempCreditDebitId; creditTax.IsTax = true; credits.Add(creditTax); } credit.Amount = amountWithoutTax; credit.Description = description; credits.Add(credit); tempCreditDebitId++; return(credits); }
public static VatViewModels Load(TaxType taxType) { VatViewModels vatView = new VatViewModels(); if (!PlugInSettings.Default.VStBerechtigt) { VatViewModel vatModel = new VatViewModel(PlugInSettings.Default.IstNichtVStBerechtigtVatValue.Code, PlugInSettings.Default.IstNichtVStBerechtigtVatValue.Beschreibung, PlugInSettings.Default.IstNichtVStBerechtigtVatValue.MwStSatz, taxType.TaxItem.FirstOrDefault().TaxableAmount); vatView.VatViewList.Add(vatModel); return(vatView); } if (taxType == null) { return(vatView); } if (!taxType.TaxItem.Any()) { return(vatView); } foreach (var taxItem in taxType.TaxItem) { VatViewModel vatModel = new VatViewModel( taxItem.TaxPercent.TaxCategoryCode, taxItem.Comment, taxItem.TaxPercent.Value, taxItem.TaxableAmount); vatView.VatViewList.Add(vatModel); } return(vatView); }
public Booking( BookingId id, DateTime startDate, DateTime endDate, CustomerId customerId, CustomerName customerName, EmailAddress customerEmail, BookingType bookingType, DiscountType discountType, DiscountValue discountValue, TaxType taxType, TaxValue taxValue ) { this.id = id; this.startDate = startDate; this.endDate = endDate; this.customerId = customerId; this.customerName = customerName; this.customerEmail = customerEmail; this.bookingType = bookingType; this.discountType = discountType; this.discountValue = discountValue; this.taxType = taxType; this.taxValue = taxValue; }
/// <summary> /// Initializes a new instance of the <see cref="TaxValue"/> class. /// </summary> /// <param name="percentage">The percentage.</param> /// <param name="name">The name.</param> /// <param name="displayname">The displayname.</param> /// <param name="type">The type.</param> public TaxValue(double percentage, string name, string displayname, TaxType type) { _Percentage = percentage; _Name = name; _DisplayName = displayname; _TaxType = type; }
public TaxCalculationModel GetCalculatedTax(TaxType eTaxType, decimal Qty, decimal Price, decimal BasicAmt, decimal Taxslab, decimal totalAmount) { TaxCalculationModel objIncTax = new TaxCalculationModel(); switch (eTaxType) { case TaxType.VATExl: break; case TaxType.VATIncl: objIncTax = VATInclusive(Qty, Price, BasicAmt, Taxslab, totalAmount); break; case TaxType.CSTExl: break; case TaxType.CSTIncl: break; } return(objIncTax); }
public TaxTypeDetailUI() { InitializeComponent(); lId = ""; lOperation = GlobalVariables.Operation.Add; loTaxType = new TaxType(); }
public TaxCost(decimal beforeTaxAmount, decimal taxAmount, decimal amountAfterTax, TaxType taxType) { BeforeTaxAmount = beforeTaxAmount; TaxAmount = taxAmount; AmountAfterTax = amountAfterTax; TaxType = taxType; }
public CommercialData(TaxType taxType, CommercialIndicator level = CommercialIndicator.Level_II) { TaxType = taxType; CommercialIndicator = level; LineItems = new List <CommercialLineItem>(); }
public TaxType Create(TaxType taxType) { ETaxType eTaxType = ETaxType(taxType); eTaxType = _iDTaxType.Create(eTaxType); return(TaxType(eTaxType)); }
public async Task <ActionResult <DirectSalesOrder_DirectSalesOrderDTO> > Get([FromBody] DirectSalesOrder_DirectSalesOrderDTO DirectSalesOrder_DirectSalesOrderDTO) { if (UnAuthorization) { return(Forbid()); } if (!ModelState.IsValid) { throw new BindException(ModelState); } if (!await HasPermission(DirectSalesOrder_DirectSalesOrderDTO.Id)) { return(Forbid()); } DirectSalesOrder DirectSalesOrder = await DirectSalesOrderService.Get(DirectSalesOrder_DirectSalesOrderDTO.Id); List <TaxType> TaxTypes = await TaxTypeService.List(new TaxTypeFilter { Skip = 0, Take = int.MaxValue, Selects = TaxTypeSelect.ALL }); DirectSalesOrder_DirectSalesOrderDTO = new DirectSalesOrder_DirectSalesOrderDTO(DirectSalesOrder); foreach (var DirectSalesOrderContent in DirectSalesOrder_DirectSalesOrderDTO.DirectSalesOrderContents) { TaxType TaxType = TaxTypes.Where(x => x.Percentage == DirectSalesOrderContent.TaxPercentage).FirstOrDefault(); DirectSalesOrderContent.TaxType = new DirectSalesOrder_TaxTypeDTO(TaxType); } return(DirectSalesOrder_DirectSalesOrderDTO); }
// Chose the strategy pattern as it felt like a good fit for this problem public async Task <decimal> CalculateTaxAsync(TaxType taxType, decimal amount, string postalCode) { TaxCalculatorStrategy taxCalculatorContext = null; switch (taxType) { case TaxType.FlatRate: taxCalculatorContext = new TaxCalculatorStrategy(new FlatRateTaxCalculatorStrategry()); break; case TaxType.FlatValue: taxCalculatorContext = new TaxCalculatorStrategy(new FlatValueTaxCalculatorStrategry()); break; case TaxType.Progression: taxCalculatorContext = new TaxCalculatorStrategy(new ProgressiveTaxCalculatorStrategry()); break; default: //Throw exception invalid tax type break; } return(await taxCalculatorContext.CalculateTaxAsync(amount)); }
public CountryTax(Guid id, Country country, decimal percentage, TaxType type) { Id = id; Country = country; Percentage = percentage; Type = type; }
/// <summary> /// Maps the tax from Model to ebInterface V5p0 /// Caution: OtherTax Element not suppored. /// </summary> /// <param name="SourceTax">The source tax.</param> /// <returns></returns> private static Model.TaxType MapTax(SRC.TaxType SourceTax) { TaxType tax = new TaxType(); List <TaxItemType> taxItems = new List <TaxItemType>(); if (SourceTax.TaxItem == null) { return(null); } foreach (var taxItemModel in SourceTax.TaxItem) { TaxItemType taxItem = new TaxItemType() { TaxableAmount = taxItemModel.TaxableAmount, TaxAmount = taxItemModel.TaxAmount, //(taxItemModel.TaxableAmount * taxItemModel.TaxPercent.Value / 100).FixedFraction(2), TaxAmountSpecified = true, TaxPercent = new TaxPercentType() { TaxCategoryCode = taxItemModel.TaxPercent.TaxCategoryCode, Value = taxItemModel.TaxPercent.Value }, }; taxItems.Add(taxItem); } tax.TaxItem = taxItems; return(tax); }
public static CountryTax Create(Guid id, TaxType type, Country country, decimal percentage) { CountryTax countryTax = Create(type, country, percentage); countryTax.Id = id; return(countryTax); }
private void tsmTaxType_Click(object sender, EventArgs e) { try { foreach (TabPage _tab in this.tbcNSites_V.TabPages) { if (_tab.Text == "TaxType List") { tbcNSites_V.SelectedTab = _tab; return; } } TaxType _TaxType = new TaxType(); Type _Type = typeof(TaxType); ListFormPayrollUI _ListForm = new ListFormPayrollUI((object)_TaxType, _Type); TabPage _ListFormTab = new TabPage(); _ListFormTab.ImageIndex = 24; _ListForm.ParentList = this; displayControlOnTab(_ListForm, _ListFormTab); } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "tsmTaxType_Click"); em.ShowDialog(); return; } }
public override int GetHashCode() { return(StartDate.GetHashCode() + EndDate.GetHashCode() + TaxType.GetHashCode() + Jurisdiction.GetHashCode() + Percent.GetHashCode()); }
public ReceiptProduct(Guid receiptId, int productId, int productQuantity, double productUnitPrice, TaxType productTaxType) { ReceiptId = receiptId; ProductId = productId; ProductQuantity = productQuantity; ProductUnitPrice = productUnitPrice; ProductTaxType = productTaxType; }
public TaxTypeDetailUI(string[] pRecords) { InitializeComponent(); lId = ""; lOperation = GlobalVariables.Operation.Edit; loTaxType = new TaxType(); lRecords = pRecords; }
public void SetMovementString(MovementType movementTypeP, TaxType taxTypeP, Nullable <decimal> fixedAmountP = null, Nullable <decimal> porcentualTax = null) { string[] dicMovementTypeP = { "Inv", "Gas", "Ven", "Sal" }; string[] dicTaxTypeP = { "Fix", "Pro", "Less", "Both" }; this.MovementString = dicMovementTypeP[(int)movementTypeP] + ";" + dicTaxTypeP[(int)taxTypeP]; this.MovementString += ";Fix=" + fixedAmountP?.ToString() + ";Por=" + porcentualTax?.ToString(); }
protected void LoadTicketData(Ticket tck) { taxt = tck.InsuranceService.Service.TaxType; LoadTaxTypeCombo(taxt); txtDescription.Text = tck.Description; txtTaxPercentage.Text = taxt.Percentage.ToString(); txtAmount.Text = tck.Amount.ToString(); }
/// <summary> /// Adds the tax type that was used for the calculation to the TaxCalculationResponse object /// </summary> /// <param name="taxyType">The tax type that was used to calculate the tax amount</param> /// <returns>TaxCalculationModelBuilder</returns> internal ResultBuilder AddTaxType(TaxType taxType) { var taxTypeText = Regex.Replace(taxType.ToString(), "(\\B[A-Z])", " $1"); _response.CalculationTypeUsed = taxTypeText; return(this); }
public static ITry <RevenueInfo, Error> Create(TaxType taxType, RevenueType revenueType, VatExemptionType?vatExemptionType = null) { if (taxType == TaxType.Vat0 && !vatExemptionType.HasValue) { return(Try.Error <RevenueInfo, Error>(new Error($"{nameof(VatExemption)} must be specified when TaxType is {taxType}"))); } return(Try.Success <RevenueInfo, Error>(new RevenueInfo(taxType, revenueType, vatExemptionType))); }
public DirectSalesOrder_TaxTypeDTO(TaxType TaxType) { this.Id = TaxType.Id; this.Code = TaxType.Code; this.Name = TaxType.Name; this.Percentage = TaxType.Percentage; this.StatusId = TaxType.StatusId; this.Errors = TaxType.Errors; }
public static CountryTax Create(TaxType type, Country country, decimal percentage) { return new CountryTax() { Id = Guid.NewGuid(), Country = country, Percentage = percentage, Type = type }; }
protected void Page_Init(object sender, EventArgs e) { ctx = new AriClinicContext("AriClinicContext"); // security control, it must be a user logged if (Session["User"] == null) Response.Redirect("Default.aspx"); else { user = CntAriCli.GetUser((Session["User"] as User).UserId, ctx); Process proc = (from p in ctx.Processes where p.Code == "taxt" select p).FirstOrDefault<Process>(); per = CntAriCli.GetPermission(user.UserGroup, proc, ctx); btnAccept.Visible = per.Modify; } // if (Request.QueryString["TaxTypeId"] != null) { taxTypeId = Int32.Parse(Request.QueryString["TaxTypeId"]); taxt = CntAriCli.GetTaxType(taxTypeId, ctx); LoadData(taxt); } }
public TaxCost(TaxType taxType) { this.TaxType = taxType; }
protected void LoadData(TaxType taxt) { txtTaxTypeId.Text = taxt.TaxTypeId.ToString(); txtName.Text = taxt.Name; txtPercentage.Text = String.Format("{0:0.00}",taxt.Percentage); }
protected void UnloadData(TaxType taxt) { taxt.Name = txtName.Text; taxt.Percentage = Decimal.Parse(txtPercentage.Text); }
protected bool CreateChange() { if (!DataOk()) return false; if (taxt == null) { taxt = new TaxType(); UnloadData(taxt); ctx.Add(taxt); } else { taxt = CntAriCli.GetTaxType(taxTypeId, ctx); UnloadData(taxt); } ctx.SaveChanges(); return true; }
public static CountryTax Create(Guid id, TaxType type, Country country, decimal percentage) { CountryTax countryTax = Create(type, country, percentage); countryTax.Id = id; return countryTax; }
protected void LoadTaxType(TaxType taxt) { // clear previous items rdcbTaxType.Items.Clear(); foreach (TaxType t in ctx.TaxTypes) { rdcbTaxType.Items.Add(new RadComboBoxItem(t.Name,t.TaxTypeId.ToString())); } if (taxt != null) { rdcbTaxType.SelectedValue = taxt.TaxTypeId.ToString(); } else { rdcbTaxType.Items.Add(new RadComboBoxItem(" ","")); rdcbTaxType.SelectedValue = ""; } }
public void GivenTaxBHasType(string key, TaxType type) { context.For<Tax>(key) .IsTrue(tax => tax.Type == type); }