Beispiel #1
0
        public override bool ParticipateHealthIncome(MonthPeriod period, WorkRelationTerms workTerm, WorkHealthTerms healthTerm,
                                                     decimal contractIncome, decimal workTermIncome, decimal totalInsIncome)
        {
            bool workTermAgreementTasks = (workTerm == WorkRelationTerms.WORKTERM_CONTRACTER_T);

            if (workTermAgreementTasks)
            {
                return(ParticipateAgreementTasks(period, contractIncome, workTermIncome, totalInsIncome));
            }
            else
            {
                switch (healthTerm)
                {
                case WorkHealthTerms.HEALTH_TERM_EMPLOYMENT:
                    return(ParticipateEmployment(period, contractIncome, workTermIncome, totalInsIncome));

                case WorkHealthTerms.HEALTH_TERM_AGREE_WORK:
                case WorkHealthTerms.HEALTH_TERM_AGREE_TASK:
                case WorkHealthTerms.HEALTH_TERM_OUT_EMPLOY:
                    return(ParticipateOutOfEmployment(period, contractIncome, workTermIncome, totalInsIncome));

                default:
                    return(true);
                }
            }
        }
        public override bool ParticipateSocialIncome(MonthPeriod period, WorkRelationTerms workTerm, WorkSocialTerms socialTerm,
                                                     decimal contractIncome, decimal workTermIncome, decimal totalInsIncome)
        {
            bool workTermAgreementTasks = (workTerm == WorkRelationTerms.WORKTERM_CONTRACTER_T);

            if (workTermAgreementTasks)
            {
                return(ParticipateAgreementTasks(period, contractIncome, workTermIncome, totalInsIncome));
            }
            else
            {
                switch (socialTerm)
                {
                case WorkSocialTerms.SOCIAL_TERM_EMPLOYMENT:
                    return(ParticipateEmployment(period, contractIncome, workTermIncome, totalInsIncome));

                case WorkSocialTerms.SOCIAL_TERM_SMALL_EMPL:
                    return(ParticipateSmallRange(period, contractIncome, workTermIncome, totalInsIncome));

                case WorkSocialTerms.SOCIAL_TERM_SHORT_MEET:
                    return(ParticipateShortWorkMeet(period, contractIncome, workTermIncome, totalInsIncome));

                case WorkSocialTerms.SOCIAL_TERM_SHORT_DENY:
                    return(ParticipateShortWorkDeny(period, contractIncome, workTermIncome, totalInsIncome));

                default:
                    return(true);
                }
            }
        }
        public void Should_Return_Valid_Result_Stream()
        {
            WorkRelationTerms TEST_CONTRACT_TYPE = WorkRelationTerms.WORKTERM_EMPLOYMENT_1;

            WorkHealthTerms TEST_HEALTH_TYPE = WorkHealthTerms.HEALTH_TERM_EMPLOYMENT;

            WorkSocialTerms TEST_SOCIAL_TYPE = WorkSocialTerms.SOCIAL_TERM_EMPLOYMENT;

            ITargetValues contractValues = TargetValueBuilder.CreateContractEmplTermValues(
                TEST_CONTRACT_TYPE, TEST_HEALTH_TYPE, TEST_SOCIAL_TYPE, null, null);

            ITargetValues positionValues = TargetValueBuilder.CreatePositionEmplTermValues(null, null);

            ITargetValues positionSalary = TargetValueBuilder.CreateSalaryBaseValues(10000m);

            ITargetValues emptyValues = TargetValueBuilder.CreateEmptyValues();

            ITargetStream targets = TargetStream.CreateEmptyStream().
                                    AddNewContractsTarget(ConfigSetCzArticleName.REF_CONTRACT_EMPL_TERM, contractValues, testConfig).
                                    AddNewPositionsTarget(ConfigSetCzArticleName.REF_POSITION_EMPL_TERM, positionValues, testConfig).
                                    AddTargetIntoPosition(ConfigSetCzArticleName.REF_SALARY_BASE, positionSalary, testConfig).
                                    AddTargetIntoPosition(ConfigSetCzArticleName.REF_INCOME_GROSS, emptyValues, testConfig);

            IEngineProfile testProfile = testEngine.BuildEngineProfile(testPeriod);

            IProcessService testModule = ProcessServiceModule.CreateModule(targets, testConfig, testProfile, serviceLog);

            IResultStream results = testModule.EvaluateTargetsToResults();

            serviceLog.CloseLogStream();

            Assert.AreEqual(0, results.Results().Keys.Count);
        }
