Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
    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();
     }
 }
Ejemplo n.º 6
0
 public async Task <bool> Delete(TaxType TaxType)
 {
     if (await ValidateId(TaxType))
     {
     }
     return(TaxType.IsValidated);
 }
Ejemplo n.º 7
0
 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);
     }
 }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
 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;
 }
Ejemplo n.º 12
0
 /// <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;
 }
Ejemplo n.º 13
0
        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();
 }
Ejemplo n.º 15
0
 public TaxCost(decimal beforeTaxAmount, decimal taxAmount, decimal amountAfterTax, TaxType taxType)
 {
     BeforeTaxAmount = beforeTaxAmount;
     TaxAmount = taxAmount;
     AmountAfterTax = amountAfterTax;
     TaxType = taxType;
 }
Ejemplo n.º 16
0
        public CommercialData(TaxType taxType, CommercialIndicator level = CommercialIndicator.Level_II)
        {
            TaxType             = taxType;
            CommercialIndicator = level;

            LineItems = new List <CommercialLineItem>();
        }
Ejemplo n.º 17
0
        public TaxType Create(TaxType taxType)
        {
            ETaxType eTaxType = ETaxType(taxType);

            eTaxType = _iDTaxType.Create(eTaxType);
            return(TaxType(eTaxType));
        }
Ejemplo n.º 18
0
        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));
        }
Ejemplo n.º 20
0
 public CountryTax(Guid id, Country country, decimal percentage, TaxType type)
 {
     Id         = id;
     Country    = country;
     Percentage = percentage;
     Type       = type;
 }
Ejemplo n.º 21
0
        /// <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);
        }
Ejemplo n.º 22
0
        public static CountryTax Create(Guid id, TaxType type, Country country, decimal percentage)
        {
            CountryTax countryTax = Create(type, country, percentage);

            countryTax.Id = id;
            return(countryTax);
        }
Ejemplo n.º 23
0
        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;
            }
        }
Ejemplo n.º 24
0
 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;
 }
Ejemplo n.º 27
0
        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();
        }
Ejemplo n.º 28
0
 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();
 }
Ejemplo n.º 29
0
        /// <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);
        }
Ejemplo n.º 30
0
 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)));
 }
Ejemplo n.º 31
0
 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
     };
 }
Ejemplo n.º 33
0
    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);
        }
    }
Ejemplo n.º 34
0
 public TaxCost(TaxType taxType)
 {
     this.TaxType = taxType;
 }
Ejemplo n.º 35
0
 protected void LoadData(TaxType taxt)
 {
     txtTaxTypeId.Text = taxt.TaxTypeId.ToString();
     txtName.Text = taxt.Name;
     txtPercentage.Text = String.Format("{0:0.00}",taxt.Percentage);    
 }
Ejemplo n.º 36
0
 protected void UnloadData(TaxType taxt)
 {
     taxt.Name = txtName.Text;
     taxt.Percentage = Decimal.Parse(txtPercentage.Text);
 }
Ejemplo n.º 37
0
 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;
 }
Ejemplo n.º 39
0
 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 = "";
     }
 }
Ejemplo n.º 40
0
 public void GivenTaxBHasType(string key, TaxType type)
 {
     context.For<Tax>(key)
            .IsTrue(tax => tax.Type == type);
 }