Пример #1
0
        public void GivenYESEmployeeIsEmployerContributionForSocialInsurancePayer(string flag)
        {
            var interest_value = new Dictionary <string, object>()
            {
                { "interest_code", CaptureBool(flag) }
            };

            PayProcess.AddTerm(PayTagGateway.REF_TAX_EMPLOYERS_SOCIAL, interest_value);
        }
Пример #2
0
        public void GivenYESEmployeeClaimsTaxBenefitOnTaxPayer(string flag)
        {
            var relief_payers_value = new Dictionary <string, object>()
            {
                { "relief_code", CaptureBool(flag) }
            };

            PayProcess.AddTerm(PayTagGateway.REF_TAX_CLAIM_PAYER, relief_payers_value);
        }
Пример #3
0
        public void GivenNOEmployeeClaimsTaxBenefitOnPreparingByStudying(string flag)
        {
            var relief_payers_value = new Dictionary <string, object>()
            {
                { "relief_code", CaptureBool(flag) }
            };

            PayProcess.AddTerm(PayTagGateway.REF_TAX_CLAIM_STUDYING, relief_payers_value);
        }
Пример #4
0
        public void GivenEmployeeHasHoursOfAbsence(int hoursAbsence)
        {
            var absence_hours_value = new Dictionary <string, object>()
            {
                { "hours", hoursAbsence }
            };

            PayProcess.AddTerm(PayTagGateway.REF_HOURS_ABSENCE, absence_hours_value);
        }
Пример #5
0
        public void GivenNOEmployeeIsRegularPensionSavingsPayer(string flag)
        {
            var interest_value = new Dictionary <string, object>()
            {
                { "interest_code", CaptureBool(flag) }
            };

            PayProcess.AddTerm(PayTagGateway.REF_SAVINGS_PENSIONS, interest_value);
        }
Пример #6
0
        public void GivenEmployeeContractIsCZKMonthly(int contract)
        {
            var salary_amount_value = new Dictionary <string, object>()
            {
                { "amount_monthly", new decimal(contract) }
            };

            PayProcess.AddTerm(PayTagGateway.REF_SALARY_BASE, salary_amount_value);
        }
Пример #7
0
        public decimal GetResultAfterReliefA(CodeNameRefer result_ref)
        {
            IDictionary <TagRefer, PayrollResult> results = PayProcess.GetResults();

            var result_select = results.Where((x) => (x.Key.Code == result_ref.Code)).ToDictionary(key => key.Key, value => value.Value);
            var result_value  = result_select.Aggregate(0m, (agr, item) => (agr + item.Value.AfterReliefA()));

            return((decimal)result_value);
        }
Пример #8
0
        void calculate_payroll_process()
        {
            var empty_value = new Dictionary <string, object>()
            {
            };
            var gross_tag = PayProcess.AddTerm(PayTagGateway.REF_INCOME_GROSS, empty_value);
            var netto_tag = PayProcess.AddTerm(PayTagGateway.REF_INCOME_NETTO, empty_value);

            PayProcess.Evaluate(netto_tag);
        }
Пример #9
0
        public void GivenYESEmployeeIsRegularSocialInsurancePayer(string flag)
        {
            var interest_value = new Dictionary <string, object>()
            {
                { "interest_code", CaptureBool(flag) }
            };

            PayProcess.AddTerm(PayTagGateway.REF_INSURANCE_SOCIAL_BASE, interest_value);
            PayProcess.AddTerm(PayTagGateway.REF_INSURANCE_SOCIAL, interest_value);
        }
Пример #10
0
        public void GivenYESEmployeeIsRegularHealthInsurancePayer(string flag, string fmin)
        {
            var interest_value = new Dictionary <string, object>()
            {
                { "interest_code", CaptureBool(flag) },
                { "minimum_asses", CaptureBool(fmin) }
            };

            PayProcess.AddTerm(PayTagGateway.REF_INSURANCE_HEALTH_BASE, interest_value);
            PayProcess.AddTerm(PayTagGateway.REF_INSURANCE_HEALTH, interest_value);
        }
Пример #11
0
        public void GivenEmployeeClaimsTaxBenefitOnChild(int childCount)
        {
            var relief_payers_value = new Dictionary <string, object>()
            {
                { "relief_code", (uint)1 }
            };

            for (uint count = 0; count < childCount; count++)
            {
                PayProcess.AddTerm(PayTagGateway.REF_TAX_CLAIM_CHILD, relief_payers_value);
            }
        }