Beispiel #4
0
 public static ITargetValues CreateContractEmplTermValues(WorkRelationTerms contract,
                                                          WorkHealthTerms healthType, WorkSocialTerms socialType,
                                                          DateTime?dateFrom, DateTime?dateEnds)
 {
     return(new TargetValues(contract, healthType, socialType,
                             dateFrom, dateEnds, NULL_TIME_WEEKLY, NULL_DAYS_WEEKLY, NULL_TIME_WORKED, NULL_TIME_ABSENT,
                             NULL_AMOUNT_MONTHLY,
                             NULL_CODE_INTERESTS, NULL_CODE_RESIDENCY, NULL_CODE_MANDATORY, NULL_CODE_STATEMENT, NULL_CODE_HANDICAPS, NULL_CODE_CARDINALS));
 }
Beispiel #5
0
        public void Should_return_FALSE_for_Participation_when_WorkTerm_is_Employment_With_Small_Work_and_Income_is_2_499_CZK()
        {
            IEnginesHistory <ISocialEngine> engines = SocialEnginesHistory.CreateEngines();

            ISocialEngine engine = engines.ResolveEngine(testPeriod);

            WorkRelationTerms termOfWork = WorkRelationTerms.WORKTERM_EMPLOYMENT_1;

            WorkSocialTerms termOfSocial = WorkSocialTerms.SOCIAL_TERM_SMALL_EMPL;

            decimal testContractIncome = 0m;
            decimal testWorkTermIncome = 2499m;
            decimal testTotalTaxIncome = 2499m;

            bool resultValue = engine.ParticipateSocialIncome(testPeriod,
                                                              termOfWork, termOfSocial, testContractIncome, testWorkTermIncome, testTotalTaxIncome);

            Assert.AreEqual(false, resultValue);
        }
Beispiel #6
0
        public void Should_return_FALSE_for_Participation_when_WorkTerm_is_AgreementTasks_and_Income_is_9_999_CZK()
        {
            IEnginesHistory <ISocialEngine> engines = SocialEnginesHistory.CreateEngines();

            ISocialEngine engine = engines.ResolveEngine(testPeriod);

            WorkRelationTerms termOfWork = WorkRelationTerms.WORKTERM_CONTRACTER_T;

            WorkSocialTerms termOfSocial = WorkSocialTerms.SOCIAL_TERM_EMPLOYMENT;

            decimal testContractIncome = 0m;
            decimal testWorkTermIncome = 9999m;
            decimal testTotalTaxIncome = 9999m;

            bool resultValue = engine.ParticipateSocialIncome(testPeriod,
                                                              termOfWork, termOfSocial, testContractIncome, testWorkTermIncome, testTotalTaxIncome);

            Assert.AreEqual(false, resultValue);
        }
        public void Should_return_TRUE_for_Participation_when_WorkTerm_is_AgreementWorks_and_Income_is_2_500_CZK()
        {
            IEnginesHistory <IHealthEngine> engines = HealthEnginesHistory.CreateEngines();

            IHealthEngine engine = engines.ResolveEngine(testPeriod);

            WorkRelationTerms termOfWork = WorkRelationTerms.WORKTERM_EMPLOYMENT_1;

            WorkHealthTerms termOfHealth = WorkHealthTerms.HEALTH_TERM_AGREE_WORK;

            decimal testContractIncome = 0m;
            decimal testWorkTermIncome = 2500m;
            decimal testTotalTaxIncome = 2500m;

            bool resultValue = engine.ParticipateHealthIncome(testPeriod,
                                                              termOfWork, termOfHealth, testContractIncome, testWorkTermIncome, testTotalTaxIncome);

            Assert.AreEqual(true, resultValue);
        }
        public void Should_return_FALSE_for_Participation_when_WorkTerm_is_AgreementTasks_and_Income_is_9_999_CZK()
        {
            IEnginesHistory <IHealthEngine> engines = HealthEnginesHistory.CreateEngines();

            IHealthEngine engine = engines.ResolveEngine(testPeriod);

            WorkRelationTerms termOfWork = WorkRelationTerms.WORKTERM_CONTRACTER_T;

            WorkHealthTerms termOfHealth = WorkHealthTerms.HEALTH_TERM_AGREE_TASK;

            decimal testContractIncome = 0m;
            decimal testWorkTermIncome = 9999m;
            decimal testTotalTaxIncome = 9999m;

            bool resultValue = engine.ParticipateHealthIncome(testPeriod,
                                                              termOfWork, termOfHealth, testContractIncome, testWorkTermIncome, testTotalTaxIncome);

            Assert.AreEqual(false, resultValue);
        }
