Esempio n. 1
0
        private Models.IRPFDiscount GetIRPFRangeValuesBySalaryRange(decimal grossSalary)
        {
            Models.IRPFDiscount[] IRPFRanges = new Models.IRPFDiscount[] {
                IRPFRangeValues1, IRPFRangeValues2, IRPFRangeValues3, IRPFRangeValues4
            };

            foreach (Models.IRPFDiscount range in IRPFRanges)
            {
                if (grossSalary >= range.StartSalaryRange && grossSalary <= range.EndSalaryRange)
                {
                    return(range);
                }
            }

            return(null);
        }
Esempio n. 2
0
        public Models.PaycheckEntry execute(decimal grossSalary)
        {
            Models.PaycheckEntry entry = new Models.PaycheckEntry();

            entry.Description = "IRPF";
            entry.Amount      = 0m;
            entry.EntryType   = Models.PaycheckEntryTypeEnum.Discount;

            Models.IRPFDiscount rangeValues = GetIRPFRangeValuesBySalaryRange(grossSalary);

            if (rangeValues != null)
            {
                decimal IRPFAmount = grossSalary * rangeValues.Aliquot / 100;
                entry.Amount = IRPFAmount <= rangeValues.LimitAmount ? Decimal.Round(IRPFAmount, 2) : rangeValues.LimitAmount;
            }

            return(entry);
        }