Пример #12
0
        public void test_working_schedule()
        {
            CodeNameRefer tagCodeName = PayTagGateway.REF_SCHEDULE_WORK;
            var           values      = new Dictionary <string, object>()
            {
                { "hours_weekly", 40 }
            };
            TagRefer payTag = PayProcess.AddTerm(tagCodeName, values);
            var      payTer = PayProcess.GetTerm(payTag);

            Assert.AreEqual(40, ((ScheduleWeeklyConcept)payTer[payTag]).HoursWeekly);
        }
Пример #13
0
        public void GivenYESEmployeeIsRegularTaxPayer(string flag)
        {
            uint taxes          = CaptureTaxes(flag);
            uint interest       = (uint)((taxes > 0) ? 1 : 0);
            uint declare        = (uint)((taxes == 3) ? 1 : 0);
            var  interest_value = new Dictionary <string, object>()
            {
                { "interest_code", interest }, { "declare_code", declare }
            };

            PayProcess.AddTerm(PayTagGateway.REF_TAX_INCOME_BASE, interest_value);
        }
Пример #14
0
        public void test_base_salary()
        {
            CodeNameRefer tagCodeName = PayTagGateway.REF_SALARY_BASE;
            var           values      = new Dictionary <string, object>()
            {
                { "amount_monthly", 15000m }
            };
            TagRefer payTag = PayProcess.AddTerm(tagCodeName, values);
            var      payTer = PayProcess.GetTerm(payTag);

            Assert.AreEqual(15000m, ((SalaryMonthlyConcept)payTer[payTag]).AmountMonthly);
        }
Пример #15
0
        public void GivenNONONOEmployeeClaimsTaxBenefitOnDisability(string flag1, string flag2, string flag3)
        {
            uint yes_no = Capture3bool(flag1, flag2, flag3);

            var relief_payers_value = new Dictionary <string, object>()
            {
                { "relief_code_1", (yes_no % 10) },
                { "relief_code_2", ((yes_no / 10) % 10) },
                { "relief_code_3", ((yes_no / 100) % 10) }
            };

            PayProcess.AddTerm(PayTagGateway.REF_TAX_CLAIM_DISABILITY, relief_payers_value);
        }
Пример #16
0
        public void GivenEmployeeWorksInWeeklyScheduleHours(int hoursWeekly)
        {
            var schedule_work_value = new Dictionary <string, object>()
            {
                { "hours_weekly", hoursWeekly }
            };
            var schedule_term_value = new Dictionary <string, object>()
            {
                { "date_from", null }, { "date_end", null }
            };

            PayProcess.AddTerm(PayTagGateway.REF_SCHEDULE_WORK, schedule_work_value);
            PayProcess.AddTerm(PayTagGateway.REF_SCHEDULE_TERM, schedule_term_value);
        }
        public void test_insert_CodeOrder_6_at_end()
        {
            uint          period      = PayrollPeriod.NOW;
            CodeNameRefer tagCodeName = PayTagGateway.REF_SALARY_BASE;
            var           values1     = new Dictionary <string, object>()
            {
                { "amount_monthly", 1000 }
            };
            var values2 = new Dictionary <string, object>()
            {
                { "amount_monthly", 2000 }
            };
            var values3 = new Dictionary <string, object>()
            {
                { "amount_monthly", 3000 }
            };
            var values4 = new Dictionary <string, object>()
            {
                { "amount_monthly", 4000 }
            };
            var values5 = new Dictionary <string, object>()
            {
                { "amount_monthly", 5000 }
            };

            PayProcess.InsTerm(period, tagCodeName, 3, values3);
            PayProcess.InsTerm(period, tagCodeName, 5, values5);
            PayProcess.InsTerm(period, tagCodeName, 1, values1);
            PayProcess.InsTerm(period, tagCodeName, 4, values4);
            PayProcess.InsTerm(period, tagCodeName, 2, values2);
            var valuesI = new Dictionary <string, object>()
            {
                { "amount_monthly", 15000 }
            };
            TagRefer payTag = PayProcess.AddTerm(tagCodeName, valuesI);

            Assert.AreEqual((uint)6, payTag.CodeOrder);
        }