Beispiel #9
0
        public void Should_return_TRUE_for_Taxing_Withhold_when_Non_Signed_Declaration_and_WorkTerm_is_StatutoryTerm_and_Resident_Foreign()
        {
            IEnginesHistory <ITaxingEngine> engines = TaxingEnginesHistory.CreateEngines();

            ITaxingEngine engine = engines.ResolveEngine(testPeriod);

            WorkRelationTerms termOfIncome = WorkRelationTerms.WORKTERM_STATUTORY__Q;

            bool testStatementSigned = false;

            decimal testContractIncome = 0m;
            decimal testWorkTermIncome = 0m;
            decimal testTotalTaxIncome = 0m;

            bool resultValue = engine.WithholdTaxableIncome(testPeriod,
                                                            testStatementSigned, TAX_RESIDENT_NO_CZ, termOfIncome,
                                                            testContractIncome, testWorkTermIncome, testTotalTaxIncome);

            Assert.AreEqual(true, resultValue);
        }
Beispiel #10
0
        public void Should_return_TRUE_for_Taxing_Advances_when_Non_Signed_Declaration_and_WorkTerm_is_AgreementTasks_and_Income_is_10_000_CZK()
        {
            IEnginesHistory <ITaxingEngine> engines = TaxingEnginesHistory.CreateEngines();

            ITaxingEngine engine = engines.ResolveEngine(testPeriod);

            WorkRelationTerms termOfIncome = WorkRelationTerms.WORKTERM_CONTRACTER_T;

            bool testStatementSigned = false;

            decimal testContractIncome = 0m;
            decimal testWorkTermIncome = 10000m;
            decimal testTotalTaxIncome = 10000m;

            bool resultValue = engine.AdvancesTaxableIncome(testPeriod,
                                                            testStatementSigned, TAX_RESIDENT_CZECH, termOfIncome,
                                                            testContractIncome, testWorkTermIncome, testTotalTaxIncome);

            Assert.AreEqual(true, resultValue);
        }
