public override PayrollResult Evaluate(PayrollPeriod period, PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
        {
            PaymentResult  advanceBaseResult      = (PaymentResult)GetResultBy(results, TAX_ADVANCE);
            TaxClaimResult reliefClaimPayerResult = (TaxClaimResult)GetResultBy(results, TAX_CLAIM_PAYER);
            TaxClaimResult reliefClaimDisabResult = (TaxClaimResult)GetResultBy(results, TAX_CLAIM_DISAB);
            TaxClaimResult reliefClaimStudyResult = (TaxClaimResult)GetResultBy(results, TAX_CLAIM_STUDY);

            decimal advanceBaseValue = advanceBaseResult.Payment();
            decimal reliefPayerValue = reliefClaimPayerResult.TaxRelief();
            decimal reliefDisabValue = reliefClaimDisabResult.TaxRelief();
            decimal reliefStudyValue = reliefClaimStudyResult.TaxRelief();

            decimal taxReliefValue = 0m;
            decimal taxClaimsValue = reliefPayerValue + reliefDisabValue + reliefStudyValue;

            decimal resultValue = ComputeResultValue(advanceBaseValue,
                                                     taxReliefValue, taxClaimsValue);

            var resultValues = new Dictionary <string, object>()
            {
                { "tax_relief", resultValue }
            };

            return(new TaxReliefResult(TagCode, Code, this, resultValues));
        }
Beispiel #2
0
        private decimal ComputeResultValue(PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
        {
            decimal resultValue = results.Aggregate(decimal.Zero,
                                                    (agr, termItem) => (decimal.Add(agr, InnerComputeResultValue(tagConfig, this.TagCode, termItem))));

            return(resultValue);
        }
Beispiel #3
0
        public override PayrollResult Evaluate(PayrollPeriod period, PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
        {
            decimal employerIncome = 0m;
            decimal employeeIncome = 0m;

            if (!Interest())
            {
                employerIncome = 0m;
                employeeIncome = 0m;
            }
            else
            {
                IncomeBaseResult resultIncome = (IncomeBaseResult)GetResultBy(results, TAG_AMOUNT_BASE);
                employerIncome = Math.Max(0m, resultIncome.EmployerBase());
                employeeIncome = Math.Max(0m, resultIncome.EmployeeBase());
            }
            decimal contPaymentValue = InsuranceContribution(period, employerIncome, employeeIncome);

            var resultValues = new Dictionary <string, object>()
            {
                { "payment", contPaymentValue }
            };

            return(new PaymentDeductionResult(TagCode, Code, this, resultValues));
        }
Beispiel #4
0
        public override PayrollResult Evaluate(PayrollPeriod period, PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
        {
            bool pensionSaving = false;

            PaymentResult resultPension = (PaymentResult)GetResultBy(results, TAG_PENSION_CONT);

            decimal paymentIncome = 0m;

            if (!Interest())
            {
                paymentIncome = 0m;
            }
            else
            {
                IncomeBaseResult resultIncome = (IncomeBaseResult)GetResultBy(results, TAG_AMOUNT_BASE);

                pensionSaving = resultPension.Interest();
                paymentIncome = Math.Max(0m, resultIncome.EmployeeBase());
            }
            decimal contPaymentValue = InsuranceContribution(period, paymentIncome, pensionSaving);

            var resultValues = new Dictionary <string, object>()
            {
                { "payment", contPaymentValue }
            };

            return(new PaymentDeductionResult(TagCode, Code, this, resultValues));
        }
        private decimal InnerComputeResultValue(PayTagGateway tagConfig, uint tagCode, KeyValuePair <TagRefer, PayrollResult> result)
        {
            TagRefer      resultKey  = result.Key;
            PayrollResult resultItem = result.Value;

            return(SumTermFor(tagConfig, tagCode, resultKey, resultItem));
        }
        public void Init()
        {
            PayTags = new PayTagGateway();

            PayConcepts = new PayConceptGateway();

            SalaryConceptTag = new SalaryBaseTag();
        }
Beispiel #7
0
        PayrollProcess init_payroll_process(PayrollPeriod period)
        {
            PayTags     = new PayTagGateway();
            PayConcepts = new PayConceptGateway();
            var payrollProcess = new PayrollProcess(PayTags, PayConcepts, period);

            return(payrollProcess);
        }
Beispiel #8
0
        public override PayrollResult Evaluate(PayrollPeriod period, PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
        {
            var resultValues = new Dictionary <string, object>()
            {
                { "hours", Hours }
            };

            return(new TermHoursResult(TagCode, Code, this, resultValues));
        }
Beispiel #9
0
        public override PayrollResult Evaluate(PayrollPeriod period, PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
        {
            int[] hoursWeek    = ComputeResultValue(period, HoursWeekly);
            var   resultValues = new Dictionary <string, object>()
            {
                { "week_schedule", hoursWeek }
            };

            return(new ScheduleResult(TagCode, Code, this, resultValues));
        }
Beispiel #10
0
        public override PayrollResult Evaluate(PayrollPeriod period, PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
        {
            var resultIncome = ComputeResultValue(tagConfig, results);
            var resultValues = new Dictionary <string, object>()
            {
                { "amount", resultIncome }
            };

            return(new AmountResult(TagCode, Code, this, resultValues));
        }
Beispiel #11
0
        public void Init()
        {
            PayPeriod = new PayrollPeriod(2013, 1);

            PayTags = new PayTagGateway();

            PayConcepts = new PayConceptGateway();

            PayProcess = new PayrollProcess(PayTags, PayConcepts, PayPeriod);
        }
        public override PayrollResult Evaluate(PayrollPeriod period, PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
        {
            decimal reliefValue = ComputeResultValue(period.Year(), ReliefCode1, ReliefCode2, ReliefCode3);

            var resultValues = new Dictionary <string, object>()
            {
                { "tax_relief", reliefValue }
            };

            return(new TaxClaimResult(TagCode, Code, this, resultValues));
        }
        public override PayrollResult Evaluate(PayrollPeriod period, PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
        {
            uint dayTermFrom = ComputeResultValueFrom(period, this.DateFrom);
            uint dayTermEnd  = ComputeResultValueEnd(period, this.DateEnd);

            var resultValues = new Dictionary <string, object>()
            {
                { "day_ord_from", dayTermFrom }, { "day_ord_end", dayTermEnd }
            };

            return(new TermEffectResult(TagCode, Code, this, resultValues));
        }
Beispiel #14
0
        public override PayrollResult Evaluate(PayrollPeriod period, PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
        {
            var resultIncome = ComputeResultValue(tagConfig, results);

            var resultValues = new Dictionary <string, object>()
            {
                { "income_base", resultIncome },
                { "interest_code", this.InterestCode },
                { "declare_code", this.DeclareCode }
            };

            return(new IncomeBaseResult(TagCode, Code, this, resultValues));
        }
        private decimal SumTermFor(PayTagGateway tagConfig, uint tagCode, TagRefer resultKey, PayrollResult resultItem)
        {
            var tagConfigItem = tagConfig.FindTag(resultKey.Code);

            if (resultItem.SummaryFor(tagCode))
            {
                if (tagConfigItem.InsuranceHealth())
                {
                    return(resultItem.Payment());
                }
            }
            return(decimal.Zero);
        }
        public override PayrollResult Evaluate(PayrollPeriod period, PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
        {
            TimesheetResult resultTimesheet = (TimesheetResult)GetResultBy(results, TAG_TIMESHEET_WORK);

            int resultHours = resultTimesheet.Hours() + Hours;

            var resultValues = new Dictionary <string, object>()
            {
                { "hours", resultHours }
            };

            return(new TermHoursResult(TagCode, Code, this, resultValues));
        }
Beispiel #17
0
        public override PayrollResult Evaluate(PayrollPeriod period, PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
        {
            ScheduleResult scheduleWorkResult = (ScheduleResult)GetResultBy(results, TAG_SCHEDULE_WORK);

            int[] weekHours = scheduleWorkResult.WeekSchedule;

            int[] hoursCalendar = ComputeResultValue(period, weekHours);

            var resultValues = new Dictionary <string, object>()
            {
                { "month_schedule", hoursCalendar }
            };

            return(new TimesheetResult(TagCode, Code, this, resultValues));
        }
Beispiel #18
0
        public override PayrollResult Evaluate(PayrollPeriod period, PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
        {
            IncomeBaseResult insIncomeResult = (IncomeBaseResult)GetResultBy(results, TAG_AMOUNT_BASE);

            decimal employerBase = insIncomeResult.EmployerBase();

            decimal paymentValue = ComputeResultValue(period, employerBase);

            var resultValues = new Dictionary <string, object>()
            {
                { "payment", paymentValue }
            };

            return(new PaymentResult(TagCode, Code, this, resultValues));
        }
        private decimal ComputeResultValue(PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
        {
            TimesheetResult resultTimesheet = (TimesheetResult)GetResultBy(results, TAG_TIMESHEET_PERIOD);
            TermHoursResult resultWorking   = (TermHoursResult)GetResultBy(results, TAG_HOURS_WORKING);
            TermHoursResult resultAbsence   = (TermHoursResult)GetResultBy(results, TAG_HOURS_ABSENCE);

            decimal scheduleFactor = 1.0m;

            int timesheetHours = resultTimesheet.Hours();
            int workingHours   = resultWorking.Hours;
            int absenceHours   = resultAbsence.Hours;

            decimal paymentValue = ComputeResultPayment(AmountMonthly, scheduleFactor, timesheetHours, workingHours, absenceHours);

            return(paymentValue);
        }
        public override PayrollResult Evaluate(PayrollPeriod period, PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
        {
            var resultIncome = ComputeResultValue(tagConfig, results);

            decimal employeeBase = MinMaxAssesmentBase(period, resultIncome);
            decimal employerBase = MaxAssesmentBase(period, resultIncome);

            var resultValues = new Dictionary <string, object>()
            {
                { "income_base", resultIncome },
                { "employee_base", employeeBase },
                { "employer_base", employerBase },
                { "interest_code", InterestCode }
            };

            return(new IncomeBaseResult(TagCode, Code, this, resultValues));
        }
        public override PayrollResult Evaluate(PayrollPeriod period, PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
        {
            IncomeBaseResult resultIncome  = (IncomeBaseResult)GetResultBy(results, TAG_INCOME_BASE);
            IncomeBaseResult resultAdvance = (IncomeBaseResult)GetResultBy(results, TAG_ADVANCE_BASE);

            decimal taxableIncome  = resultIncome.IncomeBase();
            decimal taxablePartial = resultAdvance.IncomeBase();

            decimal resultPayment = ComputeResultValue(period, taxableIncome, taxablePartial);

            var resultValues = new Dictionary <string, object>()
            {
                { "payment", resultPayment }
            };

            return(new PaymentResult(TagCode, Code, this, resultValues));
        }
Beispiel #22
0
        public override PayrollResult Evaluate(PayrollPeriod period, PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
        {
            TermEffectResult scheduleTermResult    = (TermEffectResult)GetResultBy(results, TAG_SCHEDULE_TERM);
            TimesheetResult  timesheetPeriodResult = (TimesheetResult)GetResultBy(results, TAG_TIMESHEET_PERIOD);

            uint dayOrdFrom = scheduleTermResult.DayOrdFrom;
            uint dayOrgEnd  = scheduleTermResult.DayOrdEnd;

            int[] timesheetPeriod = timesheetPeriodResult.MonthSchedule;
            int[] hoursCalendar   = ComputeResultValue(timesheetPeriod, dayOrdFrom, dayOrgEnd);

            var resultValues = new Dictionary <string, object>()
            {
                { "month_schedule", hoursCalendar }
            };

            return(new TimesheetResult(TagCode, Code, this, resultValues));
        }
Beispiel #23
0
        private decimal SumTermFor(PayTagGateway tagConfig, uint tagCode, TagRefer resultKey, PayrollResult resultItem)
        {
            var tagConfigItem = tagConfig.FindTag(resultKey.Code);

            if (resultItem.SummaryFor(tagCode))
            {
                if (tagConfigItem.IncomeNetto())
                {
                    return(resultItem.Payment());
                }
                else
                if (tagConfigItem.DeductionNetto())
                {
                    return(decimal.Negate(resultItem.Payment()));
                }
            }
            return(decimal.Zero);
        }
Beispiel #24
0
        public override PayrollResult Evaluate(PayrollPeriod period, PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
        {
            PaymentResult   advanceBaseResult = (PaymentResult)GetResultBy(results, TAX_ADVANCE);
            TaxReliefResult reliefPayerResult = (TaxReliefResult)GetResultBy(results, TAX_RELIEF_PAYER);
            decimal         reliefClaimValue  = SumReliefBy(results, TAX_CLAIM_BASE);

            decimal advanceBaseValue = advanceBaseResult.Payment();
            decimal reliefPayerValue = reliefPayerResult.TaxRelief();

            decimal taxReliefValue = ComputeResultValue(advanceBaseValue,
                                                        reliefPayerValue, reliefClaimValue);

            var resultValues = new Dictionary <string, object>()
            {
                { "tax_relief", taxReliefValue }
            };

            return(new TaxReliefResult(TagCode, Code, this, resultValues));
        }
Beispiel #25
0
        public override PayrollResult Evaluate(PayrollPeriod period, PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
        {
            PaymentResult    healthEmployer = (PaymentResult)GetResultBy(results, TAG_HEALTH_BASE);
            PaymentResult    socialEmployer = (PaymentResult)GetResultBy(results, TAG_SOCIAL_BASE);
            IncomeBaseResult resultIncome   = (IncomeBaseResult)GetResultBy(results, TAG_AMOUNT_BASE);

            decimal taxableHealth = healthEmployer.Payment();
            decimal taxableSocial = socialEmployer.Payment();
            decimal taxableBase   = resultIncome.IncomeBase();

            bool isTaxInterest = resultIncome.Interest();
            bool isTaxDeclared = resultIncome.Declared();

            decimal resultPayment = ComputeResultValue(period, isTaxInterest, isTaxDeclared, taxableHealth, taxableSocial, taxableBase);

            var resultValues = new Dictionary <string, object>()
            {
                { "income_base", resultPayment }
            };

            return(new IncomeBaseResult(TagCode, Code, this, resultValues));
        }
Beispiel #26
0
        public virtual void Init()
        {
            PayPeriod = new PayrollPeriod(2013, 1);

            PayTags = new PayTagGateway();

            PayConcepts = new PayConceptGateway();

            PayProcess = new PayrollProcess(PayTags, PayConcepts, PayPeriod);

            REF_SCHEDULE_WORK         = PayTagGateway.REF_SCHEDULE_WORK;
            REF_SCHEDULE_TERM         = PayTagGateway.REF_SCHEDULE_TERM;
            REF_HOURS_ABSENCE         = PayTagGateway.REF_HOURS_ABSENCE;
            REF_SALARY_BASE           = PayTagGateway.REF_SALARY_BASE;
            REF_TAX_INCOME_BASE       = PayTagGateway.REF_TAX_INCOME_BASE;
            REF_INSURANCE_HEALTH_BASE = PayTagGateway.REF_INSURANCE_HEALTH_BASE;
            REF_INSURANCE_HEALTH      = PayTagGateway.REF_INSURANCE_HEALTH;
            REF_INSURANCE_SOCIAL_BASE = PayTagGateway.REF_INSURANCE_SOCIAL_BASE;
            REF_INSURANCE_SOCIAL      = PayTagGateway.REF_INSURANCE_SOCIAL;
            REF_SAVINGS_PENSIONS      = PayTagGateway.REF_SAVINGS_PENSIONS;
            REF_TAX_CLAIM_PAYER       = PayTagGateway.REF_TAX_CLAIM_PAYER;
            REF_TAX_CLAIM_CHILD       = PayTagGateway.REF_TAX_CLAIM_CHILD;
            REF_TAX_CLAIM_DISABILITY  = PayTagGateway.REF_TAX_CLAIM_DISABILITY;
            REF_TAX_CLAIM_STUDYING    = PayTagGateway.REF_TAX_CLAIM_STUDYING;
            REF_TAX_EMPLOYERS_HEALTH  = PayTagGateway.REF_TAX_EMPLOYERS_HEALTH;
            REF_TAX_EMPLOYERS_SOCIAL  = PayTagGateway.REF_TAX_EMPLOYERS_SOCIAL;
            REF_TAX_ADVANCE_BASE      = PayTagGateway.REF_TAX_ADVANCE_BASE;
            REF_TAX_ADVANCE           = PayTagGateway.REF_TAX_ADVANCE;
            REF_TAX_WITHHOLD_BASE     = PayTagGateway.REF_TAX_WITHHOLD_BASE;
            REF_TAX_WITHHOLD          = PayTagGateway.REF_TAX_WITHHOLD;
            REF_TAX_RELIEF_PAYER      = PayTagGateway.REF_TAX_RELIEF_PAYER;
            REF_TAX_ADVANCE_FINAL     = PayTagGateway.REF_TAX_ADVANCE_FINAL;
            REF_TAX_RELIEF_CHILD      = PayTagGateway.REF_TAX_RELIEF_CHILD;
            REF_TAX_BONUS_CHILD       = PayTagGateway.REF_TAX_BONUS_CHILD;
            REF_INCOME_GROSS          = PayTagGateway.REF_INCOME_GROSS;
            REF_INCOME_NETTO          = PayTagGateway.REF_INCOME_NETTO;
            TAX_PAYER    = 1u;
            TAX_DECLARED = 3u;
        }
        public override PayrollResult Evaluate(PayrollPeriod period, PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
        {
            PaymentResult   advanceBaseResult = (PaymentResult)GetResultBy(results, TAX_ADVANCE);
            TaxReliefResult reliefPayerResult = (TaxReliefResult)GetResultBy(results, TAX_RELIEF_PAYER);
            TaxReliefResult reliefChildResult = (TaxReliefResult)GetResultBy(results, TAX_RELIEF_CHILD);

            decimal advanceBaseValue = advanceBaseResult.Payment();
            decimal reliefPayerValue = reliefPayerResult.TaxRelief();
            decimal reliefChildValue = reliefChildResult.TaxRelief();

            decimal taxAdvanceAfterA = ComputeResultValueA(advanceBaseValue, reliefPayerValue, reliefChildValue);
            decimal taxAdvanceAfterC = ComputeResultValueC(advanceBaseValue, reliefPayerValue, reliefChildValue);

            decimal taxAdvanceValue = taxAdvanceAfterC;

            var resultValues = new Dictionary <string, object>()
            {
                { "after_reliefA", taxAdvanceAfterA },
                { "after_reliefC", taxAdvanceAfterC },
                { "payment", taxAdvanceValue }
            };

            return(new TaxAdvanceResult(TagCode, Code, this, resultValues));
        }
Beispiel #28
0
        public override PayrollResult Evaluate(PayrollPeriod period, PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
        {
            IncomeBaseResult resultIncome = (IncomeBaseResult)GetResultBy(results, TAG_AMOUNT_BASE);

            PaymentResult   advanceBaseResult = (PaymentResult)GetResultBy(results, TAX_ADVANCE);
            TaxReliefResult reliefPayerResult = (TaxReliefResult)GetResultBy(results, TAX_RELIEF_PAYER);
            TaxReliefResult reliefChildResult = (TaxReliefResult)GetResultBy(results, TAX_RELIEF_CHILD);
            decimal         reliefClaimValue  = SumReliefBy(results, TAX_CLAIMS_CHILD);

            bool    isTaxInterest    = resultIncome.Interest();
            decimal advanceBaseValue = advanceBaseResult.Payment();
            decimal reliefPayerValue = reliefPayerResult.TaxRelief();
            decimal reliefChildValue = reliefChildResult.TaxRelief();

            decimal taxAdvanceValue = ComputeResultValue(period.Year(), isTaxInterest, advanceBaseValue,
                                                         reliefPayerValue, reliefChildValue, reliefClaimValue);

            var resultValues = new Dictionary <string, object>()
            {
                { "payment", taxAdvanceValue }
            };

            return(new PaymentResult(TagCode, Code, this, resultValues));
        }
Beispiel #29
0
 public abstract PayrollResult Evaluate(PayrollPeriod period, PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results);
 public override PayrollResult Evaluate(PayrollPeriod period, PayTagGateway tagConfig, IDictionary <TagRefer, PayrollResult> results)
 {
     return(null);
 }