Пример #18
0
        void TestPayrollProcessWithSpec(IDictionary <string, object> specs, IDictionary <string, object> results)
        {
            var EMPTY_VALUES = new Dictionary <string, object>()
            {
            };

            var    testSpec            = specs;
            string testSpecName        = S_GET_FROM(testSpec, "name");
            var    schedule_work_value = I_MAKE_HASH("hours_weekly", I_GET_FROM(testSpec, "schedule"));
            var    schedule_term_value = new Dictionary <string, object>()
            {
                { "date_from", null }, { "date_end", null }
            };

            PayProcess.AddTerm(REF_SCHEDULE_WORK, schedule_work_value);
            PayProcess.AddTerm(REF_SCHEDULE_TERM, schedule_term_value);
            var absence_hours_value = I_MAKE_HASH("hours", I_GET_FROM(testSpec, "absence"));

            PayProcess.AddTerm(REF_HOURS_ABSENCE, absence_hours_value);
            var salary_amount_value = D_MAKE_HASH(@"amount_monthly", D_GET_FROM(testSpec, @"salary"));

            PayProcess.AddTerm(REF_SALARY_BASE, salary_amount_value);
            uint yes_no1         = U_GET_FROM(testSpec, @"tax payer");
            uint tax_interest    = yes_no1 != 0 ? 1u : 0u;
            uint tax_declare     = yes_no1 == 3 ? 1u : 0u;
            var  interest_value1 = new Dictionary <string, object>()
            {
                { "interest_code", tax_interest },
                { "declare_code", tax_declare }
            };

            PayProcess.AddTerm(REF_TAX_INCOME_BASE, interest_value1);
            uint yes_no2         = U_GET_FROM(testSpec, "health payer");
            uint minim           = U_GET_FROM(testSpec, "health minim");
            var  interest_value2 = new Dictionary <string, object>()
            {
                { "interest_code", yes_no2 },
                { "minimum_asses", minim }
            };

            PayProcess.AddTerm(REF_INSURANCE_HEALTH_BASE, interest_value2);
            PayProcess.AddTerm(REF_INSURANCE_HEALTH, interest_value2);
            uint yes_no3         = U_GET_FROM(testSpec, "social payer");
            var  interest_value3 = U_MAKE_HASH("interest_code", yes_no3);

            PayProcess.AddTerm(REF_INSURANCE_SOCIAL_BASE, interest_value3);
            PayProcess.AddTerm(REF_INSURANCE_SOCIAL, interest_value3);
            uint yes_no4         = U_GET_FROM(testSpec, "pension payer");
            var  interest_value4 = I_MAKE_HASH("interest_code", yes_no4);

            PayProcess.AddTerm(REF_SAVINGS_PENSIONS, interest_value4);
            uint yes_no5       = U_GET_FROM(testSpec, "tax payer benefit");
            var  relief_value1 = U_MAKE_HASH("relief_code", yes_no5);

            PayProcess.AddTerm(REF_TAX_CLAIM_PAYER, relief_value1);
            uint count         = U_GET_FROM(testSpec, "tax child benefit");
            var  relief_value2 = U_MAKE_HASH("relief_code", 1u);

            for (int i = 0; i < count; i++)
            {
                PayProcess.AddTerm(REF_TAX_CLAIM_CHILD, relief_value2);
            }
            uint yes_no6       = U_GET_FROM(testSpec, "tax disability benefit");
            var  relief_value3 = new Dictionary <string, object>()
            {
                { "relief_code_1", (yes_no6 % 10) },
                { "relief_code_2", ((yes_no6 / 10) % 10) },
                { "relief_code_3", ((yes_no6 / 100) % 10) }
            };

            PayProcess.AddTerm(REF_TAX_CLAIM_DISABILITY, relief_value3);
            uint yes_no7       = U_GET_FROM(testSpec, "tax studying benefit");
            var  relief_value4 = U_MAKE_HASH("relief_code", yes_no7);

            PayProcess.AddTerm(REF_TAX_CLAIM_STUDYING, relief_value4);
            uint yes_no8         = U_GET_FROM(testSpec, "health employer");
            var  interest_value5 = U_MAKE_HASH("interest_code", yes_no8);

            PayProcess.AddTerm(REF_TAX_EMPLOYERS_HEALTH, interest_value5);
            uint yes_no9         = U_GET_FROM(testSpec, "social employer");
            var  interest_value6 = U_MAKE_HASH("interest_code", yes_no9);

            PayProcess.AddTerm(REF_TAX_EMPLOYERS_SOCIAL, interest_value6);

            PayProcess.AddTerm(REF_INCOME_GROSS, EMPTY_VALUES);
            TagRefer evResultTermTag = PayProcess.AddTerm(REF_INCOME_NETTO, EMPTY_VALUES);
            var      evResultDictVal = PayProcess.Evaluate(evResultTermTag);

            var      testResults = results;
            TagRefer resultTag   = new TagRefer(PayrollPeriod.NOW, (uint)TagCode.TAG_INCOME_NETTO, 1u);
            decimal  result01    = D_GET_FROM(testResults, @"tax income");
            decimal  result02    = D_GET_FROM(testResults, @"premium insurance");
            decimal  result03    = D_GET_FROM(testResults, @"tax base");
            decimal  result04    = D_GET_FROM(testResults, @"health base");
            decimal  result05    = D_GET_FROM(testResults, @"social base");
            decimal  result06    = D_GET_FROM(testResults, @"health ins");
            decimal  result07    = D_GET_FROM(testResults, @"social ins");
            decimal  result08    = D_GET_FROM(testResults, @"tax before");
            decimal  result09    = D_GET_FROM(testResults, @"payer relief");
            decimal  result10    = D_GET_FROM(testResults, @"tax after A relief");
            decimal  result11    = D_GET_FROM(testResults, @"child relief");
            decimal  result12    = D_GET_FROM(testResults, @"tax after C relief");
            decimal  result13    = D_GET_FROM(testResults, @"tax advance");
            decimal  result14    = D_GET_FROM(testResults, @"tax bonus");
            decimal  result15    = D_GET_FROM(testResults, @"gross income");
            decimal  result16    = D_GET_FROM(testResults, @"netto income");

            decimal testVal01  = GetResultIncomeBase(REF_TAX_INCOME_BASE);
            decimal testVal02a = GetResultPayment(REF_TAX_EMPLOYERS_HEALTH);
            decimal testVal02b = GetResultPayment(REF_TAX_EMPLOYERS_SOCIAL);
            decimal testVal03  = GetResultIncomeBase(REF_TAX_ADVANCE_BASE);
            decimal testVal03w = GetResultIncomeBase(REF_TAX_WITHHOLD_BASE);
            decimal testVal04  = GetResultEmployeeBase(REF_INSURANCE_HEALTH_BASE);
            decimal testVal05  = GetResultEmployeeBase(REF_INSURANCE_SOCIAL_BASE);
            decimal testVal06  = GetResultPayment(REF_INSURANCE_HEALTH);
            decimal testVal07  = GetResultPayment(REF_INSURANCE_SOCIAL);
            decimal testVal08  = GetResultPayment(REF_TAX_ADVANCE);
            decimal testVal09  = GetResultTaxRelief(REF_TAX_RELIEF_PAYER);
            decimal testVal10  = GetResultAfterReliefA(REF_TAX_ADVANCE_FINAL);
            decimal testVal11  = GetResultTaxRelief(REF_TAX_RELIEF_CHILD);
            decimal testVal12  = GetResultAfterReliefC(REF_TAX_ADVANCE_FINAL);
            decimal testVal13  = GetResultPayment(REF_TAX_ADVANCE_FINAL);
            decimal testVal14  = GetResultPayment(REF_TAX_BONUS_CHILD);
            decimal testVal15  = GetResultAmount(REF_INCOME_GROSS);
            decimal testVal16  = GetResultAmount(REF_INCOME_NETTO);
            decimal testVal02  = decimal.Add(testVal02a, testVal02b);

            Assert.AreEqual(testVal01, result01, @"tax income         should be {0} CZK, NOT {1}!", result01, testVal01);
            Assert.AreEqual(testVal02, result02, @"premium insurance  should be {0} CZK, NOT {1}!", result02, testVal02);
            Assert.AreEqual(testVal03, result03, @"tax base           should be {0} CZK, NOT {1}!", result03, testVal03);
            Assert.AreEqual(testVal04, result04, @"health base        should be {0} CZK, NOT {1}!", result04, testVal04);
            Assert.AreEqual(testVal05, result05, @"social base        should be {0} CZK, NOT {1}!", result05, testVal05);
            Assert.AreEqual(testVal06, result06, @"health ins         should be {0} CZK, NOT {1}!", result06, testVal06);
            Assert.AreEqual(testVal07, result07, @"social ins         should be {0} CZK, NOT {1}!", result07, testVal07);
            Assert.AreEqual(testVal08, result08, @"tax before         should be {0} CZK, NOT {1}!", result08, testVal08);
            Assert.AreEqual(testVal09, result09, @"payer relief       should be {0} CZK, NOT {1}!", result09, testVal09);
            Assert.AreEqual(testVal10, result10, @"tax after A relief should be {0} CZK, NOT {1}!", result10, testVal10);
            Assert.AreEqual(testVal11, result11, @"child relief       should be {0} CZK, NOT {1}!", result11, testVal11);
            Assert.AreEqual(testVal12, result12, @"tax after C relief should be {0} CZK, NOT {1}!", result12, testVal12);
            Assert.AreEqual(testVal13, result13, @"tax advance        should be {0} CZK, NOT {1}!", result13, testVal13);
            Assert.AreEqual(testVal14, result14, @"tax bonus          should be {0} CZK, NOT {1}!", result14, testVal14);
            Assert.AreEqual(testVal15, result15, @"gross income       should be {0} CZK, NOT {1}!", result15, testVal15);
            Assert.AreEqual(testVal16, result16, @"netto income       should be {0} CZK, NOT {1}!", result16, testVal16);
        }