Beispiel #11
0
        public void Should_Throw_EngineException_when_WorkTerm_is_Employment_With_Short_Work_Deny_and_Income_is_2_499_CZK()
        {
            IEnginesHistory <ISocialEngine> engines = SocialEnginesHistory.CreateEngines();

            ISocialEngine engine = engines.ResolveEngine(testPeriod);

            WorkRelationTerms termOfWork = WorkRelationTerms.WORKTERM_EMPLOYMENT_1;

            WorkSocialTerms termOfSocial = WorkSocialTerms.SOCIAL_TERM_SHORT_DENY;

            decimal testContractIncome = 0m;
            decimal testWorkTermIncome = 2499m;
            decimal testTotalTaxIncome = 2499m;

            TestDelegate testDelegateCode = () => {
                engine.ParticipateSocialIncome(testPeriod,
                                               termOfWork, termOfSocial, testContractIncome, testWorkTermIncome, testTotalTaxIncome);
            };

            Assert.Throws <EngineServicePeriodException> (testDelegateCode);
        }
        private void CopyTargetsToResults(ITargetValues targetValues)
        {
            if (targetValues == null)
            {
                return;
            }

            __contractType = targetValues.ContractType();

            __healthWorkType = targetValues.HealthWorkType();

            __socialWorkType = targetValues.SocialWorkType();

            __dateFrom = targetValues.DateFrom();

            __dateEnds = targetValues.DateEnds();

            __timesheetWeekly = targetValues.TimesheetWeekly();

            __workdaysWeekly = targetValues.WorkdaysWeekly();

            __timesheetWorked = targetValues.TimesheetWorked();

            __timesheetAbsent = targetValues.TimesheetAbsent();

            __amountMonthly = targetValues.AmountMonthly();

            __codeInterests = targetValues.CodeInterests();

            __codeResidency = targetValues.CodeResidency();

            __codeMandatory = targetValues.CodeMandatory();

            __codeStatement = targetValues.CodeStatement();

            __codeHandicaps = targetValues.CodeHandicaps();

            __codeCardinals = targetValues.CodeCardinals();
        }
        public TargetValues(WorkRelationTerms contract, WorkHealthTerms healthType, WorkSocialTerms socialType,
                            DateTime?dateFrom, DateTime?dateEnds, Int32 timeWeekly, Int32 daysWeekly, Int32 timeWorked, Int32 timeAbsent,
                            decimal amountMonthly, uint interests, uint residency, uint mandatory, uint statement, uint handicaps, uint cardinals)
        {
            __contractType = contract;

            __healthWorkType = healthType;

            __socialWorkType = socialType;

            __dateFrom = dateFrom;

            __dateEnds = dateEnds;

            __timesheetWeekly = timeWeekly;

            __workdaysWeekly = daysWeekly;

            __timesheetWorked = timeWorked;

            __timesheetAbsent = timeAbsent;

            __amountMonthly = amountMonthly;

            __codeInterests = interests;

            __codeResidency = residency;

            __codeMandatory = mandatory;

            __codeStatement = statement;

            __codeHandicaps = handicaps;

            __codeCardinals = cardinals;
        }
 public override bool ParticipateSocialIncome(MonthPeriod period, WorkRelationTerms workTerm, WorkSocialTerms socialTerm,
                                              decimal contractIncome, decimal workTermIncome, decimal totalInsIncome)
 {
     return(false);
 }
Beispiel #15
0
 public abstract bool ParticipateSocialIncome(MonthPeriod period, WorkRelationTerms workTerm, WorkSocialTerms socialTerm,
                                              decimal contractIncome, decimal workTermIncome, decimal totalInsIncome);
Beispiel #16
0
        public override bool WithholdTaxableIncome(MonthPeriod period, bool isStatementSign, bool isResidentCzech, WorkRelationTerms workTerm,
                                                   decimal contractIncome, decimal workTermIncome, decimal totalTaxIncome)
        {
            bool notSignedStatement = (!isStatementSign);

            if (notSignedStatement)
            {
                bool agreementTasksTerm = (workTerm == WorkRelationTerms.WORKTERM_CONTRACTER_T);

                bool agreementIncomeMax = (workTermIncome < PeriodMaximumIncomeToApplyWithholdTax(period));

                if (agreementTasksTerm && agreementIncomeMax)
                {
                    return(true);
                }

                bool statutoryTasksTerm = (workTerm == WorkRelationTerms.WORKTERM_STATUTORY__Q);

                bool foreignTaxResident = (!isResidentCzech);

                if (statutoryTasksTerm && foreignTaxResident)
                {
                    return(true);
                }
            }
            return(false);
        }
 public abstract bool ParticipateHealthIncome(MonthPeriod period, WorkRelationTerms workTerm, WorkHealthTerms healthTerm,
                                              decimal contractIncome, decimal workTermIncome, decimal totalInsIncome);
 public bool AdvancesTaxableIncome(MonthPeriod period, bool isStatementSign, bool isResidentCzech, WorkRelationTerms workTerm,
                                   decimal contractIncome, decimal workTermIncome, decimal totalTaxIncome)
 {
     return(!WithholdTaxableIncome(period, isStatementSign, isResidentCzech, workTerm, contractIncome, workTermIncome, totalTaxIncome));
 }
 public abstract bool WithholdTaxableIncome(MonthPeriod period, bool isStatementSign, bool isResidentCzech, WorkRelationTerms workTerm,
                                            decimal contractIncome, decimal workTermIncome, decimal totalTaxIncome);
 public override bool ParticipateHealthIncome(MonthPeriod period, WorkRelationTerms workTerm, WorkHealthTerms healthTerm,
                                              decimal contractIncome, decimal workTermIncome, decimal totalInsIncome)
 {
     return(true);
 }